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