[Libreoffice-commits] .: 2 commits - svx/inc svx/source
Joseph Powers
jpowers at kemper.freedesktop.org
Tue Jun 21 06:24:21 PDT 2011
svx/inc/svx/xtable.hxx | 49 ++++++++++----------
svx/source/unodraw/XPropertyTable.cxx | 12 ++---
svx/source/xoutdev/xtabbtmp.cxx | 14 +++--
svx/source/xoutdev/xtabcolr.cxx | 14 +++--
svx/source/xoutdev/xtabdash.cxx | 14 +++--
svx/source/xoutdev/xtabgrdt.cxx | 14 +++--
svx/source/xoutdev/xtabhtch.cxx | 14 +++--
svx/source/xoutdev/xtable.cxx | 80 +++++++++++++++++++---------------
svx/source/xoutdev/xtablend.cxx | 14 +++--
9 files changed, 129 insertions(+), 96 deletions(-)
New commits:
commit 6345a547421fd34eee721a4f279300ffed3e0659
Author: Joseph Powers <jpowers27 at cox.net>
Date: Tue Jun 21 06:22:01 2011 -0700
Remove the nDummy parameter from XPropertyTable::Remove()
diff --git a/svx/inc/svx/xtable.hxx b/svx/inc/svx/xtable.hxx
index afa1079..5e5d4c4 100644
--- a/svx/inc/svx/xtable.hxx
+++ b/svx/inc/svx/xtable.hxx
@@ -198,9 +198,9 @@ protected:
Table aTable;
Table* pBmpTable;
- sal_Bool bTableDirty;
- sal_Bool bBitmapsDirty;
- sal_Bool bOwnPool;
+ sal_Bool bTableDirty;
+ sal_Bool bBitmapsDirty;
+ sal_Bool bOwnPool;
XPropertyTable( const String& rPath,
XOutdevItemPool* pXPool = NULL,
@@ -214,9 +214,9 @@ public:
long Count() const;
- sal_Bool Insert(long nIndex, XPropertyEntry* pEntry);
+ sal_Bool Insert(long nIndex, XPropertyEntry* pEntry);
XPropertyEntry* Replace(long nIndex, XPropertyEntry* pEntry);
- XPropertyEntry* Remove(long nIndex, sal_uInt16 nDummy);
+ XPropertyEntry* Remove(long nIndex);
XPropertyEntry* Get( long nIndex, sal_uInt16 nDummy ) const;
long Get(const String& rName);
@@ -226,14 +226,14 @@ public:
void SetName( const String& rString );
const String& GetPath() const { return aPath; }
void SetPath( const String& rString ) { aPath = rString; }
- sal_Bool IsDirty() const { return bTableDirty && bBitmapsDirty; }
+ sal_Bool IsDirty() const { return bTableDirty && bBitmapsDirty; }
void SetDirty( sal_Bool bDirty = sal_True )
{ bTableDirty = bDirty; bBitmapsDirty = bDirty; }
- virtual sal_Bool Load() = 0;
- virtual sal_Bool Save() = 0;
- virtual sal_Bool Create() = 0;
- virtual sal_Bool CreateBitmapsForUI() = 0;
+ virtual sal_Bool Load() = 0;
+ virtual sal_Bool Save() = 0;
+ virtual sal_Bool Create() = 0;
+ virtual sal_Bool CreateBitmapsForUI() = 0;
virtual Bitmap* CreateBitmapForUI( long nIndex, sal_Bool bDelete = sal_True ) = 0;
};
diff --git a/svx/source/unodraw/XPropertyTable.cxx b/svx/source/unodraw/XPropertyTable.cxx
index b09b244..a7baeee 100644
--- a/svx/source/unodraw/XPropertyTable.cxx
+++ b/svx/source/unodraw/XPropertyTable.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -173,7 +173,7 @@ void SAL_CALL SvxUnoXPropertyTable::removeByName( const OUString& Name )
if( mpList )
delete mpList->Remove( i, 0 );
else
- delete mpTable->Remove( i, 0 );
+ delete mpTable->Remove( i );
return;
}
}
@@ -543,7 +543,7 @@ uno::Any SvxUnoXHatchTable::getAny( const XPropertyEntry* pEntry ) const throw()
aUnoHatch.Color = aHatch.GetColor().GetColor();
aUnoHatch.Distance = aHatch.GetDistance();
aUnoHatch.Angle = aHatch.GetAngle();
-
+
uno::Any aAny;
aAny <<= aUnoHatch;
return aAny;
@@ -701,9 +701,9 @@ uno::Reference< uno::XInterface > SAL_CALL SvxUnoXBitmapTable_createInstance( XP
// SvxUnoXPropertyTable
uno::Any SvxUnoXBitmapTable::getAny( const XPropertyEntry* pEntry ) const throw()
{
- OUString aURL( RTL_CONSTASCII_USTRINGPARAM(UNO_NAME_GRAPHOBJ_URLPREFIX));
+ OUString aURL( RTL_CONSTASCII_USTRINGPARAM(UNO_NAME_GRAPHOBJ_URLPREFIX));
aURL += OUString::createFromAscii( ((XBitmapEntry*)pEntry)->GetXBitmap().GetGraphicObject().GetUniqueID().GetBuffer() );
-
+
uno::Any aAny;
aAny <<= aURL;
return aAny;
@@ -717,7 +717,7 @@ XPropertyEntry* SvxUnoXBitmapTable::getEntry( const OUString& rName, const uno::
GraphicObject aGrafObj( GraphicObject::CreateGraphicObjectFromURL( aURL ) );
XOBitmap aBMP( aGrafObj );
-
+
const String aName( rName );
return new XBitmapEntry( aBMP, aName );
}
diff --git a/svx/source/xoutdev/xtabbtmp.cxx b/svx/source/xoutdev/xtabbtmp.cxx
index 6d638bc..2510ff6 100644
--- a/svx/source/xoutdev/xtabbtmp.cxx
+++ b/svx/source/xoutdev/xtabbtmp.cxx
@@ -93,7 +93,7 @@ XBitmapEntry* XBitmapTable::Replace(long nIndex, XBitmapEntry* pEntry )
XBitmapEntry* XBitmapTable::Remove(long nIndex)
{
- return (XBitmapEntry*) XPropertyTable::Remove(nIndex, 0);
+ return (XBitmapEntry*) XPropertyTable::Remove(nIndex);
}
/************************************************************************/
diff --git a/svx/source/xoutdev/xtabcolr.cxx b/svx/source/xoutdev/xtabcolr.cxx
index 311f303..e65ccbf 100644
--- a/svx/source/xoutdev/xtabcolr.cxx
+++ b/svx/source/xoutdev/xtabcolr.cxx
@@ -95,7 +95,7 @@ XColorEntry* XColorTable::Replace(long nIndex, XColorEntry* pEntry )
XColorEntry* XColorTable::Remove(long nIndex)
{
- return (XColorEntry*) XPropertyTable::Remove(nIndex, 0);
+ return (XColorEntry*) XPropertyTable::Remove(nIndex);
}
/************************************************************************/
diff --git a/svx/source/xoutdev/xtabdash.cxx b/svx/source/xoutdev/xtabdash.cxx
index 9f8bd33..b0f3422 100644
--- a/svx/source/xoutdev/xtabdash.cxx
+++ b/svx/source/xoutdev/xtabdash.cxx
@@ -108,7 +108,7 @@ XDashEntry* XDashTable::Replace(long nIndex, XDashEntry* pEntry )
XDashEntry* XDashTable::Remove(long nIndex)
{
- return (XDashEntry*) XPropertyTable::Remove(nIndex, 0);
+ return (XDashEntry*) XPropertyTable::Remove(nIndex);
}
/************************************************************************/
diff --git a/svx/source/xoutdev/xtabgrdt.cxx b/svx/source/xoutdev/xtabgrdt.cxx
index c950b14..41dc11a 100644
--- a/svx/source/xoutdev/xtabgrdt.cxx
+++ b/svx/source/xoutdev/xtabgrdt.cxx
@@ -104,7 +104,7 @@ XGradientEntry* XGradientTable::Replace(long nIndex, XGradientEntry* pEntry )
XGradientEntry* XGradientTable::Remove(long nIndex)
{
- return (XGradientEntry*) XPropertyTable::Remove(nIndex, 0);
+ return (XGradientEntry*) XPropertyTable::Remove(nIndex);
}
/************************************************************************/
diff --git a/svx/source/xoutdev/xtabhtch.cxx b/svx/source/xoutdev/xtabhtch.cxx
index 4bc5254..8e3ece3 100644
--- a/svx/source/xoutdev/xtabhtch.cxx
+++ b/svx/source/xoutdev/xtabhtch.cxx
@@ -102,7 +102,7 @@ XHatchEntry* XHatchTable::Replace(long nIndex, XHatchEntry* pEntry )
XHatchEntry* XHatchTable::Remove(long nIndex)
{
- return (XHatchEntry*) XPropertyTable::Remove(nIndex, 0);
+ return (XHatchEntry*) XPropertyTable::Remove(nIndex);
}
/************************************************************************/
diff --git a/svx/source/xoutdev/xtable.cxx b/svx/source/xoutdev/xtable.cxx
index f089791..9e17863 100644
--- a/svx/source/xoutdev/xtable.cxx
+++ b/svx/source/xoutdev/xtable.cxx
@@ -256,7 +256,7 @@ XPropertyEntry* XPropertyTable::Replace( long nIndex, XPropertyEntry* pEntry )
|*
*************************************************************************/
-XPropertyEntry* XPropertyTable::Remove( long nIndex, sal_uInt16 /*nDummy*/)
+XPropertyEntry* XPropertyTable::Remove( long nIndex )
{
if( pBmpTable && !bBitmapsDirty )
{
diff --git a/svx/source/xoutdev/xtablend.cxx b/svx/source/xoutdev/xtablend.cxx
index b48a1d7..cf7ea0b 100644
--- a/svx/source/xoutdev/xtablend.cxx
+++ b/svx/source/xoutdev/xtablend.cxx
@@ -115,7 +115,7 @@ XLineEndEntry* XLineEndTable::Replace(long nIndex, XLineEndEntry* pEntry )
XLineEndEntry* XLineEndTable::Remove(long nIndex)
{
- return (XLineEndEntry*) XPropertyTable::Remove(nIndex, 0);
+ return (XLineEndEntry*) XPropertyTable::Remove(nIndex);
}
/************************************************************************/
commit 6b388e3e1eb4b62e3e28243105e8d27c7bc59c30
Author: Joseph Powers <jpowers27 at cox.net>
Date: Sun Jun 19 21:27:48 2011 -0700
Replace List with std::vector< XPropertyEntry* >
diff --git a/svx/inc/svx/xtable.hxx b/svx/inc/svx/xtable.hxx
index 77eee35..afa1079 100644
--- a/svx/inc/svx/xtable.hxx
+++ b/svx/inc/svx/xtable.hxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -104,19 +104,19 @@ class XLineEndEntry : public XPropertyEntry
basegfx::B2DPolyPolygon aB2DPolyPolygon;
public:
- XLineEndEntry(const basegfx::B2DPolyPolygon& rB2DPolyPolygon, const String& rName)
- : XPropertyEntry(rName),
- aB2DPolyPolygon(rB2DPolyPolygon)
+ XLineEndEntry(const basegfx::B2DPolyPolygon& rB2DPolyPolygon, const String& rName)
+ : XPropertyEntry(rName),
+ aB2DPolyPolygon(rB2DPolyPolygon)
{}
- void SetLineEnd(const basegfx::B2DPolyPolygon& rB2DPolyPolygon)
- {
- aB2DPolyPolygon = rB2DPolyPolygon;
+ void SetLineEnd(const basegfx::B2DPolyPolygon& rB2DPolyPolygon)
+ {
+ aB2DPolyPolygon = rB2DPolyPolygon;
}
basegfx::B2DPolyPolygon& GetLineEnd()
- {
- return aB2DPolyPolygon;
+ {
+ return aB2DPolyPolygon;
}
};
@@ -241,6 +241,7 @@ public:
// class XPropertyList
// --------------------
+typedef ::std::vector< XPropertyEntry* > XPropertyEntryList_impl;
class SVX_DLLPUBLIC XPropertyList
{
protected:
@@ -248,17 +249,17 @@ protected:
String aPath;
XOutdevItemPool* pXPool;
- List aList;
+ XPropertyEntryList_impl aList;
List* pBmpList;
sal_Bool bListDirty;
sal_Bool bBitmapsDirty;
sal_Bool bOwnPool;
- XPropertyList( const String& rPath,
- XOutdevItemPool* pXPool = NULL,
- sal_uInt16 nInitSize = 16,
- sal_uInt16 nReSize = 16 );
+ XPropertyList(
+ const String& rPath,
+ XOutdevItemPool* pXPool = NULL
+ );
XPropertyList( SvStream& rIn );
void Clear();
diff --git a/svx/source/xoutdev/xtabbtmp.cxx b/svx/source/xoutdev/xtabbtmp.cxx
index faa8387..6d638bc 100644
--- a/svx/source/xoutdev/xtabbtmp.cxx
+++ b/svx/source/xoutdev/xtabbtmp.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -148,10 +148,12 @@ Bitmap* XBitmapTable::CreateBitmapForUI( long /*nIndex*/, sal_Bool /*bDelete*/)
|*
*************************************************************************/
-XBitmapList::XBitmapList( const String& rPath,
- XOutdevItemPool* pInPool,
- sal_uInt16 nInitSize, sal_uInt16 nReSize ) :
- XPropertyList( rPath, pInPool, nInitSize, nReSize)
+XBitmapList::XBitmapList(
+ const String& rPath,
+ XOutdevItemPool* pInPool,
+ sal_uInt16 /* nInitSize */,
+ sal_uInt16 /* nReSize */
+) : XPropertyList( rPath, pInPool )
{
// pBmpList = new List( nInitSize, nReSize );
}
diff --git a/svx/source/xoutdev/xtabcolr.cxx b/svx/source/xoutdev/xtabcolr.cxx
index a0c8875..311f303 100644
--- a/svx/source/xoutdev/xtabcolr.cxx
+++ b/svx/source/xoutdev/xtabcolr.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -466,10 +466,12 @@ Bitmap* XColorTable::CreateBitmapForUI( long /*nIndex*/, sal_Bool /*bDelete*/)
|*
*************************************************************************/
-XColorList::XColorList( const String& rPath,
- XOutdevItemPool* pInPool,
- sal_uInt16 nInitSize, sal_uInt16 nReSize ) :
- XPropertyList( rPath, pInPool, nInitSize, nReSize)
+XColorList::XColorList(
+ const String& rPath,
+ XOutdevItemPool* pInPool,
+ sal_uInt16 /* nInitSize */,
+ sal_uInt16 /* nReSize */
+) : XPropertyList( rPath, pInPool )
{
// pBmpList = new List( nInitSize, nReSize );
}
diff --git a/svx/source/xoutdev/xtabdash.cxx b/svx/source/xoutdev/xtabdash.cxx
index 4c3fc97..9f8bd33 100644
--- a/svx/source/xoutdev/xtabdash.cxx
+++ b/svx/source/xoutdev/xtabdash.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -201,7 +201,7 @@ void XDashList::impCreate()
pVirDev->SetDrawMode(rStyleSettings.GetHighContrastMode()
? DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT
: DRAWMODE_DEFAULT);
-
+
SdrModel* pSdrModel = new SdrModel();
OSL_ENSURE(0 != pSdrModel, "XDashList: no SdrModel created!" );
pSdrModel->GetItemPool().FreezeIdRanges();
@@ -240,8 +240,12 @@ void XDashList::impDestroy()
}
}
-XDashList::XDashList(const String& rPath, XOutdevItemPool* pInPool, sal_uInt16 nInitSize, sal_uInt16 nReSize)
-: XPropertyList(rPath, pInPool, nInitSize, nReSize),
+XDashList::XDashList(
+ const String& rPath,
+ XOutdevItemPool* pInPool,
+ sal_uInt16 nInitSize,
+ sal_uInt16 nReSize
+) : XPropertyList( rPath, pInPool ),
mpData(0)
{
pBmpList = new List(nInitSize, nReSize);
diff --git a/svx/source/xoutdev/xtabgrdt.cxx b/svx/source/xoutdev/xtabgrdt.cxx
index 030b170..c950b14 100644
--- a/svx/source/xoutdev/xtabgrdt.cxx
+++ b/svx/source/xoutdev/xtabgrdt.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -193,7 +193,7 @@ void XGradientList::impCreate()
pVirDev->SetDrawMode(rStyleSettings.GetHighContrastMode()
? DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT
: DRAWMODE_DEFAULT);
-
+
SdrModel* pSdrModel = new SdrModel();
OSL_ENSURE(0 != pSdrModel, "XGradientList: no SdrModel created!" );
pSdrModel->GetItemPool().FreezeIdRanges();
@@ -222,8 +222,12 @@ void XGradientList::impDestroy()
}
}
-XGradientList::XGradientList( const String& rPath, XOutdevItemPool* pInPool, sal_uInt16 nInitSize, sal_uInt16 nReSize)
-: XPropertyList(rPath, pInPool, nInitSize, nReSize),
+XGradientList::XGradientList(
+ const String& rPath,
+ XOutdevItemPool* pInPool,
+ sal_uInt16 nInitSize,
+ sal_uInt16 nReSize
+) : XPropertyList( rPath, pInPool ),
mpData(0)
{
pBmpList = new List(nInitSize, nReSize);
diff --git a/svx/source/xoutdev/xtabhtch.cxx b/svx/source/xoutdev/xtabhtch.cxx
index 569d159..4bc5254 100644
--- a/svx/source/xoutdev/xtabhtch.cxx
+++ b/svx/source/xoutdev/xtabhtch.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -195,7 +195,7 @@ void XHatchList::impCreate()
pVirDev->SetDrawMode(rStyleSettings.GetHighContrastMode()
? DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT
: DRAWMODE_DEFAULT);
-
+
SdrModel* pSdrModel = new SdrModel();
OSL_ENSURE(0 != pSdrModel, "XDashList: no SdrModel created!" );
pSdrModel->GetItemPool().FreezeIdRanges();
@@ -230,8 +230,12 @@ void XHatchList::impDestroy()
}
}
-XHatchList::XHatchList(const String& rPath, XOutdevItemPool* pInPool, sal_uInt16 nInitSize, sal_uInt16 nReSize)
-: XPropertyList(rPath, pInPool, nInitSize, nReSize),
+XHatchList::XHatchList(
+ const String& rPath,
+ XOutdevItemPool* pInPool,
+ sal_uInt16 nInitSize,
+ sal_uInt16 nReSize
+) : XPropertyList( rPath, pInPool ),
mpData(0)
{
pBmpList = new List(nInitSize, nReSize);
diff --git a/svx/source/xoutdev/xtable.cxx b/svx/source/xoutdev/xtable.cxx
index 18b4666..f089791 100644
--- a/svx/source/xoutdev/xtable.cxx
+++ b/svx/source/xoutdev/xtable.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -288,17 +288,16 @@ void XPropertyTable::SetName( const String& rString )
|*
*************************************************************************/
-XPropertyList::XPropertyList( const String& rPath,
- XOutdevItemPool* pInPool,
- sal_uInt16 nInitSize, sal_uInt16 nReSize ) :
- aName ( pszStandard, 8 ),
- aPath ( rPath ),
- pXPool ( pInPool ),
- aList ( nInitSize, nReSize ),
- pBmpList ( NULL ),
- bListDirty ( sal_True ),
- bBitmapsDirty ( sal_True ),
- bOwnPool ( sal_False )
+XPropertyList::XPropertyList(
+ const String& rPath,
+ XOutdevItemPool* pInPool
+) : aName ( pszStandard, 8 ),
+ aPath ( rPath ),
+ pXPool ( pInPool ),
+ pBmpList ( NULL ),
+ bListDirty ( sal_True ),
+ bBitmapsDirty ( sal_True ),
+ bOwnPool ( sal_False )
{
if( !pXPool )
{
@@ -327,14 +326,12 @@ XPropertyList::XPropertyList( SvStream& /*rIn*/) :
XPropertyList::~XPropertyList()
{
- XPropertyEntry* pEntry = (XPropertyEntry*)aList.First();
- Bitmap* pBitmap = NULL;
- for( sal_uIntPtr nIndex = 0; nIndex < aList.Count(); nIndex++ )
- {
- delete pEntry;
- pEntry = (XPropertyEntry*)aList.Next();
+ for( size_t i = 0, n = aList.size(); i < n; ++i ) {
+ delete aList[ i ];
}
+ aList.clear();
+ Bitmap* pBitmap = NULL;
if( pBmpList )
{
pBitmap = (Bitmap*) pBmpList->First();
@@ -362,7 +359,10 @@ XPropertyList::~XPropertyList()
void XPropertyList::Clear()
{
- aList.Clear();
+ for( size_t i = 0, n = aList.size(); i < n; ++i ) {
+ delete aList[ i ];
+ }
+ aList.clear();
if( pBmpList )
pBmpList->Clear();
}
@@ -377,7 +377,7 @@ long XPropertyList::Count() const
if( !( (XPropertyList*) this )->Load() )
( (XPropertyList*) this )->Create();
}
- return( aList.Count() );
+ return( aList.size() );
}
/*************************************************************************
@@ -394,7 +394,7 @@ XPropertyEntry* XPropertyList::Get( long nIndex, sal_uInt16 /*nDummy*/) const
if( !( (XPropertyList*) this )->Load() )
( (XPropertyList*) this )->Create();
}
- return (XPropertyEntry*) aList.GetObject( (sal_uIntPtr) nIndex );
+ return ( (size_t)nIndex < aList.size() ) ? aList[ nIndex ] : NULL;
}
/*************************************************************************
@@ -411,15 +411,13 @@ long XPropertyList::Get(const XubString& rName)
if( !Load() )
Create();
}
- long nPos = 0;
- XPropertyEntry* pEntry = (XPropertyEntry*)aList.First();
- while (pEntry && pEntry->GetName() != rName)
- {
- nPos++;
- pEntry = (XPropertyEntry*)aList.Next();
+
+ for( long i = 0, n = aList.size(); i < n; ++i ) {
+ if ( aList[ i ]->GetName() == rName ) {
+ return i;
+ }
}
- if (!pEntry) nPos = -1;
- return nPos;
+ return -1;
}
/*************************************************************************
@@ -451,12 +449,17 @@ Bitmap* XPropertyList::GetBitmap( long nIndex ) const
void XPropertyList::Insert( XPropertyEntry* pEntry, long nIndex )
{
- aList.Insert( pEntry, (sal_uIntPtr) nIndex );
+ if ( (size_t)nIndex < aList.size() ) {
+ aList.insert( aList.begin() + nIndex, pEntry );
+ } else {
+ aList.push_back( pEntry );
+ }
if( pBmpList && !bBitmapsDirty )
{
Bitmap* pBmp = CreateBitmapForUI(
- (sal_uIntPtr) nIndex < aList.Count() ? nIndex : aList.Count() - 1 );
+ (size_t)nIndex < aList.size() ? nIndex : aList.size() - 1
+ );
pBmpList->Insert( pBmp, (sal_uIntPtr) nIndex );
}
}
@@ -469,7 +472,10 @@ void XPropertyList::Insert( XPropertyEntry* pEntry, long nIndex )
XPropertyEntry* XPropertyList::Replace( XPropertyEntry* pEntry, long nIndex )
{
- XPropertyEntry* pOldEntry = (XPropertyEntry*) aList.Replace( pEntry, (sal_uIntPtr) nIndex );
+ XPropertyEntry* pOldEntry = (size_t)nIndex < aList.size() ? aList[ nIndex ] : NULL;
+ if ( pOldEntry ) {
+ aList[ nIndex ] = pEntry;
+ }
if( pBmpList && !bBitmapsDirty )
{
@@ -495,7 +501,13 @@ XPropertyEntry* XPropertyList::Remove( long nIndex, sal_uInt16 /*nDummy*/)
if( pOldBmp )
delete pOldBmp;
}
- return (XPropertyEntry*) aList.Remove( (sal_uIntPtr) nIndex );
+
+ XPropertyEntry* pEntry = NULL;
+ if ( (size_t)nIndex < aList.size() ) {
+ pEntry = aList[ nIndex ];
+ aList.erase( aList.begin() + nIndex );
+ }
+ return pEntry;
}
/************************************************************************/
diff --git a/svx/source/xoutdev/xtablend.cxx b/svx/source/xoutdev/xtablend.cxx
index bdcd65a..b48a1d7 100644
--- a/svx/source/xoutdev/xtablend.cxx
+++ b/svx/source/xoutdev/xtablend.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -208,7 +208,7 @@ void XLineEndList::impCreate()
pVirDev->SetDrawMode(rStyleSettings.GetHighContrastMode()
? DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT
: DRAWMODE_DEFAULT);
-
+
SdrModel* pSdrModel = new SdrModel();
OSL_ENSURE(0 != pSdrModel, "XLineEndList: no SdrModel created!" );
pSdrModel->GetItemPool().FreezeIdRanges();
@@ -247,8 +247,12 @@ void XLineEndList::impDestroy()
}
}
-XLineEndList::XLineEndList(const String& rPath, XOutdevItemPool* _pXPool, sal_uInt16 nInitSize, sal_uInt16 nReSize)
-: XPropertyList(rPath, _pXPool, nInitSize, nReSize),
+XLineEndList::XLineEndList(
+ const String& rPath,
+ XOutdevItemPool* _pXPool,
+ sal_uInt16 nInitSize,
+ sal_uInt16 nReSize
+) : XPropertyList( rPath, _pXPool ),
mpData(0)
{
pBmpList = new List(nInitSize, nReSize);
More information about the Libreoffice-commits
mailing list