svdfmtf.cxx (70d3707a) | svdfmtf.cxx (8718d260) |
---|---|
1/************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance --- 56 unchanged lines hidden (view full) --- 65#include <basegfx/polygon/b2dpolygon.hxx> 66#include <vcl/salbtype.hxx> // FRound 67#include <basegfx/matrix/b2dhommatrix.hxx> 68#include <basegfx/matrix/b2dhommatrixtools.hxx> 69#include <svx/xlinjoit.hxx> 70#include <svx/xlndsit.hxx> 71#include <basegfx/polygon/b2dpolygonclipper.hxx> 72#include <svx/xbtmpit.hxx> | 1/************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance --- 56 unchanged lines hidden (view full) --- 65#include <basegfx/polygon/b2dpolygon.hxx> 66#include <vcl/salbtype.hxx> // FRound 67#include <basegfx/matrix/b2dhommatrix.hxx> 68#include <basegfx/matrix/b2dhommatrixtools.hxx> 69#include <svx/xlinjoit.hxx> 70#include <svx/xlndsit.hxx> 71#include <basegfx/polygon/b2dpolygonclipper.hxx> 72#include <svx/xbtmpit.hxx> |
73#include <svx/xfltrit.hxx> 74#include <vcl/bmpacc.hxx> 75#include <vcl/svgdata.hxx> 76#include <drawinglayer/primitive2d/metafileprimitive2d.hxx> |
|
73 74//////////////////////////////////////////////////////////////////////////////////////////////////// 75 | 77 78//////////////////////////////////////////////////////////////////////////////////////////////////// 79 |
76ImpSdrGDIMetaFileImport::ImpSdrGDIMetaFileImport(SdrModel& rModel): 77 nMapScalingOfs(0), 78 pLineAttr(NULL),pFillAttr(NULL),pTextAttr(NULL), 79 pPage(NULL),pModel(NULL),nLayer(0), 80 nLineWidth(0), | 80ImpSdrGDIMetaFileImport::ImpSdrGDIMetaFileImport( 81 SdrModel& rModel, 82 SdrLayerID nLay, 83 const Rectangle& rRect) 84: maTmpList(), 85 maVD(), 86 maScaleRect(rRect), 87 mnMapScalingOfs(0), 88 mpLineAttr(0), 89 mpFillAttr(0), 90 mpTextAttr(0), 91 mpModel(&rModel), 92 mnLayer(nLay), 93 maOldLineColor(), 94 mnLineWidth(0), |
81 maLineJoin(basegfx::B2DLINEJOIN_NONE), 82 maLineCap(com::sun::star::drawing::LineCap_BUTT), 83 maDash(XDASH_RECT, 0, 0, 0, 0, 0), | 95 maLineJoin(basegfx::B2DLINEJOIN_NONE), 96 maLineCap(com::sun::star::drawing::LineCap_BUTT), 97 maDash(XDASH_RECT, 0, 0, 0, 0, 0), |
84 bFntDirty(sal_True), 85 bLastObjWasPolyWithoutLine(sal_False), 86 bNoLine(sal_False), 87 bNoFill(sal_False), 88 bLastObjWasLine(sal_False), | 98 mbMov(false), 99 mbSize(false), 100 maOfs(0, 0), 101 mfScaleX(1.0), 102 mfScaleY(1.0), 103 maScaleX(1.0), 104 maScaleY(1.0), 105 mbFntDirty(true), 106 mbLastObjWasPolyWithoutLine(false), 107 mbNoLine(false), 108 mbNoFill(false), 109 mbLastObjWasLine(false), |
89 maClip() 90{ | 110 maClip() 111{ |
91 aVD.EnableOutput(sal_False); 92 93 // #i111954# init to no fill and no line initially 94 aVD.SetLineColor(); 95 aVD.SetFillColor(); 96 97 aOldLineColor.SetRed( aVD.GetLineColor().GetRed() + 1 ); // invalidate old line color 98 pLineAttr=new SfxItemSet(rModel.GetItemPool(),XATTR_LINE_FIRST,XATTR_LINE_LAST); 99 pFillAttr=new SfxItemSet(rModel.GetItemPool(),XATTR_FILL_FIRST,XATTR_FILL_LAST); 100 pTextAttr=new SfxItemSet(rModel.GetItemPool(),EE_ITEMS_START,EE_ITEMS_END); 101 pModel=&rModel; | 112 maVD.EnableOutput(false); 113 maVD.SetLineColor(); 114 maVD.SetFillColor(); 115 maOldLineColor.SetRed( maVD.GetLineColor().GetRed() + 1 ); 116 mpLineAttr = new SfxItemSet(rModel.GetItemPool(), XATTR_LINE_FIRST, XATTR_LINE_LAST, 0, 0); 117 mpFillAttr = new SfxItemSet(rModel.GetItemPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST, 0, 0); 118 mpTextAttr = new SfxItemSet(rModel.GetItemPool(), EE_ITEMS_START, EE_ITEMS_END, 0, 0); |
102 checkClip(); 103} 104 105ImpSdrGDIMetaFileImport::~ImpSdrGDIMetaFileImport() 106{ | 119 checkClip(); 120} 121 122ImpSdrGDIMetaFileImport::~ImpSdrGDIMetaFileImport() 123{ |
107 delete pLineAttr; 108 delete pFillAttr; 109 delete pTextAttr; | 124 delete mpLineAttr; 125 delete mpFillAttr; 126 delete mpTextAttr; |
110} 111 | 127} 128 |
112sal_uIntPtr ImpSdrGDIMetaFileImport::DoImport(const GDIMetaFile& rMtf, 113 SdrObjList& rOL, 114 sal_uIntPtr nInsPos, 115 SvdProgressInfo *pProgrInfo) | 129void ImpSdrGDIMetaFileImport::DoLoopActions(GDIMetaFile& rMtf, SvdProgressInfo* pProgrInfo, sal_uInt32* pActionsToReport) |
116{ | 130{ |
117 pPage = rOL.GetPage(); 118 GDIMetaFile* pTmpMtf=NULL; 119 GDIMetaFile* pMtf = (GDIMetaFile*) &rMtf; 120 sal_uIntPtr nActionAnz=pMtf->GetActionCount(); 121 sal_Bool bError = sal_False; 122 123 124 // setup some global scale parameter 125 // fScaleX, fScaleY, aScaleX, aScaleY, bMov, bSize 126 fScaleX = fScaleY = 1.0; 127 Size aMtfSize( pMtf->GetPrefSize() ); 128 if ( aMtfSize.Width() & aMtfSize.Height() && ( aScaleRect.IsEmpty() == sal_False ) ) 129 { 130 aOfs = aScaleRect.TopLeft(); 131 if ( aMtfSize.Width() != ( aScaleRect.GetWidth() - 1 ) ) 132 fScaleX = (double)( aScaleRect.GetWidth() - 1 ) / (double)aMtfSize.Width(); 133 if ( aMtfSize.Height() != ( aScaleRect.GetHeight() - 1 ) ) 134 fScaleY = (double)( aScaleRect.GetHeight() - 1 ) / (double)aMtfSize.Height(); 135 } 136 137 bMov = aOfs.X()!=0 || aOfs.Y()!=0; 138 bSize = sal_False; 139 140 aScaleX = Fraction( 1, 1 ); 141 aScaleY = Fraction( 1, 1 ); 142 if ( aMtfSize.Width() != ( aScaleRect.GetWidth() - 1 ) ) 143 { 144 aScaleX = Fraction( aScaleRect.GetWidth() - 1, aMtfSize.Width() ); 145 bSize = sal_True; 146 } 147 if ( aMtfSize.Height() != ( aScaleRect.GetHeight() - 1 ) ) 148 { 149 aScaleY = Fraction( aScaleRect.GetHeight() - 1, aMtfSize.Height() ); 150 bSize = sal_True; 151 } 152 153 if(65000 < nActionAnz) | 131 for( MetaAction* pAct = rMtf.FirstAction(); pAct; pAct = rMtf.NextAction() ) |
154 { | 132 { |
155 nActionAnz = 65000; 156 bError = sal_True; 157 } 158 159 if(pProgrInfo) 160 pProgrInfo->SetActionCount(nActionAnz); 161 162 sal_uIntPtr nActionsToReport = 0; 163 164 for( MetaAction* pAct = pMtf->FirstAction(); pAct; pAct = pMtf->NextAction() ) 165 { | |
166 switch (pAct->GetType()) 167 { 168 case META_PIXEL_ACTION : DoAction((MetaPixelAction &)*pAct); break; 169 case META_POINT_ACTION : DoAction((MetaPointAction &)*pAct); break; 170 case META_LINE_ACTION : DoAction((MetaLineAction &)*pAct); break; 171 case META_RECT_ACTION : DoAction((MetaRectAction &)*pAct); break; 172 case META_ROUNDRECT_ACTION : DoAction((MetaRoundRectAction &)*pAct); break; 173 case META_ELLIPSE_ACTION : DoAction((MetaEllipseAction &)*pAct); break; --- 20 unchanged lines hidden (view full) --- 194 case META_CLIPREGION_ACTION : DoAction((MetaClipRegionAction &)*pAct); break; 195 case META_MOVECLIPREGION_ACTION : DoAction((MetaMoveClipRegionAction &)*pAct); break; 196 case META_ISECTRECTCLIPREGION_ACTION: DoAction((MetaISectRectClipRegionAction&)*pAct); break; 197 case META_ISECTREGIONCLIPREGION_ACTION: DoAction((MetaISectRegionClipRegionAction&)*pAct); break; 198 case META_RASTEROP_ACTION : DoAction((MetaRasterOpAction &)*pAct); break; 199 case META_PUSH_ACTION : DoAction((MetaPushAction &)*pAct); break; 200 case META_POP_ACTION : DoAction((MetaPopAction &)*pAct); break; 201 case META_HATCH_ACTION : DoAction((MetaHatchAction &)*pAct); break; | 133 switch (pAct->GetType()) 134 { 135 case META_PIXEL_ACTION : DoAction((MetaPixelAction &)*pAct); break; 136 case META_POINT_ACTION : DoAction((MetaPointAction &)*pAct); break; 137 case META_LINE_ACTION : DoAction((MetaLineAction &)*pAct); break; 138 case META_RECT_ACTION : DoAction((MetaRectAction &)*pAct); break; 139 case META_ROUNDRECT_ACTION : DoAction((MetaRoundRectAction &)*pAct); break; 140 case META_ELLIPSE_ACTION : DoAction((MetaEllipseAction &)*pAct); break; --- 20 unchanged lines hidden (view full) --- 161 case META_CLIPREGION_ACTION : DoAction((MetaClipRegionAction &)*pAct); break; 162 case META_MOVECLIPREGION_ACTION : DoAction((MetaMoveClipRegionAction &)*pAct); break; 163 case META_ISECTRECTCLIPREGION_ACTION: DoAction((MetaISectRectClipRegionAction&)*pAct); break; 164 case META_ISECTREGIONCLIPREGION_ACTION: DoAction((MetaISectRegionClipRegionAction&)*pAct); break; 165 case META_RASTEROP_ACTION : DoAction((MetaRasterOpAction &)*pAct); break; 166 case META_PUSH_ACTION : DoAction((MetaPushAction &)*pAct); break; 167 case META_POP_ACTION : DoAction((MetaPopAction &)*pAct); break; 168 case META_HATCH_ACTION : DoAction((MetaHatchAction &)*pAct); break; |
202 case META_COMMENT_ACTION : DoAction((MetaCommentAction &)*pAct, pMtf); break; | 169 case META_COMMENT_ACTION : DoAction((MetaCommentAction &)*pAct, &rMtf); break; 170 171 // missing actions added 172 case META_TEXTRECT_ACTION : DoAction((MetaTextRectAction&)*pAct); break; 173 case META_BMPSCALEPART_ACTION : DoAction((MetaBmpScalePartAction&)*pAct); break; 174 case META_BMPEXSCALEPART_ACTION : DoAction((MetaBmpExScalePartAction&)*pAct); break; 175 case META_MASK_ACTION : DoAction((MetaMaskAction&)*pAct); break; 176 case META_MASKSCALE_ACTION : DoAction((MetaMaskScaleAction&)*pAct); break; 177 case META_MASKSCALEPART_ACTION : DoAction((MetaMaskScalePartAction&)*pAct); break; 178 case META_GRADIENT_ACTION : DoAction((MetaGradientAction&)*pAct); break; 179 case META_WALLPAPER_ACTION : DoAction((MetaWallpaperAction&)*pAct); break; 180 case META_TRANSPARENT_ACTION : DoAction((MetaTransparentAction&)*pAct); break; 181 case META_EPS_ACTION : DoAction((MetaEPSAction&)*pAct); break; 182 case META_REFPOINT_ACTION : DoAction((MetaRefPointAction&)*pAct); break; 183 case META_TEXTLINECOLOR_ACTION : DoAction((MetaTextLineColorAction&)*pAct); break; 184 case META_TEXTLINE_ACTION : DoAction((MetaTextLineAction&)*pAct); break; 185 case META_FLOATTRANSPARENT_ACTION : DoAction((MetaFloatTransparentAction&)*pAct); break; 186 case META_GRADIENTEX_ACTION : DoAction((MetaGradientExAction&)*pAct); break; 187 case META_LAYOUTMODE_ACTION : DoAction((MetaLayoutModeAction&)*pAct); break; 188 case META_TEXTLANGUAGE_ACTION : DoAction((MetaTextLanguageAction&)*pAct); break; 189 case META_OVERLINECOLOR_ACTION : DoAction((MetaOverlineColorAction&)*pAct); break; |
203 } 204 | 190 } 191 |
205 if(pProgrInfo != NULL) | 192 if(pProgrInfo && pActionsToReport) |
206 { | 193 { |
207 nActionsToReport++; 208 if(nActionsToReport >= 16) // Alle 16 Action updaten 209 { 210 if(!pProgrInfo->ReportActions(nActionsToReport)) 211 break; 212 nActionsToReport = 0; 213 } | 194 (*pActionsToReport)++; 195 196 if(*pActionsToReport >= 16) // Alle 16 Action updaten 197 { 198 if(!pProgrInfo->ReportActions(*pActionsToReport)) 199 break; 200 201 *pActionsToReport = 0; 202 } |
214 } 215 } | 203 } 204 } |
205} |
|
216 | 206 |
217 if(pProgrInfo != NULL) | 207sal_uInt32 ImpSdrGDIMetaFileImport::DoImport( 208 const GDIMetaFile& rMtf, 209 SdrObjList& rOL, 210 sal_uInt32 nInsPos, 211 SvdProgressInfo* pProgrInfo) 212{ 213 // setup some global scale parameter 214 // mfScaleX, mfScaleY, maScaleX, maScaleY, mbMov, mbSize 215 mfScaleX = mfScaleY = 1.0; 216 const Size aMtfSize(rMtf.GetPrefSize()); 217 218 if(aMtfSize.Width() & aMtfSize.Height() && (!maScaleRect.IsEmpty())) 219 { 220 maOfs = maScaleRect.TopLeft(); 221 222 if(aMtfSize.Width() != (maScaleRect.GetWidth() - 1)) 223 { 224 mfScaleX = (double)( maScaleRect.GetWidth() - 1 ) / (double)aMtfSize.Width(); 225 } 226 227 if(aMtfSize.Height() != (maScaleRect.GetHeight() - 1)) 228 { 229 mfScaleY = (double)( maScaleRect.GetHeight() - 1 ) / (double)aMtfSize.Height(); 230 } 231 } 232 233 mbMov = maOfs.X()!=0 || maOfs.Y()!=0; 234 mbSize = false; 235 maScaleX = Fraction( 1, 1 ); 236 maScaleY = Fraction( 1, 1 ); 237 238 if(aMtfSize.Width() != (maScaleRect.GetWidth() - 1)) 239 { 240 maScaleX = Fraction(maScaleRect.GetWidth() - 1, aMtfSize.Width()); 241 mbSize = true; 242 } 243 244 if(aMtfSize.Height() != (maScaleRect.GetHeight() - 1)) 245 { 246 maScaleY = Fraction(maScaleRect.GetHeight() - 1, aMtfSize.Height()); 247 mbSize = true; 248 } 249 250 if(pProgrInfo) 251 { 252 pProgrInfo->SetActionCount(rMtf.GetActionCount()); 253 } 254 255 sal_uInt32 nActionsToReport(0); 256 257 // execute 258 DoLoopActions(const_cast< GDIMetaFile& >(rMtf), pProgrInfo, &nActionsToReport); 259 260 if(pProgrInfo) |
218 { 219 pProgrInfo->ReportActions(nActionsToReport); 220 nActionsToReport = 0; 221 } 222 223 // MapMode-Scaling vornehmen 224 MapScaling(); | 261 { 262 pProgrInfo->ReportActions(nActionsToReport); 263 nActionsToReport = 0; 264 } 265 266 // MapMode-Scaling vornehmen 267 MapScaling(); |
225 // Objekte in vorgegebenes Rechteck hineinskalieren 226 sal_uIntPtr nAnz=aTmpList.GetObjCount(); | |
227 228 // Beim berechnen der Fortschrittsanzeige wird GetActionCount()*3 benutzt. | 268 269 // Beim berechnen der Fortschrittsanzeige wird GetActionCount()*3 benutzt. |
229 // Da in aTmpList allerdings weniger eintraege als GetActionCount() | 270 // Da in maTmpList allerdings weniger eintraege als GetActionCount() |
230 // existieren koennen, muessen hier die zuviel vermuteten Actionen wieder 231 // hinzugefuegt werden. | 271 // existieren koennen, muessen hier die zuviel vermuteten Actionen wieder 272 // hinzugefuegt werden. |
232 nActionsToReport = (pMtf->GetActionCount() - nAnz)*2; | 273 nActionsToReport = (rMtf.GetActionCount() - maTmpList.size()) * 2; |
233 | 274 |
234 | |
235 // Alle noch nicht gemeldeten Rescales melden 236 if(pProgrInfo) 237 { 238 pProgrInfo->ReportRescales(nActionsToReport); | 275 // Alle noch nicht gemeldeten Rescales melden 276 if(pProgrInfo) 277 { 278 pProgrInfo->ReportRescales(nActionsToReport); |
239 pProgrInfo->SetInsertCount(nAnz); | 279 pProgrInfo->SetInsertCount(maTmpList.size()); |
240 } | 280 } |
241 nActionsToReport = 0; | |
242 | 281 |
243 // alle in aTmpList zwischengespeicherten Objekte nun in rOL ab der Position nInsPos einfuegen 244 if (nInsPos>rOL.GetObjCount()) nInsPos=rOL.GetObjCount(); | 282 nActionsToReport = 0; 283 284 // alle in maTmpList zwischengespeicherten Objekte nun in rOL ab der Position nInsPos einfuegen 285 if(nInsPos > rOL.GetObjCount()) 286 { 287 nInsPos = rOL.GetObjCount(); 288 } 289 |
245 SdrInsertReason aReason(SDRREASON_VIEWCALL); | 290 SdrInsertReason aReason(SDRREASON_VIEWCALL); |
246 for (sal_uIntPtr i=0; i<nAnz; i++) | 291 292 for(sal_uInt32 i(0); i < maTmpList.size(); i++) |
247 { | 293 { |
248 SdrObject* pObj=aTmpList.GetObj(i); 249 rOL.NbcInsertObject(pObj,nInsPos,&aReason); 250 nInsPos++; | 294 SdrObject* pObj = maTmpList[i]; 295 rOL.NbcInsertObject(pObj, nInsPos, &aReason); 296 nInsPos++; |
251 | 297 |
252 if(pProgrInfo != NULL) | 298 if(pProgrInfo) |
253 { 254 nActionsToReport++; | 299 { 300 nActionsToReport++; |
255 if(nActionsToReport >= 32) // Alle 32 Action updaten | 301 302 if(nActionsToReport >= 32) // Alle 32 Action updaten |
256 { 257 pProgrInfo->ReportInserts(nActionsToReport); 258 nActionsToReport = 0; 259 } 260 } 261 } | 303 { 304 pProgrInfo->ReportInserts(nActionsToReport); 305 nActionsToReport = 0; 306 } 307 } 308 } |
262 if (pTmpMtf!=NULL) delete pTmpMtf; | |
263 264 // ein letztesmal alle verbliebennen Inserts reporten | 309 310 // ein letztesmal alle verbliebennen Inserts reporten |
265 if(pProgrInfo != NULL) | 311 if(pProgrInfo) |
266 { 267 pProgrInfo->ReportInserts(nActionsToReport); | 312 { 313 pProgrInfo->ReportInserts(nActionsToReport); |
268 if(bError) 269 pProgrInfo->ReportError(); | |
270 } 271 | 314 } 315 |
272 return aTmpList.GetObjCount(); | 316 return maTmpList.size(); |
273} 274 | 317} 318 |
275void ImpSdrGDIMetaFileImport::SetAttributes(SdrObject* pObj, FASTBOOL bForceTextAttr) | 319void ImpSdrGDIMetaFileImport::SetAttributes(SdrObject* pObj, bool bForceTextAttr) |
276{ | 320{ |
277 bNoLine = sal_False; bNoFill = sal_False; 278 FASTBOOL bLine=sal_True && !bForceTextAttr; 279 FASTBOOL bFill=pObj==NULL || ( pObj->IsClosedObj() && !bForceTextAttr ); 280 FASTBOOL bText=bForceTextAttr || (pObj!=NULL && pObj->GetOutlinerParaObject()!=NULL); | 321 mbNoLine = false; 322 mbNoFill = false; 323 bool bLine(!bForceTextAttr); 324 bool bFill(!pObj || (pObj->IsClosedObj() && !bForceTextAttr)); 325 bool bText(bForceTextAttr || (pObj && pObj->GetOutlinerParaObject())); |
281 | 326 |
282 if ( bLine ) | 327 if(bLine) |
283 { | 328 { |
284 if ( nLineWidth ) 285 pLineAttr->Put( XLineWidthItem( nLineWidth ) ); | 329 if(mnLineWidth) 330 { 331 mpLineAttr->Put(XLineWidthItem(mnLineWidth)); 332 } |
286 else | 333 else |
287 pLineAttr->Put( XLineWidthItem( 0 ) ); | 334 { 335 mpLineAttr->Put(XLineWidthItem(0)); 336 } |
288 | 337 |
289 aOldLineColor = aVD.GetLineColor(); 290 if( aVD.IsLineColor() ) | 338 maOldLineColor = maVD.GetLineColor(); 339 340 if(maVD.IsLineColor()) |
291 { | 341 { |
292 pLineAttr->Put(XLineStyleItem(XLINE_SOLID)); 293 pLineAttr->Put(XLineColorItem(String(), aVD.GetLineColor())); | 342 mpLineAttr->Put(XLineStyleItem(XLINE_SOLID)); 343 mpLineAttr->Put(XLineColorItem(String(), maVD.GetLineColor())); |
294 } 295 else | 344 } 345 else |
296 pLineAttr->Put(XLineStyleItem(XLINE_NONE)); | 346 { 347 mpLineAttr->Put(XLineStyleItem(XLINE_NONE)); 348 } |
297 298 switch(maLineJoin) 299 { 300 default : // basegfx::B2DLINEJOIN_NONE | 349 350 switch(maLineJoin) 351 { 352 default : // basegfx::B2DLINEJOIN_NONE |
301 pLineAttr->Put(XLineJointItem(XLINEJOINT_NONE)); | 353 mpLineAttr->Put(XLineJointItem(XLINEJOINT_NONE)); |
302 break; 303 case basegfx::B2DLINEJOIN_MIDDLE: | 354 break; 355 case basegfx::B2DLINEJOIN_MIDDLE: |
304 pLineAttr->Put(XLineJointItem(XLINEJOINT_MIDDLE)); | 356 mpLineAttr->Put(XLineJointItem(XLINEJOINT_MIDDLE)); |
305 break; 306 case basegfx::B2DLINEJOIN_BEVEL: | 357 break; 358 case basegfx::B2DLINEJOIN_BEVEL: |
307 pLineAttr->Put(XLineJointItem(XLINEJOINT_BEVEL)); | 359 mpLineAttr->Put(XLineJointItem(XLINEJOINT_BEVEL)); |
308 break; 309 case basegfx::B2DLINEJOIN_MITER: | 360 break; 361 case basegfx::B2DLINEJOIN_MITER: |
310 pLineAttr->Put(XLineJointItem(XLINEJOINT_MITER)); | 362 mpLineAttr->Put(XLineJointItem(XLINEJOINT_MITER)); |
311 break; 312 case basegfx::B2DLINEJOIN_ROUND: | 363 break; 364 case basegfx::B2DLINEJOIN_ROUND: |
313 pLineAttr->Put(XLineJointItem(XLINEJOINT_ROUND)); | 365 mpLineAttr->Put(XLineJointItem(XLINEJOINT_ROUND)); |
314 break; 315 } 316 317 // Add LineCap support | 366 break; 367 } 368 369 // Add LineCap support |
318 pLineAttr->Put(XLineCapItem(maLineCap)); | 370 mpLineAttr->Put(XLineCapItem(maLineCap)); |
319 320 if(((maDash.GetDots() && maDash.GetDotLen()) || (maDash.GetDashes() && maDash.GetDashLen())) && maDash.GetDistance()) 321 { | 371 372 if(((maDash.GetDots() && maDash.GetDotLen()) || (maDash.GetDashes() && maDash.GetDashLen())) && maDash.GetDistance()) 373 { |
322 pLineAttr->Put(XLineDashItem(String(), maDash)); | 374 mpLineAttr->Put(XLineDashItem(String(), maDash)); |
323 } 324 else 325 { | 375 } 376 else 377 { |
326 pLineAttr->Put(XLineDashItem(String(), XDash(XDASH_RECT))); | 378 mpLineAttr->Put(XLineDashItem(String(), XDash(XDASH_RECT))); |
327 } 328 } 329 else | 379 } 380 } 381 else |
330 bNoLine = sal_True; | 382 { 383 mbNoLine = true; 384 } |
331 | 385 |
332 if ( bFill ) | 386 if(bFill) |
333 { | 387 { |
334 if( aVD.IsFillColor() ) | 388 if(maVD.IsFillColor()) |
335 { | 389 { |
336 pFillAttr->Put(XFillStyleItem(XFILL_SOLID)); 337 pFillAttr->Put(XFillColorItem(String(), aVD.GetFillColor())); | 390 mpFillAttr->Put(XFillStyleItem(XFILL_SOLID)); 391 mpFillAttr->Put(XFillColorItem(String(), maVD.GetFillColor())); |
338 } 339 else | 392 } 393 else |
340 pFillAttr->Put(XFillStyleItem(XFILL_NONE)); | 394 { 395 mpFillAttr->Put(XFillStyleItem(XFILL_NONE)); 396 } |
341 } 342 else | 397 } 398 else |
343 bNoFill = sal_True; | 399 { 400 mbNoFill = true; 401 } |
344 | 402 |
345 if ( bText && bFntDirty ) | 403 if(bText && mbFntDirty) |
346 { | 404 { |
347 Font aFnt(aVD.GetFont()); 348 pTextAttr->Put( SvxFontItem( aFnt.GetFamily(), aFnt.GetName(), aFnt.GetStyleName(), 349 aFnt.GetPitch(), aFnt.GetCharSet(), EE_CHAR_FONTINFO ) ); 350 pTextAttr->Put( SvxFontItem( aFnt.GetFamily(), aFnt.GetName(), aFnt.GetStyleName(), 351 aFnt.GetPitch(), aFnt.GetCharSet(), EE_CHAR_FONTINFO_CJK ) ); 352 pTextAttr->Put( SvxFontItem( aFnt.GetFamily(), aFnt.GetName(), aFnt.GetStyleName(), 353 aFnt.GetPitch(), aFnt.GetCharSet(), EE_CHAR_FONTINFO_CTL ) ); 354 pTextAttr->Put(SvxPostureItem(aFnt.GetItalic(), EE_CHAR_ITALIC)); 355 pTextAttr->Put(SvxWeightItem(aFnt.GetWeight(), EE_CHAR_WEIGHT)); 356 sal_uInt32 nHeight = FRound(aFnt.GetSize().Height() * fScaleY); 357 pTextAttr->Put( SvxFontHeightItem( nHeight, 100, EE_CHAR_FONTHEIGHT ) ); 358 pTextAttr->Put( SvxFontHeightItem( nHeight, 100, EE_CHAR_FONTHEIGHT_CJK ) ); 359 pTextAttr->Put( SvxFontHeightItem( nHeight, 100, EE_CHAR_FONTHEIGHT_CTL ) ); 360 pTextAttr->Put(SvxCharScaleWidthItem(100, EE_CHAR_FONTWIDTH)); 361 pTextAttr->Put(SvxUnderlineItem(aFnt.GetUnderline(), EE_CHAR_UNDERLINE)); 362 pTextAttr->Put(SvxOverlineItem(aFnt.GetOverline(), EE_CHAR_OVERLINE)); 363 pTextAttr->Put(SvxCrossedOutItem(aFnt.GetStrikeout(), EE_CHAR_STRIKEOUT)); 364 pTextAttr->Put(SvxShadowedItem(aFnt.IsShadow(), EE_CHAR_SHADOW)); | 405 Font aFnt(maVD.GetFont()); 406 const sal_uInt32 nHeight(FRound(aFnt.GetSize().Height() * mfScaleY)); |
365 | 407 |
408 mpTextAttr->Put( SvxFontItem( aFnt.GetFamily(), aFnt.GetName(), aFnt.GetStyleName(), aFnt.GetPitch(), aFnt.GetCharSet(), EE_CHAR_FONTINFO ) ); 409 mpTextAttr->Put( SvxFontItem( aFnt.GetFamily(), aFnt.GetName(), aFnt.GetStyleName(), aFnt.GetPitch(), aFnt.GetCharSet(), EE_CHAR_FONTINFO_CJK ) ); 410 mpTextAttr->Put( SvxFontItem( aFnt.GetFamily(), aFnt.GetName(), aFnt.GetStyleName(), aFnt.GetPitch(), aFnt.GetCharSet(), EE_CHAR_FONTINFO_CTL ) ); 411 mpTextAttr->Put(SvxPostureItem(aFnt.GetItalic(), EE_CHAR_ITALIC)); 412 mpTextAttr->Put(SvxWeightItem(aFnt.GetWeight(), EE_CHAR_WEIGHT)); 413 mpTextAttr->Put( SvxFontHeightItem( nHeight, 100, EE_CHAR_FONTHEIGHT ) ); 414 mpTextAttr->Put( SvxFontHeightItem( nHeight, 100, EE_CHAR_FONTHEIGHT_CJK ) ); 415 mpTextAttr->Put( SvxFontHeightItem( nHeight, 100, EE_CHAR_FONTHEIGHT_CTL ) ); 416 mpTextAttr->Put(SvxCharScaleWidthItem(100, EE_CHAR_FONTWIDTH)); 417 mpTextAttr->Put(SvxUnderlineItem(aFnt.GetUnderline(), EE_CHAR_UNDERLINE)); 418 mpTextAttr->Put(SvxOverlineItem(aFnt.GetOverline(), EE_CHAR_OVERLINE)); 419 mpTextAttr->Put(SvxCrossedOutItem(aFnt.GetStrikeout(), EE_CHAR_STRIKEOUT)); 420 mpTextAttr->Put(SvxShadowedItem(aFnt.IsShadow(), EE_CHAR_SHADOW)); 421 |
|
366 // #i118485# Setting this item leads to problems (written #i118498# for this) | 422 // #i118485# Setting this item leads to problems (written #i118498# for this) |
367 // pTextAttr->Put(SvxAutoKernItem(aFnt.IsKerning(), EE_CHAR_KERNING)); | 423 // mpTextAttr->Put(SvxAutoKernItem(aFnt.IsKerning(), EE_CHAR_KERNING)); |
368 | 424 |
369 pTextAttr->Put(SvxWordLineModeItem(aFnt.IsWordLineMode(), EE_CHAR_WLM)); 370 pTextAttr->Put(SvxContourItem(aFnt.IsOutline(), EE_CHAR_OUTLINE)); 371 pTextAttr->Put(SvxColorItem(aVD.GetTextColor(), EE_CHAR_COLOR)); | 425 mpTextAttr->Put(SvxWordLineModeItem(aFnt.IsWordLineMode(), EE_CHAR_WLM)); 426 mpTextAttr->Put(SvxContourItem(aFnt.IsOutline(), EE_CHAR_OUTLINE)); 427 mpTextAttr->Put(SvxColorItem(maVD.GetTextColor(), EE_CHAR_COLOR)); |
372 //... svxfont textitem svditext | 428 //... svxfont textitem svditext |
373 bFntDirty=sal_False; | 429 mbFntDirty = false; |
374 } | 430 } |
375 if (pObj!=NULL) | 431 432 if(pObj) |
376 { | 433 { |
377 pObj->SetLayer(nLayer); 378 if (bLine) pObj->SetMergedItemSet(*pLineAttr); 379 if (bFill) pObj->SetMergedItemSet(*pFillAttr); 380 if (bText) | 434 pObj->SetLayer(mnLayer); 435 436 if(bLine) 437 { 438 pObj->SetMergedItemSet(*mpLineAttr); 439 } 440 441 if(bFill) 442 { 443 pObj->SetMergedItemSet(*mpFillAttr); 444 } 445 446 if(bText) |
381 { | 447 { |
382 pObj->SetMergedItemSet(*pTextAttr); 383 pObj->SetMergedItem( SdrTextHorzAdjustItem( SDRTEXTHORZADJUST_LEFT ) ); | 448 pObj->SetMergedItemSet(*mpTextAttr); 449 pObj->SetMergedItem(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_LEFT)); |
384 } 385 } 386} 387 | 450 } 451 } 452} 453 |
388void ImpSdrGDIMetaFileImport::InsertObj(SdrObject* pObj, sal_Bool bScale) | 454void ImpSdrGDIMetaFileImport::InsertObj(SdrObject* pObj, bool bScale) |
389{ | 455{ |
390 if ( bScale && !aScaleRect.IsEmpty() ) | 456 if(bScale && !maScaleRect.IsEmpty()) |
391 { | 457 { |
392 if ( bSize ) 393 pObj->NbcResize( Point(), aScaleX, aScaleY ); 394 if ( bMov ) 395 pObj->NbcMove( Size( aOfs.X(), aOfs.Y() ) ); | 458 if(mbSize) 459 { 460 pObj->NbcResize(Point(), maScaleX, maScaleY); 461 } 462 463 if(mbMov) 464 { 465 pObj->NbcMove(Size(maOfs.X(), maOfs.Y())); 466 } |
396 } 397 398 if(isClip()) 399 { 400 const basegfx::B2DPolyPolygon aPoly(pObj->TakeXorPoly()); 401 const basegfx::B2DRange aOldRange(aPoly.getB2DRange()); 402 const SdrLayerID aOldLayer(pObj->GetLayer()); 403 const SfxItemSet aOldItemSet(pObj->GetMergedItemSet()); --- 91 unchanged lines hidden (view full) --- 495 } 496 497 if(!bVisible) 498 { 499 SdrObject::Free(pObj); 500 } 501 else 502 { | 467 } 468 469 if(isClip()) 470 { 471 const basegfx::B2DPolyPolygon aPoly(pObj->TakeXorPoly()); 472 const basegfx::B2DRange aOldRange(aPoly.getB2DRange()); 473 const SdrLayerID aOldLayer(pObj->GetLayer()); 474 const SfxItemSet aOldItemSet(pObj->GetMergedItemSet()); --- 91 unchanged lines hidden (view full) --- 566 } 567 568 if(!bVisible) 569 { 570 SdrObject::Free(pObj); 571 } 572 else 573 { |
503 aTmpList.InsertObject( pObj ); 504 if ( HAS_BASE( SdrPathObj, pObj ) ) | 574 maTmpList.push_back(pObj); 575 576 if(dynamic_cast< SdrPathObj* >(pObj)) |
505 { | 577 { |
506 FASTBOOL bClosed=pObj->IsClosedObj(); 507 bLastObjWasPolyWithoutLine=bNoLine && bClosed; 508 bLastObjWasLine=!bClosed; | 578 const bool bClosed(pObj->IsClosedObj()); 579 580 mbLastObjWasPolyWithoutLine = mbNoLine && bClosed; 581 mbLastObjWasLine = !bClosed; |
509 } 510 else 511 { | 582 } 583 else 584 { |
512 bLastObjWasPolyWithoutLine = sal_False; 513 bLastObjWasLine = sal_False; | 585 mbLastObjWasPolyWithoutLine = false; 586 mbLastObjWasLine = false; |
514 } 515 } 516 } 517} 518 519/**************************************************************************************************/ 520 521void ImpSdrGDIMetaFileImport::DoAction(MetaPixelAction& /*rAct*/) --- 8 unchanged lines hidden (view full) --- 530{ 531 // #i73407# reformulation to use new B2DPolygon classes 532 const basegfx::B2DPoint aStart(rAct.GetStartPoint().X(), rAct.GetStartPoint().Y()); 533 const basegfx::B2DPoint aEnd(rAct.GetEndPoint().X(), rAct.GetEndPoint().Y()); 534 535 if(!aStart.equal(aEnd)) 536 { 537 basegfx::B2DPolygon aLine; | 587 } 588 } 589 } 590} 591 592/**************************************************************************************************/ 593 594void ImpSdrGDIMetaFileImport::DoAction(MetaPixelAction& /*rAct*/) --- 8 unchanged lines hidden (view full) --- 603{ 604 // #i73407# reformulation to use new B2DPolygon classes 605 const basegfx::B2DPoint aStart(rAct.GetStartPoint().X(), rAct.GetStartPoint().Y()); 606 const basegfx::B2DPoint aEnd(rAct.GetEndPoint().X(), rAct.GetEndPoint().Y()); 607 608 if(!aStart.equal(aEnd)) 609 { 610 basegfx::B2DPolygon aLine; |
538 const basegfx::B2DHomMatrix aTransform(basegfx::tools::createScaleTranslateB2DHomMatrix(fScaleX, fScaleY, aOfs.X(), aOfs.Y())); | 611 const basegfx::B2DHomMatrix aTransform(basegfx::tools::createScaleTranslateB2DHomMatrix(mfScaleX, mfScaleY, maOfs.X(), maOfs.Y())); |
539 540 aLine.append(aStart); 541 aLine.append(aEnd); 542 aLine.transform(aTransform); 543 544 const LineInfo& rLineInfo = rAct.GetLineInfo(); 545 const sal_Int32 nNewLineWidth(rLineInfo.GetWidth()); 546 bool bCreateLineObject(true); 547 | 612 613 aLine.append(aStart); 614 aLine.append(aEnd); 615 aLine.transform(aTransform); 616 617 const LineInfo& rLineInfo = rAct.GetLineInfo(); 618 const sal_Int32 nNewLineWidth(rLineInfo.GetWidth()); 619 bool bCreateLineObject(true); 620 |
548 if(bLastObjWasLine && (nNewLineWidth == nLineWidth) && CheckLastLineMerge(aLine)) | 621 if(mbLastObjWasLine && (nNewLineWidth == mnLineWidth) && CheckLastLineMerge(aLine)) |
549 { 550 bCreateLineObject = false; 551 } 552 553 if(bCreateLineObject) 554 { 555 SdrPathObj* pPath = new SdrPathObj(OBJ_LINE, basegfx::B2DPolyPolygon(aLine)); | 622 { 623 bCreateLineObject = false; 624 } 625 626 if(bCreateLineObject) 627 { 628 SdrPathObj* pPath = new SdrPathObj(OBJ_LINE, basegfx::B2DPolyPolygon(aLine)); |
556 nLineWidth = nNewLineWidth; | 629 mnLineWidth = nNewLineWidth; |
557 maLineJoin = rLineInfo.GetLineJoin(); 558 maLineCap = rLineInfo.GetLineCap(); 559 maDash = XDash(XDASH_RECT, 560 rLineInfo.GetDotCount(), rLineInfo.GetDotLen(), 561 rLineInfo.GetDashCount(), rLineInfo.GetDashLen(), 562 rLineInfo.GetDistance()); 563 SetAttributes(pPath); | 630 maLineJoin = rLineInfo.GetLineJoin(); 631 maLineCap = rLineInfo.GetLineCap(); 632 maDash = XDash(XDASH_RECT, 633 rLineInfo.GetDotCount(), rLineInfo.GetDotLen(), 634 rLineInfo.GetDashCount(), rLineInfo.GetDashLen(), 635 rLineInfo.GetDistance()); 636 SetAttributes(pPath); |
564 nLineWidth = 0; | 637 mnLineWidth = 0; |
565 maLineJoin = basegfx::B2DLINEJOIN_NONE; 566 maDash = XDash(); 567 InsertObj(pPath, false); 568 } 569 } 570} 571 572void ImpSdrGDIMetaFileImport::DoAction(MetaRectAction& rAct) --- 4 unchanged lines hidden (view full) --- 577} 578 579void ImpSdrGDIMetaFileImport::DoAction(MetaRoundRectAction& rAct) 580{ 581 SdrRectObj* pRect=new SdrRectObj(rAct.GetRect()); 582 SetAttributes(pRect); 583 long nRad=(rAct.GetHorzRound()+rAct.GetVertRound())/2; 584 if (nRad!=0) { | 638 maLineJoin = basegfx::B2DLINEJOIN_NONE; 639 maDash = XDash(); 640 InsertObj(pPath, false); 641 } 642 } 643} 644 645void ImpSdrGDIMetaFileImport::DoAction(MetaRectAction& rAct) --- 4 unchanged lines hidden (view full) --- 650} 651 652void ImpSdrGDIMetaFileImport::DoAction(MetaRoundRectAction& rAct) 653{ 654 SdrRectObj* pRect=new SdrRectObj(rAct.GetRect()); 655 SetAttributes(pRect); 656 long nRad=(rAct.GetHorzRound()+rAct.GetVertRound())/2; 657 if (nRad!=0) { |
585 SfxItemSet aSet(*pLineAttr->GetPool(),SDRATTR_ECKENRADIUS,SDRATTR_ECKENRADIUS); | 658 SfxItemSet aSet(*mpLineAttr->GetPool(), SDRATTR_ECKENRADIUS, SDRATTR_ECKENRADIUS, 0, 0); |
586 aSet.Put(SdrEckenradiusItem(nRad)); 587 pRect->SetMergedItemSet(aSet); 588 } 589 InsertObj(pRect); 590} 591 592/**************************************************************************************************/ 593 --- 40 unchanged lines hidden (view full) --- 634{ 635 // #i102706# Do not merge closed polygons 636 if(rSrcPoly.isClosed()) 637 { 638 return false; 639 } 640 641 // #i73407# reformulation to use new B2DPolygon classes | 659 aSet.Put(SdrEckenradiusItem(nRad)); 660 pRect->SetMergedItemSet(aSet); 661 } 662 InsertObj(pRect); 663} 664 665/**************************************************************************************************/ 666 --- 40 unchanged lines hidden (view full) --- 707{ 708 // #i102706# Do not merge closed polygons 709 if(rSrcPoly.isClosed()) 710 { 711 return false; 712 } 713 714 // #i73407# reformulation to use new B2DPolygon classes |
642 if(bLastObjWasLine && (aOldLineColor == aVD.GetLineColor()) && rSrcPoly.count()) | 715 if(mbLastObjWasLine && (maOldLineColor == maVD.GetLineColor()) && rSrcPoly.count()) |
643 { | 716 { |
644 SdrObject* pTmpObj = aTmpList.GetObj(aTmpList.GetObjCount() - 1); 645 SdrPathObj* pLastPoly = PTR_CAST(SdrPathObj, pTmpObj); | 717 SdrObject* pTmpObj = maTmpList.size() ? maTmpList[maTmpList.size() - 1] : 0; 718 SdrPathObj* pLastPoly = dynamic_cast< SdrPathObj* >(pTmpObj); |
646 647 if(pLastPoly) 648 { 649 if(1L == pLastPoly->GetPathPoly().count()) 650 { 651 bool bOk(false); 652 basegfx::B2DPolygon aDstPoly(pLastPoly->GetPathPoly().getB2DPolygon(0L)); 653 --- 46 unchanged lines hidden (view full) --- 700 } 701 702 return false; 703} 704 705bool ImpSdrGDIMetaFileImport::CheckLastPolyLineAndFillMerge(const basegfx::B2DPolyPolygon & rPolyPolygon) 706{ 707 // #i73407# reformulation to use new B2DPolygon classes | 719 720 if(pLastPoly) 721 { 722 if(1L == pLastPoly->GetPathPoly().count()) 723 { 724 bool bOk(false); 725 basegfx::B2DPolygon aDstPoly(pLastPoly->GetPathPoly().getB2DPolygon(0L)); 726 --- 46 unchanged lines hidden (view full) --- 773 } 774 775 return false; 776} 777 778bool ImpSdrGDIMetaFileImport::CheckLastPolyLineAndFillMerge(const basegfx::B2DPolyPolygon & rPolyPolygon) 779{ 780 // #i73407# reformulation to use new B2DPolygon classes |
708 if(bLastObjWasPolyWithoutLine) | 781 if(mbLastObjWasPolyWithoutLine) |
709 { | 782 { |
710 SdrObject* pTmpObj = aTmpList.GetObj(aTmpList.GetObjCount() - 1); 711 SdrPathObj* pLastPoly = PTR_CAST(SdrPathObj, pTmpObj); | 783 SdrObject* pTmpObj = maTmpList.size() ? maTmpList[maTmpList.size() - 1] : 0; 784 SdrPathObj* pLastPoly = dynamic_cast< SdrPathObj* >(pTmpObj); |
712 713 if(pLastPoly) 714 { 715 if(pLastPoly->GetPathPoly() == rPolyPolygon) 716 { 717 SetAttributes(NULL); 718 | 785 786 if(pLastPoly) 787 { 788 if(pLastPoly->GetPathPoly() == rPolyPolygon) 789 { 790 SetAttributes(NULL); 791 |
719 if(!bNoLine && bNoFill) | 792 if(!mbNoLine && mbNoFill) |
720 { | 793 { |
721 pLastPoly->SetMergedItemSet(*pLineAttr); | 794 pLastPoly->SetMergedItemSet(*mpLineAttr); |
722 723 return true; 724 } 725 } 726 } 727 } 728 729 return false; 730} 731 732void ImpSdrGDIMetaFileImport::checkClip() 733{ | 795 796 return true; 797 } 798 } 799 } 800 } 801 802 return false; 803} 804 805void ImpSdrGDIMetaFileImport::checkClip() 806{ |
734 if(aVD.IsClipRegion()) | 807 if(maVD.IsClipRegion()) |
735 { | 808 { |
736 Region aRegion(aVD.GetClipRegion()); | 809 Region aRegion(maVD.GetClipRegion()); |
737 738 maClip = aRegion.ConvertToB2DPolyPolygon(); 739 740 if(isClip()) 741 { 742 const basegfx::B2DHomMatrix aTransform( 743 basegfx::tools::createScaleTranslateB2DHomMatrix( | 810 811 maClip = aRegion.ConvertToB2DPolyPolygon(); 812 813 if(isClip()) 814 { 815 const basegfx::B2DHomMatrix aTransform( 816 basegfx::tools::createScaleTranslateB2DHomMatrix( |
744 fScaleX, 745 fScaleY, 746 aOfs.X(), 747 aOfs.Y())); | 817 mfScaleX, 818 mfScaleY, 819 maOfs.X(), 820 maOfs.Y())); |
748 749 maClip.transform(aTransform); 750 } 751 } 752} 753 754bool ImpSdrGDIMetaFileImport::isClip() const 755{ 756 return !maClip.getB2DRange().isEmpty(); 757} 758 759void ImpSdrGDIMetaFileImport::DoAction( MetaPolyLineAction& rAct ) 760{ 761 // #i73407# reformulation to use new B2DPolygon classes 762 basegfx::B2DPolygon aSource(rAct.GetPolygon().getB2DPolygon()); 763 764 if(aSource.count()) 765 { | 821 822 maClip.transform(aTransform); 823 } 824 } 825} 826 827bool ImpSdrGDIMetaFileImport::isClip() const 828{ 829 return !maClip.getB2DRange().isEmpty(); 830} 831 832void ImpSdrGDIMetaFileImport::DoAction( MetaPolyLineAction& rAct ) 833{ 834 // #i73407# reformulation to use new B2DPolygon classes 835 basegfx::B2DPolygon aSource(rAct.GetPolygon().getB2DPolygon()); 836 837 if(aSource.count()) 838 { |
766 const basegfx::B2DHomMatrix aTransform(basegfx::tools::createScaleTranslateB2DHomMatrix(fScaleX, fScaleY, aOfs.X(), aOfs.Y())); | 839 const basegfx::B2DHomMatrix aTransform(basegfx::tools::createScaleTranslateB2DHomMatrix(mfScaleX, mfScaleY, maOfs.X(), maOfs.Y())); |
767 aSource.transform(aTransform); 768 } 769 770 const LineInfo& rLineInfo = rAct.GetLineInfo(); 771 const sal_Int32 nNewLineWidth(rLineInfo.GetWidth()); 772 bool bCreateLineObject(true); 773 | 840 aSource.transform(aTransform); 841 } 842 843 const LineInfo& rLineInfo = rAct.GetLineInfo(); 844 const sal_Int32 nNewLineWidth(rLineInfo.GetWidth()); 845 bool bCreateLineObject(true); 846 |
774 if(bLastObjWasLine && (nNewLineWidth == nLineWidth) && CheckLastLineMerge(aSource)) | 847 if(mbLastObjWasLine && (nNewLineWidth == mnLineWidth) && CheckLastLineMerge(aSource)) |
775 { 776 bCreateLineObject = false; 777 } | 848 { 849 bCreateLineObject = false; 850 } |
778 else if(bLastObjWasPolyWithoutLine && CheckLastPolyLineAndFillMerge(basegfx::B2DPolyPolygon(aSource))) | 851 else if(mbLastObjWasPolyWithoutLine && CheckLastPolyLineAndFillMerge(basegfx::B2DPolyPolygon(aSource))) |
779 { 780 bCreateLineObject = false; 781 } 782 783 if(bCreateLineObject) 784 { 785 SdrPathObj* pPath = new SdrPathObj( 786 aSource.isClosed() ? OBJ_POLY : OBJ_PLIN, 787 basegfx::B2DPolyPolygon(aSource)); | 852 { 853 bCreateLineObject = false; 854 } 855 856 if(bCreateLineObject) 857 { 858 SdrPathObj* pPath = new SdrPathObj( 859 aSource.isClosed() ? OBJ_POLY : OBJ_PLIN, 860 basegfx::B2DPolyPolygon(aSource)); |
788 nLineWidth = nNewLineWidth; | 861 mnLineWidth = nNewLineWidth; |
789 maLineJoin = rLineInfo.GetLineJoin(); 790 maLineCap = rLineInfo.GetLineCap(); 791 maDash = XDash(XDASH_RECT, 792 rLineInfo.GetDotCount(), rLineInfo.GetDotLen(), 793 rLineInfo.GetDashCount(), rLineInfo.GetDashLen(), 794 rLineInfo.GetDistance()); 795 SetAttributes(pPath); | 862 maLineJoin = rLineInfo.GetLineJoin(); 863 maLineCap = rLineInfo.GetLineCap(); 864 maDash = XDash(XDASH_RECT, 865 rLineInfo.GetDotCount(), rLineInfo.GetDotLen(), 866 rLineInfo.GetDashCount(), rLineInfo.GetDashLen(), 867 rLineInfo.GetDistance()); 868 SetAttributes(pPath); |
796 nLineWidth = 0; | 869 mnLineWidth = 0; |
797 maLineJoin = basegfx::B2DLINEJOIN_NONE; 798 maDash = XDash(); 799 InsertObj(pPath, false); 800 } 801} 802 803void ImpSdrGDIMetaFileImport::DoAction( MetaPolygonAction& rAct ) 804{ 805 // #i73407# reformulation to use new B2DPolygon classes 806 basegfx::B2DPolygon aSource(rAct.GetPolygon().getB2DPolygon()); 807 808 if(aSource.count()) 809 { | 870 maLineJoin = basegfx::B2DLINEJOIN_NONE; 871 maDash = XDash(); 872 InsertObj(pPath, false); 873 } 874} 875 876void ImpSdrGDIMetaFileImport::DoAction( MetaPolygonAction& rAct ) 877{ 878 // #i73407# reformulation to use new B2DPolygon classes 879 basegfx::B2DPolygon aSource(rAct.GetPolygon().getB2DPolygon()); 880 881 if(aSource.count()) 882 { |
810 const basegfx::B2DHomMatrix aTransform(basegfx::tools::createScaleTranslateB2DHomMatrix(fScaleX, fScaleY, aOfs.X(), aOfs.Y())); | 883 const basegfx::B2DHomMatrix aTransform(basegfx::tools::createScaleTranslateB2DHomMatrix(mfScaleX, mfScaleY, maOfs.X(), maOfs.Y())); |
811 aSource.transform(aTransform); 812 | 884 aSource.transform(aTransform); 885 |
813 if(!bLastObjWasPolyWithoutLine || !CheckLastPolyLineAndFillMerge(basegfx::B2DPolyPolygon(aSource))) | 886 if(!mbLastObjWasPolyWithoutLine || !CheckLastPolyLineAndFillMerge(basegfx::B2DPolyPolygon(aSource))) |
814 { 815 // #i73407# make sure polygon is closed, it's a filled primitive 816 aSource.setClosed(true); 817 SdrPathObj* pPath = new SdrPathObj(OBJ_POLY, basegfx::B2DPolyPolygon(aSource)); 818 SetAttributes(pPath); 819 InsertObj(pPath, false); 820 } 821 } 822} 823 824void ImpSdrGDIMetaFileImport::DoAction(MetaPolyPolygonAction& rAct) 825{ 826 // #i73407# reformulation to use new B2DPolygon classes 827 basegfx::B2DPolyPolygon aSource(rAct.GetPolyPolygon().getB2DPolyPolygon()); 828 829 if(aSource.count()) 830 { | 887 { 888 // #i73407# make sure polygon is closed, it's a filled primitive 889 aSource.setClosed(true); 890 SdrPathObj* pPath = new SdrPathObj(OBJ_POLY, basegfx::B2DPolyPolygon(aSource)); 891 SetAttributes(pPath); 892 InsertObj(pPath, false); 893 } 894 } 895} 896 897void ImpSdrGDIMetaFileImport::DoAction(MetaPolyPolygonAction& rAct) 898{ 899 // #i73407# reformulation to use new B2DPolygon classes 900 basegfx::B2DPolyPolygon aSource(rAct.GetPolyPolygon().getB2DPolyPolygon()); 901 902 if(aSource.count()) 903 { |
831 const basegfx::B2DHomMatrix aTransform(basegfx::tools::createScaleTranslateB2DHomMatrix(fScaleX, fScaleY, aOfs.X(), aOfs.Y())); | 904 const basegfx::B2DHomMatrix aTransform(basegfx::tools::createScaleTranslateB2DHomMatrix(mfScaleX, mfScaleY, maOfs.X(), maOfs.Y())); |
832 aSource.transform(aTransform); 833 | 905 aSource.transform(aTransform); 906 |
834 if(!bLastObjWasPolyWithoutLine || !CheckLastPolyLineAndFillMerge(aSource)) | 907 if(!mbLastObjWasPolyWithoutLine || !CheckLastPolyLineAndFillMerge(aSource)) |
835 { 836 // #i73407# make sure polygon is closed, it's a filled primitive 837 aSource.setClosed(true); 838 SdrPathObj* pPath = new SdrPathObj(OBJ_POLY, aSource); 839 SetAttributes(pPath); 840 InsertObj(pPath, false); 841 } 842 } 843} 844 845/**************************************************************************************************/ 846 847void ImpSdrGDIMetaFileImport::ImportText( const Point& rPos, const XubString& rStr, const MetaAction& rAct ) 848{ 849 // calc text box size, add 5% to make it fit safely 850 | 908 { 909 // #i73407# make sure polygon is closed, it's a filled primitive 910 aSource.setClosed(true); 911 SdrPathObj* pPath = new SdrPathObj(OBJ_POLY, aSource); 912 SetAttributes(pPath); 913 InsertObj(pPath, false); 914 } 915 } 916} 917 918/**************************************************************************************************/ 919 920void ImpSdrGDIMetaFileImport::ImportText( const Point& rPos, const XubString& rStr, const MetaAction& rAct ) 921{ 922 // calc text box size, add 5% to make it fit safely 923 |
851 FontMetric aFontMetric( aVD.GetFontMetric() ); 852 Font aFnt( aVD.GetFont() ); | 924 FontMetric aFontMetric( maVD.GetFontMetric() ); 925 Font aFnt( maVD.GetFont() ); |
853 FontAlign eAlg( aFnt.GetAlign() ); 854 | 926 FontAlign eAlg( aFnt.GetAlign() ); 927 |
855 sal_Int32 nTextWidth = (sal_Int32)( aVD.GetTextWidth( rStr ) * fScaleX ); 856 sal_Int32 nTextHeight = (sal_Int32)( aVD.GetTextHeight() * fScaleY ); | 928 sal_Int32 nTextWidth = (sal_Int32)( maVD.GetTextWidth( rStr ) * mfScaleX ); 929 sal_Int32 nTextHeight = (sal_Int32)( maVD.GetTextHeight() * mfScaleY ); |
857 //sal_Int32 nDxWidth = 0; 858 //sal_Int32 nLen = rStr.Len(); 859 | 930 //sal_Int32 nDxWidth = 0; 931 //sal_Int32 nLen = rStr.Len(); 932 |
860 Point aPos( FRound(rPos.X() * fScaleX + aOfs.X()), FRound(rPos.Y() * fScaleY + aOfs.Y()) ); | 933 Point aPos( FRound(rPos.X() * mfScaleX + maOfs.X()), FRound(rPos.Y() * mfScaleY + maOfs.Y()) ); |
861 Size aSize( nTextWidth, nTextHeight ); 862 863 if ( eAlg == ALIGN_BASELINE ) | 934 Size aSize( nTextWidth, nTextHeight ); 935 936 if ( eAlg == ALIGN_BASELINE ) |
864 aPos.Y() -= FRound(aFontMetric.GetAscent() * fScaleY); | 937 aPos.Y() -= FRound(aFontMetric.GetAscent() * mfScaleY); |
865 else if ( eAlg == ALIGN_BOTTOM ) 866 aPos.Y() -= nTextHeight; 867 868 Rectangle aTextRect( aPos, aSize ); 869 SdrRectObj* pText =new SdrRectObj( OBJ_TEXT, aTextRect ); 870 871 if ( aFnt.GetWidth() || ( rAct.GetType() == META_STRETCHTEXT_ACTION ) ) 872 { 873 pText->ClearMergedItem( SDRATTR_TEXT_AUTOGROWWIDTH ); | 938 else if ( eAlg == ALIGN_BOTTOM ) 939 aPos.Y() -= nTextHeight; 940 941 Rectangle aTextRect( aPos, aSize ); 942 SdrRectObj* pText =new SdrRectObj( OBJ_TEXT, aTextRect ); 943 944 if ( aFnt.GetWidth() || ( rAct.GetType() == META_STRETCHTEXT_ACTION ) ) 945 { 946 pText->ClearMergedItem( SDRATTR_TEXT_AUTOGROWWIDTH ); |
874 pText->SetMergedItem( SdrTextAutoGrowHeightItem( sal_False ) ); | 947 pText->SetMergedItem( SdrTextAutoGrowHeightItem( false ) ); |
875 // don't let the margins eat the space needed for the text 876 pText->SetMergedItem ( SdrTextUpperDistItem (0)); 877 pText->SetMergedItem ( SdrTextLowerDistItem (0)); 878 pText->SetMergedItem ( SdrTextRightDistItem (0)); 879 pText->SetMergedItem ( SdrTextLeftDistItem (0)); 880 pText->SetMergedItem( SdrTextFitToSizeTypeItem( SDRTEXTFIT_ALLLINES ) ); 881 } 882 else | 948 // don't let the margins eat the space needed for the text 949 pText->SetMergedItem ( SdrTextUpperDistItem (0)); 950 pText->SetMergedItem ( SdrTextLowerDistItem (0)); 951 pText->SetMergedItem ( SdrTextRightDistItem (0)); 952 pText->SetMergedItem ( SdrTextLeftDistItem (0)); 953 pText->SetMergedItem( SdrTextFitToSizeTypeItem( SDRTEXTFIT_ALLLINES ) ); 954 } 955 else |
883 pText->SetMergedItem( SdrTextAutoGrowWidthItem( sal_True ) ); | 956 pText->SetMergedItem( SdrTextAutoGrowWidthItem( true ) ); |
884 | 957 |
885 pText->SetModel( pModel ); 886 pText->SetLayer( nLayer ); | 958 pText->SetModel(mpModel); 959 pText->SetLayer(mnLayer); |
887 pText->NbcSetText( rStr ); | 960 pText->NbcSetText( rStr ); |
888 SetAttributes( pText, sal_True ); | 961 SetAttributes( pText, true ); |
889 pText->SetSnapRect( aTextRect ); 890 891 if (!aFnt.IsTransparent()) 892 { | 962 pText->SetSnapRect( aTextRect ); 963 964 if (!aFnt.IsTransparent()) 965 { |
893 SfxItemSet aAttr(*pFillAttr->GetPool(),XATTR_FILL_FIRST,XATTR_FILL_LAST); | 966 SfxItemSet aAttr(*mpFillAttr->GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST, 0, 0); |
894 aAttr.Put(XFillStyleItem(XFILL_SOLID)); 895 aAttr.Put(XFillColorItem(String(), aFnt.GetFillColor())); 896 pText->SetMergedItemSet(aAttr); 897 } 898 sal_uInt32 nWink = aFnt.GetOrientation(); 899 if ( nWink ) 900 { 901 nWink*=10; 902 double a=nWink*nPi180; 903 double nSin=sin(a); 904 double nCos=cos(a); 905 pText->NbcRotate(aPos,nWink,nSin,nCos); 906 } | 967 aAttr.Put(XFillStyleItem(XFILL_SOLID)); 968 aAttr.Put(XFillColorItem(String(), aFnt.GetFillColor())); 969 pText->SetMergedItemSet(aAttr); 970 } 971 sal_uInt32 nWink = aFnt.GetOrientation(); 972 if ( nWink ) 973 { 974 nWink*=10; 975 double a=nWink*nPi180; 976 double nSin=sin(a); 977 double nCos=cos(a); 978 pText->NbcRotate(aPos,nWink,nSin,nCos); 979 } |
907 InsertObj( pText, sal_False ); | 980 InsertObj( pText, false ); |
908} 909 910void ImpSdrGDIMetaFileImport::DoAction(MetaTextAction& rAct) 911{ 912 XubString aStr(rAct.GetText()); 913 aStr.Erase(0,rAct.GetIndex()); 914 aStr.Erase(rAct.GetLen()); 915 ImportText( rAct.GetPoint(), aStr, rAct ); --- 51 unchanged lines hidden (view full) --- 967 968void ImpSdrGDIMetaFileImport::DoAction( MetaHatchAction& rAct ) 969{ 970 // #i73407# reformulation to use new B2DPolygon classes 971 basegfx::B2DPolyPolygon aSource(rAct.GetPolyPolygon().getB2DPolyPolygon()); 972 973 if(aSource.count()) 974 { | 981} 982 983void ImpSdrGDIMetaFileImport::DoAction(MetaTextAction& rAct) 984{ 985 XubString aStr(rAct.GetText()); 986 aStr.Erase(0,rAct.GetIndex()); 987 aStr.Erase(rAct.GetLen()); 988 ImportText( rAct.GetPoint(), aStr, rAct ); --- 51 unchanged lines hidden (view full) --- 1040 1041void ImpSdrGDIMetaFileImport::DoAction( MetaHatchAction& rAct ) 1042{ 1043 // #i73407# reformulation to use new B2DPolygon classes 1044 basegfx::B2DPolyPolygon aSource(rAct.GetPolyPolygon().getB2DPolyPolygon()); 1045 1046 if(aSource.count()) 1047 { |
975 const basegfx::B2DHomMatrix aTransform(basegfx::tools::createScaleTranslateB2DHomMatrix(fScaleX, fScaleY, aOfs.X(), aOfs.Y())); | 1048 const basegfx::B2DHomMatrix aTransform(basegfx::tools::createScaleTranslateB2DHomMatrix(mfScaleX, mfScaleY, maOfs.X(), maOfs.Y())); |
976 aSource.transform(aTransform); 977 | 1049 aSource.transform(aTransform); 1050 |
978 if(!bLastObjWasPolyWithoutLine || !CheckLastPolyLineAndFillMerge(aSource)) | 1051 if(!mbLastObjWasPolyWithoutLine || !CheckLastPolyLineAndFillMerge(aSource)) |
979 { 980 const Hatch& rHatch = rAct.GetHatch(); 981 SdrPathObj* pPath = new SdrPathObj(OBJ_POLY, aSource); | 1052 { 1053 const Hatch& rHatch = rAct.GetHatch(); 1054 SdrPathObj* pPath = new SdrPathObj(OBJ_POLY, aSource); |
982 SfxItemSet aHatchAttr(pModel->GetItemPool(), 983 XATTR_FILLSTYLE, XATTR_FILLSTYLE, 984 XATTR_FILLHATCH, XATTR_FILLHATCH, 0, 0 ); | 1055 SfxItemSet aHatchAttr(mpModel->GetItemPool(), XATTR_FILLSTYLE, XATTR_FILLSTYLE, XATTR_FILLHATCH, XATTR_FILLHATCH, 0, 0); |
985 XHatchStyle eStyle; 986 987 switch(rHatch.GetStyle()) 988 { 989 case(HATCH_TRIPLE) : 990 { 991 eStyle = XHATCH_TRIPLE; 992 break; --- 9 unchanged lines hidden (view full) --- 1002 { 1003 eStyle = XHATCH_SINGLE; 1004 break; 1005 } 1006 } 1007 1008 SetAttributes(pPath); 1009 aHatchAttr.Put(XFillStyleItem(XFILL_HATCH)); | 1056 XHatchStyle eStyle; 1057 1058 switch(rHatch.GetStyle()) 1059 { 1060 case(HATCH_TRIPLE) : 1061 { 1062 eStyle = XHATCH_TRIPLE; 1063 break; --- 9 unchanged lines hidden (view full) --- 1073 { 1074 eStyle = XHATCH_SINGLE; 1075 break; 1076 } 1077 } 1078 1079 SetAttributes(pPath); 1080 aHatchAttr.Put(XFillStyleItem(XFILL_HATCH)); |
1010 aHatchAttr.Put(XFillHatchItem(&pModel->GetItemPool(), XHatch(rHatch.GetColor(), eStyle, rHatch.GetDistance(), rHatch.GetAngle()))); | 1081 aHatchAttr.Put(XFillHatchItem(&mpModel->GetItemPool(), XHatch(rHatch.GetColor(), eStyle, rHatch.GetDistance(), rHatch.GetAngle()))); |
1011 pPath->SetMergedItemSet(aHatchAttr); 1012 1013 InsertObj(pPath, false); 1014 } 1015 } 1016} 1017 1018//////////////////////////////////////////////////////////////////////////////////////////////////// 1019 1020void ImpSdrGDIMetaFileImport::DoAction(MetaLineColorAction& rAct) 1021{ | 1082 pPath->SetMergedItemSet(aHatchAttr); 1083 1084 InsertObj(pPath, false); 1085 } 1086 } 1087} 1088 1089//////////////////////////////////////////////////////////////////////////////////////////////////// 1090 1091void ImpSdrGDIMetaFileImport::DoAction(MetaLineColorAction& rAct) 1092{ |
1022 rAct.Execute(&aVD); | 1093 rAct.Execute(&maVD); |
1023} 1024 1025void ImpSdrGDIMetaFileImport::DoAction(MetaMapModeAction& rAct) 1026{ 1027 MapScaling(); | 1094} 1095 1096void ImpSdrGDIMetaFileImport::DoAction(MetaMapModeAction& rAct) 1097{ 1098 MapScaling(); |
1028 rAct.Execute(&aVD); 1029 bLastObjWasPolyWithoutLine=sal_False; 1030 bLastObjWasLine=sal_False; | 1099 rAct.Execute(&maVD); 1100 mbLastObjWasPolyWithoutLine = false; 1101 mbLastObjWasLine = false; |
1031} 1032 1033void ImpSdrGDIMetaFileImport::MapScaling() 1034{ | 1102} 1103 1104void ImpSdrGDIMetaFileImport::MapScaling() 1105{ |
1035 sal_uInt32 i, nAnz = aTmpList.GetObjCount(); 1036 const MapMode& rMap = aVD.GetMapMode(); | 1106 const sal_uInt32 nAnz(maTmpList.size()); 1107 sal_uInt32 i(0); 1108 const MapMode& rMap = maVD.GetMapMode(); |
1037 Point aMapOrg( rMap.GetOrigin() ); | 1109 Point aMapOrg( rMap.GetOrigin() ); |
1038 sal_Bool bMov2 = aMapOrg.X() != 0 || aMapOrg.Y() != 0; 1039 if ( bMov2 ) | 1110 bool bMov2(aMapOrg.X() != 0 || aMapOrg.Y() != 0); 1111 1112 if(bMov2) |
1040 { | 1113 { |
1041 for ( i = nMapScalingOfs; i < nAnz; i++ ) | 1114 for(i = mnMapScalingOfs; i < nAnz; i++) |
1042 { | 1115 { |
1043 SdrObject* pObj = aTmpList.GetObj(i); 1044 if ( bMov2 ) 1045 pObj->NbcMove( Size( aMapOrg.X(), aMapOrg.Y() ) ); | 1116 SdrObject* pObj = maTmpList[i]; 1117 1118 pObj->NbcMove(Size(aMapOrg.X(), aMapOrg.Y())); |
1046 } 1047 } | 1119 } 1120 } |
1048 nMapScalingOfs = nAnz; | 1121 1122 mnMapScalingOfs = nAnz; |
1049} 1050 1051//////////////////////////////////////////////////////////////////////////////////////////////////// 1052 1053void ImpSdrGDIMetaFileImport::DoAction( MetaCommentAction& rAct, GDIMetaFile* pMtf ) 1054{ 1055 ByteString aSkipComment; 1056 1057 if( rAct.GetComment().CompareIgnoreCaseToAscii( "XGRAD_SEQ_BEGIN" ) == COMPARE_EQUAL ) 1058 { 1059 MetaGradientExAction* pAct = (MetaGradientExAction*) pMtf->NextAction(); 1060 1061 if( pAct && pAct->GetType() == META_GRADIENTEX_ACTION ) 1062 { 1063 // #i73407# reformulation to use new B2DPolygon classes 1064 basegfx::B2DPolyPolygon aSource(pAct->GetPolyPolygon().getB2DPolyPolygon()); 1065 1066 if(aSource.count()) 1067 { | 1123} 1124 1125//////////////////////////////////////////////////////////////////////////////////////////////////// 1126 1127void ImpSdrGDIMetaFileImport::DoAction( MetaCommentAction& rAct, GDIMetaFile* pMtf ) 1128{ 1129 ByteString aSkipComment; 1130 1131 if( rAct.GetComment().CompareIgnoreCaseToAscii( "XGRAD_SEQ_BEGIN" ) == COMPARE_EQUAL ) 1132 { 1133 MetaGradientExAction* pAct = (MetaGradientExAction*) pMtf->NextAction(); 1134 1135 if( pAct && pAct->GetType() == META_GRADIENTEX_ACTION ) 1136 { 1137 // #i73407# reformulation to use new B2DPolygon classes 1138 basegfx::B2DPolyPolygon aSource(pAct->GetPolyPolygon().getB2DPolyPolygon()); 1139 1140 if(aSource.count()) 1141 { |
1068 if(!bLastObjWasPolyWithoutLine || !CheckLastPolyLineAndFillMerge(aSource)) | 1142 if(!mbLastObjWasPolyWithoutLine || !CheckLastPolyLineAndFillMerge(aSource)) |
1069 { 1070 const Gradient& rGrad = pAct->GetGradient(); 1071 SdrPathObj* pPath = new SdrPathObj(OBJ_POLY, aSource); | 1143 { 1144 const Gradient& rGrad = pAct->GetGradient(); 1145 SdrPathObj* pPath = new SdrPathObj(OBJ_POLY, aSource); |
1072 SfxItemSet aGradAttr(pModel->GetItemPool(), 1073 XATTR_FILLSTYLE, XATTR_FILLSTYLE, 1074 XATTR_FILLGRADIENT, XATTR_FILLGRADIENT, 0, 0 ); | 1146 SfxItemSet aGradAttr(mpModel->GetItemPool(), XATTR_FILLSTYLE, XATTR_FILLSTYLE, XATTR_FILLGRADIENT, XATTR_FILLGRADIENT, 0, 0); |
1075 XGradient aXGradient; 1076 1077 aXGradient.SetGradientStyle((XGradientStyle)rGrad.GetStyle()); 1078 aXGradient.SetStartColor(rGrad.GetStartColor()); 1079 aXGradient.SetEndColor(rGrad.GetEndColor()); 1080 aXGradient.SetAngle((sal_uInt16)rGrad.GetAngle()); 1081 aXGradient.SetBorder(rGrad.GetBorder()); 1082 aXGradient.SetXOffset(rGrad.GetOfsX()); 1083 aXGradient.SetYOffset(rGrad.GetOfsY()); 1084 aXGradient.SetStartIntens(rGrad.GetStartIntensity()); 1085 aXGradient.SetEndIntens(rGrad.GetEndIntensity()); 1086 aXGradient.SetSteps(rGrad.GetSteps()); 1087 | 1147 XGradient aXGradient; 1148 1149 aXGradient.SetGradientStyle((XGradientStyle)rGrad.GetStyle()); 1150 aXGradient.SetStartColor(rGrad.GetStartColor()); 1151 aXGradient.SetEndColor(rGrad.GetEndColor()); 1152 aXGradient.SetAngle((sal_uInt16)rGrad.GetAngle()); 1153 aXGradient.SetBorder(rGrad.GetBorder()); 1154 aXGradient.SetXOffset(rGrad.GetOfsX()); 1155 aXGradient.SetYOffset(rGrad.GetOfsY()); 1156 aXGradient.SetStartIntens(rGrad.GetStartIntensity()); 1157 aXGradient.SetEndIntens(rGrad.GetEndIntensity()); 1158 aXGradient.SetSteps(rGrad.GetSteps()); 1159 |
1088 if(aVD.IsLineColor()) | 1160 if(maVD.IsLineColor()) |
1089 { 1090 // switch line off; when there was one there will be a 1091 // META_POLYLINE_ACTION following creating another object | 1161 { 1162 // switch line off; when there was one there will be a 1163 // META_POLYLINE_ACTION following creating another object |
1092 const Color aLineColor(aVD.GetLineColor()); 1093 aVD.SetLineColor(); | 1164 const Color aLineColor(maVD.GetLineColor()); 1165 maVD.SetLineColor(); |
1094 SetAttributes(pPath); | 1166 SetAttributes(pPath); |
1095 aVD.SetLineColor(aLineColor); | 1167 maVD.SetLineColor(aLineColor); |
1096 } 1097 else 1098 { 1099 SetAttributes(pPath); 1100 } 1101 1102 aGradAttr.Put(XFillStyleItem(XFILL_GRADIENT)); | 1168 } 1169 else 1170 { 1171 SetAttributes(pPath); 1172 } 1173 1174 aGradAttr.Put(XFillStyleItem(XFILL_GRADIENT)); |
1103 aGradAttr.Put(XFillGradientItem(&pModel->GetItemPool(), aXGradient)); | 1175 aGradAttr.Put(XFillGradientItem(&mpModel->GetItemPool(), aXGradient)); |
1104 pPath->SetMergedItemSet(aGradAttr); 1105 1106 InsertObj(pPath); 1107 } 1108 } 1109 1110 aSkipComment = "XGRAD_SEQ_END"; 1111 } --- 8 unchanged lines hidden (view full) --- 1120 || (((MetaCommentAction*)pSkipAct)->GetComment().CompareIgnoreCaseToAscii(aSkipComment.GetBuffer()) != COMPARE_EQUAL))) 1121 { 1122 pSkipAct = pMtf->NextAction(); 1123 } 1124 } 1125} 1126 1127//////////////////////////////////////////////////////////////////////////////////////////////////// | 1176 pPath->SetMergedItemSet(aGradAttr); 1177 1178 InsertObj(pPath); 1179 } 1180 } 1181 1182 aSkipComment = "XGRAD_SEQ_END"; 1183 } --- 8 unchanged lines hidden (view full) --- 1192 || (((MetaCommentAction*)pSkipAct)->GetComment().CompareIgnoreCaseToAscii(aSkipComment.GetBuffer()) != COMPARE_EQUAL))) 1193 { 1194 pSkipAct = pMtf->NextAction(); 1195 } 1196 } 1197} 1198 1199//////////////////////////////////////////////////////////////////////////////////////////////////// |
1200 1201void ImpSdrGDIMetaFileImport::DoAction(MetaTextRectAction& rAct) 1202{ 1203 GDIMetaFile aTemp; 1204 1205 maVD.AddTextRectActions(rAct.GetRect(), rAct.GetText(), rAct.GetStyle(), aTemp); 1206 DoLoopActions(aTemp, 0, 0); 1207} 1208 1209void ImpSdrGDIMetaFileImport::DoAction(MetaBmpScalePartAction& rAct) 1210{ 1211 Rectangle aRect(rAct.GetDestPoint(), rAct.GetDestSize()); 1212 Bitmap aBitmap(rAct.GetBitmap()); 1213 1214 aRect.Right()++; 1215 aRect.Bottom()++; 1216 aBitmap.Crop(Rectangle(rAct.GetSrcPoint(), rAct.GetSrcSize())); 1217 1218 SdrGrafObj* pGraf = new SdrGrafObj(aBitmap, aRect); 1219 1220 InsertObj(pGraf); 1221} 1222 1223void ImpSdrGDIMetaFileImport::DoAction(MetaBmpExScalePartAction& rAct) 1224{ 1225 Rectangle aRect(rAct.GetDestPoint(),rAct.GetDestSize()); 1226 BitmapEx aBitmapEx(rAct.GetBitmapEx()); 1227 1228 aRect.Right()++; 1229 aRect.Bottom()++; 1230 aBitmapEx.Crop(Rectangle(rAct.GetSrcPoint(), rAct.GetSrcSize())); 1231 1232 SdrGrafObj* pGraf = new SdrGrafObj(aBitmapEx, aRect); 1233 1234 InsertObj(pGraf); 1235} 1236 1237void ImpSdrGDIMetaFileImport::DoAction(MetaMaskAction& rAct) 1238{ 1239 Rectangle aRect(rAct.GetPoint(), rAct.GetBitmap().GetSizePixel()); 1240 BitmapEx aBitmapEx(rAct.GetBitmap(), rAct.GetColor()); 1241 1242 aRect.Right()++; 1243 aRect.Bottom()++; 1244 1245 SdrGrafObj* pGraf = new SdrGrafObj(aBitmapEx, aRect); 1246 1247 InsertObj(pGraf); 1248} 1249 1250void ImpSdrGDIMetaFileImport::DoAction(MetaMaskScaleAction& rAct) 1251{ 1252 Rectangle aRect(rAct.GetPoint(), rAct.GetSize()); 1253 BitmapEx aBitmapEx(rAct.GetBitmap(), rAct.GetColor()); 1254 1255 aRect.Right()++; 1256 aRect.Bottom()++; 1257 1258 SdrGrafObj* pGraf = new SdrGrafObj(aBitmapEx, aRect); 1259 1260 InsertObj(pGraf); 1261} 1262 1263void ImpSdrGDIMetaFileImport::DoAction(MetaMaskScalePartAction& rAct) 1264{ 1265 Rectangle aRect(rAct.GetDestPoint(), rAct.GetDestSize()); 1266 BitmapEx aBitmapEx(rAct.GetBitmap(), rAct.GetColor()); 1267 1268 aRect.Right()++; 1269 aRect.Bottom()++; 1270 aBitmapEx.Crop(Rectangle(rAct.GetSrcPoint(), rAct.GetSrcSize())); 1271 1272 SdrGrafObj* pGraf = new SdrGrafObj(aBitmapEx, aRect); 1273 1274 InsertObj(pGraf); 1275} 1276 1277void ImpSdrGDIMetaFileImport::DoAction(MetaGradientAction& rAct) 1278{ 1279 basegfx::B2DRange aRange(rAct.GetRect().Left(), rAct.GetRect().Top(), rAct.GetRect().Right(), rAct.GetRect().Bottom()); 1280 1281 if(!aRange.isEmpty()) 1282 { 1283 const basegfx::B2DHomMatrix aTransform(basegfx::tools::createScaleTranslateB2DHomMatrix(mfScaleX, mfScaleY, maOfs.X(), maOfs.Y())); 1284 aRange.transform(aTransform); 1285 const Gradient& rGradient = rAct.GetGradient(); 1286 SdrRectObj* pRect = new SdrRectObj( 1287 Rectangle( 1288 floor(aRange.getMinX()), 1289 floor(aRange.getMinY()), 1290 ceil(aRange.getMaxX()), 1291 ceil(aRange.getMaxY()))); 1292 SfxItemSet aGradientAttr(mpModel->GetItemPool(), XATTR_FILLSTYLE, XATTR_FILLSTYLE, XATTR_FILLGRADIENT, XATTR_FILLGRADIENT, 0, 0); 1293 XGradientStyle aXGradientStyle(XGRAD_LINEAR); 1294 1295 switch(rGradient.GetStyle()) 1296 { 1297 case GRADIENT_LINEAR: aXGradientStyle = XGRAD_LINEAR; break; 1298 case GRADIENT_AXIAL: aXGradientStyle = XGRAD_AXIAL; break; 1299 case GRADIENT_RADIAL: aXGradientStyle = XGRAD_RADIAL; break; 1300 case GRADIENT_ELLIPTICAL: aXGradientStyle = XGRAD_ELLIPTICAL; break; 1301 case GRADIENT_SQUARE: aXGradientStyle = XGRAD_SQUARE; break; 1302 case GRADIENT_RECT: aXGradientStyle = XGRAD_RECT; break; 1303 } 1304 1305 const XFillGradientItem aXFillGradientItem( 1306 &mpModel->GetItemPool(), 1307 XGradient( 1308 rGradient.GetStartColor(), 1309 rGradient.GetEndColor(), 1310 aXGradientStyle, 1311 rGradient.GetAngle(), 1312 rGradient.GetOfsX(), 1313 rGradient.GetOfsY(), 1314 rGradient.GetBorder(), 1315 rGradient.GetStartIntensity(), 1316 rGradient.GetEndIntensity(), 1317 rGradient.GetSteps())); 1318 1319 SetAttributes(pRect); 1320 aGradientAttr.Put(XFillStyleItem(XFILL_HATCH)); 1321 aGradientAttr.Put(aXFillGradientItem); 1322 pRect->SetMergedItemSet(aGradientAttr); 1323 1324 InsertObj(pRect, false); 1325 } 1326} 1327 1328void ImpSdrGDIMetaFileImport::DoAction(MetaWallpaperAction& rAct) 1329{ 1330 OSL_ENSURE(false, "Tried to construct SdrObject from MetaWallpaperAction: not supported (!)"); 1331} 1332 1333void ImpSdrGDIMetaFileImport::DoAction(MetaTransparentAction& rAct) 1334{ 1335 basegfx::B2DPolyPolygon aSource(rAct.GetPolyPolygon().getB2DPolyPolygon()); 1336 1337 if(aSource.count()) 1338 { 1339 const basegfx::B2DHomMatrix aTransform(basegfx::tools::createScaleTranslateB2DHomMatrix(mfScaleX, mfScaleY, maOfs.X(), maOfs.Y())); 1340 aSource.transform(aTransform); 1341 aSource.setClosed(true); 1342 1343 SdrPathObj* pPath = new SdrPathObj(OBJ_POLY, aSource); 1344 SetAttributes(pPath); 1345 pPath->SetMergedItem(XFillTransparenceItem(rAct.GetTransparence())); 1346 InsertObj(pPath, false); 1347 } 1348} 1349 1350void ImpSdrGDIMetaFileImport::DoAction(MetaEPSAction& rAct) 1351{ 1352 OSL_ENSURE(false, "Tried to construct SdrObject from MetaEPSAction: not supported (!)"); 1353} 1354 1355void ImpSdrGDIMetaFileImport::DoAction(MetaTextLineAction& rAct) 1356{ 1357 OSL_ENSURE(false, "Tried to construct SdrObject from MetaTextLineAction: not supported (!)"); 1358} 1359 1360void ImpSdrGDIMetaFileImport::DoAction(MetaGradientExAction& rAct) 1361{ 1362 basegfx::B2DPolyPolygon aSource(rAct.GetPolyPolygon().getB2DPolyPolygon()); 1363 1364 if(aSource.count()) 1365 { 1366 const basegfx::B2DHomMatrix aTransform(basegfx::tools::createScaleTranslateB2DHomMatrix(mfScaleX, mfScaleY, maOfs.X(), maOfs.Y())); 1367 aSource.transform(aTransform); 1368 1369 if(!mbLastObjWasPolyWithoutLine || !CheckLastPolyLineAndFillMerge(aSource)) 1370 { 1371 const Gradient& rGradient = rAct.GetGradient(); 1372 SdrPathObj* pPath = new SdrPathObj(OBJ_POLY, aSource); 1373 SfxItemSet aGradientAttr(mpModel->GetItemPool(), XATTR_FILLSTYLE, XATTR_FILLSTYLE, XATTR_FILLGRADIENT, XATTR_FILLGRADIENT, 0, 0); 1374 XGradientStyle aXGradientStyle(XGRAD_LINEAR); 1375 1376 switch(rGradient.GetStyle()) 1377 { 1378 case GRADIENT_LINEAR: aXGradientStyle = XGRAD_LINEAR; break; 1379 case GRADIENT_AXIAL: aXGradientStyle = XGRAD_AXIAL; break; 1380 case GRADIENT_RADIAL: aXGradientStyle = XGRAD_RADIAL; break; 1381 case GRADIENT_ELLIPTICAL: aXGradientStyle = XGRAD_ELLIPTICAL; break; 1382 case GRADIENT_SQUARE: aXGradientStyle = XGRAD_SQUARE; break; 1383 case GRADIENT_RECT: aXGradientStyle = XGRAD_RECT; break; 1384 } 1385 1386 const XFillGradientItem aXFillGradientItem( 1387 &mpModel->GetItemPool(), 1388 XGradient( 1389 rGradient.GetStartColor(), 1390 rGradient.GetEndColor(), 1391 aXGradientStyle, 1392 rGradient.GetAngle(), 1393 rGradient.GetOfsX(), 1394 rGradient.GetOfsY(), 1395 rGradient.GetBorder(), 1396 rGradient.GetStartIntensity(), 1397 rGradient.GetEndIntensity(), 1398 rGradient.GetSteps())); 1399 1400 SetAttributes(pPath); 1401 aGradientAttr.Put(XFillStyleItem(XFILL_HATCH)); 1402 aGradientAttr.Put(aXFillGradientItem); 1403 pPath->SetMergedItemSet(aGradientAttr); 1404 1405 InsertObj(pPath, false); 1406 } 1407 } 1408} 1409 1410void ImpSdrGDIMetaFileImport::DoAction(MetaFloatTransparentAction& rAct) 1411{ 1412 const GDIMetaFile& rMtf = rAct.GetGDIMetaFile(); 1413 1414 if(rMtf.GetActionCount()) 1415 { 1416 Rectangle aRect(rAct.GetPoint(),rAct.GetSize()); 1417 aRect.Right()++; aRect.Bottom()++; 1418 1419 // get metafile content as bitmap 1420 const basegfx::B2DRange aTargetRange( 1421 aRect.Left(), aRect.Top(), aRect.Right(), aRect.Bottom()); 1422 const drawinglayer::primitive2d::Primitive2DReference aMtf( 1423 new drawinglayer::primitive2d::MetafilePrimitive2D( 1424 basegfx::tools::createScaleTranslateB2DHomMatrix( 1425 aTargetRange.getRange(), 1426 aTargetRange.getMinimum()), 1427 rMtf)); 1428 BitmapEx aBitmapEx(convertPrimitive2DSequenceToBitmapEx( 1429 drawinglayer::primitive2d::Primitive2DSequence(&aMtf, 1), 1430 aTargetRange)); 1431 1432 // handle colors 1433 const Gradient& rGradient = rAct.GetGradient(); 1434 basegfx::BColor aStart(rGradient.GetStartColor().getBColor()); 1435 basegfx::BColor aEnd(rGradient.GetEndColor().getBColor()); 1436 1437 if(100 != rGradient.GetStartIntensity()) 1438 { 1439 aStart *= (double)rGradient.GetStartIntensity() / 100.0; 1440 } 1441 1442 if(100 != rGradient.GetEndIntensity()) 1443 { 1444 aEnd *= (double)rGradient.GetEndIntensity() / 100.0; 1445 } 1446 1447 const bool bEqualColors(aStart == aEnd); 1448 const bool bNoSteps(1 == rGradient.GetSteps()); 1449 bool bCreateObject(true); 1450 bool bHasNewMask(false); 1451 AlphaMask aNewMask; 1452 1453 if(bEqualColors || bNoSteps) 1454 { 1455 // single transparence 1456 const basegfx::BColor aMedium(basegfx::average(aStart, aEnd)); 1457 const double fTransparence(aMedium.luminance()); 1458 1459 if(basegfx::fTools::lessOrEqual(fTransparence, 0.0)) 1460 { 1461 // no transparence needed, all done 1462 } 1463 else if(basegfx::fTools::moreOrEqual(fTransparence, 1.0)) 1464 { 1465 // all transparent, no object 1466 bCreateObject = false; 1467 } 1468 else 1469 { 1470 // 0.0 < transparence < 1.0, apply 1471 sal_uInt8 aAlpha(basegfx::fround(fTransparence * 255.0)); 1472 1473 aNewMask = AlphaMask(aBitmapEx.GetBitmap().GetSizePixel(), &aAlpha); 1474 bHasNewMask = true; 1475 } 1476 } 1477 else 1478 { 1479 // gradient transparence 1480 VirtualDevice aVDev; 1481 1482 aVDev.SetOutputSizePixel(aBitmapEx.GetBitmap().GetSizePixel()); 1483 aVDev.DrawGradient(Rectangle(Point(0, 0), aVDev.GetOutputSizePixel()), rGradient); 1484 1485 aNewMask = AlphaMask(aVDev.GetBitmap(Point(0, 0), aVDev.GetOutputSizePixel())); 1486 bHasNewMask = true; 1487 } 1488 1489 if(bCreateObject) 1490 { 1491 if(bHasNewMask) 1492 { 1493 if(!aBitmapEx.IsAlpha() && !aBitmapEx.IsTransparent()) 1494 { 1495 // no transparence yet, apply new one 1496 aBitmapEx = BitmapEx(aBitmapEx.GetBitmap(), aNewMask); 1497 } 1498 else 1499 { 1500 // mix existing and new alpha mask 1501 AlphaMask aOldMask; 1502 1503 if(aBitmapEx.IsAlpha()) 1504 { 1505 aOldMask = aBitmapEx.GetAlpha(); 1506 } 1507 else if(TRANSPARENT_BITMAP == aBitmapEx.GetTransparentType()) 1508 { 1509 aOldMask = aBitmapEx.GetMask(); 1510 } 1511 else if(TRANSPARENT_COLOR == aBitmapEx.GetTransparentType()) 1512 { 1513 aOldMask = aBitmapEx.GetBitmap().CreateMask(aBitmapEx.GetTransparentColor()); 1514 } 1515 1516 BitmapReadAccess* pOld = aOldMask.AcquireReadAccess(); 1517 BitmapWriteAccess* pNew = aNewMask.AcquireWriteAccess(); 1518 1519 if(pOld && pNew) 1520 { 1521 if(pOld->Width() == pNew->Width() && pOld->Height() == pNew->Height()) 1522 { 1523 for(sal_uInt32 y(0); y < pNew->Height(); y++) 1524 { 1525 for(sal_uInt32 x(0); x < pNew->Width(); x++) 1526 { 1527 const BitmapColor aColOld(pOld->GetPixel(y, x)); 1528 const BitmapColor aColNew(pNew->GetPixel(y, x)); 1529 const sal_uInt16 aCombine(sal_uInt16(aColOld.GetIndex()) + sal_uInt16(aColNew.GetIndex())); 1530 1531 pNew->SetPixel(y, x, BitmapColor(aCombine > 255 ? 255 : sal_uInt8(aCombine))); 1532 } 1533 } 1534 } 1535 else 1536 { 1537 OSL_ENSURE(false, "Alpha masks have different sizes (!)"); 1538 } 1539 1540 aOldMask.ReleaseAccess(pOld); 1541 aNewMask.ReleaseAccess(pNew); 1542 } 1543 else 1544 { 1545 OSL_ENSURE(false, "Got no access to alpha bitmaps (!)"); 1546 } 1547 1548 // apply combined bitmap as mask 1549 aBitmapEx = BitmapEx(aBitmapEx.GetBitmap(), aNewMask); 1550 } 1551 } 1552 1553 // create and add object 1554 SdrGrafObj* pGraf = new SdrGrafObj(aBitmapEx, aRect); 1555 1556 InsertObj(pGraf); 1557 } 1558 } 1559} 1560 1561//////////////////////////////////////////////////////////////////////////////////////////////////// |
|
1128// eof | 1562// eof |