[Libreoffice-commits] .: 21 commits - editeng/inc editeng/Library_editeng.mk editeng/source
Kohei Yoshida
kohei at kemper.freedesktop.org
Tue Apr 3 07:20:11 PDT 2012
editeng/Library_editeng.mk | 1
editeng/inc/editeng/editeng.hxx | 2
editeng/source/editeng/editdoc.cxx | 745 +++++++++++++++++++++++++++++++++---
editeng/source/editeng/editdoc.hxx | 163 +++----
editeng/source/editeng/editdoc2.cxx | 607 -----------------------------
editeng/source/editeng/editeng.cxx | 12
editeng/source/editeng/editundo.cxx | 2
editeng/source/editeng/edtspell.cxx | 2
editeng/source/editeng/impedit.cxx | 12
editeng/source/editeng/impedit.hxx | 102 ++--
editeng/source/editeng/impedit2.cxx | 197 ++++-----
editeng/source/editeng/impedit3.cxx | 134 +++---
editeng/source/editeng/impedit4.cxx | 20
editeng/source/editeng/impedit5.cxx | 12
14 files changed, 1016 insertions(+), 995 deletions(-)
New commits:
commit 05173270c11a997096671c035c18692cfd6b51dc
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Tue Apr 3 01:53:40 2012 -0400
Removed the last SC_DECL_PTRARR from editdoc.hxx.
diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx
index 4d253d9..373e608 100644
--- a/editeng/source/editeng/editdoc.cxx
+++ b/editeng/source/editeng/editdoc.cxx
@@ -68,6 +68,8 @@
#include <tools/shl.hxx>
#include <com/sun/star/i18n/ScriptType.hpp>
+#include <limits>
+
#include <boost/bind.hpp>
using namespace ::com::sun::star;
@@ -408,48 +410,104 @@ TextPortionList::~TextPortionList()
void TextPortionList::Reset()
{
- for ( sal_uInt16 nPortion = 0; nPortion < Count(); nPortion++ )
- delete GetObject( nPortion );
- Remove( 0, Count() );
+ maPortions.clear();
+}
+
+void TextPortionList::DeleteFromPortion(size_t nDelFrom)
+{
+ DBG_ASSERT( ( nDelFrom < maPortions.size() ) || ( (nDelFrom == 0) && maPortions.empty() ), "DeleteFromPortion: Out of range" );
+ PortionsType::iterator it = maPortions.begin();
+ std::advance(it, nDelFrom);
+ maPortions.erase(it, maPortions.end());
+}
+
+size_t TextPortionList::Count() const
+{
+ return maPortions.size();
+}
+
+const TextPortion* TextPortionList::operator[](size_t nPos) const
+{
+ return &maPortions[nPos];
+}
+
+TextPortion* TextPortionList::operator[](size_t nPos)
+{
+ return &maPortions[nPos];
+}
+
+void TextPortionList::Append(TextPortion* p)
+{
+ maPortions.push_back(p);
+}
+
+void TextPortionList::Insert(size_t nPos, TextPortion* p)
+{
+ maPortions.insert(maPortions.begin()+nPos, p);
}
-void TextPortionList::DeleteFromPortion( sal_uInt16 nDelFrom )
+void TextPortionList::Remove(size_t nPos)
{
- DBG_ASSERT( ( nDelFrom < Count() ) || ( (nDelFrom == 0) && (Count() == 0) ), "DeleteFromPortion: Out of range" );
- for ( sal_uInt16 nP = nDelFrom; nP < Count(); nP++ )
- delete GetObject( nP );
- Remove( nDelFrom, Count()-nDelFrom );
+ maPortions.erase(maPortions.begin()+nPos);
}
-sal_uInt16 TextPortionList::FindPortion( sal_uInt16 nCharPos, sal_uInt16& nPortionStart, sal_Bool bPreferStartingPortion ) const
+namespace {
+
+class FindTextPortionByAddress : std::unary_function<TextPortion, bool>
+{
+ const TextPortion* mp;
+public:
+ FindTextPortionByAddress(const TextPortion* p) : mp(p) {}
+ bool operator() (const TextPortion& v) const
+ {
+ return &v == mp;
+ }
+};
+
+}
+
+size_t TextPortionList::GetPos(const TextPortion* p) const
+{
+ PortionsType::const_iterator it =
+ std::find_if(maPortions.begin(), maPortions.end(), FindTextPortionByAddress(p));
+
+ if (it == maPortions.end())
+ return std::numeric_limits<size_t>::max(); // not found.
+
+ return std::distance(maPortions.begin(), it);
+}
+
+size_t TextPortionList::FindPortion(
+ sal_uInt16 nCharPos, sal_uInt16& nPortionStart, bool bPreferStartingPortion) const
{
// When nCharPos at portion limit, the left portion is found
sal_uInt16 nTmpPos = 0;
- for ( sal_uInt16 nPortion = 0; nPortion < Count(); nPortion++ )
+ size_t n = maPortions.size();
+ for (size_t i = 0; i < n; ++i)
{
- TextPortion* pPortion = GetObject( nPortion );
- nTmpPos = nTmpPos + pPortion->GetLen();
+ const TextPortion& rPortion = maPortions[i];
+ nTmpPos = nTmpPos + rPortion.GetLen();
if ( nTmpPos >= nCharPos )
{
// take this one if we don't prefer the starting portion, or if it's the last one
- if ( ( nTmpPos != nCharPos ) || !bPreferStartingPortion || ( nPortion == Count() - 1 ) )
+ if ( ( nTmpPos != nCharPos ) || !bPreferStartingPortion || ( i == n-1 ) )
{
- nPortionStart = nTmpPos - pPortion->GetLen();
- return nPortion;
+ nPortionStart = nTmpPos - rPortion.GetLen();
+ return i;
}
}
}
OSL_FAIL( "FindPortion: Not found!" );
- return ( Count() - 1 );
+ return n - 1;
}
-sal_uInt16 TextPortionList::GetStartPos( sal_uInt16 nPortion )
+sal_uInt16 TextPortionList::GetStartPos(size_t nPortion)
{
sal_uInt16 nPos = 0;
- for ( sal_uInt16 n = 0; n < nPortion; n++ )
+ for (size_t i = 0; i < nPortion; ++i)
{
- TextPortion* pPortion = GetObject( n );
- nPos = nPos + pPortion->GetLen();
+ const TextPortion& rPortion = maPortions[i];
+ nPos = nPos + rPortion.GetLen();
}
return nPos;
}
@@ -987,7 +1045,7 @@ Size EditLine::CalcTextSize( ParaPortion& rParaPortion )
for ( sal_uInt16 n = nStartPortion; n <= nEndPortion; n++ )
{
- pPortion = rParaPortion.GetTextPortions().GetObject(n);
+ pPortion = rParaPortion.GetTextPortions()[n];
switch ( pPortion->GetKind() )
{
case PORTIONKIND_TEXT:
diff --git a/editeng/source/editeng/editdoc.hxx b/editeng/source/editeng/editdoc.hxx
index 5bdce4c..bd05ae1 100644
--- a/editeng/source/editeng/editdoc.hxx
+++ b/editeng/source/editeng/editdoc.hxx
@@ -427,19 +427,28 @@ public:
// -------------------------------------------------------------------------
// class TextPortionList
// -------------------------------------------------------------------------
-typedef TextPortion* TextPortionPtr;
-SV_DECL_PTRARR( TextPortionArray, TextPortionPtr, 0 )
-
-class TextPortionList : public TextPortionArray
+class TextPortionList
{
+ typedef boost::ptr_vector<TextPortion> PortionsType;
+ PortionsType maPortions;
+
public:
TextPortionList();
~TextPortionList();
void Reset();
- sal_uInt16 FindPortion( sal_uInt16 nCharPos, sal_uInt16& rPortionStart, sal_Bool bPreferStartingPortion = sal_False ) const;
- sal_uInt16 GetStartPos( sal_uInt16 nPortion );
- void DeleteFromPortion( sal_uInt16 nDelFrom );
+ size_t FindPortion(
+ sal_uInt16 nCharPos, sal_uInt16& rPortionStart, bool bPreferStartingPortion = false) const;
+ sal_uInt16 GetStartPos(size_t nPortion);
+ void DeleteFromPortion(size_t nDelFrom);
+ size_t Count() const;
+ const TextPortion* operator[](size_t nPos) const;
+ TextPortion* operator[](size_t nPos);
+
+ void Append(TextPortion* p);
+ void Insert(size_t nPos, TextPortion* p);
+ void Remove(size_t nPos);
+ size_t GetPos(const TextPortion* p) const;
};
class ParaPortion;
diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx
index e33ee5a..b01c830 100644
--- a/editeng/source/editeng/impedit.cxx
+++ b/editeng/source/editeng/impedit.cxx
@@ -675,7 +675,7 @@ void ImpEditView::ShowCursor( sal_Bool bGotoCursor, sal_Bool bForceVisCursor, sa
aEditCursor.Left() = aEditCursor.Right() = pEditEngine->pImpEditEngine->PaMtoEditCursor( aPaM, GETCRSR_TXTONLY|GETCRSR_PREFERPORTIONSTART ).Left();
sal_uInt16 nTextPortion = pParaPortion->GetTextPortions().FindPortion( aPaM.GetIndex(), nTextPortionStart, sal_True );
- TextPortion* pTextPortion = pParaPortion->GetTextPortions().GetObject( nTextPortion );
+ const TextPortion* pTextPortion = pParaPortion->GetTextPortions()[nTextPortion];
if ( pTextPortion->GetKind() == PORTIONKIND_TAB )
{
aEditCursor.Right() += pTextPortion->GetSize().Width();
@@ -844,7 +844,7 @@ void ImpEditView::ShowCursor( sal_Bool bGotoCursor, sal_Bool bForceVisCursor, sa
if ( IsInsertMode() && !aEditSelection.HasRange() && ( pEditEngine->pImpEditEngine->HasDifferentRTLLevels( aPaM.GetNode() ) ) )
{
sal_uInt16 nTextPortion = pParaPortion->GetTextPortions().FindPortion( aPaM.GetIndex(), nTextPortionStart, nShowCursorFlags & GETCRSR_PREFERPORTIONSTART ? sal_True : sal_False );
- TextPortion* pTextPortion = pParaPortion->GetTextPortions().GetObject( nTextPortion );
+ const TextPortion* pTextPortion = pParaPortion->GetTextPortions()[nTextPortion];
sal_uInt16 nRTLLevel = pTextPortion->GetRightToLeft();
if ( nRTLLevel%2 )
nCursorDir = CURSOR_DIRECTION_RTL;
diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx
index aec30e1..6a01a0f 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -1032,7 +1032,7 @@ EditPaM ImpEditEngine::CursorVisualStartEnd( EditView* pEditView, const EditPaM&
sal_uInt16 nTmp;
sal_uInt16 nTextPortion = pParaPortion->GetTextPortions().FindPortion( aPaM.GetIndex(), nTmp, sal_True );
- TextPortion* pTextPortion = pParaPortion->GetTextPortions().GetObject( nTextPortion );
+ const TextPortion* pTextPortion = pParaPortion->GetTextPortions()[nTextPortion];
sal_uInt16 nRTLLevel = pTextPortion->GetRightToLeft();
sal_Bool bPortionRTL = (nRTLLevel%2) ? sal_True : sal_False;
@@ -1096,7 +1096,7 @@ EditPaM ImpEditEngine::CursorVisualLeftRight( EditView* pEditView, const EditPaM
// Check if we are within a portion and don't have overwrite mode, then it's easy...
sal_uInt16 nPortionStart;
sal_uInt16 nTextPortion = pParaPortion->GetTextPortions().FindPortion( aPaM.GetIndex(), nPortionStart, sal_False );
- TextPortion* pTextPortion = pParaPortion->GetTextPortions().GetObject( nTextPortion );
+ const TextPortion* pTextPortion = pParaPortion->GetTextPortions()[nTextPortion];
sal_Bool bPortionBoundary = ( aPaM.GetIndex() == nPortionStart ) || ( aPaM.GetIndex() == (nPortionStart+pTextPortion->GetLen()) );
sal_uInt16 nRTLLevel = pTextPortion->GetRightToLeft();
@@ -1107,7 +1107,7 @@ EditPaM ImpEditEngine::CursorVisualLeftRight( EditView* pEditView, const EditPaM
{
sal_uInt16 nTmp;
sal_uInt16 nNextTextPortion = pParaPortion->GetTextPortions().FindPortion( aPaM.GetIndex()+1, nTmp, bLogicalBackward ? sal_False : sal_True );
- TextPortion* pNextTextPortion = pParaPortion->GetTextPortions().GetObject( nNextTextPortion );
+ const TextPortion* pNextTextPortion = pParaPortion->GetTextPortions()[nNextTextPortion];
nRTLLevelNextPortion = pNextTextPortion->GetRightToLeft();
}
@@ -1176,7 +1176,7 @@ EditPaM ImpEditEngine::CursorVisualLeftRight( EditView* pEditView, const EditPaM
sal_uInt16 nPortionStart;
sal_uInt16 nTextPortion = pParaPortion->GetTextPortions().FindPortion( aPaM.GetIndex(), nPortionStart, bBeforePortion );
- TextPortion* pTextPortion = pParaPortion->GetTextPortions().GetObject( nTextPortion );
+ const TextPortion* pTextPortion = pParaPortion->GetTextPortions()[nTextPortion];
sal_Bool bRTLPortion = (pTextPortion->GetRightToLeft() % 2) != 0;
// -1: We are 'behind' the character
@@ -1205,7 +1205,7 @@ EditPaM ImpEditEngine::CursorVisualLeftRight( EditView* pEditView, const EditPaM
sal_uInt16 _nPortionStart;
// sal_uInt16 nTextPortion = pParaPortion->GetTextPortions().FindPortion( aPaM.GetIndex(), nPortionStart, !bRTLPortion );
sal_uInt16 _nTextPortion = pParaPortion->GetTextPortions().FindPortion( aPaM.GetIndex(), _nPortionStart, sal_True );
- TextPortion* _pTextPortion = pParaPortion->GetTextPortions().GetObject( _nTextPortion );
+ const TextPortion* _pTextPortion = pParaPortion->GetTextPortions()[_nTextPortion];
if ( bVisualToLeft && !bRTLPortion && ( _pTextPortion->GetRightToLeft() % 2 ) )
aPaM.GetIndex()++;
else if ( !bVisualToLeft && bRTLPortion && ( bWasBehind || !(_pTextPortion->GetRightToLeft() % 2 )) )
@@ -2018,7 +2018,7 @@ sal_Bool ImpEditEngine::HasDifferentRTLLevels( const ContentNode* pNode )
sal_uInt16 nRTLLevel = IsRightToLeft( nPara ) ? 1 : 0;
for ( sal_uInt16 n = 0; n < pParaPortion->GetTextPortions().Count(); n++ )
{
- TextPortion* pTextPortion = pParaPortion->GetTextPortions().GetObject( n );
+ const TextPortion* pTextPortion = pParaPortion->GetTextPortions()[n];
if ( pTextPortion->GetRightToLeft() != nRTLLevel )
{
bHasDifferentRTLLevels = sal_True;
@@ -3165,7 +3165,7 @@ sal_uInt32 ImpEditEngine::CalcLineWidth( ParaPortion* pPortion, EditLine* pLine,
sal_uInt16 nPos = pLine->GetStart();
for ( sal_uInt16 nTP = pLine->GetStartPortion(); nTP <= pLine->GetEndPortion(); nTP++ )
{
- TextPortion* pTextPortion = pPortion->GetTextPortions().GetObject( nTP );
+ const TextPortion* pTextPortion = pPortion->GetTextPortions()[nTP];
switch ( pTextPortion->GetKind() )
{
case PORTIONKIND_FIELD:
@@ -3720,7 +3720,7 @@ sal_uInt16 ImpEditEngine::GetChar(
// Search best matching portion with GetPortionXOffset()
for ( sal_uInt16 i = pLine->GetStartPortion(); i <= pLine->GetEndPortion(); i++ )
{
- TextPortion* pPortion = pParaPortion->GetTextPortions().GetObject( i );
+ const TextPortion* pPortion = pParaPortion->GetTextPortions()[i];
long nXLeft = GetPortionXOffset( pParaPortion, pLine, i );
long nXRight = nXLeft + pPortion->GetSize().Width();
if ( ( nXLeft <= nXPos ) && ( nXRight >= nXPos ) )
@@ -3846,7 +3846,7 @@ long ImpEditEngine::GetPortionXOffset(
for ( sal_uInt16 i = pLine->GetStartPortion(); i < nTextPortion; i++ )
{
- TextPortion* pPortion = pParaPortion->GetTextPortions().GetObject( i );
+ const TextPortion* pPortion = pParaPortion->GetTextPortions()[i];
switch ( pPortion->GetKind() )
{
case PORTIONKIND_FIELD:
@@ -3863,7 +3863,7 @@ long ImpEditEngine::GetPortionXOffset(
sal_uInt16 nPara = GetEditDoc().GetPos( pParaPortion->GetNode() );
sal_Bool bR2LPara = IsRightToLeft( nPara );
- TextPortion* pDestPortion = pParaPortion->GetTextPortions().GetObject( nTextPortion );
+ const TextPortion* pDestPortion = pParaPortion->GetTextPortions()[nTextPortion];
if ( pDestPortion->GetKind() != PORTIONKIND_TAB )
{
if ( !bR2LPara && pDestPortion->GetRightToLeft() )
@@ -3872,7 +3872,7 @@ long ImpEditEngine::GetPortionXOffset(
sal_uInt16 nTmpPortion = nTextPortion+1;
while ( nTmpPortion <= pLine->GetEndPortion() )
{
- TextPortion* pNextTextPortion = pParaPortion->GetTextPortions().GetObject( nTmpPortion );
+ const TextPortion* pNextTextPortion = pParaPortion->GetTextPortions()[nTmpPortion];
if ( pNextTextPortion->GetRightToLeft() && ( pNextTextPortion->GetKind() != PORTIONKIND_TAB ) )
nX += pNextTextPortion->GetSize().Width();
else
@@ -3884,7 +3884,7 @@ long ImpEditEngine::GetPortionXOffset(
while ( nTmpPortion > pLine->GetStartPortion() )
{
--nTmpPortion;
- TextPortion* pPrevTextPortion = pParaPortion->GetTextPortions().GetObject( nTmpPortion );
+ const TextPortion* pPrevTextPortion = pParaPortion->GetTextPortions()[nTmpPortion];
if ( pPrevTextPortion->GetRightToLeft() && ( pPrevTextPortion->GetKind() != PORTIONKIND_TAB ) )
nX -= pPrevTextPortion->GetSize().Width();
else
@@ -3897,7 +3897,7 @@ long ImpEditEngine::GetPortionXOffset(
sal_uInt16 nTmpPortion = nTextPortion+1;
while ( nTmpPortion <= pLine->GetEndPortion() )
{
- TextPortion* pNextTextPortion = pParaPortion->GetTextPortions().GetObject( nTmpPortion );
+ const TextPortion* pNextTextPortion = pParaPortion->GetTextPortions()[nTmpPortion];
if ( !pNextTextPortion->IsRightToLeft() && ( pNextTextPortion->GetKind() != PORTIONKIND_TAB ) )
nX += pNextTextPortion->GetSize().Width();
else
@@ -3909,7 +3909,7 @@ long ImpEditEngine::GetPortionXOffset(
while ( nTmpPortion > pLine->GetStartPortion() )
{
--nTmpPortion;
- TextPortion* pPrevTextPortion = pParaPortion->GetTextPortions().GetObject( nTmpPortion );
+ const TextPortion* pPrevTextPortion = pParaPortion->GetTextPortions()[nTmpPortion];
if ( !pPrevTextPortion->IsRightToLeft() && ( pPrevTextPortion->GetKind() != PORTIONKIND_TAB ) )
nX -= pPrevTextPortion->GetSize().Width();
else
@@ -3947,7 +3947,7 @@ long ImpEditEngine::GetXPos(
OSL_ENSURE( ( nTextPortion >= pLine->GetStartPortion() ) && ( nTextPortion <= pLine->GetEndPortion() ), "GetXPos: Portion not in current line! " );
- TextPortion* pPortion = pParaPortion->GetTextPortions().GetObject( nTextPortion );
+ const TextPortion* pPortion = pParaPortion->GetTextPortions()[nTextPortion];
long nX = GetPortionXOffset( pParaPortion, pLine, nTextPortion );
@@ -3967,7 +3967,7 @@ long ImpEditEngine::GetXPos(
{
if ( (nTextPortion+1) < pParaPortion->GetTextPortions().Count() )
{
- TextPortion* pNextPortion = pParaPortion->GetTextPortions().GetObject( nTextPortion+1 );
+ const TextPortion* pNextPortion = pParaPortion->GetTextPortions()[nTextPortion+1];
if ( pNextPortion->GetKind() != PORTIONKIND_TAB )
{
if ( !bPreferPortionStart )
diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx
index 315ff3b..091c329 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -685,7 +685,7 @@ sal_Bool ImpEditEngine::CreateLines( sal_uInt16 nPara, sal_uInt32 nStartPosY )
{
TextPortion* pDummyPortion = new TextPortion( 0 );
pParaPortion->GetTextPortions().Reset();
- pParaPortion->GetTextPortions().Insert( pDummyPortion, 0 );
+ pParaPortion->GetTextPortions().Append(pDummyPortion);
}
else if ( bQuickFormat )
{
@@ -891,7 +891,7 @@ sal_Bool ImpEditEngine::CreateLines( sal_uInt16 nPara, sal_uInt32 nStartPosY )
while ( ( nTmpWidth < nXWidth ) && !bEOL && ( nTmpPortion < pParaPortion->GetTextPortions().Count() ) )
{
nPortionStart = nTmpPos;
- pPortion = pParaPortion->GetTextPortions().GetObject( nTmpPortion );
+ pPortion = pParaPortion->GetTextPortions()[nTmpPortion];
if ( pPortion->GetKind() == PORTIONKIND_HYPHENATOR )
{
// Throw away a Portion, if necessary correct the one before,
@@ -900,7 +900,7 @@ sal_Bool ImpEditEngine::CreateLines( sal_uInt16 nPara, sal_uInt32 nStartPosY )
if ( nTmpPortion && pPortion->GetLen() )
{
nTmpPortion--;
- TextPortion* pPrev = pParaPortion->GetTextPortions().GetObject( nTmpPortion );
+ TextPortion* pPrev = pParaPortion->GetTextPortions()[nTmpPortion];
DBG_ASSERT( pPrev->GetKind() == PORTIONKIND_TEXT, "Portion?!" );
nTmpWidth -= pPrev->GetSize().Width();
nTmpPos = nTmpPos - pPrev->GetLen();
@@ -909,7 +909,7 @@ sal_Bool ImpEditEngine::CreateLines( sal_uInt16 nPara, sal_uInt32 nStartPosY )
}
delete pPortion;
DBG_ASSERT( nTmpPortion < pParaPortion->GetTextPortions().Count(), "No more Portions left!" );
- pPortion = pParaPortion->GetTextPortions().GetObject( nTmpPortion );
+ pPortion = pParaPortion->GetTextPortions()[nTmpPortion];
}
DBG_ASSERT( pPortion->GetKind() != PORTIONKIND_HYPHENATOR, "CreateLines: Hyphenator-Portion!" );
DBG_ASSERT( pPortion->GetLen() || bProcessingEmptyLine, "Empty Portion in CreateLines ?!" );
@@ -1099,7 +1099,7 @@ sal_Bool ImpEditEngine::CreateLines( sal_uInt16 nPara, sal_uInt32 nStartPosY )
long nWidthAfterTab = 0;
for ( sal_uInt16 n = aCurrentTab.nTabPortion+1; n <= nTmpPortion; n++ )
{
- TextPortion* pTP = pParaPortion->GetTextPortions().GetObject( n );
+ const TextPortion* pTP = pParaPortion->GetTextPortions()[n];
nWidthAfterTab += pTP->GetSize().Width();
}
long nW = nWidthAfterTab; // Length before tab position
@@ -1117,7 +1117,7 @@ sal_Bool ImpEditEngine::CreateLines( sal_uInt16 nPara, sal_uInt32 nStartPosY )
sal_uInt16 nDecPos = aText.Search( aCurrentTab.aTabStop.GetDecimal() );
if ( nDecPos != STRING_NOTFOUND )
{
- nW -= pParaPortion->GetTextPortions().GetObject( nTmpPortion )->GetSize().Width();
+ nW -= pParaPortion->GetTextPortions()[nTmpPortion]->GetSize().Width();
nW += aTmpFont.QuickGetTextSize( GetRefDevice(), *pParaPortion->GetNode(), nTmpPos, nDecPos, NULL ).Width();
aCurrentTab.bValid = sal_False;
}
@@ -1132,7 +1132,7 @@ sal_Bool ImpEditEngine::CreateLines( sal_uInt16 nPara, sal_uInt32 nStartPosY )
nW = nMaxW;
aCurrentTab.bValid = sal_False;
}
- TextPortion* pTabPortion = pParaPortion->GetTextPortions().GetObject( aCurrentTab.nTabPortion );
+ const TextPortion* pTabPortion = pParaPortion->GetTextPortions()[aCurrentTab.nTabPortion];
pTabPortion->GetSize().Width() = aCurrentTab.nTabPos - aCurrentTab.nStartPosX - nW - nStartX;
nTmpWidth = aCurrentTab.nStartPosX + pTabPortion->GetSize().Width() + nWidthAfterTab;
}
@@ -1171,7 +1171,7 @@ sal_Bool ImpEditEngine::CreateLines( sal_uInt16 nPara, sal_uInt32 nStartPosY )
DBG_ASSERT( pPortion && (pPortion->GetKind() == PORTIONKIND_TEXT), "Len>1, but no TextPortion?" );
nTmpWidth -= pPortion ? pPortion->GetSize().Width() : 0;
sal_uInt16 nP = SplitTextPortion( pParaPortion, nTmpPos, pLine );
- TextPortion* p = pParaPortion->GetTextPortions().GetObject( nP );
+ const TextPortion* p = pParaPortion->GetTextPortions()[nP];
DBG_ASSERT( p, "Portion ?!" );
nTmpWidth += p->GetSize().Width();
}
@@ -1277,7 +1277,7 @@ sal_Bool ImpEditEngine::CreateLines( sal_uInt16 nPara, sal_uInt32 nStartPosY )
sal_uInt16 nTPos = pLine->GetStart();
for ( sal_uInt16 nP = pLine->GetStartPortion(); nP <= pLine->GetEndPortion(); nP++ )
{
- TextPortion* pTP = pParaPortion->GetTextPortions().GetObject( nP );
+ const TextPortion* pTP = pParaPortion->GetTextPortions()[nP];
// problem with hard font height attribute, when everthing but the line break has this attribute
if ( pTP->GetKind() != PORTIONKIND_LINEBREAK )
{
@@ -1373,7 +1373,7 @@ sal_Bool ImpEditEngine::CreateLines( sal_uInt16 nPara, sal_uInt32 nStartPosY )
// Width from HangingPunctuation was set to 0 in ImpBreakLine,
// check for rel width now, maybe create compression...
long n = nMaxLineWidth - aTextSize.Width();
- TextPortion* pTP = pParaPortion->GetTextPortions().GetObject( pLine->GetEndPortion() );
+ const TextPortion* pTP = pParaPortion->GetTextPortions()[pLine->GetEndPortion()];
sal_uInt16 nPosInArray = pLine->GetEnd()-1-pLine->GetStart();
long nNewValue = ( nPosInArray ? pLine->GetCharPosArray()[ nPosInArray-1 ] : 0 ) + n;
pLine->GetCharPosArray()[ nPosInArray ] = nNewValue;
@@ -1526,7 +1526,7 @@ sal_Bool ImpEditEngine::CreateLines( sal_uInt16 nPara, sal_uInt32 nStartPosY )
// normaly CreateAndInsertEmptyLine would be called, but I want to use
// CreateLines, so I need Polygon code only here...
TextPortion* pDummyPortion = new TextPortion( 0 );
- pParaPortion->GetTextPortions().Insert( pDummyPortion, pParaPortion->GetTextPortions().Count() );
+ pParaPortion->GetTextPortions().Append(pDummyPortion);
pLine = new EditLine;
pParaPortion->GetLines().Insert(++nLine, pLine);
bForceOneRun = sal_True;
@@ -1608,7 +1608,7 @@ void ImpEditEngine::CreateAndInsertEmptyLine( ParaPortion* pParaPortion, sal_uIn
pDummyPortion->GetSize() = aTmpFont.GetPhysTxtSize( pRefDev, String() );
if ( IsFixedCellHeight() )
pDummyPortion->GetSize().Height() = ImplCalculateFontIndependentLineSpacing( aTmpFont.GetHeight() );
- pParaPortion->GetTextPortions().Insert( pDummyPortion, pParaPortion->GetTextPortions().Count() );
+ pParaPortion->GetTextPortions().Append(pDummyPortion);
FormatterFontMetric aFormatterMetrics;
RecalcFormatterFontMetrics( aFormatterMetrics, aTmpFont );
pTmpLine->SetMaxAscent( aFormatterMetrics.nMaxAscent );
@@ -1920,7 +1920,7 @@ void ImpEditEngine::ImpBreakLine( ParaPortion* pParaPortion, EditLine* pLine, Te
if ( bCompressBlank || bHangingPunctuation )
{
- TextPortion* pTP = pParaPortion->GetTextPortions().GetObject( nEndPortion );
+ const TextPortion* pTP = pParaPortion->GetTextPortions()[nEndPortion];
DBG_ASSERT( pTP->GetKind() == PORTIONKIND_TEXT, "BlankRubber: No TextPortion!" );
DBG_ASSERT( nBreakPos > pLine->GetStart(), "SplitTextPortion at the beginning of the line?" );
sal_uInt16 nPosInArray = nBreakPos - 1 - pLine->GetStart();
@@ -1935,7 +1935,7 @@ void ImpEditEngine::ImpBreakLine( ParaPortion* pParaPortion, EditLine* pLine, Te
String aHyphText( CH_HYPH );
if ( cAlternateReplChar )
{
- TextPortion* pPrev = pParaPortion->GetTextPortions().GetObject( nEndPortion );
+ TextPortion* pPrev = pParaPortion->GetTextPortions()[nEndPortion];
DBG_ASSERT( pPrev && pPrev->GetLen(), "Hyphenate: Prev portion?!" );
pPrev->SetLen( pPrev->GetLen() - 1 );
pHyphPortion->SetLen( 1 );
@@ -1957,7 +1957,7 @@ void ImpEditEngine::ImpBreakLine( ParaPortion* pParaPortion, EditLine* pLine, Te
pHyphPortion->GetSize().Height() = GetRefDevice()->GetTextHeight();
pHyphPortion->GetSize().Width() = GetRefDevice()->GetTextWidth( aHyphText );
- pParaPortion->GetTextPortions().Insert( pHyphPortion, ++nEndPortion );
+ pParaPortion->GetTextPortions().Insert(++nEndPortion, pHyphPortion);
}
pLine->SetEndPortion( nEndPortion );
}
@@ -2211,11 +2211,11 @@ sal_uInt16 ImpEditEngine::SplitTextPortion( ParaPortion* pPortion, sal_uInt16 nP
sal_uInt16 nSplitPortion;
sal_uInt16 nTmpPos = 0;
- TextPortion* pTextPortion = 0;
+ TextPortion* pTextPortion = NULL;
sal_uInt16 nPortions = pPortion->GetTextPortions().Count();
for ( nSplitPortion = 0; nSplitPortion < nPortions; nSplitPortion++ )
{
- TextPortion* pTP = pPortion->GetTextPortions().GetObject(nSplitPortion);
+ TextPortion* pTP = pPortion->GetTextPortions()[nSplitPortion];
nTmpPos = nTmpPos + pTP->GetLen();
if ( nTmpPos >= nPos )
{
@@ -2234,7 +2234,7 @@ sal_uInt16 ImpEditEngine::SplitTextPortion( ParaPortion* pPortion, sal_uInt16 nP
sal_uInt16 nOverlapp = nTmpPos - nPos;
pTextPortion->GetLen() = pTextPortion->GetLen() - nOverlapp;
TextPortion* pNewPortion = new TextPortion( nOverlapp );
- pPortion->GetTextPortions().Insert( pNewPortion, nSplitPortion+1 );
+ pPortion->GetTextPortions().Insert(nSplitPortion+1, pNewPortion);
// Set sizes
if ( pCurLine )
{
@@ -2317,7 +2317,7 @@ void ImpEditEngine::CreateTextPortions( ParaPortion* pParaPortion, sal_uInt16& r
sal_uInt16 nP;
for ( nP = 0; nP < pParaPortion->GetTextPortions().Count(); nP++ )
{
- TextPortion* pTmpPortion = pParaPortion->GetTextPortions().GetObject(nP);
+ const TextPortion* pTmpPortion = pParaPortion->GetTextPortions()[nP];
nPortionStart = nPortionStart + pTmpPortion->GetLen();
if ( nPortionStart >= nStartPos )
{
@@ -2328,13 +2328,13 @@ void ImpEditEngine::CreateTextPortions( ParaPortion* pParaPortion, sal_uInt16& r
}
}
DBG_ASSERT( nP < pParaPortion->GetTextPortions().Count() || !pParaPortion->GetTextPortions().Count(), "Nothing to delete: CreateTextPortions" );
- if ( nInvPortion && ( nPortionStart+pParaPortion->GetTextPortions().GetObject(nInvPortion)->GetLen() > nStartPos ) )
+ if ( nInvPortion && ( nPortionStart+pParaPortion->GetTextPortions()[nInvPortion]->GetLen() > nStartPos ) )
{
// prefer one in front ...
// But only if it was in the middle of the portion of, otherwise it
// might be the only one in the row in front!
nInvPortion--;
- nPortionStart = nPortionStart - pParaPortion->GetTextPortions().GetObject(nInvPortion)->GetLen();
+ nPortionStart = nPortionStart - pParaPortion->GetTextPortions()[nInvPortion]->GetLen();
}
pParaPortion->GetTextPortions().DeleteFromPortion( nInvPortion );
@@ -2349,7 +2349,7 @@ void ImpEditEngine::CreateTextPortions( ParaPortion* pParaPortion, sal_uInt16& r
while ( i != aPositions.end() )
{
TextPortion* pNew = new TextPortion( static_cast<sal_uInt16>(*i++) - static_cast<sal_uInt16>(*nInvPos++) );
- pParaPortion->GetTextPortions().Insert( pNew, pParaPortion->GetTextPortions().Count());
+ pParaPortion->GetTextPortions().Append(pNew);
}
DBG_ASSERT( pParaPortion->GetTextPortions().Count(), "No Portions?!" );
@@ -2387,7 +2387,7 @@ void ImpEditEngine::RecalcTextPortion( ParaPortion* pParaPortion, sal_uInt16 nSt
else
{
TextPortion* pNewPortion = new TextPortion( nNewChars );
- pParaPortion->GetTextPortions().Insert( pNewPortion, nNewPortionPos );
+ pParaPortion->GetTextPortions().Insert(nNewPortionPos, pNewPortion);
}
}
else
@@ -2453,7 +2453,7 @@ void ImpEditEngine::RecalcTextPortion( ParaPortion* pParaPortion, sal_uInt16 nSt
// No HYPHENATOR portion is allowed to get stuck right at the end...
DBG_ASSERT( pParaPortion->GetTextPortions().Count(), "RecalcTextPortions: Nothing left! ");
sal_uInt16 nLastPortion = pParaPortion->GetTextPortions().Count() - 1;
- pTP = pParaPortion->GetTextPortions().GetObject( nLastPortion );
+ pTP = pParaPortion->GetTextPortions()[nLastPortion];
if ( pTP->GetKind() == PORTIONKIND_HYPHENATOR )
{
// Discard portion; if possible, correct the ones before,
@@ -2461,7 +2461,7 @@ void ImpEditEngine::RecalcTextPortion( ParaPortion* pParaPortion, sal_uInt16 nSt
pParaPortion->GetTextPortions().Remove( nLastPortion );
if ( nLastPortion && pTP->GetLen() )
{
- TextPortion* pPrev = pParaPortion->GetTextPortions().GetObject( nLastPortion - 1 );
+ TextPortion* pPrev = pParaPortion->GetTextPortions()[nLastPortion - 1];
DBG_ASSERT( pPrev->GetKind() == PORTIONKIND_TEXT, "Portion?!" );
pPrev->SetLen( pPrev->GetLen() + pTP->GetLen() );
pPrev->GetSize().Width() = (-1);
@@ -2924,7 +2924,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRec, Point aSta
for ( sal_uInt16 y = pLine->GetStartPortion(); y <= pLine->GetEndPortion(); y++ )
{
DBG_ASSERT( pPortion->GetTextPortions().Count(), "Line without Textportion in Paint!" );
- TextPortion* pTextPortion = pPortion->GetTextPortions().GetObject( y );
+ const TextPortion* pTextPortion = pPortion->GetTextPortions()[y];
DBG_ASSERT( pTextPortion, "NULL-Pointer in Portion iterator in UpdateViews" );
long nPortionXOffset = GetPortionXOffset( pPortion, pLine, y );
@@ -4421,7 +4421,7 @@ void ImpEditEngine::ImplExpandCompressedPortions( EditLine* pLine, ParaPortion*
{
sal_Bool bFoundCompressedPortion = sal_False;
long nCompressed = 0;
- TextPortionList aCompressedPortions;
+ std::vector<TextPortion*> aCompressedPortions;
sal_uInt16 nPortion = pLine->GetEndPortion();
TextPortion* pTP = pParaPortion->GetTextPortions()[ nPortion ];
@@ -4431,7 +4431,7 @@ void ImpEditEngine::ImplExpandCompressedPortions( EditLine* pLine, ParaPortion*
{
bFoundCompressedPortion = sal_True;
nCompressed += pTP->GetExtraInfos()->nOrgWidth - pTP->GetSize().Width();
- aCompressedPortions.Insert( pTP, aCompressedPortions.Count() );
+ aCompressedPortions.push_back(pTP);
}
pTP = ( nPortion > pLine->GetStartPortion() ) ? pParaPortion->GetTextPortions()[ --nPortion ] : NULL;
}
@@ -4447,14 +4447,14 @@ void ImpEditEngine::ImplExpandCompressedPortions( EditLine* pLine, ParaPortion*
nCompressPercent /= nCompressed;
}
- for ( sal_uInt16 n = 0; n < aCompressedPortions.Count(); n++ )
+ for (size_t i = 0, n = aCompressedPortions.size(); i < n; ++i)
{
- pTP = aCompressedPortions[n];
+ pTP = aCompressedPortions[i];
pTP->GetExtraInfos()->bCompressed = sal_False;
pTP->GetSize().Width() = pTP->GetExtraInfos()->nOrgWidth;
if ( nCompressPercent )
{
- sal_uInt16 nTxtPortion = pParaPortion->GetTextPortions().GetPos( pTP );
+ size_t nTxtPortion = pParaPortion->GetTextPortions().GetPos( pTP );
sal_uInt16 nTxtPortionStart = pParaPortion->GetTextPortions().GetStartPos( nTxtPortion );
DBG_ASSERT( nTxtPortionStart >= pLine->GetStart(), "Portion doesn't belong to the line!!!" );
sal_Int32* pDXArray = &pLine->GetCharPosArray()[0]+( nTxtPortionStart-pLine->GetStart() );
@@ -4464,8 +4464,6 @@ void ImpEditEngine::ImplExpandCompressedPortions( EditLine* pLine, ParaPortion*
}
}
}
-
- aCompressedPortions.Remove( 0, aCompressedPortions.Count() );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx
index 6617eb3..dd45a57 100644
--- a/editeng/source/editeng/impedit4.cxx
+++ b/editeng/source/editeng/impedit4.cxx
@@ -631,7 +631,7 @@ sal_uInt32 ImpEditEngine::WriteRTF( SvStream& rOutput, EditSelection aSel )
// start at 0, so the index is right ...
for ( sal_uInt16 n = 0; n <= nEndPortion; n++ )
{
- TextPortion* pTextPortion = pParaPortion->GetTextPortions().GetObject(n);
+ const TextPortion* pTextPortion = pParaPortion->GetTextPortions()[n];
if ( n < nStartPortion )
{
nIndex = nIndex + pTextPortion->GetLen();
@@ -1150,9 +1150,9 @@ EditTextObject* ImpEditEngine::CreateBinTextObject( EditSelection aSel, SfxItemP
sal_uInt16 n;
for ( n = 0; n < nCount; n++ )
{
- TextPortion* pTextPortion = pParaPortion->GetTextPortions()[n];
+ const TextPortion* pTextPortion = pParaPortion->GetTextPortions()[n];
TextPortion* pNew = new TextPortion( *pTextPortion );
- pX->aTextPortions.Insert( pNew, pX->aTextPortions.Count() );
+ pX->aTextPortions.Append(pNew);
}
// The lines
@@ -1346,7 +1346,7 @@ EditSelection ImpEditEngine::InsertBinTextObject( BinTextObject& rTextObject, Ed
{
TextPortion* pTextPortion = pXP->aTextPortions[_n];
TextPortion* pNew = new TextPortion( *pTextPortion );
- pParaPortion->GetTextPortions().Insert( pNew, _n );
+ pParaPortion->GetTextPortions().Insert(_n, pNew);
}
// The lines
commit 221cbbf64a20b87443f378fcb2ed22068867f494
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Tue Apr 3 00:02:55 2012 -0400
Another SV_DECL_PTRARR killed.
diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx
index 608e681..4d253d9 100644
--- a/editeng/source/editeng/editdoc.cxx
+++ b/editeng/source/editeng/editdoc.cxx
@@ -1024,33 +1024,57 @@ EditLineList::~EditLineList()
void EditLineList::Reset()
{
- for ( sal_uInt16 nLine = 0; nLine < Count(); nLine++ )
- delete GetObject(nLine);
- Remove( 0, Count() );
+ maLines.clear();
}
-void EditLineList::DeleteFromLine( sal_uInt16 nDelFrom )
+void EditLineList::DeleteFromLine(size_t nDelFrom)
{
- DBG_ASSERT( nDelFrom <= (Count() - 1), "DeleteFromLine: Out of range" );
- for ( sal_uInt16 nL = nDelFrom; nL < Count(); nL++ )
- delete GetObject(nL);
- Remove( nDelFrom, Count()-nDelFrom );
+ DBG_ASSERT( nDelFrom <= (maLines.size() - 1), "DeleteFromLine: Out of range" );
+ LinesType::iterator it = maLines.begin();
+ std::advance(it, nDelFrom);
+ maLines.erase(it, maLines.end());
}
-sal_uInt16 EditLineList::FindLine( sal_uInt16 nChar, sal_Bool bInclEnd )
+size_t EditLineList::FindLine(sal_uInt16 nChar, bool bInclEnd)
{
- for ( sal_uInt16 nLine = 0; nLine < Count(); nLine++ )
+ size_t n = maLines.size();
+ for (size_t i = 0; i < n; ++i)
{
- EditLine* pLine = GetObject( nLine );
- if ( ( bInclEnd && ( pLine->GetEnd() >= nChar ) ) ||
- ( pLine->GetEnd() > nChar ) )
+ const EditLine& rLine = maLines[i];
+ if ( (bInclEnd && (rLine.GetEnd() >= nChar)) ||
+ (rLine.GetEnd() > nChar) )
{
- return nLine;
+ return i;
}
}
DBG_ASSERT( !bInclEnd, "Line not found: FindLine" );
- return ( Count() - 1 );
+ return n - 1;
+}
+
+size_t EditLineList::Count() const
+{
+ return maLines.size();
+}
+
+const EditLine* EditLineList::operator[](size_t nPos) const
+{
+ return &maLines[nPos];
+}
+
+EditLine* EditLineList::operator[](size_t nPos)
+{
+ return &maLines[nPos];
+}
+
+void EditLineList::Append(EditLine* p)
+{
+ maLines.push_back(p);
+}
+
+void EditLineList::Insert(size_t nPos, EditLine* p)
+{
+ maLines.insert(maLines.begin()+nPos, p);
}
EditPaM::EditPaM() : pNode(NULL), nIndex(0) {}
diff --git a/editeng/source/editeng/editdoc.hxx b/editeng/source/editeng/editdoc.hxx
index 7cc78ca..5bdce4c 100644
--- a/editeng/source/editeng/editdoc.hxx
+++ b/editeng/source/editeng/editdoc.hxx
@@ -540,18 +540,24 @@ public:
// -------------------------------------------------------------------------
// class LineList
// -------------------------------------------------------------------------
-typedef EditLine* EditLinePtr;
-SV_DECL_PTRARR( LineArray, EditLinePtr, 0 )
-
-class EditLineList : public LineArray
+class EditLineList
{
+ typedef boost::ptr_vector<EditLine> LinesType;
+ LinesType maLines;
+
public:
EditLineList();
~EditLineList();
- void Reset();
- void DeleteFromLine( sal_uInt16 nDelFrom );
- sal_uInt16 FindLine( sal_uInt16 nChar, sal_Bool bInclEnd );
+ void Reset();
+ void DeleteFromLine(size_t nDelFrom);
+ size_t FindLine(sal_uInt16 nChar, bool bInclEnd);
+ size_t Count() const;
+ const EditLine* operator[](size_t nPos) const;
+ EditLine* operator[](size_t nPos);
+
+ void Append(EditLine* p);
+ void Insert(size_t nPos, EditLine* p);
};
// -------------------------------------------------------------------------
diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx
index b6189d1..1d5fe3a 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -1708,7 +1708,7 @@ Point EditEngine::GetDocPosTopLeft( sal_uInt16 nParagraph )
if ( pPPortion->GetLines().Count() )
{
// Correct it if large Bullet.
- EditLine* pFirstLine = pPPortion->GetLines()[0];
+ const EditLine* pFirstLine = pPPortion->GetLines()[0];
aPoint.X() = pFirstLine->GetStartPosX();
}
else
@@ -1762,7 +1762,7 @@ sal_Bool EditEngine::IsTextPos( const Point& rPaperPos, sal_uInt16 nBorder )
DBG_ASSERT( pParaPortion, "ParaPortion?" );
sal_uInt16 nLine = pParaPortion->GetLineNumber( aPaM.GetIndex() );
- EditLine* pLine = pParaPortion->GetLines().GetObject( nLine );
+ const EditLine* pLine = pParaPortion->GetLines()[nLine];
Range aLineXPosStartEnd = pImpEditEngine->GetLineXPosStartEnd( pParaPortion, pLine );
if ( ( aDocPos.X() >= aLineXPosStartEnd.Min() - nBorder ) &&
( aDocPos.X() <= aLineXPosStartEnd.Max() + nBorder ) )
@@ -2201,9 +2201,9 @@ ParagraphInfos EditEngine::GetParagraphInfos( sal_uInt16 nPara )
aInfos.bValid = pImpEditEngine->IsFormatted();
if ( pImpEditEngine->IsFormatted() )
{
- ParaPortion* pParaPortion = pImpEditEngine->GetParaPortions()[nPara];
- EditLine* pLine = (pParaPortion && pParaPortion->GetLines().Count()) ?
- pParaPortion->GetLines().GetObject( 0 ) : NULL;
+ const ParaPortion* pParaPortion = pImpEditEngine->GetParaPortions()[nPara];
+ const EditLine* pLine = (pParaPortion && pParaPortion->GetLines().Count()) ?
+ pParaPortion->GetLines()[0] : NULL;
DBG_ASSERT( pParaPortion && pLine, "GetParagraphInfos - Paragraph out of range" );
if ( pParaPortion && pLine )
{
diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx
index 62d32e0..e33ee5a 100644
--- a/editeng/source/editeng/impedit.cxx
+++ b/editeng/source/editeng/impedit.cxx
@@ -205,7 +205,7 @@ void ImpEditView::DrawSelection( EditSelection aTmpSel, Region* pRegion )
for ( sal_uInt16 nLine = nStartLine; nLine <= nEndLine; nLine++ )
{
- EditLine* pLine = pTmpPortion->GetLines().GetObject( nLine );
+ const EditLine* pLine = pTmpPortion->GetLines()[nLine];
DBG_ASSERT( pLine, "Line not found: DrawSelection()" );
sal_Bool bPartOfLine = sal_False;
@@ -261,7 +261,7 @@ void ImpEditView::DrawSelection( EditSelection aTmpSel, Region* pRegion )
DBG_ASSERT( nTmpEndIndex > nTmpStartIndex, "DrawSelection, Start >= End?" );
- long nX1 = pEditEngine->pImpEditEngine->GetXPos( pTmpPortion, pLine, nTmpStartIndex, sal_True );
+ long nX1 = pEditEngine->pImpEditEngine->GetXPos( pTmpPortion, pLine, nTmpStartIndex, true );
long nX2 = pEditEngine->pImpEditEngine->GetXPos( pTmpPortion, pLine, nTmpEndIndex );
Point aPt1( Min( nX1, nX2 ), aTopLeft.Y() );
diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx
index 0c93da6..438abee 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -533,11 +533,11 @@ private:
EditPaM GetPaM( Point aDocPos, sal_Bool bSmart = sal_True );
EditPaM GetPaM( ParaPortion* pPortion, Point aPos, sal_Bool bSmart = sal_True );
- long GetXPos(const ParaPortion* pParaPortion, EditLine* pLine, sal_uInt16 nIndex, bool bPreferPortionStart = false) const;
+ long GetXPos(const ParaPortion* pParaPortion, const EditLine* pLine, sal_uInt16 nIndex, bool bPreferPortionStart = false) const;
long GetPortionXOffset(const ParaPortion* pParaPortion, const EditLine* pLine, sal_uInt16 nTextPortion) const;
- sal_uInt16 GetChar(const ParaPortion* pParaPortion, EditLine* pLine, long nX, bool bSmart = true);
+ sal_uInt16 GetChar(const ParaPortion* pParaPortion, const EditLine* pLine, long nX, bool bSmart = true);
Range GetInvalidYOffsets( ParaPortion* pPortion );
- Range GetLineXPosStartEnd( const ParaPortion* pParaPortion, EditLine* pLine ) const;
+ Range GetLineXPosStartEnd( const ParaPortion* pParaPortion, const EditLine* pLine ) const;
void SetParaAttrib( sal_uInt8 nFunc, EditSelection aSel, sal_uInt16 nValue );
sal_uInt16 GetParaAttrib( sal_uInt8 nFunc, EditSelection aSel );
diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx
index 8e2cd80..aec30e1 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -601,7 +601,7 @@ void ImpEditEngine::Command( const CommandEvent& rCEvt, EditView* pView )
ParaPortion* pParaPortion = GetParaPortions().SafeGetObject( GetEditDoc().GetPos( aPaM.GetNode() ) );
sal_uInt16 nLine = pParaPortion->GetLines().FindLine( aPaM.GetIndex(), sal_True );
- EditLine* pLine = pParaPortion->GetLines().GetObject( nLine );
+ const EditLine* pLine = pParaPortion->GetLines()[nLine];
if ( pLine && ( nInputEnd > pLine->GetEnd() ) )
nInputEnd = pLine->GetEnd();
Rectangle aR2 = PaMtoEditCursor( EditPaM( aPaM.GetNode(), nInputEnd ), GETCRSR_ENDOFLINE );
@@ -1006,8 +1006,8 @@ EditPaM ImpEditEngine::CursorVisualStartEnd( EditView* pEditView, const EditPaM&
ParaPortion* pParaPortion = GetParaPortions().SafeGetObject( nPara );
sal_uInt16 nLine = pParaPortion->GetLines().FindLine( aPaM.GetIndex(), sal_False );
- EditLine* pLine = pParaPortion->GetLines().GetObject( nLine );
- sal_Bool bEmptyLine = pLine->GetStart() == pLine->GetEnd();
+ const EditLine* pLine = pParaPortion->GetLines()[nLine];
+ bool bEmptyLine = pLine->GetStart() == pLine->GetEnd();
pEditView->pImpEditView->nExtraCursorFlags = 0;
@@ -1062,8 +1062,8 @@ EditPaM ImpEditEngine::CursorVisualLeftRight( EditView* pEditView, const EditPaM
ParaPortion* pParaPortion = GetParaPortions().SafeGetObject( nPara );
sal_uInt16 nLine = pParaPortion->GetLines().FindLine( aPaM.GetIndex(), sal_False );
- EditLine* pLine = pParaPortion->GetLines().GetObject( nLine );
- sal_Bool bEmptyLine = pLine->GetStart() == pLine->GetEnd();
+ const EditLine* pLine = pParaPortion->GetLines()[nLine];
+ bool bEmptyLine = pLine->GetStart() == pLine->GetEnd();
pEditView->pImpEditView->nExtraCursorFlags = 0;
@@ -1291,7 +1291,7 @@ EditPaM ImpEditEngine::CursorUp( const EditPaM& rPaM, EditView* pView )
const ParaPortion* pPPortion = FindParaPortion( rPaM.GetNode() );
OSL_ENSURE( pPPortion, "No matching portion found: CursorUp ");
sal_uInt16 nLine = pPPortion->GetLineNumber( rPaM.GetIndex() );
- EditLine* pLine = pPPortion->GetLines().GetObject( nLine );
+ const EditLine* pLine = pPPortion->GetLines()[nLine];
long nX;
if ( pView->pImpEditView->nTravelXPos == TRAVEL_X_DONTKNOW )
@@ -1305,7 +1305,7 @@ EditPaM ImpEditEngine::CursorUp( const EditPaM& rPaM, EditView* pView )
EditPaM aNewPaM( rPaM );
if ( nLine ) // same paragraph
{
- EditLine* pPrevLine = pPPortion->GetLines().GetObject(nLine-1);
+ const EditLine* pPrevLine = pPPortion->GetLines()[nLine-1];
aNewPaM.SetIndex( GetChar( pPPortion, pPrevLine, nX ) );
// If a previous automatically wrapped line, and one has to be exactly
// at the end of this line, the cursor lands on the current line at the
@@ -1319,7 +1319,7 @@ EditPaM ImpEditEngine::CursorUp( const EditPaM& rPaM, EditView* pView )
const ParaPortion* pPrevPortion = GetPrevVisPortion( pPPortion );
if ( pPrevPortion )
{
- pLine = pPrevPortion->GetLines().GetObject( pPrevPortion->GetLines().Count()-1 );
+ pLine = pPrevPortion->GetLines()[pPrevPortion->GetLines().Count()-1];
OSL_ENSURE( pLine, "Line in front not found: CursorUp" );
aNewPaM.SetNode( pPrevPortion->GetNode() );
aNewPaM.SetIndex( GetChar( pPrevPortion, pLine, nX+nOnePixelInRef ) );
@@ -1340,7 +1340,7 @@ EditPaM ImpEditEngine::CursorDown( const EditPaM& rPaM, EditView* pView )
long nX;
if ( pView->pImpEditView->nTravelXPos == TRAVEL_X_DONTKNOW )
{
- EditLine* pLine = pPPortion->GetLines().GetObject(nLine);
+ const EditLine* pLine = pPPortion->GetLines()[nLine];
nX = GetXPos( pPPortion, pLine, rPaM.GetIndex() );
pView->pImpEditView->nTravelXPos = nX+nOnePixelInRef;
}
@@ -1350,7 +1350,7 @@ EditPaM ImpEditEngine::CursorDown( const EditPaM& rPaM, EditView* pView )
EditPaM aNewPaM( rPaM );
if ( nLine < pPPortion->GetLines().Count()-1 )
{
- EditLine* pNextLine = pPPortion->GetLines().GetObject(nLine+1);
+ const EditLine* pNextLine = pPPortion->GetLines()[nLine+1];
aNewPaM.SetIndex( GetChar( pPPortion, pNextLine, nX ) );
// Special treatment, see CursorUp ...
if ( ( aNewPaM.GetIndex() == pNextLine->GetEnd() ) && ( aNewPaM.GetIndex() > pNextLine->GetStart() ) && ( aNewPaM.GetIndex() < pPPortion->GetNode()->Len() ) )
@@ -1361,7 +1361,7 @@ EditPaM ImpEditEngine::CursorDown( const EditPaM& rPaM, EditView* pView )
const ParaPortion* pNextPortion = GetNextVisPortion( pPPortion );
if ( pNextPortion )
{
- EditLine* pLine = pNextPortion->GetLines().GetObject(0);
+ const EditLine* pLine = pNextPortion->GetLines()[0];
OSL_ENSURE( pLine, "Line in front not found: CursorUp" );
aNewPaM.SetNode( pNextPortion->GetNode() );
// Never at the very end when several lines, because then a line
@@ -1380,7 +1380,7 @@ EditPaM ImpEditEngine::CursorStartOfLine( const EditPaM& rPaM )
const ParaPortion* pCurPortion = FindParaPortion( rPaM.GetNode() );
OSL_ENSURE( pCurPortion, "No Portion for the PaM ?" );
sal_uInt16 nLine = pCurPortion->GetLineNumber( rPaM.GetIndex() );
- EditLine* pLine = pCurPortion->GetLines().GetObject(nLine);
+ const EditLine* pLine = pCurPortion->GetLines()[nLine];
OSL_ENSURE( pLine, "Current line not found ?!" );
EditPaM aNewPaM( rPaM );
@@ -1393,7 +1393,7 @@ EditPaM ImpEditEngine::CursorEndOfLine( const EditPaM& rPaM )
const ParaPortion* pCurPortion = FindParaPortion( rPaM.GetNode() );
OSL_ENSURE( pCurPortion, "No Portion for the PaM ?" );
sal_uInt16 nLine = pCurPortion->GetLineNumber( rPaM.GetIndex() );
- EditLine* pLine = pCurPortion->GetLines().GetObject(nLine);
+ const EditLine* pLine = pCurPortion->GetLines()[nLine];
OSL_ENSURE( pLine, "Current line not found ?!" );
EditPaM aNewPaM( rPaM );
@@ -3113,7 +3113,7 @@ sal_uInt32 ImpEditEngine::CalcTextWidth( sal_Bool bIgnoreExtraSpace )
sal_uLong nLines = pPortion->GetLines().Count();
for ( sal_uInt16 nLine = 0; nLine < nLines; nLine++ )
{
- pLine = pPortion->GetLines().GetObject( nLine );
+ pLine = pPortion->GetLines()[nLine];
OSL_ENSURE( pLine, "NULL-Pointer in the line iterator in CalcWidth" );
// nCurWidth = pLine->GetStartPosX();
// For Center- or Right- alignment it depends on the paper
@@ -3249,7 +3249,7 @@ xub_StrLen ImpEditEngine::GetLineLen( sal_uInt16 nParagraph, sal_uInt16 nLine )
OSL_ENSURE( pPPortion, "Paragraph not found: GetLineLen" );
if ( pPPortion && ( nLine < pPPortion->GetLines().Count() ) )
{
- EditLine* pLine = pPPortion->GetLines().GetObject( nLine );
+ const EditLine* pLine = pPPortion->GetLines()[nLine];
OSL_ENSURE( pLine, "Line not found: GetLineHeight" );
return pLine->GetLen();
}
@@ -3265,7 +3265,7 @@ void ImpEditEngine::GetLineBoundaries( /*out*/sal_uInt16 &rStart, /*out*/sal_uIn
rStart = rEnd = 0xFFFF; // default values in case of error
if ( pPPortion && ( nLine < pPPortion->GetLines().Count() ) )
{
- EditLine* pLine = pPPortion->GetLines().GetObject( nLine );
+ const EditLine* pLine = pPPortion->GetLines()[nLine];
OSL_ENSURE( pLine, "Line not found: GetLineBoundaries" );
rStart = pLine->GetStart();
rEnd = pLine->GetEnd();
@@ -3306,7 +3306,7 @@ sal_uInt16 ImpEditEngine::GetLineHeight( sal_uInt16 nParagraph, sal_uInt16 nLine
OSL_ENSURE( pPPortion, "Paragraph not found: GetLineHeight" );
if ( pPPortion && ( nLine < pPPortion->GetLines().Count() ) )
{
- EditLine* pLine = pPPortion->GetLines().GetObject( nLine );
+ const EditLine* pLine = pPPortion->GetLines()[nLine];
OSL_ENSURE( pLine, "Paragraph not found: GetLineHeight" );
return pLine->GetHeight();
}
@@ -3602,7 +3602,7 @@ Range ImpEditEngine::GetInvalidYOffsets( ParaPortion* pPortion )
sal_uInt16 nLine;
for ( nLine = 0; nLine < pPortion->GetLines().Count(); nLine++ )
{
- EditLine* pL = pPortion->GetLines().GetObject( nLine );
+ const EditLine* pL = pPortion->GetLines()[nLine];
if ( pL->IsInvalid() )
{
nFirstInvalid = nLine;
@@ -3624,7 +3624,7 @@ Range ImpEditEngine::GetInvalidYOffsets( ParaPortion* pPortion )
sal_uInt16 nLastInvalid = pPortion->GetLines().Count()-1;
for ( nLine = nFirstInvalid; nLine < pPortion->GetLines().Count(); nLine++ )
{
- EditLine* pL = pPortion->GetLines().GetObject( nLine );
+ const EditLine* pL = pPortion->GetLines()[nLine];
if ( pL->IsValid() )
{
nLastInvalid = nLine;
@@ -3639,7 +3639,7 @@ Range ImpEditEngine::GetInvalidYOffsets( ParaPortion* pPortion )
if( ( rLSItem.GetInterLineSpaceRule() == SVX_INTER_LINE_SPACE_PROP ) && rLSItem.GetPropLineSpace() &&
( rLSItem.GetPropLineSpace() < 100 ) )
{
- EditLine* pL = pPortion->GetLines().GetObject( nFirstInvalid );
+ const EditLine* pL = pPortion->GetLines()[nFirstInvalid];
long n = pL->GetTxtHeight() * ( 100 - rLSItem.GetPropLineSpace() );
n /= 100;
aRange.Min() -= n;
@@ -3669,10 +3669,10 @@ EditPaM ImpEditEngine::GetPaM( ParaPortion* pPortion, Point aDocPos, sal_Bool bS
OSL_ENSURE( pPortion->GetLines().Count(), "Empty ParaPortion in GetPaM!" );
- EditLine* pLine = 0;
+ const EditLine* pLine = NULL;
for ( sal_uInt16 nLine = 0; nLine < pPortion->GetLines().Count(); nLine++ )
{
- EditLine* pTmpLine = pPortion->GetLines().GetObject( nLine );
+ const EditLine* pTmpLine = pPortion->GetLines()[nLine];
nY += pTmpLine->GetHeight();
if ( !aStatus.IsOutliner() )
nY += nSBL;
@@ -3700,7 +3700,7 @@ EditPaM ImpEditEngine::GetPaM( ParaPortion* pPortion, Point aDocPos, sal_Bool bS
aPaM.SetIndex( nCurIndex );
if ( nCurIndex && ( nCurIndex == pLine->GetEnd() ) &&
- ( pLine != pPortion->GetLines().GetObject( pPortion->GetLines().Count()-1) ) )
+ ( pLine != pPortion->GetLines()[pPortion->GetLines().Count()-1] ) )
{
aPaM = CursorLeft( aPaM, ::com::sun::star::i18n::CharacterIteratorMode::SKIPCELL );
}
@@ -3709,7 +3709,7 @@ EditPaM ImpEditEngine::GetPaM( ParaPortion* pPortion, Point aDocPos, sal_Bool bS
}
sal_uInt16 ImpEditEngine::GetChar(
- const ParaPortion* pParaPortion, EditLine* pLine, long nXPos, bool bSmart)
+ const ParaPortion* pParaPortion, const EditLine* pLine, long nXPos, bool bSmart)
{
OSL_ENSURE( pLine, "No line received: GetChar" );
@@ -3819,7 +3819,7 @@ sal_uInt16 ImpEditEngine::GetChar(
return nChar;
}
-Range ImpEditEngine::GetLineXPosStartEnd( const ParaPortion* pParaPortion, EditLine* pLine ) const
+Range ImpEditEngine::GetLineXPosStartEnd( const ParaPortion* pParaPortion, const EditLine* pLine ) const
{
Range aLineXPosStartEnd;
@@ -3930,7 +3930,7 @@ long ImpEditEngine::GetPortionXOffset(
}
long ImpEditEngine::GetXPos(
- const ParaPortion* pParaPortion, EditLine* pLine, sal_uInt16 nIndex, bool bPreferPortionStart) const
+ const ParaPortion* pParaPortion, const EditLine* pLine, sal_uInt16 nIndex, bool bPreferPortionStart) const
{
OSL_ENSURE( pLine, "No line received: GetXPos" );
OSL_ENSURE( ( nIndex >= pLine->GetStart() ) && ( nIndex <= pLine->GetEnd() ) , "GetXPos has to be called properly!" );
@@ -4068,8 +4068,8 @@ void ImpEditEngine::CalcHeight( ParaPortion* pPortion )
if ( pPortion->IsVisible() )
{
OSL_ENSURE( pPortion->GetLines().Count(), "Paragraph with no lines in ParaPortion::CalcHeight" );
- for ( sal_uInt16 nLine = 0; nLine < pPortion->GetLines().Count(); nLine++ )
- pPortion->nHeight += pPortion->GetLines().GetObject( nLine )->GetHeight();
+ for (size_t nLine = 0; nLine < pPortion->GetLines().Count(); ++nLine)
+ pPortion->nHeight += pPortion->GetLines()[nLine]->GetHeight();
if ( !aStatus.IsOutliner() )
{
@@ -4178,11 +4178,11 @@ Rectangle ImpEditEngine::GetEditCursor( ParaPortion* pPortion, sal_uInt16 nIndex
sal_uInt16 nCurIndex = 0;
OSL_ENSURE( pPortion->GetLines().Count(), "Empty ParaPortion in GetEditCursor!" );
- EditLine* pLine = 0;
+ const EditLine* pLine = NULL;
sal_Bool bEOL = ( nFlags & GETCRSR_ENDOFLINE ) ? sal_True : sal_False;
for ( sal_uInt16 nLine = 0; nLine < pPortion->GetLines().Count(); nLine++ )
{
- EditLine* pTmpLine = pPortion->GetLines().GetObject( nLine );
+ const EditLine* pTmpLine = pPortion->GetLines()[nLine];
if ( ( pTmpLine->GetStart() == nIndex ) || ( pTmpLine->IsIn( nIndex, bEOL ) ) )
{
pLine = pTmpLine;
@@ -4199,11 +4199,11 @@ Rectangle ImpEditEngine::GetEditCursor( ParaPortion* pPortion, sal_uInt16 nIndex
// Cursor at the End of the paragraph.
OSL_ENSURE( nIndex == nCurIndex, "Index dead wrong in GetEditCursor!" );
- pLine = pPortion->GetLines().GetObject( pPortion->GetLines().Count()-1 );
+ pLine = pPortion->GetLines()[pPortion->GetLines().Count()-1];
nY -= pLine->GetHeight();
if ( !aStatus.IsOutliner() )
nY -= nSBL;
- nCurIndex = nCurIndex - pLine->GetLen();
+ nCurIndex = nCurIndex - pLine->GetLen();
}
Rectangle aEditCursor;
diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx
index c1c7aea..315ff3b 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -619,7 +619,7 @@ sal_Bool ImpEditEngine::CreateLines( sal_uInt16 nPara, sal_uInt32 nStartPosY )
if ( pParaPortion->GetLines().Count() == 0 )
{
EditLine* pL = new EditLine;
- pParaPortion->GetLines().Insert( pL, 0 );
+ pParaPortion->GetLines().Append(pL);
}
// ---------------------------------------------------------------
@@ -706,7 +706,7 @@ sal_Bool ImpEditEngine::CreateLines( sal_uInt16 nPara, sal_uInt32 nStartPosY )
sal_uInt16 nLine = pParaPortion->GetLines().Count()-1;
for ( sal_uInt16 nL = 0; nL <= nLine; nL++ )
{
- EditLine* pLine = pParaPortion->GetLines().GetObject( nL );
+ EditLine* pLine = pParaPortion->GetLines()[nL];
if ( pLine->GetEnd() > nRealInvalidStart ) // not nInvalidStart!
{
nLine = nL;
@@ -719,7 +719,7 @@ sal_Bool ImpEditEngine::CreateLines( sal_uInt16 nPara, sal_uInt32 nStartPosY )
if ( nLine && ( !pParaPortion->IsSimpleInvalid() || ( nInvalidEnd < pNode->Len() ) || ( nInvalidDiff <= 0 ) ) )
nLine--;
- EditLine* pLine = pParaPortion->GetLines().GetObject( nLine );
+ EditLine* pLine = pParaPortion->GetLines()[nLine];
static Rectangle aZeroArea = Rectangle( Point(), Point() );
Rectangle aBulletArea( aZeroArea );
@@ -1508,7 +1508,7 @@ sal_Bool ImpEditEngine::CreateLines( sal_uInt16 nPara, sal_uInt32 nStartPosY )
// Next line or maybe a new line....
pLine = 0;
if ( nLine < pParaPortion->GetLines().Count()-1 )
- pLine = pParaPortion->GetLines().GetObject( ++nLine );
+ pLine = pParaPortion->GetLines()[++nLine];
if ( pLine && ( nIndex >= pNode->Len() ) )
{
nDelFromLine = nLine;
@@ -1519,7 +1519,7 @@ sal_Bool ImpEditEngine::CreateLines( sal_uInt16 nPara, sal_uInt32 nStartPosY )
if ( nIndex < pNode->Len() )
{
pLine = new EditLine;
- pParaPortion->GetLines().Insert( pLine, ++nLine );
+ pParaPortion->GetLines().Insert(++nLine, pLine);
}
else if ( nIndex && bLineBreak && GetTextRanger() )
{
@@ -1528,7 +1528,7 @@ sal_Bool ImpEditEngine::CreateLines( sal_uInt16 nPara, sal_uInt32 nStartPosY )
TextPortion* pDummyPortion = new TextPortion( 0 );
pParaPortion->GetTextPortions().Insert( pDummyPortion, pParaPortion->GetTextPortions().Count() );
pLine = new EditLine;
- pParaPortion->GetLines().Insert( pLine, ++nLine );
+ pParaPortion->GetLines().Insert(++nLine, pLine);
bForceOneRun = sal_True;
bProcessingEmptyLine = sal_True;
}
@@ -1571,7 +1571,7 @@ void ImpEditEngine::CreateAndInsertEmptyLine( ParaPortion* pParaPortion, sal_uIn
EditLine* pTmpLine = new EditLine;
pTmpLine->SetStart( pParaPortion->GetNode()->Len() );
pTmpLine->SetEnd( pParaPortion->GetNode()->Len() );
- pParaPortion->GetLines().Insert( pTmpLine, pParaPortion->GetLines().Count() );
+ pParaPortion->GetLines().Append(pTmpLine);
sal_Bool bLineBreak = pParaPortion->GetNode()->Len() ? sal_True : sal_False;
sal_Int32 nSpaceBefore = 0;
@@ -2818,7 +2818,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRec, Point aSta
long nFirstVisXPos = - pOutDev->GetMapMode().GetOrigin().X();
long nFirstVisYPos = - pOutDev->GetMapMode().GetOrigin().Y();
- EditLine* pLine;
+ const EditLine* pLine = NULL;
Point aTmpPos;
Point aRedLineTmpPos;
DBG_ASSERT( GetParaPortions().Count(), "No ParaPortion?!" );
@@ -2885,7 +2885,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRec, Point aSta
? GetYValue( rLSItem.GetInterLineSpace() ) : 0;
for ( sal_uInt16 nLine = 0; nLine < nLines; nLine++ )
{
- pLine = pPortion->GetLines().GetObject(nLine);
+ pLine = pPortion->GetLines()[nLine];
DBG_ASSERT( pLine, "NULL-Pointer in the line iterator in UpdateViews" );
aTmpPos = aStartPos;
if ( !IsVertical() )
@@ -3974,7 +3974,7 @@ long ImpEditEngine::CalcVertLineSpacing(Point& rStartPos) const
nTotalLineCount += nLineCount;
for (sal_uInt16 j = 0; j < nLineCount; ++j)
{
- EditLine* pLine = rLines.GetObject(j);
+ const EditLine* pLine = rLines[j];
nTotalOccupiedHeight += pLine->GetHeight();
if (j < nLineCount-1)
nTotalOccupiedHeight += nSBL;
diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx
index 3d35330..6617eb3 100644
--- a/editeng/source/editeng/impedit4.cxx
+++ b/editeng/source/editeng/impedit4.cxx
@@ -1159,9 +1159,9 @@ EditTextObject* ImpEditEngine::CreateBinTextObject( EditSelection aSel, SfxItemP
nCount = pParaPortion->GetLines().Count();
for ( n = 0; n < nCount; n++ )
{
- EditLine* pLine = pParaPortion->GetLines()[n];
+ const EditLine* pLine = pParaPortion->GetLines()[n];
EditLine* pNew = pLine->Clone();
- pX->aLines.Insert( pNew, pX->aLines.Count() );
+ pX->aLines.Append(pNew);
}
#ifdef DBG_UTIL
sal_uInt16 nTest;
@@ -1357,7 +1357,7 @@ EditSelection ImpEditEngine::InsertBinTextObject( BinTextObject& rTextObject, Ed
EditLine* pLine = pXP->aLines[m];
EditLine* pNew = pLine->Clone();
pNew->SetInvalid(); // Paint again!
- pParaPortion->GetLines().Insert( pNew, m );
+ pParaPortion->GetLines().Insert(m, pNew);
}
#ifdef DBG_UTIL
sal_uInt16 nTest;
commit b8cc16723815fc2636582e49b8878e9d34b23b86
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Mon Apr 2 22:52:24 2012 -0400
Make ImpEditEngine explicitly non-copyable.
diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx
index 7b85ca2..0c93da6 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -35,6 +35,8 @@
#include <editstt2.hxx>
#include <editeng/editdata.hxx>
#include <editeng/svxacorr.hxx>
+#include <editeng/SpellPortions.hxx>
+#include <editeng/eedata.hxx>
#include <vcl/virdev.hxx>
#include <vcl/gdimtf.hxx>
#include <vcl/cursor.hxx>
@@ -57,6 +59,8 @@
#include <i18npool/lang.h>
#include <rtl/ref.hxx>
+#include <boost/noncopyable.hpp>
+
DBG_NAMEEX( EditView )
DBG_NAMEEX( EditEngine )
@@ -89,11 +93,6 @@ class SvKeyValueIterator;
class SvxForbiddenCharactersTable;
class SvtCTLOptions;
class Window;
-
-#include <editeng/SpellPortions.hxx>
-
-#include <editeng/eedata.hxx>
-
class SvxNumberFormat;
@@ -381,7 +380,7 @@ public:
typedef EditView* EditViewPtr;
SV_DECL_PTRARR( EditViews, EditViewPtr, 0 )
-class ImpEditEngine : public SfxListener
+class ImpEditEngine : public SfxListener, boost::noncopyable
{
// The Undos have to manipulate directly ( private-Methods ),
// do that no new Undo is inserted!
@@ -689,6 +688,8 @@ private:
SpellInfo * CreateSpellInfo( const EditSelection &rSel, bool bMultipleDocs );
+ ImpEditEngine(); // disabled
+
protected:
virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
commit 11524988f1e5ceca372dd7f172a72636e3247f06
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Mon Apr 2 22:48:48 2012 -0400
Use initializer to initialize boolean's.
diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx
index 297bef5..7b85ca2 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -473,23 +473,6 @@ private:
OnDemandLocaleDataWrapper xLocaleDataWrapper;
OnDemandTransliterationWrapper xTransliterationWrapper;
- bool bKernAsianPunctuation:1;
- bool bAddExtLeading:1;
- bool bIsFormatting:1;
- bool bFormatted:1;
- bool bInSelection:1;
- bool bIsInUndo:1;
- bool bUpdate:1;
- bool bUndoEnabled:1;
- bool bOwnerOfRefDev:1;
- bool bDowning:1;
- bool bUseAutoColor:1;
- bool bForceAutoColor:1;
- bool bCallParaInsertedOrDeleted:1;
- bool bImpConvertFirstCall:1; // specifies if ImpConvert is called the very first time after Convert was called
- bool bFirstWordCapitalization:1; // specifies if auto-correction should capitalize the first word or not
- bool mbLastTryMerge:1;
-
// For Formatting / Update ....
boost::ptr_vector<DeletedNodeInfo> aDeletedNodes;
Rectangle aInvalidRec;
@@ -517,6 +500,22 @@ private:
rtl::Reference<SvxForbiddenCharactersTable> xForbiddenCharsTable;
+ bool bKernAsianPunctuation:1;
+ bool bAddExtLeading:1;
+ bool bIsFormatting:1;
+ bool bFormatted:1;
+ bool bInSelection:1;
+ bool bIsInUndo:1;
+ bool bUpdate:1;
+ bool bUndoEnabled:1;
+ bool bOwnerOfRefDev:1;
+ bool bDowning:1;
+ bool bUseAutoColor:1;
+ bool bForceAutoColor:1;
+ bool bCallParaInsertedOrDeleted:1;
+ bool bImpConvertFirstCall:1; // specifies if ImpConvert is called the very first time after Convert was called
+ bool bFirstWordCapitalization:1; // specifies if auto-correction should capitalize the first word or not
+ bool mbLastTryMerge:1;
// ================================================================
// Methods...
diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx
index 5743dc3..8e2cd80 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -94,7 +94,22 @@ ImpEditEngine::ImpEditEngine( EditEngine* pEE, SfxItemPool* pItemPool ) :
aMaxAutoPaperSize( 0x7FFFFFFF, 0x7FFFFFFF ),
aEditDoc( pItemPool ),
aWordDelimiters( RTL_CONSTASCII_USTRINGPARAM( " .,;:-'`'?!_=\"{}()[]\0xFF" ) ),
- aGroupChars( RTL_CONSTASCII_USTRINGPARAM( "{}()[]" ) )
+ aGroupChars( RTL_CONSTASCII_USTRINGPARAM( "{}()[]" ) ),
+ bKernAsianPunctuation(false),
+ bAddExtLeading(false),
+ bIsFormatting(false),
+ bFormatted(false),
+ bIsInUndo(false),
+ bUpdate(true),
+ bUndoEnabled(true),
+ bOwnerOfRefDev(false),
+ bDowning(false),
+ bUseAutoColor(true),
+ bForceAutoColor(false),
+ bCallParaInsertedOrDeleted(false),
+ bImpConvertFirstCall(false),
+ bFirstWordCapitalization(true),
+ mbLastTryMerge(false)
{
pEditEngine = pEE;
pRefDev = NULL;
@@ -120,26 +135,10 @@ ImpEditEngine::ImpEditEngine( EditEngine* pEE, SfxItemPool* pItemPool ) :
nStretchX = 100;
nStretchY = 100;
- bInSelection = false;
- bOwnerOfRefDev = false;
- bDowning = false;
- bIsInUndo = false;
- bIsFormatting = false;
- bFormatted = false;
- bUpdate = true;
- bUseAutoColor = true;
- bForceAutoColor = false;
- bAddExtLeading = false;
- bUndoEnabled = true;
- bCallParaInsertedOrDeleted = false;
- bImpConvertFirstCall= false;
- bFirstWordCapitalization = true;
-
eDefLanguage = LANGUAGE_DONTKNOW;
maBackgroundColor = COL_AUTO;
nAsianCompressionMode = text::CharacterCompressionType::NONE;
- bKernAsianPunctuation = false;
eDefaultHorizontalTextDirection = EE_HTEXTDIR_DEFAULT;
@@ -169,8 +168,6 @@ ImpEditEngine::ImpEditEngine( EditEngine* pEE, SfxItemPool* pItemPool ) :
bCallParaInsertedOrDeleted = true;
aEditDoc.SetModifyHdl( LINK( this, ImpEditEngine, DocModified ) );
-
- mbLastTryMerge = false;
}
ImpEditEngine::~ImpEditEngine()
commit 33fadf7b0d6505ff2859b8d26c8db762e04d86b9
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Mon Apr 2 21:53:46 2012 -0400
Bool cleanup.
diff --git a/editeng/inc/editeng/editeng.hxx b/editeng/inc/editeng/editeng.hxx
index c17b15b..6b6ea94 100644
--- a/editeng/inc/editeng/editeng.hxx
+++ b/editeng/inc/editeng/editeng.hxx
@@ -263,7 +263,7 @@ public:
/** returns the value last used for bTryMerge while calling ImpEditEngine::InsertUndo
This is currently used in a bad but needed hack to get undo actions merged in the
OutlineView in impress. Do not use it unless you want to sell your soul too! */
- sal_Bool HasTriedMergeOnLastAddUndo() const;
+ bool HasTriedMergeOnLastAddUndo() const;
void ClearModifyFlag();
void SetModified();
diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx
index 4f9184f..b6189d1 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -161,7 +161,7 @@ void EditEngine::UndoActionEnd( sal_uInt16 nId )
pImpEditEngine->UndoActionEnd( nId );
}
-sal_Bool EditEngine::HasTriedMergeOnLastAddUndo() const
+bool EditEngine::HasTriedMergeOnLastAddUndo() const
{
return pImpEditEngine->mbLastTryMerge;
}
diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx
index 062622e..62d32e0 100644
--- a/editeng/source/editeng/impedit.cxx
+++ b/editeng/source/editeng/impedit.cxx
@@ -1372,13 +1372,13 @@ sal_Bool ImpEditView::IsInSelection( const EditPaM& rPaM )
void ImpEditView::CreateAnchor()
{
- pEditEngine->pImpEditEngine->bInSelection = sal_True;
+ pEditEngine->pImpEditEngine->bInSelection = true;
GetEditSelection().Min() = GetEditSelection().Max();
}
void ImpEditView::DeselectAll()
{
- pEditEngine->pImpEditEngine->bInSelection = sal_False;
+ pEditEngine->pImpEditEngine->bInSelection = false;
DrawSelection();
GetEditSelection().Min() = GetEditSelection().Max();
}
diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx
index 5329322..297bef5 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -450,8 +450,6 @@ private:
sal_uInt16 nStretchY;
sal_uInt16 nAsianCompressionMode;
- sal_Bool bKernAsianPunctuation;
- sal_Bool bAddExtLeading;
EEHorizontalTextDirection eDefaultHorizontalTextDirection;
@@ -475,20 +473,22 @@ private:
OnDemandLocaleDataWrapper xLocaleDataWrapper;
OnDemandTransliterationWrapper xTransliterationWrapper;
- sal_Bool bIsFormatting;
- sal_Bool bFormatted;
- sal_Bool bInSelection;
- sal_Bool bIsInUndo;
- sal_Bool bUpdate;
- sal_Bool bUndoEnabled;
- sal_Bool bOwnerOfRefDev;
- sal_Bool bDowning;
- sal_Bool bUseAutoColor;
- sal_Bool bForceAutoColor;
- sal_Bool bCallParaInsertedOrDeleted;
- sal_Bool bImpConvertFirstCall; // specifies if ImpConvert is called the very first time after Convert was called
- sal_Bool bFirstWordCapitalization; // specifies if auto-correction should capitalize the first word or not
- sal_Bool mbLastTryMerge;
+ bool bKernAsianPunctuation:1;
+ bool bAddExtLeading:1;
+ bool bIsFormatting:1;
+ bool bFormatted:1;
+ bool bInSelection:1;
+ bool bIsInUndo:1;
+ bool bUpdate:1;
+ bool bUndoEnabled:1;
+ bool bOwnerOfRefDev:1;
+ bool bDowning:1;
+ bool bUseAutoColor:1;
+ bool bForceAutoColor:1;
+ bool bCallParaInsertedOrDeleted:1;
+ bool bImpConvertFirstCall:1; // specifies if ImpConvert is called the very first time after Convert was called
+ bool bFirstWordCapitalization:1; // specifies if auto-correction should capitalize the first word or not
+ bool mbLastTryMerge:1;
// For Formatting / Update ....
boost::ptr_vector<DeletedNodeInfo> aDeletedNodes;
@@ -527,8 +527,7 @@ private:
void TextModified();
void CalcHeight( ParaPortion* pPortion );
- // may prefer in-line, but so few ...
- void InsertUndo( EditUndo* pUndo, sal_Bool bTryMerge = sal_False );
+ void InsertUndo( EditUndo* pUndo, bool bTryMerge = false );
void ResetUndoManager();
sal_Bool HasUndoManager() const { return pUndoManager ? sal_True : sal_False; }
@@ -664,10 +663,10 @@ private:
long CalcVertLineSpacing(Point& rStartPos) const;
Color GetAutoColor() const;
- void EnableAutoColor( sal_Bool b ) { bUseAutoColor = b; }
- sal_Bool IsAutoColorEnabled() const { return bUseAutoColor; }
- void ForceAutoColor( sal_Bool b ) { bForceAutoColor = b; }
- sal_Bool IsForceAutoColor() const { return bForceAutoColor; }
+ void EnableAutoColor( bool b ) { bUseAutoColor = b; }
+ bool IsAutoColorEnabled() const { return bUseAutoColor; }
+ void ForceAutoColor( bool b ) { bForceAutoColor = b; }
+ bool IsForceAutoColor() const { return bForceAutoColor; }
inline VirtualDevice* GetVirtualDevice( const MapMode& rMapMode, sal_uLong nDrawMode );
inline void EraseVirtualDevice();
@@ -705,7 +704,7 @@ public:
inline EditUndoManager& GetUndoManager();
void SetUpdateMode( sal_Bool bUp, EditView* pCurView = 0, sal_Bool bForceUpdate = sal_False );
- sal_Bool GetUpdateMode() const { return bUpdate; }
+ bool GetUpdateMode() const { return bUpdate; }
const ParaPortionList& GetParaPortions() const { return aParaPortionList; }
ParaPortionList& GetParaPortions() { return aParaPortionList; }
@@ -756,16 +755,16 @@ public:
void UpdateSelections();
- void EnableUndo( sal_Bool bEnable );
- sal_Bool IsUndoEnabled() { return bUndoEnabled; }
- void SetUndoMode( sal_Bool b ) { bIsInUndo = b; }
- sal_Bool IsInUndo() { return bIsInUndo; }
+ void EnableUndo( bool bEnable );
+ bool IsUndoEnabled() { return bUndoEnabled; }
+ void SetUndoMode( bool b ) { bIsInUndo = b; }
+ bool IsInUndo() { return bIsInUndo; }
- void SetCallParaInsertedOrDeleted( sal_Bool b ) { bCallParaInsertedOrDeleted = b; }
- sal_Bool IsCallParaInsertedOrDeleted() const { return bCallParaInsertedOrDeleted; }
+ void SetCallParaInsertedOrDeleted( bool b ) { bCallParaInsertedOrDeleted = b; }
+ bool IsCallParaInsertedOrDeleted() const { return bCallParaInsertedOrDeleted; }
- sal_Bool IsFormatted() const { return bFormatted; }
- sal_Bool IsFormatting() const { return bIsFormatting; }
+ bool IsFormatted() const { return bFormatted; }
+ bool IsFormatting() const { return bIsFormatting; }
void SetText( const String& rText );
EditPaM DeleteSelected( EditSelection aEditSelection);
@@ -825,7 +824,7 @@ public:
Link GetModifyHdl() const { return aModifyHdl; }
- sal_Bool IsInSelectionMode() { return bInSelection; }
+ bool IsInSelectionMode() { return bInSelection; }
void IndentBlock( EditView* pView, sal_Bool bRight );
@@ -995,11 +994,11 @@ public:
void SetAsianCompressionMode( sal_uInt16 n );
sal_uInt16 GetAsianCompressionMode() const { return nAsianCompressionMode; }
- void SetKernAsianPunctuation( sal_Bool b );
- sal_Bool IsKernAsianPunctuation() const { return bKernAsianPunctuation; }
+ void SetKernAsianPunctuation( bool b );
+ bool IsKernAsianPunctuation() const { return bKernAsianPunctuation; }
- void SetAddExtLeading( sal_Bool b );
- sal_Bool IsAddExtLeading() const { return bAddExtLeading; }
+ void SetAddExtLeading( bool b );
+ bool IsAddExtLeading() const { return bAddExtLeading; }
rtl::Reference<SvxForbiddenCharactersTable> GetForbiddenCharsTable( sal_Bool bGetInternal = sal_True ) const;
void SetForbiddenCharsTable( rtl::Reference<SvxForbiddenCharactersTable> xForbiddenChars );
@@ -1013,8 +1012,8 @@ public:
Link GetEndDropHdl() const { return maEndDropHdl; }
/// specifies if auto-correction should capitalize the first word or not (default is on)
- void SetFirstWordCapitalization( sal_Bool bCapitalize ) { bFirstWordCapitalization = bCapitalize; }
- sal_Bool IsFirstWordCapitalization() const { return bFirstWordCapitalization; }
+ void SetFirstWordCapitalization( bool bCapitalize ) { bFirstWordCapitalization = bCapitalize; }
+ bool IsFirstWordCapitalization() const { return bFirstWordCapitalization; }
};
inline EPaM ImpEditEngine::CreateEPaM( const EditPaM& rPaM )
diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx
index 406f2eb..5743dc3 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -120,26 +120,26 @@ ImpEditEngine::ImpEditEngine( EditEngine* pEE, SfxItemPool* pItemPool ) :
nStretchX = 100;
nStretchY = 100;
- bInSelection = sal_False;
- bOwnerOfRefDev = sal_False;
- bDowning = sal_False;
- bIsInUndo = sal_False;
- bIsFormatting = sal_False;
- bFormatted = sal_False;
- bUpdate = sal_True;
- bUseAutoColor = sal_True;
- bForceAutoColor = sal_False;
- bAddExtLeading = sal_False;
- bUndoEnabled = sal_True;
- bCallParaInsertedOrDeleted = sal_False;
- bImpConvertFirstCall= sal_False;
- bFirstWordCapitalization = sal_True;
+ bInSelection = false;
+ bOwnerOfRefDev = false;
+ bDowning = false;
+ bIsInUndo = false;
+ bIsFormatting = false;
+ bFormatted = false;
+ bUpdate = true;
+ bUseAutoColor = true;
+ bForceAutoColor = false;
+ bAddExtLeading = false;
+ bUndoEnabled = true;
+ bCallParaInsertedOrDeleted = false;
+ bImpConvertFirstCall= false;
+ bFirstWordCapitalization = true;
eDefLanguage = LANGUAGE_DONTKNOW;
maBackgroundColor = COL_AUTO;
nAsianCompressionMode = text::CharacterCompressionType::NONE;
- bKernAsianPunctuation = sal_False;
+ bKernAsianPunctuation = false;
eDefaultHorizontalTextDirection = EE_HTEXTDIR_DEFAULT;
@@ -166,11 +166,11 @@ ImpEditEngine::ImpEditEngine( EditEngine* pEE, SfxItemPool* pItemPool ) :
SetRefDevice( pRefDev );
InitDoc( sal_False );
- bCallParaInsertedOrDeleted = sal_True;
+ bCallParaInsertedOrDeleted = true;
aEditDoc.SetModifyHdl( LINK( this, ImpEditEngine, DocModified ) );
- mbLastTryMerge = sal_False;
+ mbLastTryMerge = false;
}
ImpEditEngine::~ImpEditEngine()
@@ -182,7 +182,7 @@ ImpEditEngine::~ImpEditEngine()
// Destroying templates may otherwise cause unnecessary formatting,
// when a parent template is destroyed.
// And this after the destruction of the data!
- bDowning = sal_True;
+ bDowning = true;
SetUpdateMode( sal_False );
delete pVirtDev;
@@ -203,7 +203,7 @@ void ImpEditEngine::SetRefDevice( OutputDevice* pRef )
delete pRefDev;
pRefDev = pRef;
- bOwnerOfRefDev = sal_False;
+ bOwnerOfRefDev = false;
if ( !pRef )
pRefDev = EE_DLL().GetGlobalData()->GetStdRefDevice();
@@ -228,7 +228,7 @@ void ImpEditEngine::SetRefMapMode( const MapMode& rMapMode )
pRefDev = new VirtualDevice;
pRefDev->SetMapMode( MAP_TWIP );
SetRefDevice( pRefDev );
- bOwnerOfRefDev = sal_True;
+ bOwnerOfRefDev = true;
}
pRefDev->SetMapMode( rMapMode );
nOnePixelInRef = (sal_uInt16)pRefDev->PixelToLogic( Size( 1, 0 ) ).Width();
@@ -258,7 +258,7 @@ void ImpEditEngine::InitDoc( sal_Bool bKeepParaAttribs )
ParaPortion* pIniPortion = new ParaPortion( aEditDoc[0] );
GetParaPortions().Insert(0, pIniPortion);
- bFormatted = sal_False;
+ bFormatted = false;
if ( IsCallParaInsertedOrDeleted() )
{
@@ -660,7 +660,7 @@ sal_Bool ImpEditEngine::MouseButtonUp( const MouseEvent& rMEvt, EditView* pView
{
GetSelEngine().SetCurView( pView );
GetSelEngine().SelMouseButtonUp( rMEvt );
- bInSelection = sal_False;
+ bInSelection = false;
// Special treatments
EditSelection aCurSel( pView->pImpEditView->GetEditSelection() );
if ( !aCurSel.HasRange() )
@@ -794,7 +794,7 @@ void ImpEditEngine::CursorMoved( ContentNode* pPrevNode )
void ImpEditEngine::TextModified()
{
- bFormatted = sal_False;
+ bFormatted = false;
if ( GetNotifyHdl().IsSet() )
{
@@ -810,7 +810,7 @@ void ImpEditEngine::ParaAttribsChanged( ContentNode* pNode )
OSL_ENSURE( pNode, "ParaAttribsChanged: Which one?" );
aEditDoc.SetModified( sal_True );
- bFormatted = sal_False;
+ bFormatted = false;
ParaPortion* pPortion = FindParaPortion( pNode );
OSL_ENSURE( pPortion, "ParaAttribsChanged: Portion?" );
diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx
index 7806bce..c1c7aea 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -370,7 +370,7 @@ void ImpEditEngine::FormatDoc()
EnterBlockNotifications();
- bIsFormatting = sal_True;
+ bIsFormatting = true;
// Then I can also start the spell-timer ...
if ( GetStatus().DoOnlineSpelling() )
@@ -487,8 +487,8 @@ void ImpEditEngine::FormatDoc()
if ( aStatus.DoRestoreFont() )
GetRefDevice()->SetFont( aOldFont );
- bIsFormatting = sal_False;
- bFormatted = sal_True;
+ bIsFormatting = false;
+ bFormatted = true;
if ( bMapChanged )
GetRefDevice()->Pop();
diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx
index 4863e48..3d35330 100644
--- a/editeng/source/editeng/impedit4.cxx
+++ b/editeng/source/editeng/impedit4.cxx
@@ -1572,7 +1572,7 @@ void ImpEditEngine::Convert( EditView* pEditView,
else if ( CreateEPaM( aEditDoc.GetStartPaM() ) == pConvInfo->aConvStart )
bIsStart = sal_True;
- bImpConvertFirstCall = sal_True; // next ImpConvert call is the very first in this conversion turn
+ bImpConvertFirstCall = true; // next ImpConvert call is the very first in this conversion turn
Reference< lang::XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory();
TextConvWrapper aWrp( Application::GetDefDialogParent(), xMSF,
@@ -3061,7 +3061,7 @@ void ImpEditEngine::SetAsianCompressionMode( sal_uInt16 n )
}
}
-void ImpEditEngine::SetKernAsianPunctuation( sal_Bool b )
+void ImpEditEngine::SetKernAsianPunctuation( bool b )
{
if ( b != bKernAsianPunctuation )
{
@@ -3074,7 +3074,7 @@ void ImpEditEngine::SetKernAsianPunctuation( sal_Bool b )
}
}
-void ImpEditEngine::SetAddExtLeading( sal_Bool bExtLeading )
+void ImpEditEngine::SetAddExtLeading( bool bExtLeading )
{
if ( IsAddExtLeading() != bExtLeading )
{
diff --git a/editeng/source/editeng/impedit5.cxx b/editeng/source/editeng/impedit5.cxx
index 46fab2c..2dd9328 100644
--- a/editeng/source/editeng/impedit5.cxx
+++ b/editeng/source/editeng/impedit5.cxx
@@ -263,13 +263,13 @@ void ImpEditEngine::UndoActionEnd( sal_uInt16 )
}
}
-void ImpEditEngine::InsertUndo( EditUndo* pUndo, sal_Bool bTryMerge )
+void ImpEditEngine::InsertUndo( EditUndo* pUndo, bool bTryMerge )
{
DBG_ASSERT( !IsInUndo(), "InsertUndo in Undomodus!" );
if ( pUndoMarkSelection )
{
EditUndoMarkSelection* pU = new EditUndoMarkSelection( this, *pUndoMarkSelection );
- GetUndoManager().AddUndoAction( pU, sal_False );
+ GetUndoManager().AddUndoAction( pU, false );
delete pUndoMarkSelection;
pUndoMarkSelection = NULL;
}
@@ -284,7 +284,7 @@ void ImpEditEngine::ResetUndoManager()
GetUndoManager().Clear();
}
-void ImpEditEngine::EnableUndo( sal_Bool bEnable )
+void ImpEditEngine::EnableUndo( bool bEnable )
{
// When switching the mode Delete list:
if ( bEnable != IsUndoEnabled() )
@@ -586,7 +586,7 @@ void ImpEditEngine::SetAttribs( EditSelection aSel, const SfxItemSet& rSet, sal_
}
else if ( bCharAttribFound )
{
- bFormatted = sal_False;
+ bFormatted = false;
if ( !pNode->Len() || ( nStartPos != nEndPos ) )
{
pPortion->MarkSelectionInvalid( nStartPos, nEndPos-nStartPos );
@@ -657,7 +657,7 @@ void ImpEditEngine::RemoveCharAttribs( EditSelection aSel, sal_Bool bRemoveParaA
if ( bChanged && !bRemoveParaAttribs )
{
- bFormatted = sal_False;
+ bFormatted = false;
pPortion->MarkSelectionInvalid( nStartPos, nEndPos-nStartPos );
}
}
@@ -794,7 +794,7 @@ void ImpEditEngine::ParaAttribsToCharAttribs( ContentNode* pNode )
aEditDoc.InsertAttrib( pNode, nLastEnd, nEndPos, rItem );
}
}
- bFormatted = sal_False;
+ bFormatted = false;
// Portion does not need to be invalidated here, happens elsewhere.
}
commit dc2eddd2339ff5510928fcd6c59e186e179c86bc
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Mon Apr 2 21:38:51 2012 -0400
This ought to be private...
diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx
index e98ec49..5329322 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -488,6 +488,7 @@ private:
sal_Bool bCallParaInsertedOrDeleted;
sal_Bool bImpConvertFirstCall; // specifies if ImpConvert is called the very first time after Convert was called
sal_Bool bFirstWordCapitalization; // specifies if auto-correction should capitalize the first word or not
+ sal_Bool mbLastTryMerge;
// For Formatting / Update ....
boost::ptr_vector<DeletedNodeInfo> aDeletedNodes;
@@ -1003,8 +1004,6 @@ public:
rtl::Reference<SvxForbiddenCharactersTable> GetForbiddenCharsTable( sal_Bool bGetInternal = sal_True ) const;
void SetForbiddenCharsTable( rtl::Reference<SvxForbiddenCharactersTable> xForbiddenChars );
- sal_Bool mbLastTryMerge;
-
/** sets a link that is called at the beginning of a drag operation at an edit view */
void SetBeginDropHdl( const Link& rLink ) { maBeginDropHdl = rLink; }
Link GetBeginDropHdl() const { return maBeginDropHdl; }
commit 352f10a2e7ee32bee3553bc657e88f319f8dadc7
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Mon Apr 2 20:54:42 2012 -0400
Another SV_DECL_PTRARR to kill.
diff --git a/editeng/source/editeng/editdoc.hxx b/editeng/source/editeng/editdoc.hxx
index 0c995c9..7cc78ca 100644
--- a/editeng/source/editeng/editdoc.hxx
+++ b/editeng/source/editeng/editdoc.hxx
@@ -707,13 +707,10 @@ public:
{ nInvalidAdressPtr = nInvAdr;
nInvalidParagraph = nPos; }
- sal_uIntPtr GetInvalidAdress() { return nInvalidAdressPtr; }
- sal_uInt16 GetPosition() { return nInvalidParagraph; }
+ sal_uIntPtr GetInvalidAdress() const { return nInvalidAdressPtr; }
+ sal_uInt16 GetPosition() const { return nInvalidParagraph; }
};
-typedef DeletedNodeInfo* DeletedNodeInfoPtr;
-SV_DECL_PTRARR( DeletedNodesList, DeletedNodeInfoPtr, 0 )
-
// -------------------------------------------------------------------------
// class EditDoc
// -------------------------------------------------------------------------
diff --git a/editeng/source/editeng/editundo.cxx b/editeng/source/editeng/editundo.cxx
index 62443be..d1f65b9 100644
--- a/editeng/source/editeng/editundo.cxx
+++ b/editeng/source/editeng/editundo.cxx
@@ -216,7 +216,7 @@ void EditUndoDelContent::Redo()
_pImpEE->GetEditEnginePtr()->ParagraphDeleted( nNode );
DeletedNodeInfo* pInf = new DeletedNodeInfo( (sal_uLong)pContentNode, nNode );
- _pImpEE->aDeletedNodes.Insert( pInf, _pImpEE->aDeletedNodes.Count() );
+ _pImpEE->aDeletedNodes.push_back(pInf);
_pImpEE->UpdateSelections();
ContentNode* pN = ( nNode < _pImpEE->GetEditDoc().Count() )
diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx
index ef6e128..e98ec49 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -490,7 +490,7 @@ private:
sal_Bool bFirstWordCapitalization; // specifies if auto-correction should capitalize the first word or not
// For Formatting / Update ....
- DeletedNodesList aDeletedNodes;
+ boost::ptr_vector<DeletedNodeInfo> aDeletedNodes;
Rectangle aInvalidRec;
sal_uInt32 nCurTextHeight;
sal_uInt32 nCurTextHeightNTP; // without trailing empty paragraphs
diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx
index 5d5cdf2..406f2eb 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -2255,7 +2255,7 @@ EditPaM ImpEditEngine::ImpConnectParagraphs( ContentNode* pLeft, ContentNode* pR
sal_uInt16 nParagraphTobeDeleted = aEditDoc.GetPos( pRight );
DeletedNodeInfo* pInf = new DeletedNodeInfo( (sal_uLong)pRight, nParagraphTobeDeleted );
- aDeletedNodes.Insert( pInf, aDeletedNodes.Count() );
+ aDeletedNodes.push_back(pInf);
GetEditEnginePtr()->ParagraphConnected( aEditDoc.GetPos( pLeft ), aEditDoc.GetPos( pRight ) );
@@ -2482,7 +2482,7 @@ void ImpEditEngine::ImpRemoveParagraph( sal_uInt16 nPara )
OSL_ENSURE( pNode, "Blind Node in ImpRemoveParagraph" );
DeletedNodeInfo* pInf = new DeletedNodeInfo( (sal_uLong)pNode, nPara );
- aDeletedNodes.Insert( pInf, aDeletedNodes.Count() );
+ aDeletedNodes.push_back(pInf);
// The node is managed by the undo and possibly destroyed!
aEditDoc.Release( nPara );
@@ -3332,8 +3332,6 @@ sal_uInt32 ImpEditEngine::GetParaHeight( sal_uInt16 nParagraph )
void ImpEditEngine::UpdateSelections()
{
- sal_uInt16 nInvNodes = aDeletedNodes.Count();
-
// Check whether one of the selections is at a deleted node...
// If the node is valid, the index has yet to be examined!
for ( sal_uInt16 nView = 0; nView < aEditViews.Count(); nView++ )
@@ -3341,16 +3339,16 @@ void ImpEditEngine::UpdateSelections()
EditView* pView = aEditViews.GetObject(nView);
DBG_CHKOBJ( pView, EditView, 0 );
EditSelection aCurSel( pView->pImpEditView->GetEditSelection() );
- sal_Bool bChanged = sal_False;
- for ( sal_uInt16 n = 0; n < nInvNodes; n++ )
+ bool bChanged = false;
+ for (size_t i = 0, n = aDeletedNodes.size(); i < n; ++i)
{
- DeletedNodeInfo* pInf = aDeletedNodes.GetObject( n );
- if ( ( ( sal_uLong )(aCurSel.Min().GetNode()) == pInf->GetInvalidAdress() ) ||
- ( ( sal_uLong )(aCurSel.Max().GetNode()) == pInf->GetInvalidAdress() ) )
+ const DeletedNodeInfo& rInf = aDeletedNodes[i];
+ if ( ( ( sal_uLong )(aCurSel.Min().GetNode()) == rInf.GetInvalidAdress() ) ||
+ ( ( sal_uLong )(aCurSel.Max().GetNode()) == rInf.GetInvalidAdress() ) )
{
// Use ParaPortions, as now also hidden paragraphs have to be
// taken into account!
- sal_uInt16 nPara = pInf->GetPosition();
+ sal_uInt16 nPara = rInf.GetPosition();
ParaPortion* pPPortion = GetParaPortions().SafeGetObject( nPara );
if ( !pPPortion ) // Last paragraph
{
@@ -3394,13 +3392,7 @@ void ImpEditEngine::UpdateSelections()
}
}
- // Delete ...
- for ( sal_uInt16 n = 0; n < nInvNodes; n++ )
- {
- DeletedNodeInfo* pInf = aDeletedNodes.GetObject( n );
- delete pInf;
- }
- aDeletedNodes.Remove( 0, aDeletedNodes.Count() );
+ aDeletedNodes.clear();
}
EditSelection ImpEditEngine::ConvertSelection(
diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx
index f7038f5..7806bce 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -3785,7 +3785,7 @@ void ImpEditEngine::ShowParagraph( sal_uInt16 nParagraph, sal_Bool bShow )
// Mark as deleted, so that no selection will end or begin at
// this paragraph...
DeletedNodeInfo* pDelInfo = new DeletedNodeInfo( (sal_uIntPtr)pPPortion->GetNode(), nParagraph );
- aDeletedNodes.Insert( pDelInfo, aDeletedNodes.Count() );
+ aDeletedNodes.push_back(pDelInfo);
UpdateSelections();
// The region below will not be invalidated if UpdateMode = sal_False!
// If anyway, then save as sal_False before SetVisible !
commit 33bf6e04590fe373fd2a9887f5636c2e831cc846
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Mon Apr 2 20:31:54 2012 -0400
Unprintable character.
diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx
index ec15742..ef6e128 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -208,9 +208,9 @@ public:
EditView* GetView() { return pView; }
};
-// ----------------------------------------------------------------------
+// ----------------------------------------------------------------------
// class ImpEditView
-// ----------------------------------------------------------------------
+// ---------------------------------------------------------------------
class ImpEditView : public vcl::unohelper::DragAndDropClient
{
friend class EditView;
commit 9f1c57b4f829a0faf28e436bca1aed49694c7cb6
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Mon Apr 2 20:19:27 2012 -0400
Bool-ness.
diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx
index df899c5..608e681 100644
--- a/editeng/source/editeng/editdoc.cxx
+++ b/editeng/source/editeng/editdoc.cxx
@@ -873,7 +873,9 @@ void ConvertAndPutItems( SfxItemSet& rDest, const SfxItemSet& rSource, const Map
}
}
-EditLine::EditLine()
+EditLine::EditLine() :
+ bHangingPunctuation(false),
+ bInvalid(true)
{
DBG_CTOR( EE_EditLine, 0 );
@@ -887,11 +889,11 @@ EditLine::EditLine()
nTxtWidth = 0;
nCrsrHeight = 0;
nMaxAscent = 0;
- bHangingPunctuation = sal_False;
- bInvalid = sal_True;
}
-EditLine::EditLine( const EditLine& r )
+EditLine::EditLine( const EditLine& r ) :
+ bHangingPunctuation(r.bHangingPunctuation),
+ bInvalid(true)
{
DBG_CTOR( EE_EditLine, 0 );
@@ -899,7 +901,6 @@ EditLine::EditLine( const EditLine& r )
nStart = r.nStart;
nStartPortion = r.nStartPortion;
nEndPortion = r.nEndPortion;
- bHangingPunctuation = r.bHangingPunctuation;
nHeight = 0;
nStartPosX = 0;
@@ -907,7 +908,6 @@ EditLine::EditLine( const EditLine& r )
nTxtWidth = 0;
nCrsrHeight = 0;
nMaxAscent = 0;
- bInvalid = sal_True;
}
EditLine::~EditLine()
diff --git a/editeng/source/editeng/editdoc.hxx b/editeng/source/editeng/editdoc.hxx
index c71229a..0c995c9 100644
--- a/editeng/source/editeng/editdoc.hxx
+++ b/editeng/source/editeng/editdoc.hxx
@@ -464,8 +464,8 @@ private:
sal_uInt16 nTxtHeight; // Pure Text height
sal_uInt16 nCrsrHeight; // For contour flow high lines => cursor is large.
sal_uInt16 nMaxAscent;
- sal_Bool bHangingPunctuation;
- sal_Bool bInvalid; // for skillful formatting
+ bool bHangingPunctuation:1;
+ bool bInvalid:1; // for skillful formatting
public:
EditLine();
@@ -509,8 +509,8 @@ public:
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list