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