Kaydet (Commit) d3193875 authored tarafından August Sodora's avatar August Sodora

SvPtrarr->std::vector

üst cd10d4e8
...@@ -28,14 +28,10 @@ ...@@ -28,14 +28,10 @@
#ifndef _SVX_RULRITEM_HXX #ifndef _SVX_RULRITEM_HXX
#define _SVX_RULRITEM_HXX #define _SVX_RULRITEM_HXX
// include ---------------------------------------------------------------
#include <tools/gen.hxx> #include <tools/gen.hxx>
#include <svl/poolitem.hxx> #include <svl/poolitem.hxx>
#include "svx/svxdllapi.h" #include "svx/svxdllapi.h"
#include <vector>
// class SvxLongLRSpaceItem ----------------------------------------------
class SVX_DLLPUBLIC SvxLongLRSpaceItem : public SfxPoolItem class SVX_DLLPUBLIC SvxLongLRSpaceItem : public SfxPoolItem
{ {
...@@ -71,8 +67,6 @@ public: ...@@ -71,8 +67,6 @@ public:
void SetRight(long lArgRight) {lRight=lArgRight;} void SetRight(long lArgRight) {lRight=lArgRight;}
}; };
// class SvxLongULSpaceItem ----------------------------------------------
class SVX_DLLPUBLIC SvxLongULSpaceItem : public SfxPoolItem class SVX_DLLPUBLIC SvxLongULSpaceItem : public SfxPoolItem
{ {
long lLeft; // nLeft or the negative first-line indentation long lLeft; // nLeft or the negative first-line indentation
...@@ -107,8 +101,6 @@ public: ...@@ -107,8 +101,6 @@ public:
void SetLower(long lArgRight) {lRight=lArgRight;} void SetLower(long lArgRight) {lRight=lArgRight;}
}; };
// class SvxPagePosSizeItem ----------------------------------------------
class SVX_DLLPUBLIC SvxPagePosSizeItem : public SfxPoolItem class SVX_DLLPUBLIC SvxPagePosSizeItem : public SfxPoolItem
{ {
Point aPos; Point aPos;
...@@ -140,8 +132,6 @@ public: ...@@ -140,8 +132,6 @@ public:
long GetHeight() const { return lHeight; } long GetHeight() const { return lHeight; }
}; };
// struct SvxColumnDescription -------------------------------------------
struct SvxColumnDescription struct SvxColumnDescription
{ {
long nStart; /* Start of the column */ long nStart; /* Start of the column */
...@@ -185,13 +175,9 @@ struct SvxColumnDescription ...@@ -185,13 +175,9 @@ struct SvxColumnDescription
long GetWidth() const { return nEnd - nStart; } long GetWidth() const { return nEnd - nStart; }
}; };
// class SvxColumnItem ---------------------------------------------------
typedef SvPtrarr SvxColumns;
class SVX_DLLPUBLIC SvxColumnItem : public SfxPoolItem class SVX_DLLPUBLIC SvxColumnItem : public SfxPoolItem
{ {
SvxColumns aColumns;// Column array std::vector<SvxColumnDescription> aColumns;// Column array
long nLeft, // Left edge for the table long nLeft, // Left edge for the table
nRight; // Right edge for the table; for columns always nRight; // Right edge for the table; for columns always
// equal to the surrounding frame // equal to the surrounding frame
...@@ -199,8 +185,6 @@ class SVX_DLLPUBLIC SvxColumnItem : public SfxPoolItem ...@@ -199,8 +185,6 @@ class SVX_DLLPUBLIC SvxColumnItem : public SfxPoolItem
sal_uInt8 bTable; // table? sal_uInt8 bTable; // table?
sal_uInt8 bOrtho; // evenly spread columns sal_uInt8 bOrtho; // evenly spread columns
void DeleteAndDestroyColumns();
protected: protected:
virtual int operator==( const SfxPoolItem& ) const; virtual int operator==( const SfxPoolItem& ) const;
...@@ -225,14 +209,13 @@ public: ...@@ -225,14 +209,13 @@ public:
const SvxColumnItem &operator=(const SvxColumnItem &); const SvxColumnItem &operator=(const SvxColumnItem &);
sal_uInt16 Count() const { return aColumns.Count(); } sal_uInt16 Count() const { return aColumns.size(); }
SvxColumnDescription &operator[](sal_uInt16 i) SvxColumnDescription &operator[](sal_uInt16 i)
{ return *(SvxColumnDescription*)aColumns[i]; } { return aColumns[i]; }
const SvxColumnDescription &operator[](sal_uInt16 i) const const SvxColumnDescription &operator[](sal_uInt16 i) const
{ return *(SvxColumnDescription*)aColumns[i]; } { return aColumns[i]; }
void Insert(const SvxColumnDescription &rDesc, sal_uInt16 nPos) { void Insert(const SvxColumnDescription &rDesc, sal_uInt16 nPos) {
SvxColumnDescription* pDesc = new SvxColumnDescription(rDesc); aColumns.insert(aColumns.begin() + nPos, rDesc);
aColumns.Insert(pDesc, nPos);
} }
void Append(const SvxColumnDescription &rDesc) { Insert(rDesc, Count()); } void Append(const SvxColumnDescription &rDesc) { Insert(rDesc, Count()); }
void SetLeft(long left) { nLeft = left; } void SetLeft(long left) { nLeft = left; }
...@@ -251,7 +234,7 @@ public: ...@@ -251,7 +234,7 @@ public:
void SetOrtho(sal_Bool bVal) { bOrtho = bVal; } void SetOrtho(sal_Bool bVal) { bOrtho = bVal; }
sal_Bool IsOrtho () const { return sal_False ; } 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 long GetVisibleRight() const;// right visible edge of the current column
}; };
......
...@@ -429,18 +429,6 @@ SvxPagePosSizeItem::SvxPagePosSizeItem() ...@@ -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 int SvxColumnItem::operator==(const SfxPoolItem& rCmp) const
{ {
if(!SfxPoolItem::operator==(rCmp) || if(!SfxPoolItem::operator==(rCmp) ||
...@@ -515,50 +503,35 @@ SvxColumnItem::SvxColumnItem( sal_uInt16 nActCol, sal_uInt16 left, sal_uInt16 ri ...@@ -515,50 +503,35 @@ SvxColumnItem::SvxColumnItem( sal_uInt16 nActCol, sal_uInt16 left, sal_uInt16 ri
{ {
} }
//------------------------------------------------------------------------
SvxColumnItem::SvxColumnItem( const SvxColumnItem& rCopy ) : SvxColumnItem::SvxColumnItem( const SvxColumnItem& rCopy ) :
SfxPoolItem( rCopy ), SfxPoolItem( rCopy ),
aColumns ( (sal_uInt8)rCopy.Count() ), aColumns ( (sal_uInt8)rCopy.Count() ),
nLeft ( rCopy.nLeft ), nLeft ( rCopy.nLeft ),
nRight ( rCopy.nRight ), nRight ( rCopy.nRight ),
nActColumn( rCopy.nActColumn ), nActColumn( rCopy.nActColumn ),
bTable ( rCopy.bTable ), bTable ( rCopy.bTable ),
bOrtho ( rCopy.bOrtho ) bOrtho ( rCopy.bOrtho )
{ {
const sal_uInt16 nCount = rCopy.Count(); for(size_t i = 0; i < rCopy.Count(); ++i)
aColumns.push_back(rCopy[i]);
for ( sal_uInt16 i = 0; i < nCount; ++i )
Append( rCopy[i] );
} }
//------------------------------------------------------------------------
SvxColumnItem::~SvxColumnItem() SvxColumnItem::~SvxColumnItem()
{ {
DeleteAndDestroyColumns();
} }
//------------------------------------------------------------------------
const SvxColumnItem &SvxColumnItem::operator=(const SvxColumnItem &rCopy) const SvxColumnItem &SvxColumnItem::operator=(const SvxColumnItem &rCopy)
{ {
nLeft = rCopy.nLeft; nLeft = rCopy.nLeft;
nRight = rCopy.nRight; nRight = rCopy.nRight;
bTable = rCopy.bTable; bTable = rCopy.bTable;
nActColumn = rCopy.nActColumn; nActColumn = rCopy.nActColumn;
DeleteAndDestroyColumns(); aColumns.clear();
const sal_uInt16 nCount = rCopy.Count(); for(size_t i = 0; i < rCopy.Count(); ++i)
for(sal_uInt16 i = 0; i < nCount;++i) aColumns.push_back(rCopy[i]);
Insert(rCopy[i], i);
return *this; return *this;
} }
//------------------------------------------------------------------------
sal_Bool SvxColumnItem::CalcOrtho() const sal_Bool SvxColumnItem::CalcOrtho() const
{ {
const sal_uInt16 nCount = Count(); const sal_uInt16 nCount = Count();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment