LibreOffice Module svx (master) 1
svddrgmt.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#ifndef INCLUDED_SVX_SVDDRGMT_HXX
21#define INCLUDED_SVX_SVDDRGMT_HXX
22
23#include <svx/svddrgv.hxx>
24#include <svx/svxdllapi.h>
26#include <memory>
27
28class SdrDragView;
29class SdrDragStat;
30
31class SAL_DLLPUBLIC_RTTI SdrDragEntry
32{
33private:
35
36protected:
37 // access for derived classes
38 void setAddToTransparent(bool bNew) { mbAddToTransparent = bNew; }
39
40public:
42 virtual ~SdrDragEntry();
43
45
46 // data read access
47 bool getAddToTransparent() const { return mbAddToTransparent; }
48};
49
50
52{
53private:
55
56public:
58 virtual ~SdrDragEntryPolyPolygon() override;
59
61};
62
63
65{
66private:
70
71public:
73 const SdrObject& rOriginal,
74 bool bModify);
75 virtual ~SdrDragEntrySdrObject() override;
76
77 // #i54102# Split createPrimitive2DSequenceInCurrentState in prepareCurrentState and processing,
78 // added accessors to original and clone
79 void prepareCurrentState(SdrDragMethod& rDragMethod);
80 const SdrObject& getOriginal() const { return maOriginal; }
81 SdrObject* getClone() { return mxClone.get(); }
82
84};
85
86
88{
89private:
91
92public:
94 virtual ~SdrDragEntryPrimitive2DSequence() override;
95
97};
98
99
101{
102private:
103 std::vector< basegfx::B2DPoint > maPositions;
105
106public:
107 SdrDragEntryPointGlueDrag(std::vector< basegfx::B2DPoint >&& rPositions, bool bIsPointDrag);
108 virtual ~SdrDragEntryPointGlueDrag() override;
109
111};
112
113
115{
116private:
117 std::vector< std::unique_ptr<SdrDragEntry> > maSdrDragEntries;
120
121 bool mbMoveOnly : 1;
124
125protected:
126 // access for derivated classes to maSdrDragEntries
127 void clearSdrDragEntries();
128 void addSdrDragEntry(std::unique_ptr<SdrDragEntry> pNew);
129 virtual void createSdrDragEntries();
130 virtual void createSdrDragEntryForSdrObject(const SdrObject& rOriginal);
131
132 // Helper to support inserting a new OverlayObject. It will do all
133 // necessary stuff involved with that:
134 // - add GridOffset for non-linear ViewToDevice transformation (calc)
135 // - add to OverlayManager
136 // - add to local OverlayObjectList - ownership change (!)
137 // It is centralized here (and protected) to avoid that new usages/
138 // implementations forget one of these needed steps.
139 void insertNewlyCreatedOverlayObjectForSdrDragMethod(
140 std::unique_ptr<sdr::overlay::OverlayObject> pOverlayObject,
141 const sdr::contact::ObjectContact& rObjectContact,
142 sdr::overlay::OverlayManager& rOverlayManager);
143
144 // access for derivated classes to mrSdrDragView
145 SdrDragView& getSdrDragView() { return mrSdrDragView; }
146 const SdrDragView& getSdrDragView() const { return mrSdrDragView; }
147
148 // access for derivated classes for bools
149 void setMoveOnly(bool bNew) { mbMoveOnly = bNew; }
150 void setSolidDraggingActive(bool bNew) { mbSolidDraggingActive = bNew; }
151
152 // internal helpers for creation of standard drag entries
153 void createSdrDragEntries_SolidDrag();
154 void createSdrDragEntries_PolygonDrag();
155 void createSdrDragEntries_PointDrag();
156 void createSdrDragEntries_GlueDrag();
157
158 // old call forwarders to the SdrDragView
159 OUString ImpGetDescriptionStr(TranslateId pStrCacheID) const;
160 SdrHdl* GetDragHdl() const { return getSdrDragView().mpDragHdl; }
161 SdrHdlKind GetDragHdlKind() const { return getSdrDragView().meDragHdl; }
162 SdrDragStat& DragStat() { return getSdrDragView().maDragStat; }
163 const SdrDragStat& DragStat() const { return getSdrDragView().maDragStat; }
164 Point& Ref1() const { return mrSdrDragView.maRef1; }
165 Point& Ref2() const { return mrSdrDragView.maRef2; }
166 const SdrHdlList& GetHdlList() const { return getSdrDragView().GetHdlList(); }
167 void AddUndo(std::unique_ptr<SdrUndoAction> pUndo) { getSdrDragView().AddUndo(std::move(pUndo)); }
168 bool IsDragLimit() { return getSdrDragView().mbDragLimit; }
169 const tools::Rectangle& GetDragLimitRect() { return getSdrDragView().maDragLimit; }
170 const SdrMarkList& GetMarkedObjectList() { return getSdrDragView().GetMarkedObjectList(); }
171 Point GetSnapPos(const Point& rPt) const { return getSdrDragView().GetSnapPos(rPt,getSdrDragView().mpMarkedPV); }
172 SdrSnap SnapPos(Point& rPt) const { return getSdrDragView().SnapPos(rPt,getSdrDragView().mpMarkedPV); }
173 inline const tools::Rectangle& GetMarkedRect() const;
174 SdrPageView* GetDragPV() const;
175 SdrObject* GetDragObj() const;
176 bool IsDraggingPoints() const { return getSdrDragView().IsDraggingPoints(); }
177 bool IsDraggingGluePoints() const { return getSdrDragView().IsDraggingGluePoints(); }
178
179 bool DoAddConnectorOverlays();
181
182public:
183
184 void resetSdrDragEntries();
185 basegfx::B2DRange getCurrentRange() const;
186
187 // #i58950# also moved constructor implementation to cxx
188 SdrDragMethod(SdrDragView& rNewView);
189
190 // #i58950# virtual destructor was missing
191 virtual ~SdrDragMethod();
192
193 void Show();
194 void Hide();
195 bool IsShiftPressed() const { return mbShiftPressed; }
196 void SetShiftPressed(bool bShiftPressed) { mbShiftPressed = bShiftPressed; }
197 virtual OUString GetSdrDragComment() const=0;
198 virtual bool BeginSdrDrag()=0;
199 virtual void MoveSdrDrag(const Point& rPnt)=0;
200 virtual bool EndSdrDrag(bool bCopy)=0;
201 virtual void CancelSdrDrag();
203
204 virtual void CreateOverlayGeometry(
205 sdr::overlay::OverlayManager& rOverlayManager,
206 const sdr::contact::ObjectContact& rObjectContact);
207 void destroyOverlayGeometry();
208
209 virtual basegfx::B2DHomMatrix getCurrentTransformation() const;
210 virtual void applyCurrentTransformationToSdrObject(SdrObject& rTarget);
211 virtual void applyCurrentTransformationToPolyPolygon(basegfx::B2DPolyPolygon& rTarget);
212
213 // data read access
214 bool getMoveOnly() const { return mbMoveOnly; }
215 bool getSolidDraggingActive() const { return mbSolidDraggingActive; }
216};
217
219{
223}
224
225
226// SdrDragMove
227
229{
230private:
235
236 void ImpCheckSnap(const Point& rPt);
237
238protected:
239 virtual void createSdrDragEntryForSdrObject(const SdrObject& rOriginal) override;
240
241public:
242 SdrDragMove(SdrDragView& rNewView);
243
244 virtual OUString GetSdrDragComment() const override;
245 virtual bool BeginSdrDrag() override;
246 virtual void MoveSdrDrag(const Point& rPnt) override;
247 virtual bool EndSdrDrag(bool bCopy) override;
248 virtual PointerStyle GetSdrDragPointer() const override;
249
250 virtual basegfx::B2DHomMatrix getCurrentTransformation() const override;
251 virtual void applyCurrentTransformationToSdrObject(SdrObject& rTarget) override;
252};
253
254
255// SdrDragResize
256
258{
259protected:
262
263public:
264 SdrDragResize(SdrDragView& rNewView);
265
266 virtual OUString GetSdrDragComment() const override;
267 virtual bool BeginSdrDrag() override;
268 virtual void MoveSdrDrag(const Point& rPnt) override;
269 virtual bool EndSdrDrag(bool bCopy) override;
270 virtual PointerStyle GetSdrDragPointer() const override;
271
272 virtual basegfx::B2DHomMatrix getCurrentTransformation() const override;
273 virtual void applyCurrentTransformationToSdrObject(SdrObject& rTarget) override;
274};
275
276
277// SdrDragObjOwn
278
280{
281private:
282 // SdrDragObjOwn always works on a clone since it has no transformation
283 // mechanism to modify wireframe visualisations, but uses the
284 // SdrObject::applySpecialDrag() method to change a clone of the
285 // SdrObject
287
288protected:
289 virtual void createSdrDragEntries() override;
290
291public:
292 SdrDragObjOwn(SdrDragView& rNewView);
293 virtual ~SdrDragObjOwn() override;
294
295 virtual OUString GetSdrDragComment() const override;
296 virtual bool BeginSdrDrag() override;
297 virtual void MoveSdrDrag(const Point& rPnt) override;
298 virtual bool EndSdrDrag(bool bCopy) override;
299 virtual PointerStyle GetSdrDragPointer() const override;
300};
301
302#endif // INCLUDED_SVX_SVDDRGMT_HXX
303
304/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::vector< basegfx::B2DPoint > maPositions
Definition: svddrgmt.hxx:103
virtual ~SdrDragEntryPointGlueDrag() override
Definition: svddrgmt.cxx:215
virtual drawinglayer::primitive2d::Primitive2DContainer createPrimitive2DSequenceInCurrentState(SdrDragMethod &rDragMethod) override
Definition: svddrgmt.cxx:219
SdrDragEntryPointGlueDrag(std::vector< basegfx::B2DPoint > &&rPositions, bool bIsPointDrag)
Definition: svddrgmt.cxx:207
basegfx::B2DPolyPolygon maOriginalPolyPolygon
Definition: svddrgmt.hxx:54
virtual drawinglayer::primitive2d::Primitive2DContainer createPrimitive2DSequenceInCurrentState(SdrDragMethod &rDragMethod) override
Definition: svddrgmt.cxx:196
drawinglayer::primitive2d::Primitive2DContainer maPrimitive2DSequence
Definition: svddrgmt.hxx:90
SdrDragEntryPrimitive2DSequence(drawinglayer::primitive2d::Primitive2DContainer &&rSequence)
Definition: svddrgmt.cxx:184
virtual ~SdrDragEntryPrimitive2DSequence() override
Definition: svddrgmt.cxx:192
SdrObject * getClone()
Definition: svddrgmt.hxx:81
const SdrObject & maOriginal
Definition: svddrgmt.hxx:67
void prepareCurrentState(SdrDragMethod &rDragMethod)
Definition: svddrgmt.cxx:149
rtl::Reference< SdrObject > mxClone
Definition: svddrgmt.hxx:68
virtual drawinglayer::primitive2d::Primitive2DContainer createPrimitive2DSequenceInCurrentState(SdrDragMethod &rDragMethod) override
Definition: svddrgmt.cxx:166
virtual ~SdrDragEntrySdrObject() override
Definition: svddrgmt.cxx:145
const SdrObject & getOriginal() const
Definition: svddrgmt.hxx:80
SdrDragEntrySdrObject(const SdrObject &rOriginal, bool bModify)
Definition: svddrgmt.cxx:135
bool mbAddToTransparent
Definition: svddrgmt.hxx:34
bool getAddToTransparent() const
Definition: svddrgmt.hxx:47
void setAddToTransparent(bool bNew)
Definition: svddrgmt.hxx:38
virtual drawinglayer::primitive2d::Primitive2DContainer createPrimitive2DSequenceInCurrentState(SdrDragMethod &rDragMethod)=0
const SdrMarkList & GetMarkedObjectList()
Definition: svddrgmt.hxx:170
void SetShiftPressed(bool bShiftPressed)
Definition: svddrgmt.hxx:196
bool mbShiftPressed
Definition: svddrgmt.hxx:123
Point & Ref1() const
Definition: svddrgmt.hxx:164
virtual void MoveSdrDrag(const Point &rPnt)=0
SdrHdl * GetDragHdl() const
Definition: svddrgmt.hxx:160
SdrDragView & mrSdrDragView
Definition: svddrgmt.hxx:119
SdrHdlKind GetDragHdlKind() const
Definition: svddrgmt.hxx:161
std::vector< std::unique_ptr< SdrDragEntry > > maSdrDragEntries
Definition: svddrgmt.hxx:117
virtual bool BeginSdrDrag()=0
bool IsDraggingPoints() const
Definition: svddrgmt.hxx:176
SdrSnap SnapPos(Point &rPt) const
Definition: svddrgmt.hxx:172
const SdrDragStat & DragStat() const
Definition: svddrgmt.hxx:163
SdrDragStat & DragStat()
Definition: svddrgmt.hxx:162
void AddUndo(std::unique_ptr< SdrUndoAction > pUndo)
Definition: svddrgmt.hxx:167
Point GetSnapPos(const Point &rPt) const
Definition: svddrgmt.hxx:171
virtual bool EndSdrDrag(bool bCopy)=0
bool getMoveOnly() const
Definition: svddrgmt.hxx:214
bool mbSolidDraggingActive
Definition: svddrgmt.hxx:122
bool IsDragLimit()
Definition: svddrgmt.hxx:168
SdrDragView & getSdrDragView()
Definition: svddrgmt.hxx:145
void setMoveOnly(bool bNew)
Definition: svddrgmt.hxx:149
const tools::Rectangle & GetMarkedRect() const
Definition: svddrgmt.hxx:218
sdr::overlay::OverlayObjectList maOverlayObjectList
Definition: svddrgmt.hxx:118
bool IsShiftPressed() const
Definition: svddrgmt.hxx:195
bool IsDraggingGluePoints() const
Definition: svddrgmt.hxx:177
const SdrDragView & getSdrDragView() const
Definition: svddrgmt.hxx:146
const SdrHdlList & GetHdlList() const
Definition: svddrgmt.hxx:166
virtual OUString GetSdrDragComment() const =0
void setSolidDraggingActive(bool bNew)
Definition: svddrgmt.hxx:150
const tools::Rectangle & GetDragLimitRect()
Definition: svddrgmt.hxx:169
virtual PointerStyle GetSdrDragPointer() const =0
Point & Ref2() const
Definition: svddrgmt.hxx:165
bool getSolidDraggingActive() const
Definition: svddrgmt.hxx:215
tools::Long nBestYSnap
Definition: svddrgmt.hxx:232
tools::Long nBestXSnap
Definition: svddrgmt.hxx:231
bool bXSnapped
Definition: svddrgmt.hxx:233
bool bYSnapped
Definition: svddrgmt.hxx:234
rtl::Reference< SdrObject > mxClone
Definition: svddrgmt.hxx:286
Fraction aXFact
Definition: svddrgmt.hxx:260
Fraction aYFact
Definition: svddrgmt.hxx:261
SdrHdlKind meDragHdl
Definition: svddrgv.hxx:46
const tools::Rectangle & GetMarkedGluePointsRect() const
Definition: svdmrkv1.cxx:540
Point maRef1
Definition: svdmrkv.hxx:105
const tools::Rectangle & GetMarkedPointsRect() const
Definition: svdmrkv1.cxx:236
Point maRef2
Definition: svdmrkv.hxx:106
const tools::Rectangle & GetMarkedObjRect() const
Definition: svdmrkv.cxx:2634
Abstract DrawObject.
Definition: svdobj.hxx:261
long Long
PointerStyle
SdrHdlKind
Definition: svdhdl.hxx:53
SdrSnap
Definition:
Definition: svdsnpv.hxx:72
#define SVXCORE_DLLPUBLIC
Definition: svxdllapi.h:35