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 3553 : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL SvxFmMSFactory::createInstance(const ::rtl::OUString& ServiceSpecifier) throw( ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException )
32 : {
33 3553 : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xRet;
34 3553 : if ( ServiceSpecifier.indexOf( "com.sun.star.form.component." ) == 0 )
35 : {
36 8 : xRet = ::comphelper::getProcessServiceFactory()->createInstance(ServiceSpecifier);
37 : }
38 3545 : else if ( ServiceSpecifier == "com.sun.star.drawing.ControlShape" )
39 : {
40 9 : SdrObject* pObj = new FmFormObj();
41 9 : xRet = static_cast<cppu::OWeakObject*>(static_cast<SvxShape_UnoImplHelper*>(new SvxShapeControl(pObj)));
42 : }
43 3553 : if (!xRet.is())
44 3536 : xRet = SvxUnoDrawMSFactory::createInstance(ServiceSpecifier);
45 3553 : return xRet;
46 : }
47 :
48 : //-----------------------------------------------------------------------------
49 0 : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL SvxFmMSFactory::createInstanceWithArguments(const ::rtl::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 )
50 : {
51 0 : return SvxUnoDrawMSFactory::createInstanceWithArguments(ServiceSpecifier, Arguments );
52 : }
53 :
54 : //-----------------------------------------------------------------------------
55 13 : ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL SvxFmMSFactory::getAvailableServiceNames(void) throw( ::com::sun::star::uno::RuntimeException )
56 : {
57 : static const ::rtl::OUString aSvxComponentServiceNameList[] =
58 : {
59 : FM_SUN_COMPONENT_TEXTFIELD,
60 : FM_SUN_COMPONENT_FORM,
61 : FM_SUN_COMPONENT_LISTBOX,
62 : FM_SUN_COMPONENT_COMBOBOX,
63 : FM_SUN_COMPONENT_RADIOBUTTON,
64 : FM_SUN_COMPONENT_GROUPBOX,
65 : FM_SUN_COMPONENT_FIXEDTEXT,
66 : FM_SUN_COMPONENT_COMMANDBUTTON,
67 : FM_SUN_COMPONENT_CHECKBOX,
68 : FM_SUN_COMPONENT_GRIDCONTROL,
69 : FM_SUN_COMPONENT_IMAGEBUTTON,
70 : FM_SUN_COMPONENT_FILECONTROL,
71 : FM_SUN_COMPONENT_TIMEFIELD,
72 : FM_SUN_COMPONENT_DATEFIELD,
73 : FM_SUN_COMPONENT_NUMERICFIELD,
74 : FM_SUN_COMPONENT_CURRENCYFIELD,
75 : FM_SUN_COMPONENT_PATTERNFIELD,
76 : FM_SUN_COMPONENT_HIDDENCONTROL,
77 : FM_SUN_COMPONENT_IMAGECONTROL
78 17 : };
79 :
80 : static const sal_uInt16 nSvxComponentServiceNameListCount = sizeof(aSvxComponentServiceNameList) / sizeof ( aSvxComponentServiceNameList[0] );
81 :
82 13 : ::com::sun::star::uno::Sequence< ::rtl::OUString > aSeq( nSvxComponentServiceNameListCount );
83 13 : ::rtl::OUString* pStrings = aSeq.getArray();
84 260 : for( sal_uInt16 nIdx = 0; nIdx < nSvxComponentServiceNameListCount; nIdx++ )
85 247 : pStrings[nIdx] = aSvxComponentServiceNameList[nIdx];
86 :
87 13 : ::com::sun::star::uno::Sequence< ::rtl::OUString > aParentSeq( SvxUnoDrawMSFactory::getAvailableServiceNames() );
88 13 : return concatServiceNames( aParentSeq, aSeq );
89 : }
90 :
91 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|