xref: /aoo4110/main/vcl/inc/vcl/pdfwriter.hxx (revision b1cdbd2c)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef _VCL_PDFWRITER_HXX
24 #define _VCL_PDFWRITER_HXX
25 
26 #include <sal/types.h>
27 
28 #include <tools/gen.hxx>
29 #include <tools/string.hxx>
30 #include <tools/color.hxx>
31 
32 #include <vcl/dllapi.h>
33 #include <vcl/vclenum.hxx>
34 #include <vcl/font.hxx>
35 #include <vcl/graphictools.hxx>
36 
37 #include "com/sun/star/io/XOutputStream.hpp"
38 #include "com/sun/star/beans/XMaterialHolder.hpp"
39 
40 #include <list>
41 #include <vector>
42 #include <set>
43 
44 class Font;
45 class Point;
46 class OutputDevice;
47 class GDIMetaFile;
48 class MapMode;
49 class Polygon;
50 class LineInfo;
51 class PolyPolygon;
52 class Bitmap;
53 class BitmapEx;
54 class Image;
55 class Gradient;
56 class Hatch;
57 class Wallpaper;
58 
59 namespace vcl
60 {
61 
62 class PDFExtOutDevData;
63 
64 struct PDFNote
65 {
66     String			Title;			// optional title for the popup containing the note
67     String			Contents;		// contents of the note
68 };
69 
70 class VCL_DLLPUBLIC PDFOutputStream
71 {
72     public:
73     virtual ~PDFOutputStream();
74     virtual void write( const com::sun::star::uno::Reference< com::sun::star::io::XOutputStream >& xStream ) = 0;
75 };
76 
77 class VCL_DLLPUBLIC PDFWriter
78 {
79     void* pImplementation;
80 public:
81     // extended line info
82     enum CapType { capButt, capRound, capSquare };
83     enum JoinType { joinMiter, joinRound, joinBevel };
84     struct ExtLineInfo
85     {
86         double                      m_fLineWidth;
87         double                      m_fTransparency;
88         CapType                     m_eCap;
89         JoinType                    m_eJoin;
90         double                      m_fMiterLimit;
91         std::vector< double >       m_aDashArray;
92 
ExtLineInfovcl::PDFWriter::ExtLineInfo93         ExtLineInfo() : m_fLineWidth( 0.0 ),
94                         m_fTransparency( 0.0 ),
95                         m_eCap( capButt ),
96                         m_eJoin( joinMiter ),
97                         m_fMiterLimit( 10.0 )
98         {}
99     };
100 
101     enum Orientation { Portrait, Landscape, Seascape, Inherit };
102 
103     // in case the below enum is added PDF_1_6 PDF_1_7, please add them just after PDF_1_5
104     enum PDFVersion { PDF_1_2, PDF_1_3, PDF_1_4, PDF_1_5, PDF_A_1 };//i59651, PDF/A-1b & -1a, only -1b implemented for now
105     // for the meaning of DestAreaType please look at PDF Reference Manual
106     // version 1.4 section 8.2.1, page 475
107     enum DestAreaType { XYZ, Fit, FitHorizontal, FitVertical,
108                         FitRectangle, FitPageBoundingBox, FitPageBoundingBoxHorizontal,
109                         FitPageBoundingBoxVertical
110     };
111 
112     // for a definition of structural element types please refer to
113     // PDF Reference, 3rd ed. section 9.7.4
114     enum StructElement
115     {
116         // special element to place outside the structure hierarchy
117         NonStructElement,
118         // Grouping elements
119         Document, Part, Article, Section, Division, BlockQuote,
120         Caption, TOC, TOCI, Index,
121 
122         // block level elements
123         Paragraph, Heading, H1, H2, H3, H4, H5, H6,
124         List, ListItem, LILabel, LIBody,
125         Table, TableRow, TableHeader, TableData,
126 
127         // inline level elements
128         Span, Quote, Note, Reference, BibEntry, Code, Link,
129 
130         // illustration elements
131         Figure, Formula, Form
132     };
133 
134     enum StructAttribute
135     {
136         Placement, WritingMode, SpaceBefore, SpaceAfter, StartIndent, EndIndent,
137         TextIndent, TextAlign, Width, Height, BlockAlign, InlineAlign,
138         LineHeight, BaselineShift, TextDecorationType, ListNumbering,
139         RowSpan, ColSpan,
140 
141         // link destination is an artificial attribute that sets
142         // the link annotation ID of a Link element
143         // further note: since structure attributes can only be
144         // set during content creation, but links can be
145         // created after the fact, it is possible to set
146         // an arbitrary id as structure attribute here. In this
147         // case the arbitrary id has to be passed again when the
148         // actual link annotation is created via SetLinkPropertyID
149         LinkAnnotation,
150         // Language currently sets a LanguageType (see i18npool/lang.h)
151         // which will be internally changed to a corresponding locale
152         Language
153     };
154 
155     enum StructAttributeValue
156     {
157         Invalid,
158         NONE,
159         // Placement
160         Block, Inline, Before, After, Start, End,
161         // WritingMode
162         LrTb, RlTb, TbRl,
163         // TextAlign
164         Center, Justify,
165         // Width, Height,
166         Auto,
167         // BlockAlign
168         Middle,
169         // LineHeight
170         Normal,
171         // TextDecorationType
172         Underline, Overline, LineThrough,
173         // ListNumbering
174         Disc, Circle, Square, Decimal, UpperRoman, LowerRoman, UpperAlpha, LowerAlpha
175     };
176 
177     enum PageTransition
178     {
179         Regular,
180         SplitHorizontalInward, SplitHorizontalOutward,
181         SplitVerticalInward, SplitVerticalOutward,
182         BlindsHorizontal, BlindsVertical,
183         BoxInward, BoxOutward,
184         WipeLeftToRight, WipeBottomToTop, WipeRightToLeft, WipeTopToBottom,
185         Dissolve,
186         GlitterLeftToRight, GlitterTopToBottom, GlitterTopLeftToBottomRight
187     };
188 
189     enum WidgetType
190     {
191         PushButton, RadioButton, CheckBox, Edit, ListBox, ComboBox, Hierarchy
192     };
193 
194     enum WidgetState
195     {
196         // PushButton, RadioButton, CheckBox; Down means selected for
197         // RadioButton and CheckBox
198         Up, Down
199     };
200 
201     enum ErrorCode
202     {
203         // transparent object occurred and was draw opaque because
204         // PDF/A does not allow transparency
205         Warning_Transparency_Omitted_PDFA,
206 
207         // transparent object occured but is only supported since
208         // PDF 1.4
209         Warning_Transparency_Omitted_PDF13,
210 
211         // a form action was exported that is not suitable for PDF/A
212         // the action was skipped
213         Warning_FormAction_Omitted_PDFA,
214 
215         // transparent objects were converted to a bitmap in order
216         // to removetransparencies from the output
217         Warning_Transparency_Converted
218     };
219 
220     struct VCL_DLLPUBLIC AnyWidget
221     {
222     protected:
223         WidgetType			Type;		// primitive RTTI
224     public:
225         rtl::OUString		Name;		// a distinct name to identify the control
226         rtl::OUString		Description;// descriptive text for the contro (e.g. for tool tip)
227         rtl::OUString		Text;		// user text to appear on the control
228         sal_uInt16				TextStyle;	// style flags
229         bool				ReadOnly;
230         Rectangle			Location;	// describes the area filled by the control
231         bool				Border;		// true: widget should have a border, false: no border
232         Color				BorderColor;// COL_TRANSPARENT and Border=true means get color from application settings
233         bool				Background; // true: widget shall draw its background, false: no background
234         Color				BackgroundColor; // COL_TRANSPARENT and Background=true means get color from application settings
235         Font				TextFont;	// an empty font will be replaced by the
236         								// appropriate font from the user settings
237         Color				TextColor;  // COL_TRANSPARENT will be replaced by the appropriate color from application settings
238         sal_Int32           TabOrder; // lowest number is first in tab order
239 
240         /* style flags for text are those for OutputDevice::DrawText
241            allowed values are:
242            TEXT_DRAW_LEFT, TEXT_DRAW_CENTER, TEXT_DRAW_RIGHT, TEXT_DRAW_TOP,
243            TEXT_DRAW_VCENTER, TEXT_DRAW_BOTTOM,
244            TEXT_DRAW_MULTILINE, TEXT_DRAW_WORDBREAK
245 
246            if TextStyle is 0, then each control will fill in default values
247          */
248 
249          // note: the Name member comprises the field name of the resulting
250          // PDF field names need to be globally unique. Therefore if any
251          // Widget with an already used name is created, the name will be
252          // made unique by adding an underscore ('_') and an ascending number
253          // to the name.
254 
AnyWidgetvcl::PDFWriter::AnyWidget255         AnyWidget( WidgetType eType ) :
256                 Type( eType ),
257                 TextStyle( 0 ),
258                 ReadOnly( false ),
259                 Border( false ),
260                 BorderColor( COL_TRANSPARENT ),
261                 Background( false ),
262                 BackgroundColor( COL_TRANSPARENT ),
263                 TextColor( COL_TRANSPARENT ),
264                 TabOrder( -1 )
265         {}
266         virtual ~AnyWidget();
267 
getTypevcl::PDFWriter::AnyWidget268         WidgetType getType() const { return Type; }
269 
270         virtual AnyWidget* Clone() const = 0;
271 
272     protected:
273         // note that this equals the default compiler-generated copy-ctor, but we want to have it
274         // protected, to only allow sub classes to access it
AnyWidgetvcl::PDFWriter::AnyWidget275         AnyWidget( const AnyWidget& rSource )
276             :Type( rSource.Type )
277             ,Name( rSource.Name )
278             ,Description( rSource.Description )
279             ,Text( rSource.Text )
280             ,TextStyle( rSource.TextStyle )
281             ,ReadOnly( rSource.ReadOnly )
282             ,Location( rSource.Location )
283             ,Border( rSource.Border )
284             ,BorderColor( rSource.BorderColor )
285             ,Background( rSource.Background )
286             ,BackgroundColor( rSource.BackgroundColor )
287             ,TextFont( rSource.TextFont )
288             ,TextColor( rSource.TextColor )
289             ,TabOrder( rSource.TabOrder )
290         {
291         }
292         AnyWidget& operator=( const AnyWidget& );  // never implemented
293     };
294 
295     struct PushButtonWidget : public AnyWidget
296     {
297         /* If Dest is set to a valid link destination,
298            Then pressing the button will act as a goto
299            action within the docuemnt.
300 
301            Else:
302            An empty URL means this button will reset the form.
303 
304            If URL is not empty and Submit is set, then the URL
305            contained will be set as the URL to submit the
306            form to. In this case the submit method will be
307            either GET if SubmitGet is true or POST if
308            SubmitGet is false.
309 
310            If URL is not empty and Submit is clear, then
311            the URL contained will be interpreted as a
312            hyperlink to be executed on pushing the button.
313 
314            There will be no error checking or any kind of
315            conversion done to the URL parameter execept this:
316            it will be output as 7bit Ascii. The URL
317            will appear literally in the PDF file produced
318         */
319         sal_Int32           Dest;
320         rtl::OUString		URL;
321         bool                Submit;
322         bool                SubmitGet;
323 
PushButtonWidgetvcl::PDFWriter::PushButtonWidget324         PushButtonWidget()
325                 : AnyWidget( vcl::PDFWriter::PushButton ),
326                   Dest( -1 ), Submit( false ), SubmitGet( false )
327         {}
328 
Clonevcl::PDFWriter::PushButtonWidget329         virtual AnyWidget* Clone() const
330         {
331             return new PushButtonWidget( *this );
332         }
333     };
334 
335     struct CheckBoxWidget : public AnyWidget
336     {
337         bool				Checked;
338         bool				ButtonIsLeft;
339 
CheckBoxWidgetvcl::PDFWriter::CheckBoxWidget340         CheckBoxWidget()
341                 : AnyWidget( vcl::PDFWriter::CheckBox ),
342                   Checked( false ),
343                   ButtonIsLeft( true )
344         {}
345 
Clonevcl::PDFWriter::CheckBoxWidget346         virtual AnyWidget* Clone() const
347         {
348             return new CheckBoxWidget( *this );
349         }
350     };
351 
352     struct RadioButtonWidget : public AnyWidget
353     {
354         bool				Selected;
355         sal_Int32			RadioGroup;
356         bool				ButtonIsLeft;
357         rtl::OUString       OnValue; // the value of the radio button if it is selected
358 
RadioButtonWidgetvcl::PDFWriter::RadioButtonWidget359         RadioButtonWidget()
360                 : AnyWidget( vcl::PDFWriter::RadioButton ),
361                   Selected( false ),
362                   RadioGroup( 0 ),
363                   ButtonIsLeft( true )
364         {}
365 
Clonevcl::PDFWriter::RadioButtonWidget366         virtual AnyWidget* Clone() const
367         {
368             return new RadioButtonWidget( *this );
369         }
370         // radio buttons having the same RadioGroup id comprise one
371         // logical radio button group, that is at most one of the RadioButtons
372         // in a group can be checked at any time
373         //
374         // note: a PDF radio button field consists of a named field
375         // containing unnamed checkbox child fields. The name of the
376         // radio button field is taken from the first RadioButtonWidget created
377         // in the group
378     };
379 
380     struct EditWidget : public AnyWidget
381     {
382         bool				MultiLine;	// whether multiple lines are allowed
383         bool				Password;	// visible echo off
384         bool				FileSelect;	// field is a file selector
385         sal_Int32			MaxLen;		// maximum field length in characters, 0 means unlimited
386 
EditWidgetvcl::PDFWriter::EditWidget387         EditWidget()
388                 : AnyWidget( vcl::PDFWriter::Edit ),
389                   MultiLine( false ),
390                   Password( false ),
391                   FileSelect( false ),
392                   MaxLen( 0 )
393         {}
394 
Clonevcl::PDFWriter::EditWidget395         virtual AnyWidget* Clone() const
396         {
397             return new EditWidget( *this );
398         }
399     };
400 
401     struct ListBoxWidget : public AnyWidget
402     {
403         bool							DropDown;
404         bool							Sort;
405         bool							MultiSelect;
406         std::vector<rtl::OUString>		Entries;
407         std::vector<sal_Int32>          SelectedEntries;
408          // if MultiSelect is false only the first entry of SelectedEntries
409          // will be taken into account. the same is implicit for PDF < 1.4
410          // since multiselect is a 1.4+ feature
411 
ListBoxWidgetvcl::PDFWriter::ListBoxWidget412         ListBoxWidget()
413                 : AnyWidget( vcl::PDFWriter::ListBox ),
414                   DropDown( false ),
415                   Sort( false ),
416                   MultiSelect( false )
417         {}
418 
Clonevcl::PDFWriter::ListBoxWidget419         virtual AnyWidget* Clone() const
420         {
421             return new ListBoxWidget( *this );
422         }
423     };
424 
425     // note: PDF only supports dropdown comboboxes
426     struct ComboBoxWidget : public AnyWidget
427     {
428         bool							Sort;
429         std::vector<rtl::OUString>		Entries;
430         // set the current value in AnyWidget::Text
431 
ComboBoxWidgetvcl::PDFWriter::ComboBoxWidget432         ComboBoxWidget()
433                 : AnyWidget( vcl::PDFWriter::ComboBox ),
434                   Sort( false )
435         {}
436 
Clonevcl::PDFWriter::ComboBoxWidget437         virtual AnyWidget* Clone() const
438         {
439             return new ComboBoxWidget( *this );
440         }
441     };
442 
443     enum ExportDataFormat { HTML, XML, FDF, PDF };
444 // see 3.6.1 of PDF 1.4 ref for details, used for 8.1 PDF v 1.4 ref also
445 // These emuns are treated as integer while reading/writing to configuration
446     enum PDFViewerPageMode
447     {
448         ModeDefault,
449         UseOutlines,
450         UseThumbs
451     };
452 // These emuns are treated as integer while reading/writing to configuration
453     enum PDFViewerAction
454     {
455         ActionDefault,
456         FitInWindow,
457         FitWidth,
458         FitVisible,
459         ActionZoom
460     };
461 // These enums are treated as integer while reading/writing to configuration
462     enum PDFPageLayout
463     {
464         DefaultLayout,
465         SinglePage,
466         Continuous,
467         ContinuousFacing
468     };
469 
470     // These emuns are treated as integer while reading/writing to configuration
471     //what default action to generate in a PDF hyperlink to external document/site
472     enum PDFLinkDefaultAction
473     {
474         URIAction,
475         URIActionDestination,
476         LaunchAction
477     };
478 
479 /*
480 The following structure describes the permissions used in PDF security
481  */
482 	struct PDFEncryptionProperties
483 	{
484 
485 		bool Security128bit; // true to select 128 bit encryption, false for 40 bit
486 		//for both 40 and 128 bit security, see 3.5.2 PDF v 1.4 table 3.15, v 1.5 and v 1.6 table 3.20.
487 		bool CanPrintTheDocument;
488 		bool CanModifyTheContent;
489 		bool CanCopyOrExtract;
490 		bool CanAddOrModify;
491 		//for revision 3 (bit 128 security) only
492 		bool CanFillInteractive;
493 		bool CanExtractForAccessibility;
494 		bool CanAssemble;
495 		bool CanPrintFull;
496 
497 		// encryption will only happen if EncryptionKey is not empty
498 		// EncryptionKey is actually a construct out of OValue, UValue and DocumentIdentifier
499 		// if these do not match, behavior is undefined, most likely an invalid PDF will be produced
500 		// OValue, UValue, EncryptionKey and DocumentIdentifier can be computed from
501 		// PDFDocInfo, Owner password and User password used the InitEncryption method which
502 		// implements the algorithms described in the PDF reference chapter 3.5: Encryption
503 		std::vector<sal_uInt8> OValue;
504 		std::vector<sal_uInt8> UValue;
505 		std::vector<sal_uInt8> EncryptionKey;
506 		std::vector<sal_uInt8> DocumentIdentifier;
507 
508 		//permission default set for 128 bit, accessibility only
PDFEncryptionPropertiesvcl::PDFWriter::PDFEncryptionProperties509 		PDFEncryptionProperties() :
510 		    Security128bit              ( true ),
511 			CanPrintTheDocument			( false ),
512 			CanModifyTheContent			( false ),
513 			CanCopyOrExtract			( false ),
514 			CanAddOrModify				( false ),
515 			CanFillInteractive			( false ),
516 			CanExtractForAccessibility	( true ),
517 			CanAssemble					( false ),
518 			CanPrintFull				( false )
519 			{}
520 
521 
Encryptvcl::PDFWriter::PDFEncryptionProperties522         bool Encrypt() const
523         { return ! OValue.empty() && ! UValue.empty() && ! DocumentIdentifier.empty(); }
524 	};
525 
526     struct PDFDocInfo
527     {
528         String			Title;			// document title
529         String			Author;			// document author
530         String			Subject;		// subject
531         String			Keywords;		// keywords
532         String			Creator;		// application that created the original document
533         String			Producer;		// OpenOffice
534     };
535 
536     enum ColorMode
537     {
538         DrawColor, DrawGreyscale
539     };
540 
541     struct PDFWriterContext
542     {
543         /* must be a valid file: URL usable by osl */
544         rtl::OUString					URL;
545         /* the URL of the document being exported, used for relative links*/
546         rtl::OUString					BaseURL;
547         /*if relative to file system should be formed*/
548         bool                            RelFsys;//i56629, i49415?, i64585?
549         /*the action to set the PDF hyperlink to*/
550         PDFWriter::PDFLinkDefaultAction DefaultLinkAction;
551         //convert the .od? target file type in a link to a .pdf type
552         //this is examined before doing anything else
553         bool                            ConvertOOoTargetToPDFTarget;
554         //when the file type is .pdf, force the GoToR action
555         bool                            ForcePDFAction;
556 
557         /* decides the PDF language level to be produced */
558         PDFVersion						Version;
559         /* valid for PDF >= 1.4
560            causes the MarkInfo entry in the document catalog to be set
561         */
562         bool							Tagged;
563         /* forces the embedding of PDF standard fonts */
564         bool                            EmbedStandardFonts;
565         /*  determines in which format a form
566             will be submitted.
567          */
568         PDFWriter::ExportDataFormat		SubmitFormat;
569         bool                            AllowDuplicateFieldNames;
570         bool                            FieldsUseSystemFonts;
571         /* the following data members are used to customize the PDF viewer
572            preferences
573          */
574         /* see 3.6.1 PDF v 1.4 ref*/
575         PDFWriter::PDFViewerPageMode    PDFDocumentMode;
576         PDFWriter::PDFViewerAction      PDFDocumentAction;
577         // in percent, valid only if PDFDocumentAction == ActionZoom
578         sal_Int32                       Zoom;
579 
580         /* see 8.6 PDF v 1.4 ref
581            specifies whether to hide the viewer tool
582           bars when the document is active.
583         */
584         bool                            HideViewerToolbar;
585         bool                            HideViewerMenubar;
586         bool                            HideViewerWindowControls;
587         bool                            FitWindow;
588         bool                            OpenInFullScreenMode;
589         bool                            CenterWindow;
590         bool                            DisplayPDFDocumentTitle;
591         PDFPageLayout                   PageLayout;
592         bool                            FirstPageLeft;
593         // intially visible page in viewer (starting with 0 for first page)
594         sal_Int32                       InitialPage;
595         sal_Int32                       OpenBookmarkLevels; // -1 means all levels
596 
597         PDFWriter::PDFEncryptionProperties	Encryption;
598         PDFWriter::PDFDocInfo           DocumentInfo;
599 
600         com::sun::star::lang::Locale    DocumentLocale; // defines the document default language
601         sal_uInt32                      DPIx, DPIy;     // how to handle MapMode( MAP_PIXEL )
602                                                         // 0 here specifies a default handling
603         PDFWriter::ColorMode            ColorMode;
604 
PDFWriterContextvcl::PDFWriter::PDFWriterContext605         PDFWriterContext() :
606                 RelFsys( false ), //i56629, i49415?, i64585?
607                 DefaultLinkAction( PDFWriter::URIAction ),
608                 ConvertOOoTargetToPDFTarget( false ),
609                 ForcePDFAction( false ),
610                 Version( PDFWriter::PDF_1_4 ),
611                 Tagged( false ),
612                 EmbedStandardFonts( false ),
613                 SubmitFormat( PDFWriter::FDF ),
614                 AllowDuplicateFieldNames( false ),
615                 FieldsUseSystemFonts( true ),
616                 PDFDocumentMode( PDFWriter::ModeDefault ),
617                 PDFDocumentAction( PDFWriter::ActionDefault ),
618                 Zoom( 100 ),
619                 HideViewerToolbar( false ),
620                 HideViewerMenubar( false ),
621                 HideViewerWindowControls( false ),
622                 FitWindow( false ),
623                 OpenInFullScreenMode( false ),
624                 CenterWindow( false ),
625                 DisplayPDFDocumentTitle( true ),
626                 PageLayout( PDFWriter::DefaultLayout ),
627                 FirstPageLeft( false ),
628                 InitialPage( 1 ),
629                 OpenBookmarkLevels( -1 ),
630 				Encryption(),
631 				DPIx( 0 ),
632 				DPIy( 0 ),
633                 ColorMode( PDFWriter::DrawColor )
634         {}
635     };
636 
637     PDFWriter( const PDFWriterContext& rContext, const com::sun::star::uno::Reference< com::sun::star::beans::XMaterialHolder >& );
638     ~PDFWriter();
639 
640     /** Returns an OutputDevice for formatting
641         <p>This Output device is guaranteed to use the same
642         font metrics as the resulting PDF file.</p>
643 
644         @returns
645         the reference output device
646     */
647     OutputDevice* GetReferenceDevice();
648 
649     /** Creates a new page to fill
650         <p>If width and height are not set the page size
651         is inherited from the page tree</p>
652         <p>other effects:
653         resets the graphics state: MapMode, Font
654         Colors and other state information MUST
655         be set again or are undefined.
656         </p>
657 
658         @returns
659         returns the page id of the new page
660     */
661     sal_Int32 NewPage( sal_Int32 nPageWidth = 0, sal_Int32 nPageHeight = 0, Orientation eOrientation = Inherit );
662     /** Play a metafile like an outputdevice would do
663     */
664     struct PlayMetafileContext
665     {
666         int     m_nMaxImageResolution;
667         bool    m_bOnlyLosslessCompression;
668         int     m_nJPEGQuality;
669         bool    m_bTransparenciesWereRemoved;
670 
PlayMetafileContextvcl::PDFWriter::PlayMetafileContext671         PlayMetafileContext()
672         : m_nMaxImageResolution( 0 )
673         , m_bOnlyLosslessCompression( false )
674         , m_nJPEGQuality( 90 )
675         , m_bTransparenciesWereRemoved( false )
676         {}
677 
678     };
679     void PlayMetafile( const GDIMetaFile&, const PlayMetafileContext&, vcl::PDFExtOutDevData* pDevDat = NULL );
680 
681     /* sets the document locale originally passed with the context to a new value
682      * only affects the output if used before calling <code>Emit/code>.
683      */
684     void SetDocumentLocale( const com::sun::star::lang::Locale& rDocLocale );
685 
686     /* finishes the file */
687     bool Emit();
688 
689     /*
690      * Get a list of errors that occured during processing
691      * this should enable the producer to give feedback about
692      * any anomalies that might have occured
693      */
694     std::set< ErrorCode > GetErrors();
695 
696     PDFVersion GetVersion() const;
697 
698     static com::sun::star::uno::Reference< com::sun::star::beans::XMaterialHolder >
699            InitEncryption( const rtl::OUString& i_rOwnerPassword,
700                            const rtl::OUString& i_rUserPassword,
701                            bool b128Bit
702                          );
703 
704     /* functions for graphics state */
705     /* flag values: see vcl/outdev.hxx */
706     void				Push( sal_uInt16 nFlags = 0xffff );
707     void				Pop();
708 
709     void               SetClipRegion();
710     void               SetClipRegion( const basegfx::B2DPolyPolygon& rRegion );
711     void               MoveClipRegion( long nHorzMove, long nVertMove );
712     void               IntersectClipRegion( const Rectangle& rRect );
713     void               IntersectClipRegion( const basegfx::B2DPolyPolygon& rRegion );
714 
715     void               SetAntialiasing( sal_uInt16 nMode =  0 );
716 
717     void               SetLayoutMode( sal_uLong nMode );
718     void               SetDigitLanguage( LanguageType eLang );
719 
720     void               SetLineColor( const Color& rColor );
SetLineColor()721     void               SetLineColor() { SetLineColor( Color( COL_TRANSPARENT ) ); }
722 
723     void               SetFillColor( const Color& rColor );
SetFillColor()724     void               SetFillColor() { SetFillColor( Color( COL_TRANSPARENT ) ); }
725 
726     void               SetFont( const Font& rNewFont );
727     void               SetTextColor( const Color& rColor );
728     void               SetTextFillColor();
729     void               SetTextFillColor( const Color& rColor );
730 
731     void               SetTextLineColor();
732     void               SetTextLineColor( const Color& rColor );
733     void               SetOverlineColor();
734     void               SetOverlineColor( const Color& rColor );
735     void               SetTextAlign( ::TextAlign eAlign );
736 
737     void               SetMapMode();
738     void               SetMapMode( const MapMode& rNewMapMode );
739 
740 
741     /* actual drawing functions */
742     void				DrawText( const Point& rPos, const String& rText );
743 
744     void				DrawTextLine( const Point& rPos, long nWidth,
745                                       FontStrikeout eStrikeout,
746                                       FontUnderline eUnderline,
747                                       FontUnderline eOverline,
748                                       sal_Bool bUnderlineAbove = sal_False );
749     void				DrawTextArray( const Point& rStartPt, const XubString& rStr,
750                                        const sal_Int32* pDXAry = NULL,
751                                        xub_StrLen nIndex = 0,
752                                        xub_StrLen nLen = STRING_LEN );
753     void				DrawStretchText( const Point& rStartPt, sal_uLong nWidth,
754                                          const XubString& rStr,
755                                          xub_StrLen nIndex = 0, xub_StrLen nLen = STRING_LEN );
756     void				DrawText( const Rectangle& rRect,
757                                   const XubString& rStr, sal_uInt16 nStyle = 0 );
758 
759     void				DrawPixel( const Point& rPt, const Color& rColor );
DrawPixel(const Point & rPt)760     void				DrawPixel( const Point& rPt )
761     { DrawPixel( rPt, Color( COL_TRANSPARENT ) ); }
762     void				DrawPixel( const Polygon& rPts, const Color* pColors = NULL );
DrawPixel(const Polygon & rPts,const Color & rColor)763     void				DrawPixel( const Polygon& rPts, const Color& rColor )
764     { Push(); SetLineColor( rColor ); DrawPixel( rPts ); Pop(); }
765 
766     void				DrawLine( const Point& rStartPt, const Point& rEndPt );
767     void				DrawLine( const Point& rStartPt, const Point& rEndPt,
768                                   const LineInfo& rLineInfo );
769     void				DrawPolyLine( const Polygon& rPoly );
770     void				DrawPolyLine( const Polygon& rPoly,
771                                       const LineInfo& rLineInfo );
772     void                DrawPolyLine( const Polygon& rPoly, const ExtLineInfo& rInfo );
773     void				DrawPolygon( const Polygon& rPoly );
774     void				DrawPolyPolygon( const PolyPolygon& rPolyPoly );
775     void				DrawRect( const Rectangle& rRect );
776     void				DrawRect( const Rectangle& rRect,
777                                   sal_uLong nHorzRount, sal_uLong nVertRound );
778     void				DrawEllipse( const Rectangle& rRect );
779     void				DrawArc( const Rectangle& rRect,
780                                  const Point& rStartPt, const Point& rEndPt );
781     void				DrawPie( const Rectangle& rRect,
782                                  const Point& rStartPt, const Point& rEndPt );
783     void				DrawChord( const Rectangle& rRect,
784                                    const Point& rStartPt, const Point& rEndPt );
785 
786     void				DrawBitmap( const Point& rDestPt,
787                                     const Bitmap& rBitmap );
788     void				DrawBitmap( const Point& rDestPt, const Size& rDestSize,
789                                     const Bitmap& rBitmap );
790     void				DrawBitmap( const Point& rDestPt, const Size& rDestSize,
791                                     const Point& rSrcPtPixel, const Size& rSrcSizePixel,
792                                     const Bitmap& rBitmap );
793 
794     void				DrawBitmapEx( const Point& rDestPt,
795                                       const BitmapEx& rBitmapEx );
796     void				DrawBitmapEx( const Point& rDestPt, const Size& rDestSize,
797                                       const BitmapEx& rBitmapEx );
798     void				DrawBitmapEx( const Point& rDestPt, const Size& rDestSize,
799                                       const Point& rSrcPtPixel, const Size& rSrcSizePixel,
800                                       const BitmapEx& rBitmapEx );
801 
802     void				DrawMask( const Point& rDestPt,
803                                   const Bitmap& rBitmap, const Color& rMaskColor );
804     void				DrawMask( const Point& rDestPt, const Size& rDestSize,
805                                   const Bitmap& rBitmap, const Color& rMaskColor );
806     void				DrawMask( const Point& rDestPt, const Size& rDestSize,
807                                   const Point& rSrcPtPixel, const Size& rSrcSizePixel,
808                                   const Bitmap& rBitmap, const Color& rMaskColor );
809 
810     void				DrawGradient( const Rectangle& rRect, const Gradient& rGradient );
811     void				DrawGradient( const PolyPolygon& rPolyPoly, const Gradient& rGradient );
812 
813     void				DrawHatch( const PolyPolygon& rPolyPoly, const Hatch& rHatch );
814 
815     void				DrawWallpaper( const Rectangle& rRect, const Wallpaper& rWallpaper );
816     void				DrawTransparent( const PolyPolygon& rPolyPoly,
817                                          sal_uInt16 nTransparencePercent );
818 
819     /** Start a transparency group
820 
821     Drawing operations can be grouped together to acquire a common transparency
822     behaviour; after calling <code>BeginTransparencyGroup</code> all drawing
823     operations will be grouped together into a transparent object.
824 
825     The transparency behaviour is set with ond of the <code>EndTransparencyGroup</code>
826     calls and can be either a constant transparency factor or a transparent
827     soft mask in form of an 8 bit gray scale bitmap.
828 
829     It is permissible to nest transparency group.
830 
831     Transparency groups MUST NOT span multiple pages
832 
833     Transparency is a feature introduced in PDF1.4, so transparency group
834     will be ignored if the produced PDF has a lower version. The drawing
835     operations will be emitted normally.
836     */
837     void				BeginTransparencyGroup();
838 
839     /** End a transparency group with constant transparency factor
840 
841     This ends a transparency group and inserts it on the current page. The
842     coordinates of the group result out of the grouped drawing operations.
843 
844     @param rBoundRect
845     The bounding rectangle of the group
846 
847     @param nTransparencePercent
848     The transparency factor
849     */
850     void				EndTransparencyGroup( const Rectangle& rBoundRect, sal_uInt16 nTransparencePercent );
851 
852     /** End a transparency group with an alpha mask
853 
854     This ends a transparency group and inserts it on the current page. The
855     coordinates of the group result out of the grouped drawing operations.
856 
857     @param rBoundRect
858     The bounding rectangle of the group
859 
860     @param rAlphaMask
861     The transparency mask; must be an 8 bit grayscale image
862     */
863     void				EndTransparencyGroup( const Rectangle& rBoundRect, const Bitmap& rAlphaMask );
864 
865     /** Insert a JPG encoded image (optionally with mask)
866 
867     @param rJPGData
868     a Stream containing the encoded image
869 
870     @param bIsTrueColor
871     true: jpeg is 24 bit true color, false: jpeg is 8 bit greyscale
872 
873     @param rSrcSizePixel
874     size in pixel of the image
875 
876     @param rTargetArea
877     where to put the image
878 
879     @param rMask
880     optional mask; if not empty it must have
881     the same pixel size as the image and
882     be either 1 bit black&white or 8 bit grey
883     */
884     void				DrawJPGBitmap( SvStream& rJPGData, bool bIsTrueColor, const Size& rSrcSizePixel, const Rectangle& rTargetArea, const Bitmap& rMask );
885 
886     /** Create a new named destination to be used in a link from another PDF document
887 
888     @parm sDestName
889     the name (label) of the bookmark, to be used to jump to
890 
891     @param rRect
892     target rectangle on page to be displayed if dest is jumped to
893 
894     @param nPageNr
895     number of page the dest is on (as returned by NewPage)
896     or -1 in which case the current page is used
897 
898     @param eType
899     what dest type to use
900 
901     @returns
902     the destination id (to be used in SetLinkDest) or
903     -1 if page id does not exist
904     */
905     sal_Int32			CreateNamedDest( const rtl::OUString& sDestName, const Rectangle& rRect, sal_Int32 nPageNr = -1, DestAreaType eType = XYZ );
906     /** Create a new destination to be used in a link
907 
908     @param rRect
909     target rectangle on page to be displayed if dest is jumped to
910 
911     @param nPageNr
912     number of page the dest is on (as returned by NewPage)
913     or -1 in which case the current page is used
914 
915     @param eType
916     what dest type to use
917 
918     @returns
919     the destination id (to be used in SetLinkDest) or
920     -1 if page id does not exist
921     */
922     sal_Int32			CreateDest( const Rectangle& rRect, sal_Int32 nPageNr = -1, DestAreaType eType = XYZ );
923     /** Create a new link on a page
924 
925     @param rRect
926     active rectangle of the link (that is the area that has to be
927     hit to activate the link)
928 
929     @param nPageNr
930     number of page the link is on (as returned by NewPage)
931     or -1 in which case the current page is used
932 
933     @returns
934     the link id (to be used in SetLinkDest, SetLinkURL) or
935     -1 if page id does not exist
936     */
937     sal_Int32			CreateLink( const Rectangle& rRect, sal_Int32 nPageNr = -1 );
938 
939     /** creates a destination which is not intended to be referred to by a link, but by a public destination Id.
940 
941         Form widgets, for instance, might refer to a destination, without ever actually creating a source link to
942         point to this destination. In such cases, a public destination Id will be assigned to the form widget,
943         and later on, the concrete destination data for this public Id will be registered using RegisterDestReference.
944 
945         @param rRect
946             target rectangle on page to be displayed if dest is jumped to
947 
948         @param nPageNr
949             number of page the dest is on (as returned by NewPage)
950             or -1 in which case the current page is used
951 
952         @param eType
953             what dest type to use
954 
955         @returns
956             the internal destination Id.
957     */
958     sal_Int32           RegisterDestReference( sal_Int32 nDestId, const Rectangle& rRect, sal_Int32 nPageNr = -1, DestAreaType eType = XYZ );
959 
960 
961     /** Set the destination for a link
962         <p>will change a URL type link to a dest link if necessary</p>
963 
964         @param nLinkId
965         the link to be changed
966 
967         @param nDestId
968         the dest the link shall point to
969         @returns
970         0 for success
971         -1 in case the link id does not exist
972         -2 in case the dest id does not exist
973     */
974     sal_Int32			SetLinkDest( sal_Int32 nLinkId, sal_Int32 nDestId );
975     /** Set the URL for a link
976         <p>will change a dest type link to an URL type link if necessary</p>
977         @param nLinkId
978         the link to be changed
979 
980         @param rURL
981         the URL the link shall point to.
982         The URL will be parsed (and corrected) by the <code>com.sun.star.util.URLTransformer</code>
983         service; the result will then appear literally in the PDF file produced
984 
985         @returns
986         0 for success
987         -1 in case the link id does not exist
988     */
989     sal_Int32			SetLinkURL( sal_Int32 nLinkId, const rtl::OUString& rURL );
990     /** Resolve link in logical structure
991         <p>
992         If a link is created after the corresponding visual appearance was drawn
993         it is not possible to set the link id as a property attribute to the
994         link structure item that should be created in tagged PDF around the
995         visual appearance of a link.
996         </p>
997         <p>
998         For this reason an arbitrary id can be given to
999         <code>SetStructureAttributeNumerical</code> at the time the text for
1000         the link is drawn. To resolve this arbitrary id again when the actual
1001         link annotation is created use SetLinkPropertyID. When <code>Emit</code>
1002         finally gets called all <code>LinkAnnotation</code> type structure attributes
1003         will be replaced with the correct link id.
1004         </p>
1005         <p>
1006         CAUTION: this technique must be used either for all or none of the links
1007         in a document since the link id space and arbitrary property id space
1008         could overlap and it would be impossible to resolve whether a <code>Link</code>
1009         structure attribute value was arbitrary or already a real id.
1010         </p>
1011 
1012         @param nLinkId
1013         the link to be mapped
1014 
1015         @param nPropertyID
1016         the arbitrary id set in a <code>Link</code> structure element to address
1017         the link with real id <code>nLinkId</code>
1018      */
1019     void				SetLinkPropertyID( sal_Int32 nLinkId, sal_Int32 nPropertyID );
1020     /** Create a new outline item
1021 
1022         @param nParent
1023         declares the parent of the new item in the outline hierarchy.
1024         An invalid value will result in a new toplevel item.
1025 
1026         @param rText
1027         sets the title text of the item
1028 
1029         @param nDestId
1030         declares which Dest (created with CreateDest) the outline item
1031         will point to
1032 
1033         @returns
1034         the outline item id of the new item
1035     */
1036     sal_Int32 CreateOutlineItem( sal_Int32 nParent = 0, const rtl::OUString& rText = rtl::OUString(), sal_Int32 nDestID = -1 );
1037 
1038     /** Set an outline item's parent
1039 
1040     @param nItem
1041     specififies which item should be reparented.
1042 
1043     @param nNewParent
1044     specifies which outline item will be the item's new parent.
1045     Use 0 for reparenting to top level.
1046 
1047     @returns
1048     -1 if the item does not exist
1049     -2 if the new parent does not exist, item will be reparented to top level.
1050     */
1051     sal_Int32 SetOutlineItemParent( sal_Int32 nItem, sal_Int32 nNewParent );
1052 
1053     /** Set an outline item's title text
1054 
1055     @param nItem
1056     specififies which item should get a new text
1057 
1058     @param rText
1059     sets the title text of the item
1060 
1061     @returns
1062     0 if the item exists and the text was changed
1063     -1 if the item does not exist
1064     */
1065     sal_Int32 SetOutlineItemText( sal_Int32 nItem, const rtl::OUString& rText );
1066 
1067     /** Set an outline item's destination
1068 
1069     @param nItem
1070     specififies which item should get a new dest
1071 
1072     @param nDestID
1073     specifies the item's new destination
1074 
1075     @returns
1076     -1 if the item does not exist
1077     -2 if the new dest does not exist, dest will remain unchanged
1078     */
1079     sal_Int32 SetOutlineItemDest( sal_Int32 nItem, sal_Int32 nDestID );
1080 
1081     /** Create a new note on a page
1082 
1083     @param rRect
1084     active rectangle of the note (that is the area that has to be
1085     hit to popup the annotation)
1086 
1087     @param rNote
1088     specifies the contents of the note
1089 
1090     @param nPageNr
1091     number of page the note is on (as returned by NewPage)
1092     or -1 in which case the current page is used
1093     */
1094     void CreateNote( const Rectangle& rRect, const PDFNote& rNote, sal_Int32 nPageNr = -1 );
1095 
1096     /** begin a new logical structure element
1097 
1098     <p>
1099     BeginStructureElement/EndStructureElement calls build the logical structure
1100     of the PDF - the basis for tagged PDF. Structural elements are implemented
1101     using marked content tags. Each structural element can contain sub elements
1102     (e.g. a section can contain a heading and a paragraph). The structure hierarchy
1103     is build automatically from the Begin/EndStructureElement calls.
1104 
1105     A structural element need not be contained on one page; e.g. paragraphs often
1106     run from one page to the next. In this case the corresponding EndStructureElement
1107     must be called while drawing the next page.
1108     </p>
1109 
1110     <p>
1111     BeginStructureElement and EndStructureElement must be called only after
1112     <member scope="vcl">PDFWriter::NewPage</member> has been called and before
1113     <member scope="vcl">PDFWriter::Emit</member>gets called. The current page
1114     number is an implicit context parameter for Begin/EndStructureElement.
1115     </p>
1116 
1117     <p>
1118     For pagination artifacts that are not part of the logical structure
1119     of the document (like header, footer or page number) the special
1120     StructElement <code>NonStructElement</code> exists. To place content
1121     outside of the struture tree simply call
1122     <code>BeginStructureElement( NonStructElement )</code> then draw your
1123     content and then call <code>EndStructureElement()</code>. All children
1124     of a <code>NonStructElement</code> will not be part of the structure.
1125     Nonetheless if you add a child structural element to a
1126     <code>NonStructElement</code> you will still have to call
1127     <code>EndStructureElement</code> for it. Best think of the structure
1128     tree as a stack.
1129     </p>
1130 
1131     <p>
1132     Note: there is always one structural element in existance without having
1133     called <code>BeginStructureElement</code>; this is the root of the structure
1134     tree (called StructTreeRoot). The StructTreeRoot has always the id 0.
1135     </p>
1136 
1137     @param eType
1138     denotes what kind of element to begin (e.g. a heading or paragraph)
1139 
1140     @param rAlias
1141     the specified alias will be used as structure tag. Also an entry in the PDF's
1142     role map will be created mapping alias to regular structure type.
1143 
1144     @returns
1145     the new structure element's id for use in <code>SetCurrentStructureElement</code>
1146      */
1147      sal_Int32 BeginStructureElement( enum StructElement eType, const rtl::OUString& rAlias = rtl::OUString() );
1148     /** end the current logical structure element
1149 
1150     <p>
1151     Close the current structure element. The current element's
1152     parent becomes the current structure element again.
1153     </p>
1154 
1155     @see BeginStructureElement
1156      */
1157     void EndStructureElement();
1158     /** set the current structure element
1159 
1160     <p>
1161     For different purposes it may be useful to paint a structure element's
1162     content discontinously. In that case an already existing structure element
1163     can be appended to by using <code>SetCurrentStructureElement</code>. The
1164     refenrenced structure element becomes the current structure element with
1165     all consequences: all following structure elements are appended as children
1166     of the current element.
1167     </p>
1168 
1169     @param nElement
1170     the id of the new current structure element
1171 
1172     @returns
1173     <true/> if the current structure element could be set successfully
1174     <false/> if the current structure element could not be changed
1175     (e.g. if the passed element id is invalid)
1176      */
1177     bool SetCurrentStructureElement( sal_Int32 nElement );
1178     /** get the current structure element's id
1179 
1180     @returns
1181     the id of the current structure element or -1 if no structure exists
1182     (e.g. if no tagged PDF is being produced)
1183      */
1184     sal_Int32 GetCurrentStructureElement();
1185 
1186     /** set a structure attribute on the current structural element
1187 
1188     SetStructureAttribute sets an attribute of the current structural element to a
1189     new value. A consistency check is performed before actually setting the value;
1190     if the check fails, the function returns <FALSE/> and the attribute remains
1191     unchanged.
1192 
1193     @param eAttr
1194     denotes what attribute to change
1195 
1196     @param eVal
1197     the value to set the attribute to
1198 
1199     @returns
1200     <TRUE/> if the value was valid and the change has been performed,
1201     <FALSE/> if the attribute or value was invalid; attribute remains unchanged
1202      */
1203     bool SetStructureAttribute( enum StructAttribute eAttr, enum StructAttributeValue eVal );
1204     /** set a structure attribute on the current structural element
1205 
1206     SetStructureAttributeNumerical sets an attribute of the current structural element
1207     to a new numerical value. A consistency check is performed before actually setting
1208     the value; if the check fails, the function returns <FALSE/> and the attribute
1209     remains unchanged.
1210 
1211     @param eAttr
1212     denotes what attribute to change
1213 
1214     @param nValue
1215     the value to set the attribute to
1216 
1217     @returns
1218     <TRUE/> if the value was valid and the change has been performed,
1219     <FALSE/> if the attribute or value was invalid; attribute remains unchanged
1220      */
1221     bool SetStructureAttributeNumerical( enum StructAttribute eAttr, sal_Int32 nValue );
1222     /** set the bounding box of a structural element
1223 
1224     SetStructureBoundingBox sets the BBox attribute to a new value. Since the BBox
1225     attribute can only be applied to <code>Table</code>, <code>Figure</code>,
1226     <code>Form</code> and <code>Formula</code> elements, a call of this function
1227     for other element types will be ignored and the BBox attribute not be set.
1228 
1229     @param rRect
1230     the new bounding box for the structural element
1231      */
1232     void SetStructureBoundingBox( const Rectangle& rRect );
1233 
1234     /** set the ActualText attribute of a structural element
1235 
1236     ActualText contains the Unicode text without layout artifacts that is shown by
1237     a structural element. For example if a line is ended prematurely with a break in
1238     a word and continued on the next line (e.g. "happen-<newline>stance") the
1239     corresponding ActualText would contain the unbroken line (e.g. "happenstance").
1240 
1241     @param rText
1242     contains the complete logical text the structural element displays.
1243      */
1244     void SetActualText( const String& rText );
1245 
1246     /** set the Alt attribute of a strutural element
1247 
1248     Alt is s replacement text describing the contents of a structural element. This
1249     is mainly used by accessibility applications; e.g. a screen reader would read
1250     the Alt replacement text for an image to a visually impaired user.
1251 
1252     @param rText
1253     contains the replacement text for the structural element
1254     */
1255     void SetAlternateText( const String& rText );
1256 
1257     /** Sets the time in seconds a page will appear before the next
1258         page is shown automatically
1259 
1260         @param nSeconds
1261         time in seconds the current page will be shown; pass 0 for manual advancement
1262 
1263         @param nPageNr
1264         the page number to apply the autoadvance time to; -1 denotes the current page
1265     */
1266     void SetAutoAdvanceTime( sal_uInt32 nSeconds, sal_Int32 nPageNr = -1 );
1267 
1268     /** Sets the transitional effect to be applied when the current page gets shown.
1269 
1270     @param eType
1271     the kind of effect to be used; use Regular to disable transitional effects
1272     for this page
1273 
1274     @param nMilliSec
1275     the duration of the transitional effect in milliseconds;
1276     set 0 to disable transitional effects
1277 
1278     @param nPageNr
1279     the page number to apply the effect to; -1 denotes the current page
1280     */
1281     void SetPageTransition( PageTransition eType, sal_uInt32 nMilliSec, sal_Int32 nPageNr = -1 );
1282 
1283     /** create a new form control
1284 
1285     This function creates a new form control in the PDF and sets its various
1286     properties. Do not pass an actual AnyWidget as <code>rControlType</code>
1287     will be cast to the type described by the type member.
1288 
1289     @param rControlType
1290     a descendant of <code>AnyWidget</code> determing the control's properties
1291 
1292     @returns
1293     the new control's id for reference purposes
1294      */
1295     sal_Int32 CreateControl( const AnyWidget& rControlType, sal_Int32 nPageNr = -1 );
1296 
1297     /** Inserts an additional stream to the PDF file
1298 
1299     This function adds an arbitrary stream to the produced PDF file. May be called
1300     any time before <code>Emit()</code>. The stream will be written during
1301     <code>Emit</code> by calling the <code>PDFOutputStream</code> Object's <code>write</code>
1302     method. After the call the <code>PDFOutputStream</code> will be deleted.
1303 
1304     All additional streams and their mimetypes will be entered into an array
1305     in the trailer dictionary.
1306 
1307     @param rMimeType
1308     the mimetype of the stream
1309 
1310     @param rStream
1311     the interface to the additional stream
1312 
1313     @param bCompress
1314     specifies whether the stream should be flate encoded by PDFWriter or not
1315     */
1316     void AddStream( const String& rMimeType, PDFOutputStream* pStream, bool bCompress );
1317 
1318     /** create a new pattern for filling operations
1319 
1320     This function creates a new pattern to be used for subsequent filling operations.
1321     A pattern can consist of arbitrary drawing operations; all drawing operations
1322     between <code>BeingPattern()</code> and <code>EndPattern()</code> calls
1323     will be recorded and considered as forming up the pattern.
1324 
1325     @param rCellBounds
1326     a rectangle defining the "cell" that will be repeated to form the pattern
1327     */
1328     void BeginPattern( const Rectangle& );
1329     /** finish a new pattern for filling operations
1330 
1331     This functions finishes the pattern create begun with <code>BeginPattern()</code>
1332     and returns a pattern id to be used in subsequent drawing operations.
1333 
1334     @param rMatrix
1335     a transformation to be imposed on the drawing operations that make up the pattern
1336 
1337     @returns
1338     the new pattern's id
1339     */
1340     sal_Int32 EndPattern( const SvtGraphicFill::Transform& rTransformation );
1341     /** draw a polypolygon filled with a pattern
1342 
1343     @param rPolyPoly
1344     PolyPolygon to filled
1345 
1346     @param nPatternId
1347     the pattern previously obtained in the <code>EndPattern</code> call.
1348 
1349     @param bEOFill
1350     true: polypolygon gets filled with EvenOdd method,
1351     false: polypolygon gets filled with nonzero winding method
1352     */
1353     void DrawPolyPolygon( const PolyPolygon& rPolyPoly, sal_Int32 nPatternId, bool bEOFill );
1354 };
1355 
1356 }
1357 
1358 #endif // _VCL_PDFWRITER_HXX
1359