Kaydet (Commit) 5bf7b06c authored tarafından Matúš Kukan's avatar Matúš Kukan

svx: Constructor feature for last implementations in svx component.

Change-Id: Ifc021eabce9ae3dbd1a54edefda7d3ae3eb67b53
üst 2978ddf6
......@@ -45,7 +45,6 @@ core_factory_list = [
("libspelllo.a", "spell_component_getFactory"),
("libsvllo.a", "svl_component_getFactory"),
("libsvtlo.a", "svt_component_getFactory"),
("libsvxlo.a", "svx_component_getFactory"),
("libtklo.a", "tk_component_getFactory"),
("libucb1.a", "ucb_component_getFactory"),
("libucpexpand1lo.a", "ucpexpand1_component_getFactory"),
......@@ -143,6 +142,9 @@ core_constructor_list = [
"com_sun_star_comp_stoc_SimpleRegistry",
"com_sun_star_security_comp_stoc_AccessController",
"com_sun_star_security_comp_stoc_FilePolicy",
# svx/util/svx.component
# FIXME: what is missing ?
"com_sun_star_drawing_SvxShapeCollection_implementation_getFactory",
]
# Components which are not in any group yet:
......
......@@ -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: */
/* -*- 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: */
......@@ -20,17 +20,15 @@
#include <unotools/pathoptions.hxx>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <cppuhelper/implbase2.hxx>
#include "../customshapes/EnhancedCustomShapeEngine.hxx"
#include <svx/xtable.hxx>
using namespace ::com::sun::star;
using namespace ::rtl;
using namespace ::cppu;
class SvxUnoColorTable : public WeakImplHelper2< container::XNameContainer, lang::XServiceInfo >
namespace {
class SvxUnoColorTable : public cppu::WeakImplHelper2< container::XNameContainer, lang::XServiceInfo >
{
private:
XColorListRef pList;
......@@ -44,13 +42,6 @@ public:
virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw( uno::RuntimeException);
virtual uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw( uno::RuntimeException);
static OUString getImplementationName_Static() throw()
{
return OUString("com.sun.star.drawing.SvxUnoColorTable");
}
static uno::Sequence< OUString > getSupportedServiceNames_Static(void) throw();
// XNameContainer
virtual void SAL_CALL insertByName( const OUString& aName, const uno::Any& aElement ) throw( lang::IllegalArgumentException, container::ElementExistException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL removeByName( const OUString& Name ) throw( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException);
......@@ -93,16 +84,11 @@ sal_Bool SAL_CALL SvxUnoColorTable::supportsService( const OUString& ServiceNam
OUString SAL_CALL SvxUnoColorTable::getImplementationName() throw( uno::RuntimeException )
{
return OUString("SvxUnoColorTable");
return OUString("com.sun.star.drawing.SvxUnoColorTable");
}
uno::Sequence< OUString > SAL_CALL SvxUnoColorTable::getSupportedServiceNames()
throw( uno::RuntimeException )
{
return getSupportedServiceNames_Static();
}
uno::Sequence< OUString > SvxUnoColorTable::getSupportedServiceNames_Static(void) throw()
{
uno::Sequence< OUString > aSNS( 1 );
aSNS.getArray()[0] = "com.sun.star.drawing.ColorTable";
......@@ -202,63 +188,18 @@ sal_Bool SAL_CALL SvxUnoColorTable::hasElements()
return pList.is() && pList->Count() != 0;
}
/**
* Create a colortable
*/
uno::Reference< uno::XInterface > SAL_CALL SvxUnoColorTable_createInstance(const uno::Reference< lang::XMultiServiceFactory > & ) throw(uno::Exception)
{
return *new SvxUnoColorTable();
}
uno::Reference< uno::XInterface > SAL_CALL create_EnhancedCustomShapeEngine( const uno::Reference< lang::XMultiServiceFactory >& rxFact ) throw(uno::Exception)
{
return *new EnhancedCustomShapeEngine( rxFact );
}
//
// export this service
//
#include <com/sun/star/registry/XRegistryKey.hpp>
#include "sal/types.h"
#include "osl/diagnose.h"
#include "cppuhelper/factory.hxx"
extern "C"
{
SAL_DLLPUBLIC_EXPORT void * SAL_CALL svx_component_getFactory (
const sal_Char * pImplName, void * pServiceManager, void * )
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
com_sun_star_drawing_SvxUnoColorTable_implementation_getFactory(
SAL_UNUSED_PARAMETER css::uno::XComponentContext *,
uno_Sequence * arguments)
{
void * pRet = 0;
if( pServiceManager )
{
uno::Reference< lang::XSingleServiceFactory > xFactory;
if( rtl_str_compare( pImplName, "com.sun.star.drawing.SvxUnoColorTable" ) == 0 )
{
xFactory = createSingleFactory( reinterpret_cast< lang::XMultiServiceFactory * >( pServiceManager ),
SvxUnoColorTable::getImplementationName_Static(),
SvxUnoColorTable_createInstance,
SvxUnoColorTable::getSupportedServiceNames_Static() );
}
else if ( rtl_str_compare( pImplName, "com.sun.star.drawing.EnhancedCustomShapeEngine" ) == 0 )
{
xFactory = createSingleFactory( reinterpret_cast< lang::XMultiServiceFactory* >( pServiceManager ),
EnhancedCustomShapeEngine_getImplementationName(),
create_EnhancedCustomShapeEngine,
EnhancedCustomShapeEngine_getSupportedServiceNames() );
}
if( xFactory.is())
{
xFactory->acquire();
pRet = xFactory.get();
}
}
return pRet;
}
assert(arguments != 0 && arguments->nElements == 0); (void) arguments;
css::uno::Reference<css::uno::XInterface> x(
static_cast<cppu::OWeakObject *>(new SvxUnoColorTable));
x->acquire();
return x.get();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -18,7 +18,7 @@
-->
<component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
prefix="svx" xmlns="http://openoffice.org/2010/uno-components">
xmlns="http://openoffice.org/2010/uno-components">
<implementation name="com.sun.star.comp.gallery.GalleryThemeProvider"
constructor="com_sun_star_comp_gallery_GalleryThemeProvider_implementation_getFactory">
<service name="com.sun.star.gallery.GalleryThemeProvider"/>
......@@ -32,14 +32,16 @@
constructor="com_sun_star_comp_svx_RecoveryUI_implementation_getFactory">
<service name="com.sun.star.dialog.RecoveryUI"/>
</implementation>
<implementation name="com.sun.star.drawing.EnhancedCustomShapeEngine">
<implementation name="com.sun.star.drawing.EnhancedCustomShapeEngine"
constructor="com_sun_star_drawing_EnhancedCustomShapeEngine_implementation_getFactory">
<service name="com.sun.star.drawing.CustomShapeEngine"/>
</implementation>
<implementation name="com.sun.star.drawing.SvxShapeCollection"
constructor="com_sun_star_drawing_SvxShapeCollection_implementation_getFactory">
<service name="com.sun.star.drawing.ShapeCollection"/>
</implementation>
<implementation name="com.sun.star.drawing.SvxUnoColorTable">
<implementation name="com.sun.star.drawing.SvxUnoColorTable"
constructor="com_sun_star_drawing_SvxUnoColorTable_implementation_getFactory">
<service name="com.sun.star.drawing.ColorTable"/>
</implementation>
<implementation name="com.sun.star.svx.DownSearchToolboxController"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment