LCOV - code coverage report
Current view: top level - include/vcl - pdfwriter.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 73 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 60 0.0 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.11