xref: /aoo41x/main/svx/inc/svx/fmview.hxx (revision 3334a7e6)
1*3334a7e6SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*3334a7e6SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*3334a7e6SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*3334a7e6SAndrew Rist  * distributed with this work for additional information
6*3334a7e6SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*3334a7e6SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*3334a7e6SAndrew Rist  * "License"); you may not use this file except in compliance
9*3334a7e6SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*3334a7e6SAndrew Rist  *
11*3334a7e6SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*3334a7e6SAndrew Rist  *
13*3334a7e6SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*3334a7e6SAndrew Rist  * software distributed under the License is distributed on an
15*3334a7e6SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*3334a7e6SAndrew Rist  * KIND, either express or implied.  See the License for the
17*3334a7e6SAndrew Rist  * specific language governing permissions and limitations
18*3334a7e6SAndrew Rist  * under the License.
19*3334a7e6SAndrew Rist  *
20*3334a7e6SAndrew Rist  *************************************************************/
21*3334a7e6SAndrew Rist 
22*3334a7e6SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _SVX_FMVIEW_HXX
25cdf0e10cSrcweir #define _SVX_FMVIEW_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <svx/view3d.hxx>
28cdf0e10cSrcweir #include <comphelper/uno3.hxx>
29cdf0e10cSrcweir #include "svx/svxdllapi.h"
30cdf0e10cSrcweir 
31cdf0e10cSrcweir FORWARD_DECLARE_INTERFACE(util,XNumberFormats)
32cdf0e10cSrcweir FORWARD_DECLARE_INTERFACE(beans,XPropertySet)
33cdf0e10cSrcweir 
34cdf0e10cSrcweir class OutputDevice;
35cdf0e10cSrcweir class FmFormModel;
36cdf0e10cSrcweir class FmPageViewWinRec;
37cdf0e10cSrcweir class FmFormObj;
38cdf0e10cSrcweir class FmFormPage;
39cdf0e10cSrcweir class FmFormShell;
40cdf0e10cSrcweir class FmXFormView;
41cdf0e10cSrcweir 
42cdf0e10cSrcweir namespace svx {
43cdf0e10cSrcweir 	class ODataAccessDescriptor;
44cdf0e10cSrcweir 	struct OXFormsDescriptor;
45cdf0e10cSrcweir }
46cdf0e10cSrcweir 
47cdf0e10cSrcweir class SdrUnoObj;
48cdf0e10cSrcweir namespace com { namespace sun { namespace star { namespace form {
49cdf0e10cSrcweir     class XForm;
50cdf0e10cSrcweir     namespace runtime {
51cdf0e10cSrcweir         class XFormController;
52cdf0e10cSrcweir     }
53cdf0e10cSrcweir } } } }
54cdf0e10cSrcweir 
55cdf0e10cSrcweir class SVX_DLLPUBLIC FmFormView : public E3dView
56cdf0e10cSrcweir {
57cdf0e10cSrcweir 	FmXFormView*	pImpl;
58cdf0e10cSrcweir 	FmFormShell*	pFormShell;
59cdf0e10cSrcweir 
60cdf0e10cSrcweir 	void Init();
61cdf0e10cSrcweir 
62cdf0e10cSrcweir public:
63cdf0e10cSrcweir 	TYPEINFO();
64cdf0e10cSrcweir 
65cdf0e10cSrcweir 	FmFormView(FmFormModel* pModel, OutputDevice* pOut = 0L);
66cdf0e10cSrcweir 	virtual ~FmFormView();
67cdf0e10cSrcweir 
68cdf0e10cSrcweir 	/** create a control pair (label/bound control) for the database field description given.
69cdf0e10cSrcweir 		@param rFieldDesc
70cdf0e10cSrcweir 			description of the field. see clipboard format SBA-FIELDFORMAT
71cdf0e10cSrcweir 		@deprecated
72cdf0e10cSrcweir 			This method is deprecated. Use the version with a ODataAccessDescriptor instead.
73cdf0e10cSrcweir 	*/
74cdf0e10cSrcweir 	SdrObject*	 CreateFieldControl(const UniString& rFieldDesc) const;
75cdf0e10cSrcweir 
76cdf0e10cSrcweir 	/** create a control pair (label/bound control) for the database field description given.
77cdf0e10cSrcweir 	*/
78cdf0e10cSrcweir 	SdrObject*	 CreateFieldControl( const ::svx::ODataAccessDescriptor& _rColumnDescriptor );
79cdf0e10cSrcweir 
80cdf0e10cSrcweir 	/** create a control pair (label/bound control) for the xforms description given.
81cdf0e10cSrcweir 	*/
82cdf0e10cSrcweir 	SdrObject*	 CreateXFormsControl( const ::svx::OXFormsDescriptor &_rDesc );
83cdf0e10cSrcweir 
84cdf0e10cSrcweir 	virtual void MarkListHasChanged();
85cdf0e10cSrcweir 	virtual void AddWindowToPaintView(OutputDevice* pNewWin);
86cdf0e10cSrcweir 	virtual void DeleteWindowFromPaintView(OutputDevice* pOldWin);
87cdf0e10cSrcweir 
88cdf0e10cSrcweir 	static void createControlLabelPair(
89cdf0e10cSrcweir 		OutputDevice* _pOutDev,
90cdf0e10cSrcweir 		sal_Int32 _nXOffsetMM,
91cdf0e10cSrcweir 		sal_Int32 _nYOffsetMM,
92cdf0e10cSrcweir 		const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxField,
93cdf0e10cSrcweir 		const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormats >& _rxNumberFormats,
94cdf0e10cSrcweir 		sal_uInt16 _nControlObjectID,
95cdf0e10cSrcweir 		const ::rtl::OUString& _rFieldPostfix,
96cdf0e10cSrcweir 		sal_uInt32 _nInventor,
97cdf0e10cSrcweir 		sal_uInt16 _nLabelObjectID,
98cdf0e10cSrcweir         SdrPage* _pLabelPage,
99cdf0e10cSrcweir 		SdrPage* _pControlPage,
100cdf0e10cSrcweir 		SdrModel* _pModel,
101cdf0e10cSrcweir 		SdrUnoObj*& _rpLabel,
102cdf0e10cSrcweir 		SdrUnoObj*& _rpControl
103cdf0e10cSrcweir 	);
104cdf0e10cSrcweir 
105cdf0e10cSrcweir 	virtual SdrPageView* ShowSdrPage(SdrPage* pPage);
106cdf0e10cSrcweir 	virtual void HideSdrPage();
107cdf0e10cSrcweir 
108cdf0e10cSrcweir 	// for copying complete form structures, not only control models
109cdf0e10cSrcweir 	virtual SdrModel* GetMarkedObjModel() const;
110cdf0e10cSrcweir 	using E3dView::Paste;
111cdf0e10cSrcweir 	virtual sal_Bool Paste(const SdrModel& rMod, const Point& rPos, SdrObjList* pLst=NULL, sal_uInt32 nOptions=0);
112cdf0e10cSrcweir 
113cdf0e10cSrcweir 	virtual sal_Bool MouseButtonDown( const MouseEvent& _rMEvt, Window* _pWin );
114cdf0e10cSrcweir 
115cdf0e10cSrcweir     /** grab the focus to the first form control on the view
116cdf0e10cSrcweir 		@param _bForceSync
117cdf0e10cSrcweir 			<TRUE/> if the handling should be done synchronously.
118cdf0e10cSrcweir 	*/
119cdf0e10cSrcweir     SVX_DLLPRIVATE void	GrabFirstControlFocus( sal_Bool _bForceSync = sal_False );
120cdf0e10cSrcweir 
121cdf0e10cSrcweir     /** returns the form controller for a given form and a given device
122cdf0e10cSrcweir     */
123cdf0e10cSrcweir     SVX_DLLPRIVATE ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController >
124cdf0e10cSrcweir             GetFormController( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >& _rxForm, const OutputDevice& _rDevice ) const;
125cdf0e10cSrcweir 
126cdf0e10cSrcweir 	// SdrView
127cdf0e10cSrcweir 	sal_Bool KeyInput(const KeyEvent& rKEvt, Window* pWin);
128cdf0e10cSrcweir 
129cdf0e10cSrcweir     /// shortcut to "GetSdrPageView() ? PTR_CAST( FmFormPage, GetSdrPageView() ) : NULL"
130cdf0e10cSrcweir     FmFormPage* GetCurPage();
131cdf0e10cSrcweir 
132cdf0e10cSrcweir 	SVX_DLLPRIVATE void ActivateControls(SdrPageView*);
133cdf0e10cSrcweir 	SVX_DLLPRIVATE void DeactivateControls(SdrPageView*);
134cdf0e10cSrcweir 
135cdf0e10cSrcweir  	SVX_DLLPRIVATE void ChangeDesignMode(sal_Bool bDesign);
136cdf0e10cSrcweir 
GetImpl() const137cdf0e10cSrcweir  	SVX_DLLPRIVATE FmXFormView* GetImpl() const { return pImpl; }
GetFormShell() const138cdf0e10cSrcweir     SVX_DLLPRIVATE FmFormShell* GetFormShell() const { return pFormShell; }
139cdf0e10cSrcweir 
FormShellAccessFmFormView::FormShellAccess140cdf0e10cSrcweir     struct FormShellAccess { friend class FmFormShell; private: FormShellAccess() { } };
SetFormShell(FmFormShell * pShell,FormShellAccess)141cdf0e10cSrcweir  	void SetFormShell( FmFormShell* pShell, FormShellAccess ) { pFormShell = pShell; }
142cdf0e10cSrcweir 
ImplAccessFmFormView::ImplAccess143cdf0e10cSrcweir     struct ImplAccess { friend class FmXFormView; private: ImplAccess() { } };
SetMoveOutside(bool _bMoveOutside,ImplAccess)144cdf0e10cSrcweir     void SetMoveOutside( bool _bMoveOutside, ImplAccess ) { E3dView::SetMoveOutside( _bMoveOutside ); }
145cdf0e10cSrcweir  	virtual void InsertControlContainer(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer >& xCC);
146cdf0e10cSrcweir  	virtual void RemoveControlContainer(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer >& xCC);
147cdf0e10cSrcweir 
148cdf0e10cSrcweir 	virtual SdrPaintWindow* BeginCompleteRedraw(OutputDevice* pOut);
149cdf0e10cSrcweir 	virtual void EndCompleteRedraw(SdrPaintWindow& rPaintWindow, bool bPaintFormLayer);
150cdf0e10cSrcweir 
GetActualOutDev() const151cdf0e10cSrcweir 	SVX_DLLPRIVATE const OutputDevice* GetActualOutDev() const {return pActualOutDev;}
152cdf0e10cSrcweir 	SVX_DLLPRIVATE sal_Bool checkUnMarkAll(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xSource);
153cdf0e10cSrcweir 
154cdf0e10cSrcweir private:
155cdf0e10cSrcweir 	SVX_DLLPRIVATE void AdjustMarks(const SdrMarkList& rMarkList);
156cdf0e10cSrcweir 	SVX_DLLPRIVATE FmFormObj* getMarkedGrid() const;
157cdf0e10cSrcweir  protected:
158cdf0e10cSrcweir     using E3dView::SetMoveOutside;
159cdf0e10cSrcweir };
160cdf0e10cSrcweir 
161cdf0e10cSrcweir #endif          // _FML_FMVIEW_HXX
162cdf0e10cSrcweir 
163