summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2023-11-16 08:29:26 +0100
committerMiklos Vajna <vmiklos@collabora.com>2023-11-16 10:09:06 +0100
commit2f42d8acd2d06f848c9e680c42a0f7834a9a641f (patch)
tree408ba3529c47d2248dfac7f492e23c866bd2e5c4 /sw/source
parent06e3877dc2cf22e00d04b48453e9ab0b948c3ca2 (diff)
sw floattable, delete UI: fix unfloat button for cant-split frames
Open sw/qa/extras/uiwriter/data/unfloatable_floating_table.odt, select the TextFrame, click on the "unfloat" button that appears, then nothing happens. This is a problem since commit 51379fb3d46e5891bdaea0122bd62b0753663da3 (weld writer's FrameControl MenuButtons, 2020-12-03), the old MouseButtonDown() callback is never invoked. Fix the problem similar to what SwHeaderFooterWin does, which works: instead of overriding the dead MouseButtonDown(), explicitly connect the click handler to the weld::Button widget. Also adjust SwFlyFrame::ActiveUnfloatButton() to use the welded callback, this way CppunitTest_sw_uiwriter2's testUnfloating covers the fix. Change-Id: I1180fc6a0ae2df7c01c273a5ef92dd8915ca70a9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159493 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/core/layout/fly.cxx4
-rw-r--r--sw/source/uibase/docvw/UnfloatTableButton.cxx5
-rw-r--r--sw/source/uibase/inc/FrameControl.hxx1
-rw-r--r--sw/source/uibase/inc/UnfloatTableButton.hxx4
4 files changed, 9 insertions, 5 deletions
diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx
index 78aa7f604b20..33880623a481 100644
--- a/sw/source/core/layout/fly.cxx
+++ b/sw/source/core/layout/fly.cxx
@@ -2105,9 +2105,9 @@ void SwFlyFrame::ActiveUnfloatButton(SwWrtShell* pWrtSh)
SwEditWin& rEditWin = pWrtSh->GetView().GetEditWin();
SwFrameControlsManager& rMngr = rEditWin.GetFrameControlsManager();
SwFrameControlPtr pControl = rMngr.GetControl(FrameControlType::FloatingTable, this);
- if (pControl && pControl->GetWindow())
+ if (pControl && pControl->GetIFacePtr())
{
- pControl->GetWindow()->MouseButtonDown(MouseEvent());
+ pControl->GetIFacePtr()->GetButton()->clicked();
}
}
diff --git a/sw/source/uibase/docvw/UnfloatTableButton.cxx b/sw/source/uibase/docvw/UnfloatTableButton.cxx
index e1cdf8c7aad9..30d1d97aaacc 100644
--- a/sw/source/uibase/docvw/UnfloatTableButton.cxx
+++ b/sw/source/uibase/docvw/UnfloatTableButton.cxx
@@ -53,9 +53,12 @@ UnfloatTableButton::UnfloatTableButton(SwEditWin* pEditWin, const SwFrame* pFram
{
m_xPushButton->set_accessible_name(m_sLabel);
m_xVirDev = m_xPushButton->create_virtual_device();
+ m_xPushButton->connect_clicked(LINK(this, UnfloatTableButton, ClickHdl));
SetVirDevFont();
}
+weld::Button* UnfloatTableButton::GetButton() { return m_xPushButton.get(); }
+
UnfloatTableButton::~UnfloatTableButton() { disposeOnce(); }
void UnfloatTableButton::dispose()
@@ -89,7 +92,7 @@ void UnfloatTableButton::SetOffset(Point aTopRightPixel)
PaintButton();
}
-void UnfloatTableButton::MouseButtonDown(const MouseEvent& /*rMEvt*/)
+IMPL_LINK_NOARG(UnfloatTableButton, ClickHdl, weld::Button&, void)
{
assert(GetFrame()->IsFlyFrame());
// const_cast is needed because of bad design of ISwFrameControl and derived classes
diff --git a/sw/source/uibase/inc/FrameControl.hxx b/sw/source/uibase/inc/FrameControl.hxx
index 7bdc9ff6bb8b..4043f834f94b 100644
--- a/sw/source/uibase/inc/FrameControl.hxx
+++ b/sw/source/uibase/inc/FrameControl.hxx
@@ -32,6 +32,7 @@ public:
virtual const SwFrame* GetFrame() = 0;
virtual SwEditWin* GetEditWin() = 0;
+ virtual weld::Button* GetButton() { return nullptr; };
};
class SwFrameControl final
diff --git a/sw/source/uibase/inc/UnfloatTableButton.hxx b/sw/source/uibase/inc/UnfloatTableButton.hxx
index 164b240f28b1..8803b5169173 100644
--- a/sw/source/uibase/inc/UnfloatTableButton.hxx
+++ b/sw/source/uibase/inc/UnfloatTableButton.hxx
@@ -34,14 +34,14 @@ public:
void SetOffset(Point aTopRightPixel);
- virtual void MouseButtonDown(const MouseEvent& rMEvt) override;
-
virtual void ShowAll(bool bShow) override;
virtual bool Contains(const Point& rDocPt) const override;
virtual void SetReadonly(bool bReadonly) override;
+ weld::Button* GetButton() override;
private:
+ DECL_LINK(ClickHdl, weld::Button&, void);
void PaintButton();
};