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