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 :
112 : virtual bool MouseButtonDown( const MouseEvent& _rMEvt, vcl::Window* _pWin ) SAL_OVERRIDE;
113 :
114 : /** grab the focus to the first form control on the view
115 : @param _bForceSync
116 : <TRUE/> if the handling should be done synchronously.
117 : */
118 : SVX_DLLPRIVATE void GrabFirstControlFocus( bool _bForceSync = false );
119 :
120 : /** returns the form controller for a given form and a given device
121 : */
122 : SVX_DLLPRIVATE ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController >
123 : GetFormController( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >& _rxForm, const OutputDevice& _rDevice ) const;
124 :
125 : // SdrView
126 : bool KeyInput(const KeyEvent& rKEvt, vcl::Window* pWin) SAL_OVERRIDE;
127 :
128 : /// shortcut to "GetSdrPageView() ? PTR_CAST( FmFormPage, GetSdrPageView() ) : NULL"
129 : FmFormPage* GetCurPage();
130 :
131 : SVX_DLLPRIVATE void ActivateControls(SdrPageView*);
132 : SVX_DLLPRIVATE void DeactivateControls(SdrPageView*);
133 :
134 : SVX_DLLPRIVATE void ChangeDesignMode(bool bDesign);
135 :
136 16558 : SVX_DLLPRIVATE FmXFormView* GetImpl() const { return pImpl; }
137 12195 : SVX_DLLPRIVATE FmFormShell* GetFormShell() const { return pFormShell; }
138 :
139 6596 : struct FormShellAccess { friend class FmFormShell; private: FormShellAccess() { } };
140 6596 : void SetFormShell( FmFormShell* pShell, FormShellAccess ) { pFormShell = pShell; }
141 :
142 0 : struct ImplAccess { friend class FmXFormView; private: ImplAccess() { } };
143 0 : void SetMoveOutside( bool _bMoveOutside, ImplAccess ) { E3dView::SetMoveOutside( _bMoveOutside ); }
144 : void InsertControlContainer(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer >& xCC);
145 : void RemoveControlContainer(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer >& xCC);
146 :
147 : virtual SdrPaintWindow* BeginCompleteRedraw(OutputDevice* pOut) SAL_OVERRIDE;
148 : virtual void EndCompleteRedraw(SdrPaintWindow& rPaintWindow, bool bPaintFormLayer) SAL_OVERRIDE;
149 :
150 3914 : SVX_DLLPRIVATE const OutputDevice* GetActualOutDev() const {return pActualOutDev;}
151 : SVX_DLLPRIVATE bool checkUnMarkAll(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xSource);
152 :
153 : private:
154 : SVX_DLLPRIVATE void AdjustMarks(const SdrMarkList& rMarkList);
155 : SVX_DLLPRIVATE FmFormObj* getMarkedGrid() const;
156 : protected:
157 : using E3dView::SetMoveOutside;
158 : };
159 :
160 : #endif // _FML_FMVIEW_HXX
161 :
162 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|