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_SOURCE_INC_FMOBJ_HXX
20 #define INCLUDED_SVX_SOURCE_INC_FMOBJ_HXX
22 #include <config_options.h>
23 #include <svx/svdouno.hxx>
24 #include <com/sun/star/container/XIndexContainer.hpp>
25 #include <com/sun/star/form/XForms.hpp>
26 #include <com/sun/star/script/ScriptEventDescriptor.hpp>
31 class UNLESS_MERGELIBS(SVXCORE_DLLPUBLIC
) FmFormObj final
: public SdrUnoObj
33 FmFormObj( const FmFormObj
& ) = delete;
35 css::uno::Sequence
< css::script::ScriptEventDescriptor
> aEvts
; // events of the object
36 css::uno::Sequence
< css::script::ScriptEventDescriptor
> m_aEventsHistory
;
37 // valid if and only if m_pEnvironmentHistory != NULL, this are the events which we're set when
38 // m_pEnvironmentHistory was created
40 // information for the control environment is only maintained if an object is not in an
42 css::uno::Reference
< css::container::XIndexContainer
> m_xParent
;
43 css::uno::Reference
< css::form::XForms
> m_xEnvironmentHistory
;
46 VclPtr
<OutputDevice
> m_pLastKnownRefDevice
;
47 // the last ref device we know, as set at the model
48 // only to be used for comparison with the current ref device!
50 // protected destructor
51 SAL_DLLPRIVATE
virtual ~FmFormObj() override
;
56 const OUString
& rModelName
);
57 FmFormObj(SdrModel
& rSdrModel
);
59 FmFormObj(SdrModel
& rSdrModel
, FmFormObj
const & rSource
);
61 SAL_DLLPRIVATE
const css::uno::Reference
< css::container::XIndexContainer
>&
62 GetOriginalParent() const { return m_xParent
; }
63 SAL_DLLPRIVATE
const css::uno::Sequence
< css::script::ScriptEventDescriptor
>&
64 GetOriginalEvents() const { return aEvts
; }
65 SAL_DLLPRIVATE sal_Int32
66 GetOriginalIndex() const { return m_nPos
; }
68 SAL_DLLPRIVATE
void SetObjEnv(
69 const css::uno::Reference
< css::container::XIndexContainer
>& xForm
,
71 const css::uno::Sequence
< css::script::ScriptEventDescriptor
>& rEvts
);
72 SAL_DLLPRIVATE
void ClearObjEnv();
75 // react on page change
76 virtual void handlePageChange(SdrPage
* pOldPage
, SdrPage
* pNewPage
) override
;
78 SAL_DLLPRIVATE
virtual SdrInventor
GetObjInventor() const override
;
79 SAL_DLLPRIVATE
virtual SdrObjKind
GetObjIdentifier() const override
;
80 SAL_DLLPRIVATE
virtual void NbcReformatText() override
;
82 SAL_DLLPRIVATE
virtual rtl::Reference
<SdrObject
> CloneSdrObject(SdrModel
& rTargetModel
) const override
;
84 SAL_DLLPRIVATE
static css::uno::Reference
< css::uno::XInterface
> ensureModelEnv(
85 const css::uno::Reference
< css::uno::XInterface
>& _rSourceContainer
,
86 const css::uno::Reference
< css::form::XForms
>& _rTopLevelDestContainer
);
88 /** returns the FmFormObj behind the given SdrObject
90 In case the SdrObject *is* a FmFormObject, this is a simple cast. In case the SdrObject
91 is a virtual object whose referenced object is a FmFormObj, then this referenced
92 object is returned. In all other cases, NULL is returned.
94 SAL_DLLPRIVATE
static FmFormObj
* GetFormObject( SdrObject
* _pSdrObject
);
95 SAL_DLLPRIVATE
static const FmFormObj
* GetFormObject( const SdrObject
* _pSdrObject
);
97 SAL_DLLPRIVATE
virtual void SetUnoControlModel( const css::uno::Reference
< css::awt::XControlModel
>& _rxModel
) override
;
100 SAL_DLLPRIVATE
virtual bool EndCreate( SdrDragStat
& rStat
, SdrCreateCmd eCmd
) override
;
101 SAL_DLLPRIVATE
virtual void BrkCreate( SdrDragStat
& rStat
) override
;
103 /** isolates the control model from its form component hierarchy, i.e. removes it from
106 SAL_DLLPRIVATE
void impl_isolateControlModel_nothrow();
108 /** forwards the reference device of our SdrModel to the control model
110 SAL_DLLPRIVATE
void impl_checkRefDevice_nothrow( bool _force
= false );
114 #endif // _FM_FMOBJ_HXX
116 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */