[Libreoffice-commits] .: 2 commits - idl/inc idl/source svx/source
Joseph Powers
jpowers at kemper.freedesktop.org
Sun Feb 27 22:45:19 PST 2011
idl/inc/object.hxx | 10 ---------
idl/source/objects/object.cxx | 17 ++++++---------
svx/source/inc/clonelist.hxx | 9 +++-----
svx/source/svdraw/clonelist.cxx | 44 ++++++++++++++++------------------------
4 files changed, 30 insertions(+), 50 deletions(-)
New commits:
commit 674c10b068d27d5ebdb25458d31dd8a61b343eb6
Author: Rafael Dominguez <venccsralph at gmail.com>
Date: Sun Feb 27 21:45:37 2011 -0800
[PATCH] Remove deprecated container list for std::vector.
diff --git a/svx/source/inc/clonelist.hxx b/svx/source/inc/clonelist.hxx
index 3fdb6e1..3ed9156 100644
--- a/svx/source/inc/clonelist.hxx
+++ b/svx/source/inc/clonelist.hxx
@@ -28,8 +28,9 @@
#ifndef _CLONELIST_HXX_
#define _CLONELIST_HXX_
+#include <vector>
+
#include <sal/types.h>
-#include <tools/list.hxx>
// predeclarations
class SdrObject;
@@ -39,12 +40,10 @@ class SdrObject;
// re-creating the connections for contained connectors
class CloneList
{
- List maOriginalList;
- List maCloneList;
+ std::vector<const SdrObject*> maOriginalList;
+ std::vector<SdrObject*> maCloneList;
public:
- CloneList();
- ~CloneList();
void AddPair(const SdrObject* pOriginal, SdrObject* pClone);
sal_uInt32 Count() const;
diff --git a/svx/source/svdraw/clonelist.cxx b/svx/source/svdraw/clonelist.cxx
index 9a32363..a39bb2f 100644
--- a/svx/source/svdraw/clonelist.cxx
+++ b/svx/source/svdraw/clonelist.cxx
@@ -36,18 +36,10 @@
#include <svx/svdoedge.hxx>
#include <svx/scene3d.hxx>
-CloneList::CloneList()
-{
-}
-
-CloneList::~CloneList()
-{
-}
-
void CloneList::AddPair(const SdrObject* pOriginal, SdrObject* pClone)
{
- maOriginalList.Insert((SdrObject*)pOriginal, LIST_APPEND);
- maCloneList.Insert(pClone, LIST_APPEND);
+ maOriginalList.push_back(pOriginal);
+ maCloneList.push_back(pClone);
// look for subobjects, too.
sal_Bool bOriginalIsGroup(pOriginal->IsGroupObject());
@@ -78,22 +70,22 @@ void CloneList::AddPair(const SdrObject* pOriginal, SdrObject* pClone)
sal_uInt32 CloneList::Count() const
{
- return maOriginalList.Count();
+ return maOriginalList.size();
}
const SdrObject* CloneList::GetOriginal(sal_uInt32 nIndex) const
{
- return (SdrObject*)maOriginalList.GetObject(nIndex);
+ return maOriginalList[nIndex];
}
SdrObject* CloneList::GetClone(sal_uInt32 nIndex) const
{
- return (SdrObject*)maCloneList.GetObject(nIndex);
+ return maCloneList[nIndex];
}
void CloneList::CopyConnections() const
{
- for(sal_uInt32 a(0); a < maOriginalList.Count(); a++)
+ for(sal_uInt32 a = 0; a < maOriginalList.size(); a++)
{
const SdrEdgeObj* pOriginalEdge = PTR_CAST(SdrEdgeObj, GetOriginal(a));
SdrEdgeObj* pCloneEdge = PTR_CAST(SdrEdgeObj, GetClone(a));
@@ -105,27 +97,27 @@ void CloneList::CopyConnections() const
if(pOriginalNode1)
{
- ULONG nPos(maOriginalList.GetPos(pOriginalNode1));
+ std::vector<const SdrObject*>::const_iterator it = std::find(maOriginalList.begin(),
+ maOriginalList.end(),
+ pOriginalNode1);
- if(LIST_ENTRY_NOTFOUND != nPos)
+ if(it != maOriginalList.end())
{
- if(pOriginalEdge->GetConnectedNode(sal_True) != GetClone(nPos))
- {
- pCloneEdge->ConnectToNode(sal_True, GetClone(nPos));
- }
+ if(pOriginalEdge->GetConnectedNode(sal_True) != *it)
+ pCloneEdge->ConnectToNode(sal_True, const_cast<SdrObject*>(*it));
}
}
if(pOriginalNode2)
{
- ULONG nPos(maOriginalList.GetPos(pOriginalNode2));
+ std::vector<const SdrObject*>::const_iterator it = std::find(maOriginalList.begin(),
+ maOriginalList.end(),
+ pOriginalNode2);
- if(LIST_ENTRY_NOTFOUND != nPos)
+ if(it != maOriginalList.end())
{
- if(pOriginalEdge->GetConnectedNode(sal_False) != GetClone(nPos))
- {
- pCloneEdge->ConnectToNode(sal_False, GetClone(nPos));
- }
+ if(pOriginalEdge->GetConnectedNode(sal_True) != *it)
+ pCloneEdge->ConnectToNode(sal_True, const_cast<SdrObject*>(*it));
}
}
}
commit c44a6b5b782a7c0117afa13f485f6c098051bc4b
Author: Rafael Dominguez <venccsralph at gmail.com>
Date: Sun Feb 27 21:35:16 2011 -0800
PATCH 1/2] Remove SvULongs and replace it with std::vector<ULONG>
diff --git a/idl/inc/object.hxx b/idl/inc/object.hxx
index c91fc45..5529088 100644
--- a/idl/inc/object.hxx
+++ b/idl/inc/object.hxx
@@ -49,14 +49,6 @@ DECLARE_LIST( SvSlotElementList, SvSlotElement* )
class SvMetaClass;
typedef ::std::vector< SvMetaClass* > SvMetaClassList;
-class SvULongs : public List
-{
-public:
- void Insert( ULONG& rId, ULONG nPos ) { ULONG nId(rId ); List::Insert( (void*) nId, nPos ); }
- void Remove( ULONG& rId ){ ULONG nId(rId ); List::Remove( (void*) nId ); }
- ULONG GetObject( ULONG nPos ){ return (ULONG) List::GetObject( nPos ); }
-};
-
SV_DECL_REF(SvMetaClass)
class SvClassElement : public SvPersistBase
{
@@ -111,7 +103,7 @@ class SvMetaClass : public SvMetaType
SvIdlDataBase & rBase,
SvStream & rOutStm );
- void InsertSlots( SvSlotElementList& rList, SvULongs& rSuperList,
+ void InsertSlots( SvSlotElementList& rList, std::vector<ULONG>& rSuperList,
SvMetaClassList & rClassList,
const ByteString & rPrefix, SvIdlDataBase& rBase );
diff --git a/idl/source/objects/object.cxx b/idl/source/objects/object.cxx
index 60e76c6..049830c 100644
--- a/idl/source/objects/object.cxx
+++ b/idl/source/objects/object.cxx
@@ -472,7 +472,7 @@ USHORT SvMetaClass::WriteSlots( const ByteString & rShellName,
return nSCount;
}
-void SvMetaClass::InsertSlots( SvSlotElementList& rList, SvULongs& rSuperList,
+void SvMetaClass::InsertSlots( SvSlotElementList& rList, std::vector<ULONG>& rSuperList,
SvMetaClassList &rClassList,
const ByteString & rPrefix, SvIdlDataBase& rBase)
{
@@ -490,18 +490,15 @@ void SvMetaClass::InsertSlots( SvSlotElementList& rList, SvULongs& rSuperList,
SvMetaAttribute * pAttr = aAttrList.GetObject( n );
ULONG nId = pAttr->GetSlotId().GetValue();
- USHORT nPos;
- for ( nPos=0; nPos < rSuperList.Count(); nPos++ )
- {
- if ( rSuperList.GetObject(nPos) == nId )
- break;
- }
- if( nPos == rSuperList.Count() )
+ std::vector<ULONG>::iterator iter = std::find(rSuperList.begin(),
+ rSuperList.end(),nId);
+
+ if( iter == rSuperList.end() )
{
// Write only if not already written by subclass or
// imported interface.
- rSuperList.Insert( nId, nPos );
+ rSuperList.push_back(nId);
pAttr->Insert(rList, rPrefix, rBase);
}
}
@@ -591,7 +588,7 @@ void SvMetaClass::WriteSfx( SvIdlDataBase & rBase, SvStream & rOutStm )
rOutStm << "SFX_ARGUMENTMAP(" << GetName().GetBuffer() << ')' << endl
<< '{' << endl;
- SvULongs aSuperList;
+ std::vector<ULONG> aSuperList;
SvMetaClassList classList;
SvSlotElementList aSlotList;
InsertSlots(aSlotList, aSuperList, classList, ByteString(), rBase);
More information about the Libreoffice-commits
mailing list