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