LibreOffice Module svx (master) 1
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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
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 .
18 */
23#include <sal/config.h>
25#include <memory>
27#include <tools/fract.hxx>
28#include <vcl/virdev.hxx>
29#include <vcl/graph.hxx>
30#include <svx/svdobj.hxx>
31#include <svx/xdash.hxx>
37// Forward Declarations
39class SfxItemSet;
40class SdrObjList;
41class SdrModel;
42class SdrPage;
43class SdrObject;
44class SvdProgressInfo;
46// Helper Class to import PDF
47class ImpSdrPdfImport final
49 std::vector<rtl::Reference<SdrObject>> maTmpList;
52 size_t mnMapScalingOfs; // from here on, not edited with MapScaling
53 std::unique_ptr<SfxItemSet> mpLineAttr;
54 std::unique_ptr<SfxItemSet> mpFillAttr;
55 std::unique_ptr<SfxItemSet> mpTextAttr;
59 sal_Int32 mnLineWidth;
60 static constexpr css::drawing::LineCap gaLineCap = css::drawing::LineCap_BUTT;
63 bool mbMov;
64 bool mbSize;
66 double mfScaleX;
67 double mfScaleY;
73 // to optimize (PenNULL,Brush,DrawPoly),(Pen,BrushNULL,DrawPoly) -> two-in-one
78 // clipregion
81 std::unique_ptr<vcl::pdf::PDFiumDocument> mpPdfDocument;
89 double correctVertOrigin(double offsetPts) const { return mdPageHeightPts - offsetPts; }
91 tools::Rectangle PointsToLogic(double left, double right, double top, double bottom) const;
92 Point PointsToLogic(double x, double y) const;
94 std::shared_ptr<vcl::pdf::PDFium> mpPDFium;
96 // check for clip and evtl. fill maClip
97 void checkClip();
98 bool isClip() const;
100 void ImportPdfObject(std::unique_ptr<vcl::pdf::PDFiumPageObject> const& pPageObject,
101 std::unique_ptr<vcl::pdf::PDFiumTextPage> const& pTextPage,
102 int nPageObjectIndex);
103 void ImportForm(std::unique_ptr<vcl::pdf::PDFiumPageObject> const& pPageObject,
104 std::unique_ptr<vcl::pdf::PDFiumTextPage> const& pTextPage,
105 int nPageObjectIndex);
106 void ImportImage(std::unique_ptr<vcl::pdf::PDFiumPageObject> const& pPageObject,
107 int nPageObjectIndex);
108 void ImportPath(std::unique_ptr<vcl::pdf::PDFiumPageObject> const& pPageObject,
109 int nPageObjectIndex);
110 void ImportText(std::unique_ptr<vcl::pdf::PDFiumPageObject> const& pPageObject,
111 std::unique_ptr<vcl::pdf::PDFiumTextPage> const& pTextPage,
112 int nPageObjectIndex);
113 void InsertTextObject(const Point& rPos, const Size& rSize, const OUString& rStr);
115 void SetupPageScale(const double dPageWidth, const double dPageHeight);
116 void SetAttributes(SdrObject* pObj, bool bForceTextAttr = false);
117 void InsertObj(SdrObject* pObj, bool bScale = true);
118 void MapScaling();
120 // #i73407# reformulation to use new B2DPolygon classes
123 void DoObjects(SvdProgressInfo* pProgrInfo, sal_uInt32* pActionsToReport, int nPageIndex);
125 // Copy assignment is forbidden and not implemented.
130 ImpSdrPdfImport(SdrModel& rModel, SdrLayerID nLay, const tools::Rectangle& rRect,
131 Graphic const& rGraphic);
135 int GetPageCount() const { return mnPageCount; }
136 size_t DoImport(SdrObjList& rDestList, size_t nInsPos, int nPageNumber,
137 SvdProgressInfo* pProgrInfo = nullptr);
142/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::unique_ptr< SfxItemSet > mpFillAttr
Definition: svdpdf.hxx:54
Fraction maScaleY
Definition: svdpdf.hxx:69
void ImportText(std::unique_ptr< vcl::pdf::PDFiumPageObject > const &pPageObject, std::unique_ptr< vcl::pdf::PDFiumTextPage > const &pTextPage, int nPageObjectIndex)
Definition: svdpdf.cxx:699
std::unique_ptr< SfxItemSet > mpTextAttr
Definition: svdpdf.hxx:55
void checkClip()
Definition: svdpdf.cxx:629
std::unique_ptr< vcl::pdf::PDFiumDocument > mpPdfDocument
Definition: svdpdf.hxx:81
ImpSdrPdfImport(const ImpSdrPdfImport &)=delete
tools::Rectangle PointsToLogic(double left, double right, double top, double bottom) const
Convert PDF points to logic (twips).
Definition: svdpdf.cxx:1034
void ImportPath(std::unique_ptr< vcl::pdf::PDFiumPageObject > const &pPageObject, int nPageObjectIndex)
Definition: svdpdf.cxx:912
void InsertObj(SdrObject *pObj, bool bScale=true)
Definition: svdpdf.cxx:396
void InsertTextObject(const Point &rPos, const Size &rSize, const OUString &rStr)
Definition: svdpdf.cxx:774
SdrModel * mpModel
Definition: svdpdf.hxx:56
std::unique_ptr< SfxItemSet > mpLineAttr
Definition: svdpdf.hxx:53
ScopedVclPtr< VirtualDevice > mpVD
Definition: svdpdf.hxx:50
size_t mnMapScalingOfs
Definition: svdpdf.hxx:52
bool CheckLastPolyLineAndFillMerge(const basegfx::B2DPolyPolygon &rPolyPolygon)
Definition: svdpdf.cxx:602
void ImportPdfObject(std::unique_ptr< vcl::pdf::PDFiumPageObject > const &pPageObject, std::unique_ptr< vcl::pdf::PDFiumTextPage > const &pTextPage, int nPageObjectIndex)
Definition: svdpdf.cxx:646
double mfScaleY
Definition: svdpdf.hxx:67
Fraction maScaleX
Definition: svdpdf.hxx:68
void DoObjects(SvdProgressInfo *pProgrInfo, sal_uInt32 *pActionsToReport, int nPageIndex)
Definition: svdpdf.cxx:127
size_t DoImport(SdrObjList &rDestList, size_t nInsPos, int nPageNumber, SvdProgressInfo *pProgrInfo=nullptr)
Definition: svdpdf.cxx:213
void SetAttributes(SdrObject *pObj, bool bForceTextAttr=false)
Definition: svdpdf.cxx:273
void MapScaling()
Definition: svdpdf.cxx:832
bool mbLastObjWasPolyWithoutLine
Definition: svdpdf.hxx:74
Color maOldLineColor
Definition: svdpdf.hxx:58
void ImportForm(std::unique_ptr< vcl::pdf::PDFiumPageObject > const &pPageObject, std::unique_ptr< vcl::pdf::PDFiumTextPage > const &pTextPage, int nPageObjectIndex)
Definition: svdpdf.cxx:678
SdrLayerID mnLayer
Definition: svdpdf.hxx:57
basegfx::B2DHomMatrix maCurrentMatrix
The current transformation matrix, typically used with Form objects.
Definition: svdpdf.hxx:85
sal_Int32 mnLineWidth
Definition: svdpdf.hxx:59
int GetPageCount() const
Definition: svdpdf.hxx:135
void SetupPageScale(const double dPageWidth, const double dPageHeight)
Definition: svdpdf.cxx:169
double mdPageHeightPts
Definition: svdpdf.hxx:83
double correctVertOrigin(double offsetPts) const
Correct the vertical coordinate to start at the top.
Definition: svdpdf.hxx:89
bool isClip() const
Definition: svdpdf.cxx:645
static constexpr css::drawing::LineCap gaLineCap
Definition: svdpdf.hxx:60
bool mbFntDirty
Definition: svdpdf.hxx:71
std::vector< rtl::Reference< SdrObject > > maTmpList
Definition: svdpdf.hxx:49
tools::Rectangle maScaleRect
Definition: svdpdf.hxx:51
std::shared_ptr< vcl::pdf::PDFium > mpPDFium
Definition: svdpdf.hxx:94
void ImportImage(std::unique_ptr< vcl::pdf::PDFiumPageObject > const &pPageObject, int nPageObjectIndex)
Definition: svdpdf.cxx:852
double mfScaleX
Definition: svdpdf.hxx:66
XDash maDash
Definition: svdpdf.hxx:61
basegfx::B2DPolyPolygon maClip
Definition: svdpdf.hxx:79
ImpSdrPdfImport & operator=(const ImpSdrPdfImport &)=delete
Abstract DrawObject.
Definition: svdobj.hxx:261
A SdrPage contains exactly one SdrObjList and a description of the physical page dimensions (size / m...
Definition: svdpage.hxx:377
Helper class for the communication between the dialog In order to break open Metafiles (sd/source/ui/...
Definition: svdetc.hxx:113
Definition: xdash.hxx:32