Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
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>
27 :
28 : using namespace ::svxform;
29 :
30 : //-----------------------------------------------------------------------------
31 48418 : ::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 )
32 : {
33 48418 : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xRet;
34 48418 : if ( rServiceSpecifier.startsWith( "com.sun.star.form.component." ) )
35 : {
36 289 : css::uno::Reference<css::uno::XComponentContext> xContext = comphelper::getProcessComponentContext();
37 289 : xRet = xContext->getServiceManager()->createInstanceWithContext(rServiceSpecifier, xContext);
38 : }
39 48129 : else if ( rServiceSpecifier == "com.sun.star.drawing.ControlShape" )
40 : {
41 301 : SdrObject* pObj = new FmFormObj();
42 301 : xRet = static_cast<cppu::OWeakObject*>(static_cast<SvxShape_UnoImplHelper*>(new SvxShapeControl(pObj)));
43 : }
44 48418 : if (!xRet.is())
45 47828 : xRet = SvxUnoDrawMSFactory::createInstance(rServiceSpecifier);
46 48226 : return xRet;
47 : }
48 :
49 : //-----------------------------------------------------------------------------
50 0 : ::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 )
51 : {
52 0 : return SvxUnoDrawMSFactory::createInstanceWithArguments(ServiceSpecifier, Arguments );
53 : }
54 :
55 : //-----------------------------------------------------------------------------
56 103 : ::com::sun::star::uno::Sequence< OUString > SAL_CALL SvxFmMSFactory::getAvailableServiceNames(void) throw( ::com::sun::star::uno::RuntimeException )
57 : {
58 : static const OUString aSvxComponentServiceNameList[] =
59 : {
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
79 120 : };
80 :
81 : static const sal_uInt16 nSvxComponentServiceNameListCount = sizeof(aSvxComponentServiceNameList) / sizeof ( aSvxComponentServiceNameList[0] );
82 :
83 103 : ::com::sun::star::uno::Sequence< OUString > aSeq( nSvxComponentServiceNameListCount );
84 103 : OUString* pStrings = aSeq.getArray();
85 2060 : for( sal_uInt16 nIdx = 0; nIdx < nSvxComponentServiceNameListCount; nIdx++ )
86 1957 : pStrings[nIdx] = aSvxComponentServiceNameList[nIdx];
87 :
88 206 : ::com::sun::star::uno::Sequence< OUString > aParentSeq( SvxUnoDrawMSFactory::getAvailableServiceNames() );
89 206 : return concatServiceNames( aParentSeq, aSeq );
90 258 : }
91 :
92 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|