[Libreoffice-commits] core.git: Branch 'private/mst/sw_redlinehide_3' - 22 commits - sw/inc sw/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Fri Nov 2 10:22:10 UTC 2018
Rebased ref, commits from common ancestor:
commit 1acfed567006f32fe95ec092325e3b5d59da6b98
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 11:03:38 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 0cea28c9e20b200f0ac7e2ef5004acc612c7f0ea
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 11:03:38 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 4ca782e48ec2..260f437affc1 100644
--- a/sw/source/core/doc/docnum.cxx
+++ b/sw/source/core/doc/docnum.cxx
@@ -2144,6 +2144,41 @@ bool SwDoc::MoveParagraphImpl(const SwPaM& rPam, long const nOffset,
}
getIDocumentContentOperations().CopyRange( aPam, aInsPos, /*bCopyAll=*/false, /*bCheckPos=*/true );
+
+#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 to get easy constant index arithmetic
+ 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);
+ pam.GetPoint()->nNode += aInsPos.nNode.GetIndex() - aPam.End()->nNode.GetIndex();
+ pam.GetPoint()->nContent.Assign(pam.GetPoint()->nNode.GetNode().GetContentNode(), pam.GetPoint()->nContent.GetIndex());
+ pam.GetMark()->nNode += aInsPos.nNode.GetIndex() - aPam.End()->nNode.GetIndex();
+ 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(nRedlines == getIDocumentRedlineAccess().GetRedlineTable().size());
+ }
+ }
if( bDelLastPara )
{
// We need to remove the last empty Node again
commit b5d0708a2db863ac8b5d5d8a40cfca2405e1114c
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 11:03:42 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..42b6b8869156 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -1118,6 +1118,7 @@ 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 MoveParagraphImpl(const 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..4ca782e48ec2 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,123 @@ 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(const SwPaM& rPam, long nOffset, bool const bIsOutlMv)
+{
+ std::shared_ptr<SwUnoCursor> const pCursor(CreateUnoCursor(*rPam.GetMark()));
+ if (rPam.HasMark())
+ {
+ pCursor->SetMark();
+ *pCursor->GetPoint() = *rPam.GetPoint();
+ }
+ // 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 != &pCursor->Start()->nNode.GetNode())
+ {
+ assert(nodes.second);
+#if 0
+// correct inwards (if anything)
+// inwards if its' not a default-1-or--1 ? how to detect that?
+ if (nOffset < 0)
+ {
+ nOffset -= pCursor->Start()->nNode.GetIndex() - nodes.first->GetIndex();
+ }
+#endif
+ if (!pCursor->HasMark())
+ {
+ pCursor->SetMark();
+ }
+ assert(nodes.first->GetIndex() < pCursor->Start()->nNode.GetIndex());
+ pCursor->Start()->nNode = *nodes.first;
+ pCursor->Start()->nContent.Assign(nodes.first, 0);
+ }
+ nodes = sw::GetFirstAndLastNode(*pLayout, rPam.End()->nNode);
+ if (nodes.second && nodes.second != &pCursor->End()->nNode.GetNode())
+ {
+ assert(nodes.first);
+#if 0
+ if (nOffset > 0)
+ {
+ nOffset += nodes.second->GetIndex() - pCursor->End()->nNode.GetIndex();
+ }
+#endif
+ if (!pCursor->HasMark())
+ {
+ pCursor->SetMark();
+ }
+ assert(pCursor->End()->nNode.GetIndex() < nodes.second->GetIndex());
+ pCursor->End()->nNode = *nodes.second;
+ pCursor->End()->nContent.Assign(nodes.second, 0);
+ }
+
+ if (nOffset > 0)
+ { // sw_redlinehide: avoid moving into delete redline, skip forward
+ if (GetNodes().GetEndOfContent().GetIndex() <= pCursor->End()->nNode.GetIndex() + nOffset)
+ {
+ return false; // can't move
+ }
+ SwNode const* pNode(GetNodes()[pCursor->End()->nNode.GetIndex() + nOffset + 1]);
+ if ( pNode->GetRedlineMergeFlag() != SwNode::Merge::None
+ && pNode->GetRedlineMergeFlag() != SwNode::Merge::First)
+ {
+ for ( ; ; ++nOffset)
+ {
+ pNode = GetNodes()[pCursor->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 (pCursor->Start()->nNode.GetIndex() + nOffset < 1)
+ {
+ return false; // can't move
+ }
+ SwNode const* pNode(GetNodes()[pCursor->Start()->nNode.GetIndex() + nOffset]);
+ if ( pNode->GetRedlineMergeFlag() != SwNode::Merge::None
+ && pNode->GetRedlineMergeFlag() != SwNode::Merge::First)
+ {
+ for ( ; ; --nOffset)
+ {
+ pNode = GetNodes()[pCursor->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(*pCursor, nOffset, bIsOutlMv, pLayout);
+}
+
+bool SwDoc::MoveParagraphImpl(const SwPaM& rPam, long const nOffset,
+ bool const bIsOutlMv, SwRootFrame const*const pLayout)
{
const SwPosition *pStt = rPam.Start(), *pEnd = rPam.End();
@@ -2123,6 +2240,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 cf14f279b2e9..77e2f74eba27 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 81cb422972b17602bf2ae1dfc2391e4ed49cab69
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 11:03:38 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 0a8e00661ef7aab7e704e93f1802e1cb18e2a5ec
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 11:03:38 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 ced662b6b20efac2165d1b940996e73be0ce2584
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 11:03:38 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 6597f7109ec6..cf14f279b2e9 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());
}
}
@@ -758,7 +759,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
@@ -775,7 +776,7 @@ void SwEditShell::SetCurNumRule( const SwNumRule& rRule,
else
{
GetDoc()->SetNumRule( *pCursor, rRule,
- bCreateNewList, rContinuedListId,
+ bCreateNewList, GetLayout(), rContinuedListId,
true, bResetIndentAttrs );
GetDoc()->SetCounted( *pCursor, true );
}
commit f8b983d52118211d81efdd859f9b5751bb1afeb6
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 11:03:38 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 df1bd429363640bc6f7a45d24f8f30a9f5b1d29f
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 11:03:38 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 947087b83313ae172fb31a3237e22cc7f58a203f
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 11:03:38 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 289c353d2552ab78e1b0901367fb596187d8f84f
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 11:03:38 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 de507fa6aea3..6597f7109ec6 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 f3b2c5986d7b70c04201e890bdf67298c2ecd6fb
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 11:03:38 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 58ccd7c7b73e..de507fa6aea3 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 )
@@ -838,7 +838,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();
}
@@ -871,7 +871,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 d4346bf011f21bd96e9261eb9a4e499d6d8f7b2c
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 11:03:38 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 272a83e8122c..58ccd7c7b73e 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;
@@ -804,7 +805,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();
}
@@ -818,11 +820,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();
}
@@ -845,11 +853,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 6778741f75c2402566c7c784c35742e8b0f83957
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 11:03:38 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 9068ba1bce49..272a83e8122c 100644
--- a/sw/source/core/edit/ednumber.cxx
+++ b/sw/source/core/edit/ednumber.cxx
@@ -873,7 +873,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 33316b1af687b18c7e5e30a937165b966ec10fb6
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 11:03:38 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 f6394b08d808..9068ba1bce49 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 b2804e89bff53b65020f95fabbad5172b6d859e8
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 11:03:38 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 28345c98147d..f6394b08d808 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 927ceac41cc00a73c57ad2b796e1810ffcd5105d
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 11:03:38 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 7bb980301f30..28345c98147d 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 c8b8e2af219973ecc0ae18bea1c2b716770f61c6
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 11:03:38 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..7bb980301f30 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,7 @@ sal_uInt8 SwEditShell::GetNumLevel() const
const SwNumRule* SwEditShell::GetNumRuleAtCurrCursorPos() const
{
- return SwDoc::GetNumRuleAtPos( *GetCursor()->GetPoint() );
+ return SwDoc::GetNumRuleAtPos( *GetCursor()->GetPoint(), GetLayout() );
}
const SwNumRule* SwEditShell::GetNumRuleAtCurrentSelection() const
@@ -710,7 +711,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;
commit d7970e30d5198edc64810e43b340f041ff78bb4e
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Thu Oct 25 13:25:59 2018 +0200
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Fri Nov 2 10:58:35 2018 +0100
sw_redlinehide_3: adapt SwTextNode::IsNumbered() & callers
Answer depends on layout.
Change-Id: Ibc7bddfa1b04630ddcfcfa429fbb507347073ce2
diff --git a/sw/inc/ndtxt.hxx b/sw/inc/ndtxt.hxx
index 05bdb53b2f1f..d00b280abeb3 100644
--- a/sw/inc/ndtxt.hxx
+++ b/sw/inc/ndtxt.hxx
@@ -528,7 +528,7 @@ public:
@retval true This node is numbered.
@retval false else
*/
- bool IsNumbered() const;
+ bool IsNumbered(SwRootFrame const* pLayout = nullptr) const;
/** Returns if this text node has a marked label.
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index 42febd5f6271..d170b3b4049d 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -392,7 +392,7 @@ void SwCursorShell::UpdateMarkedListLevel()
if ( pTextNd )
{
- if ( !pTextNd->IsNumbered() )
+ if (!pTextNd->IsNumbered(GetLayout()))
{
m_pCurrentCursor->SetInFrontOfLabel_( false );
MarkListLevel( OUString(), 0 );
diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx
index dca1ea5f0f09..108aa9efca97 100644
--- a/sw/source/core/layout/wsfrm.cxx
+++ b/sw/source/core/layout/wsfrm.cxx
@@ -4345,7 +4345,7 @@ static void UnHideRedlines(SwRootFrame & rLayout,
pFrame->Broadcast(SfxHint()); // notify SwAccessibleParagraph
}
// all nodes, not just merged ones! it may be in the same list as
- if (rTextNode.IsNumbered()) // a preceding merged one...
+ if (rTextNode.IsNumbered(nullptr)) // a preceding merged one...
{ // notify frames so they reformat numbering portions
rTextNode.NumRuleChgd();
}
diff --git a/sw/source/core/text/txtfld.cxx b/sw/source/core/text/txtfld.cxx
index e7fd1223fe95..52b6c57e6c10 100644
--- a/sw/source/core/text/txtfld.cxx
+++ b/sw/source/core/text/txtfld.cxx
@@ -479,7 +479,9 @@ SwNumberPortion *SwTextFormatter::NewNumberPortion( SwTextFormatInfo &rInf ) con
const SwNumRule* pNumRule = pTextNd->GetNumRule();
// Has a "valid" number?
- if( pTextNd->IsNumbered() && pTextNd->IsCountedInList())
+ // sw_redlinehide: check that pParaPropsNode is the correct one
+ assert(pTextNd->IsNumbered(m_pFrame->getRootFrame()) == pTextNd->IsNumbered(nullptr));
+ if (pTextNd->IsNumbered(m_pFrame->getRootFrame()) && pTextNd->IsCountedInList())
{
int nLevel = pTextNd->GetActualListLevel();
diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx
index b2a9d9eec32e..e1f4beaefc3d 100644
--- a/sw/source/core/text/txtfrm.cxx
+++ b/sw/source/core/text/txtfrm.cxx
@@ -3281,8 +3281,10 @@ void SwTextFrame::CalcAdditionalFirstLineOffset()
mnAdditionalFirstLineOffset = 0;
const SwTextNode* pTextNode( GetTextNodeForParaProps() );
- if ( pTextNode && pTextNode->IsNumbered() && pTextNode->IsCountedInList() &&
- pTextNode->GetNumRule() )
+ // sw_redlinehide: check that pParaPropsNode is the correct one
+ assert(pTextNode->IsNumbered(getRootFrame()) == pTextNode->IsNumbered(nullptr));
+ if (pTextNode && pTextNode->IsNumbered(getRootFrame()) &&
+ pTextNode->IsCountedInList() && pTextNode->GetNumRule())
{
int nListLevel = pTextNode->GetActualListLevel();
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index 4caf635d7d33..97c89d2eae06 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -2897,9 +2897,9 @@ void SwTextNode::NumRuleChgd()
}
// -> #i27615#
-bool SwTextNode::IsNumbered() const
+bool SwTextNode::IsNumbered(SwRootFrame const*const pLayout) const
{
- SwNumRule* pRule = GetNum() ? GetNum()->GetNumRule() : nullptr;
+ SwNumRule* pRule = GetNum(pLayout) ? GetNum(pLayout)->GetNumRule() : nullptr;
return pRule && IsCountedInList();
}
diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx
index 17ff254b49b7..b465975a385a 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -1871,7 +1871,7 @@ bool SwContentTree::FillTransferData( TransferDataContainer& rTransfer,
const SwNumRule* pOutlRule = pWrtShell->GetOutlineNumRule();
const SwTextNode* pTextNd =
pWrtShell->getIDocumentOutlineNodesAccess()->getOutlineNode(nPos);
- if( pTextNd && pOutlRule && pTextNd->IsNumbered())
+ if (pTextNd && pOutlRule && pTextNd->IsNumbered(pWrtShell->GetLayout()))
{
SwNumberTree::tNumberVector aNumVector =
pTextNd->GetNumberVector(pWrtShell->GetLayout());
commit da79efa13f5120addb0561f101c9f7f9c87ebd11
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Thu Oct 25 13:22:23 2018 +0200
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Fri Nov 2 10:58:35 2018 +0100
sw_redlinehide_3: call UpdateAllFootnote() in UnHideRedlines()
... if the numbering is per-chapter, because only with a hidden layout
can the footnotes be numbered properly per-hidden-chapter.
Change-Id: I32732b7b8eec0adcbf4349aac3c87492802e38b6
diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx
index a8486ef619ad..dca1ea5f0f09 100644
--- a/sw/source/core/layout/wsfrm.cxx
+++ b/sw/source/core/layout/wsfrm.cxx
@@ -4488,8 +4488,13 @@ void SwRootFrame::SetHideRedlines(bool const bHideRedlines)
}
}
+ SwFootnoteIdxs & rFootnotes(rDoc.GetFootnoteIdxs());
+ if (rDoc.GetFootnoteInfo().eNum == FTNNUM_CHAPTER)
+ {
+ // sadly determining which node is outline node requires hidden layout
+ rFootnotes.UpdateAllFootnote();
+ }
// invalidate all footnotes to reformat their numbers
- SwFootnoteIdxs const& rFootnotes(rDoc.GetFootnoteIdxs());
for (SwTextFootnote *const pFootnote : rFootnotes)
{
SwFormatFootnote const& rFootnote(pFootnote->GetFootnote());
commit 32fb79e4c4a4942c2bab1827aed31b5df06f7141
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Thu Oct 25 12:54:54 2018 +0200
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Fri Nov 2 10:58:35 2018 +0100
sw_redlinehide_3: adapt SwFootnoteIdxs::UpdateFootnote()
... and UpdateAllFootnote() in the FTNNUM_CHAPTER case; the former is
particularly nasty since the hidden-chapter may effectively start
before and/or end after the "normal" chapter.
Change-Id: Ifd73dec28011c47c8b23319cb7d3bf16c84f0cfd
diff --git a/sw/source/core/doc/ftnidx.cxx b/sw/source/core/doc/ftnidx.cxx
index d4aad90404bc..85c35ecc51e7 100644
--- a/sw/source/core/doc/ftnidx.cxx
+++ b/sw/source/core/doc/ftnidx.cxx
@@ -30,6 +30,7 @@
#include <section.hxx>
#include <fmtftntx.hxx>
#include <rootfrm.hxx>
+#include <txtfrm.hxx>
static bool IsFootnoteDeleted(IDocumentRedlineAccess const& rIDRA,
SwTextFootnote const& rTextFootnote)
@@ -69,9 +70,23 @@ void SwFootnoteIdxs::UpdateFootnote( const SwNodeIndex& rStt )
// separately. For Endnotes we only have per-document numbering.
if( FTNNUM_CHAPTER == rFootnoteInfo.eNum )
{
+ SwRootFrame const* pLayout(nullptr);
+ std::set<SwRootFrame*> layouts = pDoc->GetAllLayouts();
+ // sw_redlinehide: here we need to know if there's *any* layout with
+ // IsHideRedlines(), because then the hidden-numbers have to be updated
+ for (SwRootFrame const* pTmp : layouts)
+ {
+ if (pTmp->IsHideRedlines())
+ {
+ pLayout = pTmp;
+ }
+ }
+
const SwOutlineNodes& rOutlNds = pDoc->GetNodes().GetOutLineNds();
- const SwNode* pCapStt = &pDoc->GetNodes().GetEndOfExtras();
- sal_uLong nCapEnd = pDoc->GetNodes().GetEndOfContent().GetIndex();
+ const SwNode *pChapterStartHidden(&pDoc->GetNodes().GetEndOfExtras());
+ sal_uLong nChapterStart(pChapterStartHidden->GetIndex());
+ sal_uLong nChapterEnd(pDoc->GetNodes().GetEndOfContent().GetIndex());
+ sal_uLong nChapterEndHidden(nChapterEnd);
if( !rOutlNds.empty() )
{
// Find the Chapter's start, which contains rStt
@@ -81,20 +96,37 @@ void SwFootnoteIdxs::UpdateFootnote( const SwNodeIndex& rStt )
if( rOutlNds[ n ]->GetIndex() > rStt.GetIndex() )
break; // found it!
else if ( rOutlNds[ n ]->GetTextNode()->GetAttrOutlineLevel() == 1 )
- pCapStt = rOutlNds[ n ]; // Beginning of a new Chapter
+ {
+ nChapterStart = rOutlNds[ n ]->GetIndex();
+ if (!pLayout || sw::IsParaPropsNode(*pLayout, *rOutlNds[n]->GetTextNode()))
+ {
+ pChapterStartHidden = rOutlNds[ n ];
+ }
+ }
// now find the end of the range
for( ; n < rOutlNds.size(); ++n )
if ( rOutlNds[ n ]->GetTextNode()->GetAttrOutlineLevel() == 1 )
{
- nCapEnd = rOutlNds[ n ]->GetIndex(); // End of the found Chapter
+ nChapterEnd = rOutlNds[ n ]->GetIndex();
break;
}
+
+ // continue to find end of hidden-chapter
+ for ( ; n < rOutlNds.size(); ++n)
+ {
+ if (rOutlNds[n]->GetTextNode()->GetAttrOutlineLevel() == 1
+ && (!pLayout || sw::IsParaPropsNode(*pLayout, *rOutlNds[n]->GetTextNode())))
+ {
+ nChapterEndHidden = rOutlNds[n]->GetIndex();
+ break;
+ }
+ }
}
size_t nPos = 0;
size_t nFootnoteNo = 1;
size_t nFootnoteNoHidden = 1;
- if( SeekEntry( *pCapStt, &nPos ) && nPos )
+ if (SeekEntry( *pChapterStartHidden, &nPos ) && nPos)
{
// Step forward until the Index is not the same anymore
const SwNode* pCmpNd = &rStt.GetNode();
@@ -118,7 +150,8 @@ void SwFootnoteIdxs::UpdateFootnote( const SwNodeIndex& rStt )
for( ; nPos < size(); ++nPos )
{
pTextFootnote = (*this)[ nPos ];
- if( pTextFootnote->GetTextNode().GetIndex() >= nCapEnd )
+ sal_uLong const nNode(pTextFootnote->GetTextNode().GetIndex());
+ if (nChapterEndHidden <= nNode)
break;
const SwFormatFootnote &rFootnote = pTextFootnote->GetFootnote();
@@ -126,10 +159,15 @@ void SwFootnoteIdxs::UpdateFootnote( const SwNodeIndex& rStt )
!SwUpdFootnoteEndNtAtEnd::FindSectNdWithEndAttr( *pTextFootnote ))
{
pTextFootnote->SetNumber(
- rFootnoteInfo.nFootnoteOffset + nFootnoteNo,
+ (nChapterStart <= nNode && nNode < nChapterEnd)
+ ? rFootnoteInfo.nFootnoteOffset + nFootnoteNo
+ : rFootnote.GetNumber(),
rFootnoteInfo.nFootnoteOffset + nFootnoteNoHidden,
rFootnote.GetNumStr() );
- ++nFootnoteNo;
+ if (nChapterStart <= nNode && nNode < nChapterEnd)
+ {
+ ++nFootnoteNo;
+ }
if (!IsFootnoteDeleted(rIDRA, *pTextFootnote))
{
++nFootnoteNoHidden;
@@ -234,12 +272,22 @@ void SwFootnoteIdxs::UpdateAllFootnote()
SwUpdFootnoteEndNtAtEnd aNumArr;
- SwRootFrame* pTmpRoot = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
+ SwRootFrame const* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
std::set<SwRootFrame*> aAllLayouts = pDoc->GetAllLayouts();
// For normal Footnotes per-chapter and per-document numbering are treated separately.
// For Endnotes we only have document-wise numbering.
if( FTNNUM_CHAPTER == rFootnoteInfo.eNum )
{
+ // sw_redlinehide: here we need to know if there's *any* layout with
+ // IsHideRedlines(), because then the hidden-numbers have to be updated
+ for (SwRootFrame const* pTmp : aAllLayouts)
+ {
+ if (pTmp->IsHideRedlines())
+ {
+ pLayout = pTmp;
+ }
+ }
+
const SwOutlineNodes& rOutlNds = pDoc->GetNodes().GetOutLineNds();
sal_uInt16 nNo = 1; // Number for the Footnotes
sal_uInt16 nNoNo = 1;
@@ -274,7 +322,11 @@ void SwFootnoteIdxs::UpdateAllFootnote()
if( nFootnoteIdx >= size() )
break; // ok, everything is updated
nNo = 1;
- nNoNo = 1;
+ // sw_redlinehide: this means the numbers are layout dependent in chapter case
+ if (!pLayout || sw::IsParaPropsNode(*pLayout, *rOutlNds[ n ]->GetTextNode()))
+ {
+ nNoNo = 1;
+ }
}
}
@@ -343,7 +395,7 @@ void SwFootnoteIdxs::UpdateAllFootnote()
}
}
- if( pTmpRoot && FTNNUM_PAGE == rFootnoteInfo.eNum )
+ if (pLayout && FTNNUM_PAGE == rFootnoteInfo.eNum)
for( auto aLayout : aAllLayouts )
aLayout->UpdateFootnoteNums();
}
commit a782f5882614806a541a47a5ace8a7cd93cd1d79
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Thu Oct 25 12:53:12 2018 +0200
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Fri Nov 2 10:58:35 2018 +0100
sw_redlinehide_3: filter outline nodes in SwListShell::Execute()
Change-Id: I31677211d0aa5637e0cce0034e29b9db724c791b
diff --git a/sw/source/uibase/shells/listsh.cxx b/sw/source/uibase/shells/listsh.cxx
index 220b1f3b0abf..4ed58717c1f9 100644
--- a/sw/source/uibase/shells/listsh.cxx
+++ b/sw/source/uibase/shells/listsh.cxx
@@ -80,8 +80,11 @@ static void lcl_OutlineUpDownWithSubPoints( SwWrtShell& rSh, bool bMove, bool bU
{
// Move down with subpoints:
while ( nActEndPos < pIDoc->getOutlineNodesCount() &&
- pIDoc->getOutlineLevel( nActEndPos ) > nActLevel )
+ (!pIDoc->isOutlineInLayout(nActEndPos, *rSh.GetLayout())
+ || nActLevel < pIDoc->getOutlineLevel(nActEndPos)))
+ {
++nActEndPos;
+ }
if ( nActEndPos < pIDoc->getOutlineNodesCount() )
{
@@ -90,8 +93,11 @@ static void lcl_OutlineUpDownWithSubPoints( SwWrtShell& rSh, bool bMove, bool bU
--nActEndPos;
SwOutlineNodes::size_type nDest = nActEndPos + 2;
while ( nDest < pIDoc->getOutlineNodesCount() &&
- pIDoc->getOutlineLevel( nDest ) > nActLevel )
+ (!pIDoc->isOutlineInLayout(nDest, *rSh.GetLayout())
+ || nActLevel < pIDoc->getOutlineLevel(nDest)))
+ {
++nDest;
+ }
nDir = nDest - 1 - nActEndPos;
}
@@ -101,10 +107,14 @@ static void lcl_OutlineUpDownWithSubPoints( SwWrtShell& rSh, bool bMove, bool bU
// Move up with subpoints:
if ( nActPos > 0 )
{
- --nActEndPos;
+ nActEndPos = nActPos;
SwOutlineNodes::size_type nDest = nActPos - 1;
- while ( nDest > 0 && pIDoc->getOutlineLevel( nDest ) > nActLevel )
+ while (nDest > 0 &&
+ (!pIDoc->isOutlineInLayout(nDest, *rSh.GetLayout())
+ || nActLevel < pIDoc->getOutlineLevel(nDest)))
+ {
--nDest;
+ }
nDir = nDest - nActPos;
}
commit c10103faddc7092c74d764d40cbb4b0ec38ce587
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Thu Oct 25 12:48:17 2018 +0200
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Fri Nov 2 10:58:35 2018 +0100
sw_redlinehide_3: adapt some SwEditShell functions
SwEditShell::IsOutlineCopyable(), IsOutlineMovable(),
IsProtectedOutlinePara(), GetCurrentParaOutlineLevel() all filter.
Change-Id: Ie5fb181e21d4bf606482bec9cb108dbd70f4209e
diff --git a/sw/source/core/edit/ednumber.cxx b/sw/source/core/edit/ednumber.cxx
index 7734fd03c563..c795e645b374 100644
--- a/sw/source/core/edit/ednumber.cxx
+++ b/sw/source/core/edit/ednumber.cxx
@@ -24,6 +24,7 @@
#include <IDocumentUndoRedo.hxx>
#include <IDocumentState.hxx>
#include <ndtxt.hxx>
+#include <txtfrm.hxx>
#include <paratr.hxx>
#include <swundo.hxx>
#include <numrule.hxx>
@@ -411,8 +412,8 @@ int SwEditShell::GetCurrentParaOutlineLevel( ) const
int nLevel = 0;
SwPaM* pCursor = GetCursor();
- const SwTextNode* pTextNd = pCursor->GetNode().GetTextNode();
- if( pTextNd )
+ const SwTextNode *const pTextNd = sw::GetParaPropsNode(*GetLayout(), pCursor->GetPoint()->nNode);
+ if (pTextNd)
nLevel = pTextNd->GetAttrOutlineLevel();
return nLevel;
}
@@ -570,6 +571,11 @@ bool SwEditShell::IsProtectedOutlinePara() const
{
SwNodePtr pTmpNd = rOutlNd[ nPos ];
+ if (!sw::IsParaPropsNode(*GetLayout(), *pTmpNd->GetTextNode()))
+ {
+ continue;
+ }
+
int nTmpLvl = pTmpNd->GetTextNode()->GetAttrOutlineLevel();
OSL_ENSURE( nTmpLvl >= 0 && nTmpLvl <= MAXLEVEL,
@@ -606,23 +612,25 @@ bool SwEditShell::IsProtectedOutlinePara() const
* 2) outline must not be within table
* 3) if bCopy is set, outline must not be write protected
*/
-static bool lcl_IsOutlineMoveAndCopyable( const SwDoc* pDoc, SwOutlineNodes::size_type nIdx, bool bCopy )
+static bool lcl_IsOutlineMoveAndCopyable(SwEditShell const& rShell,
+ SwOutlineNodes::size_type const nIdx, bool const bCopy)
{
- const SwNodes& rNds = pDoc->GetNodes();
+ const SwNodes& rNds = rShell.GetDoc()->GetNodes();
const SwNode* pNd = rNds.GetOutLineNds()[ nIdx ];
return pNd->GetIndex() >= rNds.GetEndOfExtras().GetIndex() && // 1) body
!pNd->FindTableNode() && // 2) table
+ sw::IsParaPropsNode(*rShell.GetLayout(), *pNd->GetTextNode()) &&
( bCopy || !pNd->IsProtect() ); // 3) write
}
bool SwEditShell::IsOutlineMovable( SwOutlineNodes::size_type nIdx ) const
{
- return lcl_IsOutlineMoveAndCopyable( GetDoc(), nIdx, false );
+ return lcl_IsOutlineMoveAndCopyable( *this, nIdx, false );
}
bool SwEditShell::IsOutlineCopyable( SwOutlineNodes::size_type nIdx ) const
{
- return lcl_IsOutlineMoveAndCopyable( GetDoc(), nIdx, true );
+ return lcl_IsOutlineMoveAndCopyable( *this, nIdx, true );
}
bool SwEditShell::NumOrNoNum(
diff --git a/sw/source/core/inc/txtfrm.hxx b/sw/source/core/inc/txtfrm.hxx
index 7e2c2aef044c..bac7372cd27e 100644
--- a/sw/source/core/inc/txtfrm.hxx
+++ b/sw/source/core/inc/txtfrm.hxx
@@ -101,6 +101,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);
TextFrameIndex UpdateMergedParaForDelete(MergedPara & rMerged,
bool isRealDelete,
diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx
index e876d5370f94..b2a9d9eec32e 100644
--- a/sw/source/core/text/txtfrm.cxx
+++ b/sw/source/core/text/txtfrm.cxx
@@ -327,6 +327,20 @@ namespace sw {
return true;
}
+ SwTextNode *
+ GetParaPropsNode(SwRootFrame const& rLayout, SwNodeIndex const& rPos)
+ {
+ SwTextNode *const pTextNode(rPos.GetNode().GetTextNode());
+ if (pTextNode && !sw::IsParaPropsNode(rLayout, *pTextNode))
+ {
+ return static_cast<SwTextFrame*>(pTextNode->getLayoutFrame(&rLayout))->GetMergedPara()->pParaPropsNode;
+ }
+ else
+ {
+ return pTextNode;
+ }
+ }
+
} // namespace sw
/// Switches width and height of the text frame
More information about the Libreoffice-commits
mailing list