[Libreoffice-commits] core.git: Branch 'private/mst/sw_redlinehide_3' - 23 commits - sw/inc sw/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Nov 6 11:53:31 UTC 2018


Rebased ref, commits from common ancestor:
commit 28729a135164fc93c8233e935956defa0d0dd79f
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Tue Nov 6 12:15:18 2018 +0100
Commit:     Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Tue Nov 6 12:50:12 2018 +0100

    sw_redlinehide_3: adapt SwCursorShell::UpdateMarkedListLevel()
    
    Change-Id: I2cd143baafae09324ad0a439cfad3f916ddb13b3

diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index d170b3b4049d..4d8631364ab8 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -388,7 +388,8 @@ void SwCursorShell::MarkListLevel( const OUString& sListId,
 
 void SwCursorShell::UpdateMarkedListLevel()
 {
-    SwTextNode * pTextNd = GetCursor_()->GetNode().GetTextNode();
+    SwTextNode const*const pTextNd = sw::GetParaPropsNode(*GetLayout(),
+            GetCursor_()->GetPoint()->nNode);
 
     if ( pTextNd )
     {
diff --git a/sw/source/core/edit/editsh.cxx b/sw/source/core/edit/editsh.cxx
index fcc0377ad54d..f548e2baf064 100644
--- a/sw/source/core/edit/editsh.cxx
+++ b/sw/source/core/edit/editsh.cxx
@@ -780,6 +780,7 @@ void SwEditShell::SetNumberingRestart()
                             SwTextNode* pTextNd( pNd->GetTextNode() );
                             SwNumRule* pNumRule( pTextNd->GetNumRule() );
 
+                            // sw_redlinehide: not sure what this should do, only called from mail-merge
                             bool bIsNodeNum =
                                ( pNumRule && pTextNd->GetNum() &&
                                  ( pTextNd->HasNumber() || pTextNd->HasBullet() ) &&
commit 201d861361d1cf99684e88fc6fdf0b533cde8af5
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Mon Nov 5 18:32:31 2018 +0100
Commit:     Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Tue Nov 6 12:50:12 2018 +0100

    sw_redlinehide_3: hide deleted numbered nodes in field dialog
    
    This reuses the IDocumentOutlineNodes code for IDocumentListItems;
    the only client of it is the field dialog cross reference page.
    
    Adapt SwCursorShell::GetContentAtPos() too.
    
    Change-Id: I9a9ed464b176dd26bf39969ba94041f995ba8c7e

diff --git a/sw/inc/IDocumentListItems.hxx b/sw/inc/IDocumentListItems.hxx
index e8573e59879f..b5d1e8083b48 100644
--- a/sw/inc/IDocumentListItems.hxx
+++ b/sw/inc/IDocumentListItems.hxx
@@ -22,6 +22,8 @@
 
 #include <vector>
 #include <rtl/ustring.hxx>
+
+class SwRootFrame;
 class SwNodeNum;
 
 /** Provides numbered items of a document.
@@ -34,7 +36,11 @@ public:
     virtual void addListItem( const SwNodeNum& rNodeNum ) = 0;
     virtual void removeListItem( const SwNodeNum& rNodeNum ) = 0;
 
-    virtual OUString getListItemText( const SwNodeNum& rNodeNum ) const = 0;
+    virtual OUString getListItemText(const SwNodeNum& rNodeNum,
+                                     SwRootFrame const& rLayout) const = 0;
+
+    virtual bool isNumberedInLayout(SwNodeNum const& rNodeNum,
+            SwRootFrame const& rLayout) const = 0;
 
     /** get vector of all list items, which are numbered
     */
diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx
index a00a35ec6f77..5220dd4f8071 100644
--- a/sw/source/core/crsr/crstrvl.cxx
+++ b/sw/source/core/crsr/crstrvl.cxx
@@ -1291,7 +1291,7 @@ bool SwCursorShell::GetContentAtPos( const Point& rPt,
             if( pONd )
             {
                 rContentAtPos.eContentAtPos = IsAttrAtPos::Outline;
-                rContentAtPos.sStr = pONd->GetExpandText( 0, -1, true, true );
+                rContentAtPos.sStr = sw::GetExpandTextMerged(GetLayout(), *pONd, true, false, ExpandMode(0));
                 bRet = true;
             }
         }
diff --git a/sw/source/core/doc/DocumentListItemsManager.cxx b/sw/source/core/doc/DocumentListItemsManager.cxx
index edb859a6e57a..8d88fba75cf1 100644
--- a/sw/source/core/doc/DocumentListItemsManager.cxx
+++ b/sw/source/core/doc/DocumentListItemsManager.cxx
@@ -18,7 +18,9 @@
  */
 
 #include <DocumentListItemsManager.hxx>
+
 #include <SwNodeNum.hxx>
+#include <txtfrm.hxx>
 #include <ndtxt.hxx>
 #include <osl/diagnose.h>
 
@@ -66,12 +68,19 @@ void DocumentListItemsManager::removeListItem( const SwNodeNum& rNodeNum )
     }
 }
 
-OUString DocumentListItemsManager::getListItemText( const SwNodeNum& rNodeNum ) const
+OUString DocumentListItemsManager::getListItemText(const SwNodeNum& rNodeNum,
+        SwRootFrame const& rLayout) const
+{
+    SwTextNode const*const pNode(rNodeNum.GetTextNode());
+    assert(pNode);
+    return sw::GetExpandTextMerged(&rLayout, *pNode, true, true, ExpandMode(0));
+}
+
+bool DocumentListItemsManager::isNumberedInLayout(
+        SwNodeNum const& rNodeNum, // note: this is the non-hidden Num ...
+        SwRootFrame const& rLayout) const
 {
-    return rNodeNum.GetTextNode()
-           ? rNodeNum.GetTextNode()->GetExpandText( 0, -1, true/*bWithNumber*/,
-                                                    true/*bWithNumber*/, true/*bWithSpacesForLevel*/ )
-           : OUString();
+    return sw::IsParaPropsNode(rLayout, *rNodeNum.GetTextNode());
 }
 
 void DocumentListItemsManager::getNumItems( tSortedNodeNumList& orNodeNumList ) const
diff --git a/sw/source/core/doc/DocumentOutlineNodesManager.cxx b/sw/source/core/doc/DocumentOutlineNodesManager.cxx
index 3654c5032eb4..12945c76ae6e 100644
--- a/sw/source/core/doc/DocumentOutlineNodesManager.cxx
+++ b/sw/source/core/doc/DocumentOutlineNodesManager.cxx
@@ -41,36 +41,31 @@ int DocumentOutlineNodesManager::getOutlineLevel( const tSortedOutlineNodeList::
                                 GetTextNode()->GetAttrOutlineLevel()-1;
 }
 
-OUString DocumentOutlineNodesManager::getOutlineText(
-                              const tSortedOutlineNodeList::size_type nIdx,
-                              SwRootFrame const*const pLayout,
-                              const bool bWithNumber,
-                              const bool bWithSpacesForLevel,
-                              const bool bWithFootnote ) const
+OUString GetExpandTextMerged(SwRootFrame const*const pLayout,
+        SwTextNode const& rNode, bool const bWithNumber,
+        bool const bWithSpacesForLevel, ExpandMode const i_mode)
 {
-    SwTextNode const*const pNode(m_rDoc.GetNodes().GetOutLineNds()[ nIdx ]->GetTextNode());
     if (pLayout && pLayout->IsHideRedlines())
     {
-        SwTextFrame const*const pFrame(static_cast<SwTextFrame*>(pNode->getLayoutFrame(pLayout)));
+        SwTextFrame const*const pFrame(static_cast<SwTextFrame*>(rNode.getLayoutFrame(pLayout)));
         if (pFrame)
         {
             sw::MergedPara const*const pMerged = pFrame->GetMergedPara();
             if (pMerged)
             {
-                if (pNode != pMerged->pParaPropsNode)
+                if (&rNode != pMerged->pParaPropsNode)
                 {
                     return OUString();
                 }
                 else
                 {
-                    ExpandMode const mode(ExpandMode::HideDeletions |
-                        (bWithFootnote ? ExpandMode::ExpandFootnote : ExpandMode(0)));
-                    OUStringBuffer ret(pNode->GetExpandText(0, -1, bWithNumber,
+                    ExpandMode const mode(ExpandMode::HideDeletions | i_mode);
+                    OUStringBuffer ret(rNode.GetExpandText(0, -1, bWithNumber,
                         bWithNumber, bWithSpacesForLevel, mode));
-                    for (sal_uLong i = pNode->GetIndex() + 1;
+                    for (sal_uLong i = rNode.GetIndex() + 1;
                          i <= pMerged->pLastNode->GetIndex(); ++i)
                     {
-                        SwNode *const pTmp(pNode->GetNodes()[i]);
+                        SwNode *const pTmp(rNode.GetNodes()[i]);
                         if (pTmp->GetRedlineMergeFlag() == SwNode::Merge::NonFirst)
                         {
                             ret.append(pTmp->GetTextNode()->GetExpandText(
@@ -82,9 +77,21 @@ OUString DocumentOutlineNodesManager::getOutlineText(
             }
         }
     }
-    return pNode->GetExpandText( 0, -1, bWithNumber,
-                    bWithNumber, bWithSpacesForLevel,
-                    bWithFootnote ? ExpandMode::ExpandFootnote : ExpandMode(0));
+    return rNode.GetExpandText( 0, -1, bWithNumber,
+                    bWithNumber, bWithSpacesForLevel, i_mode);
+}
+
+OUString DocumentOutlineNodesManager::getOutlineText(
+                              const tSortedOutlineNodeList::size_type nIdx,
+                              SwRootFrame const*const pLayout,
+                              const bool bWithNumber,
+                              const bool bWithSpacesForLevel,
+                              const bool bWithFootnote ) const
+{
+    SwTextNode const*const pNode(m_rDoc.GetNodes().GetOutLineNds()[ nIdx ]->GetTextNode());
+    return GetExpandTextMerged(pLayout, *pNode,
+            bWithNumber, bWithSpacesForLevel,
+            (bWithFootnote ? ExpandMode::ExpandFootnote : ExpandMode(0)));
 }
 
 SwTextNode* DocumentOutlineNodesManager::getOutlineNode( const tSortedOutlineNodeList::size_type nIdx ) const
diff --git a/sw/source/core/inc/DocumentListItemsManager.hxx b/sw/source/core/inc/DocumentListItemsManager.hxx
index 36e56e015d7a..7508a2b5df41 100644
--- a/sw/source/core/inc/DocumentListItemsManager.hxx
+++ b/sw/source/core/inc/DocumentListItemsManager.hxx
@@ -36,7 +36,11 @@ public:
     void addListItem( const SwNodeNum& rNodeNum ) override;
     void removeListItem( const SwNodeNum& rNodeNum ) override;
 
-    OUString getListItemText( const SwNodeNum& rNodeNum ) const override;
+    OUString getListItemText(const SwNodeNum& rNodeNum,
+                             SwRootFrame const& rLayout) const override;
+
+    bool isNumberedInLayout(SwNodeNum const& rNodeNum,
+            SwRootFrame const& rLayout) const override;
 
     void getNumItems( IDocumentListItems::tSortedNodeNumList& orNodeNumList ) const override;
 
diff --git a/sw/source/core/inc/txtfrm.hxx b/sw/source/core/inc/txtfrm.hxx
index 6870d721e5a0..9ecc04e38218 100644
--- a/sw/source/core/inc/txtfrm.hxx
+++ b/sw/source/core/inc/txtfrm.hxx
@@ -44,6 +44,7 @@ struct SwCursorMoveState;
 struct SwFillData;
 class SwPortionHandler;
 class SwScriptInfo;
+enum class ExpandMode;
 
 #define NON_PRINTING_CHARACTER_COLOR Color(0x26, 0x8b, 0xd2)
 
@@ -124,6 +125,10 @@ void AddRemoveFlysAnchoredToFrameStartingAtNode(
         SwTextFrame & rFrame, SwTextNode & rTextNode,
         std::set<sal_uLong> *pSkipped);
 
+OUString GetExpandTextMerged(SwRootFrame const* pLayout,
+        SwTextNode const& rNode, bool bWithNumber,
+        bool bWithSpacesForLevel, ExpandMode i_mode);
+
 } // namespace sw
 
 /// Represents the visualization of a paragraph. Typical upper is an
diff --git a/sw/source/ui/fldui/fldref.cxx b/sw/source/ui/fldui/fldref.cxx
index cd3919294a41..dfdb141f2d47 100644
--- a/sw/source/ui/fldui/fldref.cxx
+++ b/sw/source/ui/fldui/fldref.cxx
@@ -626,11 +626,15 @@ void SwFieldRefPage::UpdateSubType(const OUString& filterString)
             bool bCertainTextNodeSelected( false );
             for ( size_t nNumItemIdx = 0; nNumItemIdx < maNumItems.size(); ++nNumItemIdx )
             {
-                bool isSubstring = MatchSubstring(pIDoc->getListItemText( *maNumItems[nNumItemIdx] ), filterString);
+                if (!pIDoc->isNumberedInLayout(*maNumItems[nNumItemIdx], *pSh->GetLayout()))
+                {
+                    continue; // skip it
+                }
+                bool isSubstring = MatchSubstring(pIDoc->getListItemText(*maNumItems[nNumItemIdx], *pSh->GetLayout()), filterString);
                 if(isSubstring)
                 {
                     SvTreeListEntry* pEntry = m_pSelectionToolTipLB->InsertEntry(
-                    pIDoc->getListItemText( *maNumItems[nNumItemIdx] ) );
+                        pIDoc->getListItemText(*maNumItems[nNumItemIdx], *pSh->GetLayout()));
                     pEntry->SetUserData( reinterpret_cast<void*>(nNumItemIdx) );
                     if ( ( IsFieldEdit() &&
                            pRefField->GetReferencedTextNode() == maNumItems[nNumItemIdx]->GetTextNode() ) ||
commit 362f1584ebf9bf918483ec389a69f33c0f12a901
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Mon Nov 5 15:50:43 2018 +0100
Commit:     Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Tue Nov 6 12:50:12 2018 +0100

    sw_redlinehide_3: fix footnotes not being removed when deleted
    
    If there already is a merged SwTextFrame and a footnote is being
    deleted in a non-first node hence UpdateFramesForAddDeleteRedline()
    is called, the SwFootnoteFrame isn't removed unless by some accident.
    
    Just let CheckParaRedlineMerge iterate all top-level nodes.
    
    Change-Id: I65ac90636a283d5178b4c0323bcc0ae28b3f1196

diff --git a/sw/source/core/text/redlnitr.cxx b/sw/source/core/text/redlnitr.cxx
index 598c0bc321da..ecdd22eff44b 100644
--- a/sw/source/core/text/redlnitr.cxx
+++ b/sw/source/core/text/redlnitr.cxx
@@ -216,29 +216,36 @@ CheckParaRedlineMerge(SwTextFrame & rFrame, SwTextNode & rTextNode,
     if (eMode == FrameMode::Existing)
     {
         // remove existing footnote frames for first node;
-        // for non-first notes, DelFrames will remove all
+        // for non-first nodes with own frames, DelFrames will remove all
         // (could possibly call lcl_ChangeFootnoteRef, not sure if worth it)
         // note: must be done *before* changing listeners!
-        sal_Int32 nLast(0);
-        std::vector<std::pair<sal_Int32, sal_Int32>> hidden;
-        for (auto const& rExtent : extents)
+        // for non-first nodes that are already merged with this frame,
+        // need to remove here too, otherwise footnotes can be removed only
+        // by lucky accident, e.g. TruncLines().
+        auto itExtent(extents.begin());
+        for (auto const pTextNode : nodes)
         {
-            if (rExtent.pNode != &rTextNode)
+            sal_Int32 nLast(0);
+            std::vector<std::pair<sal_Int32, sal_Int32>> hidden;
+            for ( ; itExtent != extents.end(); ++itExtent)
             {
-                break;
+                if (itExtent->pNode != pTextNode)
+                {
+                    break;
+                }
+                if (itExtent->nStart != 0)
+                {
+                    assert(itExtent->nStart != nLast);
+                    hidden.emplace_back(nLast, itExtent->nStart);
+                }
+                nLast = itExtent->nEnd;
             }
-            if (rExtent.nStart != 0)
+            if (nLast != pTextNode->Len())
             {
-                assert(rExtent.nStart != nLast);
-                hidden.emplace_back(nLast, rExtent.nStart);
+                hidden.emplace_back(nLast, pTextNode->Len());
             }
-            nLast = rExtent.nEnd;
-        }
-        if (nLast != rTextNode.Len())
-        {
-            hidden.emplace_back(nLast, rTextNode.Len());
+            sw::RemoveFootnotesForNode(rFrame, *pTextNode, &hidden);
         }
-        sw::RemoveFootnotesForNode(rFrame, rTextNode, &hidden);
         // unfortunately DelFrames() must be done before StartListening too,
         // otherwise footnotes cannot be deleted by SwTextFootnote::DelFrames!
         for (auto iter = ++nodes.begin(); iter != nodes.end(); ++iter)
commit 259d8bfe67efdadd9314b2cac8c0ffa814859103
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Mon Nov 5 13:41:29 2018 +0100
Commit:     Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Tue Nov 6 12:50:12 2018 +0100

    sw: fix crash in SwContentTree::HasContentChanged()
    
    Remove() will remove the node including its children, but
    SvTreeList::Next() will actually return the first child, so the pChild
    points to an entry that has been deleted.
    
    Change-Id: Ia4bd75d64c8436ea03c0727a8d49ee0c34fda16f

diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx
index b465975a385a..ba2255d07d63 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -2213,14 +2213,11 @@ bool SwContentTree::HasContentChanged()
                     }
                     if(bRemoveChildren)
                     {
-                        SvTreeListEntry* pChild = FirstChild(pEntry);
-                        SvTreeListEntry* pRemove = pChild;
                         for(size_t j = 0; j < nChildCount; ++j)
                         {
-                            pChild = Next(pRemove);
+                            SvTreeListEntry *const pRemove = FirstChild(pEntry);
                             assert(pRemove);
                             GetModel()->Remove(pRemove);
-                            pRemove = pChild;
                         }
                     }
                     if(!nChildCount)
commit a04e817cde02170309d579f474ad87ab07a0aaf2
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Mon Nov 5 11:51:00 2018 +0100
Commit:     Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Tue Nov 6 12:50:12 2018 +0100

    sw_redlinehide_3: move assert in SwContentNode::DelFrames()
    
    This is happening in MoveParagraph; the UpdateMergedParaForDelete will
    reset the pParaPropsNode pointer so move assert below that.
    
    Change-Id: I31069578a9bfdb05f01ea778bbe9e9ae43c865c6

diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx
index fa30b94a25a8..6971e30774c9 100644
--- a/sw/source/core/docnode/node.cxx
+++ b/sw/source/core/docnode/node.cxx
@@ -1364,8 +1364,6 @@ void SwContentNode::DelFrames(SwRootFrame const*const pLayout)
             {
                 if (this != pMerged->pFirstNode)
                 {
-                    // pointer should have been updated to a different node
-                    assert(this != pMerged->pParaPropsNode);
                     // SwNodes::RemoveNode iterates *backwards* - so
                     // ensure there are no more extents pointing to this
                     // node as SwFrame::InvalidatePage() will access them.
@@ -1373,6 +1371,8 @@ void SwContentNode::DelFrames(SwRootFrame const*const pLayout)
                     // because that would access deleted wrong-lists
                     sw::UpdateMergedParaForDelete(*pMerged, true,
                             *static_cast<SwTextNode*>(this), 0, Len());
+                    // pointer should have been updated to a different node
+                    assert(this != pMerged->pParaPropsNode);
                     if (this == pMerged->pLastNode)
                     {
                         pMerged->pLastNode = GetNodes()[GetIndex()-1]->GetTextNode();
commit 66265e1931511917c47c41a39bd4d92d6ee5a05b
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Fri Nov 2 19:26:19 2018 +0100
Commit:     Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Tue Nov 6 12:50:12 2018 +0100

    sw_redlinehide_3: update frames in MoveParagraph()
    
    ... if redlining is disabled and MoveNodeRange is called.
    
    Change-Id: I8c4e35b1b783446ab9bd888599bcce44222857e8

diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index 8dcec0a9fd15..4854afde55c1 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -826,6 +826,10 @@ namespace
         {
             rSvRedLine.SetPos( nInsPos );
             pDoc->getIDocumentRedlineAccess().AppendRedline( rSvRedLine.pRedl, true );
+            if (rSvRedLine.pRedl->GetType() == nsRedlineType_t::REDLINE_DELETE)
+            {
+                UpdateFramesForAddDeleteRedline(*pDoc, *rSvRedLine.pRedl);
+            }
         }
 
         pDoc->getIDocumentRedlineAccess().SetRedlineFlags_intern( eOld );
commit fe7ee0001aa07ddf01b1e3588c645d83624a101a
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: Tue Nov 6 12:50:12 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 14f2f9c1bab5a47d20b36444e7b2e11cb310b96d
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: Tue Nov 6 12:50:12 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 18304289c071..b707c2aa631a 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 eed92db94b71d5b13cf998c3ee720a50db8cfd1e
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: Tue Nov 6 12:50:12 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 725cecde9075..d76a5a61ba36 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 26430469aa1c..18304289c071 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 3e417e7f9fec..ee35d6e8be8e 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 a7512dc8916c187d79f28cd84f8d3740629bc2a7
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: Tue Nov 6 12:50:12 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 415c3599a2ad..26430469aa1c 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 b27bea507449dd7030b3164228441a871a93c9d2
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: Tue Nov 6 12:50:12 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 6b4fb92c347a..415c3599a2ad 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 766bb343b1e0decc62158ccab35f1014ede39d3e
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: Tue Nov 6 12:50:12 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 36f72e7485a7..88399969cbbd 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 bb6980da0e418141be8f4122d88056f6cb3afcec
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: Tue Nov 6 12:50:12 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 187a271e344c..725cecde9075 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 b5f8cefdd7f6..6b4fb92c347a 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 6402f498290e..3e417e7f9fec 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 4d85495b10d367ac65b1dcfcd67f02bfc22d6f44
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: Tue Nov 6 12:50:12 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 a6af1a31a753edb4051e762f3d8cd79c5365634d
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: Tue Nov 6 12:50:12 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 20c45c0cd8c797857d73b563a8ece4607bcebb46
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: Tue Nov 6 12:50:12 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 1de3946be5156d97b9e4a06b485ce90ebf3200dc
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: Tue Nov 6 12:50:12 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 dd32c7a49efb..6402f498290e 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 cde41b7bd90243770f824fce94883141032a0952
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: Tue Nov 6 12:50:12 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 5d23d06109e7..dd32c7a49efb 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 d372e0754377a012a9dc926a33007a7e51151906
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: Tue Nov 6 12:50:12 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 7d0774f58791..5d23d06109e7 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 3ea93fb1dfdc3594065b19f2e2a79764d61c8410
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: Tue Nov 6 12:50:12 2018 +0100

    sw_redlinehide_3: adapt SwEditShell::SearchNumRule()
    
    Change-Id: Ic7d07a1e4920d5776a8fec3893cd2cd2aff2c6fc

diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index ef6280a4117c..187a271e344c 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 c3bfbda958ed..b5f8cefdd7f6 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 f6f201e1165a..7d0774f58791 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 b6935b705dd818013024bdb96edab324f66b5a97
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: Tue Nov 6 12:50:12 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 d2d4623ed3bd..ef6280a4117c 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 0d9cd97fdcfd..c3bfbda958ed 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 18c3813b24fd..f6f201e1165a 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 e2b9c17ee3291e414889021b2fbec594208e71ff
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: Tue Nov 6 12:50:12 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 350afb3ceab9..18c3813b24fd 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 d937eceb9067ec0a9aceaeb78d18c40bb2083562
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: Tue Nov 6 12:49:18 2018 +0100

    sw_redlinehide_3: SwEditShell::IsFirstNumRuleAtPos()
    
    IsFirstOfNumRule() needs a layout so it can check the correct
    SwNodeNum.
    
    Change-Id: Ic6bd9adc909d7c325f5e450fd9e53a15f68e7a63

diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index 5acdb10dd8a1..d2d4623ed3bd 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& rLayout);
 
     // access methods for XForms model(s)
 
diff --git a/sw/inc/ndtxt.hxx b/sw/inc/ndtxt.hxx
index d00b280abeb3..b483d7fc9e9d 100644
--- a/sw/inc/ndtxt.hxx
+++ b/sw/inc/ndtxt.hxx
@@ -772,7 +772,7 @@ public:
     void RemoveFromListRLHidden();
     bool IsInList() const;
 
-    bool IsFirstOfNumRule() const;
+    bool IsFirstOfNumRule(SwRootFrame const& rLayout) const;
 
     sal_uInt16 GetScalingOfSelectedText( sal_Int32 nStt, sal_Int32 nEnd ) const;
 
diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx
index 0f74cc51b7a8..0d9cd97fdcfd 100644
--- a/sw/source/core/doc/docnum.cxx
+++ b/sw/source/core/doc/docnum.cxx
@@ -2314,14 +2314,15 @@ void SwDoc::MarkListLevel( const OUString& sListId,
     }
 }
 
-bool SwDoc::IsFirstOfNumRuleAtPos( const SwPosition & rPos )
+bool SwDoc::IsFirstOfNumRuleAtPos(const SwPosition & rPos,
+        SwRootFrame const& rLayout)
 {
     bool bResult = false;
 
-    const SwTextNode* pTextNode = rPos.nNode.GetNode().GetTextNode();
+    const SwTextNode *const pTextNode = sw::GetParaPropsNode(rLayout, rPos.nNode);
     if ( pTextNode != nullptr )
     {
-        bResult = pTextNode->IsFirstOfNumRule();
+        bResult = pTextNode->IsFirstOfNumRule(rLayout);
     }
 
     return bResult;
diff --git a/sw/source/core/edit/ednumber.cxx b/sw/source/core/edit/ednumber.cxx
index c01fa8365385..350afb3ceab9 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#
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index 97c89d2eae06..36f72e7485a7 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -4355,12 +4355,13 @@ bool SwTextNode::IsInList() const
     return GetNum() != nullptr && GetNum()->GetParent() != nullptr;
 }
 
-bool SwTextNode::IsFirstOfNumRule() const
+bool SwTextNode::IsFirstOfNumRule(SwRootFrame const& rLayout) const
 {
     bool bResult = false;
 
-    if ( GetNum() && GetNum()->GetNumRule())
-        bResult = GetNum()->IsFirst();
+    SwNodeNum const*const pNum(GetNum(&rLayout));
+    if (pNum && pNum->GetNumRule())
+        bResult = pNum->IsFirst();
 
     return bResult;
 }


More information about the Libreoffice-commits mailing list