Tag: cws_src680_fwk80 User: pb Date: 2008-01-24 07:52:40+0000 Removed: dba/dbaccess/source/inc/dba_reghelper.hxx dba/dbaccess/source/shared/dba_reghelper.cxx
Modified: dba/dbaccess/source/core/dataaccess/ModelImpl.cxx dba/dbaccess/source/core/dataaccess/ModelImpl.hxx Log: RESYNC: (1.21-1.21.18.2); FILE MERGED 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.21.12.1&r2=1.21.12.2 Delta lines: +55 -26 --------------------- --- ModelImpl.cxx 2008-01-02 12:19:06+0000 1.21.12.1 +++ ModelImpl.cxx 2008-01-24 07:52:10+0000 1.21.12.2 @@ -323,6 +323,7 @@ ,m_aStorages() ,m_aMacroMode( *this ) ,m_xServiceFactory(_rxFactory) + ,m_bHasAnyObjectWithMacros( false ) ,m_nLoginTimeout(0) ,m_bReadOnly(sal_False) // we're created as service and have to allow the setting of properties ,m_bPasswordRequired(sal_False) @@ -358,6 +359,7 @@ ,m_aStorages() ,m_aMacroMode( *this ) ,m_xServiceFactory(_rxFactory) + ,m_bHasAnyObjectWithMacros( false ) ,m_sName(_rRegistrationName) ,m_nLoginTimeout(0) ,m_bReadOnly(sal_False) @@ -391,13 +393,14 @@ try { // the set of property value types in the bag is limited: - Sequence< Type > aAllowedTypes(5); + Sequence< Type > aAllowedTypes(6); Type* pAllowedType = aAllowedTypes.getArray(); *pAllowedType++ = ::getCppuType( static_cast< sal_Bool* >( NULL ) ); *pAllowedType++ = ::getCppuType( static_cast< double* >( NULL ) ); *pAllowedType++ = ::getCppuType( static_cast< ::rtl::OUString* >( NULL ) ); *pAllowedType++ = ::getCppuType( static_cast< sal_Int32* >( NULL ) ); *pAllowedType++ = ::getCppuType( static_cast< sal_Int16* >( NULL ) ); + *pAllowedType++ = ::getCppuType( static_cast< Sequence< Any >* >( NULL ) ); Sequence< Any > aInitArgs( 2 ); aInitArgs[0] <<= NamedValue( @@ -452,6 +455,40 @@ } // ......................................................................... + bool lcl_hasObjectWithMacros_throw( const ODefinitionContainer_Impl& _rObjectDefinitions, const ::utl::SharedUNOComponent< XStorage >& _rxContainerStorage ) + { + bool bSomeDocHasMacros = false; + + for ( ODefinitionContainer_Impl::const_iterator object = _rObjectDefinitions.begin(); + ( object != _rObjectDefinitions.end() ) && !bSomeDocHasMacros; + ++object + ) + { +#if OSL_DEBUG_LEVEL > 0 + const ::rtl::OUString& rName( object->first ); (void)rName; +#endif + + const TContentPtr& rDefinition( object->second ); + const ::rtl::OUString& rPersistentName( rDefinition->m_aProps.sPersistentName ); + + if ( !rPersistentName.getLength() ) + { // it's a logical sub folder used to organize the real objects + const ODefinitionContainer_Impl& rSubFoldersObjectDefinitions( dynamic_cast< const ODefinitionContainer_Impl& >( *rDefinition.get() ) ); + bSomeDocHasMacros = lcl_hasObjectWithMacros_throw( rSubFoldersObjectDefinitions, _rxContainerStorage ); + continue; + } + + ::utl::SharedUNOComponent< XStorage > xObjectStor( _rxContainerStorage->openStorageElement( + rPersistentName, ElementModes::READ ) ); + + // TODO: opening the storage is too expensive, find some hasByHierarchicalName or so + + bSomeDocHasMacros = ::sfx2::DocumentMacroMode::storageHasMacros( xObjectStor ); + } + return bSomeDocHasMacros; + } + + // ......................................................................... bool lcl_hasObjectsWithMacros_nothrow( ODatabaseModelImpl& _rModel, const ODatabaseModelImpl::ObjectType _eType ) { bool bSomeDocHasMacros = false; @@ -463,21 +500,9 @@ { ::utl::SharedUNOComponent< XStorage > xContainerStorage( _rModel.getStorage( _rModel.getObjectContainerStorageName( _eType ), ElementModes::READ ) ); - if ( !xContainerStorage.is() ) - return false; - - for ( ODefinitionContainer_Impl::const_iterator object = rObjectDefinitions.begin(); - ( object != rObjectDefinitions.end() ) && !bSomeDocHasMacros; - ++object - ) - { - ::utl::SharedUNOComponent< XStorage > xObjectStor( xContainerStorage->openStorageElement( - object->second->m_aProps.sPersistentName, ElementModes::READ ) ); - - // TODO: opening the storage is too expensive, find some hasByHierarchicalName or so - bSomeDocHasMacros = ::sfx2::DocumentMacroMode::storageHasMacros( xObjectStor ); - } + if ( xContainerStorage.is() ) + bSomeDocHasMacros = lcl_hasObjectWithMacros_throw( rObjectDefinitions, xContainerStorage ); } catch( const Exception& ) { @@ -996,7 +1021,10 @@ AsciiPropertyValue( "EnableOuterJoinEscape", makeAny( (sal_Bool)sal_True ) ), AsciiPropertyValue( "PreferDosLikeLineEnds", makeAny( (sal_Bool)sal_False ) ), AsciiPropertyValue( "FormsCheckRequiredFields", makeAny( (sal_Bool)sal_True ) ), + AsciiPropertyValue( "EscapeDateTime", makeAny( (sal_Bool)sal_True ) ), AsciiPropertyValue( "IgnoreCurrency", makeAny( (sal_Bool)sal_False ) ), + AsciiPropertyValue( "TypeInfoSettings", makeAny( Sequence< Any >()) ), + AsciiPropertyValue( NULL, Any() ) }; return aKnownSettings; @@ -1115,13 +1143,14 @@ if ( ::sfx2::DocumentMacroMode::storageHasMacros( m_xStorage ) ) return true; - // do we have forms with macros? - if ( lcl_hasObjectsWithMacros_nothrow( const_cast< ODatabaseModelImpl& >( *this ), E_FORM ) ) - return true; - - // do we have report with macros? - if ( lcl_hasObjectsWithMacros_nothrow( const_cast< ODatabaseModelImpl& >( *this ), E_REPORT ) ) + // do we have forms or reports with macros? + if ( lcl_hasObjectsWithMacros_nothrow( const_cast< ODatabaseModelImpl& >( *this ), E_FORM ) + || lcl_hasObjectsWithMacros_nothrow( const_cast< ODatabaseModelImpl& >( *this ), E_REPORT ) + ) + { + const_cast< ODatabaseModelImpl* >( this )->m_bHasAnyObjectWithMacros = true; return true; + } return false; } Directory: /dba/dbaccess/source/core/dataaccess/ ================================================ File [changed]: ModelImpl.hxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/dataaccess/ModelImpl.hxx?r1=1.16.12.1&r2=1.16.12.2 Delta lines: +16 -6 -------------------- --- ModelImpl.hxx 2008-01-02 12:19:06+0000 1.16.12.1 +++ ModelImpl.hxx 2008-01-24 07:52:13+0000 1.16.12.2 @@ -39,7 +39,6 @@ #include "apitools.hxx" #include "bookmarkcontainer.hxx" #include "ContentHelper.hxx" -#include "dba_reghelper.hxx" /** === begin UNO includes === **/ #include <com/sun/star/beans/PropertyAttribute.hpp> @@ -171,6 +170,10 @@ /// the URL the document was loaded from ::rtl::OUString m_sFileURL; + + /// do we have any object (forms/reports) which contains macros? + bool m_bHasAnyObjectWithMacros; + /** the URL which the document should report as it's URL This might differ from ->m_sFileURL in case the document was loaded @@ -353,6 +356,13 @@ static ::rtl::OUString getObjectContainerStorageName( const ObjectType _eType ); + /** determines whether the database document has any object (form/report) which contains macros + + In such a case, *all* objects in the document keep the macro capability, and the database document + itself does *not* allow embedding macros. + */ + bool hasAnyObjectWithMacros() const { return m_bHasAnyObjectWithMacros; } + /** checks our document's macro execution mode, using the interaction handler as supplied with our load arguments */ @@ -374,7 +384,7 @@ */ void resetMacroExecutionMode(); -private: +public: // IMacroDocumentAccess overridables virtual sal_Int16 getImposedMacroExecMode() const; virtual sal_Bool setImposedMacroExecMode( sal_uInt16 ); Directory: /dba/dbaccess/source/inc/ ==================================== File [removed]: dba_reghelper.hxx Directory: /dba/dbaccess/source/shared/ ======================================= File [removed]: dba_reghelper.cxx --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
