xref: /trunk/main/svx/inc/svx/fmview.hxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir #ifndef _SVX_FMVIEW_HXX
29*cdf0e10cSrcweir #define _SVX_FMVIEW_HXX
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include <svx/view3d.hxx>
32*cdf0e10cSrcweir #include <comphelper/uno3.hxx>
33*cdf0e10cSrcweir #include "svx/svxdllapi.h"
34*cdf0e10cSrcweir 
35*cdf0e10cSrcweir FORWARD_DECLARE_INTERFACE(util,XNumberFormats)
36*cdf0e10cSrcweir FORWARD_DECLARE_INTERFACE(beans,XPropertySet)
37*cdf0e10cSrcweir 
38*cdf0e10cSrcweir class OutputDevice;
39*cdf0e10cSrcweir class FmFormModel;
40*cdf0e10cSrcweir class FmPageViewWinRec;
41*cdf0e10cSrcweir class FmFormObj;
42*cdf0e10cSrcweir class FmFormPage;
43*cdf0e10cSrcweir class FmFormShell;
44*cdf0e10cSrcweir class FmXFormView;
45*cdf0e10cSrcweir 
46*cdf0e10cSrcweir namespace svx {
47*cdf0e10cSrcweir     class ODataAccessDescriptor;
48*cdf0e10cSrcweir     struct OXFormsDescriptor;
49*cdf0e10cSrcweir }
50*cdf0e10cSrcweir 
51*cdf0e10cSrcweir class SdrUnoObj;
52*cdf0e10cSrcweir namespace com { namespace sun { namespace star { namespace form {
53*cdf0e10cSrcweir     class XForm;
54*cdf0e10cSrcweir     namespace runtime {
55*cdf0e10cSrcweir         class XFormController;
56*cdf0e10cSrcweir     }
57*cdf0e10cSrcweir } } } }
58*cdf0e10cSrcweir 
59*cdf0e10cSrcweir class SVX_DLLPUBLIC FmFormView : public E3dView
60*cdf0e10cSrcweir {
61*cdf0e10cSrcweir     FmXFormView*    pImpl;
62*cdf0e10cSrcweir     FmFormShell*    pFormShell;
63*cdf0e10cSrcweir 
64*cdf0e10cSrcweir     void Init();
65*cdf0e10cSrcweir 
66*cdf0e10cSrcweir public:
67*cdf0e10cSrcweir     TYPEINFO();
68*cdf0e10cSrcweir 
69*cdf0e10cSrcweir     FmFormView(FmFormModel* pModel, OutputDevice* pOut = 0L);
70*cdf0e10cSrcweir     virtual ~FmFormView();
71*cdf0e10cSrcweir 
72*cdf0e10cSrcweir     /** create a control pair (label/bound control) for the database field description given.
73*cdf0e10cSrcweir         @param rFieldDesc
74*cdf0e10cSrcweir             description of the field. see clipboard format SBA-FIELDFORMAT
75*cdf0e10cSrcweir         @deprecated
76*cdf0e10cSrcweir             This method is deprecated. Use the version with a ODataAccessDescriptor instead.
77*cdf0e10cSrcweir     */
78*cdf0e10cSrcweir     SdrObject*   CreateFieldControl(const UniString& rFieldDesc) const;
79*cdf0e10cSrcweir 
80*cdf0e10cSrcweir     /** create a control pair (label/bound control) for the database field description given.
81*cdf0e10cSrcweir     */
82*cdf0e10cSrcweir     SdrObject*   CreateFieldControl( const ::svx::ODataAccessDescriptor& _rColumnDescriptor );
83*cdf0e10cSrcweir 
84*cdf0e10cSrcweir     /** create a control pair (label/bound control) for the xforms description given.
85*cdf0e10cSrcweir     */
86*cdf0e10cSrcweir     SdrObject*   CreateXFormsControl( const ::svx::OXFormsDescriptor &_rDesc );
87*cdf0e10cSrcweir 
88*cdf0e10cSrcweir     virtual void MarkListHasChanged();
89*cdf0e10cSrcweir     virtual void AddWindowToPaintView(OutputDevice* pNewWin);
90*cdf0e10cSrcweir     virtual void DeleteWindowFromPaintView(OutputDevice* pOldWin);
91*cdf0e10cSrcweir 
92*cdf0e10cSrcweir     static void createControlLabelPair(
93*cdf0e10cSrcweir         OutputDevice* _pOutDev,
94*cdf0e10cSrcweir         sal_Int32 _nXOffsetMM,
95*cdf0e10cSrcweir         sal_Int32 _nYOffsetMM,
96*cdf0e10cSrcweir         const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxField,
97*cdf0e10cSrcweir         const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormats >& _rxNumberFormats,
98*cdf0e10cSrcweir         sal_uInt16 _nControlObjectID,
99*cdf0e10cSrcweir         const ::rtl::OUString& _rFieldPostfix,
100*cdf0e10cSrcweir         sal_uInt32 _nInventor,
101*cdf0e10cSrcweir         sal_uInt16 _nLabelObjectID,
102*cdf0e10cSrcweir         SdrPage* _pLabelPage,
103*cdf0e10cSrcweir         SdrPage* _pControlPage,
104*cdf0e10cSrcweir         SdrModel* _pModel,
105*cdf0e10cSrcweir         SdrUnoObj*& _rpLabel,
106*cdf0e10cSrcweir         SdrUnoObj*& _rpControl
107*cdf0e10cSrcweir     );
108*cdf0e10cSrcweir 
109*cdf0e10cSrcweir     virtual SdrPageView* ShowSdrPage(SdrPage* pPage);
110*cdf0e10cSrcweir     virtual void HideSdrPage();
111*cdf0e10cSrcweir 
112*cdf0e10cSrcweir     // for copying complete form structures, not only control models
113*cdf0e10cSrcweir     virtual SdrModel* GetMarkedObjModel() const;
114*cdf0e10cSrcweir     using E3dView::Paste;
115*cdf0e10cSrcweir     virtual sal_Bool Paste(const SdrModel& rMod, const Point& rPos, SdrObjList* pLst=NULL, sal_uInt32 nOptions=0);
116*cdf0e10cSrcweir 
117*cdf0e10cSrcweir     virtual sal_Bool MouseButtonDown( const MouseEvent& _rMEvt, Window* _pWin );
118*cdf0e10cSrcweir 
119*cdf0e10cSrcweir     /** grab the focus to the first form control on the view
120*cdf0e10cSrcweir         @param _bForceSync
121*cdf0e10cSrcweir             <TRUE/> if the handling should be done synchronously.
122*cdf0e10cSrcweir     */
123*cdf0e10cSrcweir     SVX_DLLPRIVATE void GrabFirstControlFocus( sal_Bool _bForceSync = sal_False );
124*cdf0e10cSrcweir 
125*cdf0e10cSrcweir     /** returns the form controller for a given form and a given device
126*cdf0e10cSrcweir     */
127*cdf0e10cSrcweir     SVX_DLLPRIVATE ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController >
128*cdf0e10cSrcweir             GetFormController( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >& _rxForm, const OutputDevice& _rDevice ) const;
129*cdf0e10cSrcweir 
130*cdf0e10cSrcweir     // SdrView
131*cdf0e10cSrcweir     sal_Bool KeyInput(const KeyEvent& rKEvt, Window* pWin);
132*cdf0e10cSrcweir 
133*cdf0e10cSrcweir     /// shortcut to "GetSdrPageView() ? PTR_CAST( FmFormPage, GetSdrPageView() ) : NULL"
134*cdf0e10cSrcweir     FmFormPage* GetCurPage();
135*cdf0e10cSrcweir 
136*cdf0e10cSrcweir     SVX_DLLPRIVATE void ActivateControls(SdrPageView*);
137*cdf0e10cSrcweir     SVX_DLLPRIVATE void DeactivateControls(SdrPageView*);
138*cdf0e10cSrcweir 
139*cdf0e10cSrcweir     SVX_DLLPRIVATE void ChangeDesignMode(sal_Bool bDesign);
140*cdf0e10cSrcweir 
141*cdf0e10cSrcweir     SVX_DLLPRIVATE FmXFormView* GetImpl() const { return pImpl; }
142*cdf0e10cSrcweir     SVX_DLLPRIVATE FmFormShell* GetFormShell() const { return pFormShell; }
143*cdf0e10cSrcweir 
144*cdf0e10cSrcweir     struct FormShellAccess { friend class FmFormShell; private: FormShellAccess() { } };
145*cdf0e10cSrcweir     void SetFormShell( FmFormShell* pShell, FormShellAccess ) { pFormShell = pShell; }
146*cdf0e10cSrcweir 
147*cdf0e10cSrcweir     struct ImplAccess { friend class FmXFormView; private: ImplAccess() { } };
148*cdf0e10cSrcweir     void SetMoveOutside( bool _bMoveOutside, ImplAccess ) { E3dView::SetMoveOutside( _bMoveOutside ); }
149*cdf0e10cSrcweir     virtual void InsertControlContainer(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer >& xCC);
150*cdf0e10cSrcweir     virtual void RemoveControlContainer(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer >& xCC);
151*cdf0e10cSrcweir 
152*cdf0e10cSrcweir     virtual SdrPaintWindow* BeginCompleteRedraw(OutputDevice* pOut);
153*cdf0e10cSrcweir     virtual void EndCompleteRedraw(SdrPaintWindow& rPaintWindow, bool bPaintFormLayer);
154*cdf0e10cSrcweir 
155*cdf0e10cSrcweir     SVX_DLLPRIVATE const OutputDevice* GetActualOutDev() const {return pActualOutDev;}
156*cdf0e10cSrcweir     SVX_DLLPRIVATE sal_Bool checkUnMarkAll(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xSource);
157*cdf0e10cSrcweir 
158*cdf0e10cSrcweir private:
159*cdf0e10cSrcweir     SVX_DLLPRIVATE void AdjustMarks(const SdrMarkList& rMarkList);
160*cdf0e10cSrcweir     SVX_DLLPRIVATE FmFormObj* getMarkedGrid() const;
161*cdf0e10cSrcweir  protected:
162*cdf0e10cSrcweir     using E3dView::SetMoveOutside;
163*cdf0e10cSrcweir };
164*cdf0e10cSrcweir 
165*cdf0e10cSrcweir #endif          // _FML_FMVIEW_HXX
166*cdf0e10cSrcweir 
167