summaryrefslogtreecommitdiff
path: root/editeng
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2023-12-31 19:15:38 +0900
committerTomaž Vajngerl <quikee@gmail.com>2024-01-02 04:11:16 +0100
commit92a9fa82f412daa4e5ccb5889076a1267648e0c1 (patch)
tree63ad4c1a0af0b857acd2a77d7668ed31ec33b421 /editeng
parente71934471442a8bbba7e661d3ebe5f708627c5d6 (diff)
editeng: remove operator[] for EditDoc (use GetObject instead)
Change-Id: Ie41d2baf84d230b9ee280859d390e24b9da70be7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161482 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'editeng')
-rw-r--r--editeng/inc/editdoc.hxx2
-rw-r--r--editeng/source/editeng/editdoc.cxx10
-rw-r--r--editeng/source/editeng/edtspell.cxx6
-rw-r--r--editeng/source/editeng/impedit.hxx8
-rw-r--r--editeng/source/editeng/impedit2.cxx10
5 files changed, 12 insertions, 24 deletions
diff --git a/editeng/inc/editdoc.hxx b/editeng/inc/editdoc.hxx
index 974447bd806c..0c2bcd28fa97 100644
--- a/editeng/inc/editdoc.hxx
+++ b/editeng/inc/editdoc.hxx
@@ -205,8 +205,6 @@ public:
const ContentNode* GetObject(sal_Int32 nPos) const;
ContentNode* GetObject(sal_Int32 nPos);
sal_Int32 Count() const;
- const ContentNode* operator[](sal_Int32 nPos) const;
- ContentNode* operator[](sal_Int32 nPos);
void Insert(sal_Int32 nPos, std::unique_ptr<ContentNode> p);
/// deletes
void Remove(sal_Int32 nPos);
diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx
index 07d61802c773..efc95b944833 100644
--- a/editeng/source/editeng/editdoc.cxx
+++ b/editeng/source/editeng/editdoc.cxx
@@ -933,16 +933,6 @@ ContentNode* EditDoc::GetObject(sal_Int32 nPos)
return 0 <= nPos && o3tl::make_unsigned(nPos) < maContents.size() ? maContents[nPos].get() : nullptr;
}
-const ContentNode* EditDoc::operator[](sal_Int32 nPos) const
-{
- return GetObject(nPos);
-}
-
-ContentNode* EditDoc::operator[](sal_Int32 nPos)
-{
- return GetObject(nPos);
-}
-
void EditDoc::Insert(sal_Int32 nPos, std::unique_ptr<ContentNode> pNode)
{
if (nPos < 0 || nPos == SAL_MAX_INT32)
diff --git a/editeng/source/editeng/edtspell.cxx b/editeng/source/editeng/edtspell.cxx
index c07361bd196b..36e9f5fd84ae 100644
--- a/editeng/source/editeng/edtspell.cxx
+++ b/editeng/source/editeng/edtspell.cxx
@@ -613,8 +613,8 @@ OUString const* EdtAutoCorrDoc::GetPrevPara(bool const)
bAllowUndoAction = false; // Not anymore ...
- EditDoc& rNodes = mpEditEngine->GetEditDoc();
- sal_Int32 nPos = rNodes.GetPos( pCurNode );
+ EditDoc& rEditDoc = mpEditEngine->GetEditDoc();
+ sal_Int32 nPos = rEditDoc.GetPos( pCurNode );
// Special case: Bullet => Paragraph start => simply return NULL...
const SfxBoolItem& rBulletState = mpEditEngine->GetParaAttrib( nPos, EE_PARA_BULLETSTATE );
@@ -632,7 +632,7 @@ OUString const* EdtAutoCorrDoc::GetPrevPara(bool const)
for ( sal_Int32 n = nPos; n; )
{
n--;
- ContentNode* pNode = rNodes[n];
+ ContentNode* pNode = rEditDoc.GetObject(n);
if ( pNode->Len() )
return & pNode->GetString();
}
diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx
index 7269c0e0b614..ef699b0b28ad 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -1090,8 +1090,8 @@ public:
EditPaM CreateEditPaM( const EPaM& rEPaM )
{
DBG_ASSERT( rEPaM.nPara < maEditDoc.Count(), "CreateEditPaM: invalid paragraph" );
- DBG_ASSERT( maEditDoc[ rEPaM.nPara ]->Len() >= rEPaM.nIndex, "CreateEditPaM: invalid Index" );
- return EditPaM( maEditDoc[ rEPaM.nPara], rEPaM.nIndex );
+ DBG_ASSERT(maEditDoc.GetObject(rEPaM.nPara)->Len() >= rEPaM.nIndex, "CreateEditPaM: invalid Index");
+ return EditPaM(maEditDoc.GetObject(rEPaM.nPara), rEPaM.nIndex);
}
ESelection CreateESel(const EditSelection& rSel) const
@@ -1111,9 +1111,9 @@ public:
DBG_ASSERT( rSel.nStartPara < maEditDoc.Count(), "CreateSel: invalid start paragraph" );
DBG_ASSERT( rSel.nEndPara < maEditDoc.Count(), "CreateSel: invalid end paragraph" );
EditSelection aSel;
- aSel.Min().SetNode( maEditDoc[ rSel.nStartPara ] );
+ aSel.Min().SetNode(maEditDoc.GetObject(rSel.nStartPara));
aSel.Min().SetIndex( rSel.nStartPos );
- aSel.Max().SetNode( maEditDoc[ rSel.nEndPara ] );
+ aSel.Max().SetNode(maEditDoc.GetObject(rSel.nEndPara));
aSel.Max().SetIndex( rSel.nEndPos );
DBG_ASSERT( !aSel.DbgIsBuggy( maEditDoc ), "CreateSel: incorrect selection!" );
return aSel;
diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx
index 488873edd266..2b8263cc62cd 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -236,8 +236,8 @@ void ImpEditEngine::InitDoc(bool bKeepParaAttribs)
sal_Int32 nParas = maEditDoc.Count();
for ( sal_Int32 n = bKeepParaAttribs ? 1 : 0; n < nParas; n++ )
{
- if ( maEditDoc[n]->GetStyleSheet() )
- EndListening( *maEditDoc[n]->GetStyleSheet() );
+ if (maEditDoc.GetObject(n)->GetStyleSheet())
+ EndListening( *maEditDoc.GetObject(n)->GetStyleSheet() );
}
if ( bKeepParaAttribs )
@@ -247,7 +247,7 @@ void ImpEditEngine::InitDoc(bool bKeepParaAttribs)
GetParaPortions().Reset();
- GetParaPortions().Insert(0, std::make_unique<ParaPortion>( maEditDoc[0] ));
+ GetParaPortions().Insert(0, std::make_unique<ParaPortion>(maEditDoc.GetObject(0)));
mbFormatted = false;
@@ -3776,7 +3776,7 @@ EditSelection ImpEditEngine::ConvertSelection(
sal_Int32 nIndex = nStartPos;
if ( !pNode )
{
- pNode = maEditDoc[ maEditDoc.Count()-1 ];
+ pNode = maEditDoc.GetObject(maEditDoc.Count() - 1);
nIndex = pNode->Len();
}
else if ( nIndex > pNode->Len() )
@@ -3790,7 +3790,7 @@ EditSelection ImpEditEngine::ConvertSelection(
nIndex = nEndPos;
if ( !pNode )
{
- pNode = maEditDoc[ maEditDoc.Count()-1 ];
+ pNode = maEditDoc.GetObject(maEditDoc.Count() - 1);
nIndex = pNode->Len();
}
else if ( nIndex > pNode->Len() )