From 4d4a67748e945d901f320d9c3af753abb3211efc Mon Sep 17 00:00:00 2001 From: August Sodora Date: Fri, 23 Dec 2011 02:30:41 -0500 Subject: SV_DECL_VARARR->std::vector --- editeng/inc/editeng/editdata.hxx | 4 --- editeng/inc/editeng/editeng.hxx | 2 +- editeng/inc/editeng/editobj.hxx | 6 ++-- editeng/inc/editeng/unoedsrc.hxx | 1 - editeng/source/editeng/editeng.cxx | 5 +-- editeng/source/editeng/editobj.cxx | 8 ++--- editeng/source/editeng/editobj2.hxx | 2 +- editeng/source/editeng/impedit.hxx | 2 +- editeng/source/editeng/impedit5.cxx | 11 +++--- editeng/source/uno/unoedhlp.cxx | 24 ++++++------- editeng/source/uno/unofored.cxx | 67 ++++++++----------------------------- 11 files changed, 42 insertions(+), 90 deletions(-) (limited to 'editeng') diff --git a/editeng/inc/editeng/editdata.hxx b/editeng/inc/editeng/editdata.hxx index 4e0467f85de8..2ac8a996d0bc 100644 --- a/editeng/inc/editeng/editdata.hxx +++ b/editeng/inc/editeng/editdata.hxx @@ -33,8 +33,6 @@ #include #include "editeng/editengdllapi.h" -#include - class SfxItemSet; class SfxPoolItem; class SvParser; @@ -305,8 +303,6 @@ struct EECharAttrib xub_StrLen nEnd; }; -SV_DECL_VARARR_VISIBILITY( EECharAttribArray, EECharAttrib, 0, 4, EDITENG_DLLPUBLIC ) - struct MoveParagraphsInfo { sal_uInt16 nStartPara; diff --git a/editeng/inc/editeng/editeng.hxx b/editeng/inc/editeng/editeng.hxx index 88111b3378d0..4c0d5e0cc67e 100644 --- a/editeng/inc/editeng/editeng.hxx +++ b/editeng/inc/editeng/editeng.hxx @@ -236,7 +236,7 @@ public: virtual void SetParaAttribs( sal_uInt16 nPara, const SfxItemSet& rSet ); virtual const SfxItemSet& GetParaAttribs( sal_uInt16 nPara ) const; - void GetCharAttribs( sal_uInt16 nPara, EECharAttribArray& rLst ) const; + void GetCharAttribs( sal_uInt16 nPara, std::vector& rLst ) const; SfxItemSet GetAttribs( sal_uInt16 nPara, sal_uInt16 nStart, sal_uInt16 nEnd, sal_uInt8 nFlags = 0xFF ) const; SfxItemSet GetAttribs( const ESelection& rSel, sal_Bool bOnlyHardAttrib = EditEngineAttribs_All ); diff --git a/editeng/inc/editeng/editobj.hxx b/editeng/inc/editeng/editobj.hxx index 98346491a415..e3c9340de590 100644 --- a/editeng/inc/editeng/editobj.hxx +++ b/editeng/inc/editeng/editobj.hxx @@ -34,14 +34,16 @@ #include #include #include +#include #include "editeng/editengdllapi.h" +#include + DBG_NAMEEX( EE_EditTextObject ) class SfxItemPool; class SfxStyleSheetPool; class SvxFieldItem; -class EECharAttribArray; #define EDTOBJ_SETTINGS_ULITEMSUMMATION 0x00000001 #define EDTOBJ_SETTINGS_ULITEMFIRSTPARA 0x00000002 @@ -96,7 +98,7 @@ public: virtual sal_Bool HasOnlineSpellErrors() const; virtual sal_Bool HasCharAttribs( sal_uInt16 nWhich = 0 ) const; - virtual void GetCharAttribs( sal_uInt16 nPara, EECharAttribArray& rLst ) const; + virtual void GetCharAttribs( sal_uInt16 nPara, std::vector& rLst ) const; virtual sal_Bool RemoveCharAttribs( sal_uInt16 nWhich = 0 ); virtual sal_Bool RemoveParaAttribs( sal_uInt16 nWhich = 0 ); diff --git a/editeng/inc/editeng/unoedsrc.hxx b/editeng/inc/editeng/unoedsrc.hxx index 3f45bae909c6..7f31d37a0134 100644 --- a/editeng/inc/editeng/unoedsrc.hxx +++ b/editeng/inc/editeng/unoedsrc.hxx @@ -55,7 +55,6 @@ class SvxViewForwarder; class SvxEditViewForwarder; class SvxFieldItem; class SfxBroadcaster; -class EECharAttribArray; class SvxUnoTextRangeBase; typedef std::list< SvxUnoTextRangeBase* > SvxUnoTextRangeBaseList; diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx index 0ce3ff2a6ab9..2964ad4b0d47 100644 --- a/editeng/source/editeng/editeng.cxx +++ b/editeng/source/editeng/editeng.cxx @@ -97,7 +97,6 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::linguistic2; - DBG_NAME( EditEngine ) DBG_NAMEEX( EditView ) @@ -105,8 +104,6 @@ DBG_NAMEEX( EditView ) static sal_Bool bDebugPaint = sal_False; #endif -SV_IMPL_VARARR( EECharAttribArray, EECharAttrib ); - static SfxItemPool* pGlobalPool=0; // ---------------------------------------------------------------------- @@ -1498,7 +1495,7 @@ const SfxPoolItem& EditEngine::GetParaAttrib( sal_uInt16 nPara, sal_uInt16 nWhic return pImpEditEngine->GetParaAttrib( nPara, nWhich ); } -void EditEngine::GetCharAttribs( sal_uInt16 nPara, EECharAttribArray& rLst ) const +void EditEngine::GetCharAttribs( sal_uInt16 nPara, std::vector& rLst ) const { DBG_CHKTHIS( EditEngine, 0 ); pImpEditEngine->GetCharAttribs( nPara, rLst ); diff --git a/editeng/source/editeng/editobj.cxx b/editeng/source/editeng/editobj.cxx index a5a536d550e6..f039b1245b02 100644 --- a/editeng/source/editeng/editobj.cxx +++ b/editeng/source/editeng/editobj.cxx @@ -235,7 +235,7 @@ sal_Bool EditTextObject::HasCharAttribs( sal_uInt16 ) const return sal_False; } -void EditTextObject::GetCharAttribs( sal_uInt16 /*nPara*/, EECharAttribArray& /*rLst*/ ) const +void EditTextObject::GetCharAttribs( sal_uInt16 /*nPara*/, std::vector& /*rLst*/ ) const { OSL_FAIL( "Virtual method direct from EditTextObject!" ); } @@ -792,9 +792,9 @@ sal_Bool BinTextObject::HasCharAttribs( sal_uInt16 _nWhich ) const return sal_False; } -void BinTextObject::GetCharAttribs( sal_uInt16 nPara, EECharAttribArray& rLst ) const +void BinTextObject::GetCharAttribs( sal_uInt16 nPara, std::vector& rLst ) const { - rLst.Remove( 0, rLst.Count() ); + rLst.clear(); ContentInfo* pC = GetContents().GetObject( nPara ); if ( pC ) { @@ -806,7 +806,7 @@ void BinTextObject::GetCharAttribs( sal_uInt16 nPara, EECharAttribArray& rLst ) aEEAttr.nPara = nPara; aEEAttr.nStart = pAttr->GetStart(); aEEAttr.nEnd = pAttr->GetEnd(); - rLst.Insert( aEEAttr, rLst.Count() ); + rLst.push_back(aEEAttr); } } } diff --git a/editeng/source/editeng/editobj2.hxx b/editeng/source/editeng/editobj2.hxx index 893c2ac8e946..f4a7d2e25026 100644 --- a/editeng/source/editeng/editobj2.hxx +++ b/editeng/source/editeng/editobj2.hxx @@ -247,7 +247,7 @@ public: virtual sal_Bool HasOnlineSpellErrors() const; virtual sal_Bool HasCharAttribs( sal_uInt16 nWhich = 0 ) const; - virtual void GetCharAttribs( sal_uInt16 nPara, EECharAttribArray& rLst ) const; + virtual void GetCharAttribs( sal_uInt16 nPara, std::vector& rLst ) const; virtual sal_Bool RemoveCharAttribs( sal_uInt16 nWhich = 0 ); virtual sal_Bool RemoveParaAttribs( sal_uInt16 nWhich = 0 ); diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx index e427fcd7ec3a..c05b83eedf8c 100644 --- a/editeng/source/editeng/impedit.hxx +++ b/editeng/source/editeng/impedit.hxx @@ -550,7 +550,7 @@ private: sal_uInt16 GetParaAttrib( sal_uInt8 nFunc, EditSelection aSel ); void SetCharAttrib( EditSelection aSel, const SfxPoolItem& rItem ); void ParaAttribsToCharAttribs( ContentNode* pNode ); - void GetCharAttribs( sal_uInt16 nPara, EECharAttribArray& rLst ) const; + void GetCharAttribs( sal_uInt16 nPara, std::vector& rLst ) const; EditTextObject* CreateBinTextObject( EditSelection aSelection, SfxItemPool*, sal_Bool bAllowBigObjects = sal_False, sal_uInt16 nBigObjStart = 0 ) const; void StoreBinTextObject( SvStream& rOStream, BinTextObject& rTextObject ); diff --git a/editeng/source/editeng/impedit5.cxx b/editeng/source/editeng/impedit5.cxx index d46239cb019d..d99e30550fe3 100644 --- a/editeng/source/editeng/impedit5.cxx +++ b/editeng/source/editeng/impedit5.cxx @@ -742,21 +742,22 @@ const SfxPoolItem& ImpEditEngine::GetParaAttrib( sal_uInt16 nPara, sal_uInt16 nW return pNode->GetContentAttribs().GetItem( nWhich ); } -void ImpEditEngine::GetCharAttribs( sal_uInt16 nPara, EECharAttribArray& rLst ) const +void ImpEditEngine::GetCharAttribs( sal_uInt16 nPara, std::vector& rLst ) const { - rLst.Remove( 0, rLst.Count() ); + rLst.clear(); ContentNode* pNode = aEditDoc.GetObject( nPara ); if ( pNode ) { - for ( sal_uInt16 nAttr = 0; nAttr < pNode->GetCharAttribs().Count(); nAttr++ ) + rLst.reserve(pNode->GetCharAttribs().Count()); + for (size_t i = 0; i < pNode->GetCharAttribs().Count(); ++i) { - EditCharAttribPtr pAttr = pNode->GetCharAttribs().GetAttribs()[ nAttr ]; + EditCharAttribPtr pAttr = pNode->GetCharAttribs().GetAttribs()[i]; EECharAttrib aEEAttr; aEEAttr.pAttr = pAttr->GetItem(); aEEAttr.nPara = nPara; aEEAttr.nStart = pAttr->GetStart(); aEEAttr.nEnd = pAttr->GetEnd(); - rLst.Insert( aEEAttr, rLst.Count() ); + rLst.push_back(aEEAttr); } } } diff --git a/editeng/source/uno/unoedhlp.cxx b/editeng/source/uno/unoedhlp.cxx index 03361d733583..306db63440c5 100644 --- a/editeng/source/uno/unoedhlp.cxx +++ b/editeng/source/uno/unoedhlp.cxx @@ -132,37 +132,33 @@ void SvxEditSourceHint::SetEndValue( sal_uLong n ) sal_Bool SvxEditSourceHelper::GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, const EditEngine& rEE, sal_uInt16 nPara, sal_uInt16 nIndex ) { - EECharAttribArray aCharAttribs; + std::vector aCharAttribs; rEE.GetCharAttribs( nPara, aCharAttribs ); // find closest index in front of nIndex - sal_uInt16 nAttr, nCurrIndex; - sal_Int32 nClosestStartIndex; - for( nAttr=0, nClosestStartIndex=0; nAttr::iterator i = aCharAttribs.begin(); i < aCharAttribs.end(); ++i) { - nCurrIndex = aCharAttribs[nAttr].nStart; + nCurrIndex = i->nStart; if( nCurrIndex > nIndex ) break; // aCharAttribs array is sorted in increasing order for nStart values - - if( nCurrIndex > nClosestStartIndex ) + else if( nCurrIndex > nClosestStartIndex ) { nClosestStartIndex = nCurrIndex; } } // find closest index behind of nIndex - sal_Int32 nClosestEndIndex; - for( nAttr=0, nClosestEndIndex=rEE.GetTextLen(nPara); nAttr::iterator i = aCharAttribs.begin(); i < aCharAttribs.end(); ++i) { - nCurrIndex = aCharAttribs[nAttr].nEnd; + nCurrIndex = i->nEnd; - if( nCurrIndex > nIndex && - nCurrIndex < nClosestEndIndex ) - { + if( nCurrIndex > nIndex && nCurrIndex < nClosestEndIndex ) nClosestEndIndex = nCurrIndex; - } } nStartIndex = static_cast( nClosestStartIndex ); diff --git a/editeng/source/uno/unofored.cxx b/editeng/source/uno/unofored.cxx index 5bf77f0d86b4..6761127d7115 100644 --- a/editeng/source/uno/unofored.cxx +++ b/editeng/source/uno/unofored.cxx @@ -177,7 +177,7 @@ void SvxEditEngineForwarder::FieldClicked( const SvxFieldItem& rField, sal_uInt1 sal_uInt16 GetSvxEditEngineItemState( EditEngine& rEditEngine, const ESelection& rSel, sal_uInt16 nWhich ) { - EECharAttribArray aAttribs; + std::vector aAttribs; const SfxPoolItem* pLastItem = NULL; @@ -207,83 +207,44 @@ sal_uInt16 GetSvxEditEngineItemState( EditEngine& rEditEngine, const ESelection& const SfxPoolItem* pParaItem = NULL; - for( sal_uInt16 nAttrib = 0; nAttrib < aAttribs.Count(); nAttrib++ ) + for(std::vector::const_iterator i = aAttribs.begin(); i < aAttribs.end(); ++i) { - struct EECharAttrib aAttrib = aAttribs.GetObject( nAttrib ); - DBG_ASSERT( aAttrib.pAttr, "GetCharAttribs gives corrupt data" ); + DBG_ASSERT(i->pAttr, "GetCharAttribs gives corrupt data"); - const sal_Bool bEmptyPortion = aAttrib.nStart == aAttrib.nEnd; - if( (!bEmptyPortion && (aAttrib.nStart >= nEndPos)) || (bEmptyPortion && (aAttrib.nStart > nEndPos)) ) + const sal_Bool bEmptyPortion = i->nStart == i->nEnd; + if((!bEmptyPortion && i->nStart >= nEndPos) || + (bEmptyPortion && i->nStart > nEndPos)) break; // break if we are already behind our selektion - if( (!bEmptyPortion && (aAttrib.nEnd <= nPos)) || (bEmptyPortion && (aAttrib.nEnd < nPos)) ) + if((!bEmptyPortion && i->nEnd <= nPos) || + (bEmptyPortion && i->nEnd < nPos)) continue; // or if the attribute ends before our selektion - if( aAttrib.pAttr->Which() != nWhich ) + if(i->pAttr->Which() != nWhich) continue; // skip if is not the searched item // if we already found an item if( pParaItem ) { // ... and its different to this one than the state is dont care - if( *pParaItem != *aAttrib.pAttr ) + if(*pParaItem != *(i->pAttr)) return SFX_ITEM_DONTCARE; } else - { - pParaItem = aAttrib.pAttr; - } + pParaItem = i->pAttr; if( bEmpty ) bEmpty = sal_False; - if( !bGaps && aAttrib.nStart > nLastEnd ) + if(!bGaps && i->nStart > nLastEnd) bGaps = sal_True; - nLastEnd = aAttrib.nEnd; + nLastEnd = i->nEnd; } if( !bEmpty && !bGaps && nLastEnd < ( nEndPos - 1 ) ) bGaps = sal_True; -/* - // since we have no portion with our item or if there were gaps - if( bEmpty || bGaps ) - { - // we need to check the paragraph item - const SfxItemSet& rParaSet = rEditEngine.GetParaAttribs( nPara ); - if( rParaSet.GetItemState( nWhich ) == SFX_ITEM_SET ) - { - eState = SFX_ITEM_SET; - // get item from the paragraph - const SfxPoolItem* pTempItem = rParaSet.GetItem( nWhich ); - if( pParaItem ) - { - if( *pParaItem != *pTempItem ) - return SFX_ITEM_DONTCARE; - } - else - { - pParaItem = pTempItem; - } - - // set if theres no last item or if its the same - eParaState = SFX_ITEM_SET; - } - else if( bEmpty ) - { - eParaState = SFX_ITEM_DEFAULT; - } - else if( bGaps ) - { - // gaps and item not set in paragraph, thats a dont care - return SFX_ITEM_DONTCARE; - } - } - else - { - eParaState = SFX_ITEM_SET; - } -*/ + if( bEmpty ) eParaState = SFX_ITEM_DEFAULT; else if( bGaps ) -- cgit