cui/source/options/optgdlg.cxx | 52 +++-------------------------------------- 1 file changed, 4 insertions(+), 48 deletions(-)
New commits: commit 717a898b05dd1226254ee47b61ab354b348df198 Author: Gabor Kelemen <gabor.kelemen.ext...@allotropia.de> AuthorDate: Sat Mar 1 18:18:36 2025 +0100 Commit: Gabor Kelemen <gabor.kelemen.ext...@allotropia.de> CommitDate: Sun Mar 2 12:06:09 2025 +0100 Use officecfg instead of custom accessor methods Change-Id: I986981b835dd1ec14c7e345c9636bc05b05664bf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182393 Reviewed-by: Gabor Kelemen <gabor.kelemen.ext...@allotropia.de> Tested-by: Jenkins diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx index e50c71b998df..9d9d5f072bcb 100644 --- a/cui/source/options/optgdlg.cxx +++ b/cui/source/options/optgdlg.cxx @@ -52,6 +52,7 @@ #include <GraphicsTestsDialog.hxx> #include <unotools/searchopt.hxx> #include <sal/log.hxx> +#include <officecfg/Office/Canvas.hxx> #include <officecfg/Office/Common.hxx> #include <officecfg/Setup.hxx> #include <comphelper/configuration.hxx> @@ -421,10 +422,7 @@ class CanvasSettings public: CanvasSettings(); - bool IsHardwareAccelerationEnabled() const; bool IsHardwareAccelerationAvailable() const; - bool IsHardwareAccelerationRO() const; - void EnabledHardwareAcceleration( bool _bEnabled ) const; private: typedef std::vector< std::pair<OUString,Sequence<OUString> > > ServiceVector; @@ -522,48 +520,6 @@ bool CanvasSettings::IsHardwareAccelerationAvailable() const return mbHWAccelAvailable; } -bool CanvasSettings::IsHardwareAccelerationEnabled() const -{ - bool bForceLastEntry(false); - if( !mxForceFlagNameAccess.is() ) - return true; - - if( !(mxForceFlagNameAccess->getByName(u"ForceSafeServiceImpl"_ustr) >>= bForceLastEntry) ) - return true; - - return !bForceLastEntry; -} - -bool CanvasSettings::IsHardwareAccelerationRO() const -{ - Reference< XPropertySet > xSet(mxForceFlagNameAccess, UNO_QUERY); - if (!xSet.is()) - return true; - - Reference< XPropertySetInfo > xInfo = xSet->getPropertySetInfo(); - Property aProp = xInfo->getPropertyByName(u"ForceSafeServiceImpl"_ustr); - return ((aProp.Attributes & css::beans::PropertyAttribute::READONLY ) == css::beans::PropertyAttribute::READONLY); -} - -void CanvasSettings::EnabledHardwareAcceleration( bool _bEnabled ) const -{ - Reference< XNameReplace > xNameReplace( - mxForceFlagNameAccess, UNO_QUERY ); - - if( !xNameReplace.is() ) - return; - - xNameReplace->replaceByName( u"ForceSafeServiceImpl"_ustr, Any(!_bEnabled) ); - - Reference< XChangesBatch > xChangesBatch( - mxForceFlagNameAccess, UNO_QUERY ); - - if( !xChangesBatch.is() ) - return; - - xChangesBatch->commitChanges(); -} - // class OfaViewTabPage -------------------------------------------------- static bool DisplayNameCompareLessThan(const vcl::IconThemeInfo& rInfo1, const vcl::IconThemeInfo& rInfo2) @@ -880,7 +836,7 @@ bool OfaViewTabPage::FillItemSet( SfxItemSet* ) { if(m_xUseHardwareAccell->get_state_changed_from_saved()) { - pCanvasSettings->EnabledHardwareAcceleration(m_xUseHardwareAccell->get_active()); + officecfg::Office::Canvas::ForceSafeServiceImpl::set(m_xUseHardwareAccell->get_active(), xChanges); bModified = true; } } @@ -1062,10 +1018,10 @@ void OfaViewTabPage::Reset( const SfxItemSet* ) void OfaViewTabPage::UpdateHardwareAccelStatus() { // #i95644# HW accel (unified to disable mechanism) - bool bHardwareAccRO = pCanvasSettings->IsHardwareAccelerationRO(); + bool bHardwareAccRO = officecfg::Office::Canvas::ForceSafeServiceImpl::isReadOnly(); if(pCanvasSettings->IsHardwareAccelerationAvailable()) { - m_xUseHardwareAccell->set_active(pCanvasSettings->IsHardwareAccelerationEnabled()); + m_xUseHardwareAccell->set_active(officecfg::Office::Canvas::ForceSafeServiceImpl::get()); m_xUseHardwareAccell->set_sensitive(!bHardwareAccRO); m_xUseHardwareAccellImg->set_visible(bHardwareAccRO); }