LibreOffice Module vcl (master) 1
pdfextoutdevdata.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 <vcl/canvastools.hxx>
22#include <vcl/graph.hxx>
23#include <vcl/outdev.hxx>
24#include <vcl/gfxlink.hxx>
25#include <vcl/metaact.hxx>
26#include <vcl/graphicfilter.hxx>
29#include <sal/log.hxx>
30#include <o3tl/safeint.hxx>
31#include <osl/diagnose.h>
32#include <tools/stream.hxx>
33
34#include <memory>
35#include <map>
36
37namespace vcl
38{
39namespace {
40
41struct PDFExtOutDevDataSync
42{
43 enum Action{ CreateNamedDest,
44 CreateDest,
45 CreateLink,
46 CreateScreen,
47 SetLinkDest,
48 SetLinkURL,
49 SetScreenURL,
50 SetScreenStream,
51 RegisterDest,
52 CreateOutlineItem,
53 CreateNote,
54 SetPageTransition,
55
56 EnsureStructureElement,
57 InitStructureElement,
58 BeginStructureElement,
59 EndStructureElement,
60 SetCurrentStructureElement,
61 SetStructureAttribute,
62 SetStructureAttributeNumerical,
63 SetStructureBoundingBox,
64 SetStructureAnnotIds,
65 SetActualText,
66 SetAlternateText,
67 CreateControl,
68 BeginGroup,
69 EndGroupGfxLink
70 };
71
72 sal_uInt32 nIdx;
73 Action eAct;
74};
75
76struct PDFLinkDestination
77{
78 tools::Rectangle mRect;
79 MapMode mMapMode;
80 sal_Int32 mPageNr;
82};
83
84}
85
87{
88 std::deque< PDFExtOutDevDataSync::Action > mActions;
89 std::deque< MapMode > mParaMapModes;
90 std::deque< tools::Rectangle > mParaRects;
91 std::deque< sal_Int32 > mParaInts;
92 std::deque< sal_uInt32 > mParauInts;
93 std::deque< OUString > mParaOUStrings;
94 std::deque< PDFWriter::DestAreaType > mParaDestAreaTypes;
95 std::deque< PDFNote > mParaPDFNotes;
96 std::deque< PDFWriter::PageTransition > mParaPageTransitions;
97 ::std::map< sal_Int32, PDFLinkDestination > mFutureDestinations;
98
99 sal_Int32 GetMappedId();
100
105 sal_Int32 mCurId;
106 std::vector< sal_Int32 > mParaIds;
107 std::map<void const*, sal_Int32> mSEMap;
108
110 std::vector< sal_Int32 > mStructParents;
112 mCurId ( 0 ),
114 {
115 mStructParents.push_back(0); // because PDFWriterImpl has a dummy root
116 }
117 void PlayGlobalActions( PDFWriter& rWriter );
118};
119
121{
122 sal_Int32 nLinkId = mParaInts.front();
123 mParaInts.pop_front();
124
125 /* negative values are intentionally passed as invalid IDs
126 * e.g. to create a new top level outline item
127 */
128 if( nLinkId >= 0 )
129 {
130 if ( o3tl::make_unsigned(nLinkId) < mParaIds.size() )
131 nLinkId = mParaIds[ nLinkId ];
132 else
133 nLinkId = -1;
134
135 SAL_WARN_IF( nLinkId < 0, "vcl", "unmapped id in GlobalSyncData" );
136 }
137
138 return nLinkId;
139}
140
142{
143 for (auto const& action : mActions)
144 {
145 switch (action)
146 {
147 case PDFExtOutDevDataSync::CreateNamedDest : //i56629
148 {
149 rWriter.Push( PushFlags::MAPMODE );
150 rWriter.SetMapMode( mParaMapModes.front() );
151 mParaMapModes.pop_front();
152 mParaIds.push_back( rWriter.CreateNamedDest( mParaOUStrings.front(), mParaRects.front(), mParaInts.front(), mParaDestAreaTypes.front() ) );
153 mParaOUStrings.pop_front();
154 mParaRects.pop_front();
155 mParaInts.pop_front();
156 mParaDestAreaTypes.pop_front();
157 rWriter.Pop();
158 }
159 break;
160 case PDFExtOutDevDataSync::CreateDest :
161 {
162 rWriter.Push( PushFlags::MAPMODE );
163 rWriter.SetMapMode( mParaMapModes.front() );
164 mParaMapModes.pop_front();
165 mParaIds.push_back( rWriter.CreateDest( mParaRects.front(), mParaInts.front(), mParaDestAreaTypes.front() ) );
166 mParaRects.pop_front();
167 mParaInts.pop_front();
168 mParaDestAreaTypes.pop_front();
169 rWriter.Pop();
170 }
171 break;
172 case PDFExtOutDevDataSync::CreateLink :
173 {
174 rWriter.Push( PushFlags::MAPMODE );
175 rWriter.SetMapMode( mParaMapModes.front() );
176 mParaMapModes.pop_front();
177 mParaIds.push_back( rWriter.CreateLink(mParaRects.front(), mParaInts.front(), mParaOUStrings.front()) );
178 // resolve LinkAnnotation structural attribute
179 rWriter.SetLinkPropertyID( mParaIds.back(), sal_Int32(mParaIds.size()-1) );
180 mParaRects.pop_front();
181 mParaInts.pop_front();
182 mParaOUStrings.pop_front();
183 rWriter.Pop();
184 }
185 break;
186 case PDFExtOutDevDataSync::CreateScreen:
187 {
188 rWriter.Push(PushFlags::MAPMODE);
189 rWriter.SetMapMode(mParaMapModes.front());
190 mParaMapModes.pop_front();
191 OUString const altText(mParaOUStrings.front());
192 mParaOUStrings.pop_front();
193 OUString const mimeType(mParaOUStrings.front());
194 mParaOUStrings.pop_front();
195 mParaIds.push_back(rWriter.CreateScreen(mParaRects.front(), mParaInts.front(), altText, mimeType));
196 // resolve AnnotIds structural attribute
197 rWriter.SetLinkPropertyID(mParaIds.back(), sal_Int32(mParaIds.size()-1));
198 mParaRects.pop_front();
199 mParaInts.pop_front();
200 rWriter.Pop();
201 }
202 break;
203 case PDFExtOutDevDataSync::SetLinkDest :
204 {
205 sal_Int32 nLinkId = GetMappedId();
206 sal_Int32 nDestId = GetMappedId();
207 rWriter.SetLinkDest( nLinkId, nDestId );
208 }
209 break;
210 case PDFExtOutDevDataSync::SetLinkURL :
211 {
212 sal_Int32 nLinkId = GetMappedId();
213 rWriter.SetLinkURL( nLinkId, mParaOUStrings.front() );
214 mParaOUStrings.pop_front();
215 }
216 break;
217 case PDFExtOutDevDataSync::SetScreenURL:
218 {
219 sal_Int32 nScreenId = GetMappedId();
220 rWriter.SetScreenURL(nScreenId, mParaOUStrings.front());
221 mParaOUStrings.pop_front();
222 }
223 break;
224 case PDFExtOutDevDataSync::SetScreenStream:
225 {
226 sal_Int32 nScreenId = GetMappedId();
227 rWriter.SetScreenStream(nScreenId, mParaOUStrings.front());
228 mParaOUStrings.pop_front();
229 }
230 break;
231 case PDFExtOutDevDataSync::RegisterDest :
232 {
233 const sal_Int32 nDestId = mParaInts.front();
234 mParaInts.pop_front();
235 OSL_ENSURE( mFutureDestinations.find( nDestId ) != mFutureDestinations.end(),
236 "GlobalSyncData::PlayGlobalActions: DescribeRegisteredRequest has not been called for that destination!" );
237
238 PDFLinkDestination& rDest = mFutureDestinations[ nDestId ];
239
240 rWriter.Push( PushFlags::MAPMODE );
241 rWriter.SetMapMode( rDest.mMapMode );
242 mParaIds.push_back( rWriter.RegisterDestReference( nDestId, rDest.mRect, rDest.mPageNr, rDest.mAreaType ) );
243 rWriter.Pop();
244 }
245 break;
246 case PDFExtOutDevDataSync::CreateOutlineItem :
247 {
248 sal_Int32 nParent = GetMappedId();
249 sal_Int32 nLinkId = GetMappedId();
250 mParaIds.push_back( rWriter.CreateOutlineItem( nParent, mParaOUStrings.front(), nLinkId ) );
251 mParaOUStrings.pop_front();
252 }
253 break;
254 case PDFExtOutDevDataSync::CreateNote :
255 {
256 rWriter.Push( PushFlags::MAPMODE );
257 rWriter.SetMapMode( mParaMapModes.front() );
258 rWriter.CreateNote( mParaRects.front(), mParaPDFNotes.front(), mParaInts.front() );
259 mParaMapModes.pop_front();
260 mParaRects.pop_front();
261 mParaPDFNotes.pop_front();
262 mParaInts.pop_front();
263 }
264 break;
265 case PDFExtOutDevDataSync::SetPageTransition :
266 {
267 rWriter.SetPageTransition( mParaPageTransitions.front(), mParauInts.front(), mParaInts.front() );
268 mParaPageTransitions.pop_front();
269 mParauInts.pop_front();
270 mParaInts.pop_front();
271 }
272 break;
273 case PDFExtOutDevDataSync::EnsureStructureElement:
274 case PDFExtOutDevDataSync::InitStructureElement:
275 case PDFExtOutDevDataSync::BeginStructureElement:
276 case PDFExtOutDevDataSync::EndStructureElement:
277 case PDFExtOutDevDataSync::SetCurrentStructureElement:
278 case PDFExtOutDevDataSync::SetStructureAttribute:
279 case PDFExtOutDevDataSync::SetStructureAttributeNumerical:
280 case PDFExtOutDevDataSync::SetStructureBoundingBox:
281 case PDFExtOutDevDataSync::SetStructureAnnotIds:
282 case PDFExtOutDevDataSync::SetActualText:
283 case PDFExtOutDevDataSync::SetAlternateText:
284 case PDFExtOutDevDataSync::CreateControl:
285 case PDFExtOutDevDataSync::BeginGroup:
286 case PDFExtOutDevDataSync::EndGroupGfxLink:
287 break;
288 }
289 }
290}
291
293{
294 std::deque< PDFExtOutDevDataSync > mActions;
295 std::deque< tools::Rectangle > mParaRects;
296 std::deque< sal_Int32 > mParaInts;
297 std::deque< OUString > mParaOUStrings;
298 std::deque< PDFWriter::StructElement > mParaStructElements;
299 std::deque< PDFWriter::StructAttribute > mParaStructAttributes;
300 std::deque< PDFWriter::StructAttributeValue > mParaStructAttributeValues;
301 std::deque< Graphic > mGraphics;
303 std::deque< std::shared_ptr< PDFWriter::AnyWidget > >
306
308
309
310 explicit PageSyncData( GlobalSyncData* pGlobal )
312 { mpGlobalData = pGlobal; }
313
314 void PushAction( const OutputDevice& rOutDev, const PDFExtOutDevDataSync::Action eAct );
315 bool PlaySyncPageAct( PDFWriter& rWriter, sal_uInt32& rCurGDIMtfAction, const GDIMetaFile& rMtf, const PDFExtOutDevData& rOutDevData );
316};
317
318void PageSyncData::PushAction( const OutputDevice& rOutDev, const PDFExtOutDevDataSync::Action eAct )
319{
320 GDIMetaFile* pMtf = rOutDev.GetConnectMetaFile();
321 SAL_WARN_IF( !pMtf, "vcl", "PageSyncData::PushAction -> no ConnectMetaFile !!!" );
322
323 PDFExtOutDevDataSync aSync;
324 aSync.eAct = eAct;
325 if ( pMtf )
326 aSync.nIdx = pMtf->GetActionSize();
327 else
328 aSync.nIdx = 0x7fffffff; // sync not possible
329 mActions.push_back( aSync );
330}
331bool PageSyncData::PlaySyncPageAct( PDFWriter& rWriter, sal_uInt32& rCurGDIMtfAction, const GDIMetaFile& rMtf, const PDFExtOutDevData& rOutDevData )
332{
333 bool bRet = false;
334 if ( !mActions.empty() && ( mActions.front().nIdx == rCurGDIMtfAction ) )
335 {
336 bRet = true;
337 PDFExtOutDevDataSync aDataSync = mActions.front();
338 mActions.pop_front();
339 switch( aDataSync.eAct )
340 {
341 case PDFExtOutDevDataSync::EnsureStructureElement:
342 {
343#ifndef NDEBUG
344 sal_Int32 const id =
345#endif
346 rWriter.EnsureStructureElement();
347 assert(id == -1 || id == mParaInts.front()); // identity mapping
348 mParaInts.pop_front();
349 }
350 break;
351 case PDFExtOutDevDataSync::InitStructureElement:
352 {
353 rWriter.InitStructureElement(mParaInts.front(), mParaStructElements.front(), mParaOUStrings.front());
354 mParaInts.pop_front();
355 mParaStructElements.pop_front();
356 mParaOUStrings.pop_front();
357 }
358 break;
359 case PDFExtOutDevDataSync::BeginStructureElement :
360 {
361 rWriter.BeginStructureElement(mParaInts.front());
362 mParaInts.pop_front();
363 }
364 break;
365 case PDFExtOutDevDataSync::EndStructureElement :
366 {
367 rWriter.EndStructureElement();
368 }
369 break;
370 case PDFExtOutDevDataSync::SetCurrentStructureElement:
371 {
372 rWriter.SetCurrentStructureElement(mParaInts.front());
373 mParaInts.pop_front();
374 }
375 break;
376 case PDFExtOutDevDataSync::SetStructureAttribute :
377 {
379 mParaStructAttributeValues.pop_front();
380 mParaStructAttributes.pop_front();
381 }
382 break;
383 case PDFExtOutDevDataSync::SetStructureAttributeNumerical :
384 {
386 mParaStructAttributes.pop_front();
387 mParaInts.pop_front();
388 }
389 break;
390 case PDFExtOutDevDataSync::SetStructureBoundingBox :
391 {
392 rWriter.SetStructureBoundingBox( mParaRects.front() );
393 mParaRects.pop_front();
394 }
395 break;
396 case PDFExtOutDevDataSync::SetStructureAnnotIds:
397 {
398 ::std::vector<sal_Int32> annotIds;
399 auto size(mParaInts.front());
400 mParaInts.pop_front();
401 for (auto i = 0; i < size; ++i)
402 {
403 annotIds.push_back(mParaInts.front());
404 mParaInts.pop_front();
405 }
406 rWriter.SetStructureAnnotIds(annotIds);
407 }
408 break;
409 case PDFExtOutDevDataSync::SetActualText :
410 {
411 rWriter.SetActualText( mParaOUStrings.front() );
412 mParaOUStrings.pop_front();
413 }
414 break;
415 case PDFExtOutDevDataSync::SetAlternateText :
416 {
417 rWriter.SetAlternateText( mParaOUStrings.front() );
418 mParaOUStrings.pop_front();
419 }
420 break;
421 case PDFExtOutDevDataSync::CreateControl:
422 {
423 std::shared_ptr< PDFWriter::AnyWidget > pControl( mControls.front() );
424 SAL_WARN_IF( !pControl, "vcl", "PageSyncData::PlaySyncPageAct: invalid widget!" );
425 if ( pControl )
426 {
427 sal_Int32 const n = rWriter.CreateControl(*pControl);
428 // resolve AnnotIds structural attribute
429 ::std::vector<sal_Int32> const annotIds{ sal_Int32(mpGlobalData->mParaIds.size()) };
430 rWriter.SetStructureAnnotIds(annotIds);
431 rWriter.SetLinkPropertyID(n, sal_Int32(mpGlobalData->mParaIds.size()));
432 mpGlobalData->mParaIds.push_back(n);
433 }
434 mControls.pop_front();
435 }
436 break;
437 case PDFExtOutDevDataSync::BeginGroup :
438 {
439 /* first determining if this BeginGroup is starting a GfxLink,
440 by searching for an EndGroup or an EndGroupGfxLink */
442 auto isStartingGfxLink = std::any_of(mActions.begin(), mActions.end(),
443 [](const PDFExtOutDevDataSync& rAction) { return rAction.eAct == PDFExtOutDevDataSync::EndGroupGfxLink; });
444 if ( isStartingGfxLink )
445 {
446 Graphic& rGraphic = mGraphics.front();
447 if ( rGraphic.IsGfxLink() && mParaRects.size() >= 2 )
448 {
449 GfxLinkType eType = rGraphic.GetGfxLink().GetType();
451 {
454 mCurrentGraphic = rGraphic;
455 }
457 {
458 if ( eType == GfxLinkType::NativePdf || rOutDevData.HasAdequateCompression(rGraphic, mParaRects[0], mParaRects[1]) )
459 mCurrentGraphic = rGraphic;
460 }
461 }
462 }
463 }
464 break;
465 case PDFExtOutDevDataSync::EndGroupGfxLink :
466 {
467 tools::Rectangle aOutputRect, aVisibleOutputRect;
468 Graphic aGraphic( mGraphics.front() );
469
470 mGraphics.pop_front();
471 sal_Int32 nTransparency = mParaInts.front();
472 mParaInts.pop_front();
473 aOutputRect = mParaRects.front();
474 mParaRects.pop_front();
475 aVisibleOutputRect = mParaRects.front();
476 mParaRects.pop_front();
477
479 {
480 bool bClippingNeeded = ( aOutputRect != aVisibleOutputRect ) && !aVisibleOutputRect.IsEmpty();
481
482 GfxLink aGfxLink( aGraphic.GetGfxLink() );
483 if ( aGfxLink.GetType() == GfxLinkType::NativeJpg )
484 {
485 if ( bClippingNeeded )
486 {
487 rWriter.Push();
489 vcl::unotools::b2DRectangleFromRectangle(aVisibleOutputRect) ) );
490 rWriter.SetClipRegion( aRect);
491 }
492
493 AlphaMask aAlphaMask;
494 if (nTransparency)
495 {
496 aAlphaMask = AlphaMask(aGraphic.GetSizePixel());
497 aAlphaMask.Erase(nTransparency);
498 }
499
500 SvMemoryStream aTmp;
501 const sal_uInt8* pData = aGfxLink.GetData();
502 sal_uInt32 nBytes = aGfxLink.GetDataSize();
503 if( pData && nBytes )
504 {
505 aTmp.WriteBytes( pData, nBytes );
506
507 // Look up the output rectangle from the previous
508 // bitmap scale action if possible. This has the
509 // correct position and size for images with a
510 // custom translation (Writer header) or scaling
511 // (Impress notes page).
512 if (rCurGDIMtfAction > 0)
513 {
514 const MetaAction* pAction = rMtf.GetAction(rCurGDIMtfAction - 1);
515 if (pAction && pAction->GetType() == MetaActionType::BMPSCALE)
516 {
517 const MetaBmpScaleAction* pA
518 = static_cast<const MetaBmpScaleAction*>(pAction);
519 aOutputRect.SetPos(pA->GetPoint());
520 aOutputRect.SetSize(pA->GetSize());
521 }
522 }
523 auto ePixelFormat = aGraphic.GetBitmapEx().getPixelFormat();
524 rWriter.DrawJPGBitmap(aTmp, ePixelFormat > vcl::PixelFormat::N8_BPP, aGraphic.GetSizePixel(), aOutputRect, aAlphaMask, aGraphic);
525 }
526
527 if ( bClippingNeeded )
528 rWriter.Pop();
529 }
531 }
533 }
534 break;
535 case PDFExtOutDevDataSync::CreateNamedDest:
536 case PDFExtOutDevDataSync::CreateDest:
537 case PDFExtOutDevDataSync::CreateLink:
538 case PDFExtOutDevDataSync::CreateScreen:
539 case PDFExtOutDevDataSync::SetLinkDest:
540 case PDFExtOutDevDataSync::SetLinkURL:
541 case PDFExtOutDevDataSync::SetScreenURL:
542 case PDFExtOutDevDataSync::SetScreenStream:
543 case PDFExtOutDevDataSync::RegisterDest:
544 case PDFExtOutDevDataSync::CreateOutlineItem:
545 case PDFExtOutDevDataSync::CreateNote:
546 case PDFExtOutDevDataSync::SetPageTransition:
547 break;
548 }
549 }
551 {
552 rCurGDIMtfAction++;
553 bRet = true;
554 }
555 return bRet;
556}
557
559 mrOutDev ( rOutDev ),
560 mbTaggedPDF ( false ),
561 mbExportNotes ( true ),
562 mbExportNotesInMargin ( false ),
563 mbExportNotesPages ( false ),
564 mbTransitionEffects ( true ),
565 mbUseLosslessCompression( true ),
566 mbReduceImageResolution ( false ),
567 mbExportFormFields ( false ),
568 mbExportBookmarks ( false ),
569 mbExportHiddenSlides ( false ),
570 mbSinglePageSheets ( false ),
571 mbExportNDests ( false ),
572 mnPage ( -1 ),
573 mnCompressionQuality ( 90 ),
574 mpGlobalSyncData ( new GlobalSyncData() )
575{
576 mpPageSyncData.reset( new PageSyncData( mpGlobalSyncData.get() ) );
577}
578
580{
581 mpPageSyncData.reset();
582 mpGlobalSyncData.reset();
583}
584
586{
587 return mpPageSyncData->mCurrentGraphic;
588}
589
590void PDFExtOutDevData::SetDocumentLocale( const css::lang::Locale& rLoc )
591{
592 maDocLocale = rLoc;
593}
594void PDFExtOutDevData::SetCurrentPageNumber( const sal_Int32 nPage )
595{
596 mnPage = nPage;
597}
598void PDFExtOutDevData::SetIsLosslessCompression( const bool bUseLosslessCompression )
599{
600 mbUseLosslessCompression = bUseLosslessCompression;
601}
602void PDFExtOutDevData::SetCompressionQuality( const sal_Int32 nQuality )
603{
604 mnCompressionQuality = nQuality;
605}
606void PDFExtOutDevData::SetIsReduceImageResolution( const bool bReduceImageResolution )
607{
608 mbReduceImageResolution = bReduceImageResolution;
609}
610void PDFExtOutDevData::SetIsExportNotes( const bool bExportNotes )
611{
612 mbExportNotes = bExportNotes;
613}
614void PDFExtOutDevData::SetIsExportNotesInMargin( const bool bExportNotesInMargin )
615{
616 mbExportNotesInMargin = bExportNotesInMargin;
617}
618void PDFExtOutDevData::SetIsExportNotesPages( const bool bExportNotesPages )
619{
620 mbExportNotesPages = bExportNotesPages;
621}
622void PDFExtOutDevData::SetIsExportTaggedPDF( const bool bTaggedPDF )
623{
624 mbTaggedPDF = bTaggedPDF;
625}
626void PDFExtOutDevData::SetIsExportTransitionEffects( const bool bTransitionEffects )
627{
628 mbTransitionEffects = bTransitionEffects;
629}
630void PDFExtOutDevData::SetIsExportFormFields( const bool bExportFomtFields )
631{
632 mbExportFormFields = bExportFomtFields;
633}
634void PDFExtOutDevData::SetIsExportBookmarks( const bool bExportBookmarks )
635{
636 mbExportBookmarks = bExportBookmarks;
637}
638void PDFExtOutDevData::SetIsExportHiddenSlides( const bool bExportHiddenSlides )
639{
640 mbExportHiddenSlides = bExportHiddenSlides;
641}
642void PDFExtOutDevData::SetIsSinglePageSheets( const bool bSinglePageSheets )
643{
644 mbSinglePageSheets = bSinglePageSheets;
645}
647{
648 mbExportNDests = bExportNDests;
649}
651{
653}
654bool PDFExtOutDevData::PlaySyncPageAct( PDFWriter& rWriter, sal_uInt32& rIdx, const GDIMetaFile& rMtf )
655{
656 return mpPageSyncData->PlaySyncPageAct( rWriter, rIdx, rMtf, *this );
657}
659{
660 mpGlobalSyncData->PlayGlobalActions( rWriter );
661}
662
663/* global actions, synchronisation to the recorded metafile isn't needed,
664 all actions will be played after the last page was recorded
665*/
666//--->i56629
667sal_Int32 PDFExtOutDevData::CreateNamedDest(const OUString& sDestName, const tools::Rectangle& rRect, sal_Int32 nPageNr )
668{
669 mpGlobalSyncData->mActions.push_back( PDFExtOutDevDataSync::CreateNamedDest );
670 mpGlobalSyncData->mParaOUStrings.push_back( sDestName );
671 mpGlobalSyncData->mParaRects.push_back( rRect );
672 mpGlobalSyncData->mParaMapModes.push_back( mrOutDev.GetMapMode() );
673 mpGlobalSyncData->mParaInts.push_back( nPageNr == -1 ? mnPage : nPageNr );
674 mpGlobalSyncData->mParaDestAreaTypes.push_back( PDFWriter::DestAreaType::XYZ );
675
676 return mpGlobalSyncData->mCurId++;
677}
678//<---i56629
680{
681 const sal_Int32 nLinkDestID = mpGlobalSyncData->mCurId++;
682 mpGlobalSyncData->mActions.push_back( PDFExtOutDevDataSync::RegisterDest );
683 mpGlobalSyncData->mParaInts.push_back( nLinkDestID );
684
685 return nLinkDestID;
686}
687void PDFExtOutDevData::DescribeRegisteredDest( sal_Int32 nDestId, const tools::Rectangle& rRect, sal_Int32 nPageNr, PDFWriter::DestAreaType eType )
688{
689 OSL_PRECOND( nDestId != -1, "PDFExtOutDevData::DescribeRegisteredDest: invalid destination Id!" );
690 PDFLinkDestination aLinkDestination;
691 aLinkDestination.mRect = rRect;
692 aLinkDestination.mMapMode = mrOutDev.GetMapMode();
693 aLinkDestination.mPageNr = nPageNr == -1 ? mnPage : nPageNr;
694 aLinkDestination.mAreaType = eType;
695 mpGlobalSyncData->mFutureDestinations[ nDestId ] = aLinkDestination;
696}
697sal_Int32 PDFExtOutDevData::CreateDest( const tools::Rectangle& rRect, sal_Int32 nPageNr, PDFWriter::DestAreaType eType )
698{
699 mpGlobalSyncData->mActions.push_back( PDFExtOutDevDataSync::CreateDest );
700 mpGlobalSyncData->mParaRects.push_back( rRect );
701 mpGlobalSyncData->mParaMapModes.push_back( mrOutDev.GetMapMode() );
702 mpGlobalSyncData->mParaInts.push_back( nPageNr == -1 ? mnPage : nPageNr );
703 mpGlobalSyncData->mParaDestAreaTypes.push_back( eType );
704 return mpGlobalSyncData->mCurId++;
705}
706sal_Int32 PDFExtOutDevData::CreateLink(const tools::Rectangle& rRect, OUString const& rAltText, sal_Int32 nPageNr)
707{
708 mpGlobalSyncData->mActions.push_back( PDFExtOutDevDataSync::CreateLink );
709 mpGlobalSyncData->mParaRects.push_back( rRect );
710 mpGlobalSyncData->mParaMapModes.push_back( mrOutDev.GetMapMode() );
711 mpGlobalSyncData->mParaInts.push_back( nPageNr == -1 ? mnPage : nPageNr );
712 mpGlobalSyncData->mParaOUStrings.push_back(rAltText);
713 return mpGlobalSyncData->mCurId++;
714}
715
717 OUString const& rAltText, OUString const& rMimeType,
718 sal_Int32 nPageNr, SdrObject const*const pObj)
719{
720 mpGlobalSyncData->mActions.push_back(PDFExtOutDevDataSync::CreateScreen);
721 mpGlobalSyncData->mParaRects.push_back(rRect);
722 mpGlobalSyncData->mParaMapModes.push_back(mrOutDev.GetMapMode());
723 mpGlobalSyncData->mParaInts.push_back(nPageNr);
724 mpGlobalSyncData->mParaOUStrings.push_back(rAltText);
725 mpGlobalSyncData->mParaOUStrings.push_back(rMimeType);
726 auto const ret(mpGlobalSyncData->mCurId++);
727 m_ScreenAnnotations[pObj].push_back(ret);
728 return ret;
729}
730
731::std::vector<sal_Int32> const& PDFExtOutDevData::GetScreenAnnotIds(SdrObject const*const pObj) const
732{
733 auto const it(m_ScreenAnnotations.find(pObj));
734 if (it == m_ScreenAnnotations.end())
735 {
736 assert(false); // expected?
737 }
738 return it->second;
739}
740
741void PDFExtOutDevData::SetLinkDest( sal_Int32 nLinkId, sal_Int32 nDestId )
742{
743 mpGlobalSyncData->mActions.push_back( PDFExtOutDevDataSync::SetLinkDest );
744 mpGlobalSyncData->mParaInts.push_back( nLinkId );
745 mpGlobalSyncData->mParaInts.push_back( nDestId );
746}
747void PDFExtOutDevData::SetLinkURL( sal_Int32 nLinkId, const OUString& rURL )
748{
749 mpGlobalSyncData->mActions.push_back( PDFExtOutDevDataSync::SetLinkURL );
750 mpGlobalSyncData->mParaInts.push_back( nLinkId );
751 mpGlobalSyncData->mParaOUStrings.push_back( rURL );
752}
753
754void PDFExtOutDevData::SetScreenURL(sal_Int32 nScreenId, const OUString& rURL)
755{
756 mpGlobalSyncData->mActions.push_back(PDFExtOutDevDataSync::SetScreenURL);
757 mpGlobalSyncData->mParaInts.push_back(nScreenId);
758 mpGlobalSyncData->mParaOUStrings.push_back(rURL);
759}
760
761void PDFExtOutDevData::SetScreenStream(sal_Int32 nScreenId, const OUString& rURL)
762{
763 mpGlobalSyncData->mActions.push_back(PDFExtOutDevDataSync::SetScreenStream);
764 mpGlobalSyncData->mParaInts.push_back(nScreenId);
765 mpGlobalSyncData->mParaOUStrings.push_back(rURL);
766}
767
768sal_Int32 PDFExtOutDevData::CreateOutlineItem( sal_Int32 nParent, const OUString& rText, sal_Int32 nDestID )
769{
770 if (nParent == -1)
771 // Has no parent, it's a chapter / heading 1.
772 maChapterNames.push_back(rText);
773
774 mpGlobalSyncData->mActions.push_back( PDFExtOutDevDataSync::CreateOutlineItem );
775 mpGlobalSyncData->mParaInts.push_back( nParent );
776 mpGlobalSyncData->mParaOUStrings.push_back( rText );
777 mpGlobalSyncData->mParaInts.push_back( nDestID );
778 return mpGlobalSyncData->mCurId++;
779}
780void PDFExtOutDevData::CreateNote( const tools::Rectangle& rRect, const PDFNote& rNote, sal_Int32 nPageNr )
781{
782 mpGlobalSyncData->mActions.push_back( PDFExtOutDevDataSync::CreateNote );
783 mpGlobalSyncData->mParaRects.push_back( rRect );
784 mpGlobalSyncData->mParaMapModes.push_back( mrOutDev.GetMapMode() );
785 mpGlobalSyncData->mParaPDFNotes.push_back( rNote );
786 mpGlobalSyncData->mParaInts.push_back( nPageNr == -1 ? mnPage : nPageNr );
787}
789{
790 mpGlobalSyncData->mActions.push_back( PDFExtOutDevDataSync::SetPageTransition );
791 mpGlobalSyncData->mParaPageTransitions.push_back( eType );
792 mpGlobalSyncData->mParauInts.push_back( nMilliSec );
793 mpGlobalSyncData->mParaInts.push_back( mnPage );
794}
795
796/* local (page), actions have to be played synchronously to the actions of
797 of the recorded metafile (created by each xRenderable->render()) */
798
799sal_Int32 PDFExtOutDevData::EnsureStructureElement(void const*const key)
800{
801 sal_Int32 id(-1);
802 if (key != nullptr)
803 {
804 auto const it(mpGlobalSyncData->mSEMap.find(key));
805 if (it != mpGlobalSyncData->mSEMap.end())
806 {
807 id = it->second;
808 }
809 }
810 if (id == -1)
811 {
812 mpPageSyncData->PushAction(mrOutDev, PDFExtOutDevDataSync::EnsureStructureElement);
813 id = mpGlobalSyncData->mStructParents.size();
814 mpPageSyncData->mParaInts.push_back(id);
815 mpGlobalSyncData->mStructParents.push_back(mpGlobalSyncData->mCurrentStructElement);
816 if (key != nullptr)
817 {
818 mpGlobalSyncData->mSEMap.emplace(key, id);
819 }
820 }
821 return id;
822}
823
825 PDFWriter::StructElement const eType, const OUString& rAlias)
826{
827 mpPageSyncData->PushAction(mrOutDev, PDFExtOutDevDataSync::InitStructureElement);
828 mpPageSyncData->mParaInts.push_back(id);
829 mpPageSyncData->mParaStructElements.push_back( eType );
830 mpPageSyncData->mParaOUStrings.push_back( rAlias );
831}
832
834{
835 mpPageSyncData->PushAction( mrOutDev, PDFExtOutDevDataSync::BeginStructureElement );
836 mpPageSyncData->mParaInts.push_back(id);
837 mpGlobalSyncData->mCurrentStructElement = id;
838}
839
841 PDFWriter::StructElement const eType, const OUString& rAlias)
842{
843 sal_Int32 const id = EnsureStructureElement(nullptr);
844 InitStructureElement(id, eType, rAlias);
846 return id;
847}
848
850{
851 mpPageSyncData->PushAction( mrOutDev, PDFExtOutDevDataSync::EndStructureElement );
852 mpGlobalSyncData->mCurrentStructElement = mpGlobalSyncData->mStructParents[ mpGlobalSyncData->mCurrentStructElement ];
853}
855{
856 bool bSuccess = false;
857 if( o3tl::make_unsigned(nStructId) < mpGlobalSyncData->mStructParents.size() )
858 {
859 mpGlobalSyncData->mCurrentStructElement = nStructId;
860 mpPageSyncData->PushAction( mrOutDev, PDFExtOutDevDataSync::SetCurrentStructureElement );
861 mpPageSyncData->mParaInts.push_back( nStructId );
862 bSuccess = true;
863 }
864 return bSuccess;
865}
867{
868 return mpGlobalSyncData->mCurrentStructElement;
869}
871{
872 mpPageSyncData->PushAction( mrOutDev, PDFExtOutDevDataSync::SetStructureAttribute );
873 mpPageSyncData->mParaStructAttributes.push_back( eAttr );
874 mpPageSyncData->mParaStructAttributeValues.push_back( eVal );
875}
877{
878 mpPageSyncData->PushAction( mrOutDev, PDFExtOutDevDataSync::SetStructureAttributeNumerical );
879 mpPageSyncData->mParaStructAttributes.push_back( eAttr );
880 mpPageSyncData->mParaInts.push_back( nValue );
881}
883{
884 mpPageSyncData->PushAction( mrOutDev, PDFExtOutDevDataSync::SetStructureBoundingBox );
885 mpPageSyncData->mParaRects.push_back( rRect );
886}
887
888void PDFExtOutDevData::SetStructureAnnotIds(::std::vector<sal_Int32> const& rAnnotIds)
889{
890 mpPageSyncData->PushAction(mrOutDev, PDFExtOutDevDataSync::SetStructureAnnotIds);
891 mpPageSyncData->mParaInts.push_back(rAnnotIds.size());
892 for (sal_Int32 const id : rAnnotIds)
893 {
894 mpPageSyncData->mParaInts.push_back(id);
895 }
896}
897
898void PDFExtOutDevData::SetActualText( const OUString& rText )
899{
900 mpPageSyncData->PushAction( mrOutDev, PDFExtOutDevDataSync::SetActualText );
901 mpPageSyncData->mParaOUStrings.push_back( rText );
902}
903void PDFExtOutDevData::SetAlternateText( const OUString& rText )
904{
905 mpPageSyncData->PushAction( mrOutDev, PDFExtOutDevDataSync::SetAlternateText );
906 mpPageSyncData->mParaOUStrings.push_back( rText );
907}
908
910{
911 mpPageSyncData->PushAction( mrOutDev, PDFExtOutDevDataSync::CreateControl );
912
913 std::shared_ptr< PDFWriter::AnyWidget > pClone( rControlType.Clone() );
914 mpPageSyncData->mControls.push_back( pClone );
915 mpGlobalSyncData->mCurId++;
916}
917
919{
920 mpPageSyncData->PushAction( mrOutDev, PDFExtOutDevDataSync::BeginGroup );
921}
922
924 sal_uInt8 nTransparency,
925 const tools::Rectangle& rOutputRect,
926 const tools::Rectangle& rVisibleOutputRect )
927{
928 mpPageSyncData->PushAction( mrOutDev, PDFExtOutDevDataSync::EndGroupGfxLink );
929 mpPageSyncData->mGraphics.push_back( rGraphic );
930 mpPageSyncData->mParaInts.push_back( nTransparency );
931 mpPageSyncData->mParaRects.push_back( rOutputRect );
932 mpPageSyncData->mParaRects.push_back( rVisibleOutputRect );
933}
934
935// Avoids expensive de-compression and re-compression of large images.
937 const tools::Rectangle & rOutputRect,
938 const tools::Rectangle & rVisibleOutputRect ) const
939{
940 assert(rGraphic.IsGfxLink() &&
941 (rGraphic.GetGfxLink().GetType() == GfxLinkType::NativeJpg ||
942 rGraphic.GetGfxLink().GetType() == GfxLinkType::NativePng ||
943 rGraphic.GetGfxLink().GetType() == GfxLinkType::NativePdf));
944
945 if (rOutputRect != rVisibleOutputRect)
946 // rOutputRect is the crop rectangle, re-compress cropped image.
947 return false;
948
950 // Reducing resolution was requested, implies that re-compressing is
951 // wanted.
952 return false;
953
954 auto nSize = rGraphic.GetGfxLink().GetDataSize();
955 if (nSize == 0)
956 return false;
957
958 GfxLink aLink = rGraphic.GetGfxLink();
959 SvMemoryStream aMemoryStream(const_cast<sal_uInt8*>(aLink.GetData()), aLink.GetDataSize(),
960 StreamMode::READ | StreamMode::WRITE);
961 GraphicDescriptor aDescriptor(aMemoryStream, nullptr);
962 if (aDescriptor.Detect(true) && aDescriptor.GetNumberOfImageComponents() == 4)
963 // 4 means CMYK, which is not handled.
964 return false;
965
966 const Size aSize = rGraphic.GetSizePixel();
967
968 // small items better off as PNG anyway
969 if ( aSize.Width() < 32 &&
970 aSize.Height() < 32 )
971 return false;
972
975
976 // FIXME: ideally we'd also pre-empt the DPI related scaling too.
977 sal_Int32 nCurrentRatio = (100 * aSize.Width() * aSize.Height() * 4) /
978 nSize;
979
980 static const struct {
981 sal_Int32 mnQuality;
982 sal_Int32 mnRatio;
983 } aRatios[] = { // minimum tolerable compression ratios
984 { 100, 400 }, { 95, 700 }, { 90, 1000 }, { 85, 1200 },
985 { 80, 1500 }, { 75, 1700 }
986 };
987 sal_Int32 nTargetRatio = 10000;
988 bool bIsTargetRatioReached = false;
989 for (auto & rRatio : aRatios)
990 {
991 if ( mnCompressionQuality > rRatio.mnQuality )
992 {
993 bIsTargetRatioReached = true;
994 break;
995 }
996 nTargetRatio = rRatio.mnRatio;
997 }
998
999 return ((nCurrentRatio > nTargetRatio) && bIsTargetRatioReached);
1000}
1001
1002}
1003
1004/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void Erase(sal_uInt8 cTransparency)
Definition: alpha.cxx:82
vcl::PixelFormat getPixelFormat() const
Definition: bitmapex.hxx:82
size_t GetActionSize() const
Definition: gdimtf.cxx:181
MetaAction * GetAction(size_t nAction) const
Definition: gdimtf.cxx:186
sal_uInt8 GetNumberOfImageComponents() const
bool Detect(bool bExtendedInfo=false)
starts the detection
GfxLink GetGfxLink() const
Definition: graph.cxx:510
BitmapEx GetBitmapEx(const GraphicConversionParameters &rParameters=GraphicConversionParameters()) const
Definition: graph.cxx:330
void Clear()
Definition: graph.cxx:288
Size GetSizePixel(const OutputDevice *pRefDevice=nullptr) const
Definition: graph.cxx:412
bool IsGfxLink() const
Definition: graph.cxx:515
MetaActionType GetType() const
Definition: metaact.hxx:96
const Point & GetPoint() const
Definition: metaact.hxx:726
const Size & GetSize() const
Definition: metaact.hxx:727
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
Definition: outdev.hxx:170
GDIMetaFile * GetConnectMetaFile() const
Definition: outdev.hxx:285
const MapMode & GetMapMode() const
Definition: outdev.hxx:1557
constexpr tools::Long Height() const
constexpr tools::Long Width() const
std::size_t WriteBytes(const void *pData, std::size_t nSize)
void SetSize(const Size &)
void SetPos(const Point &rPoint)
constexpr bool IsEmpty() const
bool SetCurrentStructureElement(sal_Int32 nElement)
set the current structure element
void SetStructureBoundingBox(const tools::Rectangle &rRect)
set the bounding box of a structural element
void SetIsExportNamedDestinations(const bool bExportNDests)
void CreateNote(const tools::Rectangle &rRect, const PDFNote &rNote, sal_Int32 nPageNr=-1)
Create a new note on a page.
std::unique_ptr< GlobalSyncData > mpGlobalSyncData
bool GetIsLosslessCompression() const
std::unique_ptr< PageSyncData > mpPageSyncData
sal_Int32 CreateScreen(const tools::Rectangle &rRect, OUString const &rAltText, OUString const &rMimeType, sal_Int32 nPageNr, SdrObject const *pObj)
Create a Screen annotation.
sal_Int32 EnsureStructureElement(void const *key)
sal_Int32 CreateDest(const tools::Rectangle &rRect, sal_Int32 nPageNr=-1, PDFWriter::DestAreaType eType=PDFWriter::DestAreaType::XYZ)
Create a new destination to be used in a link.
void SetStructureAnnotIds(::std::vector< sal_Int32 > const &rAnnotIds)
set the annotations that should be referenced as children of the current structural element.
void BeginStructureElement(sal_Int32 id)
void SetDocumentLocale(const css::lang::Locale &rLoc)
void SetStructureAttributeNumerical(PDFWriter::StructAttribute eAttr, sal_Int32 nValue)
set a structure attribute on the current structural element
void SetScreenStream(sal_Int32 nScreenId, const OUString &rURL)
Set URL for an embedded Screen annotation.
void SetAlternateText(const OUString &rText)
set the Alt attribute of a strutural element
void SetIsExportNotes(const bool bExportNotes)
sal_Int32 GetCurrentStructureElement() const
get the current structure element id
sal_Int32 RegisterDest()
registers a destination for which a destination ID needs to be known immediately, instead of later on...
PDFExtOutDevData(const OutputDevice &rOutDev)
void SetIsExportTaggedPDF(const bool bTaggedPDF)
void SetStructureAttribute(PDFWriter::StructAttribute eAttr, PDFWriter::StructAttributeValue eVal)
set a structure attribute on the current structural element
bool PlaySyncPageAct(PDFWriter &rWriter, sal_uInt32 &rCurGDIMtfAction, const GDIMetaFile &rMtf)
bool GetIsReduceImageResolution() const
void SetPageTransition(PDFWriter::PageTransition eType, sal_uInt32 nMilliSec)
Sets the transitional effect to be applied when the current page gets shown.
css::lang::Locale maDocLocale
void SetIsExportNotesPages(const bool bExportNotesPages)
const Graphic & GetCurrentGraphic() const
void SetActualText(const OUString &rText)
set the ActualText attribute of a structural element
void PlayGlobalActions(PDFWriter &rWriter)
void BeginGroup()
Start a new group of render output.
void SetScreenURL(sal_Int32 nScreenId, const OUString &rURL)
Set URL for a linked Screen annotation.
void SetIsLosslessCompression(const bool bLosslessCompression)
void SetIsReduceImageResolution(const bool bReduceImageResolution)
void SetCurrentPageNumber(const sal_Int32 nPage)
void EndGroup(const Graphic &rGraphic, sal_uInt8 nTransparency, const tools::Rectangle &rOutputRect, const tools::Rectangle &rVisibleOutputRect)
End render output.
void DescribeRegisteredDest(sal_Int32 nDestId, const tools::Rectangle &rRect, sal_Int32 nPageNr, PDFWriter::DestAreaType eType=PDFWriter::DestAreaType::XYZ)
provides detailed information about a destination range which previously has been registered using Re...
void SetLinkURL(sal_Int32 nLinkId, const OUString &rURL)
Set the URL for a link.
void CreateControl(const PDFWriter::AnyWidget &rControlType)
create a new form control
sal_Int32 WrapBeginStructureElement(PDFWriter::StructElement eType, const OUString &rAlias=OUString())
begin a new logical structure element
sal_Int32 CreateOutlineItem(sal_Int32 nParent, const OUString &rText, sal_Int32 nDestID)
Create a new outline item.
::std::vector< sal_Int32 > const & GetScreenAnnotIds(SdrObject const *pObj) const
Get back the annotations created for one SdrObject.
void SetIsExportBookmarks(const bool bExportBookmarks)
::std::map< SdrObject const *, ::std::vector< sal_Int32 > > m_ScreenAnnotations
std::vector< OUString > maChapterNames
void SetIsExportHiddenSlides(const bool bExportHiddenSlides)
void SetIsSinglePageSheets(const bool bSinglePageSheets)
void SetIsExportTransitionEffects(const bool bTransitionalEffects)
void SetIsExportFormFields(const bool bExportFormFields)
sal_Int32 CreateNamedDest(const OUString &sDestName, const tools::Rectangle &rRect, sal_Int32 nPageNr=-1)
Create a new named destination to be used in a link to this document from another PDF document (see P...
sal_Int32 CreateLink(const tools::Rectangle &rRect, OUString const &rAltText, sal_Int32 nPageNr=-1)
Create a new link on a page.
void EndStructureElement()
end a logical structure element
bool HasAdequateCompression(const Graphic &rGraphic, const tools::Rectangle &rOutputRect, const tools::Rectangle &rVisibleOutputRect) const
Detect if stream is compressed enough to avoid de-compress / scale & re-compress.
virtual ~PDFExtOutDevData() override
void SetCompressionQuality(const sal_Int32 nQuality)
const OutputDevice & mrOutDev
void InitStructureElement(sal_Int32 id, PDFWriter::StructElement eType, const OUString &rAlias)
void SetIsExportNotesInMargin(const bool bExportNotesInMargin)
void SetLinkDest(sal_Int32 nLinkId, sal_Int32 nDestId)
Set the destination for a link.
void CreateNote(const tools::Rectangle &rRect, const PDFNote &rNote, sal_Int32 nPageNr)
Create a new note on a page.
Definition: pdfwriter.cxx:387
void SetLinkDest(sal_Int32 nLinkId, sal_Int32 nDestId)
Set the destination for a link will change a URL type link to a dest link if necessary.
Definition: pdfwriter.cxx:357
void SetScreenURL(sal_Int32 nScreenId, const OUString &rURL)
Sets the URL of a linked screen annotation.
Definition: pdfwriter.cxx:367
void SetActualText(const OUString &rText)
set the ActualText attribute of a structural element
Definition: pdfwriter.cxx:438
void SetLinkURL(sal_Int32 nLinkId, const OUString &rURL)
Set the URL for a link will change a dest type link to a URL type link if necessary.
Definition: pdfwriter.cxx:362
void InitStructureElement(sal_Int32 id, PDFWriter::StructElement eType, std::u16string_view rAlias)
Definition: pdfwriter.cxx:397
sal_Int32 CreateNamedDest(const OUString &sDestName, const tools::Rectangle &rRect, sal_Int32 nPageNr, DestAreaType eType)
Create a new named destination to be used in a link from another PDF document.
Definition: pdfwriter.cxx:348
void Push(PushFlags nFlags=PushFlags::ALL)
Definition: pdfwriter.cxx:228
sal_Int32 CreateScreen(const tools::Rectangle &rRect, sal_Int32 nPageNr, OUString const &rAltText, OUString const &rMimeType)
Creates a screen annotation.
Definition: pdfwriter.cxx:338
sal_Int32 CreateControl(const AnyWidget &rControlType)
create a new form control
Definition: pdfwriter.cxx:453
void SetCurrentStructureElement(sal_Int32 nElement)
set the current structure element
Definition: pdfwriter.cxx:413
sal_Int32 RegisterDestReference(sal_Int32 nDestId, const tools::Rectangle &rRect, sal_Int32 nPageNr, DestAreaType eType)
creates a destination which is not intended to be referred to by a link, but by a public destination ...
Definition: pdfwriter.cxx:343
void DrawJPGBitmap(SvStream &rJPGData, bool bIsTrueColor, const Size &rSrcSizePixel, const tools::Rectangle &rTargetArea, const AlphaMask &rAlphaMask, const Graphic &rGraphic)
Insert a JPG encoded image (optionally with mask)
Definition: pdfwriter.cxx:328
void SetClipRegion()
Definition: pdfwriter.cxx:253
void SetMapMode(const MapMode &rNewMapMode)
Definition: pdfwriter.cxx:238
void SetAlternateText(const OUString &rText)
set the Alt attribute of a strutural element
Definition: pdfwriter.cxx:443
void SetStructureBoundingBox(const tools::Rectangle &rRect)
set the bounding box of a structural element
Definition: pdfwriter.cxx:428
void SetStructureAnnotIds(::std::vector< sal_Int32 > const &rAnnotIds)
set the annotations that should be referenced as children of the current structural element.
Definition: pdfwriter.cxx:433
void SetStructureAttributeNumerical(enum StructAttribute eAttr, sal_Int32 nValue)
set a structure attribute on the current structural element
Definition: pdfwriter.cxx:423
void SetPageTransition(PageTransition eType, sal_uInt32 nMilliSec, sal_Int32 nPageNr)
Sets the transitional effect to be applied when the current page gets shown.
Definition: pdfwriter.cxx:448
void BeginStructureElement(sal_Int32 id)
begin a new logical structure element
Definition: pdfwriter.cxx:403
sal_Int32 CreateDest(const tools::Rectangle &rRect, sal_Int32 nPageNr, DestAreaType eType)
Create a new destination to be used in a link.
Definition: pdfwriter.cxx:352
void SetLinkPropertyID(sal_Int32 nLinkId, sal_Int32 nPropertyID)
Resolve link in logical structure.
Definition: pdfwriter.cxx:377
sal_Int32 CreateLink(const tools::Rectangle &rRect, sal_Int32 nPageNr, OUString const &rAltText)
Create a new link on a page.
Definition: pdfwriter.cxx:333
void EndStructureElement()
end the current logical structure element
Definition: pdfwriter.cxx:408
void SetStructureAttribute(enum StructAttribute eAttr, enum StructAttributeValue eVal)
set a structure attribute on the current structural element
Definition: pdfwriter.cxx:418
sal_Int32 CreateOutlineItem(sal_Int32 nParent, std::u16string_view rText, sal_Int32 nDestID)
Create a new outline item.
Definition: pdfwriter.cxx:382
void SetScreenStream(sal_Int32 nScreenId, const OUString &rURL)
Sets the URL of an embedded screen annotation.
Definition: pdfwriter.cxx:372
sal_Int32 EnsureStructureElement()
Definition: pdfwriter.cxx:392
DocumentType eType
sal_Int16 nValue
sal_Int64 n
#define SAL_WARN_IF(condition, area, stream)
std::unique_ptr< sal_Int32[]> pData
B2DPolygon createPolygonFromRect(const B2DRectangle &rRect, double fRadiusX, double fRadiusY)
size
int i
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
action
basegfx::B2DRange b2DRectangleFromRectangle(const ::tools::Rectangle &rRect)
std::deque< sal_Int32 > mParaInts
std::deque< PDFWriter::PageTransition > mParaPageTransitions
std::deque< MapMode > mParaMapModes
std::vector< sal_Int32 > mParaIds
std::deque< PDFExtOutDevDataSync::Action > mActions
std::deque< sal_uInt32 > mParauInts
std::deque< PDFNote > mParaPDFNotes
std::map< void const *, sal_Int32 > mSEMap
std::deque< OUString > mParaOUStrings
void PlayGlobalActions(PDFWriter &rWriter)
std::deque< PDFWriter::DestAreaType > mParaDestAreaTypes
std::vector< sal_Int32 > mStructParents
std::deque< tools::Rectangle > mParaRects
sal_Int32 mCurId
the way this appears to work: (only) everything that increments mCurId at recording time must put an ...
::std::map< sal_Int32, PDFLinkDestination > mFutureDestinations
virtual std::shared_ptr< AnyWidget > Clone() const =0
std::deque< PDFWriter::StructAttributeValue > mParaStructAttributeValues
std::deque< PDFWriter::StructAttribute > mParaStructAttributes
std::deque< tools::Rectangle > mParaRects
GlobalSyncData * mpGlobalData
PageSyncData(GlobalSyncData *pGlobal)
std::deque< PDFExtOutDevDataSync > mActions
std::deque< OUString > mParaOUStrings
std::deque< sal_Int32 > mParaInts
std::deque< Graphic > mGraphics
std::deque< std::shared_ptr< PDFWriter::AnyWidget > > mControls
void PushAction(const OutputDevice &rOutDev, const PDFExtOutDevDataSync::Action eAct)
std::deque< PDFWriter::StructElement > mParaStructElements
bool PlaySyncPageAct(PDFWriter &rWriter, sal_uInt32 &rCurGDIMtfAction, const GDIMetaFile &rMtf, const PDFExtOutDevData &rOutDevData)
unsigned char sal_uInt8