LibreOffice Module svx (master) 1
svdomeas.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 <svx/svdotext.hxx>
23#include <svx/svxdllapi.h>
24#include <editeng/measfld.hxx>
25
26class SdrOutliner;
27struct ImpMeasureRec;
28struct ImpMeasurePoly;
29
30namespace sdr::properties {
31 class MeasureProperties;
32}
33
35{
36public:
39
40public:
42 virtual ~SdrMeasureObjGeoData() override;
43};
44
46{
47private:
48 // to allow sdr::properties::MeasureProperties access to SetTextDirty()
50 friend class SdrMeasureField;
51
52 virtual std::unique_ptr<sdr::contact::ViewContact> CreateObjectSpecificViewContact() override;
53 virtual std::unique_ptr<sdr::properties::BaseProperties> CreateObjectSpecificProperties() override;
54
58
59 void ImpTakeAttr(ImpMeasureRec& rRec) const;
60 OUString TakeRepresentation(SdrMeasureFieldKind eMeasureFieldKind) const;
61 void ImpCalcGeometrics(const ImpMeasureRec& rRec, ImpMeasurePoly& rPol) const;
62 static basegfx::B2DPolyPolygon ImpCalcXPoly(const ImpMeasurePoly& rPol);
63 void ImpEvalDrag(ImpMeasureRec& rRec, const SdrDragStat& rDrag) const;
65 {
66 bTextDirty=true;
68 if (!m_aOutRect.IsEmpty())
69 {
71 SetBoundAndSnapRectsDirty(/*bNotMyself*/true);
72 }
73 }
74 void UndirtyText() const;
75
76 virtual std::unique_ptr<SdrObjGeoData> NewGeoData() const override;
77 virtual void SaveGeoData(SdrObjGeoData& rGeo) const override;
78 virtual void RestoreGeoData(const SdrObjGeoData& rGeo) override;
79
80 // protected destructor
81 virtual ~SdrMeasureObj() override;
82
83public:
84 SdrMeasureObj(SdrModel& rSdrModel);
85 // Copy constructor
86 SdrMeasureObj(SdrModel& rSdrModel, SdrMeasureObj const & rSource);
88 SdrModel& rSdrModel,
89 const Point& rPt1,
90 const Point& rPt2);
91
92 virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const override;
93 virtual SdrObjKind GetObjIdentifier() const override;
94 virtual void TakeUnrotatedSnapRect(tools::Rectangle& rRect) const override;
95 virtual SdrMeasureObj* CloneSdrObject(SdrModel& rTargetModel) const override;
96
97 virtual OUString TakeObjNameSingul() const override;
98 virtual OUString TakeObjNamePlural() const override;
99
100 virtual basegfx::B2DPolyPolygon TakeXorPoly() const override;
101 virtual sal_uInt32 GetHdlCount() const override;
102 virtual void AddToHdlList(SdrHdlList& rHdlList) const override;
103
104 // special drag methods
105 virtual bool hasSpecialDrag() const override;
106 virtual bool beginSpecialDrag(SdrDragStat& rDrag) const override;
107 virtual bool applySpecialDrag(SdrDragStat& rDrag) override;
108 virtual OUString getSpecialDragComment(const SdrDragStat& rDrag) const override;
109
110 virtual bool BegCreate(SdrDragStat& rStat) override;
111 virtual bool MovCreate(SdrDragStat& rStat) override;
112 virtual bool EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd) override;
113 virtual bool BckCreate(SdrDragStat& rStat) override;
114 virtual void BrkCreate(SdrDragStat& rStat) override;
115 virtual basegfx::B2DPolyPolygon TakeCreatePoly(const SdrDragStat& rDrag) const override;
116 virtual PointerStyle GetCreatePointer() const override;
117
118 virtual void NbcMove(const Size& rSiz) override;
119 virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) override;
120 virtual void NbcRotate(const Point& rRef, Degree100 nAngle, double sn, double cs) override;
121 virtual void NbcMirror(const Point& rRef1, const Point& rRef2) override;
122 virtual void NbcShear(const Point& rRef, Degree100 nAngle, double tn, bool bVShear) override;
123 virtual Degree100 GetRotateAngle() const override;
124 virtual void RecalcSnapRect() override;
125
126 virtual sal_uInt32 GetSnapPointCount() const override;
127 virtual Point GetSnapPoint(sal_uInt32 i) const override;
128
129 virtual bool IsPolyObj() const override;
130 virtual sal_uInt32 GetPointCount() const override;
131 virtual Point GetPoint(sal_uInt32 i) const override;
132 virtual void NbcSetPoint(const Point& rPnt, sal_uInt32 i) override;
133
134 virtual SdrObjectUniquePtr DoConvertToPolyObj(bool bBezier, bool bAddText) const override;
135
136 virtual bool BegTextEdit(SdrOutliner& rOutl) override;
137 virtual const Size& GetTextSize() const override;
138 virtual void TakeTextRect( SdrOutliner& rOutliner, tools::Rectangle& rTextRect, bool bNoEditText,
139 tools::Rectangle* pAnchorRect, bool bLineWidth = true ) const override;
140 virtual void TakeTextAnchorRect(tools::Rectangle& rAnchorRect) const override;
141 virtual void TakeTextEditArea(Size* pPaperMin, Size* pPaperMax, tools::Rectangle* pViewInit, tools::Rectangle* pViewMin) const override;
142 virtual EEAnchorMode GetOutlinerViewAnchorMode() const override;
143 virtual void NbcSetOutlinerParaObject(std::optional<OutlinerParaObject> pTextObject) override;
144 virtual OutlinerParaObject* GetOutlinerParaObject() const override;
145
146 virtual bool CalcFieldValue(const SvxFieldItem& rField, sal_Int32 nPara, sal_uInt16 nPos,
147 bool bEdit, std::optional<Color>& rpTxtColor, std::optional<Color>& rpFldColor, OUString& rRet) const override;
148
149 // #i97878#
150 virtual bool TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, basegfx::B2DPolyPolygon& rPolyPolygon) const override;
151 virtual void TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const basegfx::B2DPolyPolygon& rPolyPolygon) override;
152};
153
154// Creating:
155// ~~~~~~~~~
156// dragging reference point 1 to reference point 2 -> reference edge
157//
158// Defaults:
159// ~~~~~~~~~~~~~
160// dimension line and auxiliary dimension lines: solid black hairlines
161// arrows : 2mm x 4mm
162// text size
163// ___
164// | dimension | 2mm
165// |<--------------------->|---
166// | | 8mm
167// | |
168// Pt1============# Pt2-- <----reference edge (from Pt1 to Pt2)
169// # # |___ <-excess length of the auxiliary dimension line(s)
170// # #=========#
171// # objected to be dimensioned #
172// #=======================#
173//
174// Attributes:
175// ~~~~~~~~~~
176// 1. Where is the text: middle, right or left (default=automatic)
177// 2. Text above or below the line or line broken by text (default=automatic)
178// Default=8mm
179// 3. The distance from the dimension line to the reference edge (= to the dimensioned object)
180// 4. dimension line below the reference edge (default=no))
181// 5. excess length of the auxiliary dimension lines beyond the reference edge (2x, default=0)
182// 6. excess length of the auxiliary dimension lines past the dimension line (default=2mm)
183// 7. distance between the auxiliary dimension line and the reference edge
184//
185// Dragging: Handle Shift
186// ~~~~~~~~~
187// - reference points SolidQuadHdl only the length
188// 1.+2. Seizing the text
189// 3.+4. Hdl on arrow (2x) SolidQuadHdl only the Bool
190// 5. Hdl one end point CircHdl both lengths ?
191// 6.+7. no dragging
192//
193// Open:
194// ~~~~~~
195// - radiuses (anchor as type immediately)
196//
197// Special:
198// ~~~~~~~~
199// Connecting to a maximum of two objects
200// -> during Copy, etc. use the respective code of the connectors?!?
201// this probably will be pretty complicated ...
202
203/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SdrMeasureFieldKind eMeasureFieldKind
virtual ~SdrMeasureObjGeoData() override
Definition: svdomeas.cxx:71
bool bTextDirty
Definition: svdomeas.hxx:57
void SetTextDirty()
Definition: svdomeas.hxx:64
All geometrical data of an arbitrary object for use in undo/redo.
Definition: svdobj.hxx:175
Provides information about various ZObject properties.
Definition: svdobj.hxx:197
virtual void NbcSetPoint(const Point &rPnt, sal_uInt32 i)
Definition: svdobj.cxx:1752
virtual bool beginSpecialDrag(SdrDragStat &rDrag) const
Definition: svdobj.cxx:1343
virtual Point GetPoint(sal_uInt32 i) const
Definition: svdobj.cxx:1738
virtual bool IsPolyObj() const
Definition: svdobj.cxx:1728
virtual void SetBoundRectDirty()
Definition: svdobj.cxx:321
virtual void SetBoundAndSnapRectsDirty(bool bNotMyself=false, bool bRecursive=true)
Definition: svdobj.cxx:515
virtual sal_uInt32 GetPointCount() const
Definition: svdobj.cxx:1733
virtual std::unique_ptr< sdr::properties::BaseProperties > CreateObjectSpecificProperties() override
Definition: svdotext.cxx:60
virtual std::unique_ptr< SdrObjGeoData > NewGeoData() const override
A derived class must override these 3 methods if it has own geometric data that must be saved for Und...
Definition: svdotext.cxx:1412
virtual OUString getSpecialDragComment(const SdrDragStat &rDrag) const override
Definition: svdotxdr.cxx:174
virtual void SaveGeoData(SdrObjGeoData &rGeo) const override
Definition: svdotext.cxx:1417
virtual void NbcMirror(const Point &rRef1, const Point &rRef2) override
Definition: svdotxtr.cxx:232
virtual void RestoreGeoData(const SdrObjGeoData &rGeo) override
Definition: svdotext.cxx:1425
virtual void NbcShear(const Point &rRef, Degree100 nAngle, double tn, bool bVShear) override
Definition: svdotxtr.cxx:210
virtual void NbcMove(const Size &rSiz) override
The methods Move, Resize, Rotate, Mirror, Shear, SetSnapRect and SetLogicRect call the corresponding ...
Definition: svdotxtr.cxx:94
virtual void RecalcSnapRect() override
Snap is not done on the BoundRect but if possible on logic coordinates (i.e.
Definition: svdotext.cxx:1114
virtual bool applySpecialDrag(SdrDragStat &rDrag) override
Definition: svdotxdr.cxx:149
virtual bool MovCreate(SdrDragStat &rStat) override
Definition: svdotxdr.cxx:192
virtual void TakeTextEditArea(Size *pPaperMin, Size *pPaperMax, tools::Rectangle *pViewInit, tools::Rectangle *pViewMin) const
Definition: svdotxed.cxx:131
virtual bool CalcFieldValue(const SvxFieldItem &rField, sal_Int32 nPara, sal_uInt16 nPos, bool bEdit, std::optional< Color > &rpTxtColor, std::optional< Color > &rpFldColor, OUString &rRet) const
Definition: svdotxfl.cxx:22
virtual sal_uInt32 GetHdlCount() const override
Via GetHdlCount the number of Handles can be retrieved.
Definition: svdotxdr.cxx:36
virtual Degree100 GetRotateAngle() const override
Definition: svdotxtr.cxx:84
virtual OUString TakeObjNameSingul() const override
Definition: svdotext.cxx:994
virtual bool BegTextEdit(SdrOutliner &rOutl)
Definition: svdotxed.cxx:40
virtual void TakeObjInfo(SdrObjTransformInfoRec &rInfo) const override
Definition: svdotext.cxx:439
virtual const Size & GetTextSize() const
Definition: svdotext.cxx:283
virtual bool BegCreate(SdrDragStat &rStat) override
Every object must be able to create itself interactively.
Definition: svdotxdr.cxx:182
virtual void TakeTextAnchorRect(::tools::Rectangle &rAnchorRect) const
Definition: svdotext.cxx:667
virtual OutlinerParaObject * GetOutlinerParaObject() const override
Definition: svdotext.cxx:1330
friend class SdrMeasureObj
Definition: svdotext.hxx:161
virtual OUString TakeObjNamePlural() const override
Definition: svdotext.cxx:1053
virtual PointerStyle GetCreatePointer() const override
get the cursor/pointer that signals creating this object
Definition: svdotxdr.cxx:242
virtual void TRSetBaseGeometry(const basegfx::B2DHomMatrix &rMatrix, const basegfx::B2DPolyPolygon &rPolyPolygon) override
Definition: svdotext.cxx:1607
virtual basegfx::B2DPolyPolygon TakeXorPoly() const override
The Xor-Polygon is required by the View to drag the object.
Definition: svdotext.cxx:1076
virtual void BrkCreate(SdrDragStat &rStat) override
Definition: svdotxdr.cxx:221
virtual basegfx::B2DPolyPolygon TakeCreatePoly(const SdrDragStat &rDrag) const override
Polygon dragged by the user when creating the object.
Definition: svdotxdr.cxx:230
virtual std::unique_ptr< sdr::contact::ViewContact > CreateObjectSpecificViewContact() override
Definition: svdotext.cxx:66
virtual Point GetSnapPoint(sal_uInt32 i) const override
Definition: svdotext.cxx:1129
void SetTextSizeDirty()
Definition: svdotext.hxx:276
virtual sal_uInt32 GetSnapPointCount() const override
snap to special points of an Object (polygon points, center of circle)
Definition: svdotext.cxx:1124
virtual bool BckCreate(SdrDragStat &rStat) override
Definition: svdotxdr.cxx:225
virtual void TakeTextRect(SdrOutliner &rOutliner, tools::Rectangle &rTextRect, bool bNoEditText, tools::Rectangle *pAnchorRect, bool bLineWidth=true) const
Definition: svdotext.cxx:691
virtual void NbcSetOutlinerParaObject(std::optional< OutlinerParaObject > pTextObject) override
Definition: svdotext.cxx:1339
virtual SdrTextObj * CloneSdrObject(SdrModel &rTargetModel) const override
Definition: svdotext.cxx:1071
virtual void AddToHdlList(SdrHdlList &rHdlList) const override
Definition: svdotxdr.cxx:41
virtual SdrObjectUniquePtr DoConvertToPolyObj(bool bBezier, bool bAddText) const override
Definition: svdotxtr.cxx:408
virtual SdrObjKind GetObjIdentifier() const override
Definition: svdotext.cxx:463
virtual void TakeUnrotatedSnapRect(tools::Rectangle &rRect) const
Definition: svdotext.cxx:628
virtual EEAnchorMode GetOutlinerViewAnchorMode() const
Definition: svdotxed.cxx:303
virtual void NbcResize(const Point &rRef, const Fraction &xFact, const Fraction &yFact) override
Definition: svdotxtr.cxx:102
virtual bool EndCreate(SdrDragStat &rStat, SdrCreateCmd eCmd) override
Definition: svdotxdr.cxx:207
virtual bool TRGetBaseGeometry(basegfx::B2DHomMatrix &rMatrix, basegfx::B2DPolyPolygon &rPolyPolygon) const override
Definition: svdotext.cxx:1572
virtual bool hasSpecialDrag() const override
The standard transformations (Move,Resize,Rotate,Mirror,Shear) are taken over by the View (TakeXorPol...
Definition: svdotxdr.cxx:67
virtual void NbcRotate(const Point &rRef, Degree100 nAngle, double sn, double cs) override
Definition: svdotxtr.cxx:186
EEAnchorMode
SdrMeasureFieldKind
PointerStyle
std::unique_ptr< SdrObject, SdrObjectFreeOp > SdrObjectUniquePtr
Definition: svdobj.hxx:98
SdrObjKind
Definition: svdobjkind.hxx:25
SdrCreateCmd
Definition: svdtypes.hxx:27
#define SVXCORE_DLLPUBLIC
Definition: svxdllapi.h:35