diff options
author | Noel Grandin <noel@peralex.com> | 2015-11-05 11:33:34 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2015-11-05 12:02:00 +0200 |
commit | 609b22787392be4c2eac6fe098a70341a4c204e4 (patch) | |
tree | 75a40671862b9dbe2c8acd6e0e6fbeb39a8c1ac2 /svx | |
parent | 2fe02d55d72a808dd79ba9529bc5078a45175c16 (diff) |
fix tdf#95488, crash in report wizard
This reverts commit bb76b8f10697f3d5ca1f9a2f19902b043bd61cd7
"loplugin:mergeclasses"
Change-Id: Ib65459ab45cd4cefa859ed75f9ddc4f070879b1d
Diffstat (limited to 'svx')
-rw-r--r-- | svx/Library_svxcore.mk | 1 | ||||
-rw-r--r-- | svx/source/form/fmdmod.cxx | 100 | ||||
-rw-r--r-- | svx/source/unodraw/unomod.cxx | 61 |
3 files changed, 107 insertions, 55 deletions
diff --git a/svx/Library_svxcore.mk b/svx/Library_svxcore.mk index 837a86521614..ca9e5c5d0d0d 100644 --- a/svx/Library_svxcore.mk +++ b/svx/Library_svxcore.mk @@ -427,6 +427,7 @@ $(eval $(call gb_Library_add_exception_objects,svxcore,\ svx/source/form/delayedevent \ svx/source/form/fmcontrolbordermanager \ svx/source/form/fmcontrollayout \ + svx/source/form/fmdmod \ svx/source/form/fmdocumentclassification \ svx/source/form/fmdpage \ svx/source/form/fmexch \ diff --git a/svx/source/form/fmdmod.cxx b/svx/source/form/fmdmod.cxx new file mode 100644 index 000000000000..bb63fed3b326 --- /dev/null +++ b/svx/source/form/fmdmod.cxx @@ -0,0 +1,100 @@ +/* -*- 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 . + */ + +#include <sal/macros.h> +#include <svx/fmdmod.hxx> +#include "fmservs.hxx" +#include <fmobj.hxx> +#include <svx/unoshape.hxx> +#include <comphelper/processfactory.hxx> +#include <svx/fmglob.hxx> + +using namespace ::svxform; + + +::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL SvxFmMSFactory::createInstance(const OUString& rServiceSpecifier) throw( ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException, std::exception ) +{ + ::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 = SvxUnoDrawMSFactory::createInstance(rServiceSpecifier); + return xRet; +} + + + +// Encapsulation violation: We *know* that +// SvxUnoDrawMSFactory::createInstanceWithArguments() always throws. + +SAL_WNOUNREACHABLE_CODE_PUSH + +::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL SvxFmMSFactory::createInstanceWithArguments(const OUString& ServiceSpecifier, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Arguments) throw( ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException, std::exception ) +{ + return SvxUnoDrawMSFactory::createInstanceWithArguments(ServiceSpecifier, Arguments ); +} + +SAL_WNOUNREACHABLE_CODE_POP + + +::com::sun::star::uno::Sequence< OUString > SAL_CALL SvxFmMSFactory::getAvailableServiceNames() throw( ::com::sun::star::uno::RuntimeException, std::exception ) +{ + 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 = sizeof(aSvxComponentServiceNameList) / sizeof ( aSvxComponentServiceNameList[0] ); + + ::com::sun::star::uno::Sequence< OUString > aSeq( nSvxComponentServiceNameListCount ); + OUString* pStrings = aSeq.getArray(); + for( sal_uInt16 nIdx = 0; nIdx < nSvxComponentServiceNameListCount; nIdx++ ) + pStrings[nIdx] = aSvxComponentServiceNameList[nIdx]; + + ::com::sun::star::uno::Sequence< OUString > aParentSeq( SvxUnoDrawMSFactory::getAvailableServiceNames() ); + return concatServiceNames( aParentSeq, aSeq ); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/unodraw/unomod.cxx b/svx/source/unodraw/unomod.cxx index de6a352ce31c..7c6b9d748ac4 100644 --- a/svx/source/unodraw/unomod.cxx +++ b/svx/source/unodraw/unomod.cxx @@ -26,7 +26,6 @@ #include <svtools/unoevent.hxx> #include <comphelper/sequence.hxx> #include <comphelper/servicehelper.hxx> -#include <comphelper/processfactory.hxx> #include <cppuhelper/supportsservice.hxx> #include <cppuhelper/implbase.hxx> @@ -51,8 +50,6 @@ #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> @@ -199,23 +196,10 @@ 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 ) { - css::uno::Reference< css::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; + return create(rServiceSpecifier, ""); } uno::Reference< uno::XInterface > SAL_CALL SvxUnoDrawMSFactory::createTextField( const OUString& ServiceSpecifier ) throw(css::uno::Exception, css::uno::RuntimeException) @@ -236,45 +220,12 @@ uno::Reference< uno::XInterface > SAL_CALL SvxUnoDrawMSFactory::createInstanceWi throw lang::NoSupportException(); } - uno::Sequence< OUString > SAL_CALL SvxUnoDrawMSFactory::getAvailableServiceNames() throw( uno::RuntimeException, std::exception ) { - 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 ); + return UHashMap::getServiceNames(); } - uno::Sequence< OUString > SvxUnoDrawMSFactory::concatServiceNames( uno::Sequence< OUString >& rServices1, uno::Sequence< OUString >& rServices2 ) throw() { const sal_Int32 nLen1 = rServices1.getLength(); @@ -398,7 +349,7 @@ uno::Reference< drawing::XDrawPages > SAL_CALL SvxUnoDrawingModel::getDrawPages( return xDrawPages; } -// XMultiServiceFactory ( SvxUnoDrawMSFactory ) +// XMultiServiceFactory ( SvxFmMSFactory ) uno::Reference< uno::XInterface > SAL_CALL SvxUnoDrawingModel::createInstance( const OUString& aServiceSpecifier ) throw(uno::Exception, uno::RuntimeException, std::exception) { @@ -552,7 +503,7 @@ uno::Reference< uno::XInterface > SAL_CALL SvxUnoDrawingModel::createInstance( c } else { - xRet = SvxUnoDrawMSFactory::createInstance( aServiceSpecifier ); + xRet = SvxFmMSFactory::createInstance( aServiceSpecifier ); } return xRet; @@ -561,7 +512,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( SvxUnoDrawMSFactory::getAvailableServiceNames() ); + const uno::Sequence< OUString > aSNS_ORG( SvxFmMSFactory::getAvailableServiceNames() ); uno::Sequence< OUString > aSNS( 21 ); |