/src/libreoffice/include/svx/svdomeas.hxx
Line | Count | Source |
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 | | |
26 | | struct ImpMeasureRec; |
27 | | struct ImpMeasurePoly; |
28 | | |
29 | | namespace sdr::properties { |
30 | | class MeasureProperties; |
31 | | } |
32 | | |
33 | | class SdrMeasureObjGeoData final : public SdrTextObjGeoData |
34 | | { |
35 | | public: |
36 | | Point aPt1; |
37 | | Point aPt2; |
38 | | |
39 | | public: |
40 | | SdrMeasureObjGeoData(); |
41 | | virtual ~SdrMeasureObjGeoData() override; |
42 | | }; |
43 | | |
44 | | class SVXCORE_DLLPUBLIC SdrMeasureObj final : public SdrTextObj |
45 | | { |
46 | | private: |
47 | | // to allow sdr::properties::MeasureProperties access to SetTextDirty() |
48 | | friend class sdr::properties::MeasureProperties; |
49 | | friend class SdrMeasureField; |
50 | | |
51 | | SAL_DLLPRIVATE virtual std::unique_ptr<sdr::contact::ViewContact> CreateObjectSpecificViewContact() override; |
52 | | SAL_DLLPRIVATE virtual std::unique_ptr<sdr::properties::BaseProperties> CreateObjectSpecificProperties() override; |
53 | | |
54 | | Point m_aPt1; |
55 | | Point m_aPt2; |
56 | | bool m_bTextDirty; |
57 | | |
58 | | SAL_DLLPRIVATE void ImpTakeAttr(ImpMeasureRec& rRec) const; |
59 | | SAL_DLLPRIVATE OUString TakeRepresentation(SdrMeasureFieldKind eMeasureFieldKind) const; |
60 | | SAL_DLLPRIVATE void ImpCalcGeometrics(const ImpMeasureRec& rRec, ImpMeasurePoly& rPol) const; |
61 | | SAL_DLLPRIVATE static basegfx::B2DPolyPolygon ImpCalcXPoly(const ImpMeasurePoly& rPol); |
62 | | SAL_DLLPRIVATE void ImpEvalDrag(ImpMeasureRec& rRec, const SdrDragStat& rDrag) const; |
63 | | void SetTextDirty() |
64 | 0 | { |
65 | 0 | m_bTextDirty=true; |
66 | 0 | SetTextSizeDirty(); |
67 | 0 | if (!getOutRectangle().IsEmpty()) |
68 | 0 | { |
69 | 0 | SetBoundRectDirty(); |
70 | 0 | SetBoundAndSnapRectsDirty(/*bNotMyself*/true); |
71 | 0 | } |
72 | 0 | } |
73 | | SAL_DLLPRIVATE void UndirtyText() const; |
74 | | |
75 | | SAL_DLLPRIVATE virtual std::unique_ptr<SdrObjGeoData> NewGeoData() const override; |
76 | | SAL_DLLPRIVATE virtual void SaveGeoData(SdrObjGeoData& rGeo) const override; |
77 | | SAL_DLLPRIVATE virtual void RestoreGeoData(const SdrObjGeoData& rGeo) override; |
78 | | |
79 | | public: |
80 | | SAL_DLLPRIVATE SdrMeasureObj(SdrModel& rSdrModel); |
81 | | // Copy constructor |
82 | | SAL_DLLPRIVATE SdrMeasureObj(SdrModel& rSdrModel, SdrMeasureObj const & rSource); |
83 | | SdrMeasureObj( |
84 | | SdrModel& rSdrModel, |
85 | | const Point& rPt1, |
86 | | const Point& rPt2); |
87 | | SAL_DLLPRIVATE virtual ~SdrMeasureObj() override; |
88 | | |
89 | | SAL_DLLPRIVATE virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const override; |
90 | | SAL_DLLPRIVATE virtual SdrObjKind GetObjIdentifier() const override; |
91 | | virtual void TakeUnrotatedSnapRect(tools::Rectangle& rRect) const override; |
92 | | SAL_DLLPRIVATE virtual rtl::Reference<SdrObject> CloneSdrObject(SdrModel& rTargetModel) const override; |
93 | | |
94 | | SAL_DLLPRIVATE virtual OUString TakeObjNameSingul() const override; |
95 | | SAL_DLLPRIVATE virtual OUString TakeObjNamePlural() const override; |
96 | | |
97 | | SAL_DLLPRIVATE virtual basegfx::B2DPolyPolygon TakeXorPoly() const override; |
98 | | SAL_DLLPRIVATE virtual sal_uInt32 GetHdlCount() const override; |
99 | | SAL_DLLPRIVATE virtual void AddToHdlList(SdrHdlList& rHdlList) const override; |
100 | | |
101 | | // special drag methods |
102 | | SAL_DLLPRIVATE virtual bool hasSpecialDrag() const override; |
103 | | SAL_DLLPRIVATE virtual bool beginSpecialDrag(SdrDragStat& rDrag) const override; |
104 | | SAL_DLLPRIVATE virtual bool applySpecialDrag(SdrDragStat& rDrag) override; |
105 | | SAL_DLLPRIVATE virtual OUString getSpecialDragComment(const SdrDragStat& rDrag) const override; |
106 | | |
107 | | SAL_DLLPRIVATE virtual bool BegCreate(SdrDragStat& rStat) override; |
108 | | SAL_DLLPRIVATE virtual bool MovCreate(SdrDragStat& rStat) override; |
109 | | SAL_DLLPRIVATE virtual bool EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd) override; |
110 | | SAL_DLLPRIVATE virtual bool BckCreate(SdrDragStat& rStat) override; |
111 | | SAL_DLLPRIVATE virtual void BrkCreate(SdrDragStat& rStat) override; |
112 | | SAL_DLLPRIVATE virtual basegfx::B2DPolyPolygon TakeCreatePoly(const SdrDragStat& rDrag) const override; |
113 | | SAL_DLLPRIVATE virtual PointerStyle GetCreatePointer() const override; |
114 | | |
115 | | SAL_DLLPRIVATE virtual void NbcMove(const Size& rSiz) override; |
116 | | SAL_DLLPRIVATE virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) override; |
117 | | SAL_DLLPRIVATE virtual void NbcRotate(const Point& rRef, Degree100 nAngle, double sn, double cs) override; |
118 | | SAL_DLLPRIVATE virtual void NbcMirror(const Point& rRef1, const Point& rRef2) override; |
119 | | SAL_DLLPRIVATE virtual void NbcShear(const Point& rRef, Degree100 nAngle, double tn, bool bVShear) override; |
120 | | SAL_DLLPRIVATE virtual Degree100 GetRotateAngle() const override; |
121 | | SAL_DLLPRIVATE virtual void RecalcSnapRect() override; |
122 | | |
123 | | SAL_DLLPRIVATE virtual sal_uInt32 GetSnapPointCount() const override; |
124 | | SAL_DLLPRIVATE virtual Point GetSnapPoint(sal_uInt32 i) const override; |
125 | | |
126 | | SAL_DLLPRIVATE virtual bool IsPolyObj() const override; |
127 | | SAL_DLLPRIVATE virtual sal_uInt32 GetPointCount() const override; |
128 | | virtual Point GetPoint(sal_uInt32 i) const override; |
129 | | SAL_DLLPRIVATE virtual void NbcSetPoint(const Point& rPnt, sal_uInt32 i) override; |
130 | | |
131 | | SAL_DLLPRIVATE virtual rtl::Reference<SdrObject> DoConvertToPolyObj(bool bBezier, bool bAddText) const override; |
132 | | |
133 | | SAL_DLLPRIVATE virtual bool BegTextEdit(SdrOutliner& rOutl) override; |
134 | | SAL_DLLPRIVATE virtual const Size& GetTextSize() const override; |
135 | | SAL_DLLPRIVATE virtual void TakeTextRect( SdrOutliner& rOutliner, tools::Rectangle& rTextRect, bool bNoEditText, |
136 | | tools::Rectangle* pAnchorRect, bool bLineWidth = true ) const override; |
137 | | SAL_DLLPRIVATE virtual void TakeTextAnchorRect(tools::Rectangle& rAnchorRect) const override; |
138 | | SAL_DLLPRIVATE virtual void TakeTextEditArea(Size* pPaperMin, Size* pPaperMax, tools::Rectangle* pViewInit, tools::Rectangle* pViewMin) const override; |
139 | | SAL_DLLPRIVATE virtual EEAnchorMode GetOutlinerViewAnchorMode() const override; |
140 | | SAL_DLLPRIVATE virtual void NbcSetOutlinerParaObject(std::optional<OutlinerParaObject> pTextObject, bool bAdjustTextFrameWidthAndHeight = true) override; |
141 | | SAL_DLLPRIVATE virtual OutlinerParaObject* GetOutlinerParaObject() const override; |
142 | | |
143 | | SAL_DLLPRIVATE virtual bool CalcFieldValue(const SvxFieldItem& rField, sal_Int32 nPara, sal_uInt16 nPos, |
144 | | bool bEdit, std::optional<Color>& rpTxtColor, std::optional<Color>& rpFldColor, std::optional<FontLineStyle>& rpFldLineStyle, OUString& rRet) const override; |
145 | | |
146 | | // #i97878# |
147 | | SAL_DLLPRIVATE virtual bool TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, basegfx::B2DPolyPolygon& rPolyPolygon) const override; |
148 | | SAL_DLLPRIVATE virtual void TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const basegfx::B2DPolyPolygon& rPolyPolygon) override; |
149 | | }; |
150 | | |
151 | | // Creating: |
152 | | // ~~~~~~~~~ |
153 | | // dragging reference point 1 to reference point 2 -> reference edge |
154 | | // |
155 | | // Defaults: |
156 | | // ~~~~~~~~~~~~~ |
157 | | // dimension line and auxiliary dimension lines: solid black hairlines |
158 | | // arrows : 2mm x 4mm |
159 | | // text size |
160 | | // ___ |
161 | | // | dimension | 2mm |
162 | | // |<--------------------->|--- |
163 | | // | | 8mm |
164 | | // | | |
165 | | // Pt1============# Pt2-- <----reference edge (from Pt1 to Pt2) |
166 | | // # # |___ <-excess length of the auxiliary dimension line(s) |
167 | | // # #=========# |
168 | | // # objected to be dimensioned # |
169 | | // #=======================# |
170 | | // |
171 | | // Attributes: |
172 | | // ~~~~~~~~~~ |
173 | | // 1. Where is the text: middle, right or left (default=automatic) |
174 | | // 2. Text above or below the line or line broken by text (default=automatic) |
175 | | // Default=8mm |
176 | | // 3. The distance from the dimension line to the reference edge (= to the dimensioned object) |
177 | | // 4. dimension line below the reference edge (default=no)) |
178 | | // 5. excess length of the auxiliary dimension lines beyond the reference edge (2x, default=0) |
179 | | // 6. excess length of the auxiliary dimension lines past the dimension line (default=2mm) |
180 | | // 7. distance between the auxiliary dimension line and the reference edge |
181 | | // |
182 | | // Dragging: Handle Shift |
183 | | // ~~~~~~~~~ |
184 | | // - reference points SolidQuadHdl only the length |
185 | | // 1.+2. Seizing the text |
186 | | // 3.+4. Hdl on arrow (2x) SolidQuadHdl only the Bool |
187 | | // 5. Hdl one end point CircHdl both lengths ? |
188 | | // 6.+7. no dragging |
189 | | // |
190 | | // Open: |
191 | | // ~~~~~~ |
192 | | // - radiuses (anchor as type immediately) |
193 | | // |
194 | | // Special: |
195 | | // ~~~~~~~~ |
196 | | // Connecting to a maximum of two objects |
197 | | // -> during Copy, etc. use the respective code of the connectors?!? |
198 | | // this probably will be pretty complicated ... |
199 | | |
200 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |