1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef _SVX_FMVIEW_HXX
21 #define _SVX_FMVIEW_HXX
23 #include <svx/view3d.hxx>
24 #include <comphelper/uno3.hxx>
25 #include "svx/svxdllapi.h"
27 namespace com
{ namespace sun
{ namespace star
{
44 class ODataAccessDescriptor
;
45 struct OXFormsDescriptor
;
49 namespace com
{ namespace sun
{ namespace star
{ namespace form
{
52 class XFormController
;
56 class SVX_DLLPUBLIC FmFormView
: public E3dView
59 FmFormShell
* pFormShell
;
66 FmFormView(FmFormModel
* pModel
, OutputDevice
* pOut
= 0L);
67 virtual ~FmFormView();
69 /** create a control pair (label/bound control) for the database field description given.
71 description of the field. see clipboard format SBA-FIELDFORMAT
73 This method is deprecated. Use the version with a ODataAccessDescriptor instead.
75 SdrObject
* CreateFieldControl(const OUString
& rFieldDesc
) const;
77 /** create a control pair (label/bound control) for the database field description given.
79 SdrObject
* CreateFieldControl( const ::svx::ODataAccessDescriptor
& _rColumnDescriptor
);
81 /** create a control pair (label/bound control) for the xforms description given.
83 SdrObject
* CreateXFormsControl( const ::svx::OXFormsDescriptor
&_rDesc
);
85 virtual void MarkListHasChanged();
86 virtual void AddWindowToPaintView(OutputDevice
* pNewWin
);
87 virtual void DeleteWindowFromPaintView(OutputDevice
* pOldWin
);
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
,
100 SdrPage
* _pControlPage
,
102 SdrUnoObj
*& _rpLabel
,
103 SdrUnoObj
*& _rpControl
106 virtual SdrPageView
* ShowSdrPage(SdrPage
* pPage
);
107 virtual void HideSdrPage();
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);
114 virtual sal_Bool
MouseButtonDown( const MouseEvent
& _rMEvt
, Window
* _pWin
);
116 /** grab the focus to the first form control on the view
118 <TRUE/> if the handling should be done synchronously.
120 SVX_DLLPRIVATE
void GrabFirstControlFocus( sal_Bool _bForceSync
= sal_False
);
122 /** returns the form controller for a given form and a given device
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;
128 sal_Bool
KeyInput(const KeyEvent
& rKEvt
, Window
* pWin
);
130 /// shortcut to "GetSdrPageView() ? PTR_CAST( FmFormPage, GetSdrPageView() ) : NULL"
131 FmFormPage
* GetCurPage();
133 SVX_DLLPRIVATE
void ActivateControls(SdrPageView
*);
134 SVX_DLLPRIVATE
void DeactivateControls(SdrPageView
*);
136 SVX_DLLPRIVATE
void ChangeDesignMode(sal_Bool bDesign
);
138 SVX_DLLPRIVATE FmXFormView
* GetImpl() const { return pImpl
; }
139 SVX_DLLPRIVATE FmFormShell
* GetFormShell() const { return pFormShell
; }
141 struct FormShellAccess
{ friend class FmFormShell
; private: FormShellAccess() { } };
142 void SetFormShell( FmFormShell
* pShell
, FormShellAccess
) { pFormShell
= pShell
; }
144 struct ImplAccess
{ friend class FmXFormView
; private: ImplAccess() { } };
145 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
);
149 virtual SdrPaintWindow
* BeginCompleteRedraw(OutputDevice
* pOut
);
150 virtual void EndCompleteRedraw(SdrPaintWindow
& rPaintWindow
, bool bPaintFormLayer
);
152 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
);
156 SVX_DLLPRIVATE
void AdjustMarks(const SdrMarkList
& rMarkList
);
157 SVX_DLLPRIVATE FmFormObj
* getMarkedGrid() const;
159 using E3dView::SetMoveOutside
;
162 #endif // _FML_FMVIEW_HXX
164 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */