diff options
author | Frank Schoenheit [fs] <frank.schoenheit@sun.com> | 2010-02-16 15:31:07 +0100 |
---|---|---|
committer | Frank Schoenheit [fs] <frank.schoenheit@sun.com> | 2010-02-16 15:31:07 +0100 |
commit | 71fea37da21c17f147c756c782d25e207dc780c0 (patch) | |
tree | 840a557569878f8a53bc7bd713ef4bb74638cf20 /dbaccess | |
parent | 75885acffbfe4a39c95cd2267c390a528cb108fe (diff) |
autorecovery: do the recovery in setCurrentController, not in connectController - this ensures all knittings, in particular between controller and frame, already happened
Diffstat (limited to 'dbaccess')
-rw-r--r-- | dbaccess/source/core/dataaccess/databasedocument.cxx | 46 | ||||
-rw-r--r-- | dbaccess/source/core/dataaccess/databasedocument.hxx | 6 |
2 files changed, 30 insertions, 22 deletions
diff --git a/dbaccess/source/core/dataaccess/databasedocument.cxx b/dbaccess/source/core/dataaccess/databasedocument.cxx index bf4b5a12b..14d1af191 100644 --- a/dbaccess/source/core/dataaccess/databasedocument.cxx +++ b/dbaccess/source/core/dataaccess/databasedocument.cxx @@ -145,7 +145,7 @@ bool ViewMonitor::onControllerConnected( const Reference< XController >& _rxCont } //-------------------------------------------------------------------------- -void ViewMonitor::onSetCurrentController( const Reference< XController >& _rxController ) +bool ViewMonitor::onSetCurrentController( const Reference< XController >& _rxController ) { // we interpret this as "loading the document (including UI) is finished", // if and only if this is the controller which was last connected, and it was the @@ -155,6 +155,8 @@ void ViewMonitor::onSetCurrentController( const Reference< XController >& _rxCon // notify the respective events if ( bLoadFinished ) m_rEventNotifier.notifyDocumentEventAsync( m_bIsNewDocument ? "OnNew" : "OnLoad" ); + + return bLoadFinished; } //============================================================ @@ -795,25 +797,6 @@ void SAL_CALL ODatabaseDocument::connectController( const Reference< XController // check/adjust our macro mode. m_pImpl->checkMacrosOnLoading(); - - // check if there are sub components to recover from our document storage - bool bAttemptRecovery = m_bHasBeenRecovered; - if ( !bAttemptRecovery && m_pImpl->getMediaDescriptor().has( "ForceRecovery" ) ) - // do not use getOrDefault, it will throw for invalid types, which is not desired here - m_pImpl->getMediaDescriptor().get( "ForceRecovery" ) >>= bAttemptRecovery; - - if ( !bAttemptRecovery ) - return; - - try - { - DatabaseDocumentRecovery aDocRecovery( m_pImpl->m_aContext ); - aDocRecovery.recoverSubDocuments( m_pImpl->getRootStorage(), _xController ); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } } // ----------------------------------------------------------------------------- @@ -900,8 +883,29 @@ void SAL_CALL ODatabaseDocument::setCurrentController( const Reference< XControl m_xCurrentController = _xController; - m_aViewMonitor.onSetCurrentController( _xController ); + if ( !m_aViewMonitor.onSetCurrentController( _xController ) ) + return; + + // check if there are sub components to recover from our document storage + bool bAttemptRecovery = m_bHasBeenRecovered; + if ( !bAttemptRecovery && m_pImpl->getMediaDescriptor().has( "ForceRecovery" ) ) + // do not use getOrDefault, it will throw for invalid types, which is not desired here + m_pImpl->getMediaDescriptor().get( "ForceRecovery" ) >>= bAttemptRecovery; + + if ( !bAttemptRecovery ) + return; + + try + { + DatabaseDocumentRecovery aDocRecovery( m_pImpl->m_aContext ); + aDocRecovery.recoverSubDocuments( m_pImpl->getRootStorage(), _xController ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } } + // ----------------------------------------------------------------------------- Reference< XInterface > SAL_CALL ODatabaseDocument::getCurrentSelection( ) throw (RuntimeException) { diff --git a/dbaccess/source/core/dataaccess/databasedocument.hxx b/dbaccess/source/core/dataaccess/databasedocument.hxx index 93a992817..ebe95d261 100644 --- a/dbaccess/source/core/dataaccess/databasedocument.hxx +++ b/dbaccess/source/core/dataaccess/databasedocument.hxx @@ -125,8 +125,12 @@ public: ); /** to be called when a controller is set as current controller + @return <TRUE/> + if and only if the controller connection indicates that loading the document is finished. This + is the case if the given controller has previously been connected, and it was the first controller + ever for which this happened. */ - void onSetCurrentController( + bool onSetCurrentController( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController >& _rxController ); |