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 // ***************************************************************************************************
27 #include <sfx2/shell.hxx>
28 #include <sfx2/module.hxx>
29 #include <vcl/event.hxx>
31 #include <svx/svxids.hrc>
32 #include <svx/fmview.hxx>
33 #include <svx/svxdllapi.h>
35 #include <svx/ifaceids.hxx>
46 namespace com
{ namespace sun
{ namespace star
{ namespace form
{
49 class XFormController
;
55 class ISdrObjectFilter
;
59 class SAL_WARN_UNUSED SVX_DLLPUBLIC FmDesignModeChangedHint
: public SfxHint
64 FmDesignModeChangedHint( bool bDesMode
);
65 virtual ~FmDesignModeChangedHint() override
;
67 bool GetDesignMode() const { return m_bDesignMode
; }
70 class SVX_DLLPUBLIC FmFormShell
: public SfxShell
72 friend class FmFormView
;
73 friend class FmXFormShell
;
75 rtl::Reference
<FmXFormShell
> m_pImpl
;
76 FmFormView
* m_pFormView
;
77 FmFormModel
* m_pFormModel
;
79 sal_uInt16 m_nLastSlot
;
80 bool m_bDesignMode
: 1;
81 bool m_bHasForms
: 1; // flag storing if the forms on a page exist,
82 // only for the DesignMode, see UIFeatureChanged!
84 // the marks of a FormView have changed...
85 void NotifyMarkListChanged(FmFormView
*);
86 // (the FormView itself is not a broadcaster, therefore it can't always correctly notify the
87 // form explorer who is interested in the event)
90 SFX_DECL_INTERFACE(SVX_INTERFACE_FORM_SH
)
93 /// SfxInterface initializer.
94 static void InitInterface_Impl();
97 FmFormShell(SfxViewShell
* pParent
, FmFormView
* pView
= nullptr);
98 virtual ~FmFormShell() override
;
100 void Execute( SfxRequest
& );
101 void GetState( SfxItemSet
& );
102 virtual bool HasUIFeature(SfxShellFeature nFeature
) const override
;
104 void ExecuteTextAttribute( SfxRequest
& );
105 void GetTextAttributeState( SfxItemSet
& );
107 bool GetY2KState(sal_uInt16
& nReturn
);
108 void SetY2KState(sal_uInt16 n
);
110 void SetView(FmFormView
* pView
);
112 FmFormView
* GetFormView() const { return m_pFormView
; }
113 FmFormModel
* GetFormModel() const { return m_pFormModel
; }
114 FmFormPage
* GetCurPage() const;
115 FmXFormShell
* GetImpl() const {return m_pImpl
.get();};
117 bool PrepareClose(bool bUI
= true);
119 bool IsActiveControl() const;
120 void ForgetActiveControl();
121 void SetControlActivationHandler( const Link
<LinkParamNone
*,void>& _rHdl
);
123 virtual void Activate(bool bMDI
) override
;
124 virtual void Deactivate(bool bMDI
) override
;
126 // helper methods for implementing XFormLayerAccess
127 SdrUnoObj
* GetFormControl(
128 const css::uno::Reference
< css::awt::XControlModel
>& _rxModel
,
129 const SdrView
& _rView
,
130 const OutputDevice
& _rDevice
,
131 css::uno::Reference
< css::awt::XControl
>& _out_rxControl
134 static css::uno::Reference
< css::form::runtime::XFormController
> GetFormController(
135 const css::uno::Reference
< css::form::XForm
>& _rxForm
,
136 const SdrView
& _rView
,
137 const OutputDevice
& _rDevice
140 /** puts the focus into the document window, if current a form control has the focus. Otherwise, moves the focus
141 to the control belonging to the given SdrUnoObj.
143 void ToggleControlFocus(
144 const SdrUnoObj
& i_rNextCandidate
,
145 const SdrView
& i_rView
,
146 OutputDevice
& i_rDevice
149 static ::std::unique_ptr
< svx::ISdrObjectFilter
>
150 CreateFocusableControlFilter(
151 const SdrView
& i_rView
,
152 const OutputDevice
& i_rDevice
155 virtual bool IsDesignMode() const override
{ return m_bDesignMode
; }
156 void SetDesignMode( bool _bDesignMode
);
159 void GetFormState(SfxItemSet
&rSet
, sal_uInt16 nWhich
);
161 // is there a form on the current page?
162 void DetermineForms(bool bInvalidate
);
163 void impl_setDesignMode( bool bDesign
);
166 #endif // INCLUDED_SVX_FMSHELL_HXX
168 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */