More List cleaning up
From 64ac9b0a4c39d0279fd5dbe9f8f160261d9c0420 Mon Sep 17 00:00:00 2001
From: Rafael Dominguez <venccsralph@gmail.com>
Date: Thu, 2 Jun 2011 22:00:58 -0430
Subject: [PATCH 10/21] Replace List for std::vector<LotusRange*>.
---
sc/source/filter/inc/lotrange.hxx | 4 +++-
sc/source/filter/lotus/tool.cxx | 30 +++++++++++-------------------
2 files changed, 14 insertions(+), 20 deletions(-)
diff --git a/sc/source/filter/inc/lotrange.hxx b/sc/source/filter/inc/lotrange.hxx
index edffd5e..479526b 100644
--- a/sc/source/filter/inc/lotrange.hxx
+++ b/sc/source/filter/inc/lotrange.hxx
@@ -110,13 +110,15 @@ inline sal_Bool LotusRange::IsSingle( void ) const
// ----------------------------------------------------- class LotusRangeList -
-class LotusRangeList : private List
+class LotusRangeList
{
private:
LR_ID nIdCnt;
ScComplexRefData aComplRef;
static SCCOL nEingCol;
static SCROW nEingRow;
+ std::vector<LotusRange*> maRanges;
+
public:
LotusRangeList( void );
~LotusRangeList( void );
diff --git a/sc/source/filter/lotus/tool.cxx b/sc/source/filter/lotus/tool.cxx
index 39dd9d5..3267deb 100644
--- a/sc/source/filter/lotus/tool.cxx
+++ b/sc/source/filter/lotus/tool.cxx
@@ -460,28 +460,20 @@ LotusRangeList::LotusRangeList( void )
pSingRef->SetFlag3D( false );
}
-
-LotusRangeList::~LotusRangeList( void )
- {
- LotusRange *pDel = ( LotusRange * ) List::First();
-
- while( pDel )
- {
- delete pDel;
- pDel = ( LotusRange * ) List::Next();
- }
- }
-
+LotusRangeList::~LotusRangeList ()
+{
+ std::vector<LotusRange*>::iterator pIter;
+ for (pIter = maRanges.begin(); pIter != maRanges.end(); ++pIter)
+ delete (*pIter);
+}
LR_ID LotusRangeList::GetIndex( const LotusRange &rRef )
{
- LotusRange* pComp = ( LotusRange* ) List::First();
-
- while( pComp )
+ std::vector<LotusRange*>::iterator pIter;
+ for (pIter = maRanges.begin(); pIter != maRanges.end(); ++pIter)
{
- if( *pComp == rRef )
- return pComp->nId;
- pComp = ( LotusRange* ) List::Next();
+ if (rRef == *(*pIter))
+ return (*pIter)->nId;
}
return ID_FAIL;
@@ -491,7 +483,7 @@ LR_ID LotusRangeList::GetIndex( const LotusRange &rRef )
void LotusRangeList::Append( LotusRange* pLR, const String& rName )
{
OSL_ENSURE( pLR, "*LotusRangeList::Append(): das wird nichts!" );
- List::Insert( pLR, CONTAINER_APPEND );
+ maRanges.push_back(pLR);
ScTokenArray aTokArray;
--
1.7.3.4
From 1561aeb96b5b12444c2174e44c7f5d3b112a62ba Mon Sep 17 00:00:00 2001
From: Rafael Dominguez <venccsralph@gmail.com>
Date: Fri, 3 Jun 2011 18:35:50 -0430
Subject: [PATCH 11/21] Replace List for std::vector<ExcRecord*>.
---
sc/source/filter/excel/excrecds.cxx | 8 ++++----
sc/source/filter/inc/excrecds.hxx | 15 ++++++---------
2 files changed, 10 insertions(+), 13 deletions(-)
diff --git a/sc/source/filter/excel/excrecds.cxx b/sc/source/filter/excel/excrecds.cxx
index f6cede5..4bff217 100644
--- a/sc/source/filter/excel/excrecds.cxx
+++ b/sc/source/filter/excel/excrecds.cxx
@@ -182,15 +182,15 @@ sal_Size ExcEmptyRec::GetLen() const
ExcRecordList::~ExcRecordList()
{
- for( ExcRecord* pRec = First(); pRec; pRec = Next() )
- delete pRec;
+ for (iterator pIter = maRecords.begin(); pIter != maRecords.end(); ++pIter)
+ delete (*pIter);
}
void ExcRecordList::Save( XclExpStream& rStrm )
{
- for( ExcRecord* pRec = First(); pRec; pRec = Next() )
- pRec->Save( rStrm );
+ for (iterator pIter = maRecords.begin(); pIter != maRecords.end(); ++pIter)
+ (*pIter)->Save( rStrm );
}
diff --git a/sc/source/filter/inc/excrecds.hxx b/sc/source/filter/inc/excrecds.hxx
index 18e595f..0a73ea7 100644
--- a/sc/source/filter/inc/excrecds.hxx
+++ b/sc/source/filter/inc/excrecds.hxx
@@ -53,7 +53,6 @@
class SvStream;
class Font;
-class List;
class ScPatternAttr;
class ScTokenArray;
class ScRangeData;
@@ -101,20 +100,18 @@ public:
//------------------------------------------------------- class ExcRecordList -
-class ExcRecordList : protected List, public ExcEmptyRec
+class ExcRecordList : public ExcEmptyRec
{
private:
-protected:
+ std::vector<ExcRecord*> maRecords;
+
public:
- virtual ~ExcRecordList();
- using List::Count;
+ typedef std::vector<ExcRecord*>::iterator iterator;
- inline ExcRecord* First( void ) { return ( ExcRecord* )
List::First(); }
- inline ExcRecord* Next( void ) { return ( ExcRecord* )
List::Next(); }
+ virtual ~ExcRecordList();
- inline void Append( ExcRecord* pNew ) { if( pNew )
List::Insert( pNew, LIST_APPEND ); }
- inline const ExcRecord* Get( sal_uInt32 nNum ) const { return ( ExcRecord* )
List::GetObject( nNum ); }
+ inline void Append( ExcRecord* pNew ) { if( pNew )
maRecords.push_back( pNew ); }
virtual void Save( XclExpStream& rStrm );
};
--
1.7.3.4
From 18ef971d9acf001af9dc530ba438ba0d8a3b4f30 Mon Sep 17 00:00:00 2001
From: Rafael Dominguez <venccsralph@gmail.com>
Date: Fri, 3 Jun 2011 18:36:33 -0430
Subject: [PATCH 12/21] Replace ScHighlightRangeList for std::vector<ScHighlighEntry>.
---
sc/source/ui/docshell/hiranges.cxx | 16 ----------------
sc/source/ui/inc/hiranges.hxx | 15 ---------------
sc/source/ui/inc/tabview.hxx | 6 +++---
sc/source/ui/view/gridwin4.cxx | 29 ++++++++++++-----------------
sc/source/ui/view/tabview.cxx | 1 -
sc/source/ui/view/tabview3.cxx | 31 ++++++++++---------------------
sc/source/ui/view/tabview5.cxx | 1 -
7 files changed, 25 insertions(+), 74 deletions(-)
diff --git a/sc/source/ui/docshell/hiranges.cxx b/sc/source/ui/docshell/hiranges.cxx
index 5716abe..981de50 100644
--- a/sc/source/ui/docshell/hiranges.cxx
+++ b/sc/source/ui/docshell/hiranges.cxx
@@ -35,21 +35,5 @@
//==================================================================
-ScHighlightRanges::ScHighlightRanges()
-{
-}
-
-ScHighlightRanges::~ScHighlightRanges()
-{
- void* pEntry = aEntries.First();
- while ( pEntry )
- {
- delete (ScHighlightEntry*) aEntries.Remove( pEntry );
- pEntry = aEntries.Next();
- }
-}
-
-
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/inc/hiranges.hxx b/sc/source/ui/inc/hiranges.hxx
index 120e782..b42b659 100644
--- a/sc/source/ui/inc/hiranges.hxx
+++ b/sc/source/ui/inc/hiranges.hxx
@@ -44,21 +44,6 @@ struct ScHighlightEntry
aRef(rR), aColor(rC) {}
};
-class ScHighlightRanges
-{
- List aEntries;
-
-public:
- ScHighlightRanges();
- ~ScHighlightRanges();
-
- sal_uLong Count() const { return aEntries.Count(); }
- void Insert( ScHighlightEntry* pNew ) { aEntries.Insert(pNew, LIST_APPEND); }
- ScHighlightEntry* GetObject( sal_uLong nIndex ) const
- { return (ScHighlightEntry*)aEntries.GetObject(nIndex); }
-};
-
-
#endif
diff --git a/sc/source/ui/inc/tabview.hxx b/sc/source/ui/inc/tabview.hxx
index 23a7aa5..fa0f2ed 100644
--- a/sc/source/ui/inc/tabview.hxx
+++ b/sc/source/ui/inc/tabview.hxx
@@ -32,6 +32,7 @@
#include <sfx2/ipclient.hxx>
+#include "hiranges.hxx"
#include "viewutil.hxx"
#include "select.hxx"
@@ -52,7 +53,6 @@ class SdrView;
class SdrObject;
class ScHintWindow;
class ScPageBreakData;
-class ScHighlightRanges;
struct ChartSelectionInfo;
class SdrHdlList;
@@ -131,7 +131,7 @@ private:
ScHintWindow* pInputHintWindow; // Eingabemeldung bei Gueltigkeit
ScPageBreakData* pPageBreakData; // fuer Seitenumbruch-Modus
- ScHighlightRanges* pHighlightRanges;
+ std::vector<ScHighlightEntry> maHighlightRanges;
ScDocument* pBrushDocument; // cell formats for format paint brush
SfxItemSet* pDrawBrushSet; // drawing object attributes for paint brush
@@ -269,7 +269,7 @@ public:
void UpdateAnchorHandles();
ScPageBreakData* GetPageBreakData() { return pPageBreakData; }
- ScHighlightRanges* GetHighlightRanges() { return pHighlightRanges; }
+ const std::vector<ScHighlightEntry>& GetHighlightRanges() { return maHighlightRanges; }
void UpdatePageBreakData( bool bForcePaint = false );
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index 3213c8f..9441425 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -265,23 +265,19 @@ void lcl_DrawScenarioFrames( OutputDevice* pDev, ScViewData* pViewData,
ScSplitP
//------------------------------------------------------------------------
void lcl_DrawHighlight( ScOutputData& rOutputData, ScViewData* pViewData,
- ScHighlightRanges& rHighlightRanges )
+ const std::vector<ScHighlightEntry>& rHighlightRanges )
{
SCTAB nTab = pViewData->GetTabNo();
- sal_uLong nCount = rHighlightRanges.Count();
- for (sal_uLong i=0; i<nCount; i++)
+ std::vector<ScHighlightEntry>::const_iterator pIter;
+ for ( pIter = rHighlightRanges.begin(); pIter != rHighlightRanges.end(); ++pIter)
{
- ScHighlightEntry* pEntry = rHighlightRanges.GetObject( i );
- if (pEntry)
+ ScRange aRange = pIter->aRef;
+ if ( nTab >= aRange.aStart.Tab() && nTab <= aRange.aEnd.Tab() )
{
- ScRange aRange = pEntry->aRef;
- if ( nTab >= aRange.aStart.Tab() && nTab <= aRange.aEnd.Tab() )
- {
- rOutputData.DrawRefMark(
- aRange.aStart.Col(), aRange.aStart.Row(),
- aRange.aEnd.Col(), aRange.aEnd.Row(),
- pEntry->aColor, false );
- }
+ rOutputData.DrawRefMark(
+ aRange.aStart.Col(), aRange.aStart.Row(),
+ aRange.aEnd.Col(), aRange.aEnd.Row(),
+ pIter->aColor, false );
}
}
}
@@ -742,11 +738,11 @@ void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2,
ScUpdateMod
//! Szenario-Rahmen per View-Optionen abschaltbar?
SCTAB nTabCount = pDoc->GetTableCount();
- ScHighlightRanges* pHigh = pViewData->GetView()->GetHighlightRanges();
+ const std::vector<ScHighlightEntry> &rHigh = pViewData->GetView()->GetHighlightRanges();
sal_Bool bHasScenario = ( nTab+1<nTabCount && pDoc->IsScenario(nTab+1) &&
!pDoc->IsScenario(nTab) );
sal_Bool bHasChange = ( pDoc->GetChangeTrack() != NULL );
- if ( bHasChange || bHasScenario || pHigh != NULL )
+ if ( bHasChange || bHasScenario || !rHigh.empty() )
{
//! SetChangedClip() mit DrawMarks() zusammenfassen?? (anderer MapMode!)
@@ -762,8 +758,7 @@ void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMod
if ( bHasScenario )
lcl_DrawScenarioFrames( pContentDev, pViewData, eWhich, nX1,nY1,nX2,nY2 );
- if ( pHigh )
- lcl_DrawHighlight( aOutputData, pViewData, *pHigh );
+ lcl_DrawHighlight( aOutputData, pViewData, rHigh );
if (eMode == SC_UPDATE_CHANGED)
pContentDev->SetClipRegion();
diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx
index 9f04d30..1ade00b 100644
--- a/sc/source/ui/view/tabview.cxx
+++ b/sc/source/ui/view/tabview.cxx
@@ -311,7 +311,6 @@ ScTabView::ScTabView( Window* pParent, ScDocShell& rDocSh, ScTabViewShell* pView
aScrollBarBox( pFrameWin, WB_SIZEABLE ),
pInputHintWindow( NULL ),
pPageBreakData( NULL ),
- pHighlightRanges( NULL ),
pBrushDocument( NULL ),
pDrawBrushSet( NULL ),
pTimerWindow( NULL ),
diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx
index f1934bc..2b28a05 100644
--- a/sc/source/ui/view/tabview3.cxx
+++ b/sc/source/ui/view/tabview3.cxx
@@ -2023,9 +2023,7 @@ void ScTabView::PaintRangeFinder( long nNumber )
void ScTabView::AddHighlightRange( const ScRange& rRange, const Color& rColor )
{
- if (!pHighlightRanges)
- pHighlightRanges = new ScHighlightRanges;
- pHighlightRanges->Insert( new ScHighlightEntry( rRange, rColor ) );
+ maHighlightRanges.push_back( ScHighlightEntry( rRange, rColor ) );
SCTAB nTab = aViewData.GetTabNo();
if ( nTab >= rRange.aStart.Tab() && nTab <= rRange.aEnd.Tab() )
@@ -2035,26 +2033,17 @@ void ScTabView::AddHighlightRange( const ScRange& rRange, const Color&
rColor )
void ScTabView::ClearHighlightRanges()
{
- if (pHighlightRanges)
+ SCTAB nTab = aViewData.GetTabNo();
+ std::vector<ScHighlightEntry>::const_iterator pIter;
+ for ( pIter = maHighlightRanges.begin(); pIter != maHighlightRanges.end(); ++pIter)
{
- ScHighlightRanges* pTemp = pHighlightRanges;
- pHighlightRanges = NULL; // Repaint ohne Highlight
-
- SCTAB nTab = aViewData.GetTabNo();
- sal_uLong nCount = pTemp->Count();
- for (sal_uLong i=0; i<nCount; i++)
- {
- ScHighlightEntry* pEntry = pTemp->GetObject( i );
- if (pEntry)
- {
- ScRange aRange = pEntry->aRef;
- if ( nTab >= aRange.aStart.Tab() && nTab <= aRange.aEnd.Tab() )
- PaintArea( aRange.aStart.Col(), aRange.aStart.Row(),
- aRange.aEnd.Col(), aRange.aEnd.Row(), SC_UPDATE_MARKS );
- }
- }
- delete pTemp;
+ ScRange aRange = pIter->aRef;
+ if ( nTab >= aRange.aStart.Tab() && nTab <= aRange.aEnd.Tab() )
+ PaintArea( aRange.aStart.Col(), aRange.aStart.Row(),
+ aRange.aEnd.Col(), aRange.aEnd.Row(), SC_UPDATE_MARKS );
}
+
+ maHighlightRanges.clear();
}
void ScTabView::DoChartSelection(
diff --git a/sc/source/ui/view/tabview5.cxx b/sc/source/ui/view/tabview5.cxx
index 658b6b0..0a7b494 100644
--- a/sc/source/ui/view/tabview5.cxx
+++ b/sc/source/ui/view/tabview5.cxx
@@ -166,7 +166,6 @@ ScTabView::~ScTabView()
DELETEZ(pDrawBrushSet);
DELETEZ(pPageBreakData);
- DELETEZ(pHighlightRanges);
DELETEZ(pDrawOld);
DELETEZ(pDrawActual);
--
1.7.3.4
From 68cfe010e68884f3650e11d465abac7d8be371b8 Mon Sep 17 00:00:00 2001
From: Rafael Dominguez <venccsralph@gmail.com>
Date: Fri, 3 Jun 2011 18:53:10 -0430
Subject: [PATCH 13/21] Remove unused hiranges file.
---
sc/Library_sc.mk | 1 -
sc/source/ui/docshell/hiranges.cxx | 39 ------------------------------------
2 files changed, 0 insertions(+), 40 deletions(-)
delete mode 100644 sc/source/ui/docshell/hiranges.cxx
diff --git a/sc/Library_sc.mk b/sc/Library_sc.mk
index 078c94c..5e93753 100644
--- a/sc/Library_sc.mk
+++ b/sc/Library_sc.mk
@@ -338,7 +338,6 @@ $(eval $(call gb_Library_add_exception_objects,sc,\
sc/source/ui/docshell/docsh8 \
sc/source/ui/docshell/editable \
sc/source/ui/docshell/externalrefmgr \
- sc/source/ui/docshell/hiranges \
sc/source/ui/docshell/impex \
sc/source/ui/docshell/macromgr \
sc/source/ui/docshell/olinefun \
diff --git a/sc/source/ui/docshell/hiranges.cxx b/sc/source/ui/docshell/hiranges.cxx
deleted file mode 100644
index 981de50..0000000
--- a/sc/source/ui/docshell/hiranges.cxx
+++ /dev/null
@@ -1,39 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * 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
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sc.hxx"
-
-
-
-#include "hiranges.hxx"
-
-//==================================================================
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
--
1.7.3.4
From c912e385caa928cbcefc4feddd52cd24bd6ddd94 Mon Sep 17 00:00:00 2001
From: Rafael Dominguez <venccsralph@gmail.com>
Date: Fri, 3 Jun 2011 19:37:52 -0430
Subject: [PATCH 14/21] Replace List with std::vector<String>.
---
sc/inc/scabstdlg.hxx | 2 +-
sc/source/ui/attrdlg/scdlgfact.cxx | 4 ++--
sc/source/ui/attrdlg/scdlgfact.hxx | 2 +-
sc/source/ui/inc/lbseldlg.hxx | 2 +-
sc/source/ui/miscdlgs/lbseldlg.cxx | 11 ++++-------
sc/source/ui/view/cellsh2.cxx | 11 ++---------
6 files changed, 11 insertions(+), 21 deletions(-)
diff --git a/sc/inc/scabstdlg.hxx b/sc/inc/scabstdlg.hxx
index 2e17107..01d8d31 100644
--- a/sc/inc/scabstdlg.hxx
+++ b/sc/inc/scabstdlg.hxx
@@ -394,7 +394,7 @@ public:
sal_uInt16 nResId,
const String& aTitle,
const String& aLbTitle,
- List& aEntryList,
+ const std::vector<String> &rEntryList,
int nId ) = 0;
virtual AbstractScLinkedAreaDlg * CreateScLinkedAreaDlg ( Window* pParent, int nId) = 0;
//add for ScLinkedAreaDlg
diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx
index faf0f29..8d2e54e 100644
--- a/sc/source/ui/attrdlg/scdlgfact.cxx
+++ b/sc/source/ui/attrdlg/scdlgfact.cxx
@@ -1062,14 +1062,14 @@ AbstractScSelEntryDlg * ScAbstractDialogFactory_Impl::CreateScSelEntryDlg (
Wind
sal_uInt16 nResId,
const String& aTitle,
const String& aLbTitle,
- List& aEntryList,
+ const std::vector<String> &rEntryList,
int nId )
{
ScSelEntryDlg * pDlg=NULL;
switch ( nId )
{
case RID_SCDLG_SELECTDB :
- pDlg = new ScSelEntryDlg( pParent, nResId,aTitle, aLbTitle, aEntryList );
+ pDlg = new ScSelEntryDlg( pParent, nResId,aTitle, aLbTitle, rEntryList );
break;
default:
break;
diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx b/sc/source/ui/attrdlg/scdlgfact.hxx
index 9ee3575..b8090b4 100644
--- a/sc/source/ui/attrdlg/scdlgfact.hxx
+++ b/sc/source/ui/attrdlg/scdlgfact.hxx
@@ -476,7 +476,7 @@ public:
sal_uInt16 nResId,
const String& aTitle,
const String& aLbTitle,
- List& aEntryList,
+ const std::vector<String> &rEntryList,
int nId );
virtual AbstractScLinkedAreaDlg * CreateScLinkedAreaDlg ( Window* pParent, //add for
ScLinkedAreaDlg
diff --git a/sc/source/ui/inc/lbseldlg.hxx b/sc/source/ui/inc/lbseldlg.hxx
index ff07478..58d3f51 100644
--- a/sc/source/ui/inc/lbseldlg.hxx
+++ b/sc/source/ui/inc/lbseldlg.hxx
@@ -56,7 +56,7 @@ public:
sal_uInt16 nResId,
const String& aTitle,
const String& aLbTitle,
- List& aEntryList );
+ const std::vector<String> &rEntryList );
~ScSelEntryDlg();
String GetSelectEntry() const;
diff --git a/sc/source/ui/miscdlgs/lbseldlg.cxx b/sc/source/ui/miscdlgs/lbseldlg.cxx
index 291449d..fca6b18 100644
--- a/sc/source/ui/miscdlgs/lbseldlg.cxx
+++ b/sc/source/ui/miscdlgs/lbseldlg.cxx
@@ -48,7 +48,7 @@ ScSelEntryDlg::ScSelEntryDlg( Window* pParent,
sal_uInt16 nResId,
const String& aTitle,
const String& aLbTitle,
- List& aEntryList ) :
+ const std::vector<String> &rEntryList ) :
ModalDialog ( pParent, ScResId( nResId ) ),
//
aFlLbTitle ( this, ScResId( FL_ENTRYLIST ) ),
@@ -62,12 +62,9 @@ ScSelEntryDlg::ScSelEntryDlg( Window* pParent,
aLb.Clear();
aLb.SetDoubleClickHdl( LINK( this, ScSelEntryDlg, DblClkHdl ) );
- void* pListEntry = aEntryList.First();
- while ( pListEntry )
- {
- aLb.InsertEntry( *((String*)pListEntry ) );
- pListEntry = aEntryList.Next();
- }
+ std::vector<String>::const_iterator pIter;
+ for ( pIter = rEntryList.begin(); pIter != rEntryList.end(); ++pIter )
+ aLb.InsertEntry(*pIter);
if ( aLb.GetEntryCount() > 0 )
aLb.SelectEntryPos( 0 );
diff --git a/sc/source/ui/view/cellsh2.cxx b/sc/source/ui/view/cellsh2.cxx
index baaccaf..dbec2f9 100644
--- a/sc/source/ui/view/cellsh2.cxx
+++ b/sc/source/ui/view/cellsh2.cxx
@@ -723,11 +723,11 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq )
if ( pDBCol )
{
- List aList;
+ std::vector<String> aList;
const ScDBCollection::NamedDBs& rDBs = pDBCol->getNamedDBs();
ScDBCollection::NamedDBs::const_iterator itr = rDBs.begin(), itrEnd =
rDBs.end();
for (; itr != itrEnd; ++itr)
- aList.Insert(new String(itr->GetName()));
+ aList.push_back(itr->GetName());
ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
OSL_ENSURE(pFact, "ScAbstractFactory create fail!");
@@ -748,13 +748,6 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq )
}
delete pDlg;
-
- void* pEntry = aList.First();
- while ( pEntry )
- {
- delete (String*) aList.Remove( pEntry );
- pEntry = aList.Next();
- }
}
}
}
--
1.7.3.4
From 5582b8a00052fc60012e6da0d0754f1edeadf16b Mon Sep 17 00:00:00 2001
From: Rafael Dominguez <venccsralph@gmail.com>
Date: Fri, 3 Jun 2011 20:58:48 -0430
Subject: [PATCH 15/21] Remove unneded foward declaration.
---
sc/inc/document.hxx | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 9426393..06d0acd 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -80,7 +80,6 @@ class SvxSearchItem;
class SvxShadowItem;
class Window;
class XColorTable;
-class List;
struct ScAttrEntry;
class ScAutoFormatData;
--
1.7.3.4
From d4a591240a2b5c2ba1e33ecb2eaa361f4abf3dde Mon Sep 17 00:00:00 2001
From: Rafael Dominguez <venccsralph@gmail.com>
Date: Fri, 3 Jun 2011 21:52:10 -0430
Subject: [PATCH 16/21] Replace SbaSelectionList with std::vector<sal_Int32>.
Remove SbaSelectionList and SV_DECL_IMPL_REF(SbaSelectionList).
---
sc/source/ui/docshell/dbdocfun.cxx | 2 +-
sc/source/ui/docshell/dbdocimp.cxx | 12 ++++++------
sc/source/ui/docshell/docsh4.cxx | 8 ++++----
sc/source/ui/inc/dbdocfun.hxx | 16 ++--------------
4 files changed, 13 insertions(+), 25 deletions(-)
diff --git a/sc/source/ui/docshell/dbdocfun.cxx b/sc/source/ui/docshell/dbdocfun.cxx
index 33b6377..39268cf 100644
--- a/sc/source/ui/docshell/dbdocfun.cxx
+++ b/sc/source/ui/docshell/dbdocfun.cxx
@@ -1456,7 +1456,7 @@ void ScDBDocFunc::UpdateImport( const String& rTarget, const String& rDBName,
const String& rTableName, const String& rStatement, bool bNative,
sal_uInt8 nType, const ::com::sun::star::uno::Reference<
::com::sun::star::sdbc::XResultSet >& xResultSet,
- const SbaSelectionList* pSelection )
+ const std::vector<sal_Int32> *pSelection )
{
// Target ist jetzt einfach der Bereichsname
diff --git a/sc/source/ui/docshell/dbdocimp.cxx b/sc/source/ui/docshell/dbdocimp.cxx
index 21a8e0e..9ab6216 100644
--- a/sc/source/ui/docshell/dbdocimp.cxx
+++ b/sc/source/ui/docshell/dbdocimp.cxx
@@ -170,13 +170,13 @@ bool ScDBDocFunc::DoImportUno( const ScAddress& rPos,
}
}
- SbaSelectionList aList;
+ std::vector<sal_Int32> aList;
long nSelLen = aSelection.getLength();
for (i = 0; i < nSelLen; i++)
{
sal_Int32 nEntry = 0;
if ( aSelection[i] >>= nEntry )
- aList.Insert( (void*)(sal_IntPtr)nEntry, LIST_APPEND );
+ aList.push_back( nEntry );
}
bool bAddrInsert = false; //!???
@@ -213,7 +213,7 @@ bool ScDBDocFunc::DoImportUno( const ScAddress& rPos,
bool ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam,
const uno::Reference< sdbc::XResultSet >& xResultSet,
- const SbaSelectionList* pSelection, bool bRecord, bool bAddrInsert )
+ const std::vector<sal_Int32> *pSelection, bool bRecord, bool bAddrInsert )
{
ScDocument* pDoc = rDocShell.GetDocument();
ScChangeTrack *pChangeTrack = NULL;
@@ -258,10 +258,10 @@ bool ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam,
sal_uLong nListCount = 0;
// -1 is special
- if ( pSelection && pSelection->Count() && (long)pSelection->GetObject(0) != -1L )
+ if ( !pSelection->empty() && (*pSelection)[0] != -1L )
{
bDoSelection = sal_True;
- nListCount = pSelection->Count();
+ nListCount = pSelection->size();
}
// ImportDoc - also used for Redo
@@ -390,7 +390,7 @@ bool ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam,
{
if (nListPos < nListCount)
{
- sal_uLong nNextRow = (sal_uLong) pSelection->GetObject(nListPos);
+ sal_uInt32 nNextRow = (*pSelection)[nListPos];
if ( nRowsRead+1 < nNextRow )
bRealSelection = sal_True;
bEnd = !xRowSet->absolute(nRowsRead = nNextRow);
diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index b35c1fe..8489276 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -229,7 +229,7 @@ void ScDocShell::Execute( SfxRequest& rReq )
if ( sTabFlag.EqualsAscii("0") ) // "0" = Query, "1" = Table
(Default)
nType = ScDbQuery;
- SbaSelectionListRef pSelectionList = new SbaSelectionList;
+ std::vector<sal_Int32> aSelectionList;
xub_StrLen nCount = sSbaData.GetTokenCount(cSbaSep);
for (xub_StrLen i = 4; i < nCount; i++)
@@ -237,8 +237,8 @@ void ScDocShell::Execute( SfxRequest& rReq )
String aSelItem = sSbaData.GetToken(i,cSbaSep);
if (aSelItem.Len())
{
- sal_uIntPtr nValue = aSelItem.ToInt32();
- pSelectionList->Insert( (void*)nValue, LIST_APPEND );
+ sal_uInt32 nValue = aSelItem.ToInt32();
+ aSelectionList.push_back(nValue);
}
}
@@ -283,7 +283,7 @@ void ScDocShell::Execute( SfxRequest& rReq )
{
ScDBDocFunc(*this).UpdateImport( sTarget, sDBName,
sDBTable, sDBSql, true, nType, xResultSet,
- pSelectionList );
+ &aSelectionList );
rReq.Done();
// UpdateImport aktualisiert auch die internen Operationen
diff --git a/sc/source/ui/inc/dbdocfun.hxx b/sc/source/ui/inc/dbdocfun.hxx
index be99ee5..c29fa8c 100644
--- a/sc/source/ui/inc/dbdocfun.hxx
+++ b/sc/source/ui/inc/dbdocfun.hxx
@@ -57,18 +57,6 @@ namespace com { namespace sun { namespace star {
}
} } }
-// ---------------------------------------------------------------------------
-// -----------------------------------------------------------------
-class SbaSelectionList: public List , public SvRefBase
-{
-public:
- SbaSelectionList():
- List(CONTAINER_MAXBLOCKSIZE,100,100){}
-};
-
-SV_DECL_IMPL_REF(SbaSelectionList)
-
-
class ScDBDocFunc
{
friend class ScDBFunc;
@@ -85,11 +73,11 @@ public:
bool bNative, sal_uInt8 nType,
const ::com::sun::star::uno::Reference<
::com::sun::star::sdbc::XResultSet >& xResultSet,
- const SbaSelectionList* pSelection );
+ const std::vector<sal_Int32> *pSelection );
bool DoImport( SCTAB nTab, const ScImportParam& rParam,
const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet >&
xResultSet,
- const SbaSelectionList* pSelection, bool bRecord,
+ const std::vector<sal_Int32> *pSelection, bool bRecord,
bool bAddrInsert = false );
bool DoImportUno( const ScAddress& rPos,
--
1.7.3.4
From 330dd5743e2247ca28fffd904feb0d03d8a5ad17 Mon Sep 17 00:00:00 2001
From: Rafael Dominguez <venccsralph@gmail.com>
Date: Fri, 3 Jun 2011 22:10:20 -0430
Subject: [PATCH 17/21] Replace List with std::vector<ScAddress>.
---
sc/source/ui/inc/printfun.hxx | 2 +-
sc/source/ui/view/printfun.cxx | 28 +++++++++++-----------------
2 files changed, 12 insertions(+), 18 deletions(-)
diff --git a/sc/source/ui/inc/printfun.hxx b/sc/source/ui/inc/printfun.hxx
index 9a4eedc..6278a61 100644
--- a/sc/source/ui/inc/printfun.hxx
+++ b/sc/source/ui/inc/printfun.hxx
@@ -224,7 +224,7 @@ private:
ScHeaderFieldData aFieldData;
- List aNotePosList; // Reihenfolge der Notizen
+ std::vector<ScAddress> aNotePosList; // Reihenfolge der Notizen
ScPageBreakData* pPageData; // zum Eintragen der Umbrueche etc.
diff --git a/sc/source/ui/view/printfun.cxx b/sc/source/ui/view/printfun.cxx
index d0eaf91..549c193 100644
--- a/sc/source/ui/view/printfun.cxx
+++ b/sc/source/ui/view/printfun.cxx
@@ -410,14 +410,6 @@ void ScPrintFunc::FillPageData()
ScPrintFunc::~ScPrintFunc()
{
- ScAddress* pTripel = (ScAddress*) aNotePosList.First();
- while (pTripel)
- {
- delete pTripel;
- pTripel = (ScAddress*) aNotePosList.Next();
- }
- aNotePosList.Clear();
-
delete[] pPageEndX;
delete[] pPageEndY;
delete[] pPageRows;
@@ -1926,15 +1918,17 @@ long ScPrintFunc::DoNotes( long nNoteStart, sal_Bool bDoPrint,
ScPreviewLocation
long nPosX = aPageRect.Left() + nMarkLen;
long nPosY = aPageRect.Top();
- long nCount = 0;
+ long nCount = nNoteStart;
+ long nSize = aNotePosList.size();
sal_Bool bOk;
do
{
bOk = false;
- ScAddress* pPos = (ScAddress*) aNotePosList.GetObject( nNoteStart+nCount );
- if (pPos)
+ if (nCount < nSize)
{
- ScBaseCell* pCell = pDoc->GetCell( *pPos);
+ ScAddress &rPos = aNotePosList[nCount];
+
+ ScBaseCell* pCell = pDoc->GetCell( rPos);
if( const ScPostIt* pNote = pCell->GetNote() )
{
if(const EditTextObject *pEditText = pNote->GetEditTextObject())
@@ -1947,7 +1941,7 @@ long ScPrintFunc::DoNotes( long nNoteStart, sal_Bool bDoPrint,
ScPreviewLocation
pEditEngine->Draw( pDev, Point( nPosX, nPosY ), 0 );
String aMarkStr;
- pPos->Format( aMarkStr, SCA_VALID, pDoc, pDoc->GetAddressConvention() );
+ rPos.Format( aMarkStr, SCA_VALID, pDoc, pDoc->GetAddressConvention() );
aMarkStr += ':';
// Zellposition auch per EditEngine, damit die Position stimmt
@@ -1958,9 +1952,9 @@ long ScPrintFunc::DoNotes( long nNoteStart, sal_Bool bDoPrint,
ScPreviewLocation
if ( pLocationData )
{
Rectangle aTextRect( Point( nPosX, nPosY ), Size( aDataSize.Width(),
nTextHeight ) );
- pLocationData->AddNoteText( aTextRect, *pPos );
+ pLocationData->AddNoteText( aTextRect, rPos );
Rectangle aMarkRect( Point( aPageRect.Left(), nPosY ), Size( nMarkLen,
nTextHeight ) );
- pLocationData->AddNoteMark( aMarkRect, *pPos );
+ pLocationData->AddNoteMark( aMarkRect, rPos );
}
nPosY += nTextHeight;
@@ -1978,7 +1972,7 @@ long ScPrintFunc::DoNotes( long nNoteStart, sal_Bool bDoPrint,
ScPreviewLocation
long ScPrintFunc::PrintNotes( long nPageNo, long nNoteStart, sal_Bool bDoPrint,
ScPreviewLocationData* pLocationData )
{
- if ( nNoteStart >= (long) aNotePosList.Count() || !aTableParam.bNotes )
+ if ( nNoteStart >= (long) aNotePosList.size() || !aTableParam.bNotes )
return 0;
if ( bDoPrint && bClearWin )
@@ -2577,7 +2571,7 @@ long ScPrintFunc::CountNotePages()
{
if (pCell->HasNote())
{
- aNotePosList.Insert( new ScAddress( nCol,nRow,nPrintTab ), LIST_APPEND );
+ aNotePosList.push_back( ScAddress( nCol,nRow,nPrintTab ) );
++nCount;
}
--
1.7.3.4
From aed284705ccc696fb4be8217e5ad79a6c2094e4e Mon Sep 17 00:00:00 2001
From: Rafael Dominguez <venccsralph@gmail.com>
Date: Fri, 3 Jun 2011 22:29:41 -0430
Subject: [PATCH 18/21] Replace List for std::vector<ScRangeFindData>.
---
sc/source/ui/app/inputhdl.cxx | 3 +--
sc/source/ui/app/rfindlst.cxx | 10 ----------
sc/source/ui/inc/rfindlst.hxx | 11 +++++------
3 files changed, 6 insertions(+), 18 deletions(-)
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index c266f71..3ecdebf 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -204,8 +204,7 @@ handle_r1c1:
pRangeFindList = new ScRangeFindList( pDocSh->GetTitle() );
}
- ScRangeFindData* pNew = new ScRangeFindData( aRange, nFlags, nStart, nPos );
- pRangeFindList->Insert( pNew );
+ pRangeFindList->Insert( ScRangeFindData( aRange, nFlags, nStart, nPos ) );
ESelection aSel( 0, nStart, 0, nPos );
SfxItemSet aSet( pEngine->GetEmptyItemSet() );
diff --git a/sc/source/ui/app/rfindlst.cxx b/sc/source/ui/app/rfindlst.cxx
index 3dfbd42..60bbecf 100644
--- a/sc/source/ui/app/rfindlst.cxx
+++ b/sc/source/ui/app/rfindlst.cxx
@@ -49,16 +49,6 @@ ScRangeFindList::ScRangeFindList(const String& rName) :
{
}
-ScRangeFindList::~ScRangeFindList()
-{
- void* pEntry = aEntries.First();
- while ( pEntry )
- {
- delete (ScRangeFindData*) aEntries.Remove( pEntry );
- pEntry = aEntries.Next();
- }
-}
-
ColorData ScRangeFindList::GetColorName( size_t nIndex )
{
return aColNames[nIndex % SC_RANGECOLORS];
diff --git a/sc/source/ui/inc/rfindlst.hxx b/sc/source/ui/inc/rfindlst.hxx
index 72bb290..93d8adf 100644
--- a/sc/source/ui/inc/rfindlst.hxx
+++ b/sc/source/ui/inc/rfindlst.hxx
@@ -48,18 +48,17 @@ struct ScRangeFindData
class ScRangeFindList
{
- List aEntries;
+ std::vector<ScRangeFindData> maEntries;
String aDocName;
bool bHidden;
public:
ScRangeFindList(const String& rName);
- ~ScRangeFindList();
- sal_uLong Count() const { return aEntries.Count(); }
- void Insert( ScRangeFindData* pNew ) { aEntries.Insert(pNew, LIST_APPEND); }
- ScRangeFindData* GetObject( sal_uLong nIndex ) const
- { return (ScRangeFindData*)aEntries.GetObject(nIndex); }
+ sal_uLong Count() const { return maEntries.size(); }
+ void Insert( const ScRangeFindData &rNew ) { maEntries.push_back(rNew); }
+
+ ScRangeFindData* GetObject( sal_uLong nIndex ) { return &(maEntries[nIndex]); }
void SetHidden( sal_Bool bSet ) { bHidden = bSet; }
--
1.7.3.4
Context
- [Libreoffice] [PATCH] List structure cleaning in calc · Rafael Dominguez
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.