LibreOffice Module svx (master)  1
svdpdf.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 <svdpdf.hxx>
21 
22 #include <tools/UnitConversion.hxx>
23 #include <vcl/graph.hxx>
25 
26 #include <math.h>
27 #include <editeng/eeitem.hxx>
28 #include <editeng/fhgtitem.hxx>
29 #include <editeng/wghtitem.hxx>
30 #include <editeng/postitem.hxx>
31 #include <editeng/udlnitem.hxx>
33 #include <editeng/shdditem.hxx>
34 #include <svx/xlnclit.hxx>
35 #include <svx/xlncapit.hxx>
36 #include <svx/xlnwtit.hxx>
37 #include <svx/xflclit.hxx>
38 #include <editeng/fontitem.hxx>
39 #include <editeng/wrlmitem.hxx>
40 #include <editeng/contouritem.hxx>
41 #include <editeng/colritem.hxx>
42 #include <vcl/metric.hxx>
44 #include <svx/sdtditm.hxx>
45 #include <svx/sdtagitm.hxx>
46 #include <svx/sdtfsitm.hxx>
47 #include <svx/svdmodel.hxx>
48 #include <svx/svdpage.hxx>
49 #include <svx/svdobj.hxx>
50 #include <svx/svdotext.hxx>
51 #include <svx/svdorect.hxx>
52 #include <svx/svdograf.hxx>
53 #include <svx/svdopath.hxx>
54 #include <svx/svdetc.hxx>
55 #include <svl/itemset.hxx>
57 #include <tools/helpers.hxx>
60 #include <svx/xlinjoit.hxx>
61 #include <svx/xlndsit.hxx>
63 #include <svx/xbtmpit.hxx>
64 #include <svx/xfillit0.hxx>
65 #include <svx/xflbmtit.hxx>
66 #include <svx/xflbstit.hxx>
67 #include <svx/xlineit0.hxx>
69 #include <svx/svditer.hxx>
70 #include <svx/svdogrp.hxx>
71 #include <vcl/dibtools.hxx>
72 #include <sal/log.hxx>
73 #include <osl/diagnose.h>
74 
75 namespace
76 {
77 double sqrt2(double a, double b) { return sqrt(a * a + b * b); }
78 }
79 
80 using namespace com::sun::star;
81 
83  Graphic const& rGraphic)
84  : mpVD(VclPtr<VirtualDevice>::Create())
85  , maScaleRect(rRect)
86  , mnMapScalingOfs(0)
87  , mpModel(&rModel)
88  , mnLayer(nLay)
89  , mnLineWidth(0)
90  , maDash(css::drawing::DashStyle_RECT, 0, 0, 0, 0, 0)
91  , mbMov(false)
92  , mbSize(false)
93  , maOfs(0, 0)
94  , mfScaleX(1.0)
95  , mfScaleY(1.0)
96  , maScaleX(1.0)
97  , maScaleY(1.0)
98  , mbFntDirty(true)
99  , mbLastObjWasPolyWithoutLine(false)
100  , mbNoLine(false)
101  , mbNoFill(false)
102  , mnPageCount(0)
103  , mdPageHeightPts(0)
104  , mpPDFium(vcl::pdf::PDFiumLibrary::get())
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(),
111  svl::Items<XATTR_LINE_FIRST, XATTR_LINE_LAST>);
112  mpFillAttr = std::make_unique<SfxItemSet>(rModel.GetItemPool(),
113  svl::Items<XATTR_FILL_FIRST, XATTR_FILL_LAST>);
114  mpTextAttr = std::make_unique<SfxItemSet>(rModel.GetItemPool(),
115  svl::Items<EE_ITEMS_START, EE_ITEMS_END>);
116  checkClip();
117 
118  // Load the buffer using pdfium.
119  auto const& rVectorGraphicData = rGraphic.getVectorGraphicData();
120  auto* pData = rVectorGraphicData->getBinaryDataContainer().getData();
121  sal_Int32 nSize = rVectorGraphicData->getBinaryDataContainer().getSize();
122  mpPdfDocument = mpPDFium->openDocument(pData, nSize);
123  if (!mpPdfDocument)
124  return;
125 
126  mnPageCount = mpPdfDocument->getPageCount();
127 }
128 
130 
131 void ImpSdrPdfImport::DoObjects(SvdProgressInfo* pProgrInfo, sal_uInt32* pActionsToReport,
132  int nPageIndex)
133 {
134  const int nPageCount = mpPdfDocument->getPageCount();
135  if (!(nPageCount > 0 && nPageIndex >= 0 && nPageIndex < nPageCount))
136  return;
137 
138  // Render next page.
139  auto pPdfPage = mpPdfDocument->openPage(nPageIndex);
140  if (!pPdfPage)
141  return;
142 
143  basegfx::B2DSize dPageSize = mpPdfDocument->getPageSize(nPageIndex);
144 
145  const double dPageWidth = dPageSize.getX();
146  const double dPageHeight = dPageSize.getY();
147 
148  SetupPageScale(dPageWidth, dPageHeight);
149 
150  // Load the page text to extract it when we get text elements.
151  auto pTextPage = pPdfPage->getTextPage();
152 
153  const int nPageObjectCount = pPdfPage->getObjectCount();
154  if (pProgrInfo)
155  pProgrInfo->SetActionCount(nPageObjectCount);
156 
157  for (int nPageObjectIndex = 0; nPageObjectIndex < nPageObjectCount; ++nPageObjectIndex)
158  {
159  auto pPageObject = pPdfPage->getObject(nPageObjectIndex);
160  ImportPdfObject(pPageObject, pTextPage, nPageObjectIndex);
161  if (pProgrInfo && pActionsToReport)
162  {
163  (*pActionsToReport)++;
164 
165  if (*pActionsToReport >= 16)
166  {
167  if (!pProgrInfo->ReportActions(*pActionsToReport))
168  break;
169 
170  *pActionsToReport = 0;
171  }
172  }
173  }
174 }
175 
176 void ImpSdrPdfImport::SetupPageScale(const double dPageWidth, const double dPageHeight)
177 {
178  mfScaleX = mfScaleY = 1.0;
179 
180  // Store the page dimensions in Points.
181  mdPageHeightPts = dPageHeight;
182 
183  Size aPageSize(convertPointToMm100(dPageWidth), convertPointToMm100(dPageHeight));
184 
185  if (aPageSize.Width() && aPageSize.Height() && (!maScaleRect.IsEmpty()))
186  {
188 
189  if (aPageSize.Width() != (maScaleRect.GetWidth() - 1))
190  {
191  mfScaleX = static_cast<double>(maScaleRect.GetWidth() - 1)
192  / static_cast<double>(aPageSize.Width());
193  }
194 
195  if (aPageSize.Height() != (maScaleRect.GetHeight() - 1))
196  {
197  mfScaleY = static_cast<double>(maScaleRect.GetHeight() - 1)
198  / static_cast<double>(aPageSize.Height());
199  }
200  }
201 
202  mbMov = maOfs.X() != 0 || maOfs.Y() != 0;
203  mbSize = false;
204  maScaleX = Fraction(1, 1);
205  maScaleY = Fraction(1, 1);
206 
207  if (aPageSize.Width() != (maScaleRect.GetWidth() - 1))
208  {
209  maScaleX = Fraction(maScaleRect.GetWidth() - 1, aPageSize.Width());
210  mbSize = true;
211  }
212 
213  if (aPageSize.Height() != (maScaleRect.GetHeight() - 1))
214  {
215  maScaleY = Fraction(maScaleRect.GetHeight() - 1, aPageSize.Height());
216  mbSize = true;
217  }
218 }
219 
220 size_t ImpSdrPdfImport::DoImport(SdrObjList& rOL, size_t nInsPos, int nPageNumber,
221  SvdProgressInfo* pProgrInfo)
222 {
223  sal_uInt32 nActionsToReport(0);
224 
225  // execute
226  DoObjects(pProgrInfo, &nActionsToReport, nPageNumber);
227 
228  if (pProgrInfo)
229  {
230  pProgrInfo->ReportActions(nActionsToReport);
231  nActionsToReport = 0;
232  }
233 
234  // MapMode scaling
235  MapScaling();
236 
237  // To calculate the progress meter, we use GetActionSize()*3.
238  // However, maTmpList has a lower entry count limit than GetActionSize(),
239  // so the actions that were assumed were too much have to be re-added.
240  // nActionsToReport = (rMtf.GetActionSize() - maTmpList.size()) * 2;
241 
242  // announce all currently unannounced rescales
243  if (pProgrInfo)
244  {
245  pProgrInfo->ReportRescales(nActionsToReport);
246  pProgrInfo->SetInsertCount(maTmpList.size());
247  }
248 
249  nActionsToReport = 0;
250 
251  // insert all objects cached in aTmpList now into rOL from nInsPos
252  nInsPos = std::min(nInsPos, rOL.GetObjCount());
253 
254  for (SdrObject* pObj : maTmpList)
255  {
256  rOL.NbcInsertObject(pObj, nInsPos);
257  nInsPos++;
258 
259  if (pProgrInfo)
260  {
261  nActionsToReport++;
262 
263  if (nActionsToReport >= 32) // update all 32 actions
264  {
265  pProgrInfo->ReportInserts(nActionsToReport);
266  nActionsToReport = 0;
267  }
268  }
269  }
270 
271  // report all remaining inserts for the last time
272  if (pProgrInfo)
273  {
274  pProgrInfo->ReportInserts(nActionsToReport);
275  }
276 
277  return maTmpList.size();
278 }
279 
280 void ImpSdrPdfImport::SetAttributes(SdrObject* pObj, bool bForceTextAttr)
281 {
282  mbNoLine = false;
283  mbNoFill = false;
284  bool bLine(!bForceTextAttr);
285  bool bFill(!pObj || (pObj->IsClosedObj() && !bForceTextAttr));
286  bool bText(bForceTextAttr || (pObj && pObj->GetOutlinerParaObject()));
287 
288  if (bLine)
289  {
290  if (mnLineWidth)
291  {
293  }
294  else
295  {
296  mpLineAttr->Put(XLineWidthItem(0));
297  }
298 
299  maOldLineColor = mpVD->GetLineColor();
300 
301  if (mpVD->IsLineColor())
302  {
303  mpLineAttr->Put(XLineStyleItem(drawing::LineStyle_SOLID)); //TODO support dashed lines.
304  mpLineAttr->Put(XLineColorItem(OUString(), mpVD->GetLineColor()));
305  }
306  else
307  {
308  mpLineAttr->Put(XLineStyleItem(drawing::LineStyle_NONE));
309  }
310 
311  mpLineAttr->Put(XLineJointItem(css::drawing::LineJoint_NONE));
312 
313  // Add LineCap support
315 
316  if (((maDash.GetDots() && maDash.GetDotLen())
317  || (maDash.GetDashes() && maDash.GetDashLen()))
318  && maDash.GetDistance())
319  {
320  mpLineAttr->Put(XLineDashItem(OUString(), maDash));
321  }
322  else
323  {
324  mpLineAttr->Put(XLineDashItem(OUString(), XDash(css::drawing::DashStyle_RECT)));
325  }
326  }
327  else
328  {
329  mbNoLine = true;
330  }
331 
332  if (bFill)
333  {
334  if (mpVD->IsFillColor())
335  {
336  mpFillAttr->Put(XFillStyleItem(drawing::FillStyle_SOLID));
337  mpFillAttr->Put(XFillColorItem(OUString(), mpVD->GetFillColor()));
338  }
339  else
340  {
341  mpFillAttr->Put(XFillStyleItem(drawing::FillStyle_NONE));
342  }
343  }
344  else
345  {
346  mbNoFill = true;
347  }
348 
349  if (bText && mbFntDirty)
350  {
351  vcl::Font aFnt(mpVD->GetFont());
352  const sal_uInt32 nHeight(FRound(aFnt.GetFontSize().Height() * mfScaleY));
353 
354  mpTextAttr->Put(SvxFontItem(aFnt.GetFamilyType(), aFnt.GetFamilyName(), aFnt.GetStyleName(),
355  aFnt.GetPitch(), aFnt.GetCharSet(), EE_CHAR_FONTINFO));
356  mpTextAttr->Put(SvxFontItem(aFnt.GetFamilyType(), aFnt.GetFamilyName(), aFnt.GetStyleName(),
357  aFnt.GetPitch(), aFnt.GetCharSet(), EE_CHAR_FONTINFO_CJK));
358  mpTextAttr->Put(SvxFontItem(aFnt.GetFamilyType(), aFnt.GetFamilyName(), aFnt.GetStyleName(),
359  aFnt.GetPitch(), aFnt.GetCharSet(), EE_CHAR_FONTINFO_CTL));
360  mpTextAttr->Put(SvxPostureItem(aFnt.GetItalic(), EE_CHAR_ITALIC));
361  mpTextAttr->Put(SvxWeightItem(aFnt.GetWeight(), EE_CHAR_WEIGHT));
362  mpTextAttr->Put(SvxFontHeightItem(nHeight, 100, EE_CHAR_FONTHEIGHT));
366  mpTextAttr->Put(SvxUnderlineItem(aFnt.GetUnderline(), EE_CHAR_UNDERLINE));
367  mpTextAttr->Put(SvxOverlineItem(aFnt.GetOverline(), EE_CHAR_OVERLINE));
368  mpTextAttr->Put(SvxCrossedOutItem(aFnt.GetStrikeout(), EE_CHAR_STRIKEOUT));
369  mpTextAttr->Put(SvxShadowedItem(aFnt.IsShadow(), EE_CHAR_SHADOW));
370 
371  // #i118485# Setting this item leads to problems (written #i118498# for this)
372  // mpTextAttr->Put(SvxAutoKernItem(aFnt.IsKerning(), EE_CHAR_KERNING));
373 
374  mpTextAttr->Put(SvxWordLineModeItem(aFnt.IsWordLineMode(), EE_CHAR_WLM));
375  mpTextAttr->Put(SvxContourItem(aFnt.IsOutline(), EE_CHAR_OUTLINE));
376  mpTextAttr->Put(SvxColorItem(mpVD->GetTextColor(), EE_CHAR_COLOR));
377  //... svxfont textitem svditext
378  mbFntDirty = false;
379  }
380 
381  if (!pObj)
382  return;
383 
384  pObj->SetLayer(mnLayer);
385 
386  if (bLine)
387  {
389  }
390 
391  if (bFill)
392  {
394  }
395 
396  if (bText)
397  {
400  }
401 }
402 
403 void ImpSdrPdfImport::InsertObj(SdrObject* pObj, bool bScale)
404 {
405  if (bScale && !maScaleRect.IsEmpty())
406  {
407  if (mbSize)
408  {
409  pObj->NbcResize(Point(), maScaleX, maScaleY);
410  }
411 
412  if (mbMov)
413  {
414  pObj->NbcMove(Size(maOfs.X(), maOfs.Y()));
415  }
416  }
417 
418  if (isClip())
419  {
420  const basegfx::B2DPolyPolygon aPoly(pObj->TakeXorPoly());
421  const basegfx::B2DRange aOldRange(aPoly.getB2DRange());
422  const SdrLayerID aOldLayer(pObj->GetLayer());
423  const SfxItemSet aOldItemSet(pObj->GetMergedItemSet());
424  const SdrGrafObj* pSdrGrafObj = dynamic_cast<SdrGrafObj*>(pObj);
425  const SdrTextObj* pSdrTextObj = dynamic_cast<SdrTextObj*>(pObj);
426 
427  if (pSdrTextObj && pSdrTextObj->HasText())
428  {
429  // all text objects are created from ImportText and have no line or fill attributes, so
430  // it is okay to concentrate on the text itself
431  while (true)
432  {
433  const basegfx::B2DPolyPolygon aTextContour(pSdrTextObj->TakeContour());
434  const basegfx::B2DRange aTextRange(aTextContour.getB2DRange());
435  const basegfx::B2DRange aClipRange(maClip.getB2DRange());
436 
437  // no overlap -> completely outside
438  if (!aClipRange.overlaps(aTextRange))
439  {
440  SdrObject::Free(pObj);
441  break;
442  }
443 
444  // when the clip is a rectangle fast check for inside is possible
445  if (basegfx::utils::isRectangle(maClip) && aClipRange.isInside(aTextRange))
446  {
447  // completely inside ClipRect
448  break;
449  }
450 
451  // here text needs to be clipped; to do so, convert to SdrObjects with polygons
452  // and add these recursively. Delete original object, do not add in this run
453  SdrObjectUniquePtr pConverted = pSdrTextObj->ConvertToPolyObj(true, true);
454  SdrObject::Free(pObj);
455 
456  if (pConverted)
457  {
458  // recursively add created conversion; per definition this shall not
459  // contain further SdrTextObjs. Visit only non-group objects
460  SdrObjListIter aIter(*pConverted, SdrIterMode::DeepNoGroups);
461 
462  // work with clones; the created conversion may contain group objects
463  // and when working with the original objects the loop itself could
464  // break and the cleanup later would be pretty complicated (only delete group
465  // objects, are these empty, ...?)
466  while (aIter.IsMore())
467  {
468  SdrObject* pCandidate = aIter.Next();
469  OSL_ENSURE(pCandidate && dynamic_cast<SdrObjGroup*>(pCandidate) == nullptr,
470  "SdrObjListIter with SdrIterMode::DeepNoGroups error (!)");
471  SdrObject* pNewClone(
472  pCandidate->CloneSdrObject(pCandidate->getSdrModelFromSdrObject()));
473 
474  if (pNewClone)
475  {
476  InsertObj(pNewClone, false);
477  }
478  else
479  {
480  OSL_ENSURE(false, "SdrObject::Clone() failed (!)");
481  }
482  }
483  }
484 
485  break;
486  }
487  }
488  else
489  {
490  BitmapEx aBitmapEx;
491 
492  if (pSdrGrafObj)
493  {
494  aBitmapEx = pSdrGrafObj->GetGraphic().GetBitmapEx();
495  }
496 
497  SdrObject::Free(pObj);
498 
499  if (!aOldRange.isEmpty())
500  {
501  // clip against ClipRegion
503  aPoly, maClip, true, !aPoly.isClosed()));
504  const basegfx::B2DRange aNewRange(aNewPoly.getB2DRange());
505 
506  if (!aNewRange.isEmpty())
507  {
508  pObj = new SdrPathObj(*mpModel, aNewPoly.isClosed() ? OBJ_POLY : OBJ_PLIN,
509  aNewPoly);
510 
511  pObj->SetLayer(aOldLayer);
512  pObj->SetMergedItemSet(aOldItemSet);
513 
514  if (!aBitmapEx.IsEmpty())
515  {
516  // aNewRange is inside of aOldRange and defines which part of aBitmapEx is used
517  const double fScaleX(aBitmapEx.GetSizePixel().Width()
518  / (aOldRange.getWidth() ? aOldRange.getWidth() : 1.0));
519  const double fScaleY(
520  aBitmapEx.GetSizePixel().Height()
521  / (aOldRange.getHeight() ? aOldRange.getHeight() : 1.0));
522  basegfx::B2DRange aPixel(aNewRange);
523  basegfx::B2DHomMatrix aTrans;
524 
525  aTrans.translate(-aOldRange.getMinX(), -aOldRange.getMinY());
526  aTrans.scale(fScaleX, fScaleY);
527  aPixel.transform(aTrans);
528 
529  const Size aOrigSizePixel(aBitmapEx.GetSizePixel());
530  const Point aClipTopLeft(
531  basegfx::fround(floor(std::max(0.0, aPixel.getMinX()))),
532  basegfx::fround(floor(std::max(0.0, aPixel.getMinY()))));
533  const Size aClipSize(
534  basegfx::fround(ceil(std::min(
535  static_cast<double>(aOrigSizePixel.Width()), aPixel.getWidth()))),
537  ceil(std::min(static_cast<double>(aOrigSizePixel.Height()),
538  aPixel.getHeight()))));
539  const BitmapEx aClippedBitmap(aBitmapEx, aClipTopLeft, aClipSize);
540 
541  pObj->SetMergedItem(XFillStyleItem(drawing::FillStyle_BITMAP));
542  pObj->SetMergedItem(XFillBitmapItem(OUString(), Graphic(aClippedBitmap)));
543  pObj->SetMergedItem(XFillBmpTileItem(false));
544  pObj->SetMergedItem(XFillBmpStretchItem(true));
545  }
546  }
547  }
548  }
549  }
550 
551  if (!pObj)
552  return;
553 
554  // #i111954# check object for visibility
555  // used are SdrPathObj, SdrRectObj, SdrCircObj, SdrGrafObj
556  bool bVisible(false);
557 
558  if (pObj->HasLineStyle())
559  {
560  bVisible = true;
561  }
562 
563  if (!bVisible && pObj->HasFillStyle())
564  {
565  bVisible = true;
566  }
567 
568  if (!bVisible)
569  {
570  SdrTextObj* pTextObj = dynamic_cast<SdrTextObj*>(pObj);
571 
572  if (pTextObj && pTextObj->HasText())
573  {
574  bVisible = true;
575  }
576  }
577 
578  if (!bVisible)
579  {
580  SdrGrafObj* pGrafObj = dynamic_cast<SdrGrafObj*>(pObj);
581 
582  if (pGrafObj)
583  {
584  // this may be refined to check if the graphic really is visible. It
585  // is here to ensure that graphic objects without fill, line and text
586  // get created
587  bVisible = true;
588  }
589  }
590 
591  if (!bVisible)
592  {
593  SdrObject::Free(pObj);
594  }
595  else
596  {
597  maTmpList.push_back(pObj);
598 
599  if (dynamic_cast<SdrPathObj*>(pObj))
600  {
601  const bool bClosed(pObj->IsClosedObj());
602 
604  }
605  else
606  {
608  }
609  }
610 }
611 
613 {
614  // #i73407# reformulation to use new B2DPolygon classes
616  {
617  SdrObject* pTmpObj = !maTmpList.empty() ? maTmpList[maTmpList.size() - 1] : nullptr;
618  SdrPathObj* pLastPoly = dynamic_cast<SdrPathObj*>(pTmpObj);
619 
620  if (pLastPoly)
621  {
622  if (pLastPoly->GetPathPoly() == rPolyPolygon)
623  {
624  SetAttributes(nullptr);
625 
626  if (!mbNoLine && mbNoFill)
627  {
628  pLastPoly->SetMergedItemSet(*mpLineAttr);
629 
630  return true;
631  }
632  }
633  }
634  }
635 
636  return false;
637 }
638 
640 {
641  if (mpVD->IsClipRegion())
642  {
643  maClip = mpVD->GetClipRegion().GetAsB2DPolyPolygon();
644 
645  if (isClip())
646  {
648  mfScaleX, mfScaleY, maOfs.X(), maOfs.Y()));
649 
650  maClip.transform(aTransform);
651  }
652  }
653 }
654 
655 bool ImpSdrPdfImport::isClip() const { return !maClip.getB2DRange().isEmpty(); }
657  std::unique_ptr<vcl::pdf::PDFiumPageObject> const& pPageObject,
658  std::unique_ptr<vcl::pdf::PDFiumTextPage> const& pTextPage, int nPageObjectIndex)
659 {
660  if (!pPageObject)
661  return;
662 
663  const vcl::pdf::PDFPageObjectType ePageObjectType = pPageObject->getType();
664  switch (ePageObjectType)
665  {
667  ImportText(pPageObject, pTextPage, nPageObjectIndex);
668  break;
670  ImportPath(pPageObject, nPageObjectIndex);
671  break;
673  ImportImage(pPageObject, nPageObjectIndex);
674  break;
676  SAL_WARN("sd.filter", "Got page object SHADING: " << nPageObjectIndex);
677  break;
679  ImportForm(pPageObject, pTextPage, nPageObjectIndex);
680  break;
681  default:
682  SAL_WARN("sd.filter", "Unknown PDF page object #" << nPageObjectIndex << " of type: "
683  << static_cast<int>(ePageObjectType));
684  break;
685  }
686 }
687 
688 void ImpSdrPdfImport::ImportForm(std::unique_ptr<vcl::pdf::PDFiumPageObject> const& pPageObject,
689  std::unique_ptr<vcl::pdf::PDFiumTextPage> const& pTextPage,
690  int /*nPageObjectIndex*/)
691 {
692  // Get the form matrix to perform correct translation/scaling of the form sub-objects.
693  const basegfx::B2DHomMatrix aOldMatrix = maCurrentMatrix;
694 
695  maCurrentMatrix = pPageObject->getMatrix();
696 
697  const int nCount = pPageObject->getFormObjectCount();
698  for (int nIndex = 0; nIndex < nCount; ++nIndex)
699  {
700  auto pFormObject = pPageObject->getFormObject(nIndex);
701 
702  ImportPdfObject(pFormObject, pTextPage, -1);
703  }
704 
705  // Restore the old one.
706  maCurrentMatrix = aOldMatrix;
707 }
708 
709 void ImpSdrPdfImport::ImportText(std::unique_ptr<vcl::pdf::PDFiumPageObject> const& pPageObject,
710  std::unique_ptr<vcl::pdf::PDFiumTextPage> const& pTextPage,
711  int /*nPageObjectIndex*/)
712 {
713  basegfx::B2DRectangle aTextRect = pPageObject->getBounds();
714  basegfx::B2DHomMatrix aMatrix = pPageObject->getMatrix();
715 
717 
718  aTextRect *= aTextMatrix;
719  const tools::Rectangle aRect = PointsToLogic(aTextRect.getMinX(), aTextRect.getMaxX(),
720  aTextRect.getMinY(), aTextRect.getMaxY());
721 
722  OUString sText = pPageObject->getText(pTextPage);
723 
724  const double dFontSize = pPageObject->getFontSize();
725  double dFontSizeH = fabs(sqrt2(aMatrix.a(), aMatrix.c()) * dFontSize);
726  double dFontSizeV = fabs(sqrt2(aMatrix.b(), aMatrix.d()) * dFontSize);
727 
728  dFontSizeH = convertPointToMm100(dFontSizeH);
729  dFontSizeV = convertPointToMm100(dFontSizeV);
730 
731  const Size aFontSize(dFontSizeH, dFontSizeV);
732  vcl::Font aFnt = mpVD->GetFont();
733  if (aFontSize != aFnt.GetFontSize())
734  {
735  aFnt.SetFontSize(aFontSize);
736  mpVD->SetFont(aFnt);
737  mbFntDirty = true;
738  }
739 
740  OUString sFontName = pPageObject->getFontName();
741  if (!sFontName.isEmpty() && sFontName != aFnt.GetFamilyName())
742  {
743  aFnt.SetFamilyName(sFontName);
744  mpVD->SetFont(aFnt);
745  mbFntDirty = true;
746  }
747 
748  Color aTextColor(COL_TRANSPARENT);
749  bool bFill = false;
750  bool bUse = true;
751  switch (pPageObject->getTextRenderMode())
752  {
757  bFill = true;
758  break;
762  break;
765  bUse = false;
766  break;
767  }
768  if (bUse)
769  {
770  Color aColor = bFill ? pPageObject->getFillColor() : pPageObject->getStrokeColor();
771  if (aColor != COL_TRANSPARENT)
772  aTextColor = aColor.GetRGBColor();
773  }
774 
775  if (aTextColor != mpVD->GetTextColor())
776  {
777  mpVD->SetTextColor(aTextColor);
778  mbFntDirty = true;
779  }
780 
781  InsertTextObject(aRect.TopLeft(), aRect.GetSize(), sText);
782 }
783 
784 void ImpSdrPdfImport::InsertTextObject(const Point& rPos, const Size& rSize, const OUString& rStr)
785 {
786  // calc text box size, add 5% to make it fit safely
787 
788  FontMetric aFontMetric(mpVD->GetFontMetric());
789  vcl::Font aFont(mpVD->GetFont());
790  TextAlign eAlignment(aFont.GetAlignment());
791 
792  // sal_Int32 nTextWidth = static_cast<sal_Int32>(mpVD->GetTextWidth(rStr) * mfScaleX);
793  sal_Int32 nTextHeight = static_cast<sal_Int32>(mpVD->GetTextHeight() * mfScaleY);
794 
795  Point aPosition(FRound(rPos.X() * mfScaleX + maOfs.X()),
796  FRound(rPos.Y() * mfScaleY + maOfs.Y()));
797  Size aSize(FRound(rSize.Width() * mfScaleX), FRound(rSize.Height() * mfScaleY));
798 
799  if (eAlignment == ALIGN_BASELINE)
800  aPosition.AdjustY(-FRound(aFontMetric.GetAscent() * mfScaleY));
801  else if (eAlignment == ALIGN_BOTTOM)
802  aPosition.AdjustY(-nTextHeight);
803 
804  tools::Rectangle aTextRect(aPosition, aSize);
805  SdrRectObj* pText = new SdrRectObj(*mpModel, OBJ_TEXT, aTextRect);
806 
811 
812  if (aFont.GetAverageFontWidth())
813  {
816  // don't let the margins eat the space needed for the text
817  pText->SetMergedItem(SdrTextFitToSizeTypeItem(drawing::TextFitToSizeType_ALLLINES));
818  }
819  else
820  {
822  }
823 
824  pText->SetLayer(mnLayer);
825  pText->NbcSetText(rStr);
826  SetAttributes(pText, true);
827  pText->SetSnapRect(aTextRect);
828 
829  if (!aFont.IsTransparent())
830  {
831  SfxItemSet aAttr(*mpFillAttr->GetPool(), svl::Items<XATTR_FILL_FIRST, XATTR_FILL_LAST>);
832  aAttr.Put(XFillStyleItem(drawing::FillStyle_SOLID));
833  aAttr.Put(XFillColorItem(OUString(), aFont.GetFillColor()));
834  pText->SetMergedItemSet(aAttr);
835  }
836  Degree100 nAngle = toDegree100(aFont.GetOrientation());
837  if (nAngle)
838  pText->SdrAttrObj::NbcRotate(aPosition, nAngle);
839  InsertObj(pText, false);
840 }
841 
843 {
844  const size_t nCount(maTmpList.size());
845  const MapMode& rMap = mpVD->GetMapMode();
846  Point aMapOrg(rMap.GetOrigin());
847  bool bMov2(aMapOrg.X() != 0 || aMapOrg.Y() != 0);
848 
849  if (bMov2)
850  {
851  for (size_t i = mnMapScalingOfs; i < nCount; i++)
852  {
853  SdrObject* pObj = maTmpList[i];
854 
855  pObj->NbcMove(Size(aMapOrg.X(), aMapOrg.Y()));
856  }
857  }
858 
860 }
861 
862 void ImpSdrPdfImport::ImportImage(std::unique_ptr<vcl::pdf::PDFiumPageObject> const& pPageObject,
863  int /*nPageObjectIndex*/)
864 {
865  std::unique_ptr<vcl::pdf::PDFiumBitmap> bitmap = pPageObject->getImageBitmap();
866  if (!bitmap)
867  {
868  SAL_WARN("sd.filter", "Failed to get IMAGE");
869  return;
870  }
871 
872  const vcl::pdf::PDFBitmapType format = bitmap->getFormat();
873  if (format == vcl::pdf::PDFBitmapType::Unknown)
874  {
875  SAL_WARN("sd.filter", "Failed to get IMAGE format");
876  return;
877  }
878 
879  const unsigned char* pBuf = bitmap->getBuffer();
880  const int nWidth = bitmap->getWidth();
881  const int nHeight = bitmap->getHeight();
882  const int nStride = bitmap->getStride();
883  BitmapEx aBitmap(Size(nWidth, nHeight), vcl::PixelFormat::N24_BPP);
884 
885  switch (format)
886  {
888  ReadRawDIB(aBitmap, pBuf, ScanlineFormat::N24BitTcBgr, nHeight, nStride);
889  break;
891  ReadRawDIB(aBitmap, pBuf, ScanlineFormat::N32BitTcRgba, nHeight, nStride);
892  break;
894  ReadRawDIB(aBitmap, pBuf, ScanlineFormat::N32BitTcBgra, nHeight, nStride);
895  break;
896  default:
897  SAL_WARN("sd.filter", "Got IMAGE width: " << nWidth << ", height: " << nHeight
898  << ", stride: " << nStride
899  << ", format: " << static_cast<int>(format));
900  break;
901  }
902 
903  basegfx::B2DRectangle aBounds = pPageObject->getBounds();
904  float left = aBounds.getMinX();
905  // Upside down.
906  float bottom = aBounds.getMinY();
907  float right = aBounds.getMaxX();
908  // Upside down.
909  float top = aBounds.getMaxY();
910  tools::Rectangle aRect = PointsToLogic(left, right, top, bottom);
911  aRect.AdjustRight(1);
912  aRect.AdjustBottom(1);
913 
914  SdrGrafObj* pGraf = new SdrGrafObj(*mpModel, Graphic(aBitmap), aRect);
915 
916  // This action is not creating line and fill, set directly, do not use SetAttributes(..)
917  pGraf->SetMergedItem(XLineStyleItem(drawing::LineStyle_NONE));
918  pGraf->SetMergedItem(XFillStyleItem(drawing::FillStyle_NONE));
919  InsertObj(pGraf);
920 }
921 
922 void ImpSdrPdfImport::ImportPath(std::unique_ptr<vcl::pdf::PDFiumPageObject> const& pPageObject,
923  int /*nPageObjectIndex*/)
924 {
925  auto aPathMatrix = pPageObject->getMatrix();
926 
927  aPathMatrix *= maCurrentMatrix;
928 
929  basegfx::B2DPolyPolygon aPolyPoly;
930  basegfx::B2DPolygon aPoly;
931  std::vector<basegfx::B2DPoint> aBezier;
932 
933  const int nSegments = pPageObject->getPathSegmentCount();
934  for (int nSegmentIndex = 0; nSegmentIndex < nSegments; ++nSegmentIndex)
935  {
936  auto pPathSegment = pPageObject->getPathSegment(nSegmentIndex);
937  if (pPathSegment != nullptr)
938  {
939  basegfx::B2DPoint aB2DPoint = pPathSegment->getPoint();
940  aB2DPoint *= aPathMatrix;
941 
942  const bool bClose = pPathSegment->isClosed();
943  if (bClose)
944  aPoly.setClosed(bClose); // TODO: Review
945 
946  Point aPoint = PointsToLogic(aB2DPoint.getX(), aB2DPoint.getY());
947  aB2DPoint.setX(aPoint.X());
948  aB2DPoint.setY(aPoint.Y());
949 
950  const vcl::pdf::PDFSegmentType eSegmentType = pPathSegment->getType();
951  switch (eSegmentType)
952  {
954  aPoly.append(aB2DPoint);
955  break;
956 
958  aBezier.emplace_back(aB2DPoint.getX(), aB2DPoint.getY());
959  if (aBezier.size() == 3)
960  {
961  aPoly.appendBezierSegment(aBezier[0], aBezier[1], aBezier[2]);
962  aBezier.clear();
963  }
964  break;
965 
967  // New Poly.
968  if (aPoly.count() > 0)
969  {
970  aPolyPoly.append(aPoly, 1);
971  aPoly.clear();
972  }
973 
974  aPoly.append(aB2DPoint);
975  break;
976 
978  default:
979  SAL_WARN("sd.filter", "Unknown path segment type in PDF: "
980  << static_cast<int>(eSegmentType));
981  break;
982  }
983  }
984  }
985 
986  if (aBezier.size() == 3)
987  {
988  aPoly.appendBezierSegment(aBezier[0], aBezier[1], aBezier[2]);
989  aBezier.clear();
990  }
991 
992  if (aPoly.count() > 0)
993  {
994  aPolyPoly.append(aPoly, 1);
995  aPoly.clear();
996  }
997 
998  const basegfx::B2DHomMatrix aTransform(
1000  aPolyPoly.transform(aTransform);
1001 
1002  float fWidth = pPageObject->getStrokeWidth();
1003  const double dWidth = 0.5 * fabs(sqrt2(aPathMatrix.a(), aPathMatrix.c()) * fWidth);
1004  mnLineWidth = convertPointToMm100(dWidth);
1005 
1007  bool bStroke = true; // Assume we have to draw, unless told otherwise.
1008  if (pPageObject->getDrawMode(nFillMode, bStroke))
1009  {
1010  if (nFillMode == vcl::pdf::PDFFillMode::Alternate)
1011  mpVD->SetDrawMode(DrawModeFlags::Default);
1012  else if (nFillMode == vcl::pdf::PDFFillMode::Winding)
1013  mpVD->SetDrawMode(DrawModeFlags::Default);
1014  else
1015  mpVD->SetDrawMode(DrawModeFlags::NoFill);
1016  }
1017 
1018  mpVD->SetFillColor(pPageObject->getFillColor());
1019 
1020  if (bStroke)
1021  {
1022  mpVD->SetLineColor(pPageObject->getStrokeColor());
1023  }
1024  else
1025  mpVD->SetLineColor(COL_TRANSPARENT);
1026 
1028  {
1029  SdrPathObj* pPath = new SdrPathObj(*mpModel, OBJ_POLY, aPolyPoly);
1030  SetAttributes(pPath);
1031  InsertObj(pPath, false);
1032  }
1033 }
1034 
1035 Point ImpSdrPdfImport::PointsToLogic(double x, double y) const
1036 {
1037  y = correctVertOrigin(y);
1038 
1040  return aPos;
1041 }
1042 
1043 tools::Rectangle ImpSdrPdfImport::PointsToLogic(double left, double right, double top,
1044  double bottom) const
1045 {
1046  top = correctVertOrigin(top);
1047  bottom = correctVertOrigin(bottom);
1048 
1049  Point aPos(convertPointToMm100(left), convertPointToMm100(top));
1050  Size aSize(convertPointToMm100(right - left), convertPointToMm100(bottom - top));
1051 
1052  return tools::Rectangle(aPos, aSize);
1053 }
1054 
1055 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
Color maOldLineColor
Definition: svdpdf.hxx:58
void ReportRescales(size_t nRescaleCount)
Definition: svdetc.cxx:444
double getY() const
virtual basegfx::B2DPolyPolygon TakeXorPoly() const
The Xor-Polygon is required by the View to drag the object.
Definition: svdobj.cxx:1126
SdrMetricItem makeSdrTextUpperDistItem(tools::Long mnHeight)
Definition: sdtditm.hxx:35
void InsertTextObject(const Point &rPos, const Size &rSize, const OUString &rStr)
Definition: svdpdf.cxx:784
constexpr TypedWhichId< SvxFontItem > EE_CHAR_FONTINFO_CJK(EE_CHAR_START+17)
basegfx::B2DPolyPolygon maClip
Definition: svdpdf.hxx:79
size_t DoImport(SdrObjList &rDestList, size_t nInsPos, int nPageNumber, SvdProgressInfo *pProgrInfo=nullptr)
Definition: svdpdf.cxx:220
sal_Int32 nIndex
void append(const basegfx::B2DPoint &rPoint, sal_uInt32 nCount)
void SetFontSize(const Size &)
bool bVisible
bool IsClosedObj() const
Definition: svdobj.hxx:737
bool CheckLastPolyLineAndFillMerge(const basegfx::B2DPolyPolygon &rPolyPolygon)
Definition: svdpdf.cxx:612
const OUString & GetFamilyName() const
bool mbLastObjWasPolyWithoutLine
Definition: svdpdf.hxx:74
tools::Long AdjustRight(tools::Long nHorzMoveDelta)
sal_uInt64 left
std::unique_ptr< ContentProperties > pData
XDash maDash
Definition: svdpdf.hxx:61
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)
void Create(SwFormatVertOrient &rItem, SvStream &rStrm, sal_uInt16 nVersionAbusedAsSize)
void MapScaling()
Definition: svdpdf.cxx:842
ImpSdrPdfImport(const ImpSdrPdfImport &)=delete
constexpr::Color COL_TRANSPARENT(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
virtual void NbcInsertObject(SdrObject *pObj, size_t nPos=SAL_MAX_SIZE)
Definition: svdpage.cxx:283
bool HasFillStyle() const
Definition: svdobj.cxx:3040
size_t GetObjCount() const
Definition: svdpage.cxx:816
circle cut
Definition: svdobjkind.hxx:34
constexpr TypedWhichId< SvxPostureItem > EE_CHAR_ITALIC(EE_CHAR_START+7)
void ImportImage(std::unique_ptr< vcl::pdf::PDFiumPageObject > const &pPageObject, int nPageObjectIndex)
Definition: svdpdf.cxx:862
void appendBezierSegment(const basegfx::B2DPoint &rNextControlPoint, const basegfx::B2DPoint &rPrevControlPoint, const basegfx::B2DPoint &rPoint)
double GetDotLen() const
Definition: xdash.hxx:56
void SetAttributes(SdrObject *pObj, bool bForceTextAttr=false)
Definition: svdpdf.cxx:280
SdrMetricItem makeSdrTextRightDistItem(tools::Long mnHeight)
Definition: sdtditm.hxx:30
double mdPageHeightPts
Definition: svdpdf.hxx:83
SdrMetricItem makeSdrTextLowerDistItem(tools::Long mnHeight)
Definition: sdtditm.hxx:40
static void Free(SdrObject *&_rpObject)
Definition: svdobj.cxx:471
Fraction maScaleX
Definition: svdpdf.hxx:68
double getMaxX() const
constexpr TypedWhichId< SvxFontHeightItem > EE_CHAR_FONTHEIGHT(EE_CHAR_START+2)
void setX(double fX)
Color GetRGBColor() const
virtual bool HasText() const override
Definition: svdotxat.cxx:417
SdrOnOffItem makeSdrTextAutoGrowHeightItem(bool bAuto)
Definition: sdtagitm.hxx:25
SdrLayerID mnLayer
Definition: svdpdf.hxx:57
B2DPolyPolygon clipPolyPolygonOnPolyPolygon(const B2DPolyPolygon &rCandidate, const B2DPolyPolygon &rClip, bool bInside, bool bStroke)
B2DRange getB2DRange() const
Rectangle objects (rectangle, circle, ...)
Definition: svdorect.hxx:38
size_t mnMapScalingOfs
Definition: svdpdf.hxx:52
constexpr tools::Long Width() const
Degree100 toDegree100(Degree10 x)
double mfScaleY
Definition: svdpdf.hxx:67
void ClearMergedItem(const sal_uInt16 nWhich=0)
Definition: svdobj.cxx:1993
Definition: xdash.hxx:31
std::unique_ptr< vcl::pdf::PDFiumDocument > mpPdfDocument
Definition: svdpdf.hxx:81
void SetupPageScale(const double dPageWidth, const double dPageHeight)
Definition: svdpdf.cxx:176
bool IsMore() const
Definition: svditer.hxx:62
constexpr TypedWhichId< SvxFontItem > EE_CHAR_FONTINFO_CTL(EE_CHAR_START+18)
int nCount
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
void ImportText(std::unique_ptr< vcl::pdf::PDFiumPageObject > const &pPageObject, std::unique_ptr< vcl::pdf::PDFiumTextPage > const &pTextPage, int nPageObjectIndex)
Definition: svdpdf.cxx:709
SdrOnOffItem makeSdrTextAutoGrowWidthItem(bool bAuto)
Definition: sdtagitm.hxx:30
double GetDistance() const
Definition: xdash.hxx:59
double getMaxY() const
Fraction maScaleY
Definition: svdpdf.hxx:69
tools::Long AdjustBottom(tools::Long nVertMoveDelta)
void ImportPath(std::unique_ptr< vcl::pdf::PDFiumPageObject > const &pPageObject, int nPageObjectIndex)
Definition: svdpdf.cxx:922
B2IRange fround(const B2DRange &rRange)
constexpr TypedWhichId< SvxContourItem > EE_CHAR_OUTLINE(EE_CHAR_START+8)
constexpr TypedWhichId< SvxWeightItem > EE_CHAR_WEIGHT(EE_CHAR_START+4)
void SetInsertCount(size_t _nInsertCount)
Definition: svdetc.cxx:455
constexpr bool IsEmpty() const
void SetActionCount(size_t _nActionCount)
Definition: svdetc.cxx:450
void ImportPdfObject(std::unique_ptr< vcl::pdf::PDFiumPageObject > const &pPageObject, std::unique_ptr< vcl::pdf::PDFiumTextPage > const &pTextPage, int nPageObjectIndex)
Definition: svdpdf.cxx:656
constexpr TypedWhichId< SvxShadowedItem > EE_CHAR_SHADOW(EE_CHAR_START+9)
bool isEmpty() const
bool IsEmpty() const
void ImportForm(std::unique_ptr< vcl::pdf::PDFiumPageObject > const &pPageObject, std::unique_ptr< vcl::pdf::PDFiumTextPage > const &pTextPage, int nPageObjectIndex)
Definition: svdpdf.cxx:688
virtual void SetLayer(SdrLayerID nLayer)
Definition: svdobj.cxx:700
def right
ALIGN_BASELINE
std::unique_ptr< SfxItemSet > mpLineAttr
Definition: svdpdf.hxx:53
void SetFamilyName(const OUString &rFamilyName)
bool mbFntDirty
Definition: svdpdf.hxx:71
bool isClosed() const
int i
tools::Long FRound(double fVal)
constexpr TypedWhichId< SvxCharScaleWidthItem > EE_CHAR_FONTWIDTH(EE_CHAR_START+3)
void checkClip()
Definition: svdpdf.cxx:639
void InsertObj(SdrObject *pObj, bool bScale=true)
Definition: svdpdf.cxx:403
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)
void scale(double fX, double fY)
SdrModel & getSdrModelFromSdrObject() const
Definition: svdobj.cxx:279
void transform(const basegfx::B2DHomMatrix &rMatrix)
polygon, PolyPolygon
Definition: svdobjkind.hxx:35
const Size & GetFontSize() const
ALIGN_BOTTOM
void SetMergedItem(const SfxPoolItem &rItem)
Definition: svdobj.cxx:1988
double GetDashLen() const
Definition: xdash.hxx:58
This class represents an embedded or linked bitmap graphic object.
Definition: svdograf.hxx:67
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
std::unique_ptr< SfxItemSet > mpTextAttr
Definition: svdpdf.hxx:55
TextAlign
SdrMetricItem makeSdrTextLeftDistItem(tools::Long mnHeight)
Definition: sdtditm.hxx:25
constexpr Point TopLeft() const
virtual SdrLayerID GetLayer() const
Definition: svdobj.cxx:678
bool HasLineStyle() const
Definition: svdobj.cxx:3045
constexpr auto convertPointToMm100(N n)
static constexpr css::drawing::LineCap gaLineCap
Definition: svdpdf.hxx:60
std::unique_ptr< SfxItemSet > mpFillAttr
Definition: svdpdf.hxx:54
const int mnLayer
void setY(double fY)
void append(const B2DPolygon &rPolygon, sal_uInt32 nCount=1)
SdrObject * Next()
Definition: svditer.hxx:63
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
void setClosed(bool bNew)
constexpr TypedWhichId< SvxCrossedOutItem > EE_CHAR_STRIKEOUT(EE_CHAR_START+6)
SdrObjectUniquePtr ConvertToPolyObj(bool bBezier, bool bLineToArea) const
Definition: svdobj.cxx:2595
constexpr Size GetSize() const
double getMinY() const
double mfScaleX
Definition: svdpdf.hxx:66
constexpr TypedWhichId< SvxFontHeightItem > EE_CHAR_FONTHEIGHT_CTL(EE_CHAR_START+20)
constexpr tools::Long Height() const
std::vector< SdrObject * > maTmpList
Definition: svdpdf.hxx:49
std::shared_ptr< vcl::pdf::PDFium > mpPDFium
Definition: svdpdf.hxx:94
virtual void NbcMove(const Size &rSiz)
The methods Move, Resize, Rotate, Mirror, Shear, SetSnapRect and SetLogicRect call the corresponding ...
Definition: svdobj.cxx:1433
const SfxItemSet & GetMergedItemSet() const
Definition: svdobj.cxx:1978
constexpr TypedWhichId< SvxColorItem > EE_CHAR_COLOR(EE_CHAR_START+0)
void NbcSetText(const OUString &rStr)
Definition: svdotext.cxx:240
constexpr TypedWhichId< SvxWordLineModeItem > EE_CHAR_WLM(EE_CHAR_START+13)
double correctVertOrigin(double offsetPts) const
Correct the vertical coordinate to start at the top.
Definition: svdpdf.hxx:89
virtual SdrObject * CloneSdrObject(SdrModel &rTargetModel) const
Definition: svdobj.cxx:1077
constexpr TypedWhichId< SvxOverlineItem > EE_CHAR_OVERLINE(EE_CHAR_START+29)
std::unique_ptr< SdrObject, SdrObjectFreeOp > SdrObjectUniquePtr
Definition: svdobj.hxx:97
constexpr TypedWhichId< SvxFontItem > EE_CHAR_FONTINFO(EE_CHAR_START+1)
tools::Rectangle maScaleRect
Definition: svdpdf.hxx:51
void DoObjects(SvdProgressInfo *pProgrInfo, sal_uInt32 *pActionsToReport, int nPageIndex)
Definition: svdpdf.cxx:131
void translate(double fX, double fY)
tools::Rectangle PointsToLogic(double left, double right, double top, double bottom) const
Convert PDF points to logic (twips).
Definition: svdpdf.cxx:1043
const basegfx::B2DPolyPolygon & GetPathPoly() const
Definition: svdopath.hxx:141
void ReportInserts(size_t nInsertCount)
Definition: svdetc.cxx:436
virtual void SetSnapRect(const tools::Rectangle &rRect)
Definition: svdobj.cxx:1691
constexpr TypedWhichId< SvxUnderlineItem > EE_CHAR_UNDERLINE(EE_CHAR_START+5)
#define SAL_WARN(area, stream)
double getX() const
constexpr TypedWhichId< SvxFontHeightItem > EE_CHAR_FONTHEIGHT_CJK(EE_CHAR_START+19)
const SfxItemPool & GetItemPool() const
Definition: svdmodel.hxx:311
double getMinX() const
bool isClip() const
Definition: svdpdf.cxx:655
basegfx::B2DHomMatrix maCurrentMatrix
The current transformation matrix, typically used with Form objects.
Definition: svdpdf.hxx:85
const std::shared_ptr< VectorGraphicData > & getVectorGraphicData() const
ScopedVclPtr< VirtualDevice > mpVD
Definition: svdpdf.hxx:50
const Size & GetSizePixel() const
sal_Int32 mnLineWidth
Definition: svdpdf.hxx:59
periodic cubic Spline (ni)
Definition: svdobjkind.hxx:42
SdrModel * mpModel
Definition: svdpdf.hxx:56
virtual OutlinerParaObject * GetOutlinerParaObject() const
Definition: svdobj.cxx:1837
bool isRectangle(const B2DPolygon &rPoly)
bool ReadRawDIB(BitmapEx &rTarget, const unsigned char *pBuf, const ScanlineFormat nFormat, const int nHeight, const int nStride)
sal_uInt16 GetDashes() const
Definition: xdash.hxx:57
sal_uInt32 count() const
constexpr tools::Long GetHeight() const