xref: /trunk/main/svx/source/svdraw/svdfmtf.hxx (revision 5aaf853b)
13334a7e6SAndrew Rist /**************************************************************
23334a7e6SAndrew Rist  *
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 _SVDFMTF_HXX
25cdf0e10cSrcweir #define _SVDFMTF_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <vcl/metaact.hxx>
28cdf0e10cSrcweir #include <vcl/virdev.hxx>
29cdf0e10cSrcweir #include <svx/svdobj.hxx>
30cdf0e10cSrcweir 
31cdf0e10cSrcweir //************************************************************
32cdf0e10cSrcweir //   Vorausdeklarationen
33cdf0e10cSrcweir //************************************************************
34cdf0e10cSrcweir 
35cdf0e10cSrcweir class SfxItemSet;
36cdf0e10cSrcweir class SdrObjList;
37cdf0e10cSrcweir class SdrModel;
38cdf0e10cSrcweir class SdrPage;
39cdf0e10cSrcweir class SdrObject;
40cdf0e10cSrcweir class SvdProgressInfo;
41cdf0e10cSrcweir 
42cdf0e10cSrcweir //************************************************************
43cdf0e10cSrcweir //   Hilfsklasse SdrObjRefList
44cdf0e10cSrcweir //************************************************************
45cdf0e10cSrcweir 
46cdf0e10cSrcweir class SdrObjRefList
47cdf0e10cSrcweir {
48cdf0e10cSrcweir 	Container					aList;
49cdf0e10cSrcweir public:
50cdf0e10cSrcweir 
51cdf0e10cSrcweir 	SdrObjRefList()
52cdf0e10cSrcweir 	:	aList(1024,64,64)
53cdf0e10cSrcweir 	{}
54cdf0e10cSrcweir 
55cdf0e10cSrcweir 	void Clear() { aList.Clear(); }
56cdf0e10cSrcweir 	sal_uLong GetObjCount() const { return aList.Count(); }
57cdf0e10cSrcweir 	SdrObject* GetObj(sal_uLong nNum) const { return (SdrObject*)aList.GetObject(nNum); }
58cdf0e10cSrcweir 	SdrObject* operator[](sal_uLong nNum) const { return (SdrObject*)aList.GetObject(nNum); }
59cdf0e10cSrcweir 	void InsertObject(SdrObject* pObj, sal_uLong nPos=CONTAINER_APPEND) { aList.Insert(pObj,nPos); }
60cdf0e10cSrcweir 	void RemoveObject(sal_uLong nPos) { aList.Remove(nPos); }
61cdf0e10cSrcweir };
62cdf0e10cSrcweir 
63cdf0e10cSrcweir //************************************************************
64cdf0e10cSrcweir //   Hilfsklasse ImpSdrGDIMetaFileImport
65cdf0e10cSrcweir //************************************************************
66cdf0e10cSrcweir 
67cdf0e10cSrcweir class ImpSdrGDIMetaFileImport
68cdf0e10cSrcweir {
69cdf0e10cSrcweir protected:
70cdf0e10cSrcweir 	SdrObjRefList				aTmpList;
71cdf0e10cSrcweir 	VirtualDevice				aVD;
72cdf0e10cSrcweir 	Rectangle					aScaleRect;
73cdf0e10cSrcweir 	sal_uLong						nMapScalingOfs; // ab hier nocht nicht mit MapScaling bearbeitet
74cdf0e10cSrcweir 	SfxItemSet*					pLineAttr;
75cdf0e10cSrcweir 	SfxItemSet*					pFillAttr;
76cdf0e10cSrcweir 	SfxItemSet*					pTextAttr;
77cdf0e10cSrcweir 	SdrPage*					pPage;
78cdf0e10cSrcweir 	SdrModel*					pModel;
79cdf0e10cSrcweir 	SdrLayerID					nLayer;
80cdf0e10cSrcweir 	Color						aOldLineColor;
81cdf0e10cSrcweir 	sal_Int32					nLineWidth;
82cdf0e10cSrcweir 	basegfx::B2DLineJoin		maLineJoin;
83*5aaf853bSArmin Le Grand 	com::sun::star::drawing::LineCap    maLineCap;
84cdf0e10cSrcweir 	XDash						maDash;
85cdf0e10cSrcweir 
86cdf0e10cSrcweir 	sal_Bool					bMov;
87cdf0e10cSrcweir 	sal_Bool					bSize;
88cdf0e10cSrcweir 	Point						aOfs;
89cdf0e10cSrcweir     double                      fScaleX;
90cdf0e10cSrcweir     double                      fScaleY;
91cdf0e10cSrcweir 	Fraction					aScaleX;
92cdf0e10cSrcweir 	Fraction					aScaleY;
93cdf0e10cSrcweir 
94cdf0e10cSrcweir 	sal_Bool                    bFntDirty;
95cdf0e10cSrcweir 
96cdf0e10cSrcweir 	// fuer Optimierung von (PenNULL,Brush,DrawPoly),(Pen,BrushNULL,DrawPoly) -> aus 2 mach ein
97cdf0e10cSrcweir 	sal_Bool                    bLastObjWasPolyWithoutLine;
98cdf0e10cSrcweir 	sal_Bool                    bNoLine;
99cdf0e10cSrcweir 	sal_Bool                    bNoFill;
100cdf0e10cSrcweir 
101cdf0e10cSrcweir 	// fuer Optimierung mehrerer Linien zu einer Polyline
102cdf0e10cSrcweir 	sal_Bool                    bLastObjWasLine;
103cdf0e10cSrcweir 
104cdf0e10cSrcweir protected:
105cdf0e10cSrcweir 	void DoAction(MetaPixelAction			& rAct);
106cdf0e10cSrcweir 	void DoAction(MetaPointAction			& rAct);
107cdf0e10cSrcweir 	void DoAction(MetaLineAction			& rAct);
108cdf0e10cSrcweir 	void DoAction(MetaRectAction			& rAct);
109cdf0e10cSrcweir 	void DoAction(MetaRoundRectAction		& rAct);
110cdf0e10cSrcweir 	void DoAction(MetaEllipseAction			& rAct);
111cdf0e10cSrcweir 	void DoAction(MetaArcAction				& rAct);
112cdf0e10cSrcweir 	void DoAction(MetaPieAction				& rAct);
113cdf0e10cSrcweir 	void DoAction(MetaChordAction			& rAct);
114cdf0e10cSrcweir 	void DoAction(MetaPolyLineAction		& rAct);
115cdf0e10cSrcweir 	void DoAction(MetaPolygonAction			& rAct);
116cdf0e10cSrcweir 	void DoAction(MetaPolyPolygonAction		& rAct);
117cdf0e10cSrcweir 	void DoAction(MetaTextAction			& rAct);
118cdf0e10cSrcweir 	void DoAction(MetaTextArrayAction		& rAct);
119cdf0e10cSrcweir 	void DoAction(MetaStretchTextAction		& rAct);
120cdf0e10cSrcweir 	void DoAction(MetaBmpAction				& rAct);
121cdf0e10cSrcweir 	void DoAction(MetaBmpScaleAction		& rAct);
122cdf0e10cSrcweir 	void DoAction(MetaBmpExAction			& rAct);
123cdf0e10cSrcweir 	void DoAction(MetaBmpExScaleAction		& rAct);
124cdf0e10cSrcweir 	void DoAction(MetaHatchAction			& rAct);
125cdf0e10cSrcweir 	void DoAction(MetaLineColorAction		& rAct);
126cdf0e10cSrcweir 	void DoAction(MetaMapModeAction			& rAct);
127cdf0e10cSrcweir 	void DoAction(MetaFillColorAction		& rAct) { rAct.Execute(&aVD); }
128cdf0e10cSrcweir 	void DoAction(MetaTextColorAction		& rAct) { rAct.Execute(&aVD); }
129cdf0e10cSrcweir 	void DoAction(MetaTextFillColorAction	& rAct) { rAct.Execute(&aVD); }
130cdf0e10cSrcweir 	void DoAction(MetaFontAction			& rAct) { rAct.Execute(&aVD); bFntDirty=sal_True; }
131cdf0e10cSrcweir 	void DoAction(MetaTextAlignAction		& rAct) { rAct.Execute(&aVD); bFntDirty=sal_True; }
132cdf0e10cSrcweir 	void DoAction(MetaClipRegionAction		& rAct) { rAct.Execute(&aVD); }
133cdf0e10cSrcweir 	void DoAction(MetaRasterOpAction		& rAct) { rAct.Execute(&aVD); }
134cdf0e10cSrcweir 	void DoAction(MetaPushAction			& rAct) { rAct.Execute(&aVD); }
135cdf0e10cSrcweir 	void DoAction(MetaPopAction				& rAct) { rAct.Execute(&aVD); bFntDirty=sal_True; }
136cdf0e10cSrcweir 	void DoAction(MetaMoveClipRegionAction	& rAct) { rAct.Execute(&aVD); }
137cdf0e10cSrcweir 	void DoAction(MetaISectRectClipRegionAction& rAct) { rAct.Execute(&aVD); }
138cdf0e10cSrcweir 	void DoAction(MetaISectRegionClipRegionAction& rAct) { rAct.Execute(&aVD); }
139cdf0e10cSrcweir 	void DoAction(MetaCommentAction& rAct, GDIMetaFile* pMtf);
140cdf0e10cSrcweir 
141cdf0e10cSrcweir 	void ImportText( const Point& rPos, const XubString& rStr, const MetaAction& rAct );
142cdf0e10cSrcweir 	void SetAttributes(SdrObject* pObj, FASTBOOL bForceTextAttr=sal_False);
143cdf0e10cSrcweir 	void InsertObj( SdrObject* pObj, sal_Bool bScale = sal_True );
144cdf0e10cSrcweir 	void MapScaling();
145cdf0e10cSrcweir 
146cdf0e10cSrcweir 	// #i73407# reformulation to use new B2DPolygon classes
147cdf0e10cSrcweir 	bool CheckLastLineMerge(const basegfx::B2DPolygon& rSrcPoly);
148cdf0e10cSrcweir 	bool CheckLastPolyLineAndFillMerge(const basegfx::B2DPolyPolygon& rPolyPolygon);
149cdf0e10cSrcweir 
150cdf0e10cSrcweir public:
151cdf0e10cSrcweir 	ImpSdrGDIMetaFileImport(SdrModel& rModel);
152cdf0e10cSrcweir 	~ImpSdrGDIMetaFileImport();
153cdf0e10cSrcweir 	sal_uLong DoImport(const GDIMetaFile& rMtf, SdrObjList& rDestList, sal_uLong nInsPos=CONTAINER_APPEND, SvdProgressInfo *pProgrInfo = NULL);
154cdf0e10cSrcweir 	void SetLayer(SdrLayerID nLay) { nLayer=nLay; }
155cdf0e10cSrcweir 	SdrLayerID GetLayer() const { return nLayer; }
156cdf0e10cSrcweir 	void SetScaleRect(const Rectangle& rRect) { aScaleRect=rRect; }
157cdf0e10cSrcweir 	const Rectangle& GetScaleRect() const { return aScaleRect; }
158cdf0e10cSrcweir };
159cdf0e10cSrcweir 
160cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
161cdf0e10cSrcweir 
162cdf0e10cSrcweir #endif //_SVDFMTF_HXX
163cdf0e10cSrcweir // eof
164