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

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


 officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu |    8 ++++
 sw/inc/cmdid.h                                                      |    2 +
 sw/sdi/_textsh.sdi                                                  |    6 +++
 sw/sdi/swriter.sdi                                                  |   18 ++++++++++
 sw/source/uibase/shells/textsh1.cxx                                 |   17 +++++++++
 5 files changed, 51 insertions(+)

New commits:
commit 087d9191ab642e4b00afb71571d83ffe04589769
Author:     Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
AuthorDate: Thu Feb 13 09:21:41 2020 +0100
Commit:     Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
CommitDate: Thu Feb 13 14:49:15 2020 +0100

    Add uno cmd to protect fields in a document
    
    Change-Id: Ifb9f757111a6fcbb283d2350ed2ccd42de19d5df
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88585
    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 a40119acbfb9..b526f60ea6a9 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
@@ -3596,6 +3596,14 @@
           <value xml:lang="en-US">Content Controls</value>
         </prop>
       </node>
+      <node oor:name=".uno:ProtectFields" oor:op="replace">
+        <prop oor:name="Label" oor:type="xs:string">
+          <value xml:lang="en-US">Protect Fields</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 68f640199c0f..2dfb720bb854 100644
--- a/sw/inc/cmdid.h
+++ b/sw/inc/cmdid.h
@@ -284,6 +284,8 @@
 // MSO content controls
 #define FN_INSERT_DATE_FORMFIELD        (FN_INSERT2 + 25)
 
+#define FN_PROTECT_FIELDS               (FN_INSERT2 + 26)
+
 // clipboard table content
 #define FN_PASTE_NESTED_TABLE       (FN_INSERT2 + 30)  /* instead of the cell-by-cell copy between source and target tables */
 #define FN_TABLE_PASTE_ROW_BEFORE   (FN_INSERT2 + 31)  /* paste table as new table rows */
diff --git a/sw/sdi/_textsh.sdi b/sw/sdi/_textsh.sdi
index b91292dea316..9bc92512435b 100644
--- a/sw/sdi/_textsh.sdi
+++ b/sw/sdi/_textsh.sdi
@@ -1740,6 +1740,12 @@ interface BaseText
         StateMethod = StateField ;
     ]
 
+    FN_PROTECT_FIELDS
+    [
+        ExecMethod = Execute ;
+        StateMethod = GetState ;
+    ]
+
     SID_FM_CTL_PROPERTIES
     [
         ExecMethod = Execute ;
diff --git a/sw/sdi/swriter.sdi b/sw/sdi/swriter.sdi
index 524018f1b90c..dbc6196feeb1 100644
--- a/sw/sdi/swriter.sdi
+++ b/sw/sdi/swriter.sdi
@@ -7917,6 +7917,24 @@ SfxVoidItem DatePickerFormField FN_INSERT_DATE_FORMFIELD
     GroupId = SfxGroupId::Controls;
 ]
 
+SfxBoolItem ProtectFields FN_PROTECT_FIELDS
+
+[
+    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 f8bd62cab79c..a6893e5f39e1 100644
--- a/sw/source/uibase/shells/textsh1.cxx
+++ b/sw/source/uibase/shells/textsh1.cxx
@@ -1384,6 +1384,16 @@ void SwTextShell::Execute(SfxRequest &rReq)
         GetView().UpdateWordCount(this, nSlot);
     }
     break;
+    case FN_PROTECT_FIELDS:
+    {
+        IDocumentSettingAccess& rIDSA = rWrtSh.getIDocumentSettingAccess();
+        rIDSA.set(DocumentSettingId::PROTECT_FIELDS, !rIDSA.get(DocumentSettingId::PROTECT_FIELDS));
+        // Invalidate so that toggle state gets updated
+        SfxViewFrame* pViewFrame = GetView().GetViewFrame();
+        pViewFrame->GetBindings().Invalidate(nSlot);
+        pViewFrame->GetBindings().Update(nSlot);
+    }
+    break;
     case SID_FM_CTL_PROPERTIES:
     {
         SwPosition aPos(*GetShell().GetCursor()->GetPoint());
@@ -2160,6 +2170,13 @@ void SwTextShell::GetState( SfxItemSet &rSet )
                     rSet.DisableItem(nWhich);
                 break;
             }
+            case FN_PROTECT_FIELDS:
+            {
+                bool bProtected
+                    = rSh.getIDocumentSettingAccess().get(DocumentSettingId::PROTECT_FIELDS);
+                rSet.Put(SfxBoolItem(nWhich, bProtected));
+            }
+            break;
         }
         nWhich = aIter.NextWhich();
     }


More information about the Libreoffice-commits mailing list