/src/libreoffice/vcl/source/gdi/pdfwriter.cxx
Line | Count | Source (jump to first uncovered line) |
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 <vcl/bitmapex.hxx> |
21 | | |
22 | | #include <pdf/pdfwriter_impl.hxx> |
23 | | #include <vcl/pdf/PDFEncryptionInitialization.hxx> |
24 | | |
25 | | using namespace vcl; |
26 | | |
27 | | PDFWriter::AnyWidget::~AnyWidget() |
28 | 0 | { |
29 | 0 | } |
30 | | |
31 | | PDFWriter::PDFWriter( const PDFWriter::PDFWriterContext& rContext, const css::uno::Reference< css::beans::XMaterialHolder >& xEnc ) |
32 | | : |
33 | 8.47k | xImplementation( VclPtr<PDFWriterImpl>::Create(rContext, xEnc, *this) ) |
34 | 8.47k | { |
35 | 8.47k | } |
36 | | |
37 | | PDFWriter::~PDFWriter() |
38 | 8.47k | { |
39 | 8.47k | xImplementation.disposeAndClear(); |
40 | 8.47k | } |
41 | | |
42 | | OutputDevice* PDFWriter::GetReferenceDevice() |
43 | 16.9k | { |
44 | 16.9k | return xImplementation.get(); |
45 | 16.9k | } |
46 | | |
47 | | void PDFWriter::NewPage( double nPageWidth, double nPageHeight, Orientation eOrientation ) |
48 | 69.2k | { |
49 | 69.2k | xImplementation->newPage( nPageWidth, nPageHeight, eOrientation ); |
50 | 69.2k | } |
51 | | |
52 | | bool PDFWriter::Emit() |
53 | 8.47k | { |
54 | 8.47k | return xImplementation->emit(); |
55 | 8.47k | } |
56 | | |
57 | | void PDFWriter::SetDocumentLocale( const css::lang::Locale& rLoc ) |
58 | 8.47k | { |
59 | 8.47k | xImplementation->setDocumentLocale( rLoc ); |
60 | 8.47k | } |
61 | | |
62 | | void PDFWriter::SetFont( const vcl::Font& rFont ) |
63 | 958k | { |
64 | 958k | xImplementation->setFont( rFont ); |
65 | 958k | } |
66 | | |
67 | | void PDFWriter::DrawText( const Point& rPos, const OUString& rText ) |
68 | 0 | { |
69 | 0 | xImplementation->drawText( rPos, rText, 0, rText.getLength() ); |
70 | 0 | } |
71 | | |
72 | | void PDFWriter::DrawTextLine( |
73 | | const Point& rPos, |
74 | | tools::Long nWidth, |
75 | | FontStrikeout eStrikeout, |
76 | | FontLineStyle eUnderline, |
77 | | FontLineStyle eOverline ) |
78 | 0 | { |
79 | 0 | xImplementation->drawTextLine( rPos, nWidth, eStrikeout, eUnderline, eOverline, false/*bUnderlineAbove*/ ); |
80 | 0 | } |
81 | | |
82 | | void PDFWriter::DrawTextArray(const Point& rStartPt, const OUString& rStr, KernArraySpan pDXAry, |
83 | | std::span<const sal_Bool> pKashidaAry, sal_Int32 nIndex, |
84 | | sal_Int32 nLen, sal_Int32 nLayoutContextIndex, |
85 | | sal_Int32 nLayoutContextLen) |
86 | 401k | { |
87 | 401k | xImplementation->drawTextArray(rStartPt, rStr, pDXAry, pKashidaAry, nIndex, nLen, |
88 | 401k | nLayoutContextIndex, nLayoutContextLen); |
89 | 401k | } |
90 | | |
91 | | void PDFWriter::DrawStretchText( |
92 | | const Point& rStartPt, |
93 | | sal_Int32 nWidth, |
94 | | const OUString& rStr, |
95 | | sal_Int32 nIndex, |
96 | | sal_Int32 nLen ) |
97 | 6 | { |
98 | 6 | xImplementation->drawStretchText( rStartPt, nWidth, rStr, nIndex, nLen ); |
99 | 6 | } |
100 | | |
101 | | void PDFWriter::DrawText( |
102 | | const tools::Rectangle& rRect, |
103 | | const OUString& rStr, |
104 | | DrawTextFlags nStyle ) |
105 | 0 | { |
106 | 0 | xImplementation->drawText( rRect, rStr, nStyle ); |
107 | 0 | } |
108 | | |
109 | | void PDFWriter::DrawLine( const Point& rStart, const Point& rStop ) |
110 | 0 | { |
111 | 0 | xImplementation->drawLine( rStart, rStop ); |
112 | 0 | } |
113 | | |
114 | | void PDFWriter::DrawLine( const Point& rStart, const Point& rStop, const LineInfo& rInfo ) |
115 | 0 | { |
116 | 0 | xImplementation->drawLine( rStart, rStop, rInfo ); |
117 | 0 | } |
118 | | |
119 | | void PDFWriter::DrawPolygon( const tools::Polygon& rPoly ) |
120 | 0 | { |
121 | 0 | xImplementation->drawPolygon( rPoly ); |
122 | 0 | } |
123 | | |
124 | | void PDFWriter::DrawPolyLine( const tools::Polygon& rPoly ) |
125 | 1 | { |
126 | 1 | xImplementation->drawPolyLine( rPoly ); |
127 | 1 | } |
128 | | |
129 | | void PDFWriter::DrawRect( const tools::Rectangle& rRect ) |
130 | 69.2k | { |
131 | 69.2k | xImplementation->drawRectangle( rRect ); |
132 | 69.2k | } |
133 | | |
134 | | void PDFWriter::DrawRect( const tools::Rectangle& rRect, sal_uInt32 nHorzRound, sal_uInt32 nVertRound ) |
135 | 0 | { |
136 | 0 | xImplementation->drawRectangle( rRect, nHorzRound, nVertRound ); |
137 | 0 | } |
138 | | |
139 | | void PDFWriter::DrawEllipse( const tools::Rectangle& rRect ) |
140 | 0 | { |
141 | 0 | xImplementation->drawEllipse( rRect ); |
142 | 0 | } |
143 | | |
144 | | void PDFWriter::DrawArc( const tools::Rectangle& rRect, const Point& rStart, const Point& rStop ) |
145 | 0 | { |
146 | 0 | xImplementation->drawArc( rRect, rStart, rStop, false, false ); |
147 | 0 | } |
148 | | |
149 | | void PDFWriter::DrawPie( const tools::Rectangle& rRect, const Point& rStart, const Point& rStop ) |
150 | 0 | { |
151 | 0 | xImplementation->drawArc( rRect, rStart, rStop, true, false ); |
152 | 0 | } |
153 | | |
154 | | void PDFWriter::DrawChord( const tools::Rectangle& rRect, const Point& rStart, const Point& rStop ) |
155 | 0 | { |
156 | 0 | xImplementation->drawArc( rRect, rStart, rStop, false, true ); |
157 | 0 | } |
158 | | |
159 | | void PDFWriter::DrawPolyLine( const tools::Polygon& rPoly, const LineInfo& rInfo ) |
160 | 0 | { |
161 | 0 | xImplementation->drawPolyLine( rPoly, rInfo ); |
162 | 0 | } |
163 | | |
164 | | void PDFWriter::DrawPolyLine( const tools::Polygon& rPoly, const ExtLineInfo& rInfo ) |
165 | 2.71k | { |
166 | 2.71k | xImplementation->drawPolyLine( rPoly, rInfo ); |
167 | 2.71k | } |
168 | | |
169 | | void PDFWriter::DrawPolyPolygon( const tools::PolyPolygon& rPolyPoly ) |
170 | 1.38k | { |
171 | 1.38k | xImplementation->drawPolyPolygon( rPolyPoly ); |
172 | 1.38k | } |
173 | | |
174 | | void PDFWriter::DrawPixel( const Point& rPos, const Color& rColor ) |
175 | 0 | { |
176 | 0 | xImplementation->drawPixel( rPos, rColor ); |
177 | 0 | } |
178 | | |
179 | | void PDFWriter::DrawBitmap( const Point& rDestPt, const Size& rDestSize, const Bitmap& rBitmap, const Graphic& rGraphic ) |
180 | 0 | { |
181 | 0 | xImplementation->drawBitmap( rDestPt, rDestSize, rBitmap, rGraphic ); |
182 | 0 | } |
183 | | |
184 | | void PDFWriter::DrawBitmapEx( const Point& rDestPt, const Size& rDestSize, const BitmapEx& rBitmap ) |
185 | 0 | { |
186 | 0 | xImplementation->drawBitmap( rDestPt, rDestSize, rBitmap ); |
187 | 0 | } |
188 | | |
189 | | void PDFWriter::DrawHatch( const tools::PolyPolygon& rPolyPoly, const Hatch& rHatch ) |
190 | 0 | { |
191 | 0 | xImplementation->drawHatch( rPolyPoly, rHatch ); |
192 | 0 | } |
193 | | |
194 | | void PDFWriter::DrawGradient( const tools::Rectangle& rRect, const Gradient& rGradient ) |
195 | 0 | { |
196 | 0 | xImplementation->drawGradient( rRect, rGradient ); |
197 | 0 | } |
198 | | |
199 | | void PDFWriter::DrawGradient( const tools::PolyPolygon& rPolyPoly, const Gradient& rGradient ) |
200 | 0 | { |
201 | 0 | xImplementation->push(PushFlags::CLIPREGION); |
202 | 0 | xImplementation->setClipRegion( rPolyPoly.getB2DPolyPolygon() ); |
203 | 0 | xImplementation->drawGradient( rPolyPoly.GetBoundRect(), rGradient ); |
204 | 0 | xImplementation->pop(); |
205 | 0 | } |
206 | | |
207 | | void PDFWriter::DrawWallpaper( const tools::Rectangle& rRect, const Wallpaper& rWallpaper ) |
208 | 0 | { |
209 | 0 | xImplementation->drawWallpaper( rRect, rWallpaper ); |
210 | 0 | } |
211 | | |
212 | | void PDFWriter::DrawTransparent( const tools::PolyPolygon& rPolyPoly, sal_uInt16 nTransparencePercent ) |
213 | 0 | { |
214 | 0 | xImplementation->drawTransparent( rPolyPoly, nTransparencePercent ); |
215 | 0 | } |
216 | | |
217 | | void PDFWriter::BeginTransparencyGroup() |
218 | 14 | { |
219 | 14 | xImplementation->beginTransparencyGroup(); |
220 | 14 | } |
221 | | |
222 | | void PDFWriter::EndTransparencyGroup( const tools::Rectangle& rRect, sal_uInt16 nTransparentPercent ) |
223 | 14 | { |
224 | 14 | xImplementation->endTransparencyGroup( rRect, nTransparentPercent ); |
225 | 14 | } |
226 | | |
227 | | void PDFWriter::Push( PushFlags nFlags ) |
228 | 588k | { |
229 | 588k | xImplementation->push( nFlags ); |
230 | 588k | } |
231 | | |
232 | | void PDFWriter::Pop() |
233 | 588k | { |
234 | 588k | xImplementation->pop(); |
235 | 588k | } |
236 | | |
237 | | void PDFWriter::SetMapMode( const MapMode& rMapMode ) |
238 | 369k | { |
239 | 369k | xImplementation->setMapMode( rMapMode ); |
240 | 369k | } |
241 | | |
242 | | void PDFWriter::SetLineColor( const Color& rColor ) |
243 | 283k | { |
244 | 283k | xImplementation->setLineColor( rColor ); |
245 | 283k | } |
246 | | |
247 | | void PDFWriter::SetFillColor( const Color& rColor ) |
248 | 143k | { |
249 | 143k | xImplementation->setFillColor( rColor ); |
250 | 143k | } |
251 | | |
252 | | void PDFWriter::SetClipRegion() |
253 | 1.22k | { |
254 | 1.22k | xImplementation->clearClipRegion(); |
255 | 1.22k | } |
256 | | |
257 | | void PDFWriter::SetClipRegion( const basegfx::B2DPolyPolygon& rRegion ) |
258 | 69.9k | { |
259 | 69.9k | xImplementation->setClipRegion( rRegion ); |
260 | 69.9k | } |
261 | | |
262 | | void PDFWriter::MoveClipRegion( tools::Long nHorzMove, tools::Long nVertMove ) |
263 | 0 | { |
264 | 0 | xImplementation->moveClipRegion( nHorzMove, nVertMove ); |
265 | 0 | } |
266 | | |
267 | | void PDFWriter::IntersectClipRegion( const basegfx::B2DPolyPolygon& rRegion ) |
268 | 210k | { |
269 | 210k | xImplementation->intersectClipRegion( rRegion ); |
270 | 210k | } |
271 | | |
272 | | void PDFWriter::IntersectClipRegion( const tools::Rectangle& rRect ) |
273 | 512 | { |
274 | 512 | xImplementation->intersectClipRegion( rRect ); |
275 | 512 | } |
276 | | |
277 | | void PDFWriter::SetLayoutMode( vcl::text::ComplexTextLayoutFlags nMode ) |
278 | 899k | { |
279 | 899k | xImplementation->setLayoutMode( nMode ); |
280 | 899k | } |
281 | | |
282 | | void PDFWriter::SetDigitLanguage( LanguageType eLang ) |
283 | 875k | { |
284 | 875k | xImplementation->setDigitLanguage( eLang ); |
285 | 875k | } |
286 | | |
287 | | void PDFWriter::SetTextColor( const Color& rColor ) |
288 | 405k | { |
289 | 405k | xImplementation->setTextColor( rColor ); |
290 | 405k | } |
291 | | |
292 | | void PDFWriter::SetTextFillColor() |
293 | 958k | { |
294 | 958k | xImplementation->setTextFillColor(); |
295 | 958k | } |
296 | | |
297 | | void PDFWriter::SetTextFillColor( const Color& rColor ) |
298 | 0 | { |
299 | 0 | xImplementation->setTextFillColor( rColor ); |
300 | 0 | } |
301 | | |
302 | | void PDFWriter::SetTextLineColor() |
303 | 8 | { |
304 | 8 | xImplementation->setTextLineColor(); |
305 | 8 | } |
306 | | |
307 | | void PDFWriter::SetTextLineColor( const Color& rColor ) |
308 | 26 | { |
309 | 26 | xImplementation->setTextLineColor( rColor ); |
310 | 26 | } |
311 | | |
312 | | void PDFWriter::SetOverlineColor() |
313 | 8 | { |
314 | 8 | xImplementation->setOverlineColor(); |
315 | 8 | } |
316 | | |
317 | | void PDFWriter::SetOverlineColor( const Color& rColor ) |
318 | 26 | { |
319 | 26 | xImplementation->setOverlineColor( rColor ); |
320 | 26 | } |
321 | | |
322 | | void PDFWriter::SetTextAlign( ::TextAlign eAlign ) |
323 | 958k | { |
324 | 958k | xImplementation->setTextAlign( eAlign ); |
325 | 958k | } |
326 | | |
327 | | void PDFWriter::DrawJPGBitmap( SvStream& rStreamData, bool bIsTrueColor, const Size& rSrcSizePixel, const tools::Rectangle& rTargetArea, const AlphaMask& rAlphaMask, const Graphic& rGraphic ) |
328 | 0 | { |
329 | 0 | xImplementation->drawJPGBitmap( rStreamData, bIsTrueColor, rSrcSizePixel, rTargetArea, rAlphaMask, rGraphic ); |
330 | 0 | } |
331 | | |
332 | | sal_Int32 PDFWriter::CreateLink(const tools::Rectangle& rRect, sal_Int32 nPageNr, OUString const& rAltText) |
333 | 1.24k | { |
334 | 1.24k | return xImplementation->createLink(rRect, nPageNr, rAltText); |
335 | 1.24k | } |
336 | | |
337 | | sal_Int32 PDFWriter::CreateScreen(const tools::Rectangle& rRect, sal_Int32 nPageNr, OUString const& rAltText, OUString const& rMimeType) |
338 | 0 | { |
339 | 0 | return xImplementation->createScreen(rRect, nPageNr, rAltText, rMimeType); |
340 | 0 | } |
341 | | |
342 | | sal_Int32 PDFWriter::RegisterDestReference( sal_Int32 nDestId, const tools::Rectangle& rRect, sal_Int32 nPageNr, DestAreaType eType ) |
343 | 0 | { |
344 | 0 | return xImplementation->registerDestReference( nDestId, rRect, nPageNr, eType ); |
345 | 0 | } |
346 | | //--->i56629 |
347 | | sal_Int32 PDFWriter::CreateNamedDest( const OUString& sDestName, const tools::Rectangle& rRect, sal_Int32 nPageNr, PDFWriter::DestAreaType eType ) |
348 | 0 | { |
349 | 0 | return xImplementation->createNamedDest( sDestName, rRect, nPageNr, eType ); |
350 | 0 | } |
351 | | sal_Int32 PDFWriter::CreateDest( const tools::Rectangle& rRect, sal_Int32 nPageNr, PDFWriter::DestAreaType eType ) |
352 | 2.35k | { |
353 | 2.35k | return xImplementation->createDest( rRect, nPageNr, eType ); |
354 | 2.35k | } |
355 | | |
356 | | void PDFWriter::SetLinkDest( sal_Int32 nLinkId, sal_Int32 nDestId ) |
357 | 1.20k | { |
358 | 1.20k | xImplementation->setLinkDest( nLinkId, nDestId ); |
359 | 1.20k | } |
360 | | |
361 | | void PDFWriter::SetLinkURL( sal_Int32 nLinkId, const OUString& rURL ) |
362 | 40 | { |
363 | 40 | xImplementation->setLinkURL( nLinkId, rURL ); |
364 | 40 | } |
365 | | |
366 | | void PDFWriter::SetScreenURL(sal_Int32 nScreenId, const OUString& rURL) |
367 | 0 | { |
368 | 0 | xImplementation->setScreenURL(nScreenId, rURL); |
369 | 0 | } |
370 | | |
371 | | void PDFWriter::SetScreenStream(sal_Int32 nScreenId, const OUString& rURL) |
372 | 0 | { |
373 | 0 | xImplementation->setScreenStream(nScreenId, rURL); |
374 | 0 | } |
375 | | |
376 | | void PDFWriter::SetLinkPropertyID( sal_Int32 nLinkId, sal_Int32 nPropertyId ) |
377 | 1.25k | { |
378 | 1.25k | xImplementation->setLinkPropertyId( nLinkId, nPropertyId ); |
379 | 1.25k | } |
380 | | |
381 | | sal_Int32 PDFWriter::CreateOutlineItem( sal_Int32 nParent, std::u16string_view rText, sal_Int32 nDestID ) |
382 | 1.14k | { |
383 | 1.14k | return xImplementation->createOutlineItem( nParent, rText, nDestID ); |
384 | 1.14k | } |
385 | | |
386 | | sal_Int32 PDFWriter::CreateNote(const tools::Rectangle& rRect, const tools::Rectangle& rPopupRect, |
387 | | const PDFNote& rNote, sal_Int32 nPageNr) |
388 | 3 | { |
389 | 3 | return xImplementation->createNote(rRect, rPopupRect, rNote, nPageNr); |
390 | 3 | } |
391 | | |
392 | | sal_Int32 PDFWriter::EnsureStructureElement() |
393 | 10 | { |
394 | 10 | return xImplementation->ensureStructureElement(); |
395 | 10 | } |
396 | | |
397 | | void PDFWriter::InitStructureElement(sal_Int32 const id, |
398 | | vcl::pdf::StructElement const eType, std::u16string_view const rAlias) |
399 | 10 | { |
400 | 10 | return xImplementation->initStructureElement(id, eType, rAlias); |
401 | 10 | } |
402 | | |
403 | | void PDFWriter::BeginStructureElement(sal_Int32 const id) |
404 | 10 | { |
405 | 10 | return xImplementation->beginStructureElement(id); |
406 | 10 | } |
407 | | |
408 | | void PDFWriter::EndStructureElement() |
409 | 10 | { |
410 | 10 | xImplementation->endStructureElement(); |
411 | 10 | } |
412 | | |
413 | | void PDFWriter::SetCurrentStructureElement( sal_Int32 nID ) |
414 | 0 | { |
415 | 0 | xImplementation->setCurrentStructureElement( nID ); |
416 | 0 | } |
417 | | |
418 | | void PDFWriter::SetStructureAttribute( enum StructAttribute eAttr, enum StructAttributeValue eVal ) |
419 | 0 | { |
420 | 0 | xImplementation->setStructureAttribute( eAttr, eVal ); |
421 | 0 | } |
422 | | |
423 | | void PDFWriter::SetStructureAttributeNumerical( enum StructAttribute eAttr, sal_Int32 nValue ) |
424 | 0 | { |
425 | 0 | xImplementation->setStructureAttributeNumerical( eAttr, nValue ); |
426 | 0 | } |
427 | | |
428 | | void PDFWriter::SetStructureBoundingBox( const tools::Rectangle& rRect ) |
429 | 0 | { |
430 | 0 | xImplementation->setStructureBoundingBox( rRect ); |
431 | 0 | } |
432 | | |
433 | | void PDFWriter::SetStructureAnnotIds(::std::vector<sal_Int32> const& rAnnotIds) |
434 | 0 | { |
435 | 0 | xImplementation->setStructureAnnotIds(rAnnotIds); |
436 | 0 | } |
437 | | |
438 | | void PDFWriter::SetActualText( const OUString& rText ) |
439 | 0 | { |
440 | 0 | xImplementation->setActualText( rText ); |
441 | 0 | } |
442 | | |
443 | | void PDFWriter::SetAlternateText( const OUString& rText ) |
444 | 0 | { |
445 | 0 | xImplementation->setAlternateText( rText ); |
446 | 0 | } |
447 | | |
448 | | void PDFWriter::SetPageTransition( PDFWriter::PageTransition eType, sal_uInt32 nMilliSec, sal_Int32 nPageNr ) |
449 | 0 | { |
450 | 0 | xImplementation->setPageTransition( eType, nMilliSec, nPageNr ); |
451 | 0 | } |
452 | | |
453 | | sal_Int32 PDFWriter::CreateControl( const PDFWriter::AnyWidget& rControl ) |
454 | 0 | { |
455 | 0 | return xImplementation->createControl( rControl ); |
456 | 0 | } |
457 | | |
458 | | PDFOutputStream::~PDFOutputStream() |
459 | 0 | { |
460 | 0 | } |
461 | | |
462 | | void PDFWriter::AddAttachedFile(OUString const& rFileName, OUString const& rMimeType, OUString const& rDescription, std::unique_ptr<PDFOutputStream> pStream) |
463 | 0 | { |
464 | 0 | xImplementation->addDocumentAttachedFile(rFileName, rMimeType, rDescription, std::move(pStream)); |
465 | 0 | } |
466 | | |
467 | | std::set< PDFWriter::ErrorCode > const & PDFWriter::GetErrors() const |
468 | 8.47k | { |
469 | 8.47k | return xImplementation->getErrors(); |
470 | 8.47k | } |
471 | | |
472 | | void PDFWriter::PlayMetafile( const GDIMetaFile& i_rMTF, const vcl::PDFWriter::PlayMetafileContext& i_rPlayContext, PDFExtOutDevData* i_pData ) |
473 | 69.2k | { |
474 | 69.2k | xImplementation->playMetafile( i_rMTF, i_pData, i_rPlayContext ); |
475 | 69.2k | } |
476 | | |
477 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |