/src/libreoffice/svx/source/form/fmdmod.cxx
Line | Count | Source |
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/config.h> |
21 | | |
22 | | #include <sal/macros.h> |
23 | | #include <svx/fmdmod.hxx> |
24 | | #include <fmservs.hxx> |
25 | | #include <fmobj.hxx> |
26 | | #include <svx/unoshape.hxx> |
27 | | #include <comphelper/processfactory.hxx> |
28 | | #include <comphelper/sequence.hxx> |
29 | | #include <com/sun/star/uno/XComponentContext.hpp> |
30 | | |
31 | | using namespace ::svxform; |
32 | | |
33 | | |
34 | | ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL SvxFmMSFactory::createInstance(const OUString& rServiceSpecifier) |
35 | 63.8k | { |
36 | 63.8k | ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xRet; |
37 | | |
38 | 63.8k | if ( rServiceSpecifier.startsWith( "com.sun.star.form.component." ) ) |
39 | 5.05k | { |
40 | 5.05k | const css::uno::Reference<css::uno::XComponentContext>& xContext = comphelper::getProcessComponentContext(); |
41 | 5.05k | xRet = xContext->getServiceManager()->createInstanceWithContext(rServiceSpecifier, xContext); |
42 | 5.05k | } |
43 | 58.8k | else if ( rServiceSpecifier == "com.sun.star.drawing.ControlShape" ) |
44 | 2.17k | { |
45 | 2.17k | SdrModel& rTargetModel(getSdrModelFromUnoModel()); |
46 | 2.17k | rtl::Reference<SdrObject> pObj = new FmFormObj(rTargetModel); |
47 | 2.17k | xRet = getXWeak(new SvxShapeControl(pObj.get())); |
48 | 2.17k | } |
49 | | |
50 | 63.8k | if (!xRet.is()) |
51 | 56.6k | { |
52 | 56.6k | xRet = SvxUnoDrawMSFactory::createInstance(rServiceSpecifier); |
53 | 56.6k | } |
54 | | |
55 | 63.8k | return xRet; |
56 | 63.8k | } |
57 | | |
58 | | |
59 | | ::com::sun::star::uno::Sequence< OUString > SAL_CALL SvxFmMSFactory::getAvailableServiceNames() |
60 | 18.4k | { |
61 | 18.4k | static constexpr OUString aSvxComponentServiceNameList[] = |
62 | 18.4k | { |
63 | 18.4k | FM_SUN_COMPONENT_TEXTFIELD, |
64 | 18.4k | FM_SUN_COMPONENT_FORM, |
65 | 18.4k | FM_SUN_COMPONENT_LISTBOX, |
66 | 18.4k | FM_SUN_COMPONENT_COMBOBOX, |
67 | 18.4k | FM_SUN_COMPONENT_RADIOBUTTON, |
68 | 18.4k | FM_SUN_COMPONENT_GROUPBOX, |
69 | 18.4k | FM_SUN_COMPONENT_FIXEDTEXT, |
70 | 18.4k | FM_SUN_COMPONENT_COMMANDBUTTON, |
71 | 18.4k | FM_SUN_COMPONENT_CHECKBOX, |
72 | 18.4k | FM_SUN_COMPONENT_GRIDCONTROL, |
73 | 18.4k | FM_SUN_COMPONENT_IMAGEBUTTON, |
74 | 18.4k | FM_SUN_COMPONENT_FILECONTROL, |
75 | 18.4k | FM_SUN_COMPONENT_TIMEFIELD, |
76 | 18.4k | FM_SUN_COMPONENT_DATEFIELD, |
77 | 18.4k | FM_SUN_COMPONENT_NUMERICFIELD, |
78 | 18.4k | FM_SUN_COMPONENT_CURRENCYFIELD, |
79 | 18.4k | FM_SUN_COMPONENT_PATTERNFIELD, |
80 | 18.4k | FM_SUN_COMPONENT_HIDDENCONTROL, |
81 | 18.4k | FM_SUN_COMPONENT_IMAGECONTROL |
82 | 18.4k | }; |
83 | | |
84 | 18.4k | ::com::sun::star::uno::Sequence< OUString > aParentSeq( SvxUnoDrawMSFactory::getAvailableServiceNames() ); |
85 | 18.4k | return comphelper::concatSequences(aParentSeq, aSvxComponentServiceNameList); |
86 | 18.4k | } |
87 | | |
88 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |