diff options
Diffstat (limited to 'dbaccess/source/core/dataaccess')
-rw-r--r-- | dbaccess/source/core/dataaccess/ModelImpl.cxx | 7 | ||||
-rw-r--r-- | dbaccess/source/core/dataaccess/databasedocument.cxx | 25 |
2 files changed, 24 insertions, 8 deletions
diff --git a/dbaccess/source/core/dataaccess/ModelImpl.cxx b/dbaccess/source/core/dataaccess/ModelImpl.cxx index 4f360bfc1ee9..7c175ab5eeb5 100644 --- a/dbaccess/source/core/dataaccess/ModelImpl.cxx +++ b/dbaccess/source/core/dataaccess/ModelImpl.cxx @@ -374,6 +374,7 @@ ODatabaseModelImpl::ODatabaseModelImpl( const Reference< XComponentContext >& _r ,m_bSuppressVersionColumns(true) ,m_bModified(false) ,m_bDocumentReadOnly(false) + ,m_bMacroCallsSeenWhileLoading(false) ,m_pSharedConnectionManager(nullptr) ,m_nControllerLockCount(0) { @@ -407,6 +408,7 @@ ODatabaseModelImpl::ODatabaseModelImpl( ,m_bSuppressVersionColumns(true) ,m_bModified(false) ,m_bDocumentReadOnly(false) + ,m_bMacroCallsSeenWhileLoading(false) ,m_pSharedConnectionManager(nullptr) ,m_nControllerLockCount(0) { @@ -1271,6 +1273,11 @@ bool ODatabaseModelImpl::documentStorageHasMacros() const return ( *m_aEmbeddedMacros != eNoMacros ); } +bool ODatabaseModelImpl::macroCallsSeenWhileLoading() const +{ + return m_bMacroCallsSeenWhileLoading; +} + Reference< XEmbeddedScripts > ODatabaseModelImpl::getEmbeddedDocumentScripts() const { return Reference< XEmbeddedScripts >( getModel_noCreate(), UNO_QUERY ); diff --git a/dbaccess/source/core/dataaccess/databasedocument.cxx b/dbaccess/source/core/dataaccess/databasedocument.cxx index e84af4dfe653..cf133627ef37 100644 --- a/dbaccess/source/core/dataaccess/databasedocument.cxx +++ b/dbaccess/source/core/dataaccess/databasedocument.cxx @@ -747,15 +747,24 @@ sal_Bool SAL_CALL ODatabaseDocument::attachResource( const OUString& _rURL, cons bool ODatabaseDocument::impl_attachResource( const OUString& i_rLogicalDocumentURL, const Sequence< PropertyValue >& i_rMediaDescriptor, DocumentGuard& _rDocGuard ) { - if ( ( i_rLogicalDocumentURL == getURL() ) - && ( i_rMediaDescriptor.getLength() == 1 ) - && ( i_rMediaDescriptor[0].Name == "BreakMacroSignature" ) - ) + if (i_rLogicalDocumentURL == getURL()) { - // this is a BAD hack of the Basic importer code ... there should be a dedicated API for this, - // not this bad mis-using of existing interfaces - return false; - // (we do not support macro signatures, so we can ignore this call) + ::comphelper::NamedValueCollection aArgs(i_rMediaDescriptor); + + // this misuse of attachresource is a hack of the Basic importer code + // repurposing existing interfaces for uses it probably wasn't intended + // for + + // we do not support macro signatures, so we can ignore that request + aArgs.remove("BreakMacroSignature"); + + bool bMacroEventRead = false; + if ((aArgs.get( "MacroEventRead" ) >>= bMacroEventRead) && bMacroEventRead) + m_pImpl->m_bMacroCallsSeenWhileLoading = true; + aArgs.remove( "MacroEventRead" ); + + if (aArgs.empty()) + return false; } // if no URL has been provided, the caller was lazy enough to not call our getURL - which is not allowed anymore, |