Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #include <comphelper/stl_types.hxx>
30 : : #include <svx/svdobj.hxx>
31 : : #include "svx/fmtools.hxx"
32 : : #include "fmservs.hxx"
33 : :
34 : : #include "svx/fmobjfac.hxx"
35 : :
36 : : #include <svx/fmglob.hxx>
37 : :
38 : : #include "fmobj.hxx"
39 : : #include "fmshimp.hxx"
40 : :
41 : : #include <svx/fmshell.hxx>
42 : :
43 : : #include <svx/svxids.hrc>
44 : : #include "tbxform.hxx"
45 : : #include <tools/resid.hxx>
46 : :
47 : : #include "svx/fmresids.hrc"
48 : : #include <tools/shl.hxx>
49 : : #include <svx/dialmgr.hxx>
50 : : #include "tabwin.hxx"
51 : : #include "fmexpl.hxx"
52 : : #include "filtnav.hxx"
53 : :
54 : : #include "fmprop.hrc"
55 : : #include "fmPropBrw.hxx"
56 : : #include "datanavi.hxx"
57 : :
58 : : using namespace ::com::sun::star::uno;
59 : : using namespace ::com::sun::star::beans;
60 : : using namespace ::svxform;
61 : :
62 : : static sal_Bool bInit = sal_False;
63 : :
64 : : /*************************************************************************
65 : : |*
66 : : |* Ctor
67 : : |*
68 : : \************************************************************************/
69 : 149 : FmFormObjFactory::FmFormObjFactory()
70 : : {
71 [ + + ]: 149 : if ( !bInit )
72 : : {
73 [ + - ]: 135 : SdrObjFactory::InsertMakeObjectHdl(LINK(this, FmFormObjFactory, MakeObject));
74 : :
75 : : //////////////////////////////////////////////////////////////////////
76 : : // Konfigurations-::com::sun::star::frame::Controller und NavigationBar registrieren
77 : 135 : SvxFmTbxCtlConfig::RegisterControl( SID_FM_CONFIG );
78 : 135 : SvxFmTbxCtlAbsRec::RegisterControl( SID_FM_RECORD_ABSOLUTE );
79 : 135 : SvxFmTbxCtlRecText::RegisterControl( SID_FM_RECORD_TEXT );
80 : 135 : SvxFmTbxCtlRecFromText::RegisterControl( SID_FM_RECORD_FROM_TEXT );
81 : 135 : SvxFmTbxCtlRecTotal::RegisterControl( SID_FM_RECORD_TOTAL );
82 : 135 : SvxFmTbxPrevRec::RegisterControl( SID_FM_RECORD_PREV );
83 : 135 : SvxFmTbxNextRec::RegisterControl( SID_FM_RECORD_NEXT );
84 : 135 : ControlConversionMenuController::RegisterControl(SID_FM_CHANGECONTROLTYPE);
85 : :
86 : : // Registrieung von globalen fenstern
87 : 135 : FmFieldWinMgr::RegisterChildWindow();
88 : 135 : FmPropBrwMgr::RegisterChildWindow();
89 : 135 : NavigatorFrameManager::RegisterChildWindow();
90 : 135 : DataNavigatorManager::RegisterChildWindow();
91 : 135 : FmFilterNavigatorWinMgr::RegisterChildWindow();
92 : :
93 : : //////////////////////////////////////////////////////////////////////
94 : : // Interface fuer die Formshell registrieren
95 : 135 : FmFormShell::RegisterInterface(0);
96 : :
97 : 135 : ImplSmartRegisterUnoServices();
98 : 135 : bInit = sal_True;
99 : : }
100 : 149 : }
101 : :
102 : :
103 : : /*************************************************************************
104 : : |*
105 : : |* Dtor
106 : : |*
107 : : \************************************************************************/
108 : 149 : FmFormObjFactory::~FmFormObjFactory()
109 : : {
110 : 149 : }
111 : :
112 : :
113 : : /*************************************************************************
114 : : |*
115 : : |* ::com::sun::star::form::Form-Objekte erzeugen
116 : : |*
117 : : \************************************************************************/
118 : : namespace
119 : : {
120 : 0 : void lcl_initProperty( FmFormObj* _pObject, const ::rtl::OUString& _rPropName, const Any& _rValue )
121 : : {
122 : : try
123 : : {
124 [ # # ][ # # ]: 0 : Reference< XPropertySet > xModelSet( _pObject->GetUnoControlModel(), UNO_QUERY );
125 [ # # ]: 0 : if ( xModelSet.is() )
126 [ # # ][ # # ]: 0 : xModelSet->setPropertyValue( _rPropName, _rValue );
[ # # ]
127 : : }
128 : 0 : catch( const Exception& )
129 : : {
130 : : OSL_FAIL( "lcl_initProperty: caught an exception!" );
131 : : }
132 : 0 : }
133 : : }
134 : :
135 : 0 : IMPL_LINK(FmFormObjFactory, MakeObject, SdrObjFactory*, pObjFactory)
136 : : {
137 [ # # ]: 0 : if (pObjFactory->nInventor == FmFormInventor)
138 : : {
139 : 0 : ::rtl::OUString sServiceSpecifier;
140 : :
141 : : typedef ::std::vector< ::std::pair< ::rtl::OUString, Any > > PropertyValueArray;
142 [ # # ]: 0 : PropertyValueArray aInitialProperties;
143 : :
144 [ # # # # : 0 : switch ( pObjFactory->nIdentifier )
# # # # #
# # # # #
# # # # #
# # # # ]
145 : : {
146 : : case OBJ_FM_EDIT:
147 [ # # ]: 0 : sServiceSpecifier = FM_COMPONENT_EDIT;
148 : 0 : break;
149 : :
150 : : case OBJ_FM_BUTTON:
151 [ # # ]: 0 : sServiceSpecifier = FM_COMPONENT_COMMANDBUTTON;
152 : 0 : break;
153 : :
154 : : case OBJ_FM_FIXEDTEXT:
155 [ # # ]: 0 : sServiceSpecifier = FM_COMPONENT_FIXEDTEXT;
156 : 0 : break;
157 : :
158 : : case OBJ_FM_LISTBOX:
159 [ # # ]: 0 : sServiceSpecifier = FM_COMPONENT_LISTBOX;
160 : 0 : break;
161 : :
162 : : case OBJ_FM_CHECKBOX:
163 [ # # ]: 0 : sServiceSpecifier = FM_COMPONENT_CHECKBOX;
164 : 0 : break;
165 : :
166 : : case OBJ_FM_RADIOBUTTON:
167 [ # # ]: 0 : sServiceSpecifier = FM_COMPONENT_RADIOBUTTON;
168 : 0 : break;
169 : :
170 : : case OBJ_FM_GROUPBOX:
171 [ # # ]: 0 : sServiceSpecifier = FM_COMPONENT_GROUPBOX;
172 : 0 : break;
173 : :
174 : : case OBJ_FM_COMBOBOX:
175 [ # # ]: 0 : sServiceSpecifier = FM_COMPONENT_COMBOBOX;
176 : 0 : break;
177 : :
178 : : case OBJ_FM_GRID:
179 [ # # ]: 0 : sServiceSpecifier = FM_COMPONENT_GRID;
180 : 0 : break;
181 : :
182 : : case OBJ_FM_IMAGEBUTTON:
183 [ # # ]: 0 : sServiceSpecifier = FM_COMPONENT_IMAGEBUTTON;
184 : 0 : break;
185 : :
186 : : case OBJ_FM_FILECONTROL:
187 [ # # ]: 0 : sServiceSpecifier = FM_COMPONENT_FILECONTROL;
188 : 0 : break;
189 : :
190 : : case OBJ_FM_DATEFIELD:
191 [ # # ]: 0 : sServiceSpecifier = FM_COMPONENT_DATEFIELD;
192 : 0 : break;
193 : :
194 : : case OBJ_FM_TIMEFIELD:
195 [ # # ]: 0 : sServiceSpecifier = FM_COMPONENT_TIMEFIELD;
196 [ # # ][ # # ]: 0 : aInitialProperties.push_back( PropertyValueArray::value_type( FM_PROP_TIMEMAX, makeAny( (sal_Int32)( Time( 23, 59, 59, 99 ).GetTime() ) ) ) );
[ # # ][ # # ]
197 : 0 : break;
198 : :
199 : : case OBJ_FM_NUMERICFIELD:
200 [ # # ]: 0 : sServiceSpecifier = FM_COMPONENT_NUMERICFIELD;
201 : 0 : break;
202 : :
203 : : case OBJ_FM_CURRENCYFIELD:
204 [ # # ]: 0 : sServiceSpecifier = FM_COMPONENT_CURRENCYFIELD;
205 : 0 : break;
206 : :
207 : : case OBJ_FM_PATTERNFIELD:
208 [ # # ]: 0 : sServiceSpecifier = FM_COMPONENT_PATTERNFIELD;
209 : 0 : break;
210 : :
211 : : case OBJ_FM_HIDDEN:
212 [ # # ]: 0 : sServiceSpecifier = FM_COMPONENT_HIDDEN;
213 : 0 : break;
214 : :
215 : : case OBJ_FM_IMAGECONTROL:
216 [ # # ]: 0 : sServiceSpecifier = FM_COMPONENT_IMAGECONTROL;
217 : 0 : break;
218 : :
219 : : case OBJ_FM_FORMATTEDFIELD:
220 [ # # ]: 0 : sServiceSpecifier = FM_COMPONENT_FORMATTEDFIELD;
221 : 0 : break;
222 : :
223 : : case OBJ_FM_NAVIGATIONBAR:
224 [ # # ]: 0 : sServiceSpecifier = FM_SUN_COMPONENT_NAVIGATIONBAR;
225 : 0 : break;
226 : :
227 : : case OBJ_FM_SCROLLBAR:
228 [ # # ]: 0 : sServiceSpecifier = FM_SUN_COMPONENT_SCROLLBAR;
229 [ # # ][ # # ]: 0 : aInitialProperties.push_back( PropertyValueArray::value_type( FM_PROP_BORDER, makeAny( (sal_Int16)0 ) ) );
[ # # ]
230 : 0 : break;
231 : :
232 : : case OBJ_FM_SPINBUTTON:
233 [ # # ]: 0 : sServiceSpecifier = FM_SUN_COMPONENT_SPINBUTTON;
234 [ # # ][ # # ]: 0 : aInitialProperties.push_back( PropertyValueArray::value_type( FM_PROP_BORDER, makeAny( (sal_Int16)0 ) ) );
[ # # ]
235 : 0 : break;
236 : : }
237 : :
238 : : // create the actual object
239 [ # # ]: 0 : if ( !sServiceSpecifier.isEmpty() )
240 [ # # ][ # # ]: 0 : pObjFactory->pNewObj = new FmFormObj(sServiceSpecifier);
241 : : else
242 [ # # ][ # # ]: 0 : pObjFactory->pNewObj = new FmFormObj();
243 : :
244 : : // initialize some properties which we want to differ from the defaults
245 [ # # ][ # # ]: 0 : for ( PropertyValueArray::const_iterator aInitProp = aInitialProperties.begin();
[ # # ]
246 : 0 : aInitProp != aInitialProperties.end();
247 : : ++aInitProp
248 : : )
249 : : {
250 : : lcl_initProperty(
251 : : static_cast< FmFormObj* >( pObjFactory->pNewObj ),
252 : 0 : aInitProp->first,
253 : 0 : aInitProp->second
254 [ # # ]: 0 : );
255 : 0 : }
256 : : }
257 : :
258 : 0 : return 0;
259 : : }
260 : :
261 : :
262 : :
263 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|