[Libreoffice-commits] .: 5 commits - filter/inc filter/source sw/source toolkit/inc toolkit/source writerfilter/inc

Michael Stahl mst at kemper.freedesktop.org
Tue Mar 13 15:34:16 PDT 2012


 filter/inc/filter/msfilter/msdffimp.hxx               |   14 +
 filter/source/graphicfilter/icgm/actimpr.cxx          |   10 -
 filter/source/graphicfilter/icgm/elements.cxx         |   33 ----
 filter/source/graphicfilter/icgm/elements.hxx         |    7 
 filter/source/msfilter/msdffimp.cxx                   |  142 ++++++++----------
 sw/source/ui/docvw/srcedtw.cxx                        |   23 +-
 sw/source/ui/inc/srcedtw.hxx                          |    7 
 toolkit/inc/toolkit/helper/unopropertyarrayhelper.hxx |    5 
 toolkit/source/helper/unopropertyarrayhelper.cxx      |   26 +--
 writerfilter/inc/resourcemodel/WW8ResourceModel.hxx   |   13 +
 10 files changed, 130 insertions(+), 150 deletions(-)

New commits:
commit a4a7b956dc0ad439b52ef188ba0f4e5bcc215f91
Author: Noel Grandin <noelgrandin at gmail.com>
Date:   Sun Mar 11 13:14:36 2012 +0200

    Convert tools/table.hxx usage to std::set in toolkit module in UnoPropertyArrayHelper class

diff --git a/toolkit/inc/toolkit/helper/unopropertyarrayhelper.hxx b/toolkit/inc/toolkit/helper/unopropertyarrayhelper.hxx
index c109528..8fc5aef 100644
--- a/toolkit/inc/toolkit/helper/unopropertyarrayhelper.hxx
+++ b/toolkit/inc/toolkit/helper/unopropertyarrayhelper.hxx
@@ -32,9 +32,8 @@
 #include <toolkit/dllapi.h>
 #include <cppuhelper/propshlp.hxx>
 
-#include <tools/table.hxx>
-
 #include <list>
+#include <set>
 #include "toolkit/dllapi.h"
 
 //  ----------------------------------------------------
@@ -43,7 +42,7 @@
 class TOOLKIT_DLLPUBLIC UnoPropertyArrayHelper : public ::cppu::IPropertyArrayHelper
 {
 private:
-    Table       maIDs;
+    std::set<sal_Int32>       maIDs;
 
 protected:
     sal_Bool    ImplHasProperty( sal_uInt16 nPropId ) const;
diff --git a/toolkit/source/helper/unopropertyarrayhelper.cxx b/toolkit/source/helper/unopropertyarrayhelper.cxx
index 59403f8..17f518e 100644
--- a/toolkit/source/helper/unopropertyarrayhelper.cxx
+++ b/toolkit/source/helper/unopropertyarrayhelper.cxx
@@ -29,6 +29,7 @@
 
 #include <toolkit/helper/unopropertyarrayhelper.hxx>
 #include <toolkit/helper/property.hxx>
+#include <map>
 
 //  ----------------------------------------------------
 //  class UnoPropertyArrayHelper
@@ -39,14 +40,14 @@ UnoPropertyArrayHelper::UnoPropertyArrayHelper( const ::com::sun::star::uno::Seq
     sal_Int32 nIDs = rIDs.getLength();
     const sal_Int32* pIDs = rIDs.getConstArray();
     for ( sal_Int32 n = 0; n < nIDs; n++ )
-        maIDs.Insert( pIDs[n], (void*)1L );
+        maIDs.insert( pIDs[n] );
 }
 
 UnoPropertyArrayHelper::UnoPropertyArrayHelper( const std::list< sal_uInt16 > &rIDs )
 {
     std::list< sal_uInt16 >::const_iterator iter;
     for( iter = rIDs.begin(); iter != rIDs.end(); ++iter)
-      maIDs.Insert( *iter, (void*)1L);
+      maIDs.insert( *iter );
 }
 
 sal_Bool UnoPropertyArrayHelper::ImplHasProperty( sal_uInt16 nPropId ) const
@@ -54,7 +55,7 @@ sal_Bool UnoPropertyArrayHelper::ImplHasProperty( sal_uInt16 nPropId ) const
     if ( ( nPropId >= BASEPROPERTY_FONTDESCRIPTORPART_START ) && ( nPropId <= BASEPROPERTY_FONTDESCRIPTORPART_END ) )
         nPropId = BASEPROPERTY_FONTDESCRIPTOR;
 
-    return maIDs.Get( nPropId ) ? sal_True : sal_False;
+    return maIDs.find( nPropId ) != maIDs.end() ? sal_True : sal_False;
 }
 
 // ::cppu::IPropertyArrayHelper
@@ -76,29 +77,28 @@ sal_Bool UnoPropertyArrayHelper::fillPropertyMembersByHandle( ::rtl::OUString *
 {
     // Sortiert nach Namen...
 
-    Table aSortedPropsIds;
-    sal_uInt32 nProps = maIDs.Count();
-    for ( sal_uInt32 s = 0; s < nProps; s++ )
+    std::map<sal_Int32, sal_uInt16> aSortedPropsIds;
+    for( std::set<sal_Int32>::const_iterator it =  maIDs.begin(); it != maIDs.end(); ++it)
     {
-        sal_uInt16 nId = sal::static_int_cast< sal_uInt16 >(
-            maIDs.GetObjectKey( s ));
-        aSortedPropsIds.Insert( 1+GetPropertyOrderNr( nId ), (void*)(sal_uIntPtr)nId );
+        sal_uInt16 nId = sal::static_int_cast< sal_uInt16 >(*it);
+        aSortedPropsIds[ 1+GetPropertyOrderNr( nId ) ] = nId;
 
         if ( nId == BASEPROPERTY_FONTDESCRIPTOR )
         {
             // Einzelproperties...
             for ( sal_uInt16 i = BASEPROPERTY_FONTDESCRIPTORPART_START; i <= BASEPROPERTY_FONTDESCRIPTORPART_END; i++ )
-                aSortedPropsIds.Insert( 1+GetPropertyOrderNr( i ), (void*)(sal_uIntPtr)i );
+                aSortedPropsIds[ 1+GetPropertyOrderNr( i ) ]  = i;
         }
     }
 
-    nProps = aSortedPropsIds.Count();   // koennen jetzt mehr sein
+    sal_uInt32 nProps = aSortedPropsIds.size();   // koennen jetzt mehr sein
     ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property> aProps( nProps );
     ::com::sun::star::beans::Property* pProps = aProps.getArray();
 
-    for ( sal_uInt32 n = 0; n < nProps; n++ )
+    std::map<sal_Int32, sal_uInt16>::const_iterator it = aSortedPropsIds.begin();
+    for ( sal_uInt32 n = 0; n < nProps; n++, ++it )
     {
-        sal_uInt16 nId = (sal_uInt16)(sal_uLong)aSortedPropsIds.GetObject( n );
+        sal_uInt16 nId = it->second;
         pProps[n].Name = GetPropertyName( nId );
         pProps[n].Handle = nId;
         pProps[n].Type = *GetPropertyType( nId );
commit aa998adbe3f7132998ba5aff438b540ff18a10bb
Author: Noel Grandin <noelgrandin at gmail.com>
Date:   Sun Mar 11 20:50:15 2012 +0200

    Convert tools/table.hxx to std::set in SwSrcEditWindow in SW module

diff --git a/sw/source/ui/docvw/srcedtw.cxx b/sw/source/ui/docvw/srcedtw.cxx
index 9bd534c..2ffd918 100644
--- a/sw/source/ui/docvw/srcedtw.cxx
+++ b/sw/source/ui/docvw/srcedtw.cxx
@@ -595,7 +595,6 @@ IMPL_LINK( SwSrcEditWindow, SyntaxTimerHdl, Timer *, pTimer )
     SAL_WARN_IF(pTextView == 0, "sw", "No View yet, but syntax highlighting?!");
 
     bHighlighting = sal_True;
-    sal_uInt16 nLine;
     sal_uInt16 nCount  = 0;
     // at first the region around the cursor is processed
     TextSelection aSel = pTextView->GetSelection();
@@ -604,16 +603,15 @@ IMPL_LINK( SwSrcEditWindow, SyntaxTimerHdl, Timer *, pTimer )
         nCur -= 40;
     else
         nCur = 0;
-    if(aSyntaxLineTable.Count())
+    if(!aSyntaxLineTable.empty())
         for(sal_uInt16 i = 0; i < 80 && nCount < 40; i++, nCur++)
         {
-            void * p = aSyntaxLineTable.Get(nCur);
-            if(p)
+            if(aSyntaxLineTable.find(nCur) != aSyntaxLineTable.end())
             {
                 DoSyntaxHighlight( nCur );
-                aSyntaxLineTable.Remove( nCur );
+                aSyntaxLineTable.erase( nCur );
                 nCount++;
-                if(!aSyntaxLineTable.Count())
+                if(aSyntaxLineTable.empty())
                     break;
                 if((Time( Time::SYSTEM ).GetTime() - aSyntaxCheckStart.GetTime()) > MAX_HIGHLIGHTTIME )
                 {
@@ -624,14 +622,11 @@ IMPL_LINK( SwSrcEditWindow, SyntaxTimerHdl, Timer *, pTimer )
         }
 
     // when there is still anything left by then, go on from the beginning
-    void* p = aSyntaxLineTable.First();
-    while ( p && nCount < MAX_SYNTAX_HIGHLIGHT)
+    while ( !aSyntaxLineTable.empty() && nCount < MAX_SYNTAX_HIGHLIGHT)
     {
-        nLine = (sal_uInt16)aSyntaxLineTable.GetCurKey();
+        sal_uInt16 nLine = *aSyntaxLineTable.begin();
         DoSyntaxHighlight( nLine );
-        sal_uInt16 nCurKey = (sal_uInt16)aSyntaxLineTable.GetCurKey();
-        p = aSyntaxLineTable.Next();
-        aSyntaxLineTable.Remove(nCurKey);
+        aSyntaxLineTable.erase(nLine);
         nCount ++;
         if(Time( Time::SYSTEM ).GetTime() - aSyntaxCheckStart.GetTime() > MAX_HIGHLIGHTTIME)
         {
@@ -640,7 +635,7 @@ IMPL_LINK( SwSrcEditWindow, SyntaxTimerHdl, Timer *, pTimer )
         }
     }
 
-    if(aSyntaxLineTable.Count() && !pTimer->IsActive())
+    if(!aSyntaxLineTable.empty() && !pTimer->IsActive())
         pTimer->Start();
     // SyntaxTimerHdl is called when text changed
     // => good opportunity to determine text width!
@@ -681,7 +676,7 @@ void SwSrcEditWindow::DoDelayedSyntaxHighlight( sal_uInt16 nPara )
 {
     if ( !bHighlighting && bDoSyntaxHighlight )
     {
-        aSyntaxLineTable.Insert( nPara, (void*)(sal_uInt16)1 );
+        aSyntaxLineTable.insert( nPara );
         aSyntaxIdleTimer.Start();
     }
 }
diff --git a/sw/source/ui/inc/srcedtw.hxx b/sw/source/ui/inc/srcedtw.hxx
index 3439b19..8f4a443 100644
--- a/sw/source/ui/inc/srcedtw.hxx
+++ b/sw/source/ui/inc/srcedtw.hxx
@@ -32,8 +32,8 @@
 #include <svl/lstner.hxx>
 #include <vcl/timer.hxx>
 
-#include <tools/table.hxx>
 #include <svtools/xtextedt.hxx>
+#include <set>
 
 namespace com { namespace sun { namespace star { namespace beans {
     class XMultiPropertySet;
@@ -68,12 +68,13 @@ public:
 };
 
 //------------------------------------------------------------
+typedef std::set<sal_uInt16> SyntaxLineSet;
+
 class SwSrcEditWindow : public Window, public SfxListener
 {
 private:
     class ChangesListener;
     friend class ChangesListener;
-
     ExtTextView*    pTextView;
     ExtTextEngine*  pTextEngine;
 
@@ -96,7 +97,7 @@ private:
     sal_Bool            bHighlighting;
 
     Timer           aSyntaxIdleTimer;
-    Table           aSyntaxLineTable;
+    SyntaxLineSet   aSyntaxLineTable;
 
     void            ImpDoHighlight( const String& rSource, sal_uInt16 nLineOff );
 
commit 64cba6e58263e906aba6a110937f362d1e31ebe5
Author: Noel Grandin <noel at peralex.com>
Date:   Fri Mar 9 14:06:18 2012 +0200

    Convert tools/table.hxx to std::map in CGMElements class

diff --git a/filter/source/graphicfilter/icgm/actimpr.cxx b/filter/source/graphicfilter/icgm/actimpr.cxx
index 381135e..3945451 100644
--- a/filter/source/graphicfilter/icgm/actimpr.cxx
+++ b/filter/source/graphicfilter/icgm/actimpr.cxx
@@ -337,17 +337,17 @@ void CGMImpressOutAct::ImplSetFillBundle()
             aHatch.Color = nFillColor;
         else
             aHatch.Color = nFillColor;
-        HatchEntry*     pHatchEntry = (HatchEntry*)mpCGM->pElement->aHatchTable.Get( nHatchIndex );
-        if ( pHatchEntry )
+        if ( mpCGM->pElement->maHatchMap.find( nHatchIndex ) !=  mpCGM->pElement->maHatchMap.end() )
         {
-            switch ( pHatchEntry->HatchStyle )
+            HatchEntry& rHatchEntry = mpCGM->pElement->maHatchMap[ nHatchIndex ];
+            switch ( rHatchEntry.HatchStyle )
             {
             case 0 : aHatch.Style = drawing::HatchStyle_SINGLE; break;
             case 1 : aHatch.Style = drawing::HatchStyle_DOUBLE; break;
             case 2 : aHatch.Style = drawing::HatchStyle_TRIPLE; break;
             }
-            aHatch.Distance = pHatchEntry->HatchDistance;
-            aHatch.Angle = pHatchEntry->HatchAngle;
+            aHatch.Distance = rHatchEntry.HatchDistance;
+            aHatch.Angle = rHatchEntry.HatchAngle;
         }
         else
         {
diff --git a/filter/source/graphicfilter/icgm/elements.cxx b/filter/source/graphicfilter/icgm/elements.cxx
index 9bf4b85..a3f5892 100644
--- a/filter/source/graphicfilter/icgm/elements.cxx
+++ b/filter/source/graphicfilter/icgm/elements.cxx
@@ -42,7 +42,6 @@ CGMElements::CGMElements( CGM& rCGM ) :
 
 CGMElements::~CGMElements()
 {
-    DeleteTable( aHatchTable );
     DeleteAllBundles( aLineList );
     DeleteAllBundles( aMarkerList );
     DeleteAllBundles( aEdgeList );
@@ -144,14 +143,7 @@ CGMElements& CGMElements::operator=( CGMElements& rSource )
     eTransparency = rSource.eTransparency;
     nAuxiliaryColor = rSource.nAuxiliaryColor;
 
-    DeleteTable( aHatchTable );
-    HatchEntry* pSource = (HatchEntry*)rSource.aHatchTable.First();
-    while ( pSource )
-    {
-        sal_uInt32  nKey = rSource.aHatchTable.GetKey( pSource );
-        aHatchTable.Insert( nKey, new HatchEntry( *pSource ) );
-        pSource = (HatchEntry*)rSource.aHatchTable.Next();
-    }
+    maHatchMap = rSource.maHatchMap;
     bSegmentCount = rSource.bSegmentCount;
     return (*this);
 }
@@ -304,25 +296,10 @@ void CGMElements::Init()
 
 void CGMElements::ImplInsertHatch( sal_Int32 nKey, int nStyle, long nDistance, long nAngle )
 {
-    HatchEntry*     pHatchEntry;
-    pHatchEntry = new HatchEntry;
-    aHatchTable.Insert( (sal_uInt32)nKey, pHatchEntry );
-    pHatchEntry->HatchStyle = nStyle;
-    pHatchEntry->HatchDistance = nDistance;
-    pHatchEntry->HatchAngle = nAngle;
-}
-
-// ---------------------------------------------------------------
-
-void CGMElements::DeleteTable( Table& rTable )
-{
-    HatchEntry* pPtr = (HatchEntry*)rTable.First();
-    while ( pPtr )
-    {
-        delete pPtr;
-        pPtr = (HatchEntry*)rTable.Next();
-    }
-    rTable.Clear();
+    HatchEntry& rEntry = maHatchMap[nKey];
+    rEntry.HatchStyle = nStyle;
+    rEntry.HatchDistance = nDistance;
+    rEntry.HatchAngle = nAngle;
 }
 
 // ---------------------------------------------------------------
diff --git a/filter/source/graphicfilter/icgm/elements.hxx b/filter/source/graphicfilter/icgm/elements.hxx
index c378ac5..3969601 100644
--- a/filter/source/graphicfilter/icgm/elements.hxx
+++ b/filter/source/graphicfilter/icgm/elements.hxx
@@ -29,12 +29,14 @@
 #define CGM_ELEMENTS_HXX_
 
 #include "main.hxx"
-#include <tools/table.hxx>
+#include "cgmtypes.hxx"
 #include <vector>
+#include <map>
 
 #define nBackGroundColor    aColorTable[ 0 ]
 
 typedef ::std::vector< Bundle* > BundleList;
+typedef ::std::map<sal_uInt32, HatchEntry> HatchMap;
 
 class CGMElements
 {
@@ -124,7 +126,7 @@ class CGMElements
         FillBundle          aFillBundle;
         BundleList          aFillList;
         FloatPoint          aFillRefPoint;
-        Table               aHatchTable;
+        HatchMap            maHatchMap;
 
         Transparency        eTransparency;
 
@@ -137,7 +139,6 @@ class CGMElements
                             ~CGMElements();
         CGMElements&        operator=( CGMElements& );
         void                Init();
-        void                DeleteTable( Table& );
         Bundle*             GetBundleIndex( long nIndex, BundleList&, Bundle& );
         Bundle*             GetBundle( BundleList& rList, long nIndex );
         Bundle*             InsertBundle( BundleList&, Bundle& );
commit f1bd21bdbb07879f9337d2da2ef1a02792a76369
Author: Noel Grandin <noel at peralex.com>
Date:   Fri Mar 9 17:20:15 2012 +0200

    Converts from tools/table.hxx to std::map in DffPropSet class in filter module

diff --git a/filter/inc/filter/msfilter/msdffimp.hxx b/filter/inc/filter/msfilter/msdffimp.hxx
index c8edec0..3366a9c 100644
--- a/filter/inc/filter/msfilter/msdffimp.hxx
+++ b/filter/inc/filter/msfilter/msdffimp.hxx
@@ -35,7 +35,6 @@
 #include <svl/svarray.hxx>
 #include <tools/color.hxx>
 #include <tools/gen.hxx>
-#include <tools/table.hxx>
 #include <svx/msdffdef.hxx>
 #include <vcl/graph.hxx>
 #include <string.h>
@@ -106,10 +105,17 @@ struct DffPropFlags
 
 class SvxMSDffManager;
 
-class MSFILTER_DLLPUBLIC DffPropSet : public Table
+class MSFILTER_DLLPUBLIC DffPropSet
 {
+private:
+    void InitializeProp(sal_uInt32 nKey, sal_uInt32 nContent,
+            DffPropFlags& rFlags, sal_uInt32 nRecordType) const;
+
 protected:
 
+typedef std::map<sal_uInt32, sal_uInt32> RecordTypesMap;
+
+    RecordTypesMap  maRecordTypes;
     sal_uInt32      mpContents[ 1024 ];
     DffPropFlags    mpFlags[ 1024 ];
 
@@ -466,12 +472,14 @@ class MSFILTER_DLLPUBLIC SvxMSDffManager : public DffPropertyReader
 
 protected :
 
+typedef std::map<sal_uInt32, sal_uInt32> OffsetMap;
+
     String          maBaseURL;
     sal_uInt32      mnCurMaxShapeId;    // we need this information to
     sal_uInt32      mnDrawingsSaved;    // access the right drawing
     sal_uInt32      mnIdClusters;       // while only knowing the shapeid
     FIDCL*          mpFidcls;
-    Table           maDgOffsetTable;    // array of fileoffsets
+    OffsetMap       maDgOffsetTable;    // array of fileoffsets
 
     friend class DffPropertyReader;
 
diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index 176d630..80785fa 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -261,7 +261,7 @@ SvStream& operator>>( SvStream& rIn, DffPropSet& rRec )
             // set flags that have to be set
             rRec.mpContents[ nRecType ] |= nContent;
             nContentEx |= ( nContent >> 16 );
-            rRec.Replace( nRecType, (void*)(sal_uIntPtr)nContentEx );
+            rRec.maRecordTypes[ nRecType ] = nContentEx;
         }
         else
         {
@@ -320,7 +320,7 @@ SvStream& operator>>( SvStream& rIn, DffPropSet& rRec )
             }
             rRec.mpContents[ nRecType ] = nContent;
             rRec.mpFlags[ nRecType ] = aPropFlag;
-            rRec.Insert( nRecType, (void*)(sal_uIntPtr)nContentEx );
+            rRec.maRecordTypes[ nRecType ] = nContentEx;
         }
     }
     aHd.SeekToEndOfRecord( rIn );
@@ -357,77 +357,59 @@ void DffPropSet::InitializePropSet() const
     everything else)
     */
 
-    memset( ( (DffPropSet*) this )->mpFlags, 0, 0x400 * sizeof(DffPropFlags) );
-    ( (DffPropSet*) this )->Clear();
+    DffPropSet* self = (DffPropSet*) this;
+    memset( self->mpFlags, 0, 0x400 * sizeof(DffPropFlags) );
+    self->maRecordTypes.clear();
 
     DffPropFlags nFlags = { 1, 0, 0, 1 };
 
-    ( (DffPropSet*) this )->mpContents[ DFF_Prop_LockAgainstGrouping ] = 0x0000;        //0x01ff0000;
-    ( (DffPropSet*) this )->mpFlags[ DFF_Prop_LockAgainstGrouping ] = nFlags;
-    ( (DffPropSet*) this )->Insert( DFF_Prop_LockAgainstGrouping, (void*)0xffff0000 );
-
-    ( (DffPropSet*) this )->mpContents[ DFF_Prop_FitTextToShape ] = 0x0010;             //0x001f0010;
-    ( (DffPropSet*) this )->mpFlags[ DFF_Prop_FitTextToShape ] = nFlags;
-    ( (DffPropSet*) this )->Insert( DFF_Prop_FitTextToShape, (void*)0xffff0000 );
-
-    ( (DffPropSet*) this )->mpContents[ DFF_Prop_gtextFStrikethrough ] = 0x0000;        //0xffff0000;
-    ( (DffPropSet*) this )->mpFlags[ DFF_Prop_gtextFStrikethrough ] = nFlags;
-    ( (DffPropSet*) this )->Insert( DFF_Prop_gtextFStrikethrough, (void*)0xffff0000 );
-
-    ( (DffPropSet*) this )->mpContents[ DFF_Prop_pictureActive ] = 0x0000;              //0x000f0000;
-    ( (DffPropSet*) this )->mpFlags[ DFF_Prop_pictureActive ] = nFlags;
-    ( (DffPropSet*) this )->Insert( DFF_Prop_pictureActive, (void*)0xffff0000 );
-
-    ( (DffPropSet*) this )->mpContents[ DFF_Prop_fFillOK ] = 0x0039;                    //0x003f0039;
-    ( (DffPropSet*) this )->mpFlags[ DFF_Prop_fFillOK ] = nFlags;
-    ( (DffPropSet*) this )->Insert( DFF_Prop_fFillOK, (void*)0xffff0000 );
-
-    ( (DffPropSet*) this )->mpContents[ DFF_Prop_fNoFillHitTest ] = 0x001c;             //0x001f001c;
-    ( (DffPropSet*) this )->mpFlags[ DFF_Prop_fNoFillHitTest ] = nFlags;
-    ( (DffPropSet*) this )->Insert( DFF_Prop_fNoFillHitTest, (void*)0xffff0000 );
-
-    ( (DffPropSet*) this )->mpContents[ DFF_Prop_fNoLineDrawDash ] = 0x001e;            //0x001f000e;
-    ( (DffPropSet*) this )->mpFlags[ DFF_Prop_fNoLineDrawDash ] = nFlags;
-    ( (DffPropSet*) this )->Insert( DFF_Prop_fNoLineDrawDash, (void*)0xffff0000 );
-
-    ( (DffPropSet*) this )->mpContents[ DFF_Prop_fshadowObscured ] = 0x0000;            //0x00030000;
-    ( (DffPropSet*) this )->mpFlags[ DFF_Prop_fshadowObscured ] = nFlags;
-    ( (DffPropSet*) this )->Insert( DFF_Prop_fshadowObscured, (void*)0xffff0000 );
-
-    ( (DffPropSet*) this )->mpContents[ DFF_Prop_fPerspective ] = 0x0000;               //0x00010000;
-    ( (DffPropSet*) this )->mpFlags[ DFF_Prop_fPerspective ] = nFlags;
-    ( (DffPropSet*) this )->Insert( DFF_Prop_fPerspective, (void*)0xffff0000 );
-
-    ( (DffPropSet*) this )->mpContents[ DFF_Prop_fc3DLightFace ] = 0x0001;              //0x000f0001;
-    ( (DffPropSet*) this )->mpFlags[ DFF_Prop_fc3DLightFace ] = nFlags;
-    ( (DffPropSet*) this )->Insert( DFF_Prop_fc3DLightFace, (void*)0xffff0000 );
-
-    ( (DffPropSet*) this )->mpContents[ DFF_Prop_fc3DFillHarsh ] = 0x0016;              //0x001f0016;
-    ( (DffPropSet*) this )->mpFlags[ DFF_Prop_fc3DFillHarsh ] = nFlags;
-    ( (DffPropSet*) this )->Insert( DFF_Prop_fc3DFillHarsh, (void*)0xffff0000 );
-
-    ( (DffPropSet*) this )->mpContents[ DFF_Prop_fBackground ] = 0x0000;                //0x001f0000;
-    ( (DffPropSet*) this )->mpFlags[ DFF_Prop_fBackground ] = nFlags;
-    ( (DffPropSet*) this )->Insert( DFF_Prop_fBackground, (void*)0xffff0000 );
-
-    ( (DffPropSet*) this )->mpContents[ DFF_Prop_fCalloutLengthSpecified ] = 0x0010;    //0x00ef0010;
-    ( (DffPropSet*) this )->mpFlags[ DFF_Prop_fCalloutLengthSpecified ] = nFlags;
-    ( (DffPropSet*) this )->Insert( DFF_Prop_fCalloutLengthSpecified, (void*)0xffff0000 );
-
-    ( (DffPropSet*) this )->mpContents[ DFF_Prop_fPrint ] = 0x0001;                     //0x00ef0001;
-    ( (DffPropSet*) this )->mpFlags[ DFF_Prop_fPrint ] = nFlags;
-    ( (DffPropSet*) this )->Insert( DFF_Prop_fPrint, (void*)0xffff0000 );
+    //0x01ff0000;
+    InitializeProp( DFF_Prop_LockAgainstGrouping, 0x0000, nFlags, 0xffff0000 );
+    //0x001f0010;
+    InitializeProp( DFF_Prop_FitTextToShape, 0x0010, nFlags, 0xffff0000 );
+    //0xffff0000;
+    InitializeProp( DFF_Prop_gtextFStrikethrough, 0x0000, nFlags, 0xffff0000 );
+    //0x000f0000;
+    InitializeProp( DFF_Prop_pictureActive, 0x0000, nFlags, 0xffff0000 );
+    //0x003f0039;
+    InitializeProp( DFF_Prop_fFillOK, 0x0039, nFlags, 0xffff0000 );
+    //0x001f001c;
+    InitializeProp( DFF_Prop_fNoFillHitTest, 0x001c, nFlags, 0xffff0000 );
+    //0x001f000e;
+    InitializeProp( DFF_Prop_fNoLineDrawDash, 0x001e, nFlags, 0xffff0000 );
+    //0x00030000;
+    InitializeProp( DFF_Prop_fshadowObscured, 0x0000, nFlags, 0xffff0000 );
+    //0x00010000;
+    InitializeProp( DFF_Prop_fPerspective, 0x0000, nFlags, 0xffff0000 );
+    //0x000f0001;
+    InitializeProp( DFF_Prop_fc3DLightFace, 0x0001, nFlags, 0xffff0000 );
+    //0x001f0016;
+    InitializeProp( DFF_Prop_fc3DFillHarsh, 0x0016, nFlags, 0xffff0000 );
+    //0x001f0000;
+    InitializeProp( DFF_Prop_fBackground, 0x0000, nFlags, 0xffff0000 );
+    //0x00ef0010;
+    InitializeProp( DFF_Prop_fCalloutLengthSpecified, 0x0010, nFlags, 0xffff0000 );
+    //0x00ef0001;
+    InitializeProp( DFF_Prop_fPrint, 0x0001, nFlags, 0xffff0000 );
+
+    InitializeProp( DFF_Prop_fillColor, 0xffffff, nFlags, 0xffff0000 );
+}
 
-    ( (DffPropSet*) this )->mpContents[ DFF_Prop_fillColor ] = 0xffffff;
-    ( (DffPropSet*) this )->mpFlags[ DFF_Prop_fillColor ] = nFlags;
-    ( (DffPropSet*) this )->Insert( DFF_Prop_fillColor, (void*)0xffff0000 );
+void DffPropSet::InitializeProp(sal_uInt32 nKey, sal_uInt32 nContent, DffPropFlags& rFlags, sal_uInt32 nRecordType ) const
+{
+    DffPropSet* self = (DffPropSet*) this;
+    self->mpContents[ nKey ] = nContent;
+    self->mpFlags[ nKey ] = rFlags;
+    self->maRecordTypes[ nKey ] =  nRecordType;
 }
 
+
 void DffPropSet::Merge( DffPropSet& rMaster ) const
 {
-    for ( void* pDummy = rMaster.First(); pDummy; pDummy = rMaster.Next() )
+    for ( RecordTypesMap::const_iterator it = rMaster.maRecordTypes.begin();
+          it != rMaster.maRecordTypes.end(); ++it )
     {
-        sal_uInt32 nRecType = rMaster.GetCurKey();
+        sal_uInt32 nRecType = it->first;
         if ( ( nRecType & 0x3f ) == 0x3f )      // this is something called FLAGS
         {
             sal_uInt32 nCurrentFlags = mpContents[ nRecType ];
@@ -441,10 +423,11 @@ void DffPropSet::Merge( DffPropSet& rMaster ) const
             ( (DffPropSet*) this )->mpContents[ nRecType ] = nCurrentFlags;
 
 
-            sal_uInt32 nNewContentEx = (sal_uInt32)(sal_uIntPtr)rMaster.GetCurObject();
-            if ( ((DffPropSet*)this)->Seek( nRecType ) )
-                nNewContentEx |= (sal_uInt32)(sal_uIntPtr)GetCurObject();
-            ( (DffPropSet*) this )->Replace( nRecType, (void*)(sal_uIntPtr)nNewContentEx );
+            sal_uInt32 nNewContentEx = it->second;
+            RecordTypesMap::const_iterator it2 = maRecordTypes.find( nRecType );
+            if ( it2 != maRecordTypes.end() )
+                nNewContentEx |= it2->second;
+            ( (DffPropSet*) this )->maRecordTypes[ nRecType ] = nNewContentEx;
         }
         else
         {
@@ -454,7 +437,7 @@ void DffPropSet::Merge( DffPropSet& rMaster ) const
                 DffPropFlags nFlags( rMaster.mpFlags[ nRecType ] );
                 nFlags.bSoftAttr = sal_True;
                 ( (DffPropSet*) this )->mpFlags[ nRecType ] = nFlags;
-                ( (DffPropSet*) this )->Insert( nRecType, pDummy );
+                ( (DffPropSet*) this )->maRecordTypes[ nRecType ] = it->second;
             }
         }
     }
@@ -466,9 +449,10 @@ sal_Bool DffPropSet::IsHardAttribute( sal_uInt32 nId ) const
     nId &= 0x3ff;
     if ( ( nId & 0x3f ) >= 48 ) // is this a flag id
     {
-        if ( ((DffPropSet*)this)->Seek( nId | 0x3f ) )
+        RecordTypesMap::const_iterator it = maRecordTypes.find( nId | 0x3f );
+        if ( it != maRecordTypes.end() )
         {
-            sal_uInt32 nContentEx = (sal_uInt32)(sal_uIntPtr)GetCurObject();
+            sal_uInt32 nContentEx = it->second;
             bRetValue = ( nContentEx & ( 1 << ( 0xf - ( nId & 0xf ) ) ) ) != 0;
         }
     }
@@ -525,9 +509,10 @@ sal_Bool DffPropSet::SeekToContent( sal_uInt32 nRecType, SvStream& rStrm ) const
     {
         if ( mpFlags[ nRecType ].bComplex )
         {
-            if ( ((DffPropSet*)this)->Seek( nRecType ) )
+            RecordTypesMap::const_iterator it = maRecordTypes.find( nRecType );
+            if ( it != maRecordTypes.end() )
             {
-                sal_uInt32 nOffset = (sal_uInt32)(sal_uIntPtr)GetCurObject();
+                sal_uInt32 nOffset = it->second;
                 if ( nOffset && ( ( nOffset & 0xffff0000 ) != 0xffff0000 ) )
                 {
                     rStrm.Seek( nOffset );
@@ -2910,9 +2895,9 @@ void DffPropertyReader::ApplyAttributes( SvStream& rIn, SfxItemSet& rSet, const
 {
     sal_Bool bHasShadow = sal_False;
 
-    for ( void* pDummy = ((DffPropertyReader*)this)->First(); pDummy; pDummy = ((DffPropertyReader*)this)->Next() )
+    for ( RecordTypesMap::const_iterator it = maRecordTypes.begin(); it != maRecordTypes.end(); ++it )
     {
-        sal_uInt32 nRecType = GetCurKey();
+        sal_uInt32 nRecType = it->first;
         sal_uInt32 nContent = mpContents[ nRecType ];
         switch ( nRecType )
         {
@@ -3336,9 +3321,10 @@ sal_Bool SvxMSDffManager::SeekToShape( SvStream& rSt, void* /* pClientData */, s
         sal_uInt32 nShapeId, nSec = ( nId >> 10 ) - 1;
         if ( nSec < mnIdClusters )
         {
-            sal_IntPtr nOfs = (sal_IntPtr)maDgOffsetTable.Get( mpFidcls[ nSec ].dgid );
-            if ( nOfs )
+            OffsetMap::const_iterator it = maDgOffsetTable.find( mpFidcls[ nSec ].dgid );
+            if ( it != maDgOffsetTable.end() )
             {
+                sal_IntPtr nOfs = it->second;
                 rSt.Seek( nOfs );
                 DffRecordHeader aEscherF002Hd;
                 rSt >> aEscherF002Hd;
@@ -5861,7 +5847,7 @@ void SvxMSDffManager::SetDgContainer( SvStream& rSt )
         DffRecordHeader aRecHd;
         rSt >> aRecHd;
         sal_uInt32 nDrawingId = aRecHd.nRecInstance;
-        maDgOffsetTable.Insert( nDrawingId, (void*)(sal_uIntPtr)nFilePos );
+        maDgOffsetTable[ nDrawingId ] = nFilePos;
         rSt.Seek( nFilePos );
     }
 }
commit b81955ffe00f8e7137f0cd0aacc1f2970bfc02af
Author: Arnaud Versini <arnaud.versini at gmail.com>
Date:   Tue Mar 13 20:41:38 2012 +0100

    Adding virtual destructor to WW8ResourceModel.hxx classes

diff --git a/writerfilter/inc/resourcemodel/WW8ResourceModel.hxx b/writerfilter/inc/resourcemodel/WW8ResourceModel.hxx
index 9504b6f..5869f04 100644
--- a/writerfilter/inc/resourcemodel/WW8ResourceModel.hxx
+++ b/writerfilter/inc/resourcemodel/WW8ResourceModel.hxx
@@ -128,6 +128,9 @@ class Sprm;
 class WRITERFILTER_RESOURCEMODEL_DLLPUBLIC Properties
 {
 public:
+
+    virtual ~Properties() {}
+
     /**
        Receives an attribute.
 
@@ -152,6 +155,8 @@ class WRITERFILTER_RESOURCEMODEL_DLLPUBLIC Table
 {
 public:
     typedef boost::shared_ptr<Table> Pointer_t;
+
+    virtual ~Table() {}
     /**
        Receives an entry of the table.
 
@@ -167,6 +172,8 @@ public:
 class WRITERFILTER_RESOURCEMODEL_DLLPUBLIC BinaryObj
 {
 public:
+
+    virtual ~BinaryObj() {}
     /**
        Receives binary data of the object.
 
@@ -184,11 +191,14 @@ public:
 class WRITERFILTER_RESOURCEMODEL_DLLPUBLIC Stream
 {
 public:
+
     /**
        Pointer to this stream.
      */
     typedef boost::shared_ptr<Stream> Pointer_t;
 
+    virtual ~Stream() {}
+
     /**
        Receives start mark for group with the same section properties.
      */
@@ -344,6 +354,9 @@ public:
     typedef auto_ptr<Sprm> Pointer_t;
     SAL_WNODEPRECATED_DECLARATIONS_POP
     enum Kind { UNKNOWN, CHARACTER, PARAGRAPH, TABLE };
+
+    virtual ~Sprm() {}
+
     /**
        Returns id of the SPRM.
      */


More information about the Libreoffice-commits mailing list