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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Oct 30 18:25:52 UTC 2018


 sw/inc/doc.hxx                                          |    6 
 sw/source/core/doc/DocumentContentOperationsManager.cxx |    2 
 sw/source/core/doc/docnum.cxx                           |  191 +++++++++++++---
 sw/source/core/edit/edattr.cxx                          |    6 
 sw/source/core/edit/ednumber.cxx                        |   23 +
 sw/source/core/inc/txtfrm.hxx                           |    2 
 sw/source/core/text/txtfrm.cxx                          |   17 +
 7 files changed, 204 insertions(+), 43 deletions(-)

New commits:
commit 488b2cc10916b98b176cc024862585b1f899638a
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 Oct 30 19:24:05 2018 +0100

    sw_redlinehide_3: SwDoc::MoveParagraph()
    
    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 c0f52537baa3..80b45216e586 100644
--- a/sw/source/core/doc/docnum.cxx
+++ b/sw/source/core/doc/docnum.cxx
@@ -1792,7 +1792,93 @@ bool SwDoc::NumUpDown(const SwPaM& rPam, bool bDown, SwRootFrame const*const pLa
     return bRet;
 }
 
-bool SwDoc::MoveParagraph( const SwPaM& rPam, long nOffset, bool bIsOutlMv )
+bool SwDoc::MoveParagraph(const SwPaM& rPam, long nOffset, bool const bIsOutlMv)
+{
+    SwPaM pam(rPam, nullptr);
+    // 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* 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 != &pam.Start()->nNode.GetNode())
+        {
+            assert(nodes.second);
+            if (nOffset < 0)
+            {
+                nOffset -= pam.Start()->nNode.GetIndex() - nodes.first->GetIndex();
+            }
+            pam.Start()->nNode = *nodes.first;
+            pam.Start()->nContent.Assign(nodes.first, 0);
+        }
+        nodes = sw::GetFirstAndLastNode(*pLayout, rPam.End()->nNode);
+        if (nodes.first && nodes.second != &pam.End()->nNode.GetNode())
+        {
+            assert(nodes.second);
+            if (nOffset > 0)
+            {
+                nOffset += nodes.second->GetIndex() - pam.End()->nNode.GetIndex();
+            }
+            pam.End()->nNode = *nodes.second;
+            pam.End()->nContent.Assign(nodes.second, 0);
+        }
+
+        if (nOffset > 0)
+        {
+            // sw_redlinehide: avoid moving into delete redline, skip forward
+            SwNode const* pNode(GetNodes()[pam.End()->nNode.GetIndex() + nOffset]);
+            if (pLayout
+                && pNode->GetRedlineMergeFlag() != SwNode::Merge::None
+                && pNode->GetRedlineMergeFlag() != SwNode::Merge::First)
+            {
+                for ( ; ; ++nOffset)
+                {
+                    pNode = GetNodes()[pam.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
+                    }
+                }
+            }
+        }
+        else
+        {
+            // sw_redlinehide: avoid moving into delete redline, skip backward
+            SwNode const* pNode(GetNodes()[pam.Start()->nNode.GetIndex() + nOffset]);
+            if (pLayout
+                && pNode->GetRedlineMergeFlag() != SwNode::Merge::None
+                && pNode->GetRedlineMergeFlag() != SwNode::Merge::First)
+            {
+                for ( ; ; --nOffset)
+                {
+                    pNode = GetNodes()[pam.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
+                    }
+                }
+            }
+        }
+    }
+    return MoveParagraphImpl(pam, 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();
 
@@ -2118,7 +2204,10 @@ bool SwDoc::MoveParagraph( const SwPaM& rPam, long nOffset, bool bIsOutlMv )
         pUndo.reset(new SwUndoMoveNum( rPam, nOffset, bIsOutlMv ));
         nMoved = rPam.End()->nNode.GetIndex() - rPam.Start()->nNode.GetIndex() + 1;
     }
-
+    (void) pLayout;
+    assert(!pLayout // check not moving into delete redline
+        || 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..b4f2dc56700c 100644
--- a/sw/source/core/edit/ednumber.cxx
+++ b/sw/source/core/edit/ednumber.cxx
@@ -484,8 +484,10 @@ bool SwEditShell::MoveNumParas( bool bUpperLower, bool bUpperLeft )
 
                         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->IsTextNode()
+                             && sw::IsParaPropsNode(*GetLayout(), *static_cast<const SwTextNode*>(pNd))
+                             && pOrig == static_cast<const SwTextNode*>(pNd)->GetNumRule()
+                             && static_cast<const SwTextNode*>(pNd)->GetActualListLevel() > nUpperLevel))
                         {
                             ++nIdx;
                         }
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 e08d641d8ed859b366b607804c90c2ee5ca66ebd
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 Oct 30 14:46:57 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 ff96eb5596e8..c0f52537baa3 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 90807607ffb6fa06b20a2034c1890eaaf8342117
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 Oct 30 11:11:02 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 )


More information about the Libreoffice-commits mailing list