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