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