xref: /trunk/main/svx/inc/svx/fmview.hxx (revision 3334a7e6)
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 #ifndef _SVX_FMVIEW_HXX
25 #define _SVX_FMVIEW_HXX
26 
27 #include <svx/view3d.hxx>
28 #include <comphelper/uno3.hxx>
29 #include "svx/svxdllapi.h"
30 
31 FORWARD_DECLARE_INTERFACE(util,XNumberFormats)
32 FORWARD_DECLARE_INTERFACE(beans,XPropertySet)
33 
34 class OutputDevice;
35 class FmFormModel;
36 class FmPageViewWinRec;
37 class FmFormObj;
38 class FmFormPage;
39 class FmFormShell;
40 class FmXFormView;
41 
42 namespace svx {
43 	class ODataAccessDescriptor;
44 	struct OXFormsDescriptor;
45 }
46 
47 class SdrUnoObj;
48 namespace com { namespace sun { namespace star { namespace form {
49     class XForm;
50     namespace runtime {
51         class XFormController;
52     }
53 } } } }
54 
55 class SVX_DLLPUBLIC FmFormView : public E3dView
56 {
57 	FmXFormView*	pImpl;
58 	FmFormShell*	pFormShell;
59 
60 	void Init();
61 
62 public:
63 	TYPEINFO();
64 
65 	FmFormView(FmFormModel* pModel, OutputDevice* pOut = 0L);
66 	virtual ~FmFormView();
67 
68 	/** create a control pair (label/bound control) for the database field description given.
69 		@param rFieldDesc
70 			description of the field. see clipboard format SBA-FIELDFORMAT
71 		@deprecated
72 			This method is deprecated. Use the version with a ODataAccessDescriptor instead.
73 	*/
74 	SdrObject*	 CreateFieldControl(const UniString& rFieldDesc) const;
75 
76 	/** create a control pair (label/bound control) for the database field description given.
77 	*/
78 	SdrObject*	 CreateFieldControl( const ::svx::ODataAccessDescriptor& _rColumnDescriptor );
79 
80 	/** create a control pair (label/bound control) for the xforms description given.
81 	*/
82 	SdrObject*	 CreateXFormsControl( const ::svx::OXFormsDescriptor &_rDesc );
83 
84 	virtual void MarkListHasChanged();
85 	virtual void AddWindowToPaintView(OutputDevice* pNewWin);
86 	virtual void DeleteWindowFromPaintView(OutputDevice* pOldWin);
87 
88 	static void createControlLabelPair(
89 		OutputDevice* _pOutDev,
90 		sal_Int32 _nXOffsetMM,
91 		sal_Int32 _nYOffsetMM,
92 		const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxField,
93 		const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormats >& _rxNumberFormats,
94 		sal_uInt16 _nControlObjectID,
95 		const ::rtl::OUString& _rFieldPostfix,
96 		sal_uInt32 _nInventor,
97 		sal_uInt16 _nLabelObjectID,
98         SdrPage* _pLabelPage,
99 		SdrPage* _pControlPage,
100 		SdrModel* _pModel,
101 		SdrUnoObj*& _rpLabel,
102 		SdrUnoObj*& _rpControl
103 	);
104 
105 	virtual SdrPageView* ShowSdrPage(SdrPage* pPage);
106 	virtual void HideSdrPage();
107 
108 	// for copying complete form structures, not only control models
109 	virtual SdrModel* GetMarkedObjModel() const;
110 	using E3dView::Paste;
111 	virtual sal_Bool Paste(const SdrModel& rMod, const Point& rPos, SdrObjList* pLst=NULL, sal_uInt32 nOptions=0);
112 
113 	virtual sal_Bool MouseButtonDown( const MouseEvent& _rMEvt, Window* _pWin );
114 
115     /** grab the focus to the first form control on the view
116 		@param _bForceSync
117 			<TRUE/> if the handling should be done synchronously.
118 	*/
119     SVX_DLLPRIVATE void	GrabFirstControlFocus( sal_Bool _bForceSync = sal_False );
120 
121     /** returns the form controller for a given form and a given device
122     */
123     SVX_DLLPRIVATE ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController >
124             GetFormController( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >& _rxForm, const OutputDevice& _rDevice ) const;
125 
126 	// SdrView
127 	sal_Bool KeyInput(const KeyEvent& rKEvt, Window* pWin);
128 
129     /// shortcut to "GetSdrPageView() ? PTR_CAST( FmFormPage, GetSdrPageView() ) : NULL"
130     FmFormPage* GetCurPage();
131 
132 	SVX_DLLPRIVATE void ActivateControls(SdrPageView*);
133 	SVX_DLLPRIVATE void DeactivateControls(SdrPageView*);
134 
135  	SVX_DLLPRIVATE void ChangeDesignMode(sal_Bool bDesign);
136 
GetImpl() const137  	SVX_DLLPRIVATE FmXFormView* GetImpl() const { return pImpl; }
GetFormShell() const138     SVX_DLLPRIVATE FmFormShell* GetFormShell() const { return pFormShell; }
139 
FormShellAccessFmFormView::FormShellAccess140     struct FormShellAccess { friend class FmFormShell; private: FormShellAccess() { } };
SetFormShell(FmFormShell * pShell,FormShellAccess)141  	void SetFormShell( FmFormShell* pShell, FormShellAccess ) { pFormShell = pShell; }
142 
ImplAccessFmFormView::ImplAccess143     struct ImplAccess { friend class FmXFormView; private: ImplAccess() { } };
SetMoveOutside(bool _bMoveOutside,ImplAccess)144     void SetMoveOutside( bool _bMoveOutside, ImplAccess ) { E3dView::SetMoveOutside( _bMoveOutside ); }
145  	virtual void InsertControlContainer(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer >& xCC);
146  	virtual void RemoveControlContainer(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer >& xCC);
147 
148 	virtual SdrPaintWindow* BeginCompleteRedraw(OutputDevice* pOut);
149 	virtual void EndCompleteRedraw(SdrPaintWindow& rPaintWindow, bool bPaintFormLayer);
150 
GetActualOutDev() const151 	SVX_DLLPRIVATE const OutputDevice* GetActualOutDev() const {return pActualOutDev;}
152 	SVX_DLLPRIVATE sal_Bool checkUnMarkAll(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xSource);
153 
154 private:
155 	SVX_DLLPRIVATE void AdjustMarks(const SdrMarkList& rMarkList);
156 	SVX_DLLPRIVATE FmFormObj* getMarkedGrid() const;
157  protected:
158     using E3dView::SetMoveOutside;
159 };
160 
161 #endif          // _FML_FMVIEW_HXX
162 
163