Hi
Attached patch converts various places in the editeng, sc and sw modules
from using tools/table.hxx to using std::map
This patch should be easier to review, mostly because the logic using
the data structures is pretty straightforward.
The one place I was not sure of was the naming the new typedefs in
sc/inc/chartpos.hxx, mostly because I have only a vague idea what the
code is trying to accomplish.
Code is contributed under MPL+/LGPL+/GPL+
Regards, Noel Grandin
Disclaimer: http://www.peralex.com/disclaimer.html
diff --git a/editeng/inc/editeng/forbiddencharacterstable.hxx
b/editeng/inc/editeng/forbiddencharacterstable.hxx
index 5d499e8..1a9b5d4 100644
--- a/editeng/inc/editeng/forbiddencharacterstable.hxx
+++ b/editeng/inc/editeng/forbiddencharacterstable.hxx
@@ -29,8 +29,7 @@
#ifndef _FORBIDDENCHARACTERSTABLE_HXX
#define _FORBIDDENCHARACTERSTABLE_HXX
-#include <tools/table.hxx>
-
+#include <map>
#include <salhelper/simplereferenceobject.hxx>
#include <com/sun/star/uno/Reference.hxx>
#include <com/sun/star/i18n/ForbiddenCharacters.hpp>
@@ -49,18 +48,22 @@ struct ForbiddenCharactersInfo
sal_Bool bTemporary;
};
-DECLARE_TABLE( SvxForbiddenCharactersTableImpl, ForbiddenCharactersInfo* )
-class EDITENG_DLLPUBLIC SvxForbiddenCharactersTable : public SvxForbiddenCharactersTableImpl,
public salhelper::SimpleReferenceObject
+class EDITENG_DLLPUBLIC SvxForbiddenCharactersTable : public salhelper::SimpleReferenceObject
{
+public:
+ typedef std::map<int, ForbiddenCharactersInfo*> CharInfoMap;
private:
+ CharInfoMap maCharInfoMap;
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMSF;
public:
- SvxForbiddenCharactersTable( ::com::sun::star::uno::Reference<
::com::sun::star::lang::XMultiServiceFactory > xMSF, sal_uInt16 nISize = 4, sal_uInt16 nGrow = 4 );
- ~SvxForbiddenCharactersTable();
+ SvxForbiddenCharactersTable( ::com::sun::star::uno::Reference<
::com::sun::star::lang::XMultiServiceFactory > xMSF );
+ ~SvxForbiddenCharactersTable();
+
+ inline CharInfoMap& Map() { return maCharInfoMap; }
- const com::sun::star::i18n::ForbiddenCharacters* GetForbiddenCharacters( sal_uInt16 nLanuage,
sal_Bool bGetDefault ) const;
+ const com::sun::star::i18n::ForbiddenCharacters* GetForbiddenCharacters( sal_uInt16 nLanuage,
sal_Bool bGetDefault );
void SetForbiddenCharacters( sal_uInt16 nLanuage , const
com::sun::star::i18n::ForbiddenCharacters& );
void ClearForbiddenCharacters( sal_uInt16 nLanuage );
};
diff --git a/editeng/inc/editeng/svxrtf.hxx b/editeng/inc/editeng/svxrtf.hxx
index c79f2bd..fb319c2 100644
--- a/editeng/inc/editeng/svxrtf.hxx
+++ b/editeng/inc/editeng/svxrtf.hxx
@@ -29,7 +29,6 @@
#ifndef _SVXRTF_HXX
#define _SVXRTF_HXX
-#include <tools/table.hxx>
#include <tools/string.hxx>
#include <svl/itemset.hxx>
#include <svtools/parrtf.hxx>
@@ -39,6 +38,7 @@
#include <deque>
#include <utility>
#include <vector>
+#include <map>
class Font;
class Color;
class Graphic;
@@ -85,8 +85,8 @@ public:
typedef Color* ColorPtr;
typedef std::deque< ColorPtr > SvxRTFColorTbl;
-DECLARE_TABLE( SvxRTFFontTbl, Font* )
-DECLARE_TABLE( SvxRTFStyleTbl, SvxRTFStyleType* )
+typedef std::map<int, Font*> SvxRTFFontTbl;
+typedef std::map<int, SvxRTFStyleType*> SvxRTFStyleTbl;
typedef SvxRTFItemStackType* SvxRTFItemStackTypePtr;
SV_DECL_PTRARR_DEL( SvxRTFItemStackList, SvxRTFItemStackTypePtr, 1 )
diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx
index 0161eaa0..4d41d93 100644
--- a/editeng/source/editeng/editdoc.cxx
+++ b/editeng/source/editeng/editdoc.cxx
@@ -2175,27 +2175,39 @@ SvxFontTable::SvxFontTable()
SvxFontTable::~SvxFontTable()
{
- SvxFontItem* pItem = First();
- while( pItem )
- {
- delete pItem;
- pItem = Next();
- }
+ for(FontItemMap::iterator it = maFontItemMap.begin(); it != maFontItemMap.end(); ++it)
+ {
+ delete it->second;
+ }
}
sal_uLong SvxFontTable::GetId( const SvxFontItem& rFontItem )
{
- SvxFontItem* pItem = First();
- while ( pItem )
- {
+ for(FontItemMap::iterator it = maFontItemMap.begin(); it != maFontItemMap.end(); ++it)
+ {
+ SvxFontItem* pItem = it->second;
if ( *pItem == rFontItem )
- return GetCurKey();
- pItem = Next();
- }
+ return it->first;
+ }
DBG_WARNING( "Font not found: GetId()" );
return 0;
}
+void SvxFontTable::Insert( sal_uLong nIdx, SvxFontItem *pFontItem)
+{
+ maFontItemMap[ nIdx ] = pFontItem;
+}
+
+int SvxFontTable::Count() const
+{
+ return maFontItemMap.size();
+}
+
+SvxFontItem* SvxFontTable::Get( sal_uLong nIdx )
+{
+ return maFontItemMap[ nIdx ];
+}
+
SvxColorList::SvxColorList()
{
}
diff --git a/editeng/source/editeng/editdoc.hxx b/editeng/source/editeng/editdoc.hxx
index 2b35c3e..0b23954 100644
--- a/editeng/source/editeng/editdoc.hxx
+++ b/editeng/source/editeng/editdoc.hxx
@@ -37,7 +37,6 @@
#include <svl/itemset.hxx>
#include <svl/style.hxx>
#include <svl/itempool.hxx>
-#include <tools/table.hxx>
#include <vector>
#include <deque>
@@ -141,15 +140,22 @@ SV_DECL_PTRARR( ContentInfoArray, ContentAttribsInfoPtr, 1 )
// ----------------------------------------------------------------------
// class SvxFontTable
// ----------------------------------------------------------------------
-DECLARE_TABLE( DummyFontTable, SvxFontItem* )
-class SvxFontTable : public DummyFontTable
+class SvxFontTable
{
public:
SvxFontTable();
~SvxFontTable();
- sal_uLong GetId( const SvxFontItem& rFont );
+ sal_uLong GetId( const SvxFontItem& rFont );
+ void Insert( sal_uLong nIdx, SvxFontItem *pFontItem);
+ int Count() const;
+ SvxFontItem* Get( sal_uLong nIdx );
+
+private:
+ typedef std::map<sal_uLong, SvxFontItem*> FontItemMap;
+ FontItemMap maFontItemMap;
+
};
// ----------------------------------------------------------------------
diff --git a/editeng/source/editeng/eertfpar.cxx b/editeng/source/editeng/eertfpar.cxx
index d508716..63bd763 100644
--- a/editeng/source/editeng/eertfpar.cxx
+++ b/editeng/source/editeng/eertfpar.cxx
@@ -371,7 +371,7 @@ void EditRTFParser::SetAttrInDoc( SvxRTFItemStackType &rSet )
if ( rSet.StyleNo() && pImpEditEngine->GetStyleSheetPool() &&
pImpEditEngine->GetStatus().DoImportRTFStyleSheets() )
{
- SvxRTFStyleType* pS = GetStyleTbl().Get( rSet.StyleNo() );
+ SvxRTFStyleType* pS = GetStyleTbl()[ rSet.StyleNo() ];
DBG_ASSERT( pS, "Template not defined in RTF!" );
if ( pS )
{
@@ -433,10 +433,12 @@ void EditRTFParser::SetAttrInDoc( SvxRTFItemStackType &rSet )
SvxRTFStyleType* EditRTFParser::FindStyleSheet( const XubString& rName )
{
- SvxRTFStyleType* pS = GetStyleTbl().First();
- while ( pS && ( pS->sName != rName ) )
- pS = GetStyleTbl().Next();
-
+ SvxRTFStyleTbl aTable = GetStyleTbl();
+ SvxRTFStyleTbl::iterator it = aTable.begin();
+ SvxRTFStyleType* pS = it->second;
+ while ( it != aTable.end() && ( (pS = it->second)->sName != rName ) )
+ ++it;
+
return pS;
}
@@ -451,7 +453,7 @@ SfxStyleSheet* EditRTFParser::CreateStyleSheet( SvxRTFStyleType* pRTFStyle )
String aParent;
if ( pRTFStyle->nBasedOn )
{
- SvxRTFStyleType* pS = GetStyleTbl().Get( pRTFStyle->nBasedOn );
+ SvxRTFStyleType* pS = GetStyleTbl()[ pRTFStyle->nBasedOn ];
if ( pS && ( pS !=pRTFStyle ) )
aParent = pS->sName;
}
@@ -484,13 +486,11 @@ void EditRTFParser::CreateStyleSheets()
// the SvxRTFParser haa now created the template...
if ( pImpEditEngine->GetStyleSheetPool() &&
pImpEditEngine->GetStatus().DoImportRTFStyleSheets() )
{
- SvxRTFStyleType* pRTFStyle = GetStyleTbl().First();
- while ( pRTFStyle )
- {
- CreateStyleSheet( pRTFStyle );
-
- pRTFStyle = GetStyleTbl().Next();
- }
+ SvxRTFStyleTbl aTable = GetStyleTbl();
+ for (SvxRTFStyleTbl::iterator it = aTable.begin(); it != aTable.end(); ++it)
+ {
+ CreateStyleSheet( it->second );
+ }
}
}
diff --git a/editeng/source/misc/forbiddencharacterstable.cxx
b/editeng/source/misc/forbiddencharacterstable.cxx
index deb8d4d..434f98b 100644
--- a/editeng/source/misc/forbiddencharacterstable.cxx
+++ b/editeng/source/misc/forbiddencharacterstable.cxx
@@ -34,8 +34,8 @@
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-SvxForbiddenCharactersTable::SvxForbiddenCharactersTable( ::com::sun::star::uno::Reference<
::com::sun::star::lang::XMultiServiceFactory > xMSF, sal_uInt16 nISize, sal_uInt16 nGrow )
- : SvxForbiddenCharactersTableImpl( nISize, nGrow )
+SvxForbiddenCharactersTable::SvxForbiddenCharactersTable( ::com::sun::star::uno::Reference<
::com::sun::star::lang::XMultiServiceFactory > xMSF )
+ : maCharInfoMap()
{
mxMSF = xMSF;
}
@@ -43,22 +43,20 @@ SvxForbiddenCharactersTable::SvxForbiddenCharactersTable( ::com::sun::star::uno:
SvxForbiddenCharactersTable::~SvxForbiddenCharactersTable()
{
- for ( sal_uLong n = Count(); n; )
- delete GetObject( --n );
+ for (CharInfoMap::iterator it = maCharInfoMap.begin(); it != maCharInfoMap.end(); ++it)
+ delete it->second;
}
-const com::sun::star::i18n::ForbiddenCharacters*
SvxForbiddenCharactersTable::GetForbiddenCharacters( sal_uInt16 nLanguage, sal_Bool bGetDefault )
const
+const com::sun::star::i18n::ForbiddenCharacters*
SvxForbiddenCharactersTable::GetForbiddenCharacters( sal_uInt16 nLanguage, sal_Bool bGetDefault )
{
- ForbiddenCharactersInfo* pInf = Get( nLanguage );
+ ForbiddenCharactersInfo* pInf = maCharInfoMap[ nLanguage ];
if ( !pInf && bGetDefault && mxMSF.is() )
{
- const SvxForbiddenCharactersTableImpl *pConstImpl = dynamic_cast<const
SvxForbiddenCharactersTableImpl*>(this);
- SvxForbiddenCharactersTableImpl* pImpl =
const_cast<SvxForbiddenCharactersTableImpl*>(pConstImpl);
- pInf = new ForbiddenCharactersInfo;
- pImpl->Insert( nLanguage, pInf );
-
+ pInf = new ForbiddenCharactersInfo;
+ maCharInfoMap[ nLanguage ] = pInf;
+
pInf->bTemporary = sal_True;
LocaleDataWrapper aWrapper( mxMSF, SvxCreateLocale( nLanguage ) );
pInf->aForbiddenChars = aWrapper.getForbiddenCharacters();
@@ -70,11 +68,11 @@ const com::sun::star::i18n::ForbiddenCharacters* SvxForbiddenCharactersTable::Ge
void SvxForbiddenCharactersTable::SetForbiddenCharacters( sal_uInt16 nLanguage, const
com::sun::star::i18n::ForbiddenCharacters& rForbiddenChars )
{
- ForbiddenCharactersInfo* pInf = Get( nLanguage );
+ ForbiddenCharactersInfo* pInf = maCharInfoMap[ nLanguage ];
if ( !pInf )
{
pInf = new ForbiddenCharactersInfo;
- Insert( nLanguage, pInf );
+ maCharInfoMap[ nLanguage ] = pInf;
}
pInf->bTemporary = sal_False;
pInf->aForbiddenChars = rForbiddenChars;
@@ -82,10 +80,10 @@ void SvxForbiddenCharactersTable::SetForbiddenCharacters( sal_uInt16 nLanguage,
void SvxForbiddenCharactersTable::ClearForbiddenCharacters( sal_uInt16 nLanguage )
{
- ForbiddenCharactersInfo* pInf = Get( nLanguage );
+ ForbiddenCharactersInfo* pInf = maCharInfoMap[ nLanguage ];
if ( pInf )
{
- Remove( nLanguage );
+ maCharInfoMap.erase( nLanguage );
delete pInf;
}
}
diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
index ac726c8..651b9eb 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -29,7 +29,6 @@
#include <com/sun/star/io/XStream.hpp>
#include <com/sun/star/lang/Locale.hpp>
#include <tools/urlobj.hxx>
-#include <tools/table.hxx>
#include <i18npool/mslangid.hxx>
#include <vcl/svapp.hxx>
#include <sot/storinfo.hxx>
diff --git a/editeng/source/rtf/svxrtf.cxx b/editeng/source/rtf/svxrtf.cxx
index 8b9d93c..d5d48fe 100644
--- a/editeng/source/rtf/svxrtf.cxx
+++ b/editeng/source/rtf/svxrtf.cxx
@@ -77,7 +77,6 @@ SvxRTFParser::SvxRTFParser( SfxItemPool& rPool, SvStream& rIn,
int bReadNewDoc )
: SvRTFParser( rIn, 5 ),
rStrm(rIn),
- aFontTbl( 16, 4 ),
pInsPos( 0 ),
pAttrPool( &rPool ),
m_xDocProps( i_xDocProps ),
@@ -119,9 +118,9 @@ SvxRTFParser::~SvxRTFParser()
{
if( !aColorTbl.empty() )
ClearColorTbl();
- if( aFontTbl.Count() )
+ if( aFontTbl.size() )
ClearFontTbl();
- if( aStyleTbl.Count() )
+ if( aStyleTbl.size() )
ClearStyleTbl();
if( !aAttrStack.empty() )
ClearAttrStack();
@@ -149,9 +148,9 @@ SvParserState SvxRTFParser::CallParser()
if( !aColorTbl.empty() )
ClearColorTbl();
- if( aFontTbl.Count() )
+ if( aFontTbl.size() )
ClearFontTbl();
- if( aStyleTbl.Count() )
+ if( aStyleTbl.size() )
ClearStyleTbl();
if( !aAttrStack.empty() )
ClearAttrStack();
@@ -194,7 +193,7 @@ void SvxRTFParser::NextToken( int nToken )
case RTF_DEFF:
if( bNewDoc )
{
- if( aFontTbl.Count() )
+ if( aFontTbl.size() )
// Can immediately be set
SetDefault( nToken, nTokenValue );
else
@@ -385,14 +384,17 @@ void SvxRTFParser::ReadStyleTable()
{
pStyle->sName = DelCharAtEnd( aToken, ';' );
- if( aStyleTbl.Count() )
+ if( aStyleTbl.size() )
{
- SvxRTFStyleType* pOldSt = aStyleTbl.Remove( nStyleNo );
+ SvxRTFStyleType* pOldSt = aStyleTbl[ nStyleNo ];
if( pOldSt )
+ {
+ aStyleTbl.erase( nStyleNo );
delete pOldSt;
+ }
}
// All data from the font is available, so off to the table
- aStyleTbl.Insert( nStyleNo, pStyle );
+ aStyleTbl[ nStyleNo ] = pStyle;
pStyle = new SvxRTFStyleType( *pAttrPool, &aWhichMap[0] );
pStyle->aAttrSet.Put( GetRTFDefaults() );
nStyleNo = 0;
@@ -596,7 +598,7 @@ void SvxRTFParser::ReadFontTable()
(sFntNm += ';' ) += sAltNm;
pFont->SetName( sFntNm );
- aFontTbl.Insert( nInsFontNo, pFont );
+ aFontTbl[ nInsFontNo ] = pFont;
pFont = new Font();
pFont->SetCharSet( nSystemChar );
sAltNm.Erase();
@@ -798,14 +800,14 @@ void SvxRTFParser::ClearColorTbl()
void SvxRTFParser::ClearFontTbl()
{
- for( sal_uInt32 nCnt = aFontTbl.Count(); nCnt; )
- delete aFontTbl.GetObject( --nCnt );
+ for( sal_uInt32 nCnt = aFontTbl.size(); nCnt; )
+ delete aFontTbl[--nCnt ];
}
void SvxRTFParser::ClearStyleTbl()
{
- for( sal_uInt32 nCnt = aStyleTbl.Count(); nCnt; )
- delete aStyleTbl.GetObject( --nCnt );
+ for( sal_uInt32 nCnt = aStyleTbl.size(); nCnt; )
+ delete aStyleTbl[ --nCnt ];
}
void SvxRTFParser::ClearAttrStack()
@@ -833,7 +835,7 @@ String& SvxRTFParser::DelCharAtEnd( String& rStr, const sal_Unicode cDel )
const Font& SvxRTFParser::GetFont( sal_uInt16 nId )
{
- const Font* pFont = aFontTbl.Get( nId );
+ const Font* pFont = aFontTbl[ nId ];
if( !pFont )
{
const SvxFontItem& rDfltFont = (const SvxFontItem&)
@@ -875,7 +877,7 @@ void SvxRTFParser::_ClearStyleAttr( SvxRTFItemStackType& rStkType )
SvxRTFStyleType* pStyle;
if( !IsChkStyleAttr() ||
!rStkType.GetAttrSet().Count() ||
- 0 == ( pStyle = aStyleTbl.Get( rStkType.nStyleNo ) ))
+ 0 == ( pStyle = aStyleTbl[ rStkType.nStyleNo ] ))
{
for( sal_uInt16 nWhich = aIter.GetCurWhich(); nWhich; nWhich = aIter.NextWhich() )
{
diff --git a/editeng/source/uno/UnoForbiddenCharsTable.cxx
b/editeng/source/uno/UnoForbiddenCharsTable.cxx
index 5bcbf35..8b891c3 100644
--- a/editeng/source/uno/UnoForbiddenCharsTable.cxx
+++ b/editeng/source/uno/UnoForbiddenCharsTable.cxx
@@ -117,18 +117,19 @@ Sequence< Locale > SAL_CALL SvxUnoForbiddenCharsTable::getLocales()
{
SolarMutexGuard aGuard;
- const sal_Int32 nCount = mxForbiddenChars.is() ? mxForbiddenChars->Count() : 0;
+ const sal_Int32 nCount = mxForbiddenChars.is() ? mxForbiddenChars->Map().size() : 0;
Sequence< Locale > aLocales( nCount );
if( nCount )
{
Locale* pLocales = aLocales.getArray();
-
- for( sal_Int32 nIndex = 0; nIndex < nCount; nIndex++ )
- {
- const sal_uLong nLanguage = mxForbiddenChars->GetObjectKey( nIndex );
+
+ for( SvxForbiddenCharactersTable::CharInfoMap::iterator it =
mxForbiddenChars->Map().begin();
+ it != mxForbiddenChars->Map().end(); ++it)
+ {
+ const sal_uLong nLanguage = it->first;
SvxLanguageToLocale ( *pLocales++, static_cast < LanguageType > (nLanguage) );
- }
+ }
}
return aLocales;
diff --git a/sc/inc/chartpos.hxx b/sc/inc/chartpos.hxx
index b648043..445f1d7 100644
--- a/sc/inc/chartpos.hxx
+++ b/sc/inc/chartpos.hxx
@@ -36,7 +36,9 @@
class ScAddress;
-class Table;
+
+typedef ::std::map<int, ScAddress*> RowMap;
+typedef ::std::map<int, RowMap*> ColumnsMap;
class ScChartPositionMap
{
@@ -52,7 +54,7 @@ class ScChartPositionMap
ScChartPositionMap( SCCOL nChartCols, SCROW nChartRows,
SCCOL nColAdd, // header columns
SCROW nRowAdd, // header rows
- Table& rCols // table with col tables with address*
+ ColumnsMap& rCols // table with col tables with address*
);
~ScChartPositionMap(); //! deletes all ScAddress*
diff --git a/sc/source/core/tool/chartpos.cxx b/sc/source/core/tool/chartpos.cxx
index 5b7617a..e852ed1 100644
--- a/sc/source/core/tool/chartpos.cxx
+++ b/sc/source/core/tool/chartpos.cxx
@@ -29,7 +29,7 @@
// INCLUDE ---------------------------------------------------------------
-#include <tools/table.hxx>
+#include <map>
#include "chartpos.hxx"
#include "document.hxx"
@@ -354,7 +354,6 @@ const ScChartPositionMap* ScChartPositioner::GetPositionMap()
return pPositionMap;
}
-
void ScChartPositioner::CreatePositionMap()
{
if ( eGlue == SC_CHARTGLUE_NA && pPositionMap )
@@ -383,10 +382,10 @@ void ScChartPositioner::CreatePositionMap()
GlueState();
sal_Bool bNoGlue = (eGlue == SC_CHARTGLUE_NONE);
- Table* pCols = new Table;
- Table* pNewRowTable = new Table;
+ ColumnsMap aCols;
+ RowMap* pNewRowTable;
ScAddress* pNewAddress = new ScAddress;
- Table* pCol;
+ RowMap* pCol;
ScAddress* pPos;
SCROW nNoGlueRow = 0;
for ( size_t i = 0, nRanges = aRangeListRef->size(); i < nRanges; ++i )
@@ -402,30 +401,32 @@ void ScChartPositioner::CreatePositionMap()
{
if ( bNoGlue || eGlue == SC_CHARTGLUE_ROWS )
{ // meistens gleiche Cols
- if ( (pCol = (Table*) pCols->Get( nInsCol ))==NULL )
+ if ( (pCol = aCols[ nInsCol ]) == NULL )
{
- pCols->Insert( nInsCol, pNewRowTable );
+ aCols[ nInsCol ] = pNewRowTable;
pCol = pNewRowTable;
- pNewRowTable = new Table;
+ pNewRowTable = new RowMap;
}
}
else
{ // meistens neue Cols
- if ( pCols->Insert( nInsCol, pNewRowTable ) )
+ if ( aCols.count( nInsCol ) == 0)
{
+ aCols[ nInsCol ] = pNewRowTable;
pCol = pNewRowTable;
- pNewRowTable = new Table;
+ pNewRowTable = new RowMap;
}
else
- pCol = (Table*) pCols->Get( nInsCol );
+ pCol = aCols[ nInsCol ];
}
// bei anderer Tabelle wurde bereits neuer ColKey erzeugt,
// die Zeilen muessen fuer's Dummy fuellen gleich sein!
sal_uLong nInsRow = (bNoGlue ? nNoGlueRow : nRow1);
for ( nRow = nRow1; nRow <= nRow2; nRow++, nInsRow++ )
{
- if ( pCol->Insert( nInsRow, pNewAddress ) )
+ if ( pCol->count( nInsRow ) == 0)
{
+ (*pCol)[ nInsRow ] = pNewAddress;
pNewAddress->Set( nCol, nRow, nTab );
pNewAddress = new ScAddress;
}
@@ -439,15 +440,19 @@ void ScChartPositioner::CreatePositionMap()
delete pNewRowTable;
// Anzahl der Daten
- nColCount = static_cast< SCSIZE >( pCols->Count());
- if ( (pCol = (Table*) pCols->First())!=NULL )
+ nColCount = static_cast< SCSIZE >( aCols.size());
+ if ( nColCount )
{
+ pCol = aCols.begin()->second;
if ( bDummyUpperLeft )
- pCol->Insert( 0, (void*)0 ); // Dummy fuer Beschriftung
- nRowCount = static_cast< SCSIZE >( pCol->Count());
+ (*pCol)[ 0 ] = NULL; // Dummy fuer Beschriftung
+ nRowCount = static_cast< SCSIZE >( pCol->size());
}
else
+ {
+ pCol = NULL;
nRowCount = 0;
+ }
if ( nColCount > 0 )
nColCount -= nColAdd;
if ( nRowCount > 0 )
@@ -455,25 +460,25 @@ void ScChartPositioner::CreatePositionMap()
if ( nColCount==0 || nRowCount==0 )
{ // einen Eintrag ohne Daten erzeugen
- if ( pCols->Count() > 0 )
- pCol = (Table*) pCols->First();
+ if ( aCols.size() )
+ pCol = aCols.begin()->second;
else
{
- pCol = new Table;
- pCols->Insert( 0, pCol );
+ pCol = new RowMap;
+ aCols[ 0 ] = pCol;
}
nColCount = 1;
- if ( pCol->Count() > 0 )
+ if ( pCol->size() )
{ // kann ja eigentlich nicht sein, wenn nColCount==0 || nRowCount==0
- pPos = (ScAddress*) pCol->First();
+ pPos = pCol->begin()->second;
if ( pPos )
{
delete pPos;
- pCol->Replace( pCol->GetCurKey(), (void*)0 );
+ (*pCol)[ pCol->begin()->first ] = NULL;
}
}
else
- pCol->Insert( 0, (void*)0 );
+ (*pCol)[ 0 ] = NULL;
nRowCount = 1;
nColAdd = 0;
nRowAdd = 0;
@@ -482,33 +487,29 @@ void ScChartPositioner::CreatePositionMap()
{
if ( bNoGlue )
{ // Luecken mit Dummies fuellen, erste Spalte ist Master
- Table* pFirstCol = (Table*) pCols->First();
- sal_uLong nCount = pFirstCol->Count();
- pFirstCol->First();
- for ( sal_uLong n = 0; n < nCount; n++, pFirstCol->Next() )
- {
- sal_uLong nKey = pFirstCol->GetCurKey();
- pCols->First();
- while ( (pCol = (Table*) pCols->Next())!=NULL )
- pCol->Insert( nKey, (void*)0 ); // keine Daten
- }
+ RowMap* pFirstCol = aCols.begin()->second;
+ for (RowMap::iterator it = pFirstCol->begin(); it != pFirstCol->end();
++it)
+ {
+ sal_uLong nKey = it->first;
+ for (ColumnsMap::iterator it2 = aCols.begin(); it2 != aCols.end();
++it2)
+ (*(it2->second))[ nKey ] = NULL; // keine Daten
+ }
}
}
pPositionMap = new ScChartPositionMap( static_cast<SCCOL>(nColCount),
static_cast<SCROW>(nRowCount),
- static_cast<SCCOL>(nColAdd), static_cast<SCROW>(nRowAdd), *pCols );
+ static_cast<SCCOL>(nColAdd), static_cast<SCROW>(nRowAdd), aCols );
// Aufraeumen
- for ( pCol = (Table*) pCols->First(); pCol; pCol = (Table*) pCols->Next() )
+ for (ColumnsMap::iterator it = aCols.begin(); it != aCols.end(); ++it)
{ //! nur Tables loeschen, nicht die ScAddress*
- delete pCol;
- }
- delete pCols;
+ delete it->second;
+ }
}
ScChartPositionMap::ScChartPositionMap( SCCOL nChartCols, SCROW nChartRows,
- SCCOL nColAdd, SCROW nRowAdd, Table& rCols ) :
+ SCCOL nColAdd, SCROW nRowAdd, ColumnsMap& rCols ) :
ppData( new ScAddress* [ nChartCols * nChartRows ] ),
ppColHeader( new ScAddress* [ nChartCols ] ),
ppRowHeader( new ScAddress* [ nChartRows ] ),
@@ -522,18 +523,23 @@ ScChartPositionMap::ScChartPositionMap( SCCOL nChartCols, SCROW nChartRows,
SCCOL nCol;
SCROW nRow;
- Table* pCol = (Table*) rCols.First();
+ ColumnsMap::iterator aColumnsMapIter = rCols.begin();
+ RowMap::iterator aColIter = aColumnsMapIter->second->begin();
// Zeilen-Header
- pPos = (ScAddress*) pCol->First();
+ pPos = aColIter->second;
if ( nRowAdd )
- pPos = (ScAddress*) pCol->Next();
+ {
+ ++aColIter;
+ pPos = aColIter->second;
+ }
if ( nColAdd )
{ // eigenstaendig
for ( nRow = 0; nRow < nRowCount; nRow++ )
{
ppRowHeader[ nRow ] = pPos;
- pPos = (ScAddress*) pCol->Next();
+ ++aColIter;
+ pPos = aColIter->second;
}
}
else
@@ -541,30 +547,37 @@ ScChartPositionMap::ScChartPositionMap( SCCOL nChartCols, SCROW nChartRows,
for ( nRow = 0; nRow < nRowCount; nRow++ )
{
ppRowHeader[ nRow ] = ( pPos ? new ScAddress( *pPos ) : NULL );
- pPos = (ScAddress*) pCol->Next();
+ ++aColIter;
+ pPos = aColIter->second;
}
}
if ( nColAdd )
- pCol = (Table*) rCols.Next();
+ {
+ ++aColumnsMapIter;
+ aColIter = aColumnsMapIter->second->begin();
+ }
// Daten spaltenweise und Spalten-Header
sal_uLong nIndex = 0;
for ( nCol = 0; nCol < nColCount; nCol++ )
{
- if ( pCol )
+ if ( aColIter != aColumnsMapIter->second->end())
{
- pPos = (ScAddress*) pCol->First();
+ aColIter = aColumnsMapIter->second->begin();
+ pPos = aColIter->second;
if ( nRowAdd )
{
ppColHeader[ nCol ] = pPos; // eigenstaendig
- pPos = (ScAddress*) pCol->Next();
+ ++aColIter;
+ pPos = aColIter->second;
}
else
ppColHeader[ nCol ] = ( pPos ? new ScAddress( *pPos ) : NULL );
for ( nRow = 0; nRow < nRowCount; nRow++, nIndex++ )
{
ppData[ nIndex ] = pPos;
- pPos = (ScAddress*) pCol->Next();
+ ++aColIter;
+ pPos = aColIter->second;
}
}
else
@@ -575,7 +588,8 @@ ScChartPositionMap::ScChartPositionMap( SCCOL nChartCols, SCROW nChartRows,
ppData[ nIndex ] = NULL;
}
}
- pCol = (Table*) rCols.Next();
+ ++aColumnsMapIter;
+ aColIter = aColumnsMapIter->second->begin();
}
}
diff --git a/sc/source/filter/html/htmlpars.cxx b/sc/source/filter/html/htmlpars.cxx
index 323e1a2..9d3cdb3 100644
--- a/sc/source/filter/html/htmlpars.cxx
+++ b/sc/source/filter/html/htmlpars.cxx
@@ -229,7 +229,6 @@ ScHTMLLayoutParser::ScHTMLLayoutParser(
aPageSize( aPageSizeP ),
aBaseURL( rBaseURL ),
xLockedList( new ScRangeList ),
- pTables( NULL ),
pColOffset( new ScHTMLColOffset ),
pLocalColOffset( new ScHTMLColOffset ),
nFirstTableCell(0),
@@ -279,11 +278,10 @@ ScHTMLLayoutParser::~ScHTMLLayoutParser()
delete pLocalColOffset;
if ( pColOffset )
delete pColOffset;
- if ( pTables )
+ if ( !maTables.empty() )
{
- for ( Table* pT = (Table*) pTables->First(); pT; pT = (Table*) pTables->Next() )
- delete pT;
- delete pTables;
+ for ( TablesMap::iterator it = maTables.begin(); it != maTables.end(); ++it )
+ delete it->second;
}
}
@@ -331,7 +329,7 @@ sal_uLong ScHTMLLayoutParser::Read( SvStream& rStream, const String& rBaseURL )
{
aSize.Width() = *pOff - nOff;
aSize = pDefaultDev->PixelToLogic( aSize, MapMode( MAP_TWIP ) );
- pColWidths->Insert( j-1, (void*)aSize.Width() );
+ maColWidths[ j-1 ] = aSize.Width();
nOff = *pOff;
}
return nErr;
@@ -538,7 +536,7 @@ void ScHTMLLayoutParser::Adjust()
SCROW nNextRow = 0;
SCROW nCurRow = 0;
sal_uInt16 nPageWidth = (sal_uInt16) aPageSize.Width();
- Table* pTab = NULL;
+ RowMap* pTab = NULL;
for ( size_t i = 0, nListSize = maList.size(); i < nListSize; ++i )
{
ScEEParseEntry* pE = maList[ i ];
@@ -555,7 +553,7 @@ void ScHTMLLayoutParser::Adjust()
}
delete pS;
nTab = pE->nTab;
- pTab = (pTables ? (Table*) pTables->Get( nTab ) : NULL);
+ pTab = maTables[ nTab ];
}
SCROW nRow = pE->nRow;
@@ -566,7 +564,7 @@ void ScHTMLLayoutParser::Adjust()
else
nCurRow = nNextRow = pE->nRow;
SCROW nR;
- if ( pTab && ((nR = (SCROW)(sal_uLong)pTab->Get( nCurRow )) != 0) )
+ if ( pTab && ((nR = (*pTab)[ nCurRow ]) != 0) )
nNextRow += nR;
else
nNextRow++;
@@ -579,10 +577,10 @@ void ScHTMLLayoutParser::Adjust()
aStack.push( new ScHTMLAdjustStackEntry(
nLastCol, nNextRow, nCurRow ) );
nTab = pE->nTab;
- pTab = (pTables ? (Table*) pTables->Get( nTab ) : NULL);
+ pTab = maTables[ nTab ];
// neuer Zeilenabstand
SCROW nR;
- if ( pTab && ((nR = (SCROW)(sal_uLong)pTab->Get( nCurRow )) != 0) )
+ if ( pTab && ((nR = (*pTab)[ nCurRow ]) != 0) )
nNextRow = nCurRow + nR;
else
nNextRow = nCurRow + 1;
@@ -596,7 +594,7 @@ void ScHTMLLayoutParser::Adjust()
SCROW nRowSpan = pE->nRowOverlap;
for ( SCROW j=0; j < nRowSpan; j++ )
{ // aus merged Zeilen resultierendes RowSpan
- SCROW nRows = (SCROW)(sal_uLong)pTab->Get( nRow+j );
+ SCROW nRows = (*pTab)[ nRow+j ];
if ( nRows > 1 )
{
pE->nRowOverlap += nRows - 1;
@@ -1227,14 +1225,12 @@ void ScHTMLLayoutParser::TableOff( ImportInfo* pInfo )
{ // Groesse der Tabelle an dieser Position eintragen
SCROW nRow = pS->nRowCnt;
sal_uInt16 nTab = pS->nTable;
- if ( !pTables )
- pTables = new Table;
// Hoehen der aeusseren Table
- Table* pTab1 = (Table*) pTables->Get( nTab );
+ RowMap* pTab1 = maTables[ nTab ];
if ( !pTab1 )
{
- pTab1 = new Table;
- pTables->Insert( nTab, pTab1 );
+ pTab1 = new RowMap;
+ maTables[ nTab ] = pTab1;
}
SCROW nRowSpan = pE->nRowOverlap;
SCROW nRowKGV;
@@ -1252,11 +1248,11 @@ void ScHTMLLayoutParser::TableOff( ImportInfo* pInfo )
nRowKGV = nRowsPerRow1 = nRows;
nRowsPerRow2 = 1;
}
- Table* pTab2 = NULL;
+ RowMap* pTab2 = NULL;
if ( nRowsPerRow2 > 1 )
{ // Hoehen der inneren Table
- pTab2 = new Table;
- pTables->Insert( nTable, pTab2 );
+ pTab2 = new RowMap;
+ maTables[ nTable ] = pTab2;
}
// void* Data-Entry der Table-Class fuer das
// Hoehen-Mapping missbrauchen
@@ -1267,11 +1263,11 @@ void ScHTMLLayoutParser::TableOff( ImportInfo* pInfo )
for ( SCROW j=0; j < nRowSpan; j++ )
{
sal_uLong nRowKey = nRow + j;
- SCROW nR = (SCROW)(sal_uLong)pTab1->Get( nRowKey );
+ SCROW nR = (*pTab1)[ nRowKey ];
if ( !nR )
- pTab1->Insert( nRowKey, (void*)(sal_IntPtr)nRowsPerRow1 );
+ (*pTab1)[ nRowKey ] = nRowsPerRow1;
else if ( nRowsPerRow1 > nR )
- pTab1->Replace( nRowKey, (void*)(sal_IntPtr)nRowsPerRow1 );
+ (*pTab1)[ nRowKey ] = nRowsPerRow1;
//2do: wie geht das noch besser?
else if ( nRowsPerRow1 < nR && nRowSpan == 1
&& nTable == nMaxTable )
@@ -1280,11 +1276,11 @@ void ScHTMLLayoutParser::TableOff( ImportInfo* pInfo )
nR += nAdd;
if ( (nR % nRows) == 0 )
{ // nur wenn abbildbar
- SCROW nR2 = (SCROW)(sal_uLong)pTab1->Get( nRowKey+1 );
+ SCROW nR2 = (*pTab1)[ nRowKey+1 ];
if ( nR2 > nAdd )
{ // nur wenn wirklich Platz
- pTab1->Replace( nRowKey, (void*)(sal_IntPtr)nR );
- pTab1->Replace( nRowKey+1, (void*)(sal_IntPtr)(nR2 - nAdd)
);
+ (*pTab1)[ nRowKey ] = nR;
+ (*pTab1)[ nRowKey+1 ] = nR2 - nAdd;
nRowsPerRow2 = nR / nRows;
}
}
@@ -1295,17 +1291,17 @@ void ScHTMLLayoutParser::TableOff( ImportInfo* pInfo )
{ // innen
if ( !pTab2 )
{ // nRowsPerRow2 kann erhoeht worden sein
- pTab2 = new Table;
- pTables->Insert( nTable, pTab2 );
+ pTab2 = new RowMap;
+ maTables[ nTable ] = pTab2;
}
for ( SCROW j=0; j < nRows; j++ )
{
sal_uLong nRowKey = nRow + j;
- SCROW nR = (SCROW)(sal_uLong)pTab2->Get( nRowKey );
+ SCROW nR = (*pTab2)[ nRowKey ];
if ( !nR )
- pTab2->Insert( nRowKey, (void*)(sal_IntPtr)nRowsPerRow2 );
+ (*pTab2)[ nRowKey ] = nRowsPerRow2;
else if ( nRowsPerRow2 > nR )
- pTab2->Replace( nRowKey, (void*)(sal_IntPtr)nRowsPerRow2 );
+ (*pTab2)[ nRowKey ] = nRowsPerRow2;
}
}
}
diff --git a/sc/source/filter/inc/eeparser.hxx b/sc/source/filter/inc/eeparser.hxx
index dc1daf1..88b0a51 100644
--- a/sc/source/filter/inc/eeparser.hxx
+++ b/sc/source/filter/inc/eeparser.hxx
@@ -32,12 +32,12 @@
#include <tools/string.hxx>
#include <tools/gen.hxx>
#include <vcl/graph.hxx>
-#include <tools/table.hxx>
#include <svl/itemset.hxx>
#include <editeng/editdata.hxx>
#include <address.hxx>
#include <boost/ptr_container/ptr_vector.hpp>
#include <vector>
+#include <map>
const sal_Char nHorizontal = 1;
const sal_Char nVertical = 2;
@@ -110,13 +110,15 @@ class EditEngine;
class ScEEParser
{
+public:
+ typedef std::map<int, int> ColumnWidthsMap;
protected:
EditEngine* pEdit;
SfxItemPool* pPool;
SfxItemPool* pDocPool;
::std::vector< ScEEParseEntry* > maList;
ScEEParseEntry* pActEntry;
- Table* pColWidths;
+ ColumnWidthsMap maColWidths;
int nLastToken;
SCCOL nColCnt;
SCROW nRowCnt;
@@ -131,7 +133,7 @@ public:
virtual sal_uLong Read( SvStream&, const String& rBaseURL ) = 0;
- Table* GetColWidths() const { return pColWidths; }
+ ColumnWidthsMap& GetColWidths() { return maColWidths; }
void GetDimensions( SCCOL& nCols, SCROW& nRows ) const
{ nCols = nColMax; nRows = nRowMax; }
diff --git a/sc/source/filter/inc/htmlpars.hxx b/sc/source/filter/inc/htmlpars.hxx
index b8846c4..fbc7005 100644
--- a/sc/source/filter/inc/htmlpars.hxx
+++ b/sc/source/filter/inc/htmlpars.hxx
@@ -167,13 +167,16 @@ class HTMLOption;
class ScHTMLLayoutParser : public ScHTMLParser
{
+public:
+ typedef std::map<SCROW, SCROW> RowMap;
+ typedef std::map<int, RowMap*> TablesMap;
private:
Size aPageSize;
rtl::OUString aBaseURL;
ScHTMLTableStack aTableStack;
rtl::OUString aString;
ScRangeListRef xLockedList; // je Table
- Table* pTables;
+ TablesMap maTables;
ScHTMLColOffset* pColOffset;
ScHTMLColOffset* pLocalColOffset; // je Table
sal_uLong nFirstTableCell; // je Table
diff --git a/sc/source/filter/rtf/eeimpars.cxx b/sc/source/filter/rtf/eeimpars.cxx
index 2fb0484..bf61679 100644
--- a/sc/source/filter/rtf/eeimpars.cxx
+++ b/sc/source/filter/rtf/eeimpars.cxx
@@ -431,14 +431,14 @@ void ScEEImport::WriteToDocument( sal_Bool bSizeColsRows, double
nOutputFactor,
if ( bSizeColsRows )
{
// Spaltenbreiten
- Table* pColWidths = mpParser->GetColWidths();
- if ( pColWidths->Count() )
+ ScEEParser::ColumnWidthsMap& rColWidths = mpParser->GetColWidths();
+ if ( !rColWidths.empty() )
{
nProgress = 0;
pProgress->SetState( nProgress, nEndCol - nStartCol + 1 );
for ( SCCOL nCol = nStartCol; nCol <= nEndCol; nCol++ )
{
- sal_uInt16 nWidth = (sal_uInt16)(sal_uLong) pColWidths->Get( nCol );
+ sal_uInt16 nWidth = rColWidths[ nCol ];
if ( nWidth )
mpDoc->SetColWidth( nCol, nTab, nWidth );
pProgress->SetState( ++nProgress );
@@ -513,20 +513,20 @@ sal_Bool ScEEImport::GraphicSize( SCCOL nCol, SCROW nRow, SCTAB /*nTab*/,
ScEEPa
nDir = pI->nDir;
}
// Spaltenbreiten
- Table* pColWidths = mpParser->GetColWidths();
- long nThisWidth = (long) pColWidths->Get( nCol );
+ ScEEParser::ColumnWidthsMap& rColWidths = mpParser->GetColWidths();
+ long nThisWidth = (long) rColWidths[ nCol ];
long nColWidths = nThisWidth;
SCCOL nColSpanCol = nCol + pE->nColOverlap;
for ( SCCOL nC = nCol + 1; nC < nColSpanCol; nC++ )
{
- nColWidths += (long) pColWidths->Get( nC );
+ nColWidths += (long) rColWidths[ nC ];
}
if ( nWidth > nColWidths )
{ // Differenz nur in der ersten Spalte eintragen
if ( nThisWidth )
- pColWidths->Replace( nCol, (void*)(nWidth - nColWidths + nThisWidth) );
+ rColWidths[ nCol ] = nWidth - nColWidths + nThisWidth;
else
- pColWidths->Insert( nCol, (void*)(nWidth - nColWidths) );
+ rColWidths[ nCol ] = nWidth - nColWidths;
}
// Zeilenhoehen, Differenz auf alle betroffenen Zeilen verteilen
SCROW nRowSpan = pE->nRowOverlap;
@@ -619,7 +619,6 @@ ScEEParser::ScEEParser( EditEngine* pEditP ) :
pEdit( pEditP ),
pPool( EditEngine::CreatePool() ),
pDocPool( new ScDocumentPool ),
- pColWidths( new Table ),
nLastToken(0),
nColCnt(0),
nRowCnt(0),
@@ -636,7 +635,6 @@ ScEEParser::ScEEParser( EditEngine* pEditP ) :
ScEEParser::~ScEEParser()
{
delete pActEntry;
- delete pColWidths;
if ( !maList.empty() ) maList.clear();
// Pool erst loeschen nachdem die Listen geloescht wurden
diff --git a/sc/source/ui/unoobj/chart2uno.cxx b/sc/source/ui/unoobj/chart2uno.cxx
index 0317f94..1149b58 100644
--- a/sc/source/ui/unoobj/chart2uno.cxx
+++ b/sc/source/ui/unoobj/chart2uno.cxx
@@ -46,8 +46,9 @@
#include "formula/opcode.hxx"
+#include <map>
+
#include <sfx2/objsh.hxx>
-#include <tools/table.hxx>
#include <vcl/svapp.hxx>
#include <com/sun/star/beans/UnknownPropertyException.hpp>
diff --git a/sw/source/filter/rtf/rtffld.cxx b/sw/source/filter/rtf/rtffld.cxx
index 51741e1..90b3cb0 100644
--- a/sw/source/filter/rtf/rtffld.cxx
+++ b/sw/source/filter/rtf/rtffld.cxx
@@ -595,8 +595,9 @@ int SwRTFParser::MakeFieldInst( String& rFieldStr )
// Font setzen
{
SvxRTFFontTbl& rTbl = GetFontTbl();
- for( Font* pFont = rTbl.First(); pFont;
- pFont = rTbl.Next() )
+ for(SvxRTFFontTbl::iterator it =
rTbl.begin(); it != rTbl.end(); ++it)
+ {
+ Font* pFont = it->second;
if( pFont->GetName() == sParam )
{
rSet.Put( SvxFontItem(
@@ -608,6 +609,7 @@ int SwRTFParser::MakeFieldInst( String& rFieldStr )
RES_CHRATR_FONT ));
break;
}
+ }
}
break;
case 'h': case 'H':
diff --git a/sw/source/filter/rtf/rtfnum.cxx b/sw/source/filter/rtf/rtfnum.cxx
index 07b3319..d672a99 100644
--- a/sw/source/filter/rtf/rtfnum.cxx
+++ b/sw/source/filter/rtf/rtfnum.cxx
@@ -585,7 +585,7 @@ void SwRTFParser::ReadListOverrideTable()
}
// search the outline numrule and set it into the doc
- if( GetStyleTbl().Count() )
+ if( GetStyleTbl().size() )
{
if( !bStyleTabValid )
MakeStyleTab();
@@ -594,11 +594,12 @@ void SwRTFParser::ReadListOverrideTable()
std::map<sal_Int32,SwTxtFmtColl*>::const_iterator iterColl;
sal_uInt16 nRulePos( USHRT_MAX );
const SwNumRule *pNumRule = 0;
- SvxRTFStyleType* pStyle = GetStyleTbl().First();
- do {
+ for(SvxRTFStyleTbl::iterator it = GetStyleTbl().begin(); it !=
GetStyleTbl().end(); ++it)
+ {
+ SvxRTFStyleType* pStyle = it->second;
if ( MAXLEVEL > pStyle->nOutlineNo )
{
- iterColl = aTxtCollTbl.find( (sal_uInt16)GetStyleTbl().GetCurKey() );
+ iterColl = aTxtCollTbl.find( it->first );
if ( iterColl != aTxtCollTbl.end() )
{
const SfxItemState eItemState =
@@ -634,8 +635,7 @@ void SwRTFParser::ReadListOverrideTable()
}
pStyle->aAttrSet.ClearItem( FN_PARAM_NUM_LEVEL );
-
- } while( 0 != (pStyle = GetStyleTbl().Next()) );
+ }
}
SkipToken( -1 ); // die schliesende Klammer wird "oben" ausgewertet
@@ -723,17 +723,15 @@ void SwRTFParser::RemoveUnusedNumRules()
const Font* SwRTFParser::FindFontOfItem( const SvxFontItem& rItem ) const
{
SvxRTFFontTbl& rFntTbl = ((SwRTFParser*)this)->GetFontTbl();
- const Font* pFnt = rFntTbl.First();
- while( pFnt )
+ for(SvxRTFFontTbl::const_iterator it = rFntTbl.begin(); it != rFntTbl.end(); ++it)
{
+ const Font* pFnt = it->second;
if( pFnt->GetFamily() == rItem.GetFamily() &&
pFnt->GetName() == rItem.GetFamilyName() &&
pFnt->GetStyleName() == rItem.GetStyleName() &&
pFnt->GetPitch() == rItem.GetPitch() &&
pFnt->GetCharSet() == rItem.GetCharSet() )
return pFnt;
-
- pFnt = rFntTbl.Next();
}
return 0;
}
diff --git a/sw/source/filter/rtf/swparrtf.cxx b/sw/source/filter/rtf/swparrtf.cxx
index 81abb16..fa618f8 100644
--- a/sw/source/filter/rtf/swparrtf.cxx
+++ b/sw/source/filter/rtf/swparrtf.cxx
@@ -2195,8 +2195,9 @@ void SwRTFParser::SetAttrInDoc( SvxRTFItemStackType &rSet )
((SwFmtCharFmt*)pCharFmt)->GetCharFmt() )
{
const String& rName = ((SwFmtCharFmt*)pCharFmt)->GetCharFmt()->GetName();
- SvxRTFStyleType* pStyle = GetStyleTbl().First();
- do {
+ for(SvxRTFStyleTbl::iterator it = GetStyleTbl().begin(); it !=
GetStyleTbl().end(); ++it)
+ {
+ SvxRTFStyleType* pStyle = it->second;
if( pStyle->bIsCharFmt && pStyle->sName == rName )
{
// alle Attribute, die schon vom Style definiert sind, aus dem
@@ -2218,7 +2219,7 @@ void SwRTFParser::SetAttrInDoc( SvxRTFItemStackType &rSet )
}
break;
}
- } while( 0 != (pStyle = GetStyleTbl().Next()) );
+ }
pDoc->InsertPoolItem(aPam, *pCharFmt, 0);
rSet.GetAttrSet().ClearItem(RES_TXTATR_CHARFMT); //test hack
@@ -2734,7 +2735,7 @@ void SwRTFParser::ReadDocControls( int nToken )
void SwRTFParser::MakeStyleTab()
{
// dann erzeuge aus der SvxStyle-Tabelle die Swg-Collections
- if( GetStyleTbl().Count() )
+ if( GetStyleTbl().size() )
{
sal_uInt16 nValidOutlineLevels = 0;
if( !IsNewDoc() )
@@ -2746,9 +2747,10 @@ void SwRTFParser::MakeStyleTab()
nValidOutlineLevels |= 1 << rColls[ n
]->GetAssignedOutlineStyleLevel();//<-end,zhaojianwei
}
- SvxRTFStyleType* pStyle = GetStyleTbl().First();
- do {
- sal_uInt16 nNo = sal_uInt16( GetStyleTbl().GetCurKey() );
+ for(SvxRTFStyleTbl::iterator it = GetStyleTbl().begin(); it !=
GetStyleTbl().end(); ++it)
+ {
+ SvxRTFStyleType* pStyle = it->second;
+ sal_uInt16 nNo = it->first;
if( pStyle->bIsCharFmt )
{
if(aCharFmtTbl.find( nNo ) == aCharFmtTbl.end())
@@ -2761,7 +2763,7 @@ void SwRTFParser::MakeStyleTab()
MakeStyle( nNo, *pStyle );
}
- } while( 0 != (pStyle = GetStyleTbl().Next()) );
+ }
bStyleTabValid = sal_True;
}
}
@@ -3996,7 +3998,7 @@ SwTxtFmtColl* SwRTFParser::MakeStyle( sal_uInt16 nNo, const SvxRTFStyleType&
rSt
sal_uInt16 nStyleNo = rStyle.nBasedOn;
if( rStyle.bBasedOnIsSet && nStyleNo != nNo )
{
- SvxRTFStyleType* pDerivedStyle = GetStyleTbl().Get( nStyleNo );
+ SvxRTFStyleType* pDerivedStyle = GetStyleTbl()[ nStyleNo ];
SwTxtFmtColl* pDerivedColl = NULL;
std::map<sal_Int32,SwTxtFmtColl*>::iterator iter = aTxtCollTbl.find(nStyleNo);
@@ -4041,7 +4043,7 @@ SwTxtFmtColl* SwRTFParser::MakeStyle( sal_uInt16 nNo, const SvxRTFStyleType&
rSt
if( iter == aTxtCollTbl.end()) // noch nicht vorhanden, also anlegen
{
// ist die ueberhaupt als Style vorhanden ?
- SvxRTFStyleType* pMkStyle = GetStyleTbl().Get( nStyleNo );
+ SvxRTFStyleType* pMkStyle = GetStyleTbl()[ nStyleNo ];
pNext = pMkStyle
? MakeStyle( nStyleNo, *pMkStyle )
: pDoc->GetTxtCollFromPool( RES_POOLCOLL_STANDARD, false );
@@ -4067,7 +4069,7 @@ SwCharFmt* SwRTFParser::MakeCharStyle( sal_uInt16 nNo, const SvxRTFStyleType&
rS
sal_uInt16 nStyleNo = rStyle.nBasedOn;
if( rStyle.bBasedOnIsSet && nStyleNo != nNo )
{
- SvxRTFStyleType* pDerivedStyle = GetStyleTbl().Get( nStyleNo );
+ SvxRTFStyleType* pDerivedStyle = GetStyleTbl()[ nStyleNo ];
SwCharFmt* pDerivedFmt = NULL;
std::map<sal_Int32,SwCharFmt*>::iterator iter = aCharFmtTbl.find( nStyleNo );
diff --git a/sw/source/ui/docvw/srcedtw.cxx b/sw/source/ui/docvw/srcedtw.cxx
index 91dbf07..bd301e6 100644
--- a/sw/source/ui/docvw/srcedtw.cxx
+++ b/sw/source/ui/docvw/srcedtw.cxx
@@ -606,16 +606,15 @@ IMPL_LINK( SwSrcEditWindow, SyntaxTimerHdl, Timer *, pTimer )
nCur -= 40;
else
nCur = 0;
- if(aSyntaxLineTable.Count())
+ if(maSyntaxLineTable.size())
for(sal_uInt16 i = 0; i < 80 && nCount < 40; i++, nCur++)
{
- void * p = aSyntaxLineTable.Get(nCur);
- if(p)
+ if( maSyntaxLineTable.find( nCur ) != maSyntaxLineTable.end())
{
DoSyntaxHighlight( nCur );
- aSyntaxLineTable.Remove( nCur );
+ maSyntaxLineTable.erase( nCur );
nCount++;
- if(!aSyntaxLineTable.Count())
+ if(!maSyntaxLineTable.size())
break;
if((Time( Time::SYSTEM ).GetTime() - aSyntaxCheckStart.GetTime()) >
MAX_HIGHLIGHTTIME )
{
@@ -626,14 +625,12 @@ IMPL_LINK( SwSrcEditWindow, SyntaxTimerHdl, Timer *, pTimer )
}
// when there is still anything left by then, go on from the beginning
- void* p = aSyntaxLineTable.First();
- while ( p && nCount < MAX_SYNTAX_HIGHLIGHT)
+ while ( !maSyntaxLineTable.empty() && nCount < MAX_SYNTAX_HIGHLIGHT)
{
- nLine = (sal_uInt16)aSyntaxLineTable.GetCurKey();
+ SyntaxLineTable::iterator it = maSyntaxLineTable.begin();
+ nLine = *it;
DoSyntaxHighlight( nLine );
- sal_uInt16 nCurKey = (sal_uInt16)aSyntaxLineTable.GetCurKey();
- p = aSyntaxLineTable.Next();
- aSyntaxLineTable.Remove(nCurKey);
+ maSyntaxLineTable.erase(it);
nCount ++;
if(Time( Time::SYSTEM ).GetTime() - aSyntaxCheckStart.GetTime() > MAX_HIGHLIGHTTIME)
{
@@ -642,7 +639,7 @@ IMPL_LINK( SwSrcEditWindow, SyntaxTimerHdl, Timer *, pTimer )
}
}
- if(aSyntaxLineTable.Count() && !pTimer->IsActive())
+ if(!maSyntaxLineTable.empty() && !pTimer->IsActive())
pTimer->Start();
// SyntaxTimerHdl is called when text changed
// => good opportunity to determine text width!
@@ -683,7 +680,7 @@ void SwSrcEditWindow::DoDelayedSyntaxHighlight( sal_uInt16 nPara )
{
if ( !bHighlighting && bDoSyntaxHighlight )
{
- aSyntaxLineTable.Insert( nPara, (void*)(sal_uInt16)1 );
+ maSyntaxLineTable.insert( nPara );
aSyntaxIdleTimer.Start();
}
}
diff --git a/sw/source/ui/inc/srcedtw.hxx b/sw/source/ui/inc/srcedtw.hxx
index 3439b19..e7ba235 100644
--- a/sw/source/ui/inc/srcedtw.hxx
+++ b/sw/source/ui/inc/srcedtw.hxx
@@ -28,11 +28,12 @@
#ifndef _SRCEDTW_HXX
#define _SRCEDTW_HXX
+#include <set>
+
#include <vcl/window.hxx>
#include <svl/lstner.hxx>
#include <vcl/timer.hxx>
-#include <tools/table.hxx>
#include <svtools/xtextedt.hxx>
namespace com { namespace sun { namespace star { namespace beans {
@@ -96,7 +97,8 @@ private:
sal_Bool bHighlighting;
Timer aSyntaxIdleTimer;
- Table aSyntaxLineTable;
+ typedef std::set<sal_uInt16> SyntaxLineTable;
+ SyntaxLineTable maSyntaxLineTable;
void ImpDoHighlight( const String& rSource, sal_uInt16 nLineOff );
Context
- [Libreoffice] [PATCH] more conversion of tools/Table.hxx to std::map in editeng, sc and sw modules · Noel Grandin
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.