diff options
author | Matúš Kukan <matus.kukan@collabora.com> | 2013-12-30 13:19:36 +0100 |
---|---|---|
committer | Matúš Kukan <matus.kukan@collabora.com> | 2013-12-31 13:25:52 +0100 |
commit | 5bf7b06c937ef08478831bc42b344dc96986a881 (patch) | |
tree | 973bc20e467531a783e0e11062c79e6f67edb90a /svx/source/customshapes | |
parent | 2978ddf60d9cc0aced1c3804cd489b47c63bcf6d (diff) |
svx: Constructor feature for last implementations in svx component.
Change-Id: Ifc021eabce9ae3dbd1a54edefda7d3ae3eb67b53
Diffstat (limited to 'svx/source/customshapes')
-rw-r--r-- | svx/source/customshapes/EnhancedCustomShapeEngine.cxx | 102 | ||||
-rw-r--r-- | svx/source/customshapes/EnhancedCustomShapeEngine.hxx | 96 |
2 files changed, 83 insertions, 115 deletions
diff --git a/svx/source/customshapes/EnhancedCustomShapeEngine.cxx b/svx/source/customshapes/EnhancedCustomShapeEngine.cxx index bfaa79119530..b9bc674c4d14 100644 --- a/svx/source/customshapes/EnhancedCustomShapeEngine.cxx +++ b/svx/source/customshapes/EnhancedCustomShapeEngine.cxx @@ -17,7 +17,14 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include "EnhancedCustomShapeEngine.hxx" +#include <com/sun/star/uno/Reference.h> +#include <com/sun/star/uno/RuntimeException.hpp> +#include <com/sun/star/awt/Rectangle.hpp> +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/drawing/XCustomShapeEngine.hpp> #include "svx/EnhancedCustomShape2d.hxx" #include "EnhancedCustomShape3d.hxx" #include "EnhancedCustomShapeFontWork.hxx" @@ -42,29 +49,61 @@ #include <basegfx/polygon/b2dpolypolygontools.hxx> #include <basegfx/tools/unotools.hxx> #include <com/sun/star/document/XActionLockable.hpp> +#include <cppuhelper/implbase3.hxx> #include <cppuhelper/supportsservice.hxx> using namespace css; using namespace css::uno; -// - EnhancedCustomShapeEngine - -OUString EnhancedCustomShapeEngine_getImplementationName() - throw( RuntimeException ) -{ - return OUString( "com.sun.star.drawing.EnhancedCustomShapeEngine" ); -} +class SdrObject; +class SdrObjCustomShape; -Sequence< OUString > SAL_CALL EnhancedCustomShapeEngine_getSupportedServiceNames() - throw( RuntimeException ) -{ - Sequence< OUString > aRet(1); - OUString* pArray = aRet.getArray(); - pArray[0] = "com.sun.star.drawing.CustomShapeEngine"; - return aRet; -} +namespace { -EnhancedCustomShapeEngine::EnhancedCustomShapeEngine( const Reference< lang::XMultiServiceFactory >& rxMgr ) : - mxFact ( rxMgr ), +class EnhancedCustomShapeEngine : public cppu::WeakImplHelper3 +< + css::lang::XInitialization, + css::lang::XServiceInfo, + css::drawing::XCustomShapeEngine +> +{ + css::uno::Reference< css::drawing::XShape > mxShape; + sal_Bool mbForceGroupWithText; + + SdrObject* ImplForceGroupWithText( const SdrObjCustomShape* pCustoObj, SdrObject* pRenderedShape ); + +public: + EnhancedCustomShapeEngine(); + virtual ~EnhancedCustomShapeEngine(); + + // XInterface + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + + // XInitialization + virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) + throw ( css::uno::Exception, css::uno::RuntimeException ); + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() + throw ( css::uno::RuntimeException ); + virtual sal_Bool SAL_CALL supportsService( const OUString& rServiceName ) + throw ( css::uno::RuntimeException ); + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() + throw ( css::uno::RuntimeException ); + + // XCustomShapeEngine + virtual css::uno::Reference< css::drawing::XShape > SAL_CALL render() + throw ( css::uno::RuntimeException ); + virtual css::awt::Rectangle SAL_CALL getTextBounds() + throw ( css::uno::RuntimeException ); + virtual css::drawing::PolyPolygonBezierCoords SAL_CALL getLineGeometry() + throw ( css::uno::RuntimeException ); + virtual css::uno::Sequence< css::uno::Reference< css::drawing::XCustomShapeHandle > > SAL_CALL getInteraction() + throw ( css::uno::RuntimeException ); +}; + +EnhancedCustomShapeEngine::EnhancedCustomShapeEngine() : mbForceGroupWithText ( sal_False ) { } @@ -109,7 +148,7 @@ void SAL_CALL EnhancedCustomShapeEngine::initialize( const Sequence< Any >& aArg OUString SAL_CALL EnhancedCustomShapeEngine::getImplementationName() throw( RuntimeException ) { - return EnhancedCustomShapeEngine_getImplementationName(); + return OUString( "com.sun.star.drawing.EnhancedCustomShapeEngine" ); } sal_Bool SAL_CALL EnhancedCustomShapeEngine::supportsService( const OUString& rServiceName ) throw( RuntimeException ) @@ -119,7 +158,10 @@ sal_Bool SAL_CALL EnhancedCustomShapeEngine::supportsService( const OUString& rS Sequence< OUString > SAL_CALL EnhancedCustomShapeEngine::getSupportedServiceNames() throw ( RuntimeException ) { - return EnhancedCustomShapeEngine_getSupportedServiceNames(); + Sequence< OUString > aRet(1); + OUString* pArray = aRet.getArray(); + pArray[0] = "com.sun.star.drawing.CustomShapeEngine"; + return aRet; } // XCustomShapeEngine ----------------------------------------------------------- @@ -444,4 +486,26 @@ Sequence< Reference< drawing::XCustomShapeHandle > > SAL_CALL EnhancedCustomShap return aSeq; } +} + +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL +com_sun_star_drawing_EnhancedCustomShapeEngine_implementation_getFactory( + SAL_UNUSED_PARAMETER css::uno::XComponentContext *, + uno_Sequence * arguments) +{ + assert(arguments != 0); + css::uno::Reference<css::uno::XInterface> x( + static_cast<cppu::OWeakObject *>(new EnhancedCustomShapeEngine)); + x->acquire(); + css::uno::Reference< css::lang::XInitialization > xx(x, css::uno::UNO_QUERY); + if (xx.is()) + { + css::uno::Sequence<css::uno::Any> aArgs( + reinterpret_cast<css::uno::Any *>(arguments->elements), + arguments->nElements); + xx->initialize(aArgs); + } + return x.get(); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/customshapes/EnhancedCustomShapeEngine.hxx b/svx/source/customshapes/EnhancedCustomShapeEngine.hxx deleted file mode 100644 index ae90045a1f87..000000000000 --- a/svx/source/customshapes/EnhancedCustomShapeEngine.hxx +++ /dev/null @@ -1,96 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef INCLUDED_SVX_SOURCE_CUSTOMSHAPES_ENHANCEDCUSTOMSHAPEENGINE_HXX -#define INCLUDED_SVX_SOURCE_CUSTOMSHAPES_ENHANCEDCUSTOMSHAPEENGINE_HXX - -#include <com/sun/star/uno/Reference.h> -#include <com/sun/star/uno/RuntimeException.hpp> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/lang/XComponent.hpp> -#include <com/sun/star/registry/XRegistryKey.hpp> -#include <cppuhelper/implbase3.hxx> -#include <com/sun/star/awt/Rectangle.hpp> -#include <com/sun/star/beans/PropertyValue.hpp> -#include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp> -#include <com/sun/star/lang/XInitialization.hpp> -#include <com/sun/star/lang/XServiceInfo.hpp> -#include <com/sun/star/drawing/XCustomShapeEngine.hpp> - -// --------------------------- -// - EnhancedCustomShapeEngine - -// --------------------------- -// - -class SdrObject; -class SdrObjCustomShape; -class EnhancedCustomShapeEngine : public cppu::WeakImplHelper3 -< - css::lang::XInitialization, - css::lang::XServiceInfo, - css::drawing::XCustomShapeEngine -> -{ - css::uno::Reference< css::lang::XMultiServiceFactory > mxFact; - css::uno::Reference< css::drawing::XShape > mxShape; - sal_Bool mbForceGroupWithText; - - SdrObject* ImplForceGroupWithText( const SdrObjCustomShape* pCustoObj, SdrObject* pRenderedShape ); - -public: - EnhancedCustomShapeEngine( const css::uno::Reference< css::lang::XMultiServiceFactory >& rxMgr ); - virtual ~EnhancedCustomShapeEngine(); - - // XInterface - virtual void SAL_CALL acquire() throw(); - virtual void SAL_CALL release() throw(); - - // XInitialization - virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) - throw ( css::uno::Exception, css::uno::RuntimeException ); - - // XServiceInfo - virtual OUString SAL_CALL getImplementationName() - throw ( css::uno::RuntimeException ); - virtual sal_Bool SAL_CALL supportsService( const OUString& rServiceName ) - throw ( css::uno::RuntimeException ); - virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() - throw ( css::uno::RuntimeException ); - - // XCustomShapeEngine - virtual css::uno::Reference< css::drawing::XShape > SAL_CALL render() - throw ( css::uno::RuntimeException ); - virtual css::awt::Rectangle SAL_CALL getTextBounds() - throw ( css::uno::RuntimeException ); - virtual css::drawing::PolyPolygonBezierCoords SAL_CALL getLineGeometry() - throw ( css::uno::RuntimeException ); - virtual css::uno::Sequence< css::uno::Reference< css::drawing::XCustomShapeHandle > > SAL_CALL getInteraction() - throw ( css::uno::RuntimeException ); -}; - -OUString EnhancedCustomShapeEngine_getImplementationName() - throw ( css::uno::RuntimeException ); -sal_Bool SAL_CALL EnhancedCustomShapeEngine_supportsService( const OUString& rServiceName ) - throw( css::uno::RuntimeException ); -css::uno::Sequence< OUString > SAL_CALL EnhancedCustomShapeEngine_getSupportedServiceNames() - throw( css::uno::RuntimeException ); - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |