[Libreoffice-commits] core.git: Branch 'distro/lhm/libreoffice-6-4+backports' - include/vcl sw/qa vcl/inc vcl/unx
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Thu Aug 20 11:18:11 UTC 2020
include/vcl/weldutils.hxx | 128 ++++++++++++++++++++++++++++++
sw/qa/extras/ooxmlexport/ooxmlexport4.cxx | 2
vcl/inc/unx/gtk/gtkinst.hxx | 99 ++---------------------
vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx | 2
vcl/unx/gtk3/gtk3gtkinst.cxx | 34 +++++++
5 files changed, 175 insertions(+), 90 deletions(-)
New commits:
commit 9869ca098765ed5ec0325492fa2cdce4a5bab795
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Nov 13 21:28:12 2019 +0000
Commit: Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Thu Aug 20 13:17:33 2020 +0200
factor out 'weld::Widget as XWindow'
Reviewed-on: https://gerrit.libreoffice.org/82641
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
(cherry picked from commit 20d5f61abfd47fc76da3be8241653fdb7ae10491)
Change-Id: I24b52c5b8908fdf1a66fd26b2dc438b9557afa6e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100423
Tested-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
diff --git a/include/vcl/weldutils.hxx b/include/vcl/weldutils.hxx
index 4144803e8b3d..764d343902df 100644
--- a/include/vcl/weldutils.hxx
+++ b/include/vcl/weldutils.hxx
@@ -10,8 +10,11 @@
#ifndef INCLUDED_VCL_WELDUTILS_HXX
#define INCLUDED_VCL_WELDUTILS_HXX
+#include <com/sun/star/awt/XWindow.hpp>
#include <com/sun/star/frame/XFrame.hpp>
#include <com/sun/star/uno/Reference.hxx>
+#include <comphelper/interfacecontainer2.hxx>
+#include <cppuhelper/compbase.hxx>
#include <tools/link.hxx>
#include <vcl/dllapi.h>
@@ -29,6 +32,131 @@ public:
// fill in the label and icons for actions and dispatch the action on item click
ToolbarUnoDispatcher(Toolbar& rToolbar, const css::uno::Reference<css::frame::XFrame>& rFrame);
};
+
+typedef cppu::WeakComponentImplHelper<css::awt::XWindow> TransportAsXWindow_Base;
+
+class VCL_DLLPUBLIC TransportAsXWindow : public TransportAsXWindow_Base
+{
+private:
+ osl::Mutex m_aHelperMtx;
+ weld::Widget* m_pWeldWidget;
+
+ comphelper::OInterfaceContainerHelper2 m_aWindowListeners;
+ comphelper::OInterfaceContainerHelper2 m_aKeyListeners;
+ comphelper::OInterfaceContainerHelper2 m_aFocusListeners;
+ comphelper::OInterfaceContainerHelper2 m_aMouseListeners;
+ comphelper::OInterfaceContainerHelper2 m_aMotionListeners;
+ comphelper::OInterfaceContainerHelper2 m_aPaintListeners;
+
+public:
+ TransportAsXWindow(weld::Widget* pWeldWidget)
+ : TransportAsXWindow_Base(m_aHelperMtx)
+ , m_pWeldWidget(pWeldWidget)
+ , m_aWindowListeners(m_aHelperMtx)
+ , m_aKeyListeners(m_aHelperMtx)
+ , m_aFocusListeners(m_aHelperMtx)
+ , m_aMouseListeners(m_aHelperMtx)
+ , m_aMotionListeners(m_aHelperMtx)
+ , m_aPaintListeners(m_aHelperMtx)
+ {
+ }
+
+ weld::Widget* getWidget() const { return m_pWeldWidget; }
+
+ virtual void clear() { m_pWeldWidget = nullptr; }
+
+ // css::awt::XWindow
+ void SAL_CALL setPosSize(sal_Int32, sal_Int32, sal_Int32, sal_Int32, sal_Int16) override
+ {
+ throw css::uno::RuntimeException("not implemented");
+ }
+
+ css::awt::Rectangle SAL_CALL getPosSize() override
+ {
+ throw css::uno::RuntimeException("not implemented");
+ }
+
+ void SAL_CALL setVisible(sal_Bool bVisible) override { m_pWeldWidget->set_visible(bVisible); }
+
+ void SAL_CALL setEnable(sal_Bool bSensitive) override
+ {
+ m_pWeldWidget->set_sensitive(bSensitive);
+ }
+
+ void SAL_CALL setFocus() override { m_pWeldWidget->grab_focus(); }
+
+ void SAL_CALL
+ addWindowListener(const css::uno::Reference<css::awt::XWindowListener>& rListener) override
+ {
+ m_aWindowListeners.addInterface(rListener);
+ }
+
+ void SAL_CALL
+ removeWindowListener(const css::uno::Reference<css::awt::XWindowListener>& rListener) override
+ {
+ m_aWindowListeners.removeInterface(rListener);
+ }
+
+ void SAL_CALL
+ addFocusListener(const css::uno::Reference<css::awt::XFocusListener>& rListener) override
+ {
+ m_aFocusListeners.addInterface(rListener);
+ }
+
+ void SAL_CALL
+ removeFocusListener(const css::uno::Reference<css::awt::XFocusListener>& rListener) override
+ {
+ m_aFocusListeners.removeInterface(rListener);
+ }
+
+ void SAL_CALL
+ addKeyListener(const css::uno::Reference<css::awt::XKeyListener>& rListener) override
+ {
+ m_aKeyListeners.addInterface(rListener);
+ }
+
+ void SAL_CALL
+ removeKeyListener(const css::uno::Reference<css::awt::XKeyListener>& rListener) override
+ {
+ m_aKeyListeners.removeInterface(rListener);
+ }
+
+ void SAL_CALL
+ addMouseListener(const css::uno::Reference<css::awt::XMouseListener>& rListener) override
+ {
+ m_aMouseListeners.addInterface(rListener);
+ }
+
+ void SAL_CALL
+ removeMouseListener(const css::uno::Reference<css::awt::XMouseListener>& rListener) override
+ {
+ m_aMouseListeners.removeInterface(rListener);
+ }
+
+ void SAL_CALL addMouseMotionListener(
+ const css::uno::Reference<css::awt::XMouseMotionListener>& rListener) override
+ {
+ m_aMotionListeners.addInterface(rListener);
+ }
+
+ void SAL_CALL removeMouseMotionListener(
+ const css::uno::Reference<css::awt::XMouseMotionListener>& rListener) override
+ {
+ m_aMotionListeners.removeInterface(rListener);
+ }
+
+ void SAL_CALL
+ addPaintListener(const css::uno::Reference<css::awt::XPaintListener>& rListener) override
+ {
+ m_aPaintListeners.addInterface(rListener);
+ }
+
+ void SAL_CALL
+ removePaintListener(const css::uno::Reference<css::awt::XPaintListener>& rListener) override
+ {
+ m_aPaintListeners.removeInterface(rListener);
+ }
+};
}
#endif
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
index c80c8f6655bb..d77018c57a92 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
@@ -773,7 +773,7 @@ DECLARE_OOXMLEXPORT_TEST(testComboBoxControl, "combobox-control.docx")
return;
assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:sdt/w:sdtPr/w:dropDownList/w:listItem[1]", "value", "manolo");
assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:sdt/w:sdtPr/w:dropDownList/w:listItem[2]", "value", "pepito");
- assertXPathContent(pXmlDoc, "/w:document/w:body/w:p/w:sdt/w:sdtContent/w:r/w:t", "Manolo");
+ assertXPathContent(pXmlDoc, "/w:document/w:body/w:p/w:sdt/w:sdtContent/w:r/w:t", "manolo");
uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<drawing::XDrawPage> xDrawPage = xDrawPageSupplier->getDrawPage();
diff --git a/vcl/inc/unx/gtk/gtkinst.hxx b/vcl/inc/unx/gtk/gtkinst.hxx
index 78dd9bc6e8b9..b68a7a8286d5 100644
--- a/vcl/inc/unx/gtk/gtkinst.hxx
+++ b/vcl/inc/unx/gtk/gtkinst.hxx
@@ -34,6 +34,8 @@
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/awt/XWindow.hpp>
#include <cppuhelper/compbase.hxx>
+#include <vcl/weld.hxx>
+#include <vcl/weldutils.hxx>
#include <gtk/gtk.h>
namespace vcl
@@ -250,30 +252,31 @@ private:
mutable std::shared_ptr<vcl::unx::GtkPrintWrapper> m_xPrintWrapper;
};
-typedef cppu::WeakComponentImplHelper<css::awt::XWindow> SalGtkXWindow_Base;
-class SalGtkXWindow : public SalGtkXWindow_Base
+//typedef cppu::WeakComponentImplHelper<css::awt::XWindow> SalGtkXWindow_Base;
+
+class SalGtkXWindow final : public weld::TransportAsXWindow
{
private:
- osl::Mutex m_aHelperMtx;
weld::Window* m_pWeldWidget;
GtkWidget* m_pWidget;
public:
SalGtkXWindow(weld::Window* pWeldWidget, GtkWidget* pWidget)
- : SalGtkXWindow_Base(m_aHelperMtx)
+ : TransportAsXWindow(pWeldWidget)
, m_pWeldWidget(pWeldWidget)
, m_pWidget(pWidget)
{
}
- void clear()
+ virtual void clear() override
{
m_pWeldWidget = nullptr;
m_pWidget = nullptr;
+ TransportAsXWindow::clear();
}
- GtkWidget* getWidget() const
+ GtkWidget* getGtkWidget() const
{
return m_pWidget;
}
@@ -283,90 +286,10 @@ public:
return m_pWeldWidget;
}
- // css::awt::XWindow
- void SAL_CALL setPosSize(sal_Int32, sal_Int32, sal_Int32, sal_Int32, sal_Int16) override
- {
- throw css::uno::RuntimeException("not implemented");
- }
-
- css::awt::Rectangle SAL_CALL getPosSize() override
- {
- throw css::uno::RuntimeException("not implemented");
- }
-
- void SAL_CALL setVisible(sal_Bool) override
- {
- throw css::uno::RuntimeException("not implemented");
- }
-
- void SAL_CALL setEnable(sal_Bool) override
- {
- throw css::uno::RuntimeException("not implemented");
- }
-
- void SAL_CALL setFocus() override
- {
- throw css::uno::RuntimeException("not implemented");
- }
-
- void SAL_CALL addWindowListener(const css::uno::Reference< css::awt::XWindowListener >& ) override
- {
- throw css::uno::RuntimeException("not implemented");
- }
- void SAL_CALL removeWindowListener(const css::uno::Reference< css::awt::XWindowListener >& ) override
- {
- throw css::uno::RuntimeException("not implemented");
- }
-
- void SAL_CALL addFocusListener(const css::uno::Reference< css::awt::XFocusListener >& ) override
- {
- throw css::uno::RuntimeException("not implemented");
- }
-
- void SAL_CALL removeFocusListener(const css::uno::Reference< css::awt::XFocusListener >& ) override
- {
- throw css::uno::RuntimeException("not implemented");
- }
-
- void SAL_CALL addKeyListener(const css::uno::Reference< css::awt::XKeyListener >& ) override
- {
- throw css::uno::RuntimeException("not implemented");
- }
-
- void SAL_CALL removeKeyListener(const css::uno::Reference< css::awt::XKeyListener >& ) override
- {
- throw css::uno::RuntimeException("not implemented");
- }
-
- void SAL_CALL addMouseListener(const css::uno::Reference< css::awt::XMouseListener >& ) override
- {
- throw css::uno::RuntimeException("not implemented");
- }
-
- void SAL_CALL removeMouseListener(const css::uno::Reference< css::awt::XMouseListener >& ) override
- {
- throw css::uno::RuntimeException("not implemented");
- }
-
- void SAL_CALL addMouseMotionListener(const css::uno::Reference< css::awt::XMouseMotionListener >& ) override
- {
- throw css::uno::RuntimeException("not implemented");
- }
-
- void SAL_CALL removeMouseMotionListener(const css::uno::Reference< css::awt::XMouseMotionListener >& ) override
- {
- throw css::uno::RuntimeException("not implemented");
- }
+ void SAL_CALL setPosSize(sal_Int32, sal_Int32, sal_Int32 w, sal_Int32 h, sal_Int16 nFlags ) override;
- void SAL_CALL addPaintListener(const css::uno::Reference< css::awt::XPaintListener >& ) override
- {
- throw css::uno::RuntimeException("not implemented");
- }
+ css::awt::Rectangle SAL_CALL getPosSize() override;
- void SAL_CALL removePaintListener(const css::uno::Reference< css::awt::XPaintListener >& ) override
- {
- throw css::uno::RuntimeException("not implemented");
- }
};
GdkPixbuf* load_icon_by_name(const OUString& rIconName);
diff --git a/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx b/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx
index 75f832cc815a..d8ac53777482 100644
--- a/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx
+++ b/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx
@@ -1580,7 +1580,7 @@ void SAL_CALL SalGtkFilePicker::initialize( const uno::Sequence<uno::Any>& aArgu
if (xParentWindow.is())
{
if (SalGtkXWindow* pGtkXWindow = dynamic_cast<SalGtkXWindow*>(xParentWindow.get()))
- m_pParentWidget = pGtkXWindow->getWidget();
+ m_pParentWidget = pGtkXWindow->getGtkWidget();
else
{
css::uno::Reference<css::awt::XSystemDependentWindowPeer> xSysDepWin(xParentWindow, css::uno::UNO_QUERY);
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 6faad1ddf9c3..490e9c9e9325 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -13180,4 +13180,38 @@ void* GtkInstance::CreateGStreamerSink(const SystemChildWindow *pWindow)
#endif
}
+
+
+void SAL_CALL SalGtkXWindow::setPosSize(sal_Int32 nX, sal_Int32 nY, sal_Int32 nWidth, sal_Int32 nHeight, sal_Int16 nFlags )
+{
+ if(m_pWidget)
+ {
+ if( (nFlags & ( SAL_FRAME_POSSIZE_WIDTH | SAL_FRAME_POSSIZE_HEIGHT )) &&
+ (nWidth > 0 && nHeight > 0 ) // sometimes stupid things happen
+ )
+ {
+ gtk_window_resize(GTK_WINDOW(m_pWidget), nWidth, nHeight);
+ }
+
+ if( nFlags & ( SAL_FRAME_POSSIZE_X | SAL_FRAME_POSSIZE_Y ) )
+ {
+ gtk_window_move(GTK_WINDOW(m_pWidget), nX, nY);
+ }
+ }
+}
+
+css::awt::Rectangle SAL_CALL SalGtkXWindow::getPosSize()
+{
+ if(m_pWidget)
+ {
+ gint w, h, x, y;
+ gtk_window_get_size(GTK_WINDOW(m_pWidget), &w, &h);
+ gtk_window_get_position(GTK_WINDOW(m_pWidget), &x, &x);
+ return css::awt::Rectangle(x, y, w, h);
+ }
+ else {
+ return css::awt::Rectangle();
+ }
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
More information about the Libreoffice-commits
mailing list