diff options
author | Rafael Dominguez <venccsralph@gmail.com> | 2011-04-26 09:22:55 -0430 |
---|---|---|
committer | Katarina Machalkova <kmachalkova@suse.cz> | 2011-04-28 11:58:18 +0200 |
commit | 99eebb848aa3066143d3238407870f874db9d4e0 (patch) | |
tree | 63f9be6907188073872366224c62152f78a00d34 | |
parent | 1b1a61d4e2084de8f6dd818717ff9a8d4e5af8d8 (diff) |
Remove DECLARE_TABLE( SwRTFStyleTbl, SwTxtFmtColl* )
-rw-r--r-- | sw/source/filter/rtf/rtfnum.cxx | 8 | ||||
-rw-r--r-- | sw/source/filter/rtf/rtftbl.cxx | 17 | ||||
-rw-r--r-- | sw/source/filter/rtf/swparrtf.cxx | 67 | ||||
-rw-r--r-- | sw/source/filter/rtf/swparrtf.hxx | 4 |
4 files changed, 67 insertions, 29 deletions
diff --git a/sw/source/filter/rtf/rtfnum.cxx b/sw/source/filter/rtf/rtfnum.cxx index 5cd65c9e6688..95242b8d3607 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 aac3ef89132d..7b1a18e7be07 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 f24a35a75906..c9fb0df44230 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 fe87687554d5..5d8ac6469f7d 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 |