From ac1ae3e055f9104b40a12a8f5b6418817230af0d Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Fri, 26 Jul 2019 20:12:30 +0100 Subject: weld SvxAccessibilityOptionsTabPage MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I77354538eb8ff31dcc3bfc3d5a7742e92b8cd7b5 Reviewed-on: https://gerrit.libreoffice.org/76455 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- cui/source/options/optaccessibility.cxx | 80 +++++++++++++-------------------- cui/source/options/optaccessibility.hxx | 18 ++++---- 2 files changed, 40 insertions(+), 58 deletions(-) diff --git a/cui/source/options/optaccessibility.cxx b/cui/source/options/optaccessibility.cxx index 716fc042d7fe..47b44435e3f9 100644 --- a/cui/source/options/optaccessibility.cxx +++ b/cui/source/options/optaccessibility.cxx @@ -22,69 +22,53 @@ #include #include -SvxAccessibilityOptionsTabPage::SvxAccessibilityOptionsTabPage(vcl::Window* pParent, +SvxAccessibilityOptionsTabPage::SvxAccessibilityOptionsTabPage(TabPageParent pParent, const SfxItemSet& rSet) - : SfxTabPage(pParent, "OptAccessibilityPage", - "cui/ui/optaccessibilitypage.ui", &rSet) + : SfxTabPage(pParent, "cui/ui/optaccessibilitypage.ui", "OptAccessibilityPage", &rSet) + , m_xAccessibilityTool(m_xBuilder->weld_check_button("acctool")) + , m_xTextSelectionInReadonly(m_xBuilder->weld_check_button("textselinreadonly")) + , m_xAnimatedGraphics(m_xBuilder->weld_check_button("animatedgraphics")) + , m_xAnimatedTexts(m_xBuilder->weld_check_button("animatedtext")) + , m_xAutoDetectHC(m_xBuilder->weld_check_button("autodetecthc")) + , m_xAutomaticFontColor(m_xBuilder->weld_check_button("autofontcolor")) + , m_xPagePreviews(m_xBuilder->weld_check_button("systempagepreviewcolor")) { - get(m_pAccessibilityTool, "acctool"); - get(m_pTextSelectionInReadonly, "textselinreadonly"); - get(m_pAnimatedGraphics, "animatedgraphics"); - get(m_pAnimatedTexts, "animatedtext"); - - get(m_pAutoDetectHC, "autodetecthc"); - get(m_pAutomaticFontColor, "autofontcolor"); - get(m_pPagePreviews, "systempagepreviewcolor"); - #ifdef UNX // UNIX: read the gconf2 setting instead to use the checkbox - m_pAccessibilityTool->Hide(); + m_xAccessibilityTool->hide(); #endif } SvxAccessibilityOptionsTabPage::~SvxAccessibilityOptionsTabPage() { - disposeOnce(); -} - -void SvxAccessibilityOptionsTabPage::dispose() -{ - m_pAccessibilityTool.clear(); - m_pTextSelectionInReadonly.clear(); - m_pAnimatedGraphics.clear(); - m_pAnimatedTexts.clear(); - m_pAutoDetectHC.clear(); - m_pAutomaticFontColor.clear(); - m_pPagePreviews.clear(); - SfxTabPage::dispose(); } -VclPtr SvxAccessibilityOptionsTabPage::Create( TabPageParent pParent, const SfxItemSet* rAttrSet ) +VclPtr SvxAccessibilityOptionsTabPage::Create(TabPageParent pParent, const SfxItemSet* rAttrSet) { - return VclPtr::Create(pParent.pParent, *rAttrSet); + return VclPtr::Create(pParent, *rAttrSet); } bool SvxAccessibilityOptionsTabPage::FillItemSet( SfxItemSet* ) { std::shared_ptr batch( comphelper::ConfigurationChanges::create() ); if ( !officecfg::Office::Common::Accessibility::IsForPagePreviews::isReadOnly() ) - officecfg::Office::Common::Accessibility::IsForPagePreviews::set(m_pPagePreviews->IsChecked(), batch); + officecfg::Office::Common::Accessibility::IsForPagePreviews::set(m_xPagePreviews->get_active(), batch); if ( !officecfg::Office::Common::Accessibility::IsAllowAnimatedGraphics::isReadOnly() ) - officecfg::Office::Common::Accessibility::IsAllowAnimatedGraphics::set(m_pAnimatedGraphics->IsChecked(), batch); + officecfg::Office::Common::Accessibility::IsAllowAnimatedGraphics::set(m_xAnimatedGraphics->get_active(), batch); if ( !officecfg::Office::Common::Accessibility::IsAllowAnimatedText::isReadOnly() ) - officecfg::Office::Common::Accessibility::IsAllowAnimatedText::set(m_pAnimatedTexts->IsChecked(), batch); + officecfg::Office::Common::Accessibility::IsAllowAnimatedText::set(m_xAnimatedTexts->get_active(), batch); if ( !officecfg::Office::Common::Accessibility::IsAutomaticFontColor::isReadOnly() ) - officecfg::Office::Common::Accessibility::IsAutomaticFontColor::set(m_pAutomaticFontColor->IsChecked(), batch); + officecfg::Office::Common::Accessibility::IsAutomaticFontColor::set(m_xAutomaticFontColor->get_active(), batch); if ( !officecfg::Office::Common::Accessibility::IsSelectionInReadonly::isReadOnly() ) - officecfg::Office::Common::Accessibility::IsSelectionInReadonly::set(m_pTextSelectionInReadonly->IsChecked(), batch); + officecfg::Office::Common::Accessibility::IsSelectionInReadonly::set(m_xTextSelectionInReadonly->get_active(), batch); if ( !officecfg::Office::Common::Accessibility::AutoDetectSystemHC::isReadOnly() ) - officecfg::Office::Common::Accessibility::AutoDetectSystemHC::set(m_pAutoDetectHC->IsChecked(), batch); + officecfg::Office::Common::Accessibility::AutoDetectSystemHC::set(m_xAutoDetectHC->get_active(), batch); batch->commit(); AllSettings aAllSettings = Application::GetSettings(); MiscSettings aMiscSettings = aAllSettings.GetMiscSettings(); #ifndef UNX - aMiscSettings.SetEnableATToolSupport(m_pAccessibilityTool->IsChecked()); + aMiscSettings.SetEnableATToolSupport(m_xAccessibilityTool->get_active()); #endif aAllSettings.SetMiscSettings(aMiscSettings); Application::MergeSystemSettings( aAllSettings ); @@ -95,33 +79,33 @@ bool SvxAccessibilityOptionsTabPage::FillItemSet( SfxItemSet* ) void SvxAccessibilityOptionsTabPage::Reset( const SfxItemSet* ) { - m_pPagePreviews->Check( officecfg::Office::Common::Accessibility::IsForPagePreviews::get() ); + m_xPagePreviews->set_active( officecfg::Office::Common::Accessibility::IsForPagePreviews::get() ); if( officecfg::Office::Common::Accessibility::IsForPagePreviews::isReadOnly() ) - m_pPagePreviews->Disable(); + m_xPagePreviews->set_sensitive(false); - m_pAnimatedGraphics->Check( officecfg::Office::Common::Accessibility::IsAllowAnimatedGraphics::get() ); + m_xAnimatedGraphics->set_active( officecfg::Office::Common::Accessibility::IsAllowAnimatedGraphics::get() ); if( officecfg::Office::Common::Accessibility::IsAllowAnimatedGraphics::isReadOnly() ) - m_pAnimatedGraphics->Disable(); + m_xAnimatedGraphics->set_sensitive(false); - m_pAnimatedTexts->Check( officecfg::Office::Common::Accessibility::IsAllowAnimatedText::get() ); + m_xAnimatedTexts->set_active( officecfg::Office::Common::Accessibility::IsAllowAnimatedText::get() ); if( officecfg::Office::Common::Accessibility::IsAllowAnimatedText::isReadOnly() ) - m_pAnimatedTexts->Disable(); + m_xAnimatedTexts->set_sensitive(false); - m_pAutomaticFontColor->Check( officecfg::Office::Common::Accessibility::IsAutomaticFontColor::get() ); + m_xAutomaticFontColor->set_active( officecfg::Office::Common::Accessibility::IsAutomaticFontColor::get() ); if( officecfg::Office::Common::Accessibility::IsAutomaticFontColor::isReadOnly() ) - m_pAutomaticFontColor->Disable(); + m_xAutomaticFontColor->set_sensitive(false); - m_pTextSelectionInReadonly->Check( officecfg::Office::Common::Accessibility::IsSelectionInReadonly::get() ); + m_xTextSelectionInReadonly->set_active( officecfg::Office::Common::Accessibility::IsSelectionInReadonly::get() ); if( officecfg::Office::Common::Accessibility::IsSelectionInReadonly::isReadOnly() ) - m_pTextSelectionInReadonly->Disable(); + m_xTextSelectionInReadonly->set_sensitive(false); - m_pAutoDetectHC->Check( officecfg::Office::Common::Accessibility::AutoDetectSystemHC::get() ); + m_xAutoDetectHC->set_active( officecfg::Office::Common::Accessibility::AutoDetectSystemHC::get() ); if( officecfg::Office::Common::Accessibility::AutoDetectSystemHC::isReadOnly() ) - m_pAutoDetectHC->Disable(); + m_xAutoDetectHC->set_sensitive(false); AllSettings aAllSettings = Application::GetSettings(); const MiscSettings& aMiscSettings = aAllSettings.GetMiscSettings(); - m_pAccessibilityTool->Check(aMiscSettings.GetEnableATToolSupport()); + m_xAccessibilityTool->set_active(aMiscSettings.GetEnableATToolSupport()); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/options/optaccessibility.hxx b/cui/source/options/optaccessibility.hxx index 359a2a286ab4..5a1ed1bbb3c2 100644 --- a/cui/source/options/optaccessibility.hxx +++ b/cui/source/options/optaccessibility.hxx @@ -20,22 +20,20 @@ #define INCLUDED_CUI_SOURCE_OPTIONS_OPTACCESSIBILITY_HXX #include -#include class SvxAccessibilityOptionsTabPage : public SfxTabPage { - VclPtr m_pAccessibilityTool; - VclPtr m_pTextSelectionInReadonly; - VclPtr m_pAnimatedGraphics; - VclPtr m_pAnimatedTexts; - VclPtr m_pAutoDetectHC; - VclPtr m_pAutomaticFontColor; - VclPtr m_pPagePreviews; + std::unique_ptr m_xAccessibilityTool; + std::unique_ptr m_xTextSelectionInReadonly; + std::unique_ptr m_xAnimatedGraphics; + std::unique_ptr m_xAnimatedTexts; + std::unique_ptr m_xAutoDetectHC; + std::unique_ptr m_xAutomaticFontColor; + std::unique_ptr m_xPagePreviews; public: - SvxAccessibilityOptionsTabPage( vcl::Window* pParent, const SfxItemSet& rSet ); + SvxAccessibilityOptionsTabPage(TabPageParent pParent, const SfxItemSet& rSet); virtual ~SvxAccessibilityOptionsTabPage() override; - virtual void dispose() override; static VclPtr Create( TabPageParent pParent, const SfxItemSet* rAttrSet ); virtual bool FillItemSet( SfxItemSet* rSet ) override; -- cgit