summaryrefslogtreecommitdiff
path: root/basic
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2014-05-20 22:37:12 +0200
committerAndras Timar <andras.timar@collabora.com>2014-06-02 19:01:51 +0200
commitaa44b5415af1f0dde89dc6f5bba578336f735016 (patch)
treea588b7720cb9b5ff951f29dd3de7b320a35cd73f /basic
parentfc5e3724794b81aa995bc08fd61a7781c7ddf38c (diff)
fdo#68983: Revert "remove #if 0 block (from ...
... af34774d260a68fc02cd78ba90dd8d4afaf1a2a4)" This reverts commit cbd1a89676f39135ed2e9c47d20475b2053289b9. Conflicts: basic/source/uno/namecont.cxx Change-Id: I665f2e875c6b339ad718ca53fd0e54328efaeaff (cherry picked from commit 0e21019e0d61911b4c0ddef07691e9f9f6384cba) Reviewed-on: https://gerrit.libreoffice.org/9435 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'basic')
-rw-r--r--basic/source/uno/namecont.cxx60
1 files changed, 44 insertions, 16 deletions
diff --git a/basic/source/uno/namecont.cxx b/basic/source/uno/namecont.cxx
index f3b32d9866fa..357f2e0c4bed 100644
--- a/basic/source/uno/namecont.cxx
+++ b/basic/source/uno/namecont.cxx
@@ -1905,29 +1905,57 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto
if( pImplLib->implIsModified() || bComplete )
{
- {
- uno::Reference< embed::XStorage > xLibraryStor;
- if( bStorage )
+// 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
+// is in sync with the library container's own storage. Currently
+// whenever the library model is written to *any* storage
+// pImplLib->implSetModified( sal_False ) is called
+// The way the code works, especially the way that sfx uses
+// 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
+ // Can we simply copy the storage?
+ if( !mbOldInfoFormat && !pImplLib->implIsModified() && !mbOasis2OOoFormat && xSourceLibrariesStor.is() )
{
try
{
- xLibraryStor = xTargetLibrariesStor->openStorageElement(
- rLib.aName,
- embed::ElementModes::READWRITE );
+ xSourceLibrariesStor->copyElementTo( rLib.aName, xTargetLibrariesStor, rLib.aName );
}
- catch(const uno::Exception& )
+ catch( const uno::Exception& )
{
- #if OSL_DEBUG_LEVEL > 0
- Any aError( ::cppu::getCaughtException() );
- SAL_WARN(
- "basic",
- "couldn't create sub storage for library \""
- << rLib.aName << "\". Exception: "
- << comphelper::anyToString(aError));
- #endif
- throw;
+ DBG_UNHANDLED_EXCEPTION();
+ // TODO: error handling?
}
}
+ else
+#endif
+ {
+ uno::Reference< embed::XStorage > xLibraryStor;
+ if( bStorage )
+ {
+ try
+ {
+ xLibraryStor = xTargetLibrariesStor->openStorageElement(
+ rLib.aName,
+ embed::ElementModes::READWRITE );
+ }
+ catch(const uno::Exception& )
+ {
+ #if OSL_DEBUG_LEVEL > 0
+ Any aError( ::cppu::getCaughtException() );
+ SAL_WARN(
+ "basic",
+ "couldn't create sub storage for library \""
+ << rLib.aName << "\". Exception: "
+ << comphelper::anyToString(aError));
+ #endif
+ throw;
+ }
+ }
// Maybe lib is not loaded?!
if( bComplete )