35#include <com/sun/star/office/XAnnotation.hpp>
36#include <com/sun/star/text/XText.hpp>
51 const OUString aFileName(
54 std::vector<vcl::PDFGraphicResult> aGraphics;
65 for (
size_t i = 0;
i < aGraphics.size() - 1; ++
i)
72 const Graphic& rGraphic = rPDFGraphicResult.GetGraphic();
73 const Size& aSizeHMM = rPDFGraphicResult.GetSize();
89 pSdrGrafObj->SetResizeProtect(
true);
90 pSdrGrafObj->SetMoveProtect(
true);
94 for (
auto const& rPDFAnnotation : rPDFGraphicResult.GetAnnotations())
96 uno::Reference<office::XAnnotation> xAnnotation;
99 xAnnotation->setAuthor(rPDFAnnotation.maAuthor);
101 uno::Reference<text::XText> xText(xAnnotation->getTextRange());
102 xText->setString(rPDFAnnotation.maText);
104 geometry::RealPoint2D aUnoPosition(rPDFAnnotation.maRectangle.getMinX() / 100.0,
105 rPDFAnnotation.maRectangle.getMinY() / 100.00);
106 geometry::RealSize2D aUnoSize(rPDFAnnotation.maRectangle.getWidth() / 100.0,
107 rPDFAnnotation.maRectangle.getHeight() / 100.00);
108 xAnnotation->setPosition(aUnoPosition);
109 xAnnotation->setSize(aUnoSize);
110 xAnnotation->setDateTime(rPDFAnnotation.maDateTime);
112 if (rPDFAnnotation.mpMarker)
114 auto* pAnnotation =
static_cast<sd::Annotation*
>(xAnnotation.get());
117 = pAnnotation->getCustomAnnotationMarker();
119 rCustomAnnotationMarker.
maLineColor = rPDFAnnotation.maColor;
124 rPDFAnnotation.mpMarker.get());
125 rCustomAnnotationMarker.
mnLineWidth = pMarker->mnWidth;
126 rCustomAnnotationMarker.
maFillColor = pMarker->maFillColor;
127 rCustomAnnotationMarker.
maPolygons.push_back(pMarker->maPolygon);
132 rPDFAnnotation.mpMarker.get());
135 rCustomAnnotationMarker.
mnLineWidth = pMarker->mnWidth;
136 rCustomAnnotationMarker.
maFillColor = pMarker->maFillColor;
137 rCustomAnnotationMarker.
maPolygons.push_back(aPoly);
142 rPDFAnnotation.mpMarker.get());
145 double fRadiusX = rPDFAnnotation.maRectangle.getWidth() / 2;
146 double fRadiusY = rPDFAnnotation.maRectangle.getHeight() / 2;
150 rCustomAnnotationMarker.
mnLineWidth = pMarker->mnWidth;
151 rCustomAnnotationMarker.
maFillColor = pMarker->maFillColor;
152 rCustomAnnotationMarker.
maPolygons.push_back(aPoly);
157 rPDFAnnotation.mpMarker.get());
159 rCustomAnnotationMarker.
maPolygons.end(), pMarker->maStrokes.begin(),
160 pMarker->maStrokes.end());
161 rCustomAnnotationMarker.
mnLineWidth = pMarker->mnWidth;
162 rCustomAnnotationMarker.
maFillColor = pMarker->maFillColor;
169 rPDFAnnotation.mpMarker.get());
171 rCustomAnnotationMarker.
maPolygons.end(), pMarker->maQuads.begin(),
172 pMarker->maQuads.end());
174 rCustomAnnotationMarker.
maFillColor = rPDFAnnotation.maColor;
181 rPDFAnnotation.mpMarker.get());
184 aPoly.
append(pMarker->maLineStart);
185 aPoly.
append(pMarker->maLineEnd);
186 rCustomAnnotationMarker.
maPolygons.push_back(aPoly);
188 rCustomAnnotationMarker.
mnLineWidth = pMarker->mnWidth;
194 auto* pAnnotation =
static_cast<sd::Annotation*
>(xAnnotation.get());
bool IsTransparent() const
void SetAlpha(sal_uInt8 nAlpha)
virtual void InsertObject(SdrObject *pObj, size_t nPos=SAL_MAX_SIZE) override
sal_Int32 getPageNumber() const
OUString GetMainURL(DecodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
void CreateFirstPages(SdDrawDocument const *pRefDocument=nullptr)
if the document does not contain at least one handout, one slide and one notes page with at least one...
SAL_DLLPRIVATE sal_uInt16 DuplicatePage(sal_uInt16 nPageNum)
This method acts as a simplified front end for the more complex <member>DuplicatePage()</member> meth...
SdPage * GetSdPage(sal_uInt16 nPgNum, PageKind ePgKind) const
SdDrawDocument & mrDocument
void createAnnotation(css::uno::Reference< css::office::XAnnotation > &xAnnotation)
virtual void SetSize(const Size &aSize) override
SdPdfFilter(SfxMedium &rMedium, ::sd::DrawDocShell &rDocShell)
virtual ~SdPdfFilter() override
void EnableUndo(bool bEnable)
bool IsUndoEnabled() const
SdrModel & getSdrModelFromSdrPage() const
const INetURLObject & GetURLObject() const
void append(const basegfx::B2DPoint &rPoint, sal_uInt32 nCount)
void createCustomAnnotationMarker()
void setIsFreeText(bool value)
constexpr ::Color COL_TRANSPARENT(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
B2DPolygon createPolygonFromRect(const B2DRectangle &rRect, double fRadiusX, double fRadiusY)
B2DPolygon createPolygonFromEllipse(const B2DPoint &rCenter, double fRadiusX, double fRadiusY, sal_uInt32 nStartQuadrant=0)
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
size_t ImportPDFUnloaded(const OUString &rURL, std::vector< PDFGraphicResult > &rGraphics)
std::vector< basegfx::B2DPolygon > maPolygons