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 --- xmlhelp/source/cxxhelp/provider/databases.cxx | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) (limited to 'xmlhelp') diff --git a/xmlhelp/source/cxxhelp/provider/databases.cxx b/xmlhelp/source/cxxhelp/provider/databases.cxx index 342923d341f9..1d3ca708d61d 100644 --- a/xmlhelp/source/cxxhelp/provider/databases.cxx +++ b/xmlhelp/source/cxxhelp/provider/databases.cxx @@ -33,6 +33,7 @@ #include #include #include +#include #include #include "inputstream.hxx" #include @@ -1208,24 +1209,17 @@ void Databases::cascadingStylesheet( const rtl::OUString& Language, if ( aCSS.compareToAscii( "default" ) == 0 ) { // #i50760: "default" needs to adapt HC mode - uno::Reference< awt::XToolkit > xToolkit = uno::Reference< awt::XToolkit >( - ::comphelper::getProcessServiceFactory()->createInstance( rtl::OUString( "com.sun.star.awt.Toolkit" ) ), uno::UNO_QUERY ); - if ( xToolkit.is() ) + uno::Reference< awt::XToolkit2 > xToolkit = + awt::Toolkit::create( ::comphelper::getProcessComponentContext() ); + uno::Reference< awt::XTopWindow > xTopWindow = xToolkit->getActiveTopWindow(); + if ( xTopWindow.is() ) { - uno::Reference< awt::XExtendedToolkit > xExtToolkit( xToolkit, uno::UNO_QUERY ); - if ( xExtToolkit.is() ) + uno::Reference< awt::XVclWindowPeer > xVclWindowPeer( xTopWindow, uno::UNO_QUERY ); + if ( xVclWindowPeer.is() ) { - uno::Reference< awt::XTopWindow > xTopWindow = xExtToolkit->getActiveTopWindow(); - if ( xTopWindow.is() ) - { - uno::Reference< awt::XVclWindowPeer > xVclWindowPeer( xTopWindow, uno::UNO_QUERY ); - if ( xVclWindowPeer.is() ) - { - uno::Any aHCMode = xVclWindowPeer->getProperty( rtl::OUString( "HighContrastMode" ) ); - if ( ( aHCMode >>= bHighContrastMode ) && bHighContrastMode ) - aCSS = rtl::OUString( "highcontrastblack" ); - } - } + uno::Any aHCMode = xVclWindowPeer->getProperty( rtl::OUString( "HighContrastMode" ) ); + if ( ( aHCMode >>= bHighContrastMode ) && bHighContrastMode ) + aCSS = rtl::OUString( "highcontrastblack" ); } } } -- cgit