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