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