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 _SVX_FMSHELL_HXX
20 #define _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>
36 //========================================================================
45 namespace com
{ namespace sun
{ namespace star
{ namespace form
{
48 class XFormController
;
54 class ISdrObjectFilter
;
57 //========================================================================
58 class SVX_DLLPUBLIC FmDesignModeChangedHint
: public SfxHint
60 sal_Bool m_bDesignMode
;
64 FmDesignModeChangedHint( sal_Bool bDesMode
);
65 virtual ~FmDesignModeChangedHint();
67 sal_Bool
GetDesignMode() const { return m_bDesignMode
; }
70 //========================================================================
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 sal_Bool m_bDesignMode
: 1;
83 sal_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
)
106 FmFormShell(SfxViewShell
* pParent
, FmFormView
* pView
= NULL
);
107 virtual ~FmFormShell();
109 virtual void Execute( SfxRequest
& );
110 virtual void GetState( SfxItemSet
& );
111 virtual sal_Bool
HasUIFeature( sal_uInt32 nFeature
);
113 void ExecuteTextAttribute( SfxRequest
& );
114 void GetTextAttributeState( SfxItemSet
& );
116 sal_Bool
GetY2KState(sal_uInt16
& nReturn
);
117 void SetY2KState(sal_uInt16 n
);
119 void SetView(FmFormView
* pView
);
121 FmFormView
* GetFormView() const { return m_pFormView
; }
122 FmFormModel
* GetFormModel() const { return m_pFormModel
; }
123 FmFormPage
* GetCurPage() const;
124 FmXFormShell
* GetImpl() const {return m_pImpl
;};
126 sal_uInt16
PrepareClose(sal_Bool bUI
= sal_True
, sal_Bool bForBrowsing
= sal_False
);
128 bool IsActiveControl() const;
129 void ForgetActiveControl();
130 void SetControlActivationHandler( const Link
& _rHdl
);
132 virtual void Activate(sal_Bool bMDI
);
133 virtual void Deactivate(sal_Bool bMDI
);
135 // helper methods for implementing XFormLayerAccess
136 SdrUnoObj
* GetFormControl(
137 const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XControlModel
>& _rxModel
,
138 const SdrView
& _rView
,
139 const OutputDevice
& _rDevice
,
140 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XControl
>& _out_rxControl
143 ::com::sun::star::uno::Reference
< ::com::sun::star::form::runtime::XFormController
> GetFormController(
144 const ::com::sun::star::uno::Reference
< ::com::sun::star::form::XForm
>& _rxForm
,
145 const SdrView
& _rView
,
146 const OutputDevice
& _rDevice
149 /** puts the focus into the document window, if current a form control has the focus. Otherwise, moves the focus
150 to the control belonging to the given SdrUnoObj.
152 void ToggleControlFocus(
153 const SdrUnoObj
& i_rNextCandidate
,
154 const SdrView
& i_rView
,
155 OutputDevice
& i_rDevice
158 ::std::auto_ptr
< ::svx::ISdrObjectFilter
>
159 CreateFocusableControlFilter(
160 const SdrView
& i_rView
,
161 const OutputDevice
& i_rDevice
164 sal_Bool
IsDesignMode() const { return m_bDesignMode
; }
165 void SetDesignMode( sal_Bool _bDesignMode
);
168 void GetFormState(SfxItemSet
&rSet
, sal_uInt16 nWhich
);
170 // is there a form on the current page?
171 void DetermineForms(sal_Bool bInvalidate
);
172 void impl_setDesignMode( sal_Bool bDesign
);
175 // ***************************************************************************************************
176 // ***************************************************************************************************
177 // ***************************************************************************************************
179 #endif // _SVX_FMSHELL_HXX
181 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */