Tag: cws_dev300_dba30c
User: fs      
Date: 2008-05-27 21:10:36+0000
Modified:
   dba/dbaccess/source/core/dataaccess/ModelImpl.cxx

Log:
 #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.26.4.4&r2=1.26.4.5
Delta lines:  +12 -5
--------------------
--- ModelImpl.cxx       2008-05-13 08:27:22+0000        1.26.4.4
+++ ModelImpl.cxx       2008-05-27 21:10:33+0000        1.26.4.5
@@ -7,7 +7,7 @@
  * OpenOffice.org - a multi-platform office productivity suite
  *
  * $RCSfile: ModelImpl.cxx,v $
- * $Revision: 1.26.4.4 $
+ * $Revision: 1.26.4.5 $
  *
  * This file is part of OpenOffice.org.
  *
@@ -439,7 +439,7 @@
     }
 
     // 
.........................................................................
-    bool lcl_hasObjectWithMacros_throw( const ODefinitionContainer_Impl& 
_rObjectDefinitions, const SharedStorage& _rxContainerStorage )
+    bool lcl_hasObjectWithMacros_throw( const ODefinitionContainer_Impl& 
_rObjectDefinitions, const Reference< XStorage >& _rxContainerStorage )
     {
         bool bSomeDocHasMacros = false;
 
@@ -477,8 +477,15 @@
 
         try
         {
-            SharedStorage 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 );
@@ -506,7 +513,7 @@
         if ( !_rxContainerStorage->hasByName( _rPersistentName ) )
             return false;
 
-        SharedStorage xObjectStor( _rxContainerStorage->openStorageElement(
+        Reference< XStorage > xObjectStor( 
_rxContainerStorage->openStorageElement(
             _rPersistentName, ElementModes::READ ) );
 
         bHasMacros = ::sfx2::DocumentMacroMode::storageHasMacros( xObjectStor 
);




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to