summaryrefslogtreecommitdiff
path: root/cui
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-04-09 13:03:02 +0100
committerCaolán McNamara <caolanm@redhat.com>2018-04-09 21:48:09 +0200
commit40ca52ee802ea3992caa82f811eab124381bc121 (patch)
tree0c20f242b1900069b8af516013d57f99924b5fa4 /cui
parent54e13125860b124535c48e93b8001cd1aab25d8f (diff)
weld SvxSearchSimilarityDialog
Change-Id: Ifff02a6e9a9b8ce78b1e7d15f5f9a73ec2574872 Reviewed-on: https://gerrit.libreoffice.org/52631 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 'cui')
-rw-r--r--cui/source/dialogs/cuifmsearch.cxx2
-rw-r--r--cui/source/dialogs/srchxtra.cxx39
-rw-r--r--cui/source/factory/dlgfact.cxx20
-rw-r--r--cui/source/factory/dlgfact.hxx11
-rw-r--r--cui/source/inc/srchxtra.hxx31
-rw-r--r--cui/uiconfig/ui/similaritysearchdialog.ui30
6 files changed, 72 insertions, 61 deletions
diff --git a/cui/source/dialogs/cuifmsearch.cxx b/cui/source/dialogs/cuifmsearch.cxx
index 69a867b4f036..cbca9ae7fa3a 100644
--- a/cui/source/dialogs/cuifmsearch.cxx
+++ b/cui/source/dialogs/cuifmsearch.cxx
@@ -356,7 +356,7 @@ IMPL_LINK(FmSearchDialog, OnClickedSpecialSettings, Button*, pButton, void )
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
if (pFact)
{
- ScopedVclPtr<AbstractSvxSearchSimilarityDialog> pDlg(pFact->CreateSvxSearchSimilarityDialog( this, m_pSearchEngine->GetLevRelaxed(), m_pSearchEngine->GetLevOther(),
+ ScopedVclPtr<AbstractSvxSearchSimilarityDialog> pDlg(pFact->CreateSvxSearchSimilarityDialog(GetFrameWeld(), m_pSearchEngine->GetLevRelaxed(), m_pSearchEngine->GetLevOther(),
m_pSearchEngine->GetLevShorter(), m_pSearchEngine->GetLevLonger() ));
DBG_ASSERT( pDlg, "FmSearchDialog, OnClickedSpecialSettings: could not load the dialog!" );
if (pDlg && pDlg->Execute() == RET_OK)
diff --git a/cui/source/dialogs/srchxtra.cxx b/cui/source/dialogs/srchxtra.cxx
index 3e07eefc2847..beee5afea428 100644
--- a/cui/source/dialogs/srchxtra.cxx
+++ b/cui/source/dialogs/srchxtra.cxx
@@ -235,39 +235,22 @@ IMPL_LINK_NOARG(SvxSearchAttributeDialog, OKHdl, Button*, void)
// class SvxSearchSimilarityDialog ---------------------------------------
-SvxSearchSimilarityDialog::SvxSearchSimilarityDialog
-(
- vcl::Window* pParent,
- bool bRelax,
- sal_uInt16 nOther,
- sal_uInt16 nShorter,
- sal_uInt16 nLonger
-) :
- ModalDialog( pParent, "SimilaritySearchDialog", "cui/ui/similaritysearchdialog.ui" )
+SvxSearchSimilarityDialog::SvxSearchSimilarityDialog(weld::Window* pParent, bool bRelax,
+ sal_uInt16 nOther, sal_uInt16 nShorter, sal_uInt16 nLonger)
+ : GenericDialogController(pParent, "cui/ui/similaritysearchdialog.ui", "SimilaritySearchDialog")
+ , m_xOtherFld(m_xBuilder->weld_spin_button("otherfld"))
+ , m_xLongerFld(m_xBuilder->weld_spin_button("longerfld"))
+ , m_xShorterFld(m_xBuilder->weld_spin_button("shorterfld"))
+ , m_xRelaxBox(m_xBuilder->weld_check_button("relaxbox"))
{
- get( m_pOtherFld, "otherfld");
- get( m_pLongerFld, "longerfld");
- get( m_pShorterFld, "shorterfld");
- get( m_pRelaxBox, "relaxbox");
-
- m_pOtherFld->SetValue( nOther );
- m_pShorterFld->SetValue( nShorter );
- m_pLongerFld->SetValue( nLonger );
- m_pRelaxBox->Check( bRelax );
+ m_xOtherFld->set_value(nOther);
+ m_xShorterFld->set_value(nShorter);
+ m_xLongerFld->set_value(nLonger);
+ m_xRelaxBox->set_active(bRelax);
}
SvxSearchSimilarityDialog::~SvxSearchSimilarityDialog()
{
- disposeOnce();
-}
-
-void SvxSearchSimilarityDialog::dispose()
-{
- m_pOtherFld.clear();
- m_pLongerFld.clear();
- m_pShorterFld.clear();
- m_pRelaxBox.clear();
- ModalDialog::dispose();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx
index 091c920b9c5a..2002a4339183 100644
--- a/cui/source/factory/dlgfact.cxx
+++ b/cui/source/factory/dlgfact.cxx
@@ -113,7 +113,12 @@ IMPL_ABSTDLG_BASE(AbstractTitleDialog_Impl);
IMPL_ABSTDLG_BASE(AbstractScriptSelectorDialog_Impl);
IMPL_ABSTDLG_BASE(AbstractGalleryIdDialog_Impl);
IMPL_ABSTDLG_BASE(AbstractURLDlg_Impl);
-IMPL_ABSTDLG_BASE(AbstractSvxSearchSimilarityDialog_Impl);
+
+short AbstractSvxSearchSimilarityDialog_Impl::Execute()
+{
+ return m_xDlg->run();
+}
+
IMPL_ABSTDLG_BASE(AbstractSvxTransformTabDialog_Impl);
IMPL_ABSTDLG_BASE(AbstractSvxCaptionDialog_Impl);
IMPL_ABSTDLG_BASE(AbstractSvxJSearchOptionsDialog_Impl);
@@ -498,22 +503,22 @@ OUString AbstractURLDlg_Impl::GetName() const
sal_uInt16 AbstractSvxSearchSimilarityDialog_Impl::GetOther()
{
- return pDlg->GetOther();
+ return m_xDlg->GetOther();
}
sal_uInt16 AbstractSvxSearchSimilarityDialog_Impl::GetShorter()
{
- return pDlg->GetShorter();
+ return m_xDlg->GetShorter();
}
sal_uInt16 AbstractSvxSearchSimilarityDialog_Impl::GetLonger()
{
- return pDlg->GetLonger();
+ return m_xDlg->GetLonger();
}
bool AbstractSvxSearchSimilarityDialog_Impl::IsRelaxed()
{
- return pDlg->IsRelaxed();
+ return m_xDlg->IsRelaxed();
}
// AbstractSvxTransformTabDialog implementations just forwards everything to the dialog
@@ -1074,14 +1079,13 @@ VclPtr<VclAbstractDialog> AbstractDialogFactory_Impl::CreateSvxSearchAttributeDi
return VclPtr<CuiVclAbstractDialog_Impl>::Create( pDlg );
}
-VclPtr<AbstractSvxSearchSimilarityDialog> AbstractDialogFactory_Impl::CreateSvxSearchSimilarityDialog( vcl::Window* pParent,
+VclPtr<AbstractSvxSearchSimilarityDialog> AbstractDialogFactory_Impl::CreateSvxSearchSimilarityDialog(weld::Window* pParent,
bool bRelax,
sal_uInt16 nOther,
sal_uInt16 nShorter,
sal_uInt16 nLonger)
{
- VclPtrInstance<SvxSearchSimilarityDialog> pDlg( pParent, bRelax, nOther, nShorter, nLonger );
- return VclPtr<AbstractSvxSearchSimilarityDialog_Impl>::Create( pDlg );
+ return VclPtr<AbstractSvxSearchSimilarityDialog_Impl>::Create(new SvxSearchSimilarityDialog(pParent, bRelax, nOther, nShorter, nLonger));
}
VclPtr<SfxAbstractTabDialog> AbstractDialogFactory_Impl::CreateSvxBorderBackgroundDlg(
diff --git a/cui/source/factory/dlgfact.hxx b/cui/source/factory/dlgfact.hxx
index e9ea89b340e3..731b37a27530 100644
--- a/cui/source/factory/dlgfact.hxx
+++ b/cui/source/factory/dlgfact.hxx
@@ -251,7 +251,14 @@ class AbstractURLDlg_Impl :public AbstractURLDlg
class SvxSearchSimilarityDialog;
class AbstractSvxSearchSimilarityDialog_Impl :public AbstractSvxSearchSimilarityDialog
{
- DECL_ABSTDLG_BASE(AbstractSvxSearchSimilarityDialog_Impl,SvxSearchSimilarityDialog)
+protected:
+ std::unique_ptr<SvxSearchSimilarityDialog> m_xDlg;
+public:
+ explicit AbstractSvxSearchSimilarityDialog_Impl(SvxSearchSimilarityDialog* p)
+ : m_xDlg(p)
+ {
+ }
+ virtual short Execute() override;
virtual sal_uInt16 GetOther() override;
virtual sal_uInt16 GetShorter() override;
virtual sal_uInt16 GetLonger() override;
@@ -618,7 +625,7 @@ public:
virtual VclPtr<VclAbstractDialog> CreateSvxSearchAttributeDialog( vcl::Window* pParent,
SearchAttrItemList& rLst,
const sal_uInt16* pWhRanges) override;
- virtual VclPtr<AbstractSvxSearchSimilarityDialog> CreateSvxSearchSimilarityDialog( vcl::Window* pParent,
+ virtual VclPtr<AbstractSvxSearchSimilarityDialog> CreateSvxSearchSimilarityDialog( weld::Window* pParent,
bool bRelax,
sal_uInt16 nOther,
sal_uInt16 nShorter,
diff --git a/cui/source/inc/srchxtra.hxx b/cui/source/inc/srchxtra.hxx
index 1c0656f6574b..0e8442d39c71 100644
--- a/cui/source/inc/srchxtra.hxx
+++ b/cui/source/inc/srchxtra.hxx
@@ -20,6 +20,7 @@
#define INCLUDED_CUI_SOURCE_INC_SRCHXTRA_HXX
#include <vcl/field.hxx>
+#include <vcl/weld.hxx>
#include <svtools/ctrltool.hxx>
#include <sfx2/tabdlg.hxx>
@@ -65,30 +66,28 @@ private:
// class SvxSearchSimilarityDialog ---------------------------------------
-class SvxSearchSimilarityDialog : public ModalDialog
+class SvxSearchSimilarityDialog : public weld::GenericDialogController
{
private:
- VclPtr<NumericField> m_pOtherFld;
- VclPtr<NumericField> m_pLongerFld;
- VclPtr<NumericField> m_pShorterFld;
- VclPtr<CheckBox> m_pRelaxBox;
+ std::unique_ptr<weld::SpinButton> m_xOtherFld;
+ std::unique_ptr<weld::SpinButton> m_xLongerFld;
+ std::unique_ptr<weld::SpinButton> m_xShorterFld;
+ std::unique_ptr<weld::CheckButton> m_xRelaxBox;
public:
- SvxSearchSimilarityDialog( vcl::Window* pParent,
- bool bRelax,
- sal_uInt16 nOther,
- sal_uInt16 nShorter,
- sal_uInt16 nLonger );
+ SvxSearchSimilarityDialog(weld::Window* pParent,
+ bool bRelax,
+ sal_uInt16 nOther,
+ sal_uInt16 nShorter,
+ sal_uInt16 nLonger);
virtual ~SvxSearchSimilarityDialog() override;
- virtual void dispose() override;
- sal_uInt16 GetOther() { return static_cast<sal_uInt16>(m_pOtherFld->GetValue()); }
- sal_uInt16 GetShorter() { return static_cast<sal_uInt16>(m_pShorterFld->GetValue()); }
- sal_uInt16 GetLonger() { return static_cast<sal_uInt16>(m_pLongerFld->GetValue()); }
- bool IsRelaxed() { return m_pRelaxBox->IsChecked(); }
+ sal_uInt16 GetOther() { return static_cast<sal_uInt16>(m_xOtherFld->get_value()); }
+ sal_uInt16 GetShorter() { return static_cast<sal_uInt16>(m_xShorterFld->get_value()); }
+ sal_uInt16 GetLonger() { return static_cast<sal_uInt16>(m_xLongerFld->get_value()); }
+ bool IsRelaxed() { return m_xRelaxBox->get_active(); }
};
-
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/uiconfig/ui/similaritysearchdialog.ui b/cui/uiconfig/ui/similaritysearchdialog.ui
index 883c1ffb454b..12bfab037b6b 100644
--- a/cui/uiconfig/ui/similaritysearchdialog.ui
+++ b/cui/uiconfig/ui/similaritysearchdialog.ui
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.18.3 -->
+<!-- Generated with glade 3.20.4 -->
<interface domain="cui">
<requires lib="gtk+" version="3.18"/>
<object class="GtkAdjustment" id="adjustment1">
@@ -8,11 +8,26 @@
<property name="step_increment">1</property>
<property name="page_increment">10</property>
</object>
+ <object class="GtkAdjustment" id="adjustment2">
+ <property name="upper">30</property>
+ <property name="value">1</property>
+ <property name="step_increment">1</property>
+ <property name="page_increment">10</property>
+ </object>
+ <object class="GtkAdjustment" id="adjustment3">
+ <property name="upper">30</property>
+ <property name="value">1</property>
+ <property name="step_increment">1</property>
+ <property name="page_increment">10</property>
+ </object>
<object class="GtkDialog" id="SimilaritySearchDialog">
<property name="can_focus">False</property>
<property name="border_width">6</property>
<property name="title" translatable="yes" context="similaritysearchdialog|SimilaritySearchDialog">Similarity Search</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">
@@ -91,10 +106,10 @@
<object class="GtkLabel" id="label2">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="xalign">1</property>
<property name="label" translatable="yes" context="similaritysearchdialog|label2">_Exchange characters:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">otherfld</property>
+ <property name="xalign">1</property>
</object>
<packing>
<property name="left_attach">0</property>
@@ -105,10 +120,10 @@
<object class="GtkLabel" id="label3">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="xalign">1</property>
<property name="label" translatable="yes" context="similaritysearchdialog|label3">_Add characters:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">longerfld</property>
+ <property name="xalign">1</property>
</object>
<packing>
<property name="left_attach">0</property>
@@ -119,10 +134,10 @@
<object class="GtkLabel" id="label4">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="xalign">1</property>
<property name="label" translatable="yes" context="similaritysearchdialog|label4">_Remove characters:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">shorterfld</property>
+ <property name="xalign">1</property>
</object>
<packing>
<property name="left_attach">0</property>
@@ -160,7 +175,7 @@
<object class="GtkSpinButton" id="longerfld">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="adjustment">adjustment1</property>
+ <property name="adjustment">adjustment2</property>
</object>
<packing>
<property name="left_attach">1</property>
@@ -171,7 +186,7 @@
<object class="GtkSpinButton" id="shorterfld">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="adjustment">adjustment1</property>
+ <property name="adjustment">adjustment3</property>
</object>
<packing>
<property name="left_attach">1</property>
@@ -192,5 +207,8 @@
<action-widget response="-6">cancel</action-widget>
<action-widget response="-11">help</action-widget>
</action-widgets>
+ <child>
+ <placeholder/>
+ </child>
</object>
</interface>