summaryrefslogtreecommitdiff
path: root/embedserv
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2012-10-17 10:52:52 +0200
committerStephan Bergmann <sbergman@redhat.com>2012-10-24 16:49:49 +0200
commit33a0f8ce656c8c5bb9c3c3deaa10c182e262b374 (patch)
treeabd469ffb224c8d7b2de1cf76e3aada03e035fc1 /embedserv
parentf252b332dd2652abb02851ba0c2521c045787801 (diff)
fdo#46808, Adapt awt::Toolkit UNO service to new style
Create a merged XToolkit2 interface for this service to implement. Which is backwards-compatible, but does not require creating a new service. Also mark sub-interfaces as non-optional. Change-Id: I278d0288e92be277033013302267cf93f7d70480
Diffstat (limited to 'embedserv')
-rw-r--r--embedserv/source/embed/docholder.cxx60
1 files changed, 27 insertions, 33 deletions
diff --git a/embedserv/source/embed/docholder.cxx b/embedserv/source/embed/docholder.cxx
index a2a91a524202..cf2b71c4c9d9 100644
--- a/embedserv/source/embed/docholder.cxx
+++ b/embedserv/source/embed/docholder.cxx
@@ -31,6 +31,7 @@
#include "common.h"
#include <Windows.h>
#include <com/sun/star/lang/SystemDependent.hpp>
+#include <com/sun/star/awt/Toolkit.hpp>
#include <com/sun/star/awt/XSystemChildFactory.hpp>
#include <com/sun/star/awt/XSystemDependentWindowPeer.hpp>
#include <com/sun/star/awt/XSystemDependentMenuPeer.hpp>
@@ -283,36 +284,32 @@ HRESULT DocumentHolder::InPlaceActivate(
HWND hWndxWinParent(0);
uno::Reference<awt::XWindow> xWin;
- static const ::rtl::OUString aToolkitServiceName(
- RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.awt.Toolkit" ) );
- uno::Reference<awt::XSystemChildFactory> xToolkit(
- m_xFactory->createInstance(aToolkitServiceName ),uno::UNO_QUERY);
-
- if(xToolkit.is()) {
- // create system window wrapper for hwnd
- if( !m_pCHatchWin )
- m_pCHatchWin = new winwrap::CHatchWin(
- m_hInstance,this);
-
- if(m_pCHatchWin->Init(hWndSite,/*ID_HATCHWINDOW*/2000, NULL)) {
- m_pCHatchWin->RectsSet(&rcPos,&rcClip); //set visible area
- hWndxWinParent = m_pCHatchWin->Window();
- ShowWindow(hWndxWinParent,SW_SHOW); //Make visible.
- }
- else {
- // no success initializing hatch window
- delete m_pCHatchWin, m_pCHatchWin = 0;
- hWndxWinParent = hWndSite;
- }
+ uno::Reference<awt::XToolkit2> xToolkit =
+ awt::Toolkit::create(comphelper::getComponentContext(m_xFactory));
- aAny <<= sal_Int32(hWndxWinParent);
- xWin = uno::Reference<awt::XWindow>(
- xToolkit->createSystemChild(
- aAny,
- aProcessIdent,
- lang::SystemDependent::SYSTEM_WIN32),
- uno::UNO_QUERY);
+ // create system window wrapper for hwnd
+ if( !m_pCHatchWin )
+ m_pCHatchWin = new winwrap::CHatchWin(
+ m_hInstance,this);
+
+ if(m_pCHatchWin->Init(hWndSite,/*ID_HATCHWINDOW*/2000, NULL)) {
+ m_pCHatchWin->RectsSet(&rcPos,&rcClip); //set visible area
+ hWndxWinParent = m_pCHatchWin->Window();
+ ShowWindow(hWndxWinParent,SW_SHOW); //Make visible.
}
+ else {
+ // no success initializing hatch window
+ delete m_pCHatchWin, m_pCHatchWin = 0;
+ hWndxWinParent = hWndSite;
+ }
+
+ aAny <<= sal_Int32(hWndxWinParent);
+ xWin = uno::Reference<awt::XWindow>(
+ xToolkit->createSystemChild(
+ aAny,
+ aProcessIdent,
+ lang::SystemDependent::SYSTEM_WIN32),
+ uno::UNO_QUERY);
if(xWin.is()) {
xWin->setPosSize(
@@ -1301,12 +1298,9 @@ DocumentHolder::getContainerWindow(
uno::Reference<awt::XWindow> xWin(0);
- static const ::rtl::OUString aToolkitServiceName(
- RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.awt.Toolkit" ) );
- uno::Reference<awt::XSystemChildFactory> xToolkit(
- m_xFactory->createInstance(aToolkitServiceName ),uno::UNO_QUERY);
+ uno::Reference<awt::XToolkit2> xToolkit = awt::Toolkit::create( comphelper::getComponentContext(m_xFactory) );
- if(xToolkit.is() && m_pIOleIPFrame) {
+ if(m_pIOleIPFrame) {
HWND hWnd;
m_pIOleIPFrame->GetWindow(&hWnd);