xref: /trunk/main/svx/inc/svx/svdomeas.hxx (revision 2cdd1ab0)
13334a7e6SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
33334a7e6SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
43334a7e6SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
53334a7e6SAndrew Rist  * distributed with this work for additional information
63334a7e6SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
73334a7e6SAndrew Rist  * to you under the Apache License, Version 2.0 (the
83334a7e6SAndrew Rist  * "License"); you may not use this file except in compliance
93334a7e6SAndrew Rist  * with the License.  You may obtain a copy of the License at
103334a7e6SAndrew Rist  *
113334a7e6SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
123334a7e6SAndrew Rist  *
133334a7e6SAndrew Rist  * Unless required by applicable law or agreed to in writing,
143334a7e6SAndrew Rist  * software distributed under the License is distributed on an
153334a7e6SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
163334a7e6SAndrew Rist  * KIND, either express or implied.  See the License for the
173334a7e6SAndrew Rist  * specific language governing permissions and limitations
183334a7e6SAndrew Rist  * under the License.
193334a7e6SAndrew Rist  *
203334a7e6SAndrew Rist  *************************************************************/
213334a7e6SAndrew Rist 
223334a7e6SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _SVDOMEAS_HXX
25cdf0e10cSrcweir #define _SVDOMEAS_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <svx/svdotext.hxx>
28cdf0e10cSrcweir #include "svx/svxdllapi.h"
29cdf0e10cSrcweir #include <editeng/measfld.hxx>
30cdf0e10cSrcweir 
31cdf0e10cSrcweir //************************************************************
32cdf0e10cSrcweir //   Vorausdeklarationen
33cdf0e10cSrcweir //************************************************************
34cdf0e10cSrcweir 
35cdf0e10cSrcweir class SdrOutliner;
36cdf0e10cSrcweir struct ImpMeasureRec;
37cdf0e10cSrcweir struct ImpMeasurePoly;
38cdf0e10cSrcweir 
39cdf0e10cSrcweir namespace sdr {	namespace properties {
40cdf0e10cSrcweir 	class MeasureProperties;
41cdf0e10cSrcweir }}
42cdf0e10cSrcweir 
43cdf0e10cSrcweir //************************************************************
44cdf0e10cSrcweir //   Hilfsklasse SdrMeasureObjGeoData
45cdf0e10cSrcweir //************************************************************
46cdf0e10cSrcweir 
47cdf0e10cSrcweir class SdrMeasureObjGeoData : public SdrTextObjGeoData
48cdf0e10cSrcweir {
49cdf0e10cSrcweir public:
50cdf0e10cSrcweir 	Point						aPt1;
51cdf0e10cSrcweir 	Point						aPt2;
52cdf0e10cSrcweir 
53cdf0e10cSrcweir public:
54cdf0e10cSrcweir 	SdrMeasureObjGeoData();
55cdf0e10cSrcweir 	virtual ~SdrMeasureObjGeoData();
56cdf0e10cSrcweir };
57cdf0e10cSrcweir 
58cdf0e10cSrcweir //************************************************************
59cdf0e10cSrcweir //   SdrMeasureObj
60cdf0e10cSrcweir //************************************************************
61cdf0e10cSrcweir 
62cdf0e10cSrcweir class SVX_DLLPUBLIC SdrMeasureObj : public SdrTextObj
63cdf0e10cSrcweir {
64cdf0e10cSrcweir private:
65cdf0e10cSrcweir 	// to allow sdr::properties::MeasureProperties access to SetTextDirty()
66cdf0e10cSrcweir 	friend class sdr::properties::MeasureProperties;
67cdf0e10cSrcweir 
68cdf0e10cSrcweir 	friend class				SdrMeasureField;
69cdf0e10cSrcweir 
70cdf0e10cSrcweir protected:
71cdf0e10cSrcweir 	virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact();
72cdf0e10cSrcweir 	virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties();
73cdf0e10cSrcweir 
74cdf0e10cSrcweir     Point						aPt1;
75cdf0e10cSrcweir 	Point						aPt2;
76cdf0e10cSrcweir 	FASTBOOL					bTextDirty;
77cdf0e10cSrcweir 
78cdf0e10cSrcweir protected:
79cdf0e10cSrcweir 	void ImpTakeAttr(ImpMeasureRec& rRec) const;
80cdf0e10cSrcweir 	void TakeRepresentation( XubString& rStr, SdrMeasureFieldKind eMeasureFieldKind ) const;
81cdf0e10cSrcweir 	void ImpCalcGeometrics(const ImpMeasureRec& rRec, ImpMeasurePoly& rPol) const;
82cdf0e10cSrcweir 	basegfx::B2DPolyPolygon ImpCalcXPoly(const ImpMeasurePoly& rPol) const;
83cdf0e10cSrcweir 	void ImpEvalDrag(ImpMeasureRec& rRec, const SdrDragStat& rDrag) const;
SetTextDirty()84cdf0e10cSrcweir 	void SetTextDirty() { bTextDirty=sal_True; SetTextSizeDirty(); if (!aOutRect.IsEmpty()) { SetBoundRectDirty(); SetRectsDirty(sal_True); } }
85cdf0e10cSrcweir 	void UndirtyText() const;
86cdf0e10cSrcweir 
87cdf0e10cSrcweir 	virtual SdrObjGeoData* NewGeoData() const;
88cdf0e10cSrcweir 	virtual void SaveGeoData(SdrObjGeoData& rGeo) const;
89cdf0e10cSrcweir 	virtual void RestGeoData(const SdrObjGeoData& rGeo);
90cdf0e10cSrcweir 
91cdf0e10cSrcweir public:
92cdf0e10cSrcweir 	TYPEINFO();
93cdf0e10cSrcweir 	SdrMeasureObj();
94cdf0e10cSrcweir 	SdrMeasureObj(const Point& rPt1, const Point& rPt2);
95cdf0e10cSrcweir 	virtual ~SdrMeasureObj();
96cdf0e10cSrcweir 
97cdf0e10cSrcweir 	virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const;
98cdf0e10cSrcweir 	virtual sal_uInt16 GetObjIdentifier() const;
99cdf0e10cSrcweir 	virtual void TakeUnrotatedSnapRect(Rectangle& rRect) const;
100cdf0e10cSrcweir 	virtual void operator=(const SdrObject& rObj);
101cdf0e10cSrcweir 
102cdf0e10cSrcweir 	virtual void TakeObjNameSingul(String& rName) const;
103cdf0e10cSrcweir 	virtual void TakeObjNamePlural(String& rName) const;
104cdf0e10cSrcweir 
105cdf0e10cSrcweir 	virtual basegfx::B2DPolyPolygon TakeXorPoly() const;
106cdf0e10cSrcweir 	virtual sal_uInt32 GetHdlCount() const;
107cdf0e10cSrcweir 	virtual SdrHdl* GetHdl(sal_uInt32 nHdlNum) const;
108cdf0e10cSrcweir 
109cdf0e10cSrcweir     // special drag methods
110cdf0e10cSrcweir     virtual bool hasSpecialDrag() const;
111cdf0e10cSrcweir 	virtual bool beginSpecialDrag(SdrDragStat& rDrag) const;
112cdf0e10cSrcweir 	virtual bool applySpecialDrag(SdrDragStat& rDrag);
113cdf0e10cSrcweir 	virtual String getSpecialDragComment(const SdrDragStat& rDrag) const;
114cdf0e10cSrcweir 
115cdf0e10cSrcweir 	virtual FASTBOOL BegCreate(SdrDragStat& rStat);
116cdf0e10cSrcweir 	virtual FASTBOOL MovCreate(SdrDragStat& rStat);
117cdf0e10cSrcweir 	virtual FASTBOOL EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd);
118cdf0e10cSrcweir 	virtual FASTBOOL BckCreate(SdrDragStat& rStat);
119cdf0e10cSrcweir 	virtual void BrkCreate(SdrDragStat& rStat);
120cdf0e10cSrcweir 	virtual basegfx::B2DPolyPolygon TakeCreatePoly(const SdrDragStat& rDrag) const;
121cdf0e10cSrcweir 	virtual Pointer GetCreatePointer() const;
122cdf0e10cSrcweir 
123cdf0e10cSrcweir 	virtual void NbcMove(const Size& rSiz);
124cdf0e10cSrcweir 	virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact);
125cdf0e10cSrcweir 	virtual void NbcRotate(const Point& rRef, long nWink, double sn, double cs);
126cdf0e10cSrcweir 	virtual void NbcMirror(const Point& rRef1, const Point& rRef2);
127cdf0e10cSrcweir 	virtual void NbcShear(const Point& rRef, long nWink, double tn, FASTBOOL bVShear);
128cdf0e10cSrcweir 	virtual long GetRotateAngle() const;
129cdf0e10cSrcweir 	virtual void RecalcSnapRect();
130cdf0e10cSrcweir 
131cdf0e10cSrcweir 	virtual sal_uInt32 GetSnapPointCount() const;
132cdf0e10cSrcweir 	virtual Point GetSnapPoint(sal_uInt32 i) const;
133cdf0e10cSrcweir 
134cdf0e10cSrcweir 	virtual sal_Bool IsPolyObj() const;
135cdf0e10cSrcweir 	virtual sal_uInt32 GetPointCount() const;
136cdf0e10cSrcweir 	virtual Point GetPoint(sal_uInt32 i) const;
137cdf0e10cSrcweir 	virtual void NbcSetPoint(const Point& rPnt, sal_uInt32 i);
138cdf0e10cSrcweir 
139a5258243SPedro Giffuni 	virtual SdrObject* DoConvertToPolyObj(sal_Bool bBezier, bool bAddText) const;
140cdf0e10cSrcweir 
141cdf0e10cSrcweir 	virtual sal_Bool BegTextEdit(SdrOutliner& rOutl);
142cdf0e10cSrcweir 	virtual const Size& GetTextSize() const;
143cdf0e10cSrcweir 	virtual void TakeTextRect( SdrOutliner& rOutliner, Rectangle& rTextRect, FASTBOOL bNoEditText=sal_False,
144cdf0e10cSrcweir 		Rectangle* pAnchorRect=NULL, sal_Bool bLineWidth=sal_True ) const;
145cdf0e10cSrcweir 	virtual void TakeTextAnchorRect(Rectangle& rAnchorRect) const;
146cdf0e10cSrcweir 	virtual void TakeTextEditArea(Size* pPaperMin, Size* pPaperMax, Rectangle* pViewInit, Rectangle* pViewMin) const;
147cdf0e10cSrcweir 	virtual sal_uInt16 GetOutlinerViewAnchorMode() const;
148cdf0e10cSrcweir 	virtual void NbcSetOutlinerParaObject(OutlinerParaObject* pTextObject);
149cdf0e10cSrcweir 	virtual OutlinerParaObject* GetOutlinerParaObject() const;
150cdf0e10cSrcweir 
151*2cdd1ab0SDamjan Jovanovic 	virtual FASTBOOL CalcFieldValue(const SvxFieldItem& rField, sal_uInt32 nPara, sal_uInt16 nPos,
152cdf0e10cSrcweir 		FASTBOOL bEdit, Color*& rpTxtColor, Color*& rpFldColor, String& rRet) const;
153cdf0e10cSrcweir 
154cdf0e10cSrcweir     // #i97878#
155cdf0e10cSrcweir     virtual sal_Bool TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, basegfx::B2DPolyPolygon& rPolyPolygon) const;
156cdf0e10cSrcweir 	virtual void TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const basegfx::B2DPolyPolygon& rPolyPolygon);
157cdf0e10cSrcweir };
158cdf0e10cSrcweir 
159cdf0e10cSrcweir /////////////////////////////////////////////////////////////////////////////////////////////////
160cdf0e10cSrcweir //
161cdf0e10cSrcweir // Creating:
162cdf0e10cSrcweir // ~~~~~~~~~
163cdf0e10cSrcweir // Dragging von Bezugspunkt 1 zu Bezugspunkt 2 -> Bezugskante
164cdf0e10cSrcweir //
165cdf0e10cSrcweir // Die Defaults:
166cdf0e10cSrcweir // ~~~~~~~~~~~~~
167cdf0e10cSrcweir // Masslinie und Masshilfslinien: Haarlinien solid schwarz
168cdf0e10cSrcweir // Pfeile:     2mm x 4mm
169cdf0e10cSrcweir // Textgroesse
170cdf0e10cSrcweir //                              ___
171cdf0e10cSrcweir //     |        Masszahl       | 2mm
172cdf0e10cSrcweir //     |<--------------------->|---
173cdf0e10cSrcweir //     |                       | 8mm
174cdf0e10cSrcweir //     |                       |
175cdf0e10cSrcweir //    Pt1============#        Pt2-- <----Bezugskante (von Pt1 nach Pt2)
176cdf0e10cSrcweir //     #             #         |___ <- Ueberstand der Masshilfslinie(n)
177cdf0e10cSrcweir //     #             #=========#
178cdf0e10cSrcweir //     # Zu bemassendes Objekt #
179cdf0e10cSrcweir //     #=======================#
180cdf0e10cSrcweir //
181cdf0e10cSrcweir // Attribute:
182cdf0e10cSrcweir // ~~~~~~~~~~
183cdf0e10cSrcweir // 1. Wo steht der Text: mitte, rechts oder links (def=automatik)
184cdf0e10cSrcweir // 2. Text oberhalb der Linie oder unterhalb oder Linie unterbrochen durch Text (def=automatik)
185cdf0e10cSrcweir // 3. Den Abstand der Masslinie zur Bezugskante (=zum bemassten Objekt).
186cdf0e10cSrcweir //    Default=8mm
187cdf0e10cSrcweir // 4. Masslinie unterhalb der Bezugskante (default=nein)
188cdf0e10cSrcweir // 5. Die Ueberlaenge(n) der Masshilfslinien ueber die Bezugskante (2x, default=0)
189cdf0e10cSrcweir // 6. Den Ueberhang der Masshilfslinien ueber die Masslinie (default=2mm)
190cdf0e10cSrcweir // 7. Den Abstand der Masshilfslinien zur Bezugskante
191cdf0e10cSrcweir //
192cdf0e10cSrcweir // Dragging:                    Handle          Shift
193cdf0e10cSrcweir // ~~~~~~~~~
194cdf0e10cSrcweir // -  Die Bezugspunkte        SolidQuadHdl   nur die Laenge
195cdf0e10cSrcweir // 1.+2. Anpacken des Textes
196cdf0e10cSrcweir // 3.+4. Hdl am Pfeil (2x)    SolidQuadHdl   nur den Bool
197cdf0e10cSrcweir // 5.    Hdl am Endpunkt      CircHdl        beide Laengen?
198cdf0e10cSrcweir // 6.+7. Kein Dragging
199cdf0e10cSrcweir //
200cdf0e10cSrcweir // Offen:
201cdf0e10cSrcweir // ~~~~~~
202cdf0e10cSrcweir // - Radien (gleich als Typ verankern
203cdf0e10cSrcweir //
204cdf0e10cSrcweir // Special:
205cdf0e10cSrcweir // ~~~~~~~~
206cdf0e10cSrcweir // Connecting an max. 2 Objekte
207cdf0e10cSrcweir // -> Bei Copy, etc. den entspr. Code der Verbinder verwenden?!?
208cdf0e10cSrcweir // wird wohl recht kompliziert werden ...
209cdf0e10cSrcweir //
210cdf0e10cSrcweir /////////////////////////////////////////////////////////////////////////////////////////////////
211cdf0e10cSrcweir 
212cdf0e10cSrcweir #endif //_SVDOMEAS_HXX
213cdf0e10cSrcweir 
214