[Libreoffice-commits] core.git: 2 commits - framework/source

Maxim Monastirsky momonasmon at gmail.com
Sun Dec 20 04:49:39 PST 2015


 framework/source/uielement/resourcemenucontroller.cxx |   19 ++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)

New commits:
commit f4fabf4270945beaa62c047056def378c992555c
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date:   Sun Dec 20 14:28:56 2015 +0200

    Probably a better way to detect readonly doc
    
    Change-Id: I91f260ad878eba0bd7459c4246357e768c158765

diff --git a/framework/source/uielement/resourcemenucontroller.cxx b/framework/source/uielement/resourcemenucontroller.cxx
index dcbc607..a626e35 100644
--- a/framework/source/uielement/resourcemenucontroller.cxx
+++ b/framework/source/uielement/resourcemenucontroller.cxx
@@ -9,12 +9,13 @@
 
 #include <uielement/menubarmanager.hxx>
 
+#include <cppuhelper/implbase.hxx>
 #include <svtools/popupmenucontrollerbase.hxx>
-#include <unotools/mediadescriptor.hxx>
 
 #include <com/sun/star/embed/VerbAttributes.hpp>
 #include <com/sun/star/embed/VerbDescriptor.hpp>
 #include <com/sun/star/frame/ModuleManager.hpp>
+#include <com/sun/star/frame/XStorable.hpp>
 #include <com/sun/star/ui/theModuleUIConfigurationManagerSupplier.hpp>
 #include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp>
 #include <com/sun/star/util/URL.hpp>
@@ -210,17 +211,11 @@ void ResourceMenuController::addVerbs( const css::uno::Sequence< css::embed::Ver
 {
     // Check if the document is read-only.
     css::uno::Reference< css::frame::XController > xController( m_xFrame->getController() );
-    css::uno::Reference< css::frame::XModel > xModel;
+    css::uno::Reference< css::frame::XStorable > xStorable;
     if ( xController.is() )
-        xModel.set( xController->getModel() );
-
-    bool bReadOnly = false;
-    if ( xModel.is() )
-    {
-        utl::MediaDescriptor aMediaDesc( xModel->getArgs() );
-        bReadOnly = aMediaDesc.getUnpackedValueOrDefault( utl::MediaDescriptor::PROP_READONLY(), false );
-    }
+        xStorable.set( xController->getModel(), css::uno::UNO_QUERY );
 
+    bool bReadOnly = xStorable.is() && xStorable->isReadonly();
     VCLXMenu* pAwtMenu = VCLXMenu::GetImplementation( m_xPopupMenu );
     Menu* pVCLMenu = pAwtMenu->GetMenu();
 
commit d62f22570dfa767cc646f362eb2f6a2f78113874
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date:   Sun Dec 20 14:17:36 2015 +0200

    ResourceMenuController: fix detection of verbs for readonly docs
    
    Change-Id: If1f84e6ace0e42b69b8cd845e4827f1aed6552df

diff --git a/framework/source/uielement/resourcemenucontroller.cxx b/framework/source/uielement/resourcemenucontroller.cxx
index a5c55d5..dcbc607 100644
--- a/framework/source/uielement/resourcemenucontroller.cxx
+++ b/framework/source/uielement/resourcemenucontroller.cxx
@@ -226,8 +226,8 @@ void ResourceMenuController::addVerbs( const css::uno::Sequence< css::embed::Ver
 
     for ( const auto& rVerb : rVerbs )
     {
-        if ( rVerb.VerbAttributes ^ css::embed::VerbAttributes::MS_VERBATTR_ONCONTAINERMENU ||
-            ( bReadOnly && rVerb.VerbAttributes ^ css::embed::VerbAttributes::MS_VERBATTR_NEVERDIRTIES ) )
+        if ( !( rVerb.VerbAttributes & css::embed::VerbAttributes::MS_VERBATTR_ONCONTAINERMENU ) ||
+            ( bReadOnly && !( rVerb.VerbAttributes & css::embed::VerbAttributes::MS_VERBATTR_NEVERDIRTIES ) ) )
             continue;
 
         pVCLMenu->InsertItem( m_nNewMenuId, rVerb.VerbName );


More information about the Libreoffice-commits mailing list