1*b1cdbd2cSJim Jagielski /**************************************************************
2*b1cdbd2cSJim Jagielski *
3*b1cdbd2cSJim Jagielski * Licensed to the Apache Software Foundation (ASF) under one
4*b1cdbd2cSJim Jagielski * or more contributor license agreements. See the NOTICE file
5*b1cdbd2cSJim Jagielski * distributed with this work for additional information
6*b1cdbd2cSJim Jagielski * regarding copyright ownership. The ASF licenses this file
7*b1cdbd2cSJim Jagielski * to you under the Apache License, Version 2.0 (the
8*b1cdbd2cSJim Jagielski * "License"); you may not use this file except in compliance
9*b1cdbd2cSJim Jagielski * with the License. You may obtain a copy of the License at
10*b1cdbd2cSJim Jagielski *
11*b1cdbd2cSJim Jagielski * http://www.apache.org/licenses/LICENSE-2.0
12*b1cdbd2cSJim Jagielski *
13*b1cdbd2cSJim Jagielski * Unless required by applicable law or agreed to in writing,
14*b1cdbd2cSJim Jagielski * software distributed under the License is distributed on an
15*b1cdbd2cSJim Jagielski * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*b1cdbd2cSJim Jagielski * KIND, either express or implied. See the License for the
17*b1cdbd2cSJim Jagielski * specific language governing permissions and limitations
18*b1cdbd2cSJim Jagielski * under the License.
19*b1cdbd2cSJim Jagielski *
20*b1cdbd2cSJim Jagielski *************************************************************/
21*b1cdbd2cSJim Jagielski
22*b1cdbd2cSJim Jagielski
23*b1cdbd2cSJim Jagielski
24*b1cdbd2cSJim Jagielski // MARKER(update_precomp.py): autogen include statement, do not remove
25*b1cdbd2cSJim Jagielski #include "precompiled_svx.hxx"
26*b1cdbd2cSJim Jagielski #include <svx/fmdmod.hxx>
27*b1cdbd2cSJim Jagielski #include "fmservs.hxx"
28*b1cdbd2cSJim Jagielski #include <fmobj.hxx>
29*b1cdbd2cSJim Jagielski #include <svx/unoshape.hxx>
30*b1cdbd2cSJim Jagielski #include <comphelper/processfactory.hxx>
31*b1cdbd2cSJim Jagielski #include <svx/fmglob.hxx>
32*b1cdbd2cSJim Jagielski
33*b1cdbd2cSJim Jagielski using namespace ::svxform;
34*b1cdbd2cSJim Jagielski
35*b1cdbd2cSJim Jagielski //-----------------------------------------------------------------------------
createInstance(const::rtl::OUString & ServiceSpecifier)36*b1cdbd2cSJim Jagielski ::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 )
37*b1cdbd2cSJim Jagielski {
38*b1cdbd2cSJim Jagielski ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xRet;
39*b1cdbd2cSJim Jagielski if ( ServiceSpecifier.indexOf( ::rtl::OUString::createFromAscii("com.sun.star.form.component.") ) == 0 )
40*b1cdbd2cSJim Jagielski {
41*b1cdbd2cSJim Jagielski xRet = ::comphelper::getProcessServiceFactory()->createInstance(ServiceSpecifier);
42*b1cdbd2cSJim Jagielski }
43*b1cdbd2cSJim Jagielski else if ( ServiceSpecifier == ::rtl::OUString( ::rtl::OUString::createFromAscii("com.sun.star.drawing.ControlShape") ) )
44*b1cdbd2cSJim Jagielski {
45*b1cdbd2cSJim Jagielski SdrObject* pObj = new FmFormObj(OBJ_FM_CONTROL);
46*b1cdbd2cSJim Jagielski xRet = *new SvxShapeControl(pObj);
47*b1cdbd2cSJim Jagielski }
48*b1cdbd2cSJim Jagielski if (!xRet.is())
49*b1cdbd2cSJim Jagielski xRet = SvxUnoDrawMSFactory::createInstance(ServiceSpecifier);
50*b1cdbd2cSJim Jagielski return xRet;
51*b1cdbd2cSJim Jagielski }
52*b1cdbd2cSJim Jagielski
53*b1cdbd2cSJim Jagielski //-----------------------------------------------------------------------------
createInstanceWithArguments(const::rtl::OUString & ServiceSpecifier,const::com::sun::star::uno::Sequence<::com::sun::star::uno::Any> & Arguments)54*b1cdbd2cSJim Jagielski ::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 )
55*b1cdbd2cSJim Jagielski {
56*b1cdbd2cSJim Jagielski return SvxUnoDrawMSFactory::createInstanceWithArguments(ServiceSpecifier, Arguments );
57*b1cdbd2cSJim Jagielski }
58*b1cdbd2cSJim Jagielski
59*b1cdbd2cSJim Jagielski //-----------------------------------------------------------------------------
getAvailableServiceNames(void)60*b1cdbd2cSJim Jagielski ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL SvxFmMSFactory::getAvailableServiceNames(void) throw( ::com::sun::star::uno::RuntimeException )
61*b1cdbd2cSJim Jagielski {
62*b1cdbd2cSJim Jagielski static const ::rtl::OUString aSvxComponentServiceNameList[] =
63*b1cdbd2cSJim Jagielski {
64*b1cdbd2cSJim Jagielski FM_SUN_COMPONENT_TEXTFIELD,
65*b1cdbd2cSJim Jagielski FM_SUN_COMPONENT_FORM,
66*b1cdbd2cSJim Jagielski FM_SUN_COMPONENT_LISTBOX,
67*b1cdbd2cSJim Jagielski FM_SUN_COMPONENT_COMBOBOX,
68*b1cdbd2cSJim Jagielski FM_SUN_COMPONENT_RADIOBUTTON,
69*b1cdbd2cSJim Jagielski FM_SUN_COMPONENT_GROUPBOX,
70*b1cdbd2cSJim Jagielski FM_SUN_COMPONENT_FIXEDTEXT,
71*b1cdbd2cSJim Jagielski FM_SUN_COMPONENT_COMMANDBUTTON,
72*b1cdbd2cSJim Jagielski FM_SUN_COMPONENT_CHECKBOX,
73*b1cdbd2cSJim Jagielski FM_SUN_COMPONENT_GRIDCONTROL,
74*b1cdbd2cSJim Jagielski FM_SUN_COMPONENT_IMAGEBUTTON,
75*b1cdbd2cSJim Jagielski FM_SUN_COMPONENT_FILECONTROL,
76*b1cdbd2cSJim Jagielski FM_SUN_COMPONENT_TIMEFIELD,
77*b1cdbd2cSJim Jagielski FM_SUN_COMPONENT_DATEFIELD,
78*b1cdbd2cSJim Jagielski FM_SUN_COMPONENT_NUMERICFIELD,
79*b1cdbd2cSJim Jagielski FM_SUN_COMPONENT_CURRENCYFIELD,
80*b1cdbd2cSJim Jagielski FM_SUN_COMPONENT_PATTERNFIELD,
81*b1cdbd2cSJim Jagielski FM_SUN_COMPONENT_HIDDENCONTROL,
82*b1cdbd2cSJim Jagielski FM_SUN_COMPONENT_IMAGECONTROL
83*b1cdbd2cSJim Jagielski };
84*b1cdbd2cSJim Jagielski
85*b1cdbd2cSJim Jagielski static const sal_uInt16 nSvxComponentServiceNameListCount = sizeof(aSvxComponentServiceNameList) / sizeof ( aSvxComponentServiceNameList[0] );
86*b1cdbd2cSJim Jagielski
87*b1cdbd2cSJim Jagielski ::com::sun::star::uno::Sequence< ::rtl::OUString > aSeq( nSvxComponentServiceNameListCount );
88*b1cdbd2cSJim Jagielski ::rtl::OUString* pStrings = aSeq.getArray();
89*b1cdbd2cSJim Jagielski for( sal_uInt16 nIdx = 0; nIdx < nSvxComponentServiceNameListCount; nIdx++ )
90*b1cdbd2cSJim Jagielski pStrings[nIdx] = aSvxComponentServiceNameList[nIdx];
91*b1cdbd2cSJim Jagielski
92*b1cdbd2cSJim Jagielski ::com::sun::star::uno::Sequence< ::rtl::OUString > aParentSeq( SvxUnoDrawMSFactory::getAvailableServiceNames() );
93*b1cdbd2cSJim Jagielski return concatServiceNames( aParentSeq, aSeq );
94*b1cdbd2cSJim Jagielski }
95*b1cdbd2cSJim Jagielski
96*b1cdbd2cSJim Jagielski /*
97*b1cdbd2cSJim Jagielski // XServiceManager
98*b1cdbd2cSJim Jagielski ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SvxFmDrawModel::createInstance(const ::rtl::OUString& ServiceName)
99*b1cdbd2cSJim Jagielski const throw( ::com::sun::star::lang::ServiceNotRegisteredException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException )
100*b1cdbd2cSJim Jagielski {
101*b1cdbd2cSJim Jagielski ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xRet;
102*b1cdbd2cSJim Jagielski sal_uInt16 nTokenCount = ServiceName.getTokenCount('.');
103*b1cdbd2cSJim Jagielski if (nTokenCount == 5 &&
104*b1cdbd2cSJim Jagielski ServiceName.getToken( 0, '.' ) == ::rtl::OUString::createFromAscii("stardiv") &&
105*b1cdbd2cSJim Jagielski ServiceName.getToken( 1, '.' ) == ::rtl::OUString::createFromAscii("one") &&
106*b1cdbd2cSJim Jagielski ServiceName.getToken( 2, '.' ) == ::rtl::OUString::createFromAscii("form") &&
107*b1cdbd2cSJim Jagielski ServiceName.getToken( 3, '.' ) == ::rtl::OUString::createFromAscii("component"))
108*b1cdbd2cSJim Jagielski {
109*b1cdbd2cSJim Jagielski xRet = ::comphelper::getProcessServiceFactory()->createInstance(ServiceName);
110*b1cdbd2cSJim Jagielski }
111*b1cdbd2cSJim Jagielski else
112*b1cdbd2cSJim Jagielski if (nTokenCount == 4 &&
113*b1cdbd2cSJim Jagielski ServiceName.getToken( 0, '.' ) == ::rtl::OUString::createFromAscii("stardiv") &&
114*b1cdbd2cSJim Jagielski ServiceName.getToken( 1, '.' ) == ::rtl::OUString::createFromAscii("one") &&
115*b1cdbd2cSJim Jagielski ServiceName.getToken( 2, '.' ) == ::rtl::OUString::createFromAscii("drawing") &&
116*b1cdbd2cSJim Jagielski ServiceName.getToken( 3, '.' ) == ::rtl::OUString::createFromAscii("ControlShape"))
117*b1cdbd2cSJim Jagielski {
118*b1cdbd2cSJim Jagielski SdrObject* pObj = new FmFormObj();
119*b1cdbd2cSJim Jagielski xRet = *new SvxShapeControl(pObj);
120*b1cdbd2cSJim Jagielski }
121*b1cdbd2cSJim Jagielski if (!xRet.is())
122*b1cdbd2cSJim Jagielski xRet = SvxUnoDrawModel::createInstance(ServiceName);
123*b1cdbd2cSJim Jagielski return xRet;
124*b1cdbd2cSJim Jagielski }
125*b1cdbd2cSJim Jagielski */
126*b1cdbd2cSJim Jagielski
127*b1cdbd2cSJim Jagielski
128