xref: /trunk/main/svx/source/svdraw/svdfmtf.hxx (revision cdf0e10c)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir #ifndef _SVDFMTF_HXX
29*cdf0e10cSrcweir #define _SVDFMTF_HXX
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include <vcl/metaact.hxx>
32*cdf0e10cSrcweir #include <vcl/virdev.hxx>
33*cdf0e10cSrcweir #include <svx/svdobj.hxx>
34*cdf0e10cSrcweir 
35*cdf0e10cSrcweir //************************************************************
36*cdf0e10cSrcweir //   Vorausdeklarationen
37*cdf0e10cSrcweir //************************************************************
38*cdf0e10cSrcweir 
39*cdf0e10cSrcweir class SfxItemSet;
40*cdf0e10cSrcweir class SdrObjList;
41*cdf0e10cSrcweir class SdrModel;
42*cdf0e10cSrcweir class SdrPage;
43*cdf0e10cSrcweir class SdrObject;
44*cdf0e10cSrcweir class SvdProgressInfo;
45*cdf0e10cSrcweir 
46*cdf0e10cSrcweir //************************************************************
47*cdf0e10cSrcweir //   Hilfsklasse SdrObjRefList
48*cdf0e10cSrcweir //************************************************************
49*cdf0e10cSrcweir 
50*cdf0e10cSrcweir class SdrObjRefList
51*cdf0e10cSrcweir {
52*cdf0e10cSrcweir 	Container					aList;
53*cdf0e10cSrcweir public:
54*cdf0e10cSrcweir 
55*cdf0e10cSrcweir 	SdrObjRefList()
56*cdf0e10cSrcweir 	:	aList(1024,64,64)
57*cdf0e10cSrcweir 	{}
58*cdf0e10cSrcweir 
59*cdf0e10cSrcweir 	void Clear() { aList.Clear(); }
60*cdf0e10cSrcweir 	sal_uLong GetObjCount() const { return aList.Count(); }
61*cdf0e10cSrcweir 	SdrObject* GetObj(sal_uLong nNum) const { return (SdrObject*)aList.GetObject(nNum); }
62*cdf0e10cSrcweir 	SdrObject* operator[](sal_uLong nNum) const { return (SdrObject*)aList.GetObject(nNum); }
63*cdf0e10cSrcweir 	void InsertObject(SdrObject* pObj, sal_uLong nPos=CONTAINER_APPEND) { aList.Insert(pObj,nPos); }
64*cdf0e10cSrcweir 	void RemoveObject(sal_uLong nPos) { aList.Remove(nPos); }
65*cdf0e10cSrcweir };
66*cdf0e10cSrcweir 
67*cdf0e10cSrcweir //************************************************************
68*cdf0e10cSrcweir //   Hilfsklasse ImpSdrGDIMetaFileImport
69*cdf0e10cSrcweir //************************************************************
70*cdf0e10cSrcweir 
71*cdf0e10cSrcweir class ImpSdrGDIMetaFileImport
72*cdf0e10cSrcweir {
73*cdf0e10cSrcweir protected:
74*cdf0e10cSrcweir 	SdrObjRefList				aTmpList;
75*cdf0e10cSrcweir 	VirtualDevice				aVD;
76*cdf0e10cSrcweir 	Rectangle					aScaleRect;
77*cdf0e10cSrcweir 	sal_uLong						nMapScalingOfs; // ab hier nocht nicht mit MapScaling bearbeitet
78*cdf0e10cSrcweir 	SfxItemSet*					pLineAttr;
79*cdf0e10cSrcweir 	SfxItemSet*					pFillAttr;
80*cdf0e10cSrcweir 	SfxItemSet*					pTextAttr;
81*cdf0e10cSrcweir 	SdrPage*					pPage;
82*cdf0e10cSrcweir 	SdrModel*					pModel;
83*cdf0e10cSrcweir 	SdrLayerID					nLayer;
84*cdf0e10cSrcweir 	Color						aOldLineColor;
85*cdf0e10cSrcweir 	sal_Int32					nLineWidth;
86*cdf0e10cSrcweir 	basegfx::B2DLineJoin		maLineJoin;
87*cdf0e10cSrcweir 	XDash						maDash;
88*cdf0e10cSrcweir 
89*cdf0e10cSrcweir 	sal_Bool					bMov;
90*cdf0e10cSrcweir 	sal_Bool					bSize;
91*cdf0e10cSrcweir 	Point						aOfs;
92*cdf0e10cSrcweir     double                      fScaleX;
93*cdf0e10cSrcweir     double                      fScaleY;
94*cdf0e10cSrcweir 	Fraction					aScaleX;
95*cdf0e10cSrcweir 	Fraction					aScaleY;
96*cdf0e10cSrcweir 
97*cdf0e10cSrcweir 	sal_Bool                    bFntDirty;
98*cdf0e10cSrcweir 
99*cdf0e10cSrcweir 	// fuer Optimierung von (PenNULL,Brush,DrawPoly),(Pen,BrushNULL,DrawPoly) -> aus 2 mach ein
100*cdf0e10cSrcweir 	sal_Bool                    bLastObjWasPolyWithoutLine;
101*cdf0e10cSrcweir 	sal_Bool                    bNoLine;
102*cdf0e10cSrcweir 	sal_Bool                    bNoFill;
103*cdf0e10cSrcweir 
104*cdf0e10cSrcweir 	// fuer Optimierung mehrerer Linien zu einer Polyline
105*cdf0e10cSrcweir 	sal_Bool                    bLastObjWasLine;
106*cdf0e10cSrcweir 
107*cdf0e10cSrcweir protected:
108*cdf0e10cSrcweir 	void DoAction(MetaPixelAction			& rAct);
109*cdf0e10cSrcweir 	void DoAction(MetaPointAction			& rAct);
110*cdf0e10cSrcweir 	void DoAction(MetaLineAction			& rAct);
111*cdf0e10cSrcweir 	void DoAction(MetaRectAction			& rAct);
112*cdf0e10cSrcweir 	void DoAction(MetaRoundRectAction		& rAct);
113*cdf0e10cSrcweir 	void DoAction(MetaEllipseAction			& rAct);
114*cdf0e10cSrcweir 	void DoAction(MetaArcAction				& rAct);
115*cdf0e10cSrcweir 	void DoAction(MetaPieAction				& rAct);
116*cdf0e10cSrcweir 	void DoAction(MetaChordAction			& rAct);
117*cdf0e10cSrcweir 	void DoAction(MetaPolyLineAction		& rAct);
118*cdf0e10cSrcweir 	void DoAction(MetaPolygonAction			& rAct);
119*cdf0e10cSrcweir 	void DoAction(MetaPolyPolygonAction		& rAct);
120*cdf0e10cSrcweir 	void DoAction(MetaTextAction			& rAct);
121*cdf0e10cSrcweir 	void DoAction(MetaTextArrayAction		& rAct);
122*cdf0e10cSrcweir 	void DoAction(MetaStretchTextAction		& rAct);
123*cdf0e10cSrcweir 	void DoAction(MetaBmpAction				& rAct);
124*cdf0e10cSrcweir 	void DoAction(MetaBmpScaleAction		& rAct);
125*cdf0e10cSrcweir 	void DoAction(MetaBmpExAction			& rAct);
126*cdf0e10cSrcweir 	void DoAction(MetaBmpExScaleAction		& rAct);
127*cdf0e10cSrcweir 	void DoAction(MetaHatchAction			& rAct);
128*cdf0e10cSrcweir 	void DoAction(MetaLineColorAction		& rAct);
129*cdf0e10cSrcweir 	void DoAction(MetaMapModeAction			& rAct);
130*cdf0e10cSrcweir 	void DoAction(MetaFillColorAction		& rAct) { rAct.Execute(&aVD); }
131*cdf0e10cSrcweir 	void DoAction(MetaTextColorAction		& rAct) { rAct.Execute(&aVD); }
132*cdf0e10cSrcweir 	void DoAction(MetaTextFillColorAction	& rAct) { rAct.Execute(&aVD); }
133*cdf0e10cSrcweir 	void DoAction(MetaFontAction			& rAct) { rAct.Execute(&aVD); bFntDirty=sal_True; }
134*cdf0e10cSrcweir 	void DoAction(MetaTextAlignAction		& rAct) { rAct.Execute(&aVD); bFntDirty=sal_True; }
135*cdf0e10cSrcweir 	void DoAction(MetaClipRegionAction		& rAct) { rAct.Execute(&aVD); }
136*cdf0e10cSrcweir 	void DoAction(MetaRasterOpAction		& rAct) { rAct.Execute(&aVD); }
137*cdf0e10cSrcweir 	void DoAction(MetaPushAction			& rAct) { rAct.Execute(&aVD); }
138*cdf0e10cSrcweir 	void DoAction(MetaPopAction				& rAct) { rAct.Execute(&aVD); bFntDirty=sal_True; }
139*cdf0e10cSrcweir 	void DoAction(MetaMoveClipRegionAction	& rAct) { rAct.Execute(&aVD); }
140*cdf0e10cSrcweir 	void DoAction(MetaISectRectClipRegionAction& rAct) { rAct.Execute(&aVD); }
141*cdf0e10cSrcweir 	void DoAction(MetaISectRegionClipRegionAction& rAct) { rAct.Execute(&aVD); }
142*cdf0e10cSrcweir 	void DoAction(MetaCommentAction& rAct, GDIMetaFile* pMtf);
143*cdf0e10cSrcweir 	void DoAction(MetaRenderGraphicAction& rAct);
144*cdf0e10cSrcweir 
145*cdf0e10cSrcweir 	void ImportText( const Point& rPos, const XubString& rStr, const MetaAction& rAct );
146*cdf0e10cSrcweir 	void SetAttributes(SdrObject* pObj, FASTBOOL bForceTextAttr=sal_False);
147*cdf0e10cSrcweir 	void InsertObj( SdrObject* pObj, sal_Bool bScale = sal_True );
148*cdf0e10cSrcweir 	void MapScaling();
149*cdf0e10cSrcweir 
150*cdf0e10cSrcweir 	// #i73407# reformulation to use new B2DPolygon classes
151*cdf0e10cSrcweir 	bool CheckLastLineMerge(const basegfx::B2DPolygon& rSrcPoly);
152*cdf0e10cSrcweir 	bool CheckLastPolyLineAndFillMerge(const basegfx::B2DPolyPolygon& rPolyPolygon);
153*cdf0e10cSrcweir 
154*cdf0e10cSrcweir public:
155*cdf0e10cSrcweir 	ImpSdrGDIMetaFileImport(SdrModel& rModel);
156*cdf0e10cSrcweir 	~ImpSdrGDIMetaFileImport();
157*cdf0e10cSrcweir 	sal_uLong DoImport(const GDIMetaFile& rMtf, SdrObjList& rDestList, sal_uLong nInsPos=CONTAINER_APPEND, SvdProgressInfo *pProgrInfo = NULL);
158*cdf0e10cSrcweir 	void SetLayer(SdrLayerID nLay) { nLayer=nLay; }
159*cdf0e10cSrcweir 	SdrLayerID GetLayer() const { return nLayer; }
160*cdf0e10cSrcweir 	void SetScaleRect(const Rectangle& rRect) { aScaleRect=rRect; }
161*cdf0e10cSrcweir 	const Rectangle& GetScaleRect() const { return aScaleRect; }
162*cdf0e10cSrcweir };
163*cdf0e10cSrcweir 
164*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
165*cdf0e10cSrcweir 
166*cdf0e10cSrcweir #endif //_SVDFMTF_HXX
167*cdf0e10cSrcweir // eof
168