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

enable mapping direct from awt::XWindow and weld::Window

Change-Id: I33b1309a4b81bfd84449213099c4f3f781413e00
Reviewed-on: https://gerrit.libreoffice.org/52456Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst d9d6f805
......@@ -53,6 +53,7 @@ namespace weld
class Container;
class MessageDialog;
class Widget;
class Window;
}
class AllSettings;
class DataChangedEvent;
......@@ -85,6 +86,7 @@ namespace ui {
namespace awt {
class XToolkit;
class XDisplayConnection;
class XWindow;
}
} } }
......@@ -1397,6 +1399,8 @@ public:
static weld::MessageDialog* CreateMessageDialog(weld::Widget* pParent, VclMessageType eMessageType,
VclButtonsType eButtonType, const OUString& rPrimaryMessage);
static weld::Window* GetFrameWeld(const css::uno::Reference<css::awt::XWindow>& rWindow);
private:
DECL_STATIC_LINK( Application, PostEventHandler, void*, void );
};
......
......@@ -40,6 +40,7 @@ namespace star {
namespace awt {
class XGraphics;
class XToolkit;
class XWindow;
class XWindowPeer;
}
namespace lang {
......@@ -69,6 +70,7 @@ public:
// Window
virtual css::uno::Reference< css::awt::XWindowPeer> GetWindowInterface( vcl::Window* pWindow ) = 0;
virtual void SetWindowInterface( vcl::Window* pWindow, css::uno::Reference< css::awt::XWindowPeer > xIFace ) = 0;
virtual VclPtr<vcl::Window> GetWindow(const css::uno::Reference<css::awt::XWindow>& rxWindow) = 0;
virtual void WindowDestroyed( vcl::Window* pWindow ) = 0;
......
......@@ -54,6 +54,7 @@ public:
// Window
virtual css::uno::Reference< css::awt::XWindowPeer> GetWindowInterface( vcl::Window* pWindow ) override;
virtual void SetWindowInterface( vcl::Window* pWindow, css::uno::Reference< css::awt::XWindowPeer> xIFace ) override;
virtual VclPtr<vcl::Window> GetWindow(const css::uno::Reference<css::awt::XWindow>& rxWindow) override;
void WindowDestroyed( vcl::Window* pWindow ) override;
......
......@@ -161,6 +161,11 @@ css::uno::Reference< css::awt::XWindowPeer> UnoWrapper::GetWindowInterface( vcl:
return xPeer;
}
VclPtr<vcl::Window> UnoWrapper::GetWindow(const css::uno::Reference<css::awt::XWindow>& rWindow)
{
return VCLUnoHelper::GetWindow(rWindow);
}
void UnoWrapper::SetWindowInterface( vcl::Window* pWindow, css::uno::Reference< css::awt::XWindowPeer> xIFace )
{
VCLXWindow* pVCLXWindow = VCLXWindow::GetImplementation( xIFace );
......
......@@ -664,7 +664,7 @@ UUIInteractionHelper::handlePasswordRequest(
uno::Reference< task::XInteractionRequest > const & rRequest)
{
// parameters to be filled for the call to handlePasswordRequest_
vcl::Window * pParent = getParentProperty();
uno::Reference<awt::XWindow> xParent = getParentXWindow();
task::PasswordRequestMode nMode = task::PasswordRequestMode_PASSWORD_ENTER;
uno::Sequence< uno::Reference< task::XInteractionContinuation > > const & rContinuations = rRequest->getContinuations();
OUString aDocumentName;
......@@ -721,7 +721,7 @@ UUIInteractionHelper::handlePasswordRequest(
if (bDoHandleRequest)
{
handlePasswordRequest_( pParent ? pParent->GetFrameWeld() : nullptr, nMode, rContinuations,
handlePasswordRequest_( Application::GetFrameWeld(xParent), nMode, rContinuations,
aDocumentName, bMSCryptoMode, bIsPasswordToModify );
return true;
}
......@@ -729,7 +729,7 @@ UUIInteractionHelper::handlePasswordRequest(
task::PasswordRequest aPasswordRequest;
if( aAnyRequest >>= aPasswordRequest )
{
handlePasswordRequest_(pParent ? pParent->GetFrameWeld() : nullptr,
handlePasswordRequest_(Application::GetFrameWeld(xParent),
aPasswordRequest.Mode,
rRequest->getContinuations(),
OUString(),
......
......@@ -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
......
......@@ -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
{
......
......@@ -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)
......
......@@ -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)
......
......@@ -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)
......
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