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

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Tue Nov 26 12:53:56 UTC 2019


 cui/source/customize/cfg.cxx |   33 +++++++++++----------------------
 cui/source/inc/cfg.hxx       |    1 +
 2 files changed, 12 insertions(+), 22 deletions(-)

New commits:
commit 6e6233a5d0940e5bbdb346142091b0ae2e54e640
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon Nov 25 12:15:58 2019 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue Nov 26 13:52:21 2019 +0100

    tdf#126043 identify the frame module just once
    
    Change-Id: I7f68cf67838bb08672975e7a38cf213022e39ed8
    Reviewed-on: https://gerrit.libreoffice.org/83672
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx
index e47bb5d4bf7f..30dd22c71325 100644
--- a/cui/source/customize/cfg.cxx
+++ b/cui/source/customize/cfg.cxx
@@ -1040,12 +1040,12 @@ void SvxConfigPage::Reset( const SfxItemSet* )
             ::comphelper::getProcessComponentContext(), uno::UNO_SET_THROW );
 
         m_xFrame = GetFrame();
-        OUString aModuleId = GetFrameWithDefaultAndIdentify( m_xFrame );
+        m_aModuleId = GetFrameWithDefaultAndIdentify( m_xFrame );
 
         // replace %MODULENAME in the label with the correct module name
         uno::Reference< css::frame::XModuleManager2 > xModuleManager(
             css::frame::ModuleManager::create( xContext ));
-        OUString aModuleName = SvxConfigPageHelper::GetUIModuleName( aModuleId, xModuleManager );
+        OUString aModuleName = SvxConfigPageHelper::GetUIModuleName( m_aModuleId, xModuleManager );
 
         uno::Reference< css::ui::XModuleUIConfigurationManagerSupplier >
             xModuleCfgSupplier( css::ui::theModuleUIConfigurationManagerSupplier::get(xContext) );
@@ -1056,11 +1056,11 @@ void SvxConfigPage::Reset( const SfxItemSet* )
         try
         {
             xCfgMgr =
-                xModuleCfgSupplier->getUIConfigurationManager( aModuleId );
+                xModuleCfgSupplier->getUIConfigurationManager( m_aModuleId );
 
             pModuleData = CreateSaveInData( xCfgMgr,
                                             uno::Reference< css::ui::XUIConfigurationManager >(),
-                                            aModuleId,
+                                            m_aModuleId,
                                             false );
         }
         catch ( container::NoSuchElementException& )
@@ -1077,7 +1077,7 @@ void SvxConfigPage::Reset( const SfxItemSet* )
         OUString aTitle;
         uno::Reference< frame::XController > xController =
             m_xFrame->getController();
-        if ( CanConfig( aModuleId ) && xController.is() )
+        if ( CanConfig( m_aModuleId ) && xController.is() )
         {
             uno::Reference< frame::XModel > xModel( xController->getModel() );
             if ( xModel.is() )
@@ -1096,7 +1096,7 @@ void SvxConfigPage::Reset( const SfxItemSet* )
         SaveInData* pDocData = nullptr;
         if ( xDocCfgMgr.is() )
         {
-            pDocData = CreateSaveInData( xDocCfgMgr, xCfgMgr, aModuleId, true );
+            pDocData = CreateSaveInData( xDocCfgMgr, xCfgMgr, m_aModuleId, true );
 
             if ( !pDocData->IsReadOnly() )
             {
@@ -1144,7 +1144,7 @@ void SvxConfigPage::Reset( const SfxItemSet* )
         DBG_ASSERT( pCurrentSaveInData, "SvxConfigPage::Reset(): no SaveInData" );
 #endif
 
-        if ( CanConfig( aModuleId ) )
+        if ( CanConfig( m_aModuleId ) )
         {
             // Load configuration for other open documents which have
             // same module type
@@ -1178,7 +1178,7 @@ void SvxConfigPage::Reset( const SfxItemSet* )
                     } catch(const uno::Exception&)
                         { aCheckId.clear(); }
 
-                    if ( aModuleId == aCheckId )
+                    if ( m_aModuleId == aCheckId )
                     {
                         // try to get the document based ui configuration manager
                         OUString aTitle2;
@@ -1207,7 +1207,7 @@ void SvxConfigPage::Reset( const SfxItemSet* )
 
                         if ( xDocCfgMgr.is() )
                         {
-                            SaveInData* pData = CreateSaveInData( xDocCfgMgr, xCfgMgr, aModuleId, true );
+                            SaveInData* pData = CreateSaveInData( xDocCfgMgr, xCfgMgr, m_aModuleId, true );
 
                             if ( pData && !pData->IsReadOnly() )
                             {
@@ -1406,9 +1406,8 @@ int SvxConfigPage::AddFunction(int nTarget, bool bAllowDuplicates)
     }
 
     OUString aDisplayName;
-    OUString aModuleId = vcl::CommandInfoProvider::GetModuleIdentifier( m_xFrame );
 
-    auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(aURL, aModuleId);
+    auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(aURL, m_aModuleId);
 
     if ( typeid(*pCurrentSaveInData) == typeid(ContextMenuSaveInData) )
         aDisplayName = vcl::CommandInfoProvider::GetPopupLabelForCommand(aProperties);
diff --git a/cui/source/inc/cfg.hxx b/cui/source/inc/cfg.hxx
index 0cd522354124..80b0e29d009b 100644
--- a/cui/source/inc/cfg.hxx
+++ b/cui/source/inc/cfg.hxx
@@ -381,6 +381,7 @@ protected:
     OUString                                   m_aURLToSelect;
 
     css::uno::Reference< css::frame::XFrame >  m_xFrame;
+    OUString                                   m_aModuleId;
 
     // Left side of the dialog where command categories and the available
     // commands in them are displayed as a searchable list
commit 9426162a3b24732167e4fa7aa2fa6ee19d33e7e9
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon Nov 25 12:10:01 2019 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue Nov 26 13:51:58 2019 +0100

    tdf#126043 use CommandInfoProvider::GetModuleIdentifier
    
    which probably already has a cached ModuleManager
    
    Change-Id: Id653e57ecf40061ace086881344a85d7413a5afc
    Reviewed-on: https://gerrit.libreoffice.org/83671
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx
index d3a04baa1e7c..e47bb5d4bf7f 100644
--- a/cui/source/customize/cfg.cxx
+++ b/cui/source/customize/cfg.cxx
@@ -1267,17 +1267,7 @@ OUString SvxConfigPage::GetFrameWithDefaultAndIdentify( uno::Reference< frame::X
             return sModuleID;
         }
 
-        uno::Reference< css::frame::XModuleManager2 > xModuleManager(
-                css::frame::ModuleManager::create( xContext ) );
-
-        try
-        {
-            sModuleID = xModuleManager->identify( _inout_rxFrame );
-        }
-        catch ( const frame::UnknownModuleException& )
-        {
-        }
-
+        sModuleID = vcl::CommandInfoProvider::GetModuleIdentifier(_inout_rxFrame);
     }
     catch( const uno::Exception& )
     {


More information about the Libreoffice-commits mailing list