1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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>
24 #include <svx/unoshape.hxx>
25 #include <comphelper/processfactory.hxx>
26 #include <comphelper/sequence.hxx>
27 #include <com/sun/star/uno/XComponentContext.hpp>
28 #include <svx/fmglob.hxx>
30 using namespace ::svxform
;
33 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
> SAL_CALL
SvxFmMSFactory::createInstance(const OUString
& rServiceSpecifier
)
35 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
> xRet
;
37 if ( rServiceSpecifier
.startsWith( "com.sun.star.form.component." ) )
39 css::uno::Reference
<css::uno::XComponentContext
> xContext
= comphelper::getProcessComponentContext();
40 xRet
= xContext
->getServiceManager()->createInstanceWithContext(rServiceSpecifier
, xContext
);
42 else if ( rServiceSpecifier
== "com.sun.star.drawing.ControlShape" )
44 SdrModel
& rTargetModel(getSdrModelFromUnoModel());
45 SdrObject
* pObj
= new FmFormObj(rTargetModel
);
46 xRet
= static_cast<cppu::OWeakObject
*>(static_cast<SvxShape_UnoImplHelper
*>(new SvxShapeControl(pObj
)));
51 xRet
= SvxUnoDrawMSFactory::createInstance(rServiceSpecifier
);
58 ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
SvxFmMSFactory::getAvailableServiceNames()
60 static const OUStringLiteral aSvxComponentServiceNameList
[] =
62 FM_SUN_COMPONENT_TEXTFIELD
,
63 FM_SUN_COMPONENT_FORM
,
64 FM_SUN_COMPONENT_LISTBOX
,
65 FM_SUN_COMPONENT_COMBOBOX
,
66 FM_SUN_COMPONENT_RADIOBUTTON
,
67 FM_SUN_COMPONENT_GROUPBOX
,
68 FM_SUN_COMPONENT_FIXEDTEXT
,
69 FM_SUN_COMPONENT_COMMANDBUTTON
,
70 FM_SUN_COMPONENT_CHECKBOX
,
71 FM_SUN_COMPONENT_GRIDCONTROL
,
72 FM_SUN_COMPONENT_IMAGEBUTTON
,
73 FM_SUN_COMPONENT_FILECONTROL
,
74 FM_SUN_COMPONENT_TIMEFIELD
,
75 FM_SUN_COMPONENT_DATEFIELD
,
76 FM_SUN_COMPONENT_NUMERICFIELD
,
77 FM_SUN_COMPONENT_CURRENCYFIELD
,
78 FM_SUN_COMPONENT_PATTERNFIELD
,
79 FM_SUN_COMPONENT_HIDDENCONTROL
,
80 FM_SUN_COMPONENT_IMAGECONTROL
83 static const sal_uInt16 nSvxComponentServiceNameListCount
= SAL_N_ELEMENTS(aSvxComponentServiceNameList
);
85 auto aSeq( comphelper::arrayToSequence
< OUString
>(aSvxComponentServiceNameList
, nSvxComponentServiceNameListCount
) );
87 ::com::sun::star::uno::Sequence
< OUString
> aParentSeq( SvxUnoDrawMSFactory::getAvailableServiceNames() );
88 return comphelper::concatSequences( aParentSeq
, aSeq
);
91 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */