[Libreoffice-commits] core.git: Branch 'feature/cib_contract138c' - 3 commits - configure.ac include/sfx2 officecfg/registry sfx2/source

Samuel Mehrbrodt (via logerrit) logerrit at kemper.freedesktop.org
Mon Mar 30 07:53:23 UTC 2020


 configure.ac                                               |    2 -
 include/sfx2/viewsh.hxx                                    |    2 +
 officecfg/registry/schema/org/openoffice/Office/Common.xcs |    6 +++
 sfx2/source/view/viewfrm.cxx                               |   23 ++++++++++---
 sfx2/source/view/viewsh.cxx                                |    8 ++++
 5 files changed, 35 insertions(+), 6 deletions(-)

New commits:
commit eef5cd364f709ea9abe2286eb252ffcf0f344ed6
Author:     Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
AuthorDate: Mon Mar 30 09:52:39 2020 +0200
Commit:     Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
CommitDate: Mon Mar 30 09:52:39 2020 +0200

    Release 6.2.9.5
    
    Change-Id: Ifec052fc5bd5a11ced8edccd8785da3c986f1d3e

diff --git a/configure.ac b/configure.ac
index 048e78059163..7120703cfeb8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -9,7 +9,7 @@ dnl in order to create a configure script.
 # several non-alphanumeric characters, those are split off and used only for the
 # ABOUTBOXPRODUCTVERSIONSUFFIX in openoffice.lst. Why that is necessary, no idea.
 
-AC_INIT([LibreOffice],[6.2.9.4],[],[],[http://documentfoundation.org/])
+AC_INIT([LibreOffice],[6.2.9.5],[],[],[http://documentfoundation.org/])
 
 AC_PREREQ([2.59])
 
commit ac4acb66485c54746721201d0b107ccca63ab049
Author:     Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
AuthorDate: Mon Mar 30 09:51:34 2020 +0200
Commit:     Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
CommitDate: Mon Mar 30 09:51:34 2020 +0200

    Evaluate the AllowEditReadonlyDocs config option
    
    Partial backport of a474e2267cdcb1707333acdea1353d883d58c801
    
    Change-Id: I33fb8c526839a74d0e959c75ad6cb9e4d0614f5d

diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index f15e0fc670be..b1d29d0f09fa 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -278,6 +278,11 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq )
             if( !pSh || !pSh->HasName() || !(pSh->Get_Impl()->nLoadedFlags & SfxLoadedFlags::MAINDOCUMENT ))
                 break;
 
+
+            SfxViewShell* pViewSh = GetViewShell();
+            if (pViewSh && pViewSh->isEditDocLocked())
+                break;
+
             // Only change read-only UI and remove info bar when we succeed
             struct ReadOnlyUIGuard
             {
@@ -863,6 +868,7 @@ void SfxViewFrame::StateReload_Impl( SfxItemSet& rSet )
                 const SfxShell *pFSh;
                 if ( !pSh->HasName() ||
                      !( pSh->Get_Impl()->nLoadedFlags &  SfxLoadedFlags::MAINDOCUMENT ) ||
+                     (GetViewShell() && GetViewShell()->isEditDocLocked()) ||
                      ( pSh->GetCreateMode() == SfxObjectCreateMode::EMBEDDED &&
                        ( !(pVSh = pSh->GetViewShell())  ||
                          !(pFSh = pVSh->GetFormShell()) ||
@@ -1300,11 +1306,18 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
                             pInfoBar->addButton(xSignButton);
                         }
 
-                        VclPtrInstance<PushButton> xBtn(&GetWindow());
-                        xBtn->SetText(SfxResId(STR_READONLY_EDIT));
-                        xBtn->SetSizePixel(xBtn->GetOptimalSize());
-                        xBtn->SetClickHdl(LINK(this, SfxViewFrame, SwitchReadOnlyHandler));
-                        pInfoBar->addButton(xBtn);
+                        bool showEditDocumentButton = true;
+                        if (m_xObjSh->GetViewShell() && m_xObjSh->GetViewShell()->isEditDocLocked())
+                            showEditDocumentButton = false;
+
+                        if (showEditDocumentButton)
+                        {
+                            VclPtrInstance<PushButton> xBtn(&GetWindow());
+                            xBtn->SetText(SfxResId(STR_READONLY_EDIT));
+                            xBtn->SetSizePixel(xBtn->GetOptimalSize());
+                            xBtn->SetClickHdl(LINK(this, SfxViewFrame, SwitchReadOnlyHandler));
+                            pInfoBar->addButton(xBtn);
+                        }
                     }
                 }
 
commit 22a9d3837f3552806e0a8d149962134928f00e74
Author:     Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
AuthorDate: Thu Mar 26 16:29:46 2020 +0100
Commit:     Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
CommitDate: Mon Mar 30 09:51:04 2020 +0200

    tdf#101652 Add config option to prevent disabling readonly mode
    
    There are various cases where people don't want users to
    be able to turn off readonly mode, so add a config option for it.
    
    Setting this option will remove the "Edit document" button from
    the readonly infobar and also disable the "Edit mode" menu entry.
    
    Change-Id: I7988da5b181455f778a6ab148e6bf32182c72618

diff --git a/include/sfx2/viewsh.hxx b/include/sfx2/viewsh.hxx
index cb185bb7b058..a88fe07c58dd 100644
--- a/include/sfx2/viewsh.hxx
+++ b/include/sfx2/viewsh.hxx
@@ -295,6 +295,8 @@ public:
     void                        AddRemoveClipboardListener( const css::uno::Reference < css::datatransfer::clipboard::XClipboardListener>&, bool );
     css::uno::Reference< css::datatransfer::clipboard::XClipboardNotifier > GetClipboardNotifier();
 
+    bool isEditDocLocked();
+
     SAL_DLLPRIVATE SfxInPlaceClient* GetUIActiveIPClient_Impl() const;
     SAL_DLLPRIVATE void AddContextMenuInterceptor_Impl( const css::uno::Reference < css::ui::XContextMenuInterceptor >& xInterceptor );
     SAL_DLLPRIVATE void RemoveContextMenuInterceptor_Impl( const css::uno::Reference < css::ui::XContextMenuInterceptor >& xInterceptor );
diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
index 31a79ae045a9..3cb8ace6ab8c 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
@@ -5637,6 +5637,12 @@
           <desc>Contains the Personas installed through extensions</desc>
         </info>
       </set>
+      <prop oor:name="AllowEditReadonlyDocs" oor:type="xs:boolean" oor:nillable="false">
+        <info>
+          <desc>Allow the user to edit read-only docs (via menu or Infobar)</desc>
+        </info>
+        <value>true</value>
+      </prop>
     </group>
     <group oor:name="Forms">
       <info>
diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx
index f7b3d2166b8b..81cc04a222f4 100644
--- a/sfx2/source/view/viewsh.cxx
+++ b/sfx2/source/view/viewsh.cxx
@@ -59,6 +59,7 @@
 #include <vcl/commandinfoprovider.hxx>
 #include <LibreOfficeKit/LibreOfficeKitEnums.h>
 
+#include <officecfg/Office/Common.hxx>
 #include <officecfg/Setup.hxx>
 #include <sfx2/app.hxx>
 #include <sfx2/flatpak.hxx>
@@ -1754,6 +1755,13 @@ void SfxViewShell::SetController( SfxBaseController* pController )
     pImpl->xClipboardListener = new SfxClipboardChangeListener( this, GetClipboardNotifier() );
 }
 
+bool SfxViewShell::isEditDocLocked()
+{
+    if (!officecfg::Office::Common::Misc::AllowEditReadonlyDocs::get())
+        return true;
+    return false;
+}
+
 Reference < XController > SfxViewShell::GetController()
 {
     return pImpl->m_pController.get();


More information about the Libreoffice-commits mailing list