summaryrefslogtreecommitdiffstats
path: root/sw
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2012-02-21 19:01:17 +0400
committerIvan Timofeev <timofeev.i.s@gmail.com>2012-02-21 20:05:23 +0400
commita4aa96be3a9e24099a45850cadd5074d2db9a199 (patch)
tree720a4b9d019887420211d0d5d4bae284ca9a88a5 /sw
parentflylay - add back ';' removed in error (diff)
downloadcore-a4aa96be3a9e24099a45850cadd5074d2db9a199.tar.gz
core-a4aa96be3a9e24099a45850cadd5074d2db9a199.zip
convert svxrtf.hxx in editeng module from table.hxx to std::map
Diffstat (limited to 'sw')
-rw-r--r--sw/source/filter/rtf/rtffld.cxx8
-rw-r--r--sw/source/filter/rtf/rtfnum.cxx16
-rw-r--r--sw/source/filter/rtf/swparrtf.cxx38
3 files changed, 38 insertions, 24 deletions
diff --git a/sw/source/filter/rtf/rtffld.cxx b/sw/source/filter/rtf/rtffld.cxx
index 51741e10a787..9750d5258061 100644
--- a/sw/source/filter/rtf/rtffld.cxx
+++ b/sw/source/filter/rtf/rtffld.cxx
@@ -595,8 +595,11 @@ 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 +611,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 07b33195da90..f6eb0c015a52 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().empty() )
{
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();
+ SvxRTFStyleTbl::iterator it = GetStyleTbl().begin();
do {
+ 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 =
@@ -635,7 +636,8 @@ void SwRTFParser::ReadListOverrideTable()
pStyle->aAttrSet.ClearItem( FN_PARAM_NUM_LEVEL );
- } while( 0 != (pStyle = GetStyleTbl().Next()) );
+ ++it;
+ } while( it != GetStyleTbl().end() );
}
SkipToken( -1 ); // die schliesende Klammer wird "oben" ausgewertet
@@ -723,17 +725,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::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 81abb16d8a0f..cfff8720bb24 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().empty() )
{
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)
+ {
+ sal_uInt16 nNo = it->first;
+ SvxRTFStyleType* pStyle = it->second;
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,10 @@ SwTxtFmtColl* SwRTFParser::MakeStyle( sal_uInt16 nNo, const SvxRTFStyleType& rSt
sal_uInt16 nStyleNo = rStyle.nBasedOn;
if( rStyle.bBasedOnIsSet && nStyleNo != nNo )
{
- SvxRTFStyleType* pDerivedStyle = GetStyleTbl().Get( nStyleNo );
+ SvxRTFStyleTbl::iterator styleIter = GetStyleTbl().find( nStyleNo );
+ SvxRTFStyleType* pDerivedStyle = NULL;
+ if ( styleIter != GetStyleTbl().end() )
+ pDerivedStyle = styleIter->second;
SwTxtFmtColl* pDerivedColl = NULL;
std::map<sal_Int32,SwTxtFmtColl*>::iterator iter = aTxtCollTbl.find(nStyleNo);
@@ -4041,10 +4046,11 @@ 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 );
- pNext = pMkStyle
- ? MakeStyle( nStyleNo, *pMkStyle )
- : pDoc->GetTxtCollFromPool( RES_POOLCOLL_STANDARD, false );
+ SvxRTFStyleTbl::iterator styleIter = GetStyleTbl().find( nStyleNo );
+ if ( styleIter != GetStyleTbl().end() )
+ pNext = MakeStyle( nStyleNo, *styleIter->second );
+ else
+ pNext = pDoc->GetTxtCollFromPool( RES_POOLCOLL_STANDARD, false );
}
else
pNext = iter->second;
@@ -4067,7 +4073,11 @@ SwCharFmt* SwRTFParser::MakeCharStyle( sal_uInt16 nNo, const SvxRTFStyleType& rS
sal_uInt16 nStyleNo = rStyle.nBasedOn;
if( rStyle.bBasedOnIsSet && nStyleNo != nNo )
{
- SvxRTFStyleType* pDerivedStyle = GetStyleTbl().Get( nStyleNo );
+ SvxRTFStyleTbl::iterator styleIter = GetStyleTbl().find( nStyleNo );
+ SvxRTFStyleType* pDerivedStyle = NULL;
+ if ( styleIter != GetStyleTbl().end() )
+ pDerivedStyle = styleIter->second;
+
SwCharFmt* pDerivedFmt = NULL;
std::map<sal_Int32,SwCharFmt*>::iterator iter = aCharFmtTbl.find( nStyleNo );