Version 5.4.3.2, tag libreoffice-5.4.3.2
[LibreOffice.git] / include / svx / svdomeas.hxx
blobbe2ce849890b5de591c6a4720f571cd8b10340d5
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 .
20 #ifndef INCLUDED_SVX_SVDOMEAS_HXX
21 #define INCLUDED_SVX_SVDOMEAS_HXX
23 #include <svx/svdotext.hxx>
24 #include <svx/svxdllapi.h>
25 #include <editeng/measfld.hxx>
28 // Initial Declarations
31 class SdrOutliner;
32 struct ImpMeasureRec;
33 struct ImpMeasurePoly;
35 namespace sdr { namespace properties {
36 class MeasureProperties;
40 // Auxiliary Class SdrMeasureObjGeoData
43 class SdrMeasureObjGeoData : public SdrTextObjGeoData
45 public:
46 Point aPt1;
47 Point aPt2;
49 public:
50 SdrMeasureObjGeoData();
51 virtual ~SdrMeasureObjGeoData() override;
55 // SdrMeasureObj
58 class SVX_DLLPUBLIC SdrMeasureObj : public SdrTextObj
60 private:
61 // to allow sdr::properties::MeasureProperties access to SetTextDirty()
62 friend class sdr::properties::MeasureProperties;
64 friend class SdrMeasureField;
66 protected:
67 virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact() override;
68 virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties() override;
70 Point aPt1;
71 Point aPt2;
72 bool bTextDirty;
74 protected:
75 void ImpTakeAttr(ImpMeasureRec& rRec) const;
76 OUString TakeRepresentation(SdrMeasureFieldKind eMeasureFieldKind) const;
77 void ImpCalcGeometrics(const ImpMeasureRec& rRec, ImpMeasurePoly& rPol) const;
78 static basegfx::B2DPolyPolygon ImpCalcXPoly(const ImpMeasurePoly& rPol);
79 void ImpEvalDrag(ImpMeasureRec& rRec, const SdrDragStat& rDrag) const;
80 void SetTextDirty() { bTextDirty=true; SetTextSizeDirty(); if (!aOutRect.IsEmpty()) { SetBoundRectDirty(); SetRectsDirty(true); } }
81 void UndirtyText() const;
83 virtual SdrObjGeoData* NewGeoData() const override;
84 virtual void SaveGeoData(SdrObjGeoData& rGeo) const override;
85 virtual void RestGeoData(const SdrObjGeoData& rGeo) override;
87 public:
88 SdrMeasureObj();
89 SdrMeasureObj(const Point& rPt1, const Point& rPt2);
90 virtual ~SdrMeasureObj() override;
92 virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const override;
93 virtual sal_uInt16 GetObjIdentifier() const override;
94 virtual void TakeUnrotatedSnapRect(tools::Rectangle& rRect) const override;
95 virtual SdrMeasureObj* Clone() const override;
97 virtual OUString TakeObjNameSingul() const override;
98 virtual OUString TakeObjNamePlural() const override;
100 virtual basegfx::B2DPolyPolygon TakeXorPoly() const override;
101 virtual sal_uInt32 GetHdlCount() const override;
102 virtual SdrHdl* GetHdl(sal_uInt32 nHdlNum) const override;
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;
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 Pointer GetCreatePointer() const override;
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, long nAngle, double sn, double cs) override;
121 virtual void NbcMirror(const Point& rRef1, const Point& rRef2) override;
122 virtual void NbcShear(const Point& rRef, long nAngle, double tn, bool bVShear) override;
123 virtual long GetRotateAngle() const override;
124 virtual void RecalcSnapRect() override;
126 virtual sal_uInt32 GetSnapPointCount() const override;
127 virtual Point GetSnapPoint(sal_uInt32 i) const override;
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;
134 virtual SdrObject* DoConvertToPolyObj(bool bBezier, bool bAddText) const override;
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(OutlinerParaObject* pTextObject) override;
144 virtual OutlinerParaObject* GetOutlinerParaObject() const override;
146 virtual bool CalcFieldValue(const SvxFieldItem& rField, sal_Int32 nPara, sal_uInt16 nPos,
147 bool bEdit, Color*& rpTxtColor, Color*& rpFldColor, OUString& rRet) const override;
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;
154 // Creating:
155 // ~~~~~~~~~
156 // dragging reference point 1 to reference point 2 -> reference edge
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 // #=======================#
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
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
193 // Open:
194 // ~~~~~~
195 // - radiuses (anchor as type immediately)
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 ...
203 #endif // INCLUDED_SVX_SVDOMEAS_HXX
205 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */