xref: /aoo41x/main/svx/source/svdraw/svdfmtf.cxx (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 // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_svx.hxx"
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include "svdfmtf.hxx"
32*cdf0e10cSrcweir #include <editeng/editdata.hxx>
33*cdf0e10cSrcweir #include <math.h>
34*cdf0e10cSrcweir #include <svx/xpoly.hxx>
35*cdf0e10cSrcweir #include <vcl/svapp.hxx>
36*cdf0e10cSrcweir #include <editeng/eeitem.hxx>
37*cdf0e10cSrcweir #include <editeng/fhgtitem.hxx>
38*cdf0e10cSrcweir #include <editeng/wghtitem.hxx>
39*cdf0e10cSrcweir #include <editeng/postitem.hxx>
40*cdf0e10cSrcweir #include <editeng/udlnitem.hxx>
41*cdf0e10cSrcweir #include <editeng/crsditem.hxx>
42*cdf0e10cSrcweir #include <editeng/shdditem.hxx>
43*cdf0e10cSrcweir #include <svx/xlnclit.hxx>
44*cdf0e10cSrcweir #include <svx/xlnwtit.hxx>
45*cdf0e10cSrcweir #include <svx/xflclit.hxx>
46*cdf0e10cSrcweir #include <svx/xgrad.hxx>
47*cdf0e10cSrcweir #include <svx/xflgrit.hxx>
48*cdf0e10cSrcweir #include <editeng/fontitem.hxx>
49*cdf0e10cSrcweir #include <editeng/akrnitem.hxx>
50*cdf0e10cSrcweir #include <editeng/wrlmitem.hxx>
51*cdf0e10cSrcweir #include <editeng/cntritem.hxx>
52*cdf0e10cSrcweir #include <editeng/colritem.hxx>
53*cdf0e10cSrcweir #include <vcl/metric.hxx>
54*cdf0e10cSrcweir #include <editeng/charscaleitem.hxx>
55*cdf0e10cSrcweir #include <svx/xflhtit.hxx>
56*cdf0e10cSrcweir #include <svx/svdattr.hxx>
57*cdf0e10cSrcweir #include <svx/svdmodel.hxx>
58*cdf0e10cSrcweir #include <svx/svdpage.hxx>
59*cdf0e10cSrcweir #include <svx/svdobj.hxx>
60*cdf0e10cSrcweir #include "svx/svditext.hxx"
61*cdf0e10cSrcweir #include <svx/svdotext.hxx>
62*cdf0e10cSrcweir #include <svx/svdorect.hxx>
63*cdf0e10cSrcweir #include <svx/svdocirc.hxx>
64*cdf0e10cSrcweir #include <svx/svdograf.hxx>
65*cdf0e10cSrcweir #include <svx/svdopath.hxx>
66*cdf0e10cSrcweir #include <svx/svdetc.hxx>
67*cdf0e10cSrcweir #include <svl/itemset.hxx>
68*cdf0e10cSrcweir #include <basegfx/polygon/b2dpolygon.hxx>
69*cdf0e10cSrcweir #include <vcl/salbtype.hxx>		// FRound
70*cdf0e10cSrcweir #include <basegfx/matrix/b2dhommatrix.hxx>
71*cdf0e10cSrcweir #include <basegfx/matrix/b2dhommatrixtools.hxx>
72*cdf0e10cSrcweir #include <svx/xlinjoit.hxx>
73*cdf0e10cSrcweir #include <svx/xlndsit.hxx>
74*cdf0e10cSrcweir 
75*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
76*cdf0e10cSrcweir 
77*cdf0e10cSrcweir ImpSdrGDIMetaFileImport::ImpSdrGDIMetaFileImport(SdrModel& rModel):
78*cdf0e10cSrcweir 	nMapScalingOfs(0),
79*cdf0e10cSrcweir 	pLineAttr(NULL),pFillAttr(NULL),pTextAttr(NULL),
80*cdf0e10cSrcweir 	pPage(NULL),pModel(NULL),nLayer(0),
81*cdf0e10cSrcweir 	nLineWidth(0),
82*cdf0e10cSrcweir 	maLineJoin(basegfx::B2DLINEJOIN_NONE),
83*cdf0e10cSrcweir 	maDash(XDASH_RECT, 0, 0, 0, 0, 0),
84*cdf0e10cSrcweir 	bFntDirty(sal_True),
85*cdf0e10cSrcweir 	bLastObjWasPolyWithoutLine(sal_False),bNoLine(sal_False),bNoFill(sal_False),bLastObjWasLine(sal_False)
86*cdf0e10cSrcweir {
87*cdf0e10cSrcweir 	aVD.EnableOutput(sal_False);
88*cdf0e10cSrcweir 
89*cdf0e10cSrcweir     // #i111954# init to no fill and no line initially
90*cdf0e10cSrcweir     aVD.SetLineColor();
91*cdf0e10cSrcweir     aVD.SetFillColor();
92*cdf0e10cSrcweir 
93*cdf0e10cSrcweir 	aOldLineColor.SetRed( aVD.GetLineColor().GetRed() + 1 ); // invalidate old line color
94*cdf0e10cSrcweir 	pLineAttr=new SfxItemSet(rModel.GetItemPool(),XATTR_LINE_FIRST,XATTR_LINE_LAST);
95*cdf0e10cSrcweir 	pFillAttr=new SfxItemSet(rModel.GetItemPool(),XATTR_FILL_FIRST,XATTR_FILL_LAST);
96*cdf0e10cSrcweir 	pTextAttr=new SfxItemSet(rModel.GetItemPool(),EE_ITEMS_START,EE_ITEMS_END);
97*cdf0e10cSrcweir 	pModel=&rModel;
98*cdf0e10cSrcweir }
99*cdf0e10cSrcweir 
100*cdf0e10cSrcweir ImpSdrGDIMetaFileImport::~ImpSdrGDIMetaFileImport()
101*cdf0e10cSrcweir {
102*cdf0e10cSrcweir 	delete pLineAttr;
103*cdf0e10cSrcweir 	delete pFillAttr;
104*cdf0e10cSrcweir 	delete pTextAttr;
105*cdf0e10cSrcweir }
106*cdf0e10cSrcweir 
107*cdf0e10cSrcweir sal_uIntPtr ImpSdrGDIMetaFileImport::DoImport(const GDIMetaFile& rMtf,
108*cdf0e10cSrcweir 	SdrObjList& rOL,
109*cdf0e10cSrcweir 	sal_uIntPtr nInsPos,
110*cdf0e10cSrcweir 	SvdProgressInfo *pProgrInfo)
111*cdf0e10cSrcweir {
112*cdf0e10cSrcweir 	pPage = rOL.GetPage();
113*cdf0e10cSrcweir 	GDIMetaFile* pTmpMtf=NULL;
114*cdf0e10cSrcweir 	GDIMetaFile* pMtf = (GDIMetaFile*) &rMtf;
115*cdf0e10cSrcweir 	sal_uIntPtr nActionAnz=pMtf->GetActionCount();
116*cdf0e10cSrcweir 	sal_Bool bError = sal_False;
117*cdf0e10cSrcweir 
118*cdf0e10cSrcweir 
119*cdf0e10cSrcweir 	// setup some global scale parameter
120*cdf0e10cSrcweir 	// fScaleX, fScaleY, aScaleX, aScaleY, bMov, bSize
121*cdf0e10cSrcweir     fScaleX = fScaleY = 1.0;
122*cdf0e10cSrcweir 	Size  aMtfSize( pMtf->GetPrefSize() );
123*cdf0e10cSrcweir 	if ( aMtfSize.Width() & aMtfSize.Height() && ( aScaleRect.IsEmpty() == sal_False ) )
124*cdf0e10cSrcweir     {
125*cdf0e10cSrcweir 		aOfs = aScaleRect.TopLeft();
126*cdf0e10cSrcweir         if ( aMtfSize.Width() != ( aScaleRect.GetWidth() - 1 ) )
127*cdf0e10cSrcweir             fScaleX = (double)( aScaleRect.GetWidth() - 1 ) / (double)aMtfSize.Width();
128*cdf0e10cSrcweir         if ( aMtfSize.Height() != ( aScaleRect.GetHeight() - 1 ) )
129*cdf0e10cSrcweir             fScaleY = (double)( aScaleRect.GetHeight() - 1 ) / (double)aMtfSize.Height();
130*cdf0e10cSrcweir     }
131*cdf0e10cSrcweir 
132*cdf0e10cSrcweir 	bMov = aOfs.X()!=0 || aOfs.Y()!=0;
133*cdf0e10cSrcweir     bSize = sal_False;
134*cdf0e10cSrcweir 
135*cdf0e10cSrcweir 	aScaleX = Fraction( 1, 1 );
136*cdf0e10cSrcweir 	aScaleY = Fraction( 1, 1 );
137*cdf0e10cSrcweir     if ( aMtfSize.Width() != ( aScaleRect.GetWidth() - 1 ) )
138*cdf0e10cSrcweir     {
139*cdf0e10cSrcweir         aScaleX = Fraction( aScaleRect.GetWidth() - 1, aMtfSize.Width() );
140*cdf0e10cSrcweir         bSize = sal_True;
141*cdf0e10cSrcweir     }
142*cdf0e10cSrcweir     if ( aMtfSize.Height() != ( aScaleRect.GetHeight() - 1 ) )
143*cdf0e10cSrcweir     {
144*cdf0e10cSrcweir         aScaleY = Fraction( aScaleRect.GetHeight() - 1, aMtfSize.Height() );
145*cdf0e10cSrcweir         bSize = sal_True;
146*cdf0e10cSrcweir     }
147*cdf0e10cSrcweir 
148*cdf0e10cSrcweir 	if(65000 < nActionAnz)
149*cdf0e10cSrcweir 	{
150*cdf0e10cSrcweir 		nActionAnz = 65000;
151*cdf0e10cSrcweir 		bError = sal_True;
152*cdf0e10cSrcweir 	}
153*cdf0e10cSrcweir 
154*cdf0e10cSrcweir 	if(pProgrInfo)
155*cdf0e10cSrcweir 		pProgrInfo->SetActionCount(nActionAnz);
156*cdf0e10cSrcweir 
157*cdf0e10cSrcweir 	sal_uIntPtr nActionsToReport = 0;
158*cdf0e10cSrcweir 
159*cdf0e10cSrcweir 	for( MetaAction* pAct = pMtf->FirstAction(); pAct; pAct = pMtf->NextAction() )
160*cdf0e10cSrcweir 	{
161*cdf0e10cSrcweir 		switch (pAct->GetType())
162*cdf0e10cSrcweir 		{
163*cdf0e10cSrcweir 			case META_PIXEL_ACTION          : DoAction((MetaPixelAction          &)*pAct); break;
164*cdf0e10cSrcweir 			case META_POINT_ACTION          : DoAction((MetaPointAction          &)*pAct); break;
165*cdf0e10cSrcweir 			case META_LINE_ACTION           : DoAction((MetaLineAction           &)*pAct); break;
166*cdf0e10cSrcweir 			case META_RECT_ACTION           : DoAction((MetaRectAction           &)*pAct); break;
167*cdf0e10cSrcweir 			case META_ROUNDRECT_ACTION      : DoAction((MetaRoundRectAction      &)*pAct); break;
168*cdf0e10cSrcweir 			case META_ELLIPSE_ACTION        : DoAction((MetaEllipseAction        &)*pAct); break;
169*cdf0e10cSrcweir 			case META_ARC_ACTION            : DoAction((MetaArcAction            &)*pAct); break;
170*cdf0e10cSrcweir 			case META_PIE_ACTION            : DoAction((MetaPieAction            &)*pAct); break;
171*cdf0e10cSrcweir 			case META_CHORD_ACTION          : DoAction((MetaChordAction          &)*pAct); break;
172*cdf0e10cSrcweir 			case META_POLYLINE_ACTION	    : DoAction((MetaPolyLineAction		 &)*pAct); break;
173*cdf0e10cSrcweir 			case META_POLYGON_ACTION        : DoAction((MetaPolygonAction        &)*pAct); break;
174*cdf0e10cSrcweir 			case META_POLYPOLYGON_ACTION    : DoAction((MetaPolyPolygonAction    &)*pAct); break;
175*cdf0e10cSrcweir 			case META_TEXT_ACTION           : DoAction((MetaTextAction           &)*pAct); break;
176*cdf0e10cSrcweir 			case META_TEXTARRAY_ACTION      : DoAction((MetaTextArrayAction      &)*pAct); break;
177*cdf0e10cSrcweir 			case META_STRETCHTEXT_ACTION    : DoAction((MetaStretchTextAction    &)*pAct); break;
178*cdf0e10cSrcweir 			case META_BMP_ACTION			: DoAction((MetaBmpAction			 &)*pAct); break;
179*cdf0e10cSrcweir 			case META_BMPSCALE_ACTION		: DoAction((MetaBmpScaleAction		 &)*pAct); break;
180*cdf0e10cSrcweir 			case META_BMPEX_ACTION			: DoAction((MetaBmpExAction			 &)*pAct); break;
181*cdf0e10cSrcweir 			case META_BMPEXSCALE_ACTION		: DoAction((MetaBmpExScaleAction	 &)*pAct); break;
182*cdf0e10cSrcweir 			case META_LINECOLOR_ACTION      : DoAction((MetaLineColorAction      &)*pAct); break;
183*cdf0e10cSrcweir 			case META_FILLCOLOR_ACTION      : DoAction((MetaFillColorAction      &)*pAct); break;
184*cdf0e10cSrcweir 			case META_TEXTCOLOR_ACTION      : DoAction((MetaTextColorAction      &)*pAct); break;
185*cdf0e10cSrcweir 			case META_TEXTFILLCOLOR_ACTION  : DoAction((MetaTextFillColorAction  &)*pAct); break;
186*cdf0e10cSrcweir 			case META_FONT_ACTION           : DoAction((MetaFontAction           &)*pAct); break;
187*cdf0e10cSrcweir 			case META_TEXTALIGN_ACTION		: DoAction((MetaTextAlignAction		 &)*pAct); break;
188*cdf0e10cSrcweir 			case META_MAPMODE_ACTION        : DoAction((MetaMapModeAction        &)*pAct); break;
189*cdf0e10cSrcweir 			case META_CLIPREGION_ACTION     : DoAction((MetaClipRegionAction     &)*pAct); break;
190*cdf0e10cSrcweir 			case META_MOVECLIPREGION_ACTION : DoAction((MetaMoveClipRegionAction &)*pAct); break;
191*cdf0e10cSrcweir 			case META_ISECTRECTCLIPREGION_ACTION: DoAction((MetaISectRectClipRegionAction&)*pAct); break;
192*cdf0e10cSrcweir 			case META_ISECTREGIONCLIPREGION_ACTION: DoAction((MetaISectRegionClipRegionAction&)*pAct); break;
193*cdf0e10cSrcweir 			case META_RASTEROP_ACTION       : DoAction((MetaRasterOpAction       &)*pAct); break;
194*cdf0e10cSrcweir 			case META_PUSH_ACTION           : DoAction((MetaPushAction           &)*pAct); break;
195*cdf0e10cSrcweir 			case META_POP_ACTION            : DoAction((MetaPopAction            &)*pAct); break;
196*cdf0e10cSrcweir 			case META_HATCH_ACTION			: DoAction((MetaHatchAction          &)*pAct); break;
197*cdf0e10cSrcweir 			case META_COMMENT_ACTION		: DoAction((MetaCommentAction        &)*pAct, pMtf); break;
198*cdf0e10cSrcweir             case META_RENDERGRAPHIC_ACTION  : DoAction((MetaRenderGraphicAction  &)*pAct); break;
199*cdf0e10cSrcweir 		}
200*cdf0e10cSrcweir 
201*cdf0e10cSrcweir 		if(pProgrInfo != NULL)
202*cdf0e10cSrcweir 		{
203*cdf0e10cSrcweir 		  nActionsToReport++;
204*cdf0e10cSrcweir 		  if(nActionsToReport >= 16) // Alle 16 Action updaten
205*cdf0e10cSrcweir 		  {
206*cdf0e10cSrcweir 			if(!pProgrInfo->ReportActions(nActionsToReport))
207*cdf0e10cSrcweir 			  break;
208*cdf0e10cSrcweir 			nActionsToReport = 0;
209*cdf0e10cSrcweir 		  }
210*cdf0e10cSrcweir 		}
211*cdf0e10cSrcweir 	}
212*cdf0e10cSrcweir 
213*cdf0e10cSrcweir 	if(pProgrInfo != NULL)
214*cdf0e10cSrcweir 	{
215*cdf0e10cSrcweir 		pProgrInfo->ReportActions(nActionsToReport);
216*cdf0e10cSrcweir 		nActionsToReport = 0;
217*cdf0e10cSrcweir 	}
218*cdf0e10cSrcweir 
219*cdf0e10cSrcweir 	// MapMode-Scaling  vornehmen
220*cdf0e10cSrcweir 	MapScaling();
221*cdf0e10cSrcweir 	// Objekte in vorgegebenes Rechteck hineinskalieren
222*cdf0e10cSrcweir 	sal_uIntPtr nAnz=aTmpList.GetObjCount();
223*cdf0e10cSrcweir 
224*cdf0e10cSrcweir 	// Beim berechnen der Fortschrittsanzeige wird GetActionCount()*3 benutzt.
225*cdf0e10cSrcweir 	// Da in aTmpList allerdings weniger eintraege als GetActionCount()
226*cdf0e10cSrcweir 	// existieren koennen, muessen hier die zuviel vermuteten Actionen wieder
227*cdf0e10cSrcweir 	// hinzugefuegt werden.
228*cdf0e10cSrcweir 	nActionsToReport = (pMtf->GetActionCount() - nAnz)*2;
229*cdf0e10cSrcweir 
230*cdf0e10cSrcweir 
231*cdf0e10cSrcweir 	// Alle noch nicht gemeldeten Rescales melden
232*cdf0e10cSrcweir 	if(pProgrInfo)
233*cdf0e10cSrcweir 	{
234*cdf0e10cSrcweir 		pProgrInfo->ReportRescales(nActionsToReport);
235*cdf0e10cSrcweir 		pProgrInfo->SetInsertCount(nAnz);
236*cdf0e10cSrcweir 	}
237*cdf0e10cSrcweir 	nActionsToReport = 0;
238*cdf0e10cSrcweir 
239*cdf0e10cSrcweir 	// alle in aTmpList zwischengespeicherten Objekte nun in rOL ab der Position nInsPos einfuegen
240*cdf0e10cSrcweir 	if (nInsPos>rOL.GetObjCount()) nInsPos=rOL.GetObjCount();
241*cdf0e10cSrcweir 	SdrInsertReason aReason(SDRREASON_VIEWCALL);
242*cdf0e10cSrcweir 	for (sal_uIntPtr i=0; i<nAnz; i++)
243*cdf0e10cSrcweir 	{
244*cdf0e10cSrcweir 		 SdrObject* pObj=aTmpList.GetObj(i);
245*cdf0e10cSrcweir 		 rOL.NbcInsertObject(pObj,nInsPos,&aReason);
246*cdf0e10cSrcweir 		 nInsPos++;
247*cdf0e10cSrcweir 
248*cdf0e10cSrcweir 		if(pProgrInfo != NULL)
249*cdf0e10cSrcweir 		{
250*cdf0e10cSrcweir 			nActionsToReport++;
251*cdf0e10cSrcweir 			if(nActionsToReport >= 32) // Alle 32 Action updaten
252*cdf0e10cSrcweir 			{
253*cdf0e10cSrcweir 				pProgrInfo->ReportInserts(nActionsToReport);
254*cdf0e10cSrcweir 				nActionsToReport = 0;
255*cdf0e10cSrcweir 			}
256*cdf0e10cSrcweir 		}
257*cdf0e10cSrcweir 	}
258*cdf0e10cSrcweir 	if (pTmpMtf!=NULL) delete pTmpMtf;
259*cdf0e10cSrcweir 
260*cdf0e10cSrcweir 	// ein letztesmal alle verbliebennen Inserts reporten
261*cdf0e10cSrcweir 	if(pProgrInfo != NULL)
262*cdf0e10cSrcweir 	{
263*cdf0e10cSrcweir 		pProgrInfo->ReportInserts(nActionsToReport);
264*cdf0e10cSrcweir 		if(bError)
265*cdf0e10cSrcweir 			pProgrInfo->ReportError();
266*cdf0e10cSrcweir 	}
267*cdf0e10cSrcweir 
268*cdf0e10cSrcweir 	return aTmpList.GetObjCount();
269*cdf0e10cSrcweir }
270*cdf0e10cSrcweir 
271*cdf0e10cSrcweir void ImpSdrGDIMetaFileImport::SetAttributes(SdrObject* pObj, FASTBOOL bForceTextAttr)
272*cdf0e10cSrcweir {
273*cdf0e10cSrcweir 	bNoLine = sal_False; bNoFill = sal_False;
274*cdf0e10cSrcweir 	FASTBOOL bLine=sal_True && !bForceTextAttr;
275*cdf0e10cSrcweir 	FASTBOOL bFill=pObj==NULL || ( pObj->IsClosedObj() && !bForceTextAttr );
276*cdf0e10cSrcweir 	FASTBOOL bText=bForceTextAttr || (pObj!=NULL && pObj->GetOutlinerParaObject()!=NULL);
277*cdf0e10cSrcweir 
278*cdf0e10cSrcweir 	if ( bLine )
279*cdf0e10cSrcweir 	{
280*cdf0e10cSrcweir 		if ( nLineWidth )
281*cdf0e10cSrcweir 			pLineAttr->Put( XLineWidthItem( nLineWidth ) );
282*cdf0e10cSrcweir         else
283*cdf0e10cSrcweir 			pLineAttr->Put( XLineWidthItem( 0 ) );
284*cdf0e10cSrcweir 
285*cdf0e10cSrcweir 		aOldLineColor = aVD.GetLineColor();
286*cdf0e10cSrcweir 		if( aVD.IsLineColor() )
287*cdf0e10cSrcweir 		{
288*cdf0e10cSrcweir 			pLineAttr->Put(XLineStyleItem(XLINE_SOLID));
289*cdf0e10cSrcweir 			pLineAttr->Put(XLineColorItem(String(), aVD.GetLineColor()));
290*cdf0e10cSrcweir 		}
291*cdf0e10cSrcweir 		else
292*cdf0e10cSrcweir 			pLineAttr->Put(XLineStyleItem(XLINE_NONE));
293*cdf0e10cSrcweir 
294*cdf0e10cSrcweir 		switch(maLineJoin)
295*cdf0e10cSrcweir 		{
296*cdf0e10cSrcweir 			default : // basegfx::B2DLINEJOIN_NONE
297*cdf0e10cSrcweir 				pLineAttr->Put(XLineJointItem(XLINEJOINT_NONE));
298*cdf0e10cSrcweir 				break;
299*cdf0e10cSrcweir 			case basegfx::B2DLINEJOIN_MIDDLE:
300*cdf0e10cSrcweir 				pLineAttr->Put(XLineJointItem(XLINEJOINT_MIDDLE));
301*cdf0e10cSrcweir 				break;
302*cdf0e10cSrcweir 			case basegfx::B2DLINEJOIN_BEVEL:
303*cdf0e10cSrcweir 				pLineAttr->Put(XLineJointItem(XLINEJOINT_BEVEL));
304*cdf0e10cSrcweir 				break;
305*cdf0e10cSrcweir 			case basegfx::B2DLINEJOIN_MITER:
306*cdf0e10cSrcweir 				pLineAttr->Put(XLineJointItem(XLINEJOINT_MITER));
307*cdf0e10cSrcweir 				break;
308*cdf0e10cSrcweir 			case basegfx::B2DLINEJOIN_ROUND:
309*cdf0e10cSrcweir 				pLineAttr->Put(XLineJointItem(XLINEJOINT_ROUND));
310*cdf0e10cSrcweir 				break;
311*cdf0e10cSrcweir 		}
312*cdf0e10cSrcweir 
313*cdf0e10cSrcweir 		if(((maDash.GetDots() && maDash.GetDotLen()) || (maDash.GetDashes() && maDash.GetDashLen())) && maDash.GetDistance())
314*cdf0e10cSrcweir 		{
315*cdf0e10cSrcweir 			pLineAttr->Put(XLineDashItem(String(), maDash));
316*cdf0e10cSrcweir 		}
317*cdf0e10cSrcweir         else
318*cdf0e10cSrcweir         {
319*cdf0e10cSrcweir 			pLineAttr->Put(XLineDashItem(String(), XDash(XDASH_RECT)));
320*cdf0e10cSrcweir         }
321*cdf0e10cSrcweir 	}
322*cdf0e10cSrcweir 	else
323*cdf0e10cSrcweir 		bNoLine = sal_True;
324*cdf0e10cSrcweir 
325*cdf0e10cSrcweir 	if ( bFill )
326*cdf0e10cSrcweir 	{
327*cdf0e10cSrcweir 		if( aVD.IsFillColor() )
328*cdf0e10cSrcweir 		{
329*cdf0e10cSrcweir 			pFillAttr->Put(XFillStyleItem(XFILL_SOLID));
330*cdf0e10cSrcweir 			pFillAttr->Put(XFillColorItem(String(), aVD.GetFillColor()));
331*cdf0e10cSrcweir 		}
332*cdf0e10cSrcweir 		else
333*cdf0e10cSrcweir 			pFillAttr->Put(XFillStyleItem(XFILL_NONE));
334*cdf0e10cSrcweir 	}
335*cdf0e10cSrcweir 	else
336*cdf0e10cSrcweir 		bNoFill = sal_True;
337*cdf0e10cSrcweir 
338*cdf0e10cSrcweir 	if ( bText && bFntDirty )
339*cdf0e10cSrcweir 	{
340*cdf0e10cSrcweir 		Font aFnt(aVD.GetFont());
341*cdf0e10cSrcweir 		pTextAttr->Put( SvxFontItem( aFnt.GetFamily(), aFnt.GetName(), aFnt.GetStyleName(),
342*cdf0e10cSrcweir 							aFnt.GetPitch(), aFnt.GetCharSet(), EE_CHAR_FONTINFO ) );
343*cdf0e10cSrcweir 		pTextAttr->Put( SvxFontItem( aFnt.GetFamily(), aFnt.GetName(), aFnt.GetStyleName(),
344*cdf0e10cSrcweir 							aFnt.GetPitch(), aFnt.GetCharSet(), EE_CHAR_FONTINFO_CJK ) );
345*cdf0e10cSrcweir 		pTextAttr->Put( SvxFontItem( aFnt.GetFamily(), aFnt.GetName(), aFnt.GetStyleName(),
346*cdf0e10cSrcweir 							aFnt.GetPitch(), aFnt.GetCharSet(), EE_CHAR_FONTINFO_CTL ) );
347*cdf0e10cSrcweir         pTextAttr->Put(SvxPostureItem(aFnt.GetItalic(), EE_CHAR_ITALIC));
348*cdf0e10cSrcweir         pTextAttr->Put(SvxWeightItem(aFnt.GetWeight(), EE_CHAR_WEIGHT));
349*cdf0e10cSrcweir 		sal_uInt32 nHeight = FRound(aFnt.GetSize().Height() * fScaleY);
350*cdf0e10cSrcweir 		pTextAttr->Put( SvxFontHeightItem( nHeight, 100, EE_CHAR_FONTHEIGHT ) );
351*cdf0e10cSrcweir 		pTextAttr->Put( SvxFontHeightItem( nHeight, 100, EE_CHAR_FONTHEIGHT_CJK ) );
352*cdf0e10cSrcweir 		pTextAttr->Put( SvxFontHeightItem( nHeight, 100, EE_CHAR_FONTHEIGHT_CTL ) );
353*cdf0e10cSrcweir         pTextAttr->Put(SvxCharScaleWidthItem(100, EE_CHAR_FONTWIDTH));
354*cdf0e10cSrcweir         pTextAttr->Put(SvxUnderlineItem(aFnt.GetUnderline(), EE_CHAR_UNDERLINE));
355*cdf0e10cSrcweir         pTextAttr->Put(SvxOverlineItem(aFnt.GetOverline(), EE_CHAR_OVERLINE));
356*cdf0e10cSrcweir         pTextAttr->Put(SvxCrossedOutItem(aFnt.GetStrikeout(), EE_CHAR_STRIKEOUT));
357*cdf0e10cSrcweir         pTextAttr->Put(SvxShadowedItem(aFnt.IsShadow(), EE_CHAR_SHADOW));
358*cdf0e10cSrcweir         pTextAttr->Put(SvxAutoKernItem(aFnt.IsKerning(), EE_CHAR_KERNING));
359*cdf0e10cSrcweir         pTextAttr->Put(SvxWordLineModeItem(aFnt.IsWordLineMode(), EE_CHAR_WLM));
360*cdf0e10cSrcweir         pTextAttr->Put(SvxContourItem(aFnt.IsOutline(), EE_CHAR_OUTLINE));
361*cdf0e10cSrcweir         pTextAttr->Put(SvxColorItem(aFnt.GetColor(), EE_CHAR_COLOR));
362*cdf0e10cSrcweir 		//... svxfont textitem svditext
363*cdf0e10cSrcweir 		bFntDirty=sal_False;
364*cdf0e10cSrcweir 	}
365*cdf0e10cSrcweir 	if (pObj!=NULL)
366*cdf0e10cSrcweir 	{
367*cdf0e10cSrcweir 		pObj->SetLayer(nLayer);
368*cdf0e10cSrcweir 		if (bLine) pObj->SetMergedItemSet(*pLineAttr);
369*cdf0e10cSrcweir 		if (bFill) pObj->SetMergedItemSet(*pFillAttr);
370*cdf0e10cSrcweir 		if (bText)
371*cdf0e10cSrcweir 		{
372*cdf0e10cSrcweir 			pObj->SetMergedItemSet(*pTextAttr);
373*cdf0e10cSrcweir 			pObj->SetMergedItem( SdrTextHorzAdjustItem( SDRTEXTHORZADJUST_LEFT ) );
374*cdf0e10cSrcweir 		}
375*cdf0e10cSrcweir 	}
376*cdf0e10cSrcweir }
377*cdf0e10cSrcweir 
378*cdf0e10cSrcweir void ImpSdrGDIMetaFileImport::InsertObj( SdrObject* pObj, sal_Bool bScale )
379*cdf0e10cSrcweir {
380*cdf0e10cSrcweir 	if ( bScale && !aScaleRect.IsEmpty() )
381*cdf0e10cSrcweir     {
382*cdf0e10cSrcweir 		if ( bSize )
383*cdf0e10cSrcweir 			pObj->NbcResize( Point(), aScaleX, aScaleY );
384*cdf0e10cSrcweir 		if ( bMov )
385*cdf0e10cSrcweir 			pObj->NbcMove( Size( aOfs.X(), aOfs.Y() ) );
386*cdf0e10cSrcweir 	}
387*cdf0e10cSrcweir 
388*cdf0e10cSrcweir     // #i111954# check object for visibility
389*cdf0e10cSrcweir     // used are SdrPathObj, SdrRectObj, SdrCircObj, SdrGrafObj
390*cdf0e10cSrcweir     bool bVisible(false);
391*cdf0e10cSrcweir 
392*cdf0e10cSrcweir     if(pObj->HasLineStyle())
393*cdf0e10cSrcweir     {
394*cdf0e10cSrcweir         bVisible = true;
395*cdf0e10cSrcweir     }
396*cdf0e10cSrcweir 
397*cdf0e10cSrcweir     if(!bVisible && pObj->HasFillStyle())
398*cdf0e10cSrcweir     {
399*cdf0e10cSrcweir         bVisible = true;
400*cdf0e10cSrcweir     }
401*cdf0e10cSrcweir 
402*cdf0e10cSrcweir     if(!bVisible)
403*cdf0e10cSrcweir     {
404*cdf0e10cSrcweir         SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >(pObj);
405*cdf0e10cSrcweir 
406*cdf0e10cSrcweir         if(pTextObj && pTextObj->HasText())
407*cdf0e10cSrcweir         {
408*cdf0e10cSrcweir             bVisible = true;
409*cdf0e10cSrcweir         }
410*cdf0e10cSrcweir     }
411*cdf0e10cSrcweir 
412*cdf0e10cSrcweir     if(!bVisible)
413*cdf0e10cSrcweir     {
414*cdf0e10cSrcweir         SdrGrafObj* pGrafObj = dynamic_cast< SdrGrafObj* >(pObj);
415*cdf0e10cSrcweir 
416*cdf0e10cSrcweir         if(pGrafObj)
417*cdf0e10cSrcweir         {
418*cdf0e10cSrcweir             // this may be refined to check if the graphic really is visible. It
419*cdf0e10cSrcweir             // is here to ensure that graphic objects without fill, line and text
420*cdf0e10cSrcweir             // get created
421*cdf0e10cSrcweir             bVisible = true;
422*cdf0e10cSrcweir         }
423*cdf0e10cSrcweir     }
424*cdf0e10cSrcweir 
425*cdf0e10cSrcweir     if(!bVisible)
426*cdf0e10cSrcweir     {
427*cdf0e10cSrcweir         SdrObject::Free(pObj);
428*cdf0e10cSrcweir     }
429*cdf0e10cSrcweir     else
430*cdf0e10cSrcweir     {
431*cdf0e10cSrcweir 	    aTmpList.InsertObject( pObj );
432*cdf0e10cSrcweir 	    if ( HAS_BASE( SdrPathObj, pObj ) )
433*cdf0e10cSrcweir 	    {
434*cdf0e10cSrcweir 		    FASTBOOL bClosed=pObj->IsClosedObj();
435*cdf0e10cSrcweir 		    bLastObjWasPolyWithoutLine=bNoLine && bClosed;
436*cdf0e10cSrcweir 		    bLastObjWasLine=!bClosed;
437*cdf0e10cSrcweir 	    }
438*cdf0e10cSrcweir 	    else
439*cdf0e10cSrcweir 	    {
440*cdf0e10cSrcweir 		    bLastObjWasPolyWithoutLine = sal_False;
441*cdf0e10cSrcweir 		    bLastObjWasLine = sal_False;
442*cdf0e10cSrcweir 	    }
443*cdf0e10cSrcweir     }
444*cdf0e10cSrcweir }
445*cdf0e10cSrcweir 
446*cdf0e10cSrcweir /**************************************************************************************************/
447*cdf0e10cSrcweir 
448*cdf0e10cSrcweir void ImpSdrGDIMetaFileImport::DoAction(MetaPixelAction& /*rAct*/)
449*cdf0e10cSrcweir {
450*cdf0e10cSrcweir }
451*cdf0e10cSrcweir 
452*cdf0e10cSrcweir void ImpSdrGDIMetaFileImport::DoAction(MetaPointAction& /*rAct*/)
453*cdf0e10cSrcweir {
454*cdf0e10cSrcweir }
455*cdf0e10cSrcweir 
456*cdf0e10cSrcweir void ImpSdrGDIMetaFileImport::DoAction(MetaLineAction& rAct)
457*cdf0e10cSrcweir {
458*cdf0e10cSrcweir 	// #i73407# reformulation to use new B2DPolygon classes
459*cdf0e10cSrcweir 	const basegfx::B2DPoint aStart(rAct.GetStartPoint().X(), rAct.GetStartPoint().Y());
460*cdf0e10cSrcweir 	const basegfx::B2DPoint aEnd(rAct.GetEndPoint().X(), rAct.GetEndPoint().Y());
461*cdf0e10cSrcweir 
462*cdf0e10cSrcweir 	if(!aStart.equal(aEnd))
463*cdf0e10cSrcweir 	{
464*cdf0e10cSrcweir 		basegfx::B2DPolygon aLine;
465*cdf0e10cSrcweir 		const basegfx::B2DHomMatrix aTransform(basegfx::tools::createScaleTranslateB2DHomMatrix(fScaleX, fScaleY, aOfs.X(), aOfs.Y()));
466*cdf0e10cSrcweir 
467*cdf0e10cSrcweir 		aLine.append(aStart);
468*cdf0e10cSrcweir 		aLine.append(aEnd);
469*cdf0e10cSrcweir 		aLine.transform(aTransform);
470*cdf0e10cSrcweir 
471*cdf0e10cSrcweir 		const LineInfo& rLineInfo = rAct.GetLineInfo();
472*cdf0e10cSrcweir 		const sal_Int32 nNewLineWidth(rLineInfo.GetWidth());
473*cdf0e10cSrcweir 		bool bCreateLineObject(true);
474*cdf0e10cSrcweir 
475*cdf0e10cSrcweir 		if(bLastObjWasLine && (nNewLineWidth == nLineWidth) && CheckLastLineMerge(aLine))
476*cdf0e10cSrcweir 		{
477*cdf0e10cSrcweir 			bCreateLineObject = false;
478*cdf0e10cSrcweir 		}
479*cdf0e10cSrcweir 
480*cdf0e10cSrcweir 		if(bCreateLineObject)
481*cdf0e10cSrcweir 		{
482*cdf0e10cSrcweir 			SdrPathObj* pPath = new SdrPathObj(OBJ_LINE, basegfx::B2DPolyPolygon(aLine));
483*cdf0e10cSrcweir 			nLineWidth = nNewLineWidth;
484*cdf0e10cSrcweir 			maLineJoin = rLineInfo.GetLineJoin();
485*cdf0e10cSrcweir 			maDash = XDash(XDASH_RECT,
486*cdf0e10cSrcweir 				rLineInfo.GetDotCount(), rLineInfo.GetDotLen(),
487*cdf0e10cSrcweir 				rLineInfo.GetDashCount(), rLineInfo.GetDashLen(),
488*cdf0e10cSrcweir 				rLineInfo.GetDistance());
489*cdf0e10cSrcweir 			SetAttributes(pPath);
490*cdf0e10cSrcweir 			nLineWidth = 0;
491*cdf0e10cSrcweir 			maLineJoin = basegfx::B2DLINEJOIN_NONE;
492*cdf0e10cSrcweir 			maDash = XDash();
493*cdf0e10cSrcweir 			InsertObj(pPath, false);
494*cdf0e10cSrcweir 		}
495*cdf0e10cSrcweir 	}
496*cdf0e10cSrcweir }
497*cdf0e10cSrcweir 
498*cdf0e10cSrcweir void ImpSdrGDIMetaFileImport::DoAction(MetaRectAction& rAct)
499*cdf0e10cSrcweir {
500*cdf0e10cSrcweir 	SdrRectObj* pRect=new SdrRectObj(rAct.GetRect());
501*cdf0e10cSrcweir 	SetAttributes(pRect);
502*cdf0e10cSrcweir 	InsertObj(pRect);
503*cdf0e10cSrcweir }
504*cdf0e10cSrcweir 
505*cdf0e10cSrcweir void ImpSdrGDIMetaFileImport::DoAction(MetaRoundRectAction& rAct)
506*cdf0e10cSrcweir {
507*cdf0e10cSrcweir 	SdrRectObj* pRect=new SdrRectObj(rAct.GetRect());
508*cdf0e10cSrcweir 	SetAttributes(pRect);
509*cdf0e10cSrcweir 	long nRad=(rAct.GetHorzRound()+rAct.GetVertRound())/2;
510*cdf0e10cSrcweir 	if (nRad!=0) {
511*cdf0e10cSrcweir 		SfxItemSet aSet(*pLineAttr->GetPool(),SDRATTR_ECKENRADIUS,SDRATTR_ECKENRADIUS);
512*cdf0e10cSrcweir 		aSet.Put(SdrEckenradiusItem(nRad));
513*cdf0e10cSrcweir 		pRect->SetMergedItemSet(aSet);
514*cdf0e10cSrcweir 	}
515*cdf0e10cSrcweir 	InsertObj(pRect);
516*cdf0e10cSrcweir }
517*cdf0e10cSrcweir 
518*cdf0e10cSrcweir /**************************************************************************************************/
519*cdf0e10cSrcweir 
520*cdf0e10cSrcweir void ImpSdrGDIMetaFileImport::DoAction(MetaEllipseAction& rAct)
521*cdf0e10cSrcweir {
522*cdf0e10cSrcweir 	SdrCircObj* pCirc=new SdrCircObj(OBJ_CIRC,rAct.GetRect());
523*cdf0e10cSrcweir 	SetAttributes(pCirc);
524*cdf0e10cSrcweir 	InsertObj(pCirc);
525*cdf0e10cSrcweir }
526*cdf0e10cSrcweir 
527*cdf0e10cSrcweir void ImpSdrGDIMetaFileImport::DoAction(MetaArcAction& rAct)
528*cdf0e10cSrcweir {
529*cdf0e10cSrcweir 	Point aCenter(rAct.GetRect().Center());
530*cdf0e10cSrcweir 	long nStart=GetAngle(rAct.GetStartPoint()-aCenter);
531*cdf0e10cSrcweir 	long nEnd=GetAngle(rAct.GetEndPoint()-aCenter);
532*cdf0e10cSrcweir 	SdrCircObj* pCirc=new SdrCircObj(OBJ_CARC,rAct.GetRect(),nStart,nEnd);
533*cdf0e10cSrcweir 	SetAttributes(pCirc);
534*cdf0e10cSrcweir 	InsertObj(pCirc);
535*cdf0e10cSrcweir }
536*cdf0e10cSrcweir 
537*cdf0e10cSrcweir void ImpSdrGDIMetaFileImport::DoAction(MetaPieAction& rAct)
538*cdf0e10cSrcweir {
539*cdf0e10cSrcweir 	Point aCenter(rAct.GetRect().Center());
540*cdf0e10cSrcweir 	long nStart=GetAngle(rAct.GetStartPoint()-aCenter);
541*cdf0e10cSrcweir 	long nEnd=GetAngle(rAct.GetEndPoint()-aCenter);
542*cdf0e10cSrcweir 	SdrCircObj* pCirc=new SdrCircObj(OBJ_SECT,rAct.GetRect(),nStart,nEnd);
543*cdf0e10cSrcweir 	SetAttributes(pCirc);
544*cdf0e10cSrcweir 	InsertObj(pCirc);
545*cdf0e10cSrcweir }
546*cdf0e10cSrcweir 
547*cdf0e10cSrcweir void ImpSdrGDIMetaFileImport::DoAction(MetaChordAction& rAct)
548*cdf0e10cSrcweir {
549*cdf0e10cSrcweir 	Point aCenter(rAct.GetRect().Center());
550*cdf0e10cSrcweir 	long nStart=GetAngle(rAct.GetStartPoint()-aCenter);
551*cdf0e10cSrcweir 	long nEnd=GetAngle(rAct.GetEndPoint()-aCenter);
552*cdf0e10cSrcweir 	SdrCircObj* pCirc=new SdrCircObj(OBJ_CCUT,rAct.GetRect(),nStart,nEnd);
553*cdf0e10cSrcweir 	SetAttributes(pCirc);
554*cdf0e10cSrcweir 	InsertObj(pCirc);
555*cdf0e10cSrcweir }
556*cdf0e10cSrcweir 
557*cdf0e10cSrcweir /**************************************************************************************************/
558*cdf0e10cSrcweir 
559*cdf0e10cSrcweir bool ImpSdrGDIMetaFileImport::CheckLastLineMerge(const basegfx::B2DPolygon& rSrcPoly)
560*cdf0e10cSrcweir {
561*cdf0e10cSrcweir 	// #i102706# Do not merge closed polygons
562*cdf0e10cSrcweir 	if(rSrcPoly.isClosed())
563*cdf0e10cSrcweir 	{
564*cdf0e10cSrcweir 		return false;
565*cdf0e10cSrcweir 	}
566*cdf0e10cSrcweir 
567*cdf0e10cSrcweir 	// #i73407# reformulation to use new B2DPolygon classes
568*cdf0e10cSrcweir 	if(bLastObjWasLine && (aOldLineColor == aVD.GetLineColor()) && rSrcPoly.count())
569*cdf0e10cSrcweir 	{
570*cdf0e10cSrcweir 		SdrObject* pTmpObj = aTmpList.GetObj(aTmpList.GetObjCount() - 1);
571*cdf0e10cSrcweir 		SdrPathObj* pLastPoly = PTR_CAST(SdrPathObj, pTmpObj);
572*cdf0e10cSrcweir 
573*cdf0e10cSrcweir 		if(pLastPoly)
574*cdf0e10cSrcweir 		{
575*cdf0e10cSrcweir 			if(1L == pLastPoly->GetPathPoly().count())
576*cdf0e10cSrcweir 			{
577*cdf0e10cSrcweir 				bool bOk(false);
578*cdf0e10cSrcweir 				basegfx::B2DPolygon aDstPoly(pLastPoly->GetPathPoly().getB2DPolygon(0L));
579*cdf0e10cSrcweir 
580*cdf0e10cSrcweir 				// #i102706# Do not merge closed polygons
581*cdf0e10cSrcweir 				if(aDstPoly.isClosed())
582*cdf0e10cSrcweir 				{
583*cdf0e10cSrcweir 					return false;
584*cdf0e10cSrcweir 				}
585*cdf0e10cSrcweir 
586*cdf0e10cSrcweir 				if(aDstPoly.count())
587*cdf0e10cSrcweir 				{
588*cdf0e10cSrcweir 					const sal_uInt32 nMaxDstPnt(aDstPoly.count() - 1L);
589*cdf0e10cSrcweir 					const sal_uInt32 nMaxSrcPnt(rSrcPoly.count() - 1L);
590*cdf0e10cSrcweir 
591*cdf0e10cSrcweir 					if(aDstPoly.getB2DPoint(nMaxDstPnt) == rSrcPoly.getB2DPoint(0L))
592*cdf0e10cSrcweir 					{
593*cdf0e10cSrcweir 						aDstPoly.append(rSrcPoly, 1L, rSrcPoly.count() - 1L);
594*cdf0e10cSrcweir 						bOk = true;
595*cdf0e10cSrcweir 					}
596*cdf0e10cSrcweir 					else if(aDstPoly.getB2DPoint(0L) == rSrcPoly.getB2DPoint(nMaxSrcPnt))
597*cdf0e10cSrcweir 					{
598*cdf0e10cSrcweir 						basegfx::B2DPolygon aNew(rSrcPoly);
599*cdf0e10cSrcweir 						aNew.append(aDstPoly, 1L, aDstPoly.count() - 1L);
600*cdf0e10cSrcweir 						aDstPoly = aNew;
601*cdf0e10cSrcweir 						bOk = true;
602*cdf0e10cSrcweir 					}
603*cdf0e10cSrcweir 					else if(aDstPoly.getB2DPoint(0L) == rSrcPoly.getB2DPoint(0L))
604*cdf0e10cSrcweir 					{
605*cdf0e10cSrcweir 						aDstPoly.flip();
606*cdf0e10cSrcweir 						aDstPoly.append(rSrcPoly, 1L, rSrcPoly.count() - 1L);
607*cdf0e10cSrcweir 						bOk = true;
608*cdf0e10cSrcweir 					}
609*cdf0e10cSrcweir 					else if(aDstPoly.getB2DPoint(nMaxDstPnt) == rSrcPoly.getB2DPoint(nMaxSrcPnt))
610*cdf0e10cSrcweir 					{
611*cdf0e10cSrcweir 						basegfx::B2DPolygon aNew(rSrcPoly);
612*cdf0e10cSrcweir 						aNew.flip();
613*cdf0e10cSrcweir 						aDstPoly.append(aNew, 1L, aNew.count() - 1L);
614*cdf0e10cSrcweir 						bOk = true;
615*cdf0e10cSrcweir 					}
616*cdf0e10cSrcweir 				}
617*cdf0e10cSrcweir 
618*cdf0e10cSrcweir 				if(bOk)
619*cdf0e10cSrcweir 				{
620*cdf0e10cSrcweir 					pLastPoly->NbcSetPathPoly(basegfx::B2DPolyPolygon(aDstPoly));
621*cdf0e10cSrcweir 				}
622*cdf0e10cSrcweir 
623*cdf0e10cSrcweir 				return bOk;
624*cdf0e10cSrcweir 			}
625*cdf0e10cSrcweir 		}
626*cdf0e10cSrcweir 	}
627*cdf0e10cSrcweir 
628*cdf0e10cSrcweir 	return false;
629*cdf0e10cSrcweir }
630*cdf0e10cSrcweir 
631*cdf0e10cSrcweir bool ImpSdrGDIMetaFileImport::CheckLastPolyLineAndFillMerge(const basegfx::B2DPolyPolygon & rPolyPolygon)
632*cdf0e10cSrcweir {
633*cdf0e10cSrcweir 	// #i73407# reformulation to use new B2DPolygon classes
634*cdf0e10cSrcweir 	if(bLastObjWasPolyWithoutLine)
635*cdf0e10cSrcweir 	{
636*cdf0e10cSrcweir 		SdrObject* pTmpObj = aTmpList.GetObj(aTmpList.GetObjCount() - 1);
637*cdf0e10cSrcweir 		SdrPathObj* pLastPoly = PTR_CAST(SdrPathObj, pTmpObj);
638*cdf0e10cSrcweir 
639*cdf0e10cSrcweir 		if(pLastPoly)
640*cdf0e10cSrcweir 		{
641*cdf0e10cSrcweir 			if(pLastPoly->GetPathPoly() == rPolyPolygon)
642*cdf0e10cSrcweir 			{
643*cdf0e10cSrcweir 				SetAttributes(NULL);
644*cdf0e10cSrcweir 
645*cdf0e10cSrcweir 				if(!bNoLine && bNoFill)
646*cdf0e10cSrcweir 				{
647*cdf0e10cSrcweir 					pLastPoly->SetMergedItemSet(*pLineAttr);
648*cdf0e10cSrcweir 
649*cdf0e10cSrcweir 					return true;
650*cdf0e10cSrcweir 				}
651*cdf0e10cSrcweir 			}
652*cdf0e10cSrcweir 		}
653*cdf0e10cSrcweir 	}
654*cdf0e10cSrcweir 
655*cdf0e10cSrcweir 	return false;
656*cdf0e10cSrcweir }
657*cdf0e10cSrcweir 
658*cdf0e10cSrcweir 
659*cdf0e10cSrcweir void ImpSdrGDIMetaFileImport::DoAction( MetaPolyLineAction& rAct )
660*cdf0e10cSrcweir {
661*cdf0e10cSrcweir 	// #i73407# reformulation to use new B2DPolygon classes
662*cdf0e10cSrcweir 	basegfx::B2DPolygon aSource(rAct.GetPolygon().getB2DPolygon());
663*cdf0e10cSrcweir 
664*cdf0e10cSrcweir 	if(aSource.count())
665*cdf0e10cSrcweir 	{
666*cdf0e10cSrcweir 		const basegfx::B2DHomMatrix aTransform(basegfx::tools::createScaleTranslateB2DHomMatrix(fScaleX, fScaleY, aOfs.X(), aOfs.Y()));
667*cdf0e10cSrcweir 		aSource.transform(aTransform);
668*cdf0e10cSrcweir 	}
669*cdf0e10cSrcweir 
670*cdf0e10cSrcweir 	const LineInfo& rLineInfo = rAct.GetLineInfo();
671*cdf0e10cSrcweir 	const sal_Int32 nNewLineWidth(rLineInfo.GetWidth());
672*cdf0e10cSrcweir 	bool bCreateLineObject(true);
673*cdf0e10cSrcweir 
674*cdf0e10cSrcweir 	if(bLastObjWasLine && (nNewLineWidth == nLineWidth) && CheckLastLineMerge(aSource))
675*cdf0e10cSrcweir 	{
676*cdf0e10cSrcweir 		bCreateLineObject = false;
677*cdf0e10cSrcweir 	}
678*cdf0e10cSrcweir 	else if(bLastObjWasPolyWithoutLine && CheckLastPolyLineAndFillMerge(basegfx::B2DPolyPolygon(aSource)))
679*cdf0e10cSrcweir 	{
680*cdf0e10cSrcweir 		bCreateLineObject = false;
681*cdf0e10cSrcweir 	}
682*cdf0e10cSrcweir 
683*cdf0e10cSrcweir 	if(bCreateLineObject)
684*cdf0e10cSrcweir 	{
685*cdf0e10cSrcweir 		SdrPathObj* pPath = new SdrPathObj(
686*cdf0e10cSrcweir 			aSource.isClosed() ? OBJ_POLY : OBJ_PLIN,
687*cdf0e10cSrcweir 			basegfx::B2DPolyPolygon(aSource));
688*cdf0e10cSrcweir 		nLineWidth = nNewLineWidth;
689*cdf0e10cSrcweir 		maLineJoin = rLineInfo.GetLineJoin();
690*cdf0e10cSrcweir 		maDash = XDash(XDASH_RECT,
691*cdf0e10cSrcweir 			rLineInfo.GetDotCount(), rLineInfo.GetDotLen(),
692*cdf0e10cSrcweir 			rLineInfo.GetDashCount(), rLineInfo.GetDashLen(),
693*cdf0e10cSrcweir 			rLineInfo.GetDistance());
694*cdf0e10cSrcweir 		SetAttributes(pPath);
695*cdf0e10cSrcweir 		nLineWidth = 0;
696*cdf0e10cSrcweir 		maLineJoin = basegfx::B2DLINEJOIN_NONE;
697*cdf0e10cSrcweir 		maDash = XDash();
698*cdf0e10cSrcweir 		InsertObj(pPath, false);
699*cdf0e10cSrcweir 	}
700*cdf0e10cSrcweir }
701*cdf0e10cSrcweir 
702*cdf0e10cSrcweir void ImpSdrGDIMetaFileImport::DoAction( MetaPolygonAction& rAct )
703*cdf0e10cSrcweir {
704*cdf0e10cSrcweir 	// #i73407# reformulation to use new B2DPolygon classes
705*cdf0e10cSrcweir 	basegfx::B2DPolygon aSource(rAct.GetPolygon().getB2DPolygon());
706*cdf0e10cSrcweir 
707*cdf0e10cSrcweir 	if(aSource.count())
708*cdf0e10cSrcweir 	{
709*cdf0e10cSrcweir 		const basegfx::B2DHomMatrix aTransform(basegfx::tools::createScaleTranslateB2DHomMatrix(fScaleX, fScaleY, aOfs.X(), aOfs.Y()));
710*cdf0e10cSrcweir 		aSource.transform(aTransform);
711*cdf0e10cSrcweir 
712*cdf0e10cSrcweir 		if(!bLastObjWasPolyWithoutLine || !CheckLastPolyLineAndFillMerge(basegfx::B2DPolyPolygon(aSource)))
713*cdf0e10cSrcweir 		{
714*cdf0e10cSrcweir 			// #i73407# make sure polygon is closed, it's a filled primitive
715*cdf0e10cSrcweir 			aSource.setClosed(true);
716*cdf0e10cSrcweir 
717*cdf0e10cSrcweir 			SdrPathObj* pPath = new SdrPathObj(OBJ_POLY, basegfx::B2DPolyPolygon(aSource));
718*cdf0e10cSrcweir 			SetAttributes(pPath);
719*cdf0e10cSrcweir 			InsertObj(pPath, false);
720*cdf0e10cSrcweir 		}
721*cdf0e10cSrcweir 	}
722*cdf0e10cSrcweir }
723*cdf0e10cSrcweir 
724*cdf0e10cSrcweir void ImpSdrGDIMetaFileImport::DoAction(MetaPolyPolygonAction& rAct)
725*cdf0e10cSrcweir {
726*cdf0e10cSrcweir 	// #i73407# reformulation to use new B2DPolygon classes
727*cdf0e10cSrcweir 	basegfx::B2DPolyPolygon aSource(rAct.GetPolyPolygon().getB2DPolyPolygon());
728*cdf0e10cSrcweir 
729*cdf0e10cSrcweir 	if(aSource.count())
730*cdf0e10cSrcweir 	{
731*cdf0e10cSrcweir 		const basegfx::B2DHomMatrix aTransform(basegfx::tools::createScaleTranslateB2DHomMatrix(fScaleX, fScaleY, aOfs.X(), aOfs.Y()));
732*cdf0e10cSrcweir 		aSource.transform(aTransform);
733*cdf0e10cSrcweir 
734*cdf0e10cSrcweir 		if(!bLastObjWasPolyWithoutLine || !CheckLastPolyLineAndFillMerge(aSource))
735*cdf0e10cSrcweir 		{
736*cdf0e10cSrcweir 			// #i73407# make sure polygon is closed, it's a filled primitive
737*cdf0e10cSrcweir 			aSource.setClosed(true);
738*cdf0e10cSrcweir 
739*cdf0e10cSrcweir 			SdrPathObj* pPath = new SdrPathObj(OBJ_POLY, aSource);
740*cdf0e10cSrcweir 			SetAttributes(pPath);
741*cdf0e10cSrcweir 			InsertObj(pPath, false);
742*cdf0e10cSrcweir 		}
743*cdf0e10cSrcweir 	}
744*cdf0e10cSrcweir }
745*cdf0e10cSrcweir 
746*cdf0e10cSrcweir /**************************************************************************************************/
747*cdf0e10cSrcweir 
748*cdf0e10cSrcweir void ImpSdrGDIMetaFileImport::ImportText( const Point& rPos, const XubString& rStr, const MetaAction& rAct )
749*cdf0e10cSrcweir {
750*cdf0e10cSrcweir 	// calc text box size, add 5% to make it fit safely
751*cdf0e10cSrcweir 
752*cdf0e10cSrcweir 	FontMetric aFontMetric( aVD.GetFontMetric() );
753*cdf0e10cSrcweir 	Font aFnt( aVD.GetFont() );
754*cdf0e10cSrcweir 	FontAlign eAlg( aFnt.GetAlign() );
755*cdf0e10cSrcweir 
756*cdf0e10cSrcweir     sal_Int32 nTextWidth = (sal_Int32)( aVD.GetTextWidth( rStr ) * fScaleX );
757*cdf0e10cSrcweir     sal_Int32 nTextHeight = (sal_Int32)( aVD.GetTextHeight() * fScaleY );
758*cdf0e10cSrcweir 	//sal_Int32 nDxWidth = 0;
759*cdf0e10cSrcweir 	//sal_Int32 nLen = rStr.Len();
760*cdf0e10cSrcweir 
761*cdf0e10cSrcweir 	Point aPos( FRound(rPos.X() * fScaleX + aOfs.X()), FRound(rPos.Y() * fScaleY + aOfs.Y()) );
762*cdf0e10cSrcweir     Size aSize( nTextWidth, nTextHeight );
763*cdf0e10cSrcweir 
764*cdf0e10cSrcweir 	if ( eAlg == ALIGN_BASELINE )
765*cdf0e10cSrcweir 		aPos.Y() -= FRound(aFontMetric.GetAscent() * fScaleY);
766*cdf0e10cSrcweir 	else if ( eAlg == ALIGN_BOTTOM )
767*cdf0e10cSrcweir 		aPos.Y() -= nTextHeight;
768*cdf0e10cSrcweir 
769*cdf0e10cSrcweir 	Rectangle aTextRect( aPos, aSize );
770*cdf0e10cSrcweir 	SdrRectObj* pText =new SdrRectObj( OBJ_TEXT, aTextRect );
771*cdf0e10cSrcweir 
772*cdf0e10cSrcweir 	if ( aFnt.GetWidth() || ( rAct.GetType() == META_STRETCHTEXT_ACTION ) )
773*cdf0e10cSrcweir 	{
774*cdf0e10cSrcweir 		pText->ClearMergedItem( SDRATTR_TEXT_AUTOGROWWIDTH );
775*cdf0e10cSrcweir 		pText->SetMergedItem( SdrTextAutoGrowHeightItem( sal_False ) );
776*cdf0e10cSrcweir 		// don't let the margins eat the space needed for the text
777*cdf0e10cSrcweir 		pText->SetMergedItem ( SdrTextUpperDistItem (0));
778*cdf0e10cSrcweir 		pText->SetMergedItem ( SdrTextLowerDistItem (0));
779*cdf0e10cSrcweir 		pText->SetMergedItem ( SdrTextRightDistItem (0));
780*cdf0e10cSrcweir 		pText->SetMergedItem ( SdrTextLeftDistItem (0));
781*cdf0e10cSrcweir 		pText->SetMergedItem( SdrTextFitToSizeTypeItem( SDRTEXTFIT_ALLLINES ) );
782*cdf0e10cSrcweir 	}
783*cdf0e10cSrcweir 	else
784*cdf0e10cSrcweir 		pText->SetMergedItem( SdrTextAutoGrowWidthItem( sal_True ) );
785*cdf0e10cSrcweir 
786*cdf0e10cSrcweir 	pText->SetModel( pModel );
787*cdf0e10cSrcweir 	pText->SetLayer( nLayer );
788*cdf0e10cSrcweir 	pText->NbcSetText( rStr );
789*cdf0e10cSrcweir 	SetAttributes( pText, sal_True );
790*cdf0e10cSrcweir 	pText->SetSnapRect( aTextRect );
791*cdf0e10cSrcweir 
792*cdf0e10cSrcweir 	if (!aFnt.IsTransparent())
793*cdf0e10cSrcweir 	{
794*cdf0e10cSrcweir 		SfxItemSet aAttr(*pFillAttr->GetPool(),XATTR_FILL_FIRST,XATTR_FILL_LAST);
795*cdf0e10cSrcweir 		aAttr.Put(XFillStyleItem(XFILL_SOLID));
796*cdf0e10cSrcweir 		aAttr.Put(XFillColorItem(String(), aFnt.GetFillColor()));
797*cdf0e10cSrcweir 		pText->SetMergedItemSet(aAttr);
798*cdf0e10cSrcweir 	}
799*cdf0e10cSrcweir 	sal_uInt32 nWink = aFnt.GetOrientation();
800*cdf0e10cSrcweir 	if ( nWink )
801*cdf0e10cSrcweir 	{
802*cdf0e10cSrcweir 		nWink*=10;
803*cdf0e10cSrcweir 		double a=nWink*nPi180;
804*cdf0e10cSrcweir 		double nSin=sin(a);
805*cdf0e10cSrcweir 		double nCos=cos(a);
806*cdf0e10cSrcweir 		pText->NbcRotate(aPos,nWink,nSin,nCos);
807*cdf0e10cSrcweir 	}
808*cdf0e10cSrcweir 	InsertObj( pText, sal_False );
809*cdf0e10cSrcweir }
810*cdf0e10cSrcweir 
811*cdf0e10cSrcweir void ImpSdrGDIMetaFileImport::DoAction(MetaTextAction& rAct)
812*cdf0e10cSrcweir {
813*cdf0e10cSrcweir 	XubString aStr(rAct.GetText());
814*cdf0e10cSrcweir 	aStr.Erase(0,rAct.GetIndex());
815*cdf0e10cSrcweir 	aStr.Erase(rAct.GetLen());
816*cdf0e10cSrcweir 	ImportText( rAct.GetPoint(), aStr, rAct );
817*cdf0e10cSrcweir }
818*cdf0e10cSrcweir 
819*cdf0e10cSrcweir void ImpSdrGDIMetaFileImport::DoAction(MetaTextArrayAction& rAct)
820*cdf0e10cSrcweir {
821*cdf0e10cSrcweir 	XubString aStr(rAct.GetText());
822*cdf0e10cSrcweir 	aStr.Erase(0,rAct.GetIndex());
823*cdf0e10cSrcweir 	aStr.Erase(rAct.GetLen());
824*cdf0e10cSrcweir 	ImportText( rAct.GetPoint(), aStr, rAct );
825*cdf0e10cSrcweir }
826*cdf0e10cSrcweir 
827*cdf0e10cSrcweir void ImpSdrGDIMetaFileImport::DoAction(MetaStretchTextAction& rAct)
828*cdf0e10cSrcweir {
829*cdf0e10cSrcweir 	XubString aStr(rAct.GetText());
830*cdf0e10cSrcweir 	aStr.Erase(0,rAct.GetIndex());
831*cdf0e10cSrcweir 	aStr.Erase(rAct.GetLen());
832*cdf0e10cSrcweir 	ImportText( rAct.GetPoint(), aStr, rAct );
833*cdf0e10cSrcweir }
834*cdf0e10cSrcweir 
835*cdf0e10cSrcweir void ImpSdrGDIMetaFileImport::DoAction(MetaBmpAction& rAct)
836*cdf0e10cSrcweir {
837*cdf0e10cSrcweir 	Rectangle aRect(rAct.GetPoint(),rAct.GetBitmap().GetSizePixel());
838*cdf0e10cSrcweir 	aRect.Right()++; aRect.Bottom()++;
839*cdf0e10cSrcweir 	SdrGrafObj* pGraf=new SdrGrafObj(Graphic(rAct.GetBitmap()),aRect);
840*cdf0e10cSrcweir 	InsertObj(pGraf);
841*cdf0e10cSrcweir }
842*cdf0e10cSrcweir 
843*cdf0e10cSrcweir void ImpSdrGDIMetaFileImport::DoAction(MetaBmpScaleAction& rAct)
844*cdf0e10cSrcweir {
845*cdf0e10cSrcweir 	Rectangle aRect(rAct.GetPoint(),rAct.GetSize());
846*cdf0e10cSrcweir 	aRect.Right()++; aRect.Bottom()++;
847*cdf0e10cSrcweir 	SdrGrafObj* pGraf=new SdrGrafObj(Graphic(rAct.GetBitmap()),aRect);
848*cdf0e10cSrcweir 	InsertObj(pGraf);
849*cdf0e10cSrcweir }
850*cdf0e10cSrcweir 
851*cdf0e10cSrcweir void ImpSdrGDIMetaFileImport::DoAction(MetaBmpExAction& rAct)
852*cdf0e10cSrcweir {
853*cdf0e10cSrcweir 	Rectangle aRect(rAct.GetPoint(),rAct.GetBitmapEx().GetSizePixel());
854*cdf0e10cSrcweir 	aRect.Right()++; aRect.Bottom()++;
855*cdf0e10cSrcweir 	SdrGrafObj* pGraf=new SdrGrafObj( rAct.GetBitmapEx(), aRect );
856*cdf0e10cSrcweir 	InsertObj(pGraf);
857*cdf0e10cSrcweir }
858*cdf0e10cSrcweir 
859*cdf0e10cSrcweir void ImpSdrGDIMetaFileImport::DoAction(MetaBmpExScaleAction& rAct)
860*cdf0e10cSrcweir {
861*cdf0e10cSrcweir 	Rectangle aRect(rAct.GetPoint(),rAct.GetSize());
862*cdf0e10cSrcweir 	aRect.Right()++; aRect.Bottom()++;
863*cdf0e10cSrcweir 	SdrGrafObj* pGraf=new SdrGrafObj( rAct.GetBitmapEx(), aRect );
864*cdf0e10cSrcweir 	InsertObj(pGraf);
865*cdf0e10cSrcweir }
866*cdf0e10cSrcweir 
867*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
868*cdf0e10cSrcweir 
869*cdf0e10cSrcweir void ImpSdrGDIMetaFileImport::DoAction( MetaHatchAction& rAct )
870*cdf0e10cSrcweir {
871*cdf0e10cSrcweir 	// #i73407# reformulation to use new B2DPolygon classes
872*cdf0e10cSrcweir 	basegfx::B2DPolyPolygon aSource(rAct.GetPolyPolygon().getB2DPolyPolygon());
873*cdf0e10cSrcweir 
874*cdf0e10cSrcweir 	if(aSource.count())
875*cdf0e10cSrcweir 	{
876*cdf0e10cSrcweir 		const basegfx::B2DHomMatrix aTransform(basegfx::tools::createScaleTranslateB2DHomMatrix(fScaleX, fScaleY, aOfs.X(), aOfs.Y()));
877*cdf0e10cSrcweir 		aSource.transform(aTransform);
878*cdf0e10cSrcweir 
879*cdf0e10cSrcweir 		if(!bLastObjWasPolyWithoutLine || !CheckLastPolyLineAndFillMerge(aSource))
880*cdf0e10cSrcweir 		{
881*cdf0e10cSrcweir 			const Hatch& rHatch = rAct.GetHatch();
882*cdf0e10cSrcweir 			SdrPathObj* pPath = new SdrPathObj(OBJ_POLY, aSource);
883*cdf0e10cSrcweir 			SfxItemSet aHatchAttr(pModel->GetItemPool(),
884*cdf0e10cSrcweir 				XATTR_FILLSTYLE, XATTR_FILLSTYLE,
885*cdf0e10cSrcweir 				XATTR_FILLHATCH, XATTR_FILLHATCH, 0, 0 );
886*cdf0e10cSrcweir 			XHatchStyle eStyle;
887*cdf0e10cSrcweir 
888*cdf0e10cSrcweir 			switch(rHatch.GetStyle())
889*cdf0e10cSrcweir 			{
890*cdf0e10cSrcweir 				case(HATCH_TRIPLE) :
891*cdf0e10cSrcweir 				{
892*cdf0e10cSrcweir 					eStyle = XHATCH_TRIPLE;
893*cdf0e10cSrcweir 					break;
894*cdf0e10cSrcweir 				}
895*cdf0e10cSrcweir 
896*cdf0e10cSrcweir 				case(HATCH_DOUBLE) :
897*cdf0e10cSrcweir 				{
898*cdf0e10cSrcweir 					eStyle = XHATCH_DOUBLE;
899*cdf0e10cSrcweir 					break;
900*cdf0e10cSrcweir 				}
901*cdf0e10cSrcweir 
902*cdf0e10cSrcweir 				default:
903*cdf0e10cSrcweir 				{
904*cdf0e10cSrcweir 					eStyle = XHATCH_SINGLE;
905*cdf0e10cSrcweir 					break;
906*cdf0e10cSrcweir 				}
907*cdf0e10cSrcweir 			}
908*cdf0e10cSrcweir 
909*cdf0e10cSrcweir 			SetAttributes(pPath);
910*cdf0e10cSrcweir 			aHatchAttr.Put(XFillStyleItem(XFILL_HATCH));
911*cdf0e10cSrcweir 			aHatchAttr.Put(XFillHatchItem(&pModel->GetItemPool(), XHatch(rHatch.GetColor(), eStyle, rHatch.GetDistance(), rHatch.GetAngle())));
912*cdf0e10cSrcweir 			pPath->SetMergedItemSet(aHatchAttr);
913*cdf0e10cSrcweir 
914*cdf0e10cSrcweir 			InsertObj(pPath, false);
915*cdf0e10cSrcweir 		}
916*cdf0e10cSrcweir 	}
917*cdf0e10cSrcweir }
918*cdf0e10cSrcweir 
919*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
920*cdf0e10cSrcweir 
921*cdf0e10cSrcweir void ImpSdrGDIMetaFileImport::DoAction(MetaLineColorAction& rAct)
922*cdf0e10cSrcweir {
923*cdf0e10cSrcweir 	rAct.Execute(&aVD);
924*cdf0e10cSrcweir }
925*cdf0e10cSrcweir 
926*cdf0e10cSrcweir void ImpSdrGDIMetaFileImport::DoAction(MetaMapModeAction& rAct)
927*cdf0e10cSrcweir {
928*cdf0e10cSrcweir 	MapScaling();
929*cdf0e10cSrcweir 	rAct.Execute(&aVD);
930*cdf0e10cSrcweir 	bLastObjWasPolyWithoutLine=sal_False;
931*cdf0e10cSrcweir 	bLastObjWasLine=sal_False;
932*cdf0e10cSrcweir }
933*cdf0e10cSrcweir 
934*cdf0e10cSrcweir void ImpSdrGDIMetaFileImport::MapScaling()
935*cdf0e10cSrcweir {
936*cdf0e10cSrcweir 	sal_uInt32 i, nAnz = aTmpList.GetObjCount();
937*cdf0e10cSrcweir 	const MapMode& rMap = aVD.GetMapMode();
938*cdf0e10cSrcweir 	Point aMapOrg( rMap.GetOrigin() );
939*cdf0e10cSrcweir 	sal_Bool bMov2 = aMapOrg.X() != 0 || aMapOrg.Y() != 0;
940*cdf0e10cSrcweir 	if ( bMov2 )
941*cdf0e10cSrcweir     {
942*cdf0e10cSrcweir 		for ( i = nMapScalingOfs; i < nAnz; i++ )
943*cdf0e10cSrcweir         {
944*cdf0e10cSrcweir 			SdrObject* pObj = aTmpList.GetObj(i);
945*cdf0e10cSrcweir 			if ( bMov2 )
946*cdf0e10cSrcweir 				pObj->NbcMove( Size( aMapOrg.X(), aMapOrg.Y() ) );
947*cdf0e10cSrcweir 		}
948*cdf0e10cSrcweir 	}
949*cdf0e10cSrcweir 	nMapScalingOfs = nAnz;
950*cdf0e10cSrcweir }
951*cdf0e10cSrcweir 
952*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
953*cdf0e10cSrcweir 
954*cdf0e10cSrcweir void ImpSdrGDIMetaFileImport::DoAction( MetaCommentAction& rAct, GDIMetaFile* pMtf )
955*cdf0e10cSrcweir {
956*cdf0e10cSrcweir 	ByteString aSkipComment;
957*cdf0e10cSrcweir 
958*cdf0e10cSrcweir 	if( rAct.GetComment().CompareIgnoreCaseToAscii( "XGRAD_SEQ_BEGIN" ) == COMPARE_EQUAL )
959*cdf0e10cSrcweir 	{
960*cdf0e10cSrcweir 		MetaGradientExAction* pAct = (MetaGradientExAction*) pMtf->NextAction();
961*cdf0e10cSrcweir 
962*cdf0e10cSrcweir 		if( pAct && pAct->GetType() == META_GRADIENTEX_ACTION )
963*cdf0e10cSrcweir 		{
964*cdf0e10cSrcweir 			// #i73407# reformulation to use new B2DPolygon classes
965*cdf0e10cSrcweir 			basegfx::B2DPolyPolygon aSource(pAct->GetPolyPolygon().getB2DPolyPolygon());
966*cdf0e10cSrcweir 
967*cdf0e10cSrcweir 			if(aSource.count())
968*cdf0e10cSrcweir 			{
969*cdf0e10cSrcweir 				if(!bLastObjWasPolyWithoutLine || !CheckLastPolyLineAndFillMerge(aSource))
970*cdf0e10cSrcweir 				{
971*cdf0e10cSrcweir 					const Gradient&	rGrad = pAct->GetGradient();
972*cdf0e10cSrcweir 					SdrPathObj* pPath = new SdrPathObj(OBJ_POLY, aSource);
973*cdf0e10cSrcweir 					SfxItemSet aGradAttr(pModel->GetItemPool(),
974*cdf0e10cSrcweir 					   XATTR_FILLSTYLE, XATTR_FILLSTYLE,
975*cdf0e10cSrcweir 					   XATTR_FILLGRADIENT, XATTR_FILLGRADIENT, 0, 0 );
976*cdf0e10cSrcweir 					XGradient aXGradient;
977*cdf0e10cSrcweir 
978*cdf0e10cSrcweir 					aXGradient.SetGradientStyle((XGradientStyle)rGrad.GetStyle());
979*cdf0e10cSrcweir 					aXGradient.SetStartColor(rGrad.GetStartColor());
980*cdf0e10cSrcweir 					aXGradient.SetEndColor(rGrad.GetEndColor());
981*cdf0e10cSrcweir 					aXGradient.SetAngle((sal_uInt16)rGrad.GetAngle());
982*cdf0e10cSrcweir 					aXGradient.SetBorder(rGrad.GetBorder());
983*cdf0e10cSrcweir 					aXGradient.SetXOffset(rGrad.GetOfsX());
984*cdf0e10cSrcweir 					aXGradient.SetYOffset(rGrad.GetOfsY());
985*cdf0e10cSrcweir 					aXGradient.SetStartIntens(rGrad.GetStartIntensity());
986*cdf0e10cSrcweir 					aXGradient.SetEndIntens(rGrad.GetEndIntensity());
987*cdf0e10cSrcweir 					aXGradient.SetSteps(rGrad.GetSteps());
988*cdf0e10cSrcweir 
989*cdf0e10cSrcweir             		if(aVD.IsLineColor())
990*cdf0e10cSrcweir                     {
991*cdf0e10cSrcweir                         // switch line off; when there was one there will be a
992*cdf0e10cSrcweir                         // META_POLYLINE_ACTION following creating another object
993*cdf0e10cSrcweir     		            const Color aLineColor(aVD.GetLineColor());
994*cdf0e10cSrcweir     		            aVD.SetLineColor();
995*cdf0e10cSrcweir                         SetAttributes(pPath);
996*cdf0e10cSrcweir     		            aVD.SetLineColor(aLineColor);
997*cdf0e10cSrcweir                     }
998*cdf0e10cSrcweir                     else
999*cdf0e10cSrcweir                     {
1000*cdf0e10cSrcweir                         SetAttributes(pPath);
1001*cdf0e10cSrcweir                     }
1002*cdf0e10cSrcweir 
1003*cdf0e10cSrcweir 					aGradAttr.Put(XFillStyleItem(XFILL_GRADIENT));
1004*cdf0e10cSrcweir 					aGradAttr.Put(XFillGradientItem(&pModel->GetItemPool(), aXGradient));
1005*cdf0e10cSrcweir 					pPath->SetMergedItemSet(aGradAttr);
1006*cdf0e10cSrcweir 
1007*cdf0e10cSrcweir 					InsertObj(pPath);
1008*cdf0e10cSrcweir 				}
1009*cdf0e10cSrcweir 			}
1010*cdf0e10cSrcweir 
1011*cdf0e10cSrcweir 			aSkipComment = "XGRAD_SEQ_END";
1012*cdf0e10cSrcweir 		}
1013*cdf0e10cSrcweir 	}
1014*cdf0e10cSrcweir 
1015*cdf0e10cSrcweir 	if(aSkipComment.Len())
1016*cdf0e10cSrcweir 	{
1017*cdf0e10cSrcweir 		MetaAction* pSkipAct = pMtf->NextAction();
1018*cdf0e10cSrcweir 
1019*cdf0e10cSrcweir 		while( pSkipAct
1020*cdf0e10cSrcweir 			&& ((pSkipAct->GetType() != META_COMMENT_ACTION )
1021*cdf0e10cSrcweir 				|| (((MetaCommentAction*)pSkipAct)->GetComment().CompareIgnoreCaseToAscii(aSkipComment.GetBuffer()) != COMPARE_EQUAL)))
1022*cdf0e10cSrcweir 		{
1023*cdf0e10cSrcweir 			pSkipAct = pMtf->NextAction();
1024*cdf0e10cSrcweir 		}
1025*cdf0e10cSrcweir 	}
1026*cdf0e10cSrcweir }
1027*cdf0e10cSrcweir 
1028*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
1029*cdf0e10cSrcweir 
1030*cdf0e10cSrcweir void ImpSdrGDIMetaFileImport::DoAction(MetaRenderGraphicAction& rAct)
1031*cdf0e10cSrcweir {
1032*cdf0e10cSrcweir 	GDIMetaFile                 aMtf;
1033*cdf0e10cSrcweir 	const ::vcl::RenderGraphic& rRenderGraphic = rAct.GetRenderGraphic();
1034*cdf0e10cSrcweir 	Rectangle                   aRect( rAct.GetPoint(), rAct.GetSize() );
1035*cdf0e10cSrcweir     const Point                 aPos;
1036*cdf0e10cSrcweir     const Size                  aPrefSize( rRenderGraphic.GetPrefSize() );
1037*cdf0e10cSrcweir 
1038*cdf0e10cSrcweir 	aRect.Right()++; aRect.Bottom()++;
1039*cdf0e10cSrcweir 
1040*cdf0e10cSrcweir     aMtf.SetPrefMapMode( rRenderGraphic.GetPrefMapMode() );
1041*cdf0e10cSrcweir     aMtf.SetPrefSize( aPrefSize );
1042*cdf0e10cSrcweir     aMtf.AddAction( new MetaRenderGraphicAction( aPos, aPrefSize, rRenderGraphic ) );
1043*cdf0e10cSrcweir     aMtf.WindStart();
1044*cdf0e10cSrcweir 
1045*cdf0e10cSrcweir 	SdrGrafObj* pGraf=new SdrGrafObj( aMtf, aRect );
1046*cdf0e10cSrcweir 	InsertObj( pGraf );
1047*cdf0e10cSrcweir }
1048*cdf0e10cSrcweir 
1049*cdf0e10cSrcweir // eof
1050