cui/source/customize/SvxConfigPageHelper.cxx | 4 +- cui/source/options/optgdlg.cxx | 8 ++-- extensions/source/bibliography/toolbar.cxx | 7 +-- framework/source/uielement/FixedImageToolbarController.cxx | 7 +-- framework/source/uielement/imagebuttontoolbarcontroller.cxx | 4 +- framework/source/uielement/menubarmanager.cxx | 4 +- framework/source/uielement/toolbarmanager.cxx | 23 +++++------- include/svtools/miscopt.hxx | 10 ++--- sfx2/source/appl/appcfg.cxx | 3 - svtools/source/config/miscopt.cxx | 16 +++----- 10 files changed, 39 insertions(+), 47 deletions(-)
New commits: commit 0558926c2f9201a12b4c46efc36b8a4080af4d46 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Tue Jun 6 10:42:10 2023 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Tue Jun 6 20:45:52 2023 +0200 use more officecfg for SvtMiscOptions Change-Id: I6c87025fc0997b5edbc085fc88333fe9e150eb3e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152648 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/cui/source/customize/SvxConfigPageHelper.cxx b/cui/source/customize/SvxConfigPageHelper.cxx index 52265ef093e6..c14cb3560c9f 100644 --- a/cui/source/customize/SvxConfigPageHelper.cxx +++ b/cui/source/customize/SvxConfigPageHelper.cxx @@ -66,11 +66,11 @@ void SvxConfigPageHelper::InitImageType() { theImageType = css::ui::ImageType::COLOR_NORMAL | css::ui::ImageType::SIZE_DEFAULT; - if (SvtMiscOptions().GetCurrentSymbolsSize() == SFX_SYMBOLS_SIZE_LARGE) + if (SvtMiscOptions::GetCurrentSymbolsSize() == SFX_SYMBOLS_SIZE_LARGE) { theImageType |= css::ui::ImageType::SIZE_LARGE; } - else if (SvtMiscOptions().GetCurrentSymbolsSize() == SFX_SYMBOLS_SIZE_32) + else if (SvtMiscOptions::GetCurrentSymbolsSize() == SFX_SYMBOLS_SIZE_32) { theImageType |= css::ui::ImageType::SIZE_32; } diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx index 428a85ab3cbc..5819171001af 100644 --- a/cui/source/options/optgdlg.cxx +++ b/cui/source/options/optgdlg.cxx @@ -855,13 +855,13 @@ void OfaViewTabPage::Reset( const SfxItemSet* ) { SvtMiscOptions aMiscOptions; - if (aMiscOptions.GetSymbolsSize() != SFX_SYMBOLS_SIZE_AUTO) + if (SvtMiscOptions::GetSymbolsSize() != SFX_SYMBOLS_SIZE_AUTO) { nSizeLB_InitialSelection = 1; - if (aMiscOptions.GetSymbolsSize() == SFX_SYMBOLS_SIZE_LARGE) + if (SvtMiscOptions::GetSymbolsSize() == SFX_SYMBOLS_SIZE_LARGE) nSizeLB_InitialSelection = 2; - else if (aMiscOptions.GetSymbolsSize() == SFX_SYMBOLS_SIZE_32) + else if (SvtMiscOptions::GetSymbolsSize() == SFX_SYMBOLS_SIZE_32) nSizeLB_InitialSelection = 3; } m_xIconSizeLB->set_active( nSizeLB_InitialSelection ); @@ -893,7 +893,7 @@ void OfaViewTabPage::Reset( const SfxItemSet* ) nStyleLB_InitialSelection = 0; } else { - const OUString& selected = aMiscOptions.GetIconTheme(); + const OUString& selected = SvtMiscOptions::GetIconTheme(); const vcl::IconThemeInfo& selectedInfo = vcl::IconThemeInfo::FindIconThemeById(mInstalledIconThemes, selected); nStyleLB_InitialSelection = m_xIconStyleLB->find_text(selectedInfo.GetDisplayName()); diff --git a/extensions/source/bibliography/toolbar.cxx b/extensions/source/bibliography/toolbar.cxx index cee4d5fbb44a..7675a761c1ed 100644 --- a/extensions/source/bibliography/toolbar.cxx +++ b/extensions/source/bibliography/toolbar.cxx @@ -235,8 +235,7 @@ BibToolBar::BibToolBar(vcl::Window* pParent, Link<void*,void> aLink) , aLayoutManager(aLink) , nSymbolsSize(SFX_SYMBOLS_SIZE_SMALL) { - SvtMiscOptions aSvtMiscOptions; - nSymbolsSize = aSvtMiscOptions.GetCurrentSymbolsSize(); + nSymbolsSize = SvtMiscOptions::GetCurrentSymbolsSize(); xSource->Show(); pLbSource->connect_changed(LINK( this, BibToolBar, SelHdl)); @@ -561,7 +560,7 @@ void BibToolBar::DataChanged( const DataChangedEvent& rDCEvt ) IMPL_LINK_NOARG( BibToolBar, OptionsChanged_Impl, LinkParamNone*, void ) { bool bRebuildToolBar = false; - sal_Int16 eSymbolsSize = SvtMiscOptions().GetCurrentSymbolsSize(); + sal_Int16 eSymbolsSize = SvtMiscOptions::GetCurrentSymbolsSize(); if ( nSymbolsSize != eSymbolsSize ) { nSymbolsSize = eSymbolsSize; @@ -575,7 +574,7 @@ IMPL_LINK_NOARG( BibToolBar, OptionsChanged_Impl, LinkParamNone*, void ) IMPL_LINK_NOARG( BibToolBar, SettingsChanged_Impl, VclSimpleEvent&, void ) { // Check if toolbar button size have changed and we have to use system settings - sal_Int16 eSymbolsSize = SvtMiscOptions().GetCurrentSymbolsSize(); + sal_Int16 eSymbolsSize = SvtMiscOptions::GetCurrentSymbolsSize(); if ( eSymbolsSize != nSymbolsSize ) { nSymbolsSize = eSymbolsSize; diff --git a/framework/source/uielement/FixedImageToolbarController.cxx b/framework/source/uielement/FixedImageToolbarController.cxx index 303913432cd1..c694cda3b853 100644 --- a/framework/source/uielement/FixedImageToolbarController.cxx +++ b/framework/source/uielement/FixedImageToolbarController.cxx @@ -57,7 +57,7 @@ FixedImageControl::FixedImageControl(vcl::Window* pParent, const OUString& rComm m_xWidget->connect_key_press(LINK(this, FixedImageControl, KeyInputHdl)); - bool bBigImages(SvtMiscOptions().AreCurrentSymbolsLarge()); + bool bBigImages(SvtMiscOptions::AreCurrentSymbolsLarge()); auto xImage = Graphic(AddonsOptions().GetImageFromURL(rCommand, bBigImages, true)).GetXGraphic(); m_xWidget->set_image(xImage); @@ -82,7 +82,7 @@ FixedImageToolbarController::FixedImageToolbarController( const Reference<XComponentContext>& rxContext, const Reference<XFrame>& rFrame, ToolBox* pToolbar, ToolBoxItemId nID, const OUString& rCommand) : ComplexToolbarController(rxContext, rFrame, pToolbar, nID, rCommand) - , m_eSymbolSize(SvtMiscOptions().GetCurrentSymbolsSize()) + , m_eSymbolSize(SvtMiscOptions::GetCurrentSymbolsSize()) { m_pFixedImageControl = VclPtr<FixedImageControl>::Create(m_xToolbar, rCommand); m_xToolbar->SetItemWindow(m_nID, m_pFixedImageControl); @@ -106,8 +106,7 @@ void FixedImageToolbarController::CheckAndUpdateImages() { SolarMutexGuard aSolarMutexGuard; - SvtMiscOptions aMiscOptions; - const sal_Int16 eNewSymbolSize = aMiscOptions.GetCurrentSymbolsSize(); + const sal_Int16 eNewSymbolSize = SvtMiscOptions::GetCurrentSymbolsSize(); if (m_eSymbolSize == eNewSymbolSize) return; diff --git a/framework/source/uielement/imagebuttontoolbarcontroller.cxx b/framework/source/uielement/imagebuttontoolbarcontroller.cxx index 1ab3c0cf8de1..a91b0123a597 100644 --- a/framework/source/uielement/imagebuttontoolbarcontroller.cxx +++ b/framework/source/uielement/imagebuttontoolbarcontroller.cxx @@ -61,7 +61,7 @@ ImageButtonToolbarController::ImageButtonToolbarController( const OUString& aCommand ) : ComplexToolbarController( rxContext, rFrame, pToolbar, nID, aCommand ) { - bool bBigImages( SvtMiscOptions().AreCurrentSymbolsLarge() ); + bool bBigImages( SvtMiscOptions::AreCurrentSymbolsLarge() ); Image aImage(AddonsOptions().GetImageFromURL(aCommand, bBigImages, true)); @@ -97,7 +97,7 @@ void ImageButtonToolbarController::executeControlCommand( const css::frame::Cont SubstituteVariables( aURL ); Image aImage; - if ( ReadImageFromURL( SvtMiscOptions().AreCurrentSymbolsLarge(), + if ( ReadImageFromURL( SvtMiscOptions::AreCurrentSymbolsLarge(), aURL, aImage )) { diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx index b5608310188c..edbd88d2250c 100644 --- a/framework/source/uielement/menubarmanager.cxx +++ b/framework/source/uielement/menubarmanager.cxx @@ -93,7 +93,7 @@ MenuBarManager::MenuBarManager( , m_bHasMenuBar( bHasMenuBar ) , m_xContext(rxContext) , m_xURLTransformer(_xURLTransformer) - , m_sIconTheme( SvtMiscOptions().GetIconTheme() ) + , m_sIconTheme( SvtMiscOptions::GetIconTheme() ) , m_aAsyncSettingsTimer( "framework::MenuBarManager::Deactivate m_aAsyncSettingsTimer" ) { m_xPopupMenuControllerFactory = frame::thePopupMenuControllerFactory::get(m_xContext); @@ -580,7 +580,7 @@ IMPL_LINK( MenuBarManager, Activate, Menu *, pMenu, bool ) m_bActive = true; // Check if some modes have changed so we have to update our menu images - OUString sIconTheme = SvtMiscOptions().GetIconTheme(); + OUString sIconTheme = SvtMiscOptions::GetIconTheme(); if ( m_bRetrieveImages || bShowMenuImages != m_bShowMenuImages || diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx index 5278906f8eae..51855edd6402 100644 --- a/framework/source/uielement/toolbarmanager.cxx +++ b/framework/source/uielement/toolbarmanager.cxx @@ -124,11 +124,11 @@ namespace sal_Int16 getCurrentImageType() { - SvtMiscOptions aMiscOptions; sal_Int16 nImageType = css::ui::ImageType::SIZE_DEFAULT; - if (aMiscOptions.GetCurrentSymbolsSize() == SFX_SYMBOLS_SIZE_LARGE) + sal_Int16 nCurrentSymbolSize = SvtMiscOptions::GetCurrentSymbolsSize(); + if (nCurrentSymbolSize == SFX_SYMBOLS_SIZE_LARGE) nImageType |= css::ui::ImageType::SIZE_LARGE; - else if (aMiscOptions.GetCurrentSymbolsSize() == SFX_SYMBOLS_SIZE_32) + else if (nCurrentSymbolSize == SFX_SYMBOLS_SIZE_32) nImageType |= css::ui::ImageType::SIZE_32; return nImageType; } @@ -538,7 +538,7 @@ ToolBarManager::ToolBarManager( const Reference< XComponentContext >& rxContext, m_bDisposed( false ), m_bFrameActionRegistered( false ), m_bUpdateControllers( false ), - m_eSymbolSize(SvtMiscOptions().GetCurrentSymbolsSize()), + m_eSymbolSize(SvtMiscOptions::GetCurrentSymbolsSize()), m_nContextMinPos(0), m_pImpl( new VclToolBarManager( pToolBar ) ), m_pToolBar( pToolBar ), @@ -547,7 +547,7 @@ ToolBarManager::ToolBarManager( const Reference< XComponentContext >& rxContext, m_xFrame( rFrame ), m_xContext( rxContext ), m_aAsyncUpdateControllersTimer( "framework::ToolBarManager m_aAsyncUpdateControllersTimer" ), - m_sIconTheme( SvtMiscOptions().GetIconTheme() ) + m_sIconTheme( SvtMiscOptions::GetIconTheme() ) { Init(); } @@ -560,7 +560,7 @@ ToolBarManager::ToolBarManager( const Reference< XComponentContext >& rxContext, m_bDisposed( false ), m_bFrameActionRegistered( false ), m_bUpdateControllers( false ), - m_eSymbolSize( SvtMiscOptions().GetCurrentSymbolsSize() ), + m_eSymbolSize( SvtMiscOptions::GetCurrentSymbolsSize() ), m_nContextMinPos(0), m_pImpl( new WeldToolBarManager( pToolBar, pBuilder ) ), m_pWeldedToolBar( pToolBar ), @@ -568,7 +568,7 @@ ToolBarManager::ToolBarManager( const Reference< XComponentContext >& rxContext, m_xFrame( rFrame ), m_xContext( rxContext ), m_aAsyncUpdateControllersTimer( "framework::ToolBarManager m_aAsyncUpdateControllersTimer" ), - m_sIconTheme( SvtMiscOptions().GetIconTheme() ) + m_sIconTheme( SvtMiscOptions::GetIconTheme() ) { Init(); } @@ -636,8 +636,7 @@ void ToolBarManager::CheckAndUpdateImages() SolarMutexGuard g; bool bRefreshImages = false; - SvtMiscOptions aMiscOptions; - sal_Int16 eNewSymbolSize = aMiscOptions.GetCurrentSymbolsSize(); + sal_Int16 eNewSymbolSize = SvtMiscOptions::GetCurrentSymbolsSize(); if (m_eSymbolSize != eNewSymbolSize ) { @@ -645,7 +644,7 @@ void ToolBarManager::CheckAndUpdateImages() m_eSymbolSize = eNewSymbolSize; } - const OUString& sCurrentIconTheme = aMiscOptions.GetIconTheme(); + const OUString& sCurrentIconTheme = SvtMiscOptions::GetIconTheme(); if ( m_sIconTheme != sCurrentIconTheme ) { bRefreshImages = true; @@ -1630,8 +1629,6 @@ void ToolBarManager::RequestImages() Sequence< Reference< XGraphic > > aDocGraphicSeq; Sequence< Reference< XGraphic > > aModGraphicSeq; - SvtMiscOptions aMiscOptions; - sal_Int16 nImageType = getCurrentImageType(); if ( m_xDocImageManager.is() ) @@ -1652,7 +1649,7 @@ void ToolBarManager::RequestImages() // Try also to query for add-on images before giving up and use an // empty image. if ( !aImage ) - aImage = Image(framework::AddonsOptions().GetImageFromURL(aCmdURLSeq[i], aMiscOptions.AreCurrentSymbolsLarge())); + aImage = Image(framework::AddonsOptions().GetImageFromURL(aCmdURLSeq[i], SvtMiscOptions::AreCurrentSymbolsLarge())); pIter->second.nImageInfo = 1; // mark image as module based } diff --git a/include/svtools/miscopt.hxx b/include/svtools/miscopt.hxx index 190de033c129..226e92bc68d3 100644 --- a/include/svtools/miscopt.hxx +++ b/include/svtools/miscopt.hxx @@ -44,7 +44,7 @@ enum class ToolBoxButtonSize; @devstatus ready to use *//*-*************************************************************************************************************/ -class SVT_DLLPUBLIC SvtMiscOptions final : public utl::detail::Options +class SAL_WARN_UNUSED SVT_DLLPUBLIC SvtMiscOptions final : public utl::detail::Options { public: SvtMiscOptions(); @@ -53,12 +53,12 @@ class SVT_DLLPUBLIC SvtMiscOptions final : public utl::detail::Options void AddListenerLink( const Link<LinkParamNone*,void>& rLink ); void RemoveListenerLink( const Link<LinkParamNone*,void>& rLink ); - sal_Int16 GetSymbolsSize() const; + static sal_Int16 GetSymbolsSize(); void SetSymbolsSize( sal_Int16 eSet ); - sal_Int16 GetCurrentSymbolsSize() const; - bool AreCurrentSymbolsLarge() const; + static sal_Int16 GetCurrentSymbolsSize(); + static bool AreCurrentSymbolsLarge(); - OUString GetIconTheme() const; + static OUString GetIconTheme(); void SetIconTheme(const OUString&); bool IconThemeWasSetAutomatically() const; diff --git a/sfx2/source/appl/appcfg.cxx b/sfx2/source/appl/appcfg.cxx index b001f83f01af..5576c5c5b9bd 100644 --- a/sfx2/source/appl/appcfg.cxx +++ b/sfx2/source/appl/appcfg.cxx @@ -112,7 +112,6 @@ void SfxApplication::GetOptions( SfxItemSet& rSet ) bool bRet = false; const WhichRangesContainer& pRanges = rSet.GetRanges(); - SvtMiscOptions aMiscOptions; for (auto const & pRange : pRanges) { @@ -122,7 +121,7 @@ void SfxApplication::GetOptions( SfxItemSet& rSet ) { case SID_ATTR_BUTTON_BIGSIZE : { - if( rSet.Put( SfxBoolItem( SID_ATTR_BUTTON_BIGSIZE, aMiscOptions.AreCurrentSymbolsLarge() ) ) ) + if( rSet.Put( SfxBoolItem( SID_ATTR_BUTTON_BIGSIZE, SvtMiscOptions::AreCurrentSymbolsLarge() ) ) ) bRet = true; break; } diff --git a/svtools/source/config/miscopt.cxx b/svtools/source/config/miscopt.cxx index 1ea1e3b7e695..f09d07feabed 100644 --- a/svtools/source/config/miscopt.cxx +++ b/svtools/source/config/miscopt.cxx @@ -31,6 +31,7 @@ #include <svtools/imgdef.hxx> #include <vcl/svapp.hxx> #include <vcl/settings.hxx> +#include <officecfg/Office/Common.hxx> #include <mutex> #include <vector> @@ -94,9 +95,6 @@ public: // public interface - sal_Int16 GetSymbolsSize() const - { return m_nSymbolsSize; } - void SetSymbolsSize( sal_Int16 nSet ); static OUString GetIconTheme(); @@ -399,9 +397,9 @@ SvtMiscOptions::~SvtMiscOptions() } -sal_Int16 SvtMiscOptions::GetSymbolsSize() const +sal_Int16 SvtMiscOptions::GetSymbolsSize() { - return m_pImpl->GetSymbolsSize(); + return officecfg::Office::Common::Misc::SymbolSet::get(); } void SvtMiscOptions::SetSymbolsSize( sal_Int16 nSet ) @@ -409,9 +407,9 @@ void SvtMiscOptions::SetSymbolsSize( sal_Int16 nSet ) m_pImpl->SetSymbolsSize( nSet ); } -sal_Int16 SvtMiscOptions::GetCurrentSymbolsSize() const +sal_Int16 SvtMiscOptions::GetCurrentSymbolsSize() { - sal_Int16 eOptSymbolsSize = m_pImpl->GetSymbolsSize(); + sal_Int16 eOptSymbolsSize = GetSymbolsSize(); if ( eOptSymbolsSize == SFX_SYMBOLS_SIZE_AUTO ) { @@ -429,12 +427,12 @@ sal_Int16 SvtMiscOptions::GetCurrentSymbolsSize() const return eOptSymbolsSize; } -bool SvtMiscOptions::AreCurrentSymbolsLarge() const +bool SvtMiscOptions::AreCurrentSymbolsLarge() { return ( GetCurrentSymbolsSize() == SFX_SYMBOLS_SIZE_LARGE || GetCurrentSymbolsSize() == SFX_SYMBOLS_SIZE_32); } -OUString SvtMiscOptions::GetIconTheme() const +OUString SvtMiscOptions::GetIconTheme() { return SvtMiscOptions_Impl::GetIconTheme(); }