[Libreoffice-commits] .: sw/source
Katarina Machalkova
bubli at kemper.freedesktop.org
Thu Apr 28 03:29:46 PDT 2011
sw/source/filter/rtf/rtffld.cxx | 12 +++++++++---
sw/source/filter/rtf/swparrtf.cxx | 19 ++++++++++++-------
sw/source/filter/rtf/swparrtf.hxx | 3 +--
3 files changed, 22 insertions(+), 12 deletions(-)
New commits:
commit 29ce3d67f26794d693b2d49ebece6ad5ac89190c
Author: Rafael Dominguez <venccsralph at gmail.com>
Date: Tue Apr 26 10:17:07 2011 -0430
Remove DECLARE_TABLE( SwRTFCharStyleTbl, SwCharFmt* )
diff --git a/sw/source/filter/rtf/rtffld.cxx b/sw/source/filter/rtf/rtffld.cxx
index e14fdf2..106b113 100644
--- a/sw/source/filter/rtf/rtffld.cxx
+++ b/sw/source/filter/rtf/rtffld.cxx
@@ -687,9 +687,15 @@ int SwRTFParser::MakeFieldInst( String& rFieldStr )
}
SwFmtRuby aRuby( aData.sUp );
- SwCharFmt * pCharFmt = -1 != aData.nStyleNo
- ? aCharFmtTbl.Get( aData.nStyleNo )
- : 0;
+ SwCharFmt * pCharFmt = NULL;
+
+ if ( aData.nStyleNo != -1)
+ {
+ std::map<sal_Int32,SwCharFmt*>::iterator iter = aCharFmtTbl.find(aData.nStyleNo);
+
+ if (iter != aCharFmtTbl.end())
+ pCharFmt = iter->second;
+ }
if( !pCharFmt )
{
diff --git a/sw/source/filter/rtf/swparrtf.cxx b/sw/source/filter/rtf/swparrtf.cxx
index d793832..f7f48f0 100644
--- a/sw/source/filter/rtf/swparrtf.cxx
+++ b/sw/source/filter/rtf/swparrtf.cxx
@@ -2702,7 +2702,7 @@ void SwRTFParser::MakeStyleTab()
sal_uInt16 nNo = sal_uInt16( GetStyleTbl().GetCurKey() );
if( pStyle->bIsCharFmt )
{
- if( !aCharFmtTbl.Get( nNo ) )
+ if(aCharFmtTbl.find( nNo ) == aCharFmtTbl.end())
// existiert noch nicht, also anlegen
MakeCharStyle( nNo, *pStyle );
}
@@ -4009,7 +4009,7 @@ SwCharFmt* SwRTFParser::MakeCharStyle( sal_uInt16 nNo, const SvxRTFStyleType& rS
{
int bCollExist;
SwCharFmt* pFmt = MakeCharFmt( rStyle.sName, sal_uInt16(nNo), bCollExist );
- aCharFmtTbl.Insert( nNo, pFmt );
+ aCharFmtTbl.insert(std::make_pair(nNo,pFmt));
// in bestehendes Dok einfuegen, dann keine Ableitung usw. setzen
if( bCollExist )
@@ -4019,14 +4019,18 @@ SwCharFmt* SwRTFParser::MakeCharStyle( sal_uInt16 nNo, const SvxRTFStyleType& rS
if( rStyle.bBasedOnIsSet && nStyleNo != nNo )
{
SvxRTFStyleType* pDerivedStyle = GetStyleTbl().Get( nStyleNo );
- SwCharFmt* pDerivedFmt = aCharFmtTbl.Get( nStyleNo );
- if( !pDerivedFmt ) // noch nicht vorhanden, also anlegen
+ SwCharFmt* pDerivedFmt = NULL;
+ std::map<sal_Int32,SwCharFmt*>::iterator iter = aCharFmtTbl.find( nStyleNo );
+
+ if(iter == aCharFmtTbl.end()) // noch nicht vorhanden, also anlegen
{
// ist die ueberhaupt als Style vorhanden ?
pDerivedFmt = pDerivedStyle
? MakeCharStyle( nStyleNo, *pDerivedStyle )
: pDoc->GetDfltCharFmt();
}
+ else
+ pDerivedFmt = iter->second;
if( pFmt == pDerivedFmt )
((SfxItemSet&)pFmt->GetAttrSet()).Put( rStyle.aAttrSet );
@@ -4162,9 +4166,10 @@ void SwRTFParser::UnknownAttrToken( int nToken, SfxItemSet* pSet )
break;
case RTF_CS:
{
- SwCharFmt* pFmt = aCharFmtTbl.Get( nTokenValue );
- if( pFmt )
- pSet->Put( SwFmtCharFmt( pFmt ));
+ std::map<sal_Int32,SwCharFmt*>::iterator iter = aCharFmtTbl.find( nTokenValue );
+
+ if(iter != aCharFmtTbl.end())
+ pSet->Put( SwFmtCharFmt(iter->second));
}
break;
diff --git a/sw/source/filter/rtf/swparrtf.hxx b/sw/source/filter/rtf/swparrtf.hxx
index fbd178a..7ad4d54 100644
--- a/sw/source/filter/rtf/swparrtf.hxx
+++ b/sw/source/filter/rtf/swparrtf.hxx
@@ -146,7 +146,6 @@ struct SwListEntry
bRuleUsed = sal_False; }
};
-DECLARE_TABLE( SwRTFCharStyleTbl, SwCharFmt* )
typedef SwFlySave* SwFlySavePtr;
SV_DECL_PTRARR_DEL( SwFlySaveArr, SwFlySavePtr, 0, 20 )
typedef std::deque< SwListEntry > SwListArr;
@@ -287,7 +286,7 @@ class SwRTFParser : public SvxRTFParser
sw::util::InsertedTablesManager maInsertedTables;
std::map<sal_Int32,SwTxtFmtColl*> aTxtCollTbl;
- SwRTFCharStyleTbl aCharFmtTbl;
+ std::map<sal_Int32,SwCharFmt*> aCharFmtTbl;
SwFlySaveArr aFlyArr; // Flys als Letzes im Doc setzen
std::vector<bool> aMergeBoxes; // Flags fuer gemergte Zellen
SwListArr aListArr;
More information about the Libreoffice-commits
mailing list