diff options
author | Noel Grandin <noel@peralex.com> | 2015-10-07 12:31:48 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2015-10-07 12:32:23 +0200 |
commit | bb76b8f10697f3d5ca1f9a2f19902b043bd61cd7 (patch) | |
tree | d1f281ec29326f373394b61fb5253a35d1fef25f /svx/source/unodraw | |
parent | 5dbbb498b5e2ae8be9dcd10ddfc65de5266c0d15 (diff) |
loplugin:mergeclasses
Change-Id: I8f5c2ae658f8784233db98f752b6f9fa53110195
Diffstat (limited to 'svx/source/unodraw')
-rw-r--r-- | svx/source/unodraw/unomod.cxx | 61 |
1 files changed, 55 insertions, 6 deletions
diff --git a/svx/source/unodraw/unomod.cxx b/svx/source/unodraw/unomod.cxx index 1f1b2e5a7c59..b6fc50a58fcb 100644 --- a/svx/source/unodraw/unomod.cxx +++ b/svx/source/unodraw/unomod.cxx @@ -26,6 +26,7 @@ #include <svtools/unoevent.hxx> #include <comphelper/sequence.hxx> #include <comphelper/servicehelper.hxx> +#include <comphelper/processfactory.hxx> #include <cppuhelper/supportsservice.hxx> #include <cppuhelper/implbase.hxx> @@ -50,6 +51,8 @@ #include <svx/svdpage.hxx> #include <svx/unoshape.hxx> #include <svx/xmlgrhlp.hxx> +#include <fmobj.hxx> +#include "fmservs.hxx" #include <com/sun/star/text/textfield/Type.hpp> @@ -196,10 +199,23 @@ css::uno::Reference<css::uno::XInterface> create( } -uno::Reference< uno::XInterface > SAL_CALL SvxUnoDrawMSFactory::createInstance( const OUString& rServiceSpecifier ) +uno::Reference< uno::XInterface > SAL_CALL SvxUnoDrawMSFactory::createInstance(const OUString& rServiceSpecifier) throw( uno::Exception, uno::RuntimeException, std::exception ) { - return create(rServiceSpecifier, ""); + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xRet; + if ( rServiceSpecifier.startsWith( "com.sun.star.form.component." ) ) + { + css::uno::Reference<css::uno::XComponentContext> xContext = comphelper::getProcessComponentContext(); + xRet = xContext->getServiceManager()->createInstanceWithContext(rServiceSpecifier, xContext); + } + else if ( rServiceSpecifier == "com.sun.star.drawing.ControlShape" ) + { + SdrObject* pObj = new FmFormObj(); + xRet = static_cast<cppu::OWeakObject*>(static_cast<SvxShape_UnoImplHelper*>(new SvxShapeControl(pObj))); + } + if (!xRet.is()) + xRet = create(rServiceSpecifier, ""); + return xRet; } uno::Reference< uno::XInterface > SAL_CALL SvxUnoDrawMSFactory::createTextField( const OUString& ServiceSpecifier ) throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException) @@ -220,12 +236,45 @@ uno::Reference< uno::XInterface > SAL_CALL SvxUnoDrawMSFactory::createInstanceWi throw lang::NoSupportException(); } + uno::Sequence< OUString > SAL_CALL SvxUnoDrawMSFactory::getAvailableServiceNames() throw( uno::RuntimeException, std::exception ) { - return UHashMap::getServiceNames(); + static const OUString aSvxComponentServiceNameList[] = + { + OUString(FM_SUN_COMPONENT_TEXTFIELD), + OUString(FM_SUN_COMPONENT_FORM), + OUString(FM_SUN_COMPONENT_LISTBOX), + OUString(FM_SUN_COMPONENT_COMBOBOX), + OUString(FM_SUN_COMPONENT_RADIOBUTTON), + OUString(FM_SUN_COMPONENT_GROUPBOX), + OUString(FM_SUN_COMPONENT_FIXEDTEXT), + OUString(FM_SUN_COMPONENT_COMMANDBUTTON), + OUString(FM_SUN_COMPONENT_CHECKBOX), + OUString(FM_SUN_COMPONENT_GRIDCONTROL), + OUString(FM_SUN_COMPONENT_IMAGEBUTTON), + OUString(FM_SUN_COMPONENT_FILECONTROL), + OUString(FM_SUN_COMPONENT_TIMEFIELD), + OUString(FM_SUN_COMPONENT_DATEFIELD), + OUString(FM_SUN_COMPONENT_NUMERICFIELD), + OUString(FM_SUN_COMPONENT_CURRENCYFIELD), + OUString(FM_SUN_COMPONENT_PATTERNFIELD), + OUString(FM_SUN_COMPONENT_HIDDENCONTROL), + OUString(FM_SUN_COMPONENT_IMAGECONTROL) + }; + + static const sal_uInt16 nSvxComponentServiceNameListCount = SAL_N_ELEMENTS(aSvxComponentServiceNameList); + + uno::Sequence< OUString > aSeq( nSvxComponentServiceNameListCount ); + OUString* pStrings = aSeq.getArray(); + for( sal_uInt16 nIdx = 0; nIdx < nSvxComponentServiceNameListCount; nIdx++ ) + pStrings[nIdx] = aSvxComponentServiceNameList[nIdx]; + + uno::Sequence< OUString > aParentSeq( UHashMap::getServiceNames() ); + return concatServiceNames( aParentSeq, aSeq ); } + uno::Sequence< OUString > SvxUnoDrawMSFactory::concatServiceNames( uno::Sequence< OUString >& rServices1, uno::Sequence< OUString >& rServices2 ) throw() { const sal_Int32 nLen1 = rServices1.getLength(); @@ -349,7 +398,7 @@ uno::Reference< drawing::XDrawPages > SAL_CALL SvxUnoDrawingModel::getDrawPages( return xDrawPages; } -// XMultiServiceFactory ( SvxFmMSFactory ) +// XMultiServiceFactory ( SvxUnoDrawMSFactory ) uno::Reference< uno::XInterface > SAL_CALL SvxUnoDrawingModel::createInstance( const OUString& aServiceSpecifier ) throw(uno::Exception, uno::RuntimeException, std::exception) { @@ -503,7 +552,7 @@ uno::Reference< uno::XInterface > SAL_CALL SvxUnoDrawingModel::createInstance( c } else { - xRet = SvxFmMSFactory::createInstance( aServiceSpecifier ); + xRet = SvxUnoDrawMSFactory::createInstance( aServiceSpecifier ); } return xRet; @@ -512,7 +561,7 @@ uno::Reference< uno::XInterface > SAL_CALL SvxUnoDrawingModel::createInstance( c uno::Sequence< OUString > SAL_CALL SvxUnoDrawingModel::getAvailableServiceNames() throw(uno::RuntimeException, std::exception) { - const uno::Sequence< OUString > aSNS_ORG( SvxFmMSFactory::getAvailableServiceNames() ); + const uno::Sequence< OUString > aSNS_ORG( SvxUnoDrawMSFactory::getAvailableServiceNames() ); uno::Sequence< OUString > aSNS( 21 ); |