Tag: mws_ooh680 User: rt Date: 2008-05-28 11:46:41+0000 Modified: dba/dbaccess/source/core/dataaccess/ModelImpl.cxx
Log: INTEGRATION: CWS dba241e (1.21.18.5.2); FILE MERGED 2008/05/27 21:09:23 fs 1.21.18.5.2.1: #i90011# don't dispose the Forms/Reports root storage when just checking whether there are forms/reports with macros 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.18.5&r2=1.21.18.6 Delta lines: +11 -4 -------------------- --- ModelImpl.cxx 2008-05-20 18:22:49+0000 1.21.18.5 +++ ModelImpl.cxx 2008-05-28 11:46:37+0000 1.21.18.6 @@ -456,7 +456,7 @@ } // ......................................................................... - bool lcl_hasObjectWithMacros_throw( const ODefinitionContainer_Impl& _rObjectDefinitions, const ::utl::SharedUNOComponent< XStorage >& _rxContainerStorage ) + bool lcl_hasObjectWithMacros_throw( const ODefinitionContainer_Impl& _rObjectDefinitions, const Reference< XStorage >& _rxContainerStorage ) { bool bSomeDocHasMacros = false; @@ -479,7 +479,7 @@ continue; } - ::utl::SharedUNOComponent< XStorage > xObjectStor( _rxContainerStorage->openStorageElement( + Reference< XStorage > xObjectStor( _rxContainerStorage->openStorageElement( rPersistentName, ElementModes::READ ) ); // TODO: opening the storage is too expensive, find some hasByHierarchicalName or so @@ -499,8 +499,15 @@ try { - ::utl::SharedUNOComponent< XStorage > xContainerStorage( _rModel.getStorage( - _rModel.getObjectContainerStorageName( _eType ), ElementModes::READ ) ); + Reference< XStorage > xContainerStorage( _rModel.getStorage( + _rModel.getObjectContainerStorageName( _eType ), ElementModes::READWRITE ) ); + // note the READWRITE here: If the storage already existed before, then the OpenMode will + // be ignored, anyway. + // If the storage did not yet exist, then it will be created. If the database document + // is read-only, the OpenMode will be automatically downgraded to READ. Otherwise, + // the storage will in fact be created as READWRITE. While this is not strictly necessary + // for this particular use case here, it is required since the storage is *cached*, and + // later use cases will need the READWRITE mode. if ( xContainerStorage.is() ) bSomeDocHasMacros = lcl_hasObjectWithMacros_throw( rObjectDefinitions, xContainerStorage ); --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
