cui/source/dialogs/zoom.cxx | 345 +++++++++++++++------------------- cui/source/factory/dlgfact.cxx | 19 + cui/source/factory/dlgfact.hxx | 17 + cui/source/inc/zoom.hxx | 56 ++--- cui/uiconfig/ui/zoomdialog.ui | 42 ++-- include/svx/svxdlg.hxx | 3 sc/source/ui/view/tabvwsh3.cxx | 3 starmath/source/view.cxx | 2 sw/source/uibase/uiview/pview.cxx | 2 sw/source/uibase/uiview/view2.cxx | 2 sw/uiconfig/swriter/ui/inserttable.ui | 8 vcl/unx/gtk3/gtk3gtkinst.cxx | 2 12 files changed, 237 insertions(+), 264 deletions(-)
New commits: commit b16eb0d91f204823339a78b353dc8097aa8f7e56 Author: Caolán McNamara <caol...@redhat.com> Date: Fri Mar 30 14:59:24 2018 +0100 weld SvxZoomDialog Change-Id: I9d68fdcc9dc27a5aa4f6ec78542ce7822259233e Reviewed-on: https://gerrit.libreoffice.org/52157 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/cui/source/dialogs/zoom.cxx b/cui/source/dialogs/zoom.cxx index bb2700cafd05..97998a8e5fb6 100644 --- a/cui/source/dialogs/zoom.cxx +++ b/cui/source/dialogs/zoom.cxx @@ -36,55 +36,55 @@ const sal_uInt16 SPECIAL_FACTOR = 0xFFFF; sal_uInt16 SvxZoomDialog::GetFactor() const { - if (m_p100Btn->IsChecked()) + if (m_x100Btn->get_active()) return 100; - if (m_pUserBtn->IsChecked()) - return static_cast<sal_uInt16>(m_pUserEdit->GetValue()); + if (m_xUserBtn->get_active()) + return static_cast<sal_uInt16>(m_xUserEdit->get_value(FUNIT_PERCENT)); else return SPECIAL_FACTOR; } void SvxZoomDialog::SetFactor(sal_uInt16 nNewFactor, ZoomButtonId nButtonId) { - m_pUserEdit->Disable(); + m_xUserEdit->set_sensitive(false); if (nButtonId == ZoomButtonId::NONE) { if ( nNewFactor == 100 ) { - m_p100Btn->Check(); - m_p100Btn->GrabFocus(); + m_x100Btn->set_active(true); + m_x100Btn->grab_focus(); } else { - m_pUserBtn->Check(); - m_pUserEdit->Enable(); - m_pUserEdit->SetValue(static_cast<long>(nNewFactor)); - m_pUserEdit->GrabFocus(); + m_xUserBtn->set_active(true); + m_xUserEdit->set_sensitive(true); + m_xUserEdit->set_value(nNewFactor, FUNIT_PERCENT); + m_xUserEdit->grab_focus(); } } else { - m_pUserEdit->SetValue(static_cast<long>(nNewFactor)); + m_xUserEdit->set_value(nNewFactor, FUNIT_PERCENT); switch(nButtonId) { case ZoomButtonId::OPTIMAL: { - m_pOptimalBtn->Check(); - m_pOptimalBtn->GrabFocus(); + m_xOptimalBtn->set_active(true); + m_xOptimalBtn->grab_focus(); break; } case ZoomButtonId::PAGEWIDTH: { - m_pPageWidthBtn->Check(); - m_pPageWidthBtn->GrabFocus(); + m_xPageWidthBtn->set_active(true); + m_xPageWidthBtn->grab_focus(); break; } case ZoomButtonId::WHOLEPAGE: { - m_pWholePageBtn->Check(); - m_pWholePageBtn->GrabFocus(); + m_xWholePageBtn->set_active(true); + m_xWholePageBtn->grab_focus(); break; } default: break; @@ -97,15 +97,15 @@ void SvxZoomDialog::HideButton(ZoomButtonId nButtonId) switch (nButtonId) { case ZoomButtonId::OPTIMAL: - m_pOptimalBtn->Hide(); + m_xOptimalBtn->hide(); break; case ZoomButtonId::PAGEWIDTH: - m_pPageWidthBtn->Hide(); + m_xPageWidthBtn->hide(); break; case ZoomButtonId::WHOLEPAGE: - m_pWholePageBtn->Hide(); + m_xWholePageBtn->hide(); break; default: @@ -116,57 +116,54 @@ void SvxZoomDialog::HideButton(ZoomButtonId nButtonId) void SvxZoomDialog::SetLimits(sal_uInt16 nMin, sal_uInt16 nMax) { DBG_ASSERT(nMin < nMax, "invalid limits"); - m_pUserEdit->SetMin(nMin); - m_pUserEdit->SetFirst(nMin); - m_pUserEdit->SetMax(nMax); - m_pUserEdit->SetLast(nMax); + m_xUserEdit->set_range(nMin, nMax, FUNIT_PERCENT); } const SfxItemSet* SvxZoomDialog::GetOutputItemSet() const { - return mpOutSet.get(); + return m_pOutSet.get(); } -SvxZoomDialog::SvxZoomDialog( vcl::Window* pParent, const SfxItemSet& rCoreSet ) - : SfxModalDialog(pParent, "ZoomDialog", "cui/ui/zoomdialog.ui") - , mrSet(rCoreSet) - , mpOutSet() - , mbModified(false) - +SvxZoomDialog::SvxZoomDialog(weld::Window* pParent, const SfxItemSet& rCoreSet) + : GenericDialogController(pParent, "cui/ui/zoomdialog.ui", "ZoomDialog") + , m_rSet(rCoreSet) + , m_bModified(false) + , m_xOptimalBtn(m_xBuilder->weld_radio_button("optimal")) + , m_xWholePageBtn(m_xBuilder->weld_radio_button("fitwandh")) + , m_xPageWidthBtn(m_xBuilder->weld_radio_button("fitw")) + , m_x100Btn(m_xBuilder->weld_radio_button("100pc")) + , m_xUserBtn(m_xBuilder->weld_radio_button("variable")) + , m_xUserEdit(m_xBuilder->weld_metric_spin_button("zoomsb")) + , m_xViewFrame(m_xBuilder->weld_widget("viewframe")) + , m_xAutomaticBtn(m_xBuilder->weld_radio_button("automatic")) + , m_xSingleBtn(m_xBuilder->weld_radio_button("singlepage")) + , m_xColumnsBtn(m_xBuilder->weld_radio_button("columns")) + , m_xColumnsEdit(m_xBuilder->weld_spin_button("columnssb")) + , m_xBookModeChk(m_xBuilder->weld_check_button("bookmode")) + , m_xOKBtn(m_xBuilder->weld_button("ok")) { - get(m_pOptimalBtn, "optimal"); - get(m_pWholePageBtn, "fitwandh"); - get(m_pPageWidthBtn, "fitw"); - get(m_p100Btn, "100pc"); - get(m_pUserBtn, "variable"); - get(m_pUserEdit, "zoomsb"); - get(m_pViewFrame, "viewframe"); - get(m_pAutomaticBtn, "automatic"); - get(m_pSingleBtn, "singlepage"); - get(m_pColumnsBtn, "columns"); - get(m_pColumnsEdit, "columnssb"); - get(m_pBookModeChk, "bookmode"); - get(m_pOKBtn, "ok"); - Link<Button*,void> aLink = LINK(this, SvxZoomDialog, UserHdl); - m_p100Btn->SetClickHdl(aLink); - m_pOptimalBtn->SetClickHdl(aLink); - m_pPageWidthBtn->SetClickHdl(aLink); - m_pWholePageBtn->SetClickHdl(aLink); - m_pUserBtn->SetClickHdl(aLink); - - Link<Button*,void> aViewLayoutLink = LINK(this, SvxZoomDialog, ViewLayoutUserHdl); - m_pAutomaticBtn->SetClickHdl(aViewLayoutLink); - m_pSingleBtn->SetClickHdl(aViewLayoutLink); - m_pColumnsBtn->SetClickHdl(aViewLayoutLink); - - Link<Edit&,void> aViewLayoutSpinLink = LINK(this, SvxZoomDialog, ViewLayoutSpinHdl); - m_pColumnsEdit->SetModifyHdl(aViewLayoutSpinLink); - - Link<Button*,void> aViewLayoutCheckLink = LINK(this, SvxZoomDialog, ViewLayoutCheckHdl); - m_pBookModeChk->SetClickHdl(aViewLayoutCheckLink); - - m_pOKBtn->SetClickHdl(LINK(this, SvxZoomDialog, OKHdl)); - m_pUserEdit->SetModifyHdl(LINK(this, SvxZoomDialog, SpinHdl)); + m_xUserEdit->set_unit(FUNIT_PERCENT); + + Link<weld::ToggleButton&,void> aLink = LINK(this, SvxZoomDialog, UserHdl); + m_x100Btn->connect_toggled(aLink); + m_xOptimalBtn->connect_toggled(aLink); + m_xPageWidthBtn->connect_toggled(aLink); + m_xWholePageBtn->connect_toggled(aLink); + m_xUserBtn->connect_toggled(aLink); + + Link<weld::ToggleButton&,void> aViewLayoutLink = LINK(this, SvxZoomDialog, ViewLayoutUserHdl); + m_xAutomaticBtn->connect_toggled(aViewLayoutLink); + m_xSingleBtn->connect_toggled(aViewLayoutLink); + m_xColumnsBtn->connect_toggled(aViewLayoutLink); + + Link<weld::SpinButton&,void> aViewLayoutSpinLink = LINK(this, SvxZoomDialog, ViewLayoutSpinHdl); + m_xColumnsEdit->connect_value_changed(aViewLayoutSpinLink); + + Link<weld::ToggleButton&,void> aViewLayoutCheckLink = LINK(this, SvxZoomDialog, ViewLayoutCheckHdl); + m_xBookModeChk->connect_toggled(aViewLayoutCheckLink); + + m_xOKBtn->connect_clicked(LINK(this, SvxZoomDialog, OKHdl)); + m_xUserEdit->connect_value_changed(LINK(this, SvxZoomDialog, SpinHdl)); // default values sal_uInt16 nValue = 100; @@ -190,9 +187,9 @@ SvxZoomDialog::SvxZoomDialog( vcl::Window* pParent, const SfxItemSet& rCoreSet ) nMax = nValue; SetLimits(nMin, nMax); - m_pUserEdit->SetValue(nValue); + m_xUserEdit->set_value(nValue, FUNIT_PERCENT); - const SfxPoolItem& rItem = mrSet.Get(mrSet.GetPool()->GetWhich(SID_ATTR_ZOOM)); + const SfxPoolItem& rItem = m_rSet.Get(m_rSet.GetPool()->GetWhich(SID_ATTR_ZOOM)); if (nullptr != dynamic_cast<const SvxZoomItem*>( &rItem)) { @@ -220,13 +217,13 @@ SvxZoomDialog::SvxZoomDialog( vcl::Window* pParent, const SfxItemSet& rCoreSet ) } if (!(SvxZoomEnableFlags::N100 & nValSet)) - m_p100Btn->Disable(); + m_x100Btn->set_sensitive(false); if (!(SvxZoomEnableFlags::OPTIMAL & nValSet)) - m_pOptimalBtn->Disable(); + m_xOptimalBtn->set_sensitive(false); if (!(SvxZoomEnableFlags::PAGEWIDTH & nValSet)) - m_pPageWidthBtn->Disable(); + m_xPageWidthBtn->set_sensitive(false); if (!(SvxZoomEnableFlags::WHOLEPAGE & nValSet)) - m_pWholePageBtn->Disable(); + m_xWholePageBtn->set_sensitive(false); SetFactor(nZoom, nButtonId); } @@ -237,7 +234,7 @@ SvxZoomDialog::SvxZoomDialog( vcl::Window* pParent, const SfxItemSet& rCoreSet ) } const SfxPoolItem* pPoolViewLayoutItem = nullptr; - if (SfxItemState::SET == mrSet.GetItemState(SID_ATTR_VIEWLAYOUT, false, &pPoolViewLayoutItem)) + if (SfxItemState::SET == m_rSet.GetItemState(SID_ATTR_VIEWLAYOUT, false, &pPoolViewLayoutItem)) { const SvxViewLayoutItem* pViewLayoutItem = static_cast<const SvxViewLayoutItem*>(pPoolViewLayoutItem); const sal_uInt16 nColumns = pViewLayoutItem->GetValue(); @@ -245,208 +242,172 @@ SvxZoomDialog::SvxZoomDialog( vcl::Window* pParent, const SfxItemSet& rCoreSet ) if (0 == nColumns) { - m_pAutomaticBtn->Check(); - m_pColumnsEdit->SetValue(2); - m_pColumnsEdit->Disable(); - m_pBookModeChk->Disable(); + m_xAutomaticBtn->set_active(true); + m_xColumnsEdit->set_value(2); + m_xColumnsEdit->set_sensitive(false); + m_xBookModeChk->set_sensitive(false); } else if (1 == nColumns) { - m_pSingleBtn->Check(); - m_pColumnsEdit->SetValue(2); - m_pColumnsEdit->Disable(); - m_pBookModeChk->Disable(); + m_xSingleBtn->set_active(true); + m_xColumnsEdit->set_value(2); + m_xColumnsEdit->set_sensitive(false); + m_xBookModeChk->set_sensitive(false); } else { - m_pColumnsBtn->Check(); + m_xColumnsBtn->set_active(true); if (!bBookMode) { - m_pColumnsEdit->SetValue(nColumns); + m_xColumnsEdit->set_value(nColumns); if (nColumns % 2 != 0) - m_pBookModeChk->Disable(); + m_xBookModeChk->set_sensitive(false); } else { - m_pColumnsEdit->SetValue(nColumns); - m_pBookModeChk->Check(); + m_xColumnsEdit->set_value(nColumns); + m_xBookModeChk->set_active(true); } } } else { // hide view layout related controls: - m_pViewFrame->Disable(); + m_xViewFrame->set_sensitive(false); } } -SvxZoomDialog::~SvxZoomDialog() -{ - disposeOnce(); -} - -void SvxZoomDialog::dispose() -{ - mpOutSet.reset(); - m_pOptimalBtn.clear(); - m_pWholePageBtn.clear(); - m_pPageWidthBtn.clear(); - m_p100Btn.clear(); - m_pUserBtn.clear(); - m_pUserEdit.clear(); - m_pViewFrame.clear(); - m_pAutomaticBtn.clear(); - m_pSingleBtn.clear(); - m_pColumnsBtn.clear(); - m_pColumnsEdit.clear(); - m_pBookModeChk.clear(); - m_pOKBtn.clear(); - SfxModalDialog::dispose(); -} - -IMPL_LINK(SvxZoomDialog, UserHdl, Button *, pButton, void) +IMPL_LINK_NOARG(SvxZoomDialog, UserHdl, weld::ToggleButton&, void) { - mbModified = true; + m_bModified = true; - if (pButton == m_pUserBtn) + if (m_xUserBtn->get_active()) { - m_pUserEdit->Enable(); - m_pUserEdit->GrabFocus(); + m_xUserEdit->set_sensitive(true); + m_xUserEdit->grab_focus(); } else { - m_pUserEdit->Disable(); + m_xUserEdit->set_sensitive(false); } } -IMPL_LINK_NOARG(SvxZoomDialog, SpinHdl, Edit&, void) +IMPL_LINK_NOARG(SvxZoomDialog, SpinHdl, weld::MetricSpinButton&, void) { - if (!m_pUserBtn->IsChecked()) + if (!m_xUserBtn->get_active()) return; - mbModified = true; + m_bModified = true; } -IMPL_LINK(SvxZoomDialog, ViewLayoutUserHdl, Button*, pButton, void) +IMPL_LINK_NOARG(SvxZoomDialog, ViewLayoutUserHdl, weld::ToggleButton&, void) { - mbModified = true; + m_bModified = true; - if (pButton == m_pAutomaticBtn) + if (m_xAutomaticBtn->get_active()) { - m_pColumnsEdit->Disable(); - m_pBookModeChk->Disable(); + m_xColumnsEdit->set_sensitive(false); + m_xBookModeChk->set_sensitive(false); } - else if (pButton == m_pSingleBtn) + else if (m_xSingleBtn->get_active()) { - m_pColumnsEdit->Disable(); - m_pBookModeChk->Disable(); + m_xColumnsEdit->set_sensitive(false); + m_xBookModeChk->set_sensitive(false); } - else if (pButton == m_pColumnsBtn) - { - m_pColumnsEdit->Enable(); - m_pColumnsEdit->GrabFocus(); - if (m_pColumnsEdit->GetValue() % 2 == 0) - m_pBookModeChk->Enable(); - } - else + else if (m_xColumnsBtn->get_active()) { - OSL_FAIL("Wrong Button"); + m_xColumnsEdit->set_sensitive(true); + m_xColumnsEdit->grab_focus(); + if (m_xColumnsEdit->get_value() % 2 == 0) + m_xBookModeChk->set_sensitive(true); } } -IMPL_LINK(SvxZoomDialog, ViewLayoutSpinHdl, Edit&, rEdit, void) +IMPL_LINK_NOARG(SvxZoomDialog, ViewLayoutSpinHdl, weld::SpinButton&, void) { - if (&rEdit == m_pColumnsEdit && !m_pColumnsBtn->IsChecked()) + if (!m_xColumnsBtn->get_active()) return; - if (m_pColumnsEdit->GetValue() % 2 == 0) + if (m_xColumnsEdit->get_value() % 2 == 0) { - m_pBookModeChk->Enable(); + m_xBookModeChk->set_sensitive(true); } else { - m_pBookModeChk->Check(false); - m_pBookModeChk->Disable(); + m_xBookModeChk->set_active(false); + m_xBookModeChk->set_sensitive(false); } - mbModified = true; + m_bModified = true; } -IMPL_LINK(SvxZoomDialog, ViewLayoutCheckHdl, Button*, pCheckBox, void) +IMPL_LINK_NOARG(SvxZoomDialog, ViewLayoutCheckHdl, weld::ToggleButton&, void) { - if (pCheckBox == m_pBookModeChk && !m_pColumnsBtn->IsChecked()) + if (!m_xColumnsBtn->get_active()) return; - mbModified = true; + m_bModified = true; } -IMPL_LINK(SvxZoomDialog, OKHdl, Button*, pButton, void) +IMPL_LINK_NOARG(SvxZoomDialog, OKHdl, weld::Button&, void) { - if (mbModified || m_pOKBtn != pButton) + if (m_bModified) { - SvxZoomItem aZoomItem(SvxZoomType::PERCENT, 0, mrSet.GetPool()->GetWhich(SID_ATTR_ZOOM)); - SvxViewLayoutItem aViewLayoutItem(0, false, mrSet.GetPool()->GetWhich(SID_ATTR_VIEWLAYOUT)); + SvxZoomItem aZoomItem(SvxZoomType::PERCENT, 0, m_rSet.GetPool()->GetWhich(SID_ATTR_ZOOM)); + SvxViewLayoutItem aViewLayoutItem(0, false, m_rSet.GetPool()->GetWhich(SID_ATTR_VIEWLAYOUT)); - if (m_pOKBtn == pButton) - { - sal_uInt16 nFactor = GetFactor(); - - if (SPECIAL_FACTOR == nFactor) - { - if (m_pOptimalBtn->IsChecked()) - aZoomItem.SetType(SvxZoomType::OPTIMAL); - else if (m_pPageWidthBtn->IsChecked()) - aZoomItem.SetType(SvxZoomType::PAGEWIDTH); - else if (m_pWholePageBtn->IsChecked()) - aZoomItem.SetType(SvxZoomType::WHOLEPAGE); - } - else - { - aZoomItem.SetValue(nFactor); - } + sal_uInt16 nFactor = GetFactor(); - if (m_pAutomaticBtn->IsChecked()) - { - aViewLayoutItem.SetValue(0); - aViewLayoutItem.SetBookMode(false); - } - if (m_pSingleBtn->IsChecked()) - { - aViewLayoutItem.SetValue(1); - aViewLayoutItem.SetBookMode(false); - } - else if (m_pColumnsBtn->IsChecked()) - { - aViewLayoutItem.SetValue(static_cast<sal_uInt16>(m_pColumnsEdit->GetValue())); - aViewLayoutItem.SetBookMode(m_pBookModeChk->IsChecked()); - } + if (SPECIAL_FACTOR == nFactor) + { + if (m_xOptimalBtn->get_active()) + aZoomItem.SetType(SvxZoomType::OPTIMAL); + else if (m_xPageWidthBtn->get_active()) + aZoomItem.SetType(SvxZoomType::PAGEWIDTH); + else if (m_xWholePageBtn->get_active()) + aZoomItem.SetType(SvxZoomType::WHOLEPAGE); } else { - OSL_FAIL("Wrong Button"); - return; + aZoomItem.SetValue(nFactor); + } + + if (m_xAutomaticBtn->get_active()) + { + aViewLayoutItem.SetValue(0); + aViewLayoutItem.SetBookMode(false); + } + if (m_xSingleBtn->get_active()) + { + aViewLayoutItem.SetValue(1); + aViewLayoutItem.SetBookMode(false); + } + else if (m_xColumnsBtn->get_active()) + { + aViewLayoutItem.SetValue(static_cast<sal_uInt16>(m_xColumnsEdit->get_value())); + aViewLayoutItem.SetBookMode(m_xBookModeChk->get_active()); } - mpOutSet.reset(new SfxItemSet(mrSet)); - mpOutSet->Put(aZoomItem); + + m_pOutSet.reset(new SfxItemSet(m_rSet)); + m_pOutSet->Put(aZoomItem); // don't set attribute in case the whole viewlayout stuff is disabled: - if (m_pViewFrame->IsEnabled()) - mpOutSet->Put(aViewLayoutItem); + if (m_xViewFrame->get_sensitive()) + m_pOutSet->Put(aViewLayoutItem); // memorize value from the UserEdit beyond the dialog SfxObjectShell* pShell = SfxObjectShell::Current(); if (pShell) { - sal_uInt16 nZoomValue = static_cast<sal_uInt16>(m_pUserEdit->GetValue()); + sal_uInt16 nZoomValue = static_cast<sal_uInt16>(m_xUserEdit->get_value(FUNIT_PERCENT)); pShell->PutItem(SfxUInt16Item(SID_ATTR_ZOOM_USER, nZoomValue)); } - EndDialog( RET_OK ); + m_xDialog->response(RET_OK); } else - { - EndDialog(); - } + m_xDialog->response(RET_CANCEL); + } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx index 0acd2ccd46e9..6dc1f279693d 100644 --- a/cui/source/factory/dlgfact.cxx +++ b/cui/source/factory/dlgfact.cxx @@ -104,7 +104,12 @@ IMPL_ABSTDLG_BASE(AbstractHangulHanjaConversionDialog_Impl); IMPL_ABSTDLG_BASE(AbstractFmShowColsDialog_Impl); IMPL_ABSTDLG_BASE(AbstractHyphenWordDialog_Impl) IMPL_ABSTDLG_BASE(AbstractThesaurusDialog_Impl) -IMPL_ABSTDLG_BASE(AbstractSvxZoomDialog_Impl) + +short AbstractSvxZoomDialog_Impl::Execute() +{ + return m_xDlg->run(); +} + IMPL_ABSTDLG_BASE(AbstractTitleDialog_Impl); IMPL_ABSTDLG_BASE(AbstractScriptSelectorDialog_Impl); IMPL_ABSTDLG_BASE(AbstractGalleryIdDialog_Impl); @@ -406,17 +411,17 @@ void AbstractFmShowColsDialog_Impl::SetColumns(const ::Reference< css::containe void AbstractSvxZoomDialog_Impl::SetLimits( sal_uInt16 nMin, sal_uInt16 nMax ) { - pDlg->SetLimits( nMin, nMax ); + m_xDlg->SetLimits( nMin, nMax ); } void AbstractSvxZoomDialog_Impl::HideButton( ZoomButtonId nBtnId ) { - pDlg->HideButton( nBtnId ); + m_xDlg->HideButton( nBtnId ); } const SfxItemSet* AbstractSvxZoomDialog_Impl::GetOutputItemSet() const { - return pDlg->GetOutputItemSet(); + return m_xDlg->GetOutputItemSet(); } void AbstractSpellDialog_Impl::Invalidate() @@ -953,11 +958,9 @@ VclPtr<AbstractFmShowColsDialog> AbstractDialogFactory_Impl::CreateFmShowColsDia return VclPtr<AbstractFmShowColsDialog_Impl>::Create( pDlg ); } -VclPtr<AbstractSvxZoomDialog> AbstractDialogFactory_Impl::CreateSvxZoomDialog( vcl::Window* pParent, - const SfxItemSet& rCoreSet) +VclPtr<AbstractSvxZoomDialog> AbstractDialogFactory_Impl::CreateSvxZoomDialog(weld::Window* pParent, const SfxItemSet& rCoreSet) { - VclPtrInstance<SvxZoomDialog> pDlg( pParent, rCoreSet); - return VclPtr<AbstractSvxZoomDialog_Impl>::Create( pDlg ); + return VclPtr<AbstractSvxZoomDialog_Impl>::Create(new SvxZoomDialog(pParent, rCoreSet)); } VclPtr<AbstractSpellDialog> AbstractDialogFactory_Impl::CreateSvxSpellDialog( diff --git a/cui/source/factory/dlgfact.hxx b/cui/source/factory/dlgfact.hxx index 4a77f17607ee..25573f60a19e 100644 --- a/cui/source/factory/dlgfact.hxx +++ b/cui/source/factory/dlgfact.hxx @@ -187,11 +187,17 @@ class AbstractFmShowColsDialog_Impl : public AbstractFmShowColsDialog class SvxZoomDialog; class AbstractSvxZoomDialog_Impl : public AbstractSvxZoomDialog { - DECL_ABSTDLG_BASE(AbstractSvxZoomDialog_Impl,SvxZoomDialog) - virtual void SetLimits( sal_uInt16 nMin, sal_uInt16 nMax ) override; - virtual void HideButton( ZoomButtonId nBtnId ) override; +protected: + std::unique_ptr<SvxZoomDialog> m_xDlg; +public: + explicit AbstractSvxZoomDialog_Impl(SvxZoomDialog* p) + : m_xDlg(p) + { + } + virtual short Execute() override; + virtual void SetLimits( sal_uInt16 nMin, sal_uInt16 nMax ) override; + virtual void HideButton( ZoomButtonId nBtnId ) override; virtual const SfxItemSet* GetOutputItemSet() const override ; - }; namespace svx{ class SpellDialog;} @@ -547,8 +553,7 @@ public: SvxSpellWrapper* pWrapper ) override; virtual VclPtr<AbstractFmShowColsDialog> CreateFmShowColsDialog() override; - virtual VclPtr<AbstractSvxZoomDialog> CreateSvxZoomDialog( vcl::Window* pParent, - const SfxItemSet& rCoreSet) override; + virtual VclPtr<AbstractSvxZoomDialog> CreateSvxZoomDialog(weld::Window* pParent, const SfxItemSet& rCoreSet) override; // add for SvxBorderBackgroundDlg virtual VclPtr<SfxAbstractTabDialog> CreateSvxBorderBackgroundDlg( vcl::Window* pParent, diff --git a/cui/source/inc/zoom.hxx b/cui/source/inc/zoom.hxx index 87221f53397e..7dd271f7b456 100644 --- a/cui/source/inc/zoom.hxx +++ b/cui/source/inc/zoom.hxx @@ -22,44 +22,38 @@ #include <memory> #include <sfx2/basedlgs.hxx> #include <svx/zoom_def.hxx> -#include <vcl/button.hxx> -#include <vcl/field.hxx> -#include <vcl/fixed.hxx> +#include <vcl/weld.hxx> -class SvxZoomDialog : public SfxModalDialog +class SvxZoomDialog : public weld::GenericDialogController { private: - VclPtr<RadioButton> m_pOptimalBtn; - VclPtr<RadioButton> m_pWholePageBtn; - VclPtr<RadioButton> m_pPageWidthBtn; - VclPtr<RadioButton> m_p100Btn; - VclPtr<RadioButton> m_pUserBtn; - VclPtr<MetricField> m_pUserEdit; + const SfxItemSet& m_rSet; + std::unique_ptr<SfxItemSet> m_pOutSet; + bool m_bModified; - VclPtr<VclContainer> m_pViewFrame; - VclPtr<RadioButton> m_pAutomaticBtn; - VclPtr<RadioButton> m_pSingleBtn; - VclPtr<RadioButton> m_pColumnsBtn; - VclPtr<NumericField> m_pColumnsEdit; - VclPtr<CheckBox> m_pBookModeChk; + std::unique_ptr<weld::RadioButton> m_xOptimalBtn; + std::unique_ptr<weld::RadioButton> m_xWholePageBtn; + std::unique_ptr<weld::RadioButton> m_xPageWidthBtn; + std::unique_ptr<weld::RadioButton> m_x100Btn; + std::unique_ptr<weld::RadioButton> m_xUserBtn; + std::unique_ptr<weld::MetricSpinButton> m_xUserEdit; + std::unique_ptr<weld::Widget> m_xViewFrame; + std::unique_ptr<weld::RadioButton> m_xAutomaticBtn; + std::unique_ptr<weld::RadioButton> m_xSingleBtn; + std::unique_ptr<weld::RadioButton> m_xColumnsBtn; + std::unique_ptr<weld::SpinButton> m_xColumnsEdit; + std::unique_ptr<weld::CheckButton> m_xBookModeChk; + std::unique_ptr<weld::Button> m_xOKBtn; - VclPtr<OKButton> m_pOKBtn; - - const SfxItemSet& mrSet; - std::unique_ptr<SfxItemSet> mpOutSet; - bool mbModified; - - DECL_LINK(UserHdl, Button*, void); - DECL_LINK(SpinHdl, Edit&, void); - DECL_LINK(ViewLayoutUserHdl, Button*, void); - DECL_LINK(ViewLayoutSpinHdl, Edit&, void); - DECL_LINK(ViewLayoutCheckHdl, Button*, void); - DECL_LINK(OKHdl, Button*, void); + DECL_LINK(UserHdl, weld::ToggleButton&, void); + DECL_LINK(SpinHdl, weld::MetricSpinButton&, void); + DECL_LINK(ViewLayoutUserHdl, weld::ToggleButton&, void); + DECL_LINK(ViewLayoutSpinHdl, weld::SpinButton&, void); + DECL_LINK(ViewLayoutCheckHdl, weld::ToggleButton&, void); + DECL_LINK(OKHdl, weld::Button&, void); public: - SvxZoomDialog(vcl::Window* pParent, const SfxItemSet& rCoreSet); - virtual ~SvxZoomDialog() override; - virtual void dispose() override; + SvxZoomDialog(weld::Window* pParent, const SfxItemSet& rCoreSet); const SfxItemSet* GetOutputItemSet() const; diff --git a/cui/uiconfig/ui/zoomdialog.ui b/cui/uiconfig/ui/zoomdialog.ui index 24f5faa68e8c..2fd7e3e1673a 100644 --- a/cui/uiconfig/ui/zoomdialog.ui +++ b/cui/uiconfig/ui/zoomdialog.ui @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.20.0 --> +<!-- Generated with glade 3.20.4 --> <interface domain="cui"> <requires lib="gtk+" version="3.18"/> <object class="GtkAdjustment" id="adjustment1"> @@ -8,11 +8,19 @@ <property name="step_increment">1</property> <property name="page_increment">10</property> </object> + <object class="GtkAdjustment" id="adjustment2"> + <property name="upper">100</property> + <property name="step_increment">1</property> + <property name="page_increment">10</property> + </object> <object class="GtkDialog" id="ZoomDialog"> <property name="can_focus">False</property> <property name="border_width">6</property> <property name="title" translatable="yes" context="zoomdialog|ZoomDialog">Zoom & View Layout</property> <property name="resizable">False</property> + <property name="modal">True</property> + <property name="default_width">0</property> + <property name="default_height">0</property> <property name="type_hint">dialog</property> <child internal-child="vbox"> <object class="GtkBox" id="dialog-vbox1"> @@ -28,6 +36,7 @@ <property name="label">gtk-ok</property> <property name="visible">True</property> <property name="can_focus">True</property> + <property name="can_default">True</property> <property name="has_default">True</property> <property name="receives_default">True</property> <property name="use_stock">True</property> @@ -107,7 +116,6 @@ <property name="xalign">0</property> <property name="active">True</property> <property name="draw_indicator">True</property> - <property name="group">fitwandh</property> </object> <packing> <property name="expand">False</property> @@ -122,9 +130,8 @@ <property name="can_focus">True</property> <property name="receives_default">False</property> <property name="xalign">0</property> - <property name="active">True</property> <property name="draw_indicator">True</property> - <property name="group">fitw</property> + <property name="group">optimal</property> </object> <packing> <property name="expand">False</property> @@ -139,9 +146,8 @@ <property name="can_focus">True</property> <property name="receives_default">False</property> <property name="xalign">0</property> - <property name="active">True</property> <property name="draw_indicator">True</property> - <property name="group">100pc</property> + <property name="group">optimal</property> </object> <packing> <property name="expand">False</property> @@ -156,9 +162,8 @@ <property name="can_focus">True</property> <property name="receives_default">False</property> <property name="xalign">0</property> - <property name="active">True</property> <property name="draw_indicator">True</property> - <property name="group">variable</property> + <property name="group">optimal</property> </object> <packing> <property name="expand">False</property> @@ -178,11 +183,10 @@ <property name="can_focus">True</property> <property name="receives_default">False</property> <property name="xalign">0</property> - <property name="active">True</property> <property name="draw_indicator">True</property> <property name="group">optimal</property> <accessibility> - <relation type="label-for" target="zoomsb:0%"/> + <relation type="label-for" target="zoomsb"/> </accessibility> </object> <packing> @@ -192,15 +196,16 @@ </packing> </child> <child> - <object class="GtkSpinButton" id="zoomsb:0%"> + <object class="GtkSpinButton" id="zoomsb"> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="invisible_char">●</property> + <property name="activates_default">True</property> + <property name="adjustment">adjustment2</property> <accessibility> <relation type="labelled-by" target="variable"/> </accessibility> <child internal-child="accessible"> - <object class="AtkObject" id="zoomsb:0%-atkobject"> + <object class="AtkObject" id="zoomsb-atkobject"> <property name="AtkObject::accessible-name" translatable="yes" context="zoomdialog|zoomsb-atkobject">Variable</property> </object> </child> @@ -264,9 +269,7 @@ <property name="can_focus">True</property> <property name="receives_default">False</property> <property name="xalign">0</property> - <property name="active">True</property> <property name="draw_indicator">True</property> - <property name="group">singlepage</property> </object> <packing> <property name="expand">False</property> @@ -281,9 +284,8 @@ <property name="can_focus">True</property> <property name="receives_default">False</property> <property name="xalign">0</property> - <property name="active">True</property> <property name="draw_indicator">True</property> - <property name="group">columns</property> + <property name="group">automatic</property> </object> <packing> <property name="expand">False</property> @@ -303,7 +305,6 @@ <property name="can_focus">True</property> <property name="receives_default">False</property> <property name="xalign">0</property> - <property name="active">True</property> <property name="draw_indicator">True</property> <property name="group">automatic</property> <accessibility> @@ -321,7 +322,7 @@ <object class="GtkSpinButton" id="columnssb"> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="invisible_char">●</property> + <property name="activates_default">True</property> <property name="adjustment">adjustment1</property> <accessibility> <relation type="labelled-by" target="columns"/> @@ -407,5 +408,8 @@ <action-widget response="-6">cancel</action-widget> <action-widget response="-11">help</action-widget> </action-widgets> + <child> + <placeholder/> + </child> </object> </interface> diff --git a/include/svx/svxdlg.hxx b/include/svx/svxdlg.hxx index 3899e4a6f204..f2f817241b38 100644 --- a/include/svx/svxdlg.hxx +++ b/include/svx/svxdlg.hxx @@ -345,8 +345,7 @@ public: virtual VclPtr<AbstractFmShowColsDialog> CreateFmShowColsDialog() = 0; - virtual VclPtr<AbstractSvxZoomDialog> CreateSvxZoomDialog( vcl::Window* pParent, - const SfxItemSet& rCoreSet )=0; + virtual VclPtr<AbstractSvxZoomDialog> CreateSvxZoomDialog(weld::Window* pParent, const SfxItemSet& rCoreSet) = 0; virtual VclPtr<AbstractSpellDialog> CreateSvxSpellDialog(vcl::Window* pParent, SfxBindings* pBindings, diff --git a/sc/source/ui/view/tabvwsh3.cxx b/sc/source/ui/view/tabvwsh3.cxx index 404b55abcb53..a31a91fc538d 100644 --- a/sc/source/ui/view/tabvwsh3.cxx +++ b/sc/source/ui/view/tabvwsh3.cxx @@ -724,7 +724,8 @@ void ScTabViewShell::Execute( SfxRequest& rReq ) SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); if(pFact) { - pDlg.disposeAndReset(pFact->CreateSvxZoomDialog(GetDialogParent(), aSet)); + vcl::Window* pWin = GetDialogParent(); + pDlg.disposeAndReset(pFact->CreateSvxZoomDialog(pWin ? pWin->GetFrameWeld() : nullptr, aSet)); OSL_ENSURE(pDlg, "Dialog creation failed!"); } if (pDlg) diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx index f64876457931..979ac6ab8df4 100644 --- a/starmath/source/view.cxx +++ b/starmath/source/view.cxx @@ -1709,7 +1709,7 @@ void SmViewShell::Execute(SfxRequest& rReq) SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); if(pFact) { - ScopedVclPtr<AbstractSvxZoomDialog> xDlg(pFact->CreateSvxZoomDialog(&GetViewFrame()->GetWindow(), aSet)); + ScopedVclPtr<AbstractSvxZoomDialog> xDlg(pFact->CreateSvxZoomDialog(GetViewFrame()->GetWindow().GetFrameWeld(), aSet)); assert(xDlg); xDlg->SetLimits( MINZOOM, MAXZOOM ); if (xDlg->Execute() != RET_CANCEL) diff --git a/sw/source/uibase/uiview/pview.cxx b/sw/source/uibase/uiview/pview.cxx index f2958a819faa..32d37c62c8e8 100644 --- a/sw/source/uibase/uiview/pview.cxx +++ b/sw/source/uibase/uiview/pview.cxx @@ -772,7 +772,7 @@ void SwPagePreview::Execute( SfxRequest &rReq ) SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); if(pFact) { - pDlg.disposeAndReset(pFact->CreateSvxZoomDialog(&GetViewFrame()->GetWindow(), aCoreSet)); + pDlg.disposeAndReset(pFact->CreateSvxZoomDialog(GetViewFrame()->GetWindow().GetFrameWeld(), aCoreSet)); OSL_ENSURE(pDlg, "Dialog creation failed!"); } diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx index 721a6039ece7..c48970cb8e86 100644 --- a/sw/source/uibase/uiview/view2.cxx +++ b/sw/source/uibase/uiview/view2.cxx @@ -1660,7 +1660,7 @@ void SwView::ExecuteStatusLine(SfxRequest &rReq) SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); if(pFact) { - pDlg.disposeAndReset(pFact->CreateSvxZoomDialog(&GetViewFrame()->GetWindow(), aCoreSet)); + pDlg.disposeAndReset(pFact->CreateSvxZoomDialog(GetViewFrame()->GetWindow().GetFrameWeld(), aCoreSet)); OSL_ENSURE(pDlg, "Zooming fail!"); if (pDlg) { diff --git a/sw/uiconfig/swriter/ui/inserttable.ui b/sw/uiconfig/swriter/ui/inserttable.ui index 2c68b197aef1..1d7d896aeb8f 100644 --- a/sw/uiconfig/swriter/ui/inserttable.ui +++ b/sw/uiconfig/swriter/ui/inserttable.ui @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.22.0 --> +<!-- Generated with glade 3.20.4 --> <interface domain="sw"> <requires lib="gtk+" version="3.18"/> <object class="GtkAdjustment" id="adjustment1"> @@ -485,4 +485,10 @@ <placeholder/> </child> </object> + <object class="GtkSizeGroup" id="sizegroup1"> + <widgets> + <widget name="colspin"/> + <widget name="rowspin"/> + </widgets> + </object> </interface> diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx index cde387c30659..20d61600893c 100644 --- a/vcl/unx/gtk3/gtk3gtkinst.cxx +++ b/vcl/unx/gtk3/gtk3gtkinst.cxx @@ -2916,7 +2916,7 @@ public: virtual void enable_notify_events() override { - GtkInstanceEntry::disable_notify_events(); + GtkInstanceEntry::enable_notify_events(); g_signal_handler_unblock(m_pButton, m_nValueChangedSignalId); } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits