summaryrefslogtreecommitdiff
path: root/editeng
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2012-03-28 22:34:57 -0400
committerKohei Yoshida <kohei.yoshida@gmail.com>2012-03-28 22:50:13 -0400
commit87d554e97332f418d570d69391c3f2bf95e8cbab (patch)
tree5b594e59150319f85ac059af9fb51dba1b9a8298 /editeng
parentcc7bacc506d3613ad45b0443df1151eb92b1f9b4 (diff)
ParaPortionList no longer a child class of DummyParaPortionList.
BTW, whoever originally wrote this code obviously didn't like using const keywords.
Diffstat (limited to 'editeng')
-rw-r--r--editeng/source/editeng/editdoc.hxx36
-rw-r--r--editeng/source/editeng/editdoc2.cxx98
-rw-r--r--editeng/source/editeng/editeng.cxx16
-rw-r--r--editeng/source/editeng/editundo.cxx1
-rw-r--r--editeng/source/editeng/editview.cxx2
-rw-r--r--editeng/source/editeng/impedit.cxx5
-rw-r--r--editeng/source/editeng/impedit.hxx22
-rw-r--r--editeng/source/editeng/impedit2.cxx102
-rw-r--r--editeng/source/editeng/impedit3.cxx36
-rw-r--r--editeng/source/editeng/impedit4.cxx4
-rw-r--r--editeng/source/editeng/impedit5.cxx4
11 files changed, 206 insertions, 120 deletions
diff --git a/editeng/source/editeng/editdoc.hxx b/editeng/source/editeng/editdoc.hxx
index 9474ee92a002..2a78af7bb10b 100644
--- a/editeng/source/editeng/editdoc.hxx
+++ b/editeng/source/editeng/editdoc.hxx
@@ -438,7 +438,7 @@ public:
~TextPortionList();
void Reset();
- sal_uInt16 FindPortion( sal_uInt16 nCharPos, sal_uInt16& rPortionStart, sal_Bool bPreferStartingPortion = sal_False );
+ 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 );
};
@@ -584,9 +584,10 @@ public:
ParaPortion( ContentNode* pNode );
~ParaPortion();
- sal_uInt16 GetLineNumber( sal_uInt16 nIndex );
+ sal_uInt16 GetLineNumber( sal_uInt16 nIndex ) const;
EditLineList& GetLines() { return aLineList; }
+ const EditLineList& GetLines() const { return aLineList; }
sal_Bool IsInvalid() const { return bInvalid; }
sal_Bool IsSimpleInvalid() const { return bSimple; }
@@ -602,7 +603,7 @@ public:
void MarkSelectionInvalid( sal_uInt16 nStart, sal_uInt16 nEnd );
void SetVisible( sal_Bool bVisible );
- sal_Bool IsVisible() { return bVisible; }
+ bool IsVisible() const { return bVisible; }
sal_Bool IsEmpty() { return GetTextPortions().Count() == 1 && GetTextPortions()[0]->GetLen() == 0; }
@@ -612,6 +613,7 @@ public:
ContentNode* GetNode() const { return pNode; }
TextPortionList& GetTextPortions() { return aTextPortionList; }
+ const TextPortionList& GetTextPortions() const { return aTextPortionList; }
sal_uInt16 GetInvalidPosStart() const { return nInvalidPosStart; }
short GetInvalidDiff() const { return nInvalidDiff; }
@@ -622,27 +624,37 @@ public:
#endif
};
-typedef ParaPortion* ParaPortionPtr;
-SV_DECL_PTRARR( DummyParaPortionList, ParaPortionPtr, 0 )
-
// -------------------------------------------------------------------------
// class ParaPortionList
// -------------------------------------------------------------------------
-class ParaPortionList : public DummyParaPortionList
+class ParaPortionList
{
- mutable sal_uInt16 nLastCache;
+ mutable size_t nLastCache;
+ boost::ptr_vector<ParaPortion> maPortions;
public:
ParaPortionList();
~ParaPortionList();
void Reset();
- long GetYOffset( ParaPortion* pPPortion );
+ long GetYOffset(const ParaPortion* pPPortion) const;
sal_uInt16 FindParagraph( long nYOffset );
- inline ParaPortion* SaveGetObject( sal_uInt16 nPos ) const
- { return ( nPos < Count() ) ? GetObject( nPos ) : 0; }
+ inline const ParaPortion* SaveGetObject(size_t nPos) const
+ { return nPos < maPortions.size() ? &maPortions[nPos] : NULL; }
+
+ inline ParaPortion* SaveGetObject(size_t nPos)
+ { return nPos < maPortions.size() ? &maPortions[nPos] : NULL; }
+
+ sal_uInt16 GetPos(const ParaPortion* p) const;
+ ParaPortion* operator[](size_t nPos);
+ const ParaPortion* operator[](size_t nPos) const;
+
+ ParaPortion* Release(size_t nPos);
+ void Remove(size_t nPos);
+ void Insert(size_t nPos, ParaPortion* p);
+ void Append(ParaPortion* p);
+ size_t Count() const;
- sal_uInt16 GetPos(ParaPortion* p) const;
#if OSL_DEBUG_LEVEL > 2
// temporary:
void DbgCheck( EditDoc& rDoc );
diff --git a/editeng/source/editeng/editdoc2.cxx b/editeng/source/editeng/editdoc2.cxx
index 51a22f3e6aa6..52a815ad7264 100644
--- a/editeng/source/editeng/editdoc2.cxx
+++ b/editeng/source/editeng/editdoc2.cxx
@@ -63,6 +63,8 @@
#include <vcl/svapp.hxx> // For AppWindow...
+#include <limits>
+
DBG_NAME( EE_ParaPortion )
SV_IMPL_VARARR( CharPosArray, sal_Int32 );
@@ -92,7 +94,7 @@ void TextPortionList::DeleteFromPortion( sal_uInt16 nDelFrom )
Remove( nDelFrom, Count()-nDelFrom );
}
-sal_uInt16 TextPortionList::FindPortion( sal_uInt16 nCharPos, sal_uInt16& nPortionStart, sal_Bool bPreferStartingPortion )
+sal_uInt16 TextPortionList::FindPortion( sal_uInt16 nCharPos, sal_uInt16& nPortionStart, sal_Bool bPreferStartingPortion ) const
{
// When nCharPos at portion limit, the left portion is found
sal_uInt16 nTmpPos = 0;
@@ -227,7 +229,7 @@ void ParaPortion::MarkSelectionInvalid( sal_uInt16 nStart, sal_uInt16 /* nEnd */
aWritingDirectionInfos.clear();
}
-sal_uInt16 ParaPortion::GetLineNumber( sal_uInt16 nIndex )
+sal_uInt16 ParaPortion::GetLineNumber( sal_uInt16 nIndex ) const
{
DBG_ASSERTWARNING( aLineList.Count(), "Empty ParaPortion in GetLine!" );
DBG_ASSERT( bVisible, "Why GetLine() on an invisible paragraph?" );
@@ -324,6 +326,40 @@ sal_uInt16 FastGetPos(
return USHRT_MAX;
}
+template<typename _Array, typename _Val>
+size_t FastGetPos(const _Array& rArray, const _Val* p, size_t& rLastPos)
+{
+ size_t nArrayLen = rArray.size();
+
+ // Through certain filter code-paths we do a lot of appends, which in
+ // turn call GetPos - creating some N^2 nightmares. If we have a
+ // non-trivially large list, do a few checks from the end first.
+ if (rLastPos > 16)
+ {
+ size_t nEnd;
+ if (rLastPos > nArrayLen - 2)
+ nEnd = nArrayLen;
+ else
+ nEnd = rLastPos + 2;
+
+ for (size_t nIdx = rLastPos - 2; nIdx < nEnd; ++nIdx)
+ {
+ if (&rArray[nIdx] == p)
+ {
+ rLastPos = nIdx;
+ return nIdx;
+ }
+ }
+ }
+ // The world's lamest linear search from svarray ...
+ for (size_t nIdx = 0; nIdx < nArrayLen; ++nIdx)
+ if (&rArray[nIdx] == p)
+ return rLastPos = nIdx;
+
+ // 0xFFFF is used to signify "not found" condition. We need to change this.
+ return std::numeric_limits<sal_uInt16>::max();
+}
+
}
ParaPortionList::ParaPortionList() : nLastCache( 0 )
@@ -332,12 +368,46 @@ ParaPortionList::ParaPortionList() : nLastCache( 0 )
ParaPortionList::~ParaPortionList()
{
- Reset();
}
-sal_uInt16 ParaPortionList::GetPos(ParaPortion* p) const
+sal_uInt16 ParaPortionList::GetPos(const ParaPortion* p) const
{
- return FastGetPos(GetData(), Count(), p, nLastCache);
+ return FastGetPos(maPortions, p, nLastCache);
+}
+
+ParaPortion* ParaPortionList::operator [](size_t nPos)
+{
+ return nPos < maPortions.size() ? &maPortions[nPos] : NULL;
+}
+
+const ParaPortion* ParaPortionList::operator [](size_t nPos) const
+{
+ return nPos < maPortions.size() ? &maPortions[nPos] : NULL;
+}
+
+ParaPortion* ParaPortionList::Release(size_t nPos)
+{
+ return maPortions.release(maPortions.begin()+nPos).release();
+}
+
+void ParaPortionList::Remove(size_t nPos)
+{
+ maPortions.erase(maPortions.begin()+nPos);
+}
+
+void ParaPortionList::Insert(size_t nPos, ParaPortion* p)
+{
+ maPortions.insert(maPortions.begin()+nPos, p);
+}
+
+void ParaPortionList::Append(ParaPortion* p)
+{
+ maPortions.push_back(p);
+}
+
+size_t ParaPortionList::Count() const
+{
+ return maPortions.size();
}
ContentList::ContentList() : DummyContentList( 0 ), nLastCache(0) {}
@@ -349,17 +419,15 @@ sal_uInt16 ContentList::GetPos(ContentNode* p) const
void ParaPortionList::Reset()
{
- for ( sal_uInt16 nPortion = 0; nPortion < Count(); nPortion++ )
- delete GetObject( nPortion );
- Remove( 0, Count() );
+ maPortions.clear();
}
-long ParaPortionList::GetYOffset( ParaPortion* pPPortion )
+long ParaPortionList::GetYOffset(const ParaPortion* pPPortion) const
{
long nHeight = 0;
- for ( sal_uInt16 nPortion = 0; nPortion < Count(); nPortion++ )
+ for (size_t i = 0, n = maPortions.size(); i < n; ++i)
{
- ParaPortion* pTmpPortion = GetObject(nPortion);
+ const ParaPortion* pTmpPortion = &maPortions[i];
if ( pTmpPortion == pPPortion )
return nHeight;
nHeight += pTmpPortion->GetHeight();
@@ -371,13 +439,13 @@ long ParaPortionList::GetYOffset( ParaPortion* pPPortion )
sal_uInt16 ParaPortionList::FindParagraph( long nYOffset )
{
long nY = 0;
- for ( sal_uInt16 nPortion = 0; nPortion < Count(); nPortion++ )
+ for (size_t i = 0, n = maPortions.size(); i < n; ++i)
{
- nY += GetObject(nPortion)->GetHeight(); // should also be correct even in bVisible!
+ nY += maPortions[i].GetHeight(); // should also be correct even in bVisible!
if ( nY > nYOffset )
- return nPortion;
+ return i;
}
- return 0xFFFF; // Should be reachable through EE_PARA_NOT_FOUND!
+ return EE_PARA_NOT_FOUND;
}
#if OSL_DEBUG_LEVEL > 2
diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx
index 9fcd0a2f9b32..8a68f089ac37 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -1345,7 +1345,7 @@ void EditEngine::RemoveParagraph( sal_uInt16 nPara )
return;
ContentNode* pNode = pImpEditEngine->GetEditDoc().SaveGetObject( nPara );
- ParaPortion* pPortion = pImpEditEngine->GetParaPortions().SaveGetObject( nPara );
+ const ParaPortion* pPortion = pImpEditEngine->GetParaPortions().SaveGetObject( nPara );
DBG_ASSERT( pPortion && pNode, "Paragraph not found: RemoveParagraph" );
if ( pNode && pPortion )
{
@@ -1557,7 +1557,7 @@ void EditEngine::GetPortions( sal_uInt16 nPara, std::vector<sal_uInt16>& rList )
if ( !pImpEditEngine->IsFormatted() )
pImpEditEngine->FormatFullDoc();
- ParaPortion* pParaPortion = pImpEditEngine->GetParaPortions().SaveGetObject( nPara );
+ const ParaPortion* pParaPortion = pImpEditEngine->GetParaPortions().SaveGetObject( nPara );
if ( pParaPortion )
{
sal_uInt16 nEnd = 0;
@@ -1639,8 +1639,8 @@ void EditEngine::SetControlWord( sal_uInt32 nWord )
for ( sal_uInt16 n = 0; n < nNodes; n++ )
{
ContentNode* pNode = pImpEditEngine->GetEditDoc().GetObject( n );
- ParaPortion* pPortion = pImpEditEngine->GetParaPortions().GetObject( n );
- sal_Bool bWrongs = ( bSpellingChanged || ( nWord & EE_CNTRL_ONLINESPELLING ) ) ? !pNode->GetWrongList()->empty() : sal_False;
+ const ParaPortion* pPortion = pImpEditEngine->GetParaPortions()[n];
+ bool bWrongs = ( bSpellingChanged || ( nWord & EE_CNTRL_ONLINESPELLING ) ) ? !pNode->GetWrongList()->empty() : false;
if ( bSpellingChanged )
pNode->DestroyWrongList();
if ( bWrongs )
@@ -1669,13 +1669,13 @@ long EditEngine::GetFirstLineStartX( sal_uInt16 nParagraph )
DBG_CHKTHIS( EditEngine, 0 );
long nX = 0;
- ParaPortion* pPPortion = pImpEditEngine->GetParaPortions().SaveGetObject( nParagraph );
+ const ParaPortion* pPPortion = pImpEditEngine->GetParaPortions().SaveGetObject( nParagraph );
if ( pPPortion )
{
DBG_ASSERT( pImpEditEngine->IsFormatted() || !pImpEditEngine->IsFormatting(), "GetFirstLineStartX: Doc not formatted - unable to format!" );
if ( !pImpEditEngine->IsFormatted() )
pImpEditEngine->FormatDoc();
- EditLine* pFirstLine = pPPortion->GetLines()[0];
+ const EditLine* pFirstLine = pPPortion->GetLines()[0];
nX = pFirstLine->GetStartPosX();
}
return nX;
@@ -1695,7 +1695,7 @@ Point EditEngine::GetDocPos( const Point& rPaperPos ) const
Point EditEngine::GetDocPosTopLeft( sal_uInt16 nParagraph )
{
DBG_CHKTHIS( EditEngine, 0 );
- ParaPortion* pPPortion = pImpEditEngine->GetParaPortions().SaveGetObject( nParagraph );
+ const ParaPortion* pPPortion = pImpEditEngine->GetParaPortions().SaveGetObject( nParagraph );
DBG_ASSERT( pPPortion, "Paragraph not found: GetWindowPosTopLeft" );
Point aPoint;
if ( pPPortion )
@@ -1758,7 +1758,7 @@ sal_Bool EditEngine::IsTextPos( const Point& rPaperPos, sal_uInt16 nBorder )
EditPaM aPaM = pImpEditEngine->GetPaM( aDocPos, sal_False );
if ( aPaM.GetNode() )
{
- ParaPortion* pParaPortion = pImpEditEngine->FindParaPortion( aPaM.GetNode() );
+ const ParaPortion* pParaPortion = pImpEditEngine->FindParaPortion( aPaM.GetNode() );
DBG_ASSERT( pParaPortion, "ParaPortion?" );
sal_uInt16 nLine = pParaPortion->GetLineNumber( aPaM.GetIndex() );
diff --git a/editeng/source/editeng/editundo.cxx b/editeng/source/editeng/editundo.cxx
index b59b71a060f4..da8fbfd91b06 100644
--- a/editeng/source/editeng/editundo.cxx
+++ b/editeng/source/editeng/editundo.cxx
@@ -208,7 +208,6 @@ void EditUndoDelContent::Redo()
pContentNode = _pImpEE->GetEditDoc().SaveGetObject( nNode );
DBG_ASSERT( pContentNode, "EditUndoDelContent::Redo(): Node?!" );
- delete _pImpEE->GetParaPortions()[nNode];
_pImpEE->GetParaPortions().Remove( nNode );
// Do not delete node, depends on the undo!
diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx
index b7dfee803481..e066f73269ff 100644
--- a/editeng/source/editeng/editview.cxx
+++ b/editeng/source/editeng/editview.cxx
@@ -241,7 +241,7 @@ void EditView::SetSelection( const ESelection& rESel )
PIMPEE->CheckIdleFormatter();
// Selection may not start/end at an invisible paragraph:
- ParaPortion* pPortion = PIMPEE->FindParaPortion( aNewSelection.Min().GetNode() );
+ const ParaPortion* pPortion = PIMPEE->FindParaPortion( aNewSelection.Min().GetNode() );
if ( !pPortion->IsVisible() )
{
pPortion = PIMPEE->GetPrevVisPortion( pPortion );
diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx
index f63ab6aa1dce..811e96e50b7f 100644
--- a/editeng/source/editeng/impedit.cxx
+++ b/editeng/source/editeng/impedit.cxx
@@ -650,7 +650,8 @@ void ImpEditView::ShowCursor( sal_Bool bGotoCursor, sal_Bool bForceVisCursor, sa
sal_uInt16 nPara = pEditEngine->pImpEditEngine->aEditDoc.GetPos( aPaM.GetNode() );
if (nPara == USHRT_MAX) // #i94322
return;
- ParaPortion* pParaPortion = pEditEngine->pImpEditEngine->GetParaPortions().GetObject( nPara );
+
+ const ParaPortion* pParaPortion = pEditEngine->pImpEditEngine->GetParaPortions()[nPara];
nShowCursorFlags |= nExtraCursorFlags;
@@ -1218,7 +1219,7 @@ sal_Bool ImpEditView::IsBulletArea( const Point& rPos, sal_uInt16* pPara )
sal_uInt16 nPara = pEditEngine->pImpEditEngine->aEditDoc.GetPos( aPaM.GetNode() );
Rectangle aBulletArea = pEditEngine->GetBulletArea( nPara );
long nY = pEditEngine->GetDocPosTopLeft( nPara ).Y();
- ParaPortion* pParaPortion = pEditEngine->pImpEditEngine->GetParaPortions().GetObject( nPara );
+ const ParaPortion* pParaPortion = pEditEngine->pImpEditEngine->GetParaPortions()[nPara];
nY += pParaPortion->GetFirstLineOffset();
if ( ( aDocPos.Y() > ( nY + aBulletArea.Top() ) ) &&
( aDocPos.Y() < ( nY + aBulletArea.Bottom() ) ) &&
diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx
index 5196703ad7a9..3d4aaa0f6504 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -536,10 +536,10 @@ private:
EditPaM GetPaM( Point aDocPos, sal_Bool bSmart = sal_True );
EditPaM GetPaM( ParaPortion* pPortion, Point aPos, sal_Bool bSmart = sal_True );
long GetXPos( ParaPortion* pParaPortion, EditLine* pLine, sal_uInt16 nIndex, sal_Bool bPreferPortionStart = sal_False );
- long GetPortionXOffset( ParaPortion* pParaPortion, EditLine* pLine, sal_uInt16 nTextPortion );
- sal_uInt16 GetChar( ParaPortion* pParaPortion, EditLine* pLine, long nX, sal_Bool bSmart = sal_True );
+ long GetPortionXOffset(const ParaPortion* pParaPortion, EditLine* pLine, sal_uInt16 nTextPortion);
+ sal_uInt16 GetChar(const ParaPortion* pParaPortion, EditLine* pLine, long nX, bool bSmart = true);
Range GetInvalidYOffsets( ParaPortion* pPortion );
- Range GetLineXPosStartEnd( ParaPortion* pParaPortion, EditLine* pLine );
+ Range GetLineXPosStartEnd( const ParaPortion* pParaPortion, EditLine* pLine ) const;
void SetParaAttrib( sal_uInt8 nFunc, EditSelection aSel, sal_uInt16 nValue );
sal_uInt16 GetParaAttrib( sal_uInt8 nFunc, EditSelection aSel );
@@ -654,8 +654,8 @@ private:
ContentNode* GetPrevVisNode( ContentNode* pCurNode );
ContentNode* GetNextVisNode( ContentNode* pCurNode );
- ParaPortion* GetPrevVisPortion( ParaPortion* pCurPortion );
- ParaPortion* GetNextVisPortion( ParaPortion* pCurPortion );
+ const ParaPortion* GetPrevVisPortion( const ParaPortion* pCurPortion ) const;
+ const ParaPortion* GetNextVisPortion( const ParaPortion* pCurPortion ) const;
void SetBackgroundColor( const Color& rColor ) { maBackgroundColor = rColor; }
Color GetBackgroundColor() const { return maBackgroundColor; }
@@ -678,7 +678,8 @@ private:
void CheckIdleFormatter();
- inline ParaPortion* FindParaPortion( ContentNode* pNode ) const;
+ inline const ParaPortion* FindParaPortion( ContentNode* pNode ) const;
+ inline ParaPortion* FindParaPortion( ContentNode* pNode );
::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > CreateTransferable( const EditSelection& rSelection ) const;
@@ -1091,7 +1092,14 @@ inline EditUndoManager& ImpEditEngine::GetUndoManager()
return *pUndoManager;
}
-inline ParaPortion* ImpEditEngine::FindParaPortion( ContentNode* pNode ) const
+inline const ParaPortion* ImpEditEngine::FindParaPortion( ContentNode* pNode ) const
+{
+ sal_uInt16 nPos = aEditDoc.GetPos( pNode );
+ DBG_ASSERT( nPos < GetParaPortions().Count(), "Portionloser Node?" );
+ return GetParaPortions()[ nPos ];
+}
+
+inline ParaPortion* ImpEditEngine::FindParaPortion( ContentNode* pNode )
{
sal_uInt16 nPos = aEditDoc.GetPos( pNode );
DBG_ASSERT( nPos < GetParaPortions().Count(), "Portionloser Node?" );
diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx
index 8d0c04c96ac7..d7d1fa22c21b 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -256,7 +256,7 @@ void ImpEditEngine::InitDoc( sal_Bool bKeepParaAttribs )
GetParaPortions().Reset();
ParaPortion* pIniPortion = new ParaPortion( aEditDoc[0] );
- GetParaPortions().Insert( pIniPortion, 0 );
+ GetParaPortions().Insert(0, pIniPortion);
bFormatted = sal_False;
@@ -1319,7 +1319,7 @@ EditPaM ImpEditEngine::CursorUp( const EditPaM& rPaM, EditView* pView )
}
else // previous paragraph
{
- ParaPortion* pPrevPortion = GetPrevVisPortion( pPPortion );
+ const ParaPortion* pPrevPortion = GetPrevVisPortion( pPPortion );
if ( pPrevPortion )
{
pLine = pPrevPortion->GetLines().GetObject( pPrevPortion->GetLines().Count()-1 );
@@ -1361,7 +1361,7 @@ EditPaM ImpEditEngine::CursorDown( const EditPaM& rPaM, EditView* pView )
}
else // next paragraph
{
- ParaPortion* pNextPortion = GetNextVisPortion( pPPortion );
+ const ParaPortion* pNextPortion = GetNextVisPortion( pPPortion );
if ( pNextPortion )
{
EditLine* pLine = pNextPortion->GetLines().GetObject(0);
@@ -1815,12 +1815,12 @@ sal_uInt16 ImpEditEngine::GetScriptType( const EditPaM& rPaM, sal_uInt16* pEndPo
if ( rPaM.GetNode()->Len() )
{
- sal_uInt16 nPara = GetEditDoc().GetPos( rPaM.GetNode() );
- ParaPortion* pParaPortion = GetParaPortions().SaveGetObject( nPara );
+ sal_uInt16 nPara = GetEditDoc().GetPos( rPaM.GetNode() );
+ const ParaPortion* pParaPortion = GetParaPortions().SaveGetObject( nPara );
if ( pParaPortion->aScriptInfos.empty() )
((ImpEditEngine*)this)->InitScriptTypes( nPara );
- ScriptTypePosInfos& rTypes = pParaPortion->aScriptInfos;
+ const ScriptTypePosInfos& rTypes = pParaPortion->aScriptInfos;
sal_uInt16 nPos = rPaM.GetIndex();
for ( size_t n = 0; n < rTypes.size(); n++ )
{
@@ -1848,11 +1848,11 @@ sal_uInt16 ImpEditEngine::GetScriptType( const EditSelection& rSel ) const
for ( sal_uInt16 nPara = nStartPara; nPara <= nEndPara; nPara++ )
{
- ParaPortion* pParaPortion = GetParaPortions().SaveGetObject( nPara );
+ const ParaPortion* pParaPortion = GetParaPortions().SaveGetObject( nPara );
if ( pParaPortion->aScriptInfos.empty() )
((ImpEditEngine*)this)->InitScriptTypes( nPara );
- ScriptTypePosInfos& rTypes = pParaPortion->aScriptInfos;
+ const ScriptTypePosInfos& rTypes = pParaPortion->aScriptInfos;
// find the first(!) script type position that holds the
// complete selection. Thus it will work for selections as
@@ -1884,22 +1884,22 @@ sal_uInt16 ImpEditEngine::GetScriptType( const EditSelection& rSel ) const
sal_Bool ImpEditEngine::IsScriptChange( const EditPaM& rPaM ) const
{
- sal_Bool bScriptChange = sal_False;
+ bool bScriptChange = false;
if ( rPaM.GetNode()->Len() )
{
sal_uInt16 nPara = GetEditDoc().GetPos( rPaM.GetNode() );
- ParaPortion* pParaPortion = GetParaPortions().SaveGetObject( nPara );
+ const ParaPortion* pParaPortion = GetParaPortions().SaveGetObject( nPara );
if ( pParaPortion->aScriptInfos.empty() )
((ImpEditEngine*)this)->InitScriptTypes( nPara );
- ScriptTypePosInfos& rTypes = pParaPortion->aScriptInfos;
+ const ScriptTypePosInfos& rTypes = pParaPortion->aScriptInfos;
sal_uInt16 nPos = rPaM.GetIndex();
for ( size_t n = 0; n < rTypes.size(); n++ )
{
if ( rTypes[n].nStartPos == nPos )
{
- bScriptChange = sal_True;
+ bScriptChange = true;
break;
}
}
@@ -1909,17 +1909,17 @@ sal_Bool ImpEditEngine::IsScriptChange( const EditPaM& rPaM ) const
sal_Bool ImpEditEngine::HasScriptType( sal_uInt16 nPara, sal_uInt16 nType ) const
{
- sal_Bool bTypeFound = sal_False;
+ bool bTypeFound = false;
- ParaPortion* pParaPortion = GetParaPortions().SaveGetObject( nPara );
+ const ParaPortion* pParaPortion = GetParaPortions().SaveGetObject( nPara );
if ( pParaPortion->aScriptInfos.empty() )
((ImpEditEngine*)this)->InitScriptTypes( nPara );
- ScriptTypePosInfos& rTypes = pParaPortion->aScriptInfos;
+ const ScriptTypePosInfos& rTypes = pParaPortion->aScriptInfos;
for ( size_t n = rTypes.size(); n && !bTypeFound; )
{
if ( rTypes[--n].nScriptType == nType )
- bTypeFound = sal_True;
+ bTypeFound = true;
}
return bTypeFound;
}
@@ -2142,10 +2142,10 @@ EditSelection ImpEditEngine::ImpMoveParagraphs( Range aOldPositions, sal_uInt16
return aSelection;
}
- sal_uLong nParaCount = GetParaPortions().Count();
+ size_t nParaCount = GetParaPortions().Count();
if ( nNewPos >= nParaCount )
- nNewPos = GetParaPortions().Count();
+ nNewPos = nParaCount;
// Height may change when moving first or last Paragraph
ParaPortion* pRecalc1 = NULL;
@@ -2155,26 +2155,25 @@ EditSelection ImpEditEngine::ImpMoveParagraphs( Range aOldPositions, sal_uInt16
if ( nNewPos == 0 ) // Move to Start
{
- pRecalc1 = GetParaPortions().GetObject( 0 );
- pRecalc2 = GetParaPortions().GetObject( (sal_uInt16)aOldPositions.Min() );
+ pRecalc1 = GetParaPortions()[0];
+ pRecalc2 = GetParaPortions()[aOldPositions.Min()];
}
else if ( nNewPos == nParaCount )
{
- pRecalc1 = GetParaPortions().GetObject( (sal_uInt16)(nParaCount-1) );
- pRecalc2 = GetParaPortions().GetObject( (sal_uInt16)aOldPositions.Max() );
+ pRecalc1 = GetParaPortions()[nParaCount-1];
+ pRecalc2 = GetParaPortions()[aOldPositions.Max()];
}
if ( aOldPositions.Min() == 0 ) // Move from Start
{
- pRecalc3 = GetParaPortions().GetObject( 0 );
- pRecalc4 = GetParaPortions().GetObject(
- sal::static_int_cast< sal_uInt16 >( aOldPositions.Max()+1 ) );
+ pRecalc3 = GetParaPortions()[0];
+ pRecalc4 = GetParaPortions()[aOldPositions.Max()+1];
}
else if ( (sal_uInt16)aOldPositions.Max() == (nParaCount-1) )
{
- pRecalc3 = GetParaPortions().GetObject( (sal_uInt16)aOldPositions.Max() );
- pRecalc4 = GetParaPortions().GetObject( (sal_uInt16)(aOldPositions.Min()-1) );
+ pRecalc3 = GetParaPortions()[aOldPositions.Max()];
+ pRecalc4 = GetParaPortions()[aOldPositions.Min()-1];
}
MoveParagraphsInfo aMoveParagraphsInfo( sal::static_int_cast< sal_uInt16 >(aOldPositions.Min()), sal::static_int_cast< sal_uInt16 >(aOldPositions.Max()), nNewPos );
@@ -2187,22 +2186,20 @@ EditSelection ImpEditEngine::ImpMoveParagraphs( Range aOldPositions, sal_uInt16
ParaPortion* pDestPortion = GetParaPortions().SaveGetObject( nNewPos );
ParaPortionList aTmpPortionList;
- sal_uInt16 i;
- for ( i = (sal_uInt16)aOldPositions.Min(); i <= (sal_uInt16)aOldPositions.Max(); i++ )
+ for (sal_uInt16 i = (sal_uInt16)aOldPositions.Min(); i <= (sal_uInt16)aOldPositions.Max(); i++ )
{
// always aOldPositions.Min(), since Remove().
- ParaPortion* pTmpPortion = GetParaPortions().GetObject( (sal_uInt16)aOldPositions.Min() );
- GetParaPortions().Remove( (sal_uInt16)aOldPositions.Min() );
+ ParaPortion* pTmpPortion = GetParaPortions().Release(aOldPositions.Min());
aEditDoc.Remove( (sal_uInt16)aOldPositions.Min() );
- aTmpPortionList.Insert( pTmpPortion, aTmpPortionList.Count() );
+ aTmpPortionList.Append(pTmpPortion);
}
sal_uInt16 nRealNewPos = pDestPortion ? GetParaPortions().GetPos( pDestPortion ) : GetParaPortions().Count();
OSL_ENSURE( nRealNewPos != USHRT_MAX, "ImpMoveParagraphs: Invalid Position!" );
- for ( i = 0; i < (sal_uInt16)aTmpPortionList.Count(); i++ )
+ for (size_t i = 0; i < aTmpPortionList.Count(); ++i)
{
- ParaPortion* pTmpPortion = aTmpPortionList.GetObject( i );
+ ParaPortion* pTmpPortion = aTmpPortionList[i];
if ( i == 0 )
aSelection.Min().SetNode( pTmpPortion->GetNode() );
@@ -2212,7 +2209,7 @@ EditSelection ImpEditEngine::ImpMoveParagraphs( Range aOldPositions, sal_uInt16
ContentNode* pN = pTmpPortion->GetNode();
aEditDoc.Insert( pN, nRealNewPos+i );
- GetParaPortions().Insert( pTmpPortion, nRealNewPos+i );
+ GetParaPortions().Insert(nRealNewPos+i, pTmpPortion);
}
aEndMovingParagraphsHdl.Call( &aMoveParagraphsInfo );
@@ -2238,7 +2235,7 @@ EditSelection ImpEditEngine::ImpMoveParagraphs( Range aOldPositions, sal_uInt16
if ( pRecalc4 )
CalcHeight( pRecalc4 );
- aTmpPortionList.Remove( 0, aTmpPortionList.Count() ); // important !
+ aTmpPortionList.Reset();
#if OSL_DEBUG_LEVEL > 2
GetParaPortions().DbgCheck(aEditDoc);
@@ -2307,7 +2304,6 @@ EditPaM ImpEditEngine::ImpConnectParagraphs( ContentNode* pLeft, ContentNode* pR
EditPaM aPaM = aEditDoc.ConnectParagraphs( pLeft, pRight );
GetParaPortions().Remove( nParagraphTobeDeleted );
- delete pRightPortion;
pLeftPortion->MarkSelectionInvalid( aPaM.GetIndex(), pLeft->Len() );
@@ -2319,7 +2315,7 @@ EditPaM ImpEditEngine::ImpConnectParagraphs( ContentNode* pLeft, ContentNode* pR
// the change of the total text hight too late...
for ( sal_uInt16 n = nParagraphTobeDeleted; n < GetParaPortions().Count(); n++ )
{
- ParaPortion* pPP = GetParaPortions().GetObject( n );
+ ParaPortion* pPP = GetParaPortions()[n];
pPP->MarkSelectionInvalid( 0, pPP->GetNode()->Len() );
pPP->GetLines().Reset();
}
@@ -2889,7 +2885,7 @@ EditPaM ImpEditEngine::ImpInsertParaBreak( const EditPaM& rPaM, sal_Bool bKeepEn
// Here, as in undo, but also in all other methods.
sal_uInt16 nPos = GetParaPortions().GetPos( pPortion );
ParaPortion* pNewPortion = new ParaPortion( aPaM.GetNode() );
- GetParaPortions().Insert( pNewPortion, nPos + 1 );
+ GetParaPortions().Insert(nPos+1, pNewPortion);
ParaAttribsChanged( pNewPortion->GetNode() );
if ( IsCallParaInsertedOrDeleted() )
GetEditEnginePtr()->ParagraphInserted( nPos+1 );
@@ -2922,7 +2918,7 @@ EditPaM ImpEditEngine::ImpFastInsertParagraph( sal_uInt16 nPara )
aEditDoc.Insert( pNode, nPara );
ParaPortion* pNewPortion = new ParaPortion( pNode );
- GetParaPortions().Insert( pNewPortion, nPara );
+ GetParaPortions().Insert(nPara, pNewPortion);
if ( IsCallParaInsertedOrDeleted() )
GetEditEnginePtr()->ParagraphInserted( nPara );
@@ -3002,7 +2998,7 @@ sal_Bool ImpEditEngine::UpdateFields()
if ( bChangesInPara )
{
// If possible be more precise when invalidate.
- ParaPortion* pPortion = GetParaPortions().GetObject( nPara );
+ ParaPortion* pPortion = GetParaPortions()[nPara];
OSL_ENSURE( pPortion, "NULL-Pointer in Doc" );
pPortion->MarkSelectionInvalid( 0, pNode->Len() );
}
@@ -3027,7 +3023,7 @@ Rectangle ImpEditEngine::PaMtoEditCursor( EditPaM aPaM, sal_uInt16 nFlags )
long nY = 0;
for ( sal_uInt16 nPortion = 0; nPortion < GetParaPortions().Count(); nPortion++ )
{
- ParaPortion* pPortion = GetParaPortions().GetObject(nPortion);
+ ParaPortion* pPortion = GetParaPortions()[nPortion];
ContentNode* pNode = pPortion->GetNode();
OSL_ENSURE( pNode, "Invalid Node in Portion!" );
if ( pNode != aPaM.GetNode() )
@@ -3056,7 +3052,7 @@ EditPaM ImpEditEngine::GetPaM( Point aDocPos, sal_Bool bSmart )
sal_uInt16 nPortion;
for ( nPortion = 0; nPortion < GetParaPortions().Count(); nPortion++ )
{
- ParaPortion* pPortion = GetParaPortions().GetObject(nPortion);
+ ParaPortion* pPortion = GetParaPortions()[nPortion];
nTmpHeight = pPortion->GetHeight(); // should also be correct for !bVisible!
nY += nTmpHeight;
if ( nY > aDocPos.Y() )
@@ -3111,7 +3107,7 @@ sal_uInt32 ImpEditEngine::CalcTextWidth( sal_Bool bIgnoreExtraSpace )
sal_uInt16 nParas = GetParaPortions().Count();
for ( sal_uInt16 nPara = 0; nPara < nParas; nPara++ )
{
- ParaPortion* pPortion = GetParaPortions().GetObject( nPara );
+ ParaPortion* pPortion = GetParaPortions()[nPara];
if ( pPortion->IsVisible() )
{
const SvxLRSpaceItem& rLRItem = GetLRSpaceItem( pPortion->GetNode() );
@@ -3224,7 +3220,7 @@ sal_uInt32 ImpEditEngine::CalcTextHeight( sal_uInt32* pHeightNTP )
sal_uInt32 nPH;
sal_uInt32 nEmptyHeight = 0;
for ( sal_uInt16 nPortion = 0; nPortion < GetParaPortions().Count(); nPortion++ ) {
- ParaPortionPtr pPortion = GetParaPortions()[nPortion];
+ ParaPortion* pPortion = GetParaPortions()[nPortion];
nPH = pPortion->GetHeight();
nY += nPH;
if( pHeightNTP ) {
@@ -3244,7 +3240,7 @@ sal_uInt32 ImpEditEngine::CalcTextHeight( sal_uInt32* pHeightNTP )
sal_uInt16 ImpEditEngine::GetLineCount( sal_uInt16 nParagraph ) const
{
OSL_ENSURE( nParagraph < GetParaPortions().Count(), "GetLineCount: Out of range" );
- ParaPortion* pPPortion = GetParaPortions().SaveGetObject( nParagraph );
+ const ParaPortion* pPPortion = GetParaPortions().SaveGetObject( nParagraph );
OSL_ENSURE( pPPortion, "Paragraph not found: GetLineCount" );
if ( pPPortion )
return pPPortion->GetLines().Count();
@@ -3255,7 +3251,7 @@ sal_uInt16 ImpEditEngine::GetLineCount( sal_uInt16 nParagraph ) const
xub_StrLen ImpEditEngine::GetLineLen( sal_uInt16 nParagraph, sal_uInt16 nLine ) const
{
OSL_ENSURE( nParagraph < GetParaPortions().Count(), "GetLineLen: Out of range" );
- ParaPortion* pPPortion = GetParaPortions().SaveGetObject( nParagraph );
+ const ParaPortion* pPPortion = GetParaPortions().SaveGetObject( nParagraph );
OSL_ENSURE( pPPortion, "Paragraph not found: GetLineLen" );
if ( pPPortion && ( nLine < pPPortion->GetLines().Count() ) )
{
@@ -3270,7 +3266,7 @@ xub_StrLen ImpEditEngine::GetLineLen( sal_uInt16 nParagraph, sal_uInt16 nLine )
void ImpEditEngine::GetLineBoundaries( /*out*/sal_uInt16 &rStart, /*out*/sal_uInt16 &rEnd, sal_uInt16 nParagraph, sal_uInt16 nLine ) const
{
OSL_ENSURE( nParagraph < GetParaPortions().Count(), "GetLineCount: Out of range" );
- ParaPortion* pPPortion = GetParaPortions().SaveGetObject( nParagraph );
+ const ParaPortion* pPPortion = GetParaPortions().SaveGetObject( nParagraph );
OSL_ENSURE( pPPortion, "Paragraph not found: GetLineBoundaries" );
rStart = rEnd = 0xFFFF; // default values in case of error
if ( pPPortion && ( nLine < pPPortion->GetLines().Count() ) )
@@ -3362,7 +3358,7 @@ void ImpEditEngine::UpdateSelections()
if ( !pPPortion ) // Last paragraph
{
nPara = GetParaPortions().Count()-1;
- pPPortion = GetParaPortions().GetObject( nPara );
+ pPPortion = GetParaPortions()[nPara];
}
OSL_ENSURE( pPPortion, "Empty Document in UpdateSelections ?" );
// Do not end up from a hidden paragraph:
@@ -3726,7 +3722,8 @@ EditPaM ImpEditEngine::GetPaM( ParaPortion* pPortion, Point aDocPos, sal_Bool bS
return aPaM;
}
-sal_uInt16 ImpEditEngine::GetChar( ParaPortion* pParaPortion, EditLine* pLine, long nXPos, sal_Bool bSmart )
+sal_uInt16 ImpEditEngine::GetChar(
+ const ParaPortion* pParaPortion, EditLine* pLine, long nXPos, bool bSmart)
{
OSL_ENSURE( pLine, "No line received: GetChar" );
@@ -3836,7 +3833,7 @@ sal_uInt16 ImpEditEngine::GetChar( ParaPortion* pParaPortion, EditLine* pLine, l
return nChar;
}
-Range ImpEditEngine::GetLineXPosStartEnd( ParaPortion* pParaPortion, EditLine* pLine )
+Range ImpEditEngine::GetLineXPosStartEnd( const ParaPortion* pParaPortion, EditLine* pLine ) const
{
Range aLineXPosStartEnd;
@@ -3856,7 +3853,8 @@ Range ImpEditEngine::GetLineXPosStartEnd( ParaPortion* pParaPortion, EditLine* p
return aLineXPosStartEnd;
}
-long ImpEditEngine::GetPortionXOffset( ParaPortion* pParaPortion, EditLine* pLine, sal_uInt16 nTextPortion )
+long ImpEditEngine::GetPortionXOffset(
+ const ParaPortion* pParaPortion, EditLine* pLine, sal_uInt16 nTextPortion)
{
long nX = pLine->GetStartPosX();
diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx
index 110d5fbf380f..507c70025895 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -389,7 +389,7 @@ void ImpEditEngine::FormatDoc()
aInvalidRec = Rectangle(); // make empty
for ( sal_uInt16 nPara = 0; nPara < GetParaPortions().Count(); nPara++ )
{
- ParaPortion* pParaPortion = GetParaPortions().GetObject( nPara );
+ ParaPortion* pParaPortion = GetParaPortions()[nPara];
if ( pParaPortion->MustRepaint() || ( pParaPortion->IsInvalid() && pParaPortion->IsVisible() ) )
{
if ( pParaPortion->IsInvalid() )
@@ -410,7 +410,7 @@ void ImpEditEngine::FormatDoc()
// For a change in height all below must be reformatted ...
for ( sal_uInt16 n = nPara+1; n < GetParaPortions().Count(); n++ )
{
- ParaPortion* pPP = GetParaPortions().GetObject( n );
+ ParaPortion* pPP = GetParaPortions()[n];
pPP->MarkSelectionInvalid( 0, pPP->GetNode()->Len() );
pPP->GetLines().Reset();
}
@@ -546,7 +546,7 @@ void ImpEditEngine::CheckAutoPageSize()
{
// Only paragraphs which are not aligned to the left need to be
// reformatted, the height can not be changed here anymore.
- ParaPortion* pParaPortion = GetParaPortions().GetObject( nPara );
+ ParaPortion* pParaPortion = GetParaPortions()[nPara];
ContentNode* pNode = pParaPortion->GetNode();
SvxAdjust eJustification = GetJustification( nPara );
if ( eJustification != SVX_ADJUST_LEFT )
@@ -587,7 +587,7 @@ static sal_Int32 ImplCalculateFontIndependentLineSpacing( const sal_Int32 nFontH
sal_Bool ImpEditEngine::CreateLines( sal_uInt16 nPara, sal_uInt32 nStartPosY )
{
- ParaPortion* pParaPortion = GetParaPortions().GetObject( nPara );
+ ParaPortion* pParaPortion = GetParaPortions()[nPara];
// sal_Bool: Changes in the height of paragraph Yes / No - sal_True/sal_False
DBG_ASSERT( pParaPortion->GetNode(), "Portion without Node in CreateLines" );
@@ -2471,7 +2471,7 @@ void ImpEditEngine::SetTextRanger( TextRanger* pRanger )
for ( sal_uInt16 nPara = 0; nPara < GetParaPortions().Count(); nPara++ )
{
- ParaPortion* pParaPortion = GetParaPortions().GetObject( nPara );
+ ParaPortion* pParaPortion = GetParaPortions()[nPara];
pParaPortion->MarkSelectionInvalid( 0, pParaPortion->GetNode()->Len() );
pParaPortion->GetLines().Reset();
}
@@ -2479,7 +2479,7 @@ void ImpEditEngine::SetTextRanger( TextRanger* pRanger )
FormatFullDoc();
UpdateViews( GetActiveView() );
if ( GetUpdateMode() && GetActiveView() )
- pActiveView->ShowCursor( sal_False, sal_False );
+ pActiveView->ShowCursor(false, false);
}
}
@@ -2839,7 +2839,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRec, Point aSta
// --------------------------------------------------
for ( sal_uInt16 n = 0; n < GetParaPortions().Count(); n++ )
{
- ParaPortion* pPortion = GetParaPortions().GetObject( n );
+ const ParaPortion* pPortion = GetParaPortions()[n];
DBG_ASSERT( pPortion, "NULL-Pointer in TokenList in Paint" );
// if when typing idle formatting, asynchronous Paint.
// Invisible Portions may be invalid.
@@ -3719,7 +3719,7 @@ void ImpEditEngine::InsertContent( ContentNode* pNode, sal_uInt16 nPos )
DBG_ASSERT( pNode, "NULL-Pointer in InsertContent! " );
DBG_ASSERT( IsInUndo(), "InsertContent only for Undo()!" );
ParaPortion* pNew = new ParaPortion( pNode );
- GetParaPortions().Insert( pNew, nPos );
+ GetParaPortions().Insert(nPos, pNew);
aEditDoc.Insert( pNode, nPos );
if ( IsCallParaInsertedOrDeleted() )
GetEditEnginePtr()->ParagraphInserted( nPos );
@@ -3861,12 +3861,12 @@ void ImpEditEngine::InvalidateFromParagraph( sal_uInt16 nFirstInvPara )
ParaPortion* pTmpPortion;
if ( nFirstInvPara != 0 )
{
- pTmpPortion = GetParaPortions().GetObject( nFirstInvPara-1 );
+ pTmpPortion = GetParaPortions()[nFirstInvPara-1];
pTmpPortion->MarkInvalid( pTmpPortion->GetNode()->Len(), 0 );
}
else
{
- pTmpPortion = GetParaPortions().GetObject( 0 );
+ pTmpPortion = GetParaPortions()[0];
pTmpPortion->MarkSelectionInvalid( 0, pTmpPortion->GetNode()->Len() );
}
pTmpPortion->ResetHeight();
@@ -3894,7 +3894,7 @@ void ImpEditEngine::CallStatusHdl()
ContentNode* ImpEditEngine::GetPrevVisNode( ContentNode* pCurNode )
{
- ParaPortion* pPortion = FindParaPortion( pCurNode );
+ const ParaPortion* pPortion = FindParaPortion( pCurNode );
DBG_ASSERT( pPortion, "GetPrevVisibleNode: No matching portion!" );
pPortion = GetPrevVisPortion( pPortion );
if ( pPortion )
@@ -3904,7 +3904,7 @@ ContentNode* ImpEditEngine::GetPrevVisNode( ContentNode* pCurNode )
ContentNode* ImpEditEngine::GetNextVisNode( ContentNode* pCurNode )
{
- ParaPortion* pPortion = FindParaPortion( pCurNode );
+ const ParaPortion* pPortion = FindParaPortion( pCurNode );
DBG_ASSERT( pPortion, "GetNextVisibleNode: No matching portion!" );
pPortion = GetNextVisPortion( pPortion );
if ( pPortion )
@@ -3912,22 +3912,22 @@ ContentNode* ImpEditEngine::GetNextVisNode( ContentNode* pCurNode )
return 0;
}
-ParaPortion* ImpEditEngine::GetPrevVisPortion( ParaPortion* pCurPortion )
+const ParaPortion* ImpEditEngine::GetPrevVisPortion( const ParaPortion* pCurPortion ) const
{
sal_uInt16 nPara = GetParaPortions().GetPos( pCurPortion );
DBG_ASSERT( nPara < GetParaPortions().Count() , "Portion not found: GetPrevVisPortion" );
- ParaPortion* pPortion = nPara ? GetParaPortions()[--nPara] : 0;
+ const ParaPortion* pPortion = nPara ? GetParaPortions()[--nPara] : 0;
while ( pPortion && !pPortion->IsVisible() )
pPortion = nPara ? GetParaPortions()[--nPara] : 0;
return pPortion;
}
-ParaPortion* ImpEditEngine::GetNextVisPortion( ParaPortion* pCurPortion )
+const ParaPortion* ImpEditEngine::GetNextVisPortion( const ParaPortion* pCurPortion ) const
{
sal_uInt16 nPara = GetParaPortions().GetPos( pCurPortion );
DBG_ASSERT( nPara < GetParaPortions().Count() , "Portion not found: GetPrevVisNode" );
- ParaPortion* pPortion = GetParaPortions().SaveGetObject( ++nPara );
+ const ParaPortion* pPortion = GetParaPortions().SaveGetObject( ++nPara );
while ( pPortion && !pPortion->IsVisible() )
pPortion = GetParaPortions().SaveGetObject( ++nPara );
@@ -3947,7 +3947,7 @@ long ImpEditEngine::CalcVertLineSpacing(Point& rStartPos) const
// All paragraphs must have the block justification set.
return 0;
- ParaPortion* pPortion = rParaPortions.GetObject(i);
+ const ParaPortion* pPortion = rParaPortions[i];
nTotalOccupiedHeight += pPortion->GetFirstLineOffset();
const SvxLineSpacingItem& rLSItem = (const SvxLineSpacingItem&)pPortion->GetNode()->GetContentAttribs().GetItem(EE_PARA_SBL);
@@ -3957,7 +3957,7 @@ long ImpEditEngine::CalcVertLineSpacing(Point& rStartPos) const
const SvxULSpaceItem& rULItem = (const SvxULSpaceItem&)pPortion->GetNode()->GetContentAttribs().GetItem(EE_PARA_ULSPACE);
long nUL = GetYValue( rULItem.GetLower() );
- EditLineList& rLines = pPortion->GetLines();
+ const EditLineList& rLines = pPortion->GetLines();
sal_uInt16 nLineCount = rLines.Count();
nTotalLineCount += nLineCount;
for (sal_uInt16 j = 0; j < nLineCount; ++j)
diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx
index 405a4d086f9c..4bce12fe3203 100644
--- a/editeng/source/editeng/impedit4.cxx
+++ b/editeng/source/editeng/impedit4.cxx
@@ -1062,7 +1062,7 @@ EditTextObject* ImpEditEngine::CreateBinTextObject( EditSelection aSel, SfxItemP
if ( bOnlyFullParagraphs )
{
- ParaPortion* pParaPortion = GetParaPortions()[nNode];
+ const ParaPortion* pParaPortion = GetParaPortions()[nNode];
nTextPortions += pParaPortion->GetTextPortions().Count();
}
@@ -1138,7 +1138,7 @@ EditTextObject* ImpEditEngine::CreateBinTextObject( EditSelection aSel, SfxItemP
pTxtObj->SetPortionInfo( pXList );
for ( nNode = nStartNode; nNode <= nEndNode; nNode++ )
{
- ParaPortion* pParaPortion = GetParaPortions()[nNode];
+ const ParaPortion* pParaPortion = GetParaPortions()[nNode];
XParaPortion* pX = new XParaPortion;
pXList->Insert( pX, pXList->Count() );
diff --git a/editeng/source/editeng/impedit5.cxx b/editeng/source/editeng/impedit5.cxx
index b59ad86a7e93..2401d2c8bb69 100644
--- a/editeng/source/editeng/impedit5.cxx
+++ b/editeng/source/editeng/impedit5.cxx
@@ -527,7 +527,7 @@ void ImpEditEngine::SetAttribs( EditSelection aSel, const SfxItemSet& rSet, sal_
sal_Bool bCharAttribFound = sal_False;
ContentNode* pNode = aEditDoc.GetObject( nNode );
- ParaPortion* pPortion = GetParaPortions().GetObject( nNode );
+ ParaPortion* pPortion = GetParaPortions()[nNode];
DBG_ASSERT( aEditDoc.SaveGetObject( nNode ), "Node not founden: SetAttribs" );
DBG_ASSERT( GetParaPortions().GetObject( nNode ), "Portion not found: SetAttribs" );
@@ -614,7 +614,7 @@ void ImpEditEngine::RemoveCharAttribs( EditSelection aSel, sal_Bool bRemoveParaA
for ( sal_uInt16 nNode = nStartNode; nNode <= nEndNode; nNode++ )
{
ContentNode* pNode = aEditDoc.GetObject( nNode );
- ParaPortion* pPortion = GetParaPortions().GetObject( nNode );
+ ParaPortion* pPortion = GetParaPortions()[nNode];
DBG_ASSERT( aEditDoc.SaveGetObject( nNode ), "Node not found: SetAttribs" );
DBG_ASSERT( GetParaPortions().SaveGetObject( nNode ), "Portion not found: SetAttribs" );