diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-10-29 11:29:38 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-10-29 21:26:29 +0200 |
commit | 9cd0f4c2d25462feba0ffcbd906c199273821243 (patch) | |
tree | ae2a3820d624307dc4c69a7c9f49e356cf7d7aca | |
parent | 07b6e34397037722d40b2013eef21085eca4f235 (diff) |
tdf#126788 no need to allocate an SwContentIndex when calling RstTextAttr
Change-Id: I541ff3c68b9d6edee536bb9f9d45b13c7f314242
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142017
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | sw/inc/ndtxt.hxx | 4 | ||||
-rw-r--r-- | sw/qa/extras/uiwriter/uiwriter7.cxx | 3 | ||||
-rw-r--r-- | sw/source/core/doc/DocumentContentOperationsManager.cxx | 12 | ||||
-rw-r--r-- | sw/source/core/txtnode/thints.cxx | 5 | ||||
-rw-r--r-- | sw/source/core/txtnode/txtedt.cxx | 6 | ||||
-rw-r--r-- | sw/source/core/undo/unsect.cxx | 5 | ||||
-rw-r--r-- | sw/source/core/undo/untbl.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/undo/untblk.cxx | 2 |
8 files changed, 15 insertions, 24 deletions
diff --git a/sw/inc/ndtxt.hxx b/sw/inc/ndtxt.hxx index a37661e18547..42cc43380f1a 100644 --- a/sw/inc/ndtxt.hxx +++ b/sw/inc/ndtxt.hxx @@ -290,7 +290,7 @@ public: /** delete all attributes. If neither pSet nor nWhich is given, delete all attributes (except refmarks, toxmarks, meta) in range. - @param rIdx start position + @param nContentStart start position @param nLen range in which attributes will be deleted @param pSet if not 0, delete only attributes contained in pSet @param nWhich if not 0, delete only attributes with matching which @@ -302,7 +302,7 @@ public: which are simply included in the range. */ void RstTextAttr( - const SwContentIndex &rIdx, + const sal_Int32 nContentStart, const sal_Int32 nLen, const sal_uInt16 nWhich = 0, const SfxItemSet* pSet = nullptr, diff --git a/sw/qa/extras/uiwriter/uiwriter7.cxx b/sw/qa/extras/uiwriter/uiwriter7.cxx index 52e1eb6aa1de..e9c79cd2e527 100644 --- a/sw/qa/extras/uiwriter/uiwriter7.cxx +++ b/sw/qa/extras/uiwriter/uiwriter7.cxx @@ -594,9 +594,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf72788) } //Clear all the Direct Formatting ( Ctrl + M ) SwTextNode* pTextNode = pCursor->GetPointNode().GetTextNode(); - SwContentIndex aSt(pTextNode, 0); sal_Int32 nEnd = pTextNode->Len(); - pTextNode->RstTextAttr(aSt, nEnd - aSt.GetIndex()); + pTextNode->RstTextAttr(0, nEnd); //In case of Regression RstTextAttr() call will result to infinite recursion //Check that bold is removed in first paragraph aSet.ClearItem(); diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx index d7896c6c113d..a49ed387aac3 100644 --- a/sw/source/core/doc/DocumentContentOperationsManager.cxx +++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx @@ -1468,8 +1468,7 @@ namespace //local functions originally from docfmt.cxx { pCurrentNode->ResetAttr(RES_PARATR_LIST_AUTOFMT); // reset also paragraph marker - SwContentIndex nIdx( pCurrentNode, pCurrentNode->Len() ); - pCurrentNode->GetTextNode()->RstTextAttr(nIdx, 1); + pCurrentNode->GetTextNode()->RstTextAttr(pCurrentNode->Len(), 1); } pCurrentNode = SwNodes::GoPrevious( &aIdx ); } @@ -1745,18 +1744,17 @@ namespace //local functions originally from docfmt.cxx if( !(nFlags & SetAttrMode::DONTREPLACE ) && pTextNd->HasHints() && !nMkPos && nPtPos == rStr.getLength()) { - SwContentIndex aSt( pTextNd ); if( pHistory ) { // Save all attributes for the Undo. SwRegHistory aRHst( *pTextNd, pHistory ); pTextNd->GetpSwpHints()->Register( &aRHst ); - pTextNd->RstTextAttr( aSt, nPtPos, 0, pCharSet ); + pTextNd->RstTextAttr( 0, nPtPos, 0, pCharSet ); if( pTextNd->GetpSwpHints() ) pTextNd->GetpSwpHints()->DeRegister(); } else - pTextNd->RstTextAttr( aSt, nPtPos, 0, pCharSet ); + pTextNd->RstTextAttr( 0, nPtPos, 0, pCharSet ); } if( rDoc.getIDocumentRedlineAccess().IsRedlineOn() ) @@ -4058,13 +4056,13 @@ bool DocumentContentOperationsManager::lcl_RstTextAttr( SwNode* pNd, void* pArgs // Save all attributes for the Undo. SwRegHistory aRHst( *pTextNode, pPara->pHistory ); pTextNode->GetpSwpHints()->Register( &aRHst ); - pTextNode->RstTextAttr( aSt, nEnd - aSt.GetIndex(), pPara->nWhich, + pTextNode->RstTextAttr( aSt.GetIndex(), nEnd - aSt.GetIndex(), pPara->nWhich, pPara->pDelSet, pPara->bInclRefToxMark, pPara->bExactRange ); if( pTextNode->GetpSwpHints() ) pTextNode->GetpSwpHints()->DeRegister(); } else - pTextNode->RstTextAttr( aSt, nEnd - aSt.GetIndex(), pPara->nWhich, + pTextNode->RstTextAttr( aSt.GetIndex(), nEnd - aSt.GetIndex(), pPara->nWhich, pPara->pDelSet, pPara->bInclRefToxMark, pPara->bExactRange ); } return true; diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx index ee699481a79b..20ed264ec779 100644 --- a/sw/source/core/txtnode/thints.cxx +++ b/sw/source/core/txtnode/thints.cxx @@ -1982,9 +1982,8 @@ bool SwTextNode::SetAttr( (GetDoc().GetDfltCharFormat() == static_cast<const SwFormatCharFormat*>(pItem)->GetCharFormat())) { - SwContentIndex aIndex( this, nStt ); - RstTextAttr( aIndex, nEnd - nStt, RES_TXTATR_CHARFMT ); - DontExpandFormat( aIndex.GetIndex() ); + RstTextAttr( nStt, nEnd - nStt, RES_TXTATR_CHARFMT ); + DontExpandFormat( nStt ); } else { diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx index d16a17eddc28..e906826e7db7 100644 --- a/sw/source/core/txtnode/txtedt.cxx +++ b/sw/source/core/txtnode/txtedt.cxx @@ -330,7 +330,7 @@ static bool lcl_HaveCommonAttributes( IStyleAccess& rStyleAccess, * 5) The attribute is outside the deletion range * -> nothing to do * - * @param rIdx starting position + * @param nStt starting position * @param nLen length of the deletion * @param nthat ??? * @param pSet ??? @@ -338,18 +338,16 @@ static bool lcl_HaveCommonAttributes( IStyleAccess& rStyleAccess, */ void SwTextNode::RstTextAttr( - const SwContentIndex &rIdx, + sal_Int32 nStt, const sal_Int32 nLen, const sal_uInt16 nWhich, const SfxItemSet* pSet, const bool bInclRefToxMark, const bool bExactRange ) { - assert(rIdx.GetContentNode() == this); if ( !GetpSwpHints() ) return; - sal_Int32 nStt = rIdx.GetIndex(); sal_Int32 nEnd = nStt + nLen; { // enlarge range for the reset of text attributes in case of an overlapping input field diff --git a/sw/source/core/undo/unsect.cxx b/sw/source/core/undo/unsect.cxx index 69bd6fd7cf04..0463b665677f 100644 --- a/sw/source/core/undo/unsect.cxx +++ b/sw/source/core/undo/unsect.cxx @@ -288,10 +288,7 @@ void SwUndoInsSection::Join( SwDoc& rDoc, SwNodeOffset nNode ) pTextNd->JoinNext(); if (m_pHistory) - { - SwContentIndex aCntIdx( pTextNd, 0 ); - pTextNd->RstTextAttr( aCntIdx, pTextNd->Len(), 0, nullptr, true ); - } + pTextNd->RstTextAttr( 0, pTextNd->Len(), 0, nullptr, true ); } void diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx index ea1d4066d145..7844532ddb2c 100644 --- a/sw/source/core/undo/untbl.cxx +++ b/sw/source/core/undo/untbl.cxx @@ -1937,7 +1937,7 @@ void SwUndoTableMerge::UndoImpl(::sw::UndoRedoContext & rContext) // also delete not needed attributes SwContentIndex aTmpIdx( pTextNd, nDelPos ); if( pTextNd->GetpSwpHints() && pTextNd->GetpSwpHints()->Count() ) - pTextNd->RstTextAttr( aTmpIdx, pTextNd->GetText().getLength() - nDelPos + 1 ); + pTextNd->RstTextAttr( nDelPos, pTextNd->GetText().getLength() - nDelPos + 1 ); // delete separator pTextNd->EraseText( aTmpIdx, 1 ); } diff --git a/sw/source/core/undo/untblk.cxx b/sw/source/core/undo/untblk.cxx index f6cd1c07f243..76a335027c15 100644 --- a/sw/source/core/undo/untblk.cxx +++ b/sw/source/core/undo/untblk.cxx @@ -353,7 +353,7 @@ void SwUndoInserts::UndoImpl(::sw::UndoRedoContext & rContext) pTextNode->JoinNext(); } // reset all text attributes in the paragraph! - pTextNode->RstTextAttr( SwContentIndex(pTextNode, 0), pTextNode->Len(), 0, nullptr, true ); + pTextNode->RstTextAttr( 0, pTextNode->Len(), 0, nullptr, true ); pTextNode->ResetAllAttr(); |