diff options
author | Kurt Zenker <kz@openoffice.org> | 2006-12-13 13:45:12 +0000 |
---|---|---|
committer | Kurt Zenker <kz@openoffice.org> | 2006-12-13 13:45:12 +0000 |
commit | 93fd2bdf6dbd04fecc24f904fc53d01586eeddb8 (patch) | |
tree | 0d861f67e1d2bcc28ed7082bdf4a399383d9d09c | |
parent | a3c624c0dde9731cdce6b21a714d881be0897664 (diff) |
INTEGRATION: CWS presfixes09 (1.2.32); FILE MERGED
2006/10/20 11:40:26 thb 1.2.32.7: #i10000# Removed post-merge compiler warnings; removed spurious semicolon after macro
2006/10/18 13:58:23 thb 1.2.32.6: RESYNC: (1.3-1.4); FILE MERGED
2006/09/15 15:39:57 thb 1.2.32.5: RESYNC: (1.2-1.3); FILE MERGED
2006/04/25 12:53:44 thb 1.2.32.4: #i63943# Handling probe construction special
2006/04/21 12:44:22 thb 1.2.32.3: #i63088# Cloned Cyrille's patches accordingly
2006/03/13 12:38:00 thb 1.2.32.2: #i49357# Renamed macro
2006/03/08 17:59:54 thb 1.2.32.1: #i49357# Now also providing the C lib entry points again
-rw-r--r-- | canvas/source/null/null_spritecanvas.cxx | 155 |
1 files changed, 46 insertions, 109 deletions
diff --git a/canvas/source/null/null_spritecanvas.cxx b/canvas/source/null/null_spritecanvas.cxx index dbed80d007ea..0546256d9d98 100644 --- a/canvas/source/null/null_spritecanvas.cxx +++ b/canvas/source/null/null_spritecanvas.cxx @@ -4,9 +4,9 @@ * * $RCSfile: null_spritecanvas.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: obo $ $Date: 2006-09-17 03:23:44 $ + * last change: $Author: kz $ $Date: 2006-12-13 14:45:12 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -48,6 +48,7 @@ #include <cppuhelper/factory.hxx> #include <cppuhelper/implementationentry.hxx> +#include <comphelper/servicedecl.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> #include <basegfx/point/b2dpoint.hxx> @@ -59,31 +60,46 @@ using namespace ::com::sun::star; -#define IMPLEMENTATION_NAME "NullCanvas::SpriteCanvas" #define SERVICE_NAME "com.sun.star.rendering.NullCanvas" -namespace +namespace nullcanvas { - static ::rtl::OUString SAL_CALL getImplementationName_SpriteCanvas() + SpriteCanvas::SpriteCanvas( const uno::Sequence< uno::Any >& aArguments, + const uno::Reference< uno::XComponentContext >& rxContext ) : + mxComponentContext( rxContext ) { - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( IMPLEMENTATION_NAME ) ); + // #i64742# Only call initialize when not in probe mode + if( aArguments.getLength() != 0 ) + initialize( aArguments ); } - static uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames_SpriteCanvas() + void SpriteCanvas::initialize( const uno::Sequence< uno::Any >& aArguments ) { - uno::Sequence< ::rtl::OUString > aRet(1); - aRet[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME ) ); + VERBOSE_TRACE( "SpriteCanvas::initialize called" ); - return aRet; - } + // At index 1, we expect a system window handle here, + // containing a pointer to a valid window, on which to output + // At index 2, we expect the current window bound rect + CHECK_AND_THROW( aArguments.getLength() >= 4 && + aArguments[1].getValueTypeClass() == uno::TypeClass_LONG, + "SpriteCanvas::initialize: wrong number of arguments, or wrong types" ); -} + awt::Rectangle aRect; + aArguments[2] >>= aRect; + const ::basegfx::B2ISize aSize(aRect.Width, + aRect.Height); -namespace nullcanvas -{ - SpriteCanvas::SpriteCanvas( const uno::Reference< uno::XComponentContext >& rxContext ) : - mxComponentContext( rxContext ) - { + sal_Bool bIsFullscreen( sal_False ); + aArguments[3] >>= bIsFullscreen; + + // setup helper + maDeviceHelper.init( *this, + aSize, + bIsFullscreen ); + maCanvasHelper.init( maRedrawManager, + *this, + aSize, + false ); } void SAL_CALL SpriteCanvas::disposing() @@ -129,102 +145,23 @@ namespace nullcanvas mbSurfaceDirty ); } - void SAL_CALL SpriteCanvas::initialize( const uno::Sequence< uno::Any >& aArguments ) throw( uno::Exception, - uno::RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - - VERBOSE_TRACE( "SpriteCanvas::initialize called" ); - - // At index 1, we expect a system window handle here, - // containing a pointer to a valid window, on which to output - // At index 2, we expect the current window bound rect - CHECK_AND_THROW( aArguments.getLength() >= 4 && - aArguments[1].getValueTypeClass() == uno::TypeClass_LONG, - "SpriteCanvas::initialize: wrong number of arguments, or wrong types" ); - - awt::Rectangle aRect; - aArguments[2] >>= aRect; - const ::basegfx::B2ISize aSize(aRect.Width, - aRect.Height); - - sal_Bool bIsFullscreen( sal_False ); - aArguments[3] >>= bIsFullscreen; - - // setup helper - maDeviceHelper.init( *this, - aSize, - bIsFullscreen ); - maCanvasHelper.init( maRedrawManager, - *this, - aSize, - false ); - } - - ::rtl::OUString SAL_CALL SpriteCanvas::getImplementationName() throw( uno::RuntimeException ) - { - return getImplementationName_SpriteCanvas(); - } - - sal_Bool SAL_CALL SpriteCanvas::supportsService( const ::rtl::OUString& ServiceName ) throw( uno::RuntimeException ) - { - return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( SERVICE_NAME ) ); - } - - uno::Sequence< ::rtl::OUString > SAL_CALL SpriteCanvas::getSupportedServiceNames() throw( uno::RuntimeException ) - { - return getSupportedServiceNames_SpriteCanvas(); - } - ::rtl::OUString SAL_CALL SpriteCanvas::getServiceName( ) throw (uno::RuntimeException) { return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SERVICE_NAME ) ); } - uno::Reference< uno::XInterface > SAL_CALL SpriteCanvas::createInstance( const uno::Reference< uno::XComponentContext >& xContext ) throw ( uno::Exception ) - { - return uno::Reference< uno::XInterface >( static_cast<cppu::OWeakObject*>( new SpriteCanvas( xContext ) ) ); - } + namespace sdecl = comphelper::service_decl; +#if defined (__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ <= 3) + sdecl::class_<SpriteCanvas, sdecl::with_args<true> > serviceImpl; + const sdecl::ServiceDecl nullCanvasDecl( + serviceImpl, +#else + const sdecl::ServiceDecl nullCanvasDecl( + sdecl::class_<SpriteCanvas, sdecl::with_args<true> >(), +#endif + "com.sun.star.comp.rendering.NullCanvas", + SERVICE_NAME ); } -namespace -{ - /* shared lib exports implemented with helpers */ - static struct ::cppu::ImplementationEntry s_component_entries [] = - { - { - nullcanvas::SpriteCanvas::createInstance, getImplementationName_SpriteCanvas, - getSupportedServiceNames_SpriteCanvas, ::cppu::createSingleComponentFactory, - 0, 0 - }, - { 0, 0, 0, 0, 0, 0 } - }; -} - - -/* Exported UNO methods for registration and object creation. - ========================================================== - */ -extern "C" -{ - void SAL_CALL component_getImplementationEnvironment( const sal_Char** ppEnvTypeName, - uno_Environment** /*ppEnv*/ ) - { - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; - } - - sal_Bool SAL_CALL component_writeInfo( lang::XMultiServiceFactory* xMgr, - registry::XRegistryKey* xRegistry ) - { - return ::cppu::component_writeInfoHelper( - xMgr, xRegistry, s_component_entries ); - } - - void * SAL_CALL component_getFactory( sal_Char const* implName, - lang::XMultiServiceFactory* xMgr, - registry::XRegistryKey* xRegistry ) - { - return ::cppu::component_getFactoryHelper( - implName, xMgr, xRegistry, s_component_entries ); - } -} +// The C shared lib entry points +COMPHELPER_SERVICEDECL_EXPORTS1(nullcanvas::nullCanvasDecl) |