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

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Fri Jul 23 15:57:44 UTC 2021


 cui/source/options/optgdlg.cxx         |   11 ++++--
 include/sfx2/weldutils.hxx             |    2 -
 include/svtools/miscopt.hxx            |    2 -
 sfx2/source/sidebar/SidebarToolBox.cxx |    2 -
 sfx2/source/toolbox/weldutils.cxx      |    5 +-
 svtools/source/config/miscopt.cxx      |   57 ---------------------------------
 6 files changed, 12 insertions(+), 67 deletions(-)

New commits:
commit 44f32fc9c1cf95c77b725a4aa0ab405330135ad6
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Fri Jul 23 10:41:24 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Jul 23 17:57:11 2021 +0200

    use officecfg to retrieve SidebarIconSize
    
    Change-Id: Id1cc4b8e3e28d942b44deacafbc514bbcd95874c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119411
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx
index fa4598b30f4e..04d2683c921e 100644
--- a/cui/source/options/optgdlg.cxx
+++ b/cui/source/options/optgdlg.cxx
@@ -704,7 +704,9 @@ bool OfaViewTabPage::FillItemSet( SfxItemSet* )
             default:
                 OSL_FAIL( "OfaViewTabPage::FillItemSet(): This state of m_xSidebarIconSizeLB should not be possible!" );
         }
-        aMiscOptions.SetSidebarIconSize( eSet );
+        auto xChanges = comphelper::ConfigurationChanges::create();
+        officecfg::Office::Common::Misc::SidebarIconSize::set(static_cast<sal_Int16>(eSet), xChanges);
+        xChanges->commit();
     }
 
     const sal_Int32 nNotebookbarSizeLB_NewSelection = m_xNotebookbarIconSizeLB->get_active();
@@ -885,11 +887,12 @@ void OfaViewTabPage::Reset( const SfxItemSet* )
     m_xIconSizeLB->set_active( nSizeLB_InitialSelection );
     m_xIconSizeLB->save_value();
 
-    if( aMiscOptions.GetSidebarIconSize() == ToolBoxButtonSize::DontCare )
+    ToolBoxButtonSize eSidebarIconSize = static_cast<ToolBoxButtonSize>(officecfg::Office::Common::Misc::SidebarIconSize::get());
+    if( eSidebarIconSize == ToolBoxButtonSize::DontCare )
         ; // do nothing
-    else if( aMiscOptions.GetSidebarIconSize() == ToolBoxButtonSize::Small )
+    else if( eSidebarIconSize == ToolBoxButtonSize::Small )
         nSidebarSizeLB_InitialSelection = 1;
-    else if( aMiscOptions.GetSidebarIconSize() == ToolBoxButtonSize::Large )
+    else if( eSidebarIconSize == ToolBoxButtonSize::Large )
         nSidebarSizeLB_InitialSelection = 2;
     m_xSidebarIconSizeLB->set_active( nSidebarSizeLB_InitialSelection );
     m_xSidebarIconSizeLB->save_value();
diff --git a/include/sfx2/weldutils.hxx b/include/sfx2/weldutils.hxx
index 799d203ff94a..5807fc88b1cc 100644
--- a/include/sfx2/weldutils.hxx
+++ b/include/sfx2/weldutils.hxx
@@ -41,7 +41,7 @@ private:
     DECL_LINK(ChangedIconSizeHandler, LinkParamNone*, void);
 
     void CreateController(const OUString& rCommand);
-    vcl::ImageType GetIconSize() const;
+    static vcl::ImageType GetIconSize();
 
     typedef std::map<OUString, css::uno::Reference<css::frame::XToolbarController>>
         ControllerContainer;
diff --git a/include/svtools/miscopt.hxx b/include/svtools/miscopt.hxx
index f7c5108d752d..1b04df72195d 100644
--- a/include/svtools/miscopt.hxx
+++ b/include/svtools/miscopt.hxx
@@ -56,8 +56,6 @@ class SVT_DLLPUBLIC SvtMiscOptions final : public utl::detail::Options
 
         sal_Int16   GetSymbolsSize() const;
         void        SetSymbolsSize( sal_Int16 eSet );
-        ToolBoxButtonSize   GetSidebarIconSize() const;
-        void        SetSidebarIconSize( ToolBoxButtonSize eSet );
         sal_Int16   GetCurrentSymbolsSize() const;
         bool        AreCurrentSymbolsLarge() const;
 
diff --git a/sfx2/source/sidebar/SidebarToolBox.cxx b/sfx2/source/sidebar/SidebarToolBox.cxx
index bcdd31a7d17d..bb89d007bbb0 100644
--- a/sfx2/source/sidebar/SidebarToolBox.cxx
+++ b/sfx2/source/sidebar/SidebarToolBox.cxx
@@ -107,7 +107,7 @@ void SidebarToolBox::dispose()
 
 ToolBoxButtonSize SidebarToolBox::GetDefaultButtonSize() const
 {
-    return SvtMiscOptions().GetSidebarIconSize();
+    return static_cast<ToolBoxButtonSize>(officecfg::Office::Common::Misc::SidebarIconSize::get());
 }
 
 void SidebarToolBox::InsertItem(const OUString& rCommand,
diff --git a/sfx2/source/toolbox/weldutils.cxx b/sfx2/source/toolbox/weldutils.cxx
index b0055e027ac8..5c1f1c58fa4f 100644
--- a/sfx2/source/toolbox/weldutils.cxx
+++ b/sfx2/source/toolbox/weldutils.cxx
@@ -7,6 +7,7 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
+#include <officecfg/Office/Common.hxx>
 #include <com/sun/star/frame/XSubToolbarController.hpp>
 #include <sidebar/ControllerFactory.hxx>
 #include <sfx2/weldutils.hxx>
@@ -53,10 +54,10 @@ bool lcl_RTLizeCommandURL(OUString& rCommandURL)
 }
 
 // for now all controllers are in the sidebar
-vcl::ImageType ToolbarUnoDispatcher::GetIconSize() const
+vcl::ImageType ToolbarUnoDispatcher::GetIconSize()
 {
     vcl::ImageType eType = vcl::ImageType::Size16;
-    switch (m_aToolbarOptions.GetSidebarIconSize())
+    switch (static_cast<ToolBoxButtonSize>(officecfg::Office::Common::Misc::SidebarIconSize::get()))
     {
         case ToolBoxButtonSize::Large:
             eType = vcl::ImageType::Size26;
diff --git a/svtools/source/config/miscopt.cxx b/svtools/source/config/miscopt.cxx
index 6ebb4124c9ab..4d1f4575d885 100644
--- a/svtools/source/config/miscopt.cxx
+++ b/svtools/source/config/miscopt.cxx
@@ -47,8 +47,6 @@ using namespace ::com::sun::star;
 #define PROPERTYHANDLE_SYMBOLSET                0
 #define PROPERTYNAME_ICONTHEME              "SymbolStyle"
 #define PROPERTYHANDLE_SYMBOLSTYLE              1
-#define PROPERTYNAME_SIDEBARICONSIZE        "SidebarIconSize"
-#define PROPERTYHANDLE_SIDEBARICONSIZE          2
 
 class SvtMiscOptions_Impl : public ConfigItem
 {
@@ -56,8 +54,6 @@ private:
     ::std::vector<Link<LinkParamNone*,void>> aList;
     sal_Int16   m_nSymbolsSize;
     bool        m_bIsSymbolsSizeRO;
-    ToolBoxButtonSize m_nSidebarIconSize;
-    bool        m_bIsSidebarIconSizeRO;
     bool        m_bIsSymbolsStyleRO;
     bool        m_bIconThemeWasSetAutomatically;
 
@@ -92,13 +88,8 @@ public:
         sal_Int16 GetSymbolsSize() const
         { return m_nSymbolsSize; }
 
-        ToolBoxButtonSize GetSidebarIconSize() const
-        { return m_nSidebarIconSize; }
-
         void SetSymbolsSize( sal_Int16 nSet );
 
-        void SetSidebarIconSize( ToolBoxButtonSize nSet );
-
         static OUString GetIconTheme();
 
         enum class SetModifiedFlag { SET, DONT_SET };
@@ -150,8 +141,6 @@ SvtMiscOptions_Impl::SvtMiscOptions_Impl()
 
     , m_nSymbolsSize( 0 )
     , m_bIsSymbolsSizeRO( false )
-    , m_nSidebarIconSize( ToolBoxButtonSize::DontCare )
-    , m_bIsSidebarIconSizeRO( false )
     , m_bIsSymbolsStyleRO( false )
     , m_bIconThemeWasSetAutomatically( false )
 {
@@ -184,18 +173,6 @@ SvtMiscOptions_Impl::SvtMiscOptions_Impl()
                 break;
             }
 
-            case PROPERTYHANDLE_SIDEBARICONSIZE :
-            {
-                sal_uInt16 nTmp;
-                if( !(seqValues[nProperty] >>= nTmp) )
-                {
-                    OSL_FAIL("Wrong type of \"Misc\\SidebarIconSize\"!" );
-                } else
-                    m_nSidebarIconSize = static_cast<ToolBoxButtonSize>(nTmp);
-                m_bIsSidebarIconSizeRO = seqRO[nProperty];
-                break;
-            }
-
             case PROPERTYHANDLE_SYMBOLSTYLE :
             {
                 OUString aIconTheme;
@@ -249,15 +226,6 @@ void SvtMiscOptions_Impl::Load( const Sequence< OUString >& rPropertyNames )
                                                             }
                                                         }
                                                     break;
-            case PROPERTYHANDLE_SIDEBARICONSIZE     :   {
-                                                            sal_uInt16 nTmp;
-                                                            if( !(seqValues[nProperty] >>= nTmp) )
-                                                            {
-                                                                OSL_FAIL("Wrong type of \"Misc\\SidebarIconSize\"!" );
-                                                            } else
-                                                                m_nSidebarIconSize = static_cast<ToolBoxButtonSize>(nTmp);
-                                                        }
-                                                    break;
             case PROPERTYHANDLE_SYMBOLSTYLE         :   {
                                                             OUString aIconTheme;
                                                             if (seqValues[nProperty] >>= aIconTheme)
@@ -293,13 +261,6 @@ void SvtMiscOptions_Impl::SetSymbolsSize( sal_Int16 nSet )
     CallListeners();
 }
 
-void SvtMiscOptions_Impl::SetSidebarIconSize( ToolBoxButtonSize nSet )
-{
-    m_nSidebarIconSize = nSet;
-    SetModified();
-    CallListeners();
-}
-
 OUString SvtMiscOptions_Impl::GetIconTheme()
 {
     return Application::GetSettings().GetStyleSettings().DetermineIconTheme();
@@ -360,13 +321,6 @@ void SvtMiscOptions_Impl::ImplCommit()
                 break;
             }
 
-            case PROPERTYHANDLE_SIDEBARICONSIZE :
-            {
-                if ( !m_bIsSidebarIconSizeRO )
-                   seqValues[nProperty] <<= static_cast<sal_uInt16>(m_nSidebarIconSize);
-                break;
-            }
-
             case PROPERTYHANDLE_SYMBOLSTYLE :
             {
                 if ( !m_bIsSymbolsStyleRO ) {
@@ -397,7 +351,6 @@ Sequence< OUString > SvtMiscOptions_Impl::GetPropertyNames()
     {
         PROPERTYNAME_SYMBOLSET,
         PROPERTYNAME_ICONTHEME,
-        PROPERTYNAME_SIDEBARICONSIZE
     };
 }
 
@@ -440,16 +393,6 @@ void SvtMiscOptions::SetSymbolsSize( sal_Int16 nSet )
     m_pImpl->SetSymbolsSize( nSet );
 }
 
-ToolBoxButtonSize SvtMiscOptions::GetSidebarIconSize() const
-{
-    return m_pImpl->GetSidebarIconSize();
-}
-
-void SvtMiscOptions::SetSidebarIconSize( ToolBoxButtonSize nSet )
-{
-    m_pImpl->SetSidebarIconSize( nSet );
-}
-
 sal_Int16 SvtMiscOptions::GetCurrentSymbolsSize() const
 {
     sal_Int16 eOptSymbolsSize = m_pImpl->GetSymbolsSize();


More information about the Libreoffice-commits mailing list