summaryrefslogtreecommitdiff
path: root/sw/source/filter/ww8
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2022-08-16 18:44:31 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-08-17 18:18:52 +0200
commit3a02b5f8aae803b7b5a232c724135594483627a4 (patch)
tree3e51ea888f4ed012295a3736cd4cff7d81ba11c5 /sw/source/filter/ww8
parenta18a74d6762e56a20093ca51cfd12925697c2524 (diff)
convert more nNode to SwPosition::GetNode
in places where we are using the result with operator== Change-Id: I28f8f6fa2c3754ec6612ab2334c3a58b61ecd065 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138401 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/source/filter/ww8')
-rw-r--r--sw/source/filter/ww8/WW8TableInfo.cxx2
-rw-r--r--sw/source/filter/ww8/writerhelper.cxx10
-rw-r--r--sw/source/filter/ww8/wrtw8nds.cxx47
-rw-r--r--sw/source/filter/ww8/wrtww8.cxx4
-rw-r--r--sw/source/filter/ww8/ww8par2.cxx2
5 files changed, 32 insertions, 33 deletions
diff --git a/sw/source/filter/ww8/WW8TableInfo.cxx b/sw/source/filter/ww8/WW8TableInfo.cxx
index 78a70f5e90ac..f5c318b6df23 100644
--- a/sw/source/filter/ww8/WW8TableInfo.cxx
+++ b/sw/source/filter/ww8/WW8TableInfo.cxx
@@ -705,7 +705,7 @@ WW8TableInfo::processTableBoxLines(const SwTableBox * pBox,
pNodeInfo = insertTableNodeInfo(&rNode, pTable, pBoxToSet, nRow, nCell, nDepth);
- if (aPaM.GetPoint()->nNode == aEndPaM.GetPoint()->nNode)
+ if (aPaM.GetPoint()->GetNode() == aEndPaM.GetPoint()->GetNode())
bDone = true;
else
aPaM.GetPoint()->nNode++;
diff --git a/sw/source/filter/ww8/writerhelper.cxx b/sw/source/filter/ww8/writerhelper.cxx
index 3b5f44ae1a7e..80a75c4bd2c0 100644
--- a/sw/source/filter/ww8/writerhelper.cxx
+++ b/sw/source/filter/ww8/writerhelper.cxx
@@ -130,16 +130,16 @@ namespace
return aRet;
}
- //Utility to test if a frame is anchored at a given node index
+ //Utility to test if a frame is anchored at a given node
class anchoredto
{
private:
- SwNodeOffset mnNode;
+ const SwNode& mrNode;
public:
- explicit anchoredto(SwNodeOffset nNode) : mnNode(nNode) {}
+ explicit anchoredto(const SwNode& rNode) : mrNode(rNode) {}
bool operator()(const ww8::Frame &rFrame) const
{
- return (mnNode == rFrame.GetPosition().GetNode().GetIndex());
+ return (mrNode == rFrame.GetPosition().GetNode());
}
};
}
@@ -506,7 +506,7 @@ namespace sw
{
ww8::Frames aRet;
std::copy_if(rFrames.begin(), rFrames.end(),
- std::back_inserter(aRet), anchoredto(rNode.GetIndex()));
+ std::back_inserter(aRet), anchoredto(rNode));
return aRet;
}
diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx
index e7d637e1de2f..15e51affd20b 100644
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -287,7 +287,7 @@ sal_Int32 SwWW8AttrIter::SearchNext( sal_Int32 nStartPos )
if( m_pCurRedline )
{
const SwPosition* pEnd = m_pCurRedline->End();
- if (pEnd->nNode == m_rNode)
+ if (pEnd->GetNode() == m_rNode)
{
const sal_Int32 i = pEnd->GetContentIndex();
if ( i >= nStartPos && i < nMinPos )
@@ -310,7 +310,7 @@ sal_Int32 SwWW8AttrIter::SearchNext( sal_Int32 nStartPos )
auto [pStt, pEnd] = pRedl->StartEnd(); // SwPosition*
- if( pStt->nNode == m_rNode )
+ if( pStt->GetNode() == m_rNode )
{
const sal_Int32 i = pStt->GetContentIndex();
if( i >= nStartPos && i < nMinPos )
@@ -319,7 +319,7 @@ sal_Int32 SwWW8AttrIter::SearchNext( sal_Int32 nStartPos )
else
break;
- if( pEnd->nNode == m_rNode )
+ if( pEnd->GetNode() == m_rNode )
{
const sal_Int32 i = pEnd->GetContentIndex();
if( i >= nStartPos && i < nMinPos )
@@ -1498,7 +1498,7 @@ bool SwWW8AttrIter::IncludeEndOfParaCRInRedlineProperties( sal_Int32 nEnd ) cons
// Here we find out if the para end marker we will emit is affected by
// redlining, in which case it must be included by the range of character
// attributes that contains the redlining information.
- if (pEnd->nNode == m_rNode)
+ if (pEnd->GetNode() == m_rNode)
{
if (pEnd->GetContentIndex() == nEnd)
{
@@ -1510,7 +1510,7 @@ bool SwWW8AttrIter::IncludeEndOfParaCRInRedlineProperties( sal_Int32 nEnd ) cons
}
bBreak = false;
}
- if (pStart->nNode == m_rNode)
+ if (pStart->GetNode() == m_rNode)
{
if (pStart->GetContentIndex() == nEnd)
{
@@ -1549,7 +1549,7 @@ const SwRedlineData* SwWW8AttrIter::GetParagraphLevelRedline( )
{
const SwPosition* pCheckedStt = pRedl->Start();
- if( pCheckedStt->nNode == m_rNode )
+ if( pCheckedStt->GetNode() == m_rNode )
{
// Maybe add here a check that also the start & end of the redline is the entire paragraph
@@ -1596,7 +1596,7 @@ const SwRedlineData* SwWW8AttrIter::GetRunLevelRedline( sal_Int32 nPos )
auto [pStt, pEnd] = pRedl->StartEnd(); // SwPosition*
- if( pStt->nNode == m_rNode )
+ if( pStt->GetNode() == m_rNode )
{
if( pStt->GetContentIndex() >= nPos )
{
@@ -1622,7 +1622,7 @@ const SwRedlineData* SwWW8AttrIter::GetRunLevelRedline( sal_Int32 nPos )
break;
}
- if( pEnd->nNode == m_rNode &&
+ if( pEnd->GetNode() == m_rNode &&
pEnd->GetContentIndex() < nPos )
{
m_pCurRedline = pRedl;
@@ -1853,7 +1853,7 @@ static SwTextFormatColl& lcl_getFormatCollection( MSWordExportBase& rExport, con
auto [pStt, pEnd] = pRedl->StartEnd(); // SwPosition*
// Looking for deletions, which ends in current pTextNode
if( RedlineType::Delete == pRedl->GetRedlineData().GetType() &&
- pEnd->nNode == *pTextNode && pStt->nNode != *pTextNode &&
+ pEnd->GetNode() == *pTextNode && pStt->GetNode() != *pTextNode &&
pStt->GetNode().IsTextNode() )
{
pTextNode = pStt->GetNode().GetTextNode();
@@ -1961,7 +1961,6 @@ bool MSWordExportBase::GetBookmarks( const SwTextNode& rNd, sal_Int32 nStt,
sal_Int32 nEnd, IMarkVector& rArr )
{
IDocumentMarkAccess* const pMarkAccess = m_rDoc.getIDocumentMarkAccess();
- SwNodeOffset nNd = rNd.GetIndex( );
const sal_Int32 nMarks = pMarkAccess->getAllMarksCount();
for ( sal_Int32 i = 0; i < nMarks; i++ )
@@ -1986,15 +1985,15 @@ bool MSWordExportBase::GetBookmarks( const SwTextNode& rNd, sal_Int32 nStt,
}
// Only keep the bookmarks starting or ending in this node
- if ( pMark->GetMarkStart().nNode == nNd ||
- pMark->GetMarkEnd().nNode == nNd )
+ if ( pMark->GetMarkStart().GetNode() == rNd ||
+ pMark->GetMarkEnd().GetNode() == rNd )
{
const sal_Int32 nBStart = pMark->GetMarkStart().GetContentIndex();
const sal_Int32 nBEnd = pMark->GetMarkEnd().GetContentIndex();
// Keep only the bookmarks starting or ending in the snippet
- bool bIsStartOk = ( pMark->GetMarkStart().nNode == nNd ) && ( nBStart >= nStt ) && ( nBStart <= nEnd );
- bool bIsEndOk = ( pMark->GetMarkEnd().nNode == nNd ) && ( nBEnd >= nStt ) && ( nBEnd <= nEnd );
+ bool bIsStartOk = ( pMark->GetMarkStart().GetNode() == rNd ) && ( nBStart >= nStt ) && ( nBStart <= nEnd );
+ bool bIsEndOk = ( pMark->GetMarkEnd().GetNode() == rNd ) && ( nBEnd >= nStt ) && ( nBEnd <= nEnd );
if ( bIsStartOk || bIsEndOk )
{
@@ -2009,7 +2008,7 @@ bool MSWordExportBase::GetAnnotationMarks( const SwWW8AttrIter& rAttrs, sal_Int3
sal_Int32 nEnd, IMarkVector& rArr )
{
IDocumentMarkAccess* const pMarkAccess = m_rDoc.getIDocumentMarkAccess();
- SwNodeOffset nNd = rAttrs.GetNode().GetIndex();
+ const SwNode& rNd = rAttrs.GetNode();
const sal_Int32 nMarks = pMarkAccess->getAnnotationMarksCount();
for ( sal_Int32 i = 0; i < nMarks; i++ )
@@ -2017,20 +2016,20 @@ bool MSWordExportBase::GetAnnotationMarks( const SwWW8AttrIter& rAttrs, sal_Int3
IMark* pMark = pMarkAccess->getAnnotationMarksBegin()[i];
// Only keep the bookmarks starting or ending in this node
- if ( pMark->GetMarkStart().nNode == nNd ||
- pMark->GetMarkEnd().nNode == nNd )
+ if ( pMark->GetMarkStart().GetNode() == rNd ||
+ pMark->GetMarkEnd().GetNode() == rNd )
{
const sal_Int32 nBStart = pMark->GetMarkStart().GetContentIndex();
const sal_Int32 nBEnd = pMark->GetMarkEnd().GetContentIndex();
// Keep only the bookmarks starting or ending in the snippet
- bool bIsStartOk = ( pMark->GetMarkStart().nNode == nNd ) && ( nBStart >= nStt ) && ( nBStart <= nEnd );
- bool bIsEndOk = ( pMark->GetMarkEnd().nNode == nNd ) && ( nBEnd >= nStt ) && ( nBEnd <= nEnd );
+ bool bIsStartOk = ( pMark->GetMarkStart().GetNode() == rNd ) && ( nBStart >= nStt ) && ( nBStart <= nEnd );
+ bool bIsEndOk = ( pMark->GetMarkEnd().GetNode() == rNd ) && ( nBEnd >= nStt ) && ( nBEnd <= nEnd );
// Annotation marks always have at least one character: the anchor
// point of the comment field. In this case Word wants only the
// comment field, so ignore the annotation mark itself.
- bool bSingleChar = pMark->GetMarkStart().nNode == pMark->GetMarkEnd().nNode && nBStart + 1 == nBEnd;
+ bool bSingleChar = pMark->GetMarkStart().GetNode() == pMark->GetMarkEnd().GetNode() && nBStart + 1 == nBEnd;
if (bSingleChar)
{
@@ -2142,10 +2141,10 @@ void MSWordExportBase::GetSortedAnnotationMarks( const SwWW8AttrIter& rAttrs, sa
const sal_Int32 nEnd = pMark->GetMarkEnd().GetContentIndex();
const SwTextNode& rNode = rAttrs.GetNode();
- if ( nStart > nCurrentPos && ( pMark->GetMarkStart().nNode == rNode.GetIndex()) )
+ if ( nStart > nCurrentPos && ( pMark->GetMarkStart().GetNode() == rNode) )
aSortedStart.push_back( pMark );
- if ( nEnd > nCurrentPos && nEnd <= ( nCurrentPos + nLen ) && (pMark->GetMarkEnd().nNode == rNode.GetIndex()) )
+ if ( nEnd > nCurrentPos && nEnd <= ( nCurrentPos + nLen ) && (pMark->GetMarkEnd().GetNode() == rNode) )
aSortedEnd.push_back( pMark );
}
@@ -2175,10 +2174,10 @@ void MSWordExportBase::GetSortedBookmarks( const SwTextNode& rNode, sal_Int32 nC
const sal_Int32 nStart = pMark->GetMarkStart().GetContentIndex();
const sal_Int32 nEnd = pMark->GetMarkEnd().GetContentIndex();
- if ( nStart > nCurrentPos && ( pMark->GetMarkStart().nNode == rNode.GetIndex()) )
+ if ( nStart > nCurrentPos && (pMark->GetMarkStart().GetNode() == rNode) )
aSortedStart.push_back( pMark );
- if ( nEnd > nCurrentPos && nEnd <= ( nCurrentPos + nLen ) && (pMark->GetMarkEnd().nNode == rNode.GetIndex()) )
+ if ( nEnd > nCurrentPos && nEnd <= ( nCurrentPos + nLen ) && (pMark->GetMarkEnd().GetNode() == rNode) )
aSortedEnd.push_back( pMark );
}
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index e5a4ffd3ed87..967debe85dc4 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -1435,7 +1435,7 @@ void WW8Export::AppendBookmarks( const SwTextNode& rNd, sal_Int32 nCurrentPos, s
const SwPosition* pOPos = nullptr;
if(rBkmk.IsExpanded())
pOPos = &rBkmk.GetOtherMarkPos();
- if( pOPos && pOPos->nNode == pPos->nNode &&
+ if( pOPos && pOPos->GetNode() == pPos->GetNode() &&
pOPos->nContent < pPos->nContent )
{
pPos = pOPos;
@@ -2754,7 +2754,7 @@ public:
bool contentRemainsToExport(ww8::WW8TableInfo *pTableInfo)
{
bool bSimpleContentRemains = m_pCurPam->GetPoint()->nNode < m_pCurPam->GetMark()->nNode ||
- (m_pCurPam->GetPoint()->nNode == m_pCurPam->GetMark()->nNode &&
+ (m_pCurPam->GetPoint()->GetNode() == m_pCurPam->GetMark()->GetNode() &&
m_pCurPam->GetPoint()->GetContentIndex() <= m_pCurPam->GetMark()->GetContentIndex());
if (bSimpleContentRemains)
return true;
diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx
index 7021a7d53633..8d07a23ba23e 100644
--- a/sw/source/filter/ww8/ww8par2.cxx
+++ b/sw/source/filter/ww8/ww8par2.cxx
@@ -2905,7 +2905,7 @@ bool WW8TabDesc::InFirstParaInCell() const
if (!IsValidCell(GetCurrentCol()))
return false;
- return m_pIo->m_pPaM->GetPoint()->nNode == m_pTabBox->GetSttIdx() + 1;
+ return m_pIo->m_pPaM->GetPoint()->GetNodeIndex() == m_pTabBox->GetSttIdx() + 1;
}
void WW8TabDesc::SetPamInCell(short nWwCol, bool bPam)