summaryrefslogtreecommitdiff
path: root/editeng/source/uno
diff options
context:
space:
mode:
authorAugust Sodora <augsod@gmail.com>2011-12-23 02:30:41 -0500
committerAugust Sodora <augsod@gmail.com>2011-12-23 14:52:09 -0500
commit4d4a67748e945d901f320d9c3af753abb3211efc (patch)
tree462db2ccf1ee9c3455837307e98704e3f83ae864 /editeng/source/uno
parentb575f4b1a2a2217282cddc995951b350936b47b1 (diff)
SV_DECL_VARARR->std::vector
Diffstat (limited to 'editeng/source/uno')
-rw-r--r--editeng/source/uno/unoedhlp.cxx24
-rw-r--r--editeng/source/uno/unofored.cxx67
2 files changed, 24 insertions, 67 deletions
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<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 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<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 )