Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef _SVDOMEAS_HXX
30 : : #define _SVDOMEAS_HXX
31 : :
32 : : #include <svx/svdotext.hxx>
33 : : #include "svx/svxdllapi.h"
34 : : #include <editeng/measfld.hxx>
35 : :
36 : : //************************************************************
37 : : // Vorausdeklarationen
38 : : //************************************************************
39 : :
40 : : class SdrOutliner;
41 : : struct ImpMeasureRec;
42 : : struct ImpMeasurePoly;
43 : :
44 : : namespace sdr { namespace properties {
45 : : class MeasureProperties;
46 : : }}
47 : :
48 : : //************************************************************
49 : : // Hilfsklasse SdrMeasureObjGeoData
50 : : //************************************************************
51 : :
52 : : class SdrMeasureObjGeoData : public SdrTextObjGeoData
53 : : {
54 : : public:
55 : : Point aPt1;
56 : : Point aPt2;
57 : :
58 : : public:
59 : : SdrMeasureObjGeoData();
60 : : virtual ~SdrMeasureObjGeoData();
61 : : };
62 : :
63 : : //************************************************************
64 : : // SdrMeasureObj
65 : : //************************************************************
66 : :
67 : 0 : class SVX_DLLPUBLIC SdrMeasureObj : public SdrTextObj
68 : : {
69 : : private:
70 : : // to allow sdr::properties::MeasureProperties access to SetTextDirty()
71 : : friend class sdr::properties::MeasureProperties;
72 : :
73 : : friend class SdrMeasureField;
74 : :
75 : : protected:
76 : : virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact();
77 : : virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties();
78 : :
79 : : Point aPt1;
80 : : Point aPt2;
81 : : bool bTextDirty;
82 : :
83 : : protected:
84 : : void ImpTakeAttr(ImpMeasureRec& rRec) const;
85 : : void TakeRepresentation( XubString& rStr, SdrMeasureFieldKind eMeasureFieldKind ) const;
86 : : void ImpCalcGeometrics(const ImpMeasureRec& rRec, ImpMeasurePoly& rPol) const;
87 : : basegfx::B2DPolyPolygon ImpCalcXPoly(const ImpMeasurePoly& rPol) const;
88 : : void ImpEvalDrag(ImpMeasureRec& rRec, const SdrDragStat& rDrag) const;
89 [ # # ]: 0 : void SetTextDirty() { bTextDirty=sal_True; SetTextSizeDirty(); if (!aOutRect.IsEmpty()) { SetBoundRectDirty(); SetRectsDirty(sal_True); } }
90 : : void UndirtyText() const;
91 : :
92 : : virtual SdrObjGeoData* NewGeoData() const;
93 : : virtual void SaveGeoData(SdrObjGeoData& rGeo) const;
94 : : virtual void RestGeoData(const SdrObjGeoData& rGeo);
95 : :
96 : : public:
97 : : TYPEINFO();
98 : : SdrMeasureObj();
99 : : SdrMeasureObj(const Point& rPt1, const Point& rPt2);
100 : : virtual ~SdrMeasureObj();
101 : :
102 : : virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const;
103 : : virtual sal_uInt16 GetObjIdentifier() const;
104 : : virtual void TakeUnrotatedSnapRect(Rectangle& rRect) const;
105 : : virtual SdrMeasureObj* Clone() const;
106 : :
107 : : virtual void TakeObjNameSingul(String& rName) const;
108 : : virtual void TakeObjNamePlural(String& rName) const;
109 : :
110 : : virtual basegfx::B2DPolyPolygon TakeXorPoly() const;
111 : : virtual sal_uInt32 GetHdlCount() const;
112 : : virtual SdrHdl* GetHdl(sal_uInt32 nHdlNum) const;
113 : :
114 : : // special drag methods
115 : : virtual bool hasSpecialDrag() const;
116 : : virtual bool beginSpecialDrag(SdrDragStat& rDrag) const;
117 : : virtual bool applySpecialDrag(SdrDragStat& rDrag);
118 : : virtual String getSpecialDragComment(const SdrDragStat& rDrag) const;
119 : :
120 : : virtual bool BegCreate(SdrDragStat& rStat);
121 : : virtual bool MovCreate(SdrDragStat& rStat);
122 : : virtual bool EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd);
123 : : virtual bool BckCreate(SdrDragStat& rStat);
124 : : virtual void BrkCreate(SdrDragStat& rStat);
125 : : virtual basegfx::B2DPolyPolygon TakeCreatePoly(const SdrDragStat& rDrag) const;
126 : : virtual Pointer GetCreatePointer() const;
127 : :
128 : : virtual void NbcMove(const Size& rSiz);
129 : : virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact);
130 : : virtual void NbcRotate(const Point& rRef, long nWink, double sn, double cs);
131 : : virtual void NbcMirror(const Point& rRef1, const Point& rRef2);
132 : : virtual void NbcShear(const Point& rRef, long nWink, double tn, bool bVShear);
133 : : virtual long GetRotateAngle() const;
134 : : virtual void RecalcSnapRect();
135 : :
136 : : virtual sal_uInt32 GetSnapPointCount() const;
137 : : virtual Point GetSnapPoint(sal_uInt32 i) const;
138 : :
139 : : virtual sal_Bool IsPolyObj() const;
140 : : virtual sal_uInt32 GetPointCount() const;
141 : : virtual Point GetPoint(sal_uInt32 i) const;
142 : : virtual void NbcSetPoint(const Point& rPnt, sal_uInt32 i);
143 : :
144 : : virtual SdrObject* DoConvertToPolyObj(sal_Bool bBezier) const;
145 : :
146 : : virtual sal_Bool BegTextEdit(SdrOutliner& rOutl);
147 : : virtual const Size& GetTextSize() const;
148 : : virtual void TakeTextRect( SdrOutliner& rOutliner, Rectangle& rTextRect, bool bNoEditText = false,
149 : : Rectangle* pAnchorRect=NULL, bool bLineWidth = true ) const;
150 : : virtual void TakeTextAnchorRect(Rectangle& rAnchorRect) const;
151 : : virtual void TakeTextEditArea(Size* pPaperMin, Size* pPaperMax, Rectangle* pViewInit, Rectangle* pViewMin) const;
152 : : virtual sal_uInt16 GetOutlinerViewAnchorMode() const;
153 : : virtual void NbcSetOutlinerParaObject(OutlinerParaObject* pTextObject);
154 : : virtual OutlinerParaObject* GetOutlinerParaObject() const;
155 : :
156 : : virtual bool CalcFieldValue(const SvxFieldItem& rField, sal_uInt16 nPara, sal_uInt16 nPos,
157 : : bool bEdit, Color*& rpTxtColor, Color*& rpFldColor, String& rRet) const;
158 : :
159 : : // #i97878#
160 : : virtual sal_Bool TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, basegfx::B2DPolyPolygon& rPolyPolygon) const;
161 : : virtual void TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const basegfx::B2DPolyPolygon& rPolyPolygon);
162 : : };
163 : :
164 : : /////////////////////////////////////////////////////////////////////////////////////////////////
165 : : //
166 : : // Creating:
167 : : // ~~~~~~~~~
168 : : // Dragging von Bezugspunkt 1 zu Bezugspunkt 2 -> Bezugskante
169 : : //
170 : : // Die Defaults:
171 : : // ~~~~~~~~~~~~~
172 : : // Masslinie und Masshilfslinien: Haarlinien solid schwarz
173 : : // Pfeile: 2mm x 4mm
174 : : // Textgroesse
175 : : // ___
176 : : // | Masszahl | 2mm
177 : : // |<--------------------->|---
178 : : // | | 8mm
179 : : // | |
180 : : // Pt1============# Pt2-- <----Bezugskante (von Pt1 nach Pt2)
181 : : // # # |___ <- Ueberstand der Masshilfslinie(n)
182 : : // # #=========#
183 : : // # Zu bemassendes Objekt #
184 : : // #=======================#
185 : : //
186 : : // Attribute:
187 : : // ~~~~~~~~~~
188 : : // 1. Wo steht der Text: mitte, rechts oder links (def=automatik)
189 : : // 2. Text oberhalb der Linie oder unterhalb oder Linie unterbrochen durch Text (def=automatik)
190 : : // 3. Den Abstand der Masslinie zur Bezugskante (=zum bemassten Objekt).
191 : : // Default=8mm
192 : : // 4. Masslinie unterhalb der Bezugskante (default=nein)
193 : : // 5. Die Ueberlaenge(n) der Masshilfslinien ueber die Bezugskante (2x, default=0)
194 : : // 6. Den Ueberhang der Masshilfslinien ueber die Masslinie (default=2mm)
195 : : // 7. Den Abstand der Masshilfslinien zur Bezugskante
196 : : //
197 : : // Dragging: Handle Shift
198 : : // ~~~~~~~~~
199 : : // - Die Bezugspunkte SolidQuadHdl nur die Laenge
200 : : // 1.+2. Anpacken des Textes
201 : : // 3.+4. Hdl am Pfeil (2x) SolidQuadHdl nur den Bool
202 : : // 5. Hdl am Endpunkt CircHdl beide Laengen?
203 : : // 6.+7. Kein Dragging
204 : : //
205 : : // Offen:
206 : : // ~~~~~~
207 : : // - Radien (gleich als Typ verankern
208 : : //
209 : : // Special:
210 : : // ~~~~~~~~
211 : : // Connecting an max. 2 Objekte
212 : : // -> Bei Copy, etc. den entspr. Code der Verbinder verwenden?!?
213 : : // wird wohl recht kompliziert werden ...
214 : : //
215 : : /////////////////////////////////////////////////////////////////////////////////////////////////
216 : :
217 : : #endif //_SVDOMEAS_HXX
218 : :
219 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|