From 33a0f8ce656c8c5bb9c3c3deaa10c182e262b374 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 17 Oct 2012 10:52:52 +0200 Subject: 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 --- embedserv/source/embed/docholder.cxx | 60 ++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 33 deletions(-) (limited to 'embedserv') 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 #include +#include #include #include #include @@ -283,36 +284,32 @@ HRESULT DocumentHolder::InPlaceActivate( HWND hWndxWinParent(0); uno::Reference xWin; - static const ::rtl::OUString aToolkitServiceName( - RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.awt.Toolkit" ) ); - uno::Reference 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 xToolkit = + awt::Toolkit::create(comphelper::getComponentContext(m_xFactory)); - aAny <<= sal_Int32(hWndxWinParent); - xWin = uno::Reference( - 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( + xToolkit->createSystemChild( + aAny, + aProcessIdent, + lang::SystemDependent::SYSTEM_WIN32), + uno::UNO_QUERY); if(xWin.is()) { xWin->setPosSize( @@ -1301,12 +1298,9 @@ DocumentHolder::getContainerWindow( uno::Reference xWin(0); - static const ::rtl::OUString aToolkitServiceName( - RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.awt.Toolkit" ) ); - uno::Reference xToolkit( - m_xFactory->createInstance(aToolkitServiceName ),uno::UNO_QUERY); + uno::Reference xToolkit = awt::Toolkit::create( comphelper::getComponentContext(m_xFactory) ); - if(xToolkit.is() && m_pIOleIPFrame) { + if(m_pIOleIPFrame) { HWND hWnd; m_pIOleIPFrame->GetWindow(&hWnd); -- cgit