summaryrefslogtreecommitdiff
path: root/basic
diff options
context:
space:
mode:
Diffstat (limited to 'basic')
-rw-r--r--basic/source/inc/namecont.hxx4
-rw-r--r--basic/source/inc/scriptcont.hxx1
-rw-r--r--basic/source/uno/namecont.cxx17
-rw-r--r--basic/source/uno/scriptcont.cxx6
4 files changed, 23 insertions, 5 deletions
diff --git a/basic/source/inc/namecont.hxx b/basic/source/inc/namecont.hxx
index 0568a9814631..6a04d9dd4a5c 100644
--- a/basic/source/inc/namecont.hxx
+++ b/basic/source/inc/namecont.hxx
@@ -582,7 +582,9 @@ private:
sal_Bool mbReadOnlyLink;
sal_Bool mbPreload;
+protected:
sal_Bool mbPasswordProtected;
+private:
sal_Bool mbPasswordVerified;
bool mbDoc50Password;
OUString maPassword;
@@ -702,6 +704,8 @@ public:
}
protected:
+ virtual bool isLoadedStorable();
+
virtual bool SAL_CALL isLibraryElementValid( ::com::sun::star::uno::Any aElement ) const = 0;
};
diff --git a/basic/source/inc/scriptcont.hxx b/basic/source/inc/scriptcont.hxx
index 357c66336b6e..d9abeb529061 100644
--- a/basic/source/inc/scriptcont.hxx
+++ b/basic/source/inc/scriptcont.hxx
@@ -154,6 +154,7 @@ class SfxScriptLibrary : public SfxLibrary, public SfxScriptLibrary_BASE
const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler );
virtual void storeResourcesToStorage( const ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XStorage >& xStorage );
+ virtual bool isLoadedStorable() SAL_OVERRIDE;
public:
SfxScriptLibrary
diff --git a/basic/source/uno/namecont.cxx b/basic/source/uno/namecont.cxx
index 20e2bb39cb4c..28efa643f767 100644
--- a/basic/source/uno/namecont.cxx
+++ b/basic/source/uno/namecont.cxx
@@ -1920,8 +1920,6 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto
if( pImplLib->implIsModified() || bComplete )
{
-// For the moment don't copy storage (as an optimisation )
-// but instead always write to storage from memory.
// Testing pImplLib->implIsModified() is not reliable,
// IMHO the value of pImplLib->implIsModified() should
// reflect whether the library ( in-memory ) model
@@ -1932,9 +1930,14 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto
// temp storage when saving ( and later sets the root storage of the
// library container ) and similar madness in dbaccess means some surgery
// is required to make it possible to successfully use this optimisation
-#if 0
+// It would be possible to do the implSetModified() call below only
+// conditionally, but that would require an additional boolean to be
+// passed in via the XStorageBasedDocument::storeLibrariesToStorage()...
+// fdo#68983: If there's a password and the password is not known, only
+// copying the storage works!
// Can we simply copy the storage?
- if( !mbOldInfoFormat && !pImplLib->implIsModified() && !mbOasis2OOoFormat && xSourceLibrariesStor.is() )
+ if (!mbOldInfoFormat && !pImplLib->isLoadedStorable() &&
+ !mbOasis2OOoFormat && xSourceLibrariesStor.is())
{
try
{
@@ -1947,7 +1950,6 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto
}
}
else
-#endif
{
uno::Reference< embed::XStorage > xLibraryStor;
if( bStorage )
@@ -3051,6 +3053,11 @@ SfxLibrary::SfxLibrary( ModifiableHelper& _rModifiable, const Type& aType,
{
}
+bool SfxLibrary::isLoadedStorable()
+{
+ return mbLoaded && (!mbPasswordProtected || mbPasswordVerified);
+}
+
void SfxLibrary::implSetModified( sal_Bool _bIsModified )
{
if ( mbIsModified == _bIsModified )
diff --git a/basic/source/uno/scriptcont.cxx b/basic/source/uno/scriptcont.cxx
index e8c92cff7183..e1f0c9da45f5 100644
--- a/basic/source/uno/scriptcont.cxx
+++ b/basic/source/uno/scriptcont.cxx
@@ -1259,6 +1259,12 @@ SfxScriptLibrary::SfxScriptLibrary( ModifiableHelper& _rModifiable,
{
}
+bool SfxScriptLibrary::isLoadedStorable()
+{
+ // note: mbLoadedSource can only be true for password-protected lib!
+ return SfxLibrary::isLoadedStorable() && (!mbPasswordProtected || mbLoadedSource);
+}
+
// Provide modify state including resources
sal_Bool SfxScriptLibrary::isModified( void )
{