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 <sfx2/docfile.hxx>
30 : : #ifdef REFERENCE
31 : : #undef REFERENCE
32 : : #endif
33 : : #include <svtools/ehdl.hxx>
34 : : #include <unotools/moduleoptions.hxx>
35 : : #include <com/sun/star/sdb/SQLContext.hpp>
36 : : #include <com/sun/star/uno/XNamingService.hpp>
37 : : #include <com/sun/star/sdbc/XConnection.hpp>
38 : : #include <com/sun/star/sdbc/DataType.hpp>
39 : : #include <com/sun/star/form/XLoadable.hpp>
40 : : #include <com/sun/star/form/XReset.hpp>
41 : : #include "fmvwimp.hxx"
42 : : #include <sfx2/objsh.hxx>
43 : : #include <sfx2/viewsh.hxx>
44 : : #include <sfx2/viewfrm.hxx>
45 : : #include <sfx2/bindings.hxx>
46 : : #include <sfx2/dispatch.hxx>
47 : : #include <basic/sbuno.hxx>
48 : : #include <basic/sbx.hxx>
49 : : #include "fmitems.hxx"
50 : : #include "fmobj.hxx"
51 : : #include "svx/svditer.hxx"
52 : : #include <svx/svdpagv.hxx>
53 : : #include <svx/svdogrp.hxx>
54 : : #include <svx/fmview.hxx>
55 : : #include <svx/fmmodel.hxx>
56 : : #include <svx/fmpage.hxx>
57 : : #include <svx/fmshell.hxx>
58 : : #include "fmpgeimp.hxx"
59 : : #include "svx/fmtools.hxx"
60 : : #include "fmshimp.hxx"
61 : : #include "fmservs.hxx"
62 : : #include "fmprop.hrc"
63 : : #include "fmundo.hxx"
64 : : #include <svx/dataaccessdescriptor.hxx>
65 : : #include <comphelper/processfactory.hxx>
66 : : #include <comphelper/namedvaluecollection.hxx>
67 : : #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
68 : : #include <com/sun/star/beans/PropertyValue.hpp>
69 : : #include <com/sun/star/beans/PropertyState.hpp>
70 : : #include <com/sun/star/form/FormComponentType.hpp>
71 : : #include <vcl/svapp.hxx>
72 : : #include <tools/diagnose_ex.h>
73 : : #include <vcl/stdtext.hxx>
74 : : #include <svx/fmglob.hxx>
75 : : #include <svx/sdrpagewindow.hxx>
76 : : #include "svx/sdrpaintwindow.hxx"
77 : :
78 : : using namespace ::com::sun::star;
79 : : using namespace ::com::sun::star::uno;
80 : : using namespace ::com::sun::star::lang;
81 : : using namespace ::com::sun::star::sdbc;
82 : : using namespace ::com::sun::star::sdb;
83 : : using namespace ::com::sun::star::beans;
84 : : using namespace ::com::sun::star::container;
85 : : using namespace ::com::sun::star::form;
86 : : using namespace ::com::sun::star::util;
87 : : using namespace ::svxform;
88 : : using namespace ::svx;
89 : :
90 : : //========================================================================
91 : : //------------------------------------------------------------------------
92 [ + + ][ + - ]: 13202 : TYPEINIT1(FmFormView, E3dView);
93 : :
94 : : //------------------------------------------------------------------------
95 : 1976 : FmFormView::FmFormView( FmFormModel* pModel, OutputDevice* pOut )
96 : 1976 : :E3dView(pModel,pOut)
97 : : {
98 [ + - ]: 1976 : Init();
99 : 1976 : }
100 : :
101 : : //------------------------------------------------------------------------
102 : 1976 : void FmFormView::Init()
103 : : {
104 : 1976 : pFormShell = NULL;
105 [ + - ][ + - ]: 1976 : pImpl = new FmXFormView(::comphelper::getProcessServiceFactory(),this);
[ + - ][ + - ]
106 : 1976 : pImpl->acquire();
107 : :
108 : : //////////////////////////////////////////////////////////////////////
109 : : // Model setzen
110 : 1976 : SdrModel* pModel = GetModel();
111 : :
112 : : DBG_ASSERT( pModel->ISA(FmFormModel), "Falsches Model" );
113 [ + - ][ + - ]: 3952 : if( !pModel->ISA(FmFormModel) ) return;
[ + - ]
114 : 1976 : FmFormModel* pFormModel = (FmFormModel*)pModel;
115 : :
116 : : //////////////////////////////////////////////////////////////////////
117 : : // DesignMode vom Model holen
118 : 1976 : sal_Bool bInitDesignMode = pFormModel->GetOpenInDesignMode();
119 [ + + ][ + - ]: 1976 : if ( pFormModel->OpenInDesignModeIsDefaulted( ) )
120 : : { // this means that nobody ever explicitly set this on the model, and the model has never
121 : : // been loaded from a stream.
122 : : // This means this is a newly created document. This means, we want to have it in design
123 : : // mode by default (though a newly created model returns true for GetOpenInDesignMode).
124 : : // We _want_ to have this because it makes a lot of hacks following the original fix
125 : : DBG_ASSERT( !bInitDesignMode, "FmFormView::Init: doesn't the model default to FALSE anymore?" );
126 : : // if this asserts, either the on-contruction default in the model has changed (then this here
127 : : // may not be necessary anymore), or we're not dealing with a new document ....
128 : 1911 : bInitDesignMode = sal_True;
129 : : }
130 : :
131 : 1976 : SfxObjectShell* pObjShell = pFormModel->GetObjectShell();
132 [ + - ][ + - ]: 1976 : if ( pObjShell && pObjShell->GetMedium() )
[ + - ]
133 : : {
134 : 1976 : const SfxPoolItem *pItem=0;
135 [ + - ][ + - ]: 1976 : if ( pObjShell->GetMedium()->GetItemSet()->GetItemState( SID_COMPONENTDATA, sal_False, &pItem ) == SFX_ITEM_SET )
[ - + ]
136 : : {
137 [ # # ]: 0 : ::comphelper::NamedValueCollection aComponentData( ((SfxUnoAnyItem*)pItem)->GetValue() );
138 [ # # ][ # # ]: 1976 : bInitDesignMode = aComponentData.getOrDefault( "ApplyFormDesignMode", bInitDesignMode );
139 : : }
140 : : }
141 : :
142 [ + - ][ + - ]: 1976 : if( pObjShell && pObjShell->IsReadOnly() )
[ + + ][ + + ]
143 : 2 : bInitDesignMode = sal_False;
144 : :
145 : : // dieses wird in der Shell vorgenommen
146 : : // bDesignMode = !bInitDesignMode; // erzwingt, dass SetDesignMode ausgefuehrt wird
147 [ + - ]: 1976 : SetDesignMode( bInitDesignMode );
148 : : }
149 : :
150 : : //------------------------------------------------------------------------
151 : 1885 : FmFormView::~FmFormView()
152 : : {
153 [ - + ]: 1885 : if( pFormShell )
154 [ # # ]: 0 : pFormShell->SetView( NULL );
155 : :
156 [ + - ]: 1885 : pImpl->notifyViewDying();
157 : 1885 : pImpl->release();
158 : 1885 : pImpl = NULL;
159 [ - + ]: 1905 : }
160 : :
161 : : //------------------------------------------------------------------------
162 : 6522 : FmFormPage* FmFormView::GetCurPage()
163 : : {
164 : 6522 : SdrPageView* pPageView = GetSdrPageView();
165 [ + - ][ + - ]: 6522 : FmFormPage* pCurPage = pPageView ? PTR_CAST( FmFormPage, pPageView->GetPage() ) : NULL;
[ + + ]
166 : 6522 : return pCurPage;
167 : : }
168 : :
169 : : //------------------------------------------------------------------------
170 : 1700 : void FmFormView::MarkListHasChanged()
171 : : {
172 : 1700 : E3dView::MarkListHasChanged();
173 : :
174 [ + - ][ + + ]: 1700 : if ( pFormShell && IsDesignMode() )
[ + + ]
175 : : {
176 : 4 : FmFormObj* pObj = getMarkedGrid();
177 [ # # ][ - + ]: 4 : if ( pImpl->m_pMarkedGrid && pImpl->m_pMarkedGrid != pObj )
178 : : {
179 : 0 : pImpl->m_pMarkedGrid = NULL;
180 [ # # ]: 0 : if ( pImpl->m_xWindow.is() )
181 : : {
182 [ # # ][ # # ]: 0 : pImpl->m_xWindow->removeFocusListener(pImpl);
183 : 0 : pImpl->m_xWindow = NULL;
184 : : }
185 : 0 : SetMoveOutside(sal_False);
186 : : //OLMRefreshAllIAOManagers();
187 : : }
188 : :
189 : 4 : pFormShell->GetImpl()->SetSelectionDelayed();
190 : : }
191 : 1700 : }
192 : :
193 : : namespace
194 : : {
195 : 615 : const SdrPageWindow* findPageWindow( const SdrPaintView* _pView, OutputDevice* _pWindow )
196 : : {
197 : 615 : SdrPageView* pPageView = _pView->GetSdrPageView();
198 [ + + ]: 615 : if(pPageView)
199 : : {
200 [ + - ]: 363 : for ( sal_uInt32 window = 0; window < pPageView->PageWindowCount(); ++window )
201 : : {
202 : 363 : const SdrPageWindow* pPageWindow = pPageView->GetPageWindow( window );
203 [ - + ][ - + ]: 363 : if ( !pPageWindow || &pPageWindow->GetPaintWindow().GetOutputDevice() != _pWindow )
[ + - ]
204 : 0 : continue;
205 : :
206 : 363 : return pPageWindow;
207 : : }
208 : : }
209 : 615 : return NULL;
210 : : }
211 : : }
212 : :
213 : : //------------------------------------------------------------------------
214 : 0 : void FmFormView::AddWindowToPaintView(OutputDevice* pNewWin)
215 : : {
216 : 0 : E3dView::AddWindowToPaintView(pNewWin);
217 : :
218 [ # # ]: 0 : if ( !pNewWin )
219 : 0 : return;
220 : :
221 : : // look up the PageViewWindow for the newly inserted window, and care for it
222 : : // #i39269# / 2004-12-20 / frank.schoenheit@sun.com
223 : 0 : const SdrPageWindow* pPageWindow = findPageWindow( this, pNewWin );
224 [ # # ]: 0 : if ( pPageWindow )
225 : 0 : pImpl->addWindow( *pPageWindow );
226 : : }
227 : :
228 : : //------------------------------------------------------------------------
229 : 615 : void FmFormView::DeleteWindowFromPaintView(OutputDevice* pNewWin)
230 : : {
231 : 615 : const SdrPageWindow* pPageWindow = findPageWindow( this, pNewWin );
232 [ + + ]: 615 : if ( pPageWindow )
233 [ + - ]: 363 : pImpl->removeWindow( pPageWindow->GetControlContainer() );
234 : :
235 : 615 : E3dView::DeleteWindowFromPaintView(pNewWin);
236 : 615 : }
237 : :
238 : : //------------------------------------------------------------------------
239 : 1673 : void FmFormView::ChangeDesignMode(sal_Bool bDesign)
240 : : {
241 [ + + ]: 1673 : if (bDesign == IsDesignMode())
242 : 1673 : return;
243 : :
244 [ + - ][ + - ]: 4 : FmFormModel* pModel = PTR_CAST(FmFormModel, GetModel());
245 [ + - ]: 4 : if (pModel)
246 : : { // fuer die Zeit des Uebergangs das Undo-Environment ausschalten, das sichert, dass man dort auch nicht-transiente
247 : : // Properties mal eben aendern kann (sollte allerdings mit Vorsicht genossen und beim Rueckschalten des Modes
248 : : // auch immer wieder rueckgaegig gemacht werden. Ein Beispiel ist das Setzen der maximalen Text-Laenge durch das
249 : : // FmXEditModel an seinem Control.)
250 : 4 : pModel->GetUndoEnv().Lock();
251 : : }
252 : :
253 : : // --- 1. deactivate all controls if we are switching to design mode
254 [ - + ]: 4 : if ( bDesign )
255 : 0 : DeactivateControls( GetSdrPageView() );
256 : :
257 : : // --- 2. simulate a deactivation (the shell will handle some things there ...?)
258 [ + - ][ + - ]: 4 : if ( pFormShell && pFormShell->GetImpl() )
[ + - ]
259 : 4 : pFormShell->GetImpl()->viewDeactivated( *this, sal_True );
260 : : else
261 : 0 : pImpl->Deactivate( sal_True );
262 : :
263 : : // --- 3. activate all controls, if we're switching to alive mode
264 [ + - ]: 4 : if ( !bDesign )
265 : 4 : ActivateControls( GetSdrPageView() );
266 : :
267 : : // --- 4. load resp. unload the forms
268 : 4 : FmFormPage* pCurPage = GetCurPage();
269 [ + - ]: 4 : if ( pCurPage )
270 : : {
271 [ + - ][ + - ]: 4 : if ( pFormShell && pFormShell->GetImpl() )
[ + - ]
272 [ - + ]: 4 : pFormShell->GetImpl()->loadForms( pCurPage, ( bDesign ? FORMS_UNLOAD : FORMS_LOAD ) );
273 : : }
274 : :
275 : : // --- 5. base class functionality
276 : 4 : SetDesignMode( bDesign );
277 : :
278 : : // --- 6. simulate a activation (the shell will handle some things there ...?)
279 : : OSL_PRECOND( pFormShell && pFormShell->GetImpl(), "FmFormView::ChangeDesignMode: is this really allowed? No shell?" );
280 [ + - ][ + - ]: 4 : if ( pFormShell && pFormShell->GetImpl() )
[ + - ]
281 : 4 : pFormShell->GetImpl()->viewActivated( *this );
282 : : else
283 : 0 : pImpl->Activate();
284 : :
285 [ + - ]: 4 : if ( pCurPage )
286 : : {
287 [ - + ]: 4 : if ( bDesign )
288 : : {
289 [ # # ][ # # ]: 0 : if ( GetActualOutDev() && GetActualOutDev()->GetOutDevType() == OUTDEV_WINDOW )
[ # # ]
290 : : {
291 : 0 : const Window* pWindow = static_cast< const Window* >( GetActualOutDev() );
292 : 0 : const_cast< Window* >( pWindow )->GrabFocus();
293 : : }
294 : :
295 : : // redraw UNO objects
296 [ # # ]: 0 : if ( GetSdrPageView() )
297 : : {
298 [ # # ]: 0 : SdrObjListIter aIter(*pCurPage);
299 [ # # ]: 0 : while( aIter.IsMore() )
300 : : {
301 [ # # ]: 0 : SdrObject* pObj = aIter.Next();
302 [ # # ][ # # ]: 0 : if (pObj && pObj->IsUnoObj())
[ # # ][ # # ]
303 : : {
304 : : // For redraw just use ActionChanged()
305 : : // pObj->BroadcastObjectChange();
306 [ # # ]: 0 : pObj->ActionChanged();
307 : : }
308 : 0 : }
309 : : }
310 : : }
311 : : else
312 : : {
313 : : // set the auto focus to the first control (if indicated by the model to do so)
314 [ + - ]: 4 : sal_Bool bForceControlFocus = pModel ? pModel->GetAutoControlFocus() : sal_False;
315 [ - + ]: 4 : if (bForceControlFocus)
316 : 0 : pImpl->AutoFocus();
317 : : }
318 : : }
319 : :
320 : : // und mein Undo-Environment wieder an
321 [ + - ]: 4 : if (pModel)
322 : 4 : pModel->GetUndoEnv().UnLock();
323 : : }
324 : :
325 : : //------------------------------------------------------------------------
326 : 0 : void FmFormView::GrabFirstControlFocus( sal_Bool _bForceSync )
327 : : {
328 [ # # ]: 0 : if ( !IsDesignMode() )
329 : 0 : pImpl->AutoFocus( _bForceSync );
330 : 0 : }
331 : :
332 : : //------------------------------------------------------------------------
333 : 2310 : SdrPageView* FmFormView::ShowSdrPage(SdrPage* pPage)
334 : : {
335 : 2310 : SdrPageView* pPV = E3dView::ShowSdrPage(pPage);
336 : :
337 [ + - ]: 2310 : if (pPage)
338 : : {
339 [ + + ]: 2310 : if (!IsDesignMode())
340 : : {
341 : : // creating the controllers
342 : 89 : ActivateControls(pPV);
343 : :
344 : : // Alles deselektieren
345 : 89 : UnmarkAll();
346 : : }
347 [ + + ][ + - ]: 2221 : else if ( pFormShell && pFormShell->IsDesignMode() )
[ + + ]
348 : : {
349 : 292 : FmXFormShell* pFormShellImpl = pFormShell->GetImpl();
350 : 292 : pFormShellImpl->UpdateForms( sal_True );
351 : :
352 : : // damit der Formular-Navigator auf den Seitenwechsel reagieren kann
353 : 292 : pFormShell->GetViewShell()->GetViewFrame()->GetBindings().Invalidate(SID_FM_FMEXPLORER_CONTROL , sal_True, sal_False);
354 : :
355 : 292 : pFormShellImpl->SetSelection(GetMarkedObjectList());
356 : : }
357 : : }
358 : :
359 : : // notify our shell that we have been activated
360 [ + + ][ + - ]: 2310 : if ( pFormShell && pFormShell->GetImpl() )
[ + + ]
361 : 316 : pFormShell->GetImpl()->viewActivated( *this );
362 : : else
363 : 1994 : pImpl->Activate();
364 : :
365 : 2310 : return pPV;
366 : : }
367 : :
368 : : //------------------------------------------------------------------------
369 : 2339 : void FmFormView::HideSdrPage()
370 : : {
371 : : // --- 1. deactivate controls
372 [ + + ]: 2339 : if ( !IsDesignMode() )
373 : 84 : DeactivateControls(GetSdrPageView());
374 : :
375 : : // --- 2. tell the shell the view is (going to be) deactivated
376 [ + + ][ + - ]: 2339 : if ( pFormShell && pFormShell->GetImpl() )
[ + + ]
377 : 334 : pFormShell->GetImpl()->viewDeactivated( *this, sal_True );
378 : : else
379 : 2005 : pImpl->Deactivate( sal_True );
380 : :
381 : : // --- 3. base class behavior
382 : 2339 : E3dView::HideSdrPage();
383 : 2339 : }
384 : :
385 : : //------------------------------------------------------------------------
386 : 0 : SdrModel* FmFormView::GetMarkedObjModel() const
387 : : {
388 : 0 : return E3dView::GetMarkedObjModel();
389 : : }
390 : :
391 : : //------------------------------------------------------------------------
392 : 0 : sal_Bool FmFormView::Paste(const SdrModel& rMod, const Point& rPos, SdrObjList* pLst, sal_uInt32 nOptions)
393 : : {
394 : 0 : return E3dView::Paste(rMod, rPos, pLst, nOptions);
395 : : }
396 : :
397 : : //------------------------------------------------------------------------
398 : 93 : void FmFormView::ActivateControls(SdrPageView* pPageView)
399 : : {
400 [ - + ]: 93 : if (!pPageView)
401 : 93 : return;
402 : :
403 [ + + ]: 186 : for (sal_uInt32 i = 0L; i < pPageView->PageWindowCount(); ++i)
404 : : {
405 : 93 : const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(i);
406 : 93 : pImpl->addWindow(rPageWindow);
407 : : }
408 : : }
409 : :
410 : : //------------------------------------------------------------------------
411 : 84 : void FmFormView::DeactivateControls(SdrPageView* pPageView)
412 : : {
413 [ + + ]: 84 : if( !pPageView )
414 : 84 : return;
415 : :
416 [ + + ]: 148 : for (sal_uInt32 i = 0L; i < pPageView->PageWindowCount(); ++i)
417 : : {
418 : 66 : const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(i);
419 [ + - ]: 66 : pImpl->removeWindow(rPageWindow.GetControlContainer() );
420 : : }
421 : : }
422 : :
423 : : //------------------------------------------------------------------------
424 : 0 : SdrObject* FmFormView::CreateFieldControl( const ODataAccessDescriptor& _rColumnDescriptor )
425 : : {
426 : 0 : return pImpl->implCreateFieldControl( _rColumnDescriptor );
427 : : }
428 : :
429 : : //------------------------------------------------------------------------
430 : 0 : SdrObject* FmFormView::CreateXFormsControl( const OXFormsDescriptor &_rDesc )
431 : : {
432 : 0 : return pImpl->implCreateXFormsControl(_rDesc);
433 : : }
434 : :
435 : : //------------------------------------------------------------------------
436 : 0 : SdrObject* FmFormView::CreateFieldControl(const UniString& rFieldDesc) const
437 : : {
438 [ # # ][ # # ]: 0 : ::rtl::OUString sDataSource = rFieldDesc.GetToken(0,sal_Unicode(11));
[ # # ]
439 [ # # ][ # # ]: 0 : ::rtl::OUString sObjectName = rFieldDesc.GetToken(1,sal_Unicode(11));
[ # # ]
440 [ # # ][ # # ]: 0 : sal_uInt16 nObjectType = (sal_uInt16)rFieldDesc.GetToken(2,sal_Unicode(11)).ToInt32();
[ # # ]
441 [ # # ][ # # ]: 0 : ::rtl::OUString sFieldName = rFieldDesc.GetToken(3,sal_Unicode(11));
[ # # ]
442 : :
443 [ # # ][ # # ]: 0 : if (sFieldName.isEmpty() || sObjectName.isEmpty() || sDataSource.isEmpty())
[ # # ][ # # ]
444 : 0 : return NULL;
445 : :
446 [ # # ]: 0 : ODataAccessDescriptor aColumnDescriptor;
447 [ # # ]: 0 : aColumnDescriptor.setDataSource(sDataSource);
448 [ # # ][ # # ]: 0 : aColumnDescriptor[ daCommand ] <<= sObjectName;
449 [ # # ][ # # ]: 0 : aColumnDescriptor[ daCommandType ] <<= nObjectType;
450 [ # # ][ # # ]: 0 : aColumnDescriptor[ daColumnName ] <<= sFieldName;
451 : :
452 [ # # ][ # # ]: 0 : return pImpl->implCreateFieldControl( aColumnDescriptor );
453 : : }
454 : :
455 : : //------------------------------------------------------------------------
456 : 653 : void FmFormView::InsertControlContainer(const Reference< ::com::sun::star::awt::XControlContainer > & xCC)
457 : : {
458 [ + + ]: 653 : if( !IsDesignMode() )
459 : : {
460 : 89 : SdrPageView* pPageView = GetSdrPageView();
461 [ + - ]: 89 : if( pPageView )
462 : : {
463 [ + - ]: 178 : for( sal_uInt32 i = 0L; i < pPageView->PageWindowCount(); i++ )
464 : : {
465 : 89 : const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(i);
466 : :
467 [ + - ][ + - ]: 89 : if( rPageWindow.GetControlContainer( false ) == xCC )
468 : : {
469 : 89 : pImpl->addWindow(rPageWindow);
470 : 89 : break;
471 : : }
472 : : }
473 : : }
474 : : }
475 : 653 : }
476 : :
477 : : //------------------------------------------------------------------------
478 : 642 : void FmFormView::RemoveControlContainer(const Reference< ::com::sun::star::awt::XControlContainer > & xCC)
479 : : {
480 [ + + ]: 642 : if( !IsDesignMode() )
481 : : {
482 : 82 : pImpl->removeWindow( xCC );
483 : : }
484 : 642 : }
485 : :
486 : : // -----------------------------------------------------------------------------
487 : 15027 : SdrPaintWindow* FmFormView::BeginCompleteRedraw(OutputDevice* pOut)
488 : : {
489 : 15027 : SdrPaintWindow* pPaintWindow = E3dView::BeginCompleteRedraw( pOut );
490 : 15027 : pImpl->suspendTabOrderUpdate();
491 : 15027 : return pPaintWindow;
492 : : }
493 : :
494 : : // -----------------------------------------------------------------------------
495 : 15027 : void FmFormView::EndCompleteRedraw( SdrPaintWindow& rPaintWindow, bool bPaintFormLayer )
496 : : {
497 : 15027 : E3dView::EndCompleteRedraw( rPaintWindow, bPaintFormLayer );
498 : 15027 : pImpl->resumeTabOrderUpdate();
499 : 15027 : }
500 : :
501 : : // -----------------------------------------------------------------------------
502 : 0 : sal_Bool FmFormView::KeyInput(const KeyEvent& rKEvt, Window* pWin)
503 : : {
504 : 0 : sal_Bool bDone = sal_False;
505 : 0 : const KeyCode& rKeyCode = rKEvt.GetKeyCode();
506 [ # # ]: 0 : if ( IsDesignMode()
[ # # # # ]
507 : 0 : && rKeyCode.GetCode() == KEY_RETURN
508 : : )
509 : : {
510 : : // RETURN alone enters grid controls, for keyboard accessibility
511 [ # # # # : 0 : if ( pWin
# # # # ]
[ # # ]
512 : 0 : && !rKeyCode.IsShift()
513 : 0 : && !rKeyCode.IsMod1()
514 : 0 : && !rKeyCode.IsMod2()
515 : : )
516 : : {
517 : 0 : FmFormObj* pObj = getMarkedGrid();
518 [ # # ]: 0 : if ( pObj )
519 : : {
520 [ # # ][ # # ]: 0 : Reference< awt::XWindow > xWindow( pObj->GetUnoControl( *this, *pWin ), UNO_QUERY );
521 [ # # ]: 0 : if ( xWindow.is() )
522 : : {
523 : 0 : pImpl->m_pMarkedGrid = pObj;
524 [ # # ]: 0 : pImpl->m_xWindow = xWindow;
525 : : // add as listener to get notified when ESC will be pressed inside the grid
526 [ # # ][ # # ]: 0 : pImpl->m_xWindow->addFocusListener(pImpl);
[ # # ][ # # ]
527 [ # # ]: 0 : SetMoveOutside(sal_True);
528 : : //OLMRefreshAllIAOManagers();
529 [ # # ][ # # ]: 0 : xWindow->setFocus();
530 : 0 : bDone = sal_True;
531 : 0 : }
532 : : }
533 : : }
534 : : // Alt-RETURN alone shows the properties of the selection
535 [ # # # # : 0 : if ( pFormShell
# # # # #
# ][ # # ]
536 : 0 : && pFormShell->GetImpl()
537 : 0 : && !rKeyCode.IsShift()
538 : 0 : && !rKeyCode.IsMod1()
539 : 0 : && rKeyCode.IsMod2()
540 : : )
541 : : {
542 : 0 : pFormShell->GetImpl()->handleShowPropertiesRequest();
543 : : }
544 : :
545 : : }
546 : :
547 [ # # ]: 0 : if ( !bDone )
548 : 0 : bDone = E3dView::KeyInput(rKEvt,pWin);
549 : 0 : return bDone;
550 : : }
551 : : // -----------------------------------------------------------------------------
552 : 0 : sal_Bool FmFormView::checkUnMarkAll(const Reference< XInterface >& _xSource)
553 : : {
554 [ # # ]: 0 : Reference< ::com::sun::star::awt::XControl> xControl(pImpl->m_xWindow,UNO_QUERY);
555 [ # # ][ # # ]: 0 : sal_Bool bRet = !xControl.is() || !_xSource.is() || _xSource != xControl->getModel();
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
556 [ # # ]: 0 : if ( bRet )
557 [ # # ]: 0 : UnmarkAll();
558 : :
559 : 0 : return bRet;
560 : : }
561 : :
562 : : // -----------------------------------------------------------------------------
563 : 0 : sal_Bool FmFormView::MouseButtonDown( const MouseEvent& _rMEvt, Window* _pWin )
564 : : {
565 : 0 : sal_Bool bReturn = E3dView::MouseButtonDown( _rMEvt, _pWin );
566 : :
567 [ # # ][ # # ]: 0 : if ( pFormShell && pFormShell->GetImpl() )
[ # # ]
568 : : {
569 [ # # ]: 0 : SdrViewEvent aViewEvent;
570 [ # # ]: 0 : PickAnything( _rMEvt, SDRMOUSEBUTTONDOWN, aViewEvent );
571 [ # # ][ # # ]: 0 : pFormShell->GetImpl()->handleMouseButtonDown( aViewEvent );
572 : : }
573 : :
574 : 0 : return bReturn;
575 : : }
576 : :
577 : : // -----------------------------------------------------------------------------
578 : 4 : FmFormObj* FmFormView::getMarkedGrid() const
579 : : {
580 : 4 : FmFormObj* pFormObject = NULL;
581 : 4 : const SdrMarkList& rMarkList = GetMarkedObjectList();
582 [ + + ]: 4 : if ( 1 == rMarkList.GetMarkCount() )
583 : : {
584 : 2 : SdrMark* pMark = rMarkList.GetMark(0);
585 [ + - ]: 2 : if ( pMark )
586 : : {
587 : 2 : pFormObject = FmFormObj::GetFormObject( pMark->GetMarkedSdrObj() );
588 [ - + ]: 2 : if ( pFormObject )
589 : : {
590 [ # # ][ # # ]: 0 : Reference< XServiceInfo > xServInfo( pFormObject->GetUnoControlModel(), UNO_QUERY );
591 [ # # ][ # # ]: 0 : if ( !xServInfo.is() || !xServInfo->supportsService( FM_SUN_COMPONENT_GRIDCONTROL ) )
[ # # ][ # # ]
[ # # ]
[ # # # # ]
[ # # ]
592 : 0 : pFormObject = NULL;
593 : : }
594 : : }
595 : : }
596 : 4 : return pFormObject;
597 : : }
598 : :
599 : : // -----------------------------------------------------------------------------
600 : 0 : void FmFormView::createControlLabelPair( OutputDevice* _pOutDev, sal_Int32 _nXOffsetMM, sal_Int32 _nYOffsetMM,
601 : : const Reference< XPropertySet >& _rxField, const Reference< XNumberFormats >& _rxNumberFormats,
602 : : sal_uInt16 _nControlObjectID, const ::rtl::OUString& _rFieldPostfix, sal_uInt32 _nInventor, sal_uInt16 _nLabelObjectID,
603 : : SdrPage* _pLabelPage, SdrPage* _pControlPage, SdrModel* _pModel, SdrUnoObj*& _rpLabel, SdrUnoObj*& _rpControl )
604 : : {
605 : : FmXFormView::createControlLabelPair(
606 : : ::comphelper::getProcessServiceFactory(),
607 : : *_pOutDev, _nXOffsetMM, _nYOffsetMM,
608 : : _rxField, _rxNumberFormats,
609 : : _nControlObjectID, _rFieldPostfix, _nInventor, _nLabelObjectID,
610 : : _pLabelPage, _pControlPage, _pModel,
611 : : _rpLabel, _rpControl
612 [ # # ][ # # ]: 0 : );
[ # # ]
613 : 0 : }
614 : : // -----------------------------------------------------------------------------
615 : 0 : Reference< runtime::XFormController > FmFormView::GetFormController( const Reference< XForm >& _rxForm, const OutputDevice& _rDevice ) const
616 : : {
617 : 0 : return pImpl->getFormController( _rxForm, _rDevice );
618 : : }
619 : :
620 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|