xref: /aoo41x/main/svx/inc/svx/svdoashp.hxx (revision 4d7c9de0)
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 _SVDOASHP_HXX
25cdf0e10cSrcweir #define _SVDOASHP_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <svx/svdobj.hxx>
28cdf0e10cSrcweir #include <svx/svdotext.hxx>
29cdf0e10cSrcweir #include <svx/svdhdl.hxx>
30cdf0e10cSrcweir #include <vector>
31cdf0e10cSrcweir #include <com/sun/star/uno/Reference.h>
32cdf0e10cSrcweir #include <com/sun/star/drawing/XCustomShapeEngine.hpp>
33cdf0e10cSrcweir #include <com/sun/star/drawing/EnhancedCustomShapeAdjustmentValue.hpp>
34cdf0e10cSrcweir #include "svx/svxdllapi.h"
35cdf0e10cSrcweir 
36cdf0e10cSrcweir //************************************************************
37cdf0e10cSrcweir //   Vorausdeklarationen
38cdf0e10cSrcweir //************************************************************
39cdf0e10cSrcweir 
40cdf0e10cSrcweir class SdrObjList;
41cdf0e10cSrcweir class SdrObjListIter;
42cdf0e10cSrcweir class SfxItemSet;
43cdf0e10cSrcweir 
44cdf0e10cSrcweir namespace sdr
45cdf0e10cSrcweir {
46cdf0e10cSrcweir 	namespace properties
47cdf0e10cSrcweir 	{
48cdf0e10cSrcweir 		class CustomShapeProperties;
49cdf0e10cSrcweir 	} // end of namespace properties
50cdf0e10cSrcweir } // end of namespace sdr
51cdf0e10cSrcweir 
52cdf0e10cSrcweir class SdrAShapeObjGeoData : public SdrTextObjGeoData
53cdf0e10cSrcweir {
54cdf0e10cSrcweir 	public:
55cdf0e10cSrcweir 
56cdf0e10cSrcweir 	sal_Bool	bMirroredX;
57cdf0e10cSrcweir 	sal_Bool	bMirroredY;
58cdf0e10cSrcweir 	double		fObjectRotation;
59cdf0e10cSrcweir 
60cdf0e10cSrcweir 	com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeAdjustmentValue >
61cdf0e10cSrcweir 				aAdjustmentSeq;
62cdf0e10cSrcweir };
63cdf0e10cSrcweir 
64cdf0e10cSrcweir #define CUSTOMSHAPE_HANDLE_RESIZE_FIXED			1
65cdf0e10cSrcweir #define CUSTOMSHAPE_HANDLE_CREATE_FIXED			2
66cdf0e10cSrcweir #define CUSTOMSHAPE_HANDLE_RESIZE_ABSOLUTE_X	4
67cdf0e10cSrcweir #define CUSTOMSHAPE_HANDLE_RESIZE_ABSOLUTE_Y	8
68cdf0e10cSrcweir #define CUSTOMSHAPE_HANDLE_MOVE_SHAPE			16
69cdf0e10cSrcweir #define CUSTOMSHAPE_HANDLE_ORTHO4				32
70cdf0e10cSrcweir 
71cdf0e10cSrcweir struct SdrCustomShapeInteraction
72cdf0e10cSrcweir {
73cdf0e10cSrcweir 	com::sun::star::uno::Reference< com::sun::star::drawing::XCustomShapeHandle >	xInteraction;
74cdf0e10cSrcweir 	com::sun::star::awt::Point														aPosition;
75cdf0e10cSrcweir 	sal_Int32																		nMode;
76cdf0e10cSrcweir };
77cdf0e10cSrcweir 
78cdf0e10cSrcweir //************************************************************
79cdf0e10cSrcweir //   SdrObjCustomShape
80cdf0e10cSrcweir //************************************************************
81cdf0e10cSrcweir 
82cdf0e10cSrcweir class SVX_DLLPUBLIC SdrObjCustomShape : public SdrTextObj
83cdf0e10cSrcweir {
84cdf0e10cSrcweir private:
85cdf0e10cSrcweir 	// fObjectRotation is containing the object rotation in degrees.
86cdf0e10cSrcweir 	double fObjectRotation;
87cdf0e10cSrcweir 
88cdf0e10cSrcweir protected:
89cdf0e10cSrcweir 	virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact();
90cdf0e10cSrcweir 
91cdf0e10cSrcweir public:
92cdf0e10cSrcweir 	virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties();
93cdf0e10cSrcweir 
94cdf0e10cSrcweir 	// to allow sdr::properties::CustomShapeProperties access
95cdf0e10cSrcweir 	friend class sdr::properties::CustomShapeProperties;
96cdf0e10cSrcweir 
97cdf0e10cSrcweir 	com::sun::star::uno::Reference< com::sun::star::drawing::XShape > mXRenderedCustomShape;
98cdf0e10cSrcweir 
99cdf0e10cSrcweir 	// #i37011# render geometry shadow
100cdf0e10cSrcweir 	SdrObject*											mpLastShadowGeometry;
101cdf0e10cSrcweir 
102cdf0e10cSrcweir 	static com::sun::star::uno::Reference< com::sun::star::drawing::XCustomShapeEngine > GetCustomShapeEngine( const SdrObjCustomShape* pCustomShape );
103cdf0e10cSrcweir 
104cdf0e10cSrcweir //	SVX_DLLPRIVATE com::sun::star::uno::Sequence< com::sun::star::uno::Reference< com::sun::star::drawing::XCustomShapeHandle > >
105cdf0e10cSrcweir //		SdrObjCustomShape::GetInteraction( const SdrObjCustomShape* pCustomShape ) const;
106cdf0e10cSrcweir // #i47293#
107cdf0e10cSrcweir //	SVX_DLLPRIVATE std::vector< com::sun::star::uno::Reference< com::sun::star::drawing::XCustomShapeHandle > > GetFixedInteractionHandle() const;
108cdf0e10cSrcweir 
109cdf0e10cSrcweir 	SVX_DLLPRIVATE std::vector< SdrCustomShapeInteraction > GetInteractionHandles( const SdrObjCustomShape* pCustomShape ) const;
110cdf0e10cSrcweir 
111cdf0e10cSrcweir 	SVX_DLLPRIVATE void DragCreateObject( SdrDragStat& rDrag );
112cdf0e10cSrcweir 
113cdf0e10cSrcweir 	SVX_DLLPRIVATE void DragResizeCustomShape( const Rectangle& rNewRect, SdrObjCustomShape* pObj ) const;
114cdf0e10cSrcweir 	SVX_DLLPRIVATE void DragMoveCustomShapeHdl( const Point aDestination, const sal_uInt16 nCustomShapeHdlNum, SdrObjCustomShape* pObj ) const;
115cdf0e10cSrcweir 
116cdf0e10cSrcweir 	// #i37011# centralize throw-away of render geometry
117cdf0e10cSrcweir 	void InvalidateRenderGeometry();
118cdf0e10cSrcweir 
119cdf0e10cSrcweir 	// #i38892#
120cdf0e10cSrcweir 	void ImpCheckCustomGluePointsAreAdded();
121cdf0e10cSrcweir 
122cdf0e10cSrcweir 	// returns the new text rect that corresponds to the current logic rect, the return value can be empty if nothing changed.
123cdf0e10cSrcweir 	Rectangle ImpCalculateTextFrame( const FASTBOOL bHgt, const FASTBOOL bWdt );
124cdf0e10cSrcweir 
125cdf0e10cSrcweir public:
126cdf0e10cSrcweir 	// #i37011#
127cdf0e10cSrcweir 	const SdrObject* GetSdrObjectFromCustomShape() const;
128cdf0e10cSrcweir 	const SdrObject* GetSdrObjectShadowFromCustomShape() const;
129cdf0e10cSrcweir 	sal_Bool GetTextBounds( Rectangle& rTextBound ) const;
130cdf0e10cSrcweir 	sal_Bool IsTextPath() const;
131cdf0e10cSrcweir 	static basegfx::B2DPolyPolygon GetLineGeometry( const SdrObjCustomShape* pCustomShape, const sal_Bool bBezierAllowed );
132cdf0e10cSrcweir 
133cdf0e10cSrcweir protected:
134*215d8f42SArmin Le Grand     // #115391# new method for SdrObjCustomShape and SdrTextObj to correctly handle and set
135*215d8f42SArmin Le Grand     // SdrTextMinFrameWidthItem and SdrTextMinFrameHeightItem based on all settings, necessities
136*215d8f42SArmin Le Grand     // and object sizes
137*215d8f42SArmin Le Grand     virtual void AdaptTextMinSize();
138cdf0e10cSrcweir 
139cdf0e10cSrcweir 	String		aName;
140cdf0e10cSrcweir 
141cdf0e10cSrcweir public:
142cdf0e10cSrcweir 	sal_Bool UseNoFillStyle() const;
143cdf0e10cSrcweir 
144cdf0e10cSrcweir 	sal_Bool IsMirroredX() const;
145cdf0e10cSrcweir 	sal_Bool IsMirroredY() const;
146cdf0e10cSrcweir 	void SetMirroredX( const sal_Bool bMirroredX );
147cdf0e10cSrcweir 	void SetMirroredY( const sal_Bool bMirroredY );
148cdf0e10cSrcweir 
149cdf0e10cSrcweir 	double GetObjectRotation() const;
150cdf0e10cSrcweir 	double GetExtraTextRotation() const;
151cdf0e10cSrcweir 
152cdf0e10cSrcweir 	TYPEINFO();
153cdf0e10cSrcweir 	SdrObjCustomShape();
154cdf0e10cSrcweir 	virtual ~SdrObjCustomShape();
155cdf0e10cSrcweir 
156cdf0e10cSrcweir 	/* is merging default attributes from type-shype into the SdrCustomShapeGeometryItem. If pType
157cdf0e10cSrcweir 	is NULL then the type is being taken from the "Type" property of the SdrCustomShapeGeometryItem.
158cdf0e10cSrcweir 	MergeDefaultAttributes is called when creating CustomShapes via UI and after importing */
159cdf0e10cSrcweir 	void MergeDefaultAttributes( const rtl::OUString* pType = NULL );
160cdf0e10cSrcweir 
161cdf0e10cSrcweir 	/* the method is checking if the geometry data is unchanged/default, in this case the data might not be stored */
162cdf0e10cSrcweir 	enum DefaultType
163cdf0e10cSrcweir 	{
164cdf0e10cSrcweir 		DEFAULT_PATH,
165cdf0e10cSrcweir 		DEFAULT_VIEWBOX,
166cdf0e10cSrcweir 		DEFAULT_SEGMENTS,
167cdf0e10cSrcweir 		DEFAULT_GLUEPOINTS,
168cdf0e10cSrcweir 		DEFAULT_STRETCHX,
169cdf0e10cSrcweir 		DEFAULT_STRETCHY,
170cdf0e10cSrcweir 		DEFAULT_EQUATIONS,
171cdf0e10cSrcweir 		DEFAULT_HANDLES,
172cdf0e10cSrcweir 		DEFAULT_TEXTFRAMES
173cdf0e10cSrcweir 	};
174cdf0e10cSrcweir 	sal_Bool IsDefaultGeometry( const DefaultType eDefaultType ) const;
175cdf0e10cSrcweir 
176cdf0e10cSrcweir 	virtual sal_uInt16 GetObjIdentifier() const;
177cdf0e10cSrcweir 	virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const;
178cdf0e10cSrcweir 
179cdf0e10cSrcweir 	virtual void SetModel(SdrModel* pNewModel);
180cdf0e10cSrcweir 
181cdf0e10cSrcweir 	virtual void RecalcSnapRect();
182cdf0e10cSrcweir 
183cdf0e10cSrcweir 	virtual const Rectangle& GetSnapRect()  const;
184cdf0e10cSrcweir 	virtual const Rectangle& GetCurrentBoundRect() const;
185cdf0e10cSrcweir 	virtual const Rectangle& GetLogicRect() const;
186cdf0e10cSrcweir 
187cdf0e10cSrcweir 	virtual void Move(const Size& rSiz);
188cdf0e10cSrcweir 	virtual void Resize(const Point& rRef, const Fraction& xFact, const Fraction& yFact);
189cdf0e10cSrcweir 	virtual void Shear(const Point& rRef, long nWink, double tn, FASTBOOL bVShear);
190cdf0e10cSrcweir 	virtual void SetSnapRect(const Rectangle& rRect);
191cdf0e10cSrcweir 	virtual void SetLogicRect(const Rectangle& rRect);
192cdf0e10cSrcweir 
193cdf0e10cSrcweir 	virtual void NbcMove(const Size& rSiz);
194cdf0e10cSrcweir 	virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact);
195cdf0e10cSrcweir 	virtual void NbcRotate(const Point& rRef, long nWink, double sn, double cs);
196cdf0e10cSrcweir 	virtual void NbcMirror(const Point& rRef1, const Point& rRef2);
197cdf0e10cSrcweir 	virtual void NbcShear(const Point& rRef, long nWink, double tn, FASTBOOL bVShear);
198cdf0e10cSrcweir 	virtual void NbcSetSnapRect(const Rectangle& rRect);
199cdf0e10cSrcweir 	virtual void NbcSetLogicRect(const Rectangle& rRect);
200cdf0e10cSrcweir 
201cdf0e10cSrcweir 	virtual SdrGluePoint GetVertexGluePoint(sal_uInt16 nNum) const;
202cdf0e10cSrcweir 
203cdf0e10cSrcweir 	virtual void NbcSetStyleSheet( SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr );
204cdf0e10cSrcweir 
205cdf0e10cSrcweir     // special drag methods
206cdf0e10cSrcweir 	virtual bool hasSpecialDrag() const;
207cdf0e10cSrcweir 	virtual bool beginSpecialDrag(SdrDragStat& rDrag) const;
208cdf0e10cSrcweir 	virtual bool applySpecialDrag(SdrDragStat& rDrag);
209cdf0e10cSrcweir 
210cdf0e10cSrcweir 	virtual FASTBOOL BegCreate( SdrDragStat& rStat );
211cdf0e10cSrcweir 	virtual FASTBOOL MovCreate(SdrDragStat& rStat);	// #i37448#
212cdf0e10cSrcweir 	virtual FASTBOOL EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd);
213cdf0e10cSrcweir 
214cdf0e10cSrcweir 	virtual FASTBOOL AdjustTextFrameWidthAndHeight(Rectangle& rR, FASTBOOL bHgt=sal_True, FASTBOOL bWdt=sal_True) const;
215cdf0e10cSrcweir 	virtual FASTBOOL NbcAdjustTextFrameWidthAndHeight(FASTBOOL bHgt=sal_True, FASTBOOL bWdt=sal_True);
216cdf0e10cSrcweir 	virtual FASTBOOL AdjustTextFrameWidthAndHeight(FASTBOOL bHgt=sal_True, FASTBOOL bWdt=sal_True);
217cdf0e10cSrcweir 	virtual FASTBOOL IsAutoGrowHeight() const;
218cdf0e10cSrcweir 	virtual FASTBOOL IsAutoGrowWidth() const;
219cdf0e10cSrcweir 	virtual void SetVerticalWriting( sal_Bool bVertical );
220cdf0e10cSrcweir 	virtual sal_Bool BegTextEdit( SdrOutliner& rOutl );
221cdf0e10cSrcweir 	virtual void TakeTextEditArea(Size* pPaperMin, Size* pPaperMax, Rectangle* pViewInit, Rectangle* pViewMin) const;
222cdf0e10cSrcweir 	virtual void EndTextEdit( SdrOutliner& rOutl );
223cdf0e10cSrcweir 	virtual void TakeTextAnchorRect( Rectangle& rAnchorRect ) const;
224cdf0e10cSrcweir 	virtual void TakeTextRect( SdrOutliner& rOutliner, Rectangle& rTextRect, FASTBOOL bNoEditText=sal_False,
225cdf0e10cSrcweir 		Rectangle* pAnchorRect=NULL, sal_Bool bLineWidth=sal_True ) const;
226cdf0e10cSrcweir 	virtual void operator=(const SdrObject& rObj);
227cdf0e10cSrcweir 
228cdf0e10cSrcweir 	virtual void TakeObjNameSingul(String& rName) const;
229cdf0e10cSrcweir 	virtual void TakeObjNamePlural(String& rName) const;
230cdf0e10cSrcweir 
231cdf0e10cSrcweir 	virtual basegfx::B2DPolyPolygon TakeCreatePoly( const SdrDragStat& rDrag) const;
232cdf0e10cSrcweir 
233cdf0e10cSrcweir 	virtual basegfx::B2DPolyPolygon TakeXorPoly() const;
234cdf0e10cSrcweir 	virtual basegfx::B2DPolyPolygon TakeContour() const;
235cdf0e10cSrcweir 
236cdf0e10cSrcweir 	virtual void NbcSetOutlinerParaObject(OutlinerParaObject* pTextObject);
237cdf0e10cSrcweir 
238a5258243SPedro Giffuni 	virtual SdrObject* DoConvertToPolyObj(sal_Bool bBezier, bool bAddText) const;
239cdf0e10cSrcweir 
240cdf0e10cSrcweir 	virtual void SetPage( SdrPage* pNewPage );
241cdf0e10cSrcweir 
242cdf0e10cSrcweir 	virtual SdrObjGeoData *NewGeoData() const;
243cdf0e10cSrcweir 	virtual void          SaveGeoData(SdrObjGeoData &rGeo) const;
244cdf0e10cSrcweir 	virtual void          RestGeoData(const SdrObjGeoData &rGeo);
245cdf0e10cSrcweir 
246cdf0e10cSrcweir 	// need to take fObjectRotation instead of aGeo.nWink, replace it temporary
247cdf0e10cSrcweir 	virtual sal_Bool TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, basegfx::B2DPolyPolygon& rPolyPolygon) const;
248cdf0e10cSrcweir 	virtual void TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const basegfx::B2DPolyPolygon& rPolyPolygon);
249cdf0e10cSrcweir 
250cdf0e10cSrcweir 	virtual const SdrGluePointList* GetGluePointList() const;
251cdf0e10cSrcweir 	//virtual SdrGluePointList* GetGluePointList();
252cdf0e10cSrcweir 	virtual SdrGluePointList* ForceGluePointList();
253cdf0e10cSrcweir 
254cdf0e10cSrcweir 	virtual sal_uInt32 GetHdlCount() const;
255cdf0e10cSrcweir 	virtual SdrHdl* GetHdl( sal_uInt32 nHdlNum ) const;
256cdf0e10cSrcweir 
257cdf0e10cSrcweir 	// #i33136#
258cdf0e10cSrcweir 	static bool doConstructOrthogonal(const ::rtl::OUString& rName);
259cdf0e10cSrcweir 
260cdf0e10cSrcweir 	using SdrTextObj::NbcSetOutlinerParaObject;
2619b8096d0SSteve Yin 
2629b8096d0SSteve Yin 	::rtl::OUString GetCustomShapeName();
263cdf0e10cSrcweir };
264cdf0e10cSrcweir 
265cdf0e10cSrcweir #endif //_SVDOASHP_HXX
266cdf0e10cSrcweir 
267