diff options
Diffstat (limited to 'dbaccess/source/ui/misc/singledoccontroller.cxx')
-rw-r--r-- | dbaccess/source/ui/misc/singledoccontroller.cxx | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/dbaccess/source/ui/misc/singledoccontroller.cxx b/dbaccess/source/ui/misc/singledoccontroller.cxx index 4275339c159a..2ef890cd8713 100644 --- a/dbaccess/source/ui/misc/singledoccontroller.cxx +++ b/dbaccess/source/ui/misc/singledoccontroller.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: singledoccontroller.cxx,v $ - * $Revision: 1.30 $ + * $Revision: 1.30.24.2 $ * * This file is part of OpenOffice.org. * @@ -155,13 +155,15 @@ namespace dbaui sal_Bool m_bSuspended; // is true when the controller was already suspended sal_Bool m_bEditable; // is the control readonly or not sal_Bool m_bModified; // is the data modified + bool m_bNotAttached; OSingleDocumentControllerImpl() :m_aDocScriptSupport() - ,m_nDocStartNumber(1) + ,m_nDocStartNumber(0) ,m_bSuspended( sal_False ) ,m_bEditable(sal_True) ,m_bModified(sal_False) + ,m_bNotAttached(true) { } @@ -288,6 +290,14 @@ namespace dbaui } OSL_POSTCOND( m_pImpl->m_aDataSource.is(), "OSingleDocumentController::initializeConnection: unable to obtain the data source object!" ); + if ( m_pImpl->m_bNotAttached ) + { + Reference< XUntitledNumbers > xUntitledProvider( getDatabaseDocument(), UNO_QUERY ); + m_pImpl->m_nDocStartNumber = 1; + if ( xUntitledProvider.is() ) + m_pImpl->m_nDocStartNumber = xUntitledProvider->leaseNumber( static_cast< XWeak* >( this ) ); + } + // determine the availability of script support in our document. Our own XScriptInvocationContext // interface depends on this m_pImpl->setDocumentScriptSupport( Reference< XEmbeddedScripts >( getDatabaseDocument(), UNO_QUERY ).is() ); @@ -471,9 +481,15 @@ namespace dbaui // ----------------------------------------------------------------------------- sal_Bool SAL_CALL OSingleDocumentController::attachModel( const Reference< XModel > & _rxModel) throw( RuntimeException ) { + if ( !_rxModel.is() ) + return sal_False; if ( !OSingleDocumentController_Base::attachModel( _rxModel ) ) return sal_False; + m_pImpl->m_bNotAttached = false; + if ( m_pImpl->m_nDocStartNumber == 1 ) + releaseNumberForComponent(); + Reference< XUntitledNumbers > xUntitledProvider( _rxModel, UNO_QUERY ); m_pImpl->m_nDocStartNumber = 1; if ( xUntitledProvider.is() ) |