1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: fmview.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _SVX_FMVIEW_HXX
32 #define _SVX_FMVIEW_HXX
34 #include <svx/view3d.hxx>
35 #include <comphelper/uno3.hxx>
36 #include "svx/svxdllapi.h"
38 FORWARD_DECLARE_INTERFACE(util
,XNumberFormats
)
39 FORWARD_DECLARE_INTERFACE(beans
,XPropertySet
)
43 class FmPageViewWinRec
;
50 class ODataAccessDescriptor
;
51 struct OXFormsDescriptor
;
55 namespace com
{ namespace sun
{ namespace star
{ namespace form
{
57 class XFormController
;
60 class SVX_DLLPUBLIC FmFormView
: public E3dView
63 FmFormShell
* pFormShell
;
70 FmFormView(FmFormModel
* pModel
, OutputDevice
* pOut
= 0L);
71 virtual ~FmFormView();
73 /** create a control pair (label/bound control) for the database field description given.
75 description of the field. see clipboard format SBA-FIELDFORMAT
77 This method is deprecated. Use the version with a ODataAccessDescriptor instead.
79 SdrObject
* CreateFieldControl(const UniString
& rFieldDesc
) const;
81 /** create a control pair (label/bound control) for the database field description given.
83 SdrObject
* CreateFieldControl( const ::svx::ODataAccessDescriptor
& _rColumnDescriptor
);
85 /** create a control pair (label/bound control) for the xforms description given.
87 SdrObject
* CreateXFormsControl( const ::svx::OXFormsDescriptor
&_rDesc
);
89 virtual void MarkListHasChanged();
90 virtual void AddWindowToPaintView(OutputDevice
* pNewWin
);
91 virtual void DeleteWindowFromPaintView(OutputDevice
* pOldWin
);
93 static void createControlLabelPair(
94 OutputDevice
* _pOutDev
,
95 sal_Int32 _nXOffsetMM
,
96 sal_Int32 _nYOffsetMM
,
97 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>& _rxField
,
98 const ::com::sun::star::uno::Reference
< ::com::sun::star::util::XNumberFormats
>& _rxNumberFormats
,
99 sal_uInt16 _nControlObjectID
,
100 const ::rtl::OUString
& _rFieldPostfix
,
102 UINT16 _nLabelObjectID
,
103 SdrPage
* _pLabelPage
,
104 SdrPage
* _pControlPage
,
106 SdrUnoObj
*& _rpLabel
,
107 SdrUnoObj
*& _rpControl
110 virtual SdrPageView
* ShowSdrPage(SdrPage
* pPage
);
111 virtual void HideSdrPage();
113 // for copying complete form structures, not only control models
114 virtual SdrModel
* GetMarkedObjModel() const;
115 using E3dView::Paste
;
116 virtual sal_Bool
Paste(const SdrModel
& rMod
, const Point
& rPos
, SdrObjList
* pLst
=NULL
, sal_uInt32 nOptions
=0);
118 virtual BOOL
MouseButtonDown( const MouseEvent
& _rMEvt
, Window
* _pWin
);
120 /** grab the focus to the first form control on the view
122 <TRUE/> if the handling should be done synchronously.
124 SVX_DLLPRIVATE
void GrabFirstControlFocus( sal_Bool _bForceSync
= sal_False
);
126 /** returns the form controller for a given form and a given device
128 SVX_DLLPRIVATE ::com::sun::star::uno::Reference
< ::com::sun::star::form::XFormController
>
129 GetFormController( const ::com::sun::star::uno::Reference
< ::com::sun::star::form::XForm
>& _rxForm
, const OutputDevice
& _rDevice
) const;
132 BOOL
KeyInput(const KeyEvent
& rKEvt
, Window
* pWin
);
134 /// shortcut to "GetSdrPageView() ? PTR_CAST( FmFormPage, GetSdrPageView() ) : NULL"
135 FmFormPage
* GetCurPage();
137 SVX_DLLPRIVATE
void ActivateControls(SdrPageView
*);
138 SVX_DLLPRIVATE
void DeactivateControls(SdrPageView
*);
140 SVX_DLLPRIVATE
void ChangeDesignMode(sal_Bool bDesign
);
142 SVX_DLLPRIVATE FmXFormView
* GetImpl() const { return pImpl
; }
143 SVX_DLLPRIVATE FmFormShell
* GetFormShell() const { return pFormShell
; }
145 struct FormShellAccess
{ friend class FmFormShell
; private: FormShellAccess() { } };
146 void SetFormShell( FmFormShell
* pShell
, FormShellAccess
) { pFormShell
= pShell
; }
148 struct ImplAccess
{ friend class FmXFormView
; private: ImplAccess() { } };
149 void SetMoveOutside( bool _bMoveOutside
, ImplAccess
) { E3dView::SetMoveOutside( _bMoveOutside
); }
150 virtual void InsertControlContainer(const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XControlContainer
>& xCC
);
151 virtual void RemoveControlContainer(const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XControlContainer
>& xCC
);
153 virtual SdrPaintWindow
* BeginCompleteRedraw(OutputDevice
* pOut
);
154 virtual void EndCompleteRedraw(SdrPaintWindow
& rPaintWindow
, bool bPaintFormLayer
);
156 SVX_DLLPRIVATE
const OutputDevice
* GetActualOutDev() const {return pActualOutDev
;}
157 SVX_DLLPRIVATE sal_Bool
checkUnMarkAll(const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
>& _xSource
);
160 SVX_DLLPRIVATE
void AdjustMarks(const SdrMarkList
& rMarkList
);
161 SVX_DLLPRIVATE FmFormObj
* getMarkedGrid() const;
163 using E3dView::SetMoveOutside
;
166 #endif // _FML_FMVIEW_HXX