[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sw/source

Jim Raykowski (via logerrit) logerrit at kemper.freedesktop.org
Wed Aug 11 13:06:52 UTC 2021


 sw/source/uibase/shells/basesh.cxx |   49 +++++++++++++++++++------------------
 1 file changed, 26 insertions(+), 23 deletions(-)

New commits:
commit d3f5f1b0068b8ab57f7aae9588cc0cff4af1db54
Author:     Jim Raykowski <raykowj at gmail.com>
AuthorDate: Sun Aug 8 21:43:25 2021 -0800
Commit:     Michael Stahl <michael.stahl at allotropia.de>
CommitDate: Wed Aug 11 15:06:12 2021 +0200

    tdf#143577 check node is a text node before use as such
    
    Change-Id: I337c94aa90ed906c5b744171728022ba5f9c64b3
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120191
    Tested-by: Jenkins
    Reviewed-by: Jim Raykowski <raykowj at gmail.com>
    (cherry picked from commit 0ff5eb97b89f89e770d4397bf76f24fb7cd76b57)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120250
    Reviewed-by: Michael Stahl <michael.stahl at allotropia.de>

diff --git a/sw/source/uibase/shells/basesh.cxx b/sw/source/uibase/shells/basesh.cxx
index a81ae435829c..9752f24ad189 100644
--- a/sw/source/uibase/shells/basesh.cxx
+++ b/sw/source/uibase/shells/basesh.cxx
@@ -199,25 +199,26 @@ void SwBaseShell::ExecDelete(SfxRequest &rReq)
         case SID_DELETE:
             if (rSh.GetViewOptions()->IsShowOutlineContentVisibilityButton())
             {
+                // Disallow if the cursor is at the end of a paragraph and the document model
+                // node at this position is an outline node with folded content or the next node
+                // is an outline node with folded content.
                 if (rSh.IsEndPara())
                 {
                     SwNodeIndex aIdx(rSh.GetCursor()->GetNode());
-                    // disallow if this is an outline node having folded content
-                    bool bVisible = true;
-                    aIdx.GetNode().GetTextNode()->GetAttrOutlineContentVisible(bVisible);
-                    if (!bVisible)
-                        return;
-                    // disallow if the next text node is an outline node having folded content
-                    ++aIdx;
-                    SwNodeType aNodeType;
-                    while ((aNodeType = aIdx.GetNode().GetNodeType()) != SwNodeType::Text)
-                        ++aIdx;
                     if (aIdx.GetNode().IsTextNode())
                     {
-                        bVisible = true;
+                        bool bVisible = true;
                         aIdx.GetNode().GetTextNode()->GetAttrOutlineContentVisible(bVisible);
                         if (!bVisible)
-                            return;
+                            break;
+                        ++aIdx;
+                        if (aIdx.GetNode().IsTextNode())
+                        {
+                            bVisible = true;
+                            aIdx.GetNode().GetTextNode()->GetAttrOutlineContentVisible(bVisible);
+                            if (!bVisible)
+                                break;
+                        }
                     }
                 }
             }
@@ -227,21 +228,23 @@ void SwBaseShell::ExecDelete(SfxRequest &rReq)
         case FN_BACKSPACE:
             if (rSh.GetViewOptions()->IsShowOutlineContentVisibilityButton())
             {
+                // Disallow if the cursor is at the start of a paragraph and the document model
+                // node at this position is an outline node with folded content or the previous
+                // node is a content node without a layout frame.
                 if (rSh.IsSttPara())
                 {
                     SwNodeIndex aIdx(rSh.GetCursor()->GetNode());
-                    // disallow if this is a folded outline node
-                    bool bVisible = true;
-                    aIdx.GetNode().GetTextNode()->GetAttrOutlineContentVisible(bVisible);
-                    if (!bVisible)
-                        return;
-                    // disallow if previous text node does not have a layout frame
-                    --aIdx;
-                    SwNodeType aNodeType;
-                    while ((aNodeType = aIdx.GetNode().GetNodeType()) != SwNodeType::Text)
+                    if (aIdx.GetNode().IsTextNode())
+                    {
+                        bool bVisible = true;
+                        aIdx.GetNode().GetTextNode()->GetAttrOutlineContentVisible(bVisible);
+                        if (!bVisible)
+                            break;
                         --aIdx;
-                    if (aIdx.GetNode().IsContentNode() && !aIdx.GetNode().GetContentNode()->getLayoutFrame(nullptr))
-                        return;
+                        if (aIdx.GetNode().IsContentNode() &&
+                                !aIdx.GetNode().GetContentNode()->getLayoutFrame(nullptr))
+                            break;
+                    }
                 }
             }
             if( rSh.IsNoNum() )


More information about the Libreoffice-commits mailing list