summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <Michael.Stahl@cib.de>2018-10-26 11:29:16 +0200
committerMichael Stahl <Michael.Stahl@cib.de>2018-11-10 19:47:00 +0100
commitf611e051039f489c2151d4c29af5d6eb8beb0820 (patch)
tree1d46c38ac61944be7a00de026a821ca1bccac869
parentd6d76a89898cdb4b448d97daed3e3f0fb8b47fb9 (diff)
sw_redlinehide_3: adapt SwEditShell callers of SwDoc::GetNumRuleAtPos
Change-Id: I192a9743300a77bc463319789064abd89d046b0a
-rw-r--r--sw/inc/doc.hxx3
-rw-r--r--sw/source/core/doc/docnum.cxx9
-rw-r--r--sw/source/core/edit/ednumber.cxx13
3 files changed, 18 insertions, 7 deletions
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index 4d5d6e5b6015..305e77f1a4ea 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -1032,7 +1032,8 @@ public:
void SetNumRuleStart( const SwPosition& rPos, bool bFlag = true );
void SetNodeNumStart( const SwPosition& rPos, sal_uInt16 nStt );
- static SwNumRule* GetNumRuleAtPos( const SwPosition& rPos );
+ // sw_redlinehide: may set rPos to different node (the one with the NumRule)
+ static SwNumRule* GetNumRuleAtPos(SwPosition& rPos, SwRootFrame const* pLayout = nullptr);
const SwNumRuleTable& GetNumRuleTable() const { return *mpNumRuleTable; }
diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx
index e1cf7ee67c98..b3e37b23427f 100644
--- a/sw/source/core/doc/docnum.cxx
+++ b/sw/source/core/doc/docnum.cxx
@@ -2091,13 +2091,20 @@ bool SwDoc::NumOrNoNum( const SwNodeIndex& rIdx, bool bDel )
return bResult;
}
-SwNumRule* SwDoc::GetNumRuleAtPos( const SwPosition& rPos )
+SwNumRule* SwDoc::GetNumRuleAtPos(SwPosition& rPos,
+ SwRootFrame const*const pLayout)
{
SwNumRule* pRet = nullptr;
SwTextNode* pTNd = rPos.nNode.GetNode().GetTextNode();
if ( pTNd != nullptr )
{
+ if (pLayout && !sw::IsParaPropsNode(*pLayout, *pTNd))
+ {
+ pTNd = static_cast<SwTextFrame*>(pTNd->getLayoutFrame(pLayout))->GetMergedPara()->pParaPropsNode;
+ rPos.nNode = *pTNd;
+ rPos.nContent.Assign(pTNd, 0);
+ }
pRet = pTNd->GetNumRule();
}
diff --git a/sw/source/core/edit/ednumber.cxx b/sw/source/core/edit/ednumber.cxx
index c795e645b374..c01fa8365385 100644
--- a/sw/source/core/edit/ednumber.cxx
+++ b/sw/source/core/edit/ednumber.cxx
@@ -361,7 +361,8 @@ void SwEditShell::SetIndent(short nIndent, const SwPosition & rPos)
{
StartAllAction();
- SwNumRule *pCurNumRule = SwDoc::GetNumRuleAtPos(rPos);
+ SwPosition pos(rPos);
+ SwNumRule *pCurNumRule = SwDoc::GetNumRuleAtPos(pos, GetLayout());
if (pCurNumRule)
{
@@ -372,7 +373,7 @@ void SwEditShell::SetIndent(short nIndent, const SwPosition & rPos)
}
else
{
- const SwTextNode* pTextNode = rPos.nNode.GetNode().GetTextNode();
+ const SwTextNode* pTextNode = pos.nNode.GetNode().GetTextNode();
if ( pTextNode != nullptr
&& pTextNode->GetActualListLevel() >= 0 )
{
@@ -381,7 +382,7 @@ void SwEditShell::SetIndent(short nIndent, const SwPosition & rPos)
}
// change numbering rule - changed numbering rule is not applied at <aPaM>
- SwPaM aPaM(rPos);
+ SwPaM aPaM(pos);
GetDoc()->SetNumRule( aPaM, aRule, false, OUString(), false );
}
@@ -696,7 +697,8 @@ sal_uInt8 SwEditShell::GetNumLevel() const
const SwNumRule* SwEditShell::GetNumRuleAtCurrCursorPos() const
{
- return SwDoc::GetNumRuleAtPos( *GetCursor()->GetPoint() );
+ SwPosition pos(*GetCursor()->GetPoint());
+ return SwDoc::GetNumRuleAtPos( pos, GetLayout() );
}
const SwNumRule* SwEditShell::GetNumRuleAtCurrentSelection() const
@@ -710,7 +712,8 @@ const SwNumRule* SwEditShell::GetNumRuleAtCurrentSelection() const
for ( SwNodeIndex aNode = rCurrentCursor.Start()->nNode; aNode <= aEndNode; ++aNode )
{
- const SwNumRule* pNumRule = SwDoc::GetNumRuleAtPos( SwPosition( aNode ) );
+ SwPosition pos(aNode);
+ const SwNumRule* pNumRule = SwDoc::GetNumRuleAtPos(pos, GetLayout());
if ( pNumRule == nullptr )
{
continue;