[Libreoffice-commits] core.git: include/sfx2 officecfg/registry sfx2/sdi sfx2/source sw/uiconfig

Gulsah Kose gulsah.1004 at gmail.com
Sun Dec 17 20:51:50 UTC 2017


 include/sfx2/sfxsids.hrc                                             |    2 -
 officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu |    8 ++++
 sfx2/sdi/frmslots.sdi                                                |    5 ++
 sfx2/sdi/sfx.sdi                                                     |   19 ++++++++++
 sfx2/source/view/viewfrm.cxx                                         |   13 +++++-
 sw/uiconfig/swriter/toolbar/standardbar.xml                          |    1 
 sw/uiconfig/swriter/toolbar/viewerbar.xml                            |    1 
 7 files changed, 45 insertions(+), 4 deletions(-)

New commits:
commit 5afa76782d192d66711e02400987d6153ef9e5a7
Author: Gulsah Kose <gulsah.1004 at gmail.com>
Date:   Mon Nov 20 23:45:02 2017 +0300

    tdf#113928 Add uno:ReadOnlyDoc command.
    
    That uno command is opposition to uno:EditDoc command.
    
    Change-Id: I34977a46c274574e8e44097a16c0fa8972d68559
    Signed-off-by: Gulsah Kose <gulsah.1004 at gmail.com>
    Reviewed-on: https://gerrit.libreoffice.org/45005
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Maxim Monastirsky <momonasmon at gmail.com>

diff --git a/include/sfx2/sfxsids.hrc b/include/sfx2/sfxsids.hrc
index 7bac74572f8f..995f3641a744 100644
--- a/include/sfx2/sfxsids.hrc
+++ b/include/sfx2/sfxsids.hrc
@@ -147,7 +147,7 @@
 #define SID_CREATELINK                      (SID_SFX_START + 1309)
 #define SID_EDITDOC                         (SID_SFX_START + 1312)
 #define SID_BROWSER_MODE                    (SID_SFX_START + 1313)
-// FREE (was SID_PLUGINS_ACTIVE)                  (SID_SFX_START + 1314)
+#define SID_READONLYDOC                     (SID_SFX_START + 1314)
 #define SID_BROWSER                         (SID_SFX_START + 1318)
 #define SID_MACROEXECMODE                   (SID_SFX_START + 1319)
 
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
index c5d9664e2aa3..c903fe8b9d21 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
@@ -2841,6 +2841,14 @@
           <value>9</value>
         </prop>
       </node>
+      <node oor:name=".uno:ReadOnlyDoc" oor:op="replace">
+        <prop oor:name="Label" oor:type="xs:string">
+          <value xml:lang="en-US">Read Only Mode</value>
+        </prop>
+        <prop oor:name="TooltipLabel" oor:type="xs:string">
+          <value xml:lang="en-US">Toggle Read Only Mode</value>
+        </prop>
+      </node>
       <node oor:name=".uno:InsertImageControl" oor:op="replace">
         <prop oor:name="Label" oor:type="xs:string">
           <value xml:lang="en-US">Image Control</value>
diff --git a/sfx2/sdi/frmslots.sdi b/sfx2/sdi/frmslots.sdi
index f4c824ec29ab..09aafef95b7d 100644
--- a/sfx2/sdi/frmslots.sdi
+++ b/sfx2/sdi/frmslots.sdi
@@ -208,6 +208,11 @@ interface BrowseWindow : Window
         ExecMethod = ExecReload_Impl ;
         StateMethod = StateReload_Impl ;
     ]
+    SID_READONLYDOC // ole(?opt) api(play/rec)
+    [
+        ExecMethod = ExecReload_Impl ;
+        StateMethod = StateReload_Impl ;
+    ]
     SID_RELOAD // ole(?opt) api(play/rec)
     [
         ExecMethod = ExecReload_Impl ;
diff --git a/sfx2/sdi/sfx.sdi b/sfx2/sdi/sfx.sdi
index 659e3763bfd1..79d10caa0716 100644
--- a/sfx2/sdi/sfx.sdi
+++ b/sfx2/sdi/sfx.sdi
@@ -1050,6 +1050,25 @@ SfxVoidItem EditDoc SID_EDITDOC
 ]
 
 
+SfxVoidItem ReadOnlyDoc SID_READONLYDOC
+(SfxBoolItem Editable SID_EDITDOC)
+[
+    AutoUpdate = TRUE,
+    FastCall = FALSE,
+    ReadOnlyDoc = TRUE,
+    Toggle = FALSE,
+    Container = FALSE,
+    RecordAbsolute = FALSE,
+    RecordPerSet;
+    Asynchron;
+
+    AccelConfig = TRUE,
+    MenuConfig = TRUE,
+    ToolBoxConfig = TRUE,
+    GroupId = SfxGroupId::Document;
+]
+
+
 SfxVoidItem EditMacro SID_BASICIDE_EDITMACRO
 (SfxMacroInfoItem aMacroInfo SID_BASICIDE_ARG_MACROINFO)
 [
diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index e168ac8068bf..448b625dd427 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -254,6 +254,7 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq )
     switch ( rReq.GetSlot() )
     {
         case SID_EDITDOC:
+        case SID_READONLYDOC:
         {
             // Due to Double occupancy in toolboxes (with or without Ctrl),
             // it is also possible that the slot is enabled, but Ctrl-click
@@ -791,6 +792,7 @@ void SfxViewFrame::StateReload_Impl( SfxItemSet& rSet )
         switch ( nWhich )
         {
             case SID_EDITDOC:
+            case SID_READONLYDOC:
             {
                 const SfxViewShell *pVSh;
                 const SfxShell *pFSh;
@@ -800,14 +802,19 @@ void SfxViewFrame::StateReload_Impl( SfxItemSet& rSet )
                        ( !(pVSh = pSh->GetViewShell())  ||
                          !(pFSh = pVSh->GetFormShell()) ||
                          !pFSh->IsDesignMode())))
-                    rSet.DisableItem( SID_EDITDOC );
+                    rSet.DisableItem( nWhich );
                 else
                 {
                     const SfxBoolItem* pItem = SfxItemSet::GetItem<SfxBoolItem>(pSh->GetMedium()->GetItemSet(), SID_EDITDOC, false);
                     if ( pItem && !pItem->GetValue() )
-                        rSet.DisableItem( SID_EDITDOC );
+                        rSet.DisableItem( nWhich );
                     else
-                        rSet.Put( SfxBoolItem( nWhich, !pSh->IsReadOnly() ) );
+                    {
+                        if (nWhich==SID_EDITDOC)
+                            rSet.Put( SfxBoolItem( nWhich, !pSh->IsReadOnly() ) );
+                        else if (nWhich==SID_READONLYDOC)
+                            rSet.Put( SfxBoolItem( nWhich, pSh->IsReadOnly() ) );
+                    }
                 }
                 break;
             }
diff --git a/sw/uiconfig/swriter/toolbar/standardbar.xml b/sw/uiconfig/swriter/toolbar/standardbar.xml
index 10c5b6edf05b..fa35697ffd94 100644
--- a/sw/uiconfig/swriter/toolbar/standardbar.xml
+++ b/sw/uiconfig/swriter/toolbar/standardbar.xml
@@ -28,6 +28,7 @@
  <toolbar:toolbaritem xlink:href=".uno:SendMail" toolbar:visible="false"/>
  <toolbar:toolbarseparator/>
  <toolbar:toolbaritem xlink:href=".uno:EditDoc" toolbar:visible="false"/>
+ <toolbar:toolbaritem xlink:href=".uno:ReadOnlyDoc" toolbar:visible="false"/>
  <toolbar:toolbarseparator/>
  <toolbar:toolbaritem xlink:href=".uno:ExportDirectToPDF"/>
  <toolbar:toolbaritem xlink:href=".uno:ExportDirectToEPUB" toolbar:visible="false"/>
diff --git a/sw/uiconfig/swriter/toolbar/viewerbar.xml b/sw/uiconfig/swriter/toolbar/viewerbar.xml
index 369a7023efe6..98bbea29a426 100644
--- a/sw/uiconfig/swriter/toolbar/viewerbar.xml
+++ b/sw/uiconfig/swriter/toolbar/viewerbar.xml
@@ -21,6 +21,7 @@
  <toolbar:toolbaritem xlink:href=".uno:SaveAs"/>
  <toolbar:toolbarseparator/>
  <toolbar:toolbaritem xlink:href=".uno:EditDoc" toolbar:visible="false"/>
+ <toolbar:toolbaritem xlink:href=".uno:ReadOnlyDoc" toolbar:visible="false"/>
  <toolbar:toolbaritem xlink:href=".uno:SendMail"/>
  <toolbar:toolbarseparator/>
  <toolbar:toolbaritem xlink:href=".uno:ExportDirectToPDF"/>


More information about the Libreoffice-commits mailing list