summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-04-05 12:40:52 +0100
committerCaolán McNamara <caolanm@redhat.com>2018-04-05 15:29:16 +0200
commit6c5aa32a3ca51f9feecf2ed59944080e766b9ac2 (patch)
tree87e8081be5696b7f08013e3b3d07d448ca46b517 /vcl
parentd9d6f805fdda16a1a51d50deaba8c3a08b606234 (diff)
enable mapping direct from awt::XWindow and weld::Window
Change-Id: I33b1309a4b81bfd84449213099c4f3f781413e00 Reviewed-on: https://gerrit.libreoffice.org/52456 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 'vcl')
-rw-r--r--vcl/inc/salinst.hxx9
-rw-r--r--vcl/inc/unx/gtk/gtkinst.hxx13
-rw-r--r--vcl/source/app/salvtables.cxx12
-rw-r--r--vcl/source/window/builder.cxx5
-rw-r--r--vcl/unx/gtk3/gtk3gtkinst.cxx9
5 files changed, 45 insertions, 3 deletions
diff --git a/vcl/inc/salinst.hxx b/vcl/inc/salinst.hxx
index 8b7a77f34543..49091b6f577c 100644
--- a/vcl/inc/salinst.hxx
+++ b/vcl/inc/salinst.hxx
@@ -34,12 +34,20 @@
#include <com/sun/star/ui/dialogs/XFilePicker2.hpp>
#include <com/sun/star/ui/dialogs/XFolderPicker2.hpp>
+namespace com {
+namespace sun {
+namespace star {
+namespace awt {
+ class XWindow;
+}
+} } }
namespace comphelper { class SolarMutex; }
namespace vcl { class Window; }
namespace weld {
class Builder;
class MessageDialog;
class Widget;
+ class Window;
}
struct SystemParentData;
struct SalPrinterQueueInfo;
@@ -157,6 +165,7 @@ public:
virtual weld::Builder* CreateBuilder(weld::Widget* pParent, const OUString& rUIRoot, const OUString& rUIFile);
virtual weld::MessageDialog* CreateMessageDialog(weld::Widget* pParent, VclMessageType eMessageType,
VclButtonsType eButtonType, const OUString& rPrimaryMessage);
+ virtual weld::Window* GetFrameWeld(const css::uno::Reference<css::awt::XWindow>& rWindow);
// methods for XDisplayConnection
diff --git a/vcl/inc/unx/gtk/gtkinst.hxx b/vcl/inc/unx/gtk/gtkinst.hxx
index 9a3cb48dfe03..b6f00a0752d7 100644
--- a/vcl/inc/unx/gtk/gtkinst.hxx
+++ b/vcl/inc/unx/gtk/gtkinst.hxx
@@ -229,6 +229,7 @@ public:
virtual OpenGLContext* CreateOpenGLContext() override;
virtual weld::Builder* CreateBuilder(weld::Widget* pParent, const OUString& rUIRoot, const OUString& rUIFile) override;
virtual weld::MessageDialog* CreateMessageDialog(weld::Widget* pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage) override;
+ virtual weld::Window* GetFrameWeld(const css::uno::Reference<css::awt::XWindow>& rWindow) override;
#endif
virtual const cairo_font_options_t* GetCairoFontOptions() override;
@@ -257,25 +258,33 @@ class SalGtkXWindow : public SalGtkXWindow_Base
{
private:
osl::Mutex m_aHelperMtx;
+ weld::Window* m_pWeldWidget;
GtkWidget* m_pWidget;
public:
- SalGtkXWindow(GtkWidget* pWidget)
+ SalGtkXWindow(weld::Window* pWeldWidget, GtkWidget* pWidget)
: SalGtkXWindow_Base(m_aHelperMtx)
+ , m_pWeldWidget(pWeldWidget)
, m_pWidget(pWidget)
{
}
void clear()
{
+ m_pWeldWidget = nullptr;
m_pWidget = nullptr;
}
- GtkWidget * getWidget() const
+ GtkWidget* getWidget() const
{
return m_pWidget;
}
+ weld::Window* getFrameWeld() const
+ {
+ return m_pWeldWidget;
+ }
+
// css::awt::XWindow
void SAL_CALL setPosSize(sal_Int32, sal_Int32, sal_Int32, sal_Int32, sal_Int16) override
{
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index d473f7b59ddd..62e5873b8501 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -37,6 +37,7 @@
#include <vcl/layout.hxx>
#include <vcl/tabctrl.hxx>
#include <vcl/tabpage.hxx>
+#include <vcl/unowrap.hxx>
#include <vcl/weld.hxx>
#include <bitmaps.hlst>
@@ -1840,6 +1841,17 @@ weld::MessageDialog* SalInstance::CreateMessageDialog(weld::Widget* pParent, Vcl
return new SalInstanceMessageDialog(xMessageDialog, true);
}
+weld::Window* SalInstance::GetFrameWeld(const css::uno::Reference<css::awt::XWindow>& rWindow)
+{
+ UnoWrapperBase* pWrapper = Application::GetUnoWrapper();
+ if (!pWrapper)
+ return nullptr;
+ VclPtr<vcl::Window> xWindow = pWrapper->GetWindow(rWindow);
+ if (!xWindow)
+ return nullptr;
+ return xWindow->GetFrameWeld();
+}
+
weld::Window* SalFrame::GetFrameWeld() const
{
if (!m_xFrameWeld)
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index 926a69b47231..fafae4c130bc 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -135,6 +135,11 @@ weld::MessageDialog* Application::CreateMessageDialog(weld::Widget* pParent, Vcl
return ImplGetSVData()->mpDefInst->CreateMessageDialog(pParent, eMessageType, eButtonType, rPrimaryMessage);
}
+weld::Window* Application::GetFrameWeld(const css::uno::Reference<css::awt::XWindow>& rWindow)
+{
+ return ImplGetSVData()->mpDefInst->GetFrameWeld(rWindow);
+}
+
namespace
{
const OUString MetricToString(FieldUnit rUnit)
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 916fda03ff74..133406925d79 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -1612,7 +1612,7 @@ public:
virtual css::uno::Reference<css::awt::XWindow> GetXWindow() override
{
if (!m_xWindow.is())
- m_xWindow.set(new SalGtkXWindow(m_pWidget));
+ m_xWindow.set(new SalGtkXWindow(this, m_pWidget));
return css::uno::Reference<css::awt::XWindow>(m_xWindow.get());
}
@@ -4041,6 +4041,13 @@ weld::MessageDialog* GtkInstance::CreateMessageDialog(weld::Widget* pParent, Vcl
return new GtkInstanceMessageDialog(pMessageDialog, true);
}
+weld::Window* GtkInstance::GetFrameWeld(const css::uno::Reference<css::awt::XWindow>& rWindow)
+{
+ if (SalGtkXWindow* pGtkXWindow = dynamic_cast<SalGtkXWindow*>(rWindow.get()))
+ return pGtkXWindow->getFrameWeld();
+ return nullptr;
+}
+
weld::Window* GtkSalFrame::GetFrameWeld() const
{
if (!m_xFrameWeld)