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 .
20 #ifndef INCLUDED_BASCTL_SOURCE_INC_DLGEDOBJ_HXX
21 #define INCLUDED_BASCTL_SOURCE_INC_DLGEDOBJ_HXX
23 #include <com/sun/star/frame/XModel.hpp>
24 #include <com/sun/star/beans/XPropertyChangeListener.hpp>
25 #include <com/sun/star/container/XContainerListener.hpp>
26 #include <svx/svdouno.hxx>
28 #include <boost/optional.hpp>
33 typedef std::multimap
< sal_Int16
, OUString
> IndexToNameMap
;
43 class DlgEdObj
: public SdrUnoObj
45 friend class DlgEditor
;
46 friend class DlgEdFactory
;
47 friend class DlgEdPropListenerImpl
;
48 friend class DlgEdForm
;
52 DlgEdForm
* pDlgEdForm
;
53 css::uno::Reference
< css::beans::XPropertyChangeListener
> m_xPropertyChangeListener
;
54 css::uno::Reference
< css::container::XContainerListener
> m_xContainerListener
;
57 DlgEditor
& GetDialogEditor ();
60 DlgEdObj(SdrModel
& rSdrModel
);
63 const OUString
& rModelName
,
64 const css::uno::Reference
< css::lang::XMultiServiceFactory
>& rxSFac
);
66 // protected destructor
67 virtual ~DlgEdObj() override
;
69 virtual void NbcMove( const Size
& rSize
) override
;
70 virtual void NbcResize(const Point
& rRef
, const Fraction
& xFact
, const Fraction
& yFact
) override
;
71 virtual bool EndCreate(SdrDragStat
& rStat
, SdrCreateCmd eCmd
) override
;
73 using SfxListener::StartListening
;
74 void StartListening();
75 using SfxListener::EndListening
;
76 void EndListening(bool bRemoveListener
);
77 bool isListening() const { return bIsListening
; }
79 bool TransformSdrToControlCoordinates(
80 sal_Int32 nXIn
, sal_Int32 nYIn
, sal_Int32 nWidthIn
, sal_Int32 nHeightIn
,
81 sal_Int32
& nXOut
, sal_Int32
& nYOut
, sal_Int32
& nWidthOut
, sal_Int32
& nHeightOut
);
82 bool TransformSdrToFormCoordinates(
83 sal_Int32 nXIn
, sal_Int32 nYIn
, sal_Int32 nWidthIn
, sal_Int32 nHeightIn
,
84 sal_Int32
& nXOut
, sal_Int32
& nYOut
, sal_Int32
& nWidthOut
, sal_Int32
& nHeightOut
);
85 bool TransformControlToSdrCoordinates(
86 sal_Int32 nXIn
, sal_Int32 nYIn
, sal_Int32 nWidthIn
, sal_Int32 nHeightIn
,
87 sal_Int32
& nXOut
, sal_Int32
& nYOut
, sal_Int32
& nWidthOut
, sal_Int32
& nHeightOut
);
88 bool TransformFormToSdrCoordinates(
89 sal_Int32 nXIn
, sal_Int32 nYIn
, sal_Int32 nWidthIn
, sal_Int32 nHeightIn
,
90 sal_Int32
& nXOut
, sal_Int32
& nYOut
, sal_Int32
& nWidthOut
, sal_Int32
& nHeightOut
);
93 void SetDlgEdForm( DlgEdForm
* pForm
) { pDlgEdForm
= pForm
; }
94 DlgEdForm
* GetDlgEdForm() const { return pDlgEdForm
; }
96 virtual SdrInventor
GetObjInventor() const override
;
97 virtual sal_uInt16
GetObjIdentifier() const override
;
99 virtual DlgEdObj
* CloneSdrObject(SdrModel
& rTargetModel
) const override
; // not working yet
100 void clonedFrom(const DlgEdObj
* _pSource
); // not working yet
103 virtual SdrObject
* getFullDragClone() const override
;
105 bool supportsService( OUString
const & serviceName
) const;
106 OUString
GetDefaultName() const;
107 OUString
GetUniqueName() const;
109 sal_Int32
GetStep() const;
110 virtual void UpdateStep();
113 virtual void SetRectFromProps();
114 virtual void SetPropsFromRect();
116 css::uno::Reference
< css::awt::XControl
> GetControl() const;
118 virtual void PositionAndSizeChange( const css::beans::PropertyChangeEvent
& evt
);
119 /// @throws css::container::NoSuchElementException
120 /// @throws css::uno::RuntimeException
121 void NameChange( const css::beans::PropertyChangeEvent
& evt
);
122 /// @throws css::uno::RuntimeException
123 void TabIndexChange( const css::beans::PropertyChangeEvent
& evt
);
125 // PropertyChangeListener
126 /// @throws css::uno::RuntimeException
127 void _propertyChange(const css::beans::PropertyChangeEvent
& evt
);
130 /// @throws css::uno::RuntimeException
131 void _elementInserted();
132 /// @throws css::uno::RuntimeException
133 void _elementReplaced();
134 /// @throws css::uno::RuntimeException
135 void _elementRemoved();
137 virtual void SetLayer(SdrLayerID nLayer
) override
;
138 void MakeDataAware( const css::uno::Reference
< css::frame::XModel
>& xModel
);
145 class DlgEdForm
: public DlgEdObj
147 friend class DlgEditor
;
148 friend class DlgEdFactory
;
151 DlgEditor
& rDlgEditor
;
152 std::vector
<DlgEdObj
*> pChildren
;
154 mutable ::boost::optional
< css::awt::DeviceInfo
> mpDeviceInfo
;
162 virtual void NbcMove( const Size
& rSize
) override
;
163 virtual void NbcResize(const Point
& rRef
, const Fraction
& xFact
, const Fraction
& yFact
) override
;
164 virtual bool EndCreate(SdrDragStat
& rStat
, SdrCreateCmd eCmd
) override
;
166 // protected destructor
167 virtual ~DlgEdForm() override
;
170 DlgEditor
& GetDlgEditor () const { return rDlgEditor
; }
172 void AddChild( DlgEdObj
* pDlgEdObj
);
173 void RemoveChild( DlgEdObj
* pDlgEdObj
);
174 std::vector
<DlgEdObj
*> const& GetChildren() const { return pChildren
; }
176 virtual void UpdateStep() override
;
178 virtual void SetRectFromProps() override
;
179 virtual void SetPropsFromRect() override
;
181 virtual void PositionAndSizeChange( const css::beans::PropertyChangeEvent
& evt
) override
;
183 void UpdateTabIndices();
184 void UpdateTabOrder();
186 void UpdateTabOrderAndGroups();
188 css::awt::DeviceInfo
getDeviceInfo() const;
191 } // namespace basctl
193 #endif // INCLUDED_BASCTL_SOURCE_INC_DLGEDOBJ_HXX
195 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */