[Libreoffice-commits] core.git: sw/source
Jim Raykowski (via logerrit)
logerrit at kemper.freedesktop.org
Wed Aug 11 05:10:53 UTC 2021
sw/source/uibase/shells/basesh.cxx | 49 +++++++++++++++++++------------------
1 file changed, 26 insertions(+), 23 deletions(-)
New commits:
commit 0ff5eb97b89f89e770d4397bf76f24fb7cd76b57
Author: Jim Raykowski <raykowj at gmail.com>
AuthorDate: Sun Aug 8 21:43:25 2021 -0800
Commit: Jim Raykowski <raykowj at gmail.com>
CommitDate: Wed Aug 11 07:10:20 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>
diff --git a/sw/source/uibase/shells/basesh.cxx b/sw/source/uibase/shells/basesh.cxx
index 4a0691d36f99..0ef37aeb3a00 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