[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - include/svtools svtools/source svx/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Mon Aug 24 10:16:15 UTC 2020
include/svtools/editbrowsebox.hxx | 27 +++++++++++++++++++++++++--
svtools/source/brwbox/ebbcontrols.cxx | 10 ++++++++--
svx/source/fmcomp/gridcell.cxx | 23 ++++++++++++++---------
svx/source/inc/gridcell.hxx | 7 +++----
4 files changed, 50 insertions(+), 17 deletions(-)
New commits:
commit 4771535e40feb6ec7f15e160e00592b2f253f3a5
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Aug 14 14:41:35 2020 +0100
Commit: Michael Stahl <michael.stahl at cib.de>
CommitDate: Mon Aug 24 12:15:43 2020 +0200
tdf#135550 make XListBox Item status changed event work again
Change-Id: I9a5fe6a097c5d06e3ac3ab6c4c77cbe082d1a17d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100747
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl at cib.de>
diff --git a/include/svtools/editbrowsebox.hxx b/include/svtools/editbrowsebox.hxx
index 61deadfdd4fa..ebd968d254ad 100644
--- a/include/svtools/editbrowsebox.hxx
+++ b/include/svtools/editbrowsebox.hxx
@@ -375,6 +375,11 @@ namespace svt
//= ListBoxControl
class SVT_DLLPUBLIC ListBoxControl final : public InterimItemWindow
{
+ private:
+ std::unique_ptr<weld::ComboBox> m_xWidget;
+ Link<LinkParamNone*,void> m_aModify1Hdl;
+ Link<LinkParamNone*,void> m_aModify2Hdl;
+
friend class ListBoxCellController;
public:
@@ -382,9 +387,27 @@ namespace svt
weld::ComboBox& get_widget() { return *m_xWidget; }
+ // sets a link to call when the selection is changed by the user
+ void SetModifyHdl(const Link<LinkParamNone*,void>& rHdl)
+ {
+ m_aModify1Hdl = rHdl;
+ }
+
+ // sets an additional link to call when the selection is changed by the user
+ void SetAuxModifyHdl(const Link<LinkParamNone*,void>& rLink)
+ {
+ m_aModify2Hdl = rLink;
+ }
+
virtual void dispose() override;
private:
- std::unique_ptr<weld::ComboBox> m_xWidget;
+ DECL_LINK(SelectHdl, weld::ComboBox&, void);
+
+ void CallModifyHdls()
+ {
+ m_aModify1Hdl.Call(nullptr);
+ m_aModify2Hdl.Call(nullptr);
+ }
};
//= ListBoxCellController
@@ -401,7 +424,7 @@ namespace svt
protected:
virtual bool MoveAllowed(const KeyEvent& rEvt) const override;
private:
- DECL_LINK(ListBoxSelectHdl, weld::ComboBox&, void);
+ DECL_LINK(ListBoxSelectHdl, LinkParamNone*, void);
};
//= FormattedFieldCellController
diff --git a/svtools/source/brwbox/ebbcontrols.cxx b/svtools/source/brwbox/ebbcontrols.cxx
index 4d4fc8ea72cf..1e0272aeeea9 100644
--- a/svtools/source/brwbox/ebbcontrols.cxx
+++ b/svtools/source/brwbox/ebbcontrols.cxx
@@ -115,6 +115,7 @@ namespace svt
, m_xWidget(m_xBuilder->weld_combo_box("listbox"))
{
m_xWidget->set_size_request(42, -1); // so a later narrow size request can stick
+ m_xWidget->connect_changed(LINK(this, ListBoxControl, SelectHdl));
}
void ListBoxControl::dispose()
@@ -123,11 +124,16 @@ namespace svt
InterimItemWindow::dispose();
}
+ IMPL_LINK_NOARG(ListBoxControl, SelectHdl, weld::ComboBox&, void)
+ {
+ CallModifyHdls();
+ }
+
//= ListBoxCellController
ListBoxCellController::ListBoxCellController(ListBoxControl* pWin)
:CellController(pWin)
{
- GetListBox().connect_changed(LINK(this, ListBoxCellController, ListBoxSelectHdl));
+ static_cast<ListBoxControl&>(GetWindow()).SetModifyHdl(LINK(this, ListBoxCellController, ListBoxSelectHdl));
}
bool ListBoxCellController::MoveAllowed(const KeyEvent& rEvt) const
@@ -165,7 +171,7 @@ namespace svt
GetListBox().save_value();
}
- IMPL_LINK_NOARG(ListBoxCellController, ListBoxSelectHdl, weld::ComboBox&, void)
+ IMPL_LINK_NOARG(ListBoxCellController, ListBoxSelectHdl, LinkParamNone*, void)
{
callModifyHdl();
}
diff --git a/svx/source/fmcomp/gridcell.cxx b/svx/source/fmcomp/gridcell.cxx
index 8811f7ce29e1..b84805165c9e 100644
--- a/svx/source/fmcomp/gridcell.cxx
+++ b/svx/source/fmcomp/gridcell.cxx
@@ -3967,9 +3967,9 @@ FmXListBoxCell::FmXListBoxCell(DbGridColumn* pColumn, std::unique_ptr<DbCellCont
: FmXTextCell(pColumn, std::move(pControl))
, m_aItemListeners(m_aMutex)
, m_aActionListeners(m_aMutex)
- , m_pBox(&static_cast<svt::ListBoxControl&>(m_pCellControl->GetWindow()).get_widget())
+ , m_pBox(&static_cast<svt::ListBoxControl&>(m_pCellControl->GetWindow()))
{
- m_pBox->connect_changed(LINK(this, FmXListBoxCell, ChangedHdl));
+ m_pBox->SetAuxModifyHdl(LINK(this, FmXListBoxCell, ChangedHdl));
}
FmXListBoxCell::~FmXListBoxCell()
@@ -3988,7 +3988,7 @@ void FmXListBoxCell::disposing()
m_aItemListeners.disposeAndClear(aEvt);
m_aActionListeners.disposeAndClear(aEvt);
- m_pBox->connect_changed( Link<weld::ComboBox&,void>() );
+ m_pBox->SetAuxModifyHdl(Link<LinkParamNone*,void>());
m_pBox = nullptr;
FmXTextCell::disposing();
@@ -3996,9 +3996,14 @@ void FmXListBoxCell::disposing()
IMPLEMENT_GET_IMPLEMENTATION_ID( FmXListBoxCell )
-IMPL_LINK_NOARG(FmXListBoxCell, ChangedHdl, weld::ComboBox&, void)
+IMPL_LINK_NOARG(FmXListBoxCell, ChangedHdl, LinkParamNone*, void)
{
- if (!m_pBox || !m_pBox->changed_by_direct_pick())
+ if (!m_pBox)
+ return;
+
+ weld::ComboBox& rBox = m_pBox->get_widget();
+
+ if (!rBox.changed_by_direct_pick())
return;
OnDoubleClick();
@@ -4008,11 +4013,10 @@ IMPL_LINK_NOARG(FmXListBoxCell, ChangedHdl, weld::ComboBox&, void)
aEvent.Highlighted = 0;
// with multiple selection 0xFFFF, otherwise the ID
- aEvent.Selected = (m_pBox->get_active() != -1 )
- ? m_pBox->get_active() : 0xFFFF;
+ aEvent.Selected = (rBox.get_active() != -1 )
+ ? rBox.get_active() : 0xFFFF;
m_aItemListeners.notifyEach( &awt::XItemListener::itemStateChanged, aEvent );
- return;
}
void FmXListBoxCell::OnDoubleClick()
@@ -4021,7 +4025,8 @@ void FmXListBoxCell::OnDoubleClick()
css::awt::ActionEvent aEvent;
aEvent.Source = *this;
- aEvent.ActionCommand = m_pBox->get_active_text();
+ weld::ComboBox& rBox = m_pBox->get_widget();
+ aEvent.ActionCommand = rBox.get_active_text();
while( aIt.hasMoreElements() )
static_cast< css::awt::XActionListener *>(aIt.next())->actionPerformed( aEvent );
diff --git a/svx/source/inc/gridcell.hxx b/svx/source/inc/gridcell.hxx
index eebfbab4cc6f..16055251de16 100644
--- a/svx/source/inc/gridcell.hxx
+++ b/svx/source/inc/gridcell.hxx
@@ -951,8 +951,7 @@ protected:
virtual void onWindowEvent( const VclEventId _nEventId, const vcl::Window& _rWindow, const void* _pEventData ) override;
};
-
-class FmXListBoxCell final :public FmXTextCell
+class FmXListBoxCell final : public FmXTextCell
{
public:
FmXListBoxCell( DbGridColumn* pColumn, std::unique_ptr<DbCellControl> pControl );
@@ -965,13 +964,13 @@ public:
private:
virtual ~FmXListBoxCell() override;
- DECL_LINK(ChangedHdl, weld::ComboBox&, void);
+ DECL_LINK(ChangedHdl, LinkParamNone*, void);
void OnDoubleClick();
::comphelper::OInterfaceContainerHelper2 m_aItemListeners,
m_aActionListeners;
- weld::ComboBox* m_pBox;
+ VclPtr<::svt::ListBoxControl> m_pBox;
};
More information about the Libreoffice-commits
mailing list