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

Maxim Monastirsky momonasmon at gmail.com
Tue May 16 20:09:11 UTC 2017


 cui/source/customize/acccfg.cxx  |    2 +-
 cui/source/customize/cfgutil.cxx |   19 +++++++++++--------
 cui/source/inc/cfgutil.hxx       |    4 ++--
 3 files changed, 14 insertions(+), 11 deletions(-)

New commits:
commit 4e52299a6aff1386151223a99e7ed3a49496d967
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date:   Tue May 16 02:22:30 2017 +0300

    tdf#107853 tdf#107854 Hide useless style families
    
    Change-Id: I9918cbbf6b030e0f1f0a5dee153bedc8a53f91d8
    Reviewed-on: https://gerrit.libreoffice.org/37688
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Maxim Monastirsky <momonasmon at gmail.com>

diff --git a/cui/source/customize/acccfg.cxx b/cui/source/customize/acccfg.cxx
index dfaf2004d173..f5d90803fc58 100644
--- a/cui/source/customize/acccfg.cxx
+++ b/cui/source/customize/acccfg.cxx
@@ -924,7 +924,7 @@ void SfxAcceleratorConfigPage::Init(const uno::Reference<ui::XAcceleratorConfigu
         if (xController.is())
             xModel = xController->getModel();
 
-        m_aStylesInfo.setModel(xModel);
+        m_aStylesInfo.init(m_sModuleLongName, xModel);
         m_pFunctionBox->SetStylesInfo(&m_aStylesInfo);
         m_pGroupLBox->SetStylesInfo(&m_aStylesInfo);
         m_bStylesInfoInitialized = true;
diff --git a/cui/source/customize/cfgutil.cxx b/cui/source/customize/cfgutil.cxx
index ad171a755354..408c74331950 100644
--- a/cui/source/customize/cfgutil.cxx
+++ b/cui/source/customize/cfgutil.cxx
@@ -76,8 +76,9 @@ using namespace ::com::sun::star::document;
 SfxStylesInfo_Impl::SfxStylesInfo_Impl()
 {}
 
-void SfxStylesInfo_Impl::setModel(const css::uno::Reference< css::frame::XModel >& xModel)
+void SfxStylesInfo_Impl::init(const OUString& rModuleName, const css::uno::Reference< css::frame::XModel >& xModel)
 {
+    m_aModuleName = rModuleName;
     m_xDoc = xModel;
 }
 
@@ -171,12 +172,14 @@ std::vector< SfxStyleInfo_Impl > SfxStylesInfo_Impl::getStyleFamilies()
     css::uno::Reference< css::container::XNameAccess > xCont = xModel->getStyleFamilies();
     css::uno::Sequence< OUString > lFamilyNames = xCont->getElementNames();
     std::vector< SfxStyleInfo_Impl > lFamilies;
-    sal_Int32 c = lFamilyNames.getLength();
-    sal_Int32 i = 0;
-    for(i=0; i<c; ++i)
+    for (const auto& aFamily : lFamilyNames)
     {
+        if ((aFamily == "CellStyles" && m_aModuleName != "com.sun.star.sheet.SpreadsheetDocument") ||
+             aFamily == "cell" || aFamily == "table" || aFamily == "Default")
+            continue;
+
         SfxStyleInfo_Impl aFamilyInfo;
-        aFamilyInfo.sFamily = lFamilyNames[i];
+        aFamilyInfo.sFamily = aFamily;
 
         try
         {
@@ -1189,9 +1192,9 @@ SvxScriptSelectorDialog::SvxScriptSelectorDialog(
     m_pOKButton->Show();
 
     get(m_pCategories, "categories");
+    const OUString aModuleName(vcl::CommandInfoProvider::GetModuleIdentifier(xFrame));
     m_pCategories->SetFunctionListBox(m_pCommands);
-    m_pCategories->Init(comphelper::getProcessComponentContext(), xFrame,
-                        vcl::CommandInfoProvider::GetModuleIdentifier(xFrame), bShowSlots);
+    m_pCategories->Init(comphelper::getProcessComponentContext(), xFrame, aModuleName, bShowSlots);
 
     m_pCategories->SetSelectHdl(
             LINK( this, SvxScriptSelectorDialog, SelectHdl ) );
@@ -1211,7 +1214,7 @@ SvxScriptSelectorDialog::SvxScriptSelectorDialog(
     if (xController.is())
         xModel = xController->getModel();
 
-    m_aStylesInfo.setModel(xModel);
+    m_aStylesInfo.init(aModuleName, xModel);
     m_pCommands->SetStylesInfo(&m_aStylesInfo);
     m_pCategories->SetStylesInfo(&m_aStylesInfo);
 
diff --git a/cui/source/inc/cfgutil.hxx b/cui/source/inc/cfgutil.hxx
index d053555bba86..acc0020daa1f 100644
--- a/cui/source/inc/cfgutil.hxx
+++ b/cui/source/inc/cfgutil.hxx
@@ -61,13 +61,13 @@ struct SfxStyleInfo_Impl
 struct SfxStylesInfo_Impl
 {
 private:
-
+        OUString m_aModuleName;
         css::uno::Reference< css::frame::XModel > m_xDoc;
 
 public:
 
         SfxStylesInfo_Impl();
-        void setModel(const css::uno::Reference< css::frame::XModel >& xModel);
+        void init(const OUString& rModuleName, const css::uno::Reference< css::frame::XModel >& xModel);
 
         static bool parseStyleCommand(SfxStyleInfo_Impl& aStyle);
         void getLabel4Style(SfxStyleInfo_Impl& aStyle);


More information about the Libreoffice-commits mailing list