[Libreoffice-commits] core.git: Branch 'private/mst/sw_redlinehide_3' - 18 commits - sw/inc sw/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Fri Nov 2 18:02:16 UTC 2018
Rebased ref, commits from common ancestor:
commit e5d4d9d6ee6145fcb3fc270cee323fbb902401ab
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Fri Nov 2 14:29:23 2018 +0100
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Fri Nov 2 18:55:50 2018 +0100
sw_redlinehide_3: SetHideRedlines() must iterate doc when Show->Hide
Something must call AddToListRLHidden() on all the nodes.
Change-Id: Ibe23f499372b7fd07a2894ee3f90684d53d67aef
diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx
index 108aa9efca97..7be6db566c8b 100644
--- a/sw/source/core/layout/wsfrm.cxx
+++ b/sw/source/core/layout/wsfrm.cxx
@@ -4438,7 +4438,8 @@ void SwRootFrame::SetHideRedlines(bool const bHideRedlines)
}
mbHideRedlines = bHideRedlines;
SwDoc & rDoc(*GetFormat()->GetDoc());
- if (rDoc.getIDocumentRedlineAccess().GetRedlineTable().empty())
+ if (!bHideRedlines // Show->Hide must init hidden number trees
+ && rDoc.getIDocumentRedlineAccess().GetRedlineTable().empty())
{
return;
}
commit 9f0a7901e210ddce98b8d1f99d81c1a8fa1de67b
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Thu Nov 1 19:25:04 2018 +0100
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Fri Nov 2 18:55:50 2018 +0100
sw_redlinehide_3: fix SwDoc::MoveParagraph copying of redlined text
If redlining is enabled, the selection is copied and so delete redlines
become insert redline; better to delete the delete redlines so the
insert redline consists only of the visible text.
Change-Id: I5f7da96dd957262ccc2b83d0abe6add258b7067f
diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx
index d379a14825f1..e2ccaa575dd9 100644
--- a/sw/source/core/doc/docnum.cxx
+++ b/sw/source/core/doc/docnum.cxx
@@ -2140,7 +2140,48 @@ bool SwDoc::MoveParagraphImpl(SwPaM& rPam, long const nOffset,
}
}
+ --aIdx; // move before insertion
+
getIDocumentContentOperations().CopyRange( aPam, aInsPos, /*bCopyAll=*/false, /*bCheckPos=*/true );
+
+ // now delete all the delete redlines that were copied
+#ifndef NDEBUG
+ size_t nRedlines(getIDocumentRedlineAccess().GetRedlineTable().size());
+#endif
+ if (nOffset > 0)
+ assert(aPam.End()->nNode.GetIndex() - aPam.Start()->nNode.GetIndex() + nOffset == aInsPos.nNode.GetIndex() - aPam.End()->nNode.GetIndex());
+ else
+ assert(aPam.Start()->nNode.GetIndex() - aPam.End()->nNode.GetIndex() + nOffset == aInsPos.nNode.GetIndex() - aPam.End()->nNode.GetIndex());
+ SwRedlineTable::size_type i;
+ getIDocumentRedlineAccess().GetRedline(*aPam.End(), &i);
+ for ( ; 0 < i; --i)
+ { // iterate backwards and offset via the start nodes difference
+ SwRangeRedline const*const pRedline = getIDocumentRedlineAccess().GetRedlineTable()[i - 1];
+ if (*pRedline->End() < *aPam.Start())
+ {
+ break;
+ }
+ if (pRedline->GetType() == nsRedlineType_t::REDLINE_DELETE)
+ {
+ assert(*aPam.Start() <= *pRedline->Start()); // caller's fault
+ SwRangeRedline* pNewRedline;
+ {
+ SwPaM pam(*pRedline, nullptr);
+ sal_uLong const nCurrentOffset(
+ aIdx.GetIndex() + 1 - aPam.Start()->nNode.GetIndex());
+ pam.GetPoint()->nNode += nCurrentOffset;
+ pam.GetPoint()->nContent.Assign(pam.GetPoint()->nNode.GetNode().GetContentNode(), pam.GetPoint()->nContent.GetIndex());
+ pam.GetMark()->nNode += nCurrentOffset;
+ pam.GetMark()->nContent.Assign(pam.GetMark()->nNode.GetNode().GetContentNode(), pam.GetMark()->nContent.GetIndex());
+
+ pNewRedline = new SwRangeRedline( nsRedlineType_t::REDLINE_DELETE, pam );
+ }
+ // note: effectively this will DeleteAndJoin the pam!
+ getIDocumentRedlineAccess().AppendRedline(pNewRedline, true);
+ assert(getIDocumentRedlineAccess().GetRedlineTable().size() <= nRedlines);
+ }
+ }
+
if( bDelLastPara )
{
// We need to remove the last empty Node again
commit 6ab51ecb419cf3680e9988be6800086f61de5e2e
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Tue Oct 30 19:12:39 2018 +0100
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Fri Nov 2 18:51:14 2018 +0100
sw_redlinehide_3: adapt SwDoc::MoveParagraph()
Very tricky...
Change-Id: Ic4157d14c2a3ee7c90f103561a376ac6f753a694
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index c4842f8af649..020379e2d5a9 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -1117,7 +1117,8 @@ public:
/** Move selected paragraphes (not only numberings)
according to offsets. (if negative: go to doc start). */
- bool MoveParagraph( const SwPaM&, long nOffset, bool bIsOutlMv = false );
+ bool MoveParagraph(SwPaM&, long nOffset, bool bIsOutlMv = false);
+ bool MoveParagraphImpl(SwPaM&, long nOffset, bool bIsOutlMv, SwRootFrame const*);
bool NumOrNoNum( const SwNodeIndex& rIdx, bool bDel = false);
diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx
index 00080bb8f9ec..d379a14825f1 100644
--- a/sw/source/core/doc/docnum.cxx
+++ b/sw/source/core/doc/docnum.cxx
@@ -29,6 +29,7 @@
#include <IDocumentState.hxx>
#include <IDocumentStylePoolAccess.hxx>
#include <pam.hxx>
+#include <unocrsr.hxx>
#include <ndtxt.hxx>
#include <doctxm.hxx>
#include <poolfmt.hxx>
@@ -1792,7 +1793,120 @@ bool SwDoc::NumUpDown(const SwPaM& rPam, bool bDown, SwRootFrame const*const pLa
return bRet;
}
-bool SwDoc::MoveParagraph( const SwPaM& rPam, long nOffset, bool bIsOutlMv )
+// this function doesn't contain any numbering-related code, but it is
+// primarily called to move numbering-relevant paragraphs around, hence
+// it will expand its selection to include full SwTextFrames.
+bool SwDoc::MoveParagraph(SwPaM& rPam, long nOffset, bool const bIsOutlMv)
+{
+ // sw_redlinehide: as long as a layout with Hide mode exists, only
+ // move nodes that have merged frames *completely*
+ SwRootFrame const* pLayout(nullptr);
+ for (SwRootFrame const*const pLay : GetAllLayouts())
+ {
+ if (pLay->IsHideRedlines())
+ {
+ pLayout = pLay;
+ }
+ }
+ if (pLayout)
+ {
+ std::pair<SwTextNode *, SwTextNode *> nodes(
+ sw::GetFirstAndLastNode(*pLayout, rPam.Start()->nNode));
+ if (nodes.first && nodes.first != &rPam.Start()->nNode.GetNode())
+ {
+ assert(nodes.second);
+ if (nOffset < 0)
+ {
+ nOffset += rPam.Start()->nNode.GetIndex() - nodes.first->GetIndex();
+ if (0 <= nOffset) // hack: there are callers that know what
+ { // node they want; those should never need
+ nOffset = -1; // this; other callers just pass in -1
+ } // and those should still move
+ }
+ if (!rPam.HasMark())
+ {
+ rPam.SetMark();
+ }
+ assert(nodes.first->GetIndex() < rPam.Start()->nNode.GetIndex());
+ rPam.Start()->nNode = *nodes.first;
+ rPam.Start()->nContent.Assign(nodes.first, 0);
+ }
+ nodes = sw::GetFirstAndLastNode(*pLayout, rPam.End()->nNode);
+ if (nodes.second && nodes.second != &rPam.End()->nNode.GetNode())
+ {
+ assert(nodes.first);
+ if (0 < nOffset)
+ {
+ nOffset -= nodes.second->GetIndex() - rPam.End()->nNode.GetIndex();
+ if (nOffset <= 0) // hack: there are callers that know what
+ { // node they want; those should never need
+ nOffset = +1; // this; other callers just pass in +1
+ } // and those should still move
+ }
+ if (!rPam.HasMark())
+ {
+ rPam.SetMark();
+ }
+ assert(rPam.End()->nNode.GetIndex() < nodes.second->GetIndex());
+ rPam.End()->nNode = *nodes.second;
+ // until end, otherwise Impl will detect overlapping redline
+ rPam.End()->nContent.Assign(nodes.second, nodes.second->GetTextNode()->Len());
+ }
+
+ if (nOffset > 0)
+ { // sw_redlinehide: avoid moving into delete redline, skip forward
+ if (GetNodes().GetEndOfContent().GetIndex() <= rPam.End()->nNode.GetIndex() + nOffset)
+ {
+ return false; // can't move
+ }
+ SwNode const* pNode(GetNodes()[rPam.End()->nNode.GetIndex() + nOffset + 1]);
+ if ( pNode->GetRedlineMergeFlag() != SwNode::Merge::None
+ && pNode->GetRedlineMergeFlag() != SwNode::Merge::First)
+ {
+ for ( ; ; ++nOffset)
+ {
+ pNode = GetNodes()[rPam.End()->nNode.GetIndex() + nOffset];
+ if (pNode->IsTextNode())
+ {
+ nodes = GetFirstAndLastNode(*pLayout, *pNode->GetTextNode());
+ assert(nodes.first && nodes.second);
+ nOffset += nodes.second->GetIndex() - pNode->GetIndex();
+ // on last; will be incremented below to behind-last
+ break;
+ }
+ }
+ }
+ }
+ else
+ { // sw_redlinehide: avoid moving into delete redline, skip backward
+ if (rPam.Start()->nNode.GetIndex() + nOffset < 1)
+ {
+ return false; // can't move
+ }
+ SwNode const* pNode(GetNodes()[rPam.Start()->nNode.GetIndex() + nOffset]);
+ if ( pNode->GetRedlineMergeFlag() != SwNode::Merge::None
+ && pNode->GetRedlineMergeFlag() != SwNode::Merge::First)
+ {
+ for ( ; ; --nOffset)
+ {
+ pNode = GetNodes()[rPam.Start()->nNode.GetIndex() + nOffset];
+ if (pNode->IsTextNode())
+ {
+ nodes = GetFirstAndLastNode(*pLayout, *pNode->GetTextNode());
+ assert(nodes.first && nodes.second);
+ nOffset -= pNode->GetIndex() - nodes.first->GetIndex();
+ // on first
+ break;
+ }
+ }
+ }
+ }
+ }
+ return MoveParagraphImpl(rPam, nOffset, bIsOutlMv, pLayout);
+}
+
+bool SwDoc::MoveParagraphImpl(SwPaM& rPam, long const nOffset,
+ bool const bIsOutlMv, SwRootFrame const*const pLayout)
{
const SwPosition *pStt = rPam.Start(), *pEnd = rPam.End();
@@ -2123,6 +2237,10 @@ bool SwDoc::MoveParagraph( const SwPaM& rPam, long nOffset, bool bIsOutlMv )
nMoved = rPam.End()->nNode.GetIndex() - rPam.Start()->nNode.GetIndex() + 1;
}
+ (void) pLayout; // note: move will insert between aIdx-1 and aIdx
+ assert(!pLayout // check not moving *into* delete redline (caller's fault)
+ || aIdx.GetNode().GetRedlineMergeFlag() == SwNode::Merge::None
+ || aIdx.GetNode().GetRedlineMergeFlag() == SwNode::Merge::First);
getIDocumentContentOperations().MoveNodeRange( aMvRg, aIdx, SwMoveFlags::REDLINES );
if( pUndo )
diff --git a/sw/source/core/edit/ednumber.cxx b/sw/source/core/edit/ednumber.cxx
index d8a9d7c47b8d..41a06f6d42ba 100644
--- a/sw/source/core/edit/ednumber.cxx
+++ b/sw/source/core/edit/ednumber.cxx
@@ -460,6 +460,13 @@ bool SwEditShell::MoveNumParas( bool bUpperLower, bool bUpperLeft )
else
{
sal_uLong nStt = aPos.nNode.GetIndex(), nIdx = nStt - 1;
+
+ if (SwTextNode const*const pStt = aPos.nNode.GetNode().GetTextNode())
+ {
+ std::pair<SwTextNode *, SwTextNode *> nodes(
+ sw::GetFirstAndLastNode(*GetLayout(), *pStt));
+ nIdx = nodes.first->GetIndex() - 1;
+ }
while( nIdx && (
( pNd = GetDoc()->GetNodes()[ nIdx ])->IsSectionNode() ||
( pNd->IsEndNode() && pNd->StartOfSectionNode()->IsSectionNode())))
@@ -477,18 +484,38 @@ bool SwEditShell::MoveNumParas( bool bUpperLower, bool bUpperLeft )
pOrig == aCursor.GetNode().GetTextNode()->GetNumRule() )
{
sal_uLong nStt = aCursor.GetPoint()->nNode.GetIndex(), nIdx = nStt+1;
+ if (SwTextNode const*const pStt = aCursor.GetPoint()->nNode.GetNode().GetTextNode())
+ {
+ std::pair<SwTextNode *, SwTextNode *> nodes(
+ sw::GetFirstAndLastNode(*GetLayout(), *pStt));
+ nIdx = nodes.second->GetIndex() + 1;
+ }
while (nIdx < GetDoc()->GetNodes().Count()-1)
{
pNd = GetDoc()->GetNodes()[ nIdx ];
if (pNd->IsSectionNode() ||
- ( pNd->IsEndNode() && pNd->StartOfSectionNode()->IsSectionNode()) ||
- ( pNd->IsTextNode() && pOrig == static_cast<const SwTextNode*>(pNd)->GetNumRule() &&
- static_cast<const SwTextNode*>(pNd)->GetActualListLevel() > nUpperLevel ))
+ (pNd->IsEndNode() && pNd->StartOfSectionNode()->IsSectionNode()))
{
++nIdx;
}
+ else if (pNd->IsTextNode())
+ {
+ SwTextNode const*const pTextNode =
+ sw::GetParaPropsNode(*GetLayout(), SwNodeIndex(*pNd));
+ if (pOrig == pTextNode->GetNumRule()
+ && pTextNode->GetActualListLevel() > nUpperLevel)
+ {
+ std::pair<SwTextNode *, SwTextNode *> nodes(
+ sw::GetFirstAndLastNode(*GetLayout(), *pTextNode));
+ nIdx = nodes.second->GetIndex() + 1;
+ }
+ else
+ {
+ break;
+ }
+ }
// #i57856#
else
{
diff --git a/sw/source/core/inc/txtfrm.hxx b/sw/source/core/inc/txtfrm.hxx
index d74f5d4dd2d0..6870d721e5a0 100644
--- a/sw/source/core/inc/txtfrm.hxx
+++ b/sw/source/core/inc/txtfrm.hxx
@@ -103,6 +103,8 @@ bool FrameContainsNode(SwContentFrame const& rFrame, sal_uLong nNodeIndex);
bool IsParaPropsNode(SwRootFrame const& rLayout, SwTextNode const& rNode);
SwTextNode * GetParaPropsNode(SwRootFrame const& rLayout, SwNodeIndex const& rNode);
SwPosition GetParaPropsPos(SwRootFrame const& rLayout, SwPosition const& rPos);
+std::pair<SwTextNode *, SwTextNode *>
+GetFirstAndLastNode(SwRootFrame const& rLayout, SwNodeIndex const& rPos);
TextFrameIndex UpdateMergedParaForDelete(MergedPara & rMerged,
bool isRealDelete,
diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx
index 24d6b5fdb347..07e7b3cfaac0 100644
--- a/sw/source/core/text/txtfrm.cxx
+++ b/sw/source/core/text/txtfrm.cxx
@@ -354,6 +354,23 @@ namespace sw {
return pos;
}
+ std::pair<SwTextNode *, SwTextNode *>
+ GetFirstAndLastNode(SwRootFrame const& rLayout, SwNodeIndex const& rPos)
+ {
+ SwTextNode *const pTextNode(rPos.GetNode().GetTextNode());
+ if (pTextNode && rLayout.IsHideRedlines())
+ {
+ if (SwTextFrame const*const pFrame = static_cast<SwTextFrame*>(pTextNode->getLayoutFrame(&rLayout)))
+ {
+ if (sw::MergedPara const*const pMerged = pFrame->GetMergedPara())
+ {
+ return std::make_pair(pMerged->pFirstNode, const_cast<SwTextNode*>(pMerged->pLastNode));
+ }
+ }
+ }
+ return std::make_pair(pTextNode, pTextNode);
+ }
+
} // namespace sw
/// Switches width and height of the text frame
commit c2450f537d26aac3e0f22632a79afcca0fef8490
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Thu Oct 25 16:35:07 2018 +0200
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Fri Nov 2 18:51:14 2018 +0100
sw_redlinehide_3: update frames in SwDoc::MoveParagraph()
... for hidden mode.
Change-Id: I61f240ee7e4e3b61d53b07170be195c15fd679ae
diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx
index e3c93cb29828..00080bb8f9ec 100644
--- a/sw/source/core/doc/docnum.cxx
+++ b/sw/source/core/doc/docnum.cxx
@@ -2088,6 +2088,10 @@ bool SwDoc::MoveParagraph( const SwPaM& rPam, long nOffset, bool bIsOutlMv )
getIDocumentRedlineAccess().AppendRedline( pNewRedline, true );
+ aPam.GetBound().nContent.Assign(aPam.GetBound().nNode.GetNode().GetContentNode(), 0);
+ aPam.GetBound(false).nContent.Assign(aPam.GetBound(false).nNode.GetNode().GetContentNode(), 0);
+ sw::UpdateFramesForAddDeleteRedline(*this, aPam);
+
// Still NEEDS to be optimized!
getIDocumentRedlineAccess().SetRedlineFlags( eOld );
GetIDocumentUndoRedo().EndUndo( SwUndoId::END, nullptr );
commit 9c6c4a68ce9dd440ff949c261ec27eeaca5c04e8
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Thu Oct 25 16:32:04 2018 +0200
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Fri Nov 2 18:51:14 2018 +0100
sw_redlinehide_3: fix bad redlines in SwDoc::MoveParagraph()
Avoid creating a redline that ends on an EndNode (if the moved node is
the last in the body), and also ensure that the redline has valid
SwIndex nContent in its positions (because lcl_CheckPosition asserts
that).
Change-Id: I9b89d8cbc180453c24d9690ac937adb4512f0aeb
diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx
index 8cad779f5bc1..e3c93cb29828 100644
--- a/sw/source/core/doc/docnum.cxx
+++ b/sw/source/core/doc/docnum.cxx
@@ -1992,11 +1992,12 @@ bool SwDoc::MoveParagraph( const SwPaM& rPam, long nOffset, bool bIsOutlMv )
SwPosition aInsPos( aIdx );
aInsPos.nContent.Assign( aIdx.GetNode().GetContentNode(), 0 );
- SwPaM aPam( pStt->nNode, aMvRg.aEnd );
+ SwPaM aPam( pStt->nNode, 0, aMvRg.aEnd, 0 );
SwPaM& rOrigPam = const_cast<SwPaM&>(rPam);
rOrigPam.DeleteMark();
rOrigPam.GetPoint()->nNode = aIdx.GetIndex() - 1;
+ rOrigPam.GetPoint()->nContent.Assign( rOrigPam.GetContentNode(), 0 );
bool bDelLastPara = !aInsPos.nNode.GetNode().IsContentNode();
@@ -2057,6 +2058,14 @@ bool SwDoc::MoveParagraph( const SwPaM& rPam, long nOffset, bool bIsOutlMv )
++rOrigPam.GetPoint()->nNode;
rOrigPam.GetPoint()->nContent.Assign( rOrigPam.GetContentNode(), 0 );
+ assert(*aPam.GetMark() < *aPam.GetPoint());
+ if (aPam.GetPoint()->nNode.GetNode().IsEndNode())
+ { // ensure redline ends on content node
+ --aPam.GetPoint()->nNode;
+ assert(aPam.GetPoint()->nNode.GetNode().IsTextNode());
+ SwTextNode *const pNode(aPam.GetPoint()->nNode.GetNode().GetTextNode());
+ aPam.GetPoint()->nContent.Assign(pNode, pNode->Len());
+ }
RedlineFlags eOld = getIDocumentRedlineAccess().GetRedlineFlags();
GetDocumentRedlineManager().checkRedlining(eOld);
commit f3ebe729238548c30629ea27f7ca5e9689a8f9cc
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Thu Nov 1 19:27:34 2018 +0100
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Fri Nov 2 18:51:14 2018 +0100
sw_redlinehide_3: SwTextNode::AddToList ignore Undo-array nodes
The node is moved between undo-array and doc-array and each time
AddToList is called; it doesn't make sense to add a node that is
currently in undo-array to a list, and it leaks the mpNodeNum
because IsInList will return false because the SwNodeNum lacks a
parent, and it triggers some recently added asserts,
so just don't do that.
Change-Id: I75e51386806ce3845b7c61206020a59c092577fe
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index 97c89d2eae06..5cd2a795b2eb 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -4281,7 +4281,7 @@ void SwTextNode::AddToList()
}
SwList *const pList(FindList(this));
- if (pList)
+ if (pList && GetNodes().IsDocNodes()) // not for undo nodes
{
assert(!mpNodeNum);
mpNodeNum = new SwNodeNum(this, false);
commit fca0000ba4ada4f6c9bf0801387c9d06437d68fc
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Tue Oct 30 14:14:55 2018 +0100
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Fri Nov 2 18:51:14 2018 +0100
sw_redlinehide_3: adapt setters in SwEditShell too
SwEditShell::SetNumRule(), DelNumRules(), NumUpDown()
The selection could start in a different node than the props-node but
the operation with hidden redlines should apply to the props-node.
Change-Id: I307f6497c8fabdf8e12e352c6b9f2c4bf9101720
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index 8ccee0b48349..c4842f8af649 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -1022,6 +1022,7 @@ public:
OUString SetNumRule( const SwPaM&,
const SwNumRule&,
bool bCreateNewList,
+ SwRootFrame const* pLayout = nullptr,
const OUString& sContinuedListId = OUString(),
bool bSetItem = true,
const bool bResetIndentAttrs = false );
@@ -1107,12 +1108,12 @@ public:
bool NoNum( const SwPaM& );
// Delete, splitting of numbering list.
- void DelNumRules( const SwPaM& );
+ void DelNumRules(const SwPaM&, SwRootFrame const* pLayout = nullptr);
// Invalidates all numrules
void InvalidateNumRules();
- bool NumUpDown( const SwPaM&, bool bDown );
+ bool NumUpDown(const SwPaM&, bool bDown, SwRootFrame const* pLayout = nullptr);
/** Move selected paragraphes (not only numberings)
according to offsets. (if negative: go to doc start). */
diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index e52356822ed4..8dcec0a9fd15 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -4662,7 +4662,7 @@ bool DocumentContentOperationsManager::CopyImpl( SwPaM& rPam, SwPosition& rPos,
// #i86492# - use <SwDoc::SetNumRule(..)>, because it also handles the <ListId>
// Don't reset indent attributes, that would mean loss of direct
// formatting.
- pDoc->SetNumRule( *pCopyPam, *pNumRuleToPropagate, false,
+ pDoc->SetNumRule( *pCopyPam, *pNumRuleToPropagate, false, nullptr,
aListIdToPropagate, true, /*bResetIndentAttrs=*/false );
}
diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx
index 0fd8e653033f..8cad779f5bc1 100644
--- a/sw/source/core/doc/docnum.cxx
+++ b/sw/source/core/doc/docnum.cxx
@@ -84,6 +84,24 @@ namespace {
pDoc->ResetAttrs( rPam, false, aResetAttrsArray );
}
}
+
+ static void ExpandPamForParaPropsNodes(SwPaM& rPam, SwRootFrame const*const pLayout)
+ {
+ if (pLayout)
+ { // ensure that selection from the Shell includes the para-props node
+ // to which the attributes should be applied
+ if (rPam.GetPoint()->nNode.GetNode().IsTextNode())
+ {
+ rPam.GetPoint()->nNode = *sw::GetParaPropsNode(*pLayout, rPam.GetPoint()->nNode);
+ rPam.GetPoint()->nContent.Assign(rPam.GetPoint()->nNode.GetNode().GetContentNode(), 0);
+ }
+ if (rPam.GetMark()->nNode.GetNode().IsTextNode())
+ {
+ rPam.GetMark()->nNode = *sw::GetParaPropsNode(*pLayout, rPam.GetMark()->nNode);
+ rPam.GetMark()->nContent.Assign(rPam.GetMark()->nNode.GetNode().GetContentNode(), 0);
+ }
+ }
+ }
}
static inline sal_uInt8 GetUpperLvlChg( sal_uInt8 nCurLvl, sal_uInt8 nLevel, sal_uInt16 nMask )
@@ -181,9 +199,11 @@ bool SwDoc::OutlineUpDown(const SwPaM& rPam, short nOffset,
return false;
// calculate the range
+ SwPaM aPam(rPam, nullptr);
+ ExpandPamForParaPropsNodes(aPam, pLayout);
const SwOutlineNodes& rOutlNds = GetNodes().GetOutLineNds();
- const SwNodePtr pSttNd = &rPam.Start()->nNode.GetNode();
- const SwNodePtr pEndNd = &rPam.End()->nNode.GetNode();
+ const SwNodePtr pSttNd = &aPam.Start()->nNode.GetNode();
+ const SwNodePtr pEndNd = &aPam.End()->nNode.GetNode();
SwOutlineNodes::size_type nSttPos, nEndPos;
if( !rOutlNds.Seek_Entry( pSttNd, &nSttPos ) &&
@@ -370,7 +390,7 @@ bool SwDoc::OutlineUpDown(const SwPaM& rPam, short nOffset,
{
GetIDocumentUndoRedo().StartUndo(SwUndoId::OUTLINE_LR, nullptr);
GetIDocumentUndoRedo().AppendUndo(
- o3tl::make_unique<SwUndoOutlineLeftRight>( rPam, nOffset ) );
+ o3tl::make_unique<SwUndoOutlineLeftRight>(aPam, nOffset) );
}
// 2. Apply the new style to all Nodes
@@ -830,18 +850,22 @@ static void lcl_ChgNumRule( SwDoc& rDoc, const SwNumRule& rRule )
OUString SwDoc::SetNumRule( const SwPaM& rPam,
const SwNumRule& rRule,
const bool bCreateNewList,
+ SwRootFrame const*const pLayout,
const OUString& sContinuedListId,
bool bSetItem,
const bool bResetIndentAttrs )
{
OUString sListId;
+ SwPaM aPam(rPam, nullptr);
+ ExpandPamForParaPropsNodes(aPam, pLayout);
+
SwUndoInsNum * pUndo = nullptr;
if (GetIDocumentUndoRedo().DoesUndo())
{
// Start/End for attributes!
GetIDocumentUndoRedo().StartUndo( SwUndoId::INSNUM, nullptr );
- pUndo = new SwUndoInsNum( rPam, rRule );
+ pUndo = new SwUndoInsNum( aPam, rRule );
GetIDocumentUndoRedo().AppendUndo(std::unique_ptr<SwUndo>(pUndo));
}
@@ -892,16 +916,17 @@ OUString SwDoc::SetNumRule( const SwPaM& rPam,
}
if (!sListId.isEmpty())
{
- getIDocumentContentOperations().InsertPoolItem( rPam, SfxStringItem( RES_PARATR_LIST_ID, sListId ) );
+ getIDocumentContentOperations().InsertPoolItem(aPam, SfxStringItem(RES_PARATR_LIST_ID, sListId));
}
}
- if ( !rPam.HasMark() )
+ if (!aPam.HasMark())
{
- SwTextNode * pTextNd = rPam.GetPoint()->nNode.GetNode().GetTextNode();
+ SwTextNode * pTextNd = aPam.GetPoint()->nNode.GetNode().GetTextNode();
// robust code: consider case that the PaM doesn't denote a text node - e.g. it denotes a graphic node
if ( pTextNd != nullptr )
{
+ assert(!pLayout || sw::IsParaPropsNode(*pLayout, *pTextNd));
SwNumRule * pRule = pTextNd->GetNumRule();
if (pRule && pRule->GetName() == pNewOrChangedNumRule->GetName())
@@ -932,13 +957,13 @@ OUString SwDoc::SetNumRule( const SwPaM& rPam,
if ( bSetItem )
{
- getIDocumentContentOperations().InsertPoolItem( rPam, SwNumRuleItem( pNewOrChangedNumRule->GetName() ) );
+ getIDocumentContentOperations().InsertPoolItem(aPam, SwNumRuleItem(pNewOrChangedNumRule->GetName()));
}
if ( bResetIndentAttrs
&& pNewOrChangedNumRule->Get( 0 ).GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT )
{
- ::lcl_ResetIndentAttrs(this, rPam, RES_LR_SPACE);
+ ::lcl_ResetIndentAttrs(this, aPam, RES_LR_SPACE);
}
if (GetIDocumentUndoRedo().DoesUndo())
@@ -1254,6 +1279,7 @@ void SwDoc::MakeUniqueNumRules(const SwPaM & rPaM)
SetNumRule( aPam,
*aListStyleData.pReplaceNumRule,
aListStyleData.bCreateNewList,
+ nullptr,
aListStyleData.sListId );
if ( aListStyleData.bCreateNewList )
{
@@ -1291,19 +1317,17 @@ bool SwDoc::NoNum( const SwPaM& rPam )
return bRet;
}
-void SwDoc::DelNumRules( const SwPaM& rPam )
+void SwDoc::DelNumRules(const SwPaM& rPam, SwRootFrame const*const pLayout)
{
- sal_uLong nStt = rPam.GetPoint()->nNode.GetIndex(),
- nEnd = rPam.GetMark()->nNode.GetIndex();
- if( nStt > nEnd )
- {
- sal_uLong nTmp = nStt; nStt = nEnd; nEnd = nTmp;
- }
+ SwPaM aPam(rPam, nullptr);
+ ExpandPamForParaPropsNodes(aPam, pLayout);
+ sal_uLong nStt = aPam.Start()->nNode.GetIndex();
+ sal_uLong const nEnd = aPam.End()->nNode.GetIndex();
SwUndoDelNum* pUndo;
if (GetIDocumentUndoRedo().DoesUndo())
{
- pUndo = new SwUndoDelNum( rPam );
+ pUndo = new SwUndoDelNum( aPam );
GetIDocumentUndoRedo().AppendUndo(std::unique_ptr<SwUndo>(pUndo));
}
else
@@ -1316,6 +1340,10 @@ void SwDoc::DelNumRules( const SwPaM& rPam )
for( ; nStt <= nEnd; ++nStt )
{
SwTextNode* pTNd = GetNodes()[ nStt ]->GetTextNode();
+ if (pLayout && pTNd)
+ {
+ pTNd = sw::GetParaPropsNode(*pLayout, *pTNd);
+ }
SwNumRule* pNumRuleOfTextNode = pTNd ? pTNd->GetNumRule() : nullptr;
if ( pTNd && pNumRuleOfTextNode )
{
@@ -1651,14 +1679,12 @@ bool SwDoc::GotoPrevNum(SwPosition& rPos, SwRootFrame const*const pLayout,
return ::lcl_GotoNextPrevNum(rPos, false, bOverUpper, nullptr, nullptr, pLayout);
}
-bool SwDoc::NumUpDown( const SwPaM& rPam, bool bDown )
+bool SwDoc::NumUpDown(const SwPaM& rPam, bool bDown, SwRootFrame const*const pLayout)
{
- sal_uLong nStt = rPam.GetPoint()->nNode.GetIndex(),
- nEnd = rPam.GetMark()->nNode.GetIndex();
- if( nStt > nEnd )
- {
- sal_uLong nTmp = nStt; nStt = nEnd; nEnd = nTmp;
- }
+ SwPaM aPam(rPam, nullptr);
+ ExpandPamForParaPropsNodes(aPam, pLayout);
+ sal_uLong nStt = aPam.Start()->nNode.GetIndex();
+ sal_uLong const nEnd = aPam.End()->nNode.GetIndex();
// -> outline nodes are promoted or demoted differently
bool bOnlyOutline = true;
@@ -1669,6 +1695,10 @@ bool SwDoc::NumUpDown( const SwPaM& rPam, bool bDown )
if (pTextNd)
{
+ if (pLayout)
+ {
+ pTextNd = sw::GetParaPropsNode(*pLayout, *pTextNd);
+ }
SwNumRule * pRule = pTextNd->GetNumRule();
if (pRule)
@@ -1685,7 +1715,7 @@ bool SwDoc::NumUpDown( const SwPaM& rPam, bool bDown )
sal_Int8 nDiff = bDown ? 1 : -1;
if (bOnlyOutline)
- bRet = OutlineUpDown(rPam, nDiff);
+ bRet = OutlineUpDown(rPam, nDiff, pLayout);
else if (bOnlyNonOutline)
{
/* #i24560#
@@ -1700,6 +1730,11 @@ bool SwDoc::NumUpDown( const SwPaM& rPam, bool bDown )
// text node.
if ( pTNd )
{
+ if (pLayout)
+ {
+ pTNd = sw::GetParaPropsNode(*pLayout, *pTNd);
+ }
+
SwNumRule * pRule = pTNd->GetNumRule();
if (pRule)
@@ -1717,15 +1752,26 @@ bool SwDoc::NumUpDown( const SwPaM& rPam, bool bDown )
if (GetIDocumentUndoRedo().DoesUndo())
{
GetIDocumentUndoRedo().AppendUndo(
- o3tl::make_unique<SwUndoNumUpDown>(rPam, nDiff) );
+ o3tl::make_unique<SwUndoNumUpDown>(aPam, nDiff) );
}
+ SwTextNode* pPrev = nullptr;
for(sal_uLong nTmp = nStt; nTmp <= nEnd; ++nTmp )
{
SwTextNode* pTNd = GetNodes()[ nTmp ]->GetTextNode();
if( pTNd)
{
+ if (pLayout)
+ {
+ pTNd = sw::GetParaPropsNode(*pLayout, *pTNd);
+ if (pTNd == pPrev)
+ {
+ continue;
+ }
+ pPrev = pTNd;
+ }
+
SwNumRule * pRule = pTNd->GetNumRule();
if (pRule)
diff --git a/sw/source/core/edit/ednumber.cxx b/sw/source/core/edit/ednumber.cxx
index 0b2d5c57eccc..d8a9d7c47b8d 100644
--- a/sw/source/core/edit/ednumber.cxx
+++ b/sw/source/core/edit/ednumber.cxx
@@ -142,6 +142,7 @@ void SwEditShell::NoNum()
GetDoc()->GetIDocumentUndoRedo().EndUndo( SwUndoId::END, nullptr );
}
else
+ // sw_redlinehide: leave cursor as is, will be split at Point & apply to new node
bRet = GetDoc()->NoNum( *pCursor );
EndAllAction();
@@ -287,12 +288,12 @@ void SwEditShell::DelNumRules()
SwPaM aPam( *pCursor->GetPoint() );
for( size_t n = 0; n < aRangeArr.Count(); ++n )
{
- GetDoc()->DelNumRules( aRangeArr.SetPam( n, aPam ) );
+ GetDoc()->DelNumRules(aRangeArr.SetPam( n, aPam ), GetLayout());
}
GetDoc()->GetIDocumentUndoRedo().EndUndo( SwUndoId::END, nullptr );
}
else
- GetDoc()->DelNumRules( *pCursor );
+ GetDoc()->DelNumRules(*pCursor, GetLayout());
// Call AttrChangeNotify on the UI-side. Should actually be redundant but there was a bug once.
CallChgLnk();
@@ -312,14 +313,14 @@ void SwEditShell::NumUpDown( bool bDown )
bool bRet = true;
SwPaM* pCursor = GetCursor();
if( !pCursor->IsMultiSelection() )
- bRet = GetDoc()->NumUpDown( *pCursor, bDown );
+ bRet = GetDoc()->NumUpDown(*pCursor, bDown, GetLayout());
else
{
GetDoc()->GetIDocumentUndoRedo().StartUndo( SwUndoId::START, nullptr );
SwPamRanges aRangeArr( *pCursor );
SwPaM aPam( *pCursor->GetPoint() );
for( size_t n = 0; n < aRangeArr.Count(); ++n )
- bRet = bRet && GetDoc()->NumUpDown( aRangeArr.SetPam( n, aPam ), bDown );
+ bRet = bRet && GetDoc()->NumUpDown(aRangeArr.SetPam( n, aPam ), bDown, GetLayout());
GetDoc()->GetIDocumentUndoRedo().EndUndo( SwUndoId::END, nullptr );
}
GetDoc()->getIDocumentState().SetModified();
@@ -387,7 +388,7 @@ void SwEditShell::SetIndent(short nIndent, const SwPosition & rPos)
// change numbering rule - changed numbering rule is not applied at <aPaM>
SwPaM aPaM(pos);
- GetDoc()->SetNumRule( aPaM, aRule, false, OUString(), false );
+ GetDoc()->SetNumRule(aPaM, aRule, false, GetLayout(), OUString(), false);
}
EndAllAction();
@@ -513,7 +514,7 @@ bool SwEditShell::MoveNumParas( bool bUpperLower, bool bUpperLeft )
else if( (bUpperLeft ? nUpperLevel : nLowerLevel+1) < MAXLEVEL )
{
aCursor.Move( fnMoveBackward, GoInNode );
- bRet = GetDoc()->NumUpDown( aCursor, !bUpperLeft );
+ bRet = GetDoc()->NumUpDown(aCursor, !bUpperLeft, GetLayout());
}
}
@@ -759,7 +760,7 @@ void SwEditShell::SetCurNumRule( const SwNumRule& rRule,
{
aRangeArr.SetPam( n, aPam );
OUString sListId = GetDoc()->SetNumRule( aPam, rRule,
- bCreateNewList, sContinuedListId,
+ bCreateNewList, GetLayout(), sContinuedListId,
true, bResetIndentAttrs );
//tdf#87548 On creating a new list for a multi-selection only
@@ -776,7 +777,7 @@ void SwEditShell::SetCurNumRule( const SwNumRule& rRule,
else
{
GetDoc()->SetNumRule( *pCursor, rRule,
- bCreateNewList, rContinuedListId,
+ bCreateNewList, GetLayout(), rContinuedListId,
true, bResetIndentAttrs );
GetDoc()->SetCounted( *pCursor, true );
}
commit 4cc50171656fea1e9986d62617700d932ccb1d7b
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Tue Oct 30 11:11:02 2018 +0100
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Fri Nov 2 18:51:14 2018 +0100
sw_redlinehide_3: adapt SwEditShell::GetPaMAttr/GetPaMTextFormatColl
These are Num-relevant.
Change-Id: Ic07dc2574590713357aec484051f52bfe792eabb
diff --git a/sw/source/core/edit/edattr.cxx b/sw/source/core/edit/edattr.cxx
index afe1b0baffb2..579150a64000 100644
--- a/sw/source/core/edit/edattr.cxx
+++ b/sw/source/core/edit/edattr.cxx
@@ -79,7 +79,8 @@ bool SwEditShell::GetPaMAttr( SwPaM* pPaM, SfxItemSet& rSet,
// the attributes to get are those from the numbering format.
if (rCurrentPaM.IsInFrontOfLabel())
{
- SwTextNode * pTextNd = rCurrentPaM.GetPoint()->nNode.GetNode().GetTextNode();
+ SwTextNode const*const pTextNd = sw::GetParaPropsNode(*GetLayout(),
+ rCurrentPaM.GetPoint()->nNode);
if (pTextNd)
{
@@ -268,8 +269,9 @@ SwTextFormatColl* SwEditShell::GetPaMTextFormatColl( SwPaM* pPaM ) const
if( pNd->IsTextNode() )
{
+ SwTextNode *const pTextNode(sw::GetParaPropsNode(*GetLayout(), SwNodeIndex(*pNd)));
// if it's a text node get its named paragraph format
- SwTextFormatColl* pFormat = pNd->GetTextNode()->GetTextColl();
+ SwTextFormatColl *const pFormat = pTextNode->GetTextColl();
// if the paragraph format exist stop here and return it
if( pFormat != nullptr )
commit 30e63cba8cb10ad478e6caffc701762f979c4b8f
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Mon Oct 29 19:23:42 2018 +0100
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Fri Nov 2 18:51:14 2018 +0100
sw_redlinehide_3: adapt SwWrtShell::NumOrBulletOn/Off
Change-Id: I5cd89bc0595f96125d58a05e01d9e33b965621fe
diff --git a/sw/source/uibase/wrtsh/wrtsh1.cxx b/sw/source/uibase/wrtsh/wrtsh1.cxx
index 9ddfd9fe39e8..c0181c34402d 100644
--- a/sw/source/uibase/wrtsh/wrtsh1.cxx
+++ b/sw/source/uibase/wrtsh/wrtsh1.cxx
@@ -56,6 +56,7 @@
#include <fmtftn.hxx>
#include <fmthdft.hxx>
#include <fmtpdsc.hxx>
+#include <txtfrm.hxx>
#include <wdocsh.hxx>
#include <basesh.hxx>
#include <swmodule.hxx>
@@ -1026,8 +1027,8 @@ void SwWrtShell::NumOrBulletOn(bool bNum)
// check, if text node at current cursor positioned is counted.
// If not, let it been counted. Then it has to be checked,
// of the outline numbering has to be activated or continued.
- SwTextNode* pTextNode =
- GetCursor()->GetPoint()->nNode.GetNode().GetTextNode();
+ SwTextNode const*const pTextNode = sw::GetParaPropsNode(
+ *GetLayout(), GetCursor()->GetPoint()->nNode);
if ( pTextNode && !pTextNode->IsCountedInList() )
{
// check, if numbering of the outline level of the paragraph
@@ -1133,7 +1134,8 @@ void SwWrtShell::NumOrBulletOn(bool bNum)
// do not change found numbering/bullet rule, if it should only be continued.
if ( !bContinueFoundNumRule )
{
- SwTextNode * pTextNode = GetCursor()->GetPoint()->nNode.GetNode().GetTextNode();
+ SwTextNode const*const pTextNode = sw::GetParaPropsNode(
+ *GetLayout(), GetCursor()->GetPoint()->nNode);
if (pTextNode)
{
@@ -1197,7 +1199,8 @@ void SwWrtShell::NumOrBulletOn(bool bNum)
pChrFormat = GetCharFormatFromPool( RES_POOLCHR_BUL_LEVEL );
}
- const SwTextNode* pTextNode = GetCursor()->GetPoint()->nNode.GetNode().GetTextNode();
+ const SwTextNode *const pTextNode = sw::GetParaPropsNode(*GetLayout(),
+ GetCursor()->GetPoint()->nNode);
const SwTwips nWidthOfTabs = pTextNode
? pTextNode->GetWidthOfLeadingTabs()
: 0;
@@ -1306,7 +1309,7 @@ void SwWrtShell::NumOrBulletOff()
SwNumRule aNumRule(*pCurNumRule);
SwTextNode * pTextNode =
- GetCursor()->GetPoint()->nNode.GetNode().GetTextNode();
+ sw::GetParaPropsNode(*GetLayout(), GetCursor()->GetPoint()->nNode);
if (pTextNode)
{
@@ -1413,7 +1416,7 @@ SelectionType SwWrtShell::GetSelectionType() const
if ( pNumRule )
{
const SwTextNode* pTextNd =
- GetCursor()->GetPoint()->nNode.GetNode().GetTextNode();
+ sw::GetParaPropsNode(*GetLayout(), GetCursor()->GetPoint()->nNode);
if ( pTextNd && pTextNd->IsInList() )
{
commit 60c6a66683631c75c3b6bc04011988ba4377c973
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Mon Oct 29 18:54:56 2018 +0100
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Fri Nov 2 18:51:14 2018 +0100
sw_redlinehide_3: adapt SwFEShell::GetNumRuleNodeAtPos()/IsNumLabel()
Change-Id: Ifd65b7b294cd7bc2a93c9e574712dce200bdfcf3
diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx
index 05890b2e1803..a00a35ec6f77 100644
--- a/sw/source/core/crsr/crstrvl.cxx
+++ b/sw/source/core/crsr/crstrvl.cxx
@@ -1304,7 +1304,7 @@ bool SwCursorShell::GetContentAtPos( const Point& rPt,
&& IsAttrAtPos::NumLabel & rContentAtPos.eContentAtPos)
{
bRet = aTmpState.m_bInNumPortion;
- rContentAtPos.aFnd.pNode = pTextNd;
+ rContentAtPos.aFnd.pNode = sw::GetParaPropsNode(*GetLayout(), aPos.nNode);
Size aSizeLogic(aTmpState.m_nInNumPortionOffset, 0);
Size aSizePixel = GetWin()->LogicToPixel(aSizeLogic);
commit eb05fa876f0b1320fd5e71bd97c41d1468da5981
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Mon Oct 29 15:58:25 2018 +0100
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Fri Nov 2 18:51:14 2018 +0100
remove this nonsense, see SwPam::Delete
Change-Id: Ic8425801e51219627fd37e0b63161590a61b2857
diff --git a/sw/source/core/edit/ednumber.cxx b/sw/source/core/edit/ednumber.cxx
index 6c6f3fa47a46..0b2d5c57eccc 100644
--- a/sw/source/core/edit/ednumber.cxx
+++ b/sw/source/core/edit/ednumber.cxx
@@ -398,12 +398,6 @@ bool SwEditShell::MoveParagraph( long nOffset )
StartAllAction();
SwPaM *pCursor = GetCursor();
- if( !pCursor->HasMark() )
- {
- // Ensures that Bound1 and Bound2 are in the same Node
- pCursor->SetMark();
- pCursor->DeleteMark();
- }
bool bRet = GetDoc()->MoveParagraph( *pCursor, nOffset );
commit 9b1f7f4474cf636de73913149b40fa5a9efadcc9
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Fri Oct 26 17:22:48 2018 +0200
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Fri Nov 2 18:51:14 2018 +0100
sw_redlinehide_3: adapt even more SwEditShell Num
IsNoNum(), GetNumLevel(), IsNumRuleStart(), GetNodeNumStart()
Change-Id: I38e592835f3e6e3e7faa901e5b6533b2222fb35a
diff --git a/sw/source/core/edit/ednumber.cxx b/sw/source/core/edit/ednumber.cxx
index 3174cbe3e7b4..6c6f3fa47a46 100644
--- a/sw/source/core/edit/ednumber.cxx
+++ b/sw/source/core/edit/ednumber.cxx
@@ -667,7 +667,7 @@ bool SwEditShell::IsNoNum( bool bChkStart ) const
&& !HasSelection()
&& ( !bChkStart || IsSttPara() ) )
{
- const SwTextNode* pTextNd = GetCursor()->GetNode().GetTextNode();
+ const SwTextNode* pTextNd = sw::GetParaPropsNode(*GetLayout(), GetCursor()->GetPoint()->nNode);
if ( pTextNd != nullptr )
{
bResult = !pTextNd->IsCountedInList();
@@ -683,7 +683,7 @@ sal_uInt8 SwEditShell::GetNumLevel() const
sal_uInt8 nLevel = MAXLEVEL;
SwPaM* pCursor = GetCursor();
- const SwTextNode* pTextNd = pCursor->GetNode().GetTextNode();
+ const SwTextNode *const pTextNd = sw::GetParaPropsNode(*GetLayout(), pCursor->GetPoint()->nNode);
OSL_ENSURE( pTextNd, "GetNumLevel() without text node" );
if ( pTextNd == nullptr )
@@ -839,7 +839,7 @@ void SwEditShell::SetNumRuleStart( bool bFlag, SwPaM* pPaM )
bool SwEditShell::IsNumRuleStart( SwPaM* pPaM ) const
{
SwPaM* pCursor = pPaM ? pPaM : GetCursor( );
- const SwTextNode* pTextNd = pCursor->GetNode().GetTextNode();
+ const SwTextNode *const pTextNd = sw::GetParaPropsNode(*GetLayout(), pCursor->GetPoint()->nNode);
return pTextNd && pTextNd->IsListRestart();
}
@@ -872,7 +872,7 @@ void SwEditShell::SetNodeNumStart( sal_uInt16 nStt )
sal_uInt16 SwEditShell::GetNodeNumStart( SwPaM* pPaM ) const
{
SwPaM* pCursor = pPaM ? pPaM : GetCursor();
- const SwTextNode* pTextNd = pCursor->GetNode().GetTextNode();
+ const SwTextNode *const pTextNd = sw::GetParaPropsNode(*GetLayout(), pCursor->GetPoint()->nNode);
// correction: check, if list restart value is set at text node and
// use new method <SwTextNode::GetAttrListRestartValue()>.
// return USHRT_MAX, if no list restart value is found.
commit 3df6bd03fb6c00813101e092b88660090d25f7d8
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Fri Oct 26 17:20:17 2018 +0200
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Fri Nov 2 18:51:14 2018 +0100
sw_redlinehide_3: adapt more SwEditShell Num
ReplaceNumRule(), SetNumRuleStart(), SetNodeNumStart()
Change-Id: I7e58d477b02e0e242ce3c12eca0071856533debf
diff --git a/sw/source/core/edit/ednumber.cxx b/sw/source/core/edit/ednumber.cxx
index b917cfb2024c..3174cbe3e7b4 100644
--- a/sw/source/core/edit/ednumber.cxx
+++ b/sw/source/core/edit/ednumber.cxx
@@ -651,7 +651,8 @@ bool SwEditShell::NumOrNoNum(
&& ( !bChkStart || IsSttPara() ) )
{
StartAllAction();
- bRet = GetDoc()->NumOrNoNum( GetCursor()->GetPoint()->nNode, !bNumOn );
+ SwPosition const pos(sw::GetParaPropsPos(*GetLayout(), *GetCursor()->GetPoint()));
+ bRet = GetDoc()->NumOrNoNum(pos.nNode, !bNumOn);
EndAllAction();
}
return bRet;
@@ -805,7 +806,8 @@ void SwEditShell::ChgNumRuleFormats( const SwNumRule& rRule )
void SwEditShell::ReplaceNumRule( const OUString& rOldRule, const OUString& rNewRule )
{
StartAllAction();
- GetDoc()->ReplaceNumRule( *GetCursor()->GetPoint(), rOldRule, rNewRule );
+ SwPosition const pos(sw::GetParaPropsPos(*GetLayout(), *GetCursor()->GetPoint()));
+ GetDoc()->ReplaceNumRule( pos, rOldRule, rNewRule );
EndAllAction();
}
@@ -819,11 +821,17 @@ void SwEditShell::SetNumRuleStart( bool bFlag, SwPaM* pPaM )
SwPamRanges aRangeArr( *pCursor );
SwPaM aPam( *pCursor->GetPoint() );
for( size_t n = 0; n < aRangeArr.Count(); ++n )
- GetDoc()->SetNumRuleStart( *aRangeArr.SetPam( n, aPam ).GetPoint(), bFlag );
+ {
+ SwPosition const pos(sw::GetParaPropsPos(*GetLayout(), *aRangeArr.SetPam( n, aPam ).GetPoint()));
+ GetDoc()->SetNumRuleStart( pos, bFlag );
+ }
GetDoc()->GetIDocumentUndoRedo().EndUndo( SwUndoId::END, nullptr );
}
else
- GetDoc()->SetNumRuleStart( *pCursor->GetPoint(), bFlag );
+ {
+ SwPosition const pos(sw::GetParaPropsPos(*GetLayout(), *GetCursor()->GetPoint()));
+ GetDoc()->SetNumRuleStart(pos, bFlag);
+ }
EndAllAction();
}
@@ -846,11 +854,17 @@ void SwEditShell::SetNodeNumStart( sal_uInt16 nStt )
SwPamRanges aRangeArr( *pCursor );
SwPaM aPam( *pCursor->GetPoint() );
for( size_t n = 0; n < aRangeArr.Count(); ++n )
- GetDoc()->SetNodeNumStart( *aRangeArr.SetPam( n, aPam ).GetPoint(), nStt );
+ {
+ SwPosition const pos(sw::GetParaPropsPos(*GetLayout(), *aRangeArr.SetPam( n, aPam ).GetPoint()));
+ GetDoc()->SetNodeNumStart( pos, nStt );
+ }
GetDoc()->GetIDocumentUndoRedo().EndUndo( SwUndoId::END, nullptr );
}
else
- GetDoc()->SetNodeNumStart( *pCursor->GetPoint(), nStt );
+ {
+ SwPosition const pos(sw::GetParaPropsPos(*GetLayout(), *pCursor->GetPoint()));
+ GetDoc()->SetNodeNumStart( pos, nStt );
+ }
EndAllAction();
}
diff --git a/sw/source/core/inc/txtfrm.hxx b/sw/source/core/inc/txtfrm.hxx
index bac7372cd27e..d74f5d4dd2d0 100644
--- a/sw/source/core/inc/txtfrm.hxx
+++ b/sw/source/core/inc/txtfrm.hxx
@@ -102,6 +102,7 @@ std::unique_ptr<sw::MergedPara> CheckParaRedlineMerge(SwTextFrame & rFrame, SwTe
bool FrameContainsNode(SwContentFrame const& rFrame, sal_uLong nNodeIndex);
bool IsParaPropsNode(SwRootFrame const& rLayout, SwTextNode const& rNode);
SwTextNode * GetParaPropsNode(SwRootFrame const& rLayout, SwNodeIndex const& rNode);
+SwPosition GetParaPropsPos(SwRootFrame const& rLayout, SwPosition const& rPos);
TextFrameIndex UpdateMergedParaForDelete(MergedPara & rMerged,
bool isRealDelete,
diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx
index e1f4beaefc3d..24d6b5fdb347 100644
--- a/sw/source/core/text/txtfrm.cxx
+++ b/sw/source/core/text/txtfrm.cxx
@@ -341,6 +341,19 @@ namespace sw {
}
}
+ SwPosition
+ GetParaPropsPos(SwRootFrame const& rLayout, SwPosition const& rPos)
+ {
+ SwPosition pos(rPos);
+ SwTextNode const*const pNode(pos.nNode.GetNode().GetTextNode());
+ if (pNode)
+ {
+ pos.nNode = *sw::GetParaPropsNode(rLayout, *pNode);
+ pos.nContent.Assign(pos.nNode.GetNode().GetContentNode(), 0);
+ }
+ return pos;
+ }
+
} // namespace sw
/// Switches width and height of the text frame
commit 0c6baa9bd26e36c4e66a256b0006e601f86cb298
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Fri Oct 26 17:12:14 2018 +0200
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Fri Nov 2 18:51:14 2018 +0100
sw_redlinehide_3: adapt SwEditShell::SearchNumRule()
Change-Id: Ic7d07a1e4920d5776a8fec3893cd2cd2aff2c6fc
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index 8072372e78e7..8ccee0b48349 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -1100,6 +1100,7 @@ public:
const bool bOutline,
int nNonEmptyAllowed,
OUString& sListId,
+ SwRootFrame const* pLayout,
const bool bInvestigateStartNode = false );
// Paragraphs without numbering but with indents.
diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index 85cef08f4698..e52356822ed4 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -4337,11 +4337,11 @@ bool DocumentContentOperationsManager::CopyImpl( SwPaM& rPam, SwPosition& rPos,
// Keep also the <ListId> value for possible propagation.
OUString aListIdToPropagate;
const SwNumRule* pNumRuleToPropagate =
- pDoc->SearchNumRule( rPos, false, true, false, 0, aListIdToPropagate, true );
+ pDoc->SearchNumRule( rPos, false, true, false, 0, aListIdToPropagate, nullptr, true );
if ( !pNumRuleToPropagate )
{
pNumRuleToPropagate =
- pDoc->SearchNumRule( rPos, false, false, false, 0, aListIdToPropagate, true );
+ pDoc->SearchNumRule( rPos, false, false, false, 0, aListIdToPropagate, nullptr, true );
}
// #i86492#
// Do not propagate previous found list, if
diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx
index 5e490a902c19..0fd8e653033f 100644
--- a/sw/source/core/doc/docnum.cxx
+++ b/sw/source/core/doc/docnum.cxx
@@ -1236,7 +1236,7 @@ void SwDoc::MakeUniqueNumRules(const SwPaM & rPaM)
const_cast<SwNumRule *>
(SearchNumRule( aPos, false, pCNd->HasNumber(),
false, 0,
- aListStyleData.sListId, true ));
+ aListStyleData.sListId, nullptr, true ));
}
if ( aListStyleData.pReplaceNumRule == nullptr )
@@ -1571,10 +1571,15 @@ const SwNumRule * SwDoc::SearchNumRule(const SwPosition & rPos,
const bool bOutline,
int nNonEmptyAllowed,
OUString& sListId,
+ SwRootFrame const* pLayout,
const bool bInvestigateStartNode)
{
const SwNumRule * pResult = nullptr;
SwTextNode * pTextNd = rPos.nNode.GetNode().GetTextNode();
+ if (pLayout)
+ {
+ pTextNd = sw::GetParaPropsNode(*pLayout, rPos.nNode);
+ }
SwNode * pStartFromNode = pTextNd;
if (pTextNd)
@@ -1588,9 +1593,9 @@ const SwNumRule * SwDoc::SearchNumRule(const SwPosition & rPos,
if ( !bInvestigateStartNode )
{
if (bForward)
- ++aIdx;
+ lcl_GotoNextLayoutTextFrame(aIdx, pLayout);
else
- --aIdx;
+ lcl_GotoPrevLayoutTextFrame(aIdx, pLayout);
}
if (aIdx.GetNode().IsTextNode())
@@ -1626,9 +1631,9 @@ const SwNumRule * SwDoc::SearchNumRule(const SwPosition & rPos,
if ( bInvestigateStartNode )
{
if (bForward)
- ++aIdx;
+ lcl_GotoNextLayoutTextFrame(aIdx, pLayout);
else
- --aIdx;
+ lcl_GotoPrevLayoutTextFrame(aIdx, pLayout);
}
pNode = &aIdx.GetNode();
diff --git a/sw/source/core/edit/ednumber.cxx b/sw/source/core/edit/ednumber.cxx
index d3466dfe30ac..b917cfb2024c 100644
--- a/sw/source/core/edit/ednumber.cxx
+++ b/sw/source/core/edit/ednumber.cxx
@@ -874,7 +874,7 @@ const SwNumRule * SwEditShell::SearchNumRule( const bool bNum,
{
return GetDoc()->SearchNumRule( *(GetCursor()->Start()),
false/*bForward*/, bNum, false/*bOutline*/, -1/*nNonEmptyAllowe*/,
- sListId );
+ sListId, GetLayout() );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/uibase/wrtsh/wrtsh1.cxx b/sw/source/uibase/wrtsh/wrtsh1.cxx
index f97a0daf62ad..9ddfd9fe39e8 100644
--- a/sw/source/uibase/wrtsh/wrtsh1.cxx
+++ b/sw/source/uibase/wrtsh/wrtsh1.cxx
@@ -1122,7 +1122,7 @@ void SwWrtShell::NumOrBulletOn(bool bNum)
{
pNumRule = GetDoc()->SearchNumRule( *GetCursor()->GetPoint(),
false, bNum, false, 0,
- sContinuedListId );
+ sContinuedListId, GetLayout() );
bContinueFoundNumRule = pNumRule != nullptr;
}
commit 4276f07309b75df6da7288c3da93221c4e912c54
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Fri Oct 26 14:39:23 2018 +0200
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Fri Nov 2 18:51:14 2018 +0100
sw_redlinehide_3: adapt SwDoc::GotoNextNum()/GotoPrevNum()
... and callers in SwCursorShell / SwEditShell.
Change-Id: Iffe4ca7893b97df8bd07f25c9e0e1dc908011e3f
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index 4ef4f0e51a29..8072372e78e7 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -1065,9 +1065,11 @@ public:
const OUString& rNewRule );
// Goto next/previous on same level.
- static bool GotoNextNum( SwPosition&, bool bOverUpper = true,
+ static bool GotoNextNum( SwPosition&, SwRootFrame const* pLayout,
+ bool bOverUpper = true,
sal_uInt8* pUpper = nullptr, sal_uInt8* pLower = nullptr );
- static bool GotoPrevNum( SwPosition&, bool bOverUpper = true );
+ static bool GotoPrevNum( SwPosition&, SwRootFrame const* pLayout,
+ bool bOverUpper = true );
/** Searches for a text node with a numbering rule.
diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx
index 9b8f2e6c6bf3..05890b2e1803 100644
--- a/sw/source/core/crsr/crstrvl.cxx
+++ b/sw/source/core/crsr/crstrvl.cxx
@@ -112,14 +112,14 @@ void SwCursorShell::MoveCursorToNum()
/// go to next/previous point on the same level
void SwCursorShell::GotoNextNum()
{
- if (!SwDoc::GotoNextNum( *m_pCurrentCursor->GetPoint() ))
+ if (!SwDoc::GotoNextNum(*m_pCurrentCursor->GetPoint(), GetLayout()))
return;
MoveCursorToNum();
}
void SwCursorShell::GotoPrevNum()
{
- if (!SwDoc::GotoPrevNum( *m_pCurrentCursor->GetPoint() ))
+ if (!SwDoc::GotoPrevNum(*m_pCurrentCursor->GetPoint(), GetLayout()))
return;
MoveCursorToNum();
}
diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx
index 2f6f145c337e..5e490a902c19 100644
--- a/sw/source/core/doc/docnum.cxx
+++ b/sw/source/core/doc/docnum.cxx
@@ -42,6 +42,7 @@
#include <docary.hxx>
#include <mvsave.hxx>
#include <txtfrm.hxx>
+#include <rootfrm.hxx>
#include <pamtyp.hxx>
#include <redline.hxx>
#include <strings.hrc>
@@ -1407,10 +1408,47 @@ static bool lcl_IsValidPrevNextNumNode( const SwNodeIndex& rIdx )
return bRet;
}
+static void
+lcl_GotoPrevLayoutTextFrame(SwNodeIndex & rIndex, SwRootFrame const*const pLayout)
+{
+ if (pLayout && pLayout->IsHideRedlines()
+ && rIndex.GetNode().IsTextNode()
+ && rIndex.GetNode().GetRedlineMergeFlag() != SwNode::Merge::None)
+ {
+ rIndex = *static_cast<SwTextFrame*>(rIndex.GetNode().GetTextNode()->getLayoutFrame(pLayout))->GetMergedPara()->pFirstNode;
+ }
+ --rIndex;
+ if (pLayout && rIndex.GetNode().IsTextNode())
+ {
+ rIndex = *sw::GetParaPropsNode(*pLayout, *rIndex.GetNode().GetTextNode());
+ }
+}
+
+static void
+lcl_GotoNextLayoutTextFrame(SwNodeIndex & rIndex, SwRootFrame const*const pLayout)
+{
+ if (pLayout && pLayout->IsHideRedlines()
+ && rIndex.GetNode().IsTextNode()
+ && rIndex.GetNode().GetRedlineMergeFlag() != SwNode::Merge::None)
+ {
+ rIndex = *static_cast<SwTextFrame*>(rIndex.GetNode().GetTextNode()->getLayoutFrame(pLayout))->GetMergedPara()->pLastNode;
+ }
+ ++rIndex;
+ if (pLayout && rIndex.GetNode().IsTextNode())
+ {
+ rIndex = *sw::GetParaPropsNode(*pLayout, *rIndex.GetNode().GetTextNode());
+ }
+}
+
static bool lcl_GotoNextPrevNum( SwPosition& rPos, bool bNext,
- bool bOverUpper, sal_uInt8* pUpper, sal_uInt8* pLower )
+ bool bOverUpper, sal_uInt8* pUpper, sal_uInt8* pLower,
+ SwRootFrame const*const pLayout)
{
const SwTextNode* pNd = rPos.nNode.GetNode().GetTextNode();
+ if (pNd && pLayout)
+ {
+ pNd = sw::GetParaPropsNode(*pLayout, *pNd);
+ }
if( !pNd || nullptr == pNd->GetNumRule() )
return false;
@@ -1422,7 +1460,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 {
- --aIdx;
+ lcl_GotoPrevLayoutTextFrame(aIdx, pLayout);
if( aIdx.GetNode().IsTextNode() )
{
pNd = aIdx.GetNode().GetTextNode();
@@ -1454,12 +1492,12 @@ static bool lcl_GotoNextPrevNum( SwPosition& rPos, bool bNext,
const SwTextNode* pLast;
if( bNext )
{
- ++aIdx;
+ lcl_GotoNextLayoutTextFrame(aIdx, pLayout);
pLast = pNd;
}
else
{
- --aIdx;
+ lcl_GotoPrevLayoutTextFrame(aIdx, pLayout);
pLast = nullptr;
}
@@ -1490,9 +1528,9 @@ static bool lcl_GotoNextPrevNum( SwPosition& rPos, bool bNext,
break;
if( bNext )
- ++aIdx;
+ lcl_GotoNextLayoutTextFrame(aIdx, pLayout);
else
- --aIdx;
+ lcl_GotoPrevLayoutTextFrame(aIdx, pLayout);
}
if( !bRet && !bOverUpper && pLast ) // do not iterate over higher numbers, but still to the end
@@ -1521,10 +1559,10 @@ static bool lcl_GotoNextPrevNum( SwPosition& rPos, bool bNext,
return bRet;
}
-bool SwDoc::GotoNextNum( SwPosition& rPos, bool bOverUpper,
- sal_uInt8* pUpper, sal_uInt8* pLower )
+bool SwDoc::GotoNextNum(SwPosition& rPos, SwRootFrame const*const pLayout,
+ bool bOverUpper, sal_uInt8* pUpper, sal_uInt8* pLower)
{
- return ::lcl_GotoNextPrevNum( rPos, true, bOverUpper, pUpper, pLower );
+ return ::lcl_GotoNextPrevNum(rPos, true, bOverUpper, pUpper, pLower, pLayout);
}
const SwNumRule * SwDoc::SearchNumRule(const SwPosition & rPos,
@@ -1602,9 +1640,10 @@ const SwNumRule * SwDoc::SearchNumRule(const SwPosition & rPos,
return pResult;
}
-bool SwDoc::GotoPrevNum( SwPosition& rPos, bool bOverUpper )
+bool SwDoc::GotoPrevNum(SwPosition& rPos, SwRootFrame const*const pLayout,
+ bool bOverUpper)
{
- return ::lcl_GotoNextPrevNum( rPos, false, bOverUpper, nullptr, nullptr );
+ return ::lcl_GotoNextPrevNum(rPos, false, bOverUpper, nullptr, nullptr, pLayout);
}
bool SwDoc::NumUpDown( const SwPaM& rPam, bool bDown )
diff --git a/sw/source/core/edit/ednumber.cxx b/sw/source/core/edit/ednumber.cxx
index a342824ced0b..d3466dfe30ac 100644
--- a/sw/source/core/edit/ednumber.cxx
+++ b/sw/source/core/edit/ednumber.cxx
@@ -430,7 +430,7 @@ void SwEditShell::GetCurrentOutlineLevels( sal_uInt8& rUpper, sal_uInt8& rLower
aCursor.SetMark();
if( pCursor->HasMark() )
*aCursor.GetPoint() = *pCursor->End();
- SwDoc::GotoNextNum( *aCursor.GetPoint(), false, &rUpper, &rLower );
+ SwDoc::GotoNextNum(*aCursor.GetPoint(), GetLayout(), false, &rUpper, &rLower);
}
bool SwEditShell::MoveNumParas( bool bUpperLower, bool bUpperLeft )
@@ -447,7 +447,7 @@ bool SwEditShell::MoveNumParas( bool bUpperLower, bool bUpperLeft )
bool bRet = false;
sal_uInt8 nUpperLevel, nLowerLevel;
- if( SwDoc::GotoNextNum( *aCursor.GetPoint(), false,
+ if (SwDoc::GotoNextNum( *aCursor.GetPoint(), GetLayout(), false,
&nUpperLevel, &nLowerLevel ))
{
if( bUpperLower )
@@ -459,7 +459,7 @@ bool SwEditShell::MoveNumParas( bool bUpperLower, bool bUpperLeft )
if( bUpperLeft ) // move up
{
SwPosition aPos( *aCursor.GetMark() );
- if( SwDoc::GotoPrevNum( aPos, false ) )
+ if (SwDoc::GotoPrevNum( aPos, GetLayout(), false ))
nOffset = aPos.nNode.GetIndex() -
aCursor.GetMark()->nNode.GetIndex();
else
@@ -475,7 +475,9 @@ bool SwEditShell::MoveNumParas( bool bUpperLower, bool bUpperLeft )
}
else // move down
{
- const SwNumRule* pOrig = aCursor.GetNode(false).GetTextNode()->GetNumRule();
+ assert(!aCursor.GetNode().IsTextNode()
+ || sw::IsParaPropsNode(*GetLayout(), *aCursor.GetNode().GetTextNode()));
+ const SwNumRule* pOrig = sw::GetParaPropsNode(*GetLayout(), *aCursor.GetNode(false).GetTextNode())->GetNumRule();
if( aCursor.GetNode().IsTextNode() &&
pOrig == aCursor.GetNode().GetTextNode()->GetNumRule() )
{
commit c049a4508eef5e1013fd8a287d04e16211c4c615
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Fri Oct 26 12:48:46 2018 +0200
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Fri Nov 2 18:51:14 2018 +0100
sw_redlinehide_3: SwEditShell::HasNumber, HasBullet etc.
Change-Id: I6db8421a52f7a9bece5ebb95b377dd3bb0a39af4
diff --git a/sw/source/core/edit/ednumber.cxx b/sw/source/core/edit/ednumber.cxx
index 4b5de9e62540..a342824ced0b 100644
--- a/sw/source/core/edit/ednumber.cxx
+++ b/sw/source/core/edit/ednumber.cxx
@@ -150,8 +150,7 @@ void SwEditShell::NoNum()
bool SwEditShell::SelectionHasNumber() const
{
bool bResult = HasNumber();
- const SwTextNode * pTextNd =
- GetCursor()->GetPoint()->nNode.GetNode().GetTextNode();
+ const SwTextNode * pTextNd = sw::GetParaPropsNode(*GetLayout(), GetCursor()->GetPoint()->nNode);
if (!bResult && pTextNd && pTextNd->Len()==0 && !pTextNd->GetNumRule()) {
SwPamRanges aRangeArr( *GetCursor() );
SwPaM aPam( *GetCursor()->GetPoint() );
@@ -168,6 +167,10 @@ bool SwEditShell::SelectionHasNumber() const
for (sal_uInt32 nPos = nStt; nPos<=nEnd; nPos++)
{
pTextNd = mxDoc->GetNodes()[nPos]->GetTextNode();
+ if (pTextNd)
+ {
+ pTextNd = sw::GetParaPropsNode(*GetLayout(), SwNodeIndex(*pTextNd));
+ }
if (pTextNd && pTextNd->Len()!=0)
{
bResult = pTextNd->HasNumber();
@@ -196,8 +199,7 @@ bool SwEditShell::SelectionHasNumber() const
bool SwEditShell::SelectionHasBullet() const
{
bool bResult = HasBullet();
- const SwTextNode * pTextNd =
- GetCursor()->GetPoint()->nNode.GetNode().GetTextNode();
+ const SwTextNode * pTextNd = sw::GetParaPropsNode(*GetLayout(), GetCursor()->GetPoint()->nNode);
if (!bResult && pTextNd && pTextNd->Len()==0 && !pTextNd->GetNumRule()) {
SwPamRanges aRangeArr( *GetCursor() );
SwPaM aPam( *GetCursor()->GetPoint() );
@@ -214,6 +216,10 @@ bool SwEditShell::SelectionHasBullet() const
for (sal_uInt32 nPos = nStt; nPos<=nEnd; nPos++)
{
pTextNd = mxDoc->GetNodes()[nPos]->GetTextNode();
+ if (pTextNd)
+ {
+ pTextNd = sw::GetParaPropsNode(*GetLayout(), SwNodeIndex(*pTextNd));
+ }
if (pTextNd && pTextNd->Len()!=0)
{
bResult = pTextNd->HasBullet();
@@ -235,8 +241,7 @@ bool SwEditShell::HasNumber() const
{
bool bResult = false;
- const SwTextNode * pTextNd =
- GetCursor()->GetPoint()->nNode.GetNode().GetTextNode();
+ const SwTextNode *const pTextNd = sw::GetParaPropsNode(*GetLayout(), GetCursor()->GetPoint()->nNode);
if (pTextNd)
{
@@ -258,8 +263,7 @@ bool SwEditShell::HasBullet() const
{
bool bResult = false;
- const SwTextNode * pTextNd =
- GetCursor()->GetPoint()->nNode.GetNode().GetTextNode();
+ const SwTextNode *const pTextNd = sw::GetParaPropsNode(*GetLayout(), GetCursor()->GetPoint()->nNode);
if (pTextNd)
{
commit 66c5ae960834b7343761bbd86baeb558b5c32965
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Fri Oct 26 11:58:58 2018 +0200
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Fri Nov 2 18:51:14 2018 +0100
sw_redlinehide_3: SwEditShell::IsFirstNumRuleAtPos()
Change-Id: Ic6bd9adc909d7c325f5e450fd9e53a15f68e7a63
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index 5acdb10dd8a1..4ef4f0e51a29 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -1539,7 +1539,7 @@ public:
*/
static OUString GetPaMDescr(const SwPaM & rPaM);
- static bool IsFirstOfNumRuleAtPos( const SwPosition & rPos );
+ static bool IsFirstOfNumRuleAtPos(const SwPosition & rPos, SwRootFrame const* pLayout);
// access methods for XForms model(s)
diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx
index 0f74cc51b7a8..2f6f145c337e 100644
--- a/sw/source/core/doc/docnum.cxx
+++ b/sw/source/core/doc/docnum.cxx
@@ -2314,13 +2314,18 @@ void SwDoc::MarkListLevel( const OUString& sListId,
}
}
-bool SwDoc::IsFirstOfNumRuleAtPos( const SwPosition & rPos )
+bool SwDoc::IsFirstOfNumRuleAtPos(const SwPosition & rPos,
+ SwRootFrame const*const pLayout)
{
bool bResult = false;
const SwTextNode* pTextNode = rPos.nNode.GetNode().GetTextNode();
if ( pTextNode != nullptr )
{
+ if (pLayout && !sw::IsParaPropsNode(*pLayout, *pTextNode))
+ {
+ pTextNode = static_cast<SwTextFrame*>(pTextNode->getLayoutFrame(pLayout))->GetMergedPara()->pParaPropsNode;
+ }
bResult = pTextNode->IsFirstOfNumRule();
}
diff --git a/sw/source/core/edit/ednumber.cxx b/sw/source/core/edit/ednumber.cxx
index c01fa8365385..4b5de9e62540 100644
--- a/sw/source/core/edit/ednumber.cxx
+++ b/sw/source/core/edit/ednumber.cxx
@@ -331,7 +331,7 @@ void SwEditShell::NumUpDown( bool bDown )
bool SwEditShell::IsFirstOfNumRuleAtCursorPos() const
{
- return SwDoc::IsFirstOfNumRuleAtPos( *GetCursor()->GetPoint() );
+ return SwDoc::IsFirstOfNumRuleAtPos(*GetCursor()->GetPoint(), GetLayout());
}
// -> #i23725#, #i90078#
commit c058758688afbfc7a239e63f9455a0f0a6250c85
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Fri Oct 26 11:29:16 2018 +0200
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Fri Nov 2 18:51:14 2018 +0100
sw_redlinehide_3: adapt SwEditShell callers of SwDoc::GetNumRuleAtPos
Change-Id: I192a9743300a77bc463319789064abd89d046b0a
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index 2670ff98bd03..5acdb10dd8a1 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 b9426acafe27..0f74cc51b7a8 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;
More information about the Libreoffice-commits
mailing list