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 .
19 #ifndef INCLUDED_SVX_FMSHELL_HXX
20 #define INCLUDED_SVX_FMSHELL_HXX
22 // ***************************************************************************************************
23 // ***************************************************************************************************
24 // ***************************************************************************************************
26 #include <sfx2/shell.hxx>
27 #include <sfx2/module.hxx>
28 #include <vcl/event.hxx>
30 #include <svx/svxids.hrc>
31 #include <svx/fmview.hxx>
32 #include <svx/svxdllapi.h>
34 #include <svx/ifaceids.hxx>
45 namespace com
{ namespace sun
{ namespace star
{ namespace form
{
48 class XFormController
;
54 class ISdrObjectFilter
;
58 class SVX_DLLPUBLIC FmDesignModeChangedHint
: public SfxHint
64 FmDesignModeChangedHint( bool bDesMode
);
65 virtual ~FmDesignModeChangedHint();
67 bool GetDesignMode() const { return m_bDesignMode
; }
71 class SVX_DLLPUBLIC FmFormShell
: public SfxShell
73 friend class FmFormView
;
74 friend class FmXFormShell
;
76 FmXFormShell
* m_pImpl
;
77 FmFormView
* m_pFormView
;
78 FmFormModel
* m_pFormModel
;
79 SfxViewShell
* m_pParentShell
;
81 sal_uInt16 m_nLastSlot
;
82 bool m_bDesignMode
: 1;
83 bool m_bHasForms
: 1; // flag storing if the forms on a page exist,
84 // only for the DesignMode, see UIFeatureChanged!
86 // the marks of a FormView have changed...
87 void NotifyMarkListChanged(FmFormView
*);
88 // (the FormView itself is not a broadcaster, therefore it can't always correctly notify the
89 // form explorer who is interested in the event)
91 class FormShellWaitObject
95 FormShellWaitObject(const FmFormShell
* _pShell
);
96 ~FormShellWaitObject();
98 friend class FormShellWaitObject
;
100 const OutputDevice
* GetCurrentViewDevice() const { return m_pFormView
? m_pFormView
->GetActualOutDev() : NULL
; }
103 SFX_DECL_INTERFACE(SVX_INTERFACE_FORM_SH
)
107 /// SfxInterface initializer.
108 static void InitInterface_Impl();
111 FmFormShell(SfxViewShell
* pParent
, FmFormView
* pView
= NULL
);
112 virtual ~FmFormShell();
114 virtual void Execute( SfxRequest
& );
115 virtual void GetState( SfxItemSet
& );
116 virtual bool HasUIFeature( sal_uInt32 nFeature
) SAL_OVERRIDE
;
118 void ExecuteTextAttribute( SfxRequest
& );
119 void GetTextAttributeState( SfxItemSet
& );
121 bool GetY2KState(sal_uInt16
& nReturn
);
122 void SetY2KState(sal_uInt16 n
);
124 void SetView(FmFormView
* pView
);
126 FmFormView
* GetFormView() const { return m_pFormView
; }
127 FmFormModel
* GetFormModel() const { return m_pFormModel
; }
128 FmFormPage
* GetCurPage() const;
129 FmXFormShell
* GetImpl() const {return m_pImpl
;};
131 bool PrepareClose(bool bUI
= true);
133 bool IsActiveControl() const;
134 void ForgetActiveControl();
135 void SetControlActivationHandler( const Link
& _rHdl
);
137 virtual void Activate(bool bMDI
) SAL_OVERRIDE
;
138 virtual void Deactivate(bool bMDI
) SAL_OVERRIDE
;
140 // helper methods for implementing XFormLayerAccess
141 SdrUnoObj
* GetFormControl(
142 const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XControlModel
>& _rxModel
,
143 const SdrView
& _rView
,
144 const OutputDevice
& _rDevice
,
145 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XControl
>& _out_rxControl
148 ::com::sun::star::uno::Reference
< ::com::sun::star::form::runtime::XFormController
> GetFormController(
149 const ::com::sun::star::uno::Reference
< ::com::sun::star::form::XForm
>& _rxForm
,
150 const SdrView
& _rView
,
151 const OutputDevice
& _rDevice
154 /** puts the focus into the document window, if current a form control has the focus. Otherwise, moves the focus
155 to the control belonging to the given SdrUnoObj.
157 void ToggleControlFocus(
158 const SdrUnoObj
& i_rNextCandidate
,
159 const SdrView
& i_rView
,
160 OutputDevice
& i_rDevice
163 ::std::auto_ptr
< ::svx::ISdrObjectFilter
>
164 CreateFocusableControlFilter(
165 const SdrView
& i_rView
,
166 const OutputDevice
& i_rDevice
169 bool IsDesignMode() const { return m_bDesignMode
; }
170 void SetDesignMode( bool _bDesignMode
);
173 void GetFormState(SfxItemSet
&rSet
, sal_uInt16 nWhich
);
175 // is there a form on the current page?
176 void DetermineForms(bool bInvalidate
);
177 void impl_setDesignMode( bool bDesign
);
180 // ***************************************************************************************************
181 // ***************************************************************************************************
182 // ***************************************************************************************************
184 #endif // INCLUDED_SVX_FMSHELL_HXX
186 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */