summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2022-08-24 11:04:48 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-08-24 14:29:41 +0200
commit55c638eb0d6aeacb7b5a8b0345add9b44aa6c889 (patch)
tree883418e2b0d793b9ba77c34fa07b5d7effedca24
parentf067bfebf6fbdfb66d545585fea9fe6cec559038 (diff)
use SwNode instead of SwNodeIndex in HasBareGraphicEnd method
part of the process of hiding the internals of SwPosition Change-Id: I89f5bc1a70a8cf54052eebdda9830f8ed634ce45 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138759 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--sw/source/filter/ww8/ww8glsy.cxx33
-rw-r--r--sw/source/filter/ww8/ww8glsy.hxx2
2 files changed, 16 insertions, 19 deletions
diff --git a/sw/source/filter/ww8/ww8glsy.cxx b/sw/source/filter/ww8/ww8glsy.cxx
index 8b8c92482510..2ad84960dcb1 100644
--- a/sw/source/filter/ww8/ww8glsy.cxx
+++ b/sw/source/filter/ww8/ww8glsy.cxx
@@ -56,7 +56,7 @@ WW8Glossary::WW8Glossary(tools::SvRef<SotStorageStream> &refStrm, sal_uInt8 nVer
}
}
-bool WW8Glossary::HasBareGraphicEnd(SwDoc *pDoc,SwNodeIndex const &rIdx)
+bool WW8Glossary::HasBareGraphicEnd(SwDoc *pDoc, SwNode const &rIdx)
{
bool bRet=false;
for( sal_uInt16 nCnt = pDoc->GetSpzFrameFormats()->size(); nCnt; )
@@ -70,7 +70,7 @@ bool WW8Glossary::HasBareGraphicEnd(SwDoc *pDoc,SwNodeIndex const &rIdx)
if (pAPos &&
((RndStdIds::FLY_AT_PARA == rAnchor.GetAnchorId()) ||
(RndStdIds::FLY_AT_CHAR == rAnchor.GetAnchorId())) &&
- rIdx == pAPos->GetNodeIndex() )
+ rIdx == pAPos->GetNode() )
{
bRet=true;
break;
@@ -115,29 +115,28 @@ bool WW8Glossary::MakeEntries(SwDoc *pD, SwTextBlocks &rBlocks,
do {
SwPaM aPam( aStart );
{
- SwNodeIndex& rIdx = aPam.GetPoint()->nNode;
- ++rIdx;
- pCNd = rIdx.GetNode().GetTextNode();
+ SwPosition& rPos = *aPam.GetPoint();
+ rPos.Adjust(SwNodeOffset(1));
+ pCNd = rPos.GetNode().GetTextNode();
if( nullptr == pCNd )
{
- pCNd = pD->GetNodes().MakeTextNode( rIdx.GetNode(), pColl );
- rIdx = *pCNd;
+ pCNd = pD->GetNodes().MakeTextNode( rPos.GetNode(), pColl );
+ rPos.Assign(*pCNd);
}
}
- aPam.GetPoint()->nContent.Assign( pCNd, 0 );
aPam.SetMark();
{
- SwNodeIndex& rIdx = aPam.GetPoint()->nNode;
- rIdx = aStart.GetNode().EndOfSectionIndex() - 1;
- if(( nullptr == ( pCNd = rIdx.GetNode().GetContentNode() ) )
- || HasBareGraphicEnd(pD,rIdx))
+ SwPosition& rPos = *aPam.GetPoint();
+ rPos.Assign(aStart.GetNode().EndOfSectionIndex() - 1);
+ if(( nullptr == ( pCNd = rPos.GetNode().GetContentNode() ) )
+ || HasBareGraphicEnd(pD,rPos.GetNode()))
{
- ++rIdx;
- pCNd = pD->GetNodes().MakeTextNode( rIdx.GetNode(), pColl );
- rIdx = *pCNd;
+ rPos.Adjust(SwNodeOffset(1));
+ pCNd = pD->GetNodes().MakeTextNode( rPos.GetNode(), pColl );
+ rPos.Assign(*pCNd);
}
}
- aPam.GetPoint()->nContent.Assign( pCNd, pCNd->Len() );
+ aPam.GetPoint()->SetContent( pCNd->Len() );
// now we have the right selection for one entry. Copy this to
// the defined TextBlock, but only if it is not an autocorrection
@@ -221,8 +220,6 @@ bool WW8Glossary::Load( SwTextBlocks &rBlocks, bool bSaveRelFile )
pD->GetNodes().GoNext( &aIdx );
}
SwPaM aPamo( aIdx );
- aPamo.GetPoint()->nContent.Assign(aIdx.GetNode().GetContentNode(),
- 0);
std::unique_ptr<SwWW8ImplReader> xRdr(new SwWW8ImplReader(
m_xGlossary->m_nVersion, m_xStg.get(), m_rStrm.get(), *pD, rBlocks.GetBaseURL(),
true, false, *aPamo.GetPoint()));
diff --git a/sw/source/filter/ww8/ww8glsy.hxx b/sw/source/filter/ww8/ww8glsy.hxx
index bff76efedecd..35babac1d07f 100644
--- a/sw/source/filter/ww8/ww8glsy.hxx
+++ b/sw/source/filter/ww8/ww8glsy.hxx
@@ -81,7 +81,7 @@ private:
static bool MakeEntries(SwDoc *pD, SwTextBlocks &rBlocks, bool bSaveRelFile,
const std::vector<OUString>& rStrings,
const std::vector<ww::bytes>& rExtra);
- static bool HasBareGraphicEnd(SwDoc *pD,SwNodeIndex const &rIdx);
+ static bool HasBareGraphicEnd(SwDoc *pD, SwNode const &rIdx);
WW8Glossary(const WW8Glossary&) = delete;
WW8Glossary& operator=(const WW8Glossary&) = delete;