[Libreoffice-commits] core.git: officecfg/registry sw/inc sw/sdi sw/source

Samuel Mehrbrodt (via logerrit) logerrit at kemper.freedesktop.org
Thu Feb 13 14:39:56 UTC 2020


 officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu |    8 ++++
 sw/inc/cmdid.h                                                      |    1 
 sw/sdi/_textsh.sdi                                                  |    6 +++
 sw/sdi/swriter.sdi                                                  |   18 ++++++++++
 sw/source/uibase/shells/textsh1.cxx                                 |   13 +++++--
 5 files changed, 43 insertions(+), 3 deletions(-)

New commits:
commit 4a5c627e61dc1bd67106a18319eabecb50b79658
Author:     Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
AuthorDate: Thu Feb 13 09:37:20 2020 +0100
Commit:     Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
CommitDate: Thu Feb 13 15:39:22 2020 +0100

    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 at cib.de>

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;


More information about the Libreoffice-commits mailing list