diff options
author | Noel Grandin <noel@peralex.com> | 2012-10-17 10:52:52 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2012-10-24 16:49:49 +0200 |
commit | 33a0f8ce656c8c5bb9c3c3deaa10c182e262b374 (patch) | |
tree | abd469ffb224c8d7b2de1cf76e3aada03e035fc1 /sw | |
parent | f252b332dd2652abb02851ba0c2521c045787801 (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 'sw')
-rw-r--r-- | sw/source/ui/utlui/unotools.cxx | 76 |
1 files changed, 38 insertions, 38 deletions
diff --git a/sw/source/ui/utlui/unotools.cxx b/sw/source/ui/utlui/unotools.cxx index 6324bddd27a3..e762e720f77b 100644 --- a/sw/source/ui/utlui/unotools.cxx +++ b/sw/source/ui/utlui/unotools.cxx @@ -43,6 +43,7 @@ #include <com/sun/star/style/XStyleFamiliesSupplier.hpp> #include <com/sun/star/style/XStyle.hpp> #include <com/sun/star/text/XTextDocument.hpp> +#include <com/sun/star/awt/Toolkit.hpp> #include <com/sun/star/awt/PosSize.hpp> #include <com/sun/star/view/XViewSettingsSupplier.hpp> #include <com/sun/star/container/XNameContainer.hpp> @@ -123,50 +124,49 @@ void SwOneExampleFrame::CreateControl() return ; uno::Reference< lang::XMultiServiceFactory > xMgr = comphelper::getProcessServiceFactory(); + uno::Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext(); uno::Reference< uno::XInterface > xInst = xMgr->createInstance( C2U("com.sun.star.frame.FrameControl") ); _xControl = uno::Reference< awt::XControl >(xInst, uno::UNO_QUERY); if(_xControl.is()) { uno::Reference< awt::XWindowPeer > xParent( rWindow.GetComponentInterface() ); - uno::Reference< awt::XToolkit > xToolkit( xMgr->createInstance( C2U("com.sun.star.awt.Toolkit") ), uno::UNO_QUERY ); - if(xToolkit.is()) - { - _xControl->createPeer( xToolkit, xParent ); - - uno::Reference< awt::XWindow > xWin( _xControl, uno::UNO_QUERY ); - xWin->setVisible( sal_False ); - Size aWinSize(rWindow.GetOutputSizePixel()); - xWin->setPosSize( 0, 0, aWinSize.Width(), aWinSize.Height(), awt::PosSize::SIZE ); - - uno::Reference< beans::XPropertySet > xPrSet(xInst, uno::UNO_QUERY); - uno::Any aURL; - // create new doc - rtl::OUString sTempURL(cFactory); - if(sArgumentURL.Len()) - sTempURL = sArgumentURL; - aURL <<= sTempURL; - - uno::Sequence<beans::PropertyValue> aSeq(3); - beans::PropertyValue* pValues = aSeq.getArray(); - pValues[0].Name = C2U("ReadOnly"); - sal_Bool bTrue = sal_True; - pValues[0].Value.setValue(&bTrue, ::getBooleanCppuType()); - pValues[1].Name = C2U("OpenFlags"); - pValues[1].Value <<= C2U("-RB"); - pValues[2].Name = C2U("Referer"); - pValues[2].Value <<= C2U("private:user"); - uno::Any aArgs; - aArgs.setValue(&aSeq, ::getCppuType((uno::Sequence<beans::PropertyValue>*)0)); - - xPrSet->setPropertyValue( C2U("LoaderArguments"), aArgs ); - //save and set readonly??? - - xPrSet->setPropertyValue(C2U("ComponentURL"), aURL); - - aLoadedTimer.Start(); - bServiceAvailable = sal_True; - } + uno::Reference< awt::XToolkit > xToolkit( awt::Toolkit::create(xContext), uno::UNO_QUERY_THROW ); + + _xControl->createPeer( xToolkit, xParent ); + + uno::Reference< awt::XWindow > xWin( _xControl, uno::UNO_QUERY ); + xWin->setVisible( sal_False ); + Size aWinSize(rWindow.GetOutputSizePixel()); + xWin->setPosSize( 0, 0, aWinSize.Width(), aWinSize.Height(), awt::PosSize::SIZE ); + + uno::Reference< beans::XPropertySet > xPrSet(xInst, uno::UNO_QUERY); + uno::Any aURL; + // create new doc + rtl::OUString sTempURL(cFactory); + if(sArgumentURL.Len()) + sTempURL = sArgumentURL; + aURL <<= sTempURL; + + uno::Sequence<beans::PropertyValue> aSeq(3); + beans::PropertyValue* pValues = aSeq.getArray(); + pValues[0].Name = C2U("ReadOnly"); + sal_Bool bTrue = sal_True; + pValues[0].Value.setValue(&bTrue, ::getBooleanCppuType()); + pValues[1].Name = C2U("OpenFlags"); + pValues[1].Value <<= C2U("-RB"); + pValues[2].Name = C2U("Referer"); + pValues[2].Value <<= C2U("private:user"); + uno::Any aArgs; + aArgs.setValue(&aSeq, ::getCppuType((uno::Sequence<beans::PropertyValue>*)0)); + + xPrSet->setPropertyValue( C2U("LoaderArguments"), aArgs ); + //save and set readonly??? + + xPrSet->setPropertyValue(C2U("ComponentURL"), aURL); + + aLoadedTimer.Start(); + bServiceAvailable = sal_True; } } |