xref: /AOO41X/main/svx/inc/svx/svdoedge.hxx (revision a5258243accf51c522d45cf65e4b16cb17a336f7)
1cdf0e10cSrcweir /*************************************************************************
2cdf0e10cSrcweir  *
3cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4cdf0e10cSrcweir  *
5cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6cdf0e10cSrcweir  *
7cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8cdf0e10cSrcweir  *
9cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10cdf0e10cSrcweir  *
11cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14cdf0e10cSrcweir  *
15cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20cdf0e10cSrcweir  *
21cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25cdf0e10cSrcweir  *
26cdf0e10cSrcweir  ************************************************************************/
27cdf0e10cSrcweir 
28cdf0e10cSrcweir #ifndef _SVDOEDGE_HXX
29cdf0e10cSrcweir #define _SVDOEDGE_HXX
30cdf0e10cSrcweir 
31cdf0e10cSrcweir #include <svx/svdotext.hxx>
32cdf0e10cSrcweir #include <svx/svdglue.hxx>
33cdf0e10cSrcweir #include "svx/svxdllapi.h"
34cdf0e10cSrcweir 
35cdf0e10cSrcweir //************************************************************
36cdf0e10cSrcweir //   Vorausdeklarationen
37cdf0e10cSrcweir //************************************************************
38cdf0e10cSrcweir 
39cdf0e10cSrcweir class SdrDragMethod;
40cdf0e10cSrcweir class SdrPageView;
41cdf0e10cSrcweir 
42cdf0e10cSrcweir namespace sdr {	namespace properties {
43cdf0e10cSrcweir 	class ConnectorProperties;
44cdf0e10cSrcweir }}
45cdf0e10cSrcweir 
46cdf0e10cSrcweir //************************************************************
47cdf0e10cSrcweir //   Hilfsklasse SdrObjConnection
48cdf0e10cSrcweir //************************************************************
49cdf0e10cSrcweir 
50cdf0e10cSrcweir class SdrObjConnection
51cdf0e10cSrcweir {
52cdf0e10cSrcweir 	friend class				SdrEdgeObj;
53cdf0e10cSrcweir 	friend class				ImpEdgeHdl;
54cdf0e10cSrcweir 	friend class				SdrCreateView;
55cdf0e10cSrcweir 
56cdf0e10cSrcweir protected:
57cdf0e10cSrcweir 	Point						aObjOfs;       // Wird beim Draggen eines Knotens gesetzt
58cdf0e10cSrcweir 	SdrObject*					pObj;          // Referenziertes Objekt
59cdf0e10cSrcweir 	long						nXDist;        // Hor. Objektabstand wenn bXDistOvr=TRUE
60cdf0e10cSrcweir 	long						nYDist;        // Vert. Objektabstand wenn bYDistOvr=TRUE
61cdf0e10cSrcweir 	sal_uInt16						nConId;        // Konnektornummer
62cdf0e10cSrcweir 
63cdf0e10cSrcweir 	// bitfield
64cdf0e10cSrcweir 	unsigned					bBestConn : 1;   // sal_True= es wird der guenstigste Konnektor gesucht
65cdf0e10cSrcweir 	unsigned					bBestVertex : 1; // sal_True= es wird der guenstigste Scheitelpunkt zum konnekten gesucht
66cdf0e10cSrcweir 	unsigned					bXDistOvr : 1;   // sal_True= Hor. Objektabstand wurde gedragt (Overwrite)
67cdf0e10cSrcweir 	unsigned					bYDistOvr : 1;   // sal_True= Vert. Objektabstand wurde gedragt (Overwrite)
68cdf0e10cSrcweir 	unsigned					bAutoVertex : 1; // AutoConnector am Scheitelpunkt nCon
69cdf0e10cSrcweir 	unsigned					bAutoCorner : 1; // AutoConnector am Eckpunkt nCon
70cdf0e10cSrcweir 
71cdf0e10cSrcweir public:
72cdf0e10cSrcweir 	SdrObjConnection() { ResetVars(); }
73cdf0e10cSrcweir 	SVX_DLLPUBLIC ~SdrObjConnection();
74cdf0e10cSrcweir 
75cdf0e10cSrcweir 	void ResetVars();
76cdf0e10cSrcweir 	FASTBOOL TakeGluePoint(SdrGluePoint& rGP, FASTBOOL bSetAbsolutePos) const;
77cdf0e10cSrcweir 
78cdf0e10cSrcweir 	inline void SetBestConnection( sal_Bool rB ) { bBestConn = rB; };
79cdf0e10cSrcweir 	inline void SetBestVertex( sal_Bool rB ) { bBestVertex = rB; };
80cdf0e10cSrcweir 	inline void SetAutoVertex( sal_Bool rB ) { bAutoVertex = rB; };
81cdf0e10cSrcweir 	inline void SetConnectorId( sal_uInt16 nId ) { nConId = nId; };
82cdf0e10cSrcweir 
83cdf0e10cSrcweir 	inline sal_Bool IsBestConnection() const { return bBestConn; };
84cdf0e10cSrcweir 	inline sal_Bool IsBestVertex() const { return bBestVertex; };
85cdf0e10cSrcweir 	inline sal_Bool IsAutoVertex() const { return bAutoVertex; };
86cdf0e10cSrcweir 	inline sal_uInt16 GetConnectorId() const { return nConId; };
87cdf0e10cSrcweir 	inline SdrObject* GetObject() const { return pObj; }
88cdf0e10cSrcweir };
89cdf0e10cSrcweir 
90cdf0e10cSrcweir //************************************************************
91cdf0e10cSrcweir //   Hilfsklasse SdrEdgeInfoRec
92cdf0e10cSrcweir //************************************************************
93cdf0e10cSrcweir 
94cdf0e10cSrcweir enum SdrEdgeLineCode {OBJ1LINE2,OBJ1LINE3,OBJ2LINE2,OBJ2LINE3,MIDDLELINE};
95cdf0e10cSrcweir 
96cdf0e10cSrcweir class SdrEdgeInfoRec
97cdf0e10cSrcweir {
98cdf0e10cSrcweir public:
99cdf0e10cSrcweir 	// Die 5 Distanzen werden beim draggen bzw. per SetAttr gesetzt und von
100cdf0e10cSrcweir 	// ImpCalcEdgeTrack ausgewertet. Per Get/SetAttr/Get/SetStyleSh werden
101cdf0e10cSrcweir 	// jedoch nur 0-3 longs transportiert.
102cdf0e10cSrcweir 	Point						aObj1Line2;
103cdf0e10cSrcweir 	Point						aObj1Line3;
104cdf0e10cSrcweir 	Point						aObj2Line2;
105cdf0e10cSrcweir 	Point						aObj2Line3;
106cdf0e10cSrcweir 	Point						aMiddleLine;
107cdf0e10cSrcweir 
108cdf0e10cSrcweir 	// Nachfolgende Werte werden von ImpCalcEdgeTrack gesetzt
109cdf0e10cSrcweir 	long						nAngle1;           // Austrittswinkel am Obj1
110cdf0e10cSrcweir 	long						nAngle2;           // Austrittswinkel am Obj2
111cdf0e10cSrcweir 	sal_uInt16						nObj1Lines;        // 1..3
112cdf0e10cSrcweir 	sal_uInt16						nObj2Lines;        // 1..3
113cdf0e10cSrcweir 	sal_uInt16						nMiddleLine;       // 0xFFFF=keine, sonst Punktnummer des Linienbeginns
114cdf0e10cSrcweir 	char						cOrthoForm;        // Form des Ortho-Verbindes, z.B. 'Z','U',I','L','S',...
115cdf0e10cSrcweir 
116cdf0e10cSrcweir public:
117cdf0e10cSrcweir 	SdrEdgeInfoRec()
118cdf0e10cSrcweir 	:	nAngle1(0),
119cdf0e10cSrcweir 		nAngle2(0),
120cdf0e10cSrcweir 		nObj1Lines(0),
121cdf0e10cSrcweir 		nObj2Lines(0),
122cdf0e10cSrcweir 		nMiddleLine(0xFFFF),
123cdf0e10cSrcweir 		cOrthoForm(0)
124cdf0e10cSrcweir 	{}
125cdf0e10cSrcweir 
126cdf0e10cSrcweir 	Point& ImpGetLineVersatzPoint(SdrEdgeLineCode eLineCode);
127cdf0e10cSrcweir 	const Point& ImpGetLineVersatzPoint(SdrEdgeLineCode eLineCode) const { return ((SdrEdgeInfoRec*)this)->ImpGetLineVersatzPoint(eLineCode); }
128cdf0e10cSrcweir 	sal_uInt16 ImpGetPolyIdx(SdrEdgeLineCode eLineCode, const XPolygon& rXP) const;
129cdf0e10cSrcweir 	FASTBOOL ImpIsHorzLine(SdrEdgeLineCode eLineCode, const XPolygon& rXP) const;
130cdf0e10cSrcweir 	void ImpSetLineVersatz(SdrEdgeLineCode eLineCode, const XPolygon& rXP, long nVal);
131cdf0e10cSrcweir 	long ImpGetLineVersatz(SdrEdgeLineCode eLineCode, const XPolygon& rXP) const;
132cdf0e10cSrcweir };
133cdf0e10cSrcweir 
134cdf0e10cSrcweir //************************************************************
135cdf0e10cSrcweir //   Hilfsklasse SdrEdgeObjGeoData
136cdf0e10cSrcweir //************************************************************
137cdf0e10cSrcweir 
138cdf0e10cSrcweir class SdrEdgeObjGeoData : public SdrTextObjGeoData
139cdf0e10cSrcweir {
140cdf0e10cSrcweir public:
141cdf0e10cSrcweir 	SdrObjConnection			aCon1;  // Verbindungszustand des Linienanfangs
142cdf0e10cSrcweir 	SdrObjConnection			aCon2;  // Verbindungszustand des Linienendes
143cdf0e10cSrcweir 	XPolygon*					pEdgeTrack;
144cdf0e10cSrcweir 	sal_Bool					bEdgeTrackDirty;// sal_True=Verbindungsverlauf muss neu berechnet werden.
145cdf0e10cSrcweir 	sal_Bool					bEdgeTrackUserDefined;
146cdf0e10cSrcweir 	SdrEdgeInfoRec				aEdgeInfo;
147cdf0e10cSrcweir 
148cdf0e10cSrcweir public:
149cdf0e10cSrcweir 	SdrEdgeObjGeoData();
150cdf0e10cSrcweir 	virtual ~SdrEdgeObjGeoData();
151cdf0e10cSrcweir };
152cdf0e10cSrcweir 
153cdf0e10cSrcweir //************************************************************
154cdf0e10cSrcweir //   Hilfsklasse SdrEdgeObj
155cdf0e10cSrcweir //************************************************************
156cdf0e10cSrcweir 
157cdf0e10cSrcweir class SVX_DLLPUBLIC SdrEdgeObj : public SdrTextObj
158cdf0e10cSrcweir {
159cdf0e10cSrcweir private:
160cdf0e10cSrcweir 	// to allow sdr::properties::ConnectorProperties access to ImpSetAttrToEdgeInfo()
161cdf0e10cSrcweir 	friend class sdr::properties::ConnectorProperties;
162cdf0e10cSrcweir 
163cdf0e10cSrcweir 	friend class				SdrCreateView;
164cdf0e10cSrcweir 	friend class				ImpEdgeHdl;
165cdf0e10cSrcweir 
166cdf0e10cSrcweir protected:
167cdf0e10cSrcweir 	virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact();
168cdf0e10cSrcweir 	virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties();
169cdf0e10cSrcweir 
170cdf0e10cSrcweir     SdrObjConnection			aCon1;  // Verbindungszustand des Linienanfangs
171cdf0e10cSrcweir 	SdrObjConnection			aCon2;  // Verbindungszustand des Linienendes
172cdf0e10cSrcweir 
173cdf0e10cSrcweir 	XPolygon*					pEdgeTrack;
174cdf0e10cSrcweir 	sal_uInt16					nNotifyingCount; // Verrieglung
175cdf0e10cSrcweir 	SdrEdgeInfoRec				aEdgeInfo;
176cdf0e10cSrcweir 
177cdf0e10cSrcweir 	// bitfield
178cdf0e10cSrcweir 	unsigned					bEdgeTrackDirty : 1; // sal_True=Verbindungsverlauf muss neu berechnet werden.
179cdf0e10cSrcweir 	unsigned					bEdgeTrackUserDefined : 1;
180cdf0e10cSrcweir 
181cdf0e10cSrcweir 	// #109007#
182cdf0e10cSrcweir 	// Bool to allow supporession of default connects at object
183cdf0e10cSrcweir 	// inside test (HitTest) and object center test (see ImpFindConnector())
184cdf0e10cSrcweir 	unsigned					mbSuppressDefaultConnect : 1;
185cdf0e10cSrcweir 
186cdf0e10cSrcweir 	// #110649#
187cdf0e10cSrcweir 	// Flag value for avoiding death loops when calculating BoundRects
188cdf0e10cSrcweir 	// from circularly connected connectors. A coloring algorythm is used
189cdf0e10cSrcweir 	// here. When the GetCurrentBoundRect() calculation of a SdrEdgeObj
190cdf0e10cSrcweir 	// is running, the flag is set, else it is always sal_False.
191cdf0e10cSrcweir 	unsigned					mbBoundRectCalculationRunning : 1;
192cdf0e10cSrcweir 
193cdf0e10cSrcweir public:
194cdf0e10cSrcweir 	// #109007#
195cdf0e10cSrcweir 	// Interface to default connect suppression
196cdf0e10cSrcweir 	void SetSuppressDefaultConnect(sal_Bool bNew) { mbSuppressDefaultConnect = bNew; }
197cdf0e10cSrcweir 	sal_Bool GetSuppressDefaultConnect() const { return mbSuppressDefaultConnect; }
198cdf0e10cSrcweir 
199cdf0e10cSrcweir 	// #110649#
200cdf0e10cSrcweir 	sal_Bool IsBoundRectCalculationRunning() const { return mbBoundRectCalculationRunning; }
201cdf0e10cSrcweir 
202cdf0e10cSrcweir protected:
203cdf0e10cSrcweir 	virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint);
204cdf0e10cSrcweir 
205cdf0e10cSrcweir 	XPolygon ImpCalcObjToCenter(const Point& rStPt, long nEscAngle, const Rectangle& rRect, const Point& rCenter) const;
206cdf0e10cSrcweir 	void ImpRecalcEdgeTrack();  // Neuberechnung des Verbindungsverlaufs
207cdf0e10cSrcweir 	XPolygon ImpCalcEdgeTrack(const XPolygon& rTrack0, SdrObjConnection& rCon1, SdrObjConnection& rCon2, SdrEdgeInfoRec* pInfo) const;
208cdf0e10cSrcweir 	XPolygon ImpCalcEdgeTrack(const Point& rPt1, long nAngle1, const Rectangle& rBoundRect1, const Rectangle& rBewareRect1,
209cdf0e10cSrcweir 		const Point& rPt2, long nAngle2, const Rectangle& rBoundRect2, const Rectangle& rBewareRect2,
210cdf0e10cSrcweir 		sal_uIntPtr* pnQuality, SdrEdgeInfoRec* pInfo) const;
211cdf0e10cSrcweir 	static FASTBOOL ImpFindConnector(const Point& rPt, const SdrPageView& rPV, SdrObjConnection& rCon, const SdrEdgeObj* pThis, OutputDevice* pOut=NULL);
212cdf0e10cSrcweir 	sal_uInt16 ImpCalcEscAngle(SdrObject* pObj, const Point& aPt2) const;
213cdf0e10cSrcweir 	FASTBOOL ImpStripPolyPoints(XPolygon& rXP) const; // entfernen ueberfluessiger Punkte
214cdf0e10cSrcweir 	void ImpSetTailPoint(FASTBOOL bTail1, const Point& rPt);
215cdf0e10cSrcweir 	void ImpUndirtyEdgeTrack();  // eventuelle Neuberechnung des Verbindungsverlaufs
216cdf0e10cSrcweir 	void ImpDirtyEdgeTrack();	// invalidate connector path, so it will be recalculated next time
217cdf0e10cSrcweir 	void ImpSetAttrToEdgeInfo(); // Werte vom Pool nach aEdgeInfo kopieren
218cdf0e10cSrcweir 	void ImpSetEdgeInfoToAttr(); // Werte vom aEdgeInfo in den Pool kopieren
219cdf0e10cSrcweir 
220cdf0e10cSrcweir public:
221cdf0e10cSrcweir 	TYPEINFO();
222cdf0e10cSrcweir 
223cdf0e10cSrcweir 	SdrEdgeObj();
224cdf0e10cSrcweir 	virtual ~SdrEdgeObj();
225cdf0e10cSrcweir 
226cdf0e10cSrcweir 	SdrObjConnection& GetConnection(FASTBOOL bTail1) { return *(bTail1 ? &aCon1 : &aCon2); }
227cdf0e10cSrcweir 	virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const;
228cdf0e10cSrcweir 	virtual sal_uInt16 GetObjIdentifier() const;
229cdf0e10cSrcweir 	virtual const Rectangle& GetCurrentBoundRect() const;
230cdf0e10cSrcweir 	virtual const Rectangle& GetSnapRect() const;
231cdf0e10cSrcweir 	virtual FASTBOOL IsNode() const;
232cdf0e10cSrcweir 	virtual SdrGluePoint GetVertexGluePoint(sal_uInt16 nNum) const;
233cdf0e10cSrcweir 	virtual SdrGluePoint GetCornerGluePoint(sal_uInt16 nNum) const;
234cdf0e10cSrcweir 	virtual const SdrGluePointList* GetGluePointList() const;
235cdf0e10cSrcweir 	virtual SdrGluePointList* ForceGluePointList();
236cdf0e10cSrcweir 	virtual FASTBOOL IsEdge() const;
237cdf0e10cSrcweir 
238cdf0e10cSrcweir 	// bTail1=TRUE: Linienanfang, sonst LinienEnde
239cdf0e10cSrcweir 	// pObj=NULL: Disconnect
240cdf0e10cSrcweir 	void SetEdgeTrackDirty() { bEdgeTrackDirty=sal_True; }
241cdf0e10cSrcweir 	void ConnectToNode(FASTBOOL bTail1, SdrObject* pObj);
242cdf0e10cSrcweir 	void DisconnectFromNode(FASTBOOL bTail1);
243cdf0e10cSrcweir 	SdrObject* GetConnectedNode(FASTBOOL bTail1) const;
244cdf0e10cSrcweir 	const SdrObjConnection& GetConnection(FASTBOOL bTail1) const { return *(bTail1 ? &aCon1 : &aCon2); }
245cdf0e10cSrcweir 	FASTBOOL CheckNodeConnection(FASTBOOL bTail1) const;
246cdf0e10cSrcweir 
247cdf0e10cSrcweir 	virtual void RecalcSnapRect();
248cdf0e10cSrcweir 	virtual void TakeUnrotatedSnapRect(Rectangle& rRect) const;
249cdf0e10cSrcweir 	virtual void operator=(const SdrObject& rObj);
250cdf0e10cSrcweir 	virtual void TakeObjNameSingul(String& rName) const;
251cdf0e10cSrcweir 	virtual void TakeObjNamePlural(String& rName) const;
252cdf0e10cSrcweir 
253cdf0e10cSrcweir 	void	SetEdgeTrackPath( const basegfx::B2DPolyPolygon& rPoly );
254cdf0e10cSrcweir 	basegfx::B2DPolyPolygon GetEdgeTrackPath() const;
255cdf0e10cSrcweir 
256cdf0e10cSrcweir 	virtual basegfx::B2DPolyPolygon TakeXorPoly() const;
257cdf0e10cSrcweir 	virtual sal_uInt32 GetHdlCount() const;
258cdf0e10cSrcweir 	virtual SdrHdl* GetHdl(sal_uInt32 nHdlNum) const;
259cdf0e10cSrcweir 
260cdf0e10cSrcweir     // special drag methods
261cdf0e10cSrcweir 	virtual bool hasSpecialDrag() const;
262cdf0e10cSrcweir 	virtual bool beginSpecialDrag(SdrDragStat& rDrag) const;
263cdf0e10cSrcweir 	virtual bool applySpecialDrag(SdrDragStat& rDrag);
264cdf0e10cSrcweir 	virtual String getSpecialDragComment(const SdrDragStat& rDrag) const;
265cdf0e10cSrcweir 
266cdf0e10cSrcweir     // FullDrag support
267cdf0e10cSrcweir 	virtual SdrObject* getFullDragClone() const;
268cdf0e10cSrcweir 
269cdf0e10cSrcweir     virtual void NbcSetSnapRect(const Rectangle& rRect);
270cdf0e10cSrcweir 	virtual void NbcMove(const Size& aSize);
271cdf0e10cSrcweir 	virtual void NbcResize(const Point& rRefPnt, const Fraction& aXFact, const Fraction& aYFact);
272cdf0e10cSrcweir 
273cdf0e10cSrcweir 	// #102344# Added missing implementation
274cdf0e10cSrcweir 	virtual void NbcSetAnchorPos(const Point& rPnt);
275cdf0e10cSrcweir 
276cdf0e10cSrcweir 	virtual FASTBOOL BegCreate(SdrDragStat& rStat);
277cdf0e10cSrcweir 	virtual FASTBOOL MovCreate(SdrDragStat& rStat);
278cdf0e10cSrcweir 	virtual FASTBOOL EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd);
279cdf0e10cSrcweir 	virtual FASTBOOL BckCreate(SdrDragStat& rStat);
280cdf0e10cSrcweir 	virtual void BrkCreate(SdrDragStat& rStat);
281cdf0e10cSrcweir 	virtual basegfx::B2DPolyPolygon TakeCreatePoly(const SdrDragStat& rDrag) const;
282cdf0e10cSrcweir 	virtual Pointer GetCreatePointer() const;
283*a5258243SPedro Giffuni 	virtual SdrObject* DoConvertToPolyObj(sal_Bool bBezier, bool bAddText) const;
284cdf0e10cSrcweir 
285cdf0e10cSrcweir 	virtual sal_uInt32 GetSnapPointCount() const;
286cdf0e10cSrcweir 	virtual Point GetSnapPoint(sal_uInt32 i) const;
287cdf0e10cSrcweir 	virtual sal_Bool IsPolyObj() const;
288cdf0e10cSrcweir 	virtual sal_uInt32 GetPointCount() const;
289cdf0e10cSrcweir 	virtual Point GetPoint(sal_uInt32 i) const;
290cdf0e10cSrcweir 	virtual void NbcSetPoint(const Point& rPnt, sal_uInt32 i);
291cdf0e10cSrcweir 
292cdf0e10cSrcweir 	virtual SdrObjGeoData* NewGeoData() const;
293cdf0e10cSrcweir 	virtual void SaveGeoData(SdrObjGeoData& rGeo) const;
294cdf0e10cSrcweir 	virtual void RestGeoData(const SdrObjGeoData& rGeo);
295cdf0e10cSrcweir 
296cdf0e10cSrcweir 	/** updates edges that are connected to the edges of this object
297cdf0e10cSrcweir 		as if the connected objects send a repaint broadcast
298cdf0e10cSrcweir 		#103122#
299cdf0e10cSrcweir 	*/
300cdf0e10cSrcweir 	void Reformat();
301cdf0e10cSrcweir 
302cdf0e10cSrcweir 	// helper methods for the StarOffice api
303cdf0e10cSrcweir 	Point GetTailPoint( sal_Bool bTail ) const;
304cdf0e10cSrcweir 	void SetTailPoint( sal_Bool bTail, const Point& rPt );
305cdf0e10cSrcweir 	void setGluePointIndex( sal_Bool bTail, sal_Int32 nId = -1 );
306cdf0e10cSrcweir 	sal_Int32 getGluePointIndex( sal_Bool bTail );
307cdf0e10cSrcweir 
308cdf0e10cSrcweir 	virtual sal_Bool TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, basegfx::B2DPolyPolygon& rPolyPolygon) const;
309cdf0e10cSrcweir 	virtual void TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const basegfx::B2DPolyPolygon& rPolyPolygon);
310cdf0e10cSrcweir 
311cdf0e10cSrcweir 	// for geometry access
312cdf0e10cSrcweir 	::basegfx::B2DPolygon getEdgeTrack() const;
313cdf0e10cSrcweir 
314cdf0e10cSrcweir 	// helper method for SdrDragMethod::AddConnectorOverlays. Adds a overlay polygon for
315cdf0e10cSrcweir 	// this connector to rResult.
316cdf0e10cSrcweir 	basegfx::B2DPolygon ImplAddConnectorOverlay(SdrDragMethod& rDragMethod, bool bTail1, bool bTail2, bool bDetail) const;
317cdf0e10cSrcweir };
318cdf0e10cSrcweir 
319cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
320cdf0e10cSrcweir //
321cdf0e10cSrcweir // Zur Bestimmung der Verlaufslinie werden folgende Item-Parameter des SdrItemPool verwendet:
322cdf0e10cSrcweir //
323cdf0e10cSrcweir //  sal_uInt16 EdgeFlowAngle       Default 9000 (=90.00 Deg), min 0, max 9000
324cdf0e10cSrcweir //      Verlauffreiheitswinkel.
325cdf0e10cSrcweir //      Der Winkel, in dem die Verbindungslinie verlaufen darf.
326cdf0e10cSrcweir //
327cdf0e10cSrcweir //  sal_uInt16 EdgeEscAngle        Default 9000 (=90.00 Deg), min 0, max 9000
328cdf0e10cSrcweir //      Objektaustrittswinkel.
329cdf0e10cSrcweir //      Der Winkel, in dem die Verbindungslinie aus dem Objekt austreten darf.
330cdf0e10cSrcweir //
331cdf0e10cSrcweir //  sal_Bool   EdgeEscAsRay        Default FALSE
332cdf0e10cSrcweir //      sal_True= die Verbindungslinie tritt aus dem Obj Strahlenfoermig aus.
333cdf0e10cSrcweir //      Also Winkelvorgabe durch die Strecke ObjMitte/Konnektor.
334cdf0e10cSrcweir //
335cdf0e10cSrcweir //  sal_Bool   EdgeEscUseObjAngle  Default FALSE
336cdf0e10cSrcweir //      Objektdrehwinkelberuecksichtigung.
337cdf0e10cSrcweir //      sal_True= Bei der Bestimmung des Objektaustrittswinkels wird der
338cdf0e10cSrcweir //      Drehwinkel des Objekts als Offset beruecksichtigt.
339cdf0e10cSrcweir //
340cdf0e10cSrcweir //  sal_uIntPtr  EdgeFlowDefDist     Default 0, min 0, max ?
341cdf0e10cSrcweir //      Das ist der Default-Mindestabstand der bei der Berechnung der
342cdf0e10cSrcweir //      Verbindungslinie zu den angedockten Objekten in logischen Einheiten.
343cdf0e10cSrcweir //      Dieser Abstand wird innerhalb des Objektes "ueberschrieben", sobald
344cdf0e10cSrcweir //      der User an den Linien draggd. Beim Andocken an ein neues Objekt wird
345cdf0e10cSrcweir //      dann jedoch wieder dieser Default verwendet.
346cdf0e10cSrcweir //
347cdf0e10cSrcweir //
348cdf0e10cSrcweir // Allgemeines zu Konnektoren:
349cdf0e10cSrcweir //
350cdf0e10cSrcweir // Es gibt Knoten und Kantenobjekte. Zwei Knoten koennen durch eine Kante
351cdf0e10cSrcweir // miteinander verbunden werden. Ist eine Kante nur an einem Ende an einen
352cdf0e10cSrcweir // Knoten geklebt, ist das andere Ende auf einer absoluten Position im Doc
353cdf0e10cSrcweir // fixiert. Ebenso ist es natuerlich auch moeglich, dass eine Kante an beiden
354cdf0e10cSrcweir // Enden "frei", also nicht mit einem Knotenobjekt verbunden ist.
355cdf0e10cSrcweir //
356cdf0e10cSrcweir // Ein Kantenobjekt kann theoretisch auch gleichzeitig Knotenobjekt sein. In
357cdf0e10cSrcweir // der ersten Version wird das jedoch noch nicht realisiert werden.
358cdf0e10cSrcweir //
359cdf0e10cSrcweir // Eine Verbindung zwischen Knoten und Kante kann hergestellt werden durch:
360cdf0e10cSrcweir // - Interaktives erzeugen eines neuen Kantenobjekts an der SdrView wobei
361cdf0e10cSrcweir //   Anfangs- bzw. Endpunkt der Kante auf ein Konnektor (Klebestelle) eines
362cdf0e10cSrcweir //   bereits vorhandenen Knotenobjekts gelegt wird.
363cdf0e10cSrcweir // - Interaktives draggen des Anfangs- bzw. Endpunkts eines bestehenden
364cdf0e10cSrcweir //   Kantenobjekts an der SdrView auf ein Konnektor (Klebestelle) eines
365cdf0e10cSrcweir //   bereits vorhandenen Knotenobjekts.
366cdf0e10cSrcweir // - Undo/Redo
367cdf0e10cSrcweir // Verschieben von Knotenobjekten stellt keine Verbindungen her. Ebenso auch
368cdf0e10cSrcweir // nicht das direkte Verschieben von Kantenendpunkten am SdrModel...
369cdf0e10cSrcweir // Verbindungen koennen auch hergestellt werden, wenn die Konnektoren an der
370cdf0e10cSrcweir // View nicht sichtbar geschaltet sind.
371cdf0e10cSrcweir //
372cdf0e10cSrcweir // Eine vorhandene Verbindung zwischen Knoten und Kante bleibt erhalten bei:
373cdf0e10cSrcweir // - Draggen (Move/Resize/Rotate/...) des Knotenobjekts
374cdf0e10cSrcweir // - Verschieben einer Konnektorposition im Knotemobjekt
375cdf0e10cSrcweir // - gleichzeitiges Draggen (Move/Resize/Rotate/...) von Knoten und Kante
376cdf0e10cSrcweir //
377cdf0e10cSrcweir // Eine Verbindung zwischen Knoten und Kante kann geloesst werden durch:
378cdf0e10cSrcweir // - Loeschen eines der Objekte
379cdf0e10cSrcweir // - Draggen des Kantenobjekts ohne gleichzeitiges Draggen des Knotens
380cdf0e10cSrcweir // - Loeschen des Konnektors am Knotenobjekt
381cdf0e10cSrcweir // - Undo/Redo/Repeat
382cdf0e10cSrcweir // Beim Draggen muss die Aufforderung zum loesen der Verbindung von ausserhalb
383cdf0e10cSrcweir // des Models befohlen werden (z.B. von der SdrView). SdrEdgeObj::Move() loesst
384cdf0e10cSrcweir // die Verbindung nicht selbsttaetig.
385cdf0e10cSrcweir //
386cdf0e10cSrcweir // Jedes Knotenobjekt kann Konnektoren, sog. Klebestellen besitzen. Das sind die
387cdf0e10cSrcweir // geometrischen Punkte, an denen das verbindende Kantenobjekt bei hergestellter
388cdf0e10cSrcweir // Verbindung endet. Defaultmaessig hat jedes Objekt keine Konnektoren. Trotzdem
389cdf0e10cSrcweir // kann man bei bestimmten View-Einstellungen eine Kante andocken, da dann z.B.
390cdf0e10cSrcweir // an den 4 Scheitelpunkten des Knotenobjekts bei Bedarf automatisch Konnektoren
391cdf0e10cSrcweir // generiert werden. Jedes Objekt liefert dafuer 2x4 sog. Default-Konnektorposi-
392cdf0e10cSrcweir // tionen, 4 an den Scheitelpunkten und 4 an den Eckpositionen. Im Normalfall
393cdf0e10cSrcweir // liegen diese an den 8 Handlepositionen; Ausnahmen bilden hier Ellipsen,
394cdf0e10cSrcweir // Parallelogramme, ... . Darueberhinaus koennen auch an jedem Knotenobjekt
395cdf0e10cSrcweir // anwenderspeziefische Konnektoren gesetzt werden.
396cdf0e10cSrcweir //
397cdf0e10cSrcweir // Dann gibt es noch die Moeglichkeit, ein Kante an einem Objekt mit dem
398cdf0e10cSrcweir // Attribut "bUseBestConnector" anzudocken. Es wird dann aus dem Angebot der
399cdf0e10cSrcweir // Konnektoren des Objekts oder/und der Scheitelpunkte, jeweils die fuer den
400cdf0e10cSrcweir // Verlauf der Verbindungslinie guenstigste Konnektorposition verwendet. Der
401cdf0e10cSrcweir // Anwender vergibt dieses Attribut, indem er den Knoten in seiner Mitte
402cdf0e10cSrcweir // andockt (siehe z.B. Visio).
403cdf0e10cSrcweir // 09-06-1996: bUseBestConnector verwendet nur Scheitelpunktklebepunkte.
404cdf0e10cSrcweir //
405cdf0e10cSrcweir // Und hier noch etwas Begriffsdefinition:
406cdf0e10cSrcweir //   Verbinder : Eben das Verbinderobjekt (Kantenobjekt)
407cdf0e10cSrcweir //   Knoten    : Ein beliebiges Objekt, an dem ein Verbinder drangeklebt
408cdf0e10cSrcweir //               werden kann, z.B. ein Rechteck, ...
409cdf0e10cSrcweir //   Klebepunkt: Der Punkt, an dem der Verbinder an das Knotenobjekt
410cdf0e10cSrcweir //               geklebt wird. Hierbei gibt es:
411cdf0e10cSrcweir //                 Scheitelpunktklebepunkte: Jedes Knotenobjekt hat diese
412cdf0e10cSrcweir //                     Klebepunkte von Natur aus. Moeglicherweise gibt es
413cdf0e10cSrcweir //                     im Draw bereits die Option "Automatisch ankleben an
414cdf0e10cSrcweir //                     Objektscheitelpunkte" (default an)
415cdf0e10cSrcweir //                 Eckpunktklebepunkte: Auch diese Klebepunkte sind den
416cdf0e10cSrcweir //                     Objekten von mir bereits mitgegeben. Wie die oben
417cdf0e10cSrcweir //                     erwaehnten gibt es fuer diese moeglicherweise
418cdf0e10cSrcweir //                     bereits auch eine Option im Draw. (default aus)
419cdf0e10cSrcweir //                 Scheitelpunktklebepunkte und Eckpunktklebepunkte sind
420cdf0e10cSrcweir //                     im Gegensatz zu Visio nicht optisch sichtbar; sie
421cdf0e10cSrcweir //                     sind eben einfach da (wenn Option eingeschaltet).
422cdf0e10cSrcweir //                 Benutzerdefinierte Klebepunkte: Gibt es an jedem
423cdf0e10cSrcweir //                     Knotenobjekt beliebig viele. Per Option koennen sie
424cdf0e10cSrcweir //                     sichtbar geschaltet werden (beim editieren immer
425cdf0e10cSrcweir //                     sichtbar). Zur Zeit sind die jedoch noch nicht ganz
426cdf0e10cSrcweir //                     fertigimplementiert.
427cdf0e10cSrcweir //                 Automatische Klebepunktwahl: Wird der Verbinder so an
428cdf0e10cSrcweir //                     das Knotenobjekt gedockt, dass der schwarke Rahmen
429cdf0e10cSrcweir //                     das gesamte Objekt umfasst, so versucht der
430cdf0e10cSrcweir //                     Verbinder von den 4 Scheitelpunktklebepunkten (und
431cdf0e10cSrcweir //                     zwar nur von denen) den guenstigsten herauszufinden.
432cdf0e10cSrcweir //
433cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////////////////////////
434cdf0e10cSrcweir 
435cdf0e10cSrcweir #endif //_SVDOEDGE_HXX
436cdf0e10cSrcweir 
437