diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-04-20 11:06:07 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-04-22 21:29:36 +0200 |
commit | 60f3e4b843da89678e022eed837ee66e726b1920 (patch) | |
tree | 4cffea5d364e3ed9bd3e68c7b471f313c237a98e /starmath/source | |
parent | 4a7ebfea57094b914c4b1c3e46936dbf67dec499 (diff) |
place an intermediate class as parent for SfxTabPages
so a SfxTabPage can be parented by a vcl::Window or a welded native notebook tabpage.
That ways the same SfxTabPage can be used at the same time in both a native dialog
or a vcl dialog. The impl can be changed to the weld api, and when hosted in a native
dialog the vcl impl of that will be instantiated, while native otherwise. e.g.
print options appearing in print options dialog and general options.
This allows incremental changeover.
Change-Id: I6f1fed1e8d0898b01853bb878757bad41cbf9bba
Reviewed-on: https://gerrit.libreoffice.org/53193
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'starmath/source')
-rw-r--r-- | starmath/source/dialog.cxx | 95 | ||||
-rw-r--r-- | starmath/source/smmod.cxx | 4 | ||||
-rw-r--r-- | starmath/source/view.cxx | 2 |
3 files changed, 40 insertions, 61 deletions
diff --git a/starmath/source/dialog.cxx b/starmath/source/dialog.cxx index e1f744c053f3..267cdca90009 100644 --- a/starmath/source/dialog.cxx +++ b/starmath/source/dialog.cxx @@ -151,99 +151,78 @@ void SetFontStyle(const OUString &rStyleName, vcl::Font &rFont) rFont.SetWeight((nIndex & 0x2) ? WEIGHT_BOLD : WEIGHT_NORMAL); } -IMPL_LINK_NOARG( SmPrintOptionsTabPage, SizeButtonClickHdl, Button *, void ) +IMPL_LINK_NOARG(SmPrintOptionsTabPage, SizeButtonClickHdl, weld::ToggleButton&, void) { - m_pZoom->Enable(m_pSizeZoomed->IsChecked()); + m_xZoom->set_sensitive(m_xSizeZoomed->get_active()); } -SmPrintOptionsTabPage::SmPrintOptionsTabPage(vcl::Window* pParent, const SfxItemSet& rOptions) - : SfxTabPage(pParent, "SmathSettings", "modules/smath/ui/smathsettings.ui", &rOptions) +SmPrintOptionsTabPage::SmPrintOptionsTabPage(TabPageParent pPage, const SfxItemSet& rOptions) + : SfxTabPage(pPage, "modules/smath/ui/smathsettings.ui", "SmathSettings", &rOptions) + , m_xTitle(m_xBuilder->weld_check_button("title")) + , m_xText(m_xBuilder->weld_check_button("text")) + , m_xFrame(m_xBuilder->weld_check_button("frame")) + , m_xSizeNormal(m_xBuilder->weld_radio_button("sizenormal")) + , m_xSizeScaled(m_xBuilder->weld_radio_button("sizescaled")) + , m_xSizeZoomed(m_xBuilder->weld_radio_button("sizezoomed")) + , m_xZoom(m_xBuilder->weld_metric_spin_button("zoom", FUNIT_PERCENT)) + , m_xNoRightSpaces(m_xBuilder->weld_check_button("norightspaces")) + , m_xSaveOnlyUsedSymbols(m_xBuilder->weld_check_button("saveonlyusedsymbols")) + , m_xAutoCloseBrackets(m_xBuilder->weld_check_button("autoclosebrackets")) { - get( m_pTitle, "title"); - get( m_pText, "text"); - get( m_pFrame, "frame"); - get( m_pSizeNormal, "sizenormal"); - get( m_pSizeScaled, "sizescaled"); - get( m_pSizeZoomed, "sizezoomed"); - get( m_pZoom, "zoom"); - get( m_pNoRightSpaces, "norightspaces"); - get( m_pSaveOnlyUsedSymbols, "saveonlyusedsymbols"); - get( m_pAutoCloseBrackets, "autoclosebrackets"); - - m_pSizeNormal->SetClickHdl(LINK(this, SmPrintOptionsTabPage, SizeButtonClickHdl)); - m_pSizeScaled->SetClickHdl(LINK(this, SmPrintOptionsTabPage, SizeButtonClickHdl)); - m_pSizeZoomed->SetClickHdl(LINK(this, SmPrintOptionsTabPage, SizeButtonClickHdl)); + m_xSizeNormal->connect_toggled(LINK(this, SmPrintOptionsTabPage, SizeButtonClickHdl)); + m_xSizeScaled->connect_toggled(LINK(this, SmPrintOptionsTabPage, SizeButtonClickHdl)); + m_xSizeZoomed->connect_toggled(LINK(this, SmPrintOptionsTabPage, SizeButtonClickHdl)); Reset(&rOptions); } SmPrintOptionsTabPage::~SmPrintOptionsTabPage() { - disposeOnce(); } -void SmPrintOptionsTabPage::dispose() -{ - m_pTitle.clear(); - m_pText.clear(); - m_pFrame.clear(); - m_pSizeNormal.clear(); - m_pSizeScaled.clear(); - m_pSizeZoomed.clear(); - m_pZoom.clear(); - m_pNoRightSpaces.clear(); - m_pSaveOnlyUsedSymbols.clear(); - m_pAutoCloseBrackets.clear(); - SfxTabPage::dispose(); -} - - bool SmPrintOptionsTabPage::FillItemSet(SfxItemSet* rSet) { sal_uInt16 nPrintSize; - if (m_pSizeNormal->IsChecked()) + if (m_xSizeNormal->get_active()) nPrintSize = PRINT_SIZE_NORMAL; - else if (m_pSizeScaled->IsChecked()) + else if (m_xSizeScaled->get_active()) nPrintSize = PRINT_SIZE_SCALED; else nPrintSize = PRINT_SIZE_ZOOMED; rSet->Put(SfxUInt16Item(GetWhich(SID_PRINTSIZE), nPrintSize)); - rSet->Put(SfxUInt16Item(GetWhich(SID_PRINTZOOM), sal::static_int_cast<sal_uInt16>(m_pZoom->GetValue()))); - rSet->Put(SfxBoolItem(GetWhich(SID_PRINTTITLE), m_pTitle->IsChecked())); - rSet->Put(SfxBoolItem(GetWhich(SID_PRINTTEXT), m_pText->IsChecked())); - rSet->Put(SfxBoolItem(GetWhich(SID_PRINTFRAME), m_pFrame->IsChecked())); - rSet->Put(SfxBoolItem(GetWhich(SID_NO_RIGHT_SPACES), m_pNoRightSpaces->IsChecked())); - rSet->Put(SfxBoolItem(GetWhich(SID_SAVE_ONLY_USED_SYMBOLS), m_pSaveOnlyUsedSymbols->IsChecked())); - rSet->Put(SfxBoolItem(GetWhich(SID_AUTO_CLOSE_BRACKETS), m_pAutoCloseBrackets->IsChecked())); + rSet->Put(SfxUInt16Item(GetWhich(SID_PRINTZOOM), sal::static_int_cast<sal_uInt16>(m_xZoom->get_value(FUNIT_PERCENT)))); + rSet->Put(SfxBoolItem(GetWhich(SID_PRINTTITLE), m_xTitle->get_active())); + rSet->Put(SfxBoolItem(GetWhich(SID_PRINTTEXT), m_xText->get_active())); + rSet->Put(SfxBoolItem(GetWhich(SID_PRINTFRAME), m_xFrame->get_active())); + rSet->Put(SfxBoolItem(GetWhich(SID_NO_RIGHT_SPACES), m_xNoRightSpaces->get_active())); + rSet->Put(SfxBoolItem(GetWhich(SID_SAVE_ONLY_USED_SYMBOLS), m_xSaveOnlyUsedSymbols->get_active())); + rSet->Put(SfxBoolItem(GetWhich(SID_AUTO_CLOSE_BRACKETS), m_xAutoCloseBrackets->get_active())); return true; } - void SmPrintOptionsTabPage::Reset(const SfxItemSet* rSet) { SmPrintSize ePrintSize = static_cast<SmPrintSize>(static_cast<const SfxUInt16Item &>(rSet->Get(GetWhich(SID_PRINTSIZE))).GetValue()); - m_pSizeNormal->Check(ePrintSize == PRINT_SIZE_NORMAL); - m_pSizeScaled->Check(ePrintSize == PRINT_SIZE_SCALED); - m_pSizeZoomed->Check(ePrintSize == PRINT_SIZE_ZOOMED); + m_xSizeNormal->set_active(ePrintSize == PRINT_SIZE_NORMAL); + m_xSizeScaled->set_active(ePrintSize == PRINT_SIZE_SCALED); + m_xSizeZoomed->set_active(ePrintSize == PRINT_SIZE_ZOOMED); - m_pZoom->Enable(m_pSizeZoomed->IsChecked()); + m_xZoom->set_sensitive(m_xSizeZoomed->get_active()); - m_pZoom->SetValue(static_cast<const SfxUInt16Item &>(rSet->Get(GetWhich(SID_PRINTZOOM))).GetValue()); + m_xZoom->set_value(static_cast<const SfxUInt16Item &>(rSet->Get(GetWhich(SID_PRINTZOOM))).GetValue(), FUNIT_PERCENT); - m_pTitle->Check(static_cast<const SfxBoolItem &>(rSet->Get(GetWhich(SID_PRINTTITLE))).GetValue()); - m_pText->Check(static_cast<const SfxBoolItem &>(rSet->Get(GetWhich(SID_PRINTTEXT))).GetValue()); - m_pFrame->Check(static_cast<const SfxBoolItem &>(rSet->Get(GetWhich(SID_PRINTFRAME))).GetValue()); - m_pNoRightSpaces->Check(static_cast<const SfxBoolItem &>(rSet->Get(GetWhich(SID_NO_RIGHT_SPACES))).GetValue()); - m_pSaveOnlyUsedSymbols->Check(static_cast<const SfxBoolItem &>(rSet->Get(GetWhich(SID_SAVE_ONLY_USED_SYMBOLS))).GetValue()); - m_pAutoCloseBrackets->Check(static_cast<const SfxBoolItem &>(rSet->Get(GetWhich(SID_AUTO_CLOSE_BRACKETS))).GetValue()); + m_xTitle->set_active(static_cast<const SfxBoolItem &>(rSet->Get(GetWhich(SID_PRINTTITLE))).GetValue()); + m_xNoRightSpaces->set_active(static_cast<const SfxBoolItem &>(rSet->Get(GetWhich(SID_NO_RIGHT_SPACES))).GetValue()); + m_xSaveOnlyUsedSymbols->set_active(static_cast<const SfxBoolItem &>(rSet->Get(GetWhich(SID_SAVE_ONLY_USED_SYMBOLS))).GetValue()); + m_xAutoCloseBrackets->set_active(static_cast<const SfxBoolItem &>(rSet->Get(GetWhich(SID_AUTO_CLOSE_BRACKETS))).GetValue()); } -VclPtr<SfxTabPage> SmPrintOptionsTabPage::Create(vcl::Window* pWindow, const SfxItemSet& rSet) +VclPtr<SfxTabPage> SmPrintOptionsTabPage::Create(TabPageParent pParent, const SfxItemSet& rSet) { - return VclPtr<SmPrintOptionsTabPage>::Create(pWindow, rSet).get(); + return VclPtr<SmPrintOptionsTabPage>::Create(pParent, rSet).get(); } void SmShowFont::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) diff --git a/starmath/source/smmod.cxx b/starmath/source/smmod.cxx index ba52877e6e21..3a4722da4b61 100644 --- a/starmath/source/smmod.cxx +++ b/starmath/source/smmod.cxx @@ -234,11 +234,11 @@ void SmModule::ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet ) } } -VclPtr<SfxTabPage> SmModule::CreateTabPage( sal_uInt16 nId, vcl::Window* pParent, const SfxItemSet& rSet ) +VclPtr<SfxTabPage> SmModule::CreateTabPage( sal_uInt16 nId, TabPageParent pParent, const SfxItemSet& rSet ) { VclPtr<SfxTabPage> pRet; if(nId == SID_SM_TP_PRINTOPTIONS) - pRet = SmPrintOptionsTabPage::Create( pParent, rSet ); + pRet = SmPrintOptionsTabPage::Create( TabPageParent(pParent.pParent), rSet ); return pRet; } diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx index d7a52d82caa3..819aaec2da13 100644 --- a/starmath/source/view.cxx +++ b/starmath/source/view.cxx @@ -1260,7 +1260,7 @@ bool SmViewShell::HasPrintOptionsPage() const return true; } -VclPtr<SfxTabPage> SmViewShell::CreatePrintOptionsPage(vcl::Window *pParent, +VclPtr<SfxTabPage> SmViewShell::CreatePrintOptionsPage(TabPageParent pParent, const SfxItemSet &rOptions) { return SmPrintOptionsTabPage::Create(pParent, rOptions); |