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 <rtl/ref.hxx>
28 #include <sfx2/shell.hxx>
29 #include <vcl/outdev.hxx>
31 #include <svx/svxdllapi.h>
32 #include <svx/ifaceids.hxx>
33 #include <svl/hint.hxx>
35 #include <com/sun/star/uno/Reference.hxx>
45 namespace com
{ namespace sun
{ namespace star
{ namespace form
{
48 class XFormController
;
52 namespace com::sun::star::awt
{ class XControl
; }
53 namespace com::sun::star::awt
{ class XControlModel
; }
54 template <typename Arg
, typename Ret
> class Link
;
58 class ISdrObjectFilter
;
62 class SAL_WARN_UNUSED SVX_DLLPUBLIC FmDesignModeChangedHint
: public SfxHint
64 bool const m_bDesignMode
;
67 FmDesignModeChangedHint( bool bDesMode
);
68 virtual ~FmDesignModeChangedHint() override
;
70 bool GetDesignMode() const { return m_bDesignMode
; }
73 class SVX_DLLPUBLIC FmFormShell
: public SfxShell
75 friend class FmFormView
;
76 friend class FmXFormShell
;
78 rtl::Reference
<FmXFormShell
> m_pImpl
;
79 FmFormView
* m_pFormView
;
80 FmFormModel
* m_pFormModel
;
82 sal_uInt16 m_nLastSlot
;
83 bool m_bDesignMode
: 1;
84 bool m_bHasForms
: 1; // flag storing if the forms on a page exist,
85 // only for the DesignMode, see UIFeatureChanged!
87 // the marks of a FormView have changed...
88 void NotifyMarkListChanged(FmFormView
*);
89 // (the FormView itself is not a broadcaster, therefore it can't always correctly notify the
90 // form explorer who is interested in the event)
93 SFX_DECL_INTERFACE(SVX_INTERFACE_FORM_SH
)
96 /// SfxInterface initializer.
97 static void InitInterface_Impl();
100 FmFormShell(SfxViewShell
* pParent
, FmFormView
* pView
= nullptr);
101 virtual ~FmFormShell() override
;
103 void Execute( SfxRequest
& );
104 void GetState( SfxItemSet
& );
105 virtual bool HasUIFeature(SfxShellFeature nFeature
) const override
;
107 void ExecuteTextAttribute( SfxRequest
& );
108 void GetTextAttributeState( SfxItemSet
& );
110 bool GetY2KState(sal_uInt16
& nReturn
);
111 void SetY2KState(sal_uInt16 n
);
113 void SetView(FmFormView
* pView
);
115 FmFormView
* GetFormView() const { return m_pFormView
; }
116 FmFormModel
* GetFormModel() const { return m_pFormModel
; }
117 FmFormPage
* GetCurPage() const;
118 FmXFormShell
* GetImpl() const {return m_pImpl
.get();};
120 bool PrepareClose(bool bUI
= true);
122 bool IsActiveControl() const;
123 void ForgetActiveControl();
124 void SetControlActivationHandler( const Link
<LinkParamNone
*,void>& _rHdl
);
126 virtual void Activate(bool bMDI
) override
;
127 virtual void Deactivate(bool bMDI
) override
;
129 // helper methods for implementing XFormLayerAccess
130 SdrUnoObj
* GetFormControl(
131 const css::uno::Reference
< css::awt::XControlModel
>& _rxModel
,
132 const SdrView
& _rView
,
133 const OutputDevice
& _rDevice
,
134 css::uno::Reference
< css::awt::XControl
>& _out_rxControl
137 static css::uno::Reference
< css::form::runtime::XFormController
> GetFormController(
138 const css::uno::Reference
< css::form::XForm
>& _rxForm
,
139 const SdrView
& _rView
,
140 const OutputDevice
& _rDevice
143 /** puts the focus into the document window, if current a form control has the focus. Otherwise, moves the focus
144 to the control belonging to the given SdrUnoObj.
146 void ToggleControlFocus(
147 const SdrUnoObj
& i_rNextCandidate
,
148 const SdrView
& i_rView
,
149 OutputDevice
& i_rDevice
152 static ::std::unique_ptr
< svx::ISdrObjectFilter
>
153 CreateFocusableControlFilter(
154 const SdrView
& i_rView
,
155 const OutputDevice
& i_rDevice
158 virtual bool IsDesignMode() const override
{ return m_bDesignMode
; }
159 void SetDesignMode( bool _bDesignMode
);
162 void GetFormState(SfxItemSet
&rSet
, sal_uInt16 nWhich
);
164 // is there a form on the current page?
165 void DetermineForms(bool bInvalidate
);
166 void impl_setDesignMode( bool bDesign
);
169 #endif // INCLUDED_SVX_FMSHELL_HXX
171 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */