diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2020-01-27 17:54:31 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2020-01-27 20:53:20 +0100 |
commit | d05a65bec5dc498f66f9331189124d539bc0d505 (patch) | |
tree | 30d2eb3bba8da16637b5f19d9346f8d551249773 /sw/source/uibase/shells/frmsh.cxx | |
parent | f9035b6102b6647dd6fc27694cce33593ee50a1e (diff) |
tdf#130179 sw comments on frames: limit insert UI for at-char and ...
... as-char anchor types
SwWrtShell::InsertPostIt() only sets the comment anchor for those types,
and we would crash without an anchor.
Change-Id: I7d2f5d3d8f8e11c46db060c17587e97ecb786ad2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87542
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'sw/source/uibase/shells/frmsh.cxx')
-rw-r--r-- | sw/source/uibase/shells/frmsh.cxx | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/sw/source/uibase/shells/frmsh.cxx b/sw/source/uibase/shells/frmsh.cxx index 7a5a63011b01..3f139e81f0cc 100644 --- a/sw/source/uibase/shells/frmsh.cxx +++ b/sw/source/uibase/shells/frmsh.cxx @@ -72,6 +72,7 @@ #include <swslots.hxx> #include <grfatr.hxx> #include <fldmgr.hxx> +#include <flyfrm.hxx> using ::editeng::SvxBorderLine; using namespace ::com::sun::star; @@ -1011,6 +1012,26 @@ void SwFrameShell::GetState(SfxItemSet& rSet) } break; + case FN_POSTIT: + { + SwFlyFrame* pFly = rSh.GetSelectedFlyFrame(); + if (pFly) + { + SwFrameFormat* pFormat = pFly->GetFormat(); + if (pFormat) + { + RndStdIds eAnchorId = pFormat->GetAnchor().GetAnchorId(); + // SwWrtShell::InsertPostIt() only works on as-char and at-char anchored + // images. + if (eAnchorId != RndStdIds::FLY_AS_CHAR && eAnchorId != RndStdIds::FLY_AT_CHAR) + { + rSet.DisableItem(nWhich); + } + } + } + } + break; + default: /* do nothing */; break; |