diff options
author | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2020-02-13 09:37:20 +0100 |
---|---|---|
committer | Thorsten Behrens <Thorsten.Behrens@CIB.de> | 2020-04-07 16:08:01 +0200 |
commit | dc1a5d5081a0a4fd6fb2c86c5b7ab096a085bb2c (patch) | |
tree | d1b68db206b1d6075061afc2fad3997c56110e42 | |
parent | 0307f178617c0c80e332860319772545ae24e24e (diff) |
Add uno cmd to protect bookmarks in a document
Change-Id: I7cc0dfa2b129d69d49b555495d77c2c710689e94
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88586
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
(cherry picked from commit 4a5c627e61dc1bd67106a18319eabecb50b79658)
Without the WriterCommands/UI changes.
Change-Id: Ib1d28f96bd1c4a87ef644a376cefa2cf5c7e6728
Conflicts:
officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
sw/sdi/_textsh.sdi
sw/sdi/swriter.sdi
-rw-r--r-- | sw/inc/cmdid.h | 1 | ||||
-rw-r--r-- | sw/sdi/_textsh.sdi | 6 | ||||
-rw-r--r-- | sw/sdi/swriter.sdi | 18 | ||||
-rw-r--r-- | sw/source/uibase/shells/textsh1.cxx | 13 |
4 files changed, 35 insertions, 3 deletions
diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h index 769f40aca04f..a5cc561f8a6f 100644 --- a/sw/inc/cmdid.h +++ b/sw/inc/cmdid.h @@ -272,6 +272,7 @@ #define FN_INSERT_AUTH_ENTRY_DLG (FN_INSERT2 + 21) /* insert entry for table of authorities*/ #define FN_PROTECT_FIELDS (FN_INSERT2 + 26) +#define FN_PROTECT_BOOKMARKS (FN_INSERT2 + 27) // Region: Format #define FN_AUTOFORMAT_APPLY (FN_FORMAT + 1 ) /* apply autoformat options */ diff --git a/sw/sdi/_textsh.sdi b/sw/sdi/_textsh.sdi index 453e48dd1b49..0ba9b7a31a14 100644 --- a/sw/sdi/_textsh.sdi +++ b/sw/sdi/_textsh.sdi @@ -1682,5 +1682,11 @@ interface BaseText StateMethod = GetState ; ] + FN_PROTECT_BOOKMARKS + [ + ExecMethod = Execute ; + StateMethod = GetState ; + ] + } //ende interface text diff --git a/sw/sdi/swriter.sdi b/sw/sdi/swriter.sdi index c89731d924f7..d0e618229b12 100644 --- a/sw/sdi/swriter.sdi +++ b/sw/sdi/swriter.sdi @@ -7668,3 +7668,21 @@ SfxBoolItem ProtectFields FN_PROTECT_FIELDS ToolBoxConfig = FALSE, GroupId = SfxGroupId::Controls; ] + +SfxBoolItem ProtectBookmarks FN_PROTECT_BOOKMARKS + +[ + AutoUpdate = TRUE, + FastCall = FALSE, + ReadOnlyDoc = FALSE, + Toggle = TRUE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + + + AccelConfig = FALSE, + MenuConfig = FALSE, + ToolBoxConfig = FALSE, + GroupId = SfxGroupId::Controls; +] diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx index 1de455d6b0f4..b5efe7f1a32b 100644 --- a/sw/source/uibase/shells/textsh1.cxx +++ b/sw/source/uibase/shells/textsh1.cxx @@ -1392,9 +1392,13 @@ void SwTextShell::Execute(SfxRequest &rReq) } break; case FN_PROTECT_FIELDS: + case FN_PROTECT_BOOKMARKS: { IDocumentSettingAccess& rIDSA = rWrtSh.getIDocumentSettingAccess(); - rIDSA.set(DocumentSettingId::PROTECT_FIELDS, !rIDSA.get(DocumentSettingId::PROTECT_FIELDS)); + DocumentSettingId aSettingId = nSlot == FN_PROTECT_FIELDS + ? DocumentSettingId::PROTECT_FIELDS + : DocumentSettingId::PROTECT_BOOKMARKS; + rIDSA.set(aSettingId, !rIDSA.get(aSettingId)); // Invalidate so that toggle state gets updated SfxViewFrame* pViewFrame = GetView().GetViewFrame(); pViewFrame->GetBindings().Invalidate(nSlot); @@ -1941,9 +1945,12 @@ void SwTextShell::GetState( SfxItemSet &rSet ) } break; case FN_PROTECT_FIELDS: + case FN_PROTECT_BOOKMARKS: { - bool bProtected - = rSh.getIDocumentSettingAccess().get(DocumentSettingId::PROTECT_FIELDS); + DocumentSettingId aSettingId = nWhich == FN_PROTECT_FIELDS + ? DocumentSettingId::PROTECT_FIELDS + : DocumentSettingId::PROTECT_BOOKMARKS; + bool bProtected = rSh.getIDocumentSettingAccess().get(aSettingId); rSet.Put(SfxBoolItem(nWhich, bProtected)); } break; |