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