diff options
Diffstat (limited to 'svx/source/customshapes/EnhancedCustomShapeEngine.cxx')
-rw-r--r-- | svx/source/customshapes/EnhancedCustomShapeEngine.cxx | 102 |
1 files changed, 83 insertions, 19 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: */ |