diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-08-03 15:47:51 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-08-04 11:03:13 +0200 |
commit | 96fb8f88bd56c113eb23e50d23a038509703c288 (patch) | |
tree | 749a70b903289b76d10cc5e2df1db2708cb84ad0 /sw/source | |
parent | 6a0163d967ce0482598eeebbcc5a4f413f190533 (diff) |
elide some SwNodeIndex temporaries
Change-Id: I5391aa409d760870ead26d43b2287b23d2d40089
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137776
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/source')
-rw-r--r-- | sw/source/core/crsr/pam.cxx | 35 | ||||
-rw-r--r-- | sw/source/core/doc/docnew.cxx | 5 | ||||
-rw-r--r-- | sw/source/core/doc/docredln.cxx | 9 | ||||
-rw-r--r-- | sw/source/core/doc/tblrwcl.cxx | 3 | ||||
-rw-r--r-- | sw/source/core/docnode/ndtbl.cxx | 7 | ||||
-rw-r--r-- | sw/source/core/frmedt/fecopy.cxx | 6 | ||||
-rw-r--r-- | sw/source/core/frmedt/fefly1.cxx | 6 | ||||
-rw-r--r-- | sw/source/core/layout/fly.cxx | 3 | ||||
-rw-r--r-- | sw/source/core/table/swnewtable.cxx | 3 | ||||
-rw-r--r-- | sw/source/core/undo/SwUndoField.cxx | 3 | ||||
-rw-r--r-- | sw/source/core/undo/undobj1.cxx | 3 | ||||
-rw-r--r-- | sw/source/core/unocore/unocrsrhelper.cxx | 3 | ||||
-rw-r--r-- | sw/source/core/unocore/unoobj2.cxx | 3 | ||||
-rw-r--r-- | sw/source/core/unocore/unoparagraph.cxx | 15 | ||||
-rw-r--r-- | sw/source/core/unocore/unotext.cxx | 6 | ||||
-rw-r--r-- | sw/source/filter/basflt/shellio.cxx | 3 | ||||
-rw-r--r-- | sw/source/filter/html/swhtml.cxx | 3 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par.cxx | 12 | ||||
-rw-r--r-- | sw/source/filter/xml/XMLRedlineImportHelper.cxx | 7 |
19 files changed, 72 insertions, 63 deletions
diff --git a/sw/source/core/crsr/pam.cxx b/sw/source/core/crsr/pam.cxx index 64c8a5ddd3a2..495edbea1683 100644 --- a/sw/source/core/crsr/pam.cxx +++ b/sw/source/core/crsr/pam.cxx @@ -467,6 +467,29 @@ SwPaM::SwPaM( const SwNode& rMark, sal_Int32 nMarkContent, nMarkContent ); } +SwPaM::SwPaM( const SwNode& rMark, SwNodeOffset nMarkOffset, sal_Int32 nMarkContent, + const SwNode& rPoint, SwNodeOffset nPointOffset, sal_Int32 nPointContent, SwPaM* pRing ) + : Ring( pRing ) + , m_Bound1( rMark ) + , m_Bound2( rPoint ) + , m_pPoint( &m_Bound2 ) + , m_pMark( &m_Bound1 ) + , m_bIsInFrontOfLabel( false ) +{ + if ( nMarkOffset ) + { + m_pMark->nNode += nMarkOffset; + } + if ( nPointOffset ) + { + m_pPoint->nNode += nPointOffset; + } + m_pPoint->nContent.Assign( m_pPoint->GetNode().GetContentNode(), + nPointContent); + m_pMark ->nContent.Assign( m_pMark ->GetNode().GetContentNode(), + nMarkContent ); +} + SwPaM::SwPaM( const SwNode& rNode, sal_Int32 nContent, SwPaM* pRing ) : Ring( pRing ) , m_Bound1( rNode ) @@ -479,6 +502,18 @@ SwPaM::SwPaM( const SwNode& rNode, sal_Int32 nContent, SwPaM* pRing ) nContent ); } +SwPaM::SwPaM( const SwNode& rNode, SwNodeOffset nNdOffset, sal_Int32 nContent, SwPaM* pRing ) + : Ring( pRing ) + , m_Bound1( rNode, nNdOffset ) + , m_Bound2( m_Bound1.GetNode().GetNodes() ) // default initialize + , m_pPoint( &m_Bound1 ) + , m_pMark( &m_Bound1 ) + , m_bIsInFrontOfLabel( false ) +{ + m_pPoint->nContent.Assign( m_pPoint->GetNode().GetContentNode(), + nContent ); +} + SwPaM::SwPaM( const SwNodeIndex& rNodeIdx, sal_Int32 nContent, SwPaM* pRing ) : Ring( pRing ) , m_Bound1( rNodeIdx ) diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx index a40919ff04cd..9700cfdbd03d 100644 --- a/sw/source/core/doc/docnew.cxx +++ b/sw/source/core/doc/docnew.cxx @@ -685,7 +685,7 @@ void SwDoc::ClearDoc() pFirstNd->SetAttr( SwFormatPageDesc( pDummyPgDsc )); SwPosition aPos( *pFirstNd ); - SwPaM const tmpPaM(aSttIdx, SwNodeIndex(GetNodes().GetEndOfContent())); + SwPaM const tmpPaM(aSttIdx, GetNodes().GetEndOfContent()); ::PaMCorrAbs(tmpPaM, aPos); } @@ -1151,8 +1151,7 @@ SwNodeIndex SwDoc::AppendDoc(const SwDoc& rSource, sal_uInt16 const nStartPageNu SwNodeIndex aFixupIdx( GetNodes().GetEndOfContent(), -1 ); // append at the end of document / content - SwNodeIndex aTargetIdx( GetNodes().GetEndOfContent() ); - SwPaM aInsertPam( aTargetIdx ); + SwPaM aInsertPam( GetNodes().GetEndOfContent() ); #ifdef DBG_UTIL SAL_INFO( "sw.docappend", "Pam-Nd: " << aCpyPam.GetNode().GetIndex() - aCpyPam.GetNode( false ).GetIndex() + 1 diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx index a80af53a66a7..f167f5268895 100644 --- a/sw/source/core/doc/docredln.cxx +++ b/sw/source/core/doc/docredln.cxx @@ -783,8 +783,7 @@ bool SwRedlineTable::isMoved( size_type rPos ) const } else // otherwise it is saved in pContentSect, e.g. during ODT import { - SwNodeIndex aTmpIdx( *pRedline->GetContentIdx()->GetNode().EndOfSectionNode() ); - pPaM = new SwPaM(*pRedline->GetContentIdx(), aTmpIdx ); + pPaM = new SwPaM(*pRedline->GetContentIdx(), *pRedline->GetContentIdx()->GetNode().EndOfSectionNode() ); bDeletePaM = true; } @@ -823,8 +822,7 @@ bool SwRedlineTable::isMoved( size_type rPos ) const else // otherwise it is saved in pContentSect, e.g. during ODT import { // saved in pContentSect, e.g. during ODT import - SwNodeIndex aTmpIdx( *pPair->GetContentIdx()->GetNode().EndOfSectionNode() ); - pPairPaM = new SwPaM(*pPair->GetContentIdx(), aTmpIdx ); + pPairPaM = new SwPaM(*pPair->GetContentIdx(), *pPair->GetContentIdx()->GetNode().EndOfSectionNode() ); bDeletePairPaM = true; } @@ -1983,8 +1981,7 @@ OUString SwRangeRedline::GetDescr(bool bSimplified) } else // otherwise it is saved in pContentSect { - SwNodeIndex aTmpIdx( *m_pContentSect->GetNode().EndOfSectionNode() ); - pPaM = new SwPaM(*m_pContentSect, aTmpIdx ); + pPaM = new SwPaM( m_pContentSect->GetNode(), *m_pContentSect->GetNode().EndOfSectionNode() ); bDeletePaM = true; } diff --git a/sw/source/core/doc/tblrwcl.cxx b/sw/source/core/doc/tblrwcl.cxx index d92d7726f7b8..3b798262cb62 100644 --- a/sw/source/core/doc/tblrwcl.cxx +++ b/sw/source/core/doc/tblrwcl.cxx @@ -595,8 +595,7 @@ bool SwTable::InsertRow_( SwDoc* pDoc, const SwSelBoxes& rBoxes, SvxPrintItem aSetTracking(RES_PRINT, false); SwPosition aPos(*pNewTableLine->GetTabBoxes()[0]->GetSttNd()); SwCursor aCursor( aPos, nullptr ); - SwNodeIndex aInsPos(*pNewTableLine->GetTabBoxes()[0]->GetSttNd(), 1 ); - SwPaM aPaM(aInsPos); + SwPaM aPaM(*pNewTableLine->GetTabBoxes()[0]->GetSttNd(), SwNodeOffset(1)); pDoc->getIDocumentContentOperations().InsertString( aPaM, OUStringChar(CH_TXT_TRACKED_DUMMY_CHAR) ); pDoc->SetRowNotTracked( aCursor, aSetTracking ); diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx index db023dc228aa..435480730372 100644 --- a/sw/source/core/docnode/ndtbl.cxx +++ b/sw/source/core/docnode/ndtbl.cxx @@ -1216,7 +1216,8 @@ const SwTable* SwDoc::TextToTable( const std::vector< std::vector<SwNodeRange> > } } // another one to break between last cell and node after table - SwPaM pam(SwNodeIndex(*pPrev, +1), 0, *pPrev, + SwPaM pam(pPrev->GetNode(), SwNodeOffset(+1), 0, + pPrev->GetNode(), SwNodeOffset(0), (pPrev->GetNode().IsContentNode()) ? pPrev->GetNode().GetContentNode()->Len() : 0); rIDRA.SplitRedline(pam); @@ -2023,7 +2024,7 @@ bool SwDoc::DeleteRowCol(const SwSelBoxes& rBoxes, RowColMode const eMode) } // Save the cursors (UNO and otherwise) - SwPaM aSavePaM( SwNodeIndex( *pTableNd->EndOfSectionNode() ) ); + SwPaM aSavePaM( *pTableNd->EndOfSectionNode() ); if( ! aSavePaM.Move( fnMoveForward, GoInNode ) ) { *aSavePaM.GetMark() = SwPosition( *pTableNd ); @@ -2073,7 +2074,7 @@ bool SwDoc::DeleteRowCol(const SwSelBoxes& rBoxes, RowColMode const eMode) } // Save the cursors (UNO and otherwise) - SwPaM aSavePaM( SwNodeIndex( *pTableNd->EndOfSectionNode() ) ); + SwPaM aSavePaM( *pTableNd->EndOfSectionNode() ); if( ! aSavePaM.Move( fnMoveForward, GoInNode ) ) { *aSavePaM.GetMark() = SwPosition( *pTableNd ); diff --git a/sw/source/core/frmedt/fecopy.cxx b/sw/source/core/frmedt/fecopy.cxx index 650abb6abe5e..bc7388ce56ba 100644 --- a/sw/source/core/frmedt/fecopy.cxx +++ b/sw/source/core/frmedt/fecopy.cxx @@ -1093,8 +1093,7 @@ bool SwFEShell::Paste(SwDoc& rClpDoc, bool bNestedTable) // Note: aCpyPam is invalid now ++aIndexBefore; - SwPaM aPaM(SwPosition(aIndexBefore), - SwPosition(rInsPos.nNode)); + SwPaM aPaM(aIndexBefore, rInsPos.nNode); aPaM.GetDoc().MakeUniqueNumRules(aPaM); @@ -1193,8 +1192,7 @@ void SwFEShell::PastePages( SwFEShell& rToFill, sal_uInt16 nStartPage, sal_uInt1 //remove the inserted paragraph Undo(); //remove the paragraph in the second doc, too - SwNodeIndex aIdx( rToFill.GetDoc()->GetNodes().GetEndOfExtras(), 2 ); - SwPaM aPara( aIdx ); //DocStart + SwPaM aPara( rToFill.GetDoc()->GetNodes().GetEndOfExtras(), SwNodeOffset(2) ); //DocStart rToFill.GetDoc()->getIDocumentContentOperations().DelFullPara(aPara); } // now the page bound objects diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx index ef7ca3971195..d3b9b5a1b565 100644 --- a/sw/source/core/frmedt/fefly1.cxx +++ b/sw/source/core/frmedt/fefly1.cxx @@ -906,9 +906,9 @@ void SwFEShell::Insert( const OUString& rGrfName, const OUString& rFltName, // add a redline to the anchor point at tracked insertion of picture if ( IsRedlineOn() ) { - SwPosition aPos(*pFormat->GetAnchor().GetContentAnchor()); - SwPaM aPaM(aPos.GetNode(), aPos.GetContentIndex(), - aPos.GetNode(), aPos.GetContentIndex() + 1); + const SwPosition & rPos(*pFormat->GetAnchor().GetContentAnchor()); + SwPaM aPaM(rPos.GetNode(), rPos.GetContentIndex(), + rPos.GetNode(), rPos.GetContentIndex() + 1); GetDoc()->getIDocumentRedlineAccess().AppendRedline( new SwRangeRedline( RedlineType::Insert, aPaM ), true); } diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx index 089d1e40e2fc..4ce1b6510af6 100644 --- a/sw/source/core/layout/fly.cxx +++ b/sw/source/core/layout/fly.cxx @@ -423,8 +423,7 @@ void SwFlyFrame::FinitDrawObj() rCurrentShell.Imp()->GetDrawView()->UnmarkAll(); if (pOldSelFly) { - SwPosition const pos(ResolveFlyAnchor(*pOldSelFly->GetFormat())); - SwPaM const temp(pos); + SwPaM const temp(ResolveFlyAnchor(*pOldSelFly->GetFormat())); pFEShell->SetSelection(temp); // could also call SetCursor() like SwFEShell::SelectObj() // does, but that would access layout a bit much... diff --git a/sw/source/core/table/swnewtable.cxx b/sw/source/core/table/swnewtable.cxx index 6e0e3495ae16..b163f8e2bc83 100644 --- a/sw/source/core/table/swnewtable.cxx +++ b/sw/source/core/table/swnewtable.cxx @@ -1531,8 +1531,7 @@ bool SwTable::InsertRow( SwDoc* pDoc, const SwSelBoxes& rBoxes, SwContentNode* pCNd = aIdx.GetNode().GetContentNode(); if( pCNd && pCNd->IsTextNode() && pCNd->GetTextNode()->GetNumRule() ) { - SwPosition aPos( *pCNd->GetTextNode() ); - SwPaM aPam( aPos, aPos ); + SwPaM aPam( *pCNd->GetTextNode(), *pCNd->GetTextNode() ); pDoc->DelNumRules( aPam ); } } diff --git a/sw/source/core/undo/SwUndoField.cxx b/sw/source/core/undo/SwUndoField.cxx index 1f7e3cb0df14..3d736a46e1bc 100644 --- a/sw/source/core/undo/SwUndoField.cxx +++ b/sw/source/core/undo/SwUndoField.cxx @@ -47,9 +47,8 @@ SwUndoField::~SwUndoField() SwPosition SwUndoField::GetPosition() { SwNode * pNode = m_pDoc->GetNodes()[m_nNodeIndex]; - SwNodeIndex aNodeIndex(*pNode); SwContentIndex aIndex(pNode->GetContentNode(), m_nOffset); - SwPosition aResult(aNodeIndex, aIndex); + SwPosition aResult(*pNode, aIndex); return aResult; } diff --git a/sw/source/core/undo/undobj1.cxx b/sw/source/core/undo/undobj1.cxx index 50137926ec75..55b0f622d694 100644 --- a/sw/source/core/undo/undobj1.cxx +++ b/sw/source/core/undo/undobj1.cxx @@ -314,8 +314,7 @@ void SwUndoInsLayFormat::UndoImpl(::sw::UndoRedoContext & rContext) rContent.GetContentIdx()->GetIndex() ); SwNodeIndex aEndIdx( rDoc.GetNodes(), aIdx.GetNode().EndOfSectionIndex() ); - SwContentIndex aIndex( pNode, mnCursorSaveIndexPos ); - SwPosition aPos( *pNode, aIndex ); + SwPosition aPos( *pNode, mnCursorSaveIndexPos ); // don't delete bookmarks here, DelFly() will save them in history ::PaMCorrAbs(SwPaM(aIdx, aEndIdx), aPos); // TODO: is aPos actually a sensible pos for e.g. SwXText* ? diff --git a/sw/source/core/unocore/unocrsrhelper.cxx b/sw/source/core/unocore/unocrsrhelper.cxx index f5c2dd7c75b9..612d17826753 100644 --- a/sw/source/core/unocore/unocrsrhelper.cxx +++ b/sw/source/core/unocore/unocrsrhelper.cxx @@ -232,8 +232,7 @@ void GetSelectableFromAny(uno::Reference<uno::XInterface> const& xIfc, pBox = pCell->FindBox(pTable, pBox); if (pBox) { - SwPosition const aPos(*pBox->GetSttNd()); - SwPaM aPam(aPos); + SwPaM aPam(*pBox->GetSttNd()); aPam.Move(fnMoveForward, GoInNode); o_rpPaM = lcl_createPamCopy(aPam); } diff --git a/sw/source/core/unocore/unoobj2.cxx b/sw/source/core/unocore/unoobj2.cxx index cc2b2e36212e..52a04b0c383c 100644 --- a/sw/source/core/unocore/unoobj2.cxx +++ b/sw/source/core/unocore/unoobj2.cxx @@ -747,8 +747,7 @@ SwXTextRange::SwXTextRange(SwTableFormat& rTableFormat) { SwTable *const pTable = SwTable::FindTable( &rTableFormat ); SwTableNode *const pTableNode = pTable->GetTableNode(); - SwPosition aPosition( *pTableNode ); - SwPaM aPam( aPosition ); + SwPaM aPam( *pTableNode ); SetPositions( aPam ); } diff --git a/sw/source/core/unocore/unoparagraph.cxx b/sw/source/core/unocore/unoparagraph.cxx index 443987f74e4a..45ef0e53165e 100644 --- a/sw/source/core/unocore/unoparagraph.cxx +++ b/sw/source/core/unocore/unoparagraph.cxx @@ -522,8 +522,7 @@ uno::Sequence< uno::Any > SwXParagraph::Impl::GetPropertyValues_Impl( SwTextNode & rTextNode(GetTextNodeOrThrow()); uno::Sequence< uno::Any > aValues(rPropertyNames.getLength()); - SwPosition aPos( rTextNode ); - SwPaM aPam( aPos ); + SwPaM aPam( rTextNode ); uno::Any* pValues = aValues.getArray(); const OUString* pPropertyNames = rPropertyNames.getConstArray(); const SfxItemPropertyMap &rMap = m_rPropSet.getPropertyMap(); @@ -778,8 +777,7 @@ SwXParagraph::Impl::GetPropertyValuesTolerant_Impl( if (! ::sw::GetDefaultTextContentValue( aValue, rProp, pEntry->nWID ) ) { - SwPosition aPos( rTextNode ); - SwPaM aPam( aPos ); + SwPaM aPam( rTextNode ); // handle properties that are not part of the attribute // and thus only pretended to be paragraph attributes beans::PropertyState eTemp; @@ -1257,8 +1255,7 @@ SwXParagraph::createEnumeration() SwTextNode & rTextNode(m_pImpl->GetTextNodeOrThrow()); - SwPosition aPos( rTextNode ); - SwPaM aPam ( aPos ); + SwPaM aPam ( rTextNode ); const uno::Reference< container::XEnumeration > xRef = new SwXTextPortionEnumeration(aPam, m_pImpl->m_xParentText, m_pImpl->m_nSelectionStartPos, m_pImpl->m_nSelectionEndPos); @@ -1272,8 +1269,7 @@ SwXParagraph::createTextFieldsEnumeration() SolarMutexGuard aGuard; SwTextNode & rTextNode(m_pImpl->GetTextNodeOrThrow()); - SwPosition aPos( rTextNode ); - SwPaM aPam ( aPos ); + SwPaM aPam ( rTextNode ); return new SwXTextPortionEnumeration(aPam, m_pImpl->m_xParentText, m_pImpl->m_nSelectionStartPos, m_pImpl->m_nSelectionEndPos, /*bOnlyTextFields*/true); @@ -1398,8 +1394,7 @@ SwXParagraph::createContentEnumeration(const OUString& rServiceName) SwTextNode & rTextNode(m_pImpl->GetTextNodeOrThrow()); - SwPosition aPos( rTextNode ); - SwPaM aPam( aPos ); + SwPaM aPam( rTextNode ); uno::Reference< container::XEnumeration > xRet = SwXParaFrameEnumeration::Create(aPam, PARAFRAME_PORTION_PARAGRAPH); return xRet; diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx index 5fed8c91de5d..f4033be51050 100644 --- a/sw/source/core/unocore/unotext.cxx +++ b/sw/source/core/unocore/unotext.cxx @@ -969,8 +969,7 @@ SwXText::setString(const OUString& rString) if(bInsertNodes) { GetDoc()->getIDocumentContentOperations().AppendTextNode( aStartPos ); - SwPosition aEndPos(aEndIdx.GetNode()); - SwPaM aPam(aEndPos); + SwPaM aPam(aEndIdx.GetNode()); GetDoc()->getIDocumentContentOperations().AppendTextNode( *aPam.Start() ); } } @@ -1272,8 +1271,7 @@ SwXText::Impl::finishOrAppendParagraph( // find end node, go backward - don't skip tables because the new // paragraph has to be the last node //aPam.Move( fnMoveBackward, GoInNode ); - SwPosition aInsertPosition( *pStartNode->EndOfSectionNode(), SwNodeOffset(-1) ); - SwPaM aPam(aInsertPosition); + SwPaM aPam(*pStartNode->EndOfSectionNode(), SwNodeOffset(-1)); // If we got a position reference, then the insert point is not the end of // the document. if (xInsertPosition.is()) diff --git a/sw/source/filter/basflt/shellio.cxx b/sw/source/filter/basflt/shellio.cxx index 395853dba02d..d8e1b3e9ce94 100644 --- a/sw/source/filter/basflt/shellio.cxx +++ b/sw/source/filter/basflt/shellio.cxx @@ -117,8 +117,7 @@ ErrCode SwReader::Read( const Reader& rOptions ) else { // if the Reader was not called by a Shell, create a PaM ourselves - SwNodeIndex nNode( mxDoc->GetNodes().GetEndOfContent(), -1 ); - pPam = new SwPaM( nNode ); + pPam = new SwPaM( mxDoc->GetNodes().GetEndOfContent(), SwNodeOffset(-1) ); // For Web documents the default template was set already by InitNew, // unless the filter is not HTML, // or a SetTemplateName was called in ConvertFrom. diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx index e8980241b3a0..13dd07c810ff 100644 --- a/sw/source/filter/html/swhtml.cxx +++ b/sw/source/filter/html/swhtml.cxx @@ -5601,8 +5601,7 @@ bool TestImportHTML(SvStream &rStream) xDocSh->DoInitNew(); SwDoc *pD = static_cast<SwDocShell*>((&xDocSh))->GetDoc(); - SwNodeIndex aIdx(pD->GetNodes().GetEndOfContent(), -1); - SwPaM aPaM(aIdx); + SwPaM aPaM(pD->GetNodes().GetEndOfContent(), SwNodeOffset(-1)); pD->SetInReading(true); bool bRet = false; try diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index bfeb0a0bdb82..de2f096bdff9 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -1555,8 +1555,7 @@ void SwWW8FltRefStack::SetAttrInDoc(const SwPosition& rTmpPos, case RES_TXTATR_ANNOTATION: case RES_TXTATR_INPUTFIELD: { - SwNodeIndex aIdx(rEntry.m_aMkPos.m_nNode, 1); - SwPaM aPaM(aIdx, rEntry.m_aMkPos.m_nContent); + SwPaM aPaM(rEntry.m_aMkPos.m_nNode.GetNode(), SwNodeOffset(1), rEntry.m_aMkPos.m_nContent); SwFormatField& rFormatField = *static_cast<SwFormatField*>(rEntry.m_pAttr.get()); SwField* pField = rFormatField.GetField(); @@ -4691,8 +4690,7 @@ void wwSectionManager::InsertSegments() if (pTextNd) { - SwNodeIndex aIdx(*pTextNd); - SwPaM aTest(aIdx); + SwPaM aTest(*pTextNd); mrReader.m_rDoc.getIDocumentContentOperations().DelFullPara(aTest); pTextNd = nullptr; } @@ -4708,8 +4706,7 @@ void wwExtraneousParas::delete_all_from_doc() SwTextNode* pTextNode = rListener.GetTextNode(); rListener.StopListening(pTextNode); - SwNodeIndex aIdx(*pTextNode); - SwPaM aTest(aIdx); + SwPaM aTest(*pTextNode); m_rDoc.getIDocumentContentOperations().DelFullPara(aTest); } m_aTextNodes.clear(); @@ -6358,8 +6355,7 @@ bool TestImportDOC(SvStream &rStream, const OUString &rFltName) xDocSh->DoInitNew(); SwDoc *pD = static_cast<SwDocShell*>((&xDocSh))->GetDoc(); - SwNodeIndex aIdx(pD->GetNodes().GetEndOfContent(), -1); - SwPaM aPaM(aIdx); + SwPaM aPaM(pD->GetNodes().GetEndOfContent(), -1); pD->SetInReading(true); bool bRet = xReader->Read(*pD, OUString(), aPaM, OUString()) == ERRCODE_NONE; pD->SetInReading(false); diff --git a/sw/source/filter/xml/XMLRedlineImportHelper.cxx b/sw/source/filter/xml/XMLRedlineImportHelper.cxx index 7bc78f4e77e7..c6b4023f6c5e 100644 --- a/sw/source/filter/xml/XMLRedlineImportHelper.cxx +++ b/sw/source/filter/xml/XMLRedlineImportHelper.cxx @@ -631,12 +631,11 @@ void XMLRedlineImportHelper::InsertIntoDocument(RedlineInfo* pRedlineInfo) // They have to be deleted as well (#i80689)! if( m_bIgnoreRedlines && pRedlineInfo->pContentIndex != nullptr ) { - SwNodeIndex aIdx( *pRedlineInfo->pContentIndex ); - const SwNode* pEnd = aIdx.GetNode().EndOfSectionNode(); + const SwNodeIndex& rIdx( *pRedlineInfo->pContentIndex ); + const SwNode* pEnd = rIdx.GetNode().EndOfSectionNode(); if( pEnd ) { - SwNodeIndex aEnd( *pEnd, 1 ); - SwPaM aDel( aIdx, aEnd ); + SwPaM aDel( rIdx.GetNode(), 0, *pEnd, 1 ); pDoc->getIDocumentContentOperations().DeleteRange(aDel); } } |