diff options
author | Daniel Di Marco <d.dimarco@gmx.de> | 2011-10-29 13:24:48 +0200 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2011-11-01 12:19:05 +0000 |
commit | f7303fcac779f99931bfba48e8bfcf9c081af67f (patch) | |
tree | 2ebd76bd8d6d8db36bc87020accf5b22e05afec9 /editeng | |
parent | cca7126c2908c5b9b6693326a3861bb96fae1be3 (diff) |
eliminate SvUShorts type
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/inc/editeng/svxrtf.hxx | 16 | ||||
-rw-r--r-- | editeng/source/rtf/rtfitem.cxx | 16 | ||||
-rw-r--r-- | editeng/source/rtf/svxrtf.cxx | 31 |
3 files changed, 30 insertions, 33 deletions
diff --git a/editeng/inc/editeng/svxrtf.hxx b/editeng/inc/editeng/svxrtf.hxx index f1e932134eac..125ce5535a3f 100644 --- a/editeng/inc/editeng/svxrtf.hxx +++ b/editeng/inc/editeng/svxrtf.hxx @@ -34,8 +34,6 @@ #include <svl/itemset.hxx> #include <svtools/parrtf.hxx> -#define _SVSTDARR_sal_uInt16S -#include <svl/svstdarr.hxx> #include <editeng/editengdllapi.h> #include <deque> @@ -231,9 +229,9 @@ class EDITENG_DLLPUBLIC SvxRTFParser : public SvRTFParser SvxRTFItemStack aAttrStack; SvxRTFItemStackList aAttrSetList; - SvUShorts aPlainMap; - SvUShorts aPardMap; - SvUShorts aWhichMap; + std::vector<sal_uInt16> aPlainMap; + std::vector<sal_uInt16> aPardMap; + std::vector<sal_uInt16> aWhichMap; String sBaseURL; SvxPosition* pInsPos; @@ -360,8 +358,8 @@ protected: // Query/Set the mapping IDs for the Pard/Plain attributes //(Set: It is noted in the pointers, which thus does not create a copy) - void AddPardAttr( sal_uInt16 nWhich ) { aPardMap.Insert( nWhich, aPardMap.Count() ); } - void AddPlainAttr( sal_uInt16 nWhich ) { aPlainMap.Insert( nWhich, aPlainMap.Count() ); } + void AddPardAttr( sal_uInt16 nWhich ) { aPardMap.push_back( nWhich ); } + void AddPlainAttr( sal_uInt16 nWhich ) { aPlainMap.push_back( nWhich ); } SvxRTFStyleTbl& GetStyleTbl() { return aStyleTbl; } SvxRTFItemStack& GetAttrStack() { return aAttrStack; } @@ -393,9 +391,9 @@ public: void SetAttrPool( SfxItemPool* pNewPool ) { pAttrPool = pNewPool; } // to set different WhichIds for a different pool. RTFPardAttrMapIds& GetPardMap() - { return (RTFPardAttrMapIds&)*aPardMap.GetData(); } + { return (RTFPardAttrMapIds&)*aPardMap.begin(); } RTFPlainAttrMapIds& GetPlainMap() - { return (RTFPlainAttrMapIds&)*aPlainMap.GetData(); } + { return (RTFPlainAttrMapIds&)*aPlainMap.begin(); } // to be able to assign them from the outside as for example table cells void ReadBorderAttr( int nToken, SfxItemSet& rSet, int bTableDef=sal_False ); void ReadBackgroundAttr( int nToken, SfxItemSet& rSet, int bTableDef=sal_False ); diff --git a/editeng/source/rtf/rtfitem.cxx b/editeng/source/rtf/rtfitem.cxx index d97c05b3d67f..e04113ef6a87 100644 --- a/editeng/source/rtf/rtfitem.cxx +++ b/editeng/source/rtf/rtfitem.cxx @@ -109,14 +109,14 @@ inline const SvxLRSpaceItem& GetLRSpace(const SfxItemSet& rSet,sal_uInt16 nId,sa inline const SvxULSpaceItem& GetULSpace(const SfxItemSet& rSet,sal_uInt16 nId,sal_Bool bInP=sal_True) { return (const SvxULSpaceItem&)rSet.Get( nId,bInP); } -#define PARDID ((RTFPardAttrMapIds*)aPardMap.GetData()) -#define PLAINID ((RTFPlainAttrMapIds*)aPlainMap.GetData()) +#define PARDID ((RTFPardAttrMapIds*)&aPardMap[0]) +#define PLAINID ((RTFPlainAttrMapIds*)&aPlainMap[0]) void SvxRTFParser::SetScriptAttr( RTF_CharTypeDef eType, SfxItemSet& rSet, SfxPoolItem& rItem ) { const sal_uInt16 *pNormal = 0, *pCJK = 0, *pCTL = 0; - const RTFPlainAttrMapIds* pIds = (RTFPlainAttrMapIds*)aPlainMap.GetData(); + const RTFPlainAttrMapIds* pIds = (RTFPlainAttrMapIds*)&aPlainMap[0]; switch( rItem.Which() ) { case SID_ATTR_CHAR_FONT: @@ -1761,13 +1761,13 @@ void SvxRTFParser::RTFPardPlain( int bPard, SfxItemSet** ppSet ) if( bPard ) { pAkt->nStyleNo = 0; - pPtr = aPardMap.GetData(); - nCnt = aPardMap.Count(); + pPtr = &aPardMap[0]; + nCnt = aPardMap.size(); } else { - pPtr = aPlainMap.GetData(); - nCnt = aPlainMap.Count(); + pPtr = &aPlainMap[0]; + nCnt = aPlainMap.size(); } for( sal_uInt16 n = 0; n < nCnt; ++n, ++pPtr ) @@ -1827,7 +1827,7 @@ void SvxRTFParser::SetDefault( int nToken, int nValue ) if( !bNewDoc ) return; - SfxItemSet aTmp( *pAttrPool, aWhichMap.GetData() ); + SfxItemSet aTmp( *pAttrPool, &aWhichMap[0] ); sal_Bool bOldFlag = bIsLeftToRightDef; bIsLeftToRightDef = sal_True; switch( nToken ) diff --git a/editeng/source/rtf/svxrtf.cxx b/editeng/source/rtf/svxrtf.cxx index e24905345aea..beec9c66a21b 100644 --- a/editeng/source/rtf/svxrtf.cxx +++ b/editeng/source/rtf/svxrtf.cxx @@ -94,13 +94,13 @@ SvxRTFParser::SvxRTFParser( SfxItemPool& rPool, SvStream& rIn, { RTFPlainAttrMapIds aTmp( rPool ); - aPlainMap.Insert( (sal_uInt16*)&aTmp, - sizeof( RTFPlainAttrMapIds ) / sizeof(sal_uInt16), 0 ); + aPlainMap.insert( aPlainMap.begin(), (sal_uInt16*)&aTmp, + (sal_uInt16*)&aTmp + (sizeof( RTFPlainAttrMapIds ) / sizeof(sal_uInt16)) ); } { RTFPardAttrMapIds aTmp( rPool ); - aPardMap.Insert( (sal_uInt16*)&aTmp, - sizeof( RTFPardAttrMapIds ) / sizeof(sal_uInt16), 0 ); + aPardMap.insert( aPardMap.begin(), (sal_uInt16*)&aTmp, + (sal_uInt16*)&aTmp + (sizeof( RTFPardAttrMapIds ) / sizeof(sal_uInt16)) ); } pDfltFont = new Font; pDfltColor = new Color; @@ -340,7 +340,7 @@ void SvxRTFParser::ReadStyleTable() int nToken, bSaveChkStyleAttr = bChkStyleAttr; short nStyleNo = 0; int _nOpenBrakets = 1; // the first was already detected earlier!! - SvxRTFStyleType* pStyle = new SvxRTFStyleType( *pAttrPool, aWhichMap.GetData() ); + SvxRTFStyleType* pStyle = new SvxRTFStyleType( *pAttrPool, &aWhichMap[0] ); pStyle->aAttrSet.Put( GetRTFDefaults() ); bIsInReadStyleTab = sal_True; @@ -396,7 +396,7 @@ void SvxRTFParser::ReadStyleTable() } // All data from the font is available, so off to the table aStyleTbl.Insert( nStyleNo, pStyle ); - pStyle = new SvxRTFStyleType( *pAttrPool, aWhichMap.GetData() ); + pStyle = new SvxRTFStyleType( *pAttrPool, &aWhichMap[0] ); pStyle->aAttrSet.Put( GetRTFDefaults() ); nStyleNo = 0; } @@ -841,7 +841,7 @@ const Font& SvxRTFParser::GetFont( sal_uInt16 nId ) { const SvxFontItem& rDfltFont = (const SvxFontItem&) pAttrPool->GetDefaultItem( - ((RTFPlainAttrMapIds*)aPlainMap.GetData())->nFont ); + ((RTFPlainAttrMapIds*)&aPlainMap[0])->nFont ); pDfltFont->SetName( rDfltFont.GetStyleName() ); pDfltFont->SetFamily( rDfltFont.GetFamily() ); pFont = pDfltFont; @@ -856,7 +856,7 @@ SvxRTFItemStackType* SvxRTFParser::_GetAttrSet( int bCopyAttr ) if( pAkt ) pNew = new SvxRTFItemStackType( *pAkt, *pInsPos, bCopyAttr ); else - pNew = new SvxRTFItemStackType( *pAttrPool, aWhichMap.GetData(), + pNew = new SvxRTFItemStackType( *pAttrPool, &aWhichMap[0], *pInsPos ); pNew->SetRTFDefaults( GetRTFDefaults() ); @@ -982,7 +982,7 @@ void SvxRTFParser::AttrGroupEnd() // process the current, delete from Stack pNew->aAttrSet.SetParent( pOld->aAttrSet.GetParent() ); // Delete all paragraph attributes from pNew - for( sal_uInt16 n = 0; n < aPardMap.Count() && + for( sal_uInt16 n = 0; n < aPardMap.size() && pNew->aAttrSet.Count(); ++n ) if( aPardMap[n] ) pNew->aAttrSet.ClearItem( aPardMap[n] ); @@ -1132,24 +1132,23 @@ void SvxRTFParser::SetAttrInDoc( SvxRTFItemStackType & ) void SvxRTFParser::BuildWhichTbl() { - if( aWhichMap.Count() ) - aWhichMap.Remove( 0, aWhichMap.Count() ); - aWhichMap.Insert( (sal_uInt16)0, (sal_uInt16)0 ); + aWhichMap.clear(); + aWhichMap.push_back( 0 ); // Building a Which-Map 'rWhichMap' from an Array of // 'pWhichIds' frm Which-Ids. It has the long 'nWhichIds'. // The Which-Map is not going to be deleted. - SvParser::BuildWhichTbl( aWhichMap, (sal_uInt16*)aPardMap.GetData(), aPardMap.Count() ); - SvParser::BuildWhichTbl( aWhichMap, (sal_uInt16*)aPlainMap.GetData(), aPlainMap.Count() ); + SvParser::BuildWhichTbl( aWhichMap, (sal_uInt16*)&aPardMap[0], aPardMap.size() ); + SvParser::BuildWhichTbl( aWhichMap, (sal_uInt16*)&aPlainMap[0], aPlainMap.size() ); } const SfxItemSet& SvxRTFParser::GetRTFDefaults() { if( !pRTFDefaults ) { - pRTFDefaults = new SfxItemSet( *pAttrPool, aWhichMap.GetData() ); + pRTFDefaults = new SfxItemSet( *pAttrPool, &aWhichMap[0] ); sal_uInt16 nId; - if( 0 != ( nId = ((RTFPardAttrMapIds*)aPardMap.GetData())->nScriptSpace )) + if( 0 != ( nId = ((RTFPardAttrMapIds*)&aPardMap[0])->nScriptSpace )) { SvxScriptSpaceItem aItem( sal_False, nId ); if( bNewDoc ) |