[Libreoffice-commits] .: sw/source
Katarina Machalkova
bubli at kemper.freedesktop.org
Thu Apr 28 03:05:50 PDT 2011
sw/source/filter/rtf/rtfnum.cxx | 8 ++--
sw/source/filter/rtf/rtftbl.cxx | 17 +++++++--
sw/source/filter/rtf/swparrtf.cxx | 67 +++++++++++++++++++++++++++-----------
sw/source/filter/rtf/swparrtf.hxx | 4 +-
4 files changed, 67 insertions(+), 29 deletions(-)
New commits:
commit 4a5cdae780929efb81ce993fcd28d36a161813a9
Author: Rafael Dominguez <venccsralph at gmail.com>
Date: Tue Apr 26 09:22:55 2011 -0430
Remove DECLARE_TABLE( SwRTFStyleTbl, SwTxtFmtColl* )
diff --git a/sw/source/filter/rtf/rtfnum.cxx b/sw/source/filter/rtf/rtfnum.cxx
index dc280fd..be2ec0f 100644
--- a/sw/source/filter/rtf/rtfnum.cxx
+++ b/sw/source/filter/rtf/rtfnum.cxx
@@ -593,18 +593,18 @@ void SwRTFParser::ReadListOverrideTable()
MakeStyleTab();
const SfxPoolItem* pItem( 0 );
- const SwTxtFmtColl* pColl( 0 );
+ std::map<sal_Int32,SwTxtFmtColl*>::const_iterator iterColl;
sal_uInt16 nRulePos( USHRT_MAX );
const SwNumRule *pNumRule = 0;
SvxRTFStyleType* pStyle = GetStyleTbl().First();
do {
if ( MAXLEVEL > pStyle->nOutlineNo )
{
- pColl = aTxtCollTbl.Get( (sal_uInt16)GetStyleTbl().GetCurKey() );
- if ( pColl )
+ iterColl = aTxtCollTbl.find( (sal_uInt16)GetStyleTbl().GetCurKey() );
+ if ( iterColl != aTxtCollTbl.end() )
{
const SfxItemState eItemState =
- pColl->GetItemState( RES_PARATR_NUMRULE, sal_False, &pItem );
+ iterColl->second->GetItemState( RES_PARATR_NUMRULE, sal_False, &pItem );
if ( eItemState == SFX_ITEM_SET )
{
nRulePos = pDoc->FindNumRule( ((SwNumRuleItem*)pItem)->GetValue() );
diff --git a/sw/source/filter/rtf/rtftbl.cxx b/sw/source/filter/rtf/rtftbl.cxx
index 3b3b318..5b46a54 100644
--- a/sw/source/filter/rtf/rtftbl.cxx
+++ b/sw/source/filter/rtf/rtftbl.cxx
@@ -701,9 +701,13 @@ void SwRTFParser::ReadTable( int nToken )
if( aBoxFmts.Count() )
{
// setze das default Style
- SwTxtFmtColl* pColl = aTxtCollTbl.Get( 0 );
- if( !pColl )
+ SwTxtFmtColl* pColl = NULL;
+ std::map<sal_Int32,SwTxtFmtColl*>::iterator iter = aTxtCollTbl.find(0);
+
+ if( iter == aTxtCollTbl.end() )
pColl = pDoc->GetTxtCollFromPool( RES_POOLCOLL_STANDARD, false );
+ else
+ pColl = iter->second;
sal_uInt16 nStt = 0;
if( bNewTbl )
@@ -907,9 +911,14 @@ void SwRTFParser::NewTblLine()
// alle Nodes in den Boxen auf die "default" Vorlage setzten
{
- SwTxtFmtColl* pColl = aTxtCollTbl.Get( 0 );
- if( !pColl )
+ SwTxtFmtColl* pColl = NULL;
+ std::map<sal_Int32,SwTxtFmtColl*>::iterator iter = aTxtCollTbl.find( 0 );
+
+ if( iter == aTxtCollTbl.end() )
pColl = pDoc->GetTxtCollFromPool( RES_POOLCOLL_STANDARD, false );
+ else
+ pColl = iter->second;
+
pPam->SetMark();
pLine = (*pLns)[ pLns->Count()-1 ];
diff --git a/sw/source/filter/rtf/swparrtf.cxx b/sw/source/filter/rtf/swparrtf.cxx
index 6391764..d793832 100644
--- a/sw/source/filter/rtf/swparrtf.cxx
+++ b/sw/source/filter/rtf/swparrtf.cxx
@@ -2026,9 +2026,14 @@ void SwRTFParser::InsertPara()
if( !bStyleTabValid )
MakeStyleTab();
- SwTxtFmtColl* pColl = aTxtCollTbl.Get( 0 );
- if( !pColl )
+ SwTxtFmtColl* pColl = NULL;
+ std::map<sal_Int32,SwTxtFmtColl*>::iterator iter = aTxtCollTbl.find(0);
+
+ if( iter == aTxtCollTbl.end() )
pColl = pDoc->GetTxtCollFromPool( RES_POOLCOLL_STANDARD, false );
+ else
+ pColl = iter->second;
+
pDoc->SetTxtFmtColl( *pPam, pColl );
::SetProgressState( rInput.Tell(), pDoc->GetDocShell() );
@@ -2121,9 +2126,11 @@ void SwRTFParser::SetAttrInDoc( SvxRTFItemStackType &rSet )
// setze jetzt das Style
if( !bStyleTabValid )
MakeStyleTab();
- SwTxtFmtColl* pColl = aTxtCollTbl.Get( rSet.StyleNo() );
- if( pColl )
- pDoc->SetTxtFmtColl( aPam, pColl, false );
+
+ std::map<sal_Int32,SwTxtFmtColl*>::iterator iter = aTxtCollTbl.find(rSet.StyleNo());
+
+ if (iter != aTxtCollTbl.end())
+ pDoc->SetTxtFmtColl( aPam, iter->second, false );
}
const SfxPoolItem* pItem;
@@ -2647,11 +2654,13 @@ void SwRTFParser::ReadDocControls( int nToken )
MakeStyleTab();
- SwTxtFmtColl* pColl = aTxtCollTbl.Get(0);
- if (!pColl)
- {
+ SwTxtFmtColl *pColl = NULL;
+ std::map<sal_Int32,SwTxtFmtColl*>::iterator iter = aTxtCollTbl.find(0);
+
+ if (iter == aTxtCollTbl.end())
pColl = pDoc->GetTxtCollFromPool(RES_POOLCOLL_STANDARD, false );
- }
+ else
+ pColl = iter->second;
OSL_ENSURE(pColl, "impossible to have no standard style");
@@ -2697,7 +2706,7 @@ void SwRTFParser::MakeStyleTab()
// existiert noch nicht, also anlegen
MakeCharStyle( nNo, *pStyle );
}
- else if( !aTxtCollTbl.Get( nNo ) )
+ else if( aTxtCollTbl.find( nNo ) == aTxtCollTbl.end() )
{
// existiert noch nicht, also anlegen
MakeStyle( nNo, *pStyle );
@@ -3180,9 +3189,14 @@ void SwRTFParser::ReadPageDescTbl()
// diese auch in den Headers/Footer benutzt werden koennen!
MakeStyleTab();
// das default-Style schon gleich am ersten Node setzen
- SwTxtFmtColl* pColl = aTxtCollTbl.Get( 0 );
- if( !pColl )
+ SwTxtFmtColl* pColl = NULL;
+ std::map<sal_Int32,SwTxtFmtColl*>::iterator iter = aTxtCollTbl.find( 0 );
+
+ if( iter == aTxtCollTbl.end() )
pColl = pDoc->GetTxtCollFromPool( RES_POOLCOLL_STANDARD, false );
+ else
+ pColl = iter->second;
+
pDoc->SetTxtFmtColl( *pPam, pColl );
int nToken, bSaveChkStyleAttr = IsChkStyleAttr();
@@ -3643,9 +3657,14 @@ void SwRTFParser::ReadHeaderFooter( int nToken, SwPageDesc* pPageDesc )
pPam->GetPoint()->nNode = *pNode->EndOfSectionNode();
pPam->Move( fnMoveBackward );
- SwTxtFmtColl* pColl = aTxtCollTbl.Get( 0 );
- if( !pColl )
+ SwTxtFmtColl* pColl = NULL;
+ std::map<sal_Int32,SwTxtFmtColl*>::iterator iter = aTxtCollTbl.find( 0 );
+
+ if( iter == aTxtCollTbl.end() )
pColl = pDoc->GetTxtCollFromPool( RES_POOLCOLL_STANDARD, false );
+ else
+ pColl = iter->second;
+
pDoc->SetTxtFmtColl( *pPam, pColl );
SetNewGroup( sal_True );
@@ -3919,7 +3938,7 @@ SwTxtFmtColl* SwRTFParser::MakeStyle( sal_uInt16 nNo, const SvxRTFStyleType& rSt
bool bCollExist;
SwTxtFmtColl* pColl = MakeColl( rStyle.sName, sal_uInt16(nNo),
rStyle.nOutlineNo, bCollExist);
- aTxtCollTbl.Insert( nNo, pColl );
+ aTxtCollTbl.insert(std::make_pair(nNo,pColl));
// in bestehendes Dok einfuegen, dann keine Ableitung usw. setzen
if( bCollExist )
@@ -3929,14 +3948,19 @@ SwTxtFmtColl* SwRTFParser::MakeStyle( sal_uInt16 nNo, const SvxRTFStyleType& rSt
if( rStyle.bBasedOnIsSet && nStyleNo != nNo )
{
SvxRTFStyleType* pDerivedStyle = GetStyleTbl().Get( nStyleNo );
- SwTxtFmtColl* pDerivedColl = aTxtCollTbl.Get( nStyleNo );
- if( !pDerivedColl ) // noch nicht vorhanden, also anlegen
+
+ SwTxtFmtColl* pDerivedColl = NULL;
+ std::map<sal_Int32,SwTxtFmtColl*>::iterator iter = aTxtCollTbl.find(nStyleNo);
+
+ if(iter == aTxtCollTbl.end() ) // noch nicht vorhanden, also anlegen
{
// ist die ueberhaupt als Style vorhanden ?
pDerivedColl = pDerivedStyle
? MakeStyle( nStyleNo, *pDerivedStyle )
: pDoc->GetTxtCollFromPool( RES_POOLCOLL_STANDARD, false );
}
+ else
+ pDerivedColl = iter->second;
if( pColl == pDerivedColl )
((SfxItemSet&)pColl->GetAttrSet()).Put( rStyle.aAttrSet );
@@ -3962,8 +3986,10 @@ SwTxtFmtColl* SwRTFParser::MakeStyle( sal_uInt16 nNo, const SvxRTFStyleType& rSt
nStyleNo = rStyle.nNext;
if( nStyleNo != nNo )
{
- SwTxtFmtColl* pNext = aTxtCollTbl.Get( nStyleNo );
- if( !pNext ) // noch nicht vorhanden, also anlegen
+ SwTxtFmtColl* pNext = NULL;
+ std::map<sal_Int32,SwTxtFmtColl*>::iterator iter = aTxtCollTbl.find( nStyleNo );
+
+ if( iter == aTxtCollTbl.end()) // noch nicht vorhanden, also anlegen
{
// ist die ueberhaupt als Style vorhanden ?
SvxRTFStyleType* pMkStyle = GetStyleTbl().Get( nStyleNo );
@@ -3971,6 +3997,9 @@ SwTxtFmtColl* SwRTFParser::MakeStyle( sal_uInt16 nNo, const SvxRTFStyleType& rSt
? MakeStyle( nStyleNo, *pMkStyle )
: pDoc->GetTxtCollFromPool( RES_POOLCOLL_STANDARD, false );
}
+ else
+ pNext = iter->second;
+
pColl->SetNextTxtFmtColl( *pNext );
}
return pColl;
diff --git a/sw/source/filter/rtf/swparrtf.hxx b/sw/source/filter/rtf/swparrtf.hxx
index 0d83382..fbd178a 100644
--- a/sw/source/filter/rtf/swparrtf.hxx
+++ b/sw/source/filter/rtf/swparrtf.hxx
@@ -31,6 +31,7 @@
#include <deque>
#include <vector>
+#include <map>
#include <editeng/svxrtf.hxx>
#include <editeng/numitem.hxx>
@@ -145,7 +146,6 @@ struct SwListEntry
bRuleUsed = sal_False; }
};
-DECLARE_TABLE( SwRTFStyleTbl, SwTxtFmtColl* )
DECLARE_TABLE( SwRTFCharStyleTbl, SwCharFmt* )
typedef SwFlySave* SwFlySavePtr;
SV_DECL_PTRARR_DEL( SwFlySaveArr, SwFlySavePtr, 0, 20 )
@@ -286,7 +286,7 @@ class SwRTFParser : public SvxRTFParser
rtfSections maSegments;
sw::util::InsertedTablesManager maInsertedTables;
- SwRTFStyleTbl aTxtCollTbl;
+ std::map<sal_Int32,SwTxtFmtColl*> aTxtCollTbl;
SwRTFCharStyleTbl aCharFmtTbl;
SwFlySaveArr aFlyArr; // Flys als Letzes im Doc setzen
std::vector<bool> aMergeBoxes; // Flags fuer gemergte Zellen
More information about the Libreoffice-commits
mailing list