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 .
22 #include <com/sun/star/frame/XModel.hpp>
23 #include <com/sun/star/beans/XPropertyChangeListener.hpp>
24 #include <com/sun/star/container/XContainerListener.hpp>
25 #include <svx/svdouno.hxx>
34 typedef std::multimap
< sal_Int16
, OUString
> IndexToNameMap
;
44 class DlgEdObj
: public SdrUnoObj
46 friend class DlgEditor
;
47 friend class DlgEdFactory
;
48 friend class DlgEdPropListenerImpl
;
49 friend class DlgEdForm
;
53 DlgEdForm
* pDlgEdForm
;
54 css::uno::Reference
< css::beans::XPropertyChangeListener
> m_xPropertyChangeListener
;
55 css::uno::Reference
< css::container::XContainerListener
> m_xContainerListener
;
58 DlgEditor
& GetDialogEditor ();
61 DlgEdObj(SdrModel
& rSdrModel
);
64 const OUString
& rModelName
,
65 const css::uno::Reference
< css::lang::XMultiServiceFactory
>& rxSFac
);
67 // protected destructor
68 virtual ~DlgEdObj() override
;
70 virtual void NbcMove( const Size
& rSize
) override
;
71 virtual void NbcResize(const Point
& rRef
, const Fraction
& xFact
, const Fraction
& yFact
) override
;
72 virtual bool EndCreate(SdrDragStat
& rStat
, SdrCreateCmd eCmd
) override
;
74 using SfxListener::StartListening
;
75 void StartListening();
76 using SfxListener::EndListening
;
77 void EndListening(bool bRemoveListener
);
78 bool isListening() const { return bIsListening
; }
80 bool TransformSdrToControlCoordinates(
81 sal_Int32 nXIn
, sal_Int32 nYIn
, sal_Int32 nWidthIn
, sal_Int32 nHeightIn
,
82 sal_Int32
& nXOut
, sal_Int32
& nYOut
, sal_Int32
& nWidthOut
, sal_Int32
& nHeightOut
);
83 bool TransformSdrToFormCoordinates(
84 sal_Int32 nXIn
, sal_Int32 nYIn
, sal_Int32 nWidthIn
, sal_Int32 nHeightIn
,
85 sal_Int32
& nXOut
, sal_Int32
& nYOut
, sal_Int32
& nWidthOut
, sal_Int32
& nHeightOut
);
86 bool TransformControlToSdrCoordinates(
87 sal_Int32 nXIn
, sal_Int32 nYIn
, sal_Int32 nWidthIn
, sal_Int32 nHeightIn
,
88 sal_Int32
& nXOut
, sal_Int32
& nYOut
, sal_Int32
& nWidthOut
, sal_Int32
& nHeightOut
);
89 bool TransformFormToSdrCoordinates(
90 sal_Int32 nXIn
, sal_Int32 nYIn
, sal_Int32 nWidthIn
, sal_Int32 nHeightIn
,
91 sal_Int32
& nXOut
, sal_Int32
& nYOut
, sal_Int32
& nWidthOut
, sal_Int32
& nHeightOut
);
94 DlgEdObj(DlgEdObj
const &) = delete; // due to SdrUnoObj
95 DlgEdObj(DlgEdObj
&&) = delete; // due to SdrUnoObj
96 DlgEdObj
& operator =(DlgEdObj
const &) = default;
97 DlgEdObj
& operator =(DlgEdObj
&&) = default;
99 void SetDlgEdForm( DlgEdForm
* pForm
) { pDlgEdForm
= pForm
; }
100 DlgEdForm
* GetDlgEdForm() const { return pDlgEdForm
; }
102 virtual SdrInventor
GetObjInventor() const override
;
103 virtual SdrObjKind
GetObjIdentifier() const override
;
105 virtual DlgEdObj
* CloneSdrObject(SdrModel
& rTargetModel
) const override
; // not working yet
106 void clonedFrom(const DlgEdObj
* _pSource
); // not working yet
109 virtual SdrObjectUniquePtr
getFullDragClone() const override
;
111 bool supportsService( OUString
const & serviceName
) const;
112 OUString
GetDefaultName() const;
113 OUString
GetUniqueName() const;
115 sal_Int32
GetStep() const;
116 virtual void UpdateStep();
119 virtual void SetRectFromProps();
120 virtual void SetPropsFromRect();
122 css::uno::Reference
< css::awt::XControl
> GetControl() const;
124 virtual void PositionAndSizeChange( const css::beans::PropertyChangeEvent
& evt
);
125 /// @throws css::container::NoSuchElementException
126 /// @throws css::uno::RuntimeException
127 void NameChange( const css::beans::PropertyChangeEvent
& evt
);
128 /// @throws css::uno::RuntimeException
129 void TabIndexChange( const css::beans::PropertyChangeEvent
& evt
);
131 // PropertyChangeListener
132 /// @throws css::uno::RuntimeException
133 void _propertyChange(const css::beans::PropertyChangeEvent
& evt
);
136 /// @throws css::uno::RuntimeException
137 void _elementInserted();
138 /// @throws css::uno::RuntimeException
139 void _elementReplaced();
140 /// @throws css::uno::RuntimeException
141 void _elementRemoved();
143 virtual void SetLayer(SdrLayerID nLayer
) override
;
144 void MakeDataAware( const css::uno::Reference
< css::frame::XModel
>& xModel
);
151 class DlgEdForm
: public DlgEdObj
153 friend class DlgEditor
;
154 friend class DlgEdFactory
;
157 DlgEditor
& rDlgEditor
;
158 std::vector
<DlgEdObj
*> pChildren
;
160 mutable ::std::optional
< css::awt::DeviceInfo
> mpDeviceInfo
;
168 virtual void NbcMove( const Size
& rSize
) override
;
169 virtual void NbcResize(const Point
& rRef
, const Fraction
& xFact
, const Fraction
& yFact
) override
;
170 virtual bool EndCreate(SdrDragStat
& rStat
, SdrCreateCmd eCmd
) override
;
172 // protected destructor
173 virtual ~DlgEdForm() override
;
176 DlgEditor
& GetDlgEditor () const { return rDlgEditor
; }
178 void AddChild( DlgEdObj
* pDlgEdObj
);
179 void RemoveChild( DlgEdObj
* pDlgEdObj
);
180 std::vector
<DlgEdObj
*> const& GetChildren() const { return pChildren
; }
182 virtual void UpdateStep() override
;
184 virtual void SetRectFromProps() override
;
185 virtual void SetPropsFromRect() override
;
187 virtual void PositionAndSizeChange( const css::beans::PropertyChangeEvent
& evt
) override
;
189 void UpdateTabIndices();
190 void UpdateTabOrder();
192 void UpdateTabOrderAndGroups();
194 css::awt::DeviceInfo
getDeviceInfo() const;
197 } // namespace basctl
199 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */