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