LibreOffice Module svx (master)  1
svdfmtf.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #include "svdfmtf.hxx"
21 #include <math.h>
22 #include <editeng/eeitem.hxx>
23 #include <editeng/fhgtitem.hxx>
24 #include <editeng/wghtitem.hxx>
25 #include <editeng/postitem.hxx>
26 #include <editeng/udlnitem.hxx>
28 #include <editeng/shdditem.hxx>
29 #include <svx/xlineit0.hxx>
30 #include <svx/xlnclit.hxx>
31 #include <svx/xlncapit.hxx>
32 #include <svx/xlnwtit.hxx>
33 #include <svx/xfillit0.hxx>
34 #include <svx/xflclit.hxx>
35 #include <svx/xgrad.hxx>
36 #include <svx/xflgrit.hxx>
37 #include <editeng/fontitem.hxx>
38 #include <editeng/wrlmitem.hxx>
39 #include <editeng/contouritem.hxx>
40 #include <editeng/colritem.hxx>
41 #include <vcl/canvastools.hxx>
42 #include <vcl/metric.hxx>
44 #include <svx/xflhtit.hxx>
45 #include <svx/sdmetitm.hxx>
46 #include <svx/sdtagitm.hxx>
47 #include <svx/sdtaitm.hxx>
48 #include <svx/sdtditm.hxx>
49 #include <svx/sdtfsitm.hxx>
50 #include <svx/svdmodel.hxx>
51 #include <svx/svdpage.hxx>
52 #include <svx/svdobj.hxx>
53 #include <svx/svdotext.hxx>
54 #include <svx/svdorect.hxx>
55 #include <svx/svdocirc.hxx>
56 #include <svx/svdograf.hxx>
57 #include <svx/svdopath.hxx>
58 #include <svx/svdetc.hxx>
59 #include <svl/itemset.hxx>
61 #include <tools/helpers.hxx>
64 #include <svx/xlinjoit.hxx>
65 #include <svx/xlndsit.hxx>
67 #include <svx/xbtmpit.hxx>
68 #include <svx/xfltrit.hxx>
69 #include <svx/xflbmtit.hxx>
70 #include <svx/xflbstit.hxx>
71 #include <svx/svdpntv.hxx>
73 #include <svx/svditer.hxx>
74 #include <svx/svdogrp.hxx>
75 #include <vcl/BitmapTools.hxx>
76 
77 using namespace com::sun::star;
78 
80  SdrModel& rModel,
81  SdrLayerID nLay,
82  const tools::Rectangle& rRect)
83 : maTmpList(),
84  mpVD(VclPtr<VirtualDevice>::Create()),
85  maScaleRect(rRect),
86  mnMapScalingOfs(0),
87  mpModel(&rModel),
88  mnLayer(nLay),
89  maOldLineColor(),
90  mnLineWidth(0),
91  maLineJoin(basegfx::B2DLineJoin::NONE),
92  maLineCap(css::drawing::LineCap_BUTT),
93  maDash(css::drawing::DashStyle_RECT, 0, 0, 0, 0, 0),
94  mbMov(false),
95  mbSize(false),
96  maOfs(0, 0),
97  mfScaleX(1.0),
98  mfScaleY(1.0),
99  maScaleX(1.0),
100  maScaleY(1.0),
101  mbFntDirty(true),
102  mbLastObjWasPolyWithoutLine(false),
103  mbNoLine(false),
104  mbNoFill(false),
105  mbLastObjWasLine(false),
106  maClip()
107 {
108  mpVD->EnableOutput(false);
109  mpVD->SetLineColor();
110  mpVD->SetFillColor();
111  maOldLineColor.SetRed( mpVD->GetLineColor().GetRed() + 1 );
112  mpLineAttr = std::make_unique<SfxItemSet>(rModel.GetItemPool(), svl::Items<XATTR_LINE_FIRST, XATTR_LINE_LAST>{});
113  mpFillAttr = std::make_unique<SfxItemSet>(rModel.GetItemPool(), svl::Items<XATTR_FILL_FIRST, XATTR_FILL_LAST>{});
114  mpTextAttr = std::make_unique<SfxItemSet>(rModel.GetItemPool(), svl::Items<EE_ITEMS_START, EE_ITEMS_END>{});
115  checkClip();
116 }
117 
118 void ImpSdrGDIMetaFileImport::DoLoopActions(GDIMetaFile const & rMtf, SvdProgressInfo* pProgrInfo, sal_uInt32* pActionsToReport)
119 {
120  const sal_uLong nCount(rMtf.GetActionSize());
121 
122  for(sal_uLong a(0); a < nCount; a++)
123  {
124  MetaAction* pAct = rMtf.GetAction(a);
125 
126  if(!pAct)
127  {
128  OSL_ENSURE(false, "OOps, no action at valid position (!)");
129  pAct = rMtf.GetAction(0);
130  }
131 
132  switch (pAct->GetType())
133  {
134  case MetaActionType::PIXEL : break;
135  case MetaActionType::POINT : break;
136  case MetaActionType::LINE : DoAction(static_cast<MetaLineAction &>(*pAct)); break;
137  case MetaActionType::RECT : DoAction(static_cast<MetaRectAction &>(*pAct)); break;
138  case MetaActionType::ROUNDRECT : DoAction(static_cast<MetaRoundRectAction &>(*pAct)); break;
139  case MetaActionType::ELLIPSE : DoAction(static_cast<MetaEllipseAction &>(*pAct)); break;
140  case MetaActionType::ARC : DoAction(static_cast<MetaArcAction &>(*pAct)); break;
141  case MetaActionType::PIE : DoAction(static_cast<MetaPieAction &>(*pAct)); break;
142  case MetaActionType::CHORD : DoAction(static_cast<MetaChordAction &>(*pAct)); break;
143  case MetaActionType::POLYLINE : DoAction(static_cast<MetaPolyLineAction &>(*pAct)); break;
144  case MetaActionType::POLYGON : DoAction(static_cast<MetaPolygonAction &>(*pAct)); break;
145  case MetaActionType::POLYPOLYGON : DoAction(static_cast<MetaPolyPolygonAction &>(*pAct)); break;
146  case MetaActionType::TEXT : DoAction(static_cast<MetaTextAction &>(*pAct)); break;
147  case MetaActionType::TEXTARRAY : DoAction(static_cast<MetaTextArrayAction &>(*pAct)); break;
148  case MetaActionType::STRETCHTEXT : DoAction(static_cast<MetaStretchTextAction &>(*pAct)); break;
149  case MetaActionType::BMP : DoAction(static_cast<MetaBmpAction &>(*pAct)); break;
150  case MetaActionType::BMPSCALE : DoAction(static_cast<MetaBmpScaleAction &>(*pAct)); break;
151  case MetaActionType::BMPEX : DoAction(static_cast<MetaBmpExAction &>(*pAct)); break;
152  case MetaActionType::BMPEXSCALE : DoAction(static_cast<MetaBmpExScaleAction &>(*pAct)); break;
153  case MetaActionType::LINECOLOR : DoAction(static_cast<MetaLineColorAction &>(*pAct)); break;
154  case MetaActionType::FILLCOLOR : DoAction(static_cast<MetaFillColorAction &>(*pAct)); break;
155  case MetaActionType::TEXTCOLOR : DoAction(static_cast<MetaTextColorAction &>(*pAct)); break;
156  case MetaActionType::TEXTFILLCOLOR : DoAction(static_cast<MetaTextFillColorAction &>(*pAct)); break;
157  case MetaActionType::FONT : DoAction(static_cast<MetaFontAction &>(*pAct)); break;
158  case MetaActionType::TEXTALIGN : DoAction(static_cast<MetaTextAlignAction &>(*pAct)); break;
159  case MetaActionType::MAPMODE : DoAction(static_cast<MetaMapModeAction &>(*pAct)); break;
160  case MetaActionType::CLIPREGION : DoAction(static_cast<MetaClipRegionAction &>(*pAct)); break;
161  case MetaActionType::MOVECLIPREGION : DoAction(static_cast<MetaMoveClipRegionAction &>(*pAct)); break;
162  case MetaActionType::ISECTRECTCLIPREGION: DoAction(static_cast<MetaISectRectClipRegionAction&>(*pAct)); break;
163  case MetaActionType::ISECTREGIONCLIPREGION: DoAction(static_cast<MetaISectRegionClipRegionAction&>(*pAct)); break;
164  case MetaActionType::RASTEROP : DoAction(static_cast<MetaRasterOpAction &>(*pAct)); break;
165  case MetaActionType::PUSH : DoAction(static_cast<MetaPushAction &>(*pAct)); break;
166  case MetaActionType::POP : DoAction(static_cast<MetaPopAction &>(*pAct)); break;
167  case MetaActionType::HATCH : DoAction(static_cast<MetaHatchAction &>(*pAct)); break;
168 
169  // #i125211# MetaCommentAction may change index, thus hand it over
170  case MetaActionType::COMMENT : DoAction(static_cast<MetaCommentAction&>(*pAct), rMtf, a);
171  break;
172 
173  // missing actions added
174  case MetaActionType::TEXTRECT : DoAction(static_cast<MetaTextRectAction&>(*pAct)); break;
175  case MetaActionType::BMPSCALEPART : DoAction(static_cast<MetaBmpScalePartAction&>(*pAct)); break;
176  case MetaActionType::BMPEXSCALEPART : DoAction(static_cast<MetaBmpExScalePartAction&>(*pAct)); break;
177  case MetaActionType::MASK : DoAction(static_cast<MetaMaskAction&>(*pAct)); break;
178  case MetaActionType::MASKSCALE : DoAction(static_cast<MetaMaskScaleAction&>(*pAct)); break;
179  case MetaActionType::MASKSCALEPART : DoAction(static_cast<MetaMaskScalePartAction&>(*pAct)); break;
180  case MetaActionType::GRADIENT : DoAction(static_cast<MetaGradientAction&>(*pAct)); break;
181  case MetaActionType::WALLPAPER : OSL_ENSURE(false, "Tried to construct SdrObject from MetaWallpaperAction: not supported (!)"); break;
182  case MetaActionType::Transparent : DoAction(static_cast<MetaTransparentAction&>(*pAct)); break;
183  case MetaActionType::EPS : OSL_ENSURE(false, "Tried to construct SdrObject from MetaEPSAction: not supported (!)"); break;
184  case MetaActionType::REFPOINT : DoAction(static_cast<MetaRefPointAction&>(*pAct)); break;
185  case MetaActionType::TEXTLINECOLOR : DoAction(static_cast<MetaTextLineColorAction&>(*pAct)); break;
186  case MetaActionType::TEXTLINE : OSL_ENSURE(false, "Tried to construct SdrObject from MetaTextLineAction: not supported (!)"); break;
187  case MetaActionType::FLOATTRANSPARENT : DoAction(static_cast<MetaFloatTransparentAction&>(*pAct)); break;
188  case MetaActionType::GRADIENTEX : DoAction(static_cast<MetaGradientExAction&>(*pAct)); break;
189  case MetaActionType::LAYOUTMODE : DoAction(static_cast<MetaLayoutModeAction&>(*pAct)); break;
190  case MetaActionType::TEXTLANGUAGE : DoAction(static_cast<MetaTextLanguageAction&>(*pAct)); break;
191  case MetaActionType::OVERLINECOLOR : DoAction(static_cast<MetaOverlineColorAction&>(*pAct)); break;
192  default: break;
193  }
194 
195  if(pProgrInfo && pActionsToReport)
196  {
197  (*pActionsToReport)++;
198 
199  if(*pActionsToReport >= 16) // update all 16 actions
200  {
201  if(!pProgrInfo->ReportActions(*pActionsToReport))
202  break;
203 
204  *pActionsToReport = 0;
205  }
206  }
207  }
208 }
209 
211  const GDIMetaFile& rMtf,
212  SdrObjList& rOL,
213  size_t nInsPos,
214  SvdProgressInfo* pProgrInfo)
215 {
216  // setup some global scale parameter
217  // mfScaleX, mfScaleY, maScaleX, maScaleY, mbMov, mbSize
218  mfScaleX = mfScaleY = 1.0;
219  const Size aMtfSize(rMtf.GetPrefSize());
220 
221  if(aMtfSize.Width() & aMtfSize.Height() && (!maScaleRect.IsEmpty()))
222  {
224 
225  if(aMtfSize.Width() != (maScaleRect.GetWidth() - 1))
226  {
227  mfScaleX = static_cast<double>( maScaleRect.GetWidth() - 1 ) / static_cast<double>(aMtfSize.Width());
228  }
229 
230  if(aMtfSize.Height() != (maScaleRect.GetHeight() - 1))
231  {
232  mfScaleY = static_cast<double>( maScaleRect.GetHeight() - 1 ) / static_cast<double>(aMtfSize.Height());
233  }
234  }
235 
236  mbMov = maOfs.X()!=0 || maOfs.Y()!=0;
237  mbSize = false;
238  maScaleX = Fraction( 1, 1 );
239  maScaleY = Fraction( 1, 1 );
240 
241  if(aMtfSize.Width() != (maScaleRect.GetWidth() - 1))
242  {
243  maScaleX = Fraction(maScaleRect.GetWidth() - 1, aMtfSize.Width());
244  mbSize = true;
245  }
246 
247  if(aMtfSize.Height() != (maScaleRect.GetHeight() - 1))
248  {
249  maScaleY = Fraction(maScaleRect.GetHeight() - 1, aMtfSize.Height());
250  mbSize = true;
251  }
252 
253  if(pProgrInfo)
254  {
255  pProgrInfo->SetActionCount(rMtf.GetActionSize());
256  }
257 
258  sal_uInt32 nActionsToReport(0);
259 
260  // execute
261  DoLoopActions(rMtf, pProgrInfo, &nActionsToReport);
262 
263  if(pProgrInfo)
264  {
265  pProgrInfo->ReportActions(nActionsToReport);
266  nActionsToReport = 0;
267  }
268 
269  // MapMode scaling
270  MapScaling();
271 
272  // To calculate the progress meter, we use GetActionSize()*3.
273  // However, maTmpList has a lower entry count limit than GetActionSize(),
274  // so the actions that were assumed were too much have to be re-added.
275  nActionsToReport = (rMtf.GetActionSize() - maTmpList.size()) * 2;
276 
277  // announce all currently unannounced rescales
278  if(pProgrInfo)
279  {
280  pProgrInfo->ReportRescales(nActionsToReport);
281  pProgrInfo->SetInsertCount(maTmpList.size());
282  }
283 
284  nActionsToReport = 0;
285 
286  // insert all objects cached in aTmpList now into rOL from nInsPos
287  nInsPos = std::min(nInsPos, rOL.GetObjCount());
288 
289  for(SdrObject* pObj : maTmpList)
290  {
291  rOL.NbcInsertObject(pObj, nInsPos);
292  nInsPos++;
293 
294  if(pProgrInfo)
295  {
296  nActionsToReport++;
297 
298  if(nActionsToReport >= 32) // update all 32 actions
299  {
300  pProgrInfo->ReportInserts(nActionsToReport);
301  nActionsToReport = 0;
302  }
303  }
304  }
305 
306  // report all remaining inserts for the last time
307  if(pProgrInfo)
308  {
309  pProgrInfo->ReportInserts(nActionsToReport);
310  }
311 
312  return maTmpList.size();
313 }
314 
315 void ImpSdrGDIMetaFileImport::SetAttributes(SdrObject* pObj, bool bForceTextAttr)
316 {
317  mbNoLine = false;
318  mbNoFill = false;
319  bool bLine(!bForceTextAttr);
320  bool bFill(!pObj || (pObj->IsClosedObj() && !bForceTextAttr));
321  bool bText(bForceTextAttr || (pObj && pObj->GetOutlinerParaObject()));
322 
323  if(bLine)
324  {
325  if(mnLineWidth)
326  {
328  }
329  else
330  {
331  mpLineAttr->Put(XLineWidthItem(0));
332  }
333 
334  maOldLineColor = mpVD->GetLineColor();
335 
336  if(mpVD->IsLineColor())
337  {
338  mpLineAttr->Put(XLineStyleItem(drawing::LineStyle_SOLID));
339  mpLineAttr->Put(XLineColorItem(OUString(), mpVD->GetLineColor()));
340  }
341  else
342  {
343  mpLineAttr->Put(XLineStyleItem(drawing::LineStyle_NONE));
344  }
345 
346  switch(maLineJoin)
347  {
349  mpLineAttr->Put(XLineJointItem(css::drawing::LineJoint_NONE));
350  break;
352  mpLineAttr->Put(XLineJointItem(css::drawing::LineJoint_BEVEL));
353  break;
355  mpLineAttr->Put(XLineJointItem(css::drawing::LineJoint_MITER));
356  break;
358  mpLineAttr->Put(XLineJointItem(css::drawing::LineJoint_ROUND));
359  break;
360  }
361 
362  // Add LineCap support
364 
366  {
367  mpLineAttr->Put(XLineDashItem(OUString(), maDash));
368  }
369  else
370  {
371  mpLineAttr->Put(XLineDashItem(OUString(), XDash(css::drawing::DashStyle_RECT)));
372  }
373  }
374  else
375  {
376  mbNoLine = true;
377  }
378 
379  if(bFill)
380  {
381  if(mpVD->IsFillColor())
382  {
383  mpFillAttr->Put(XFillStyleItem(drawing::FillStyle_SOLID));
384  mpFillAttr->Put(XFillColorItem(OUString(), mpVD->GetFillColor()));
385  }
386  else
387  {
388  mpFillAttr->Put(XFillStyleItem(drawing::FillStyle_NONE));
389  }
390  }
391  else
392  {
393  mbNoFill = true;
394  }
395 
396  if(bText && mbFntDirty)
397  {
398  vcl::Font aFnt(mpVD->GetFont());
399  const sal_uInt32 nHeight(FRound(aFnt.GetFontSize().Height() * mfScaleY));
400 
401  mpTextAttr->Put( SvxFontItem( aFnt.GetFamilyType(), aFnt.GetFamilyName(), aFnt.GetStyleName(), aFnt.GetPitch(), aFnt.GetCharSet(), EE_CHAR_FONTINFO ) );
402  mpTextAttr->Put( SvxFontItem( aFnt.GetFamilyType(), aFnt.GetFamilyName(), aFnt.GetStyleName(), aFnt.GetPitch(), aFnt.GetCharSet(), EE_CHAR_FONTINFO_CJK ) );
403  mpTextAttr->Put( SvxFontItem( aFnt.GetFamilyType(), aFnt.GetFamilyName(), aFnt.GetStyleName(), aFnt.GetPitch(), aFnt.GetCharSet(), EE_CHAR_FONTINFO_CTL ) );
404  mpTextAttr->Put(SvxPostureItem(aFnt.GetItalic(), EE_CHAR_ITALIC));
405  mpTextAttr->Put(SvxWeightItem(aFnt.GetWeight(), EE_CHAR_WEIGHT));
406  mpTextAttr->Put( SvxFontHeightItem( nHeight, 100, EE_CHAR_FONTHEIGHT ) );
407  mpTextAttr->Put( SvxFontHeightItem( nHeight, 100, EE_CHAR_FONTHEIGHT_CJK ) );
408  mpTextAttr->Put( SvxFontHeightItem( nHeight, 100, EE_CHAR_FONTHEIGHT_CTL ) );
410  mpTextAttr->Put(SvxUnderlineItem(aFnt.GetUnderline(), EE_CHAR_UNDERLINE));
411  mpTextAttr->Put(SvxOverlineItem(aFnt.GetOverline(), EE_CHAR_OVERLINE));
412  mpTextAttr->Put(SvxCrossedOutItem(aFnt.GetStrikeout(), EE_CHAR_STRIKEOUT));
413  mpTextAttr->Put(SvxShadowedItem(aFnt.IsShadow(), EE_CHAR_SHADOW));
414 
415  // #i118485# Setting this item leads to problems (written #i118498# for this)
416  // mpTextAttr->Put(SvxAutoKernItem(aFnt.IsKerning(), EE_CHAR_KERNING));
417 
418  mpTextAttr->Put(SvxWordLineModeItem(aFnt.IsWordLineMode(), EE_CHAR_WLM));
419  mpTextAttr->Put(SvxContourItem(aFnt.IsOutline(), EE_CHAR_OUTLINE));
420  mpTextAttr->Put(SvxColorItem(mpVD->GetTextColor(), EE_CHAR_COLOR));
421  //... svxfont textitem svditext
422  mbFntDirty = false;
423  }
424 
425  if(pObj)
426  {
427  pObj->SetLayer(mnLayer);
428 
429  if(bLine)
430  {
432  }
433 
434  if(bFill)
435  {
437  }
438 
439  if(bText)
440  {
443  }
444  }
445 }
446 
448 {
449  if(bScale && !maScaleRect.IsEmpty())
450  {
451  if(mbSize)
452  {
453  pObj->NbcResize(Point(), maScaleX, maScaleY);
454  }
455 
456  if(mbMov)
457  {
458  pObj->NbcMove(Size(maOfs.X(), maOfs.Y()));
459  }
460  }
461 
462  if(isClip())
463  {
464  const basegfx::B2DPolyPolygon aPoly(pObj->TakeXorPoly());
465  const basegfx::B2DRange aOldRange(aPoly.getB2DRange());
466  const SdrLayerID aOldLayer(pObj->GetLayer());
467  const SfxItemSet aOldItemSet(pObj->GetMergedItemSet());
468  const SdrGrafObj* pSdrGrafObj = dynamic_cast< SdrGrafObj* >(pObj);
469  const SdrTextObj* pSdrTextObj = dynamic_cast< SdrTextObj* >(pObj);
470 
471  if(pSdrTextObj && pSdrTextObj->HasText())
472  {
473  // all text objects are created from ImportText and have no line or fill attributes, so
474  // it is okay to concentrate on the text itself
475  while(true)
476  {
477  const basegfx::B2DPolyPolygon aTextContour(pSdrTextObj->TakeContour());
478  const basegfx::B2DRange aTextRange(aTextContour.getB2DRange());
479  const basegfx::B2DRange aClipRange(maClip.getB2DRange());
480 
481  // no overlap -> completely outside
482  if(!aClipRange.overlaps(aTextRange))
483  {
484  SdrObject::Free(pObj);
485  break;
486  }
487 
488  // when the clip is a rectangle fast check for inside is possible
489  if(basegfx::utils::isRectangle(maClip) && aClipRange.isInside(aTextRange))
490  {
491  // completely inside ClipRect
492  break;
493  }
494 
495  // here text needs to be clipped; to do so, convert to SdrObjects with polygons
496  // and add these recursively. Delete original object, do not add in this run
497  SdrObject* pConverted = pSdrTextObj->ConvertToPolyObj(true, true).release();
498  SdrObject::Free(pObj);
499 
500  if(pConverted)
501  {
502  // recursively add created conversion; per definition this shall not
503  // contain further SdrTextObjs. Visit only non-group objects
504  SdrObjListIter aIter(*pConverted, SdrIterMode::DeepNoGroups);
505 
506  // work with clones; the created conversion may contain group objects
507  // and when working with the original objects the loop itself could
508  // break and the cleanup later would be pretty complicated (only delete group
509  // objects, are these empty, ...?)
510  while(aIter.IsMore())
511  {
512  SdrObject* pCandidate = aIter.Next();
513  OSL_ENSURE(pCandidate && dynamic_cast< SdrObjGroup* >(pCandidate) == nullptr, "SdrObjListIter with SdrIterMode::DeepNoGroups error (!)");
514  SdrObject* pNewClone(pCandidate->CloneSdrObject(pCandidate->getSdrModelFromSdrObject()));
515 
516  if(pNewClone)
517  {
518  InsertObj(pNewClone, false);
519  }
520  else
521  {
522  OSL_ENSURE(false, "SdrObject::Clone() failed (!)");
523  }
524  }
525 
526  // cleanup temporary conversion objects
527  SdrObject::Free(pConverted);
528  }
529 
530  break;
531  }
532  }
533  else
534  {
535  BitmapEx aBitmapEx;
536 
537  if(pSdrGrafObj)
538  {
539  aBitmapEx = pSdrGrafObj->GetGraphic().GetBitmapEx();
540  }
541 
542  SdrObject::Free(pObj);
543 
544  if(!aOldRange.isEmpty())
545  {
546  // clip against ClipRegion
547  const basegfx::B2DPolyPolygon aNewPoly(
549  aPoly,
550  maClip,
551  true,
552  !aPoly.isClosed()));
553  const basegfx::B2DRange aNewRange(aNewPoly.getB2DRange());
554 
555  if(!aNewRange.isEmpty())
556  {
557  pObj = new SdrPathObj(
558  *mpModel,
559  aNewPoly.isClosed() ? OBJ_POLY : OBJ_PLIN,
560  aNewPoly);
561 
562  pObj->SetLayer(aOldLayer);
563  pObj->SetMergedItemSet(aOldItemSet);
564 
565  if(!!aBitmapEx)
566  {
567  // aNewRange is inside of aOldRange and defines which part of aBitmapEx is used
568  const double fScaleX(aBitmapEx.GetSizePixel().Width() / (aOldRange.getWidth() ? aOldRange.getWidth() : 1.0));
569  const double fScaleY(aBitmapEx.GetSizePixel().Height() / (aOldRange.getHeight() ? aOldRange.getHeight() : 1.0));
570  basegfx::B2DRange aPixel(aNewRange);
571  basegfx::B2DHomMatrix aTrans;
572 
573  aTrans.translate(-aOldRange.getMinX(), -aOldRange.getMinY());
574  aTrans.scale(fScaleX, fScaleY);
575  aPixel.transform(aTrans);
576 
577  const Size aOrigSizePixel(aBitmapEx.GetSizePixel());
578  const Point aClipTopLeft(
579  basegfx::fround(floor(std::max(0.0, aPixel.getMinX()))),
580  basegfx::fround(floor(std::max(0.0, aPixel.getMinY()))));
581  const Size aClipSize(
582  basegfx::fround(ceil(std::min(static_cast<double>(aOrigSizePixel.Width()), aPixel.getWidth()))),
583  basegfx::fround(ceil(std::min(static_cast<double>(aOrigSizePixel.Height()), aPixel.getHeight()))));
584  const BitmapEx aClippedBitmap(
585  aBitmapEx,
586  aClipTopLeft,
587  aClipSize);
588 
589  pObj->SetMergedItem(XFillStyleItem(drawing::FillStyle_BITMAP));
590  pObj->SetMergedItem(XFillBitmapItem(OUString(), Graphic(aClippedBitmap)));
591  pObj->SetMergedItem(XFillBmpTileItem(false));
592  pObj->SetMergedItem(XFillBmpStretchItem(true));
593  }
594  }
595  }
596  }
597  }
598 
599  if(pObj)
600  {
601  // #i111954# check object for visibility
602  // used are SdrPathObj, SdrRectObj, SdrCircObj, SdrGrafObj
603  bool bVisible(false);
604 
605  if(pObj->HasLineStyle())
606  {
607  bVisible = true;
608  }
609 
610  if(!bVisible && pObj->HasFillStyle())
611  {
612  bVisible = true;
613  }
614 
615  if(!bVisible)
616  {
617  SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >(pObj);
618 
619  if(pTextObj && pTextObj->HasText())
620  {
621  bVisible = true;
622  }
623  }
624 
625  if(!bVisible)
626  {
627  SdrGrafObj* pGrafObj = dynamic_cast< SdrGrafObj* >(pObj);
628 
629  if(pGrafObj)
630  {
631  // this may be refined to check if the graphic really is visible. It
632  // is here to ensure that graphic objects without fill, line and text
633  // get created
634  bVisible = true;
635  }
636  }
637 
638  if(!bVisible)
639  {
640  SdrObject::Free(pObj);
641  }
642  else
643  {
644  maTmpList.push_back(pObj);
645 
646  if(dynamic_cast< SdrPathObj* >(pObj))
647  {
648  const bool bClosed(pObj->IsClosedObj());
649 
651  mbLastObjWasLine = !bClosed;
652  }
653  else
654  {
656  mbLastObjWasLine = false;
657  }
658  }
659  }
660 }
661 
663 {
664  // #i73407# reformulation to use new B2DPolygon classes
665  const basegfx::B2DPoint aStart(rAct.GetStartPoint().X(), rAct.GetStartPoint().Y());
666  const basegfx::B2DPoint aEnd(rAct.GetEndPoint().X(), rAct.GetEndPoint().Y());
667 
668  if(!aStart.equal(aEnd))
669  {
670  basegfx::B2DPolygon aLine;
672 
673  aLine.append(aStart);
674  aLine.append(aEnd);
675  aLine.transform(aTransform);
676 
677  const LineInfo& rLineInfo = rAct.GetLineInfo();
678  const sal_Int32 nNewLineWidth(rLineInfo.GetWidth());
679  bool bCreateLineObject(true);
680 
681  if(mbLastObjWasLine && (nNewLineWidth == mnLineWidth) && CheckLastLineMerge(aLine))
682  {
683  bCreateLineObject = false;
684  }
685 
686  if(bCreateLineObject)
687  {
688  SdrPathObj* pPath = new SdrPathObj(
689  *mpModel,
690  OBJ_LINE,
691  basegfx::B2DPolyPolygon(aLine));
692  mnLineWidth = nNewLineWidth;
693  maLineJoin = rLineInfo.GetLineJoin();
694  maLineCap = rLineInfo.GetLineCap();
695  maDash = XDash(css::drawing::DashStyle_RECT,
696  rLineInfo.GetDotCount(), rLineInfo.GetDotLen(),
697  rLineInfo.GetDashCount(), rLineInfo.GetDashLen(),
698  rLineInfo.GetDistance());
699  SetAttributes(pPath);
700  mnLineWidth = 0;
702  maDash = XDash();
703  InsertObj(pPath, false);
704  }
705  }
706 }
707 
709 {
710  SdrRectObj* pRect = new SdrRectObj(
711  *mpModel,
712  rAct.GetRect());
713  SetAttributes(pRect);
714  InsertObj(pRect);
715 }
716 
717 void ImpSdrGDIMetaFileImport::DoAction(MetaRoundRectAction const & rAct)
718 {
719  SdrRectObj* pRect = new SdrRectObj(
720  *mpModel,
721  rAct.GetRect());
722  SetAttributes(pRect);
723  long nRad=(rAct.GetHorzRound()+rAct.GetVertRound())/2;
724  if (nRad!=0) {
726  aSet.Put(SdrMetricItem(SDRATTR_ECKENRADIUS, nRad));
727  pRect->SetMergedItemSet(aSet);
728  }
729  InsertObj(pRect);
730 }
731 
732 void ImpSdrGDIMetaFileImport::DoAction(MetaEllipseAction const & rAct)
733 {
734  SdrCircObj* pCirc=new SdrCircObj(
735  *mpModel,
737  rAct.GetRect());
738  SetAttributes(pCirc);
739  InsertObj(pCirc);
740 }
741 
742 void ImpSdrGDIMetaFileImport::DoAction(MetaArcAction const & rAct)
743 {
744  Point aCenter(rAct.GetRect().Center());
745  long nStart=GetAngle(rAct.GetStartPoint()-aCenter);
746  long nEnd=GetAngle(rAct.GetEndPoint()-aCenter);
747  SdrCircObj* pCirc = new SdrCircObj(
748  *mpModel,
750  rAct.GetRect(),nStart,nEnd);
751  SetAttributes(pCirc);
752  InsertObj(pCirc);
753 }
754 
755 void ImpSdrGDIMetaFileImport::DoAction(MetaPieAction const & rAct)
756 {
757  Point aCenter(rAct.GetRect().Center());
758  long nStart=GetAngle(rAct.GetStartPoint()-aCenter);
759  long nEnd=GetAngle(rAct.GetEndPoint()-aCenter);
760  SdrCircObj* pCirc = new SdrCircObj(
761  *mpModel,
763  rAct.GetRect(),
764  nStart,
765  nEnd);
766  SetAttributes(pCirc);
767  InsertObj(pCirc);
768 }
769 
770 void ImpSdrGDIMetaFileImport::DoAction(MetaChordAction const & rAct)
771 {
772  Point aCenter(rAct.GetRect().Center());
773  long nStart=GetAngle(rAct.GetStartPoint()-aCenter);
774  long nEnd=GetAngle(rAct.GetEndPoint()-aCenter);
775  SdrCircObj* pCirc = new SdrCircObj(
776  *mpModel,
778  rAct.GetRect(),
779  nStart,
780  nEnd);
781  SetAttributes(pCirc);
782  InsertObj(pCirc);
783 }
784 
786 {
787  // #i102706# Do not merge closed polygons
788  if(rSrcPoly.isClosed())
789  {
790  return false;
791  }
792 
793  // #i73407# reformulation to use new B2DPolygon classes
794  if(mbLastObjWasLine && (maOldLineColor == mpVD->GetLineColor()) && rSrcPoly.count())
795  {
796  SdrObject* pTmpObj = !maTmpList.empty() ? maTmpList[maTmpList.size() - 1] : nullptr;
797  SdrPathObj* pLastPoly = dynamic_cast< SdrPathObj* >(pTmpObj);
798 
799  if(pLastPoly)
800  {
801  if(1 == pLastPoly->GetPathPoly().count())
802  {
803  bool bOk(false);
804  basegfx::B2DPolygon aDstPoly(pLastPoly->GetPathPoly().getB2DPolygon(0));
805 
806  // #i102706# Do not merge closed polygons
807  if(aDstPoly.isClosed())
808  {
809  return false;
810  }
811 
812  if(aDstPoly.count())
813  {
814  const sal_uInt32 nMaxDstPnt(aDstPoly.count() - 1);
815  const sal_uInt32 nMaxSrcPnt(rSrcPoly.count() - 1);
816 
817  if(aDstPoly.getB2DPoint(nMaxDstPnt) == rSrcPoly.getB2DPoint(0))
818  {
819  aDstPoly.append(rSrcPoly, 1, rSrcPoly.count() - 1);
820  bOk = true;
821  }
822  else if(aDstPoly.getB2DPoint(0) == rSrcPoly.getB2DPoint(nMaxSrcPnt))
823  {
824  basegfx::B2DPolygon aNew(rSrcPoly);
825  aNew.append(aDstPoly, 1, aDstPoly.count() - 1);
826  aDstPoly = aNew;
827  bOk = true;
828  }
829  else if(aDstPoly.getB2DPoint(0) == rSrcPoly.getB2DPoint(0))
830  {
831  aDstPoly.flip();
832  aDstPoly.append(rSrcPoly, 1, rSrcPoly.count() - 1);
833  bOk = true;
834  }
835  else if(aDstPoly.getB2DPoint(nMaxDstPnt) == rSrcPoly.getB2DPoint(nMaxSrcPnt))
836  {
837  basegfx::B2DPolygon aNew(rSrcPoly);
838  aNew.flip();
839  aDstPoly.append(aNew, 1, aNew.count() - 1);
840  bOk = true;
841  }
842  }
843 
844  if(bOk)
845  {
846  pLastPoly->NbcSetPathPoly(basegfx::B2DPolyPolygon(aDstPoly));
847  }
848 
849  return bOk;
850  }
851  }
852  }
853 
854  return false;
855 }
856 
858 {
859  // #i73407# reformulation to use new B2DPolygon classes
861  {
862  SdrObject* pTmpObj = !maTmpList.empty() ? maTmpList[maTmpList.size() - 1] : nullptr;
863  SdrPathObj* pLastPoly = dynamic_cast< SdrPathObj* >(pTmpObj);
864 
865  if(pLastPoly)
866  {
867  if(pLastPoly->GetPathPoly() == rPolyPolygon)
868  {
869  SetAttributes(nullptr);
870 
871  if(!mbNoLine && mbNoFill)
872  {
873  pLastPoly->SetMergedItemSet(*mpLineAttr);
874 
875  return true;
876  }
877  }
878  }
879  }
880 
881  return false;
882 }
883 
885 {
886  if(mpVD->IsClipRegion())
887  {
888  maClip = mpVD->GetClipRegion().GetAsB2DPolyPolygon();
889 
890  if(isClip())
891  {
892  const basegfx::B2DHomMatrix aTransform(
894  mfScaleX,
895  mfScaleY,
896  maOfs.X(),
897  maOfs.Y()));
898 
899  maClip.transform(aTransform);
900  }
901  }
902 }
903 
905 {
906  return !maClip.getB2DRange().isEmpty();
907 }
908 
909 void ImpSdrGDIMetaFileImport::DoAction( MetaPolyLineAction const & rAct )
910 {
911  // #i73407# reformulation to use new B2DPolygon classes
912  basegfx::B2DPolygon aSource(rAct.GetPolygon().getB2DPolygon());
913 
914  if(aSource.count())
915  {
917  aSource.transform(aTransform);
918  }
919 
920  const LineInfo& rLineInfo = rAct.GetLineInfo();
921  const sal_Int32 nNewLineWidth(rLineInfo.GetWidth());
922  bool bCreateLineObject(true);
923 
924  if(mbLastObjWasLine && (nNewLineWidth == mnLineWidth) && CheckLastLineMerge(aSource))
925  {
926  bCreateLineObject = false;
927  }
929  {
930  bCreateLineObject = false;
931  }
932 
933  if(bCreateLineObject)
934  {
935  SdrPathObj* pPath = new SdrPathObj(
936  *mpModel,
937  aSource.isClosed() ? OBJ_POLY : OBJ_PLIN,
938  basegfx::B2DPolyPolygon(aSource));
939  mnLineWidth = nNewLineWidth;
940  maLineJoin = rLineInfo.GetLineJoin();
941  maLineCap = rLineInfo.GetLineCap();
942  maDash = XDash(css::drawing::DashStyle_RECT,
943  rLineInfo.GetDotCount(), rLineInfo.GetDotLen(),
944  rLineInfo.GetDashCount(), rLineInfo.GetDashLen(),
945  rLineInfo.GetDistance());
946  SetAttributes(pPath);
947  mnLineWidth = 0;
949  maDash = XDash();
950  InsertObj(pPath, false);
951  }
952 }
953 
954 void ImpSdrGDIMetaFileImport::DoAction( MetaPolygonAction const & rAct )
955 {
956  // #i73407# reformulation to use new B2DPolygon classes
957  basegfx::B2DPolygon aSource(rAct.GetPolygon().getB2DPolygon());
958 
959  if(aSource.count())
960  {
962  aSource.transform(aTransform);
963 
965  {
966  // #i73407# make sure polygon is closed, it's a filled primitive
967  aSource.setClosed(true);
968  SdrPathObj* pPath = new SdrPathObj(
969  *mpModel,
970  OBJ_POLY,
971  basegfx::B2DPolyPolygon(aSource));
972  SetAttributes(pPath);
973  InsertObj(pPath, false);
974  }
975  }
976 }
977 
978 void ImpSdrGDIMetaFileImport::DoAction(MetaPolyPolygonAction const & rAct)
979 {
980  // #i73407# reformulation to use new B2DPolygon classes
981  basegfx::B2DPolyPolygon aSource(rAct.GetPolyPolygon().getB2DPolyPolygon());
982 
983  if(aSource.count())
984  {
986  aSource.transform(aTransform);
987 
989  {
990  // #i73407# make sure polygon is closed, it's a filled primitive
991  aSource.setClosed(true);
992  SdrPathObj* pPath = new SdrPathObj(
993  *mpModel,
994  OBJ_POLY,
995  aSource);
996  SetAttributes(pPath);
997  InsertObj(pPath, false);
998  }
999  }
1000 }
1001 
1002 void ImpSdrGDIMetaFileImport::ImportText( const Point& rPos, const OUString& rStr, const MetaAction& rAct )
1003 {
1004  // calc text box size, add 5% to make it fit safely
1005 
1006  FontMetric aFontMetric( mpVD->GetFontMetric() );
1007  vcl::Font aFnt( mpVD->GetFont() );
1008  FontAlign eAlg( aFnt.GetAlignment() );
1009 
1010  sal_Int32 nTextWidth = static_cast<sal_Int32>( mpVD->GetTextWidth( rStr ) * mfScaleX );
1011  sal_Int32 nTextHeight = static_cast<sal_Int32>( mpVD->GetTextHeight() * mfScaleY );
1012 
1013  Point aPos( FRound(rPos.X() * mfScaleX + maOfs.X()), FRound(rPos.Y() * mfScaleY + maOfs.Y()) );
1014  Size aSize( nTextWidth, nTextHeight );
1015 
1016  if ( eAlg == ALIGN_BASELINE )
1017  aPos.AdjustY( -(FRound(aFontMetric.GetAscent() * mfScaleY)) );
1018  else if ( eAlg == ALIGN_BOTTOM )
1019  aPos.AdjustY( -nTextHeight );
1020 
1021  tools::Rectangle aTextRect( aPos, aSize );
1022  SdrRectObj* pText = new SdrRectObj(
1023  *mpModel,
1024  OBJ_TEXT,
1025  aTextRect);
1026 
1030  pText->SetMergedItem ( makeSdrTextLeftDistItem (0));
1031 
1032  if ( aFnt.GetAverageFontWidth() || ( rAct.GetType() == MetaActionType::STRETCHTEXT ) )
1033  {
1035  pText->SetMergedItem( makeSdrTextAutoGrowHeightItem( false ) );
1036  // don't let the margins eat the space needed for the text
1037  pText->SetMergedItem( SdrTextFitToSizeTypeItem(drawing::TextFitToSizeType_ALLLINES) );
1038  }
1039  else
1040  {
1041  pText->SetMergedItem( makeSdrTextAutoGrowWidthItem( true ) );
1042  }
1043 
1044  pText->SetLayer(mnLayer);
1045  pText->NbcSetText( rStr );
1046  SetAttributes( pText, true );
1047  pText->SetSnapRect( aTextRect );
1048 
1049  if (!aFnt.IsTransparent())
1050  {
1052  aAttr.Put(XFillStyleItem(drawing::FillStyle_SOLID));
1053  aAttr.Put(XFillColorItem(OUString(), aFnt.GetFillColor()));
1054  pText->SetMergedItemSet(aAttr);
1055  }
1056  sal_uInt32 nAngle = aFnt.GetOrientation();
1057  if ( nAngle )
1058  {
1059  nAngle*=10;
1060  double a = nAngle * F_PI18000;
1061  double nSin=sin(a);
1062  double nCos=cos(a);
1063  pText->NbcRotate(aPos,nAngle,nSin,nCos);
1064  }
1065  InsertObj( pText, false );
1066 }
1067 
1069 {
1070  OUString aStr(rAct.GetText());
1071  aStr = aStr.copy(rAct.GetIndex(), rAct.GetLen());
1072  ImportText( rAct.GetPoint(), aStr, rAct );
1073 }
1074 
1075 void ImpSdrGDIMetaFileImport::DoAction(MetaTextArrayAction const & rAct)
1076 {
1077  OUString aStr(rAct.GetText());
1078  aStr = aStr.copy(rAct.GetIndex(), rAct.GetLen());
1079  ImportText( rAct.GetPoint(), aStr, rAct );
1080 }
1081 
1083 {
1084  OUString aStr(rAct.GetText());
1085  aStr = aStr.copy(rAct.GetIndex(), rAct.GetLen());
1086  ImportText( rAct.GetPoint(), aStr, rAct );
1087 }
1088 
1090 {
1091  tools::Rectangle aRect(rAct.GetPoint(),rAct.GetBitmap().GetSizePixel());
1092  aRect.AdjustRight( 1 ); aRect.AdjustBottom( 1 );
1093  SdrGrafObj* pGraf = new SdrGrafObj(
1094  *mpModel,
1095  Graphic(rAct.GetBitmap()),
1096  aRect);
1097 
1098  // This action is not creating line and fill, set directly, do not use SetAttributes(..)
1099  pGraf->SetMergedItem(XLineStyleItem(drawing::LineStyle_NONE));
1100  pGraf->SetMergedItem(XFillStyleItem(drawing::FillStyle_NONE));
1101  InsertObj(pGraf);
1102 }
1103 
1105 {
1106  tools::Rectangle aRect(rAct.GetPoint(),rAct.GetSize());
1107  aRect.AdjustRight( 1 ); aRect.AdjustBottom( 1 );
1108  SdrGrafObj* pGraf = new SdrGrafObj(
1109  *mpModel,
1110  Graphic(rAct.GetBitmap()),
1111  aRect);
1112 
1113  // This action is not creating line and fill, set directly, do not use SetAttributes(..)
1114  pGraf->SetMergedItem(XLineStyleItem(drawing::LineStyle_NONE));
1115  pGraf->SetMergedItem(XFillStyleItem(drawing::FillStyle_NONE));
1116  InsertObj(pGraf);
1117 }
1118 
1120 {
1121  tools::Rectangle aRect(rAct.GetPoint(),rAct.GetBitmapEx().GetSizePixel());
1122  aRect.AdjustRight( 1 ); aRect.AdjustBottom( 1 );
1123  SdrGrafObj* pGraf = new SdrGrafObj(
1124  *mpModel,
1125  rAct.GetBitmapEx(),
1126  aRect);
1127 
1128  // This action is not creating line and fill, set directly, do not use SetAttributes(..)
1129  pGraf->SetMergedItem(XLineStyleItem(drawing::LineStyle_NONE));
1130  pGraf->SetMergedItem(XFillStyleItem(drawing::FillStyle_NONE));
1131  InsertObj(pGraf);
1132 }
1133 
1135 {
1136  tools::Rectangle aRect(rAct.GetPoint(),rAct.GetSize());
1137  aRect.AdjustRight( 1 ); aRect.AdjustBottom( 1 );
1138  SdrGrafObj* pGraf = new SdrGrafObj(
1139  *mpModel,
1140  rAct.GetBitmapEx(),
1141  aRect);
1142 
1143  // This action is not creating line and fill, set directly, do not use SetAttributes(..)
1144  pGraf->SetMergedItem(XLineStyleItem(drawing::LineStyle_NONE));
1145  pGraf->SetMergedItem(XFillStyleItem(drawing::FillStyle_NONE));
1146  InsertObj(pGraf);
1147 }
1148 
1149 
1151 {
1152  // #i73407# reformulation to use new B2DPolygon classes
1154 
1155  if(aSource.count())
1156  {
1158  aSource.transform(aTransform);
1159 
1161  {
1162  const Hatch& rHatch = rAct.GetHatch();
1163  SdrPathObj* pPath = new SdrPathObj(
1164  *mpModel,
1165  OBJ_POLY,
1166  aSource);
1167  // #i125211# Use the ranges from the SdrObject to create a new empty SfxItemSet
1168  SfxItemSet aHatchAttr(mpModel->GetItemPool(), pPath->GetMergedItemSet().GetRanges());
1169  css::drawing::HatchStyle eStyle;
1170 
1171  switch(rHatch.GetStyle())
1172  {
1173  case HatchStyle::Triple :
1174  {
1175  eStyle = css::drawing::HatchStyle_TRIPLE;
1176  break;
1177  }
1178 
1179  case HatchStyle::Double :
1180  {
1181  eStyle = css::drawing::HatchStyle_DOUBLE;
1182  break;
1183  }
1184 
1185  default:
1186  {
1187  eStyle = css::drawing::HatchStyle_SINGLE;
1188  break;
1189  }
1190  }
1191 
1192  SetAttributes(pPath);
1193  aHatchAttr.Put(XFillStyleItem(drawing::FillStyle_HATCH));
1194  aHatchAttr.Put(XFillHatchItem(XHatch(rHatch.GetColor(), eStyle, rHatch.GetDistance(), rHatch.GetAngle())));
1195  pPath->SetMergedItemSet(aHatchAttr);
1196 
1197  InsertObj(pPath, false);
1198  }
1199  }
1200 }
1201 
1202 
1204 {
1205  rAct.Execute(mpVD);
1206 }
1207 
1208 void ImpSdrGDIMetaFileImport::DoAction(MetaMapModeAction& rAct)
1209 {
1210  MapScaling();
1211  rAct.Execute(mpVD);
1213  mbLastObjWasLine = false;
1214 }
1215 
1217 {
1218  const size_t nCount(maTmpList.size());
1219  const MapMode& rMap = mpVD->GetMapMode();
1220  Point aMapOrg( rMap.GetOrigin() );
1221  bool bMov2(aMapOrg.X() != 0 || aMapOrg.Y() != 0);
1222 
1223  if(bMov2)
1224  {
1225  for(size_t i = mnMapScalingOfs; i < nCount; i++)
1226  {
1227  SdrObject* pObj = maTmpList[i];
1228 
1229  pObj->NbcMove(Size(aMapOrg.X(), aMapOrg.Y()));
1230  }
1231  }
1232 
1234 }
1235 
1236 
1237 void ImpSdrGDIMetaFileImport::DoAction( MetaCommentAction const & rAct, GDIMetaFile const & rMtf, sal_uLong& a) // GDIMetaFile* pMtf )
1238 {
1239  bool aSkipComment = false;
1240 
1241  if (a < rMtf.GetActionSize() && rAct.GetComment().equalsIgnoreAsciiCase("XGRAD_SEQ_BEGIN"))
1242  {
1243  // #i125211# Check if next action is a MetaGradientExAction
1244  MetaGradientExAction* pAct = dynamic_cast< MetaGradientExAction* >(rMtf.GetAction(a + 1));
1245 
1246  if( pAct && pAct->GetType() == MetaActionType::GRADIENTEX )
1247  {
1248  // #i73407# reformulation to use new B2DPolygon classes
1249  basegfx::B2DPolyPolygon aSource(pAct->GetPolyPolygon().getB2DPolyPolygon());
1250 
1251  if(aSource.count())
1252  {
1254  {
1255  const Gradient& rGrad = pAct->GetGradient();
1256  SdrPathObj* pPath = new SdrPathObj(
1257  *mpModel,
1258  OBJ_POLY,
1259  aSource);
1260  // #i125211# Use the ranges from the SdrObject to create a new empty SfxItemSet
1261  SfxItemSet aGradAttr(mpModel->GetItemPool(), pPath->GetMergedItemSet().GetRanges());
1262  XGradient aXGradient;
1263 
1264  aXGradient.SetGradientStyle(static_cast<css::awt::GradientStyle>(rGrad.GetStyle()));
1265  aXGradient.SetStartColor(rGrad.GetStartColor());
1266  aXGradient.SetEndColor(rGrad.GetEndColor());
1267  aXGradient.SetAngle(rGrad.GetAngle());
1268  aXGradient.SetBorder(rGrad.GetBorder());
1269  aXGradient.SetXOffset(rGrad.GetOfsX());
1270  aXGradient.SetYOffset(rGrad.GetOfsY());
1271  aXGradient.SetStartIntens(rGrad.GetStartIntensity());
1272  aXGradient.SetEndIntens(rGrad.GetEndIntensity());
1273  aXGradient.SetSteps(rGrad.GetSteps());
1274 
1275  // no need to use SetAttributes(..) here since line and fill style
1276  // need to be set individually
1277  // SetAttributes(pPath);
1278 
1279  // switch line off; if there was one there will be a
1280  // MetaActionType::POLYLINE following creating another object
1281  aGradAttr.Put(XLineStyleItem(drawing::LineStyle_NONE));
1282 
1283  // add detected gradient fillstyle
1284  aGradAttr.Put(XFillStyleItem(drawing::FillStyle_GRADIENT));
1285  aGradAttr.Put(XFillGradientItem(aXGradient));
1286 
1287  pPath->SetMergedItemSet(aGradAttr);
1288 
1289  InsertObj(pPath);
1290  }
1291  }
1292 
1293  aSkipComment = true;
1294  }
1295  }
1296 
1297  if(aSkipComment)
1298  {
1299  // #i125211# forward until closing MetaCommentAction
1300  MetaAction* pSkipAct = rMtf.GetAction(++a);
1301 
1302  while( pSkipAct
1303  && ((pSkipAct->GetType() != MetaActionType::COMMENT )
1304  || !(static_cast<MetaCommentAction*>(pSkipAct)->GetComment().equalsIgnoreAsciiCase("XGRAD_SEQ_END"))))
1305  {
1306  pSkipAct = rMtf.GetAction(++a);
1307  }
1308  }
1309 }
1310 
1312 {
1313  GDIMetaFile aTemp;
1314 
1315  mpVD->AddTextRectActions(rAct.GetRect(), rAct.GetText(), rAct.GetStyle(), aTemp);
1316  DoLoopActions(aTemp, nullptr, nullptr);
1317 }
1318 
1319 void ImpSdrGDIMetaFileImport::DoAction(MetaBmpScalePartAction const & rAct)
1320 {
1321  tools::Rectangle aRect(rAct.GetDestPoint(), rAct.GetDestSize());
1322  Bitmap aBitmap(rAct.GetBitmap());
1323 
1324  aRect.AdjustRight( 1 );
1325  aRect.AdjustBottom( 1 );
1326  aBitmap.Crop(tools::Rectangle(rAct.GetSrcPoint(), rAct.GetSrcSize()));
1327  SdrGrafObj* pGraf = new SdrGrafObj(
1328  *mpModel,
1329  aBitmap,
1330  aRect);
1331 
1332  // This action is not creating line and fill, set directly, do not use SetAttributes(..)
1333  pGraf->SetMergedItem(XLineStyleItem(drawing::LineStyle_NONE));
1334  pGraf->SetMergedItem(XFillStyleItem(drawing::FillStyle_NONE));
1335  InsertObj(pGraf);
1336 }
1337 
1338 void ImpSdrGDIMetaFileImport::DoAction(MetaBmpExScalePartAction const & rAct)
1339 {
1340  tools::Rectangle aRect(rAct.GetDestPoint(),rAct.GetDestSize());
1341  BitmapEx aBitmapEx(rAct.GetBitmapEx());
1342 
1343  aRect.AdjustRight( 1 );
1344  aRect.AdjustBottom( 1 );
1345  aBitmapEx.Crop(tools::Rectangle(rAct.GetSrcPoint(), rAct.GetSrcSize()));
1346  SdrGrafObj* pGraf = new SdrGrafObj(
1347  *mpModel,
1348  aBitmapEx,
1349  aRect);
1350 
1351  // This action is not creating line and fill, set directly, do not use SetAttributes(..)
1352  pGraf->SetMergedItem(XLineStyleItem(drawing::LineStyle_NONE));
1353  pGraf->SetMergedItem(XFillStyleItem(drawing::FillStyle_NONE));
1354  InsertObj(pGraf);
1355 }
1356 
1358 {
1359  tools::Rectangle aRect(rAct.GetPoint(), rAct.GetBitmap().GetSizePixel());
1360  BitmapEx aBitmapEx(rAct.GetBitmap(), rAct.GetColor());
1361 
1362  aRect.AdjustRight( 1 ); aRect.AdjustBottom( 1 );
1363  SdrGrafObj* pGraf = new SdrGrafObj(
1364  *mpModel,
1365  aBitmapEx,
1366  aRect);
1367 
1368  // This action is not creating line and fill, set directly, do not use SetAttributes(..)
1369  pGraf->SetMergedItem(XLineStyleItem(drawing::LineStyle_NONE));
1370  pGraf->SetMergedItem(XFillStyleItem(drawing::FillStyle_NONE));
1371  InsertObj(pGraf);
1372 }
1373 
1375 {
1376  tools::Rectangle aRect(rAct.GetPoint(), rAct.GetSize());
1377  BitmapEx aBitmapEx(rAct.GetBitmap(), rAct.GetColor());
1378 
1379  aRect.AdjustRight( 1 ); aRect.AdjustBottom( 1 );
1380  SdrGrafObj* pGraf = new SdrGrafObj(
1381  *mpModel,
1382  aBitmapEx,
1383  aRect);
1384 
1385  // This action is not creating line and fill, set directly, do not use SetAttributes(..)
1386  pGraf->SetMergedItem(XLineStyleItem(drawing::LineStyle_NONE));
1387  pGraf->SetMergedItem(XFillStyleItem(drawing::FillStyle_NONE));
1388  InsertObj(pGraf);
1389 }
1390 
1392 {
1393  tools::Rectangle aRect(rAct.GetDestPoint(), rAct.GetDestSize());
1394  BitmapEx aBitmapEx(rAct.GetBitmap(), rAct.GetColor());
1395 
1396  aRect.AdjustRight( 1 ); aRect.AdjustBottom( 1 );
1397  aBitmapEx.Crop(tools::Rectangle(rAct.GetSrcPoint(), rAct.GetSrcSize()));
1398  SdrGrafObj* pGraf = new SdrGrafObj(
1399  *mpModel,
1400  aBitmapEx,
1401  aRect);
1402 
1403  // This action is not creating line and fill, set directly, do not use SetAttributes(..)
1404  pGraf->SetMergedItem(XLineStyleItem(drawing::LineStyle_NONE));
1405  pGraf->SetMergedItem(XFillStyleItem(drawing::FillStyle_NONE));
1406  InsertObj(pGraf);
1407 }
1408 
1409 namespace
1410 {
1411  css::awt::GradientStyle getXGradientStyleFromGradientStyle(const GradientStyle& rGradientStyle)
1412  {
1413  css::awt::GradientStyle aXGradientStyle(css::awt::GradientStyle_LINEAR);
1414 
1415  switch(rGradientStyle)
1416  {
1417  case GradientStyle::Linear: aXGradientStyle = css::awt::GradientStyle_LINEAR; break;
1418  case GradientStyle::Axial: aXGradientStyle = css::awt::GradientStyle_AXIAL; break;
1419  case GradientStyle::Radial: aXGradientStyle = css::awt::GradientStyle_RADIAL; break;
1420  case GradientStyle::Elliptical: aXGradientStyle = css::awt::GradientStyle_ELLIPTICAL; break;
1421  case GradientStyle::Square: aXGradientStyle = css::awt::GradientStyle_SQUARE; break;
1422  case GradientStyle::Rect: aXGradientStyle = css::awt::GradientStyle_RECT; break;
1423 
1424  // Needed due to GradientStyle::FORCE_EQUAL_SIZE; this again is needed
1425  // to force the enum defines in VCL to a defined size for the compilers,
1426  // so despite it is never used it cannot be removed (would break the
1427  // API implementation probably).
1428  case GradientStyle::FORCE_EQUAL_SIZE: break;
1429  default:
1430  break;
1431  }
1432 
1433  return aXGradientStyle;
1434  }
1435 }
1436 
1438 {
1440 
1441  if(aRange.isEmpty())
1442  return;
1443 
1445  aRange.transform(aTransform);
1446  const Gradient& rGradient = rAct.GetGradient();
1447  SdrRectObj* pRect = new SdrRectObj(
1448  *mpModel,
1450  floor(aRange.getMinX()),
1451  floor(aRange.getMinY()),
1452  ceil(aRange.getMaxX()),
1453  ceil(aRange.getMaxY())));
1454  // #i125211# Use the ranges from the SdrObject to create a new empty SfxItemSet
1455  SfxItemSet aGradientAttr(mpModel->GetItemPool(), pRect->GetMergedItemSet().GetRanges());
1456  const css::awt::GradientStyle aXGradientStyle(getXGradientStyleFromGradientStyle(rGradient.GetStyle()));
1457  const XFillGradientItem aXFillGradientItem(
1458  XGradient(
1459  rGradient.GetStartColor(),
1460  rGradient.GetEndColor(),
1461  aXGradientStyle,
1462  rGradient.GetAngle(),
1463  rGradient.GetOfsX(),
1464  rGradient.GetOfsY(),
1465  rGradient.GetBorder(),
1466  rGradient.GetStartIntensity(),
1467  rGradient.GetEndIntensity(),
1468  rGradient.GetSteps()));
1469 
1470  SetAttributes(pRect);
1471  aGradientAttr.Put(XFillStyleItem(drawing::FillStyle_GRADIENT)); // #i125211#
1472  aGradientAttr.Put(aXFillGradientItem);
1473  pRect->SetMergedItemSet(aGradientAttr);
1474 
1475  InsertObj(pRect, false);
1476 }
1477 
1479 {
1481 
1482  if(aSource.count())
1483  {
1485  aSource.transform(aTransform);
1486  aSource.setClosed(true);
1487 
1488  SdrPathObj* pPath = new SdrPathObj(
1489  *mpModel,
1490  OBJ_POLY,
1491  aSource);
1492  SetAttributes(pPath);
1494  InsertObj(pPath, false);
1495  }
1496 }
1497 
1498 void ImpSdrGDIMetaFileImport::DoAction(MetaGradientExAction const & rAct)
1499 {
1500  basegfx::B2DPolyPolygon aSource(rAct.GetPolyPolygon().getB2DPolyPolygon());
1501 
1502  if(aSource.count())
1503  {
1505  aSource.transform(aTransform);
1506 
1508  {
1509  const Gradient& rGradient = rAct.GetGradient();
1510  SdrPathObj* pPath = new SdrPathObj(
1511  *mpModel,
1512  OBJ_POLY,
1513  aSource);
1514  // #i125211# Use the ranges from the SdrObject to create a new empty SfxItemSet
1515  SfxItemSet aGradientAttr(mpModel->GetItemPool(), pPath->GetMergedItemSet().GetRanges());
1516  const css::awt::GradientStyle aXGradientStyle(getXGradientStyleFromGradientStyle(rGradient.GetStyle()));
1517  const XFillGradientItem aXFillGradientItem(
1518  XGradient(
1519  rGradient.GetStartColor(),
1520  rGradient.GetEndColor(),
1521  aXGradientStyle,
1522  rGradient.GetAngle(),
1523  rGradient.GetOfsX(),
1524  rGradient.GetOfsY(),
1525  rGradient.GetBorder(),
1526  rGradient.GetStartIntensity(),
1527  rGradient.GetEndIntensity(),
1528  rGradient.GetSteps()));
1529 
1530  SetAttributes(pPath);
1531  aGradientAttr.Put(XFillStyleItem(drawing::FillStyle_GRADIENT)); // #i125211#
1532  aGradientAttr.Put(aXFillGradientItem);
1533  pPath->SetMergedItemSet(aGradientAttr);
1534 
1535  InsertObj(pPath, false);
1536  }
1537  }
1538 }
1539 
1541 {
1542  const GDIMetaFile& rMtf = rAct.GetGDIMetaFile();
1543 
1544  if(!rMtf.GetActionSize())
1545  return;
1546 
1547  const tools::Rectangle aRect(rAct.GetPoint(),rAct.GetSize());
1548 
1549  // convert metafile sub-content to BitmapEx
1550  BitmapEx aBitmapEx(
1552  rMtf,
1554  125000));
1555 
1556  // handle colors
1557  const Gradient& rGradient = rAct.GetGradient();
1558  basegfx::BColor aStart(rGradient.GetStartColor().getBColor());
1559  basegfx::BColor aEnd(rGradient.GetEndColor().getBColor());
1560 
1561  if(100 != rGradient.GetStartIntensity())
1562  {
1563  aStart *= static_cast<double>(rGradient.GetStartIntensity()) / 100.0;
1564  }
1565 
1566  if(100 != rGradient.GetEndIntensity())
1567  {
1568  aEnd *= static_cast<double>(rGradient.GetEndIntensity()) / 100.0;
1569  }
1570 
1571  const bool bEqualColors(aStart == aEnd);
1572  const bool bNoSteps(1 == rGradient.GetSteps());
1573  bool bCreateObject(true);
1574  bool bHasNewMask(false);
1575  AlphaMask aNewMask;
1576  double fTransparence(0.0);
1577  bool bFixedTransparence(false);
1578 
1579  if(bEqualColors || bNoSteps)
1580  {
1581  // single transparence
1582  const basegfx::BColor aMedium(basegfx::average(aStart, aEnd));
1583  fTransparence = aMedium.luminance();
1584 
1585  if(basegfx::fTools::lessOrEqual(fTransparence, 0.0))
1586  {
1587  // no transparence needed, all done
1588  }
1589  else if(basegfx::fTools::moreOrEqual(fTransparence, 1.0))
1590  {
1591  // all transparent, no object
1592  bCreateObject = false;
1593  }
1594  else
1595  {
1596  // 0.0 < transparence < 1.0, apply fixed transparence
1597  bFixedTransparence = true;
1598  }
1599  }
1600  else
1601  {
1602  // gradient transparence
1604 
1605  pVDev->SetOutputSizePixel(aBitmapEx.GetBitmap().GetSizePixel());
1606  pVDev->DrawGradient(tools::Rectangle(Point(0, 0), pVDev->GetOutputSizePixel()), rGradient);
1607 
1608  aNewMask = AlphaMask(pVDev->GetBitmap(Point(0, 0), pVDev->GetOutputSizePixel()));
1609  bHasNewMask = true;
1610  }
1611 
1612  if(bCreateObject)
1613  {
1614  if(bHasNewMask || bFixedTransparence)
1615  {
1616  if(!aBitmapEx.IsAlpha() && !aBitmapEx.IsTransparent())
1617  {
1618  // no transparence yet, apply new one
1619  if(bFixedTransparence)
1620  {
1621  sal_uInt8 aAlpha(basegfx::fround(fTransparence * 255.0));
1622 
1623  aNewMask = AlphaMask(aBitmapEx.GetBitmap().GetSizePixel(), &aAlpha);
1624  }
1625 
1626  aBitmapEx = BitmapEx(aBitmapEx.GetBitmap(), aNewMask);
1627  }
1628  else
1629  {
1630  vcl::bitmap::DrawAlphaBitmapAndAlphaGradient(aBitmapEx, bFixedTransparence, fTransparence, aNewMask);
1631  }
1632  }
1633 
1634  // create and add object
1635  SdrGrafObj* pGraf = new SdrGrafObj(
1636  *mpModel,
1637  aBitmapEx,
1638  aRect);
1639 
1640  // for MetaFloatTransparentAction, do not use SetAttributes(...)
1641  // since these metafile content is not used to draw line/fill
1642  // dependent of these setting at the device content
1643  pGraf->SetMergedItem(XLineStyleItem(drawing::LineStyle_NONE));
1644  pGraf->SetMergedItem(XFillStyleItem(drawing::FillStyle_NONE));
1645  InsertObj(pGraf);
1646  }
1647 }
1648 
1649 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Point TopLeft() const
long Width() const
static bool lessOrEqual(const double &rfValA, const double &rfValB)
const Gradient & GetGradient() const
void ReportRescales(size_t nRescaleCount)
Definition: svdetc.cxx:473
static bool moreOrEqual(const double &rfValA, const double &rfValB)
virtual basegfx::B2DPolyPolygon TakeXorPoly() const
The Xor-Polygon is required by the View to drag the object.
Definition: svdobj.cxx:1066
const LineInfo & GetLineInfo() const
css::drawing::LineCap GetLineCap() const
double luminance() const
#define FontAlign
DrawTextFlags GetStyle() const
long GetWidth() const
#define EE_CHAR_FONTINFO
const Size & GetDestSize() const
void append(const basegfx::B2DPoint &rPoint, sal_uInt32 nCount)
const Bitmap & GetBitmap() const
bool bVisible
sal_Int32 GetLen() const
GradientStyle GetStyle() const
long GetHeight() const
const Point & GetPoint() const
bool IsClosedObj() const
Definition: svdobj.hxx:787
long FRound(double fVal)
const GDIMetaFile & GetGDIMetaFile() const
void DrawAlphaBitmapAndAlphaGradient(BitmapEx &rBitmapEx, bool bFixedTransparence, float fTransparence, AlphaMask &rNewMask)
virtual void NbcResize(const Point &rRef, const Fraction &xFact, const Fraction &yFact)
Definition: svdobj.cxx:1379
long Height() const
sal_uInt16 GetOfsY() const
void ImportText(const Point &rPos, const OUString &rStr, const MetaAction &rAct)
Definition: svdfmtf.cxx:1002
void Create(SwFormatVertOrient &rItem, SvStream &rStrm, sal_uInt16 nVersionAbusedAsSize)
periodic cubic Spline (ni)
Definition: svdobj.hxx:133
sal_uIntPtr sal_uLong
std::unique_ptr< SfxItemSet > mpTextAttr
Definition: svdfmtf.hxx:54
virtual void NbcInsertObject(SdrObject *pObj, size_t nPos=SAL_MAX_SIZE)
Definition: svdpage.cxx:300
bool HasFillStyle() const
Definition: svdobj.cxx:2948
sal_uInt32 GetDistance() const
Definition: xdash.hxx:59
void DoLoopActions(GDIMetaFile const &rMtf, SvdProgressInfo *pProgrInfo, sal_uInt32 *pActionsToReport)
Definition: svdfmtf.cxx:118
sal_uInt16 GetBorder() const
size_t GetObjCount() const
Definition: svdpage.cxx:760
const Point & GetPoint() const
const Size & GetSize() const
const tools::PolyPolygon & GetPolyPolygon() const
#define EE_CHAR_FONTHEIGHT_CJK
const Point & GetEndPoint() const
void SetAttributes(SdrObject *pObj, bool bForceTextAttr=false)
Definition: svdfmtf.cxx:315
long GetDistance() const
basegfx::B2DLineJoin maLineJoin
Definition: svdfmtf.hxx:59
const OUString & GetText() const
B2DTuple average(const B2DTuple &rOld1, const B2DTuple &rOld2)
void DoAction(MetaLineAction const &rAct)
Definition: svdfmtf.cxx:662
Size GetSizePixel() const
circle cut
Definition: svdobj.hxx:125
static void Free(SdrObject *&_rpObject)
Definition: svdobj.cxx:395
double getMaxX() const
const Point & GetPoint() const
polygon, PolyPolygon
Definition: svdobj.hxx:126
virtual bool HasText() const override
Definition: svdotxat.cxx:412
SdrOnOffItem makeSdrTextAutoGrowHeightItem(bool bAuto)
Definition: sdtagitm.hxx:25
NONE
B2DPolyPolygon clipPolyPolygonOnPolyPolygon(const B2DPolyPolygon &rCandidate, const B2DPolyPolygon &rClip, bool bInside, bool bStroke)
#define EE_CHAR_FONTWIDTH
B2DRange getB2DRange() const
Rectangle objects (rectangle, circle, ...)
Definition: svdorect.hxx:39
bool IsEmpty() const
SdrModel * mpModel
Definition: svdpntv.hxx:132
bool Crop(const tools::Rectangle &rRectPixel)
B2DPolygon const & getB2DPolygon(sal_uInt32 nIndex) const
void ClearMergedItem(const sal_uInt16 nWhich=0)
Definition: svdobj.cxx:1898
Definition: xdash.hxx:31
sal_uInt16 GetDotCount() const
const Point & GetPoint() const
bool IsMore() const
Definition: svditer.hxx:62
const OUString & GetText() const
const Color & GetColor() const
BASEGFX_DLLPUBLIC void transform(const B2DHomMatrix &rMatrix)
const Bitmap & GetBitmap() const
int nCount
tools::Rectangle maScaleRect
Definition: svdfmtf.hxx:50
const Gradient & GetGradient() const
void SetMergedItemSet(const SfxItemSet &rSet, bool bClearAllItems=false)
Definition: svdobj.cxx:1908
#define EE_CHAR_ITALIC
B2DHomMatrix createScaleTranslateB2DHomMatrix(double fScaleX, double fScaleY, double fTranslateX, double fTranslateY)
sal_uInt16 GetDots() const
Definition: xdash.hxx:55
GradientStyle
SdrOnOffItem makeSdrTextAutoGrowWidthItem(bool bAuto)
Definition: sdtagitm.hxx:29
const Size & GetSize() const
double getMaxY() const
HatchStyle GetStyle() const
#define EE_CHAR_OVERLINE
B2IRange fround(const B2DRange &rRange)
bool isClosed() const
SdrMetricItem makeSdrTextUpperDistItem(long mnHeight)
Definition: sdtditm.hxx:33
sal_uInt16 GetDashCount() const
void SetInsertCount(size_t _nInsertCount)
Definition: svdetc.cxx:484
void InsertObj(SdrObject *pObj, bool bScale=true)
Definition: svdfmtf.cxx:447
void SetActionCount(size_t _nActionCount)
Definition: svdetc.cxx:479
const Size & GetSrcSize() const
bool isEmpty() const
sal_Int32 GetDistance() const
virtual void SetLayer(SdrLayerID nLayer)
Definition: svdobj.cxx:598
sal_Int32 GetWidth() const
object group
Definition: svdobj.hxx:119
ALIGN_BASELINE
basegfx::B2DLineJoin GetLineJoin() const
sal_uInt16 GetAngle() const
const tools::Rectangle & GetRect() const
const Size & GetPrefSize() const
bool isClosed() const
int i
uno_Any a
sal_uInt16 GetTransparence() const
const Size & GetSize() const
const Point & GetPoint() const
basegfx::B2DPolyPolygon maClip
sal_uInt16 GetAngle() const
#define EE_CHAR_UNDERLINE
const BitmapEx & GetBitmapEx() const
const tools::Rectangle & GetRect() const
void NbcSetPathPoly(const basegfx::B2DPolyPolygon &rPathPoly)
Definition: svdopath.cxx:2728
void SetGradientStyle(css::awt::GradientStyle eNewStyle)
Definition: xgrad.hxx:55
const Color & GetColor() const
sal_uInt16 GetOfsX() const
const Size & GetSize() const
#define EE_CHAR_SHADOW
size_t DoImport(const GDIMetaFile &rMtf, SdrObjList &rDestList, size_t nInsPos, SvdProgressInfo *pProgrInfo=nullptr)
Definition: svdfmtf.cxx:210
BitmapEx convertMetafileToBitmapEx(const GDIMetaFile &rMtf, const basegfx::B2DRange &rTargetRange, const sal_uInt32 nMaximumQuadraticPixels)
Helper to convert any GDIMetaFile to a good quality BitmapEx, using default parameters and graphic::X...
Definition: svdpntv.cxx:103
Helper class for the communication between the dialog In order to break open Metafiles (sd/source/ui/...
Definition: svdetc.hxx:111
void SetRed(sal_uInt8 nRed)
B2DLineJoin
void scale(double fX, double fY)
friend class SdrGrafObj
Definition: svdpntv.hxx:125
SdrModel & getSdrModelFromSdrObject() const
Definition: svdobj.cxx:272
void transform(const basegfx::B2DHomMatrix &rMatrix)
#define EE_CHAR_COLOR
const OUString & GetText() const
#define EE_CHAR_FONTHEIGHT
sal_uInt16 GetEndIntensity() const
ALIGN_BOTTOM
sal_Int32 GetLen() const
void SetMergedItem(const SfxPoolItem &rItem)
Definition: svdobj.cxx:1893
const Point & GetPoint() const
const Bitmap & GetBitmap() const
This class represents an embedded or linked bitmap graphic object.
Definition: svdograf.hxx:79
std::unique_ptr< SfxItemSet > mpFillAttr
Definition: svdfmtf.hxx:53
Abstract DrawObject.
Definition: svdobj.hxx:312
bool ReportActions(size_t nActionCount)
Definition: svdetc.cxx:455
virtual basegfx::B2DPolyPolygon TakeContour() const override
contour for TextToContour
Definition: svdotext.cxx:1064
const Bitmap & GetBitmap() const
const Point & GetPoint() const
sal_Int32 GetDashLen() const
const Bitmap & GetBitmap() const
sal_uInt16 GetSteps() const
void transform(const basegfx::B2DHomMatrix &rMatrix)
virtual SdrLayerID GetLayer() const
Definition: svdobj.cxx:576
bool HasLineStyle() const
Definition: svdobj.cxx:2953
basegfx::B2DRange b2DRectangleFromRectangle(const ::tools::Rectangle &rRect)
const Color & GetStartColor() const
const tools::PolyPolygon & GetPolyPolygon() const
const Point & GetPoint() const
const int mnLayer
const Color & GetColor() const
bool isClip() const
Definition: svdfmtf.cxx:904
const Point & GetStartPoint() const
SdrObject * Next()
Definition: svditer.hxx:63
SdrObjectUniquePtr ConvertToPolyObj(bool bBezier, bool bLineToArea) const
Definition: svdobj.cxx:2504
::std::vector< SdrObject * > maTmpList
Definition: svdfmtf.hxx:48
double getMinY() const
const BitmapEx & GetBitmapEx() const
#define EE_CHAR_OUTLINE
sal_uInt32 count() const
#define EE_CHAR_FONTINFO_CJK
sal_uInt32 GetDotLen() const
Definition: xdash.hxx:56
std::unique_ptr< SfxItemSet > mpLineAttr
Definition: svdfmtf.hxx:52
basegfx::B2DPolyPolygon maClip
Definition: svdfmtf.hxx:82
long AdjustRight(long nHorzMoveDelta)
::basegfx::B2DPolyPolygon getB2DPolyPolygon() const
const Color & GetColor() const
unsigned char sal_uInt8
#define EE_CHAR_WEIGHT
sal_Int32 GetDotLen() const
virtual void NbcMove(const Size &rSiz)
The methods Move, Resize, Rotate, Mirror, Shear, SetSnapRect and SetLogicRect call the corresponding ...
Definition: svdobj.cxx:1373
MetaAction * GetAction(size_t nAction) const
#define EE_CHAR_FONTHEIGHT_CTL
const SfxItemSet & GetMergedItemSet() const
Definition: svdobj.cxx:1883
const Color & GetEndColor() const
const Point & GetPoint() const
#define SDRATTR_TEXT_AUTOGROWWIDTH
Definition: svddef.hxx:211
void NbcSetText(const OUString &rStr)
Definition: svdotext.cxx:190
const Point & GetDestPoint() const
virtual SdrObject * CloneSdrObject(SdrModel &rTargetModel) const
Definition: svdobj.cxx:973
#define F_PI18000
bool CheckLastLineMerge(const basegfx::B2DPolygon &rSrcPoly)
Definition: svdfmtf.cxx:785
size_t GetActionSize() const
bool mbLastObjWasPolyWithoutLine
Definition: svdfmtf.hxx:74
MetaActionType GetType() const
long GetAngle(const Point &rPnt)
The Y axis points down! The function negates the Y axis, when calculating the angle, such that GetAngle(Point(0,-1))=90 deg.
Definition: svdtrans.cxx:385
SdrMetricItem makeSdrTextLeftDistItem(long mnHeight)
Definition: sdtditm.hxx:25
void translate(double fX, double fY)
const basegfx::B2DPolyPolygon & GetPathPoly() const
Definition: svdopath.hxx:139
basegfx::BColor getBColor() const
void ReportInserts(size_t nInsertCount)
Definition: svdetc.cxx:465
const Hatch & GetHatch() const
const Point & GetSrcPoint() const
virtual void SetSnapRect(const tools::Rectangle &rRect)
Definition: svdobj.cxx:1621
SdrMetricItem makeSdrTextRightDistItem(long mnHeight)
Definition: sdtditm.hxx:29
const sal_uInt16 * GetRanges() const
virtual void NbcRotate(const Point &rRef, long nAngle, double sn, double cs) override
Definition: svdorect.cxx:472
const SfxItemPool & GetItemPool() const
Definition: svdmodel.hxx:314
double getMinX() const
const OString & GetComment() const
#define EE_CHAR_FONTINFO_CTL
virtual void Execute(OutputDevice *pOut) override
sal_uInt32 GetDashLen() const
Definition: xdash.hxx:58
const Size & GetSizePixel() const
SdrMetricItem makeSdrTextLowerDistItem(long mnHeight)
Definition: sdtditm.hxx:37
#define EE_CHAR_STRIKEOUT
bool Crop(const tools::Rectangle &rRectPixel)
sal_uInt16 GetStartIntensity() const
virtual OutlinerParaObject * GetOutlinerParaObject() const
Definition: svdobj.cxx:1742
const tools::Rectangle & GetRect() const
aStr
bool CheckLastPolyLineAndFillMerge(const basegfx::B2DPolyPolygon &rPolyPolygon)
Definition: svdfmtf.cxx:857
sal_Int32 GetIndex() const
ImpSdrGDIMetaFileImport(const ImpSdrGDIMetaFileImport &)=delete
bool isRectangle(const B2DPolygon &rPoly)
sal_Int32 GetIndex() const
css::drawing::LineCap maLineCap
Definition: svdfmtf.hxx:60
sal_uInt16 GetDashes() const
Definition: xdash.hxx:57
sal_uInt32 count() const
#define EE_CHAR_WLM
basegfx::B2DPoint const & getB2DPoint(sal_uInt32 nIndex) const
#define SDRATTR_ECKENRADIUS
Definition: svddef.hxx:199
ScopedVclPtr< VirtualDevice > mpVD
Definition: svdfmtf.hxx:49