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 0 : ::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 )
32 : {
33 0 : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xRet;
34 0 : if ( rServiceSpecifier.startsWith( "com.sun.star.form.component." ) )
35 : {
36 0 : css::uno::Reference<css::uno::XComponentContext> xContext = comphelper::getProcessComponentContext();
37 0 : xRet = xContext->getServiceManager()->createInstanceWithContext(rServiceSpecifier, xContext);
38 : }
39 0 : else if ( rServiceSpecifier == "com.sun.star.drawing.ControlShape" )
40 : {
41 0 : SdrObject* pObj = new FmFormObj();
42 0 : xRet = static_cast<cppu::OWeakObject*>(static_cast<SvxShape_UnoImplHelper*>(new SvxShapeControl(pObj)));
43 : }
44 0 : if (!xRet.is())
45 0 : xRet = SvxUnoDrawMSFactory::createInstance(rServiceSpecifier);
46 0 : return xRet;
47 : }
48 :
49 :
50 :
51 : // Encapsulation violation: We *know* that
52 : // SvxUnoDrawMSFactory::createInstanceWithArguments() always throws.
53 :
54 : SAL_WNOUNREACHABLE_CODE_PUSH
55 :
56 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, std::exception )
57 : {
58 0 : return SvxUnoDrawMSFactory::createInstanceWithArguments(ServiceSpecifier, Arguments );
59 : }
60 :
61 : SAL_WNOUNREACHABLE_CODE_POP
62 :
63 :
64 0 : ::com::sun::star::uno::Sequence< OUString > SAL_CALL SvxFmMSFactory::getAvailableServiceNames(void) throw( ::com::sun::star::uno::RuntimeException, std::exception )
65 : {
66 : static const OUString aSvxComponentServiceNameList[] =
67 : {
68 : FM_SUN_COMPONENT_TEXTFIELD,
69 : FM_SUN_COMPONENT_FORM,
70 : FM_SUN_COMPONENT_LISTBOX,
71 : FM_SUN_COMPONENT_COMBOBOX,
72 : FM_SUN_COMPONENT_RADIOBUTTON,
73 : FM_SUN_COMPONENT_GROUPBOX,
74 : FM_SUN_COMPONENT_FIXEDTEXT,
75 : FM_SUN_COMPONENT_COMMANDBUTTON,
76 : FM_SUN_COMPONENT_CHECKBOX,
77 : FM_SUN_COMPONENT_GRIDCONTROL,
78 : FM_SUN_COMPONENT_IMAGEBUTTON,
79 : FM_SUN_COMPONENT_FILECONTROL,
80 : FM_SUN_COMPONENT_TIMEFIELD,
81 : FM_SUN_COMPONENT_DATEFIELD,
82 : FM_SUN_COMPONENT_NUMERICFIELD,
83 : FM_SUN_COMPONENT_CURRENCYFIELD,
84 : FM_SUN_COMPONENT_PATTERNFIELD,
85 : FM_SUN_COMPONENT_HIDDENCONTROL,
86 : FM_SUN_COMPONENT_IMAGECONTROL
87 0 : };
88 :
89 : static const sal_uInt16 nSvxComponentServiceNameListCount = sizeof(aSvxComponentServiceNameList) / sizeof ( aSvxComponentServiceNameList[0] );
90 :
91 0 : ::com::sun::star::uno::Sequence< OUString > aSeq( nSvxComponentServiceNameListCount );
92 0 : OUString* pStrings = aSeq.getArray();
93 0 : for( sal_uInt16 nIdx = 0; nIdx < nSvxComponentServiceNameListCount; nIdx++ )
94 0 : pStrings[nIdx] = aSvxComponentServiceNameList[nIdx];
95 :
96 0 : ::com::sun::star::uno::Sequence< OUString > aParentSeq( SvxUnoDrawMSFactory::getAvailableServiceNames() );
97 0 : return concatServiceNames( aParentSeq, aSeq );
98 : }
99 :
100 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|