Author: alg
Date: Mon Apr 29 14:29:02 2013
New Revision: 1477102

URL: http://svn.apache.org/r1477102
Log:
i122120 Make sure helper model itself will not allocate XPropertyLists

Modified:
    openoffice/trunk/main/svx/inc/svx/svdmodel.hxx
    openoffice/trunk/main/svx/source/svdraw/svdmodel.cxx
    openoffice/trunk/main/svx/source/xoutdev/xtable.cxx

Modified: openoffice/trunk/main/svx/inc/svx/svdmodel.hxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/svx/inc/svx/svdmodel.hxx?rev=1477102&r1=1477101&r2=1477102&view=diff
==============================================================================
--- openoffice/trunk/main/svx/inc/svx/svdmodel.hxx (original)
+++ openoffice/trunk/main/svx/inc/svx/svdmodel.hxx Mon Apr 29 14:29:02 2013
@@ -217,7 +217,7 @@ protected:
        sal_uInt16          nStreamNumberFormat;
        sal_uInt16          nDefaultTabulator;
        sal_uInt32          nMaxUndoCount;
-       FASTBOOL        bSaveNative;
+       FASTBOOL         mbAutomaticXPropertyListCreation;
        sal_Bool            bStarDrawPreviewMode;
 
 
@@ -296,7 +296,6 @@ private:
        SVX_DLLPRIVATE void ImpSetOutlinerDefaults( SdrOutliner* pOutliner, 
sal_Bool bInit = sal_False );
        SVX_DLLPRIVATE void ImpReformatAllTextObjects();
        SVX_DLLPRIVATE void ImpReformatAllEdgeObjects();        // #103122#
-       SVX_DLLPRIVATE void ImpCreateTables();
        SVX_DLLPRIVATE void ImpCtor(SfxItemPool* pPool, 
::comphelper::IEmbeddedHelper* pPers, bool bLoadRefCounts = true);
 
 //#endif // __PRIVATE
@@ -489,13 +488,6 @@ public:
        FASTBOOL        IsSaveCompressed() const                   { return 
bSaveCompressed; }
        void            SetSaveCompressed(FASTBOOL bJa=sal_True)       { 
bSaveCompressed=bJa; }
 
-       // Schaltet man dieses Flag auf sal_True, so werden
-       // Grafikobjekte mit gesetztem Native-Link
-       // native gespeichert.
-       // Default=FALSE. Flag ist nicht persistent.
-       FASTBOOL        IsSaveNative() const                       { return 
bSaveNative; }
-       void            SetSaveNative(FASTBOOL bJa=sal_True)           { 
bSaveNative=bJa; }
-
        // Schaltet man dieses Flag auf sal_True, so werden die Grafiken
        // von Grafikobjekten:
        // - beim Laden eines Dokuments nicht sofort mitgeladen,
@@ -726,6 +718,9 @@ public:
                This returns false if undo was disabled using EnableUndo( false 
) and
                also during the runtime of the Undo() and Redo() methods. */
        bool IsUndoEnabled() const;
+
+    void SetAutomaticXPropertyListCreation(bool bNew) { 
mbAutomaticXPropertyListCreation = bNew; }
+    bool IsAutomaticXPropertyListCreation() const { return 
mbAutomaticXPropertyListCreation; }
 };
 
 typedef tools::WeakReference< SdrModel > SdrModelWeakRef;

Modified: openoffice/trunk/main/svx/source/svdraw/svdmodel.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/svx/source/svdraw/svdmodel.cxx?rev=1477102&r1=1477101&r2=1477102&view=diff
==============================================================================
--- openoffice/trunk/main/svx/source/svdraw/svdmodel.cxx (original)
+++ openoffice/trunk/main/svx/source/svdraw/svdmodel.cxx Mon Apr 29 14:29:02 
2013
@@ -150,7 +150,7 @@ void SdrModel::ImpCtor(SfxItemPool* pPoo
        bPageNotValid=sal_False;
        bSavePortable=sal_False;
        bSaveCompressed=sal_False;
-       bSaveNative=sal_False;
+       mbAutomaticXPropertyListCreation=true;
        bSwapGraphics=sal_False;
        nSwapGraphicsMode=SDR_SWAPGRAPHICSMODE_DEFAULT;
        bSaveOLEPreview=sal_False;
@@ -212,8 +212,6 @@ void SdrModel::ImpCtor(SfxItemPool* pPoo
 
        pHitTestOutliner = SdrMakeOutliner( OUTLINERMODE_TEXTOBJECT, this );
        ImpSetOutlinerDefaults(pHitTestOutliner, sal_True);
-
-       ImpCreateTables();
 }
 
 SdrModel::SdrModel(SfxItemPool* pPool, ::comphelper::IEmbeddedHelper* pPers, 
sal_Bool bLoadRefCounts):
@@ -330,13 +328,6 @@ SdrModel::~SdrModel()
 
        delete mpImpl->mpUndoFactory;
        delete mpImpl;
-
-    maColorTable.reset();
-    maDashList.reset();
-    maLineEndList.reset();
-    maHatchList.reset();
-    maGradientList.reset();
-    maBitmapList.reset();
 }
 
 bool SdrModel::IsInDestruction() const
@@ -722,16 +713,6 @@ bool SdrModel::IsUndoEnabled() const
 
 
////////////////////////////////////////////////////////////////////////////////////////////////////
 
-void SdrModel::ImpCreateTables()
-{
-    maColorTable = XPropertyListFactory::CreateSharedXColorList(aTablePath);
-    maDashList = XPropertyListFactory::CreateSharedXDashList(aTablePath);
-    maLineEndList = XPropertyListFactory::CreateSharedXLineEndList(aTablePath);
-    maHatchList = XPropertyListFactory::CreateSharedXHatchList(aTablePath);
-    maGradientList = 
XPropertyListFactory::CreateSharedXGradientList(aTablePath);
-    maBitmapList = XPropertyListFactory::CreateSharedXBitmapList(aTablePath);
-}
-
 // #116168#
 void SdrModel::ClearModel(sal_Bool bCalledFromDestructor)
 {
@@ -2141,6 +2122,11 @@ void SdrModel::SetColorTableAtSdrModel(X
 
 XColorListSharedPtr SdrModel::GetColorTableFromSdrModel() const                
    
 { 
+    if(IsAutomaticXPropertyListCreation() && !maColorTable.get())
+    {
+        const_cast< SdrModel* >(this)->maColorTable = 
XPropertyListFactory::CreateSharedXColorList(aTablePath);
+    }
+
     return maColorTable; 
 }
 
@@ -2151,6 +2137,11 @@ void SdrModel::SetDashListAtSdrModel(XDa
 
 XDashListSharedPtr SdrModel::GetDashListFromSdrModel() const                   
   
 { 
+    if(IsAutomaticXPropertyListCreation() && !maDashList.get())
+    {
+        const_cast< SdrModel* >(this)->maDashList = 
XPropertyListFactory::CreateSharedXDashList(aTablePath);
+    }
+
     return maDashList; 
 }
 
@@ -2161,6 +2152,11 @@ void SdrModel::SetLineEndListAtSdrModel(
 
 XLineEndListSharedPtr SdrModel::GetLineEndListFromSdrModel() const             
      
 { 
+    if(IsAutomaticXPropertyListCreation() && !maLineEndList.get())
+    {
+        const_cast< SdrModel* >(this)->maLineEndList = 
XPropertyListFactory::CreateSharedXLineEndList(aTablePath);
+    }
+
     return maLineEndList; 
 }
 
@@ -2171,6 +2167,11 @@ void SdrModel::SetHatchListAtSdrModel(XH
 
 XHatchListSharedPtr SdrModel::GetHatchListFromSdrModel() const                 
    
 { 
+    if(IsAutomaticXPropertyListCreation() && !maHatchList.get())
+    {
+        const_cast< SdrModel* >(this)->maHatchList = 
XPropertyListFactory::CreateSharedXHatchList(aTablePath);
+    }
+
     return maHatchList; 
 }
 
@@ -2181,6 +2182,11 @@ void SdrModel::SetGradientListAtSdrModel
 
 XGradientListSharedPtr SdrModel::GetGradientListFromSdrModel() const           
       
 { 
+    if(IsAutomaticXPropertyListCreation() && !maGradientList.get())
+    {
+        const_cast< SdrModel* >(this)->maGradientList = 
XPropertyListFactory::CreateSharedXGradientList(aTablePath);
+    }
+
     return maGradientList; 
 }
 
@@ -2191,6 +2197,11 @@ void SdrModel::SetBitmapListAtSdrModel(X
 
 XBitmapListSharedPtr SdrModel::GetBitmapListFromSdrModel() const               
     
 { 
+    if(IsAutomaticXPropertyListCreation() && !maBitmapList.get())
+    {
+        const_cast< SdrModel* >(this)->maBitmapList = 
XPropertyListFactory::CreateSharedXBitmapList(aTablePath);
+    }
+
     return maBitmapList; 
 }
 

Modified: openoffice/trunk/main/svx/source/xoutdev/xtable.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/svx/source/xoutdev/xtable.cxx?rev=1477102&r1=1477101&r2=1477102&view=diff
==============================================================================
--- openoffice/trunk/main/svx/source/xoutdev/xtable.cxx (original)
+++ openoffice/trunk/main/svx/source/xoutdev/xtable.cxx Mon Apr 29 14:29:02 2013
@@ -80,6 +80,7 @@ SdrModel& sharedModelAndVDev::getSharedS
         mpSdrModel = new SdrModel();
         OSL_ENSURE(0 != mpSdrModel, "XPropertyList sharedModelAndVDev: no 
SdrModel created!" );
         mpSdrModel->GetItemPool().FreezeIdRanges();
+        mpSdrModel->SetAutomaticXPropertyListCreation(false);
     }
 
     return *mpSdrModel;


Reply via email to