bump product version to 4.1.6.2
[LibreOffice.git] / svx / source / form / fmdmod.cxx
blobe5092ebe4fb376aaf2907cd4f88c8dc347d64e44
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <sal/macros.h>
21 #include <svx/fmdmod.hxx>
22 #include "fmservs.hxx"
23 #include <fmobj.hxx>
24 #include <svx/unoshape.hxx>
25 #include <comphelper/processfactory.hxx>
26 #include <svx/fmglob.hxx>
28 using namespace ::svxform;
30 //-----------------------------------------------------------------------------
31 ::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 )
33 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xRet;
34 if ( rServiceSpecifier.startsWith( "com.sun.star.form.component." ) )
36 css::uno::Reference<css::uno::XComponentContext> xContext = comphelper::getProcessComponentContext();
37 xRet = xContext->getServiceManager()->createInstanceWithContext(rServiceSpecifier, xContext);
39 else if ( rServiceSpecifier == "com.sun.star.drawing.ControlShape" )
41 SdrObject* pObj = new FmFormObj();
42 xRet = static_cast<cppu::OWeakObject*>(static_cast<SvxShape_UnoImplHelper*>(new SvxShapeControl(pObj)));
44 if (!xRet.is())
45 xRet = SvxUnoDrawMSFactory::createInstance(rServiceSpecifier);
46 return xRet;
49 //-----------------------------------------------------------------------------
50 ::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 )
52 return SvxUnoDrawMSFactory::createInstanceWithArguments(ServiceSpecifier, Arguments );
55 //-----------------------------------------------------------------------------
56 ::com::sun::star::uno::Sequence< OUString > SAL_CALL SvxFmMSFactory::getAvailableServiceNames(void) throw( ::com::sun::star::uno::RuntimeException )
58 static const OUString aSvxComponentServiceNameList[] =
60 FM_SUN_COMPONENT_TEXTFIELD,
61 FM_SUN_COMPONENT_FORM,
62 FM_SUN_COMPONENT_LISTBOX,
63 FM_SUN_COMPONENT_COMBOBOX,
64 FM_SUN_COMPONENT_RADIOBUTTON,
65 FM_SUN_COMPONENT_GROUPBOX,
66 FM_SUN_COMPONENT_FIXEDTEXT,
67 FM_SUN_COMPONENT_COMMANDBUTTON,
68 FM_SUN_COMPONENT_CHECKBOX,
69 FM_SUN_COMPONENT_GRIDCONTROL,
70 FM_SUN_COMPONENT_IMAGEBUTTON,
71 FM_SUN_COMPONENT_FILECONTROL,
72 FM_SUN_COMPONENT_TIMEFIELD,
73 FM_SUN_COMPONENT_DATEFIELD,
74 FM_SUN_COMPONENT_NUMERICFIELD,
75 FM_SUN_COMPONENT_CURRENCYFIELD,
76 FM_SUN_COMPONENT_PATTERNFIELD,
77 FM_SUN_COMPONENT_HIDDENCONTROL,
78 FM_SUN_COMPONENT_IMAGECONTROL
81 static const sal_uInt16 nSvxComponentServiceNameListCount = sizeof(aSvxComponentServiceNameList) / sizeof ( aSvxComponentServiceNameList[0] );
83 ::com::sun::star::uno::Sequence< OUString > aSeq( nSvxComponentServiceNameListCount );
84 OUString* pStrings = aSeq.getArray();
85 for( sal_uInt16 nIdx = 0; nIdx < nSvxComponentServiceNameListCount; nIdx++ )
86 pStrings[nIdx] = aSvxComponentServiceNameList[nIdx];
88 ::com::sun::star::uno::Sequence< OUString > aParentSeq( SvxUnoDrawMSFactory::getAvailableServiceNames() );
89 return concatServiceNames( aParentSeq, aSeq );
92 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */