LibreOffice Module basctl (master) 1
dlgedobj.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#pragma once
21
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>
26
27#include <optional>
28
29#include <map>
30
31namespace basctl
32{
33
34typedef std::multimap< sal_Int16, OUString > IndexToNameMap;
35
36
37class DlgEdForm;
38class DlgEditor;
39
40
41// DlgEdObj
42
43
44class DlgEdObj: public SdrUnoObj
45{
46 friend class DlgEditor;
47 friend class DlgEdFactory;
49 friend class DlgEdForm;
50
51private:
54 css::uno::Reference< css::beans::XPropertyChangeListener> m_xPropertyChangeListener;
55 css::uno::Reference< css::container::XContainerListener> m_xContainerListener;
56
57private:
59
60protected:
61 DlgEdObj(SdrModel& rSdrModel);
62 // copy constructor
63 DlgEdObj(SdrModel& rSdrModel, DlgEdObj const & rSource);
65 SdrModel& rSdrModel,
66 const OUString& rModelName,
67 const css::uno::Reference< css::lang::XMultiServiceFactory >& rxSFac);
68
69 // protected destructor
70 virtual ~DlgEdObj() override;
71
72 virtual void NbcMove( const Size& rSize ) override;
73 virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) override;
74 virtual bool EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd) override;
75
77 void StartListening();
79 void EndListening(bool bRemoveListener);
80 bool isListening() const { return bIsListening; }
81
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 );
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 );
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 );
92 sal_Int32 nXIn, sal_Int32 nYIn, sal_Int32 nWidthIn, sal_Int32 nHeightIn,
93 sal_Int32& nXOut, sal_Int32& nYOut, sal_Int32& nWidthOut, sal_Int32& nHeightOut );
94
95public:
96 void SetDlgEdForm( DlgEdForm* pForm ) { pDlgEdForm = pForm; }
97 DlgEdForm* GetDlgEdForm() const { return pDlgEdForm.get(); }
98
99 virtual SdrInventor GetObjInventor() const override;
100 virtual SdrObjKind GetObjIdentifier() const override;
101
102 virtual rtl::Reference<SdrObject> CloneSdrObject(SdrModel& rTargetModel) const override; // not working yet
103
104 // FullDrag support
105 virtual rtl::Reference<SdrObject> getFullDragClone() const override;
106
107 bool supportsService( OUString const & serviceName ) const;
108 OUString GetDefaultName() const;
109 OUString GetUniqueName() const;
110
111 sal_Int32 GetStep() const;
112 virtual void UpdateStep();
113
114 void SetDefaults();
115 virtual void SetRectFromProps();
116 virtual void SetPropsFromRect();
117
118 css::uno::Reference< css::awt::XControl > GetControl() const;
119
120 virtual void PositionAndSizeChange( const css::beans::PropertyChangeEvent& evt );
123 void NameChange( const css::beans::PropertyChangeEvent& evt );
125 void TabIndexChange( const css::beans::PropertyChangeEvent& evt );
126
127 // PropertyChangeListener
129 void _propertyChange(const css::beans::PropertyChangeEvent& evt);
130
131 // ContainerListener
133 void _elementInserted();
135 void _elementReplaced();
137 void _elementRemoved();
138
139 virtual void SetLayer(SdrLayerID nLayer) override;
140 void MakeDataAware( const css::uno::Reference< css::frame::XModel >& xModel );
141};
142
143
144// DlgEdForm
145
146
147class DlgEdForm: public DlgEdObj
148{
149 friend class DlgEditor;
150 friend class DlgEdFactory;
151
152private:
154 std::vector<DlgEdObj*> pChildren;
155
156 mutable ::std::optional< css::awt::DeviceInfo > mpDeviceInfo;
157
158private:
159 explicit DlgEdForm(
160 SdrModel& rSdrModel,
161 DlgEditor&);
162
163protected:
164 virtual void NbcMove( const Size& rSize ) override;
165 virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) override;
166 virtual bool EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd) override;
167
168 // protected destructor
169 virtual ~DlgEdForm() override;
170
171public:
172 DlgEditor& GetDlgEditor () const { return rDlgEditor; }
173
174 void AddChild( DlgEdObj* pDlgEdObj );
175 void RemoveChild( DlgEdObj* pDlgEdObj );
176 std::vector<DlgEdObj*> const& GetChildren() const { return pChildren; }
177
178 virtual void UpdateStep() override;
179
180 virtual void SetRectFromProps() override;
181 virtual void SetPropsFromRect() override;
182
183 virtual void PositionAndSizeChange( const css::beans::PropertyChangeEvent& evt ) override;
184
185 void UpdateTabIndices();
186 void UpdateTabOrder();
187 void UpdateGroups();
189
190 css::awt::DeviceInfo getDeviceInfo() const;
191};
192
193} // namespace basctl
194
195/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void StartListening(SfxBroadcaster &rBroadcaster, DuplicateHandling eDuplicateHanding=DuplicateHandling::Unexpected)
void EndListening(SfxBroadcaster &rBroadcaster, bool bRemoveAllDuplicates=false)
virtual void PositionAndSizeChange(const css::beans::PropertyChangeEvent &evt) override
Definition: dlgedobj.cxx:1294
virtual void UpdateStep() override
Definition: dlgedobj.cxx:1403
virtual void SetRectFromProps() override
Definition: dlgedobj.cxx:1235
void RemoveChild(DlgEdObj *pDlgEdObj)
Definition: dlgedobj.cxx:1289
virtual void NbcResize(const Point &rRef, const Fraction &xFact, const Fraction &yFact) override
Definition: dlgedobj.cxx:1589
DlgEditor & rDlgEditor
Definition: dlgedobj.hxx:153
DlgEditor & GetDlgEditor() const
Definition: dlgedobj.hxx:172
std::vector< DlgEdObj * > const & GetChildren() const
Definition: dlgedobj.hxx:176
css::awt::DeviceInfo getDeviceInfo() const
Definition: dlgedobj.cxx:1629
virtual void NbcMove(const Size &rSize) override
Definition: dlgedobj.cxx:1568
mutable ::std::optional< css::awt::DeviceInfo > mpDeviceInfo
Definition: dlgedobj.hxx:156
std::vector< DlgEdObj * > pChildren
Definition: dlgedobj.hxx:154
virtual bool EndCreate(SdrDragStat &rStat, SdrCreateCmd eCmd) override
Definition: dlgedobj.cxx:1610
void AddChild(DlgEdObj *pDlgEdObj)
Definition: dlgedobj.cxx:1284
virtual void SetPropsFromRect() override
Definition: dlgedobj.cxx:1259
void UpdateTabIndices()
Definition: dlgedobj.cxx:1419
virtual ~DlgEdForm() override
Definition: dlgedobj.cxx:1231
void UpdateTabOrderAndGroups()
Definition: dlgedobj.cxx:1562
rtl::Reference< DlgEdForm > pDlgEdForm
Definition: dlgedobj.hxx:53
css::uno::Reference< css::beans::XPropertyChangeListener > m_xPropertyChangeListener
Definition: dlgedobj.hxx:54
sal_Int32 GetStep() const
Definition: dlgedobj.cxx:527
css::uno::Reference< css::awt::XControl > GetControl() const
Definition: dlgedobj.cxx:148
virtual SdrObjKind GetObjIdentifier() const override
Definition: dlgedobj.cxx:808
css::uno::Reference< css::container::XContainerListener > m_xContainerListener
Definition: dlgedobj.hxx:55
bool isListening() const
Definition: dlgedobj.hxx:80
virtual bool EndCreate(SdrDragStat &rStat, SdrCreateCmd eCmd) override
Definition: dlgedobj.cxx:954
bool TransformSdrToControlCoordinates(sal_Int32 nXIn, sal_Int32 nYIn, sal_Int32 nWidthIn, sal_Int32 nHeightIn, sal_Int32 &nXOut, sal_Int32 &nYOut, sal_Int32 &nWidthOut, sal_Int32 &nHeightOut)
Definition: dlgedobj.cxx:159
void _elementRemoved()
Definition: dlgedobj.cxx:1201
friend class DlgEdForm
Definition: dlgedobj.hxx:49
DlgEdForm * GetDlgEdForm() const
Definition: dlgedobj.hxx:97
bool supportsService(OUString const &serviceName) const
Definition: dlgedobj.cxx:661
void _elementInserted()
Definition: dlgedobj.cxx:1183
DlgEdObj(SdrModel &rSdrModel)
Definition: dlgedobj.cxx:71
OUString GetUniqueName() const
Definition: dlgedobj.cxx:784
virtual void SetRectFromProps()
Definition: dlgedobj.cxx:368
void StartListening()
Definition: dlgedobj.cxx:1055
void NameChange(const css::beans::PropertyChangeEvent &evt)
Definition: dlgedobj.cxx:483
void TabIndexChange(const css::beans::PropertyChangeEvent &evt)
Definition: dlgedobj.cxx:565
OUString GetDefaultName() const
Definition: dlgedobj.cxx:673
virtual void SetLayer(SdrLayerID nLayer) override
Definition: dlgedobj.cxx:1210
void MakeDataAware(const css::uno::Reference< css::frame::XModel > &xModel)
Definition: dlgedobj.cxx:1665
virtual ~DlgEdObj() override
Definition: dlgedobj.cxx:124
DlgEditor & GetDialogEditor()
Definition: dlgedobj.cxx:63
bool TransformControlToSdrCoordinates(sal_Int32 nXIn, sal_Int32 nYIn, sal_Int32 nWidthIn, sal_Int32 nHeightIn, sal_Int32 &nXOut, sal_Int32 &nYOut, sal_Int32 &nWidthOut, sal_Int32 &nHeightOut)
Definition: dlgedobj.cxx:261
bool TransformSdrToFormCoordinates(sal_Int32 nXIn, sal_Int32 nYIn, sal_Int32 nWidthIn, sal_Int32 nHeightIn, sal_Int32 &nXOut, sal_Int32 &nYOut, sal_Int32 &nWidthOut, sal_Int32 &nHeightOut)
Definition: dlgedobj.cxx:214
void SetDefaults()
Definition: dlgedobj.cxx:980
virtual rtl::Reference< SdrObject > CloneSdrObject(SdrModel &rTargetModel) const override
Definition: dlgedobj.cxx:908
void EndListening(bool bRemoveListener)
Definition: dlgedobj.cxx:1091
virtual SdrInventor GetObjInventor() const override
Definition: dlgedobj.cxx:803
void SetDlgEdForm(DlgEdForm *pForm)
Definition: dlgedobj.hxx:96
virtual rtl::Reference< SdrObject > getFullDragClone() const override
Definition: dlgedobj.cxx:913
virtual void PositionAndSizeChange(const css::beans::PropertyChangeEvent &evt)
Definition: dlgedobj.cxx:417
bool TransformFormToSdrCoordinates(sal_Int32 nXIn, sal_Int32 nYIn, sal_Int32 nWidthIn, sal_Int32 nHeightIn, sal_Int32 &nXOut, sal_Int32 &nYOut, sal_Int32 &nWidthOut, sal_Int32 &nHeightOut)
Definition: dlgedobj.cxx:319
virtual void NbcMove(const Size &rSize) override
Definition: dlgedobj.cxx:920
virtual void NbcResize(const Point &rRef, const Fraction &xFact, const Fraction &yFact) override
Definition: dlgedobj.cxx:937
void _elementReplaced()
Definition: dlgedobj.cxx:1192
void _propertyChange(const css::beans::PropertyChangeEvent &evt)
Definition: dlgedobj.cxx:1126
virtual void UpdateStep()
Definition: dlgedobj.cxx:539
virtual void SetPropsFromRect()
Definition: dlgedobj.cxx:392
std::multimap< sal_Int16, OUString > IndexToNameMap
Definition: dlgedobj.hxx:34
SdrInventor
SdrObjKind
SdrCreateCmd