[Libreoffice-commits] .: 10 commits - sc/inc sc/source
Joseph Powers
jpowers at kemper.freedesktop.org
Mon Feb 21 12:01:42 PST 2011
sc/inc/dpsave.hxx | 21 +-
sc/inc/dptabsrc.hxx | 7
sc/inc/fmtuno.hxx | 9 -
sc/inc/refreshtimer.hxx | 4
sc/source/core/data/dpsave.cxx | 231 +++++++++++++--------------
sc/source/core/data/dptabsrc.cxx | 24 +-
sc/source/filter/dif/difimp.cxx | 86 ++++------
sc/source/filter/excel/excimp8.cxx | 6
sc/source/filter/excel/exctools.cxx | 83 ++-------
sc/source/filter/excel/frmbase.cxx | 59 ++-----
sc/source/filter/excel/impop.cxx | 4
sc/source/filter/excel/xepivot.cxx | 18 --
sc/source/filter/inc/dif.hxx | 88 +++-------
sc/source/filter/inc/excscen.hxx | 103 ++----------
sc/source/filter/inc/formel.hxx | 128 ++-------------
sc/source/filter/inc/lotattr.hxx | 126 +++++++--------
sc/source/filter/lotus/lotattr.cxx | 176 ++++++++-------------
sc/source/filter/xml/XMLExportDataPilot.cxx | 10 -
sc/source/ui/docshell/autostyl.cxx | 128 +++++----------
sc/source/ui/inc/autostyl.hxx | 13 +
sc/source/ui/inc/prevloc.hxx | 10 -
sc/source/ui/unoobj/dapiuno.cxx | 39 ++--
sc/source/ui/unoobj/fmtuno.cxx | 48 ++---
sc/source/ui/view/prevloc.cxx | 233 +++++++++++++---------------
24 files changed, 662 insertions(+), 992 deletions(-)
New commits:
commit 4b8c17bf3425b42428476f1df3dda42025d4822c
Author: npcdoom <venccsralph at gmail.com>
Date: Mon Feb 21 11:02:01 2011 -0800
[PATCH 10/10] Remove deprecated List container.
diff --git a/sc/source/filter/excel/frmbase.cxx b/sc/source/filter/excel/frmbase.cxx
index 868b927..c4552fd 100644
--- a/sc/source/filter/excel/frmbase.cxx
+++ b/sc/source/filter/excel/frmbase.cxx
@@ -29,29 +29,9 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sc.hxx"
-
-
-
#include "formel.hxx"
-
-
-
-_ScRangeList::~_ScRangeList()
-{
- ScRange* p = ( ScRange* ) First();
-
- while( p )
- {
- delete p;
- p = ( ScRange* ) Next();
- }
-}
-
-
-
-
-_ScRangeListTabs::_ScRangeListTabs( void )
+_ScRangeListTabs::_ScRangeListTabs()
{
ppTabLists = new _ScRangeList*[ MAXTAB + 1 ];
@@ -63,7 +43,6 @@ _ScRangeListTabs::_ScRangeListTabs( void )
nAct = 0;
}
-
_ScRangeListTabs::~_ScRangeListTabs()
{
if( bHasRanges )
@@ -111,11 +90,10 @@ void _ScRangeListTabs::Append( ScSingleRefData a, SCsTAB nTab, const BOOL b )
if( !p )
p = ppTabLists[ nTab ] = new _ScRangeList;
- p->Append( a );
+ p->push_back(new ScRange(a.nCol,a.nRow,a.nTab));
}
}
-
void _ScRangeListTabs::Append( ScComplexRefData a, SCsTAB nTab, const BOOL b )
{
if( b )
@@ -166,6 +144,7 @@ void _ScRangeListTabs::Append( ScComplexRefData a, SCsTAB nTab, const BOOL b )
if( nTab == SCTAB_MAX)
return;
+
if( nTab < -1)
nTab = a.Ref1.nTab;
@@ -176,11 +155,11 @@ void _ScRangeListTabs::Append( ScComplexRefData a, SCsTAB nTab, const BOOL b )
if( !p )
p = ppTabLists[ nTab ] = new _ScRangeList;
- p->Append( a );
+ p->push_back(new ScRange(a.Ref1.nCol,a.Ref1.nRow,a.Ref1.nTab,
+ a.Ref2.nCol,a.Ref2.nRow,a.Ref2.nTab));
}
}
-
const ScRange* _ScRangeListTabs::First( const UINT16 n )
{
DBG_ASSERT( ValidTab(n), "-_ScRangeListTabs::First(): Und tschuessssssss!" );
@@ -189,27 +168,25 @@ const ScRange* _ScRangeListTabs::First( const UINT16 n )
{
pAct = ppTabLists[ n ];
nAct = n;
- return pAct->First();
- }
- else
- {
- pAct = NULL;
- nAct = 0;
- return NULL;
+ pAct->iterCur = pAct->begin();
+ return &(*(pAct->iterCur));
}
-}
+ pAct = NULL;
+ nAct = 0;
+ return NULL;
+}
-const ScRange* _ScRangeListTabs::Next( void )
+const ScRange* _ScRangeListTabs::Next ()
{
if( pAct )
- return pAct->Next();
- else
- return NULL;
-}
-
-
+ {
+ ++pAct->iterCur;
+ return &(*(pAct->iterCur));
+ }
+ return NULL;
+}
ConverterBase::ConverterBase( UINT16 nNewBuffer ) :
aEingPos( 0, 0, 0 ),
diff --git a/sc/source/filter/excel/impop.cxx b/sc/source/filter/excel/impop.cxx
index 018e4c7..57cb68e 100644
--- a/sc/source/filter/excel/impop.cxx
+++ b/sc/source/filter/excel/impop.cxx
@@ -1262,7 +1262,7 @@ void ImportExcel::PostDocLoad( void )
p = pExcRoot->pPrintRanges->First( static_cast<UINT16>(n) );
if( p )
{
- DBG_ASSERT( pExcRoot->pPrintRanges->GetActList(),
+ DBG_ASSERT( pExcRoot->pPrintRanges->HasActList(),
"-ImportExcel::PostDocLoad(): Imaginaere Tabelle gefunden!" );
pD->ClearPrintRanges( n );
@@ -1288,7 +1288,7 @@ void ImportExcel::PostDocLoad( void )
p = pExcRoot->pPrintTitles->First( static_cast<UINT16>(n) );
if( p )
{
- DBG_ASSERT( pExcRoot->pPrintTitles->GetActList(),
+ DBG_ASSERT( pExcRoot->pPrintTitles->HasActList(),
"-ImportExcel::PostDocLoad(): Imaginaere Tabelle gefunden!" );
BOOL bRowVirgin = TRUE;
diff --git a/sc/source/filter/inc/formel.hxx b/sc/source/filter/inc/formel.hxx
index d18be9b..79cb2fc 100644
--- a/sc/source/filter/inc/formel.hxx
+++ b/sc/source/filter/inc/formel.hxx
@@ -29,15 +29,16 @@
#ifndef SC_FORMEL_HXX
#define SC_FORMEL_HXX
+#include <boost/ptr_container/ptr_vector.hpp>
+
#include <tools/solar.h>
#include <tools/string.hxx>
-#include "tokstack.hxx"
-#include "root.hxx"
-#include <global.hxx>
-#include <compiler.hxx>
+#include <compiler.hxx>
+#include <global.hxx>
-// ----- forwards --------------------------------------------------------
+#include "root.hxx"
+#include "tokstack.hxx"
class XclImpStream;
class ScTokenArray;
@@ -45,11 +46,6 @@ class ScFormulaCell;
struct ScSingleRefData;
struct ScComplexRefData;
-
-
-
-//------------------------------------------------------------------------
-
enum ConvErr
{
ConvOK = 0,
@@ -59,7 +55,6 @@ enum ConvErr
ConvErrCount // Nicht alle Bytes der Formel 'erwischt'
};
-
enum FORMULA_TYPE
{
FT_CellFormula,
@@ -67,115 +62,34 @@ enum FORMULA_TYPE
FT_SharedFormula
};
-
-
-
-//--------------------------------------------------------- class ScRangeList -
-
-class _ScRangeList : protected List
-{
-private:
-protected:
-public:
- virtual ~_ScRangeList();
- inline void Append( const ScRange& rRange );
- inline void Append( ScRange* pRange );
- inline void Append( const ScSingleRefData& rSRD );
- inline void Append( const ScComplexRefData& rCRD );
-
- using List::Count;
- inline BOOL HasRanges( void ) const;
-
- inline const ScRange* First( void );
- inline const ScRange* Next( void );
-};
-
-
-inline void _ScRangeList::Append( const ScRange& r )
-{
- List::Insert( new ScRange( r ), LIST_APPEND );
-}
-
-
-inline void _ScRangeList::Append( ScRange* p )
-{
- List::Insert( p, LIST_APPEND );
-}
-
-
-inline BOOL _ScRangeList::HasRanges( void ) const
-{
- return Count() > 0;
-}
-
-
-inline const ScRange* _ScRangeList::First( void )
-{
- return ( const ScRange* ) List::First();
-}
-
-
-inline const ScRange* _ScRangeList::Next( void )
-{
- return ( const ScRange* ) List::Next();
-}
-
-
-inline void _ScRangeList::Append( const ScSingleRefData& r )
-{
- List::Insert( new ScRange( r.nCol, r.nRow, r.nTab ), LIST_APPEND );
-}
-
-
-inline void _ScRangeList::Append( const ScComplexRefData& r )
-{
- List::Insert( new ScRange( r.Ref1.nCol, r.Ref1.nRow, r.Ref1.nTab,
- r.Ref2.nCol, r.Ref2.nRow, r.Ref2.nTab ),
- LIST_APPEND );
-}
-
-
-
-
-//----------------------------------------------------- class ScRangeListTabs -
-
class _ScRangeListTabs
{
-private:
-protected:
+ struct _ScRangeList : public boost::ptr_vector<ScRange>
+ {
+ iterator iterCur;
+ };
+
BOOL bHasRanges;
_ScRangeList** ppTabLists;
_ScRangeList* pAct;
UINT16 nAct;
-public:
- _ScRangeListTabs( void );
- virtual ~_ScRangeListTabs();
-
- void Append( ScSingleRefData aSRD, SCsTAB nTab, const BOOL bLimit = TRUE );
- void Append( ScComplexRefData aCRD, SCsTAB nTab, const BOOL bLimit = TRUE );
-
- inline BOOL HasRanges( void ) const;
-
- const ScRange* First( const UINT16 nTab = 0 );
- const ScRange* Next( void );
-// const ScRange* NextContinue( void );
- inline const _ScRangeList* GetActList( void ) const;
-};
+public:
-inline BOOL _ScRangeListTabs::HasRanges( void ) const
-{
- return bHasRanges;
-}
+ _ScRangeListTabs ();
+ ~_ScRangeListTabs();
-inline const _ScRangeList* _ScRangeListTabs::GetActList( void ) const
-{
- return pAct;
-}
+ void Append( ScSingleRefData aSRD, SCsTAB nTab, const BOOL bLimit = TRUE );
+ void Append( ScComplexRefData aCRD, SCsTAB nTab, const BOOL bLimit = TRUE );
+ const ScRange* First ( const UINT16 nTab = 0 );
+ const ScRange* Next ();
+ inline bool HasRanges () const { return bHasRanges; }
+ inline bool HasActList () const { return pAct != NULL; }
+};
class ConverterBase
{
commit 4889aefda0074bb6c579bb3c2a3741f0df6e9816
Author: npcdoom <venccsralph at gmail.com>
Date: Mon Feb 21 11:00:30 2011 -0800
[PATCH 09/10] Remove deprecated List container.
diff --git a/sc/inc/dpsave.hxx b/sc/inc/dpsave.hxx
index 931f828..792ff9b 100644
--- a/sc/inc/dpsave.hxx
+++ b/sc/inc/dpsave.hxx
@@ -29,16 +29,19 @@
#ifndef SC_DPSAVE_HXX
#define SC_DPSAVE_HXX
+#include <list>
+#include <memory>
+
+#include <boost/ptr_container/ptr_vector.hpp>
+#include <boost/unordered_map.hpp>
+
+#include <com/sun/star/sheet/XDimensionsSupplier.hpp>
+#include <com/sun/star/sheet/DataPilotFieldOrientation.hpp>
#include <rtl/ustring.hxx>
#include <sal/types.h>
#include <tools/string.hxx>
-#include <tools/list.hxx>
-#include <com/sun/star/sheet/XDimensionsSupplier.hpp>
-#include <com/sun/star/sheet/DataPilotFieldOrientation.hpp>
+
#include "scdllapi.h"
-#include <boost/unordered_map.hpp>
-#include <list>
-#include <memory>
namespace com { namespace sun { namespace star { namespace sheet {
struct DataPilotFieldReference;
@@ -236,7 +239,7 @@ public:
class ScDPSaveData
{
private:
- List aDimList;
+ boost::ptr_vector<ScDPSaveDimension> aDimList;
ScDPDimensionSaveData* pDimensionData; // settings that create new dimensions
sal_uInt16 nColumnGrandMode;
sal_uInt16 nRowGrandMode;
@@ -264,11 +267,11 @@ public:
SC_DLLPUBLIC void SetGrandTotalName(const ::rtl::OUString& rName);
SC_DLLPUBLIC const ::rtl::OUString* GetGrandTotalName() const;
- const List& GetDimensions() const
+ const boost::ptr_vector<ScDPSaveDimension>& GetDimensions() const
{ return aDimList; }
void AddDimension(ScDPSaveDimension* pDim)
- { aDimList.Insert(pDim, LIST_APPEND); }
+ { aDimList.push_back(pDim); }
/**
* Get a dimension object by its name. <i>If one doesn't exist for the
diff --git a/sc/source/core/data/dpsave.cxx b/sc/source/core/data/dpsave.cxx
index 9f0ae49..cc7ab86 100644
--- a/sc/source/core/data/dpsave.cxx
+++ b/sc/source/core/data/dpsave.cxx
@@ -759,12 +759,7 @@ ScDPSaveData::ScDPSaveData(const ScDPSaveData& r) :
else
pDimensionData = NULL;
- long nCount = r.aDimList.Count();
- for (long i=0; i<nCount; i++)
- {
- ScDPSaveDimension* pNew = new ScDPSaveDimension( *(ScDPSaveDimension*)r.aDimList.GetObject(i) );
- aDimList.Insert( pNew, LIST_APPEND );
- }
+ aDimList = r.aDimList.clone();
if (r.mpGrandTotalName.get())
mpGrandTotalName.reset(new OUString(*r.mpGrandTotalName));
@@ -796,14 +791,11 @@ bool ScDPSaveData::operator== ( const ScDPSaveData& r ) const
if ( !pDimensionData || !r.pDimensionData || !( *pDimensionData == *r.pDimensionData ) )
return false;
- sal_uInt32 nCount = aDimList.Count();
- if ( nCount != r.aDimList.Count() )
+ if ( aDimList.size() != r.aDimList.size() )
return false;
- for (sal_uInt32 i=0; i<nCount; ++i)
- if ( !( *(ScDPSaveDimension*)aDimList.GetObject(i) ==
- *(ScDPSaveDimension*)r.aDimList.GetObject(i) ) )
- return false;
+ if (aDimList != r.aDimList)
+ return false;
if (mpGrandTotalName.get())
{
@@ -820,11 +812,6 @@ bool ScDPSaveData::operator== ( const ScDPSaveData& r ) const
ScDPSaveData::~ScDPSaveData()
{
- long nCount = aDimList.Count();
- for (long i=0; i<nCount; i++)
- delete (ScDPSaveDimension*)aDimList.GetObject(i);
- aDimList.Clear();
-
delete pDimensionData;
}
@@ -840,41 +827,40 @@ const OUString* ScDPSaveData::GetGrandTotalName() const
ScDPSaveDimension* ScDPSaveData::GetDimensionByName(const ::rtl::OUString& rName)
{
- long nCount = aDimList.Count();
- for (long i=0; i<nCount; i++)
+ boost::ptr_vector<ScDPSaveDimension>::const_iterator iter;
+ for (iter = aDimList.begin(); iter != aDimList.end(); ++iter)
{
- ScDPSaveDimension* pDim = (ScDPSaveDimension*)aDimList.GetObject(i);
- if ( pDim->GetName() == rName && !pDim->IsDataLayout() )
- return pDim;
+ if (iter->GetName() == rName && !iter->IsDataLayout() )
+ return const_cast<ScDPSaveDimension*>(&(*iter));
}
+
ScDPSaveDimension* pNew = new ScDPSaveDimension( rName, false );
- aDimList.Insert( pNew, LIST_APPEND );
+ aDimList.push_back(pNew);
return pNew;
}
ScDPSaveDimension* ScDPSaveData::GetExistingDimensionByName(const ::rtl::OUString& rName) const
{
- long nCount = aDimList.Count();
- for (long i=0; i<nCount; i++)
+ boost::ptr_vector<ScDPSaveDimension>::const_iterator iter;
+ for (iter = aDimList.begin(); iter != aDimList.end(); ++iter)
{
- ScDPSaveDimension* pDim = (ScDPSaveDimension*)aDimList.GetObject(i);
- if ( pDim->GetName() == rName && !pDim->IsDataLayout() )
- return pDim;
+ if (iter->GetName() == rName && !iter->IsDataLayout() )
+ return const_cast<ScDPSaveDimension*>(&(*iter));
}
return NULL; // don't create new
}
ScDPSaveDimension* ScDPSaveData::GetNewDimensionByName(const ::rtl::OUString& rName)
{
- long nCount = aDimList.Count();
- for (long i=0; i<nCount; i++)
+ boost::ptr_vector<ScDPSaveDimension>::const_iterator iter;
+ for (iter = aDimList.begin(); iter != aDimList.end(); ++iter)
{
- ScDPSaveDimension* pDim = (ScDPSaveDimension*)aDimList.GetObject(i);
- if ( pDim->GetName() == rName && !pDim->IsDataLayout() )
+ if (iter->GetName() == rName && !iter->IsDataLayout() )
return DuplicateDimension(rName);
}
+
ScDPSaveDimension* pNew = new ScDPSaveDimension( rName, false );
- aDimList.Insert( pNew, LIST_APPEND );
+ aDimList.push_back(pNew);
return pNew;
}
@@ -885,18 +871,17 @@ ScDPSaveDimension* ScDPSaveData::GetDataLayoutDimension()
return pDim;
ScDPSaveDimension* pNew = new ScDPSaveDimension( ::rtl::OUString(), true );
- aDimList.Insert( pNew, LIST_APPEND );
+ aDimList.push_back(pNew);
return pNew;
}
ScDPSaveDimension* ScDPSaveData::GetExistingDataLayoutDimension() const
{
- long nCount = aDimList.Count();
- for (long i=0; i<nCount; i++)
+ boost::ptr_vector<ScDPSaveDimension>::const_iterator iter;
+ for (iter = aDimList.begin(); iter != aDimList.end(); ++iter)
{
- ScDPSaveDimension* pDim = (ScDPSaveDimension*)aDimList.GetObject(i);
- if ( pDim->IsDataLayout() )
- return pDim;
+ if ( iter->IsDataLayout() )
+ return const_cast<ScDPSaveDimension*>(&(*iter));
}
return NULL;
}
@@ -909,20 +894,18 @@ ScDPSaveDimension* ScDPSaveData::DuplicateDimension(const ::rtl::OUString& rName
ScDPSaveDimension* pOld = GetDimensionByName( rName );
ScDPSaveDimension* pNew = new ScDPSaveDimension( *pOld );
pNew->SetDupFlag( true );
- aDimList.Insert( pNew, LIST_APPEND );
+ aDimList.push_back(pNew);
return pNew;
}
void ScDPSaveData::RemoveDimensionByName(const ::rtl::OUString& rName)
{
- long nCount = aDimList.Count();
- for (long i=0; i<nCount; i++)
+ boost::ptr_vector<ScDPSaveDimension>::iterator iter;
+ for (iter = aDimList.begin(); iter != aDimList.end(); ++iter)
{
- ScDPSaveDimension* pDim = (ScDPSaveDimension*)aDimList.GetObject(i);
- if ( pDim->GetName() == rName && !pDim->IsDataLayout() )
+ if ( iter->GetName() == rName && !iter->IsDataLayout() )
{
- delete pDim;
- aDimList.Remove(i);
+ aDimList.erase(iter);
break;
}
}
@@ -932,7 +915,7 @@ ScDPSaveDimension& ScDPSaveData::DuplicateDimension( const ScDPSaveDimension& rD
{
ScDPSaveDimension* pNew = new ScDPSaveDimension( rDim );
pNew->SetDupFlag( true );
- aDimList.Insert( pNew, LIST_APPEND );
+ aDimList.push_back(pNew);
return *pNew;
}
@@ -941,25 +924,23 @@ ScDPSaveDimension* ScDPSaveData::GetInnermostDimension(sal_uInt16 nOrientation)
// return the innermost dimension for the given orientation,
// excluding data layout dimension
- ScDPSaveDimension* pInner = NULL;
- long nCount = aDimList.Count();
- for (long i=0; i<nCount; i++)
+ boost::ptr_vector<ScDPSaveDimension>::const_reverse_iterator iter;
+ for (iter = aDimList.rbegin(); iter != aDimList.rend(); ++iter)
{
- ScDPSaveDimension* pDim = static_cast<ScDPSaveDimension*>(aDimList.GetObject(i));
- if ( pDim->GetOrientation() == nOrientation && !pDim->IsDataLayout() )
- pInner = pDim;
+ if (iter->GetOrientation() == nOrientation && !iter->IsDataLayout())
+ return const_cast<ScDPSaveDimension*>(&(*iter));
}
- return pInner; // the last matching one
+
+ return NULL;
}
ScDPSaveDimension* ScDPSaveData::GetFirstDimension(sheet::DataPilotFieldOrientation eOrientation)
{
- long nCount = aDimList.Count();
- for (long i = 0; i < nCount; ++i)
+ boost::ptr_vector<ScDPSaveDimension>::const_iterator iter;
+ for (iter = aDimList.begin(); iter != aDimList.end(); ++iter)
{
- ScDPSaveDimension* pDim = static_cast<ScDPSaveDimension*>(aDimList.GetObject(i));
- if (pDim->GetOrientation() == eOrientation && !pDim->IsDataLayout())
- return pDim;
+ if (iter->GetOrientation() == eOrientation && !iter->IsDataLayout())
+ return const_cast<ScDPSaveDimension*>(&(*iter));
}
return NULL;
}
@@ -968,11 +949,10 @@ long ScDPSaveData::GetDataDimensionCount() const
{
long nDataCount = 0;
- long nCount = aDimList.Count();
- for (long i=0; i<nCount; i++)
+ boost::ptr_vector<ScDPSaveDimension>::const_iterator iter;
+ for (iter = aDimList.begin(); iter != aDimList.end(); ++iter)
{
- const ScDPSaveDimension* pDim = static_cast<const ScDPSaveDimension*>(aDimList.GetObject(i));
- if ( pDim->GetOrientation() == sheet::DataPilotFieldOrientation_DATA )
+ if (iter->GetOrientation() == sheet::DataPilotFieldOrientation_DATA)
++nDataCount;
}
@@ -985,18 +965,26 @@ void ScDPSaveData::SetPosition( ScDPSaveDimension* pDim, long nNew )
sal_uInt16 nOrient = pDim->GetOrientation();
- aDimList.Remove( pDim );
- sal_uInt32 nCount = aDimList.Count(); // after remove
+ boost::ptr_vector<ScDPSaveDimension>::iterator it;
+ for ( it = aDimList.begin(); it != aDimList.end(); ++it)
+ {
+ if (pDim == &(*it))
+ {
+ aDimList.erase(it);
+ break;
+ }
+ }
- sal_uInt32 nInsPos = 0;
- while ( nNew > 0 && nInsPos < nCount )
+ boost::ptr_vector<ScDPSaveDimension>::iterator iterInsert = aDimList.begin();
+ while ( nNew > 0 && iterInsert != aDimList.end())
{
- if ( ((ScDPSaveDimension*)aDimList.GetObject(nInsPos))->GetOrientation() == nOrient )
+ if (iterInsert->GetOrientation() == nOrient )
--nNew;
- ++nInsPos;
+
+ ++iterInsert;
}
- aDimList.Insert( pDim, nInsPos );
+ aDimList.insert(iterInsert,pDim);
}
void ScDPSaveData::SetColumnGrand(bool bSet)
@@ -1092,15 +1080,14 @@ void ScDPSaveData::WriteToSource( const uno::Reference<sheet::XDimensionsSupplie
lcl_ResetOrient( xSource );
- long nCount = aDimList.Count();
- for (long i=0; i<nCount; i++)
+ boost::ptr_vector<ScDPSaveDimension>::iterator iter = aDimList.begin();
+ for (long i = 0; iter != aDimList.end(); ++iter, ++i)
{
- ScDPSaveDimension* pDim = (ScDPSaveDimension*)aDimList.GetObject(i);
- rtl::OUString aName = pDim->GetName();
+ rtl::OUString aName = iter->GetName();
- DBG_TRACESTR(String(pDim->GetName()));
+ DBG_TRACESTR(String(iter->GetName()));
- bool bData = pDim->IsDataLayout();
+ bool bData = iter->IsDataLayout();
//! getByName for ScDPSource, including DataLayoutDimension !!!!!!!!
@@ -1130,9 +1117,9 @@ void ScDPSaveData::WriteToSource( const uno::Reference<sheet::XDimensionsSupplie
if ( bFound )
{
- if ( pDim->GetDupFlag() )
+ if ( iter->GetDupFlag() )
{
- OUStringBuffer aBuf(pDim->GetName());
+ OUStringBuffer aBuf(iter->GetName());
// different name for each duplication of a (real) dimension...
for (long j=0; j<=i; ++j) //! Test !!!!!!
@@ -1147,12 +1134,12 @@ void ScDPSaveData::WriteToSource( const uno::Reference<sheet::XDimensionsSupplie
if (xNewName.is())
{
xNewName->setName(aBuf.makeStringAndClear());
- pDim->WriteToSource( xNew );
+ iter->WriteToSource( xNew );
}
}
}
else
- pDim->WriteToSource( xIntDim );
+ iter->WriteToSource( xIntDim );
}
}
DBG_ASSERT(bFound, "WriteToSource: Dimension not found");
@@ -1176,11 +1163,10 @@ void ScDPSaveData::WriteToSource( const uno::Reference<sheet::XDimensionsSupplie
bool ScDPSaveData::IsEmpty() const
{
- long nCount = aDimList.Count();
- for (long i=0; i<nCount; i++)
+ boost::ptr_vector<ScDPSaveDimension>::const_iterator iter;
+ for (iter = aDimList.begin(); iter != aDimList.end(); ++iter)
{
- ScDPSaveDimension* pDim = (ScDPSaveDimension*)aDimList.GetObject(i);
- if ( pDim->GetOrientation() != sheet::DataPilotFieldOrientation_HIDDEN && !pDim->IsDataLayout() )
+ if (iter->GetOrientation() != sheet::DataPilotFieldOrientation_HIDDEN && !iter->IsDataLayout())
return false;
}
return true; // no entries that are not hidden
@@ -1216,11 +1202,10 @@ void ScDPSaveData::BuildAllDimensionMembers(ScDPTableData* pData)
NameIndexMap::const_iterator itrEnd = aMap.end();
- sal_uInt32 n = aDimList.Count();
- for (sal_uInt32 i = 0; i < n; ++i)
+ boost::ptr_vector<ScDPSaveDimension>::iterator iter;
+ for (iter = aDimList.begin(); iter != aDimList.end(); ++iter)
{
- ScDPSaveDimension* pDim = static_cast<ScDPSaveDimension*>(aDimList.GetObject(i));
- const ::rtl::OUString& rDimName = pDim->GetName();
+ const ::rtl::OUString& rDimName = iter->GetName();
if (!rDimName.getLength())
// empty dimension name. It must be data layout.
continue;
@@ -1237,13 +1222,13 @@ void ScDPSaveData::BuildAllDimensionMembers(ScDPTableData* pData)
{
const ScDPItemData* pMemberData = pData->GetMemberById( nDimIndex, rMembers[j] );
::rtl::OUString aMemName = pMemberData->GetString();
- if (pDim->GetExistingMemberByName(aMemName))
+ if (iter->GetExistingMemberByName(aMemName))
// this member instance already exists. nothing to do.
continue;
auto_ptr<ScDPSaveMember> pNewMember(new ScDPSaveMember(aMemName));
pNewMember->SetIsVisible(true);
- pDim->AddMember(pNewMember.release());
+ iter->AddMember(pNewMember.release());
}
}
@@ -1263,47 +1248,49 @@ void ScDPSaveData::Refresh( const uno::Reference<sheet::XDimensionsSupplier>& xS
{
try
{
- long nCount = aDimList.Count();
std::list<rtl::OUString> deletedDims;
- for (long i=nCount-1; i >=0 ; i--)
+
{
- ScDPSaveDimension* pDim = (ScDPSaveDimension*)aDimList.GetObject(i);
+ boost::ptr_vector<ScDPSaveDimension>::iterator iter = aDimList.end()-1;
+ for (long i = aDimList.size()-1; i >= 0; ++i,--iter)
+ {
+ rtl::OUString aName = iter->GetName();
+ if ( iter->IsDataLayout() )
+ continue;
+
+ uno::Reference<container::XNameAccess> xDimsName = xSource->getDimensions();
+ uno::Reference<container::XIndexAccess> xIntDims = new ScNameToIndexAccess( xDimsName );
+ long nIntCount = xIntDims->getCount();
+ bool bFound = false;
+ for (long nIntDim=0; nIntDim<nIntCount && !bFound; nIntDim++)
+ {
+ uno::Reference<uno::XInterface> xIntDim = ScUnoHelpFunctions::AnyToInterface( xIntDims->getByIndex(nIntDim) );
+ uno::Reference<container::XNamed> xDimName( xIntDim, uno::UNO_QUERY );
+ if ( xDimName.is() && xDimName->getName() == aName )
+ bFound = true;
+ }
- rtl::OUString aName = pDim->GetName();
- if ( pDim->IsDataLayout() )
- continue;
+ if ( !bFound )
+ {
+ deletedDims.push_back( aName );
+ iter = aDimList.erase(iter);
+ DBG_TRACE( "\n Remove dim: \t" );
+ DBG_TRACESTR( String( aName ) );
+ }
- uno::Reference<container::XNameAccess> xDimsName = xSource->getDimensions();
- uno::Reference<container::XIndexAccess> xIntDims = new ScNameToIndexAccess( xDimsName );
- long nIntCount = xIntDims->getCount();
- bool bFound = false;
- for (long nIntDim=0; nIntDim<nIntCount && !bFound; nIntDim++)
- {
- uno::Reference<uno::XInterface> xIntDim = ScUnoHelpFunctions::AnyToInterface( xIntDims->getByIndex(nIntDim) );
- uno::Reference<container::XNamed> xDimName( xIntDim, uno::UNO_QUERY );
- if ( xDimName.is() && xDimName->getName() == aName )
- bFound = true;
- }
- if ( !bFound )
- {
- deletedDims.push_back( aName );
- aDimList.Remove(i);
- DBG_TRACE( "\n Remove dim: \t" );
- DBG_TRACESTR( String( aName ) );
}
-
}
- nCount = aDimList.Count();
- for (long i=nCount-1; i >=0 ; --i) //check every dimension ??
{
- ScDPSaveDimension* pDim = (ScDPSaveDimension*)aDimList.GetObject(i);
-
- rtl::OUString aName = pDim->GetName();
- if ( pDim->IsDataLayout() )
- continue;
- pDim->Refresh( xSource, deletedDims );
+ boost::ptr_vector<ScDPSaveDimension>::reverse_iterator iter;
+ for (iter = aDimList.rbegin(); iter != aDimList.rend(); ++iter) //check every dimension ??
+ {
+ rtl::OUString aName = iter->GetName();
+ if ( iter->IsDataLayout() )
+ continue;
+ iter->Refresh( xSource, deletedDims );
+ }
}
mbDimensionMembersBuilt = false; // there may be new members
diff --git a/sc/source/filter/excel/xepivot.cxx b/sc/source/filter/excel/xepivot.cxx
index 3244a45..43813b6 100644
--- a/sc/source/filter/excel/xepivot.cxx
+++ b/sc/source/filter/excel/xepivot.cxx
@@ -1290,21 +1290,19 @@ XclExpPivotTable::XclExpPivotTable( const XclExpRoot& rRoot, const ScDPObject& r
for( sal_uInt16 nFieldIdx = 0, nFieldCount = mrPCache.GetFieldCount(); nFieldIdx < nFieldCount; ++nFieldIdx )
maFieldList.AppendNewRecord( new XclExpPTField( *this, nFieldIdx ) );
- const List& rDimList = pSaveData->GetDimensions();
- ULONG nDimIdx, nDimCount = rDimList.Count();
+ boost::ptr_vector<ScDPSaveDimension>::const_iterator iter;
+ const boost::ptr_vector<ScDPSaveDimension>& rDimList = pSaveData->GetDimensions();
/* 2) First process all data dimensions, they are needed for extended
settings of row/column/page fields (sorting/auto show). */
- for( nDimIdx = 0; nDimIdx < nDimCount; ++nDimIdx )
- if( const ScDPSaveDimension* pSaveDim = static_cast< const ScDPSaveDimension* >( rDimList.GetObject( nDimIdx ) ) )
- if( pSaveDim->GetOrientation() == DataPilotFieldOrientation_DATA )
- SetDataFieldPropertiesFromDim( *pSaveDim );
+ for (iter = rDimList.begin(); iter != rDimList.end(); ++iter)
+ if (iter->GetOrientation() == DataPilotFieldOrientation_DATA)
+ SetDataFieldPropertiesFromDim(*iter);
/* 3) Row/column/page/hidden fields. */
- for( nDimIdx = 0; nDimIdx < nDimCount; ++nDimIdx )
- if( const ScDPSaveDimension* pSaveDim = static_cast< const ScDPSaveDimension* >( rDimList.GetObject( nDimIdx ) ) )
- if( pSaveDim->GetOrientation() != DataPilotFieldOrientation_DATA )
- SetFieldPropertiesFromDim( *pSaveDim );
+ for (iter = rDimList.begin(); iter != rDimList.end(); ++iter)
+ if (iter->GetOrientation() != DataPilotFieldOrientation_DATA)
+ SetDataFieldPropertiesFromDim(*iter);
// Finalize -------------------------------------------------------
diff --git a/sc/source/filter/xml/XMLExportDataPilot.cxx b/sc/source/filter/xml/XMLExportDataPilot.cxx
index 532382a..0e90894 100644
--- a/sc/source/filter/xml/XMLExportDataPilot.cxx
+++ b/sc/source/filter/xml/XMLExportDataPilot.cxx
@@ -719,12 +719,10 @@ void ScXMLExportDataPilot::WriteDimension(ScDPSaveDimension* pDim, const ScDPDim
void ScXMLExportDataPilot::WriteDimensions(ScDPSaveData* pDPSave)
{
- List aDimensions = pDPSave->GetDimensions();
- sal_Int32 nDimCount = aDimensions.Count();
- for (sal_Int32 nDim = 0; nDim < nDimCount; nDim++)
- {
- WriteDimension((ScDPSaveDimension*)aDimensions.GetObject(nDim), pDPSave->GetExistingDimensionData());
- }
+ const boost::ptr_vector<ScDPSaveDimension> &rDimensions = pDPSave->GetDimensions();
+ boost::ptr_vector<ScDPSaveDimension>::const_iterator iter;
+ for (iter = rDimensions.begin(); iter != rDimensions.end(); ++iter)
+ WriteDimension(const_cast<ScDPSaveDimension*>(&(*iter)), pDPSave->GetExistingDimensionData());
}
void ScXMLExportDataPilot::WriteGrandTotal(::xmloff::token::XMLTokenEnum eOrient, bool bVisible, const OUString* pGrandTotal)
diff --git a/sc/source/ui/unoobj/dapiuno.cxx b/sc/source/ui/unoobj/dapiuno.cxx
index 7e6acff..8fe24f9 100644
--- a/sc/source/ui/unoobj/dapiuno.cxx
+++ b/sc/source/ui/unoobj/dapiuno.cxx
@@ -1515,16 +1515,16 @@ ScDPSaveDimension* ScDataPilotChildObjBase::GetDPDimension( ScDPObject** ppDPObj
return pSaveData->GetDimensionByName( maFieldId.maFieldName );
// find dimension with specified index (search in duplicated dimensions)
- const List& rDimensions = pSaveData->GetDimensions();
- ULONG nDimCount = rDimensions.Count();
+ const boost::ptr_vector<ScDPSaveDimension>& rDimensions = pSaveData->GetDimensions();
+
sal_Int32 nFoundIdx = 0;
- for( ULONG nDim = 0; nDim < nDimCount; ++nDim )
+ boost::ptr_vector<ScDPSaveDimension>::const_iterator it;
+ for(it = rDimensions.begin(); it != rDimensions.end(); ++it)
{
- ScDPSaveDimension* pDim = static_cast< ScDPSaveDimension* >( rDimensions.GetObject( nDim ) );
- if( !pDim->IsDataLayout() && (pDim->GetName() == maFieldId.maFieldName) )
+ if( !it->IsDataLayout() && (it->GetName() == maFieldId.maFieldName) )
{
if( nFoundIdx == maFieldId.mnFieldIdx )
- return pDim;
+ return const_cast<ScDPSaveDimension*>(&(*it));
++nFoundIdx;
}
}
@@ -1787,14 +1787,14 @@ Sequence<OUString> SAL_CALL ScDataPilotFieldsObj::getElementNames()
{
Sequence< OUString > aSeq( lcl_GetFieldCount( pDPObj->GetSource(), maOrient ) );
OUString* pAry = aSeq.getArray();
- const List& rDimensions = pDPObj->GetSaveData()->GetDimensions();
- sal_Int32 nDimCount = rDimensions.Count();
- for (sal_Int32 nDim = 0; nDim < nDimCount; nDim++)
+
+ const boost::ptr_vector<ScDPSaveDimension>& rDimensions = pDPObj->GetSaveData()->GetDimensions();
+ boost::ptr_vector<ScDPSaveDimension>::const_iterator it;
+ for (it = rDimensions.begin(); it != rDimensions.end(); ++it)
{
- ScDPSaveDimension* pDim = (ScDPSaveDimension*)rDimensions.GetObject(nDim);
- if(maOrient.hasValue() && (pDim->GetOrientation() == maOrient.get< DataPilotFieldOrientation >()))
+ if(maOrient.hasValue() && (it->GetOrientation() == maOrient.get< DataPilotFieldOrientation >()))
{
- *pAry = pDim->GetName();
+ *pAry = it->GetName();
++pAry;
}
}
@@ -2077,16 +2077,15 @@ void ScDataPilotFieldObj::setOrientation(DataPilotFieldOrientation eNew)
// look for existing duplicate with orientation "hidden"
- const List& rDimensions = pSaveData->GetDimensions();
- sal_Int32 nDimCount = rDimensions.Count();
sal_Int32 nFound = 0;
- for ( sal_Int32 nDim = 0; nDim < nDimCount && !pNewDim; nDim++ )
+ const boost::ptr_vector<ScDPSaveDimension>& rDimensions = pSaveData->GetDimensions();
+ boost::ptr_vector<ScDPSaveDimension>::const_iterator it;
+ for ( it = rDimensions.begin(); it != rDimensions.end() && !pNewDim; ++it )
{
- ScDPSaveDimension* pOneDim = static_cast<ScDPSaveDimension*>(rDimensions.GetObject(nDim));
- if ( !pOneDim->IsDataLayout() && (pOneDim->GetName() == maFieldId.maFieldName) )
+ if ( !it->IsDataLayout() && (it->GetName() == maFieldId.maFieldName) )
{
- if ( pOneDim->GetOrientation() == DataPilotFieldOrientation_HIDDEN )
- pNewDim = pOneDim; // use this one
+ if ( it->GetOrientation() == DataPilotFieldOrientation_HIDDEN )
+ pNewDim = const_cast<ScDPSaveDimension*>(&(*it)); // use this one
else
++nFound; // count existing non-hidden occurrences
}
@@ -2102,7 +2101,7 @@ void ScDataPilotFieldObj::setOrientation(DataPilotFieldOrientation eNew)
pDim->SetOrientation(sal::static_int_cast<USHORT>(eNew));
// move changed field behind all other fields (make it the last field in dimension)
- pSaveData->SetPosition( pDim, pSaveData->GetDimensions().Count() );
+ pSaveData->SetPosition( pDim, pSaveData->GetDimensions().size() );
SetDPObject( pDPObj );
commit 17ebba046721d3f4accea2abce4b4b5e493bfc00
Author: npcdoom <venccsralph at gmail.com>
Date: Mon Feb 21 10:59:41 2011 -0800
[PATCH 08/10] Removed deprecated List container.
diff --git a/sc/source/filter/excel/excimp8.cxx b/sc/source/filter/excel/excimp8.cxx
index 10fac72..e148492 100644
--- a/sc/source/filter/excel/excimp8.cxx
+++ b/sc/source/filter/excel/excimp8.cxx
@@ -287,13 +287,13 @@ void ImportExcel8::Scenman( void )
aIn.Ignore( 4 );
aIn >> nLastDispl;
- aScenList.SetLast( nLastDispl );
+ aScenList.nLastScenario = nLastDispl;
}
void ImportExcel8::Scenario( void )
{
- aScenList.Append( new ExcScenario( aIn, *pExcRoot ) );
+ aScenList.aEntries.push_back( new ExcScenario( aIn, *pExcRoot ) );
}
@@ -423,7 +423,7 @@ void ImportExcel8::PostDocLoad( void )
ImportExcel::PostDocLoad();
// Scenarien bemachen! ACHTUNG: Hier wird Tabellen-Anzahl im Dokument erhoeht!!
- if( !pD->IsClipboard() && aScenList.Count() )
+ if( !pD->IsClipboard() && aScenList.aEntries.size() )
{
pD->UpdateChartListenerCollection(); // references in charts must be updated
diff --git a/sc/source/filter/excel/exctools.cxx b/sc/source/filter/excel/exctools.cxx
index 527738e..dcba10c 100644
--- a/sc/source/filter/excel/exctools.cxx
+++ b/sc/source/filter/excel/exctools.cxx
@@ -62,8 +62,6 @@
#include <vector>
-// - ALLGEMEINE ----------------------------------------------------------
-
RootData::RootData( void )
{
eDateiTyp = BiffX;
@@ -187,28 +185,13 @@ void XclImpOutlineBuffer::SetButtonMode( bool bRightOrUnder )
mbButtonAfter = bRightOrUnder;
}
-//___________________________________________________________________
-
-
-ExcScenarioCell::ExcScenarioCell( const UINT16 nC, const UINT16 nR ) : nCol( nC ), nRow( nR )
-{
-}
-
-
-void ExcScenarioCell::SetValue( const String& r )
+ExcScenarioCell::ExcScenarioCell( const UINT16 nC, const UINT16 nR )
+ : nCol( nC ), nRow( nR )
{
- aValue = r;
}
-
-
-
-#define EXCSCAPPEND(EXCSCCELL) (List::Insert(EXCSCCELL,LIST_APPEND))
-#define EXCSCFIRST() ((ExcScenarioCell*)List::First())
-#define EXCSCNEXT() ((ExcScenarioCell*)List::Next())
-
-
-ExcScenario::ExcScenario( XclImpStream& rIn, const RootData& rR ) : nTab( rR.pIR->GetCurrScTab() )
+ExcScenario::ExcScenario( XclImpStream& rIn, const RootData& rR )
+ : nTab( rR.pIR->GetCurrScTab() )
{
UINT16 nCref;
UINT8 nName, nComment;
@@ -240,32 +223,20 @@ ExcScenario::ExcScenario( XclImpStream& rIn, const RootData& rR ) : nTab( rR.pIR
{
rIn >> nR >> nC;
- EXCSCAPPEND( new ExcScenarioCell( nC, nR ) );
+ aEntries.push_back(new ExcScenarioCell( nC, nR ));
n--;
}
n = nCref;
- ExcScenarioCell* p = EXCSCFIRST();
- while( p )
- {
- p->SetValue( rIn.ReadUniString() );
- p = EXCSCNEXT();
- }
+ boost::ptr_vector<ExcScenarioCell>::iterator iter;
+ for (iter = aEntries.begin(); iter != aEntries.end(); ++iter)
+ iter->SetValue(rIn.ReadUniString());
}
-
ExcScenario::~ExcScenario()
{
- ExcScenarioCell* p = EXCSCFIRST();
-
- while( p )
- {
- delete p;
- p = EXCSCNEXT();
- }
-
if( pName )
delete pName;
if( pComment )
@@ -274,11 +245,9 @@ ExcScenario::~ExcScenario()
delete pUserName;
}
-
void ExcScenario::Apply( const XclImpRoot& rRoot, const BOOL bLast )
{
ScDocument& r = rRoot.GetDoc();
- ExcScenarioCell* p = EXCSCFIRST();
String aSzenName( *pName );
UINT16 nNewTab = nTab + 1;
@@ -289,17 +258,16 @@ void ExcScenario::Apply( const XclImpRoot& rRoot, const BOOL bLast )
// #112621# do not show scenario frames
r.SetScenarioData( nNewTab, *pComment, COL_LIGHTGRAY, /*SC_SCENARIO_SHOWFRAME|*/SC_SCENARIO_COPYALL|(nProtected ? SC_SCENARIO_PROTECT : 0) );
- while( p )
+ boost::ptr_vector<ExcScenarioCell>::const_iterator iter;
+ for (iter = aEntries.begin(); iter != aEntries.end(); ++iter)
{
- UINT16 nCol = p->nCol;
- UINT16 nRow = p->nRow;
- String aVal = p->GetValue();
+ UINT16 nCol = iter->nCol;
+ UINT16 nRow = iter->nRow;
+ String aVal = iter->GetValue();
r.ApplyFlagsTab( nCol, nRow, nCol, nRow, nNewTab, SC_MF_SCENARIO );
r.SetString( nCol, nRow, nNewTab, aVal );
-
- p = EXCSCNEXT();
}
if( bLast )
@@ -313,33 +281,16 @@ void ExcScenario::Apply( const XclImpRoot& rRoot, const BOOL bLast )
rRoot.GetTabInfo().InsertScTab( nNewTab );
}
-
-
-
-ExcScenarioList::~ExcScenarioList()
-{
- ExcScenario* p = _First();
-
- while( p )
- {
- delete p;
- p = _Next();
- }
-}
-
-
void ExcScenarioList::Apply( const XclImpRoot& rRoot )
{
- ExcScenario* p = _Last();
- UINT16 n = ( UINT16 ) Count();
+ sal_uInt16 n = static_cast<sal_uInt16>(aEntries.size());
- while( p )
+ boost::ptr_vector<ExcScenario>::reverse_iterator iter;
+ for (iter = aEntries.rbegin(); iter != aEntries.rend(); ++iter)
{
n--;
- p->Apply( rRoot, ( BOOL ) ( n == nLastScenario ) );
- p = _Prev();
+ iter->Apply(rRoot, n == nLastScenario);
}
}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/filter/inc/excscen.hxx b/sc/source/filter/inc/excscen.hxx
index bf91b53..9d3cfa2 100644
--- a/sc/source/filter/inc/excscen.hxx
+++ b/sc/source/filter/inc/excscen.hxx
@@ -29,17 +29,16 @@
#ifndef SC_EXCSCEN_HXX
#define SC_EXCSCEN_HXX
+#include <boost/ptr_container/ptr_vector.hpp>
+
#include <tools/solar.h>
#include <tools/string.hxx>
-
struct RootData;
class XclImpRoot;
class XclImpStream;
class ScDocument;
-
-
class ExcScenarioCell
{
private:
@@ -48,100 +47,42 @@ public:
const UINT16 nCol;
const UINT16 nRow;
- ExcScenarioCell( const UINT16 nC, const UINT16 nR );
- void SetValue( const String& rVal );
- inline const String& GetValue( void ) const;
-};
-
-
-
-
-class ExcScenario : protected List
-{
-private:
- friend class ExcScenarioList;
-protected:
- String* pName;
- String* pComment;
- String* pUserName;
- UINT8 nProtected;
+ ExcScenarioCell( const UINT16 nC, const UINT16 nR );
- const UINT16 nTab;
+ inline void SetValue( const String& rVal ) { aValue = rVal; }
- void Apply( const XclImpRoot& rRoot, const BOOL bLast = FALSE );
-public:
- ExcScenario( XclImpStream& rIn, const RootData& rRoot );
- virtual ~ExcScenario();
+ inline const String& GetValue( void ) const { return aValue; }
};
-
-
-
-class ExcScenarioList : protected List
+class ExcScenario
{
-private:
- UINT16 nLastScenario;
- inline ExcScenario* _First( void ) { return ( ExcScenario* ) List::First(); }
- inline ExcScenario* _Next( void ) { return ( ExcScenario* ) List::Next(); }
- inline ExcScenario* _Last( void ) { return ( ExcScenario* ) List::Last(); }
- inline ExcScenario* _Prev( void ) { return ( ExcScenario* ) List::Prev(); }
-protected:
public:
- ExcScenarioList( void );
- virtual ~ExcScenarioList();
- inline void Append( ExcScenario* pNew );
+ ExcScenario( XclImpStream& rIn, const RootData& rRoot );
- inline void SetLast( const UINT16 nIndex4Last );
+ ~ExcScenario();
- inline const ExcScenario* First( void );
- inline const ExcScenario* Next( void );
+ void Apply( const XclImpRoot& rRoot, const BOOL bLast = FALSE );
- using List::Count;
+protected:
- void Apply( const XclImpRoot& rRoot );
+ String* pName;
+ String* pComment;
+ String* pUserName;
+ UINT8 nProtected;
+ const UINT16 nTab;
+ boost::ptr_vector<ExcScenarioCell> aEntries;
};
-
-
-
-inline const String& ExcScenarioCell::GetValue( void ) const
-{
- return aValue;
-}
-
-
-
-
-inline ExcScenarioList::ExcScenarioList( void )
-{
- nLastScenario = 0;
-}
-
-
-inline void ExcScenarioList::Append( ExcScenario* p )
+struct ExcScenarioList
{
- List::Insert( p, LIST_APPEND );
-}
+ ExcScenarioList () : nLastScenario(0) {}
+ void Apply( const XclImpRoot& rRoot );
-inline const ExcScenario* ExcScenarioList::First( void )
-{
- return ( const ExcScenario* ) List::First();
-}
-
-
-inline const ExcScenario* ExcScenarioList::Next( void )
-{
- return ( const ExcScenario* ) List::Next();
-}
-
-
-inline void ExcScenarioList::SetLast( const UINT16 n )
-{
- nLastScenario = n;
-}
-
+ sal_uInt16 nLastScenario;
+ boost::ptr_vector<ExcScenario> aEntries;
+};
#endif
commit 547de2df944be664cdcbbb6385b65726d407b638
Author: npcdoom <venccsralph at gmail.com>
Date: Mon Feb 21 10:58:43 2011 -0800
[PATCH 07/10] Removed deprecated container List.
diff --git a/sc/inc/dptabsrc.hxx b/sc/inc/dptabsrc.hxx
index 8124b29..ecd9a3d 100644
--- a/sc/inc/dptabsrc.hxx
+++ b/sc/inc/dptabsrc.hxx
@@ -34,6 +34,7 @@
#include <boost/unordered_set.hpp>
#include <list>
#include <memory>
+
#include <tools/string.hxx>
#include "global.hxx" // enum ScSubTotalFunc
#include <com/sun/star/sheet/XDimensionsSupplier.hpp>
@@ -132,15 +133,15 @@ private:
ScDPResultMember* pRowResRoot;
com::sun::star::uno::Sequence<com::sun::star::sheet::MemberResult>* pColResults;
com::sun::star::uno::Sequence<com::sun::star::sheet::MemberResult>* pRowResults;
- List aColLevelList;
- List aRowLevelList;
+ std::vector<ScDPLevel*> aColLevelList;
+ std::vector<ScDPLevel*> aRowLevelList;
BOOL bResultOverflow;
::std::auto_ptr<rtl::OUString> mpGrandTotalName;
void CreateRes_Impl();
void FillMemberResults();
- void FillLevelList( USHORT nOrientation, List& rList );
+ void FillLevelList( USHORT nOrientation, std::vector<ScDPLevel*> &rList );
void FillCalcInfo(bool bIsRow, ScDPTableData::CalcInfo& rInfo, bool &bHasAutoShow);
/**
diff --git a/sc/source/core/data/dptabsrc.cxx b/sc/source/core/data/dptabsrc.cxx
index ab82904..685ace4 100644
--- a/sc/source/core/data/dptabsrc.cxx
+++ b/sc/source/core/data/dptabsrc.cxx
@@ -561,8 +561,8 @@ void ScDPSource::disposeData()
delete[] pRowResults;
pColResults = NULL;
pRowResults = NULL;
- aColLevelList.Clear();
- aRowLevelList.Clear();
+ aColLevelList.clear();
+ aRowLevelList.clear();
}
if ( pDimensions )
@@ -998,9 +998,9 @@ void ScDPSource::CreateRes_Impl()
}
-void ScDPSource::FillLevelList( USHORT nOrientation, List& rList )
+void ScDPSource::FillLevelList( USHORT nOrientation, std::vector<ScDPLevel*> &rList )
{
- rList.Clear();
+ rList.clear();
long nDimCount = 0;
long* pDimIndex = NULL;
@@ -1048,7 +1048,7 @@ void ScDPSource::FillLevelList( USHORT nOrientation, List& rList )
for (long nLev=0; nLev<nLevCount; nLev++)
{
ScDPLevel* pLevel = pLevels->getByIndex(nLev);
- rList.Insert( pLevel, LIST_APPEND );
+ rList.push_back(pLevel);
}
}
}
@@ -1067,7 +1067,7 @@ void ScDPSource::FillMemberResults()
}
FillLevelList( sheet::DataPilotFieldOrientation_COLUMN, aColLevelList );
- long nColLevelCount = aColLevelList.Count();
+ long nColLevelCount = aColLevelList.size();
if (nColLevelCount)
{
long nColDimSize = pColResRoot->GetSize(pResData->GetColStartMeasure());
@@ -1081,7 +1081,7 @@ void ScDPSource::FillMemberResults()
}
FillLevelList( sheet::DataPilotFieldOrientation_ROW, aRowLevelList );
- long nRowLevelCount = aRowLevelList.Count();
+ long nRowLevelCount = aRowLevelList.size();
if (nRowLevelCount)
{
long nRowDimSize = pRowResRoot->GetSize(pResData->GetRowStartMeasure());
@@ -1100,18 +1100,18 @@ const uno::Sequence<sheet::MemberResult>* ScDPSource::GetMemberResults( ScDPLeve
{
FillMemberResults();
- long i;
- long nColCount = aColLevelList.Count();
+ long i = 0;
+ long nColCount = aColLevelList.size();
for (i=0; i<nColCount; i++)
{
- ScDPLevel* pColLevel = (ScDPLevel*)aColLevelList.GetObject(i);
+ ScDPLevel* pColLevel = aColLevelList[i];
if ( pColLevel == pLevel )
return pColResults+i;
}
- long nRowCount = aRowLevelList.Count();
+ long nRowCount = aRowLevelList.size();
for (i=0; i<nRowCount; i++)
{
- ScDPLevel* pRowLevel = (ScDPLevel*)aRowLevelList.GetObject(i);
+ ScDPLevel* pRowLevel = aRowLevelList[i];
if ( pRowLevel == pLevel )
return pRowResults+i;
}
commit 9d5729eaede971de5d96282781c0e505c4439899
Author: npcdoom <venccsralph at gmail.com>
Date: Mon Feb 21 10:58:05 2011 -0800
[PATCH 06/10] Remove deprecated List container.
diff --git a/sc/inc/fmtuno.hxx b/sc/inc/fmtuno.hxx
index eeb25b9..cf0c2da 100644
--- a/sc/inc/fmtuno.hxx
+++ b/sc/inc/fmtuno.hxx
@@ -29,8 +29,8 @@
#ifndef SC_FMTUNO_HXX
#define SC_FMTUNO_HXX
-#include "address.hxx"
-#include "conditio.hxx"
+#include <vector>
+
#include <formula/grammar.hxx>
#include <svl/itemprop.hxx>
#include <com/sun/star/sheet/XSheetConditionalEntries.hpp>
@@ -50,6 +50,9 @@
#include <cppuhelper/implbase5.hxx>
#include <com/sun/star/sheet/ConditionOperator2.hpp>
+#include "address.hxx"
+#include "conditio.hxx"
+
class ScDocument;
class ScTableConditionalEntry;
class ScConditionalFormat;
@@ -83,7 +86,7 @@ class ScTableConditionalFormat : public cppu::WeakImplHelper5<
com::sun::star::lang::XServiceInfo >
{
private:
- List aEntries;
+ std::vector<ScTableConditionalEntry*> aEntries;
ScTableConditionalEntry* GetObjectByIndex_Impl(USHORT nIndex) const;
void AddEntry_Impl(const ScCondFormatEntryItem& aEntry);
diff --git a/sc/source/ui/unoobj/fmtuno.cxx b/sc/source/ui/unoobj/fmtuno.cxx
index 47550d2..5f28dbd 100644
--- a/sc/source/ui/unoobj/fmtuno.cxx
+++ b/sc/source/ui/unoobj/fmtuno.cxx
@@ -29,7 +29,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sc.hxx"
-
+#include <boost/bind.hpp>
#include <tools/debug.hxx>
#include <rtl/uuid.h>
@@ -237,15 +237,12 @@ void ScTableConditionalFormat::FillFormat( ScConditionalFormat& rFormat,
// ScConditionalFormat = Core-Struktur, muss leer sein
DBG_ASSERT( rFormat.IsEmpty(), "FillFormat: Format nicht leer" );
- USHORT nCount = (USHORT)aEntries.Count();
- for (USHORT i=0; i<nCount; i++)
- {
- ScTableConditionalEntry* pEntry = (ScTableConditionalEntry*)aEntries.GetObject(i);
- if ( !pEntry )
- continue;
+ std::vector<ScTableConditionalEntry*>::const_iterator iter;
+ for (iter = aEntries.begin(); iter != aEntries.end(); ++iter)
+ {
ScCondFormatEntryItem aData;
- pEntry->GetData(aData);
+ (*iter)->GetData(aData);
FormulaGrammar::Grammar eGrammar1 = lclResolveGrammar( eGrammar, aData.meGrammar1 );
FormulaGrammar::Grammar eGrammar2 = lclResolveGrammar( eGrammar, aData.meGrammar2 );
@@ -275,17 +272,14 @@ void ScTableConditionalFormat::FillFormat( ScConditionalFormat& rFormat,
ScTableConditionalFormat::~ScTableConditionalFormat()
{
- ScTableConditionalEntry* pEntry;
- aEntries.First();
- while ( ( pEntry = (ScTableConditionalEntry*)aEntries.Remove() ) != NULL )
- pEntry->release();
+ std::for_each(aEntries.begin(),aEntries.end(),boost::bind(&ScTableConditionalEntry::release,_1));
}
void ScTableConditionalFormat::AddEntry_Impl(const ScCondFormatEntryItem& aEntry)
{
ScTableConditionalEntry* pNew = new ScTableConditionalEntry(this, aEntry);
pNew->acquire();
- aEntries.Insert( pNew, LIST_APPEND );
+ aEntries.push_back(pNew);
}
void ScTableConditionalFormat::DataChanged()
@@ -297,7 +291,7 @@ void ScTableConditionalFormat::DataChanged()
ScTableConditionalEntry* ScTableConditionalFormat::GetObjectByIndex_Impl(USHORT nIndex) const
{
- return (ScTableConditionalEntry*)aEntries.GetObject(nIndex);
+ return aEntries[nIndex];
}
void SAL_CALL ScTableConditionalFormat::addNew(
@@ -401,11 +395,13 @@ void SAL_CALL ScTableConditionalFormat::removeByIndex( sal_Int32 nIndex )
throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
- ScTableConditionalEntry* pEntry = (ScTableConditionalEntry*)aEntries.GetObject(nIndex);
- if (pEntry)
+
+ if (nIndex < static_cast<sal_Int32>(aEntries.size()))
{
- aEntries.Remove(pEntry);
- pEntry->release();
+ std::vector<ScTableConditionalEntry*>::iterator iter = aEntries.begin()+nIndex;
+
+ (*iter)->release();
+ aEntries.erase(iter);
DataChanged();
}
}
@@ -413,10 +409,10 @@ void SAL_CALL ScTableConditionalFormat::removeByIndex( sal_Int32 nIndex )
void SAL_CALL ScTableConditionalFormat::clear() throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
- ScTableConditionalEntry* pEntry;
- aEntries.First();
- while ( ( pEntry = (ScTableConditionalEntry*)aEntries.Remove() ) != NULL )
- pEntry->release();
+ std::for_each(aEntries.begin(),aEntries.end(),
+ boost::bind(&ScTableConditionalEntry::release,_1));
+
+ aEntries.clear();
DataChanged();
}
@@ -435,7 +431,7 @@ uno::Reference<container::XEnumeration> SAL_CALL ScTableConditionalFormat::creat
sal_Int32 SAL_CALL ScTableConditionalFormat::getCount() throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
- return aEntries.Count();
+ return aEntries.size();
}
uno::Any SAL_CALL ScTableConditionalFormat::getByIndex( sal_Int32 nIndex )
@@ -480,7 +476,7 @@ uno::Any SAL_CALL ScTableConditionalFormat::getByName( const rtl::OUString& aNam
SolarMutexGuard aGuard;
uno::Reference<sheet::XSheetConditionalEntry> xEntry;
- long nCount = aEntries.Count();
+ long nCount = aEntries.size();
for (long i=0; i<nCount; i++)
if ( aName == lcl_GetEntryNameFromIndex(i) )
{
@@ -500,7 +496,7 @@ uno::Sequence<rtl::OUString> SAL_CALL ScTableConditionalFormat::getElementNames(
{
SolarMutexGuard aGuard;
- long nCount = aEntries.Count();
+ long nCount = aEntries.size();
uno::Sequence<rtl::OUString> aNames(nCount);
rtl::OUString* pArray = aNames.getArray();
for (long i=0; i<nCount; i++)
@@ -514,7 +510,7 @@ sal_Bool SAL_CALL ScTableConditionalFormat::hasByName( const rtl::OUString& aNam
{
SolarMutexGuard aGuard;
- long nCount = aEntries.Count();
+ long nCount = aEntries.size();
for (long i=0; i<nCount; i++)
if ( aName == lcl_GetEntryNameFromIndex(i) )
return TRUE;
commit 9c7512f8002e669cbeb966465c660477f375f4e2
Author: npcdoom <venccsralph at gmail.com>
Date: Mon Feb 21 10:57:25 2011 -0800
[PATCH 05/10] Removed deprecated List container.
diff --git a/sc/source/filter/inc/lotattr.hxx b/sc/source/filter/inc/lotattr.hxx
index f1d4259..98b8ec9 100644
--- a/sc/source/filter/inc/lotattr.hxx
+++ b/sc/source/filter/inc/lotattr.hxx
@@ -29,49 +29,52 @@
#ifndef SC_LOTATTR_HXX
#define SC_LOTATTR_HXX
+#include <boost/ptr_container/ptr_vector.hpp>
+
#include <tools/solar.h>
-#include "patattr.hxx"
-#include "scitems.hxx"
+
#include "address.hxx"
+#include "scitems.hxx"
-// ----- forwards --------------------------------------------------------
class ScDocument;
class ScDocumentPool;
+class ScPatternAttr;
class SvxBorderLine;
class SvxColorItem;
class Color;
-
class LotAttrTable;
-
struct LotAttrWK3
{
- UINT8 nFont;
- UINT8 nLineStyle;
- UINT8 nFontCol;
- UINT8 nBack;
+ UINT8 nFont;
+ UINT8 nLineStyle;
+ UINT8 nFontCol;
+ UINT8 nBack;
- inline BOOL HasStyles( void );
- inline BOOL IsCentered( void );
-};
+ inline bool HasStyles () const
+ {
+ return ( nFont || nLineStyle || nFontCol || ( nBack & 0x7F ) );
+ // !! ohne Center-Bit!!
+ }
+ inline bool IsCentered () const
+ {
+ return ( nBack & 0x80 );
+ }
+};
-inline BOOL LotAttrWK3::HasStyles( void )
+class LotAttrCache
{
- return ( nFont || nLineStyle || nFontCol || ( nBack & 0x7F ) );
- // !! ohne Center-Bit!!
-}
+public:
+ LotAttrCache ();
-inline BOOL LotAttrWK3::IsCentered( void )
-{
- return ( nBack & 0x80 );
-}
+ ~LotAttrCache();
+ const ScPatternAttr& GetPattAttr( const LotAttrWK3& );
-class LotAttrCache : private List
-{
private:
+
friend class LotAttrTable;
struct ENTRY
@@ -79,75 +82,76 @@ private:
ScPatternAttr* pPattAttr;
UINT32 nHash0;
- inline ENTRY( const ScPatternAttr& r ) { pPattAttr = new ScPatternAttr( r ); }
+ ENTRY (const ScPatternAttr &r);
- inline ENTRY( ScPatternAttr* p ) { pPattAttr = p; }
+ ENTRY (ScPatternAttr* p);
- inline ~ENTRY() { delete pPattAttr; }
+ ~ENTRY ();
- inline BOOL operator ==( const ENTRY& r ) const { return nHash0 == r.nHash0; }
+ inline bool operator == (const ENTRY &r) const { return nHash0 == r.nHash0; }
- inline BOOL operator ==( const UINT32& r ) const { return nHash0 == r; }
+ inline bool operator == (const UINT32 &r) const { return nHash0 == r; }
};
+ inline static void MakeHash( const LotAttrWK3& rAttr, UINT32& rOut )
+ {
+ ( ( UINT8* ) &rOut )[ 0 ] = rAttr.nFont & 0x7F;
+ ( ( UINT8* ) &rOut )[ 1 ] = rAttr.nLineStyle;
+ ( ( UINT8* ) &rOut )[ 2 ] = rAttr.nFontCol;
+ ( ( UINT8* ) &rOut )[ 3 ] = rAttr.nBack;
+ }
+
+ static void LotusToScBorderLine( UINT8 nLine, SvxBorderLine& );
+
+ const SvxColorItem& GetColorItem( const UINT8 nLotIndex ) const;
+
+ const Color& GetColor( const UINT8 nLotIndex ) const;
+
ScDocumentPool* pDocPool;
- SvxColorItem* ppColorItems[ 6 ]; // 0 und 7 fehlen!
+ SvxColorItem* ppColorItems[6]; // 0 und 7 fehlen!
SvxColorItem* pBlack;
SvxColorItem* pWhite;
Color* pColTab;
+ boost::ptr_vector<ENTRY> aEntries;
+};
- inline static void MakeHash( const LotAttrWK3& rAttr, UINT32& rOut )
- {
- ( ( UINT8* ) &rOut )[ 0 ] = rAttr.nFont & 0x7F;
- ( ( UINT8* ) &rOut )[ 1 ] = rAttr.nLineStyle;
- ( ( UINT8* ) &rOut )[ 2 ] = rAttr.nFontCol;
- ( ( UINT8* ) &rOut )[ 3 ] = rAttr.nBack;
- }
- static void LotusToScBorderLine( UINT8 nLine, SvxBorderLine& );
- const SvxColorItem& GetColorItem( const UINT8 nLotIndex ) const;
- const Color& GetColor( const UINT8 nLotIndex ) const;
+
+class LotAttrCol
+{
public:
- LotAttrCache( void );
- ~LotAttrCache();
- const ScPatternAttr& GetPattAttr( const LotAttrWK3& );
-};
+ void SetAttr (const SCROW nRow, const ScPatternAttr&);
+ void Apply (const SCCOL nCol, const SCTAB nTab, const BOOL bClear = TRUE);
+
+ void Clear ();
-class LotAttrCol : private List
-{
private:
+
struct ENTRY
{
- const ScPatternAttr* pPattAttr;
- SCROW nFirstRow;
- SCROW nLastRow;
+ const ScPatternAttr* pPattAttr;
+ SCROW nFirstRow;
+ SCROW nLastRow;
};
-public:
- ~LotAttrCol( void );
- void SetAttr( const SCROW nRow, const ScPatternAttr& );
- void Apply( const SCCOL nCol, const SCTAB nTab, const BOOL bClear = TRUE );
- void Clear( void );
+ boost::ptr_vector<ENTRY> aEntries;
};
class LotAttrTable
{
-private:
- LotAttrCol pCols[ MAXCOLCOUNT ];
- LotAttrCache aAttrCache;
public:
- LotAttrTable( void );
- ~LotAttrTable();
-
- void SetAttr( const SCCOL nColFirst, const SCCOL nColLast, const SCROW nRow, const LotAttrWK3& );
- void Apply( const SCTAB nTabNum );
-};
+ void SetAttr( const SCCOL nColFirst, const SCCOL nColLast, const SCROW nRow, const LotAttrWK3& );
+ void Apply( const SCTAB nTabNum );
+private:
+ LotAttrCol pCols[ MAXCOLCOUNT ];
+ LotAttrCache aAttrCache;
+};
#endif
diff --git a/sc/source/filter/lotus/lotattr.cxx b/sc/source/filter/lotus/lotattr.cxx
index 1f290c5..42994a0 100644
--- a/sc/source/filter/lotus/lotattr.cxx
+++ b/sc/source/filter/lotus/lotattr.cxx
@@ -29,66 +29,39 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sc.hxx"
+#include "lotattr.hxx"
+#include <boost/bind.hpp>
-//------------------------------------------------------------------------
-
-#include "scitems.hxx"
-#include <svx/algitem.hxx>
#include <editeng/boxitem.hxx>
#include <editeng/brshitem.hxx>
#include <editeng/justifyitem.hxx>
+#include <svx/algitem.hxx>
-#include "document.hxx"
-#include "patattr.hxx"
-#include "docpool.hxx"
#include "attrib.hxx"
-
-#include "lotattr.hxx"
+#include "docpool.hxx"
+#include "document.hxx"
#include "lotfntbf.hxx"
+#include "patattr.hxx"
#include "root.hxx"
+#include "scitems.hxx"
-
-
-void LotAttrCache::LotusToScBorderLine( UINT8 nLine, SvxBorderLine& aBL )
+LotAttrCache::ENTRY::ENTRY (const ScPatternAttr &r)
+ : pPattAttr(new ScPatternAttr(r))
{
- static const UINT16 pPara[ 4 ][ 3 ] =
- {
- { 0,0,0 },
- { DEF_LINE_WIDTH_1, 0, 0 },
- { DEF_LINE_WIDTH_2, 0, 0 },
- { DEF_LINE_WIDTH_1, DEF_LINE_WIDTH_1, DEF_LINE_WIDTH_1 }
- };
-
- nLine &= 0x03;
-
- if( nLine )
- {
- aBL.SetOutWidth( pPara[ nLine ][ 0 ] );
- aBL.SetInWidth( pPara[ nLine ][ 1 ] );
- aBL.SetDistance( pPara[ nLine ][ 2 ] );
- }
}
-
-const SvxColorItem& LotAttrCache::GetColorItem( const UINT8 nLotIndex ) const
+LotAttrCache::ENTRY::ENTRY (ScPatternAttr* p)
+ : pPattAttr(p)
{
- DBG_ASSERT( nLotIndex > 0 && nLotIndex < 7,
- "-LotAttrCache::GetColorItem(): so nicht!" );
-
- return *ppColorItems[ nLotIndex - 1 ];
}
-
-const Color& LotAttrCache::GetColor( const UINT8 nLotIndex ) const
+LotAttrCache::ENTRY::~ENTRY ()
{
- // Farbe <-> Index passt fuer Background, nicht aber fuer Fonts (0 <-> 7)!
- DBG_ASSERT( nLotIndex < 8, "*LotAttrCache::GetColor(): Index > 7!" );
- return pColTab[ nLotIndex ];
+ delete pPattAttr;
}
-
-LotAttrCache::LotAttrCache( void )
+LotAttrCache::LotAttrCache ()
{
pDocPool = pLotusRoot->pDoc->GetPool();
@@ -116,14 +89,6 @@ LotAttrCache::LotAttrCache( void )
LotAttrCache::~LotAttrCache()
{
- ENTRY* pAkt = ( ENTRY* ) List::First();
-
- while( pAkt )
- {
- delete pAkt;
- pAkt = ( ENTRY* ) List::Next();
- }
-
for( UINT16 nCnt = 0 ; nCnt < 6 ; nCnt++ )
delete ppColorItems[ nCnt ];
@@ -137,22 +102,19 @@ LotAttrCache::~LotAttrCache()
const ScPatternAttr& LotAttrCache::GetPattAttr( const LotAttrWK3& rAttr )
{
UINT32 nRefHash;
- ENTRY* pAkt = ( ENTRY* ) List::First();
-
MakeHash( rAttr, nRefHash );
- while( pAkt )
- {
- if( *pAkt == nRefHash )
- return *pAkt->pPattAttr;
+ boost::ptr_vector<ENTRY>::const_iterator iter = std::find_if(aEntries.begin(),aEntries.end(),
+ boost::bind(&ENTRY::nHash0,_1) == nRefHash);
- pAkt = ( ENTRY* ) List::Next();
- }
+ if (iter != aEntries.end())
+ return *(iter->pPattAttr);
// neues PatternAttribute erzeugen
- ScPatternAttr* pNewPatt = new ScPatternAttr( pDocPool );
+ ScPatternAttr* pNewPatt = new ScPatternAttr(pDocPool);
+
SfxItemSet& rItemSet = pNewPatt->GetItemSet();
- pAkt = new ENTRY( pNewPatt );
+ ENTRY *pAkt = new ENTRY( pNewPatt );
pAkt->nHash0 = nRefHash;
@@ -200,43 +162,75 @@ const ScPatternAttr& LotAttrCache::GetPattAttr( const LotAttrWK3& rAttr )
rItemSet.Put( aHorJustify );
}
- List::Insert( pAkt, LIST_APPEND );
+ aEntries.push_back(pAkt);
return *pNewPatt;
- }
+}
+
+
+void LotAttrCache::LotusToScBorderLine( UINT8 nLine, SvxBorderLine& aBL )
+{
+ static const UINT16 pPara[ 4 ][ 3 ] =
+ {
+ { 0,0,0 },
+ { DEF_LINE_WIDTH_1, 0, 0 },
+ { DEF_LINE_WIDTH_2, 0, 0 },
+ { DEF_LINE_WIDTH_1, DEF_LINE_WIDTH_1, DEF_LINE_WIDTH_1 }
+ };
+ nLine &= 0x03;
-LotAttrCol::~LotAttrCol()
+ if( nLine )
+ {
+ aBL.SetOutWidth( pPara[ nLine ][ 0 ] );
+ aBL.SetInWidth( pPara[ nLine ][ 1 ] );
+ aBL.SetDistance( pPara[ nLine ][ 2 ] );
+ }
+}
+
+const SvxColorItem& LotAttrCache::GetColorItem( const UINT8 nLotIndex ) const
{
- Clear();
+ DBG_ASSERT( nLotIndex > 0 && nLotIndex < 7,
+ "-LotAttrCache::GetColorItem(): so nicht!" );
+
+ return *ppColorItems[ nLotIndex - 1 ];
}
+const Color& LotAttrCache::GetColor( const UINT8 nLotIndex ) const
+{
+ // Farbe <-> Index passt fuer Background, nicht aber fuer Fonts (0 <-> 7)!
+ DBG_ASSERT( nLotIndex < 8, "*LotAttrCache::GetColor(): Index > 7!" );
+
+ return pColTab[ nLotIndex ];
+}
void LotAttrCol::SetAttr( const SCROW nRow, const ScPatternAttr& rAttr )
{
DBG_ASSERT( ValidRow(nRow), "*LotAttrCol::SetAttr(): ... und rums?!" );
- ENTRY* pAkt = ( ENTRY* ) List::Last();
+ boost::ptr_vector<ENTRY>::reverse_iterator iterLast = aEntries.rbegin();
- if( pAkt )
+ if(iterLast != aEntries.rend())
{
- if( ( pAkt->nLastRow == nRow - 1 ) && ( &rAttr == pAkt->pPattAttr ) )
- pAkt->nLastRow = nRow;
+ if( ( iterLast->nLastRow == nRow - 1 ) && ( &rAttr == iterLast->pPattAttr ) )
+ iterLast->nLastRow = nRow;
else
{
- pAkt = new ENTRY;
+ ENTRY *pAkt = new ENTRY;
pAkt->pPattAttr = &rAttr;
pAkt->nFirstRow = pAkt->nLastRow = nRow;
- List::Insert( pAkt, LIST_APPEND );
+
+ aEntries.push_back(pAkt);
}
}
else
{ // erster Eintrag
- pAkt = new ENTRY;
+ ENTRY *pAkt = new ENTRY;
pAkt->pPattAttr = &rAttr;
pAkt->nFirstRow = pAkt->nLastRow = nRow;
- List::Insert( pAkt, LIST_APPEND );
+
+ aEntries.push_back(pAkt);
}
}
@@ -244,45 +238,26 @@ void LotAttrCol::SetAttr( const SCROW nRow, const ScPatternAttr& rAttr )
void LotAttrCol::Apply( const SCCOL nColNum, const SCTAB nTabNum, const BOOL /*bClear*/ )
{
ScDocument* pDoc = pLotusRoot->pDoc;
- ENTRY* pAkt = ( ENTRY* ) List::First();
-
- while( pAkt )
- {
- pDoc->ApplyPatternAreaTab( nColNum, pAkt->nFirstRow, nColNum, pAkt->nLastRow,
- nTabNum, *pAkt->pPattAttr );
-
- pAkt = ( ENTRY* ) List::Next();
- }
-}
-
-void LotAttrCol::Clear( void )
-{
- ENTRY* pAkt = ( ENTRY* ) List::First();
-
- while( pAkt )
+ boost::ptr_vector<ENTRY>::iterator iter;
+ for (iter = aEntries.begin(); iter != aEntries.end(); ++iter)
{
- delete pAkt;
- pAkt = ( ENTRY* ) List::Next();
+ pDoc->ApplyPatternAreaTab(nColNum,iter->nFirstRow,nColNum,iter->nLastRow,
+ nTabNum, *(iter->pPattAttr));
}
}
-LotAttrTable::LotAttrTable( void )
+void LotAttrCol::Clear ()
{
+ aEntries.clear();
}
-
-LotAttrTable::~LotAttrTable()
-{
-}
-
-
void LotAttrTable::SetAttr( const SCCOL nColFirst, const SCCOL nColLast, const SCROW nRow,
const LotAttrWK3& rAttr )
{
- const ScPatternAttr& rPattAttr = aAttrCache.GetPattAttr( rAttr );
- SCCOL nColCnt;
+ const ScPatternAttr &rPattAttr = aAttrCache.GetPattAttr( rAttr );
+ SCCOL nColCnt;
for( nColCnt = nColFirst ; nColCnt <= nColLast ; nColCnt++ )
pCols[ nColCnt ].SetAttr( nRow, rPattAttr );
@@ -291,12 +266,9 @@ void LotAttrTable::SetAttr( const SCCOL nColFirst, const SCCOL nColLast, const S
void LotAttrTable::Apply( const SCTAB nTabNum )
{
- SCCOL nColCnt;
+ SCCOL nColCnt;
for( nColCnt = 0 ; nColCnt <= MAXCOL ; nColCnt++ )
pCols[ nColCnt ].Apply( nColCnt, nTabNum ); // macht auch gleich ein Clear() am Ende
}
-
-
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 1bfb5a78e66ba1120ebf026f23e109842b7c303e
Author: npcdoom <venccsralph at gmail.com>
Date: Mon Feb 21 10:56:28 2011 -0800
[PATCH 04/10] Removed deprecated List container.
diff --git a/sc/source/ui/inc/prevloc.hxx b/sc/source/ui/inc/prevloc.hxx
index 9dc2782..b621434 100644
--- a/sc/source/ui/inc/prevloc.hxx
+++ b/sc/source/ui/inc/prevloc.hxx
@@ -29,11 +29,12 @@
#ifndef SC_PREVLOC_HXX
#define SC_PREVLOC_HXX
-#include "address.hxx"
-#include <tools/list.hxx>
-#include <vcl/mapmod.hxx>
+#include <boost/ptr_container/ptr_list.hpp>
+
#include <sal/types.h>
+#include <vcl/mapmod.hxx>
+#include "address.hxx"
#define SC_PREVIEW_MAXRANGES 4
#define SC_PREVIEW_RANGE_EDGE 0
@@ -48,6 +49,7 @@ class Rectangle;
class ScAddress;
class ScRange;
class ScDocument;
+class ScPreviewLocationEntry;
struct ScPreviewColRowInfo
{
@@ -100,7 +102,7 @@ class ScPreviewLocationData
sal_uInt8 aDrawRangeId[SC_PREVIEW_MAXRANGES];
USHORT nDrawRanges;
SCTAB nPrintTab;
- List aEntries;
+ boost::ptr_list<ScPreviewLocationEntry> aEntries;
Rectangle GetOffsetPixel( const ScAddress& rCellPos, const ScRange& rRange ) const;
diff --git a/sc/source/ui/view/prevloc.cxx b/sc/source/ui/view/prevloc.cxx
index 94580c0..43701da 100644
--- a/sc/source/ui/view/prevloc.cxx
+++ b/sc/source/ui/view/prevloc.cxx
@@ -29,18 +29,12 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sc.hxx"
-
-
-// INCLUDE ---------------------------------------------------------------
-
-#include <vcl/outdev.hxx>
#include <tools/debug.hxx>
+#include <vcl/outdev.hxx>
#include "prevloc.hxx"
#include "document.hxx"
-//==================================================================
-
enum ScPreviewLocationType
{
SC_PLOC_CELLRANGE,
@@ -73,8 +67,6 @@ struct ScPreviewLocationEntry
}
};
-//==================================================================
-
ScPreviewTableInfo::ScPreviewTableInfo() :
nTab(0),
nCols(0),
@@ -166,8 +158,6 @@ void ScPreviewTableInfo::LimitToArea( const Rectangle& rPixelArea )
}
}
-//------------------------------------------------------------------
-
ScPreviewLocationData::ScPreviewLocationData( ScDocument* pDocument, OutputDevice* pWin ) :
pWindow( pWin ),
pDoc( pDocument ),
@@ -193,13 +183,7 @@ void ScPreviewLocationData::SetPrintTab( SCTAB nNew )
void ScPreviewLocationData::Clear()
{
- void* pEntry = aEntries.First();
- while ( pEntry )
- {
- delete (ScPreviewLocationEntry*) pEntry;
- pEntry = aEntries.Next();
- }
- aEntries.Clear();
+ aEntries.clear();
nDrawRanges = 0;
}
@@ -208,23 +192,30 @@ void ScPreviewLocationData::AddCellRange( const Rectangle& rRect, const ScRange&
const MapMode& rDrawMap )
{
Rectangle aPixelRect( pWindow->LogicToPixel( rRect ) );
- aEntries.Insert( new ScPreviewLocationEntry( SC_PLOC_CELLRANGE, aPixelRect, rRange, bRepCol, bRepRow ) );
+ aEntries.push_front( new ScPreviewLocationEntry( SC_PLOC_CELLRANGE, aPixelRect, rRange, bRepCol, bRepRow ) );
DBG_ASSERT( nDrawRanges < SC_PREVIEW_MAXRANGES, "too many ranges" );
+
if ( nDrawRanges < SC_PREVIEW_MAXRANGES )
{
aDrawRectangle[nDrawRanges] = aPixelRect;
aDrawMapMode[nDrawRanges] = rDrawMap;
- if (bRepCol)
- if (bRepRow)
- aDrawRangeId[nDrawRanges] = SC_PREVIEW_RANGE_EDGE;
- else
- aDrawRangeId[nDrawRanges] = SC_PREVIEW_RANGE_REPCOL;
+
+ if (bRepCol)
+ {
+ if (bRepRow)
+ aDrawRangeId[nDrawRanges] = SC_PREVIEW_RANGE_EDGE;
else
- if (bRepRow)
- aDrawRangeId[nDrawRanges] = SC_PREVIEW_RANGE_REPROW;
- else
- aDrawRangeId[nDrawRanges] = SC_PREVIEW_RANGE_TAB;
+ aDrawRangeId[nDrawRanges] = SC_PREVIEW_RANGE_REPCOL;
+ }
+ else
+ {
+ if (bRepRow)
+ aDrawRangeId[nDrawRanges] = SC_PREVIEW_RANGE_REPROW;
+ else
+ aDrawRangeId[nDrawRanges] = SC_PREVIEW_RANGE_TAB;
+ }
+
++nDrawRanges;
}
}
@@ -234,7 +225,8 @@ void ScPreviewLocationData::AddColHeaders( const Rectangle& rRect, SCCOL nStartC
SCTAB nTab = 0; //! ?
ScRange aRange( nStartCol, 0, nTab, nEndCol, 0, nTab );
Rectangle aPixelRect( pWindow->LogicToPixel( rRect ) );
- aEntries.Insert( new ScPreviewLocationEntry( SC_PLOC_COLHEADER, aPixelRect, aRange, bRepCol, FALSE ) );
+
+ aEntries.push_front( new ScPreviewLocationEntry( SC_PLOC_COLHEADER, aPixelRect, aRange, bRepCol, FALSE ) );
}
void ScPreviewLocationData::AddRowHeaders( const Rectangle& rRect, SCROW nStartRow, SCROW nEndRow, BOOL bRepRow )
@@ -242,7 +234,8 @@ void ScPreviewLocationData::AddRowHeaders( const Rectangle& rRect, SCROW nStartR
SCTAB nTab = 0; //! ?
ScRange aRange( 0, nStartRow, nTab, 0, nEndRow, nTab );
Rectangle aPixelRect( pWindow->LogicToPixel( rRect ) );
- aEntries.Insert( new ScPreviewLocationEntry( SC_PLOC_ROWHEADER, aPixelRect, aRange, FALSE, bRepRow ) );
+
+ aEntries.push_front( new ScPreviewLocationEntry( SC_PLOC_ROWHEADER, aPixelRect, aRange, FALSE, bRepRow ) );
}
void ScPreviewLocationData::AddHeaderFooter( const Rectangle& rRect, BOOL bHeader, BOOL bLeft )
@@ -253,24 +246,25 @@ void ScPreviewLocationData::AddHeaderFooter( const Rectangle& rRect, BOOL bHeade
ScPreviewLocationType eType = bHeader ?
( bLeft ? SC_PLOC_LEFTHEADER : SC_PLOC_RIGHTHEADER ) :
( bLeft ? SC_PLOC_LEFTFOOTER : SC_PLOC_RIGHTFOOTER );
- aEntries.Insert( new ScPreviewLocationEntry( eType, aPixelRect, aRange, FALSE, FALSE ) );
+
+ aEntries.push_front( new ScPreviewLocationEntry( eType, aPixelRect, aRange, FALSE, FALSE ) );
}
void ScPreviewLocationData::AddNoteMark( const Rectangle& rRect, const ScAddress& rPos )
{
ScRange aRange( rPos );
Rectangle aPixelRect( pWindow->LogicToPixel( rRect ) );
- aEntries.Insert( new ScPreviewLocationEntry( SC_PLOC_NOTEMARK, aPixelRect, aRange, FALSE, FALSE ) );
+
+ aEntries.push_front( new ScPreviewLocationEntry( SC_PLOC_NOTEMARK, aPixelRect, aRange, FALSE, FALSE ) );
}
void ScPreviewLocationData::AddNoteText( const Rectangle& rRect, const ScAddress& rPos )
{
ScRange aRange( rPos );
Rectangle aPixelRect( pWindow->LogicToPixel( rRect ) );
- aEntries.Insert( new ScPreviewLocationEntry( SC_PLOC_NOTETEXT, aPixelRect, aRange, FALSE, FALSE ) );
-}
-//------------------------------------------------------------------
+ aEntries.push_front( new ScPreviewLocationEntry( SC_PLOC_NOTETEXT, aPixelRect, aRange, FALSE, FALSE ) );
+}
void ScPreviewLocationData::GetDrawRange( USHORT nPos, Rectangle& rPixelRect, MapMode& rMapMode, sal_uInt8& rRangeId ) const
{
@@ -283,15 +277,16 @@ void ScPreviewLocationData::GetDrawRange( USHORT nPos, Rectangle& rPixelRect, Ma
}
}
-ScPreviewLocationEntry* lcl_GetEntryByAddress( const List& rEntries, const ScAddress& rPos, ScPreviewLocationType eType )
+ScPreviewLocationEntry* lcl_GetEntryByAddress( const boost::ptr_list<ScPreviewLocationEntry> &rEntries,
+ const ScAddress& rPos, ScPreviewLocationType eType )
{
- ULONG nCount = rEntries.Count();
- for (ULONG nListPos=0; nListPos<nCount; nListPos++)
+ boost::ptr_list<ScPreviewLocationEntry>::const_iterator it;
+ for (it = rEntries.begin(); it != rEntries.end(); ++it)
{
- ScPreviewLocationEntry* pEntry = (ScPreviewLocationEntry*)rEntries.GetObject(nListPos);
- if ( pEntry->eType == eType && pEntry->aCellRange.In( rPos ) )
- return pEntry;
+ if ( it->eType == eType && it->aCellRange.In( rPos ) )
+ return const_cast<ScPreviewLocationEntry*>(&(*it));
}
+
return NULL;
}
@@ -342,73 +337,74 @@ BOOL ScPreviewLocationData::GetCellPosition( const ScAddress& rCellPos, Rectangl
BOOL ScPreviewLocationData::HasCellsInRange( const Rectangle& rVisiblePixel ) const
{
- ULONG nCount = aEntries.Count();
- for (ULONG nListPos=0; nListPos<nCount; nListPos++)
+ boost::ptr_list<ScPreviewLocationEntry>::const_iterator it;
+ for (it = aEntries.begin(); it != aEntries.end(); ++it)
{
- ScPreviewLocationEntry* pEntry = (ScPreviewLocationEntry*)aEntries.GetObject(nListPos);
- ScPreviewLocationType eType = pEntry->eType;
- if ( eType == SC_PLOC_CELLRANGE || eType == SC_PLOC_COLHEADER || eType == SC_PLOC_ROWHEADER )
- if ( pEntry->aPixelRect.IsOver( rVisiblePixel ) )
+ if ( it->eType == SC_PLOC_CELLRANGE || it->eType == SC_PLOC_COLHEADER || it->eType == SC_PLOC_ROWHEADER )
+ if ( it->aPixelRect.IsOver( rVisiblePixel ) )
return TRUE;
}
+
return FALSE;
}
BOOL ScPreviewLocationData::GetHeaderPosition( Rectangle& rRect ) const
{
- ULONG nCount = aEntries.Count();
- for (ULONG nListPos=0; nListPos<nCount; nListPos++)
+ boost::ptr_list<ScPreviewLocationEntry>::const_iterator it;
+ for (it = aEntries.begin(); it != aEntries.end(); ++it)
{
- ScPreviewLocationEntry* pEntry = (ScPreviewLocationEntry*)aEntries.GetObject(nListPos);
- if ( pEntry->eType == SC_PLOC_LEFTHEADER || pEntry->eType == SC_PLOC_RIGHTHEADER )
+ if ( it->eType == SC_PLOC_LEFTHEADER || it->eType == SC_PLOC_RIGHTHEADER )
{
- rRect = pEntry->aPixelRect;
+ rRect = it->aPixelRect;
return TRUE;
}
}
+
return FALSE;
}
BOOL ScPreviewLocationData::GetFooterPosition( Rectangle& rRect ) const
{
- ULONG nCount = aEntries.Count();
- for (ULONG nListPos=0; nListPos<nCount; nListPos++)
+ boost::ptr_list<ScPreviewLocationEntry>::const_iterator it;
+ for (it = aEntries.begin(); it != aEntries.end(); ++it)
{
- ScPreviewLocationEntry* pEntry = (ScPreviewLocationEntry*)aEntries.GetObject(nListPos);
- if ( pEntry->eType == SC_PLOC_LEFTFOOTER || pEntry->eType == SC_PLOC_RIGHTFOOTER )
+ if ( it->eType == SC_PLOC_LEFTFOOTER || it->eType == SC_PLOC_RIGHTFOOTER )
{
- rRect = pEntry->aPixelRect;
+ rRect = it->aPixelRect;
return TRUE;
}
}
+
return FALSE;
}
BOOL ScPreviewLocationData::IsHeaderLeft() const
{
- ULONG nCount = aEntries.Count();
- for (ULONG nListPos=0; nListPos<nCount; nListPos++)
+ boost::ptr_list<ScPreviewLocationEntry>::const_iterator it;
+ for (it = aEntries.begin(); it != aEntries.end(); ++it)
{
- ScPreviewLocationEntry* pEntry = (ScPreviewLocationEntry*)aEntries.GetObject(nListPos);
- if ( pEntry->eType == SC_PLOC_LEFTHEADER )
+ if ( it->eType == SC_PLOC_LEFTHEADER )
return TRUE;
- if ( pEntry->eType == SC_PLOC_RIGHTHEADER )
+
+ if ( it->eType == SC_PLOC_RIGHTHEADER )
return FALSE;
}
+
return FALSE;
}
BOOL ScPreviewLocationData::IsFooterLeft() const
{
- ULONG nCount = aEntries.Count();
- for (ULONG nListPos=0; nListPos<nCount; nListPos++)
+ boost::ptr_list<ScPreviewLocationEntry>::const_iterator it;
+ for (it = aEntries.begin(); it != aEntries.end(); ++it)
{
- ScPreviewLocationEntry* pEntry = (ScPreviewLocationEntry*)aEntries.GetObject(nListPos);
- if ( pEntry->eType == SC_PLOC_LEFTFOOTER )
+ if ( it->eType == SC_PLOC_LEFTFOOTER )
return TRUE;
- if ( pEntry->eType == SC_PLOC_RIGHTFOOTER )
+
+ if ( it->eType == SC_PLOC_RIGHTFOOTER )
return FALSE;
}
+
return FALSE;
}
@@ -417,13 +413,13 @@ long ScPreviewLocationData::GetNoteCountInRange( const Rectangle& rVisiblePixel,
ScPreviewLocationType eType = bNoteMarks ? SC_PLOC_NOTEMARK : SC_PLOC_NOTETEXT;
ULONG nRet = 0;
- ULONG nCount = aEntries.Count();
- for (ULONG nListPos=0; nListPos<nCount; nListPos++)
+ boost::ptr_list<ScPreviewLocationEntry>::const_iterator it;
+ for (it = aEntries.begin(); it != aEntries.end(); ++it)
{
- ScPreviewLocationEntry* pEntry = (ScPreviewLocationEntry*)aEntries.GetObject(nListPos);
- if ( pEntry->eType == eType && pEntry->aPixelRect.IsOver( rVisiblePixel ) )
+ if ( it->eType == eType && it->aPixelRect.IsOver( rVisiblePixel ) )
++nRet;
}
+
return nRet;
}
@@ -433,21 +429,21 @@ BOOL ScPreviewLocationData::GetNoteInRange( const Rectangle& rVisiblePixel, long
ScPreviewLocationType eType = bNoteMarks ? SC_PLOC_NOTEMARK : SC_PLOC_NOTETEXT;
ULONG nPos = 0;
- ULONG nCount = aEntries.Count();
- for (ULONG nListPos=0; nListPos<nCount; nListPos++)
+ boost::ptr_list<ScPreviewLocationEntry>::const_iterator it;
+ for (it = aEntries.begin(); it != aEntries.end(); ++it)
{
- ScPreviewLocationEntry* pEntry = (ScPreviewLocationEntry*)aEntries.GetObject(nListPos);
- if ( pEntry->eType == eType && pEntry->aPixelRect.IsOver( rVisiblePixel ) )
+ if ( it->eType == eType && it->aPixelRect.IsOver( rVisiblePixel ) )
{
if ( nPos == sal::static_int_cast<ULONG>(nIndex) )
{
- rCellPos = pEntry->aCellRange.aStart;
- rNoteRect = pEntry->aPixelRect;
+ rCellPos = it->aCellRange.aStart;
+ rNoteRect = it->aPixelRect;
return TRUE;
}
++nPos;
}
}
+
return FALSE;
}
@@ -456,17 +452,17 @@ Rectangle ScPreviewLocationData::GetNoteInRangeOutputRect(const Rectangle& rVisi
ScPreviewLocationType eType = bNoteMarks ? SC_PLOC_NOTEMARK : SC_PLOC_NOTETEXT;
ULONG nPos = 0;
- ULONG nCount = aEntries.Count();
- for (ULONG nListPos=0; nListPos<nCount; nListPos++)
+ boost::ptr_list<ScPreviewLocationEntry>::const_iterator it;
+ for (it = aEntries.begin(); it != aEntries.end(); ++it)
{
- ScPreviewLocationEntry* pEntry = (ScPreviewLocationEntry*)aEntries.GetObject(nListPos);
- if ( pEntry->eType == eType && pEntry->aPixelRect.IsOver( rVisiblePixel ) )
+ if ( it->eType == eType && it->aPixelRect.IsOver( rVisiblePixel ) )
{
- if ( aCellPos == pEntry->aCellRange.aStart )
- return pEntry->aPixelRect;
+ if ( aCellPos == it->aCellRange.aStart )
+ return it->aPixelRect;
++nPos;
}
}
+
return Rectangle();
}
@@ -496,59 +492,58 @@ void ScPreviewLocationData::GetTableInfo( const Rectangle& rVisiblePixel, ScPrev
Rectangle aHeaderRect, aRepeatRect, aMainRect;
SCTAB nTab = 0;
- ULONG nCount = aEntries.Count();
- for (ULONG nListPos=0; nListPos<nCount; nListPos++)
+ boost::ptr_list<ScPreviewLocationEntry>::const_iterator it;
+ for (it = aEntries.begin(); it != aEntries.end(); ++it)
{
- ScPreviewLocationEntry* pEntry = (ScPreviewLocationEntry*)aEntries.GetObject(nListPos);
- if ( pEntry->eType == SC_PLOC_CELLRANGE )
+ if ( it->eType == SC_PLOC_CELLRANGE )
{
- if ( pEntry->bRepeatCol )
+ if ( it->bRepeatCol )
{
bHasRepCols = TRUE;
- nRepeatColStart = pEntry->aCellRange.aStart.Col();
- nRepeatColEnd = pEntry->aCellRange.aEnd.Col();
- aRepeatRect.Left() = pEntry->aPixelRect.Left();
- aRepeatRect.Right() = pEntry->aPixelRect.Right();
+ nRepeatColStart = it->aCellRange.aStart.Col();
+ nRepeatColEnd = it->aCellRange.aEnd.Col();
+ aRepeatRect.Left() = it->aPixelRect.Left();
+ aRepeatRect.Right() = it->aPixelRect.Right();
}
else
{
bHasMainCols = TRUE;
- nMainColStart = pEntry->aCellRange.aStart.Col();
- nMainColEnd = pEntry->aCellRange.aEnd.Col();
- aMainRect.Left() = pEntry->aPixelRect.Left();
- aMainRect.Right() = pEntry->aPixelRect.Right();
+ nMainColStart = it->aCellRange.aStart.Col();
+ nMainColEnd = it->aCellRange.aEnd.Col();
+ aMainRect.Left() = it->aPixelRect.Left();
+ aMainRect.Right() = it->aPixelRect.Right();
}
- if ( pEntry->bRepeatRow )
+ if ( it->bRepeatRow )
{
bHasRepRows = TRUE;
- nRepeatRowStart = pEntry->aCellRange.aStart.Row();
- nRepeatRowEnd = pEntry->aCellRange.aEnd.Row();
- aRepeatRect.Top() = pEntry->aPixelRect.Top();
- aRepeatRect.Bottom() = pEntry->aPixelRect.Bottom();
+ nRepeatRowStart = it->aCellRange.aStart.Row();
+ nRepeatRowEnd = it->aCellRange.aEnd.Row();
+ aRepeatRect.Top() = it->aPixelRect.Top();
+ aRepeatRect.Bottom() = it->aPixelRect.Bottom();
}
else
{
bHasMainRows = TRUE;
- nMainRowStart = pEntry->aCellRange.aStart.Row();
- nMainRowEnd = pEntry->aCellRange.aEnd.Row();
- aMainRect.Top() = pEntry->aPixelRect.Top();
- aMainRect.Bottom() = pEntry->aPixelRect.Bottom();
+ nMainRowStart = it->aCellRange.aStart.Row();
+ nMainRowEnd = it->aCellRange.aEnd.Row();
+ aMainRect.Top() = it->aPixelRect.Top();
+ aMainRect.Bottom() = it->aPixelRect.Bottom();
}
- nTab = pEntry->aCellRange.aStart.Tab(); //! store separately?
+ nTab = it->aCellRange.aStart.Tab(); //! store separately?
}
- else if ( pEntry->eType == SC_PLOC_ROWHEADER )
+ else if ( it->eType == SC_PLOC_ROWHEADER )
{
// row headers result in an additional column
bHasHeaderCol = TRUE;
- aHeaderRect.Left() = pEntry->aPixelRect.Left();
- aHeaderRect.Right() = pEntry->aPixelRect.Right();
+ aHeaderRect.Left() = it->aPixelRect.Left();
+ aHeaderRect.Right() = it->aPixelRect.Right();
}
- else if ( pEntry->eType == SC_PLOC_COLHEADER )
+ else if ( it->eType == SC_PLOC_COLHEADER )
{
// column headers result in an additional row
bHasHeaderRow = TRUE;
- aHeaderRect.Top() = pEntry->aPixelRect.Top();
- aHeaderRect.Bottom() = pEntry->aPixelRect.Bottom();
+ aHeaderRect.Top() = it->aPixelRect.Top();
+ aHeaderRect.Bottom() = it->aPixelRect.Bottom();
}
}
@@ -739,18 +734,18 @@ Rectangle ScPreviewLocationData::GetCellOutputRect(const ScAddress& rCellPos) co
BOOL ScPreviewLocationData::GetMainCellRange( ScRange& rRange, Rectangle& rPixRect ) const
{
- ULONG nCount = aEntries.Count();
- for (ULONG nListPos=0; nListPos<nCount; nListPos++)
+ boost::ptr_list<ScPreviewLocationEntry>::const_iterator it;
+ for (it = aEntries.begin(); it != aEntries.end(); ++it)
{
- ScPreviewLocationEntry* pEntry = (ScPreviewLocationEntry*)aEntries.GetObject(nListPos);
- if ( pEntry->eType == SC_PLOC_CELLRANGE && !pEntry->bRepeatCol && !pEntry->bRepeatRow )
+ if ( it->eType == SC_PLOC_CELLRANGE && !it->bRepeatCol && !it->bRepeatRow )
{
- rRange = pEntry->aCellRange;
- rPixRect = pEntry->aPixelRect;
+ rRange = it->aCellRange;
+ rPixRect = it->aPixelRect;
return TRUE;
}
}
- return FALSE; // not found
+
+ return FALSE;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit a84c6e7764c631e8c3d56154e27e37b0dc6e9ed8
Author: npcdoom <venccsralph at gmail.com>
Date: Mon Feb 21 10:55:30 2011 -0800
[PATCH 03/10] Remove deprecated List container.
diff --git a/sc/source/ui/docshell/autostyl.cxx b/sc/source/ui/docshell/autostyl.cxx
index 8b275b2..aa744a7 100644
--- a/sc/source/ui/docshell/autostyl.cxx
+++ b/sc/source/ui/docshell/autostyl.cxx
@@ -29,19 +29,15 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sc.hxx"
+#include <time.h>
+#include <boost/bind.hpp>
-// INCLUDE ---------------------------------------------------------------
-
-#include <time.h>
+#include "attrib.hxx"
#include "autostyl.hxx"
-
#include "docsh.hxx"
-#include "attrib.hxx"
#include "sc.hrc"
-//==================================================================
-
struct ScAutoStyleInitData
{
ScRange aRange;
@@ -63,15 +59,11 @@ struct ScAutoStyleData
nTimeout(nT), aRange(rR), aStyle(rT) {}
};
-//==================================================================
-
inline ULONG TimeNow() // Sekunden
{
return (ULONG) time(0);
}
-//==================================================================
-
ScAutoStyleList::ScAutoStyleList(ScDocShell* pShell) :
pDocSh( pShell )
{
@@ -82,89 +74,56 @@ ScAutoStyleList::ScAutoStyleList(ScDocShell* pShell) :
ScAutoStyleList::~ScAutoStyleList()
{
- ULONG i;
- ULONG nCount = aEntries.Count();
- for (i=0; i<nCount; i++)
- delete (ScAutoStyleData*) aEntries.GetObject(i);
- nCount = aInitials.Count();
- for (i=0; i<nCount; i++)
- delete (ScAutoStyleInitData*) aInitials.GetObject(i);
}
-//==================================================================
-
// initial short delay (asynchronous call)
void ScAutoStyleList::AddInitial( const ScRange& rRange, const String& rStyle1,
ULONG nTimeout, const String& rStyle2 )
{
- ScAutoStyleInitData* pNew =
- new ScAutoStyleInitData( rRange, rStyle1, nTimeout, rStyle2 );
- aInitials.Insert( pNew, aInitials.Count() );
+ aInitials.push_back(new ScAutoStyleInitData( rRange, rStyle1, nTimeout, rStyle2 ));
aInitTimer.Start();
}
IMPL_LINK( ScAutoStyleList, InitHdl, Timer*, EMPTYARG )
{
- ULONG nCount = aInitials.Count();
- for (ULONG i=0; i<nCount; i++)
+ boost::ptr_vector<ScAutoStyleInitData>::iterator iter;
+ for (iter = aInitials.begin(); iter != aInitials.end(); ++iter)
{
- ScAutoStyleInitData* pData = (ScAutoStyleInitData*) aInitials.GetObject(i);
-
// apply first style immediately
- pDocSh->DoAutoStyle( pData->aRange, pData->aStyle1 );
+ pDocSh->DoAutoStyle(iter->aRange,iter->aStyle1);
// add second style to list
- if ( pData->nTimeout )
- AddEntry( pData->nTimeout, pData->aRange, pData->aStyle2 );
-
- delete pData;
+ if (iter->nTimeout)
+ AddEntry(iter->nTimeout,iter->aRange,iter->aStyle2 );
}
- aInitials.Clear();
+
+ aInitials.clear();
return 0;
}
-//==================================================================
-
void ScAutoStyleList::AddEntry( ULONG nTimeout, const ScRange& rRange, const String& rStyle )
{
aTimer.Stop();
ULONG nNow = TimeNow();
- // alten Eintrag loeschen
-
- ULONG nCount = aEntries.Count();
- ULONG i;
- for (i=0; i<nCount; i++)
- {
- ScAutoStyleData* pData = (ScAutoStyleData*) aEntries.GetObject(i);
- if (pData->aRange == rRange)
- {
- delete pData;
- aEntries.Remove(i);
- --nCount;
- break; // nicht weitersuchen - es kann nur einen geben
- }
- }
+ aEntries.erase(std::remove_if(aEntries.begin(),aEntries.end(),
+ boost::bind(&ScAutoStyleData::aRange,_1) == rRange));
// Timeouts von allen Eintraegen anpassen
- if (nCount && nNow != nTimerStart)
+ if (!aEntries.empty() && nNow != nTimerStart)
{
DBG_ASSERT(nNow>nTimerStart, "Zeit laeuft rueckwaerts?");
AdjustEntries((nNow-nTimerStart)*1000);
}
// Einfuege-Position suchen
+ boost::ptr_vector<ScAutoStyleData>::iterator iter = std::find_if(aEntries.begin(),aEntries.end(),
+ boost::bind(&ScAutoStyleData::nTimeout,_1) >= nTimeout);
- ULONG nPos = LIST_APPEND;
- for (i=0; i<nCount && nPos == LIST_APPEND; i++)
- if (nTimeout <= ((ScAutoStyleData*) aEntries.GetObject(i))->nTimeout)
- nPos = i;
-
- ScAutoStyleData* pNew = new ScAutoStyleData( nTimeout, rRange, rStyle );
- aEntries.Insert( pNew, nPos );
+ aEntries.insert(iter,new ScAutoStyleData(nTimeout,rRange,rStyle));
// abgelaufene ausfuehren, Timer neu starten
@@ -174,26 +133,30 @@ void ScAutoStyleList::AddEntry( ULONG nTimeout, const ScRange& rRange, const Str
void ScAutoStyleList::AdjustEntries( ULONG nDiff ) // Millisekunden
{
- ULONG nCount = aEntries.Count();
- for (ULONG i=0; i<nCount; i++)
+ boost::ptr_vector<ScAutoStyleData>::iterator iter;
+ for (iter = aEntries.begin(); iter != aEntries.end(); ++iter)
{
- ScAutoStyleData* pData = (ScAutoStyleData*) aEntries.GetObject(i);
- if ( pData->nTimeout <= nDiff )
- pData->nTimeout = 0; // abgelaufen
+ if (iter->nTimeout <= nDiff)
+ iter->nTimeout = 0; // abgelaufen
else
- pData->nTimeout -= nDiff; // weiterzaehlen
+ iter->nTimeout -= nDiff; // weiterzaehlen
}
}
void ScAutoStyleList::ExecuteEntries()
{
- ScAutoStyleData* pData;
- while ((pData = (ScAutoStyleData*) aEntries.GetObject(0)) != NULL && pData->nTimeout == 0)
+ boost::ptr_vector<ScAutoStyleData>::iterator iter;
+ for (iter = aEntries.begin(); iter != aEntries.end();)
{
- pDocSh->DoAutoStyle( pData->aRange, pData->aStyle ); //! oder Request ???
-
- delete pData;
- aEntries.Remove((ULONG)0);
+ if (!iter->nTimeout)
+ {
+ pDocSh->DoAutoStyle(iter->aRange,iter->aStyle);
+ iter = aEntries.erase(iter);
+ }
+ else
+ {
+ ++iter;
+ }
}
}
@@ -201,32 +164,25 @@ void ScAutoStyleList::ExecuteAllNow()
{
aTimer.Stop();
- ULONG nCount = aEntries.Count();
- for (ULONG i=0; i<nCount; i++)
- {
- ScAutoStyleData* pData = (ScAutoStyleData*) aEntries.GetObject(i);
-
- pDocSh->DoAutoStyle( pData->aRange, pData->aStyle ); //! oder Request ???
+ boost::ptr_vector<ScAutoStyleData>::iterator iter;
+ for (iter = aEntries.begin(); iter != aEntries.end(); ++iter)
+ pDocSh->DoAutoStyle(iter->aRange,iter->aStyle);
- delete pData;
- }
- aEntries.Clear();
+ aEntries.clear();
}
void ScAutoStyleList::StartTimer( ULONG nNow ) // Sekunden
{
// ersten Eintrag mit Timeout != 0 suchen
+ boost::ptr_vector<ScAutoStyleData>::iterator iter = std::find_if(aEntries.begin(),aEntries.end(),
+ boost::bind(&ScAutoStyleData::nTimeout,_1) != 0);
- ULONG nPos = 0;
- ScAutoStyleData* pData;
- while ( (pData = (ScAutoStyleData*) aEntries.GetObject(nPos)) != NULL && pData->nTimeout == 0 )
- ++nPos;
-
- if (pData)
+ if (iter != aEntries.end())
{
- aTimer.SetTimeout( pData->nTimeout );
+ aTimer.SetTimeout(iter->nTimeout);
aTimer.Start();
}
+
nTimerStart = nNow;
}
diff --git a/sc/source/ui/inc/autostyl.hxx b/sc/source/ui/inc/autostyl.hxx
index 38345d1..61691c1 100644
--- a/sc/source/ui/inc/autostyl.hxx
+++ b/sc/source/ui/inc/autostyl.hxx
@@ -29,22 +29,27 @@
#ifndef SC_AUTOSTYL_HXX
#define SC_AUTOSTYL_HXX
-#include <vcl/timer.hxx>
-#include <tools/list.hxx>
+#include <boost/ptr_container/ptr_vector.hpp>
+
#include <tools/string.hxx>
+#include <vcl/timer.hxx>
+
class ScDocShell;
class ScRange;
+class ScAutoStyleData;
+class ScAutoStyleInitData;
class ScAutoStyleList
{
private:
+
ScDocShell* pDocSh;
Timer aTimer;
Timer aInitTimer;
ULONG nTimerStart;
- List aEntries;
- List aInitials;
+ boost::ptr_vector<ScAutoStyleData> aEntries;
+ boost::ptr_vector<ScAutoStyleInitData> aInitials;
void ExecuteEntries();
void AdjustEntries(ULONG nDiff);
commit edab80c4df20dd70ed695a04234edba4bbdbd03e
Author: npcdoom <venccsralph at gmail.com>
Date: Mon Feb 21 10:54:12 2011 -0800
[PATCH 02/10] Remove deprecated List container.
diff --git a/sc/source/filter/dif/difimp.cxx b/sc/source/filter/dif/difimp.cxx
index af65c23..f22bfa6 100644
--- a/sc/source/filter/dif/difimp.cxx
+++ b/sc/source/filter/dif/difimp.cxx
@@ -29,23 +29,22 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sc.hxx"
-//------------------------------------------------------------------------
+#include <math.h>
-#include "scitems.hxx"
#include <svl/zforlist.hxx>
+#include <tools/debug.hxx>
+#include "attrib.hxx"
+#include "cell.hxx"
#include "dif.hxx"
+#include "docpool.hxx"
+#include "document.hxx"
#include "filter.hxx"
#include "fprogressbar.hxx"
-#include "scerrors.hxx"
-#include "document.hxx"
-#include "cell.hxx"
-#include "patattr.hxx"
-#include "docpool.hxx"
-#include "attrib.hxx"
#include "ftools.hxx"
-
-#include <math.h>
+#include "patattr.hxx"
+#include "scerrors.hxx"
+#include "scitems.hxx"
const sal_Unicode pKeyTABLE[] = { 'T', 'A', 'B', 'L', 'E', 0 };
const sal_Unicode pKeyVECTORS[] = { 'V', 'E', 'C', 'T', 'O', 'R', 'S', 0 };
@@ -824,19 +823,11 @@ BOOL DifParser::ScanFloatVal( const sal_Unicode* pStart )
return bRet;
}
-
-DifColumn::~DifColumn( void )
+DifColumn::DifColumn ()
+ : pAkt(NULL)
{
- ENTRY* pEntry = ( ENTRY* ) List::First();
-
- while( pEntry )
- {
- delete pEntry;
- pEntry = ( ENTRY* ) List::Next();
- }
}
-
void DifColumn::SetLogical( SCROW nRow )
{
DBG_ASSERT( ValidRow(nRow), "*DifColumn::SetLogical(): Row zu gross!" );
@@ -844,7 +835,9 @@ void DifColumn::SetLogical( SCROW nRow )
if( pAkt )
{
DBG_ASSERT( nRow > 0, "*DifColumn::SetLogical(): weitere koennen nicht 0 sein!" );
+
nRow--;
+
if( pAkt->nEnd == nRow )
pAkt->nEnd++;
else
@@ -854,7 +847,8 @@ void DifColumn::SetLogical( SCROW nRow )
{
pAkt = new ENTRY;
pAkt->nStart = pAkt->nEnd = nRow;
- List::Insert( pAkt, LIST_APPEND );
+
+ aEntries.push_back(pAkt);
}
}
@@ -865,7 +859,7 @@ void DifColumn::SetNumFormat( SCROW nRow, const UINT32 nNumFormat )
if( nNumFormat > 0 )
{
- if( pAkt )
+ if(pAkt)
{
DBG_ASSERT( nRow > 0,
"*DifColumn::SetNumFormat(): weitere koennen nicht 0 sein!" );
@@ -876,10 +870,10 @@ void DifColumn::SetNumFormat( SCROW nRow, const UINT32 nNumFormat )
pAkt->nEnd = nRow;
else
NewEntry( nRow, nNumFormat );
- }
- else
- NewEntry( nRow, nNumFormat );
}
+ else
+ NewEntry(nRow,nNumFormat );
+ }
else
pAkt = NULL;
}
@@ -890,41 +884,33 @@ void DifColumn::NewEntry( const SCROW nPos, const UINT32 nNumFormat )
pAkt = new ENTRY;
pAkt->nStart = pAkt->nEnd = nPos;
pAkt->nNumFormat = nNumFormat;
- List::Insert( pAkt, LIST_APPEND );
+
+ aEntries.push_back(pAkt);
}
void DifColumn::Apply( ScDocument& rDoc, const SCCOL nCol, const SCTAB nTab, const ScPatternAttr& rPattAttr )
{
- ENTRY* pEntry = ( ENTRY* ) List::First();
-
- while( pEntry )
- {
- rDoc.ApplyPatternAreaTab( nCol, pEntry->nStart, nCol, pEntry->nEnd,
- nTab, rPattAttr );
- pEntry = ( ENTRY* ) List::Next();
- }
+ for (boost::ptr_vector<ENTRY>::const_iterator it = aEntries.begin(); it != aEntries.end(); ++it)
+ rDoc.ApplyPatternAreaTab( nCol, it->nStart, nCol, it->nEnd, nTab, rPattAttr );
}
void DifColumn::Apply( ScDocument& rDoc, const SCCOL nCol, const SCTAB nTab )
{
- ScPatternAttr aAttr( rDoc.GetPool() );
- SfxItemSet& rItemSet = aAttr.GetItemSet();
+ ScPatternAttr aAttr( rDoc.GetPool() );
+ SfxItemSet &rItemSet = aAttr.GetItemSet();
- ENTRY* pEntry = ( ENTRY* ) List::First();
-
- while( pEntry )
- {
- DBG_ASSERT( pEntry->nNumFormat > 0,
+ for (boost::ptr_vector<ENTRY>::const_iterator it = aEntries.begin(); it != aEntries.end(); ++it)
+ {
+ DBG_ASSERT( it->nNumFormat > 0,
"+DifColumn::Apply(): Numberformat darf hier nicht 0 sein!" );
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list