summaryrefslogtreecommitdiff
path: root/starmath
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-04-09 15:04:02 +0100
committerCaolán McNamara <caolanm@redhat.com>2018-04-10 09:51:50 +0200
commitccbaaa04417eac83f9f521e034a3e62821e4b7f3 (patch)
tree444eb8925146632f9878c86f80da4424fc088e5f /starmath
parent342a5d13dfcca37a68cb996650e1ada868c5ce3e (diff)
weld SmFontSizeDialog
and give it a parent via SfxRequest::GetFrameWeld Change-Id: I126c300ce4b3f477fd927efbcc83b1a6d315f594 Reviewed-on: https://gerrit.libreoffice.org/52637 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')
-rw-r--r--starmath/inc/dialog.hxx21
-rw-r--r--starmath/source/dialog.cxx66
-rw-r--r--starmath/source/document.cxx8
-rw-r--r--starmath/uiconfig/smath/ui/fontsizedialog.ui74
4 files changed, 93 insertions, 76 deletions
diff --git a/starmath/inc/dialog.hxx b/starmath/inc/dialog.hxx
index d4452b86a427..bc0701421d43 100644
--- a/starmath/inc/dialog.hxx
+++ b/starmath/inc/dialog.hxx
@@ -123,22 +123,21 @@ public:
/**************************************************************************/
-class SmFontSizeDialog : public ModalDialog
+class SmFontSizeDialog : public weld::GenericDialogController
{
- VclPtr<MetricField> m_pBaseSize;
- VclPtr<MetricField> m_pTextSize;
- VclPtr<MetricField> m_pIndexSize;
- VclPtr<MetricField> m_pFunctionSize;
- VclPtr<MetricField> m_pOperatorSize;
- VclPtr<MetricField> m_pBorderSize;
- VclPtr<PushButton> m_pDefaultButton;
+ std::unique_ptr<weld::MetricSpinButton> m_xBaseSize;
+ std::unique_ptr<weld::MetricSpinButton> m_xTextSize;
+ std::unique_ptr<weld::MetricSpinButton> m_xIndexSize;
+ std::unique_ptr<weld::MetricSpinButton> m_xFunctionSize;
+ std::unique_ptr<weld::MetricSpinButton> m_xOperatorSize;
+ std::unique_ptr<weld::MetricSpinButton> m_xBorderSize;
+ std::unique_ptr<weld::Button> m_xDefaultButton;
- DECL_LINK(DefaultButtonClickHdl, Button *, void);
+ DECL_LINK(DefaultButtonClickHdl, weld::Button&, void);
public:
- SmFontSizeDialog(vcl::Window *pParent);
+ SmFontSizeDialog(weld::Window *pParent);
virtual ~SmFontSizeDialog() override;
- virtual void dispose() override;
void ReadFrom(const SmFormat &rFormat);
void WriteTo (SmFormat &rFormat) const;
diff --git a/starmath/source/dialog.cxx b/starmath/source/dialog.cxx
index ad70b04e3402..e8afccc2586d 100644
--- a/starmath/source/dialog.cxx
+++ b/starmath/source/dialog.cxx
@@ -404,9 +404,9 @@ public:
}
};
-IMPL_LINK_NOARG( SmFontSizeDialog, DefaultButtonClickHdl, Button *, void )
+IMPL_LINK_NOARG( SmFontSizeDialog, DefaultButtonClickHdl, weld::Button&, void )
{
- SaveDefaultsQuery aQuery(GetFrameWeld());
+ SaveDefaultsQuery aQuery(m_xDialog.get());
if (aQuery.run() == RET_YES)
{
SmModule *pp = SM_MOD();
@@ -416,61 +416,45 @@ IMPL_LINK_NOARG( SmFontSizeDialog, DefaultButtonClickHdl, Button *, void )
}
}
-SmFontSizeDialog::SmFontSizeDialog(vcl::Window * pParent)
- : ModalDialog(pParent, "FontSizeDialog", "modules/smath/ui/fontsizedialog.ui")
+SmFontSizeDialog::SmFontSizeDialog(weld::Window* pParent)
+ : GenericDialogController(pParent, "modules/smath/ui/fontsizedialog.ui", "FontSizeDialog")
+ , m_xBaseSize(m_xBuilder->weld_metric_spin_button("spinB_baseSize", FUNIT_POINT))
+ , m_xTextSize(m_xBuilder->weld_metric_spin_button("spinB_text", FUNIT_PERCENT))
+ , m_xIndexSize(m_xBuilder->weld_metric_spin_button("spinB_index", FUNIT_PERCENT))
+ , m_xFunctionSize(m_xBuilder->weld_metric_spin_button("spinB_function", FUNIT_PERCENT))
+ , m_xOperatorSize(m_xBuilder->weld_metric_spin_button("spinB_operator", FUNIT_PERCENT))
+ , m_xBorderSize(m_xBuilder->weld_metric_spin_button("spinB_limit", FUNIT_PERCENT))
+ , m_xDefaultButton(m_xBuilder->weld_button("default"))
{
- get(m_pTextSize, "spinB_text");
- get(m_pIndexSize, "spinB_index");
- get(m_pFunctionSize, "spinB_function");
- get(m_pOperatorSize, "spinB_operator");
- get(m_pBorderSize, "spinB_limit");
- get(m_pBaseSize, "spinB_baseSize");
- get(m_pDefaultButton, "default");
-
- m_pDefaultButton->SetClickHdl(LINK(this, SmFontSizeDialog, DefaultButtonClickHdl));
+ m_xDefaultButton->connect_clicked(LINK(this, SmFontSizeDialog, DefaultButtonClickHdl));
}
SmFontSizeDialog::~SmFontSizeDialog()
{
- disposeOnce();
}
-void SmFontSizeDialog::dispose()
-{
- m_pBaseSize.clear();
- m_pTextSize.clear();
- m_pIndexSize.clear();
- m_pFunctionSize.clear();
- m_pOperatorSize.clear();
- m_pBorderSize.clear();
- m_pDefaultButton.clear();
- ModalDialog::dispose();
-}
-
-
void SmFontSizeDialog::ReadFrom(const SmFormat &rFormat)
{
//! watch out: round properly!
- m_pBaseSize->SetValue( SmRoundFraction(
- Sm100th_mmToPts( rFormat.GetBaseSize().Height() ) ) );
+ m_xBaseSize->set_value( SmRoundFraction(
+ Sm100th_mmToPts( rFormat.GetBaseSize().Height() ) ), FUNIT_NONE );
- m_pTextSize->SetValue( rFormat.GetRelSize(SIZ_TEXT) );
- m_pIndexSize->SetValue( rFormat.GetRelSize(SIZ_INDEX) );
- m_pFunctionSize->SetValue( rFormat.GetRelSize(SIZ_FUNCTION) );
- m_pOperatorSize->SetValue( rFormat.GetRelSize(SIZ_OPERATOR) );
- m_pBorderSize->SetValue( rFormat.GetRelSize(SIZ_LIMITS) );
+ m_xTextSize->set_value( rFormat.GetRelSize(SIZ_TEXT), FUNIT_NONE );
+ m_xIndexSize->set_value( rFormat.GetRelSize(SIZ_INDEX), FUNIT_NONE );
+ m_xFunctionSize->set_value( rFormat.GetRelSize(SIZ_FUNCTION), FUNIT_NONE );
+ m_xOperatorSize->set_value( rFormat.GetRelSize(SIZ_OPERATOR), FUNIT_NONE );
+ m_xBorderSize->set_value( rFormat.GetRelSize(SIZ_LIMITS), FUNIT_NONE );
}
-
void SmFontSizeDialog::WriteTo(SmFormat &rFormat) const
{
- rFormat.SetBaseSize( Size(0, SmPtsTo100th_mm( static_cast< long >(m_pBaseSize->GetValue()))) );
+ rFormat.SetBaseSize( Size(0, SmPtsTo100th_mm( static_cast< long >(m_xBaseSize->get_value(FUNIT_NONE)))) );
- rFormat.SetRelSize(SIZ_TEXT, sal::static_int_cast<sal_uInt16>(m_pTextSize->GetValue()));
- rFormat.SetRelSize(SIZ_INDEX, sal::static_int_cast<sal_uInt16>(m_pIndexSize->GetValue()));
- rFormat.SetRelSize(SIZ_FUNCTION, sal::static_int_cast<sal_uInt16>(m_pFunctionSize->GetValue()));
- rFormat.SetRelSize(SIZ_OPERATOR, sal::static_int_cast<sal_uInt16>(m_pOperatorSize->GetValue()));
- rFormat.SetRelSize(SIZ_LIMITS, sal::static_int_cast<sal_uInt16>(m_pBorderSize->GetValue()));
+ rFormat.SetRelSize(SIZ_TEXT, sal::static_int_cast<sal_uInt16>(m_xTextSize->get_value(FUNIT_NONE)));
+ rFormat.SetRelSize(SIZ_INDEX, sal::static_int_cast<sal_uInt16>(m_xIndexSize->get_value(FUNIT_NONE)));
+ rFormat.SetRelSize(SIZ_FUNCTION, sal::static_int_cast<sal_uInt16>(m_xFunctionSize->get_value(FUNIT_NONE)));
+ rFormat.SetRelSize(SIZ_OPERATOR, sal::static_int_cast<sal_uInt16>(m_xOperatorSize->get_value(FUNIT_NONE)));
+ rFormat.SetRelSize(SIZ_LIMITS, sal::static_int_cast<sal_uInt16>(m_xBorderSize->get_value(FUNIT_NONE)));
const Size aTmp (rFormat.GetBaseSize());
for (sal_uInt16 i = FNT_BEGIN; i <= FNT_END; i++)
diff --git a/starmath/source/document.cxx b/starmath/source/document.cxx
index c4a312888d0b..9eac89d5f474 100644
--- a/starmath/source/document.cxx
+++ b/starmath/source/document.cxx
@@ -950,15 +950,15 @@ void SmDocShell::Execute(SfxRequest& rReq)
case SID_FONTSIZE:
{
- VclPtrInstance< SmFontSizeDialog > xFontSizeDialog(nullptr);
+ SmFontSizeDialog aFontSizeDialog(rReq.GetFrameWeld());
SmFormat aOldFormat = GetFormat();
- xFontSizeDialog->ReadFrom( aOldFormat );
- if (xFontSizeDialog->Execute() == RET_OK)
+ aFontSizeDialog.ReadFrom( aOldFormat );
+ if (aFontSizeDialog.run() == RET_OK)
{
SmFormat aNewFormat( aOldFormat );
- xFontSizeDialog->WriteTo(aNewFormat);
+ aFontSizeDialog.WriteTo(aNewFormat);
::svl::IUndoManager *pTmpUndoMgr = GetUndoManager();
if (pTmpUndoMgr)
diff --git a/starmath/uiconfig/smath/ui/fontsizedialog.ui b/starmath/uiconfig/smath/ui/fontsizedialog.ui
index 3eaa2236f5c5..68c90e15d8fb 100644
--- a/starmath/uiconfig/smath/ui/fontsizedialog.ui
+++ b/starmath/uiconfig/smath/ui/fontsizedialog.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="sm">
<requires lib="gtk+" version="3.18"/>
<object class="GtkAdjustment" id="adjustmentBaseSize">
@@ -8,7 +8,31 @@
<property name="step_increment">1</property>
<property name="page_increment">10</property>
</object>
- <object class="GtkAdjustment" id="adjustmentRelativeSizes">
+ <object class="GtkAdjustment" id="adjustmentRelativeSizes1">
+ <property name="lower">5</property>
+ <property name="upper">200</property>
+ <property name="step_increment">1</property>
+ <property name="page_increment">10</property>
+ </object>
+ <object class="GtkAdjustment" id="adjustmentRelativeSizes2">
+ <property name="lower">5</property>
+ <property name="upper">200</property>
+ <property name="step_increment">1</property>
+ <property name="page_increment">10</property>
+ </object>
+ <object class="GtkAdjustment" id="adjustmentRelativeSizes3">
+ <property name="lower">5</property>
+ <property name="upper">200</property>
+ <property name="step_increment">1</property>
+ <property name="page_increment">10</property>
+ </object>
+ <object class="GtkAdjustment" id="adjustmentRelativeSizes4">
+ <property name="lower">5</property>
+ <property name="upper">200</property>
+ <property name="step_increment">1</property>
+ <property name="page_increment">10</property>
+ </object>
+ <object class="GtkAdjustment" id="adjustmentRelativeSizes5">
<property name="lower">5</property>
<property name="upper">200</property>
<property name="step_increment">1</property>
@@ -20,6 +44,8 @@
<property name="title" translatable="yes" context="fontsizedialog|FontSizeDialog">Font Sizes</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-vbox4">
@@ -121,7 +147,7 @@
<property name="can_focus">False</property>
<property name="label" translatable="yes" context="fontsizedialog|label4">Base _size:</property>
<property name="use_underline">True</property>
- <property name="mnemonic_widget">spinB_baseSize:0pt</property>
+ <property name="mnemonic_widget">spinB_baseSize</property>
<property name="xalign">0</property>
</object>
<packing>
@@ -131,10 +157,11 @@
</packing>
</child>
<child>
- <object class="GtkSpinButton" id="spinB_baseSize:0pt">
+ <object class="GtkSpinButton" id="spinB_baseSize">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
+ <property name="activates_default">True</property>
<property name="adjustment">adjustmentBaseSize</property>
</object>
<packing>
@@ -174,11 +201,12 @@
<property name="row_spacing">6</property>
<property name="column_spacing">12</property>
<child>
- <object class="GtkSpinButton" id="spinB_function:0%">
+ <object class="GtkSpinButton" id="spinB_function">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
- <property name="adjustment">adjustmentRelativeSizes</property>
+ <property name="activates_default">True</property>
+ <property name="adjustment">adjustmentRelativeSizes1</property>
</object>
<packing>
<property name="left_attach">1</property>
@@ -191,7 +219,7 @@
<property name="can_focus">False</property>
<property name="label" translatable="yes" context="fontsizedialog|label2">_Operators:</property>
<property name="use_underline">True</property>
- <property name="mnemonic_widget">spinB_function:0%</property>
+ <property name="mnemonic_widget">spinB_function</property>
<property name="xalign">0</property>
</object>
<packing>
@@ -205,7 +233,7 @@
<property name="can_focus">False</property>
<property name="label" translatable="yes" context="fontsizedialog|label3">_Limits:</property>
<property name="use_underline">True</property>
- <property name="mnemonic_widget">spinB_limit:0%</property>
+ <property name="mnemonic_widget">spinB_limit</property>
<property name="xalign">0</property>
</object>
<packing>
@@ -214,11 +242,12 @@
</packing>
</child>
<child>
- <object class="GtkSpinButton" id="spinB_operator:0%">
+ <object class="GtkSpinButton" id="spinB_operator">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
- <property name="adjustment">adjustmentRelativeSizes</property>
+ <property name="activates_default">True</property>
+ <property name="adjustment">adjustmentRelativeSizes2</property>
</object>
<packing>
<property name="left_attach">1</property>
@@ -226,11 +255,12 @@
</packing>
</child>
<child>
- <object class="GtkSpinButton" id="spinB_limit:0%">
+ <object class="GtkSpinButton" id="spinB_limit">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
- <property name="adjustment">adjustmentRelativeSizes</property>
+ <property name="activates_default">True</property>
+ <property name="adjustment">adjustmentRelativeSizes3</property>
</object>
<packing>
<property name="left_attach">1</property>
@@ -243,7 +273,7 @@
<property name="can_focus">False</property>
<property name="label" translatable="yes" context="fontsizedialog|label5">_Text:</property>
<property name="use_underline">True</property>
- <property name="mnemonic_widget">spinB_text:0%</property>
+ <property name="mnemonic_widget">spinB_text</property>
<property name="xalign">0</property>
</object>
<packing>
@@ -257,7 +287,7 @@
<property name="can_focus">False</property>
<property name="label" translatable="yes" context="fontsizedialog|label7">_Functions:</property>
<property name="use_underline">True</property>
- <property name="mnemonic_widget">spinB_function:0%</property>
+ <property name="mnemonic_widget">spinB_function</property>
<property name="xalign">0</property>
</object>
<packing>
@@ -271,7 +301,7 @@
<property name="can_focus">False</property>
<property name="label" translatable="yes" context="fontsizedialog|label6">_Indexes:</property>
<property name="use_underline">True</property>
- <property name="mnemonic_widget">spinB_index:0%</property>
+ <property name="mnemonic_widget">spinB_index</property>
<property name="xalign">0</property>
</object>
<packing>
@@ -280,11 +310,12 @@
</packing>
</child>
<child>
- <object class="GtkSpinButton" id="spinB_text:0%">
+ <object class="GtkSpinButton" id="spinB_text">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
- <property name="adjustment">adjustmentRelativeSizes</property>
+ <property name="activates_default">True</property>
+ <property name="adjustment">adjustmentRelativeSizes4</property>
</object>
<packing>
<property name="left_attach">1</property>
@@ -292,11 +323,12 @@
</packing>
</child>
<child>
- <object class="GtkSpinButton" id="spinB_index:0%">
+ <object class="GtkSpinButton" id="spinB_index">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
- <property name="adjustment">adjustmentRelativeSizes</property>
+ <property name="activates_default">True</property>
+ <property name="adjustment">adjustmentRelativeSizes5</property>
</object>
<packing>
<property name="left_attach">1</property>
@@ -334,7 +366,9 @@
</object>
</child>
<action-widgets>
- <action-widget response="0">default</action-widget>
+ <action-widget response="-5">ok</action-widget>
+ <action-widget response="-6">cancel</action-widget>
+ <action-widget response="-11">help</action-widget>
</action-widgets>
<child>
<placeholder/>