xref: /aoo41x/main/svx/source/svdraw/svdfmtf.cxx (revision 468982e4)
1f6e50924SAndrew Rist /**************************************************************
2f6e50924SAndrew Rist  *
3f6e50924SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4f6e50924SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5f6e50924SAndrew Rist  * distributed with this work for additional information
6f6e50924SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7f6e50924SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8f6e50924SAndrew Rist  * "License"); you may not use this file except in compliance
9f6e50924SAndrew Rist  * with the License.  You may obtain a copy of the License at
10f6e50924SAndrew Rist  *
11f6e50924SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12f6e50924SAndrew Rist  *
13f6e50924SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14f6e50924SAndrew Rist  * software distributed under the License is distributed on an
15f6e50924SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16f6e50924SAndrew Rist  * KIND, either express or implied.  See the License for the
17f6e50924SAndrew Rist  * specific language governing permissions and limitations
18f6e50924SAndrew Rist  * under the License.
19f6e50924SAndrew Rist  *
20f6e50924SAndrew Rist  *************************************************************/
21f6e50924SAndrew Rist 
22f6e50924SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_svx.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include "svdfmtf.hxx"
28cdf0e10cSrcweir #include <editeng/editdata.hxx>
29cdf0e10cSrcweir #include <math.h>
30cdf0e10cSrcweir #include <svx/xpoly.hxx>
31cdf0e10cSrcweir #include <vcl/svapp.hxx>
32cdf0e10cSrcweir #include <editeng/eeitem.hxx>
33cdf0e10cSrcweir #include <editeng/fhgtitem.hxx>
34cdf0e10cSrcweir #include <editeng/wghtitem.hxx>
35cdf0e10cSrcweir #include <editeng/postitem.hxx>
36cdf0e10cSrcweir #include <editeng/udlnitem.hxx>
37cdf0e10cSrcweir #include <editeng/crsditem.hxx>
38cdf0e10cSrcweir #include <editeng/shdditem.hxx>
39cdf0e10cSrcweir #include <svx/xlnclit.hxx>
405aaf853bSArmin Le Grand #include <svx/xlncapit.hxx>
41cdf0e10cSrcweir #include <svx/xlnwtit.hxx>
42cdf0e10cSrcweir #include <svx/xflclit.hxx>
43cdf0e10cSrcweir #include <svx/xgrad.hxx>
44cdf0e10cSrcweir #include <svx/xflgrit.hxx>
45cdf0e10cSrcweir #include <editeng/fontitem.hxx>
46cdf0e10cSrcweir #include <editeng/akrnitem.hxx>
47cdf0e10cSrcweir #include <editeng/wrlmitem.hxx>
48cdf0e10cSrcweir #include <editeng/cntritem.hxx>
49cdf0e10cSrcweir #include <editeng/colritem.hxx>
50cdf0e10cSrcweir #include <vcl/metric.hxx>
51cdf0e10cSrcweir #include <editeng/charscaleitem.hxx>
52cdf0e10cSrcweir #include <svx/xflhtit.hxx>
53cdf0e10cSrcweir #include <svx/svdattr.hxx>
54cdf0e10cSrcweir #include <svx/svdmodel.hxx>
55cdf0e10cSrcweir #include <svx/svdpage.hxx>
56cdf0e10cSrcweir #include <svx/svdobj.hxx>
57cdf0e10cSrcweir #include "svx/svditext.hxx"
58cdf0e10cSrcweir #include <svx/svdotext.hxx>
59cdf0e10cSrcweir #include <svx/svdorect.hxx>
60cdf0e10cSrcweir #include <svx/svdocirc.hxx>
61cdf0e10cSrcweir #include <svx/svdograf.hxx>
62cdf0e10cSrcweir #include <svx/svdopath.hxx>
63cdf0e10cSrcweir #include <svx/svdetc.hxx>
64cdf0e10cSrcweir #include <svl/itemset.hxx>
65cdf0e10cSrcweir #include <basegfx/polygon/b2dpolygon.hxx>
66cdf0e10cSrcweir #include <vcl/salbtype.hxx>		// FRound
67cdf0e10cSrcweir #include <basegfx/matrix/b2dhommatrix.hxx>
68cdf0e10cSrcweir #include <basegfx/matrix/b2dhommatrixtools.hxx>
69cdf0e10cSrcweir #include <svx/xlinjoit.hxx>
70cdf0e10cSrcweir #include <svx/xlndsit.hxx>
7147a7c0c1SArmin Le Grand #include <basegfx/polygon/b2dpolygonclipper.hxx>
7247a7c0c1SArmin Le Grand #include <svx/xbtmpit.hxx>
738718d260SArmin Le Grand #include <svx/xfltrit.hxx>
748718d260SArmin Le Grand #include <vcl/bmpacc.hxx>
759f63b866SArmin Le Grand #include <svx/xflbmtit.hxx>
769f63b866SArmin Le Grand #include <svx/xflbstit.hxx>
779f63b866SArmin Le Grand #include <svx/svdpntv.hxx>
78cdf0e10cSrcweir 
79cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
80cdf0e10cSrcweir 
818718d260SArmin Le Grand ImpSdrGDIMetaFileImport::ImpSdrGDIMetaFileImport(
828718d260SArmin Le Grand     SdrModel& rModel,
838718d260SArmin Le Grand     SdrLayerID nLay,
848718d260SArmin Le Grand     const Rectangle& rRect)
858718d260SArmin Le Grand :   maTmpList(),
868718d260SArmin Le Grand     maVD(),
878718d260SArmin Le Grand     maScaleRect(rRect),
888718d260SArmin Le Grand     mnMapScalingOfs(0),
898718d260SArmin Le Grand 	mpLineAttr(0),
908718d260SArmin Le Grand     mpFillAttr(0),
918718d260SArmin Le Grand     mpTextAttr(0),
928718d260SArmin Le Grand     mpModel(&rModel),
938718d260SArmin Le Grand     mnLayer(nLay),
948718d260SArmin Le Grand     maOldLineColor(),
958718d260SArmin Le Grand 	mnLineWidth(0),
96cdf0e10cSrcweir 	maLineJoin(basegfx::B2DLINEJOIN_NONE),
975aaf853bSArmin Le Grand 	maLineCap(com::sun::star::drawing::LineCap_BUTT),
98cdf0e10cSrcweir 	maDash(XDASH_RECT, 0, 0, 0, 0, 0),
998718d260SArmin Le Grand     mbMov(false),
1008718d260SArmin Le Grand     mbSize(false),
1018718d260SArmin Le Grand     maOfs(0, 0),
1028718d260SArmin Le Grand     mfScaleX(1.0),
1038718d260SArmin Le Grand     mfScaleY(1.0),
1048718d260SArmin Le Grand     maScaleX(1.0),
1058718d260SArmin Le Grand     maScaleY(1.0),
1068718d260SArmin Le Grand 	mbFntDirty(true),
1078718d260SArmin Le Grand 	mbLastObjWasPolyWithoutLine(false),
1088718d260SArmin Le Grand     mbNoLine(false),
1098718d260SArmin Le Grand     mbNoFill(false),
1108718d260SArmin Le Grand     mbLastObjWasLine(false),
11147a7c0c1SArmin Le Grand     maClip()
112cdf0e10cSrcweir {
1138718d260SArmin Le Grand 	maVD.EnableOutput(false);
1148718d260SArmin Le Grand     maVD.SetLineColor();
1158718d260SArmin Le Grand     maVD.SetFillColor();
1168718d260SArmin Le Grand 	maOldLineColor.SetRed( maVD.GetLineColor().GetRed() + 1 );
1178718d260SArmin Le Grand 	mpLineAttr = new SfxItemSet(rModel.GetItemPool(), XATTR_LINE_FIRST, XATTR_LINE_LAST, 0, 0);
1188718d260SArmin Le Grand 	mpFillAttr = new SfxItemSet(rModel.GetItemPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST, 0, 0);
1198718d260SArmin Le Grand 	mpTextAttr = new SfxItemSet(rModel.GetItemPool(), EE_ITEMS_START, EE_ITEMS_END, 0, 0);
12047a7c0c1SArmin Le Grand     checkClip();
121cdf0e10cSrcweir }
122cdf0e10cSrcweir 
123cdf0e10cSrcweir ImpSdrGDIMetaFileImport::~ImpSdrGDIMetaFileImport()
124cdf0e10cSrcweir {
1258718d260SArmin Le Grand 	delete mpLineAttr;
1268718d260SArmin Le Grand 	delete mpFillAttr;
1278718d260SArmin Le Grand 	delete mpTextAttr;
128cdf0e10cSrcweir }
129cdf0e10cSrcweir 
1308718d260SArmin Le Grand void ImpSdrGDIMetaFileImport::DoLoopActions(GDIMetaFile& rMtf, SvdProgressInfo* pProgrInfo, sal_uInt32* pActionsToReport)
131cdf0e10cSrcweir {
132*468982e4SArmin Le Grand     const sal_uLong nCount(rMtf.GetActionCount());
133*468982e4SArmin Le Grand 
134*468982e4SArmin Le Grand     for(sal_uLong a(0); a < nCount; a++)
135*468982e4SArmin Le Grand     {
136*468982e4SArmin Le Grand         MetaAction* pAct = rMtf.GetAction(a);
137*468982e4SArmin Le Grand 
138*468982e4SArmin Le Grand         if(!pAct)
139*468982e4SArmin Le Grand         {
140*468982e4SArmin Le Grand             OSL_ENSURE(false, "OOps, no action at valid position (!)");
141*468982e4SArmin Le Grand             pAct = rMtf.GetAction(0);
142*468982e4SArmin Le Grand         }
143*468982e4SArmin Le Grand 
144cdf0e10cSrcweir 		switch (pAct->GetType())
145cdf0e10cSrcweir 		{
146cdf0e10cSrcweir 			case META_PIXEL_ACTION          : DoAction((MetaPixelAction          &)*pAct); break;
147cdf0e10cSrcweir 			case META_POINT_ACTION          : DoAction((MetaPointAction          &)*pAct); break;
148cdf0e10cSrcweir 			case META_LINE_ACTION           : DoAction((MetaLineAction           &)*pAct); break;
149cdf0e10cSrcweir 			case META_RECT_ACTION           : DoAction((MetaRectAction           &)*pAct); break;
150cdf0e10cSrcweir 			case META_ROUNDRECT_ACTION      : DoAction((MetaRoundRectAction      &)*pAct); break;
151cdf0e10cSrcweir 			case META_ELLIPSE_ACTION        : DoAction((MetaEllipseAction        &)*pAct); break;
152cdf0e10cSrcweir 			case META_ARC_ACTION            : DoAction((MetaArcAction            &)*pAct); break;
153cdf0e10cSrcweir 			case META_PIE_ACTION            : DoAction((MetaPieAction            &)*pAct); break;
154cdf0e10cSrcweir 			case META_CHORD_ACTION          : DoAction((MetaChordAction          &)*pAct); break;
155cdf0e10cSrcweir 			case META_POLYLINE_ACTION	    : DoAction((MetaPolyLineAction		 &)*pAct); break;
156cdf0e10cSrcweir 			case META_POLYGON_ACTION        : DoAction((MetaPolygonAction        &)*pAct); break;
157cdf0e10cSrcweir 			case META_POLYPOLYGON_ACTION    : DoAction((MetaPolyPolygonAction    &)*pAct); break;
158cdf0e10cSrcweir 			case META_TEXT_ACTION           : DoAction((MetaTextAction           &)*pAct); break;
159cdf0e10cSrcweir 			case META_TEXTARRAY_ACTION      : DoAction((MetaTextArrayAction      &)*pAct); break;
160cdf0e10cSrcweir 			case META_STRETCHTEXT_ACTION    : DoAction((MetaStretchTextAction    &)*pAct); break;
161cdf0e10cSrcweir 			case META_BMP_ACTION			: DoAction((MetaBmpAction			 &)*pAct); break;
162cdf0e10cSrcweir 			case META_BMPSCALE_ACTION		: DoAction((MetaBmpScaleAction		 &)*pAct); break;
163cdf0e10cSrcweir 			case META_BMPEX_ACTION			: DoAction((MetaBmpExAction			 &)*pAct); break;
164cdf0e10cSrcweir 			case META_BMPEXSCALE_ACTION		: DoAction((MetaBmpExScaleAction	 &)*pAct); break;
165cdf0e10cSrcweir 			case META_LINECOLOR_ACTION      : DoAction((MetaLineColorAction      &)*pAct); break;
166cdf0e10cSrcweir 			case META_FILLCOLOR_ACTION      : DoAction((MetaFillColorAction      &)*pAct); break;
167cdf0e10cSrcweir 			case META_TEXTCOLOR_ACTION      : DoAction((MetaTextColorAction      &)*pAct); break;
168cdf0e10cSrcweir 			case META_TEXTFILLCOLOR_ACTION  : DoAction((MetaTextFillColorAction  &)*pAct); break;
169cdf0e10cSrcweir 			case META_FONT_ACTION           : DoAction((MetaFontAction           &)*pAct); break;
170cdf0e10cSrcweir 			case META_TEXTALIGN_ACTION		: DoAction((MetaTextAlignAction		 &)*pAct); break;
171cdf0e10cSrcweir 			case META_MAPMODE_ACTION        : DoAction((MetaMapModeAction        &)*pAct); break;
172cdf0e10cSrcweir 			case META_CLIPREGION_ACTION     : DoAction((MetaClipRegionAction     &)*pAct); break;
173cdf0e10cSrcweir 			case META_MOVECLIPREGION_ACTION : DoAction((MetaMoveClipRegionAction &)*pAct); break;
174cdf0e10cSrcweir 			case META_ISECTRECTCLIPREGION_ACTION: DoAction((MetaISectRectClipRegionAction&)*pAct); break;
175cdf0e10cSrcweir 			case META_ISECTREGIONCLIPREGION_ACTION: DoAction((MetaISectRegionClipRegionAction&)*pAct); break;
176cdf0e10cSrcweir 			case META_RASTEROP_ACTION       : DoAction((MetaRasterOpAction       &)*pAct); break;
177cdf0e10cSrcweir 			case META_PUSH_ACTION           : DoAction((MetaPushAction           &)*pAct); break;
178cdf0e10cSrcweir 			case META_POP_ACTION            : DoAction((MetaPopAction            &)*pAct); break;
179cdf0e10cSrcweir 			case META_HATCH_ACTION			: DoAction((MetaHatchAction          &)*pAct); break;
1808718d260SArmin Le Grand 			case META_COMMENT_ACTION		: DoAction((MetaCommentAction        &)*pAct, &rMtf); break;
1818718d260SArmin Le Grand 
1828718d260SArmin Le Grand             // missing actions added
1838718d260SArmin Le Grand             case META_TEXTRECT_ACTION       : DoAction((MetaTextRectAction&)*pAct); break;
1848718d260SArmin Le Grand             case META_BMPSCALEPART_ACTION   : DoAction((MetaBmpScalePartAction&)*pAct); break;
1858718d260SArmin Le Grand             case META_BMPEXSCALEPART_ACTION : DoAction((MetaBmpExScalePartAction&)*pAct); break;
1868718d260SArmin Le Grand             case META_MASK_ACTION           : DoAction((MetaMaskAction&)*pAct); break;
1878718d260SArmin Le Grand             case META_MASKSCALE_ACTION      : DoAction((MetaMaskScaleAction&)*pAct); break;
1888718d260SArmin Le Grand             case META_MASKSCALEPART_ACTION  : DoAction((MetaMaskScalePartAction&)*pAct); break;
1898718d260SArmin Le Grand             case META_GRADIENT_ACTION       : DoAction((MetaGradientAction&)*pAct); break;
1908718d260SArmin Le Grand             case META_WALLPAPER_ACTION      : DoAction((MetaWallpaperAction&)*pAct); break;
1918718d260SArmin Le Grand             case META_TRANSPARENT_ACTION    : DoAction((MetaTransparentAction&)*pAct); break;
1928718d260SArmin Le Grand             case META_EPS_ACTION            : DoAction((MetaEPSAction&)*pAct); break;
1938718d260SArmin Le Grand             case META_REFPOINT_ACTION       : DoAction((MetaRefPointAction&)*pAct); break;
1948718d260SArmin Le Grand             case META_TEXTLINECOLOR_ACTION  : DoAction((MetaTextLineColorAction&)*pAct); break;
1958718d260SArmin Le Grand             case META_TEXTLINE_ACTION       : DoAction((MetaTextLineAction&)*pAct); break;
1968718d260SArmin Le Grand             case META_FLOATTRANSPARENT_ACTION : DoAction((MetaFloatTransparentAction&)*pAct); break;
1978718d260SArmin Le Grand             case META_GRADIENTEX_ACTION     : DoAction((MetaGradientExAction&)*pAct); break;
1988718d260SArmin Le Grand             case META_LAYOUTMODE_ACTION     : DoAction((MetaLayoutModeAction&)*pAct); break;
1998718d260SArmin Le Grand             case META_TEXTLANGUAGE_ACTION   : DoAction((MetaTextLanguageAction&)*pAct); break;
2008718d260SArmin Le Grand             case META_OVERLINECOLOR_ACTION  : DoAction((MetaOverlineColorAction&)*pAct); break;
201cdf0e10cSrcweir 		}
202cdf0e10cSrcweir 
2038718d260SArmin Le Grand 		if(pProgrInfo && pActionsToReport)
204cdf0e10cSrcweir 		{
2058718d260SArmin Le Grand             (*pActionsToReport)++;
2068718d260SArmin Le Grand 
2078718d260SArmin Le Grand             if(*pActionsToReport >= 16) // Alle 16 Action updaten
2088718d260SArmin Le Grand             {
2098718d260SArmin Le Grand                 if(!pProgrInfo->ReportActions(*pActionsToReport))
2108718d260SArmin Le Grand                     break;
2118718d260SArmin Le Grand 
2128718d260SArmin Le Grand                 *pActionsToReport = 0;
2138718d260SArmin Le Grand             }
214cdf0e10cSrcweir 		}
215cdf0e10cSrcweir 	}
2168718d260SArmin Le Grand }
217cdf0e10cSrcweir 
2188718d260SArmin Le Grand sal_uInt32 ImpSdrGDIMetaFileImport::DoImport(
2198718d260SArmin Le Grand     const GDIMetaFile& rMtf,
2208718d260SArmin Le Grand 	SdrObjList& rOL,
2218718d260SArmin Le Grand 	sal_uInt32 nInsPos,
2228718d260SArmin Le Grand 	SvdProgressInfo* pProgrInfo)
2238718d260SArmin Le Grand {
2248718d260SArmin Le Grand 	// setup some global scale parameter
2258718d260SArmin Le Grand 	// mfScaleX, mfScaleY, maScaleX, maScaleY, mbMov, mbSize
2268718d260SArmin Le Grand     mfScaleX = mfScaleY = 1.0;
2278718d260SArmin Le Grand 	const Size aMtfSize(rMtf.GetPrefSize());
2288718d260SArmin Le Grand 
2298718d260SArmin Le Grand     if(aMtfSize.Width() & aMtfSize.Height() && (!maScaleRect.IsEmpty()))
2308718d260SArmin Le Grand     {
2318718d260SArmin Le Grand 		maOfs = maScaleRect.TopLeft();
2328718d260SArmin Le Grand 
2338718d260SArmin Le Grand         if(aMtfSize.Width() != (maScaleRect.GetWidth() - 1))
2348718d260SArmin Le Grand         {
2358718d260SArmin Le Grand             mfScaleX = (double)( maScaleRect.GetWidth() - 1 ) / (double)aMtfSize.Width();
2368718d260SArmin Le Grand         }
2378718d260SArmin Le Grand 
2388718d260SArmin Le Grand         if(aMtfSize.Height() != (maScaleRect.GetHeight() - 1))
2398718d260SArmin Le Grand         {
2408718d260SArmin Le Grand             mfScaleY = (double)( maScaleRect.GetHeight() - 1 ) / (double)aMtfSize.Height();
2418718d260SArmin Le Grand         }
2428718d260SArmin Le Grand     }
2438718d260SArmin Le Grand 
2448718d260SArmin Le Grand 	mbMov = maOfs.X()!=0 || maOfs.Y()!=0;
2458718d260SArmin Le Grand     mbSize = false;
2468718d260SArmin Le Grand 	maScaleX = Fraction( 1, 1 );
2478718d260SArmin Le Grand 	maScaleY = Fraction( 1, 1 );
2488718d260SArmin Le Grand 
2498718d260SArmin Le Grand     if(aMtfSize.Width() != (maScaleRect.GetWidth() - 1))
2508718d260SArmin Le Grand     {
2518718d260SArmin Le Grand         maScaleX = Fraction(maScaleRect.GetWidth() - 1, aMtfSize.Width());
2528718d260SArmin Le Grand         mbSize = true;
2538718d260SArmin Le Grand     }
2548718d260SArmin Le Grand 
2558718d260SArmin Le Grand     if(aMtfSize.Height() != (maScaleRect.GetHeight() - 1))
2568718d260SArmin Le Grand     {
2578718d260SArmin Le Grand         maScaleY = Fraction(maScaleRect.GetHeight() - 1, aMtfSize.Height());
2588718d260SArmin Le Grand         mbSize = true;
2598718d260SArmin Le Grand     }
2608718d260SArmin Le Grand 
2618718d260SArmin Le Grand 	if(pProgrInfo)
2628718d260SArmin Le Grand     {
2638718d260SArmin Le Grand 		pProgrInfo->SetActionCount(rMtf.GetActionCount());
2648718d260SArmin Le Grand     }
2658718d260SArmin Le Grand 
2668718d260SArmin Le Grand 	sal_uInt32 nActionsToReport(0);
2678718d260SArmin Le Grand 
2688718d260SArmin Le Grand     // execute
2698718d260SArmin Le Grand     DoLoopActions(const_cast< GDIMetaFile& >(rMtf), pProgrInfo, &nActionsToReport);
2708718d260SArmin Le Grand 
2718718d260SArmin Le Grand     if(pProgrInfo)
272cdf0e10cSrcweir 	{
273cdf0e10cSrcweir 		pProgrInfo->ReportActions(nActionsToReport);
274cdf0e10cSrcweir 		nActionsToReport = 0;
275cdf0e10cSrcweir 	}
276cdf0e10cSrcweir 
277cdf0e10cSrcweir 	// MapMode-Scaling  vornehmen
278cdf0e10cSrcweir 	MapScaling();
279cdf0e10cSrcweir 
280cdf0e10cSrcweir 	// Beim berechnen der Fortschrittsanzeige wird GetActionCount()*3 benutzt.
2818718d260SArmin Le Grand 	// Da in maTmpList allerdings weniger eintraege als GetActionCount()
282cdf0e10cSrcweir 	// existieren koennen, muessen hier die zuviel vermuteten Actionen wieder
283cdf0e10cSrcweir 	// hinzugefuegt werden.
2848718d260SArmin Le Grand 	nActionsToReport = (rMtf.GetActionCount() - maTmpList.size()) * 2;
285cdf0e10cSrcweir 
286cdf0e10cSrcweir 	// Alle noch nicht gemeldeten Rescales melden
287cdf0e10cSrcweir 	if(pProgrInfo)
288cdf0e10cSrcweir 	{
289cdf0e10cSrcweir 		pProgrInfo->ReportRescales(nActionsToReport);
2908718d260SArmin Le Grand 		pProgrInfo->SetInsertCount(maTmpList.size());
291cdf0e10cSrcweir 	}
292cdf0e10cSrcweir 
2938718d260SArmin Le Grand     nActionsToReport = 0;
2948718d260SArmin Le Grand 
2958718d260SArmin Le Grand 	// alle in maTmpList zwischengespeicherten Objekte nun in rOL ab der Position nInsPos einfuegen
2968718d260SArmin Le Grand 	if(nInsPos > rOL.GetObjCount())
2978718d260SArmin Le Grand     {
2988718d260SArmin Le Grand         nInsPos = rOL.GetObjCount();
2998718d260SArmin Le Grand     }
3008718d260SArmin Le Grand 
301cdf0e10cSrcweir 	SdrInsertReason aReason(SDRREASON_VIEWCALL);
3028718d260SArmin Le Grand 
3038718d260SArmin Le Grand 	for(sal_uInt32 i(0); i < maTmpList.size(); i++)
304cdf0e10cSrcweir 	{
3058718d260SArmin Le Grand 		SdrObject* pObj = maTmpList[i];
3068718d260SArmin Le Grand 		rOL.NbcInsertObject(pObj, nInsPos, &aReason);
3078718d260SArmin Le Grand 		nInsPos++;
308cdf0e10cSrcweir 
3098718d260SArmin Le Grand 		if(pProgrInfo)
310cdf0e10cSrcweir 		{
311cdf0e10cSrcweir 			nActionsToReport++;
3128718d260SArmin Le Grand 
3138718d260SArmin Le Grand             if(nActionsToReport >= 32) // Alle 32 Action updaten
314cdf0e10cSrcweir 			{
315cdf0e10cSrcweir 				pProgrInfo->ReportInserts(nActionsToReport);
316cdf0e10cSrcweir 				nActionsToReport = 0;
317cdf0e10cSrcweir 			}
318cdf0e10cSrcweir 		}
319cdf0e10cSrcweir 	}
320cdf0e10cSrcweir 
321cdf0e10cSrcweir 	// ein letztesmal alle verbliebennen Inserts reporten
3228718d260SArmin Le Grand 	if(pProgrInfo)
323cdf0e10cSrcweir 	{
324cdf0e10cSrcweir 		pProgrInfo->ReportInserts(nActionsToReport);
325cdf0e10cSrcweir 	}
326cdf0e10cSrcweir 
3278718d260SArmin Le Grand 	return maTmpList.size();
328cdf0e10cSrcweir }
329cdf0e10cSrcweir 
3308718d260SArmin Le Grand void ImpSdrGDIMetaFileImport::SetAttributes(SdrObject* pObj, bool bForceTextAttr)
331cdf0e10cSrcweir {
3328718d260SArmin Le Grand 	mbNoLine = false;
3338718d260SArmin Le Grand     mbNoFill = false;
3348718d260SArmin Le Grand 	bool bLine(!bForceTextAttr);
3358718d260SArmin Le Grand 	bool bFill(!pObj || (pObj->IsClosedObj() && !bForceTextAttr));
3368718d260SArmin Le Grand 	bool bText(bForceTextAttr || (pObj && pObj->GetOutlinerParaObject()));
337cdf0e10cSrcweir 
3388718d260SArmin Le Grand 	if(bLine)
339cdf0e10cSrcweir 	{
3408718d260SArmin Le Grand 		if(mnLineWidth)
3418718d260SArmin Le Grand         {
3428718d260SArmin Le Grand 			mpLineAttr->Put(XLineWidthItem(mnLineWidth));
3438718d260SArmin Le Grand         }
344cdf0e10cSrcweir         else
3458718d260SArmin Le Grand         {
3468718d260SArmin Le Grand 			mpLineAttr->Put(XLineWidthItem(0));
3478718d260SArmin Le Grand         }
3488718d260SArmin Le Grand 
3498718d260SArmin Le Grand 		maOldLineColor = maVD.GetLineColor();
350cdf0e10cSrcweir 
3518718d260SArmin Le Grand         if(maVD.IsLineColor())
352cdf0e10cSrcweir 		{
3538718d260SArmin Le Grand 			mpLineAttr->Put(XLineStyleItem(XLINE_SOLID));
3548718d260SArmin Le Grand 			mpLineAttr->Put(XLineColorItem(String(), maVD.GetLineColor()));
355cdf0e10cSrcweir 		}
356cdf0e10cSrcweir 		else
3578718d260SArmin Le Grand         {
3588718d260SArmin Le Grand 			mpLineAttr->Put(XLineStyleItem(XLINE_NONE));
3598718d260SArmin Le Grand         }
360cdf0e10cSrcweir 
361cdf0e10cSrcweir 		switch(maLineJoin)
362cdf0e10cSrcweir 		{
363cdf0e10cSrcweir 			default : // basegfx::B2DLINEJOIN_NONE
364d5370dc8SArmin Le Grand 				mpLineAttr->Put(XLineJointItem(com::sun::star::drawing::LineJoint_NONE));
365cdf0e10cSrcweir 				break;
366cdf0e10cSrcweir 			case basegfx::B2DLINEJOIN_MIDDLE:
367d5370dc8SArmin Le Grand 				mpLineAttr->Put(XLineJointItem(com::sun::star::drawing::LineJoint_MIDDLE));
368cdf0e10cSrcweir 				break;
369cdf0e10cSrcweir 			case basegfx::B2DLINEJOIN_BEVEL:
370d5370dc8SArmin Le Grand 				mpLineAttr->Put(XLineJointItem(com::sun::star::drawing::LineJoint_BEVEL));
371cdf0e10cSrcweir 				break;
372cdf0e10cSrcweir 			case basegfx::B2DLINEJOIN_MITER:
373d5370dc8SArmin Le Grand 				mpLineAttr->Put(XLineJointItem(com::sun::star::drawing::LineJoint_MITER));
374cdf0e10cSrcweir 				break;
375cdf0e10cSrcweir 			case basegfx::B2DLINEJOIN_ROUND:
376d5370dc8SArmin Le Grand 				mpLineAttr->Put(XLineJointItem(com::sun::star::drawing::LineJoint_ROUND));
377cdf0e10cSrcweir 				break;
378cdf0e10cSrcweir 		}
379cdf0e10cSrcweir 
3805aaf853bSArmin Le Grand         // Add LineCap support
3818718d260SArmin Le Grand         mpLineAttr->Put(XLineCapItem(maLineCap));
3825aaf853bSArmin Le Grand 
383cdf0e10cSrcweir 		if(((maDash.GetDots() && maDash.GetDotLen()) || (maDash.GetDashes() && maDash.GetDashLen())) && maDash.GetDistance())
384cdf0e10cSrcweir 		{
3858718d260SArmin Le Grand 			mpLineAttr->Put(XLineDashItem(String(), maDash));
386cdf0e10cSrcweir 		}
387cdf0e10cSrcweir         else
388cdf0e10cSrcweir         {
3898718d260SArmin Le Grand 			mpLineAttr->Put(XLineDashItem(String(), XDash(XDASH_RECT)));
390cdf0e10cSrcweir         }
391cdf0e10cSrcweir 	}
392cdf0e10cSrcweir 	else
3938718d260SArmin Le Grand     {
3948718d260SArmin Le Grand 		mbNoLine = true;
3958718d260SArmin Le Grand     }
396cdf0e10cSrcweir 
3978718d260SArmin Le Grand 	if(bFill)
398cdf0e10cSrcweir 	{
3998718d260SArmin Le Grand 		if(maVD.IsFillColor())
400cdf0e10cSrcweir 		{
4018718d260SArmin Le Grand 			mpFillAttr->Put(XFillStyleItem(XFILL_SOLID));
4028718d260SArmin Le Grand 			mpFillAttr->Put(XFillColorItem(String(), maVD.GetFillColor()));
403cdf0e10cSrcweir 		}
404cdf0e10cSrcweir 		else
4058718d260SArmin Le Grand         {
4068718d260SArmin Le Grand 			mpFillAttr->Put(XFillStyleItem(XFILL_NONE));
4078718d260SArmin Le Grand         }
408cdf0e10cSrcweir 	}
409cdf0e10cSrcweir 	else
4108718d260SArmin Le Grand     {
4118718d260SArmin Le Grand 		mbNoFill = true;
4128718d260SArmin Le Grand     }
413cdf0e10cSrcweir 
4148718d260SArmin Le Grand 	if(bText && mbFntDirty)
415cdf0e10cSrcweir 	{
4168718d260SArmin Le Grand 		Font aFnt(maVD.GetFont());
4178718d260SArmin Le Grand 		const sal_uInt32 nHeight(FRound(aFnt.GetSize().Height() * mfScaleY));
4188718d260SArmin Le Grand 
4198718d260SArmin Le Grand         mpTextAttr->Put( SvxFontItem( aFnt.GetFamily(), aFnt.GetName(), aFnt.GetStyleName(), aFnt.GetPitch(), aFnt.GetCharSet(), EE_CHAR_FONTINFO ) );
4208718d260SArmin Le Grand 		mpTextAttr->Put( SvxFontItem( aFnt.GetFamily(), aFnt.GetName(), aFnt.GetStyleName(), aFnt.GetPitch(), aFnt.GetCharSet(), EE_CHAR_FONTINFO_CJK ) );
4218718d260SArmin Le Grand 		mpTextAttr->Put( SvxFontItem( aFnt.GetFamily(), aFnt.GetName(), aFnt.GetStyleName(), aFnt.GetPitch(), aFnt.GetCharSet(), EE_CHAR_FONTINFO_CTL ) );
4228718d260SArmin Le Grand         mpTextAttr->Put(SvxPostureItem(aFnt.GetItalic(), EE_CHAR_ITALIC));
4238718d260SArmin Le Grand         mpTextAttr->Put(SvxWeightItem(aFnt.GetWeight(), EE_CHAR_WEIGHT));
4248718d260SArmin Le Grand 		mpTextAttr->Put( SvxFontHeightItem( nHeight, 100, EE_CHAR_FONTHEIGHT ) );
4258718d260SArmin Le Grand 		mpTextAttr->Put( SvxFontHeightItem( nHeight, 100, EE_CHAR_FONTHEIGHT_CJK ) );
4268718d260SArmin Le Grand 		mpTextAttr->Put( SvxFontHeightItem( nHeight, 100, EE_CHAR_FONTHEIGHT_CTL ) );
4278718d260SArmin Le Grand         mpTextAttr->Put(SvxCharScaleWidthItem(100, EE_CHAR_FONTWIDTH));
4288718d260SArmin Le Grand         mpTextAttr->Put(SvxUnderlineItem(aFnt.GetUnderline(), EE_CHAR_UNDERLINE));
4298718d260SArmin Le Grand         mpTextAttr->Put(SvxOverlineItem(aFnt.GetOverline(), EE_CHAR_OVERLINE));
4308718d260SArmin Le Grand         mpTextAttr->Put(SvxCrossedOutItem(aFnt.GetStrikeout(), EE_CHAR_STRIKEOUT));
4318718d260SArmin Le Grand         mpTextAttr->Put(SvxShadowedItem(aFnt.IsShadow(), EE_CHAR_SHADOW));
432a5258243SPedro Giffuni 
433a5258243SPedro Giffuni         // #i118485# Setting this item leads to problems (written #i118498# for this)
4348718d260SArmin Le Grand         // mpTextAttr->Put(SvxAutoKernItem(aFnt.IsKerning(), EE_CHAR_KERNING));
435a5258243SPedro Giffuni 
4368718d260SArmin Le Grand         mpTextAttr->Put(SvxWordLineModeItem(aFnt.IsWordLineMode(), EE_CHAR_WLM));
4378718d260SArmin Le Grand         mpTextAttr->Put(SvxContourItem(aFnt.IsOutline(), EE_CHAR_OUTLINE));
4388718d260SArmin Le Grand         mpTextAttr->Put(SvxColorItem(maVD.GetTextColor(), EE_CHAR_COLOR));
439cdf0e10cSrcweir 		//... svxfont textitem svditext
4408718d260SArmin Le Grand 		mbFntDirty = false;
441cdf0e10cSrcweir 	}
4428718d260SArmin Le Grand 
4438718d260SArmin Le Grand     if(pObj)
444cdf0e10cSrcweir 	{
4458718d260SArmin Le Grand 		pObj->SetLayer(mnLayer);
4468718d260SArmin Le Grand 
4478718d260SArmin Le Grand         if(bLine)
4488718d260SArmin Le Grand         {
4498718d260SArmin Le Grand             pObj->SetMergedItemSet(*mpLineAttr);
4508718d260SArmin Le Grand         }
4518718d260SArmin Le Grand 
4528718d260SArmin Le Grand 		if(bFill)
4538718d260SArmin Le Grand         {
4548718d260SArmin Le Grand             pObj->SetMergedItemSet(*mpFillAttr);
4558718d260SArmin Le Grand         }
4568718d260SArmin Le Grand 
4578718d260SArmin Le Grand 		if(bText)
458cdf0e10cSrcweir 		{
4598718d260SArmin Le Grand 			pObj->SetMergedItemSet(*mpTextAttr);
4608718d260SArmin Le Grand 			pObj->SetMergedItem(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_LEFT));
461cdf0e10cSrcweir 		}
462cdf0e10cSrcweir 	}
463cdf0e10cSrcweir }
464cdf0e10cSrcweir 
4658718d260SArmin Le Grand void ImpSdrGDIMetaFileImport::InsertObj(SdrObject* pObj, bool bScale)
466cdf0e10cSrcweir {
4678718d260SArmin Le Grand     if(bScale && !maScaleRect.IsEmpty())
468cdf0e10cSrcweir     {
4698718d260SArmin Le Grand 		if(mbSize)
4708718d260SArmin Le Grand         {
4718718d260SArmin Le Grand 			pObj->NbcResize(Point(), maScaleX, maScaleY);
4728718d260SArmin Le Grand         }
4738718d260SArmin Le Grand 
4748718d260SArmin Le Grand         if(mbMov)
4758718d260SArmin Le Grand         {
4768718d260SArmin Le Grand 			pObj->NbcMove(Size(maOfs.X(), maOfs.Y()));
4778718d260SArmin Le Grand         }
478cdf0e10cSrcweir 	}
479cdf0e10cSrcweir 
48047a7c0c1SArmin Le Grand     if(isClip())
481cdf0e10cSrcweir     {
48247a7c0c1SArmin Le Grand         const basegfx::B2DPolyPolygon aPoly(pObj->TakeXorPoly());
48347a7c0c1SArmin Le Grand         const basegfx::B2DRange aOldRange(aPoly.getB2DRange());
48447a7c0c1SArmin Le Grand     	const SdrLayerID aOldLayer(pObj->GetLayer());
48547a7c0c1SArmin Le Grand     	const SfxItemSet aOldItemSet(pObj->GetMergedItemSet());
48647a7c0c1SArmin Le Grand         const SdrGrafObj* pSdrGrafObj = dynamic_cast< SdrGrafObj* >(pObj);
48747a7c0c1SArmin Le Grand         BitmapEx aBitmapEx;
48847a7c0c1SArmin Le Grand 
48947a7c0c1SArmin Le Grand         if(pSdrGrafObj)
49047a7c0c1SArmin Le Grand         {
49147a7c0c1SArmin Le Grand         	aBitmapEx = pSdrGrafObj->GetGraphic().GetBitmapEx();
49247a7c0c1SArmin Le Grand         }
493cdf0e10cSrcweir 
49447a7c0c1SArmin Le Grand         SdrObject::Free(pObj);
49547a7c0c1SArmin Le Grand 
49647a7c0c1SArmin Le Grand         if(!aOldRange.isEmpty())
49747a7c0c1SArmin Le Grand         {
49847a7c0c1SArmin Le Grand             // clip against ClipRegion
49947a7c0c1SArmin Le Grand             const basegfx::B2DPolyPolygon aNewPoly(
50047a7c0c1SArmin Le Grand                 basegfx::tools::clipPolyPolygonOnPolyPolygon(
50147a7c0c1SArmin Le Grand                     aPoly,
50247a7c0c1SArmin Le Grand                     maClip,
50347a7c0c1SArmin Le Grand                     true,
50447a7c0c1SArmin Le Grand                     aPoly.isClosed() ? false : true));
50547a7c0c1SArmin Le Grand             const basegfx::B2DRange aNewRange(aNewPoly.getB2DRange());
50647a7c0c1SArmin Le Grand 
50747a7c0c1SArmin Le Grand             if(!aNewRange.isEmpty())
50847a7c0c1SArmin Le Grand             {
50947a7c0c1SArmin Le Grand                 pObj = new SdrPathObj(
51047a7c0c1SArmin Le Grand                     aNewPoly.isClosed() ? OBJ_POLY : OBJ_PLIN,
51147a7c0c1SArmin Le Grand                     aNewPoly);
51247a7c0c1SArmin Le Grand 
51347a7c0c1SArmin Le Grand 		        pObj->SetLayer(aOldLayer);
51447a7c0c1SArmin Le Grand 		        pObj->SetMergedItemSet(aOldItemSet);
51547a7c0c1SArmin Le Grand 
51647a7c0c1SArmin Le Grand                 if(!!aBitmapEx)
51747a7c0c1SArmin Le Grand                 {
51847a7c0c1SArmin Le Grand                     // aNewRange is inside of aOldRange and defines which part of aBitmapEx is used
51947a7c0c1SArmin Le Grand                     const double fScaleX(aBitmapEx.GetSizePixel().Width() / (aOldRange.getWidth() ? aOldRange.getWidth() : 1.0));
52047a7c0c1SArmin Le Grand                     const double fScaleY(aBitmapEx.GetSizePixel().Height() / (aOldRange.getHeight() ? aOldRange.getHeight() : 1.0));
52147a7c0c1SArmin Le Grand                     basegfx::B2DRange aPixel(aNewRange);
52247a7c0c1SArmin Le Grand                     basegfx::B2DHomMatrix aTrans;
52347a7c0c1SArmin Le Grand 
52447a7c0c1SArmin Le Grand                     aTrans.translate(-aOldRange.getMinX(), -aOldRange.getMinY());
52547a7c0c1SArmin Le Grand                     aTrans.scale(fScaleX, fScaleY);
52647a7c0c1SArmin Le Grand                     aPixel.transform(aTrans);
52747a7c0c1SArmin Le Grand 
528*468982e4SArmin Le Grand                     const Size aOrigSizePixel(aBitmapEx.GetSizePixel());
529*468982e4SArmin Le Grand                     const Point aClipTopLeft(
530*468982e4SArmin Le Grand                         basegfx::fround(floor(std::max(0.0, aPixel.getMinX()))),
531*468982e4SArmin Le Grand                         basegfx::fround(floor(std::max(0.0, aPixel.getMinY()))));
532*468982e4SArmin Le Grand                     const Size aClipSize(
533*468982e4SArmin Le Grand                         basegfx::fround(ceil(std::min((double)aOrigSizePixel.Width(), aPixel.getWidth()))),
534*468982e4SArmin Le Grand                         basegfx::fround(ceil(std::min((double)aOrigSizePixel.Height(), aPixel.getHeight()))));
53547a7c0c1SArmin Le Grand                     const BitmapEx aClippedBitmap(
53647a7c0c1SArmin Le Grand                         aBitmapEx,
537*468982e4SArmin Le Grand                         aClipTopLeft,
538*468982e4SArmin Le Grand                         aClipSize);
53947a7c0c1SArmin Le Grand 
54047a7c0c1SArmin Le Grand                     pObj->SetMergedItem(XFillStyleItem(XFILL_BITMAP));
54170d3707aSArmin Le Grand                     pObj->SetMergedItem(XFillBitmapItem(String(), Graphic(aClippedBitmap)));
5429f63b866SArmin Le Grand                     pObj->SetMergedItem(XFillBmpTileItem(false));
5439f63b866SArmin Le Grand                     pObj->SetMergedItem(XFillBmpStretchItem(true));
54447a7c0c1SArmin Le Grand                 }
54547a7c0c1SArmin Le Grand             }
54647a7c0c1SArmin Le Grand         }
547cdf0e10cSrcweir     }
548cdf0e10cSrcweir 
54947a7c0c1SArmin Le Grand     if(pObj)
550cdf0e10cSrcweir     {
55147a7c0c1SArmin Le Grand         // #i111954# check object for visibility
55247a7c0c1SArmin Le Grand         // used are SdrPathObj, SdrRectObj, SdrCircObj, SdrGrafObj
55347a7c0c1SArmin Le Grand         bool bVisible(false);
554cdf0e10cSrcweir 
55547a7c0c1SArmin Le Grand         if(pObj->HasLineStyle())
556cdf0e10cSrcweir         {
557cdf0e10cSrcweir             bVisible = true;
558cdf0e10cSrcweir         }
559cdf0e10cSrcweir 
56047a7c0c1SArmin Le Grand         if(!bVisible && pObj->HasFillStyle())
561cdf0e10cSrcweir         {
562cdf0e10cSrcweir             bVisible = true;
563cdf0e10cSrcweir         }
564cdf0e10cSrcweir 
56547a7c0c1SArmin Le Grand         if(!bVisible)
56647a7c0c1SArmin Le Grand         {
56747a7c0c1SArmin Le Grand             SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >(pObj);
56847a7c0c1SArmin Le Grand 
56947a7c0c1SArmin Le Grand             if(pTextObj && pTextObj->HasText())
57047a7c0c1SArmin Le Grand             {
57147a7c0c1SArmin Le Grand                 bVisible = true;
57247a7c0c1SArmin Le Grand             }
57347a7c0c1SArmin Le Grand         }
57447a7c0c1SArmin Le Grand 
57547a7c0c1SArmin Le Grand         if(!bVisible)
57647a7c0c1SArmin Le Grand         {
57747a7c0c1SArmin Le Grand             SdrGrafObj* pGrafObj = dynamic_cast< SdrGrafObj* >(pObj);
57847a7c0c1SArmin Le Grand 
57947a7c0c1SArmin Le Grand             if(pGrafObj)
58047a7c0c1SArmin Le Grand             {
58147a7c0c1SArmin Le Grand                 // this may be refined to check if the graphic really is visible. It
58247a7c0c1SArmin Le Grand                 // is here to ensure that graphic objects without fill, line and text
58347a7c0c1SArmin Le Grand                 // get created
58447a7c0c1SArmin Le Grand                 bVisible = true;
58547a7c0c1SArmin Le Grand             }
58647a7c0c1SArmin Le Grand         }
58747a7c0c1SArmin Le Grand 
58847a7c0c1SArmin Le Grand         if(!bVisible)
58947a7c0c1SArmin Le Grand         {
59047a7c0c1SArmin Le Grand             SdrObject::Free(pObj);
59147a7c0c1SArmin Le Grand         }
59247a7c0c1SArmin Le Grand         else
59347a7c0c1SArmin Le Grand         {
5948718d260SArmin Le Grand 	        maTmpList.push_back(pObj);
5958718d260SArmin Le Grand 
5968718d260SArmin Le Grand             if(dynamic_cast< SdrPathObj* >(pObj))
59747a7c0c1SArmin Le Grand 	        {
5988718d260SArmin Le Grand 		        const bool bClosed(pObj->IsClosedObj());
5998718d260SArmin Le Grand 
6008718d260SArmin Le Grand                 mbLastObjWasPolyWithoutLine = mbNoLine && bClosed;
6018718d260SArmin Le Grand 		        mbLastObjWasLine = !bClosed;
60247a7c0c1SArmin Le Grand 	        }
60347a7c0c1SArmin Le Grand 	        else
60447a7c0c1SArmin Le Grand 	        {
6058718d260SArmin Le Grand 		        mbLastObjWasPolyWithoutLine = false;
6068718d260SArmin Le Grand 		        mbLastObjWasLine = false;
60747a7c0c1SArmin Le Grand 	        }
60847a7c0c1SArmin Le Grand         }
609cdf0e10cSrcweir     }
610cdf0e10cSrcweir }
611cdf0e10cSrcweir 
612cdf0e10cSrcweir /**************************************************************************************************/
613cdf0e10cSrcweir 
614cdf0e10cSrcweir void ImpSdrGDIMetaFileImport::DoAction(MetaPixelAction& /*rAct*/)
615cdf0e10cSrcweir {
616cdf0e10cSrcweir }
617cdf0e10cSrcweir 
618cdf0e10cSrcweir void ImpSdrGDIMetaFileImport::DoAction(MetaPointAction& /*rAct*/)
619cdf0e10cSrcweir {
620cdf0e10cSrcweir }
621cdf0e10cSrcweir 
622cdf0e10cSrcweir void ImpSdrGDIMetaFileImport::DoAction(MetaLineAction& rAct)
623cdf0e10cSrcweir {
624cdf0e10cSrcweir 	// #i73407# reformulation to use new B2DPolygon classes
625cdf0e10cSrcweir 	const basegfx::B2DPoint aStart(rAct.GetStartPoint().X(), rAct.GetStartPoint().Y());
626cdf0e10cSrcweir 	const basegfx::B2DPoint aEnd(rAct.GetEndPoint().X(), rAct.GetEndPoint().Y());
627cdf0e10cSrcweir 
628cdf0e10cSrcweir 	if(!aStart.equal(aEnd))
629cdf0e10cSrcweir 	{
630cdf0e10cSrcweir 		basegfx::B2DPolygon aLine;
6318718d260SArmin Le Grand 		const basegfx::B2DHomMatrix aTransform(basegfx::tools::createScaleTranslateB2DHomMatrix(mfScaleX, mfScaleY, maOfs.X(), maOfs.Y()));
632cdf0e10cSrcweir 
633cdf0e10cSrcweir 		aLine.append(aStart);
634cdf0e10cSrcweir 		aLine.append(aEnd);
635cdf0e10cSrcweir 		aLine.transform(aTransform);
636cdf0e10cSrcweir 
637cdf0e10cSrcweir 		const LineInfo& rLineInfo = rAct.GetLineInfo();
638cdf0e10cSrcweir 		const sal_Int32 nNewLineWidth(rLineInfo.GetWidth());
639cdf0e10cSrcweir 		bool bCreateLineObject(true);
640cdf0e10cSrcweir 
6418718d260SArmin Le Grand 		if(mbLastObjWasLine && (nNewLineWidth == mnLineWidth) && CheckLastLineMerge(aLine))
642cdf0e10cSrcweir 		{
643cdf0e10cSrcweir 			bCreateLineObject = false;
644cdf0e10cSrcweir 		}
645cdf0e10cSrcweir 
646cdf0e10cSrcweir 		if(bCreateLineObject)
647cdf0e10cSrcweir 		{
648cdf0e10cSrcweir 			SdrPathObj* pPath = new SdrPathObj(OBJ_LINE, basegfx::B2DPolyPolygon(aLine));
6498718d260SArmin Le Grand 			mnLineWidth = nNewLineWidth;
650cdf0e10cSrcweir 			maLineJoin = rLineInfo.GetLineJoin();
6515aaf853bSArmin Le Grand             maLineCap = rLineInfo.GetLineCap();
652cdf0e10cSrcweir 			maDash = XDash(XDASH_RECT,
653cdf0e10cSrcweir 				rLineInfo.GetDotCount(), rLineInfo.GetDotLen(),
654cdf0e10cSrcweir 				rLineInfo.GetDashCount(), rLineInfo.GetDashLen(),
655cdf0e10cSrcweir 				rLineInfo.GetDistance());
656cdf0e10cSrcweir 			SetAttributes(pPath);
6578718d260SArmin Le Grand 			mnLineWidth = 0;
658cdf0e10cSrcweir 			maLineJoin = basegfx::B2DLINEJOIN_NONE;
659cdf0e10cSrcweir 			maDash = XDash();
660cdf0e10cSrcweir 			InsertObj(pPath, false);
661cdf0e10cSrcweir 		}
662cdf0e10cSrcweir 	}
663cdf0e10cSrcweir }
664cdf0e10cSrcweir 
665cdf0e10cSrcweir void ImpSdrGDIMetaFileImport::DoAction(MetaRectAction& rAct)
666cdf0e10cSrcweir {
66747a7c0c1SArmin Le Grand     SdrRectObj* pRect=new SdrRectObj(rAct.GetRect());
668cdf0e10cSrcweir 	SetAttributes(pRect);
669cdf0e10cSrcweir 	InsertObj(pRect);
670cdf0e10cSrcweir }
671cdf0e10cSrcweir 
672cdf0e10cSrcweir void ImpSdrGDIMetaFileImport::DoAction(MetaRoundRectAction& rAct)
673cdf0e10cSrcweir {
67447a7c0c1SArmin Le Grand     SdrRectObj* pRect=new SdrRectObj(rAct.GetRect());
675cdf0e10cSrcweir 	SetAttributes(pRect);
676cdf0e10cSrcweir 	long nRad=(rAct.GetHorzRound()+rAct.GetVertRound())/2;
677cdf0e10cSrcweir 	if (nRad!=0) {
6788718d260SArmin Le Grand 		SfxItemSet aSet(*mpLineAttr->GetPool(), SDRATTR_ECKENRADIUS, SDRATTR_ECKENRADIUS, 0, 0);
679cdf0e10cSrcweir 		aSet.Put(SdrEckenradiusItem(nRad));
680cdf0e10cSrcweir 		pRect->SetMergedItemSet(aSet);
681cdf0e10cSrcweir 	}
682cdf0e10cSrcweir 	InsertObj(pRect);
683cdf0e10cSrcweir }
684cdf0e10cSrcweir 
685cdf0e10cSrcweir /**************************************************************************************************/
686cdf0e10cSrcweir 
687cdf0e10cSrcweir void ImpSdrGDIMetaFileImport::DoAction(MetaEllipseAction& rAct)
688cdf0e10cSrcweir {
68947a7c0c1SArmin Le Grand     SdrCircObj* pCirc=new SdrCircObj(OBJ_CIRC,rAct.GetRect());
690cdf0e10cSrcweir 	SetAttributes(pCirc);
691cdf0e10cSrcweir 	InsertObj(pCirc);
692cdf0e10cSrcweir }
693cdf0e10cSrcweir 
694cdf0e10cSrcweir void ImpSdrGDIMetaFileImport::DoAction(MetaArcAction& rAct)
695cdf0e10cSrcweir {
69647a7c0c1SArmin Le Grand     Point aCenter(rAct.GetRect().Center());
697cdf0e10cSrcweir 	long nStart=GetAngle(rAct.GetStartPoint()-aCenter);
698cdf0e10cSrcweir 	long nEnd=GetAngle(rAct.GetEndPoint()-aCenter);
699cdf0e10cSrcweir 	SdrCircObj* pCirc=new SdrCircObj(OBJ_CARC,rAct.GetRect(),nStart,nEnd);
700cdf0e10cSrcweir 	SetAttributes(pCirc);
701cdf0e10cSrcweir 	InsertObj(pCirc);
702cdf0e10cSrcweir }
703cdf0e10cSrcweir 
704cdf0e10cSrcweir void ImpSdrGDIMetaFileImport::DoAction(MetaPieAction& rAct)
705cdf0e10cSrcweir {
70647a7c0c1SArmin Le Grand     Point aCenter(rAct.GetRect().Center());
707cdf0e10cSrcweir 	long nStart=GetAngle(rAct.GetStartPoint()-aCenter);
708cdf0e10cSrcweir 	long nEnd=GetAngle(rAct.GetEndPoint()-aCenter);
709cdf0e10cSrcweir 	SdrCircObj* pCirc=new SdrCircObj(OBJ_SECT,rAct.GetRect(),nStart,nEnd);
710cdf0e10cSrcweir 	SetAttributes(pCirc);
711cdf0e10cSrcweir 	InsertObj(pCirc);
712cdf0e10cSrcweir }
713cdf0e10cSrcweir 
714cdf0e10cSrcweir void ImpSdrGDIMetaFileImport::DoAction(MetaChordAction& rAct)
715cdf0e10cSrcweir {
71647a7c0c1SArmin Le Grand     Point aCenter(rAct.GetRect().Center());
717cdf0e10cSrcweir 	long nStart=GetAngle(rAct.GetStartPoint()-aCenter);
718cdf0e10cSrcweir 	long nEnd=GetAngle(rAct.GetEndPoint()-aCenter);
719cdf0e10cSrcweir 	SdrCircObj* pCirc=new SdrCircObj(OBJ_CCUT,rAct.GetRect(),nStart,nEnd);
720cdf0e10cSrcweir 	SetAttributes(pCirc);
721cdf0e10cSrcweir 	InsertObj(pCirc);
722cdf0e10cSrcweir }
723cdf0e10cSrcweir 
724cdf0e10cSrcweir /**************************************************************************************************/
725cdf0e10cSrcweir 
726cdf0e10cSrcweir bool ImpSdrGDIMetaFileImport::CheckLastLineMerge(const basegfx::B2DPolygon& rSrcPoly)
727cdf0e10cSrcweir {
728cdf0e10cSrcweir 	// #i102706# Do not merge closed polygons
729cdf0e10cSrcweir 	if(rSrcPoly.isClosed())
730cdf0e10cSrcweir 	{
731cdf0e10cSrcweir 		return false;
732cdf0e10cSrcweir 	}
733cdf0e10cSrcweir 
734cdf0e10cSrcweir 	// #i73407# reformulation to use new B2DPolygon classes
7358718d260SArmin Le Grand 	if(mbLastObjWasLine && (maOldLineColor == maVD.GetLineColor()) && rSrcPoly.count())
736cdf0e10cSrcweir 	{
7378718d260SArmin Le Grand 		SdrObject* pTmpObj = maTmpList.size() ? maTmpList[maTmpList.size() - 1] : 0;
7388718d260SArmin Le Grand 		SdrPathObj* pLastPoly = dynamic_cast< SdrPathObj* >(pTmpObj);
739cdf0e10cSrcweir 
740cdf0e10cSrcweir 		if(pLastPoly)
741cdf0e10cSrcweir 		{
742cdf0e10cSrcweir 			if(1L == pLastPoly->GetPathPoly().count())
743cdf0e10cSrcweir 			{
744cdf0e10cSrcweir 				bool bOk(false);
745cdf0e10cSrcweir 				basegfx::B2DPolygon aDstPoly(pLastPoly->GetPathPoly().getB2DPolygon(0L));
746cdf0e10cSrcweir 
747cdf0e10cSrcweir 				// #i102706# Do not merge closed polygons
748cdf0e10cSrcweir 				if(aDstPoly.isClosed())
749cdf0e10cSrcweir 				{
750cdf0e10cSrcweir 					return false;
751cdf0e10cSrcweir 				}
752cdf0e10cSrcweir 
753cdf0e10cSrcweir 				if(aDstPoly.count())
754cdf0e10cSrcweir 				{
755cdf0e10cSrcweir 					const sal_uInt32 nMaxDstPnt(aDstPoly.count() - 1L);
756cdf0e10cSrcweir 					const sal_uInt32 nMaxSrcPnt(rSrcPoly.count() - 1L);
757cdf0e10cSrcweir 
758cdf0e10cSrcweir 					if(aDstPoly.getB2DPoint(nMaxDstPnt) == rSrcPoly.getB2DPoint(0L))
759cdf0e10cSrcweir 					{
760cdf0e10cSrcweir 						aDstPoly.append(rSrcPoly, 1L, rSrcPoly.count() - 1L);
761cdf0e10cSrcweir 						bOk = true;
762cdf0e10cSrcweir 					}
763cdf0e10cSrcweir 					else if(aDstPoly.getB2DPoint(0L) == rSrcPoly.getB2DPoint(nMaxSrcPnt))
764cdf0e10cSrcweir 					{
765cdf0e10cSrcweir 						basegfx::B2DPolygon aNew(rSrcPoly);
766cdf0e10cSrcweir 						aNew.append(aDstPoly, 1L, aDstPoly.count() - 1L);
767cdf0e10cSrcweir 						aDstPoly = aNew;
768cdf0e10cSrcweir 						bOk = true;
769cdf0e10cSrcweir 					}
770cdf0e10cSrcweir 					else if(aDstPoly.getB2DPoint(0L) == rSrcPoly.getB2DPoint(0L))
771cdf0e10cSrcweir 					{
772cdf0e10cSrcweir 						aDstPoly.flip();
773cdf0e10cSrcweir 						aDstPoly.append(rSrcPoly, 1L, rSrcPoly.count() - 1L);
774cdf0e10cSrcweir 						bOk = true;
775cdf0e10cSrcweir 					}
776cdf0e10cSrcweir 					else if(aDstPoly.getB2DPoint(nMaxDstPnt) == rSrcPoly.getB2DPoint(nMaxSrcPnt))
777cdf0e10cSrcweir 					{
778cdf0e10cSrcweir 						basegfx::B2DPolygon aNew(rSrcPoly);
779cdf0e10cSrcweir 						aNew.flip();
780cdf0e10cSrcweir 						aDstPoly.append(aNew, 1L, aNew.count() - 1L);
781cdf0e10cSrcweir 						bOk = true;
782cdf0e10cSrcweir 					}
783cdf0e10cSrcweir 				}
784cdf0e10cSrcweir 
785cdf0e10cSrcweir 				if(bOk)
786cdf0e10cSrcweir 				{
787cdf0e10cSrcweir 					pLastPoly->NbcSetPathPoly(basegfx::B2DPolyPolygon(aDstPoly));
788cdf0e10cSrcweir 				}
789cdf0e10cSrcweir 
790cdf0e10cSrcweir 				return bOk;
791cdf0e10cSrcweir 			}
792cdf0e10cSrcweir 		}
793cdf0e10cSrcweir 	}
794cdf0e10cSrcweir 
795cdf0e10cSrcweir 	return false;
796cdf0e10cSrcweir }
797cdf0e10cSrcweir 
798cdf0e10cSrcweir bool ImpSdrGDIMetaFileImport::CheckLastPolyLineAndFillMerge(const basegfx::B2DPolyPolygon & rPolyPolygon)
799cdf0e10cSrcweir {
800cdf0e10cSrcweir 	// #i73407# reformulation to use new B2DPolygon classes
8018718d260SArmin Le Grand 	if(mbLastObjWasPolyWithoutLine)
802cdf0e10cSrcweir 	{
8038718d260SArmin Le Grand 		SdrObject* pTmpObj = maTmpList.size() ? maTmpList[maTmpList.size() - 1] : 0;
8048718d260SArmin Le Grand 		SdrPathObj* pLastPoly = dynamic_cast< SdrPathObj* >(pTmpObj);
805cdf0e10cSrcweir 
806cdf0e10cSrcweir 		if(pLastPoly)
807cdf0e10cSrcweir 		{
808cdf0e10cSrcweir 			if(pLastPoly->GetPathPoly() == rPolyPolygon)
809cdf0e10cSrcweir 			{
810cdf0e10cSrcweir 				SetAttributes(NULL);
811cdf0e10cSrcweir 
8128718d260SArmin Le Grand 				if(!mbNoLine && mbNoFill)
813cdf0e10cSrcweir 				{
8148718d260SArmin Le Grand 					pLastPoly->SetMergedItemSet(*mpLineAttr);
815cdf0e10cSrcweir 
816cdf0e10cSrcweir 					return true;
817cdf0e10cSrcweir 				}
818cdf0e10cSrcweir 			}
819cdf0e10cSrcweir 		}
820cdf0e10cSrcweir 	}
821cdf0e10cSrcweir 
822cdf0e10cSrcweir 	return false;
823cdf0e10cSrcweir }
824cdf0e10cSrcweir 
82547a7c0c1SArmin Le Grand void ImpSdrGDIMetaFileImport::checkClip()
82647a7c0c1SArmin Le Grand {
8278718d260SArmin Le Grand     if(maVD.IsClipRegion())
82847a7c0c1SArmin Le Grand     {
829e6f63103SArmin Le Grand         maClip = maVD.GetClipRegion().GetAsB2DPolyPolygon();
83047a7c0c1SArmin Le Grand 
83147a7c0c1SArmin Le Grand         if(isClip())
83247a7c0c1SArmin Le Grand         {
83347a7c0c1SArmin Le Grand     		const basegfx::B2DHomMatrix aTransform(
83447a7c0c1SArmin Le Grand                 basegfx::tools::createScaleTranslateB2DHomMatrix(
8358718d260SArmin Le Grand                     mfScaleX,
8368718d260SArmin Le Grand                     mfScaleY,
8378718d260SArmin Le Grand                     maOfs.X(),
8388718d260SArmin Le Grand                     maOfs.Y()));
83947a7c0c1SArmin Le Grand 
84047a7c0c1SArmin Le Grand             maClip.transform(aTransform);
84147a7c0c1SArmin Le Grand         }
84247a7c0c1SArmin Le Grand     }
84347a7c0c1SArmin Le Grand }
84447a7c0c1SArmin Le Grand 
84547a7c0c1SArmin Le Grand bool ImpSdrGDIMetaFileImport::isClip() const
84647a7c0c1SArmin Le Grand {
84747a7c0c1SArmin Le Grand     return !maClip.getB2DRange().isEmpty();
84847a7c0c1SArmin Le Grand }
849cdf0e10cSrcweir 
850cdf0e10cSrcweir void ImpSdrGDIMetaFileImport::DoAction( MetaPolyLineAction& rAct )
851cdf0e10cSrcweir {
852cdf0e10cSrcweir 	// #i73407# reformulation to use new B2DPolygon classes
853cdf0e10cSrcweir 	basegfx::B2DPolygon aSource(rAct.GetPolygon().getB2DPolygon());
854cdf0e10cSrcweir 
855cdf0e10cSrcweir 	if(aSource.count())
856cdf0e10cSrcweir 	{
8578718d260SArmin Le Grand 		const basegfx::B2DHomMatrix aTransform(basegfx::tools::createScaleTranslateB2DHomMatrix(mfScaleX, mfScaleY, maOfs.X(), maOfs.Y()));
858cdf0e10cSrcweir 		aSource.transform(aTransform);
859cdf0e10cSrcweir 	}
860cdf0e10cSrcweir 
861cdf0e10cSrcweir 	const LineInfo& rLineInfo = rAct.GetLineInfo();
862cdf0e10cSrcweir 	const sal_Int32 nNewLineWidth(rLineInfo.GetWidth());
863cdf0e10cSrcweir 	bool bCreateLineObject(true);
864cdf0e10cSrcweir 
8658718d260SArmin Le Grand 	if(mbLastObjWasLine && (nNewLineWidth == mnLineWidth) && CheckLastLineMerge(aSource))
866cdf0e10cSrcweir 	{
867cdf0e10cSrcweir 		bCreateLineObject = false;
868cdf0e10cSrcweir 	}
8698718d260SArmin Le Grand 	else if(mbLastObjWasPolyWithoutLine && CheckLastPolyLineAndFillMerge(basegfx::B2DPolyPolygon(aSource)))
870cdf0e10cSrcweir 	{
871cdf0e10cSrcweir 		bCreateLineObject = false;
872cdf0e10cSrcweir 	}
873cdf0e10cSrcweir 
874cdf0e10cSrcweir 	if(bCreateLineObject)
875cdf0e10cSrcweir 	{
87647a7c0c1SArmin Le Grand         SdrPathObj* pPath = new SdrPathObj(
877cdf0e10cSrcweir 			aSource.isClosed() ? OBJ_POLY : OBJ_PLIN,
878cdf0e10cSrcweir 			basegfx::B2DPolyPolygon(aSource));
8798718d260SArmin Le Grand 		mnLineWidth = nNewLineWidth;
880cdf0e10cSrcweir 		maLineJoin = rLineInfo.GetLineJoin();
8815aaf853bSArmin Le Grand         maLineCap = rLineInfo.GetLineCap();
882cdf0e10cSrcweir 		maDash = XDash(XDASH_RECT,
883cdf0e10cSrcweir 			rLineInfo.GetDotCount(), rLineInfo.GetDotLen(),
884cdf0e10cSrcweir 			rLineInfo.GetDashCount(), rLineInfo.GetDashLen(),
885cdf0e10cSrcweir 			rLineInfo.GetDistance());
886cdf0e10cSrcweir 		SetAttributes(pPath);
8878718d260SArmin Le Grand 		mnLineWidth = 0;
888cdf0e10cSrcweir 		maLineJoin = basegfx::B2DLINEJOIN_NONE;
889cdf0e10cSrcweir 		maDash = XDash();
890cdf0e10cSrcweir 		InsertObj(pPath, false);
891cdf0e10cSrcweir 	}
892cdf0e10cSrcweir }
893cdf0e10cSrcweir 
894cdf0e10cSrcweir void ImpSdrGDIMetaFileImport::DoAction( MetaPolygonAction& rAct )
895cdf0e10cSrcweir {
896cdf0e10cSrcweir 	// #i73407# reformulation to use new B2DPolygon classes
897cdf0e10cSrcweir 	basegfx::B2DPolygon aSource(rAct.GetPolygon().getB2DPolygon());
898cdf0e10cSrcweir 
899cdf0e10cSrcweir 	if(aSource.count())
900cdf0e10cSrcweir 	{
9018718d260SArmin Le Grand 		const basegfx::B2DHomMatrix aTransform(basegfx::tools::createScaleTranslateB2DHomMatrix(mfScaleX, mfScaleY, maOfs.X(), maOfs.Y()));
902cdf0e10cSrcweir 		aSource.transform(aTransform);
903cdf0e10cSrcweir 
9048718d260SArmin Le Grand 		if(!mbLastObjWasPolyWithoutLine || !CheckLastPolyLineAndFillMerge(basegfx::B2DPolyPolygon(aSource)))
905cdf0e10cSrcweir 		{
906cdf0e10cSrcweir 			// #i73407# make sure polygon is closed, it's a filled primitive
907cdf0e10cSrcweir 			aSource.setClosed(true);
90847a7c0c1SArmin Le Grand             SdrPathObj* pPath = new SdrPathObj(OBJ_POLY, basegfx::B2DPolyPolygon(aSource));
909cdf0e10cSrcweir 			SetAttributes(pPath);
910cdf0e10cSrcweir 			InsertObj(pPath, false);
911cdf0e10cSrcweir 		}
912cdf0e10cSrcweir 	}
913cdf0e10cSrcweir }
914cdf0e10cSrcweir 
915cdf0e10cSrcweir void ImpSdrGDIMetaFileImport::DoAction(MetaPolyPolygonAction& rAct)
916cdf0e10cSrcweir {
917cdf0e10cSrcweir 	// #i73407# reformulation to use new B2DPolygon classes
918cdf0e10cSrcweir 	basegfx::B2DPolyPolygon aSource(rAct.GetPolyPolygon().getB2DPolyPolygon());
919cdf0e10cSrcweir 
920cdf0e10cSrcweir 	if(aSource.count())
921cdf0e10cSrcweir 	{
9228718d260SArmin Le Grand 		const basegfx::B2DHomMatrix aTransform(basegfx::tools::createScaleTranslateB2DHomMatrix(mfScaleX, mfScaleY, maOfs.X(), maOfs.Y()));
923cdf0e10cSrcweir 		aSource.transform(aTransform);
924cdf0e10cSrcweir 
9258718d260SArmin Le Grand 		if(!mbLastObjWasPolyWithoutLine || !CheckLastPolyLineAndFillMerge(aSource))
926cdf0e10cSrcweir 		{
927cdf0e10cSrcweir 			// #i73407# make sure polygon is closed, it's a filled primitive
928cdf0e10cSrcweir 			aSource.setClosed(true);
92947a7c0c1SArmin Le Grand             SdrPathObj* pPath = new SdrPathObj(OBJ_POLY, aSource);
930cdf0e10cSrcweir 			SetAttributes(pPath);
931cdf0e10cSrcweir 			InsertObj(pPath, false);
932cdf0e10cSrcweir 		}
933cdf0e10cSrcweir 	}
934cdf0e10cSrcweir }
935cdf0e10cSrcweir 
936cdf0e10cSrcweir /**************************************************************************************************/
937cdf0e10cSrcweir 
938cdf0e10cSrcweir void ImpSdrGDIMetaFileImport::ImportText( const Point& rPos, const XubString& rStr, const MetaAction& rAct )
939cdf0e10cSrcweir {
940cdf0e10cSrcweir 	// calc text box size, add 5% to make it fit safely
941cdf0e10cSrcweir 
9428718d260SArmin Le Grand 	FontMetric aFontMetric( maVD.GetFontMetric() );
9438718d260SArmin Le Grand 	Font aFnt( maVD.GetFont() );
944cdf0e10cSrcweir 	FontAlign eAlg( aFnt.GetAlign() );
945cdf0e10cSrcweir 
9468718d260SArmin Le Grand     sal_Int32 nTextWidth = (sal_Int32)( maVD.GetTextWidth( rStr ) * mfScaleX );
9478718d260SArmin Le Grand     sal_Int32 nTextHeight = (sal_Int32)( maVD.GetTextHeight() * mfScaleY );
948cdf0e10cSrcweir 	//sal_Int32 nDxWidth = 0;
949cdf0e10cSrcweir 	//sal_Int32 nLen = rStr.Len();
950cdf0e10cSrcweir 
9518718d260SArmin Le Grand 	Point aPos( FRound(rPos.X() * mfScaleX + maOfs.X()), FRound(rPos.Y() * mfScaleY + maOfs.Y()) );
952cdf0e10cSrcweir     Size aSize( nTextWidth, nTextHeight );
953cdf0e10cSrcweir 
954cdf0e10cSrcweir 	if ( eAlg == ALIGN_BASELINE )
9558718d260SArmin Le Grand 		aPos.Y() -= FRound(aFontMetric.GetAscent() * mfScaleY);
956cdf0e10cSrcweir 	else if ( eAlg == ALIGN_BOTTOM )
957cdf0e10cSrcweir 		aPos.Y() -= nTextHeight;
958cdf0e10cSrcweir 
959cdf0e10cSrcweir 	Rectangle aTextRect( aPos, aSize );
960cdf0e10cSrcweir 	SdrRectObj* pText =new SdrRectObj( OBJ_TEXT, aTextRect );
961cdf0e10cSrcweir 
962cdf0e10cSrcweir 	if ( aFnt.GetWidth() || ( rAct.GetType() == META_STRETCHTEXT_ACTION ) )
963cdf0e10cSrcweir 	{
964cdf0e10cSrcweir 		pText->ClearMergedItem( SDRATTR_TEXT_AUTOGROWWIDTH );
9658718d260SArmin Le Grand 		pText->SetMergedItem( SdrTextAutoGrowHeightItem( false ) );
966cdf0e10cSrcweir 		// don't let the margins eat the space needed for the text
967cdf0e10cSrcweir 		pText->SetMergedItem ( SdrTextUpperDistItem (0));
968cdf0e10cSrcweir 		pText->SetMergedItem ( SdrTextLowerDistItem (0));
969cdf0e10cSrcweir 		pText->SetMergedItem ( SdrTextRightDistItem (0));
970cdf0e10cSrcweir 		pText->SetMergedItem ( SdrTextLeftDistItem (0));
97126734c99SArmin Le Grand 		pText->SetMergedItem( SdrTextFitToSizeTypeItem( SDRTEXTFIT_ALLLINES ) );
972cdf0e10cSrcweir 	}
973cdf0e10cSrcweir 	else
9748718d260SArmin Le Grand 		pText->SetMergedItem( SdrTextAutoGrowWidthItem( true ) );
975cdf0e10cSrcweir 
9768718d260SArmin Le Grand 	pText->SetModel(mpModel);
9778718d260SArmin Le Grand 	pText->SetLayer(mnLayer);
978cdf0e10cSrcweir 	pText->NbcSetText( rStr );
9798718d260SArmin Le Grand 	SetAttributes( pText, true );
980cdf0e10cSrcweir 	pText->SetSnapRect( aTextRect );
981cdf0e10cSrcweir 
982cdf0e10cSrcweir 	if (!aFnt.IsTransparent())
983cdf0e10cSrcweir 	{
9848718d260SArmin Le Grand 		SfxItemSet aAttr(*mpFillAttr->GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST, 0, 0);
985cdf0e10cSrcweir 		aAttr.Put(XFillStyleItem(XFILL_SOLID));
986cdf0e10cSrcweir 		aAttr.Put(XFillColorItem(String(), aFnt.GetFillColor()));
987cdf0e10cSrcweir 		pText->SetMergedItemSet(aAttr);
988cdf0e10cSrcweir 	}
989cdf0e10cSrcweir 	sal_uInt32 nWink = aFnt.GetOrientation();
990cdf0e10cSrcweir 	if ( nWink )
991cdf0e10cSrcweir 	{
992cdf0e10cSrcweir 		nWink*=10;
993cdf0e10cSrcweir 		double a=nWink*nPi180;
994cdf0e10cSrcweir 		double nSin=sin(a);
995cdf0e10cSrcweir 		double nCos=cos(a);
996cdf0e10cSrcweir 		pText->NbcRotate(aPos,nWink,nSin,nCos);
997cdf0e10cSrcweir 	}
9988718d260SArmin Le Grand 	InsertObj( pText, false );
999cdf0e10cSrcweir }
1000cdf0e10cSrcweir 
1001cdf0e10cSrcweir void ImpSdrGDIMetaFileImport::DoAction(MetaTextAction& rAct)
1002cdf0e10cSrcweir {
1003cdf0e10cSrcweir 	XubString aStr(rAct.GetText());
1004cdf0e10cSrcweir 	aStr.Erase(0,rAct.GetIndex());
1005cdf0e10cSrcweir 	aStr.Erase(rAct.GetLen());
1006cdf0e10cSrcweir 	ImportText( rAct.GetPoint(), aStr, rAct );
1007cdf0e10cSrcweir }
1008cdf0e10cSrcweir 
1009cdf0e10cSrcweir void ImpSdrGDIMetaFileImport::DoAction(MetaTextArrayAction& rAct)
1010cdf0e10cSrcweir {
1011cdf0e10cSrcweir 	XubString aStr(rAct.GetText());
1012cdf0e10cSrcweir 	aStr.Erase(0,rAct.GetIndex());
1013cdf0e10cSrcweir 	aStr.Erase(rAct.GetLen());
1014cdf0e10cSrcweir 	ImportText( rAct.GetPoint(), aStr, rAct );
1015cdf0e10cSrcweir }
1016cdf0e10cSrcweir 
1017cdf0e10cSrcweir void ImpSdrGDIMetaFileImport::DoAction(MetaStretchTextAction& rAct)
1018cdf0e10cSrcweir {
1019cdf0e10cSrcweir 	XubString aStr(rAct.GetText());
1020cdf0e10cSrcweir 	aStr.Erase(0,rAct.GetIndex());
1021cdf0e10cSrcweir 	aStr.Erase(rAct.GetLen());
1022cdf0e10cSrcweir 	ImportText( rAct.GetPoint(), aStr, rAct );
1023cdf0e10cSrcweir }
1024cdf0e10cSrcweir 
1025cdf0e10cSrcweir void ImpSdrGDIMetaFileImport::DoAction(MetaBmpAction& rAct)
1026cdf0e10cSrcweir {
1027cdf0e10cSrcweir 	Rectangle aRect(rAct.GetPoint(),rAct.GetBitmap().GetSizePixel());
1028cdf0e10cSrcweir 	aRect.Right()++; aRect.Bottom()++;
102947a7c0c1SArmin Le Grand     SdrGrafObj* pGraf=new SdrGrafObj(Graphic(rAct.GetBitmap()),aRect);
1030*468982e4SArmin Le Grand 
1031*468982e4SArmin Le Grand     // This action is not creating line and fill, set directly, do not use SetAttributes(..)
1032*468982e4SArmin Le Grand     pGraf->SetMergedItem(XLineStyleItem(XLINE_NONE));
1033*468982e4SArmin Le Grand     pGraf->SetMergedItem(XFillStyleItem(XFILL_NONE));
1034*468982e4SArmin Le Grand     InsertObj(pGraf);
1035cdf0e10cSrcweir }
1036cdf0e10cSrcweir 
1037cdf0e10cSrcweir void ImpSdrGDIMetaFileImport::DoAction(MetaBmpScaleAction& rAct)
1038cdf0e10cSrcweir {
1039cdf0e10cSrcweir 	Rectangle aRect(rAct.GetPoint(),rAct.GetSize());
1040cdf0e10cSrcweir 	aRect.Right()++; aRect.Bottom()++;
104147a7c0c1SArmin Le Grand     SdrGrafObj* pGraf=new SdrGrafObj(Graphic(rAct.GetBitmap()),aRect);
1042*468982e4SArmin Le Grand 
1043*468982e4SArmin Le Grand     // This action is not creating line and fill, set directly, do not use SetAttributes(..)
1044*468982e4SArmin Le Grand     pGraf->SetMergedItem(XLineStyleItem(XLINE_NONE));
1045*468982e4SArmin Le Grand     pGraf->SetMergedItem(XFillStyleItem(XFILL_NONE));
1046*468982e4SArmin Le Grand     InsertObj(pGraf);
1047cdf0e10cSrcweir }
1048cdf0e10cSrcweir 
1049cdf0e10cSrcweir void ImpSdrGDIMetaFileImport::DoAction(MetaBmpExAction& rAct)
1050cdf0e10cSrcweir {
1051cdf0e10cSrcweir 	Rectangle aRect(rAct.GetPoint(),rAct.GetBitmapEx().GetSizePixel());
1052cdf0e10cSrcweir 	aRect.Right()++; aRect.Bottom()++;
105347a7c0c1SArmin Le Grand     SdrGrafObj* pGraf=new SdrGrafObj( rAct.GetBitmapEx(), aRect );
1054*468982e4SArmin Le Grand 
1055*468982e4SArmin Le Grand     // This action is not creating line and fill, set directly, do not use SetAttributes(..)
1056*468982e4SArmin Le Grand     pGraf->SetMergedItem(XLineStyleItem(XLINE_NONE));
1057*468982e4SArmin Le Grand     pGraf->SetMergedItem(XFillStyleItem(XFILL_NONE));
1058*468982e4SArmin Le Grand     InsertObj(pGraf);
1059cdf0e10cSrcweir }
1060cdf0e10cSrcweir 
1061cdf0e10cSrcweir void ImpSdrGDIMetaFileImport::DoAction(MetaBmpExScaleAction& rAct)
1062cdf0e10cSrcweir {
1063cdf0e10cSrcweir 	Rectangle aRect(rAct.GetPoint(),rAct.GetSize());
1064cdf0e10cSrcweir 	aRect.Right()++; aRect.Bottom()++;
106547a7c0c1SArmin Le Grand     SdrGrafObj* pGraf=new SdrGrafObj( rAct.GetBitmapEx(), aRect );
1066*468982e4SArmin Le Grand 
1067*468982e4SArmin Le Grand     // This action is not creating line and fill, set directly, do not use SetAttributes(..)
1068*468982e4SArmin Le Grand     pGraf->SetMergedItem(XLineStyleItem(XLINE_NONE));
1069*468982e4SArmin Le Grand     pGraf->SetMergedItem(XFillStyleItem(XFILL_NONE));
1070cdf0e10cSrcweir 	InsertObj(pGraf);
1071cdf0e10cSrcweir }
1072cdf0e10cSrcweir 
1073cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
1074cdf0e10cSrcweir 
1075cdf0e10cSrcweir void ImpSdrGDIMetaFileImport::DoAction( MetaHatchAction& rAct )
1076cdf0e10cSrcweir {
1077cdf0e10cSrcweir 	// #i73407# reformulation to use new B2DPolygon classes
1078cdf0e10cSrcweir 	basegfx::B2DPolyPolygon aSource(rAct.GetPolyPolygon().getB2DPolyPolygon());
1079cdf0e10cSrcweir 
1080cdf0e10cSrcweir 	if(aSource.count())
1081cdf0e10cSrcweir 	{
10828718d260SArmin Le Grand 		const basegfx::B2DHomMatrix aTransform(basegfx::tools::createScaleTranslateB2DHomMatrix(mfScaleX, mfScaleY, maOfs.X(), maOfs.Y()));
1083cdf0e10cSrcweir 		aSource.transform(aTransform);
1084cdf0e10cSrcweir 
10858718d260SArmin Le Grand 		if(!mbLastObjWasPolyWithoutLine || !CheckLastPolyLineAndFillMerge(aSource))
1086cdf0e10cSrcweir 		{
1087cdf0e10cSrcweir 			const Hatch& rHatch = rAct.GetHatch();
108847a7c0c1SArmin Le Grand             SdrPathObj* pPath = new SdrPathObj(OBJ_POLY, aSource);
10898718d260SArmin Le Grand 			SfxItemSet aHatchAttr(mpModel->GetItemPool(), XATTR_FILLSTYLE, XATTR_FILLSTYLE, XATTR_FILLHATCH, XATTR_FILLHATCH, 0, 0);
1090cdf0e10cSrcweir 			XHatchStyle eStyle;
1091cdf0e10cSrcweir 
1092cdf0e10cSrcweir 			switch(rHatch.GetStyle())
1093cdf0e10cSrcweir 			{
1094cdf0e10cSrcweir 				case(HATCH_TRIPLE) :
1095cdf0e10cSrcweir 				{
1096cdf0e10cSrcweir 					eStyle = XHATCH_TRIPLE;
1097cdf0e10cSrcweir 					break;
1098cdf0e10cSrcweir 				}
1099cdf0e10cSrcweir 
1100cdf0e10cSrcweir 				case(HATCH_DOUBLE) :
1101cdf0e10cSrcweir 				{
1102cdf0e10cSrcweir 					eStyle = XHATCH_DOUBLE;
1103cdf0e10cSrcweir 					break;
1104cdf0e10cSrcweir 				}
1105cdf0e10cSrcweir 
1106cdf0e10cSrcweir 				default:
1107cdf0e10cSrcweir 				{
1108cdf0e10cSrcweir 					eStyle = XHATCH_SINGLE;
1109cdf0e10cSrcweir 					break;
1110cdf0e10cSrcweir 				}
1111cdf0e10cSrcweir 			}
1112cdf0e10cSrcweir 
1113cdf0e10cSrcweir 			SetAttributes(pPath);
1114cdf0e10cSrcweir 			aHatchAttr.Put(XFillStyleItem(XFILL_HATCH));
11158718d260SArmin Le Grand 			aHatchAttr.Put(XFillHatchItem(&mpModel->GetItemPool(), XHatch(rHatch.GetColor(), eStyle, rHatch.GetDistance(), rHatch.GetAngle())));
1116cdf0e10cSrcweir 			pPath->SetMergedItemSet(aHatchAttr);
1117cdf0e10cSrcweir 
1118cdf0e10cSrcweir 			InsertObj(pPath, false);
1119cdf0e10cSrcweir 		}
1120cdf0e10cSrcweir 	}
1121cdf0e10cSrcweir }
1122cdf0e10cSrcweir 
1123cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
1124cdf0e10cSrcweir 
1125cdf0e10cSrcweir void ImpSdrGDIMetaFileImport::DoAction(MetaLineColorAction& rAct)
1126cdf0e10cSrcweir {
11278718d260SArmin Le Grand 	rAct.Execute(&maVD);
1128cdf0e10cSrcweir }
1129cdf0e10cSrcweir 
1130cdf0e10cSrcweir void ImpSdrGDIMetaFileImport::DoAction(MetaMapModeAction& rAct)
1131cdf0e10cSrcweir {
1132cdf0e10cSrcweir 	MapScaling();
11338718d260SArmin Le Grand 	rAct.Execute(&maVD);
11348718d260SArmin Le Grand 	mbLastObjWasPolyWithoutLine = false;
11358718d260SArmin Le Grand 	mbLastObjWasLine = false;
1136cdf0e10cSrcweir }
1137cdf0e10cSrcweir 
1138cdf0e10cSrcweir void ImpSdrGDIMetaFileImport::MapScaling()
1139cdf0e10cSrcweir {
11408718d260SArmin Le Grand 	const sal_uInt32 nAnz(maTmpList.size());
11418718d260SArmin Le Grand 	sal_uInt32 i(0);
11428718d260SArmin Le Grand 	const MapMode& rMap = maVD.GetMapMode();
1143cdf0e10cSrcweir 	Point aMapOrg( rMap.GetOrigin() );
11448718d260SArmin Le Grand 	bool bMov2(aMapOrg.X() != 0 || aMapOrg.Y() != 0);
11458718d260SArmin Le Grand 
11468718d260SArmin Le Grand     if(bMov2)
1147cdf0e10cSrcweir     {
11488718d260SArmin Le Grand 		for(i = mnMapScalingOfs; i < nAnz; i++)
1149cdf0e10cSrcweir         {
11508718d260SArmin Le Grand 			SdrObject* pObj = maTmpList[i];
11518718d260SArmin Le Grand 
11528718d260SArmin Le Grand             pObj->NbcMove(Size(aMapOrg.X(), aMapOrg.Y()));
1153cdf0e10cSrcweir 		}
1154cdf0e10cSrcweir 	}
11558718d260SArmin Le Grand 
11568718d260SArmin Le Grand     mnMapScalingOfs = nAnz;
1157cdf0e10cSrcweir }
1158cdf0e10cSrcweir 
1159cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
1160cdf0e10cSrcweir 
1161cdf0e10cSrcweir void ImpSdrGDIMetaFileImport::DoAction( MetaCommentAction& rAct, GDIMetaFile* pMtf )
1162cdf0e10cSrcweir {
1163cdf0e10cSrcweir 	ByteString aSkipComment;
1164cdf0e10cSrcweir 
1165cdf0e10cSrcweir 	if( rAct.GetComment().CompareIgnoreCaseToAscii( "XGRAD_SEQ_BEGIN" ) == COMPARE_EQUAL )
1166cdf0e10cSrcweir 	{
1167cdf0e10cSrcweir 		MetaGradientExAction* pAct = (MetaGradientExAction*) pMtf->NextAction();
1168cdf0e10cSrcweir 
1169cdf0e10cSrcweir 		if( pAct && pAct->GetType() == META_GRADIENTEX_ACTION )
1170cdf0e10cSrcweir 		{
1171cdf0e10cSrcweir 			// #i73407# reformulation to use new B2DPolygon classes
1172cdf0e10cSrcweir 			basegfx::B2DPolyPolygon aSource(pAct->GetPolyPolygon().getB2DPolyPolygon());
1173cdf0e10cSrcweir 
1174cdf0e10cSrcweir 			if(aSource.count())
1175cdf0e10cSrcweir 			{
11768718d260SArmin Le Grand 				if(!mbLastObjWasPolyWithoutLine || !CheckLastPolyLineAndFillMerge(aSource))
1177cdf0e10cSrcweir 				{
1178cdf0e10cSrcweir 					const Gradient&	rGrad = pAct->GetGradient();
117947a7c0c1SArmin Le Grand                     SdrPathObj* pPath = new SdrPathObj(OBJ_POLY, aSource);
11808718d260SArmin Le Grand 					SfxItemSet aGradAttr(mpModel->GetItemPool(), XATTR_FILLSTYLE, XATTR_FILLSTYLE, XATTR_FILLGRADIENT, XATTR_FILLGRADIENT, 0, 0);
1181cdf0e10cSrcweir 					XGradient aXGradient;
1182cdf0e10cSrcweir 
1183cdf0e10cSrcweir 					aXGradient.SetGradientStyle((XGradientStyle)rGrad.GetStyle());
1184cdf0e10cSrcweir 					aXGradient.SetStartColor(rGrad.GetStartColor());
1185cdf0e10cSrcweir 					aXGradient.SetEndColor(rGrad.GetEndColor());
1186cdf0e10cSrcweir 					aXGradient.SetAngle((sal_uInt16)rGrad.GetAngle());
1187cdf0e10cSrcweir 					aXGradient.SetBorder(rGrad.GetBorder());
1188cdf0e10cSrcweir 					aXGradient.SetXOffset(rGrad.GetOfsX());
1189cdf0e10cSrcweir 					aXGradient.SetYOffset(rGrad.GetOfsY());
1190cdf0e10cSrcweir 					aXGradient.SetStartIntens(rGrad.GetStartIntensity());
1191cdf0e10cSrcweir 					aXGradient.SetEndIntens(rGrad.GetEndIntensity());
1192cdf0e10cSrcweir 					aXGradient.SetSteps(rGrad.GetSteps());
1193cdf0e10cSrcweir 
1194*468982e4SArmin Le Grand                     // no need to use SetAttributes(..) here since line and fill style
1195*468982e4SArmin Le Grand                     // need to be set individually
1196*468982e4SArmin Le Grand                     // SetAttributes(pPath);
1197*468982e4SArmin Le Grand 
1198*468982e4SArmin Le Grand                     // switch line off; when there was one there will be a
1199*468982e4SArmin Le Grand                     // META_POLYLINE_ACTION following creating another object
1200*468982e4SArmin Le Grand                     aGradAttr.Put(XLineStyleItem(XLINE_NONE));
1201cdf0e10cSrcweir 
1202*468982e4SArmin Le Grand                     // add detected gradient fillstyle
1203*468982e4SArmin Le Grand                     aGradAttr.Put(XFillStyleItem(XFILL_GRADIENT));
1204*468982e4SArmin Le Grand                     aGradAttr.Put(XFillGradientItem(&mpModel->GetItemPool(), aXGradient));
1205*468982e4SArmin Le Grand 
1206*468982e4SArmin Le Grand                     pPath->SetMergedItemSet(aGradAttr);
1207cdf0e10cSrcweir 
1208cdf0e10cSrcweir 					InsertObj(pPath);
1209cdf0e10cSrcweir 				}
1210cdf0e10cSrcweir 			}
1211cdf0e10cSrcweir 
1212cdf0e10cSrcweir 			aSkipComment = "XGRAD_SEQ_END";
1213cdf0e10cSrcweir 		}
1214cdf0e10cSrcweir 	}
1215cdf0e10cSrcweir 
1216cdf0e10cSrcweir 	if(aSkipComment.Len())
1217cdf0e10cSrcweir 	{
1218cdf0e10cSrcweir 		MetaAction* pSkipAct = pMtf->NextAction();
1219cdf0e10cSrcweir 
1220cdf0e10cSrcweir 		while( pSkipAct
1221cdf0e10cSrcweir 			&& ((pSkipAct->GetType() != META_COMMENT_ACTION )
1222cdf0e10cSrcweir 				|| (((MetaCommentAction*)pSkipAct)->GetComment().CompareIgnoreCaseToAscii(aSkipComment.GetBuffer()) != COMPARE_EQUAL)))
1223cdf0e10cSrcweir 		{
1224cdf0e10cSrcweir 			pSkipAct = pMtf->NextAction();
1225cdf0e10cSrcweir 		}
1226cdf0e10cSrcweir 	}
1227cdf0e10cSrcweir }
1228cdf0e10cSrcweir 
12298718d260SArmin Le Grand ////////////////////////////////////////////////////////////////////////////////////////////////////
12308718d260SArmin Le Grand 
12318718d260SArmin Le Grand void ImpSdrGDIMetaFileImport::DoAction(MetaTextRectAction& rAct)
12328718d260SArmin Le Grand {
12338718d260SArmin Le Grand     GDIMetaFile aTemp;
12348718d260SArmin Le Grand 
12358718d260SArmin Le Grand     maVD.AddTextRectActions(rAct.GetRect(), rAct.GetText(), rAct.GetStyle(), aTemp);
12368718d260SArmin Le Grand     DoLoopActions(aTemp, 0, 0);
12378718d260SArmin Le Grand }
12388718d260SArmin Le Grand 
12398718d260SArmin Le Grand void ImpSdrGDIMetaFileImport::DoAction(MetaBmpScalePartAction& rAct)
12408718d260SArmin Le Grand {
12418718d260SArmin Le Grand 	Rectangle aRect(rAct.GetDestPoint(), rAct.GetDestSize());
12428718d260SArmin Le Grand     Bitmap aBitmap(rAct.GetBitmap());
12438718d260SArmin Le Grand 
12448718d260SArmin Le Grand     aRect.Right()++;
12458718d260SArmin Le Grand     aRect.Bottom()++;
12468718d260SArmin Le Grand     aBitmap.Crop(Rectangle(rAct.GetSrcPoint(), rAct.GetSrcSize()));
12478718d260SArmin Le Grand     SdrGrafObj* pGraf = new SdrGrafObj(aBitmap, aRect);
12488718d260SArmin Le Grand 
1249*468982e4SArmin Le Grand     // This action is not creating line and fill, set directly, do not use SetAttributes(..)
1250*468982e4SArmin Le Grand     pGraf->SetMergedItem(XLineStyleItem(XLINE_NONE));
1251*468982e4SArmin Le Grand     pGraf->SetMergedItem(XFillStyleItem(XFILL_NONE));
12528718d260SArmin Le Grand     InsertObj(pGraf);
12538718d260SArmin Le Grand }
12548718d260SArmin Le Grand 
12558718d260SArmin Le Grand void ImpSdrGDIMetaFileImport::DoAction(MetaBmpExScalePartAction& rAct)
12568718d260SArmin Le Grand {
12578718d260SArmin Le Grand 	Rectangle aRect(rAct.GetDestPoint(),rAct.GetDestSize());
12588718d260SArmin Le Grand     BitmapEx aBitmapEx(rAct.GetBitmapEx());
12598718d260SArmin Le Grand 
12608718d260SArmin Le Grand     aRect.Right()++;
12618718d260SArmin Le Grand     aRect.Bottom()++;
12628718d260SArmin Le Grand     aBitmapEx.Crop(Rectangle(rAct.GetSrcPoint(), rAct.GetSrcSize()));
12638718d260SArmin Le Grand     SdrGrafObj* pGraf = new SdrGrafObj(aBitmapEx, aRect);
12648718d260SArmin Le Grand 
1265*468982e4SArmin Le Grand     // This action is not creating line and fill, set directly, do not use SetAttributes(..)
1266*468982e4SArmin Le Grand     pGraf->SetMergedItem(XLineStyleItem(XLINE_NONE));
1267*468982e4SArmin Le Grand     pGraf->SetMergedItem(XFillStyleItem(XFILL_NONE));
12688718d260SArmin Le Grand     InsertObj(pGraf);
12698718d260SArmin Le Grand }
12708718d260SArmin Le Grand 
12718718d260SArmin Le Grand void ImpSdrGDIMetaFileImport::DoAction(MetaMaskAction& rAct)
12728718d260SArmin Le Grand {
12738718d260SArmin Le Grand 	Rectangle aRect(rAct.GetPoint(), rAct.GetBitmap().GetSizePixel());
12748718d260SArmin Le Grand     BitmapEx aBitmapEx(rAct.GetBitmap(), rAct.GetColor());
12758718d260SArmin Le Grand 
1276*468982e4SArmin Le Grand     aRect.Right()++; aRect.Bottom()++;
12778718d260SArmin Le Grand     SdrGrafObj* pGraf = new SdrGrafObj(aBitmapEx, aRect);
12788718d260SArmin Le Grand 
1279*468982e4SArmin Le Grand     // This action is not creating line and fill, set directly, do not use SetAttributes(..)
1280*468982e4SArmin Le Grand     pGraf->SetMergedItem(XLineStyleItem(XLINE_NONE));
1281*468982e4SArmin Le Grand     pGraf->SetMergedItem(XFillStyleItem(XFILL_NONE));
12828718d260SArmin Le Grand     InsertObj(pGraf);
12838718d260SArmin Le Grand }
12848718d260SArmin Le Grand 
12858718d260SArmin Le Grand void ImpSdrGDIMetaFileImport::DoAction(MetaMaskScaleAction& rAct)
12868718d260SArmin Le Grand {
12878718d260SArmin Le Grand 	Rectangle aRect(rAct.GetPoint(), rAct.GetSize());
12888718d260SArmin Le Grand     BitmapEx aBitmapEx(rAct.GetBitmap(), rAct.GetColor());
12898718d260SArmin Le Grand 
1290*468982e4SArmin Le Grand     aRect.Right()++; aRect.Bottom()++;
12918718d260SArmin Le Grand     SdrGrafObj* pGraf = new SdrGrafObj(aBitmapEx, aRect);
12928718d260SArmin Le Grand 
1293*468982e4SArmin Le Grand     // This action is not creating line and fill, set directly, do not use SetAttributes(..)
1294*468982e4SArmin Le Grand     pGraf->SetMergedItem(XLineStyleItem(XLINE_NONE));
1295*468982e4SArmin Le Grand     pGraf->SetMergedItem(XFillStyleItem(XFILL_NONE));
12968718d260SArmin Le Grand     InsertObj(pGraf);
12978718d260SArmin Le Grand }
12988718d260SArmin Le Grand 
12998718d260SArmin Le Grand void ImpSdrGDIMetaFileImport::DoAction(MetaMaskScalePartAction& rAct)
13008718d260SArmin Le Grand {
13018718d260SArmin Le Grand 	Rectangle aRect(rAct.GetDestPoint(), rAct.GetDestSize());
13028718d260SArmin Le Grand     BitmapEx aBitmapEx(rAct.GetBitmap(), rAct.GetColor());
13038718d260SArmin Le Grand 
1304*468982e4SArmin Le Grand     aRect.Right()++; aRect.Bottom()++;
13058718d260SArmin Le Grand     aBitmapEx.Crop(Rectangle(rAct.GetSrcPoint(), rAct.GetSrcSize()));
13068718d260SArmin Le Grand     SdrGrafObj* pGraf = new SdrGrafObj(aBitmapEx, aRect);
13078718d260SArmin Le Grand 
1308*468982e4SArmin Le Grand     // This action is not creating line and fill, set directly, do not use SetAttributes(..)
1309*468982e4SArmin Le Grand     pGraf->SetMergedItem(XLineStyleItem(XLINE_NONE));
1310*468982e4SArmin Le Grand     pGraf->SetMergedItem(XFillStyleItem(XFILL_NONE));
13118718d260SArmin Le Grand     InsertObj(pGraf);
13128718d260SArmin Le Grand }
13138718d260SArmin Le Grand 
1314603e43faSArmin Le Grand XGradientStyle getXGradientStyleFromGradientStyle(const GradientStyle& rGradientStyle)
1315603e43faSArmin Le Grand {
1316603e43faSArmin Le Grand     XGradientStyle aXGradientStyle(XGRAD_LINEAR);
1317603e43faSArmin Le Grand 
1318603e43faSArmin Le Grand     switch(rGradientStyle)
1319603e43faSArmin Le Grand     {
1320603e43faSArmin Le Grand         case GRADIENT_LINEAR: aXGradientStyle = XGRAD_LINEAR; break;
1321603e43faSArmin Le Grand         case GRADIENT_AXIAL: aXGradientStyle = XGRAD_AXIAL; break;
1322603e43faSArmin Le Grand         case GRADIENT_RADIAL: aXGradientStyle = XGRAD_RADIAL; break;
1323603e43faSArmin Le Grand         case GRADIENT_ELLIPTICAL: aXGradientStyle = XGRAD_ELLIPTICAL; break;
1324603e43faSArmin Le Grand         case GRADIENT_SQUARE: aXGradientStyle = XGRAD_SQUARE; break;
1325603e43faSArmin Le Grand         case GRADIENT_RECT: aXGradientStyle = XGRAD_RECT; break;
1326603e43faSArmin Le Grand 
1327603e43faSArmin Le Grand         // Needed due to GRADIENT_FORCE_EQUAL_SIZE; this again is needed
1328603e43faSArmin Le Grand         // to force the enum defines in VCL to a defined size for the compilers,
1329603e43faSArmin Le Grand         // so despite it is never used it cannot be removed (would break the
1330603e43faSArmin Le Grand         // API implementation probably).
1331603e43faSArmin Le Grand         default: break;
1332603e43faSArmin Le Grand     }
1333603e43faSArmin Le Grand 
1334603e43faSArmin Le Grand     return aXGradientStyle;
1335603e43faSArmin Le Grand }
1336603e43faSArmin Le Grand 
13378718d260SArmin Le Grand void ImpSdrGDIMetaFileImport::DoAction(MetaGradientAction& rAct)
13388718d260SArmin Le Grand {
13398718d260SArmin Le Grand     basegfx::B2DRange aRange(rAct.GetRect().Left(), rAct.GetRect().Top(), rAct.GetRect().Right(), rAct.GetRect().Bottom());
13408718d260SArmin Le Grand 
13418718d260SArmin Le Grand 	if(!aRange.isEmpty())
13428718d260SArmin Le Grand 	{
13438718d260SArmin Le Grand 		const basegfx::B2DHomMatrix aTransform(basegfx::tools::createScaleTranslateB2DHomMatrix(mfScaleX, mfScaleY, maOfs.X(), maOfs.Y()));
13448718d260SArmin Le Grand 		aRange.transform(aTransform);
13458718d260SArmin Le Grand         const Gradient& rGradient = rAct.GetGradient();
13468718d260SArmin Le Grand         SdrRectObj* pRect = new SdrRectObj(
13478718d260SArmin Le Grand             Rectangle(
13488718d260SArmin Le Grand                 floor(aRange.getMinX()),
13498718d260SArmin Le Grand                 floor(aRange.getMinY()),
13508718d260SArmin Le Grand                 ceil(aRange.getMaxX()),
13518718d260SArmin Le Grand                 ceil(aRange.getMaxY())));
13528718d260SArmin Le Grand 		SfxItemSet aGradientAttr(mpModel->GetItemPool(), XATTR_FILLSTYLE, XATTR_FILLSTYLE, XATTR_FILLGRADIENT, XATTR_FILLGRADIENT, 0, 0);
1353603e43faSArmin Le Grand         const XGradientStyle aXGradientStyle(getXGradientStyleFromGradientStyle(rGradient.GetStyle()));
13548718d260SArmin Le Grand         const XFillGradientItem aXFillGradientItem(
13558718d260SArmin Le Grand             &mpModel->GetItemPool(),
13568718d260SArmin Le Grand             XGradient(
13578718d260SArmin Le Grand                 rGradient.GetStartColor(),
13588718d260SArmin Le Grand                 rGradient.GetEndColor(),
13598718d260SArmin Le Grand                 aXGradientStyle,
13608718d260SArmin Le Grand                 rGradient.GetAngle(),
13618718d260SArmin Le Grand                 rGradient.GetOfsX(),
13628718d260SArmin Le Grand                 rGradient.GetOfsY(),
13638718d260SArmin Le Grand                 rGradient.GetBorder(),
13648718d260SArmin Le Grand                 rGradient.GetStartIntensity(),
13658718d260SArmin Le Grand                 rGradient.GetEndIntensity(),
13668718d260SArmin Le Grand                 rGradient.GetSteps()));
13678718d260SArmin Le Grand 
13688718d260SArmin Le Grand 		SetAttributes(pRect);
13698718d260SArmin Le Grand 		aGradientAttr.Put(XFillStyleItem(XFILL_HATCH));
13708718d260SArmin Le Grand 		aGradientAttr.Put(aXFillGradientItem);
13718718d260SArmin Le Grand 		pRect->SetMergedItemSet(aGradientAttr);
13728718d260SArmin Le Grand 
13738718d260SArmin Le Grand 		InsertObj(pRect, false);
13748718d260SArmin Le Grand 	}
13758718d260SArmin Le Grand }
13768718d260SArmin Le Grand 
1377603e43faSArmin Le Grand void ImpSdrGDIMetaFileImport::DoAction(MetaWallpaperAction& /*rAct*/)
13788718d260SArmin Le Grand {
13798718d260SArmin Le Grand     OSL_ENSURE(false, "Tried to construct SdrObject from MetaWallpaperAction: not supported (!)");
13808718d260SArmin Le Grand }
13818718d260SArmin Le Grand 
13828718d260SArmin Le Grand void ImpSdrGDIMetaFileImport::DoAction(MetaTransparentAction& rAct)
13838718d260SArmin Le Grand {
13848718d260SArmin Le Grand 	basegfx::B2DPolyPolygon aSource(rAct.GetPolyPolygon().getB2DPolyPolygon());
13858718d260SArmin Le Grand 
13868718d260SArmin Le Grand 	if(aSource.count())
13878718d260SArmin Le Grand 	{
13888718d260SArmin Le Grand 		const basegfx::B2DHomMatrix aTransform(basegfx::tools::createScaleTranslateB2DHomMatrix(mfScaleX, mfScaleY, maOfs.X(), maOfs.Y()));
13898718d260SArmin Le Grand 		aSource.transform(aTransform);
13908718d260SArmin Le Grand     	aSource.setClosed(true);
13918718d260SArmin Le Grand 
13928718d260SArmin Le Grand         SdrPathObj* pPath = new SdrPathObj(OBJ_POLY, aSource);
13938718d260SArmin Le Grand 		SetAttributes(pPath);
13948718d260SArmin Le Grand         pPath->SetMergedItem(XFillTransparenceItem(rAct.GetTransparence()));
13958718d260SArmin Le Grand 		InsertObj(pPath, false);
13968718d260SArmin Le Grand 	}
13978718d260SArmin Le Grand }
13988718d260SArmin Le Grand 
1399603e43faSArmin Le Grand void ImpSdrGDIMetaFileImport::DoAction(MetaEPSAction& /*rAct*/)
14008718d260SArmin Le Grand {
14018718d260SArmin Le Grand     OSL_ENSURE(false, "Tried to construct SdrObject from MetaEPSAction: not supported (!)");
14028718d260SArmin Le Grand }
14038718d260SArmin Le Grand 
1404603e43faSArmin Le Grand void ImpSdrGDIMetaFileImport::DoAction(MetaTextLineAction& /*rAct*/)
14058718d260SArmin Le Grand {
14068718d260SArmin Le Grand     OSL_ENSURE(false, "Tried to construct SdrObject from MetaTextLineAction: not supported (!)");
14078718d260SArmin Le Grand }
14088718d260SArmin Le Grand 
14098718d260SArmin Le Grand void ImpSdrGDIMetaFileImport::DoAction(MetaGradientExAction& rAct)
14108718d260SArmin Le Grand {
14118718d260SArmin Le Grand 	basegfx::B2DPolyPolygon aSource(rAct.GetPolyPolygon().getB2DPolyPolygon());
14128718d260SArmin Le Grand 
14138718d260SArmin Le Grand 	if(aSource.count())
14148718d260SArmin Le Grand 	{
14158718d260SArmin Le Grand 		const basegfx::B2DHomMatrix aTransform(basegfx::tools::createScaleTranslateB2DHomMatrix(mfScaleX, mfScaleY, maOfs.X(), maOfs.Y()));
14168718d260SArmin Le Grand 		aSource.transform(aTransform);
14178718d260SArmin Le Grand 
14188718d260SArmin Le Grand 		if(!mbLastObjWasPolyWithoutLine || !CheckLastPolyLineAndFillMerge(aSource))
14198718d260SArmin Le Grand 		{
14208718d260SArmin Le Grand         	const Gradient& rGradient = rAct.GetGradient();
14218718d260SArmin Le Grand             SdrPathObj* pPath = new SdrPathObj(OBJ_POLY, aSource);
14228718d260SArmin Le Grand 			SfxItemSet aGradientAttr(mpModel->GetItemPool(), XATTR_FILLSTYLE, XATTR_FILLSTYLE, XATTR_FILLGRADIENT, XATTR_FILLGRADIENT, 0, 0);
1423603e43faSArmin Le Grand             const XGradientStyle aXGradientStyle(getXGradientStyleFromGradientStyle(rGradient.GetStyle()));
14248718d260SArmin Le Grand             const XFillGradientItem aXFillGradientItem(
14258718d260SArmin Le Grand                 &mpModel->GetItemPool(),
14268718d260SArmin Le Grand                 XGradient(
14278718d260SArmin Le Grand                     rGradient.GetStartColor(),
14288718d260SArmin Le Grand                     rGradient.GetEndColor(),
14298718d260SArmin Le Grand                     aXGradientStyle,
14308718d260SArmin Le Grand                     rGradient.GetAngle(),
14318718d260SArmin Le Grand                     rGradient.GetOfsX(),
14328718d260SArmin Le Grand                     rGradient.GetOfsY(),
14338718d260SArmin Le Grand                     rGradient.GetBorder(),
14348718d260SArmin Le Grand                     rGradient.GetStartIntensity(),
14358718d260SArmin Le Grand                     rGradient.GetEndIntensity(),
14368718d260SArmin Le Grand                     rGradient.GetSteps()));
14378718d260SArmin Le Grand 
14388718d260SArmin Le Grand 			SetAttributes(pPath);
14398718d260SArmin Le Grand 			aGradientAttr.Put(XFillStyleItem(XFILL_HATCH));
14408718d260SArmin Le Grand 			aGradientAttr.Put(aXFillGradientItem);
14418718d260SArmin Le Grand 			pPath->SetMergedItemSet(aGradientAttr);
14428718d260SArmin Le Grand 
14438718d260SArmin Le Grand 			InsertObj(pPath, false);
14448718d260SArmin Le Grand 		}
14458718d260SArmin Le Grand 	}
14468718d260SArmin Le Grand }
14478718d260SArmin Le Grand 
14488718d260SArmin Le Grand void ImpSdrGDIMetaFileImport::DoAction(MetaFloatTransparentAction& rAct)
14498718d260SArmin Le Grand {
14508718d260SArmin Le Grand 	const GDIMetaFile& rMtf = rAct.GetGDIMetaFile();
14518718d260SArmin Le Grand 
14528718d260SArmin Le Grand     if(rMtf.GetActionCount())
14538718d260SArmin Le Grand     {
14549f63b866SArmin Le Grand 	    const Rectangle aRect(rAct.GetPoint(),rAct.GetSize());
14559f63b866SArmin Le Grand 
1456*468982e4SArmin Le Grand         Rectangle aHairline;
1457*468982e4SArmin Le Grand         const Rectangle aBoundRect(rMtf.GetBoundRect(*Application::GetDefaultDevice(), &aHairline));
1458*468982e4SArmin Le Grand 
14599f63b866SArmin Le Grand         // convert metafile sub-content to BitmapEx
14609f63b866SArmin Le Grand         BitmapEx aBitmapEx(
14619f63b866SArmin Le Grand             convertMetafileToBitmapEx(
14629f63b866SArmin Le Grand                 rMtf,
14639f63b866SArmin Le Grand                 basegfx::B2DRange(
14649f63b866SArmin Le Grand                     aRect.Left(), aRect.Top(),
14659f63b866SArmin Le Grand                     aRect.Right(), aRect.Bottom()),
14669f63b866SArmin Le Grand                 125000));
14678718d260SArmin Le Grand 
14688718d260SArmin Le Grand         // handle colors
14698718d260SArmin Le Grand         const Gradient& rGradient = rAct.GetGradient();
14708718d260SArmin Le Grand 	    basegfx::BColor aStart(rGradient.GetStartColor().getBColor());
14718718d260SArmin Le Grand 	    basegfx::BColor aEnd(rGradient.GetEndColor().getBColor());
14728718d260SArmin Le Grand 
14738718d260SArmin Le Grand         if(100 != rGradient.GetStartIntensity())
14748718d260SArmin Le Grand 	    {
14758718d260SArmin Le Grand             aStart *= (double)rGradient.GetStartIntensity() / 100.0;
14768718d260SArmin Le Grand 	    }
14778718d260SArmin Le Grand 
14788718d260SArmin Le Grand         if(100 != rGradient.GetEndIntensity())
14798718d260SArmin Le Grand 	    {
14808718d260SArmin Le Grand             aEnd *= (double)rGradient.GetEndIntensity() / 100.0;
14818718d260SArmin Le Grand 	    }
14828718d260SArmin Le Grand 
14838718d260SArmin Le Grand         const bool bEqualColors(aStart == aEnd);
14848718d260SArmin Le Grand         const bool bNoSteps(1 == rGradient.GetSteps());
14858718d260SArmin Le Grand         bool bCreateObject(true);
14868718d260SArmin Le Grand         bool bHasNewMask(false);
14878718d260SArmin Le Grand         AlphaMask aNewMask;
14889f63b866SArmin Le Grand         double fTransparence(0.0);
14899f63b866SArmin Le Grand         bool bFixedTransparence(false);
14908718d260SArmin Le Grand 
14918718d260SArmin Le Grand         if(bEqualColors || bNoSteps)
14928718d260SArmin Le Grand         {
14938718d260SArmin Le Grand             // single transparence
14948718d260SArmin Le Grand             const basegfx::BColor aMedium(basegfx::average(aStart, aEnd));
14959f63b866SArmin Le Grand             fTransparence = aMedium.luminance();
14968718d260SArmin Le Grand 
14978718d260SArmin Le Grand             if(basegfx::fTools::lessOrEqual(fTransparence, 0.0))
14988718d260SArmin Le Grand             {
14998718d260SArmin Le Grand                 // no transparence needed, all done
15008718d260SArmin Le Grand             }
15018718d260SArmin Le Grand             else if(basegfx::fTools::moreOrEqual(fTransparence, 1.0))
15028718d260SArmin Le Grand             {
15038718d260SArmin Le Grand                 // all transparent, no object
15048718d260SArmin Le Grand                 bCreateObject = false;
15058718d260SArmin Le Grand             }
15068718d260SArmin Le Grand             else
15078718d260SArmin Le Grand             {
15089f63b866SArmin Le Grand                 // 0.0 < transparence < 1.0, apply fixed transparence
15099f63b866SArmin Le Grand                 bFixedTransparence = true;
15108718d260SArmin Le Grand             }
15118718d260SArmin Le Grand         }
15128718d260SArmin Le Grand         else
15138718d260SArmin Le Grand         {
15148718d260SArmin Le Grand             // gradient transparence
15158718d260SArmin Le Grand             VirtualDevice aVDev;
15168718d260SArmin Le Grand 
15178718d260SArmin Le Grand             aVDev.SetOutputSizePixel(aBitmapEx.GetBitmap().GetSizePixel());
15188718d260SArmin Le Grand             aVDev.DrawGradient(Rectangle(Point(0, 0), aVDev.GetOutputSizePixel()), rGradient);
15198718d260SArmin Le Grand 
15208718d260SArmin Le Grand             aNewMask = AlphaMask(aVDev.GetBitmap(Point(0, 0), aVDev.GetOutputSizePixel()));
15218718d260SArmin Le Grand             bHasNewMask = true;
15228718d260SArmin Le Grand         }
15238718d260SArmin Le Grand 
15248718d260SArmin Le Grand         if(bCreateObject)
15258718d260SArmin Le Grand         {
15269f63b866SArmin Le Grand             if(bHasNewMask || bFixedTransparence)
15278718d260SArmin Le Grand             {
15288718d260SArmin Le Grand                 if(!aBitmapEx.IsAlpha() && !aBitmapEx.IsTransparent())
15298718d260SArmin Le Grand                 {
15308718d260SArmin Le Grand                     // no transparence yet, apply new one
15319f63b866SArmin Le Grand                     if(bFixedTransparence)
15329f63b866SArmin Le Grand                     {
15339f63b866SArmin Le Grand                         sal_uInt8 aAlpha(basegfx::fround(fTransparence * 255.0));
15349f63b866SArmin Le Grand 
15359f63b866SArmin Le Grand                         aNewMask = AlphaMask(aBitmapEx.GetBitmap().GetSizePixel(), &aAlpha);
15369f63b866SArmin Le Grand                     }
15379f63b866SArmin Le Grand 
15388718d260SArmin Le Grand                     aBitmapEx = BitmapEx(aBitmapEx.GetBitmap(), aNewMask);
15398718d260SArmin Le Grand                 }
15408718d260SArmin Le Grand                 else
15418718d260SArmin Le Grand                 {
15428718d260SArmin Le Grand                     // mix existing and new alpha mask
15438718d260SArmin Le Grand                     AlphaMask aOldMask;
15448718d260SArmin Le Grand 
15458718d260SArmin Le Grand                     if(aBitmapEx.IsAlpha())
15468718d260SArmin Le Grand                     {
15478718d260SArmin Le Grand                         aOldMask = aBitmapEx.GetAlpha();
15488718d260SArmin Le Grand                     }
15498718d260SArmin Le Grand                     else if(TRANSPARENT_BITMAP == aBitmapEx.GetTransparentType())
15508718d260SArmin Le Grand                     {
15518718d260SArmin Le Grand                         aOldMask = aBitmapEx.GetMask();
15528718d260SArmin Le Grand                     }
15538718d260SArmin Le Grand                     else if(TRANSPARENT_COLOR == aBitmapEx.GetTransparentType())
15548718d260SArmin Le Grand                     {
15558718d260SArmin Le Grand                         aOldMask = aBitmapEx.GetBitmap().CreateMask(aBitmapEx.GetTransparentColor());
15568718d260SArmin Le Grand                     }
15578718d260SArmin Le Grand 
15589f63b866SArmin Le Grand                     BitmapWriteAccess* pOld = aOldMask.AcquireWriteAccess();
15598718d260SArmin Le Grand 
15609f63b866SArmin Le Grand                     if(pOld)
15618718d260SArmin Le Grand                     {
15629f63b866SArmin Le Grand                         const double fFactor(1.0 / 255.0);
15639f63b866SArmin Le Grand 
15649f63b866SArmin Le Grand                         if(bFixedTransparence)
15658718d260SArmin Le Grand                         {
15669f63b866SArmin Le Grand                             const double fOpNew(1.0 - fTransparence);
15679f63b866SArmin Le Grand 
1568603e43faSArmin Le Grand                             for(sal_uInt32 y(0); y < static_cast< sal_uInt32 >(pOld->Height()); y++)
15698718d260SArmin Le Grand                             {
1570603e43faSArmin Le Grand                                 for(sal_uInt32 x(0); x < static_cast< sal_uInt32 >(pOld->Width()); x++)
15718718d260SArmin Le Grand                                 {
15729f63b866SArmin Le Grand                                     const double fOpOld(1.0 - (pOld->GetPixel(y, x).GetIndex() * fFactor));
15739f63b866SArmin Le Grand                                     const sal_uInt8 aCol(basegfx::fround((1.0 - (fOpOld * fOpNew)) * 255.0));
15749f63b866SArmin Le Grand 
15759f63b866SArmin Le Grand                                     pOld->SetPixel(y, x, BitmapColor(aCol));
15768718d260SArmin Le Grand                                 }
15778718d260SArmin Le Grand                             }
15788718d260SArmin Le Grand                         }
15798718d260SArmin Le Grand                         else
15808718d260SArmin Le Grand                         {
15819f63b866SArmin Le Grand                             BitmapReadAccess* pNew = aNewMask.AcquireReadAccess();
15829f63b866SArmin Le Grand 
15839f63b866SArmin Le Grand                             if(pNew)
15849f63b866SArmin Le Grand                             {
15859f63b866SArmin Le Grand                                 if(pOld->Width() == pNew->Width() && pOld->Height() == pNew->Height())
15869f63b866SArmin Le Grand                                 {
1587603e43faSArmin Le Grand                                     for(sal_uInt32 y(0); y < static_cast< sal_uInt32 >(pOld->Height()); y++)
15889f63b866SArmin Le Grand                                     {
1589603e43faSArmin Le Grand                                         for(sal_uInt32 x(0); x < static_cast< sal_uInt32 >(pOld->Width()); x++)
15909f63b866SArmin Le Grand                                         {
15919f63b866SArmin Le Grand                                             const double fOpOld(1.0 - (pOld->GetPixel(y, x).GetIndex() * fFactor));
15929f63b866SArmin Le Grand                                             const double fOpNew(1.0 - (pNew->GetPixel(y, x).GetIndex() * fFactor));
15939f63b866SArmin Le Grand                                             const sal_uInt8 aCol(basegfx::fround((1.0 - (fOpOld * fOpNew)) * 255.0));
15949f63b866SArmin Le Grand 
15959f63b866SArmin Le Grand                                             pOld->SetPixel(y, x, BitmapColor(aCol));
15969f63b866SArmin Le Grand                                         }
15979f63b866SArmin Le Grand                                     }
15989f63b866SArmin Le Grand                                 }
15999f63b866SArmin Le Grand                                 else
16009f63b866SArmin Le Grand                                 {
16019f63b866SArmin Le Grand                                     OSL_ENSURE(false, "Alpha masks have different sizes (!)");
16029f63b866SArmin Le Grand                                 }
16038718d260SArmin Le Grand 
16049f63b866SArmin Le Grand                                 aNewMask.ReleaseAccess(pNew);
16059f63b866SArmin Le Grand                             }
16069f63b866SArmin Le Grand                             else
16079f63b866SArmin Le Grand                             {
16089f63b866SArmin Le Grand                                 OSL_ENSURE(false, "Got no access to new alpha mask (!)");
16099f63b866SArmin Le Grand                             }
16109f63b866SArmin Le Grand                         }
16119f63b866SArmin Le Grand 
16128718d260SArmin Le Grand                         aOldMask.ReleaseAccess(pOld);
16138718d260SArmin Le Grand                     }
16148718d260SArmin Le Grand                     else
16158718d260SArmin Le Grand                     {
16169f63b866SArmin Le Grand                         OSL_ENSURE(false, "Got no access to old alpha mask (!)");
16178718d260SArmin Le Grand                     }
16188718d260SArmin Le Grand 
16198718d260SArmin Le Grand                     // apply combined bitmap as mask
16209f63b866SArmin Le Grand                     aBitmapEx = BitmapEx(aBitmapEx.GetBitmap(), aOldMask);
16218718d260SArmin Le Grand                 }
16228718d260SArmin Le Grand             }
16238718d260SArmin Le Grand 
16248718d260SArmin Le Grand             // create and add object
16258718d260SArmin Le Grand             SdrGrafObj* pGraf = new SdrGrafObj(aBitmapEx, aRect);
16268718d260SArmin Le Grand 
1627*468982e4SArmin Le Grand             // for MetaFloatTransparentAction, do not use SetAttributes(...)
1628*468982e4SArmin Le Grand             // since these metafile content is not used to draw line/fill
1629*468982e4SArmin Le Grand             // dependent of these setting at the device content
1630*468982e4SArmin Le Grand             pGraf->SetMergedItem(XLineStyleItem(XLINE_NONE));
1631*468982e4SArmin Le Grand             pGraf->SetMergedItem(XFillStyleItem(XFILL_NONE));
16328718d260SArmin Le Grand             InsertObj(pGraf);
16338718d260SArmin Le Grand         }
16348718d260SArmin Le Grand     }
16358718d260SArmin Le Grand }
16368718d260SArmin Le Grand 
1637cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
1638cdf0e10cSrcweir // eof
1639