summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2022-08-24 09:46:41 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-08-24 11:35:47 +0200
commit6ba1f58c58857812d85e7c57d2f612ca80216786 (patch)
tree2c6d92043f25ba4941bce72f8d9c7df36f595999 /sw
parent573d6a12a450949246516c8d69e173c8c7680fc2 (diff)
Use more SwPosition::Adjust
to keep the internal fields of SwPosition in sync. Change-Id: Ia11f4797fe0b7b0ba4fb368fe4f9918a2d577c87 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138751 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/filter/ww8/ww8par2.cxx31
-rw-r--r--sw/source/filter/ww8/ww8par5.cxx2
-rw-r--r--sw/source/filter/ww8/ww8par6.cxx8
3 files changed, 20 insertions, 21 deletions
diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx
index d075cd1d8d93..9b6cdfe6c754 100644
--- a/sw/source/filter/ww8/ww8par2.cxx
+++ b/sw/source/filter/ww8/ww8par2.cxx
@@ -198,7 +198,7 @@ sal_uInt16 SwWW8ImplReader::End_Footnote()
{
sChar += OUStringChar(pText->GetText()[--nPos]);
m_pPaM->SetMark();
- --m_pPaM->GetMark()->nContent;
+ m_pPaM->GetMark()->AdjustContent(-1);
std::shared_ptr<SwUnoCursor> xLastAnchorCursor(m_oLastAnchorPos ? m_rDoc.CreateUnoCursor(*m_oLastAnchorPos) : nullptr);
m_oLastAnchorPos.reset();
m_rDoc.getIDocumentContentOperations().DeleteRange( *m_pPaM );
@@ -251,9 +251,9 @@ sal_uInt16 SwWW8ImplReader::End_Footnote()
as usual. Might not be if the user has already deleted it, e.g.
#i14737#
*/
- SwNodeIndex& rNIdx = m_pPaM->GetPoint()->nNode;
- rNIdx = pSttIdx->GetIndex() + 1;
- SwTextNode* pTNd = rNIdx.GetNode().GetTextNode();
+ SwPosition& rPaMPointPos = *m_pPaM->GetPoint();
+ rPaMPointPos.Assign(pSttIdx->GetIndex() + 1);
+ SwTextNode* pTNd = rPaMPointPos.GetNode().GetTextNode();
if (pTNd && !pTNd->GetText().isEmpty() && !sChar.isEmpty())
{
const OUString &rText = pTNd->GetText();
@@ -269,12 +269,12 @@ sal_uInt16 SwWW8ImplReader::End_Footnote()
nFirstLineIndent = pLRSpace->GetTextFirstLineOffset();
}
- m_pPaM->GetPoint()->nContent.Assign( pTNd, 0 );
+ rPaMPointPos.SetContent(0);
m_pPaM->SetMark();
// Strip out aesthetic tabs we may have inserted on export #i24762#
if (nFirstLineIndent < 0 && rText.getLength() > 1 && rText[1] == 0x09)
- ++m_pPaM->GetMark()->nContent;
- ++m_pPaM->GetMark()->nContent;
+ m_pPaM->GetMark()->AdjustContent(1);
+ m_pPaM->GetMark()->AdjustContent(1);
m_xReffingStck->Delete(*m_pPaM);
m_rDoc.getIDocumentContentOperations().DeleteRange( *m_pPaM );
m_pPaM->DeleteMark();
@@ -2740,11 +2740,11 @@ void WW8TabDesc::ParkPaM()
{
do
{
- m_pIo->m_pPaM->GetPoint()->nNode = nSttNd;
+ m_pIo->m_pPaM->GetPoint()->Assign(nSttNd);
}
while (m_pIo->m_pPaM->GetPointNode().GetNodeType() != SwNodeType::Text && ++nSttNd < nEndNd);
- m_pIo->m_pPaM->GetPoint()->nContent.Assign(m_pIo->m_pPaM->GetPointContentNode(), 0);
+ m_pIo->m_pPaM->GetPoint()->SetContent(0);
m_pIo->m_rDoc.SetTextFormatColl(*m_pIo->m_pPaM, const_cast<SwTextFormatColl*>(m_pIo->m_pDfltTextFormatColl));
}
}
@@ -2983,10 +2983,10 @@ void WW8TabDesc::SetPamInCell(short nWwCol, bool bPam)
{
do
{
- m_pIo->m_pPaM->GetPoint()->nNode = nSttNd;
+ m_pIo->m_pPaM->GetPoint()->Assign(nSttNd);
}
while (m_pIo->m_pPaM->GetPointNode().GetNodeType() != SwNodeType::Text && ++nSttNd < nEndNd);
- m_pIo->m_pPaM->GetPoint()->nContent.Assign(m_pIo->m_pPaM->GetPointContentNode(), 0);
+ m_pIo->m_pPaM->GetPoint()->SetContent(0);
// Precautionally set now, otherwise the style is not set for cells
// that are inserted for margin balancing.
m_pIo->m_rDoc.SetTextFormatColl(*m_pIo->m_pPaM, const_cast<SwTextFormatColl*>(m_pIo->m_pDfltTextFormatColl));
@@ -2995,7 +2995,8 @@ void WW8TabDesc::SetPamInCell(short nWwCol, bool bPam)
}
// Better to turn Snap to Grid off for all paragraphs in tables
- SwTextNode *pNd = m_pIo->m_pPaM->GetPointNode().GetTextNode();
+ SwPosition* pGridPos = m_pIo->m_pPaM->GetPoint();
+ SwTextNode *pNd = pGridPos->GetNode().GetTextNode();
if(!pNd)
return;
@@ -3008,12 +3009,10 @@ void WW8TabDesc::SetPamInCell(short nWwCol, bool bPam)
SvxParaGridItem aGridItem( rSnapToGrid );
aGridItem.SetValue(false);
- SwPosition* pGridPos = m_pIo->m_pPaM->GetPoint();
-
const sal_Int32 nEnd = pGridPos->GetContentIndex();
- pGridPos->nContent.Assign(m_pIo->m_pPaM->GetPointContentNode(), 0);
+ pGridPos->SetContent(0);
m_pIo->m_xCtrlStck->NewAttr(*pGridPos, aGridItem);
- pGridPos->nContent.Assign(m_pIo->m_pPaM->GetPointContentNode(), nEnd);
+ pGridPos->SetContent(nEnd);
m_pIo->m_xCtrlStck->SetAttr(*pGridPos, RES_PARATR_SNAPTOGRID);
}
diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx
index 4447d124f267..bd17737753ef 100644
--- a/sw/source/filter/ww8/ww8par5.cxx
+++ b/sw/source/filter/ww8/ww8par5.cxx
@@ -599,7 +599,7 @@ sal_uInt16 SwWW8ImplReader::End_Field()
if (aRestorePos.GetContentIndex() > nMaxValidIndex)
{
SAL_WARN("sw.ww8", "Attempt to restore to invalid content position");
- aRestorePos.nContent.Assign(pNd, nMaxValidIndex);
+ aRestorePos.SetContent(nMaxValidIndex);
}
*m_pPaM->GetPoint() = aRestorePos;
diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx
index 873d1d9b2bfc..00c9b1cda0df 100644
--- a/sw/source/filter/ww8/ww8par6.cxx
+++ b/sw/source/filter/ww8/ww8par6.cxx
@@ -821,7 +821,7 @@ void SwWW8ImplReader::HandleLineNumbering(const wwSection &rSection)
}
}
-wwSection::wwSection(const SwPosition &rPos) : maStart(rPos.nNode)
+wwSection::wwSection(const SwPosition &rPos) : maStart(rPos.GetNode())
, mpSection(nullptr)
, mpPage(nullptr)
, meDir(SvxFrameDirection::Horizontal_LR_TB)
@@ -2543,14 +2543,14 @@ bool SwWW8ImplReader::StartApo(const ApoTestResults &rApo, const WW8_TablePos *p
void wwSectionManager::JoinNode(const SwPosition &rPos, const SwNode &rNode)
{
- if ((!maSegments.empty()) && (maSegments.back().maStart == rPos.nNode))
+ if ((!maSegments.empty()) && (maSegments.back().maStart == rPos.GetNode()))
maSegments.back().maStart.Assign(rNode);
}
bool SwWW8ImplReader::JoinNode(SwPaM &rPam, bool bStealAttr)
{
bool bRet = false;
- rPam.GetPoint()->nContent = 0; // go to start of paragraph
+ rPam.GetPoint()->SetContent(0); // go to start of paragraph
SwNodeIndex aPref(rPam.GetPoint()->GetNode(), -1);
@@ -4554,7 +4554,7 @@ void SwWW8ImplReader::Read_LineBreakClear(sal_uInt16 /*nId*/, const sal_uInt8* p
// Replace the linebreak char with a clearing break.
--nPos;
m_pPaM->SetMark();
- --m_pPaM->GetMark()->nContent;
+ m_pPaM->GetMark()->AdjustContent(-1);
m_rDoc.getIDocumentContentOperations().DeleteRange(*m_pPaM);
m_pPaM->DeleteMark();
SwFormatLineBreak aLineBreak(*m_oLineBreakClear);