summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2020-02-13 09:37:20 +0100
committerSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2020-02-13 15:39:22 +0100
commit4a5c627e61dc1bd67106a18319eabecb50b79658 (patch)
tree59cdb589ad6775959fea64003bb9fb746d300d1a
parent618d1f1085cd7a9c672b851944aae106868266fa (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>
-rw-r--r--officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu8
-rw-r--r--sw/inc/cmdid.h1
-rw-r--r--sw/sdi/_textsh.sdi6
-rw-r--r--sw/sdi/swriter.sdi18
-rw-r--r--sw/source/uibase/shells/textsh1.cxx13
5 files changed, 43 insertions, 3 deletions
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
index b526f60ea6a9..d713b2593ef2 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
@@ -3604,6 +3604,14 @@
<value>1</value>
</prop>
</node>
+ <node oor:name=".uno:ProtectBookmarks" oor:op="replace">
+ <prop oor:name="Label" oor:type="xs:string">
+ <value xml:lang="en-US">Protect Bookmarks</value>
+ </prop>
+ <prop oor:name="Properties" oor:type="xs:int">
+ <value>1</value>
+ </prop>
+ </node>
</node>
</node>
</oor:component-data>
diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h
index 2dfb720bb854..b43a852d38e4 100644
--- a/sw/inc/cmdid.h
+++ b/sw/inc/cmdid.h
@@ -285,6 +285,7 @@
#define FN_INSERT_DATE_FORMFIELD (FN_INSERT2 + 25)
#define FN_PROTECT_FIELDS (FN_INSERT2 + 26)
+#define FN_PROTECT_BOOKMARKS (FN_INSERT2 + 27)
// clipboard table content
#define FN_PASTE_NESTED_TABLE (FN_INSERT2 + 30) /* instead of the cell-by-cell copy between source and target tables */
diff --git a/sw/sdi/_textsh.sdi b/sw/sdi/_textsh.sdi
index 9bc92512435b..df370c510b02 100644
--- a/sw/sdi/_textsh.sdi
+++ b/sw/sdi/_textsh.sdi
@@ -1746,6 +1746,12 @@ interface BaseText
StateMethod = GetState ;
]
+ FN_PROTECT_BOOKMARKS
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+
SID_FM_CTL_PROPERTIES
[
ExecMethod = Execute ;
diff --git a/sw/sdi/swriter.sdi b/sw/sdi/swriter.sdi
index dbc6196feeb1..4634ad612069 100644
--- a/sw/sdi/swriter.sdi
+++ b/sw/sdi/swriter.sdi
@@ -7935,6 +7935,24 @@ SfxBoolItem ProtectFields FN_PROTECT_FIELDS
GroupId = SfxGroupId::Controls;
]
+SfxBoolItem ProtectBookmarks FN_PROTECT_BOOKMARKS
+
+[
+ AutoUpdate = TRUE,
+ FastCall = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = TRUE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+
+
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ ToolBoxConfig = TRUE,
+ GroupId = SfxGroupId::Controls;
+]
+
SfxUInt32Item TableRowHeight SID_ATTR_TABLE_ROW_HEIGHT
[
diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx
index a6893e5f39e1..88d8fbcd2557 100644
--- a/sw/source/uibase/shells/textsh1.cxx
+++ b/sw/source/uibase/shells/textsh1.cxx
@@ -1385,9 +1385,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);
@@ -2171,9 +2175,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;