[Libreoffice-commits] .: 14 commits - sc/source
Kohei Yoshida
kohei at kemper.freedesktop.org
Mon Dec 20 21:33:33 PST 2010
sc/source/filter/excel/impop.cxx | 14 +--
sc/source/filter/excel/xestyle.cxx | 73 ++++++++++--------
sc/source/filter/excel/xicontent.cxx | 46 +++++------
sc/source/filter/excel/xihelper.cxx | 20 ++---
sc/source/filter/excel/xilink.cxx | 121 ++++++++++++++-----------------
sc/source/filter/excel/xiname.cxx | 18 ++--
sc/source/filter/excel/xistyle.cxx | 109 +++++++++++++++------------
sc/source/filter/ftools/fprogressbar.cxx | 12 +--
sc/source/filter/inc/fprogressbar.hxx | 9 +-
sc/source/filter/inc/ftools.hxx | 90 -----------------------
sc/source/filter/inc/imp_op.hxx | 3
sc/source/filter/inc/xicontent.hxx | 4 -
sc/source/filter/inc/xihelper.hxx | 3
sc/source/filter/inc/xiname.hxx | 4 -
sc/source/filter/inc/xistyle.hxx | 37 +++++----
15 files changed, 250 insertions(+), 313 deletions(-)
New commits:
commit 11f2e508a01967f94a3db7504a97e8b053fd851b
Author: Kohei Yoshida <kyoshida at novell.com>
Date: Tue Dec 21 00:32:39 2010 -0500
Prefer the real iterators over First() Next() iteration pattern.
diff --git a/sc/source/filter/excel/xistyle.cxx b/sc/source/filter/excel/xistyle.cxx
index d6f8208..b705430 100644
--- a/sc/source/filter/excel/xistyle.cxx
+++ b/sc/source/filter/excel/xistyle.cxx
@@ -1677,8 +1677,6 @@ void XclImpXFRangeColumn::SetXF( SCROW nScRow, const XclImpXFIndex& rXFIndex )
void XclImpXFRangeColumn::Insert(XclImpXFRange* pXFRange, ULONG nIndex)
{
maIndexList.insert( maIndexList.begin() + nIndex, pXFRange );
- if (nIndex <= mnCurIndex)
- ++mnCurIndex;
}
void XclImpXFRangeColumn::Find(
@@ -1757,11 +1755,7 @@ void XclImpXFRangeColumn::TryConcatPrev( ULONG nIndex )
XclImpXFRange& nextRange = maIndexList[ nIndex ];
if( prevRange.Expand( nextRange ) )
- {
maIndexList.erase( maIndexList.begin() + nIndex );
- if (mnCurIndex > nIndex)
- --mnCurIndex;
- }
}
// ----------------------------------------------------------------------------
@@ -1898,9 +1892,12 @@ void XclImpXFRangeBuffer::Finalize()
XclImpXFRangeColumn& rColumn = **aVIt;
SCCOL nScCol = static_cast< SCCOL >( aVIt - aVBeg );
list<ScAttrEntry> aAttrs;
- for( XclImpXFRange* pStyle = rColumn.First(); pStyle; pStyle = rColumn.Next() )
+
+ for (XclImpXFRangeColumn::IndexList::iterator itr = rColumn.begin(), itrEnd = rColumn.end();
+ itr != itrEnd; ++itr)
{
- const XclImpXFIndex& rXFIndex = pStyle->maXFIndex;
+ XclImpXFRange& rStyle = *itr;
+ const XclImpXFIndex& rXFIndex = rStyle.maXFIndex;
XclImpXF* pXF = rXFBuffer.GetXF( rXFIndex.GetXFIndex() );
if (!pXF)
continue;
@@ -1908,7 +1905,7 @@ void XclImpXFRangeBuffer::Finalize()
sal_uInt32 nForceScNumFmt = rXFIndex.IsBoolCell() ?
GetNumFmtBuffer().GetStdScNumFmt() : NUMBERFORMAT_ENTRY_NOT_FOUND;
- pXF->ApplyPatternToAttrList(aAttrs, pStyle->mnScRow1, pStyle->mnScRow2, nForceScNumFmt);
+ pXF->ApplyPatternToAttrList(aAttrs, rStyle.mnScRow1, rStyle.mnScRow2, nForceScNumFmt);
}
if (aAttrs.empty() || aAttrs.back().nRow != MAXROW)
diff --git a/sc/source/filter/inc/xistyle.hxx b/sc/source/filter/inc/xistyle.hxx
index 599d384..4d9747d 100644
--- a/sc/source/filter/inc/xistyle.hxx
+++ b/sc/source/filter/inc/xistyle.hxx
@@ -573,12 +573,13 @@ inline bool XclImpXFRange::Contains( SCROW nScRow ) const
class XclImpXFRangeColumn : private boost::noncopyable
{
public:
- inline explicit XclImpXFRangeColumn() : mnCurIndex(0) {}
+ typedef ::boost::ptr_vector<XclImpXFRange> IndexList;
+
+ inline explicit XclImpXFRangeColumn() {}
+
+ IndexList::iterator begin() { return maIndexList.begin(); }
+ IndexList::iterator end() { return maIndexList.end(); }
- /** Returns the first formatted cell range in this column. */
- inline XclImpXFRange* First() { mnCurIndex = 0; return ( maIndexList.empty() ) ? 0 : &(maIndexList.front()); }
- /** Returns the next formatted cell range in this column. */
- inline XclImpXFRange* Next() { return ( ++mnCurIndex >= maIndexList.size() ) ? 0 : &(maIndexList[mnCurIndex]); }
/** Inserts a single row range into the list. */
void SetDefaultXF( const XclImpXFIndex& rXFIndex );
@@ -603,8 +604,7 @@ private:
void Insert(XclImpXFRange* pXFRange, ULONG nIndex);
private:
- boost::ptr_vector< XclImpXFRange > maIndexList; /// The list of XF index range.
- ULONG mnCurIndex; ///Index of current element for use with First() and Next().
+ IndexList maIndexList; /// The list of XF index range.
};
// ----------------------------------------------------------------------------
commit 6a9e68319c529b577b1f95f56bdb472db53afc38
Author: Nigel Hawkins <n.hawkins at gmx.com>
Date: Mon Dec 20 14:50:24 2010 +0000
Remove ScfDelList and ScfDelStack
diff --git a/sc/source/filter/inc/ftools.hxx b/sc/source/filter/inc/ftools.hxx
index 8e32707..16cc643 100644
--- a/sc/source/filter/inc/ftools.hxx
+++ b/sc/source/filter/inc/ftools.hxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -353,94 +353,6 @@ typedef ::std::vector< String > ScfStringVec;
// ----------------------------------------------------------------------------
-/** Template for a list that owns the contained objects.
- @descr This list stores pointers to objects and deletes the objects itself
- on destruction. The Clear() method deletes all objects too. */
-template< typename Type > class ScfDelList
-{
-public:
- inline explicit ScfDelList( USHORT nInitSize = 16, USHORT nResize = 16 ) :
- maList( nInitSize, nResize ) {}
- /** Creates a deep copy of the passed list (copy-constructs all contained objects). */
- inline explicit ScfDelList( const ScfDelList& rSrc ) { *this = rSrc; }
- virtual ~ScfDelList();
-
- /** Creates a deep copy of the passed list (copy-constructs all contained objects). */
- ScfDelList& operator=( const ScfDelList& rSrc );
-
- inline void Insert( Type* pObj, ULONG nIndex ) { if( pObj ) maList.Insert( pObj, nIndex ); }
- inline void Append( Type* pObj ) { if( pObj ) maList.Insert( pObj, LIST_APPEND ); }
- /** Removes the object without deletion. */
- inline Type* Remove( ULONG nIndex ) { return static_cast< Type* >( maList.Remove( nIndex ) ); }
- /** Removes and deletes the object. */
- inline void Delete( ULONG nIndex ) { delete Remove( nIndex ); }
- /** Exchanges the contained object with the passed, returns the old. */
- inline Type* Exchange( Type* pObj, ULONG nIndex ) { return static_cast< Type* >( maList.Replace( pObj, nIndex ) ); }
- /** Replaces (deletes) the contained object. */
- inline void Replace( Type* pObj, ULONG nIndex ) { delete Exchange( pObj, nIndex ); }
-
- void Clear();
- inline ULONG Count() const { return maList.Count(); }
- inline bool Empty() const { return maList.Count() == 0; }
-
- inline Type* GetCurObject() const { return static_cast< Type* >( maList.GetCurObject() ); }
- inline ULONG GetCurPos() const { return maList.GetCurPos(); }
- inline Type* GetObject( sal_uInt32 nIndex ) const { return static_cast< Type* >( maList.GetObject( nIndex ) ); }
-
- inline Type* First() const { return static_cast< Type* >( maList.First() ); }
- inline Type* Last() const { return static_cast< Type* >( maList.Last() ); }
- inline Type* Next() const { return static_cast< Type* >( maList.Next() ); }
- inline Type* Prev() const { return static_cast< Type* >( maList.Prev() ); }
-
-private:
- mutable List maList; /// The base container object.
-};
-
-template< typename Type > ScfDelList< Type >& ScfDelList< Type >::operator=( const ScfDelList& rSrc )
-{
- Clear();
- for( const Type* pObj = rSrc.First(); pObj; pObj = rSrc.Next() )
- Append( new Type( *pObj ) );
- return *this;
-}
-
-template< typename Type > ScfDelList< Type >::~ScfDelList()
-{
- Clear();
-}
-
-template< typename Type > void ScfDelList< Type >::Clear()
-{
- for( Type* pObj = First(); pObj; pObj = Next() )
- delete pObj;
- maList.Clear();
-}
-
-// ----------------------------------------------------------------------------
-
-/** Template for a stack that owns the contained objects.
- @descr This stack stores pointers to objects and deletes the objects
- itself on destruction. The Clear() method deletes all objects too.
- The Pop() method removes the top object from stack without deletion. */
-template< typename Type >
-class ScfDelStack : private ScfDelList< Type >
-{
-public:
- inline ScfDelStack( USHORT nInitSize = 16, USHORT nResize = 16 ) :
- ScfDelList< Type >( nInitSize, nResize ) {}
-
- inline void Push( Type* pObj ) { Append( pObj ); }
- /** Removes the top object without deletion. */
- inline Type* Pop() { return Remove( Count() - 1 ); }
-
- inline Type* Top() const { return GetObject( Count() - 1 ); }
-
- using ScfDelList< Type >::Clear;
- using ScfDelList< Type >::Count;
- using ScfDelList< Type >::Empty;
-};
-
-// ----------------------------------------------------------------------------
class ScFormatFilterPluginImpl : public ScFormatFilterPlugin {
public:
ScFormatFilterPluginImpl();
commit a8025a27dde2d3c4ca8584ecf21b9ee3a4a91aa0
Author: Kohei Yoshida <kyoshida at novell.com>
Date: Mon Dec 20 23:56:04 2010 -0500
Removed const_cast, and fixed some accidental logic change.
Get a reference from the list when we need to modify the stored
object. Making a copy and modifying the copy is not what the
original code did.
diff --git a/sc/source/filter/excel/xistyle.cxx b/sc/source/filter/excel/xistyle.cxx
index d4800d4..d6f8208 100644
--- a/sc/source/filter/excel/xistyle.cxx
+++ b/sc/source/filter/excel/xistyle.cxx
@@ -532,13 +532,14 @@ const XclImpFont* XclImpFontBuffer::GetFont( sal_uInt16 nFontIndex ) const
/* Font with index 4 is not stored in an Excel file, but used e.g. by
BIFF5 form pushbutton objects. It is the bold default font.
This also means that entries above 4 are out by one in the list. */
+
if (nFontIndex == 4)
return &maFont4;
- if ( (nFontIndex < 4) && (nFontIndex < maFontList.size()) )
- return &(maFontList[nFontIndex]);
- if ( (nFontIndex > 4) && (nFontIndex <= maFontList.size()) )
- return &(maFontList[nFontIndex - 1]);
- return 0;
+
+ if (nFontIndex >= maFontList.size())
+ return NULL;
+
+ return (nFontIndex < 4) ? &(maFontList[nFontIndex]) : &(maFontList[nFontIndex - 1]);
}
void XclImpFontBuffer::ReadFont( XclImpStream& rStrm )
@@ -1682,7 +1683,7 @@ void XclImpXFRangeColumn::Insert(XclImpXFRange* pXFRange, ULONG nIndex)
void XclImpXFRangeColumn::Find(
XclImpXFRange*& rpPrevRange, XclImpXFRange*& rpNextRange,
- ULONG& rnNextIndex, SCROW nScRow ) const
+ ULONG& rnNextIndex, SCROW nScRow )
{
// test whether list is empty
@@ -1693,8 +1694,8 @@ void XclImpXFRangeColumn::Find(
return;
}
- rpPrevRange = const_cast<XclImpXFRange*> (&(maIndexList.front()));
- rpNextRange = const_cast<XclImpXFRange*> (&(maIndexList.back()));
+ rpPrevRange = &maIndexList.front();
+ rpNextRange = &maIndexList.back();
// test whether row is at end of list (contained in or behind last range)
// rpPrevRange will contain a possible existing row
@@ -1725,7 +1726,7 @@ void XclImpXFRangeColumn::Find(
while( ((rnNextIndex - nPrevIndex) > 1) && (rpPrevRange->mnScRow2 < nScRow) )
{
nMidIndex = (nPrevIndex + rnNextIndex) / 2;
- pMidRange = const_cast<XclImpXFRange*>( &(maIndexList[ nMidIndex ]) );
+ pMidRange = &maIndexList[nMidIndex];
DBG_ASSERT( pMidRange, "XclImpXFRangeColumn::Find - missing XF index range" );
if( nScRow < pMidRange->mnScRow1 ) // row is really before pMidRange
{
@@ -1743,19 +1744,20 @@ void XclImpXFRangeColumn::Find(
if( nScRow <= rpPrevRange->mnScRow2 )
{
rnNextIndex = nPrevIndex + 1;
- rpNextRange = const_cast<XclImpXFRange*>( &(maIndexList[rnNextIndex]) );
+ rpNextRange = &maIndexList[rnNextIndex];
}
}
void XclImpXFRangeColumn::TryConcatPrev( ULONG nIndex )
{
- if( nIndex <= 0 || nIndex >= maIndexList.size() )
+ if( !nIndex || nIndex >= maIndexList.size() )
return;
- XclImpXFRange prevRange = maIndexList[ nIndex - 1 ];
- XclImpXFRange nextRange = maIndexList[ nIndex ];
+ XclImpXFRange& prevRange = maIndexList[ nIndex - 1 ];
+ XclImpXFRange& nextRange = maIndexList[ nIndex ];
- if( prevRange.Expand( nextRange ) ) {
+ if( prevRange.Expand( nextRange ) )
+ {
maIndexList.erase( maIndexList.begin() + nIndex );
if (mnCurIndex > nIndex)
--mnCurIndex;
diff --git a/sc/source/filter/inc/xistyle.hxx b/sc/source/filter/inc/xistyle.hxx
index f48db44..599d384 100644
--- a/sc/source/filter/inc/xistyle.hxx
+++ b/sc/source/filter/inc/xistyle.hxx
@@ -497,8 +497,11 @@ public:
void ReadStyle( XclImpStream& rStrm );
/** Returns the object that stores all contents of an XF record. */
- inline XclImpXF* GetXF( sal_uInt16 nXFIndex ) const
- { return const_cast< XclImpXF* > ((nXFIndex >= maXFList.size()) ? 0 : &(maXFList.at(nXFIndex))); }
+ inline XclImpXF* GetXF( sal_uInt16 nXFIndex )
+ { return (nXFIndex >= maXFList.size()) ? NULL : &maXFList.at(nXFIndex); }
+
+ inline const XclImpXF* GetXF( sal_uInt16 nXFIndex ) const
+ { return (nXFIndex >= maXFList.size()) ? NULL : &maXFList.at(nXFIndex); }
/** Returns the index to the Excel font used in the specified XF record. */
sal_uInt16 GetFontIndex( sal_uInt16 nXFIndex ) const;
@@ -589,7 +592,7 @@ private:
XclImpXFRange*& rpPrevRange,
XclImpXFRange*& rpNextRange,
ULONG& rnNextIndex,
- SCROW nScRow ) const;
+ SCROW nScRow );
/** Tries to concatenate a range with its predecessor.
@descr The ranges must have the same XF index and must not have a gap.
commit b5493a7ef9689fe64e2d1deba79707fa90716c49
Author: Nigel Hawkins <n.hawkins at gmx.com>
Date: Sun Dec 19 08:35:44 2010 +0000
Remove ScfDelList in xistyle
diff --git a/sc/source/filter/excel/xistyle.cxx b/sc/source/filter/excel/xistyle.cxx
index 3105816..d4800d4 100644
--- a/sc/source/filter/excel/xistyle.cxx
+++ b/sc/source/filter/excel/xistyle.cxx
@@ -517,7 +517,7 @@ XclImpFontBuffer::XclImpFontBuffer( const XclImpRoot& rRoot ) :
void XclImpFontBuffer::Initialize()
{
- maFontList.Clear();
+ maFontList.clear();
// application font for column width calculation, later filled with first font from font list
XclFontData aAppFontData;
@@ -530,18 +530,24 @@ void XclImpFontBuffer::Initialize()
const XclImpFont* XclImpFontBuffer::GetFont( sal_uInt16 nFontIndex ) const
{
/* Font with index 4 is not stored in an Excel file, but used e.g. by
- BIFF5 form pushbutton objects. It is the bold default font. */
- return (nFontIndex == 4) ? &maFont4 :
- maFontList.GetObject( (nFontIndex < 4) ? nFontIndex : (nFontIndex - 1) );
+ BIFF5 form pushbutton objects. It is the bold default font.
+ This also means that entries above 4 are out by one in the list. */
+ if (nFontIndex == 4)
+ return &maFont4;
+ if ( (nFontIndex < 4) && (nFontIndex < maFontList.size()) )
+ return &(maFontList[nFontIndex]);
+ if ( (nFontIndex > 4) && (nFontIndex <= maFontList.size()) )
+ return &(maFontList[nFontIndex - 1]);
+ return 0;
}
void XclImpFontBuffer::ReadFont( XclImpStream& rStrm )
{
XclImpFont* pFont = new XclImpFont( GetRoot() );
pFont->ReadFont( rStrm );
- maFontList.Append( pFont );
+ maFontList.push_back( pFont );
- if( maFontList.Count() == 1 )
+ if( maFontList.size() == 1 )
{
UpdateAppFont( pFont->GetFontData(), pFont->HasCharSet() );
// #i71033# set text encoding from application font, if CODEPAGE is missing
@@ -551,8 +557,8 @@ void XclImpFontBuffer::ReadFont( XclImpStream& rStrm )
void XclImpFontBuffer::ReadEfont( XclImpStream& rStrm )
{
- if( XclImpFont* pFont = maFontList.Last() )
- pFont->ReadEfont( rStrm );
+ if( !maFontList.empty() )
+ maFontList.back().ReadEfont( rStrm );
}
void XclImpFontBuffer::FillToItemSet(
@@ -1431,9 +1437,9 @@ XclImpXFBuffer::XclImpXFBuffer( const XclImpRoot& rRoot ) :
void XclImpXFBuffer::Initialize()
{
- maXFList.Clear();
- maBuiltinStyles.Clear();
- maUserStyles.Clear();
+ maXFList.clear();
+ maBuiltinStyles.clear();
+ maUserStyles.clear();
maStylesByXf.clear();
}
@@ -1441,14 +1447,14 @@ void XclImpXFBuffer::ReadXF( XclImpStream& rStrm )
{
XclImpXF* pXF = new XclImpXF( GetRoot() );
pXF->ReadXF( rStrm );
- maXFList.Append( pXF );
+ maXFList.push_back( pXF );
}
void XclImpXFBuffer::ReadStyle( XclImpStream& rStrm )
{
XclImpStyle* pStyle = new XclImpStyle( GetRoot() );
pStyle->ReadStyle( rStrm );
- (pStyle->IsBuiltin() ? maBuiltinStyles : maUserStyles).Append( pStyle );
+ (pStyle->IsBuiltin() ? maBuiltinStyles : maUserStyles).push_back( pStyle );
DBG_ASSERT( maStylesByXf.count( pStyle->GetXfId() ) == 0, "XclImpXFBuffer::ReadStyle - multiple styles with equal XF identifier" );
maStylesByXf[ pStyle->GetXfId() ] = pStyle;
}
@@ -1502,28 +1508,28 @@ void XclImpXFBuffer::CreateUserStyles()
/* Calculate names of built-in styles. Store styles with reserved names
in the aConflictNameStyles list. */
- for( XclImpStyle* pStyle = maBuiltinStyles.First(); pStyle; pStyle = maBuiltinStyles.Next() )
+ for( XclImpStyleList::iterator itStyle = maBuiltinStyles.begin(); itStyle != maBuiltinStyles.end(); ++itStyle )
{
- String aStyleName = XclTools::GetBuiltInStyleName( pStyle->GetBuiltinId(), pStyle->GetName(), pStyle->GetLevel() );
+ String aStyleName = XclTools::GetBuiltInStyleName( itStyle->GetBuiltinId(), itStyle->GetName(), itStyle->GetLevel() );
DBG_ASSERT( bReserveAll || (aCellStyles.count( aStyleName ) == 0),
"XclImpXFBuffer::CreateUserStyles - multiple styles with equal built-in identifier" );
if( aCellStyles.count( aStyleName ) > 0 )
- aConflictNameStyles.push_back( pStyle );
+ aConflictNameStyles.push_back( &(*itStyle) );
else
- aCellStyles[ aStyleName ] = pStyle;
+ aCellStyles[ aStyleName ] = &(*itStyle);
}
/* Calculate names of user defined styles. Store styles with reserved
names in the aConflictNameStyles list. */
- for( XclImpStyle* pStyle = maUserStyles.First(); pStyle; pStyle = maUserStyles.Next() )
+ for( XclImpStyleList::iterator itStyle = maUserStyles.begin(); itStyle != maUserStyles.end(); ++itStyle )
{
// #i1624# #i1768# ignore unnamed user styles
- if( pStyle->GetName().Len() > 0 )
+ if( itStyle->GetName().Len() > 0 )
{
- if( aCellStyles.count( pStyle->GetName() ) > 0 )
- aConflictNameStyles.push_back( pStyle );
+ if( aCellStyles.count( itStyle->GetName() ) > 0 )
+ aConflictNameStyles.push_back( &(*itStyle) );
else
- aCellStyles[ pStyle->GetName() ] = pStyle;
+ aCellStyles[ itStyle->GetName() ] = &(*itStyle);
}
}
@@ -1593,10 +1599,10 @@ void XclImpXFRangeColumn::SetDefaultXF( const XclImpXFIndex& rXFIndex )
{
// List should be empty when inserting the default column format.
// Later explicit SetXF() calls will break up this range.
- DBG_ASSERT( maIndexList.Empty(), "XclImpXFRangeColumn::SetDefaultXF - Setting Default Column XF is not empty" );
+ DBG_ASSERT( maIndexList.empty(), "XclImpXFRangeColumn::SetDefaultXF - Setting Default Column XF is not empty" );
// insert a complete row range with one insert.
- maIndexList.Append( new XclImpXFRange( 0, MAXROW, rXFIndex ) );
+ maIndexList.push_back( new XclImpXFRange( 0, MAXROW, rXFIndex ) );
}
// ----------------------------------------------------------------------------
@@ -1622,7 +1628,7 @@ void XclImpXFRangeColumn::SetXF( SCROW nScRow, const XclImpXFIndex& rXFIndex )
SCROW nLastScRow = pPrevRange->mnScRow2;
ULONG nIndex = nNextIndex - 1;
XclImpXFRange* pThisRange = pPrevRange;
- pPrevRange = nIndex ? maIndexList.GetObject( nIndex - 1 ) : 0;
+ pPrevRange = (nIndex > 0 && nIndex <= maIndexList.size()) ? &(maIndexList[ nIndex - 1 ]) : 0;
if( nFirstScRow == nLastScRow ) // replace solely XF
{
@@ -1635,20 +1641,20 @@ void XclImpXFRangeColumn::SetXF( SCROW nScRow, const XclImpXFIndex& rXFIndex )
++(pThisRange->mnScRow1);
// try to concatenate with previous of this
if( !pPrevRange || !pPrevRange->Expand( nScRow, rXFIndex ) )
- maIndexList.Insert( new XclImpXFRange( nScRow, rXFIndex ), nIndex );
+ Insert( new XclImpXFRange( nScRow, rXFIndex ), nIndex );
}
else if( nLastScRow == nScRow ) // replace last XF
{
--(pThisRange->mnScRow2);
if( !pNextRange || !pNextRange->Expand( nScRow, rXFIndex ) )
- maIndexList.Insert( new XclImpXFRange( nScRow, rXFIndex ), nNextIndex );
+ Insert( new XclImpXFRange( nScRow, rXFIndex ), nNextIndex );
}
else // insert in the middle of the range
{
pThisRange->mnScRow1 = nScRow + 1;
// List::Insert() moves entries towards end of list, so insert twice at nIndex
- maIndexList.Insert( new XclImpXFRange( nScRow, rXFIndex ), nIndex );
- maIndexList.Insert( new XclImpXFRange( nFirstScRow, nScRow - 1, pThisRange->maXFIndex ), nIndex );
+ Insert( new XclImpXFRange( nScRow, rXFIndex ), nIndex );
+ Insert( new XclImpXFRange( nFirstScRow, nScRow - 1, pThisRange->maXFIndex ), nIndex );
}
return;
}
@@ -1664,7 +1670,14 @@ void XclImpXFRangeColumn::SetXF( SCROW nScRow, const XclImpXFIndex& rXFIndex )
return;
// create new range
- maIndexList.Insert( new XclImpXFRange( nScRow, rXFIndex ), nNextIndex );
+ Insert( new XclImpXFRange( nScRow, rXFIndex ), nNextIndex );
+}
+
+void XclImpXFRangeColumn::Insert(XclImpXFRange* pXFRange, ULONG nIndex)
+{
+ maIndexList.insert( maIndexList.begin() + nIndex, pXFRange );
+ if (nIndex <= mnCurIndex)
+ ++mnCurIndex;
}
void XclImpXFRangeColumn::Find(
@@ -1673,15 +1686,15 @@ void XclImpXFRangeColumn::Find(
{
// test whether list is empty
- if( maIndexList.Empty() )
+ if( maIndexList.empty() )
{
rpPrevRange = rpNextRange = 0;
rnNextIndex = 0;
return;
}
- rpPrevRange = maIndexList.GetObject( 0 );
- rpNextRange = maIndexList.GetObject( maIndexList.Count() - 1 );
+ rpPrevRange = const_cast<XclImpXFRange*> (&(maIndexList.front()));
+ rpNextRange = const_cast<XclImpXFRange*> (&(maIndexList.back()));
// test whether row is at end of list (contained in or behind last range)
// rpPrevRange will contain a possible existing row
@@ -1689,7 +1702,7 @@ void XclImpXFRangeColumn::Find(
{
rpPrevRange = rpNextRange;
rpNextRange = 0;
- rnNextIndex = maIndexList.Count();
+ rnNextIndex = maIndexList.size();
return;
}
@@ -1707,12 +1720,12 @@ void XclImpXFRangeColumn::Find(
// if rpPrevRange contains nScRow (rpNextRange will never contain nScRow)
ULONG nPrevIndex = 0;
ULONG nMidIndex;
- rnNextIndex = maIndexList.Count() - 1;
+ rnNextIndex = maIndexList.size() - 1;
XclImpXFRange* pMidRange;
while( ((rnNextIndex - nPrevIndex) > 1) && (rpPrevRange->mnScRow2 < nScRow) )
{
nMidIndex = (nPrevIndex + rnNextIndex) / 2;
- pMidRange = maIndexList.GetObject( nMidIndex );
+ pMidRange = const_cast<XclImpXFRange*>( &(maIndexList[ nMidIndex ]) );
DBG_ASSERT( pMidRange, "XclImpXFRangeColumn::Find - missing XF index range" );
if( nScRow < pMidRange->mnScRow1 ) // row is really before pMidRange
{
@@ -1730,22 +1743,23 @@ void XclImpXFRangeColumn::Find(
if( nScRow <= rpPrevRange->mnScRow2 )
{
rnNextIndex = nPrevIndex + 1;
- rpNextRange = maIndexList.GetObject( rnNextIndex );
+ rpNextRange = const_cast<XclImpXFRange*>( &(maIndexList[rnNextIndex]) );
}
}
void XclImpXFRangeColumn::TryConcatPrev( ULONG nIndex )
{
- if( !nIndex )
+ if( nIndex <= 0 || nIndex >= maIndexList.size() )
return;
- XclImpXFRange* pPrevRange = maIndexList.GetObject( nIndex - 1 );
- XclImpXFRange* pNextRange = maIndexList.GetObject( nIndex );
- if( !pPrevRange || !pNextRange )
- return;
+ XclImpXFRange prevRange = maIndexList[ nIndex - 1 ];
+ XclImpXFRange nextRange = maIndexList[ nIndex ];
- if( pPrevRange->Expand( *pNextRange ) )
- maIndexList.Delete( nIndex );
+ if( prevRange.Expand( nextRange ) ) {
+ maIndexList.erase( maIndexList.begin() + nIndex );
+ if (mnCurIndex > nIndex)
+ --mnCurIndex;
+ }
}
// ----------------------------------------------------------------------------
diff --git a/sc/source/filter/inc/xistyle.hxx b/sc/source/filter/inc/xistyle.hxx
index 5b16cc7..f48db44 100644
--- a/sc/source/filter/inc/xistyle.hxx
+++ b/sc/source/filter/inc/xistyle.hxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -33,6 +33,7 @@
#include <tools/mempool.hxx>
#include <boost/noncopyable.hpp>
#include <boost/shared_ptr.hpp>
+#include <boost/ptr_container/ptr_vector.hpp>
#include "rangelst.hxx"
#include "patattr.hxx"
#include "xladdress.hxx"
@@ -208,10 +209,10 @@ private:
void UpdateAppFont( const XclFontData& rFontData, bool bHasCharSet );
private:
- ScfDelList< XclImpFont > maFontList; /// List of all FONT records in the Excel file.
- XclFontData maAppFont; /// Application font (for column width).
- XclImpFont maFont4; /// Built-in font with index 4.
- XclImpFont maCtrlFont; /// BIFF5 default form controls font (Helv,8pt,bold).
+ boost::ptr_vector< XclImpFont > maFontList; /// List of all FONT records in the Excel file.
+ XclFontData maAppFont; /// Application font (for column width).
+ XclImpFont maFont4; /// Built-in font with index 4.
+ XclImpFont maCtrlFont; /// BIFF5 default form controls font (Helv,8pt,bold).
};
// FORMAT record - number formats =============================================
@@ -497,7 +498,7 @@ public:
/** Returns the object that stores all contents of an XF record. */
inline XclImpXF* GetXF( sal_uInt16 nXFIndex ) const
- { return maXFList.GetObject( nXFIndex ); }
+ { return const_cast< XclImpXF* > ((nXFIndex >= maXFList.size()) ? 0 : &(maXFList.at(nXFIndex))); }
/** Returns the index to the Excel font used in the specified XF record. */
sal_uInt16 GetFontIndex( sal_uInt16 nXFIndex ) const;
@@ -511,10 +512,10 @@ public:
ScStyleSheet* CreateStyleSheet( sal_uInt16 nXFIndex );
private:
- typedef ScfDelList< XclImpStyle > XclImpStyleList;
+ typedef boost::ptr_vector< XclImpStyle > XclImpStyleList;
typedef ::std::map< sal_uInt16, XclImpStyle* > XclImpStyleMap;
- ScfDelList< XclImpXF > maXFList; /// List of contents of all XF record.
+ boost::ptr_vector< XclImpXF > maXFList; /// List of contents of all XF record.
XclImpStyleList maBuiltinStyles; /// List of built-in cell styles.
XclImpStyleList maUserStyles; /// List of user defined cell styles.
XclImpStyleMap maStylesByXf; /// Maps XF records to cell styles.
@@ -569,13 +570,12 @@ inline bool XclImpXFRange::Contains( SCROW nScRow ) const
class XclImpXFRangeColumn : private boost::noncopyable
{
public:
- inline explicit XclImpXFRangeColumn() {}
+ inline explicit XclImpXFRangeColumn() : mnCurIndex(0) {}
/** Returns the first formatted cell range in this column. */
- inline XclImpXFRange* First() { return maIndexList.First(); }
+ inline XclImpXFRange* First() { mnCurIndex = 0; return ( maIndexList.empty() ) ? 0 : &(maIndexList.front()); }
/** Returns the next formatted cell range in this column. */
- inline XclImpXFRange* Next() { return maIndexList.Next(); }
-
+ inline XclImpXFRange* Next() { return ( ++mnCurIndex >= maIndexList.size() ) ? 0 : &(maIndexList[mnCurIndex]); }
/** Inserts a single row range into the list. */
void SetDefaultXF( const XclImpXFIndex& rXFIndex );
@@ -596,8 +596,12 @@ private:
The resulting range has the index nIndex-1. */
void TryConcatPrev( ULONG nIndex );
+ /** Insert a range into the list at the specified index. */
+ void Insert(XclImpXFRange* pXFRange, ULONG nIndex);
+
private:
- ScfDelList< XclImpXFRange > maIndexList; /// The list of XF index range.
+ boost::ptr_vector< XclImpXFRange > maIndexList; /// The list of XF index range.
+ ULONG mnCurIndex; ///Index of current element for use with First() and Next().
};
// ----------------------------------------------------------------------------
commit 8408099ee293725f1bd4c970c254fad8de63aa42
Author: Kohei Yoshida <kyoshida at novell.com>
Date: Mon Dec 20 23:27:40 2010 -0500
Check for the validity of the index before calling at(index).
diff --git a/sc/source/filter/excel/xilink.cxx b/sc/source/filter/excel/xilink.cxx
index 637dedc..143d95a 100644
--- a/sc/source/filter/excel/xilink.cxx
+++ b/sc/source/filter/excel/xilink.cxx
@@ -516,7 +516,9 @@ void XclImpSupbook::ReadExternname( XclImpStream& rStrm, ExcelToSc* pFormulaConv
const XclImpExtName* XclImpSupbook::GetExternName( sal_uInt16 nXclIndex ) const
{
DBG_ASSERT( nXclIndex > 0, "XclImpSupbook::GetExternName - index must be >0" );
- return (meType == EXC_SBTYPE_SELF) ? 0 : &(maExtNameList.at( nXclIndex - 1 ));
+ if (meType == EXC_SBTYPE_SELF || nXclIndex >= maExtNameList.size())
+ return NULL;
+ return &maExtNameList.at( nXclIndex - 1 );
}
bool XclImpSupbook::GetLinkData( String& rApplic, String& rTopic ) const
commit 6b6ddbb66551a17cd2a216cc9a96923b5e8d5902
Author: Nigel Hawkins <n.hawkins at gmx.com>
Date: Thu Dec 16 20:41:34 2010 +0000
Remove ScfDelList in xilink
diff --git a/sc/source/filter/excel/xilink.cxx b/sc/source/filter/excel/xilink.cxx
index eac0c38..637dedc 100644
--- a/sc/source/filter/excel/xilink.cxx
+++ b/sc/source/filter/excel/xilink.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -41,6 +41,7 @@
#include "externalrefmgr.hxx"
#include <vector>
+#include <boost/ptr_container/ptr_vector.hpp>
using ::std::vector;
@@ -50,7 +51,10 @@ using ::std::vector;
// Cached external cells ======================================================
-/** Contains the address and value of an external referenced cell. */
+/**
+ * Contains the address and value of an external referenced cell.
+ * Note that this is non-copyable, so cannot be used in most stl/boost containers.
+ */
class XclImpCrn : public XclImpCachedValue
{
public:
@@ -82,7 +86,8 @@ public:
void LoadCachedValues(ScExternalRefCache::TableTypeRef pCacheTable);
private:
- typedef ScfDelList< XclImpCrn > XclImpCrnList;
+ typedef boost::shared_ptr< XclImpCrn > XclImpCrnRef;
+ typedef std::vector< XclImpCrnRef > XclImpCrnList;
XclImpCrnList maCrnList; /// List of CRN records (cached cell values).
String maTabName; /// Name of the external sheet.
@@ -129,8 +134,8 @@ public:
void LoadCachedValues();
private:
- typedef ScfDelList< XclImpSupbookTab > XclImpSupbookTabList;
- typedef ScfDelList< XclImpExtName > XclImpExtNameList;
+ typedef boost::ptr_vector< XclImpSupbookTab > XclImpSupbookTabList;
+ typedef boost::ptr_vector< XclImpExtName > XclImpExtNameList;
XclImpSupbookTabList maSupbTabList; /// All sheet names of the document.
XclImpExtNameList maExtNameList; /// All external names of the document.
@@ -212,7 +217,7 @@ private:
private:
typedef ::std::vector< XclImpXti > XclImpXtiVector;
- typedef ScfDelList< XclImpSupbook > XclImpSupbookList;
+ typedef boost::ptr_vector< XclImpSupbook > XclImpSupbookList;
XclImpXtiVector maXtiList; /// List of all XTI structures.
XclImpSupbookList maSupbookList; /// List of external documents.
@@ -388,43 +393,45 @@ XclImpSupbookTab::~XclImpSupbookTab()
void XclImpSupbookTab::ReadCrn( XclImpStream& rStrm, const XclAddress& rXclPos )
{
- maCrnList.Append( new XclImpCrn( rStrm, rXclPos ) );
+ XclImpCrnRef crnRef( new XclImpCrn(rStrm, rXclPos) );
+ maCrnList.push_back( crnRef );
}
void XclImpSupbookTab::LoadCachedValues(ScExternalRefCache::TableTypeRef pCacheTable)
{
- if (maCrnList.Empty())
+ if (maCrnList.empty())
return;
- for (XclImpCrn* p = maCrnList.First(); p; p = maCrnList.Next())
+ for (XclImpCrnList::iterator itCrnRef = maCrnList.begin(); itCrnRef != maCrnList.end(); ++itCrnRef)
{
- const XclAddress& rAddr = p->GetAddress();
- switch (p->GetType())
+ const XclImpCrn* const pCrn = itCrnRef->get();
+ const XclAddress& rAddr = pCrn->GetAddress();
+ switch (pCrn->GetType())
{
case EXC_CACHEDVAL_BOOL:
{
- bool b = p->GetBool();
+ bool b = pCrn->GetBool();
ScExternalRefCache::TokenRef pToken(new formula::FormulaDoubleToken(b ? 1.0 : 0.0));
pCacheTable->setCell(rAddr.mnCol, rAddr.mnRow, pToken, 0, false);
}
break;
case EXC_CACHEDVAL_DOUBLE:
{
- double f = p->GetValue();
+ double f = pCrn->GetValue();
ScExternalRefCache::TokenRef pToken(new formula::FormulaDoubleToken(f));
pCacheTable->setCell(rAddr.mnCol, rAddr.mnRow, pToken, 0, false);
}
break;
case EXC_CACHEDVAL_ERROR:
{
- double fError = XclTools::ErrorToDouble( p->GetXclError() );
+ double fError = XclTools::ErrorToDouble( pCrn->GetXclError() );
ScExternalRefCache::TokenRef pToken(new formula::FormulaDoubleToken(fError));
pCacheTable->setCell(rAddr.mnCol, rAddr.mnRow, pToken, 0, false);
}
break;
case EXC_CACHEDVAL_STRING:
{
- const String& rStr = p->GetString();
+ const String& rStr = pCrn->GetString();
ScExternalRefCache::TokenRef pToken(new formula::FormulaStringToken(rStr));
pCacheTable->setCell(rAddr.mnCol, rAddr.mnRow, pToken, 0, false);
}
@@ -463,7 +470,7 @@ XclImpSupbook::XclImpSupbook( XclImpStream& rStrm ) :
if( maXclUrl.EqualsIgnoreCaseAscii( "\010EUROTOOL.XLA" ) )
{
meType = EXC_SBTYPE_EUROTOOL;
- maSupbTabList.Append( new XclImpSupbookTab( maXclUrl ) );
+ maSupbTabList.push_back( new XclImpSupbookTab( maXclUrl ) );
}
else if( nSBTabCnt )
{
@@ -471,14 +478,14 @@ XclImpSupbook::XclImpSupbook( XclImpStream& rStrm ) :
for( sal_uInt16 nSBTab = 0; nSBTab < nSBTabCnt; ++nSBTab )
{
String aTabName( rStrm.ReadUniString() );
- maSupbTabList.Append( new XclImpSupbookTab( aTabName ) );
+ maSupbTabList.push_back( new XclImpSupbookTab( aTabName ) );
}
}
else
{
meType = EXC_SBTYPE_SPECIAL;
// create dummy list entry
- maSupbTabList.Append( new XclImpSupbookTab( maXclUrl ) );
+ maSupbTabList.push_back( new XclImpSupbookTab( maXclUrl ) );
}
}
@@ -490,26 +497,26 @@ void XclImpSupbook::ReadXct( XclImpStream& rStrm )
void XclImpSupbook::ReadCrn( XclImpStream& rStrm )
{
- if( XclImpSupbookTab* pSBTab = maSupbTabList.GetObject( mnSBTab ) )
- {
- sal_uInt8 nXclColLast, nXclColFirst;
- sal_uInt16 nXclRow;
- rStrm >> nXclColLast >> nXclColFirst >> nXclRow;
+ if (mnSBTab >= maSupbTabList.size())
+ return;
+ XclImpSupbookTab& rSbTab = maSupbTabList[mnSBTab];
+ sal_uInt8 nXclColLast, nXclColFirst;
+ sal_uInt16 nXclRow;
+ rStrm >> nXclColLast >> nXclColFirst >> nXclRow;
- for( sal_uInt8 nXclCol = nXclColFirst; (nXclCol <= nXclColLast) && (rStrm.GetRecLeft() > 1); ++nXclCol )
- pSBTab->ReadCrn( rStrm, XclAddress( nXclCol, nXclRow ) );
- }
+ for( sal_uInt8 nXclCol = nXclColFirst; (nXclCol <= nXclColLast) && (rStrm.GetRecLeft() > 1); ++nXclCol )
+ rSbTab.ReadCrn( rStrm, XclAddress( nXclCol, nXclRow ) );
}
void XclImpSupbook::ReadExternname( XclImpStream& rStrm, ExcelToSc* pFormulaConv )
{
- maExtNameList.Append( new XclImpExtName( *this, rStrm, meType, pFormulaConv ) );
+ maExtNameList.push_back( new XclImpExtName( *this, rStrm, meType, pFormulaConv ) );
}
const XclImpExtName* XclImpSupbook::GetExternName( sal_uInt16 nXclIndex ) const
{
DBG_ASSERT( nXclIndex > 0, "XclImpSupbook::GetExternName - index must be >0" );
- return (meType == EXC_SBTYPE_SELF) ? 0 : maExtNameList.GetObject( nXclIndex - 1 );
+ return (meType == EXC_SBTYPE_SELF) ? 0 : &(maExtNameList.at( nXclIndex - 1 ));
}
bool XclImpSupbook::GetLinkData( String& rApplic, String& rTopic ) const
@@ -526,22 +533,14 @@ const String& XclImpSupbook::GetMacroName( sal_uInt16 nXclNameIdx ) const
const String& XclImpSupbook::GetTabName( sal_uInt16 nXtiTab ) const
{
- if (maSupbTabList.Empty())
+ if (nXtiTab >= maSupbTabList.size())
return EMPTY_STRING;
-
- sal_uInt16 i = 0;
- for (XclImpSupbookTab* p = maSupbTabList.First(); p; p = maSupbTabList.Next(), ++i)
- {
- if (i == nXtiTab)
- return p->GetTabName();
- }
-
- return EMPTY_STRING;
+ return maSupbTabList[nXtiTab].GetTabName();
}
sal_uInt16 XclImpSupbook::GetTabCount() const
{
- return ulimit_cast<sal_uInt16>(maSupbTabList.Count());
+ return ulimit_cast<sal_uInt16>(maSupbTabList.size());
}
void XclImpSupbook::LoadCachedValues()
@@ -554,16 +553,11 @@ void XclImpSupbook::LoadCachedValues()
ScExternalRefManager* pRefMgr = GetRoot().GetDoc().GetExternalRefManager();
sal_uInt16 nFileId = pRefMgr->getExternalFileId(aAbsUrl);
- sal_uInt16 nCount = static_cast< sal_uInt16 >( maSupbTabList.Count() );
- for (sal_uInt16 i = 0; i < nCount; ++i)
+ for (XclImpSupbookTabList::iterator itTab = maSupbTabList.begin(); itTab != maSupbTabList.end(); ++itTab)
{
- XclImpSupbookTab* pTab = maSupbTabList.GetObject(i);
- if (!pTab)
- return;
-
- const String& rTabName = pTab->GetTabName();
+ const String& rTabName = itTab->GetTabName();
ScExternalRefCache::TableTypeRef pCacheTable = pRefMgr->getCacheTable(nFileId, rTabName, true);
- pTab->LoadCachedValues(pCacheTable);
+ itTab->LoadCachedValues(pCacheTable);
pCacheTable->setWholeTableCached();
}
}
@@ -597,25 +591,25 @@ void XclImpLinkManagerImpl::ReadExternsheet( XclImpStream& rStrm )
void XclImpLinkManagerImpl::ReadSupbook( XclImpStream& rStrm )
{
- maSupbookList.Append( new XclImpSupbook( rStrm ) );
+ maSupbookList.push_back( new XclImpSupbook( rStrm ) );
}
void XclImpLinkManagerImpl::ReadXct( XclImpStream& rStrm )
{
- if( XclImpSupbook* pSupbook = maSupbookList.Last() )
- pSupbook->ReadXct( rStrm );
+ if( !maSupbookList.empty() )
+ maSupbookList.back().ReadXct( rStrm );
}
void XclImpLinkManagerImpl::ReadCrn( XclImpStream& rStrm )
{
- if( XclImpSupbook* pSupbook = maSupbookList.Last() )
- pSupbook->ReadCrn( rStrm );
+ if( !maSupbookList.empty() )
+ maSupbookList.back().ReadCrn( rStrm );
}
void XclImpLinkManagerImpl::ReadExternname( XclImpStream& rStrm, ExcelToSc* pFormulaConv )
{
- if( XclImpSupbook* pSupbook = maSupbookList.Last() )
- pSupbook->ReadExternname( rStrm, pFormulaConv );
+ if( !maSupbookList.empty() )
+ maSupbookList.back().ReadExternname( rStrm, pFormulaConv );
}
bool XclImpLinkManagerImpl::IsSelfRef( sal_uInt16 nXtiIndex ) const
@@ -629,7 +623,7 @@ bool XclImpLinkManagerImpl::GetScTabRange(
{
if( const XclImpXti* pXti = GetXti( nXtiIndex ) )
{
- if (maSupbookList.GetObject(pXti->mnSupbook))
+ if (!maSupbookList.empty() && (pXti->mnSupbook < maSupbookList.size()) )
{
rnFirstScTab = pXti->mnSBTabFirst;
rnLastScTab = pXti->mnSBTabLast;
@@ -678,21 +672,20 @@ const XclImpXti* XclImpLinkManagerImpl::GetXti( sal_uInt16 nXtiIndex ) const
const XclImpSupbook* XclImpLinkManagerImpl::GetSupbook( sal_uInt16 nXtiIndex ) const
{
+ if ( maSupbookList.empty() )
+ return NULL;
const XclImpXti* pXti = GetXti( nXtiIndex );
- return pXti ? maSupbookList.GetObject( pXti->mnSupbook ) : 0;
+ if (!pXti || pXti->mnSupbook >= maSupbookList.size())
+ return NULL;
+ return &(maSupbookList.at( pXti->mnSupbook ));
}
void XclImpLinkManagerImpl::LoadCachedValues()
{
// Read all CRN records which can be accessed via XclImpSupbook, and store
// the cached values to the external reference manager.
-
- sal_uInt32 nCount = maSupbookList.Count();
- for (sal_uInt16 nSupbook = 0; nSupbook < nCount; ++nSupbook)
- {
- XclImpSupbook* pSupbook = maSupbookList.GetObject(nSupbook);
- pSupbook->LoadCachedValues();
- }
+ for (XclImpSupbookList::iterator itSupbook = maSupbookList.begin(); itSupbook != maSupbookList.end(); ++itSupbook)
+ itSupbook->LoadCachedValues();
}
// ============================================================================
commit d6a96090bd4d2e4e1c6d70fb69d7336dd4f95892
Author: Nigel Hawkins <n.hawkins at gmx.com>
Date: Thu Dec 16 16:09:31 2010 +0000
Remove ScfDelList in xicontent
diff --git a/sc/source/filter/excel/xicontent.cxx b/sc/source/filter/excel/xicontent.cxx
index 98f93df..b6a84d4 100644
--- a/sc/source/filter/excel/xicontent.cxx
+++ b/sc/source/filter/excel/xicontent.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -666,23 +666,23 @@ XclImpCondFormatManager::XclImpCondFormatManager( const XclImpRoot& rRoot ) :
void XclImpCondFormatManager::ReadCondfmt( XclImpStream& rStrm )
{
- XclImpCondFormat* pFmt = new XclImpCondFormat( GetRoot(), maCondFmtList.Count() );
+ XclImpCondFormat* pFmt = new XclImpCondFormat( GetRoot(), maCondFmtList.size() );
pFmt->ReadCondfmt( rStrm );
- maCondFmtList.Append( pFmt );
+ maCondFmtList.push_back( pFmt );
}
void XclImpCondFormatManager::ReadCF( XclImpStream& rStrm )
{
- DBG_ASSERT( !maCondFmtList.Empty(), "XclImpCondFormatManager::ReadCF - CF without leading CONDFMT" );
- if( !maCondFmtList.Empty() )
- maCondFmtList.GetObject( maCondFmtList.Count() - 1 )->ReadCF( rStrm );
+ DBG_ASSERT( !maCondFmtList.empty(), "XclImpCondFormatManager::ReadCF - CF without leading CONDFMT" );
+ if( !maCondFmtList.empty() )
+ maCondFmtList.back().ReadCF( rStrm );
}
void XclImpCondFormatManager::Apply()
{
- for( XclImpCondFormat* pFmt = maCondFmtList.First(); pFmt; pFmt = maCondFmtList.Next() )
- pFmt->Apply();
- maCondFmtList.Clear();
+ for( XclImpCondFmtList::iterator itFmt = maCondFmtList.begin(); itFmt != maCondFmtList.end(); ++itFmt )
+ itFmt->Apply();
+ maCondFmtList.clear();
}
// Data Validation ============================================================
@@ -987,7 +987,7 @@ void XclImpWebQueryBuffer::ReadQsi( XclImpStream& rStrm )
{
ScRange aRange;
if( pRangeData->IsReference( aRange ) )
- maWQList.Append( new XclImpWebQuery( aRange ) );
+ maWQList.push_back( new XclImpWebQuery( aRange ) );
}
}
}
@@ -999,34 +999,34 @@ void XclImpWebQueryBuffer::ReadQsi( XclImpStream& rStrm )
void XclImpWebQueryBuffer::ReadParamqry( XclImpStream& rStrm )
{
- if( XclImpWebQuery* pQuery = maWQList.Last() )
- pQuery->ReadParamqry( rStrm );
+ if (!maWQList.empty())
+ maWQList.back().ReadParamqry( rStrm );
}
void XclImpWebQueryBuffer::ReadWqstring( XclImpStream& rStrm )
{
- if( XclImpWebQuery* pQuery = maWQList.Last() )
- pQuery->ReadWqstring( rStrm );
+ if (!maWQList.empty())
+ maWQList.back().ReadWqstring( rStrm );
}
void XclImpWebQueryBuffer::ReadWqsettings( XclImpStream& rStrm )
{
- if( XclImpWebQuery* pQuery = maWQList.Last() )
- pQuery->ReadWqsettings( rStrm );
+ if (!maWQList.empty())
+ maWQList.back().ReadWqsettings( rStrm );
}
void XclImpWebQueryBuffer::ReadWqtables( XclImpStream& rStrm )
{
- if( XclImpWebQuery* pQuery = maWQList.Last() )
- pQuery->ReadWqtables( rStrm );
+ if (!maWQList.empty())
+ maWQList.back().ReadWqtables( rStrm );
}
void XclImpWebQueryBuffer::Apply()
{
ScDocument& rDoc = GetDoc();
String aFilterName( RTL_CONSTASCII_USTRINGPARAM( EXC_WEBQRY_FILTER ) );
- for( XclImpWebQuery* pQuery = maWQList.First(); pQuery; pQuery = maWQList.Next() )
- pQuery->Apply( rDoc, aFilterName );
+ for( XclImpWebQueryList::iterator itQuery = maWQList.begin(); itQuery != maWQList.end(); ++itQuery )
+ itQuery->Apply( rDoc, aFilterName );
}
// Decryption =================================================================
@@ -1227,7 +1227,7 @@ void XclImpSheetProtectBuffer::ReadOptions( XclImpStream& rStrm, SCTAB nTab )
{
rStrm.Ignore(12);
- // feature type can be either 2 or 4. If 2, this record stores flag for
+ // feature type can be either 2 or 4. If 2, this record stores flag for
// enhanced protection, whereas if 4 it stores flag for smart tag.
sal_uInt16 nFeatureType;
rStrm >> nFeatureType;
@@ -1237,7 +1237,7 @@ void XclImpSheetProtectBuffer::ReadOptions( XclImpStream& rStrm, SCTAB nTab )
rStrm.Ignore(1); // always 1
- // The flag size specifies the size of bytes that follows that stores
+ // The flag size specifies the size of bytes that follows that stores
// feature data. If -1 it depends on the feature type imported earlier.
// For enhanced protection data, the size is always 4. For the most xls
// documents out there this value is almost always -1.
@@ -1246,7 +1246,7 @@ void XclImpSheetProtectBuffer::ReadOptions( XclImpStream& rStrm, SCTAB nTab )
if (nFlagSize != -1)
return;
- // There are actually 4 bytes to read, but the upper 2 bytes currently
+ // There are actually 4 bytes to read, but the upper 2 bytes currently
// don't store any bits.
sal_uInt16 nOptions;
rStrm >> nOptions;
diff --git a/sc/source/filter/inc/xicontent.hxx b/sc/source/filter/inc/xicontent.hxx
index 5002e97..31a62ab 100644
--- a/sc/source/filter/inc/xicontent.hxx
+++ b/sc/source/filter/inc/xicontent.hxx
@@ -172,7 +172,7 @@ public:
void Apply();
private:
- typedef ScfDelList< XclImpCondFormat > XclImpCondFmtList;
+ typedef boost::ptr_vector< XclImpCondFormat > XclImpCondFmtList;
XclImpCondFmtList maCondFmtList; /// List with all conditional formattings.
};
@@ -262,7 +262,7 @@ public:
void Apply();
private:
- typedef ScfDelList< XclImpWebQuery > XclImpWebQueryList;
+ typedef boost::ptr_vector< XclImpWebQuery > XclImpWebQueryList;
XclImpWebQueryList maWQList; /// List of the web query objects.
};
commit 64f8f833e4285119f86dcf1ffc2071030d41ecca
Author: Kohei Yoshida <kyoshida at novell.com>
Date: Mon Dec 20 23:00:31 2010 -0500
ptr_vector never stores NULL pointers.
Since ptr_vector doesn't allow storing NULL pointers, there is no
need to check for NULL values on pointers obtained from it.
diff --git a/sc/source/filter/excel/xestyle.cxx b/sc/source/filter/excel/xestyle.cxx
index a28f8b1..0f6ddf5 100644
--- a/sc/source/filter/excel/xestyle.cxx
+++ b/sc/source/filter/excel/xestyle.cxx
@@ -711,7 +711,7 @@ sal_uInt32 XclExpPaletteImpl::GetNearestListColor( sal_uInt32 nIndex ) const
if (nIndex >= mxColorList->size())
return 0;
XclListColor* pEntry = &(mxColorList->at( nIndex ));
- return pEntry ? GetNearestListColor( pEntry->GetColor(), nIndex ) : 0;
+ return GetNearestListColor( pEntry->GetColor(), nIndex );
}
sal_Int32 XclExpPaletteImpl::GetNearestPaletteColor(
commit 820b6c9b853780830e4cfe840855f841568820f9
Author: Nigel Hawkins <n.hawkins at gmx.com>
Date: Thu Dec 16 14:58:51 2010 +0000
Remove ScfDelList in xestyle.cxx
diff --git a/sc/source/filter/excel/xestyle.cxx b/sc/source/filter/excel/xestyle.cxx
index 5d89f15..a28f8b1 100644
--- a/sc/source/filter/excel/xestyle.cxx
+++ b/sc/source/filter/excel/xestyle.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -58,6 +58,7 @@
#include "xestring.hxx"
#include <oox/core/tokens.hxx>
+#include <boost/ptr_container/ptr_vector.hpp>
using ::rtl::OString;
using ::rtl::OUString;
@@ -313,7 +314,7 @@ private:
const Color& rColor ) const;
private:
- typedef ScfDelList< XclListColor > XclListColorList;
+ typedef boost::ptr_vector< XclListColor > XclListColorList;
typedef boost::shared_ptr< XclListColorList > XclListColorListRef;
typedef ::std::vector< XclColorIdData > XclColorIdDataVec;
typedef ::std::vector< XclPaletteColor > XclPaletteColorVec;
@@ -367,28 +368,28 @@ void XclExpPaletteImpl::Finalize()
{
// --- build initial color ID data vector (maColorIdDataVec) ---
- sal_uInt32 nCount = mxColorList->Count();
+ sal_uInt32 nCount = mxColorList->size();
maColorIdDataVec.resize( nCount );
for( sal_uInt32 nIdx = 0; nIdx < nCount; ++nIdx )
{
- XclListColor* pListColor = mxColorList->GetObject( nIdx );
- maColorIdDataVec[ pListColor->GetColorId() ].Set( pListColor->GetColor(), nIdx );
+ const XclListColor& listColor = mxColorList->at( nIdx );
+ maColorIdDataVec[ listColor.GetColorId() ].Set( listColor.GetColor(), nIdx );
}
// --- loop as long as current color count does not fit into palette of current BIFF ---
// phase 1: raw reduction (performance reasons, #i36945#)
sal_uInt32 nPass = 0;
- while( mxColorList->Count() > EXC_PAL_MAXRAWSIZE )
+ while( mxColorList->size() > EXC_PAL_MAXRAWSIZE )
RawReducePalette( nPass++ );
// phase 2: precise reduction using advanced color merging based on color weighting
- while( mxColorList->Count() > mrDefPal.GetColorCount() )
+ while( mxColorList->size() > mrDefPal.GetColorCount() )
ReduceLeastUsedColor();
// --- #104865# use default palette and replace colors with nearest used colors ---
- nCount = mxColorList->Count();
+ nCount = mxColorList->size();
XclRemapVec aRemapVec( nCount );
XclNearestVec aNearestVec( nCount );
@@ -399,7 +400,7 @@ void XclExpPaletteImpl::Finalize()
// find nearest unused default color for each unprocessed list color
for( nIndex = 0; nIndex < nCount; ++nIndex )
aNearestVec[ nIndex ].mnDist = aRemapVec[ nIndex ].mbProcessed ? SAL_MAX_INT32 :
- GetNearestPaletteColor( aNearestVec[ nIndex ].mnPalIndex, mxColorList->GetObject( nIndex )->GetColor(), true );
+ GetNearestPaletteColor( aNearestVec[ nIndex ].mnPalIndex, mxColorList->at( nIndex ).GetColor(), true );
// find the list color which is nearest to a default color
sal_uInt32 nFound = 0;
for( nIndex = 1; nIndex < nCount; ++nIndex )
@@ -407,9 +408,9 @@ void XclExpPaletteImpl::Finalize()
nFound = nIndex;
// replace default color with list color
sal_uInt32 nNearest = aNearestVec[ nFound ].mnPalIndex;
- DBG_ASSERT( mxColorList->GetObject( nFound ), "XclExpPaletteImpl::Finalize - missing a color" );
+ DBG_ASSERT( mxColorList->at( nFound ), "XclExpPaletteImpl::Finalize - missing a color" );
DBG_ASSERT( nNearest < maPalette.size(), "XclExpPaletteImpl::Finalize - algorithm error" );
- maPalette[ nNearest ].SetColor( mxColorList->GetObject( nFound )->GetColor() );
+ maPalette[ nNearest ].SetColor( mxColorList->at( nFound ).GetColor() );
aRemapVec[ nFound ].SetIndex( nNearest );
}
@@ -528,20 +529,24 @@ const Color& XclExpPaletteImpl::GetOriginalColor( sal_uInt32 nColorId ) const
XclListColor* XclExpPaletteImpl::SearchListEntry( const Color& rColor, sal_uInt32& rnIndex )
{
rnIndex = mnLastIdx;
- XclListColor* pEntry = mxColorList->GetObject( rnIndex );
+ XclListColor* pEntry;
// search optimization for equal-colored objects occuring repeatedly
- if( pEntry && (pEntry->GetColor() == rColor) )
- return pEntry;
+ if (rnIndex < mxColorList->size())
+ {
+ pEntry = &(mxColorList->at( rnIndex ));
+ if( pEntry->GetColor() == rColor )
+ return pEntry;
+ }
// binary search for color
sal_uInt32 nBegIdx = 0;
- sal_uInt32 nEndIdx = mxColorList->Count();
+ sal_uInt32 nEndIdx = mxColorList->size();
bool bFound = false;
while( !bFound && (nBegIdx < nEndIdx) )
{
rnIndex = (nBegIdx + nEndIdx) / 2;
- pEntry = mxColorList->GetObject( rnIndex );
+ pEntry = &(mxColorList->at( rnIndex ));
bFound = pEntry->GetColor() == rColor;
if( !bFound )
{
@@ -553,7 +558,7 @@ XclListColor* XclExpPaletteImpl::SearchListEntry( const Color& rColor, sal_uInt3
}
// not found - use end of range as new insertion position
if( !bFound )
- pEntry = mxColorList->GetObject( rnIndex = nEndIdx );
+ pEntry = &(mxColorList->at( rnIndex = nEndIdx ));
mnLastIdx = rnIndex;
return pEntry;
@@ -561,8 +566,8 @@ XclListColor* XclExpPaletteImpl::SearchListEntry( const Color& rColor, sal_uInt3
XclListColor* XclExpPaletteImpl::CreateListEntry( const Color& rColor, sal_uInt32 nIndex )
{
- XclListColor* pEntry = new XclListColor( rColor, mxColorList->Count() );
- mxColorList->Insert( pEntry, nIndex );
+ XclListColor* pEntry = new XclListColor( rColor, mxColorList->size() );
+ mxColorList->insert( mxColorList->begin() + nIndex, pEntry );
return pEntry;
}
@@ -584,7 +589,7 @@ void XclExpPaletteImpl::RawReducePalette( sal_uInt32 nPass )
// maps old list indexes to new list indexes, used to update maColorIdDataVec
ScfUInt32Vec aListIndexMap;
- aListIndexMap.reserve( xOldList->Count() );
+ aListIndexMap.reserve( xOldList->size() );
// preparations
sal_uInt8 nR, nG, nB;
@@ -598,10 +603,10 @@ void XclExpPaletteImpl::RawReducePalette( sal_uInt32 nPass )
sal_uInt8 nFactor3 = static_cast< sal_uInt8 >( 0x40 >> nPass );
// process each color in the old color list
- for( sal_uInt32 nIdx = 0, nCount = xOldList->Count(); nIdx < nCount; ++nIdx )
+ for( sal_uInt32 nIdx = 0, nCount = xOldList->size(); nIdx < nCount; ++nIdx )
{
// get the old list entry
- const XclListColor* pOldEntry = xOldList->GetObject( nIdx );
+ const XclListColor* pOldEntry = &(xOldList->at( nIdx ));
nR = pOldEntry->GetColor().GetRed();
nG = pOldEntry->GetColor().GetGreen();
nB = pOldEntry->GetColor().GetBlue();
@@ -639,14 +644,14 @@ void XclExpPaletteImpl::ReduceLeastUsedColor()
sal_uInt32 nKeep = GetNearestListColor( nRemove );
// merge both colors to one color, remove one color from list
- XclListColor* pKeepEntry = mxColorList->GetObject( nKeep );
- XclListColor* pRemoveEntry = mxColorList->GetObject( nRemove );
+ XclListColor* pKeepEntry = &(mxColorList->at( nKeep ));
+ XclListColor* pRemoveEntry = &(mxColorList->at( nRemove ));
if( pKeepEntry && pRemoveEntry )
{
// merge both colors (if pKeepEntry is a base color, it will not change)
pKeepEntry->Merge( *pRemoveEntry );
// remove the less used color, adjust nKeep index if kept color follows removed color
- mxColorList->Delete( nRemove );
+ mxColorList->erase( mxColorList->begin() + nRemove );
if( nKeep > nRemove ) --nKeep;
// recalculate color ID data map (maps color IDs to color list indexes)
@@ -665,14 +670,14 @@ sal_uInt32 XclExpPaletteImpl::GetLeastUsedListColor() const
sal_uInt32 nFound = 0;
sal_uInt32 nMinW = SAL_MAX_UINT32;
- for( sal_uInt32 nIdx = 0, nCount = mxColorList->Count(); nIdx < nCount; ++nIdx )
+ for( sal_uInt32 nIdx = 0, nCount = mxColorList->size(); nIdx < nCount; ++nIdx )
{
- XclListColor* pEntry = mxColorList->GetObject( nIdx );
+ XclListColor& pEntry = mxColorList->at( nIdx );
// ignore the base colors
- if( !pEntry->IsBaseColor() && (pEntry->GetWeighting() < nMinW) )
+ if( !pEntry.IsBaseColor() && (pEntry.GetWeighting() < nMinW) )
{
nFound = nIdx;
- nMinW = pEntry->GetWeighting();
+ nMinW = pEntry.GetWeighting();
}
}
return nFound;
@@ -683,11 +688,11 @@ sal_uInt32 XclExpPaletteImpl::GetNearestListColor( const Color& rColor, sal_uInt
sal_uInt32 nFound = 0;
sal_Int32 nMinD = SAL_MAX_INT32;
- for( sal_uInt32 nIdx = 0, nCount = mxColorList->Count(); nIdx < nCount; ++nIdx )
+ for( sal_uInt32 nIdx = 0, nCount = mxColorList->size(); nIdx < nCount; ++nIdx )
{
if( nIdx != nIgnore )
{
- if( XclListColor* pEntry = mxColorList->GetObject( nIdx ) )
+ if( XclListColor* pEntry = &(mxColorList->at( nIdx )) )
{
sal_Int32 nDist = lclGetColorDistance( rColor, pEntry->GetColor() );
if( nDist < nMinD )
@@ -703,7 +708,9 @@ sal_uInt32 XclExpPaletteImpl::GetNearestListColor( const Color& rColor, sal_uInt
sal_uInt32 XclExpPaletteImpl::GetNearestListColor( sal_uInt32 nIndex ) const
{
- XclListColor* pEntry = mxColorList->GetObject( nIndex );
+ if (nIndex >= mxColorList->size())
+ return 0;
+ XclListColor* pEntry = &(mxColorList->at( nIndex ));
return pEntry ? GetNearestListColor( pEntry->GetColor(), nIndex ) : 0;
}
commit fbce87fa82716746d3f89a783d3e2e8076fb928c
Author: Kohei Yoshida <kyoshida at novell.com>
Date: Mon Dec 20 22:49:48 2010 -0500
Removed const_cast by making the method non-const.
diff --git a/sc/source/filter/ftools/fprogressbar.cxx b/sc/source/filter/ftools/fprogressbar.cxx
index d54931c..62c319e 100644
--- a/sc/source/filter/ftools/fprogressbar.cxx
+++ b/sc/source/filter/ftools/fprogressbar.cxx
@@ -80,12 +80,12 @@ void ScfProgressBar::Init( SfxObjectShell* pDocShell )
mbInProgress = false;
}
-ScfProgressBar::ScfProgressSegment* ScfProgressBar::GetSegment( sal_Int32 nSegment ) const
+ScfProgressBar::ScfProgressSegment* ScfProgressBar::GetSegment( sal_Int32 nSegment )
{
if( nSegment < 0 )
return 0;
DBG_ASSERT( maSegments.at( nSegment ), "ScfProgressBar::GetSegment - invalid segment index" );
- return const_cast<ScfProgressBar::ScfProgressSegment*>(&(maSegments.at( nSegment )));
+ return &(maSegments.at( nSegment ));
}
void ScfProgressBar::SetCurrSegment( ScfProgressSegment* pSegment )
diff --git a/sc/source/filter/inc/fprogressbar.hxx b/sc/source/filter/inc/fprogressbar.hxx
index 2b231f0..3828327 100644
--- a/sc/source/filter/inc/fprogressbar.hxx
+++ b/sc/source/filter/inc/fprogressbar.hxx
@@ -155,7 +155,7 @@ private:
void Init( SfxObjectShell* pDocShell );
/** Returns the segment specified by list index. */
- ScfProgressSegment* GetSegment( sal_Int32 nSegment ) const;
+ ScfProgressSegment* GetSegment( sal_Int32 nSegment );
/** Activates progress bar and sets current segment. */
void SetCurrSegment( ScfProgressSegment* pSegment );
/** Increases mnTotalPos and calls the system progress bar. */
commit d9d22d0c565b0aea95e1442361d28f7d9a01f191
Author: Nigel Hawkins <n.hawkins at gmx.com>
Date: Wed Dec 15 18:02:17 2010 +0000
Remove ScfDelList in fprogressbar
diff --git a/sc/source/filter/ftools/fprogressbar.cxx b/sc/source/filter/ftools/fprogressbar.cxx
index d69559a..d54931c 100644
--- a/sc/source/filter/ftools/fprogressbar.cxx
+++ b/sc/source/filter/ftools/fprogressbar.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -84,8 +84,8 @@ ScfProgressBar::ScfProgressSegment* ScfProgressBar::GetSegment( sal_Int32 nSegme
{
if( nSegment < 0 )
return 0;
- DBG_ASSERT( maSegments.GetObject( nSegment ), "ScfProgressBar::GetSegment - invalid segment index" );
- return maSegments.GetObject( nSegment );
+ DBG_ASSERT( maSegments.at( nSegment ), "ScfProgressBar::GetSegment - invalid segment index" );
+ return const_cast<ScfProgressBar::ScfProgressSegment*>(&(maSegments.at( nSegment )));
}
void ScfProgressBar::SetCurrSegment( ScfProgressSegment* pSegment )
@@ -155,9 +155,9 @@ sal_Int32 ScfProgressBar::AddSegment( sal_Size nSize )
if( nSize == 0 )
return SCF_INV_SEGMENT;
- maSegments.Append( new ScfProgressSegment( nSize ) );
+ maSegments.push_back( new ScfProgressSegment( nSize ) );
mnTotalSize += nSize;
- return static_cast< sal_Int32 >( maSegments.Count() - 1 );
+ return static_cast< sal_Int32 >( maSegments.size() - 1 );
}
ScfProgressBar& ScfProgressBar::GetSegmentProgressBar( sal_Int32 nSegment )
diff --git a/sc/source/filter/inc/fprogressbar.hxx b/sc/source/filter/inc/fprogressbar.hxx
index 11e0657..2b231f0 100644
--- a/sc/source/filter/inc/fprogressbar.hxx
+++ b/sc/source/filter/inc/fprogressbar.hxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -30,6 +30,7 @@
#define SC_FPROGRESSBAR_HXX
#include <boost/noncopyable.hpp>
+#include <boost/ptr_container/ptr_vector.hpp>
#include "globstr.hrc"
#include "ftools.hxx"
#include "scdllapi.h"
@@ -174,8 +175,8 @@ private:
~ScfProgressSegment();
};
- typedef ::std::auto_ptr< ScProgress > ScProgressPtr;
- typedef ScfDelList< ScfProgressSegment > ScfSegmentList;
+ typedef ::std::auto_ptr< ScProgress > ScProgressPtr;
+ typedef boost::ptr_vector< ScfProgressSegment > ScfSegmentList;
ScfSegmentList maSegments; /// List of progress segments.
String maText; /// UI string for system progress.
commit 3509c40a0ac26d317b7e6512f3c41eb1c6f84ce5
Author: Nigel Hawkins <n.hawkins at gmx.com>
Date: Wed Dec 15 15:51:49 2010 +0000
Remove ScfDelList in imp_op
diff --git a/sc/source/filter/excel/impop.cxx b/sc/source/filter/excel/impop.cxx
index 28aa5b4..018e4c7 100644
--- a/sc/source/filter/excel/impop.cxx
+++ b/sc/source/filter/excel/impop.cxx
@@ -1168,11 +1168,11 @@ void ImportExcel::NeueTabelle( void )
InitializeTable( nTab );
- pOutlineListBuffer->Append( new XclImpOutlineDataBuffer( GetRoot(), nTab ) );
-
- pExcRoot->pColRowBuff = pColRowBuff = pOutlineListBuffer->Last()->GetColRowBuff();
- pColOutlineBuff = pOutlineListBuffer->Last()->GetColOutline();
- pRowOutlineBuff = pOutlineListBuffer->Last()->GetRowOutline();
+ XclImpOutlineDataBuffer* pNewItem = new XclImpOutlineDataBuffer( GetRoot(), nTab );
+ pOutlineListBuffer->push_back( pNewItem );
+ pExcRoot->pColRowBuff = pColRowBuff = pNewItem->GetColRowBuff();
+ pColOutlineBuff = pNewItem->GetColOutline();
+ pRowOutlineBuff = pNewItem->GetRowOutline();
}
@@ -1202,8 +1202,8 @@ void ImportExcel::PostDocLoad( void )
pStyleSheet->GetItemSet().Put( SfxUInt16Item( ATTR_PAGE_FIRSTPAGENO, 0 ) );
// outlines for all sheets, sets hidden rows and columns (#i11776# after filtered ranges)
- for( XclImpOutlineDataBuffer* pBuffer = pOutlineListBuffer->First(); pBuffer; pBuffer = pOutlineListBuffer->Next() )
- pBuffer->Convert();
+ for (XclImpOutlineListBuffer::iterator itBuffer = pOutlineListBuffer->begin(); itBuffer != pOutlineListBuffer->end(); ++itBuffer)
+ itBuffer->Convert();
// document view settings (before visible OLE area)
GetDocViewSettings().Finalize();
diff --git a/sc/source/filter/inc/imp_op.hxx b/sc/source/filter/inc/imp_op.hxx
index f45d580..7761177 100644
--- a/sc/source/filter/inc/imp_op.hxx
+++ b/sc/source/filter/inc/imp_op.hxx
@@ -40,6 +40,7 @@
#include "colrowst.hxx"
#include "excdefs.hxx"
#include <boost/shared_ptr.hpp>
+#include <boost/ptr_container/ptr_vector.hpp>
class SfxItemSet;
@@ -108,7 +109,7 @@ protected:
XclImpOutlineBuffer* pRowOutlineBuff;
XclImpColRowSettings* pColRowBuff; // Col/Row-Einstellungen 1 Tabelle
- typedef ScfDelList< XclImpOutlineDataBuffer > XclImpOutlineListBuffer;
+ typedef boost::ptr_vector< XclImpOutlineDataBuffer > XclImpOutlineListBuffer;
XclImpOutlineListBuffer* pOutlineListBuffer;
sal_Int16 mnLastRefIdx;
commit f2048e9c9e3b232ff8d48977eb96eeb01ca0fe58
Author: Nigel Hawkins <n.hawkins at gmx.com>
Date: Tue Dec 14 14:36:30 2010 +0000
Remove ScfDelList in xihelper
diff --git a/sc/source/filter/excel/xihelper.cxx b/sc/source/filter/excel/xihelper.cxx
index bb17cc6..af76096 100644
--- a/sc/source/filter/excel/xihelper.cxx
+++ b/sc/source/filter/excel/xihelper.cxx
@@ -845,7 +845,7 @@ XclImpCachedMatrix::XclImpCachedMatrix( XclImpStream& rStrm ) :
for( SCSIZE nScRow = 0; nScRow < mnScRows; ++nScRow )
for( SCSIZE nScCol = 0; nScCol < mnScCols; ++nScCol )
- maValueList.Append( new XclImpCachedValue( rStrm ) );
+ maValueList.push_back( new XclImpCachedValue( rStrm ) );
}
XclImpCachedMatrix::~XclImpCachedMatrix()
@@ -855,38 +855,38 @@ XclImpCachedMatrix::~XclImpCachedMatrix()
ScMatrixRef XclImpCachedMatrix::CreateScMatrix() const
{
ScMatrixRef xScMatrix;
- DBG_ASSERT( mnScCols * mnScRows == maValueList.Count(), "XclImpCachedMatrix::CreateScMatrix - element count mismatch" );
- if( mnScCols && mnScRows && static_cast< ULONG >( mnScCols * mnScRows ) <= maValueList.Count() )
+ DBG_ASSERT( mnScCols * mnScRows == maValueList.size(), "XclImpCachedMatrix::CreateScMatrix - element count mismatch" );
+ if( mnScCols && mnScRows && static_cast< ULONG >( mnScCols * mnScRows ) <= maValueList.size() )
{
xScMatrix = new ScMatrix( mnScCols, mnScRows );
- const XclImpCachedValue* pValue = maValueList.First();
+ XclImpValueList::const_iterator itValue = maValueList.begin();
for( SCSIZE nScRow = 0; nScRow < mnScRows; ++nScRow )
{
for( SCSIZE nScCol = 0; nScCol < mnScCols; ++nScCol )
{
- switch( pValue->GetType() )
+ switch( itValue->GetType() )
{
case EXC_CACHEDVAL_EMPTY:
// Excel shows 0.0 here, not an empty cell
xScMatrix->PutEmpty( nScCol, nScRow );
break;
case EXC_CACHEDVAL_DOUBLE:
- xScMatrix->PutDouble( pValue->GetValue(), nScCol, nScRow );
+ xScMatrix->PutDouble( itValue->GetValue(), nScCol, nScRow );
break;
case EXC_CACHEDVAL_STRING:
- xScMatrix->PutString( pValue->GetString(), nScCol, nScRow );
+ xScMatrix->PutString( itValue->GetString(), nScCol, nScRow );
break;
case EXC_CACHEDVAL_BOOL:
- xScMatrix->PutBoolean( pValue->GetBool(), nScCol, nScRow );
+ xScMatrix->PutBoolean( itValue->GetBool(), nScCol, nScRow );
break;
case EXC_CACHEDVAL_ERROR:
- xScMatrix->PutError( pValue->GetScError(), nScCol, nScRow );
+ xScMatrix->PutError( itValue->GetScError(), nScCol, nScRow );
break;
default:
DBG_ERRORFILE( "XclImpCachedMatrix::CreateScMatrix - unknown value type" );
xScMatrix->PutEmpty( nScCol, nScRow );
}
- pValue = maValueList.Next();
+ ++itValue;
}
}
}
diff --git a/sc/source/filter/inc/xihelper.hxx b/sc/source/filter/inc/xihelper.hxx
index 06aac7d..278d601 100644
--- a/sc/source/filter/inc/xihelper.hxx
+++ b/sc/source/filter/inc/xihelper.hxx
@@ -32,6 +32,7 @@
#include <editeng/editdata.hxx>
#include <boost/noncopyable.hpp>
#include <boost/shared_ptr.hpp>
+#include <boost/ptr_container/ptr_vector.hpp>
#include "scmatrix.hxx"
#include "xladdress.hxx"
#include "xiroot.hxx"
@@ -347,7 +348,7 @@ public:
ScMatrixRef CreateScMatrix() const;
private:
- typedef ScfDelList< XclImpCachedValue > XclImpValueList;
+ typedef boost::ptr_vector< XclImpCachedValue > XclImpValueList;
XclImpValueList maValueList; /// List of cached cell values.
SCSIZE mnScCols; /// Number of cached columns.
commit 88cf93a5a68a11cabaa66b5c4355e60fa9266851
Author: Nigel Hawkins <n.hawkins at gmx.com>
Date: Tue Dec 14 13:55:44 2010 +0000
Remove ScfDelList in xiname
diff --git a/sc/source/filter/excel/xiname.cxx b/sc/source/filter/excel/xiname.cxx
index 111f9da..a8994fa 100644
--- a/sc/source/filter/excel/xiname.cxx
+++ b/sc/source/filter/excel/xiname.cxx
@@ -256,23 +256,23 @@ XclImpNameManager::XclImpNameManager( const XclImpRoot& rRoot ) :
void XclImpNameManager::ReadName( XclImpStream& rStrm )
{
- ULONG nCount = maNameList.Count();
+ ULONG nCount = maNameList.size();
if( nCount < 0xFFFF )
- maNameList.Append( new XclImpName( rStrm, static_cast< sal_uInt16 >( nCount + 1 ) ) );
+ maNameList.push_back( new XclImpName( rStrm, static_cast< sal_uInt16 >( nCount + 1 ) ) );
}
const XclImpName* XclImpNameManager::FindName( const String& rXclName, SCTAB nScTab ) const
{
const XclImpName* pGlobalName = 0; // a found global name
const XclImpName* pLocalName = 0; // a found local name
- for( const XclImpName* pName = maNameList.First(); pName && !pLocalName; pName = maNameList.Next() )
+ for( XclImpNameList::const_iterator itName = maNameList.begin(); itName != maNameList.end() && !pLocalName; ++itName )
{
- if( pName->GetXclName() == rXclName )
+ if( itName->GetXclName() == rXclName )
{
- if( pName->GetScTab() == nScTab )
- pLocalName = pName;
- else if( pName->IsGlobal() )
- pGlobalName = pName;
+ if( itName->GetScTab() == nScTab )
+ pLocalName = &(*itName);
+ else if( itName->IsGlobal() )
+ pGlobalName = &(*itName);
}
}
return pLocalName ? pLocalName : pGlobalName;
@@ -281,7 +281,7 @@ const XclImpName* XclImpNameManager::FindName( const String& rXclName, SCTAB nSc
const XclImpName* XclImpNameManager::GetName( sal_uInt16 nXclNameIdx ) const
{
DBG_ASSERT( nXclNameIdx > 0, "XclImpNameManager::GetName - index must be >0" );
- return maNameList.GetObject( nXclNameIdx - 1 );
+ return &(maNameList.at( nXclNameIdx - 1 ));
}
// ============================================================================
diff --git a/sc/source/filter/inc/xiname.hxx b/sc/source/filter/inc/xiname.hxx
index c31e654..7c5ab98 100644
--- a/sc/source/filter/inc/xiname.hxx
+++ b/sc/source/filter/inc/xiname.hxx
@@ -29,7 +29,7 @@
#ifndef SC_XINAME_HXX
#define SC_XINAME_HXX
-#include <map>
+#include <boost/ptr_container/ptr_vector.hpp>
#include "xlname.hxx"
#include "xiroot.hxx"
@@ -91,7 +91,7 @@ public:
const XclImpName* GetName( sal_uInt16 nXclNameIdx ) const;
private:
- typedef ScfDelList< XclImpName > XclImpNameList;
+ typedef boost::ptr_vector< XclImpName > XclImpNameList;
XclImpNameList maNameList;
};
More information about the Libreoffice-commits
mailing list