LCOV - code coverage report
Current view: top level - solver/unxlngi6.pro/inc/vcl - pdfwriter.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 73 0.0 %
Date: 2012-08-25 Functions: 0 59 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 112 0.0 %

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

Generated by: LCOV version 1.10