summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrank Schoenheit [fs] <frank.schoenheit@sun.com>2010-01-28 22:19:50 +0100
committerFrank Schoenheit [fs] <frank.schoenheit@sun.com>2010-01-28 22:19:50 +0100
commit67f02ec2e2aea15b32883ee479457fcc1fdfc806 (patch)
treed438e929ddb3861b83c5ead50ed3c3f9c57db602
parent42614dac6359f8ea3a3446f089f17b5054dbe50b (diff)
autorecovery: move the responsibility for calling attachResource into recoverFromFile. This saves us from some problems with SFX-based documents, which change there Args during the load process (during macro confirmation), so a later attachResource from outside would overwrite those changed args
-rw-r--r--dbaccess/source/core/dataaccess/databasedocument.cxx23
-rw-r--r--dbaccess/source/core/dataaccess/databasedocument.hxx17
2 files changed, 34 insertions, 6 deletions
diff --git a/dbaccess/source/core/dataaccess/databasedocument.cxx b/dbaccess/source/core/dataaccess/databasedocument.cxx
index 67e97110ad0f..64b667e89d14 100644
--- a/dbaccess/source/core/dataaccess/databasedocument.cxx
+++ b/dbaccess/source/core/dataaccess/databasedocument.cxx
@@ -668,6 +668,11 @@ void SAL_CALL ODatabaseDocument::recoverFromFile( const ::rtl::OUString& i_Sourc
// Without a controller, we are unable to recover the sub components, as they're always tied to a controller.
// So, everything else is done when the first controller is connected.
m_bHasBeenRecovered = true;
+
+ // by definition (of XDocumentRecovery), we're responsible for delivering a fully-initialized document,
+ // which includes an attachResource call.
+ impl_attachResource( i_SourceLocation, aMediaDescriptor.getPropertyValues(), aGuard );
+ // <- SYNCHRONIZED
}
catch( const Exception& )
{
@@ -690,10 +695,16 @@ void SAL_CALL ODatabaseDocument::recoverFromFile( const ::rtl::OUString& i_Sourc
sal_Bool SAL_CALL ODatabaseDocument::attachResource( const ::rtl::OUString& _rURL, const Sequence< PropertyValue >& _rArguments ) throw (RuntimeException)
{
DocumentGuard aGuard( *this, DocumentGuard::MethodUsedDuringInit );
+ return impl_attachResource( _rURL, _rArguments, aGuard );
+}
- if ( ( _rURL == getURL() )
- && ( _rArguments.getLength() == 1 )
- && ( _rArguments[0].Name.compareToAscii( "BreakMacroSignature" ) == 0 )
+// -----------------------------------------------------------------------------
+sal_Bool ODatabaseDocument::impl_attachResource( const ::rtl::OUString& i_rURL, const Sequence< PropertyValue >& i_rMediaDescriptor,
+ DocumentGuard& _rDocGuard )
+{
+ if ( ( i_rURL == getURL() )
+ && ( i_rMediaDescriptor.getLength() == 1 )
+ && ( i_rMediaDescriptor[0].Name.compareToAscii( "BreakMacroSignature" ) == 0 )
)
{
// this is a BAD hack of the Basic importer code ... there should be a dedicated API for this,
@@ -703,13 +714,13 @@ sal_Bool SAL_CALL ODatabaseDocument::attachResource( const ::rtl::OUString& _rUR
}
// if no URL has been provided, the caller was lazy enough to not call our getLocation/getURL - which is allowed ...
- ::rtl::OUString sURL( _rURL );
+ ::rtl::OUString sURL( i_rURL );
if ( !sURL.getLength() )
sURL = getLocation();
if ( !sURL.getLength() )
sURL = getURL();
- m_pImpl->attachResource( sURL, _rArguments );
+ m_pImpl->attachResource( sURL, i_rMediaDescriptor );
if ( impl_isInitializing() )
{ // this means we've just been loaded, and this is the attachResource call which follows
@@ -721,7 +732,7 @@ sal_Bool SAL_CALL ODatabaseDocument::attachResource( const ::rtl::OUString& _rUR
// should know this before anybody actually uses the object.
m_bAllowDocumentScripting = ( m_pImpl->determineEmbeddedMacros() != ODatabaseModelImpl::eSubDocumentMacros );
- aGuard.clear();
+ _rDocGuard.clear();
// <- SYNCHRONIZED
m_aEventNotifier.notifyDocumentEvent( "OnLoadFinished" );
}
diff --git a/dbaccess/source/core/dataaccess/databasedocument.hxx b/dbaccess/source/core/dataaccess/databasedocument.hxx
index 446a344dfebc..f3206fbc15ae 100644
--- a/dbaccess/source/core/dataaccess/databasedocument.hxx
+++ b/dbaccess/source/core/dataaccess/databasedocument.hxx
@@ -609,6 +609,23 @@ private:
const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rMediaDescriptor,
DocumentGuard& _rDocGuard
) const;
+
+
+ /** impl-version of attachResource
+
+ @param i_rURL
+ denotes the URL the document was loaded from
+ @param i_rMediaDescriptor
+ denotes additional document parameters
+ @param _rDocGuard
+ is the guard which currently protects the document instance
+
+ */
+ sal_Bool impl_attachResource(
+ const ::rtl::OUString& i_rURL,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& i_rMediaDescriptor,
+ DocumentGuard& _rDocGuard
+ );
};
/** an extended version of the ModelMethodGuard, which also cares for the initialization state