Tag: cws_src680_dba24c User: fs Date: 2007-10-22 08:24:31+0000 Modified: dba/dbaccess/source/core/dataaccess/ModelImpl.cxx dba/dbaccess/source/core/dataaccess/ModelImpl.hxx
Log: #i52527#/#i73705#: use an ::sfx2::DocumentMacroMode to handle the MacroExecutionMode at level of the DB document as a whole (implementation not yet finished) File Changes: Directory: /dba/dbaccess/source/core/dataaccess/ ================================================ File [changed]: ModelImpl.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/dataaccess/ModelImpl.cxx?r1=1.19&r2=1.19.22.1 Delta lines: +100 -108 ----------------------- --- ModelImpl.cxx 2007-07-24 12:04:04+0000 1.19 +++ ModelImpl.cxx 2007-10-22 08:24:28+0000 1.19.22.1 @@ -4,9 +4,9 @@ * * $RCSfile: ModelImpl.cxx,v $ * - * $Revision: 1.19 $ + * $Revision: 1.19.22.1 $ * - * last change: $Author: rt $ $Date: 2007/07/24 12:04:04 $ + * last change: $Author: fs $ $Date: 2007/10/22 08:24:28 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -36,123 +36,51 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_dbaccess.hxx" -#ifndef _DBA_COREDATAACCESS_MODELIMPL_HXX_ -#include "ModelImpl.hxx" -#endif -#ifndef _DBA_CORE_USERINFORMATION_HXX_ -#include "userinformation.hxx" -#endif -#ifndef _DBA_COREDATAACCESS_COMMANDCONTAINER_HXX_ #include "commandcontainer.hxx" -#endif -#ifndef _TOOLS_DEBUG_HXX -#include <tools/debug.hxx> -#endif -#ifndef TOOLS_DIAGNOSE_EX_H -#include <tools/diagnose_ex.h> -#endif -#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_ -#include <cppuhelper/typeprovider.hxx> -#endif -#ifndef _COMPHELPER_SEQSTREAM_HXX -#include <comphelper/seqstream.hxx> -#endif -#ifndef DBACCESS_SHARED_DBASTRINGS_HRC -#include "dbastrings.hrc" -#endif -#ifndef _DBA_CORE_RESOURCE_HXX_ -#include "core_resource.hxx" -#endif -#ifndef _DBA_CORE_RESOURCE_HRC_ +#include "connection.hxx" #include "core_resource.hrc" -#endif -#ifndef _COMPHELPER_SEQUENCE_HXX_ -#include <comphelper/sequence.hxx> -#endif -#ifndef _DBA_COREDATAACCESS_DATABASECONTEXT_HXX_ +#include "core_resource.hxx" #include "databasecontext.hxx" -#endif -#ifndef _DBA_COREDATAACCESS_DATASOURCE_HXX_ -#include "datasource.hxx" -#endif -#ifndef _DBA_COREDATAACCESS_DATABASEDOCUMENT_HXX_ #include "databasedocument.hxx" -#endif -#ifndef _COM_SUN_STAR_IO_XACTIVEDATASOURCE_HPP_ -#include <com/sun/star/io/XActiveDataSource.hpp> -#endif -#ifndef _COM_SUN_STAR_XML_SAX_XDOCUMENTHANDLER_HPP_ -#include <com/sun/star/xml/sax/XDocumentHandler.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_XDRIVERACCESS_HPP_ -#include <com/sun/star/sdbc/XDriverAccess.hpp> -#endif -#ifndef _COM_SUN_STAR_EMBED_XTRANSACTIONBROADCASTER_HPP_ +#include "datasource.hxx" +#include "dbastrings.hrc" +#include "ModelImpl.hxx" +#include "userinformation.hxx" + +/** === begin UNO includes === **/ +#include <com/sun/star/document/MacroExecMode.hpp> +#include <com/sun/star/document/XExporter.hpp> +#include <com/sun/star/document/XFilter.hpp> +#include <com/sun/star/document/XImporter.hpp> +#include <com/sun/star/embed/XTransactedObject.hpp> #include <com/sun/star/embed/XTransactionBroadcaster.hpp> -#endif -#ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_ +#include <com/sun/star/io/XActiveDataSource.hpp> #include <com/sun/star/lang/DisposedException.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_XDRIVERMANAGER_HPP_ +#include <com/sun/star/reflection/XProxyFactory.hpp> +#include <com/sun/star/sdbc/XDriverAccess.hpp> #include <com/sun/star/sdbc/XDriverManager.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBCX_XTABLESSUPPLIER_HPP_ #include <com/sun/star/sdbcx/XTablesSupplier.hpp> -#endif -#ifndef _COM_SUN_STAR_TASK_XSTATUSINDICATOR_HPP_ #include <com/sun/star/task/XStatusIndicator.hpp> -#endif -#ifndef _COM_SUN_STAR_UCB_XINTERACTIONSUPPLYAUTHENTICATION_HPP_ -#include <com/sun/star/ucb/XInteractionSupplyAuthentication.hpp> -#endif -#ifndef _COM_SUN_STAR_UCB_AUTHENTICATIONREQUEST_HPP_ #include <com/sun/star/ucb/AuthenticationRequest.hpp> -#endif -#ifndef _COM_SUN_STAR_REFLECTION_XPROXYFACTORY_HPP_ -#include <com/sun/star/reflection/XProxyFactory.hpp> -#endif -#ifndef _TYPELIB_TYPEDESCRIPTION_HXX_ -#include <typelib/typedescription.hxx> -#endif -#ifndef _DBHELPER_DBEXCEPTION_HXX_ -#include <connectivity/dbexception.hxx> -#endif -#ifndef _COMPHELPER_INTERACTION_HXX_ +#include <com/sun/star/ucb/XInteractionSupplyAuthentication.hpp> +#include <com/sun/star/view/XSelectionSupplier.hpp> +#include <com/sun/star/xml/sax/XDocumentHandler.hpp> +/** === end UNO includes === **/ + #include <comphelper/interaction.hxx> -#endif -#ifndef _DBA_CORE_CONNECTION_HXX_ -#include "connection.hxx" -#endif -#ifndef _RTL_DIGEST_H_ +#include <comphelper/mediadescriptor.hxx> +#include <comphelper/namedvaluecollection.hxx> +#include <comphelper/seqstream.hxx> +#include <comphelper/sequence.hxx> +#include <connectivity/dbexception.hxx> +#include <cppuhelper/typeprovider.hxx> #include <rtl/digest.h> -#endif -#ifndef _COM_SUN_STAR_EMBED_XTRANSACTEDOBJECT_HPP_ -#include <com/sun/star/embed/XTransactedObject.hpp> -#endif -#ifndef _COM_SUN_STAR_DOCUMENT_XEXPORTER_HPP_ -#include <com/sun/star/document/XExporter.hpp> -#endif -#ifndef _COM_SUN_STAR_DOCUMENT_XFILTER_HPP_ -#include <com/sun/star/document/XFilter.hpp> -#endif -#ifndef _URLOBJ_HXX -#include <tools/urlobj.hxx> -#endif -#ifndef _ERRCODE_HXX +#include <sfx2/signaturestate.hxx> +#include <tools/debug.hxx> +#include <tools/diagnose_ex.h> #include <tools/errcode.hxx> -#endif -#ifndef _COM_SUN_STAR_VIEW_XSELECTIONSUPPLIER_HPP_ -#include <com/sun/star/view/XSelectionSupplier.hpp> -#endif -#ifndef _COM_SUN_STAR_DOCUMENT_XIMPORTER_HPP_ -#include <com/sun/star/document/XImporter.hpp> -#endif -#ifndef _COMPHELPER_MEDIADESCRIPTOR_HXX_ -#include <comphelper/mediadescriptor.hxx> -#endif -#ifndef _COM_SUN_STAR_DOCUMENT_XIMPORTER_HPP_ -#include <com/sun/star/document/XImporter.hpp> -#endif +#include <tools/urlobj.hxx> + #include <algorithm> using namespace ::com::sun::star::document; @@ -400,6 +328,7 @@ ,m_bModified(sal_False) ,m_bDocumentReadOnly(sal_False) ,m_bDisposingSubStorages( sal_False ) + ,m_aMacroMode( *this ) ,m_pDBContext(NULL) ,m_pSharedConnectionManager(NULL) ,m_refCount(0) @@ -432,6 +361,7 @@ ,m_bModified(sal_False) ,m_bDocumentReadOnly(sal_False) ,m_bDisposingSubStorages( sal_False ) + ,m_aMacroMode( *this ) ,m_pDBContext(_pDBContext) ,m_pSharedConnectionManager(NULL) ,m_refCount(0) @@ -1001,6 +931,68 @@ } // ----------------------------------------------------------------------------- +sal_Int16 ODatabaseModelImpl::getImposedMacroExecMode() const +{ + sal_Int16 nMacroExecMode( MacroExecMode::USE_CONFIG ); + try + { + ::comphelper::NamedValueCollection aArgs( m_aArgs ); + nMacroExecMode = aArgs.getOrDefault( "MacroExecutionMode", nMacroExecMode ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + return nMacroExecMode; +} + +// ----------------------------------------------------------------------------- +::rtl::OUString ODatabaseModelImpl::getDocumentLocation() const +{ + // don't return getURL() (or m_sRealFileURL, which is the same). In case we were recovered + // after a previous crash of OOo, m_sFileURL points to the file which were loaded from, + // and this is the one we need for security checks. + return m_sFileURL; +} + +// ----------------------------------------------------------------------------- +Reference< XStorage > ODatabaseModelImpl::getLastCommitDocumentStorage() +{ + // we do not support signing the scripting storages, so we're allowed to + // return <NULL/> here. + return Reference< XStorage >(); +} + +// ----------------------------------------------------------------------------- +bool ODatabaseModelImpl::documentStorageHasMacros() const +{ + // TODO: check all the storages of our embedded forms and reports + return ::sfx2::DocumentMacroMode::storageHasMacros( m_xStorage ); +} + +// ----------------------------------------------------------------------------- +Reference< XEmbeddedScripts > ODatabaseModelImpl::getEmbeddedDocumentScripts() const +{ + // we do not (yet) support embedding scripts directly into the database document + // (but in sub documents only), so we're allowed to return <NULL/> here. + return Reference< XEmbeddedScripts >(); +} + +// ----------------------------------------------------------------------------- +sal_Int16 ODatabaseModelImpl::getScriptingSignatureState() const +{ + // no support for signatures at the moment + return SIGNATURESTATE_NOSIGNATURES; +} + +// ----------------------------------------------------------------------------- +bool ODatabaseModelImpl::checkForBrokenScriptingSignatures( const Reference< XInteractionHandler >& /*_rxInteraction*/ ) +{ + // no support for signatures at the moment, so they're not broken + return false; +} + +// ----------------------------------------------------------------------------- ModelDependentComponent::ModelDependentComponent( const ::rtl::Reference< ODatabaseModelImpl >& _model ) :m_pImpl( _model ) ,m_xMutex( _model->getSharedMutex() ) File [changed]: ModelImpl.hxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/dataaccess/ModelImpl.hxx?r1=1.15&r2=1.15.22.1 Delta lines: +53 -123 ---------------------- --- ModelImpl.hxx 2007-07-24 12:04:18+0000 1.15 +++ ModelImpl.hxx 2007-10-22 08:24:28+0000 1.15.22.1 @@ -4,9 +4,9 @@ * * $RCSfile: ModelImpl.hxx,v $ * - * $Revision: 1.15 $ + * $Revision: 1.15.22.1 $ * - * last change: $Author: rt $ $Date: 2007/07/24 12:04:18 $ + * last change: $Author: fs $ $Date: 2007/10/22 08:24:28 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -36,129 +36,52 @@ #ifndef _DBA_COREDATAACCESS_MODELIMPL_HXX_ #define _DBA_COREDATAACCESS_MODELIMPL_HXX_ -#ifndef _COM_SUN_STAR_UTIL_XNUMBERFORMATSSUPPLIER_HPP_ -#include <com/sun/star/util/XNumberFormatsSupplier.hpp> -#endif -#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_ -#include <com/sun/star/lang/XServiceInfo.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_XDATASOURCE_HPP_ -#include <com/sun/star/sdbc/XDataSource.hpp> -#endif -#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_ +#include "apitools.hxx" +#include "bookmarkcontainer.hxx" +#include "ContentHelper.hxx" +#include "dba_reghelper.hxx" + +/** === begin UNO includes === **/ +#include <com/sun/star/beans/PropertyAttribute.hpp> +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/beans/XPropertyAccess.hpp> +#include <com/sun/star/container/XContainerListener.hpp> +#include <com/sun/star/document/XDocumentSubStorageSupplier.hpp> +#include <com/sun/star/document/XEventListener.hpp> +#include <com/sun/star/document/XStorageBasedDocument.hpp> +#include <com/sun/star/embed/ElementModes.hpp> +#include <com/sun/star/embed/XStorage.hpp> +#include <com/sun/star/embed/XTransactionListener.hpp> +#include <com/sun/star/frame/XModel.hpp> +#include <com/sun/star/frame/XStorable.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> -#endif -#ifndef _COM_SUN_STAR_LANG_XSINGLESERVICEFACTORY_HPP_ +#include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XSingleServiceFactory.hpp> -#endif -#ifndef _COM_SUN_STAR_CONTAINER_XCONTAINERLISTENER_HPP_ -#include <com/sun/star/container/XContainerListener.hpp> -#endif -#ifndef _COM_SUN_STAR_SDB_XBOOKMARKSSUPPLIER_HPP_ #include <com/sun/star/sdb/XBookmarksSupplier.hpp> -#endif -#ifndef _COM_SUN_STAR_SDB_XQUERYDEFINITIONSSUPPLIER_HPP_ +#include <com/sun/star/sdb/XCompletedConnection.hpp> +#include <com/sun/star/sdb/XFormDocumentsSupplier.hpp> #include <com/sun/star/sdb/XQueryDefinitionsSupplier.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_XISOLATEDCONNECTION_HPP_ +#include <com/sun/star/sdb/XReportDocumentsSupplier.hpp> +#include <com/sun/star/sdbc/XDataSource.hpp> #include <com/sun/star/sdbc/XIsolatedConnection.hpp> -#endif -#ifndef _COM_SUN_STAR_UTIL_XNUMBERFORMATSSUPPLIER_HPP_ +#include <com/sun/star/sdbcx/XTablesSupplier.hpp> +#include <com/sun/star/util/XCloseable.hpp> +#include <com/sun/star/util/XFlushable.hpp> +#include <com/sun/star/util/XModifiable.hpp> #include <com/sun/star/util/XNumberFormatsSupplier.hpp> -#endif -#ifndef _COM_SUN_STAR_UTIL_XNUMBERFORMATTER_HPP_ #include <com/sun/star/util/XNumberFormatter.hpp> -#endif -#ifndef _COM_SUN_STAR_DOCUMENT_XEVENTLISTENER_HPP_ -#include <com/sun/star/document/XEventListener.hpp> -#endif -#ifndef _COM_SUN_STAR_UTIL_XFLUSHABLE_HPP_ -#include <com/sun/star/util/XFlushable.hpp> -#endif -#ifndef _CPPUHELPER_PROPSHLP_HXX -#include <cppuhelper/propshlp.hxx> -#endif -#ifndef _COMPHELPER_PROPERTY_ARRAY_HELPER_HXX_ +#include <com/sun/star/util/XRefreshable.hpp> +/** === end UNO includes === **/ + +#include <comphelper/broadcasthelper.hxx> #include <comphelper/proparrhlp.hxx> -#endif -#ifndef _CPPUHELPER_WEAKREF_HXX_ +#include <connectivity/CommonTools.hxx> +#include <cppuhelper/propshlp.hxx> #include <cppuhelper/weakref.hxx> -#endif -#ifndef _DBASHARED_APITOOLS_HXX_ -#include "apitools.hxx" -#endif -#ifndef _DBA_REGHELPER_HXX_ -#include "dba_reghelper.hxx" -#endif -#ifndef _DBA_CORE_BOOKMARKCONTAINER_HXX_ -#include "bookmarkcontainer.hxx" -#endif -#ifndef _VOS_REF_HXX_ -#include <vos/ref.hxx> -#endif -#ifndef _STRING_HXX +#include <sfx2/docmacromode.hxx> #include <tools/string.hxx> -#endif -#ifndef _CONNECTIVITY_COMMONTOOLS_HXX_ -#include <connectivity/CommonTools.hxx> -#endif -#ifndef _COMPHELPER_BROADCASTHELPER_HXX_ -#include <comphelper/broadcasthelper.hxx> -#endif -#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_ -#include <com/sun/star/beans/PropertyAttribute.hpp> -#endif -#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_ -#include <com/sun/star/beans/PropertyValue.hpp> -#endif -#ifndef _COM_SUN_STAR_SDB_XCOMPLETEDCONNECTION_HPP_ -#include <com/sun/star/sdb/XCompletedConnection.hpp> -#endif -#ifndef _COM_SUN_STAR_SDB_XREPORTDOCUMENTSSUPPLIER_HPP_ -#include <com/sun/star/sdb/XReportDocumentsSupplier.hpp> -#endif -#ifndef _COM_SUN_STAR_SDB_XFORMDOCUMENTSSUPPLIER_HPP_ -#include <com/sun/star/sdb/XFormDocumentsSupplier.hpp> -#endif -#ifndef _COM_SUN_STAR_FRAME_XMODEL_HPP_ -#include <com/sun/star/frame/XModel.hpp> -#endif -#ifndef _COM_SUN_STAR_FRAME_XSTORABLE_HPP_ -#include <com/sun/star/frame/XStorable.hpp> -#endif -#ifndef _COM_SUN_STAR_UTIL_XMODIFIABLE_HPP_ -#include <com/sun/star/util/XModifiable.hpp> -#endif -#ifndef _COM_SUN_STAR_UTIL_XCLOSEABLE_HPP_ -#include <com/sun/star/util/XCloseable.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBCX_XTABLESSUPPLIER_HPP_ -#include <com/sun/star/sdbcx/XTablesSupplier.hpp> -#endif -#ifndef _COM_SUN_STAR_EMBED_XSTORAGE_HPP_ -#include <com/sun/star/embed/XStorage.hpp> -#endif -#ifndef DBA_CONTENTHELPER_HXX -#include "ContentHelper.hxx" -#endif -#ifndef _COM_SUN_STAR_DOCUMENT_XDOCUMENTSUBSTORAGESUPPLIER_HPP_ -#include <com/sun/star/document/XDocumentSubStorageSupplier.hpp> -#endif -#ifndef _COM_SUN_STAR_DOCUMENT_XSTORAGEBASEDDOCUMENT_HPP_ -#include <com/sun/star/document/XStorageBasedDocument.hpp> -#endif -#ifndef _COM_SUN_STAR_EMBED_ELEMENTMODES_HPP_ -#include <com/sun/star/embed/ElementModes.hpp> -#endif -#ifndef _COM_SUN_STAR_EMBED_XTRANSACTIONLISTENER_HPP_ -#include <com/sun/star/embed/XTransactionListener.hpp> -#endif -#ifndef _COM_SUN_STAR_UTIL_XREFRESHABLE_HPP_ -#include <com/sun/star/util/XRefreshable.hpp> -#endif -#ifndef _COM_SUN_STAR_BEANS_XPROPERTYACCESS_HPP_ -#include <com/sun/star/beans/XPropertyAccess.hpp> -#endif +#include <vos/ref.hxx> + #include <memory> //........................................................................ @@ -216,7 +139,8 @@ class ODatabaseContext; class DocumentStorageAccess; class OSharedConnectionManager; -class ODatabaseModelImpl : public ::rtl::IReference +class ODatabaseModelImpl :public ::rtl::IReference + ,public ::sfx2::IMacroDocumentAccess { private: ::com::sun::star::uno::WeakReference< ::com::sun::star::frame::XModel > m_xModel; @@ -256,7 +180,6 @@ */ ::rtl::OUString m_sRealFileURL; -// <properties> ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > m_xNumberFormatsSupplier; ::rtl::OUString m_sConnectURL; @@ -278,11 +201,9 @@ ::com::sun::star::uno::Sequence< ::rtl::OUString > m_aTableTypeFilter; ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > m_aArgs; -// </properties> + ::sfx2::DocumentMacroMode m_aMacroMode; - // ::cppu::OInterfaceContainerHelper m_aStorageListeners; - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener> m_xSharedConnectionManager; ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > m_xStorage; @@ -292,7 +213,6 @@ sal_uInt16 m_nControllerLockCount; sal_Bool m_bOwnStorage; - void reset(); /** determines whether the database document has an embedded data storage @@ -421,6 +341,16 @@ static const AsciiPropertyValue* getDefaultDataSourceSettings(); private: + // IMacroDocumentAccess overridables + virtual sal_Int16 getImposedMacroExecMode() const; + virtual ::rtl::OUString getDocumentLocation() const; + virtual ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > getLastCommitDocumentStorage(); + virtual bool documentStorageHasMacros() const; + virtual ::com::sun::star::uno::Reference< ::com::sun::star::document::XEmbeddedScripts > getEmbeddedDocumentScripts() const; + virtual sal_Int16 getScriptingSignatureState() const; + virtual bool checkForBrokenScriptingSignatures( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& _rxInteraction ); + +private: void impl_construct_nothrow(); }; --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
