[Libreoffice-commits] .: svx/inc svx/source

August Sodora augsod at kemper.freedesktop.org
Mon Jan 16 19:04:27 PST 2012


 svx/inc/svx/rulritem.hxx       |   31 +++++++------------------------
 svx/source/dialog/rulritem.cxx |   37 +++++--------------------------------
 2 files changed, 12 insertions(+), 56 deletions(-)

New commits:
commit d319387526870f34c49b3ef337b1b0d55767f3fe
Author: August Sodora <augsod at gmail.com>
Date:   Mon Jan 16 22:03:51 2012 -0500

    SvPtrarr->std::vector

diff --git a/svx/inc/svx/rulritem.hxx b/svx/inc/svx/rulritem.hxx
index 4689665..e1c4413 100644
--- a/svx/inc/svx/rulritem.hxx
+++ b/svx/inc/svx/rulritem.hxx
@@ -28,14 +28,10 @@
 #ifndef _SVX_RULRITEM_HXX
 #define _SVX_RULRITEM_HXX
 
-// include ---------------------------------------------------------------
-
-
 #include <tools/gen.hxx>
 #include <svl/poolitem.hxx>
 #include "svx/svxdllapi.h"
-
-// class SvxLongLRSpaceItem ----------------------------------------------
+#include <vector>
 
 class SVX_DLLPUBLIC SvxLongLRSpaceItem : public SfxPoolItem
 {
@@ -71,8 +67,6 @@ public:
     void    SetRight(long lArgRight) {lRight=lArgRight;}
 };
 
-// class SvxLongULSpaceItem ----------------------------------------------
-
 class SVX_DLLPUBLIC SvxLongULSpaceItem : public SfxPoolItem
 {
     long    lLeft;         // nLeft or the negative first-line indentation
@@ -107,8 +101,6 @@ public:
     void    SetLower(long lArgRight) {lRight=lArgRight;}
 };
 
-// class SvxPagePosSizeItem ----------------------------------------------
-
 class SVX_DLLPUBLIC SvxPagePosSizeItem : public SfxPoolItem
 {
     Point aPos;
@@ -140,8 +132,6 @@ public:
     long    GetHeight() const { return lHeight; }
 };
 
-// struct SvxColumnDescription -------------------------------------------
-
 struct SvxColumnDescription
 {
     long nStart;                    /* Start of the column */
@@ -185,13 +175,9 @@ struct SvxColumnDescription
     long GetWidth() const { return nEnd - nStart; }
 };
 
-// class SvxColumnItem ---------------------------------------------------
-
-typedef SvPtrarr SvxColumns;
-
 class SVX_DLLPUBLIC SvxColumnItem : public SfxPoolItem
 {
-    SvxColumns aColumns;// Column array
+    std::vector<SvxColumnDescription> aColumns;// Column array
     long    nLeft,      // Left edge for the table
            nRight;      // Right edge for the table; for columns always
                                 // equal to the surrounding frame
@@ -199,8 +185,6 @@ class SVX_DLLPUBLIC SvxColumnItem : public SfxPoolItem
     sal_uInt8  bTable;      // table?
     sal_uInt8  bOrtho;     // evenly spread columns
 
-    void DeleteAndDestroyColumns();
-
 protected:
     virtual int              operator==( const SfxPoolItem& ) const;
 
@@ -225,14 +209,13 @@ public:
 
     const SvxColumnItem &operator=(const SvxColumnItem &);
 
-    sal_uInt16 Count() const { return aColumns.Count(); }
+    sal_uInt16 Count() const { return aColumns.size(); }
     SvxColumnDescription &operator[](sal_uInt16 i)
-        { return *(SvxColumnDescription*)aColumns[i]; }
+        { return aColumns[i]; }
     const SvxColumnDescription &operator[](sal_uInt16 i) const
-        { return *(SvxColumnDescription*)aColumns[i]; }
+        { return aColumns[i]; }
     void Insert(const SvxColumnDescription &rDesc, sal_uInt16 nPos) {
-        SvxColumnDescription* pDesc = new SvxColumnDescription(rDesc);
-        aColumns.Insert(pDesc, nPos);
+        aColumns.insert(aColumns.begin() + nPos, rDesc);
     }
     void   Append(const SvxColumnDescription &rDesc) { Insert(rDesc, Count()); }
     void   SetLeft(long left) { nLeft = left; }
@@ -251,7 +234,7 @@ public:
     void   SetOrtho(sal_Bool bVal) { bOrtho = bVal; }
     sal_Bool   IsOrtho () const { return sal_False ; }
 
-    sal_Bool IsConsistent() const  { return nActColumn < aColumns.Count(); }
+    sal_Bool IsConsistent() const  { return nActColumn < aColumns.size(); }
     long   GetVisibleRight() const;// right visible edge of the current column
 };
 
diff --git a/svx/source/dialog/rulritem.cxx b/svx/source/dialog/rulritem.cxx
index 640ce1f..1be621b 100644
--- a/svx/source/dialog/rulritem.cxx
+++ b/svx/source/dialog/rulritem.cxx
@@ -429,18 +429,6 @@ SvxPagePosSizeItem::SvxPagePosSizeItem()
 
 //------------------------------------------------------------------------
 
-void SvxColumnItem::DeleteAndDestroyColumns()
-{
-    for( sal_uInt16 i = aColumns.Count(); i>0; )
-    {
-        SvxColumnDescription *pTmp = (SvxColumnDescription *)aColumns[--i];
-        aColumns.Remove( i );
-        delete pTmp;
-    }
-}
-
-//------------------------------------------------------------------------
-
 int SvxColumnItem::operator==(const SfxPoolItem& rCmp) const
 {
     if(!SfxPoolItem::operator==(rCmp) ||
@@ -515,50 +503,35 @@ SvxColumnItem::SvxColumnItem( sal_uInt16 nActCol, sal_uInt16 left, sal_uInt16 ri
 {
 }
 
-//------------------------------------------------------------------------
-
 SvxColumnItem::SvxColumnItem( const SvxColumnItem& rCopy ) :
-
     SfxPoolItem( rCopy ),
-
       aColumns  ( (sal_uInt8)rCopy.Count() ),
       nLeft     ( rCopy.nLeft ),
       nRight    ( rCopy.nRight ),
       nActColumn( rCopy.nActColumn ),
       bTable    ( rCopy.bTable ),
       bOrtho    ( rCopy.bOrtho )
-
 {
-    const sal_uInt16 nCount = rCopy.Count();
-
-    for ( sal_uInt16 i = 0; i < nCount; ++i )
-        Append( rCopy[i] );
+    for(size_t i = 0; i < rCopy.Count(); ++i)
+        aColumns.push_back(rCopy[i]);
 }
 
-//------------------------------------------------------------------------
-
 SvxColumnItem::~SvxColumnItem()
 {
-    DeleteAndDestroyColumns();
 }
 
-//------------------------------------------------------------------------
-
 const SvxColumnItem &SvxColumnItem::operator=(const SvxColumnItem &rCopy)
 {
     nLeft = rCopy.nLeft;
     nRight = rCopy.nRight;
     bTable = rCopy.bTable;
     nActColumn = rCopy.nActColumn;
-    DeleteAndDestroyColumns();
-    const sal_uInt16 nCount = rCopy.Count();
-    for(sal_uInt16 i = 0; i < nCount;++i)
-        Insert(rCopy[i], i);
+    aColumns.clear();
+    for(size_t i = 0; i < rCopy.Count(); ++i)
+        aColumns.push_back(rCopy[i]);
     return *this;
 }
 
-//------------------------------------------------------------------------
-
 sal_Bool SvxColumnItem::CalcOrtho() const
 {
     const sal_uInt16 nCount = Count();


More information about the Libreoffice-commits mailing list