1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
22 #include <svx/svdotext.hxx>
23 #include <svx/svxdllapi.h>
24 #include <editeng/measfld.hxx>
28 struct ImpMeasurePoly
;
30 namespace sdr::properties
{
31 class MeasureProperties
;
34 class SdrMeasureObjGeoData final
: public SdrTextObjGeoData
41 SdrMeasureObjGeoData();
42 virtual ~SdrMeasureObjGeoData() override
;
45 class SVXCORE_DLLPUBLIC SdrMeasureObj final
: public SdrTextObj
48 // to allow sdr::properties::MeasureProperties access to SetTextDirty()
49 friend class sdr::properties::MeasureProperties
;
50 friend class SdrMeasureField
;
52 SAL_DLLPRIVATE
virtual std::unique_ptr
<sdr::contact::ViewContact
> CreateObjectSpecificViewContact() override
;
53 SAL_DLLPRIVATE
virtual std::unique_ptr
<sdr::properties::BaseProperties
> CreateObjectSpecificProperties() override
;
59 SAL_DLLPRIVATE
void ImpTakeAttr(ImpMeasureRec
& rRec
) const;
60 SAL_DLLPRIVATE OUString
TakeRepresentation(SdrMeasureFieldKind eMeasureFieldKind
) const;
61 SAL_DLLPRIVATE
void ImpCalcGeometrics(const ImpMeasureRec
& rRec
, ImpMeasurePoly
& rPol
) const;
62 SAL_DLLPRIVATE
static basegfx::B2DPolyPolygon
ImpCalcXPoly(const ImpMeasurePoly
& rPol
);
63 SAL_DLLPRIVATE
void ImpEvalDrag(ImpMeasureRec
& rRec
, const SdrDragStat
& rDrag
) const;
68 if (!getOutRectangle().IsEmpty())
71 SetBoundAndSnapRectsDirty(/*bNotMyself*/true);
74 SAL_DLLPRIVATE
void UndirtyText() const;
76 SAL_DLLPRIVATE
virtual std::unique_ptr
<SdrObjGeoData
> NewGeoData() const override
;
77 SAL_DLLPRIVATE
virtual void SaveGeoData(SdrObjGeoData
& rGeo
) const override
;
78 SAL_DLLPRIVATE
virtual void RestoreGeoData(const SdrObjGeoData
& rGeo
) override
;
81 SAL_DLLPRIVATE
SdrMeasureObj(SdrModel
& rSdrModel
);
83 SAL_DLLPRIVATE
SdrMeasureObj(SdrModel
& rSdrModel
, SdrMeasureObj
const & rSource
);
88 SAL_DLLPRIVATE
virtual ~SdrMeasureObj() override
;
90 SAL_DLLPRIVATE
virtual void TakeObjInfo(SdrObjTransformInfoRec
& rInfo
) const override
;
91 SAL_DLLPRIVATE
virtual SdrObjKind
GetObjIdentifier() const override
;
92 virtual void TakeUnrotatedSnapRect(tools::Rectangle
& rRect
) const override
;
93 SAL_DLLPRIVATE
virtual rtl::Reference
<SdrObject
> CloneSdrObject(SdrModel
& rTargetModel
) const override
;
95 SAL_DLLPRIVATE
virtual OUString
TakeObjNameSingul() const override
;
96 SAL_DLLPRIVATE
virtual OUString
TakeObjNamePlural() const override
;
98 SAL_DLLPRIVATE
virtual basegfx::B2DPolyPolygon
TakeXorPoly() const override
;
99 SAL_DLLPRIVATE
virtual sal_uInt32
GetHdlCount() const override
;
100 SAL_DLLPRIVATE
virtual void AddToHdlList(SdrHdlList
& rHdlList
) const override
;
102 // special drag methods
103 SAL_DLLPRIVATE
virtual bool hasSpecialDrag() const override
;
104 SAL_DLLPRIVATE
virtual bool beginSpecialDrag(SdrDragStat
& rDrag
) const override
;
105 SAL_DLLPRIVATE
virtual bool applySpecialDrag(SdrDragStat
& rDrag
) override
;
106 SAL_DLLPRIVATE
virtual OUString
getSpecialDragComment(const SdrDragStat
& rDrag
) const override
;
108 SAL_DLLPRIVATE
virtual bool BegCreate(SdrDragStat
& rStat
) override
;
109 SAL_DLLPRIVATE
virtual bool MovCreate(SdrDragStat
& rStat
) override
;
110 SAL_DLLPRIVATE
virtual bool EndCreate(SdrDragStat
& rStat
, SdrCreateCmd eCmd
) override
;
111 SAL_DLLPRIVATE
virtual bool BckCreate(SdrDragStat
& rStat
) override
;
112 SAL_DLLPRIVATE
virtual void BrkCreate(SdrDragStat
& rStat
) override
;
113 SAL_DLLPRIVATE
virtual basegfx::B2DPolyPolygon
TakeCreatePoly(const SdrDragStat
& rDrag
) const override
;
114 SAL_DLLPRIVATE
virtual PointerStyle
GetCreatePointer() const override
;
116 SAL_DLLPRIVATE
virtual void NbcMove(const Size
& rSiz
) override
;
117 SAL_DLLPRIVATE
virtual void NbcResize(const Point
& rRef
, const Fraction
& xFact
, const Fraction
& yFact
) override
;
118 SAL_DLLPRIVATE
virtual void NbcRotate(const Point
& rRef
, Degree100 nAngle
, double sn
, double cs
) override
;
119 SAL_DLLPRIVATE
virtual void NbcMirror(const Point
& rRef1
, const Point
& rRef2
) override
;
120 SAL_DLLPRIVATE
virtual void NbcShear(const Point
& rRef
, Degree100 nAngle
, double tn
, bool bVShear
) override
;
121 SAL_DLLPRIVATE
virtual Degree100
GetRotateAngle() const override
;
122 SAL_DLLPRIVATE
virtual void RecalcSnapRect() override
;
124 SAL_DLLPRIVATE
virtual sal_uInt32
GetSnapPointCount() const override
;
125 SAL_DLLPRIVATE
virtual Point
GetSnapPoint(sal_uInt32 i
) const override
;
127 SAL_DLLPRIVATE
virtual bool IsPolyObj() const override
;
128 SAL_DLLPRIVATE
virtual sal_uInt32
GetPointCount() const override
;
129 virtual Point
GetPoint(sal_uInt32 i
) const override
;
130 SAL_DLLPRIVATE
virtual void NbcSetPoint(const Point
& rPnt
, sal_uInt32 i
) override
;
132 SAL_DLLPRIVATE
virtual rtl::Reference
<SdrObject
> DoConvertToPolyObj(bool bBezier
, bool bAddText
) const override
;
134 SAL_DLLPRIVATE
virtual bool BegTextEdit(SdrOutliner
& rOutl
) override
;
135 SAL_DLLPRIVATE
virtual const Size
& GetTextSize() const override
;
136 SAL_DLLPRIVATE
virtual void TakeTextRect( SdrOutliner
& rOutliner
, tools::Rectangle
& rTextRect
, bool bNoEditText
,
137 tools::Rectangle
* pAnchorRect
, bool bLineWidth
= true ) const override
;
138 SAL_DLLPRIVATE
virtual void TakeTextAnchorRect(tools::Rectangle
& rAnchorRect
) const override
;
139 SAL_DLLPRIVATE
virtual void TakeTextEditArea(Size
* pPaperMin
, Size
* pPaperMax
, tools::Rectangle
* pViewInit
, tools::Rectangle
* pViewMin
) const override
;
140 SAL_DLLPRIVATE
virtual EEAnchorMode
GetOutlinerViewAnchorMode() const override
;
141 SAL_DLLPRIVATE
virtual void NbcSetOutlinerParaObject(std::optional
<OutlinerParaObject
> pTextObject
, bool bAdjustTextFrameWidthAndHeight
= true) override
;
142 SAL_DLLPRIVATE
virtual OutlinerParaObject
* GetOutlinerParaObject() const override
;
144 SAL_DLLPRIVATE
virtual bool CalcFieldValue(const SvxFieldItem
& rField
, sal_Int32 nPara
, sal_uInt16 nPos
,
145 bool bEdit
, std::optional
<Color
>& rpTxtColor
, std::optional
<Color
>& rpFldColor
, std::optional
<FontLineStyle
>& rpFldLineStyle
, OUString
& rRet
) const override
;
148 SAL_DLLPRIVATE
virtual bool TRGetBaseGeometry(basegfx::B2DHomMatrix
& rMatrix
, basegfx::B2DPolyPolygon
& rPolyPolygon
) const override
;
149 SAL_DLLPRIVATE
virtual void TRSetBaseGeometry(const basegfx::B2DHomMatrix
& rMatrix
, const basegfx::B2DPolyPolygon
& rPolyPolygon
) override
;
154 // dragging reference point 1 to reference point 2 -> reference edge
158 // dimension line and auxiliary dimension lines: solid black hairlines
159 // arrows : 2mm x 4mm
163 // |<--------------------->|---
166 // Pt1============# Pt2-- <----reference edge (from Pt1 to Pt2)
167 // # # |___ <-excess length of the auxiliary dimension line(s)
169 // # objected to be dimensioned #
170 // #=======================#
174 // 1. Where is the text: middle, right or left (default=automatic)
175 // 2. Text above or below the line or line broken by text (default=automatic)
177 // 3. The distance from the dimension line to the reference edge (= to the dimensioned object)
178 // 4. dimension line below the reference edge (default=no))
179 // 5. excess length of the auxiliary dimension lines beyond the reference edge (2x, default=0)
180 // 6. excess length of the auxiliary dimension lines past the dimension line (default=2mm)
181 // 7. distance between the auxiliary dimension line and the reference edge
183 // Dragging: Handle Shift
185 // - reference points SolidQuadHdl only the length
186 // 1.+2. Seizing the text
187 // 3.+4. Hdl on arrow (2x) SolidQuadHdl only the Bool
188 // 5. Hdl one end point CircHdl both lengths ?
193 // - radiuses (anchor as type immediately)
197 // Connecting to a maximum of two objects
198 // -> during Copy, etc. use the respective code of the connectors?!?
199 // this probably will be pretty complicated ...
201 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */