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