Kaydet (Commit) df230a23 authored tarafından Caolán McNamara's avatar Caolán McNamara

weld FmSearchDialog

Change-Id: If7e87f725ea44732080fc0c57e4503c82b0cf4a0
Reviewed-on: https://gerrit.libreoffice.org/67595
Tested-by: Jenkins
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst d88911d1
......@@ -217,7 +217,11 @@ short AbstractSvxPathSelectDialog_Impl::Execute()
}
IMPL_ABSTDLG_BASE(AbstractSvxHpLinkDlg_Impl);
IMPL_ABSTDLG_BASE(AbstractFmSearchDialog_Impl);
short AbstractFmSearchDialog_Impl::Execute()
{
return m_xDlg->run();
}
short AbstractGraphicFilterDialog_Impl::Execute()
{
......@@ -792,18 +796,19 @@ bool AbstractSvxHpLinkDlg_Impl::QueryClose()
return pDlg->QueryClose();
}
void AbstractFmSearchDialog_Impl::SetFoundHandler(const Link<FmFoundRecordInformation&,void>& lnk)
{
pDlg->SetFoundHandler(lnk);
m_xDlg->SetFoundHandler(lnk);
}
void AbstractFmSearchDialog_Impl::SetCanceledNotFoundHdl(const Link<FmFoundRecordInformation&,void>& lnk)
{
pDlg->SetCanceledNotFoundHdl(lnk);
m_xDlg->SetCanceledNotFoundHdl(lnk);
}
void AbstractFmSearchDialog_Impl::SetActiveField(const OUString& strField)
{
pDlg->SetActiveField(strField);
m_xDlg->SetActiveField(strField);
}
Graphic AbstractGraphicFilterDialog_Impl::GetFilteredGraphic(const Graphic& rGraphic, double fScaleX, double fScaleY)
......@@ -1247,15 +1252,15 @@ VclPtr<AbstractSvxHpLinkDlg> AbstractDialogFactory_Impl::CreateSvxHpLinkDlg (vcl
return VclPtr<AbstractSvxHpLinkDlg_Impl>::Create(pDlg);
}
VclPtr<AbstractFmSearchDialog> AbstractDialogFactory_Impl::CreateFmSearchDialog(vcl::Window* pParent,
VclPtr<AbstractFmSearchDialog> AbstractDialogFactory_Impl::CreateFmSearchDialog(weld::Window* pParent,
const OUString& strInitialText,
const std::vector< OUString >& _rContexts,
sal_Int16 nInitialContext,
const Link<FmSearchContext&,sal_uInt32>& lnkContextSupplier)
{
VclPtrInstance<FmSearchDialog> pDlg( pParent, strInitialText, _rContexts,
nInitialContext, lnkContextSupplier );
return VclPtr<AbstractFmSearchDialog_Impl>::Create( pDlg );
return VclPtr<AbstractFmSearchDialog_Impl>::Create(std::make_unique<FmSearchDialog>(pParent,
strInitialText, _rContexts, nInitialContext, lnkContextSupplier));
}
VclPtr<AbstractGraphicFilterDialog> AbstractDialogFactory_Impl::CreateGraphicFilterEmboss(weld::Window* pParent,
......
......@@ -506,7 +506,14 @@ class FmSearchDialog;
struct FmFoundRecordInformation;
class AbstractFmSearchDialog_Impl :public AbstractFmSearchDialog
{
DECL_ABSTDLG_BASE(AbstractFmSearchDialog_Impl,FmSearchDialog)
protected:
std::unique_ptr<FmSearchDialog> m_xDlg;
public:
explicit AbstractFmSearchDialog_Impl(std::unique_ptr<FmSearchDialog> p)
: m_xDlg(std::move(p))
{
}
virtual short Execute() override;
virtual void SetFoundHandler(const Link<FmFoundRecordInformation&,void>& lnk) override ;
virtual void SetCanceledNotFoundHdl(const Link<FmFoundRecordInformation&,void>& lnk) override;
virtual void SetActiveField(const OUString& strField) override;
......@@ -783,7 +790,7 @@ public:
virtual VclPtr<AbstractSvxMultiPathDialog> CreateSvxMultiPathDialog(weld::Window* pParent) override;
virtual VclPtr<AbstractSvxMultiPathDialog> CreateSvxPathSelectDialog(weld::Window* pParent) override;
virtual VclPtr<AbstractSvxHpLinkDlg> CreateSvxHpLinkDlg(vcl::Window* pParent, SfxBindings* pBindings) override;
virtual VclPtr<AbstractFmSearchDialog> CreateFmSearchDialog(vcl::Window* pParent,
virtual VclPtr<AbstractFmSearchDialog> CreateFmSearchDialog(weld::Window* pParent,
const OUString& strInitialText,
const std::vector< OUString >& _rContexts,
sal_Int16 nInitialContext,
......
......@@ -41,42 +41,13 @@ struct FmSearchProgress;
class FmSearchEngine;
/// Dialog for searching in Forms/Tables
class FmSearchDialog final : public ModalDialog
class FmSearchDialog final : public weld::GenericDialogController
{
friend class FmSearchEngine;
// my all Controls
VclPtr<RadioButton> m_prbSearchForText;
VclPtr<RadioButton> m_prbSearchForNull;
VclPtr<RadioButton> m_prbSearchForNotNull;
VclPtr<ComboBox> m_pcmbSearchText;
VclPtr<FixedText> m_pftForm;
VclPtr<ListBox> m_plbForm;
VclPtr<RadioButton> m_prbAllFields;
VclPtr<RadioButton> m_prbSingleField;
VclPtr<ListBox> m_plbField;
VclPtr<FixedText> m_pftPosition;
VclPtr<ListBox> m_plbPosition;
VclPtr<CheckBox> m_pcbUseFormat;
VclPtr<CheckBox> m_pcbCase;
VclPtr<CheckBox> m_pcbBackwards;
VclPtr<CheckBox> m_pcbStartOver;
VclPtr<CheckBox> m_pcbWildCard;
VclPtr<CheckBox> m_pcbRegular;
VclPtr<CheckBox> m_pcbApprox;
VclPtr<PushButton> m_ppbApproxSettings;
VclPtr<CheckBox> m_pHalfFullFormsCJK;
VclPtr<CheckBox> m_pSoundsLikeCJK;
VclPtr<PushButton> m_pSoundsLikeCJKSettings;
VclPtr<FixedText> m_pftRecord;
VclPtr<FixedText> m_pftHint;
VclPtr<PushButton> m_pbSearchAgain;
VclPtr<CancelButton> m_pbClose;
OUString m_sSearch;
OUString m_sCancel;
VclPtr<vcl::Window> m_pPreSearchFocus;
Link<FmFoundRecordInformation&,void> m_lnkFoundHandler; ///< Handler for "found"
Link<FmFoundRecordInformation&,void> m_lnkCanceledNotFoundHdl; ///< Handler for Positioning the Cursors
......@@ -87,10 +58,37 @@ class FmSearchDialog final : public ModalDialog
std::unique_ptr<FmSearchEngine> m_pSearchEngine;
Timer m_aDelayedPaint;
// see EnableSearchUI
std::unique_ptr<::svxform::FmSearchConfigItem> m_pConfig;
// my all Controls
std::unique_ptr<weld::RadioButton> m_prbSearchForText;
std::unique_ptr<weld::RadioButton> m_prbSearchForNull;
std::unique_ptr<weld::RadioButton> m_prbSearchForNotNull;
std::unique_ptr<weld::ComboBox> m_pcmbSearchText;
std::unique_ptr<weld::Label> m_pftForm;
std::unique_ptr<weld::ComboBox> m_plbForm;
std::unique_ptr<weld::RadioButton> m_prbAllFields;
std::unique_ptr<weld::RadioButton> m_prbSingleField;
std::unique_ptr<weld::ComboBox> m_plbField;
std::unique_ptr<weld::Label> m_pftPosition;
std::unique_ptr<weld::ComboBox> m_plbPosition;
std::unique_ptr<weld::CheckButton> m_pcbUseFormat;
std::unique_ptr<weld::CheckButton> m_pcbCase;
std::unique_ptr<weld::CheckButton> m_pcbBackwards;
std::unique_ptr<weld::CheckButton> m_pcbStartOver;
std::unique_ptr<weld::CheckButton> m_pcbWildCard;
std::unique_ptr<weld::CheckButton> m_pcbRegular;
std::unique_ptr<weld::CheckButton> m_pcbApprox;
std::unique_ptr<weld::Button> m_ppbApproxSettings;
std::unique_ptr<weld::CheckButton> m_pHalfFullFormsCJK;
std::unique_ptr<weld::CheckButton> m_pSoundsLikeCJK;
std::unique_ptr<weld::Button> m_pSoundsLikeCJKSettings;
std::unique_ptr<weld::Label> m_pftRecord;
std::unique_ptr<weld::Label> m_pftHint;
std::unique_ptr<weld::Button> m_pbSearchAgain;
std::unique_ptr<weld::Button> m_pbClose;
public:
/** This can search in different sets of fields. There is a number of contexts; their names are in strContexts (separated
by ';'), the user can choose one of them.
......@@ -106,11 +104,12 @@ public:
(of course needed : the string number i in strUsedFields of a context must correspond with the interface number i in the
arrFields of the context)
*/
FmSearchDialog(vcl::Window* pParent, const OUString& strInitialText, const std::vector< OUString >& _rContexts, sal_Int16 nInitialContext,
FmSearchDialog(weld::Window* pParent, const OUString& strInitialText, const std::vector< OUString >& _rContexts, sal_Int16 nInitialContext,
const Link<FmSearchContext&,sal_uInt32>& lnkContextSupplier);
virtual short run() override;
virtual ~FmSearchDialog() override;
virtual void dispose() override;
/** The found-handler gets in the 'found'-case a pointer on a FmFoundRecordInformation-structure
(which is only valid in the handler; so if one needs to memorize the data, don't copy the pointer but
......@@ -131,58 +130,47 @@ public:
inline void SetActiveField(const OUString& strField);
private:
virtual bool Close() override;
void Init(const OUString& strVisibleFields, const OUString& strInitialText);
// only to be used out of the constructors
void OnFound(const css::uno::Any& aCursorPos, sal_Int16 nFieldPos);
/** When searching in an own thread I naturally want to disable the UI for starting the search and for setting search
parameters. If bEnable == sal_False, for all affected controls painting is turned off and shortly after turned on
again using m_aDelayedPaint. If there is a demand with bEnable == sal_True inbetween, the timer is stopped and
painting is turned on immediately. As a consequence for this intricateness there is no flickering when turning
off and on quickly.
*/
void EnableSearchUI(bool bEnable);
void EnableSearchForDependees(bool bEnable);
void EnableControlPaint(bool bEnable);
void InitContext(sal_Int16 nContext);
void LoadParams();
void SaveParams() const;
// Handler for the Controls
DECL_LINK( OnClickedFieldRadios, Button*, void );
DECL_LINK(OnClickedSearchAgain, Button *, void);
DECL_LINK( OnClickedSpecialSettings, Button*, void );
DECL_LINK( OnClickedFieldRadios, weld::Button&, void );
DECL_LINK( OnClickedSearchAgain, weld::Button&, void );
DECL_LINK( OnClickedSpecialSettings, weld::Button&, void );
DECL_LINK(OnSearchTextModified, Edit&, void);
DECL_LINK( OnSearchTextModified, weld::ComboBox&, void );
DECL_LINK( OnPositionSelected, ListBox&, void );
DECL_LINK( OnFieldSelected, ListBox&, void );
DECL_LINK( OnPositionSelected, weld::ComboBox&, void );
DECL_LINK( OnFieldSelected, weld::ComboBox&, void );
DECL_LINK( OnFocusGrabbed, Control&, void );
DECL_LINK( OnCheckBoxToggled, CheckBox&, void );
DECL_LINK( OnFocusGrabbed, weld::Widget&, void );
DECL_LINK( OnCheckBoxToggled, weld::ToggleButton&, void );
DECL_LINK( OnContextSelection, ListBox&, void );
DECL_LINK( OnContextSelection, weld::ComboBox&, void );
DECL_LINK( OnSearchProgress, const FmSearchProgress*, void );
DECL_LINK( OnDelayedPaint, Timer*, void ); ///< see EnableSearchUI
void initCommon( const css::uno::Reference< css::sdbc::XResultSet >& _rxCursor );
};
inline void FmSearchDialog::SetActiveField(const OUString& strField)
{
sal_Int32 nInitialField = m_plbField->GetEntryPos(strField);
if (nInitialField == LISTBOX_ENTRY_NOTFOUND)
int nInitialField = m_plbField->find_text(strField);
if (nInitialField == -1)
nInitialField = 0;
m_plbField->SelectEntryPos(nInitialField);
LINK(this, FmSearchDialog, OnFieldSelected).Call(*m_plbField);
m_plbField->set_active(nInitialField);
OnFieldSelected(*m_plbField);
}
#endif // INCLUDED_CUI_SOURCE_INC_CUIFMSEARCH_HXX
......
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 -->
<!-- Generated with glade 3.22.1 -->
<interface domain="cui">
<requires lib="gtk+" version="3.18"/>
<object class="GtkDialog" id="RecordSearchDialog">
<property name="can_focus">False</property>
<property name="border_width">6</property>
<property name="title" translatable="yes" context="fmsearchdialog|RecordSearchDialog">Record Search</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>
<placeholder/>
</child>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox3">
<property name="can_focus">False</property>
......@@ -117,7 +123,7 @@
<property name="hexpand">True</property>
<property name="column_spacing">12</property>
<child>
<object class="GtkComboBox" id="cmbSearchText">
<object class="GtkComboBoxText" id="cmbSearchText">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="valign">start</property>
......@@ -125,7 +131,8 @@
<property name="has_entry">True</property>
<child internal-child="entry">
<object class="GtkEntry" id="combobox-entry2">
<property name="can_focus">False</property>
<property name="can_focus">True</property>
<property name="activates_default">True</property>
</object>
</child>
</object>
......@@ -279,7 +286,7 @@
</packing>
</child>
<child>
<object class="GtkComboBox" id="lbField">
<object class="GtkComboBoxText" id="lbField">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
......@@ -323,10 +330,10 @@
<object class="GtkLabel" id="ftForm">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes" context="fmsearchdialog|ftForm">Form:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">lbForm</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
......@@ -334,7 +341,7 @@
</packing>
</child>
<child>
<object class="GtkComboBox" id="lbForm">
<object class="GtkComboBoxText" id="lbForm">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
......@@ -375,8 +382,8 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="xalign">0</property>
<property name="wrap">True</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="expand">False</property>
......@@ -448,10 +455,10 @@
<object class="GtkLabel" id="ftPosition">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes" context="fmsearchdialog|ftPosition">_Position:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">lbPosition</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
......@@ -459,7 +466,7 @@
</packing>
</child>
<child>
<object class="GtkComboBox" id="lbPosition">
<object class="GtkComboBoxText" id="lbPosition">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
......@@ -719,8 +726,8 @@
<object class="GtkLabel" id="ftRecordLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes" context="fmsearchdialog|ftRecordLabel">Record:</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
......@@ -780,6 +787,7 @@
</object>
</child>
<action-widgets>
<action-widget response="-7">close</action-widget>
<action-widget response="-11">help</action-widget>
</action-widgets>
</object>
......
......@@ -1833,7 +1833,7 @@ void SbaXDataBrowserController::ExecuteSearch()
VclPtr<AbstractFmSearchDialog> pDialog;
std::vector< OUString > aContextNames;
aContextNames.emplace_back("Standard" );
pDialog = pFact->CreateFmSearchDialog(getBrowserView(), sInitialText, aContextNames, 0, LINK(this, SbaXDataBrowserController, OnSearchContextRequest));
pDialog = pFact->CreateFmSearchDialog(getFrameWeld(), sInitialText, aContextNames, 0, LINK(this, SbaXDataBrowserController, OnSearchContextRequest));
pDialog->SetActiveField( sActiveField );
pDialog->SetFoundHandler( LINK( this, SbaXDataBrowserController, OnFoundData ) );
pDialog->SetCanceledNotFoundHdl( LINK( this, SbaXDataBrowserController, OnCanceledNotFound ) );
......
......@@ -394,7 +394,7 @@ public:
virtual VclPtr<AbstractSvxMultiPathDialog> CreateSvxMultiPathDialog(weld::Window* pParent) = 0 ;
virtual VclPtr<AbstractSvxMultiPathDialog> CreateSvxPathSelectDialog(weld::Window* pParent) = 0 ;
virtual VclPtr<AbstractSvxHpLinkDlg> CreateSvxHpLinkDlg(vcl::Window* pParent, SfxBindings* pBindings)=0;
virtual VclPtr<AbstractFmSearchDialog> CreateFmSearchDialog(vcl::Window* pParent,
virtual VclPtr<AbstractFmSearchDialog> CreateFmSearchDialog(weld::Window* pParent,
const OUString& strInitialText,
const ::std::vector< OUString >& _rContexts,
sal_Int16 nInitialContext,
......
......@@ -1569,7 +1569,7 @@ void FmXFormShell::ExecuteSearch_Lock()
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
ScopedVclPtr<AbstractFmSearchDialog> pDialog(
pFact->CreateFmSearchDialog(
&m_pShell->GetViewShell()->GetViewFrame()->GetWindow(),
m_pShell->GetViewShell()->GetViewFrame()->GetWindow().GetFrameWeld(),
strInitialText, aContextNames, nInitialContext,
LINK(this, FmXFormShell, OnSearchContextRequest_Lock) ));
pDialog->SetActiveField( strActiveField );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment