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 _SVX_FMVIEW_HXX
21 : #define _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();
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();
86 : virtual void AddWindowToPaintView(OutputDevice* pNewWin);
87 : virtual void DeleteWindowFromPaintView(OutputDevice* pOldWin);
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);
107 : virtual void HideSdrPage();
108 :
109 : // for copying complete form structures, not only control models
110 : virtual SdrModel* GetMarkedObjModel() const;
111 : using E3dView::Paste;
112 : virtual sal_Bool Paste(const SdrModel& rMod, const Point& rPos, SdrObjList* pLst=NULL, sal_uInt32 nOptions=0);
113 :
114 : virtual sal_Bool MouseButtonDown( const MouseEvent& _rMEvt, Window* _pWin );
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( sal_Bool _bForceSync = sal_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 : sal_Bool KeyInput(const KeyEvent& rKEvt, Window* pWin);
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(sal_Bool bDesign);
137 :
138 5660 : SVX_DLLPRIVATE FmXFormView* GetImpl() const { return pImpl; }
139 4386 : SVX_DLLPRIVATE FmFormShell* GetFormShell() const { return pFormShell; }
140 :
141 2172 : struct FormShellAccess { friend class FmFormShell; private: FormShellAccess() { } };
142 2172 : 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);
150 : virtual void EndCompleteRedraw(SdrPaintWindow& rPaintWindow, bool bPaintFormLayer);
151 :
152 1906 : SVX_DLLPRIVATE const OutputDevice* GetActualOutDev() const {return pActualOutDev;}
153 : SVX_DLLPRIVATE sal_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: */
|