diff options
author | Michael Stahl <Michael.Stahl@cib.de> | 2018-11-06 16:38:44 +0100 |
---|---|---|
committer | Michael Stahl <Michael.Stahl@cib.de> | 2018-11-15 15:10:05 +0100 |
commit | eed21432f3f1fa1f23552cc03fc3ffddf5fc2f29 (patch) | |
tree | 4d39f6209dce286b3d0f6cb4cd589a90bd56edde /sw/source | |
parent | 3d6169eb3918ffb414ddc6fd36bc9973ccb36135 (diff) |
sw_redlinehide_3: adapt PDFExport lcl_HasPreviousParaSameNumRule
Reuse some formerly static functions in docnum.cxx
Change-Id: I8d6bcca28a4f8a6e197a1c302acdf22ce6de01ff
Diffstat (limited to 'sw/source')
-rw-r--r-- | sw/source/core/doc/docnum.cxx | 30 | ||||
-rw-r--r-- | sw/source/core/inc/txtfrm.hxx | 3 | ||||
-rw-r--r-- | sw/source/core/text/EnhancedPDFExportHelper.cxx | 9 |
3 files changed, 25 insertions, 17 deletions
diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx index 414bc472fb42..576f66b0a7a1 100644 --- a/sw/source/core/doc/docnum.cxx +++ b/sw/source/core/doc/docnum.cxx @@ -1426,8 +1426,10 @@ static bool lcl_IsValidPrevNextNumNode( const SwNodeIndex& rIdx ) return bRet; } -static void -lcl_GotoPrevLayoutTextFrame(SwNodeIndex & rIndex, SwRootFrame const*const pLayout) +namespace sw { + +void +GotoPrevLayoutTextFrame(SwNodeIndex & rIndex, SwRootFrame const*const pLayout) { if (pLayout && pLayout->IsHideRedlines() && rIndex.GetNode().IsTextNode() @@ -1442,8 +1444,8 @@ lcl_GotoPrevLayoutTextFrame(SwNodeIndex & rIndex, SwRootFrame const*const pLayou } } -static void -lcl_GotoNextLayoutTextFrame(SwNodeIndex & rIndex, SwRootFrame const*const pLayout) +void +GotoNextLayoutTextFrame(SwNodeIndex & rIndex, SwRootFrame const*const pLayout) { if (pLayout && pLayout->IsHideRedlines() && rIndex.GetNode().IsTextNode() @@ -1458,6 +1460,8 @@ lcl_GotoNextLayoutTextFrame(SwNodeIndex & rIndex, SwRootFrame const*const pLayou } } +} // namespace sw + static bool lcl_GotoNextPrevNum( SwPosition& rPos, bool bNext, bool bOverUpper, sal_uInt8* pUpper, sal_uInt8* pLower, SwRootFrame const*const pLayout) @@ -1478,7 +1482,7 @@ static bool lcl_GotoNextPrevNum( SwPosition& rPos, bool bNext, // If NO_NUMLEVEL is switched on, we search the preceding Node with Numbering bool bError = false; do { - lcl_GotoPrevLayoutTextFrame(aIdx, pLayout); + sw::GotoPrevLayoutTextFrame(aIdx, pLayout); if( aIdx.GetNode().IsTextNode() ) { pNd = aIdx.GetNode().GetTextNode(); @@ -1510,12 +1514,12 @@ static bool lcl_GotoNextPrevNum( SwPosition& rPos, bool bNext, const SwTextNode* pLast; if( bNext ) { - lcl_GotoNextLayoutTextFrame(aIdx, pLayout); + sw::GotoNextLayoutTextFrame(aIdx, pLayout); pLast = pNd; } else { - lcl_GotoPrevLayoutTextFrame(aIdx, pLayout); + sw::GotoPrevLayoutTextFrame(aIdx, pLayout); pLast = nullptr; } @@ -1546,9 +1550,9 @@ static bool lcl_GotoNextPrevNum( SwPosition& rPos, bool bNext, break; if( bNext ) - lcl_GotoNextLayoutTextFrame(aIdx, pLayout); + sw::GotoNextLayoutTextFrame(aIdx, pLayout); else - lcl_GotoPrevLayoutTextFrame(aIdx, pLayout); + sw::GotoPrevLayoutTextFrame(aIdx, pLayout); } if( !bRet && !bOverUpper && pLast ) // do not iterate over higher numbers, but still to the end @@ -1611,9 +1615,9 @@ const SwNumRule * SwDoc::SearchNumRule(const SwPosition & rPos, if ( !bInvestigateStartNode ) { if (bForward) - lcl_GotoNextLayoutTextFrame(aIdx, pLayout); + sw::GotoNextLayoutTextFrame(aIdx, pLayout); else - lcl_GotoPrevLayoutTextFrame(aIdx, pLayout); + sw::GotoPrevLayoutTextFrame(aIdx, pLayout); } if (aIdx.GetNode().IsTextNode()) @@ -1649,9 +1653,9 @@ const SwNumRule * SwDoc::SearchNumRule(const SwPosition & rPos, if ( bInvestigateStartNode ) { if (bForward) - lcl_GotoNextLayoutTextFrame(aIdx, pLayout); + sw::GotoNextLayoutTextFrame(aIdx, pLayout); else - lcl_GotoPrevLayoutTextFrame(aIdx, pLayout); + sw::GotoPrevLayoutTextFrame(aIdx, pLayout); } pNode = &aIdx.GetNode(); diff --git a/sw/source/core/inc/txtfrm.hxx b/sw/source/core/inc/txtfrm.hxx index 1b145bda9bd0..00bd58d12fe9 100644 --- a/sw/source/core/inc/txtfrm.hxx +++ b/sw/source/core/inc/txtfrm.hxx @@ -107,6 +107,9 @@ SwPosition GetParaPropsPos(SwRootFrame const& rLayout, SwPosition const& rPos); std::pair<SwTextNode *, SwTextNode *> GetFirstAndLastNode(SwRootFrame const& rLayout, SwNodeIndex const& rPos); +void GotoPrevLayoutTextFrame(SwNodeIndex & rIndex, SwRootFrame const* pLayout); +void GotoNextLayoutTextFrame(SwNodeIndex & rIndex, SwRootFrame const* pLayout); + TextFrameIndex UpdateMergedParaForDelete(MergedPara & rMerged, bool isRealDelete, SwTextNode const& rNode, sal_Int32 nIndex, sal_Int32 nLen); diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx b/sw/source/core/text/EnhancedPDFExportHelper.cxx index c248492ff34c..a3e97f716409 100644 --- a/sw/source/core/text/EnhancedPDFExportHelper.cxx +++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx @@ -226,7 +226,7 @@ void* lcl_GetKeyFromFrame( const SwFrame& rFrame ) return pKey; } -bool lcl_HasPreviousParaSameNumRule( const SwTextNode& rNode ) +bool lcl_HasPreviousParaSameNumRule(SwTextFrame const& rTextFrame, const SwTextNode& rNode) { bool bRet = false; SwNodeIndex aIdx( rNode ); @@ -237,11 +237,12 @@ bool lcl_HasPreviousParaSameNumRule( const SwTextNode& rNode ) while (pNode != rNodes.DocumentSectionStartNode(const_cast<SwNode*>(static_cast<SwNode const *>(&rNode))) ) { - --aIdx; + sw::GotoPrevLayoutTextFrame(aIdx, rTextFrame.getRootFrame()); if (aIdx.GetNode().IsTextNode()) { - const SwTextNode* pPrevTextNd = aIdx.GetNode().GetTextNode(); + const SwTextNode *const pPrevTextNd = sw::GetParaPropsNode( + *rTextFrame.getRootFrame(), *aIdx.GetNode().GetTextNode()); const SwNumRule * pPrevNumRule = pPrevTextNd->GetNumRule(); // We find the previous text node. Now check, if the previous text node @@ -844,7 +845,7 @@ void SwTaggedPDFHelper::BeginNumberedListStructureElements() return; const SwNumberTreeNode* pParent = pNodeNum->GetParent(); - const bool bSameNumbering = lcl_HasPreviousParaSameNumRule(*pTextNd); + const bool bSameNumbering = lcl_HasPreviousParaSameNumRule(rTextFrame, *pTextNd); // Second condition: current numbering is not 'interrupted' if ( bSameNumbering ) |