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 "fmvwimp.hxx"
30 : : #include <svx/fmshell.hxx>
31 : : #include "svx/fmtools.hxx"
32 : : #include "fmservs.hxx"
33 : : #include "fmprop.hrc"
34 : : #include "fmpgeimp.hxx"
35 : : #include "fmitems.hxx"
36 : : #include "fmundo.hxx"
37 : : #include <vcl/waitobj.hxx>
38 : : #include <com/sun/star/form/XLoadable.hpp>
39 : : #include <com/sun/star/container/XNamed.hpp>
40 : : #include <com/sun/star/sdbcx/Privilege.hpp>
41 : : #include <com/sun/star/beans/XPropertySet.hpp>
42 : : #include <com/sun/star/beans/XMultiPropertySet.hpp>
43 : : #include <com/sun/star/beans/XFastPropertySet.hpp>
44 : : #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
45 : : #include <com/sun/star/lang/XServiceInfo.hpp>
46 : : #include <com/sun/star/container/XNameContainer.hpp>
47 : : #include <com/sun/star/awt/XTabControllerModel.hpp>
48 : : #include <sfx2/viewfrm.hxx>
49 : : #include <vcl/wrkwin.hxx>
50 : : #include <vcl/msgbox.hxx>
51 : : #include <svl/whiter.hxx>
52 : : #include <sfx2/app.hxx>
53 : : #include <svl/intitem.hxx>
54 : : #include <svl/visitem.hxx>
55 : : #include <unotools/moduleoptions.hxx>
56 : : #include <sfx2/objface.hxx>
57 : : #include <sfx2/request.hxx>
58 : : #include <sfx2/dispatch.hxx>
59 : : #include <sfx2/objsh.hxx>
60 : : #include <svx/svdobj.hxx>
61 : : #include <svx/fmpage.hxx>
62 : : #include "svx/svditer.hxx"
63 : : #include "fmobj.hxx"
64 : :
65 : : #include <svx/svxids.hrc>
66 : :
67 : : #include "svx/fmresids.hrc"
68 : : #include "fmexch.hxx"
69 : : #include <svx/fmglob.hxx>
70 : : #include <svl/eitem.hxx>
71 : : #include <tools/shl.hxx>
72 : : #include <tools/diagnose_ex.h>
73 : : #include <svx/svdpage.hxx>
74 : : #include <svx/fmmodel.hxx>
75 : : #include <svx/dialmgr.hxx>
76 : : #include "fmshimp.hxx"
77 : : #include <svx/svdpagv.hxx>
78 : : #include <sfx2/objitem.hxx>
79 : : #include <sfx2/viewsh.hxx>
80 : : #include "fmexpl.hxx"
81 : : #include "formcontrolling.hxx"
82 : : #include <svl/numuno.hxx>
83 : : #include <connectivity/dbtools.hxx>
84 : : #include <comphelper/types.hxx>
85 : : #include <comphelper/processfactory.hxx>
86 : : #include "fmdocumentclassification.hxx"
87 : : #include "formtoolbars.hxx"
88 : :
89 : : #include <svx/svxdlg.hxx>
90 : : #include <svx/dialogs.hrc>
91 : :
92 : : #include "svx/sdrobjectfilter.hxx"
93 : :
94 : : #define FmFormShell
95 : : #include "svxslots.hxx"
96 : :
97 : : #include "tbxform.hxx"
98 : : #include <comphelper/property.hxx>
99 : : #include <com/sun/star/beans/PropertyValue.hpp>
100 : :
101 : : #include <boost/scoped_ptr.hpp>
102 : :
103 : : // wird fuer Invalidate verwendet -> mitpflegen
104 : : // aufsteigend sortieren !!!!!!
105 : : sal_uInt16 ControllerSlotMap[] = // slots des Controllers
106 : : {
107 : : SID_FM_CONFIG,
108 : : SID_FM_PUSHBUTTON,
109 : : SID_FM_RADIOBUTTON,
110 : : SID_FM_CHECKBOX,
111 : : SID_FM_FIXEDTEXT,
112 : : SID_FM_GROUPBOX,
113 : : SID_FM_EDIT,
114 : : SID_FM_LISTBOX,
115 : : SID_FM_COMBOBOX,
116 : : SID_FM_DBGRID,
117 : : SID_FM_IMAGEBUTTON,
118 : : SID_FM_FILECONTROL,
119 : : SID_FM_NAVIGATIONBAR,
120 : : SID_FM_CTL_PROPERTIES,
121 : : SID_FM_PROPERTIES,
122 : : SID_FM_TAB_DIALOG,
123 : : SID_FM_ADD_FIELD,
124 : : SID_FM_DESIGN_MODE,
125 : : SID_FM_SHOW_FMEXPLORER,
126 : : SID_FM_SHOW_PROPERTIES,
127 : : SID_FM_FMEXPLORER_CONTROL,
128 : : SID_FM_DATEFIELD,
129 : : SID_FM_TIMEFIELD,
130 : : SID_FM_NUMERICFIELD,
131 : : SID_FM_CURRENCYFIELD,
132 : : SID_FM_PATTERNFIELD,
133 : : SID_FM_OPEN_READONLY,
134 : : SID_FM_IMAGECONTROL,
135 : : SID_FM_USE_WIZARDS,
136 : : SID_FM_FORMATTEDFIELD,
137 : : SID_FM_FILTER_NAVIGATOR,
138 : : SID_FM_AUTOCONTROLFOCUS,
139 : : SID_FM_SCROLLBAR,
140 : : SID_FM_SPINBUTTON,
141 : : SID_FM_SHOW_DATANAVIGATOR,
142 : : SID_FM_DATANAVIGATOR_CONTROL,
143 : :
144 : : 0
145 : : };
146 : :
147 : : using namespace ::com::sun::star::uno;
148 : : using namespace ::com::sun::star::awt;
149 : : using namespace ::com::sun::star::sdbc;
150 : : using namespace ::com::sun::star::sdbcx;
151 : : using namespace ::com::sun::star::beans;
152 : : using namespace ::com::sun::star::form;
153 : : using namespace ::com::sun::star::form::runtime;
154 : : using namespace ::com::sun::star::frame;
155 : : using namespace ::svxform;
156 : :
157 : : //========================================================================
158 : : // class FmDesignModeChangedHint
159 : : //========================================================================
160 [ + + ][ - + ]: 29106 : TYPEINIT1( FmDesignModeChangedHint, SfxHint );
161 : :
162 : : //------------------------------------------------------------------------
163 : 1673 : FmDesignModeChangedHint::FmDesignModeChangedHint( sal_Bool bDesMode )
164 : 1673 : :m_bDesignMode( bDesMode )
165 : : {
166 : 1673 : }
167 : :
168 : : //------------------------------------------------------------------------
169 : 1673 : FmDesignModeChangedHint::~FmDesignModeChangedHint()
170 : : {
171 [ - + ]: 1673 : }
172 : :
173 : : //========================================================================
174 : : const sal_uInt32 FM_UI_FEATURE_SHOW_DATABASEBAR = 0x00000001;
175 : : const sal_uInt32 FM_UI_FEATURE_SHOW_FIELD = 0x00000002;
176 : : const sal_uInt32 FM_UI_FEATURE_SHOW_PROPERTIES = 0x00000004;
177 : : const sal_uInt32 FM_UI_FEATURE_SHOW_EXPLORER = 0x00000008;
178 : : const sal_uInt32 FM_UI_FEATURE_SHOW_FILTERBAR = 0x00000010;
179 : : const sal_uInt32 FM_UI_FEATURE_SHOW_FILTERNAVIGATOR = 0x00000020;
180 : : const sal_uInt32 FM_UI_FEATURE_SHOW_TEXT_CONTROL_BAR = 0x00000040;
181 : : const sal_uInt32 FM_UI_FEATURE_TB_CONTROLS = 0x00000080;
182 : : const sal_uInt32 FM_UI_FEATURE_TB_MORECONTROLS = 0x00000100;
183 : : const sal_uInt32 FM_UI_FEATURE_TB_FORMDESIGN = 0x00000200;
184 : : const sal_uInt32 FM_UI_FEATURE_SHOW_DATANAVIGATOR = 0x00000400;
185 : :
186 [ + + ][ + - ]: 157733 : SFX_IMPL_INTERFACE(FmFormShell, SfxShell, SVX_RES(RID_STR_FORMSHELL))
[ + - ]
187 : : {
188 [ + - ]: 135 : SFX_FEATURED_OBJECTBAR_REGISTRATION( SFX_OBJECTBAR_NAVIGATION|SFX_VISIBILITY_STANDARD|SFX_VISIBILITY_READONLYDOC,
189 : : SVX_RES(RID_SVXTBX_FORM_NAVIGATION),
190 [ + - ]: 135 : FM_UI_FEATURE_SHOW_DATABASEBAR );
191 : :
192 [ + - ]: 135 : SFX_FEATURED_OBJECTBAR_REGISTRATION( SFX_OBJECTBAR_NAVIGATION|SFX_VISIBILITY_STANDARD|SFX_VISIBILITY_READONLYDOC,
193 : : SVX_RES(RID_SVXTBX_FORM_FILTER),
194 [ + - ]: 135 : FM_UI_FEATURE_SHOW_FILTERBAR );
195 : :
196 [ + - ]: 135 : SFX_FEATURED_OBJECTBAR_REGISTRATION( SFX_OBJECTBAR_OBJECT | SFX_VISIBILITY_STANDARD | SFX_VISIBILITY_READONLYDOC,
197 : : SVX_RES( RID_SVXTBX_TEXT_CONTROL_ATTRIBUTES ),
198 [ + - ]: 135 : FM_UI_FEATURE_SHOW_TEXT_CONTROL_BAR );
199 : :
200 : 135 : SFX_FEATURED_CHILDWINDOW_REGISTRATION(SID_FM_ADD_FIELD, FM_UI_FEATURE_SHOW_FIELD);
201 : 135 : SFX_FEATURED_CHILDWINDOW_REGISTRATION(SID_FM_SHOW_PROPERTIES, FM_UI_FEATURE_SHOW_PROPERTIES);
202 : 135 : SFX_FEATURED_CHILDWINDOW_REGISTRATION(SID_FM_SHOW_FMEXPLORER, FM_UI_FEATURE_SHOW_EXPLORER);
203 : 135 : SFX_FEATURED_CHILDWINDOW_REGISTRATION(SID_FM_FILTER_NAVIGATOR, FM_UI_FEATURE_SHOW_FILTERNAVIGATOR);
204 : 135 : SFX_FEATURED_CHILDWINDOW_REGISTRATION(SID_FM_SHOW_DATANAVIGATOR, FM_UI_FEATURE_SHOW_DATANAVIGATOR);
205 : :
206 [ + - ]: 135 : SFX_FEATURED_OBJECTBAR_REGISTRATION( SFX_OBJECTBAR_OBJECT | SFX_VISIBILITY_STANDARD,
207 : : SVX_RES( RID_SVXTBX_CONTROLS ),
208 [ + - ]: 135 : FM_UI_FEATURE_TB_CONTROLS );
209 : :
210 [ + - ]: 135 : SFX_FEATURED_OBJECTBAR_REGISTRATION( SFX_OBJECTBAR_OBJECT | SFX_VISIBILITY_STANDARD,
211 : : SVX_RES( RID_SVXTBX_MORECONTROLS ),
212 [ + - ]: 135 : FM_UI_FEATURE_TB_MORECONTROLS );
213 : :
214 [ + - ]: 135 : SFX_FEATURED_OBJECTBAR_REGISTRATION( SFX_OBJECTBAR_OBJECT | SFX_VISIBILITY_STANDARD,
215 : : SVX_RES( RID_SVXTBX_FORMDESIGN ),
216 [ + - ]: 135 : FM_UI_FEATURE_TB_FORMDESIGN );
217 : 135 : }
218 : :
219 : : //========================================================================
220 [ + + ][ - + ]: 30532 : TYPEINIT1(FmFormShell,SfxShell)
221 : :
222 : : //------------------------------------------------------------------------
223 : 1669 : FmFormShell::FmFormShell( SfxViewShell* _pParent, FmFormView* pView )
224 : : :SfxShell(_pParent)
225 [ + - ]: 1669 : ,m_pImpl(new FmXFormShell(*this, _pParent->GetViewFrame()))
226 : : ,m_pFormView( pView )
227 : : ,m_pFormModel( NULL )
228 : : ,m_pParentShell(_pParent)
229 : : ,m_nLastSlot( 0 )
230 : : ,m_bDesignMode( sal_True )
231 : 1669 : ,m_bHasForms(sal_False)
232 : : {
233 : 1669 : m_pImpl->acquire();
234 [ + - ]: 1669 : SetPool( &SFX_APP()->GetPool() );
235 [ + - ][ + - ]: 1669 : SetName( rtl::OUString("Form") );
[ + - ]
236 : :
237 [ + - ]: 1669 : SetView(m_pFormView);
238 : 1669 : }
239 : :
240 : : //------------------------------------------------------------------------
241 : 1578 : FmFormShell::~FmFormShell()
242 : : {
243 [ + + ]: 1578 : if ( m_pFormView )
244 [ + - ]: 1448 : SetView( NULL );
245 : :
246 [ + - ]: 1578 : m_pImpl->dispose();
247 : 1578 : m_pImpl->release();
248 : 1578 : m_pImpl = NULL;
249 [ - + ]: 3156 : }
250 : :
251 : : //------------------------------------------------------------------------
252 : 296 : void FmFormShell::NotifyMarkListChanged(FmFormView* pWhichView)
253 : : {
254 [ + - ]: 296 : FmNavViewMarksChanged aChangeNotification(pWhichView);
255 [ + - ][ + - ]: 296 : Broadcast(aChangeNotification);
256 : 296 : }
257 : :
258 : : //------------------------------------------------------------------------
259 : 4169 : sal_uInt16 FmFormShell::PrepareClose(sal_Bool bUI, sal_Bool /*bForBrowsing*/)
260 : : {
261 [ - + ]: 4169 : if ( GetImpl()->didPrepareClose() )
262 : : // we already did a PrepareClose for the current modifications of the current form
263 : 0 : return sal_True;
264 : :
265 : 4169 : sal_Bool bResult = sal_True;
266 : : // Save the data records, not in DesignMode and FilterMode
267 [ + + ][ + - ]: 4437 : if (!m_bDesignMode && !GetImpl()->isInFilterMode() &&
[ + - + +
+ - ][ + + ]
268 : 142 : m_pFormView && m_pFormView->GetActualOutDev() &&
269 : 126 : m_pFormView->GetActualOutDev()->GetOutDevType() == OUTDEV_WINDOW)
270 : : {
271 : 126 : SdrPageView* pCurPageView = m_pFormView->GetSdrPageView();
272 : :
273 : : // sal_uInt16 nPos = pCurPageView ? pCurPageView->GetWinList().Find((OutputDevice*)m_pFormView->GetActualOutDev()) : SDRPAGEVIEWWIN_NOTFOUND;
274 [ + + ]: 126 : SdrPageWindow* pWindow = pCurPageView ? pCurPageView->FindPageWindow(*((OutputDevice*)m_pFormView->GetActualOutDev())) : 0L;
275 : :
276 [ + + ]: 126 : if(pWindow)
277 : : {
278 : : // Zunaechst werden die aktuellen Inhalte der Controls gespeichert
279 : : // Wenn alles glatt gelaufen ist, werden die modifizierten Datensaetze gespeichert
280 [ + + ]: 124 : if ( GetImpl()->getActiveController().is() )
281 : : {
282 : 6 : const ::svx::ControllerFeatures& rController = GetImpl()->getActiveControllerFeatures();
283 [ + - ]: 6 : if ( rController->commitCurrentControl() )
284 : : {
285 : 6 : sal_Bool bModified = rController->isModifiedRow();
286 : :
287 [ # # ][ - + ]: 6 : if ( bModified && bUI )
288 : : {
289 [ # # ][ # # ]: 0 : QueryBox aQry(NULL, SVX_RES(RID_QRY_SAVEMODIFIED));
290 [ # # ]: 0 : switch (aQry.Execute())
[ # # # # ]
291 : : {
292 : : case RET_NO:
293 : 0 : bModified = sal_False;
294 : 0 : GetImpl()->didPrepareClose( sal_True );
295 : 0 : break;
296 : :
297 : : case RET_CANCEL:
298 : 0 : return sal_False;
299 : :
300 : : case RET_NEWTASK:
301 : 0 : return RET_NEWTASK;
302 : : }
303 : :
304 [ # # ]: 0 : if ( bModified )
305 [ # # ][ # # ]: 0 : bResult = rController->commitCurrentRecord( );
[ # # ]
306 : : }
307 : : }
308 : : }
309 : : }
310 : : }
311 : 4169 : return bResult;
312 : : }
313 : :
314 : : //------------------------------------------------------------------------
315 : 1673 : void FmFormShell::impl_setDesignMode(sal_Bool bDesign)
316 : : {
317 [ + - ]: 1673 : if (m_pFormView)
318 : : {
319 [ + + ]: 1673 : if (!bDesign)
320 : 69 : m_nLastSlot = SID_FM_DESIGN_MODE;
321 : :
322 : 1673 : GetImpl()->SetDesignMode(bDesign);
323 : : // mein m_bDesignMode wird auch von der Impl gesetzt ...
324 : : }
325 : : else
326 : : {
327 : 0 : m_bHasForms = sal_False;
328 : 0 : m_bDesignMode = bDesign;
329 : 0 : UIFeatureChanged();
330 : : }
331 : :
332 : 1673 : GetViewShell()->GetViewFrame()->GetBindings().Invalidate(ControllerSlotMap);
333 : 1673 : }
334 : :
335 : : //------------------------------------------------------------------------
336 : 35731 : sal_Bool FmFormShell::HasUIFeature( sal_uInt32 nFeature )
337 : : {
338 : 35731 : sal_Bool bResult = sal_False;
339 [ + + ]: 35731 : if ((nFeature & FM_UI_FEATURE_SHOW_DATABASEBAR) == FM_UI_FEATURE_SHOW_DATABASEBAR)
340 : : {
341 : : // nur wenn auch formulare verfuegbar
342 [ + + ][ - + ]: 3257 : bResult = !m_bDesignMode && GetImpl()->hasDatabaseBar() && !GetImpl()->isInFilterMode();
[ # # ]
343 : : }
344 [ + + ]: 32474 : else if ((nFeature & FM_UI_FEATURE_SHOW_FILTERBAR) == FM_UI_FEATURE_SHOW_FILTERBAR)
345 : : {
346 : : // nur wenn auch formulare verfuegbar
347 [ + + ][ - + ]: 3257 : bResult = !m_bDesignMode && GetImpl()->hasDatabaseBar() && GetImpl()->isInFilterMode();
[ # # ]
348 : : }
349 [ + + ]: 29217 : else if ((nFeature & FM_UI_FEATURE_SHOW_FILTERNAVIGATOR) == FM_UI_FEATURE_SHOW_FILTERNAVIGATOR)
350 : : {
351 [ + + ][ - + ]: 3257 : bResult = !m_bDesignMode && GetImpl()->hasDatabaseBar() && GetImpl()->isInFilterMode();
[ # # ]
352 : : }
353 [ + + ]: 25960 : else if ((nFeature & FM_UI_FEATURE_SHOW_FIELD) == FM_UI_FEATURE_SHOW_FIELD)
354 : : {
355 [ + + ][ + - ]: 3241 : bResult = m_bDesignMode && m_pFormView && m_bHasForms;
[ + + ]
356 : : }
357 [ + + ]: 22719 : else if ((nFeature & FM_UI_FEATURE_SHOW_PROPERTIES) == FM_UI_FEATURE_SHOW_PROPERTIES)
358 : : {
359 [ + + ][ + - ]: 3241 : bResult = m_bDesignMode && m_pFormView && m_bHasForms;
[ + + ]
360 : : }
361 [ + + ]: 19478 : else if ((nFeature & FM_UI_FEATURE_SHOW_EXPLORER) == FM_UI_FEATURE_SHOW_EXPLORER)
362 : : {
363 : 3241 : bResult = m_bDesignMode; // OJ #101593# && m_pFormView && m_bHasForms;
364 : : }
365 [ + + ]: 16237 : else if ( ( nFeature & FM_UI_FEATURE_SHOW_TEXT_CONTROL_BAR ) == FM_UI_FEATURE_SHOW_TEXT_CONTROL_BAR )
366 : : {
367 [ + + ][ - + ]: 3257 : bResult = !GetImpl()->IsReadonlyDoc() && m_pImpl->IsActiveControl( true );
368 : : }
369 [ + + ]: 12980 : else if ((nFeature & FM_UI_FEATURE_SHOW_DATANAVIGATOR) == FM_UI_FEATURE_SHOW_DATANAVIGATOR)
370 : : {
371 : 3257 : bResult = GetImpl()->isEnhancedForm();
372 : : }
373 [ + + ][ + + ]: 9723 : else if ( ( ( nFeature & FM_UI_FEATURE_TB_CONTROLS ) == FM_UI_FEATURE_TB_CONTROLS )
[ + - ]
374 : : || ( ( nFeature & FM_UI_FEATURE_TB_MORECONTROLS ) == FM_UI_FEATURE_TB_MORECONTROLS )
375 : : || ( ( nFeature & FM_UI_FEATURE_TB_FORMDESIGN ) == FM_UI_FEATURE_TB_FORMDESIGN )
376 : : )
377 : : {
378 : 9723 : bResult = sal_True;
379 : : }
380 : :
381 : 35731 : return bResult;
382 : : }
383 : :
384 : : //------------------------------------------------------------------------
385 : 4 : void FmFormShell::Execute(SfxRequest &rReq)
386 : : {
387 : 4 : sal_uInt16 nSlot = rReq.GetSlot();
388 : :
389 : : //////////////////////////////////////////////////////////////////////
390 : : // MasterSlot setzen
391 [ - + ]: 4 : switch( nSlot )
392 : : {
393 : : case SID_FM_PUSHBUTTON:
394 : : case SID_FM_RADIOBUTTON:
395 : : case SID_FM_CHECKBOX:
396 : : case SID_FM_FIXEDTEXT:
397 : : case SID_FM_GROUPBOX:
398 : : case SID_FM_LISTBOX:
399 : : case SID_FM_COMBOBOX:
400 : : case SID_FM_NAVIGATIONBAR:
401 : : case SID_FM_EDIT:
402 : : case SID_FM_DBGRID:
403 : : case SID_FM_IMAGEBUTTON:
404 : : case SID_FM_IMAGECONTROL:
405 : : case SID_FM_FILECONTROL:
406 : : case SID_FM_DATEFIELD:
407 : : case SID_FM_TIMEFIELD:
408 : : case SID_FM_NUMERICFIELD:
409 : : case SID_FM_CURRENCYFIELD:
410 : : case SID_FM_PATTERNFIELD:
411 : : case SID_FM_FORMATTEDFIELD:
412 : : case SID_FM_SCROLLBAR:
413 : : case SID_FM_SPINBUTTON:
414 : 0 : m_nLastSlot = nSlot;
415 : 0 : GetViewShell()->GetViewFrame()->GetBindings().Invalidate( SID_FM_CONFIG );
416 : 0 : break;
417 : : }
418 : :
419 : : //////////////////////////////////////////////////////////////////////
420 : : // Identifier und Inventor des Uno-Controls setzen
421 : 4 : sal_uInt16 nIdentifier = 0;
422 [ - - - - : 4 : switch( nSlot )
- - - - -
- - - - -
- - - - -
- - + ]
423 : : {
424 : : case SID_FM_CHECKBOX:
425 : 0 : nIdentifier = OBJ_FM_CHECKBOX;
426 : 0 : break;
427 : : case SID_FM_PUSHBUTTON:
428 : 0 : nIdentifier = OBJ_FM_BUTTON;
429 : 0 : break;
430 : : case SID_FM_FIXEDTEXT:
431 : 0 : nIdentifier = OBJ_FM_FIXEDTEXT;
432 : 0 : break;
433 : : case SID_FM_LISTBOX:
434 : 0 : nIdentifier = OBJ_FM_LISTBOX;
435 : 0 : break;
436 : : case SID_FM_EDIT:
437 : 0 : nIdentifier = OBJ_FM_EDIT;
438 : 0 : break;
439 : : case SID_FM_RADIOBUTTON:
440 : 0 : nIdentifier = OBJ_FM_RADIOBUTTON;
441 : 0 : break;
442 : : case SID_FM_GROUPBOX:
443 : 0 : nIdentifier = OBJ_FM_GROUPBOX;
444 : 0 : break;
445 : : case SID_FM_COMBOBOX:
446 : 0 : nIdentifier = OBJ_FM_COMBOBOX;
447 : 0 : break;
448 : : case SID_FM_NAVIGATIONBAR:
449 : 0 : nIdentifier = OBJ_FM_NAVIGATIONBAR;
450 : 0 : break;
451 : : case SID_FM_DBGRID:
452 : 0 : nIdentifier = OBJ_FM_GRID;
453 : 0 : break;
454 : : case SID_FM_IMAGEBUTTON:
455 : 0 : nIdentifier = OBJ_FM_IMAGEBUTTON;
456 : 0 : break;
457 : : case SID_FM_IMAGECONTROL:
458 : 0 : nIdentifier = OBJ_FM_IMAGECONTROL;
459 : 0 : break;
460 : : case SID_FM_FILECONTROL:
461 : 0 : nIdentifier = OBJ_FM_FILECONTROL;
462 : 0 : break;
463 : : case SID_FM_DATEFIELD:
464 : 0 : nIdentifier = OBJ_FM_DATEFIELD;
465 : 0 : break;
466 : : case SID_FM_TIMEFIELD:
467 : 0 : nIdentifier = OBJ_FM_TIMEFIELD;
468 : 0 : break;
469 : : case SID_FM_NUMERICFIELD:
470 : 0 : nIdentifier = OBJ_FM_NUMERICFIELD;
471 : 0 : break;
472 : : case SID_FM_CURRENCYFIELD:
473 : 0 : nIdentifier = OBJ_FM_CURRENCYFIELD;
474 : 0 : break;
475 : : case SID_FM_PATTERNFIELD:
476 : 0 : nIdentifier = OBJ_FM_PATTERNFIELD;
477 : 0 : break;
478 : : case SID_FM_FORMATTEDFIELD:
479 : 0 : nIdentifier = OBJ_FM_FORMATTEDFIELD;
480 : 0 : break;
481 : : case SID_FM_SCROLLBAR:
482 : 0 : nIdentifier = OBJ_FM_SCROLLBAR;
483 : 0 : break;
484 : : case SID_FM_SPINBUTTON:
485 : 0 : nIdentifier = OBJ_FM_SPINBUTTON;
486 : 0 : break;
487 : : }
488 : :
489 [ - + ]: 4 : switch ( nSlot )
490 : : {
491 : : case SID_FM_CHECKBOX:
492 : : case SID_FM_PUSHBUTTON:
493 : : case SID_FM_FIXEDTEXT:
494 : : case SID_FM_LISTBOX:
495 : : case SID_FM_EDIT:
496 : : case SID_FM_RADIOBUTTON:
497 : : case SID_FM_COMBOBOX:
498 : : case SID_FM_NAVIGATIONBAR:
499 : : case SID_FM_GROUPBOX:
500 : : case SID_FM_DBGRID:
501 : : case SID_FM_IMAGEBUTTON:
502 : : case SID_FM_IMAGECONTROL:
503 : : case SID_FM_FILECONTROL:
504 : : case SID_FM_DATEFIELD:
505 : : case SID_FM_TIMEFIELD:
506 : : case SID_FM_NUMERICFIELD:
507 : : case SID_FM_CURRENCYFIELD:
508 : : case SID_FM_PATTERNFIELD:
509 : : case SID_FM_FORMATTEDFIELD:
510 : : case SID_FM_SCROLLBAR:
511 : : case SID_FM_SPINBUTTON:
512 : : {
513 [ # # ][ # # ]: 0 : SFX_REQUEST_ARG( rReq, pGrabFocusItem, SfxBoolItem, SID_FM_TOGGLECONTROLFOCUS, sal_False );
514 [ # # ][ # # ]: 0 : if ( pGrabFocusItem && pGrabFocusItem->GetValue() )
[ # # ]
515 : : { // see below
516 [ # # ]: 0 : SfxViewShell* pShell = GetViewShell();
517 [ # # ]: 0 : Window* pShellWnd = pShell ? pShell->GetWindow() : NULL;
518 [ # # ]: 0 : if ( pShellWnd )
519 [ # # ]: 0 : pShellWnd->GrabFocus();
520 : : break;
521 : : }
522 : :
523 [ # # ]: 0 : SfxUInt16Item aIdentifierItem( SID_FM_CONTROL_IDENTIFIER, nIdentifier );
524 [ # # ]: 0 : SfxUInt32Item aInventorItem( SID_FM_CONTROL_INVENTOR, FmFormInventor );
525 : : const SfxPoolItem* pArgs[] =
526 : : {
527 : : &aIdentifierItem, &aInventorItem, NULL
528 : 0 : };
529 : : const SfxPoolItem* pInternalArgs[] =
530 : : {
531 : : NULL
532 : 0 : };
533 : :
534 : : GetViewShell()->GetViewFrame()->GetDispatcher()->Execute( SID_FM_CREATE_CONTROL, SFX_CALLMODE_ASYNCHRON,
535 [ # # ][ # # ]: 0 : pArgs, rReq.GetModifier(), pInternalArgs );
[ # # ]
536 : :
537 [ # # ][ # # ]: 0 : if ( rReq.GetModifier() & KEY_MOD1 )
538 : : {
539 : : // #99013# if selected with control key, return focus to current view
540 : : // do this asynchron, so that the creation can be finished first
541 : : // reusing the SID_FM_TOGGLECONTROLFOCUS is somewhat hacky ... which it wouldn't if it would have another
542 : : // name, so I do not really have a big problem with this ....
543 [ # # ]: 0 : SfxBoolItem aGrabFocusIndicatorItem( SID_FM_TOGGLECONTROLFOCUS, sal_True );
544 : : GetViewShell()->GetViewFrame()->GetDispatcher()->Execute( nSlot, SFX_CALLMODE_ASYNCHRON,
545 [ # # ][ # # ]: 0 : &aGrabFocusIndicatorItem, NULL );
[ # # ]
546 : : }
547 : :
548 [ # # ][ # # ]: 0 : rReq.Done();
[ # # ]
549 : 0 : } break;
550 : : }
551 : :
552 : : // Individuelle Aktionen
553 [ - - - - : 4 : switch( nSlot )
- - - - -
- - + - -
- - - - -
- - ]
554 : : {
555 : : case SID_FM_MORE_CONTROLS:
556 : : case SID_FM_FORM_DESIGN_TOOLS:
557 : : {
558 [ # # ]: 0 : FormToolboxes aToolboxAccess( GetImpl()->getHostFrame() );
559 [ # # ]: 0 : aToolboxAccess.toggleToolbox( nSlot );
560 [ # # ][ # # ]: 0 : rReq.Done();
561 : : }
562 : 0 : break;
563 : :
564 : : case SID_FM_TOGGLECONTROLFOCUS:
565 : : {
566 : 0 : FmFormView* pFormView = GetFormView();
567 [ # # ]: 0 : if ( !pFormView )
568 : 0 : break;
569 : :
570 : : // if we execute this ourself, then either the application does not implement an own handling for this,
571 : : // of we're on the top of the dispatcher stack, which means a control has the focus.
572 : : // In the latter case, we put the focus to the document window, otherwise, we focus the first control
573 : 0 : const bool bHasControlFocus = GetImpl()->HasControlFocus();
574 [ # # ]: 0 : if ( bHasControlFocus )
575 : : {
576 : 0 : const OutputDevice* pDevice = GetCurrentViewDevice();
577 [ # # ]: 0 : Window* pWindow = dynamic_cast< Window* >( const_cast< OutputDevice* >( pDevice ) );
578 [ # # ]: 0 : if ( pWindow )
579 : 0 : pWindow->GrabFocus();
580 : : }
581 : : else
582 : : {
583 : 0 : pFormView->GrabFirstControlFocus( );
584 : : }
585 : : }
586 : 0 : break;
587 : :
588 : : case SID_FM_VIEW_AS_GRID:
589 : 0 : GetImpl()->CreateExternalView();
590 : 0 : break;
591 : : case SID_FM_CONVERTTO_EDIT :
592 : : case SID_FM_CONVERTTO_BUTTON :
593 : : case SID_FM_CONVERTTO_FIXEDTEXT :
594 : : case SID_FM_CONVERTTO_LISTBOX :
595 : : case SID_FM_CONVERTTO_CHECKBOX :
596 : : case SID_FM_CONVERTTO_RADIOBUTTON :
597 : : case SID_FM_CONVERTTO_GROUPBOX :
598 : : case SID_FM_CONVERTTO_COMBOBOX :
599 : : case SID_FM_CONVERTTO_IMAGEBUTTON :
600 : : case SID_FM_CONVERTTO_FILECONTROL :
601 : : case SID_FM_CONVERTTO_DATE :
602 : : case SID_FM_CONVERTTO_TIME :
603 : : case SID_FM_CONVERTTO_NUMERIC :
604 : : case SID_FM_CONVERTTO_CURRENCY :
605 : : case SID_FM_CONVERTTO_PATTERN :
606 : : case SID_FM_CONVERTTO_IMAGECONTROL :
607 : : case SID_FM_CONVERTTO_FORMATTED :
608 : : case SID_FM_CONVERTTO_SCROLLBAR :
609 : : case SID_FM_CONVERTTO_SPINBUTTON :
610 : : case SID_FM_CONVERTTO_NAVIGATIONBAR :
611 : 0 : GetImpl()->executeControlConversionSlot( nSlot );
612 : : // nach dem Konvertieren die Selektion neu bestimmern, da sich ja das selektierte Objekt
613 : : // geaendert hat
614 : 0 : GetImpl()->SetSelection(GetFormView()->GetMarkedObjectList());
615 : 0 : break;
616 : : case SID_FM_LEAVE_CREATE:
617 : 0 : m_nLastSlot = 0;
618 : 0 : GetViewShell()->GetViewFrame()->GetBindings().Invalidate( SID_FM_CONFIG );
619 : 0 : rReq.Done();
620 : 0 : break;
621 : : case SID_FM_SHOW_PROPERTY_BROWSER:
622 : : {
623 : 0 : SFX_REQUEST_ARG( rReq, pShowItem, SfxBoolItem, SID_FM_SHOW_PROPERTIES, sal_False );
624 : 0 : sal_Bool bShow = sal_True;
625 [ # # ]: 0 : if ( pShowItem )
626 : 0 : bShow = pShowItem->GetValue();
627 : 0 : GetImpl()->ShowSelectionProperties( bShow );
628 : :
629 : 0 : rReq.Done();
630 : 0 : } break;
631 : :
632 : : case SID_FM_PROPERTIES:
633 : : {
634 : : // PropertyBrowser anzeigen
635 [ # # ][ # # ]: 0 : SFX_REQUEST_ARG(rReq, pShowItem, SfxBoolItem, nSlot, sal_False);
636 [ # # ]: 0 : sal_Bool bShow = pShowItem ? pShowItem->GetValue() : sal_True;
637 : :
638 [ # # ]: 0 : InterfaceBag aOnlyTheForm;
639 [ # # ][ # # ]: 0 : aOnlyTheForm.insert( Reference< XInterface >( GetImpl()->getCurrentForm(), UNO_QUERY ) );
[ # # ]
640 [ # # ]: 0 : GetImpl()->setCurrentSelection( aOnlyTheForm );
641 : :
642 [ # # ]: 0 : GetImpl()->ShowSelectionProperties( bShow );
643 : :
644 [ # # ]: 0 : rReq.Done();
645 : 0 : } break;
646 : :
647 : : case SID_FM_CTL_PROPERTIES:
648 : : {
649 : 0 : SFX_REQUEST_ARG(rReq, pShowItem, SfxBoolItem, nSlot, sal_False);
650 [ # # ]: 0 : sal_Bool bShow = pShowItem ? pShowItem->GetValue() : sal_True;
651 : :
652 : : OSL_ENSURE( GetImpl()->onlyControlsAreMarked(), "FmFormShell::Execute: ControlProperties should be disabled!" );
653 [ # # ]: 0 : if ( bShow )
654 : 0 : GetImpl()->selectLastMarkedControls();
655 : 0 : GetImpl()->ShowSelectionProperties( bShow );
656 : :
657 : 0 : rReq.Done();
658 : 0 : } break;
659 : : case SID_FM_SHOW_PROPERTIES:
660 : : case SID_FM_ADD_FIELD:
661 : : case SID_FM_FILTER_NAVIGATOR:
662 : : case SID_FM_SHOW_DATANAVIGATOR :
663 : : {
664 : 0 : GetViewShell()->GetViewFrame()->ChildWindowExecute( rReq );
665 : 0 : rReq.Done();
666 : 0 : } break;
667 : : case SID_FM_SHOW_FMEXPLORER:
668 : : {
669 [ # # ]: 0 : if (!m_pFormView) // setzen der ::com::sun::star::sdbcx::View Forcieren
670 : 0 : GetViewShell()->GetViewFrame()->GetDispatcher()->Execute(SID_CREATE_SW_DRAWVIEW);
671 : :
672 : 0 : GetViewShell()->GetViewFrame()->ChildWindowExecute(rReq);
673 : 0 : rReq.Done();
674 : : }
675 : 0 : break;
676 : :
677 : : case SID_FM_TAB_DIALOG:
678 : : {
679 [ # # ][ # # ]: 0 : GetImpl()->ExecuteTabOrderDialog( Reference< XTabControllerModel >( GetImpl()->getCurrentForm(), UNO_QUERY ) );
680 : 0 : rReq.Done();
681 : : }
682 : 0 : break;
683 : :
684 : : case SID_FM_DESIGN_MODE:
685 : : {
686 : 4 : SFX_REQUEST_ARG(rReq, pDesignItem, SfxBoolItem, nSlot, sal_False);
687 [ + - ]: 4 : sal_Bool bDesignMode = pDesignItem ? pDesignItem->GetValue() : !m_bDesignMode;
688 : 4 : SetDesignMode( bDesignMode );
689 [ + - ]: 4 : if ( m_bDesignMode == bDesignMode )
690 : 4 : rReq.Done();
691 : :
692 : 4 : m_nLastSlot = SID_FM_DESIGN_MODE;
693 : 4 : GetViewShell()->GetViewFrame()->GetBindings().Invalidate( SID_FM_CONFIG );
694 : : }
695 : 4 : break;
696 : :
697 : : case SID_FM_AUTOCONTROLFOCUS:
698 : : {
699 : 0 : FmFormModel* pModel = GetFormModel();
700 : : DBG_ASSERT(pModel, "FmFormShell::Execute : invalid call !");
701 : : // should have been disabled in GetState if we don't have a FormModel
702 : 0 : pModel->SetAutoControlFocus( !pModel->GetAutoControlFocus() );
703 : 0 : GetViewShell()->GetViewFrame()->GetBindings().Invalidate(SID_FM_AUTOCONTROLFOCUS);
704 : : }
705 : 0 : break;
706 : : case SID_FM_OPEN_READONLY:
707 : : {
708 : 0 : FmFormModel* pModel = GetFormModel();
709 : : DBG_ASSERT(pModel, "FmFormShell::Execute : invalid call !");
710 : : // should have been disabled in GetState if we don't have a FormModel
711 : 0 : pModel->SetOpenInDesignMode( !pModel->GetOpenInDesignMode() );
712 : 0 : GetViewShell()->GetViewFrame()->GetBindings().Invalidate(SID_FM_OPEN_READONLY);
713 : : }
714 : 0 : break;
715 : : case SID_FM_USE_WIZARDS:
716 : : {
717 : 0 : GetImpl()->SetWizardUsing(!GetImpl()->GetWizardUsing());
718 : 0 : GetViewShell()->GetViewFrame()->GetBindings().Invalidate(SID_FM_USE_WIZARDS);
719 : : }
720 : 0 : break;
721 : : case SID_FM_SEARCH:
722 : : {
723 : 0 : const ::svx::ControllerFeatures& rController = GetImpl()->getActiveControllerFeatures();
724 [ # # ][ # # ]: 0 : if ( rController->commitCurrentControl() && rController->commitCurrentRecord() )
[ # # ]
725 : 0 : GetImpl()->ExecuteSearch();
726 : 0 : rReq.Done();
727 : : }
728 : 0 : break;
729 : :
730 : : case SID_FM_RECORD_FIRST:
731 : : case SID_FM_RECORD_PREV:
732 : : case SID_FM_RECORD_NEXT:
733 : : case SID_FM_RECORD_LAST:
734 : : case SID_FM_RECORD_NEW:
735 : : case SID_FM_REFRESH:
736 : : case SID_FM_REFRESH_FORM_CONTROL:
737 : : case SID_FM_RECORD_DELETE:
738 : : case SID_FM_RECORD_UNDO:
739 : : case SID_FM_RECORD_SAVE:
740 : : case SID_FM_REMOVE_FILTER_SORT:
741 : : case SID_FM_SORTDOWN:
742 : : case SID_FM_SORTUP:
743 : : case SID_FM_AUTOFILTER:
744 : : case SID_FM_ORDERCRIT:
745 : : case SID_FM_FORM_FILTERED:
746 : : {
747 : 0 : GetImpl()->ExecuteFormSlot( nSlot );
748 : 0 : rReq.Done();
749 : : }
750 : 0 : break;
751 : :
752 : : case SID_FM_RECORD_ABSOLUTE:
753 : : {
754 : 0 : const ::svx::ControllerFeatures& rController = GetImpl()->getNavControllerFeatures();
755 : 0 : sal_Int32 nRecord = -1;
756 : :
757 : 0 : const SfxItemSet* pArgs = rReq.GetArgs();
758 [ # # ]: 0 : if ( pArgs )
759 : : {
760 : : const SfxPoolItem* pItem;
761 [ # # ][ # # ]: 0 : if ( ( pArgs->GetItemState( FN_PARAM_1, sal_True, &pItem ) ) == SFX_ITEM_SET )
762 : : {
763 [ # # ][ # # ]: 0 : const SfxInt32Item* pTypedItem = PTR_CAST( SfxInt32Item, pItem );
[ # # ][ # # ]
764 [ # # ]: 0 : if ( pTypedItem )
765 : 0 : nRecord = Max( pTypedItem->GetValue(), sal_Int32(0) );
766 : : }
767 : : }
768 : : else
769 : : {
770 : 0 : SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
771 : : DBG_ASSERT( pFact, "no dialog factory!" );
772 [ # # ]: 0 : if ( pFact )
773 : : {
774 [ # # ]: 0 : boost::scoped_ptr< AbstractFmInputRecordNoDialog > dlg( pFact->CreateFmInputRecordNoDialog( NULL ) );
775 : : DBG_ASSERT( dlg.get(), "Dialogdiet fail!" );
776 [ # # ][ # # ]: 0 : dlg->SetValue( rController->getCursor()->getRow() );
[ # # ][ # # ]
777 [ # # ][ # # ]: 0 : if ( dlg->Execute() == RET_OK )
778 [ # # ]: 0 : nRecord = dlg->GetValue();
779 : :
780 [ # # ][ # # ]: 0 : rReq.AppendItem( SfxInt32Item( FN_PARAM_1, nRecord ) );
[ # # ][ # # ]
781 : : }
782 : : }
783 : :
784 [ # # ]: 0 : if ( nRecord != -1 )
785 [ # # ][ # # ]: 0 : rController->execute( nSlot, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Position" )), makeAny( (sal_Int32)nRecord ) );
[ # # ]
786 : :
787 : 0 : rReq.Done();
788 : 0 : } break;
789 : : case SID_FM_FILTER_EXECUTE:
790 : : case SID_FM_FILTER_EXIT:
791 : : {
792 : 0 : sal_Bool bCancelled = ( SID_FM_FILTER_EXIT == nSlot );
793 : 0 : sal_Bool bReopenNavigator = sal_False;
794 : :
795 [ # # ]: 0 : if ( !bCancelled )
796 : : {
797 : : // if the filter navigator is still open, we need to close it, so it can possibly
798 : : // commit it's most recent changes
799 [ # # ][ # # ]: 0 : if ( GetViewShell() && GetViewShell()->GetViewFrame() )
[ # # ][ # # ]
[ # # ]
800 [ # # ][ # # ]: 0 : if ( GetViewShell()->GetViewFrame()->HasChildWindow( SID_FM_FILTER_NAVIGATOR ) )
[ # # ]
801 : : {
802 [ # # ][ # # ]: 0 : GetViewShell()->GetViewFrame()->ToggleChildWindow( SID_FM_FILTER_NAVIGATOR );
803 : 0 : bReopenNavigator = sal_True;
804 : : }
805 : :
806 : 0 : Reference< runtime::XFormController > xController( GetImpl()->getActiveController() );
807 : :
808 [ # # ]: 0 : if ( GetViewShell()->GetViewFrame()->HasChildWindow( SID_FM_FILTER_NAVIGATOR )
[ # # # # ]
[ # # ][ # # ]
[ # # ]
809 : : // closing the window was denied, for instance because of a invalid criterion
810 : :
811 : 0 : || ( xController.is()
812 [ # # ]: 0 : && !GetImpl()->getActiveControllerFeatures()->commitCurrentControl( )
813 : : )
814 : : // committing the controller was denied
815 : : )
816 : : {
817 [ # # ]: 0 : rReq.Done();
818 : : break;
819 [ # # ]: 0 : }
820 : : }
821 : :
822 : 0 : GetImpl()->stopFiltering( !bCancelled );
823 : 0 : rReq.Done();
824 : :
825 [ # # ]: 0 : if ( bReopenNavigator )
826 : : // we closed the navigator only to implicitly commit it (as we do not have another
827 : : // direct wire to it), but to the user, it should look it it was always open
828 : 0 : GetViewShell()->GetViewFrame()->ToggleChildWindow( SID_FM_FILTER_NAVIGATOR );
829 : : }
830 : 0 : break;
831 : :
832 : : case SID_FM_FILTER_START:
833 : : {
834 [ # # ]: 0 : GetImpl()->startFiltering();
835 [ # # ]: 0 : rReq.Done();
836 : :
837 : : // initially open the filter navigator, the whole form based filter is pretty useless without it
838 [ # # ]: 0 : SfxBoolItem aIdentifierItem( SID_FM_FILTER_NAVIGATOR, sal_True );
839 : : GetViewShell()->GetViewFrame()->GetDispatcher()->Execute( SID_FM_FILTER_NAVIGATOR, SFX_CALLMODE_ASYNCHRON,
840 [ # # ][ # # ]: 0 : &aIdentifierItem, NULL );
[ # # ]
841 : 0 : } break;
842 : : }
843 : 4 : }
844 : :
845 : : //------------------------------------------------------------------------
846 : 169 : void FmFormShell::GetState(SfxItemSet &rSet)
847 : : {
848 [ + - ]: 169 : SfxWhichIter aIter( rSet );
849 [ + - ]: 169 : sal_uInt16 nWhich = aIter.FirstWhich();
850 [ + + ]: 338 : while ( nWhich )
851 : : {
852 [ - - - - : 169 : switch( nWhich )
- - - - -
- - - - -
- + + - -
- - ]
853 : : {
854 : : case SID_FM_MORE_CONTROLS:
855 : : case SID_FM_FORM_DESIGN_TOOLS:
856 : : {
857 [ # # ]: 0 : FormToolboxes aToolboxAccess( GetImpl()->getHostFrame() );
858 [ # # ][ # # ]: 0 : rSet.Put( SfxBoolItem( nWhich, aToolboxAccess.isToolboxVisible( nWhich ) ) );
[ # # ][ # # ]
[ # # ]
859 : : }
860 : 0 : break;
861 : :
862 : : case SID_FM_FILTER_EXECUTE:
863 : : case SID_FM_FILTER_EXIT:
864 [ # # ]: 0 : if (!GetImpl()->isInFilterMode())
865 [ # # ]: 0 : rSet.DisableItem( nWhich );
866 : 0 : break;
867 : :
868 : : case SID_FM_USE_WIZARDS:
869 [ # # ][ # # ]: 0 : if ( !SvtModuleOptions().IsModuleInstalled( SvtModuleOptions::E_SDATABASE ) )
[ # # ][ # # ]
870 [ # # ][ # # ]: 0 : rSet.Put( SfxVisibilityItem( nWhich, sal_False ) );
[ # # ]
871 [ # # ]: 0 : else if (!GetFormModel())
872 [ # # ]: 0 : rSet.DisableItem( nWhich );
873 : : else
874 [ # # ][ # # ]: 0 : rSet.Put( SfxBoolItem(nWhich, GetImpl()->GetWizardUsing() ) );
[ # # ]
875 : 0 : break;
876 : : case SID_FM_AUTOCONTROLFOCUS:
877 [ # # ]: 0 : if (!GetFormModel())
878 [ # # ]: 0 : rSet.DisableItem( nWhich );
879 : : else
880 [ # # ][ # # ]: 0 : rSet.Put( SfxBoolItem(nWhich, GetFormModel()->GetAutoControlFocus() ) );
[ # # ]
881 : 0 : break;
882 : : case SID_FM_OPEN_READONLY:
883 [ # # ]: 0 : if (!GetFormModel())
884 [ # # ]: 0 : rSet.DisableItem( nWhich );
885 : : else
886 [ # # ][ # # ]: 0 : rSet.Put( SfxBoolItem(nWhich, GetFormModel()->GetOpenInDesignMode() ) );
[ # # ]
887 : 0 : break;
888 : :
889 : : case SID_FM_NAVIGATIONBAR:
890 : : case SID_FM_DBGRID:
891 [ # # ][ # # ]: 0 : if ( !SvtModuleOptions().IsModuleInstalled( SvtModuleOptions::E_SDATABASE ) )
[ # # ][ # # ]
892 : : {
893 [ # # ][ # # ]: 0 : rSet.Put( SfxVisibilityItem( nWhich, sal_False ) );
[ # # ]
894 : 0 : break;
895 : : }
896 : : // NO break!
897 : :
898 : : case SID_FM_SCROLLBAR:
899 : : case SID_FM_IMAGECONTROL:
900 : : case SID_FM_FILECONTROL:
901 : : case SID_FM_CURRENCYFIELD:
902 : : case SID_FM_PATTERNFIELD:
903 : : case SID_FM_IMAGEBUTTON:
904 : : case SID_FM_RADIOBUTTON:
905 : : case SID_FM_COMBOBOX:
906 : : case SID_FM_GROUPBOX:
907 : : case SID_FM_CHECKBOX:
908 : : case SID_FM_PUSHBUTTON:
909 : : case SID_FM_FIXEDTEXT:
910 : : case SID_FM_LISTBOX:
911 : : case SID_FM_EDIT:
912 : : case SID_FM_DATEFIELD:
913 : : case SID_FM_TIMEFIELD:
914 : : case SID_FM_NUMERICFIELD:
915 : : case SID_FM_FORMATTEDFIELD:
916 : : case SID_FM_SPINBUTTON:
917 [ # # ]: 0 : if (!m_bDesignMode)
918 [ # # ]: 0 : rSet.DisableItem( nWhich );
919 : : else
920 : : {
921 : 0 : sal_Bool bLayerLocked = sal_False;
922 [ # # ]: 0 : if (m_pFormView)
923 : : {
924 : : // Ist der ::com::sun::star::drawing::Layer gelocked, so m???ssen die Slots disabled werden. #36897
925 : 0 : SdrPageView* pPV = m_pFormView->GetSdrPageView();
926 [ # # ]: 0 : if (pPV != NULL)
927 [ # # ]: 0 : bLayerLocked = pPV->IsLayerLocked(m_pFormView->GetActiveLayer());
928 : : }
929 [ # # ]: 0 : if (bLayerLocked)
930 [ # # ]: 0 : rSet.DisableItem( nWhich );
931 : : else
932 [ # # ][ # # ]: 0 : rSet.Put( SfxBoolItem(nWhich, (nWhich==m_nLastSlot)) );
[ # # ]
933 : : }
934 : 0 : break;
935 : : case SID_FM_FILTER_NAVIGATOR_CONTROL:
936 : : {
937 [ # # ]: 0 : if (GetImpl()->isInFilterMode())
938 [ # # ][ # # ]: 0 : rSet.Put(SfxObjectItem(nWhich, this));
[ # # ]
939 : : else
940 [ # # ][ # # ]: 0 : rSet.Put(SfxObjectItem(nWhich));
[ # # ]
941 : 0 : } break;
942 : : case SID_FM_FIELDS_CONTROL:
943 : : case SID_FM_PROPERTY_CONTROL:
944 : : {
945 [ # # ][ # # ]: 0 : if (!m_bDesignMode || !m_pFormView || !m_bHasForms)
[ # # ]
946 [ # # ][ # # ]: 0 : rSet.Put(SfxObjectItem(nWhich));
[ # # ]
947 : : else
948 [ # # ][ # # ]: 0 : rSet.Put(SfxObjectItem(nWhich, this));
[ # # ]
949 : :
950 : 0 : } break;
951 : : case SID_FM_FMEXPLORER_CONTROL:
952 : : case SID_FM_DATANAVIGATOR_CONTROL :
953 : : {
954 [ # # ][ # # ]: 0 : if (!m_bDesignMode || !m_pFormView)
955 [ # # ][ # # ]: 0 : rSet.Put(SfxObjectItem(nWhich));
[ # # ]
956 : : else
957 [ # # ][ # # ]: 0 : rSet.Put(SfxObjectItem(nWhich, this));
[ # # ]
958 : :
959 : 0 : } break;
960 : : case SID_FM_ADD_FIELD:
961 : : case SID_FM_SHOW_FMEXPLORER:
962 : : case SID_FM_SHOW_PROPERTIES:
963 : : case SID_FM_FILTER_NAVIGATOR:
964 : : case SID_FM_SHOW_DATANAVIGATOR:
965 : : {
966 [ # # ][ # # ]: 0 : if ( GetViewShell()->GetViewFrame()->KnowsChildWindow(nWhich) )
[ # # ]
967 [ # # ][ # # ]: 0 : rSet.Put( SfxBoolItem( nWhich, GetViewShell()->GetViewFrame()->HasChildWindow(nWhich)) );
[ # # ][ # # ]
[ # # ]
968 : : else
969 [ # # ]: 0 : rSet.DisableItem(nWhich);
970 : 0 : } break;
971 : :
972 : : case SID_FM_SHOW_PROPERTY_BROWSER:
973 : : {
974 [ # # ][ # # ]: 0 : rSet.Put(SfxBoolItem(GetImpl()->IsPropBrwOpen()));
[ # # ][ # # ]
975 : : }
976 : 0 : break;
977 : :
978 : : case SID_FM_CTL_PROPERTIES:
979 : : {
980 : : // der Impl eventuell die Moeglichjkeit geben, ihre an der aktuellen MarkList ausgerichteten Objekte
981 : : // auf den neuesten Stand zu bringen
982 [ # # ]: 0 : if (GetImpl()->IsSelectionUpdatePending())
983 [ # # ]: 0 : GetImpl()->ForceUpdateSelection(sal_False);
984 : :
985 [ # # ][ # # ]: 0 : if ( !m_pFormView || !m_bDesignMode || !GetImpl()->onlyControlsAreMarked() )
[ # # ][ # # ]
986 [ # # ]: 0 : rSet.DisableItem( nWhich );
987 : : else
988 : : {
989 [ # # ][ # # ]: 0 : sal_Bool bChecked = GetImpl()->IsPropBrwOpen() && !GetImpl()->isSolelySelected( GetImpl()->getCurrentForm() );
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
990 : : // if the property browser is open, and only controls are marked, and the current selection
991 : : // does not consist of only the current form, then the current selection is the (composition of)
992 : : // the currently marked controls
993 [ # # ][ # # ]: 0 : rSet.Put( SfxBoolItem( nWhich, bChecked ) );
[ # # ]
994 : : }
995 : 0 : } break;
996 : :
997 : : case SID_FM_PROPERTIES:
998 : : {
999 : : // der Impl eventuell die Moeglichjkeit geben, ihre an der aktuellen MarkList ausgerichteten Objekte
1000 : : // auf den neuesten Stand zu bringen
1001 [ # # ]: 0 : if (GetImpl()->IsSelectionUpdatePending())
1002 [ # # ]: 0 : GetImpl()->ForceUpdateSelection(sal_False);
1003 : :
1004 [ # # ][ # # ]: 0 : if ( !m_pFormView || !m_bDesignMode || !GetImpl()->getCurrentForm().is() )
[ # # ][ # # ]
[ # # ]
[ # # # # ]
1005 [ # # ]: 0 : rSet.DisableItem( nWhich );
1006 : : else
1007 : : {
1008 [ # # ][ # # ]: 0 : sal_Bool bChecked = GetImpl()->IsPropBrwOpen() && GetImpl()->isSolelySelected( GetImpl()->getCurrentForm() );
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
1009 [ # # ][ # # ]: 0 : rSet.Put(SfxBoolItem(nWhich, bChecked));
[ # # ]
1010 : : }
1011 : 0 : } break;
1012 : : case SID_FM_TAB_DIALOG:
1013 : : // der Impl eventuell die Moeglichjkeit geben, ihre an der aktuellen MarkList ausgerichteten Objekte
1014 : : // auf den neuesten Stand zu bringen
1015 [ # # ]: 0 : if (GetImpl()->IsSelectionUpdatePending())
1016 [ # # ]: 0 : GetImpl()->ForceUpdateSelection(sal_False);
1017 : :
1018 [ # # ][ # # ]: 0 : if (!m_pFormView || !m_bDesignMode || !GetImpl()->getCurrentForm().is() )
[ # # ][ # # ]
[ # # ]
[ # # # # ]
1019 [ # # ]: 0 : rSet.DisableItem( nWhich );
1020 : 0 : break;
1021 : : case SID_FM_CONFIG:
1022 [ + - ][ + - ]: 155 : rSet.Put(SfxUInt16Item(nWhich, m_nLastSlot));
[ + - ]
1023 : 155 : break;
1024 : : case SID_FM_DESIGN_MODE:
1025 [ + - ][ + - ]: 14 : if (!m_pFormView || GetImpl()->IsReadonlyDoc() )
[ - + ][ - + ]
1026 [ # # ]: 0 : rSet.DisableItem( nWhich );
1027 : : else
1028 [ + - ][ + - ]: 14 : rSet.Put( SfxBoolItem(nWhich, m_bDesignMode) );
[ + - ]
1029 : 14 : break;
1030 : : case SID_FM_SEARCH:
1031 : : case SID_FM_RECORD_FIRST:
1032 : : case SID_FM_RECORD_NEXT:
1033 : : case SID_FM_RECORD_PREV:
1034 : : case SID_FM_RECORD_LAST:
1035 : : case SID_FM_RECORD_NEW:
1036 : : case SID_FM_RECORD_DELETE:
1037 : : case SID_FM_RECORD_ABSOLUTE:
1038 : : case SID_FM_RECORD_TOTAL:
1039 : : case SID_FM_RECORD_SAVE:
1040 : : case SID_FM_RECORD_UNDO:
1041 : : case SID_FM_FORM_FILTERED:
1042 : : case SID_FM_REMOVE_FILTER_SORT:
1043 : : case SID_FM_SORTUP:
1044 : : case SID_FM_SORTDOWN:
1045 : : case SID_FM_ORDERCRIT:
1046 : : case SID_FM_FILTER_START:
1047 : : case SID_FM_AUTOFILTER:
1048 : : case SID_FM_REFRESH:
1049 : : case SID_FM_REFRESH_FORM_CONTROL:
1050 : : case SID_FM_VIEW_AS_GRID:
1051 [ # # ]: 0 : GetFormState(rSet,nWhich);
1052 : 0 : break;
1053 : :
1054 : : case SID_FM_CHANGECONTROLTYPE:
1055 : : {
1056 [ # # ][ # # ]: 0 : if ( !m_pFormView || !m_bDesignMode )
1057 [ # # ]: 0 : rSet.DisableItem( nWhich );
1058 : : else
1059 : : {
1060 [ # # ][ # # ]: 0 : if ( !GetImpl()->canConvertCurrentSelectionToControl( OBJ_FM_FIXEDTEXT ) )
1061 : : // if it cannot be converted to a fixed text, it is no single control
1062 [ # # ]: 0 : rSet.DisableItem( nWhich );
1063 : : }
1064 : 0 : } break;
1065 : :
1066 : : case SID_FM_CONVERTTO_FILECONTROL :
1067 : : case SID_FM_CONVERTTO_CURRENCY :
1068 : : case SID_FM_CONVERTTO_PATTERN :
1069 : : case SID_FM_CONVERTTO_IMAGECONTROL :
1070 : : case SID_FM_CONVERTTO_SCROLLBAR :
1071 : : case SID_FM_CONVERTTO_NAVIGATIONBAR :
1072 : : case SID_FM_CONVERTTO_IMAGEBUTTON :
1073 : : case SID_FM_CONVERTTO_EDIT :
1074 : : case SID_FM_CONVERTTO_BUTTON :
1075 : : case SID_FM_CONVERTTO_FIXEDTEXT :
1076 : : case SID_FM_CONVERTTO_LISTBOX :
1077 : : case SID_FM_CONVERTTO_CHECKBOX :
1078 : : case SID_FM_CONVERTTO_RADIOBUTTON :
1079 : : case SID_FM_CONVERTTO_GROUPBOX :
1080 : : case SID_FM_CONVERTTO_COMBOBOX :
1081 : : case SID_FM_CONVERTTO_DATE :
1082 : : case SID_FM_CONVERTTO_TIME :
1083 : : case SID_FM_CONVERTTO_NUMERIC :
1084 : : case SID_FM_CONVERTTO_FORMATTED :
1085 : : case SID_FM_CONVERTTO_SPINBUTTON :
1086 : : {
1087 [ # # ][ # # ]: 0 : if ( !m_pFormView || !m_bDesignMode || !GetImpl()->canConvertCurrentSelectionToControl( nWhich ) )
[ # # ][ # # ]
[ # # ]
1088 [ # # ]: 0 : rSet.DisableItem( nWhich );
1089 : : else
1090 : : {
1091 [ # # ][ # # ]: 0 : rSet.Put( SfxBoolItem( nWhich, sal_False ) );
[ # # ]
1092 : : // just to have a defined state (available and not checked)
1093 : : }
1094 : : }
1095 : 0 : break;
1096 : : }
1097 [ + - ]: 169 : nWhich = aIter.NextWhich();
1098 [ + - ]: 169 : }
1099 : 169 : }
1100 : :
1101 : : //------------------------------------------------------------------------
1102 : 0 : void FmFormShell::GetFormState(SfxItemSet &rSet, sal_uInt16 nWhich)
1103 : : {
1104 [ # # ][ # # ]: 0 : if ( !GetImpl()->getNavController().is()
[ # # ][ # #
# # # # ]
[ # # ]
1105 [ # # ][ # # ]: 0 : || !isRowSetAlive(GetImpl()->getNavController()->getModel())
[ # # ][ # # ]
[ # # ]
1106 : 0 : || !m_pFormView
1107 : : || m_bDesignMode
1108 : 0 : || !GetImpl()->getActiveForm().is()
1109 : 0 : || GetImpl()->isInFilterMode()
1110 : : )
1111 : 0 : rSet.DisableItem(nWhich);
1112 : : else
1113 : : {
1114 : 0 : sal_Bool bEnable = sal_False;
1115 : : try
1116 : : {
1117 [ # # # # : 0 : switch (nWhich)
# # # ]
1118 : : {
1119 : : case SID_FM_VIEW_AS_GRID:
1120 [ # # ][ # # ]: 0 : if (GetImpl()->getHostFrame().is() && GetImpl()->getNavController().is())
[ # # ]
1121 : : {
1122 : 0 : bEnable = sal_True;
1123 : : sal_Bool bDisplayingCurrent =
1124 : : GetImpl()->getInternalForm(
1125 [ # # ]: 0 : Reference< XForm >( GetImpl()->getNavController()->getModel(), UNO_QUERY )
1126 [ # # ][ # # ]: 0 : ) == GetImpl()->getExternallyDisplayedForm();
[ # # ][ # # ]
1127 [ # # ][ # # ]: 0 : rSet.Put(SfxBoolItem(nWhich, bDisplayingCurrent));
[ # # ]
1128 : : }
1129 : 0 : break;
1130 : :
1131 : : case SID_FM_SEARCH:
1132 : : {
1133 [ # # ]: 0 : Reference< ::com::sun::star::beans::XPropertySet > xNavSet(GetImpl()->getActiveForm(), UNO_QUERY);
1134 [ # # ][ # # ]: 0 : sal_Int32 nCount = ::comphelper::getINT32(xNavSet->getPropertyValue(FM_PROP_ROWCOUNT));
[ # # ][ # # ]
1135 : 0 : bEnable = nCount != 0;
1136 : 0 : } break;
1137 : : case SID_FM_RECORD_ABSOLUTE:
1138 : : case SID_FM_RECORD_TOTAL:
1139 : : {
1140 : 0 : FeatureState aState;
1141 [ # # ]: 0 : GetImpl()->getNavControllerFeatures()->getState( nWhich, aState );
1142 [ # # ]: 0 : if ( SID_FM_RECORD_ABSOLUTE == nWhich )
1143 : : {
1144 : 0 : sal_Int32 nPosition = 0;
1145 : 0 : aState.State >>= nPosition;
1146 [ # # ][ # # ]: 0 : rSet.Put( SfxInt32Item( nWhich, nPosition ) );
[ # # ]
1147 : : }
1148 [ # # ]: 0 : else if ( SID_FM_RECORD_TOTAL == nWhich )
1149 : : {
1150 : 0 : ::rtl::OUString sTotalCount;
1151 : 0 : aState.State >>= sTotalCount;
1152 [ # # ][ # # ]: 0 : rSet.Put( SfxStringItem( nWhich, sTotalCount ) );
[ # # ][ # # ]
[ # # ]
1153 : : }
1154 : 0 : bEnable = aState.Enabled;
1155 : : }
1156 : 0 : break;
1157 : :
1158 : : // first, prev, next, last, and absolute affect the nav controller, not the
1159 : : // active controller
1160 : : case SID_FM_RECORD_FIRST:
1161 : : case SID_FM_RECORD_PREV:
1162 : : case SID_FM_RECORD_NEXT:
1163 : : case SID_FM_RECORD_LAST:
1164 : : case SID_FM_RECORD_NEW:
1165 : : case SID_FM_RECORD_SAVE:
1166 : : case SID_FM_RECORD_UNDO:
1167 : : case SID_FM_RECORD_DELETE:
1168 : : case SID_FM_REFRESH:
1169 : : case SID_FM_REFRESH_FORM_CONTROL:
1170 : : case SID_FM_REMOVE_FILTER_SORT:
1171 : : case SID_FM_SORTUP:
1172 : : case SID_FM_SORTDOWN:
1173 : : case SID_FM_AUTOFILTER:
1174 : : case SID_FM_ORDERCRIT:
1175 [ # # ]: 0 : bEnable = GetImpl()->IsFormSlotEnabled( nWhich );
1176 : 0 : break;
1177 : :
1178 : : case SID_FM_FORM_FILTERED:
1179 : : {
1180 : 0 : FeatureState aState;
1181 [ # # ]: 0 : bEnable = GetImpl()->IsFormSlotEnabled( nWhich, &aState );
1182 : :
1183 [ # # ][ # # ]: 0 : rSet.Put( SfxBoolItem( nWhich, ::comphelper::getBOOL( aState.State ) ) );
[ # # ][ # # ]
[ # # ]
1184 : : }
1185 : 0 : break;
1186 : :
1187 : : case SID_FM_FILTER_START:
1188 [ # # ]: 0 : bEnable = GetImpl()->getActiveControllerFeatures()->canDoFormFilter();
1189 : 0 : break;
1190 : : }
1191 : : }
1192 : 0 : catch( const Exception& )
1193 : : {
1194 : : OSL_FAIL( "FmFormShell::GetFormState: caught an exception while determining the state!" );
1195 : : }
1196 [ # # ]: 0 : if (!bEnable)
1197 : 0 : rSet.DisableItem(nWhich);
1198 : : }
1199 : 0 : }
1200 : :
1201 : : //------------------------------------------------------------------------
1202 : 8253 : FmFormPage* FmFormShell::GetCurPage() const
1203 : : {
1204 : 8253 : FmFormPage* pP = NULL;
1205 [ + - ][ + + ]: 8253 : if (m_pFormView && m_pFormView->GetSdrPageView())
[ + + ]
1206 [ + - ][ + - ]: 8235 : pP = PTR_CAST(FmFormPage,m_pFormView->GetSdrPageView()->GetPage());
1207 : 8253 : return pP;
1208 : : }
1209 : :
1210 : : //------------------------------------------------------------------------
1211 : 4786 : void FmFormShell::SetView( FmFormView* _pView )
1212 : : {
1213 [ + + ]: 4786 : if ( m_pFormView )
1214 : : {
1215 [ - + ]: 1708 : if ( IsActive() )
1216 : 0 : GetImpl()->viewDeactivated( *m_pFormView );
1217 : :
1218 : 1708 : m_pFormView->SetFormShell( NULL, FmFormView::FormShellAccess() );
1219 : 1708 : m_pFormView = NULL;
1220 : 1708 : m_pFormModel = NULL;
1221 : : }
1222 : :
1223 [ + + ]: 4786 : if ( !_pView )
1224 : 4786 : return;
1225 : :
1226 : 1669 : m_pFormView = _pView;
1227 : 1669 : m_pFormView->SetFormShell( this, FmFormView::FormShellAccess() );
1228 : 1669 : m_pFormModel = (FmFormModel*)m_pFormView->GetModel();
1229 : :
1230 : 1669 : impl_setDesignMode( m_pFormView->IsDesignMode() );
1231 : :
1232 : : // We activate our view if we are activated ourself, but sometimes the Activate precedes the SetView.
1233 : : // But here we know both the view and our activation state so we at least are able to pass the latter
1234 : : // to the former.
1235 : : // FS - 30.06.99 - 67308
1236 [ + + ]: 1669 : if ( IsActive() )
1237 : 1292 : GetImpl()->viewActivated( *m_pFormView );
1238 : : }
1239 : :
1240 : : //------------------------------------------------------------------------
1241 : 7365 : void FmFormShell::DetermineForms(sal_Bool bInvalidate)
1242 : : {
1243 : : // Existieren Formulare auf der aktuellen Page
1244 : 7365 : sal_Bool bForms = GetImpl()->hasForms();
1245 [ + + ]: 7365 : if (bForms != m_bHasForms)
1246 : : {
1247 : 250 : m_bHasForms = bForms;
1248 [ + + ]: 250 : if (bInvalidate)
1249 : 244 : UIFeatureChanged();
1250 : : }
1251 : 7365 : }
1252 : :
1253 : : //------------------------------------------------------------------------
1254 : 0 : sal_Bool FmFormShell::GetY2KState(sal_uInt16& nReturn)
1255 : : {
1256 : 0 : return GetImpl()->GetY2KState(nReturn);
1257 : : }
1258 : :
1259 : : //------------------------------------------------------------------------
1260 : 10 : void FmFormShell::SetY2KState(sal_uInt16 n)
1261 : : {
1262 : 10 : GetImpl()->SetY2KState(n);
1263 : 10 : }
1264 : :
1265 : : //------------------------------------------------------------------------
1266 : 1808 : void FmFormShell::Activate(sal_Bool bMDI)
1267 : : {
1268 : 1808 : SfxShell::Activate(bMDI);
1269 : :
1270 [ + + ]: 1808 : if ( m_pFormView )
1271 : 516 : GetImpl()->viewActivated( *m_pFormView, sal_True );
1272 : 1808 : }
1273 : :
1274 : : //------------------------------------------------------------------------
1275 : 1934 : void FmFormShell::Deactivate(sal_Bool bMDI)
1276 : : {
1277 : 1934 : SfxShell::Deactivate(bMDI);
1278 : :
1279 [ + - ]: 1934 : if ( m_pFormView )
1280 : 1934 : GetImpl()->viewDeactivated( *m_pFormView, sal_False );
1281 : 1934 : }
1282 : :
1283 : : //------------------------------------------------------------------------
1284 : 0 : void FmFormShell::ExecuteTextAttribute( SfxRequest& _rReq )
1285 : : {
1286 : 0 : m_pImpl->ExecuteTextAttribute( _rReq );
1287 : 0 : }
1288 : :
1289 : : //------------------------------------------------------------------------
1290 : 0 : void FmFormShell::GetTextAttributeState( SfxItemSet& _rSet )
1291 : : {
1292 : 0 : m_pImpl->GetTextAttributeState( _rSet );
1293 : 0 : }
1294 : :
1295 : : //------------------------------------------------------------------------
1296 : 19589 : bool FmFormShell::IsActiveControl() const
1297 : : {
1298 : 19589 : return m_pImpl->IsActiveControl();
1299 : : }
1300 : :
1301 : : //------------------------------------------------------------------------
1302 : 223 : void FmFormShell::ForgetActiveControl()
1303 : : {
1304 : 223 : m_pImpl->ForgetActiveControl();
1305 : 223 : }
1306 : :
1307 : : //------------------------------------------------------------------------
1308 : 1795 : void FmFormShell::SetControlActivationHandler( const Link& _rHdl )
1309 : : {
1310 : 1795 : m_pImpl->SetControlActivationHandler( _rHdl );
1311 : 1795 : }
1312 : :
1313 : : //------------------------------------------------------------------------
1314 : : namespace
1315 : : {
1316 : 196 : SdrUnoObj* lcl_findUnoObject( const SdrObjList& _rObjList, const Reference< XControlModel >& _rxModel )
1317 : : {
1318 [ + - ]: 196 : SdrObjListIter aIter( _rObjList );
1319 [ + + ]: 264 : while ( aIter.IsMore() )
1320 : : {
1321 [ + - ]: 262 : SdrObject* pObject = aIter.Next();
1322 [ + - ][ + - ]: 262 : SdrUnoObj* pUnoObject = pObject ? PTR_CAST( SdrUnoObj, pObject ) : NULL;
[ + - ][ + - ]
[ + - ]
1323 [ - + ]: 262 : if ( !pUnoObject )
1324 : 0 : continue;
1325 : :
1326 [ + - ]: 262 : Reference< XControlModel > xControlModel = pUnoObject->GetUnoControlModel();
1327 [ - + ]: 262 : if ( !xControlModel.is() )
1328 : 0 : continue;
1329 : :
1330 [ + - ][ + + ]: 262 : if ( _rxModel == xControlModel )
1331 : 262 : return pUnoObject;
1332 [ + - + ]: 262 : }
1333 : 196 : return NULL;
1334 : : }
1335 : : }
1336 : :
1337 : : //------------------------------------------------------------------------
1338 : 0 : void FmFormShell::ToggleControlFocus( const SdrUnoObj& i_rUnoObject, const SdrView& i_rView, OutputDevice& i_rDevice ) const
1339 : : {
1340 : : try
1341 : : {
1342 : : // check if the focus currently is in a control
1343 : : // Well, okay, do it the other way 'round: Check whether the current control of the active controller
1344 : : // actually has the focus. This should be equivalent.
1345 [ # # ]: 0 : const bool bHasControlFocus = GetImpl()->HasControlFocus();
1346 : :
1347 [ # # ]: 0 : if ( bHasControlFocus )
1348 : : {
1349 [ # # ]: 0 : Window* pWindow( dynamic_cast< Window* >( &i_rDevice ) );
1350 : : OSL_ENSURE( pWindow, "FmFormShell::ToggleControlFocus: I need a Window, really!" );
1351 [ # # ]: 0 : if ( pWindow )
1352 [ # # ]: 0 : pWindow->GrabFocus();
1353 : : }
1354 : : else
1355 : : {
1356 : 0 : Reference< XControl > xControl;
1357 [ # # ][ # # ]: 0 : GetFormControl( i_rUnoObject.GetUnoControlModel(), i_rView, i_rDevice, xControl );
1358 [ # # ]: 0 : Reference< XWindow > xControlWindow( xControl, UNO_QUERY );
1359 [ # # ]: 0 : if ( xControlWindow.is() )
1360 [ # # ][ # # ]: 0 : xControlWindow->setFocus();
[ # # ]
1361 : : }
1362 : : }
1363 : 0 : catch( const Exception& )
1364 : : {
1365 : : DBG_UNHANDLED_EXCEPTION();
1366 : : }
1367 : 0 : }
1368 : :
1369 : : //------------------------------------------------------------------------
1370 : : namespace
1371 : : {
1372 [ # # ]: 0 : class FocusableControlsFilter : public ::svx::ISdrObjectFilter
1373 : : {
1374 : : public:
1375 : 0 : FocusableControlsFilter( const SdrView& i_rView, const OutputDevice& i_rDevice )
1376 : : :m_rView( i_rView )
1377 : 0 : ,m_rDevice( i_rDevice )
1378 : : {
1379 : 0 : }
1380 : :
1381 : : public:
1382 : 0 : virtual bool includeObject( const SdrObject& i_rObject ) const
1383 : : {
1384 [ # # ]: 0 : const SdrUnoObj* pUnoObj = dynamic_cast< const SdrUnoObj* >( &i_rObject );
1385 [ # # ]: 0 : if ( !pUnoObj )
1386 : 0 : return false;
1387 : :
1388 [ # # ]: 0 : Reference< XControl > xControl = pUnoObj->GetUnoControl( m_rView, m_rDevice );
1389 [ # # ]: 0 : return FmXFormView::isFocusable( xControl );
1390 : : }
1391 : :
1392 : : private:
1393 : : const SdrView& m_rView;
1394 : : const OutputDevice& m_rDevice;
1395 : : };
1396 : : }
1397 : :
1398 : : //------------------------------------------------------------------------
1399 : : SAL_WNODEPRECATED_DECLARATIONS_PUSH
1400 : 0 : ::std::auto_ptr< ::svx::ISdrObjectFilter > FmFormShell::CreateFocusableControlFilter( const SdrView& i_rView, const OutputDevice& i_rDevice ) const
1401 : : {
1402 : 0 : ::std::auto_ptr< ::svx::ISdrObjectFilter > pFilter;
1403 : :
1404 [ # # ]: 0 : if ( !i_rView.IsDesignMode() )
1405 [ # # ][ # # ]: 0 : pFilter.reset( new FocusableControlsFilter( i_rView, i_rDevice ) );
1406 : :
1407 : 0 : return pFilter;
1408 : : }
1409 : : SAL_WNODEPRECATED_DECLARATIONS_POP
1410 : :
1411 : : //------------------------------------------------------------------------
1412 : 196 : SdrUnoObj* FmFormShell::GetFormControl( const Reference< XControlModel >& _rxModel, const SdrView& _rView, const OutputDevice& _rDevice, Reference< XControl >& _out_rxControl ) const
1413 : : {
1414 [ - + ]: 196 : if ( !_rxModel.is() )
1415 : 0 : return NULL;
1416 : :
1417 : : // we can only retrieve controls for SdrObjects which belong to page which is actually displayed in the given view
1418 : 196 : SdrPageView* pPageView = _rView.GetSdrPageView();
1419 [ + - ]: 196 : SdrPage* pPage = pPageView ? pPageView->GetPage() : NULL;
1420 : : OSL_ENSURE( pPage, "FmFormShell::GetFormControl: no page displayed in the given view!" );
1421 [ - + ]: 196 : if ( !pPage )
1422 : 0 : return NULL;
1423 : :
1424 : 196 : SdrUnoObj* pUnoObject = lcl_findUnoObject( *pPage, _rxModel );
1425 [ + + ]: 196 : if ( pUnoObject )
1426 : : {
1427 [ + - ]: 194 : _out_rxControl = pUnoObject->GetUnoControl( _rView, _rDevice );
1428 : 194 : return pUnoObject;
1429 : : }
1430 : :
1431 : : #if OSL_DEBUG_LEVEL > 0
1432 : : // perhaps we are fed with a control model which lives on a page other than the one displayed
1433 : : // in the given view. This is worth being reported as error, in non-product builds.
1434 : : FmFormModel* pModel = GetFormModel();
1435 : : if ( pModel )
1436 : : {
1437 : : sal_uInt16 pageCount = pModel->GetPageCount();
1438 : : for ( sal_uInt16 page = 0; page < pageCount; ++page )
1439 : : {
1440 : : pPage = pModel->GetPage( page );
1441 : : OSL_ENSURE( pPage, "FmFormShell::GetFormControl: NULL page encountered!" );
1442 : : if ( !pPage )
1443 : : continue;
1444 : :
1445 : : pUnoObject = lcl_findUnoObject( *pPage, _rxModel );
1446 : : OSL_ENSURE( !pUnoObject, "FmFormShell::GetFormControl: the given control model belongs to a wrong page (displayed elsewhere)!" );
1447 : : }
1448 : : }
1449 : : #endif
1450 : :
1451 : 196 : return NULL;
1452 : : }
1453 : :
1454 : : //------------------------------------------------------------------------
1455 : 0 : Reference< runtime::XFormController > FmFormShell::GetFormController( const Reference< XForm >& _rxForm, const SdrView& _rView, const OutputDevice& _rDevice ) const
1456 : : {
1457 [ # # ]: 0 : const FmFormView* pFormView = dynamic_cast< const FmFormView* >( &_rView );
1458 [ # # ]: 0 : if ( !pFormView )
1459 : 0 : return NULL;
1460 : :
1461 : 0 : return pFormView->GetFormController( _rxForm, _rDevice );
1462 : : }
1463 : :
1464 : : //------------------------------------------------------------------------
1465 : 4 : void FmFormShell::SetDesignMode( sal_Bool _bDesignMode )
1466 : : {
1467 [ - + ]: 4 : if ( _bDesignMode == m_bDesignMode )
1468 : 4 : return;
1469 : :
1470 : 4 : FmFormModel* pModel = GetFormModel();
1471 [ + - ]: 4 : if (pModel)
1472 : : // fuer die Zeit des Uebergangs das Undo-Environment ausschalten, das sichert, dass man dort auch nicht-transiente
1473 : : // Properties mal eben aendern kann (sollte allerdings mit Vorsicht genossen und beim Rueckschalten des Modes
1474 : : // auch immer wieder rueckgaegig gemacht werden. Ein Beispiel ist das Setzen der maximalen Text-Laenge durch das
1475 : : // OEditModel an seinem Control.)
1476 : 4 : pModel->GetUndoEnv().Lock();
1477 : :
1478 : : // dann die eigentliche Umschaltung
1479 [ - + ][ # # ]: 4 : if ( m_bDesignMode || PrepareClose( sal_True ) )
[ + - ]
1480 : 4 : impl_setDesignMode(!m_bDesignMode );
1481 : :
1482 : : // und mein Undo-Environment wieder an
1483 [ + - ]: 4 : if ( pModel )
1484 : 4 : pModel->GetUndoEnv().UnLock();
1485 : : }
1486 : :
1487 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|