summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <Michael.Stahl@cib.de>2018-11-06 16:38:44 +0100
committerMichael Stahl <Michael.Stahl@cib.de>2018-11-10 19:47:00 +0100
commitb16391691833bc09a60a31d0098230d67feb1ad4 (patch)
tree58f91ff9ea4a6d98a6996e327525499ebc98898d
parent1ad75a70c22c84ed8710ee51c69eca31647647ad (diff)
sw_redlinehide_3: adapt PDFExport lcl_HasPreviousParaSameNumRule
Reuse some formerly static functions in docnum.cxx Change-Id: I8d6bcca28a4f8a6e197a1c302acdf22ce6de01ff
-rw-r--r--sw/source/core/doc/docnum.cxx30
-rw-r--r--sw/source/core/inc/txtfrm.hxx3
-rw-r--r--sw/source/core/text/EnhancedPDFExportHelper.cxx9
3 files changed, 25 insertions, 17 deletions
diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx
index 204cd1fd8b58..b3c2a8336ba8 100644
--- a/sw/source/core/doc/docnum.cxx
+++ b/sw/source/core/doc/docnum.cxx
@@ -1437,8 +1437,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()
@@ -1453,8 +1455,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()
@@ -1469,6 +1471,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)
@@ -1489,7 +1493,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();
@@ -1521,12 +1525,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;
}
@@ -1557,9 +1561,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
@@ -1622,9 +1626,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())
@@ -1660,9 +1664,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 )