[Libreoffice-commits] .: editeng/inc editeng/source starmath/source svx/source sw/source
August Sodora
augsod at kemper.freedesktop.org
Fri Dec 23 11:52:48 PST 2011
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 +++++-------------------
starmath/source/accessibility.cxx | 23 +++-----
svx/source/sdr/properties/textproperties.cxx | 25 +++------
sw/source/filter/ww8/wrtw8esh.cxx | 75 +++++++++------------------
sw/source/filter/ww8/wrtww8.hxx | 2
15 files changed, 90 insertions(+), 167 deletions(-)
New commits:
commit 4d4a67748e945d901f320d9c3af753abb3211efc
Author: August Sodora <augsod at gmail.com>
Date: Fri Dec 23 02:30:41 2011 -0500
SV_DECL_VARARR->std::vector
diff --git a/editeng/inc/editeng/editdata.hxx b/editeng/inc/editeng/editdata.hxx
index 4e0467f..2ac8a99 100644
--- a/editeng/inc/editeng/editdata.hxx
+++ b/editeng/inc/editeng/editdata.hxx
@@ -33,8 +33,6 @@
#include <tools/string.hxx>
#include "editeng/editengdllapi.h"
-#include <svl/svarray.hxx>
-
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 88111b3..4c0d5e0 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<EECharAttrib>& 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 9834649..e3c9340 100644
--- a/editeng/inc/editeng/editobj.hxx
+++ b/editeng/inc/editeng/editobj.hxx
@@ -34,14 +34,16 @@
#include <rsc/rscsfx.hxx>
#include <svl/itemset.hxx>
#include <editeng/eeitem.hxx>
+#include <editeng/editdata.hxx>
#include "editeng/editengdllapi.h"
+#include <vector>
+
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<EECharAttrib>& 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 3f45bae..7f31d37 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 0ce3ff2..2964ad4 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<EECharAttrib>& 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 a5a536d..f039b12 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<EECharAttrib>& /*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<EECharAttrib>& 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 893c2ac..f4a7d2e 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<EECharAttrib>& 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 e427fcd..c05b83e 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<EECharAttrib>& 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 d46239c..d99e305 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<EECharAttrib>& 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 03361d7..306db63 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<EECharAttrib> 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<aCharAttribs.Count(); ++nAttr )
+ sal_uInt16 nCurrIndex;
+ sal_Int32 nClosestStartIndex = 0;
+ for(std::vector<EECharAttrib>::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<aCharAttribs.Count(); ++nAttr )
+ sal_Int32 nClosestEndIndex = rEE.GetTextLen(nPara);
+ for(std::vector<EECharAttrib>::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<sal_uInt16>( nClosestStartIndex );
diff --git a/editeng/source/uno/unofored.cxx b/editeng/source/uno/unofored.cxx
index 5bf77f0..6761127 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<EECharAttrib> 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<EECharAttrib>::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 )
diff --git a/starmath/source/accessibility.cxx b/starmath/source/accessibility.cxx
index 1f9f149..e70301d 100644
--- a/starmath/source/accessibility.cxx
+++ b/starmath/source/accessibility.cxx
@@ -1142,7 +1142,7 @@ void SmTextForwarder::FieldClicked(const SvxFieldItem&, sal_uInt16, sal_uInt16)
sal_uInt16 GetSvxEditEngineItemState( EditEngine& rEditEngine, const ESelection& rSel, sal_uInt16 nWhich )
{
- EECharAttribArray aAttribs;
+ std::vector<EECharAttrib> aAttribs;
const SfxPoolItem* pLastItem = NULL;
@@ -1172,40 +1172,39 @@ sal_uInt16 GetSvxEditEngineItemState( EditEngine& rEditEngine, const ESelection&
const SfxPoolItem* pParaItem = NULL;
- for( sal_uInt16 nAttrib = 0; nAttrib < aAttribs.Count(); nAttrib++ )
+ for(std::vector<EECharAttrib>::const_iterator i = aAttribs.begin(); i < aAttribs.end(); ++i)
{
- struct EECharAttrib aAttrib = aAttribs.GetObject( nAttrib );
- OSL_ENSURE( aAttrib.pAttr, "GetCharAttribs gives corrupt data" );
+ OSL_ENSURE( 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 = false;
- if( !bGaps && aAttrib.nStart > nLastEnd )
+ if( !bGaps && i->nStart > nLastEnd )
bGaps = true;
- nLastEnd = aAttrib.nEnd;
+ nLastEnd = i->nEnd;
}
if( !bEmpty && !bGaps && nLastEnd < ( nEndPos - 1 ) )
diff --git a/svx/source/sdr/properties/textproperties.cxx b/svx/source/sdr/properties/textproperties.cxx
index 92a15a4..9003769 100644
--- a/svx/source/sdr/properties/textproperties.cxx
+++ b/svx/source/sdr/properties/textproperties.cxx
@@ -456,19 +456,16 @@ namespace sdr
if(aSet.GetItemState(EE_CHAR_COLOR) == SFX_ITEM_SET)
{
EditEngine* pEditEngine = const_cast<EditEngine*>(&(pOutliner->GetEditEngine()));
- EECharAttribArray aAttribs;
+ std::vector<EECharAttrib> aAttribs;
pEditEngine->GetCharAttribs((sal_uInt16)nPara, aAttribs);
- sal_uInt16 nAttrib;
- for(nAttrib = 0; nAttrib < aAttribs.Count(); nAttrib++)
+ for(std::vector<EECharAttrib>::iterator i = aAttribs.begin(); i < aAttribs.end(); ++i)
{
- struct EECharAttrib aAttrib(aAttribs.GetObject(nAttrib));
-
- if(EE_FEATURE_FIELD == aAttrib.pAttr->Which())
+ if(EE_FEATURE_FIELD == i->pAttr->Which())
{
- if(aAttrib.pAttr)
+ if(i->pAttr)
{
- SvxFieldItem* pFieldItem = (SvxFieldItem*)aAttrib.pAttr;
+ SvxFieldItem* pFieldItem = (SvxFieldItem*)(i->pAttr);
if(pFieldItem)
{
@@ -491,20 +488,16 @@ namespace sdr
ESelection aSel((sal_uInt16)nPara, 0);
- for(nAttrib = 0; nAttrib < aAttribs.Count(); nAttrib++)
+ for(std::vector<EECharAttrib>::iterator i = aAttribs.begin(); i < aAttribs.end(); ++i)
{
- struct EECharAttrib aAttrib(aAttribs.GetObject(nAttrib));
-
- if(EE_FEATURE_FIELD == aAttrib.pAttr->Which())
+ if(EE_FEATURE_FIELD == i->pAttr->Which())
{
- aSel.nEndPos = aAttrib.nStart;
+ aSel.nEndPos = i->nStart;
if(aSel.nStartPos != aSel.nEndPos)
- {
pEditEngine->QuickSetAttribs(aColorSet, aSel);
- }
- aSel.nStartPos = aAttrib.nEnd;
+ aSel.nStartPos = i->nEnd;
}
}
diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx
index 2082874..143b824 100644
--- a/sw/source/filter/ww8/wrtw8esh.cxx
+++ b/sw/source/filter/ww8/wrtw8esh.cxx
@@ -859,7 +859,7 @@ void WW8Export::AppendFlyInFlys(const sw::Frame& rFrmFmt,
MSWord_SdrAttrIter::MSWord_SdrAttrIter( MSWordExportBase& rWr,
const EditTextObject& rEditObj, sal_uInt8 nTyp )
: MSWordAttrIter( rWr ), pEditObj(&rEditObj), pEditPool(0),
- aTxtAtrArr( 0, 4 ), aChrTxtAtrArr( 0, 4 ), aChrSetArr( 0, 4 ),
+ aTxtAtrArr(), aChrTxtAtrArr( 0, 4 ), aChrSetArr( 0, 4 ),
mnTyp(nTyp)
{
NextPara( 0 );
@@ -898,29 +898,22 @@ rtl_TextEncoding MSWord_SdrAttrIter::GetNextCharSet() const
// der erste Parameter in SearchNext() liefert zurueck, ob es ein TxtAtr ist.
xub_StrLen MSWord_SdrAttrIter::SearchNext( xub_StrLen nStartPos )
{
- xub_StrLen nPos;
- xub_StrLen nMinPos = STRING_MAXLEN;
- xub_StrLen i;
-
- for( i = 0; i < aTxtAtrArr.Count(); i++ )
+ sal_uInt16 nMinPos = STRING_MAXLEN;
+ for(std::vector<EECharAttrib>::const_iterator i = aTxtAtrArr.begin(); i < aTxtAtrArr.end(); ++i)
{
- const EECharAttrib& rHt = aTxtAtrArr[ i ];
- nPos = rHt.nStart; // gibt erstes Attr-Zeichen
+ sal_uInt16 nPos = i->nStart; // gibt erstes Attr-Zeichen
if( nPos >= nStartPos && nPos <= nMinPos )
{
nMinPos = nPos;
- SetCharSet(rHt, true);
+ SetCharSet(*i, true);
}
+ nPos = i->nEnd; // gibt letztes Attr-Zeichen + 1
+ if( nPos >= nStartPos && nPos < nMinPos )
{
- nPos = rHt.nEnd; // gibt letztes Attr-Zeichen + 1
- if( nPos >= nStartPos && nPos < nMinPos )
- {
- nMinPos = nPos;
- SetCharSet(rHt, false);
- }
+ nMinPos = nPos;
+ SetCharSet(*i, false);
}
-
}
return nMinPos;
}
@@ -978,7 +971,7 @@ void MSWord_SdrAttrIter::OutAttr( xub_StrLen nSwPos )
{
OutParaAttr(true);
- if( aTxtAtrArr.Count() )
+ if(!aTxtAtrArr.empty())
{
const SwModify* pOldMod = m_rExport.pOutFmtNode;
m_rExport.pOutFmtNode = 0;
@@ -987,16 +980,15 @@ void MSWord_SdrAttrIter::OutAttr( xub_StrLen nSwPos )
const SfxItemPool& rDstPool = m_rExport.pDoc->GetAttrPool();
nTmpSwPos = nSwPos;
- sal_uInt16 i, nWhich, nSlotId;
- for( i = 0; i < aTxtAtrArr.Count(); i++ )
+ sal_uInt16 nWhich, nSlotId;
+ for(std::vector<EECharAttrib>::const_iterator i = aTxtAtrArr.begin(); i < aTxtAtrArr.end(); ++i)
{
- const EECharAttrib& rHt = aTxtAtrArr[ i ];
- if (nSwPos >= rHt.nStart && nSwPos < rHt.nEnd)
+ if (nSwPos >= i->nStart && nSwPos < i->nEnd)
{
- nWhich = rHt.pAttr->Which();
+ nWhich = i->pAttr->Which();
if (nWhich == EE_FEATURE_FIELD)
{
- OutEEField(*rHt.pAttr);
+ OutEEField(*(i->pAttr));
continue;
}
else if (nWhich == EE_FEATURE_TAB)
@@ -1014,7 +1006,7 @@ void MSWord_SdrAttrIter::OutAttr( xub_StrLen nSwPos )
m_rExport.CollapseScriptsforWordOk(nScript,nWhich))
{
// use always the SW-Which Id !
- SfxPoolItem* pI = rHt.pAttr->Clone();
+ SfxPoolItem* pI = i->pAttr->Clone();
pI->SetWhich( nWhich );
m_rExport.AttrOutput().OutputItem( *pI );
delete pI;
@@ -1022,7 +1014,7 @@ void MSWord_SdrAttrIter::OutAttr( xub_StrLen nSwPos )
}
}
- if( nSwPos < rHt.nStart )
+ if( nSwPos < i->nStart )
break;
}
@@ -1033,18 +1025,13 @@ void MSWord_SdrAttrIter::OutAttr( xub_StrLen nSwPos )
bool MSWord_SdrAttrIter::IsTxtAttr(xub_StrLen nSwPos)
{
- for (sal_uInt16 i = 0; i < aTxtAtrArr.Count(); ++i)
+ for (std::vector<EECharAttrib>::const_iterator i = aTxtAtrArr.begin(); i < aTxtAtrArr.end(); ++i)
{
- const EECharAttrib& rHt = aTxtAtrArr[ i ];
- if (nSwPos >= rHt.nStart && nSwPos < rHt.nEnd)
+ if (nSwPos >= i->nStart && nSwPos < i->nEnd)
{
- if (
- (rHt.pAttr->Which() == EE_FEATURE_FIELD) ||
- (rHt.pAttr->Which() == EE_FEATURE_TAB)
- )
- {
+ if (i->pAttr->Which() == EE_FEATURE_FIELD ||
+ i->pAttr->Which() == EE_FEATURE_TAB)
return true;
- }
}
}
return false;
@@ -1058,27 +1045,19 @@ bool MSWord_SdrAttrIter::IsTxtAttr(xub_StrLen nSwPos)
// Es wird mit bDeep gesucht
const SfxPoolItem* MSWord_SdrAttrIter::HasTextItem(sal_uInt16 nWhich) const
{
- const SfxPoolItem* pRet = 0;
nWhich = sw::hack::TransformWhichBetweenPools(*pEditPool,
m_rExport.pDoc->GetAttrPool(), nWhich);
if (nWhich)
{
- for (sal_uInt16 i = 0; i < aTxtAtrArr.Count(); ++i)
+ for (std::vector<EECharAttrib>::const_iterator i = aTxtAtrArr.begin(); i < aTxtAtrArr.end(); ++i)
{
- const EECharAttrib& rHt = aTxtAtrArr[i];
- if (
- nWhich == rHt.pAttr->Which() && nTmpSwPos >= rHt.nStart &&
- nTmpSwPos < rHt.nEnd
- )
- {
- pRet = rHt.pAttr; // Found
- break;
- }
- else if (nTmpSwPos < rHt.nStart)
- break; // dann kommt da nichts mehr
+ if (nWhich == i->pAttr->Which() && nTmpSwPos >= i->nStart && nTmpSwPos < i->nEnd)
+ return i->pAttr; // Found
+ else if (nTmpSwPos < i->nStart)
+ return NULL; // dann kommt da nichts mehr
}
}
- return pRet;
+ return NULL;
}
const SfxPoolItem& MSWord_SdrAttrIter::GetItem( sal_uInt16 nWhich ) const
diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx
index ed7fe30..c886e22 100644
--- a/sw/source/filter/ww8/wrtww8.hxx
+++ b/sw/source/filter/ww8/wrtww8.hxx
@@ -1371,7 +1371,7 @@ class MSWord_SdrAttrIter : public MSWordAttrIter
private:
const EditTextObject* pEditObj;
const SfxItemPool* pEditPool;
- EECharAttribArray aTxtAtrArr;
+ std::vector<EECharAttrib> aTxtAtrArr;
SvPtrarr aChrTxtAtrArr;
std::vector<sal_uInt16> aChrSetArr;
sal_uInt16 nPara;
More information about the Libreoffice-commits
mailing list