1*b1cdbd2cSJim Jagielski /************************************************************** 2*b1cdbd2cSJim Jagielski * 3*b1cdbd2cSJim Jagielski * Licensed to the Apache Software Foundation (ASF) under one 4*b1cdbd2cSJim Jagielski * or more contributor license agreements. See the NOTICE file 5*b1cdbd2cSJim Jagielski * distributed with this work for additional information 6*b1cdbd2cSJim Jagielski * regarding copyright ownership. The ASF licenses this file 7*b1cdbd2cSJim Jagielski * to you under the Apache License, Version 2.0 (the 8*b1cdbd2cSJim Jagielski * "License"); you may not use this file except in compliance 9*b1cdbd2cSJim Jagielski * with the License. You may obtain a copy of the License at 10*b1cdbd2cSJim Jagielski * 11*b1cdbd2cSJim Jagielski * http://www.apache.org/licenses/LICENSE-2.0 12*b1cdbd2cSJim Jagielski * 13*b1cdbd2cSJim Jagielski * Unless required by applicable law or agreed to in writing, 14*b1cdbd2cSJim Jagielski * software distributed under the License is distributed on an 15*b1cdbd2cSJim Jagielski * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*b1cdbd2cSJim Jagielski * KIND, either express or implied. See the License for the 17*b1cdbd2cSJim Jagielski * specific language governing permissions and limitations 18*b1cdbd2cSJim Jagielski * under the License. 19*b1cdbd2cSJim Jagielski * 20*b1cdbd2cSJim Jagielski *************************************************************/ 21*b1cdbd2cSJim Jagielski 22*b1cdbd2cSJim Jagielski 23*b1cdbd2cSJim Jagielski 24*b1cdbd2cSJim Jagielski #ifndef _VCL_PDFEXTOUTDEVDATA_HXX 25*b1cdbd2cSJim Jagielski #define _VCL_PDFEXTOUTDEVDATA_HXX 26*b1cdbd2cSJim Jagielski 27*b1cdbd2cSJim Jagielski #include <vcl/dllapi.h> 28*b1cdbd2cSJim Jagielski 29*b1cdbd2cSJim Jagielski #include <vcl/pdfwriter.hxx> 30*b1cdbd2cSJim Jagielski #include <vcl/extoutdevdata.hxx> 31*b1cdbd2cSJim Jagielski #include <vcl/gdimtf.hxx> 32*b1cdbd2cSJim Jagielski #include <vcl/mapmod.hxx> 33*b1cdbd2cSJim Jagielski #include <tools/rtti.hxx> 34*b1cdbd2cSJim Jagielski #include <vector> 35*b1cdbd2cSJim Jagielski #include <deque> 36*b1cdbd2cSJim Jagielski 37*b1cdbd2cSJim Jagielski class Graphic; 38*b1cdbd2cSJim Jagielski 39*b1cdbd2cSJim Jagielski namespace vcl { class PDFWriter; } 40*b1cdbd2cSJim Jagielski 41*b1cdbd2cSJim Jagielski namespace vcl 42*b1cdbd2cSJim Jagielski { 43*b1cdbd2cSJim Jagielski 44*b1cdbd2cSJim Jagielski /* 45*b1cdbd2cSJim Jagielski A PDFExtOutDevBookmarkEntry is being created by the EditEngine if 46*b1cdbd2cSJim Jagielski a bookmark URL has been parsed. The Application is requested to take 47*b1cdbd2cSJim Jagielski care of each bookmark entry by emptying out the bookmark vector. 48*b1cdbd2cSJim Jagielski */ 49*b1cdbd2cSJim Jagielski struct PDFExtOutDevBookmarkEntry 50*b1cdbd2cSJim Jagielski { 51*b1cdbd2cSJim Jagielski /** ID of the link pointing to the bookmark, or -1 if the entry denotes a destination instead of a link. 52*b1cdbd2cSJim Jagielski */ 53*b1cdbd2cSJim Jagielski sal_Int32 nLinkId; 54*b1cdbd2cSJim Jagielski 55*b1cdbd2cSJim Jagielski /** ID of the named destination denoted by the bookmark, or -1 if the entry denotes a link instead of a named destination. 56*b1cdbd2cSJim Jagielski */ 57*b1cdbd2cSJim Jagielski sal_Int32 nDestId; 58*b1cdbd2cSJim Jagielski 59*b1cdbd2cSJim Jagielski /** link target name, respectively destination name 60*b1cdbd2cSJim Jagielski */ 61*b1cdbd2cSJim Jagielski rtl::OUString aBookmark; 62*b1cdbd2cSJim Jagielski PDFExtOutDevBookmarkEntryvcl::PDFExtOutDevBookmarkEntry63*b1cdbd2cSJim Jagielski PDFExtOutDevBookmarkEntry() 64*b1cdbd2cSJim Jagielski :nLinkId( -1 ) 65*b1cdbd2cSJim Jagielski ,nDestId( -1 ) 66*b1cdbd2cSJim Jagielski ,aBookmark() 67*b1cdbd2cSJim Jagielski { 68*b1cdbd2cSJim Jagielski } 69*b1cdbd2cSJim Jagielski }; 70*b1cdbd2cSJim Jagielski 71*b1cdbd2cSJim Jagielski /* 72*b1cdbd2cSJim Jagielski Class that is being set at the OutputDevice allowing the 73*b1cdbd2cSJim Jagielski application to send enhanced PDF commands like CreateLink 74*b1cdbd2cSJim Jagielski */ 75*b1cdbd2cSJim Jagielski struct PageSyncData; 76*b1cdbd2cSJim Jagielski struct GlobalSyncData; 77*b1cdbd2cSJim Jagielski class VCL_DLLPUBLIC PDFExtOutDevData : public ExtOutDevData 78*b1cdbd2cSJim Jagielski { 79*b1cdbd2cSJim Jagielski 80*b1cdbd2cSJim Jagielski const OutputDevice& mrOutDev; 81*b1cdbd2cSJim Jagielski 82*b1cdbd2cSJim Jagielski sal_Bool mbTaggedPDF; 83*b1cdbd2cSJim Jagielski sal_Bool mbExportNotes; 84*b1cdbd2cSJim Jagielski sal_Bool mbExportNotesPages; 85*b1cdbd2cSJim Jagielski sal_Bool mbTransitionEffects; 86*b1cdbd2cSJim Jagielski sal_Bool mbUseLosslessCompression; 87*b1cdbd2cSJim Jagielski sal_Bool mbReduceImageResolution; 88*b1cdbd2cSJim Jagielski sal_Bool mbExportFormFields; 89*b1cdbd2cSJim Jagielski sal_Bool mbExportBookmarks; 90*b1cdbd2cSJim Jagielski sal_Bool mbExportNDests; //i56629 91*b1cdbd2cSJim Jagielski sal_Int32 mnFormsFormat; 92*b1cdbd2cSJim Jagielski sal_Int32 mnPage; 93*b1cdbd2cSJim Jagielski com::sun::star::lang::Locale maDocLocale; 94*b1cdbd2cSJim Jagielski 95*b1cdbd2cSJim Jagielski PageSyncData* mpPageSyncData; 96*b1cdbd2cSJim Jagielski GlobalSyncData* mpGlobalSyncData; 97*b1cdbd2cSJim Jagielski 98*b1cdbd2cSJim Jagielski std::vector< PDFExtOutDevBookmarkEntry > maBookmarks; 99*b1cdbd2cSJim Jagielski 100*b1cdbd2cSJim Jagielski public : 101*b1cdbd2cSJim Jagielski 102*b1cdbd2cSJim Jagielski TYPEINFO(); 103*b1cdbd2cSJim Jagielski PDFExtOutDevData( const OutputDevice& rOutDev ); 104*b1cdbd2cSJim Jagielski virtual ~PDFExtOutDevData(); 105*b1cdbd2cSJim Jagielski 106*b1cdbd2cSJim Jagielski sal_Bool PlaySyncPageAct( PDFWriter& rWriter, sal_uInt32& rCurGDIMtfAction ); 107*b1cdbd2cSJim Jagielski void ResetSyncData(); 108*b1cdbd2cSJim Jagielski 109*b1cdbd2cSJim Jagielski void PlayGlobalActions( PDFWriter& rWriter ); 110*b1cdbd2cSJim Jagielski 111*b1cdbd2cSJim Jagielski 112*b1cdbd2cSJim Jagielski 113*b1cdbd2cSJim Jagielski sal_Bool GetIsExportNotes() const; 114*b1cdbd2cSJim Jagielski void SetIsExportNotes( const sal_Bool bExportNotes ); 115*b1cdbd2cSJim Jagielski 116*b1cdbd2cSJim Jagielski sal_Bool GetIsExportNotesPages() const; 117*b1cdbd2cSJim Jagielski void SetIsExportNotesPages( const sal_Bool bExportNotesPages ); 118*b1cdbd2cSJim Jagielski 119*b1cdbd2cSJim Jagielski sal_Bool GetIsExportTaggedPDF() const; 120*b1cdbd2cSJim Jagielski void SetIsExportTaggedPDF( const sal_Bool bTaggedPDF ); 121*b1cdbd2cSJim Jagielski 122*b1cdbd2cSJim Jagielski sal_Bool GetIsExportTransitionEffects() const; 123*b1cdbd2cSJim Jagielski void SetIsExportTransitionEffects( const sal_Bool bTransitionalEffects ); 124*b1cdbd2cSJim Jagielski 125*b1cdbd2cSJim Jagielski sal_Bool GetIsExportFormFields() const; 126*b1cdbd2cSJim Jagielski void SetIsExportFormFields( const sal_Bool bExportFormFields ); 127*b1cdbd2cSJim Jagielski 128*b1cdbd2cSJim Jagielski sal_Int32 GetFormsFormat() const; 129*b1cdbd2cSJim Jagielski void SetFormsFormat( const sal_Int32 nFormsFormat ); 130*b1cdbd2cSJim Jagielski 131*b1cdbd2cSJim Jagielski sal_Bool GetIsExportBookmarks() const; 132*b1cdbd2cSJim Jagielski void SetIsExportBookmarks( const sal_Bool bExportBookmarks ); 133*b1cdbd2cSJim Jagielski 134*b1cdbd2cSJim Jagielski sal_Bool GetIsExportNamedDestinations() const; //i56629 135*b1cdbd2cSJim Jagielski void SetIsExportNamedDestinations( const sal_Bool bExportNDests ); //i56629 136*b1cdbd2cSJim Jagielski 137*b1cdbd2cSJim Jagielski // PageNumber, Compression is being set by the PDFExport 138*b1cdbd2cSJim Jagielski sal_Int32 GetCurrentPageNumber() const; 139*b1cdbd2cSJim Jagielski void SetCurrentPageNumber( const sal_Int32 nPage ); 140*b1cdbd2cSJim Jagielski 141*b1cdbd2cSJim Jagielski sal_Bool GetIsLosslessCompression() const; 142*b1cdbd2cSJim Jagielski void SetIsLosslessCompression( const sal_Bool bLosslessCompression ); 143*b1cdbd2cSJim Jagielski 144*b1cdbd2cSJim Jagielski sal_Bool GetIsReduceImageResolution() const; 145*b1cdbd2cSJim Jagielski void SetIsReduceImageResolution( const sal_Bool bReduceImageResolution ); 146*b1cdbd2cSJim Jagielski 147*b1cdbd2cSJim Jagielski const com::sun::star::lang::Locale& GetDocumentLocale() const; 148*b1cdbd2cSJim Jagielski void SetDocumentLocale( const com::sun::star::lang::Locale& rLoc ); 149*b1cdbd2cSJim Jagielski 150*b1cdbd2cSJim Jagielski std::vector< PDFExtOutDevBookmarkEntry >& GetBookmarks(); 151*b1cdbd2cSJim Jagielski 152*b1cdbd2cSJim Jagielski /** Start a new group of render output 153*b1cdbd2cSJim Jagielski 154*b1cdbd2cSJim Jagielski Use this method to group render output. 155*b1cdbd2cSJim Jagielski */ 156*b1cdbd2cSJim Jagielski void BeginGroup(); 157*b1cdbd2cSJim Jagielski 158*b1cdbd2cSJim Jagielski /** End render output 159*b1cdbd2cSJim Jagielski 160*b1cdbd2cSJim Jagielski This method ends grouped render output without 161*b1cdbd2cSJim Jagielski further actions. 162*b1cdbd2cSJim Jagielski */ 163*b1cdbd2cSJim Jagielski void EndGroup(); 164*b1cdbd2cSJim Jagielski 165*b1cdbd2cSJim Jagielski /** End render output 166*b1cdbd2cSJim Jagielski 167*b1cdbd2cSJim Jagielski This method ends grouped render output, that can be 168*b1cdbd2cSJim Jagielski represented by a GfxLink. This is typically used for 169*b1cdbd2cSJim Jagielski external graphic files, such as JPEGs, EPS files etc. 170*b1cdbd2cSJim Jagielski The BeginGroup/EndGroup calls must exactly enclose the 171*b1cdbd2cSJim Jagielski relevant OutputDevice calls issued to render the 172*b1cdbd2cSJim Jagielski graphic the normal way. 173*b1cdbd2cSJim Jagielski 174*b1cdbd2cSJim Jagielski @param rGraphic 175*b1cdbd2cSJim Jagielski The link to the original graphic 176*b1cdbd2cSJim Jagielski 177*b1cdbd2cSJim Jagielski @param nTransparency 178*b1cdbd2cSJim Jagielski Eight bit transparency value, with 0 denoting full opacity, 179*b1cdbd2cSJim Jagielski and 255 full transparency. 180*b1cdbd2cSJim Jagielski 181*b1cdbd2cSJim Jagielski @param rOutputRect 182*b1cdbd2cSJim Jagielski The output rectangle of the graphic. 183*b1cdbd2cSJim Jagielski 184*b1cdbd2cSJim Jagielski @param rVisibleOutputRect 185*b1cdbd2cSJim Jagielski The visible part of the output. This might be less than 186*b1cdbd2cSJim Jagielski rOutputRect, e.g. for cropped graphics. 187*b1cdbd2cSJim Jagielski */ 188*b1cdbd2cSJim Jagielski void EndGroup( const Graphic& rGraphic, 189*b1cdbd2cSJim Jagielski sal_uInt8 nTransparency, 190*b1cdbd2cSJim Jagielski const Rectangle& rOutputRect, 191*b1cdbd2cSJim Jagielski const Rectangle& rVisibleOutputRect ); 192*b1cdbd2cSJim Jagielski //--->i56629 193*b1cdbd2cSJim Jagielski /** Create a new named destination to be used in a link to this document from another PDF document 194*b1cdbd2cSJim Jagielski (see PDF spec 1.4, 8.2.1) 195*b1cdbd2cSJim Jagielski 196*b1cdbd2cSJim Jagielski @parm sDestName 197*b1cdbd2cSJim Jagielski the name this destination will be addressed with from others PDF document 198*b1cdbd2cSJim Jagielski 199*b1cdbd2cSJim Jagielski @param rRect 200*b1cdbd2cSJim Jagielski target rectangle on page to be displayed if dest is jumped to 201*b1cdbd2cSJim Jagielski 202*b1cdbd2cSJim Jagielski @param nPageNr 203*b1cdbd2cSJim Jagielski number of page the dest is on (as returned by NewPage) 204*b1cdbd2cSJim Jagielski or -1 in which case the current page is used 205*b1cdbd2cSJim Jagielski 206*b1cdbd2cSJim Jagielski @param eType 207*b1cdbd2cSJim Jagielski what dest type to use 208*b1cdbd2cSJim Jagielski 209*b1cdbd2cSJim Jagielski @returns 210*b1cdbd2cSJim Jagielski the destination id (to be used in SetLinkDest) or 211*b1cdbd2cSJim Jagielski -1 if page id does not exist 212*b1cdbd2cSJim Jagielski */ 213*b1cdbd2cSJim Jagielski sal_Int32 CreateNamedDest( const String& sDestName, const Rectangle& rRect, sal_Int32 nPageNr = -1, PDFWriter::DestAreaType eType = PDFWriter::XYZ ); 214*b1cdbd2cSJim Jagielski 215*b1cdbd2cSJim Jagielski /** registers a destination for which a destinatin ID needs to be known immediately, instead of later on setting it via 216*b1cdbd2cSJim Jagielski SetLinkDest. 217*b1cdbd2cSJim Jagielski 218*b1cdbd2cSJim Jagielski This is used in contexts where a destination is referenced by means other than a link. 219*b1cdbd2cSJim Jagielski 220*b1cdbd2cSJim Jagielski Later in the export process, a call to DescribeRegisteredDest must be made, providing the information about 221*b1cdbd2cSJim Jagielski the destination. 222*b1cdbd2cSJim Jagielski 223*b1cdbd2cSJim Jagielski @return 224*b1cdbd2cSJim Jagielski the unique Id of the destination 225*b1cdbd2cSJim Jagielski */ 226*b1cdbd2cSJim Jagielski sal_Int32 RegisterDest(); 227*b1cdbd2cSJim Jagielski 228*b1cdbd2cSJim Jagielski /** provides detailed information about a destination range which previously has been registered using RegisterDest. 229*b1cdbd2cSJim Jagielski */ 230*b1cdbd2cSJim Jagielski void DescribeRegisteredDest( sal_Int32 nDestId, const Rectangle& rRect, sal_Int32 nPageNr = -1, PDFWriter::DestAreaType eType = PDFWriter::XYZ ); 231*b1cdbd2cSJim Jagielski 232*b1cdbd2cSJim Jagielski //<---i56629 233*b1cdbd2cSJim Jagielski 234*b1cdbd2cSJim Jagielski /** Create a new destination to be used in a link 235*b1cdbd2cSJim Jagielski 236*b1cdbd2cSJim Jagielski @param rRect 237*b1cdbd2cSJim Jagielski target rectangle on page to be displayed if dest is jumped to 238*b1cdbd2cSJim Jagielski 239*b1cdbd2cSJim Jagielski @param nPageNr 240*b1cdbd2cSJim Jagielski number of page the dest is on (as returned by NewPage) 241*b1cdbd2cSJim Jagielski or -1 in which case the current page is used 242*b1cdbd2cSJim Jagielski 243*b1cdbd2cSJim Jagielski @param eType 244*b1cdbd2cSJim Jagielski what dest type to use 245*b1cdbd2cSJim Jagielski 246*b1cdbd2cSJim Jagielski @returns 247*b1cdbd2cSJim Jagielski the destination id (to be used in SetLinkDest) or 248*b1cdbd2cSJim Jagielski -1 if page id does not exist 249*b1cdbd2cSJim Jagielski */ 250*b1cdbd2cSJim Jagielski sal_Int32 CreateDest( const Rectangle& rRect, sal_Int32 nPageNr = -1, PDFWriter::DestAreaType eType = PDFWriter::XYZ ); 251*b1cdbd2cSJim Jagielski /** Create a new link on a page 252*b1cdbd2cSJim Jagielski 253*b1cdbd2cSJim Jagielski @param rRect 254*b1cdbd2cSJim Jagielski active rectangle of the link (that is the area that has to be 255*b1cdbd2cSJim Jagielski hit to activate the link) 256*b1cdbd2cSJim Jagielski 257*b1cdbd2cSJim Jagielski @param nPageNr 258*b1cdbd2cSJim Jagielski number of page the link is on (as returned by NewPage) 259*b1cdbd2cSJim Jagielski or -1 in which case the current page is used 260*b1cdbd2cSJim Jagielski 261*b1cdbd2cSJim Jagielski @returns 262*b1cdbd2cSJim Jagielski the link id (to be used in SetLinkDest, SetLinkURL) or 263*b1cdbd2cSJim Jagielski -1 if page id does not exist 264*b1cdbd2cSJim Jagielski */ 265*b1cdbd2cSJim Jagielski sal_Int32 CreateLink( const Rectangle& rRect, sal_Int32 nPageNr = -1 ); 266*b1cdbd2cSJim Jagielski /** Set the destination for a link 267*b1cdbd2cSJim Jagielski <p>will change a URL type link to a dest link if necessary</p> 268*b1cdbd2cSJim Jagielski 269*b1cdbd2cSJim Jagielski @param nLinkId 270*b1cdbd2cSJim Jagielski the link to be changed 271*b1cdbd2cSJim Jagielski 272*b1cdbd2cSJim Jagielski @param nDestId 273*b1cdbd2cSJim Jagielski the dest the link shall point to 274*b1cdbd2cSJim Jagielski @returns 275*b1cdbd2cSJim Jagielski 0 for success 276*b1cdbd2cSJim Jagielski -1 in case the link id does not exist 277*b1cdbd2cSJim Jagielski -2 in case the dest id does not exist 278*b1cdbd2cSJim Jagielski */ 279*b1cdbd2cSJim Jagielski sal_Int32 SetLinkDest( sal_Int32 nLinkId, sal_Int32 nDestId ); 280*b1cdbd2cSJim Jagielski /** Set the URL for a link 281*b1cdbd2cSJim Jagielski <p>will change a dest type link to an URL type link if necessary</p> 282*b1cdbd2cSJim Jagielski @param nLinkId 283*b1cdbd2cSJim Jagielski the link to be changed 284*b1cdbd2cSJim Jagielski 285*b1cdbd2cSJim Jagielski @param rURL 286*b1cdbd2cSJim Jagielski the URL the link shall point to. 287*b1cdbd2cSJim Jagielski there will be no error checking or any kind of 288*b1cdbd2cSJim Jagielski conversion done to this parameter execept this: 289*b1cdbd2cSJim Jagielski it will be output as 7bit Ascii. The URL 290*b1cdbd2cSJim Jagielski will appear literally in the PDF file produced 291*b1cdbd2cSJim Jagielski 292*b1cdbd2cSJim Jagielski @returns 293*b1cdbd2cSJim Jagielski 0 for success 294*b1cdbd2cSJim Jagielski -1 in case the link id does not exist 295*b1cdbd2cSJim Jagielski */ 296*b1cdbd2cSJim Jagielski sal_Int32 SetLinkURL( sal_Int32 nLinkId, const rtl::OUString& rURL ); 297*b1cdbd2cSJim Jagielski /** Create a new outline item 298*b1cdbd2cSJim Jagielski 299*b1cdbd2cSJim Jagielski @param nParent 300*b1cdbd2cSJim Jagielski declares the parent of the new item in the outline hierarchy. 301*b1cdbd2cSJim Jagielski An invalid value will result in a new toplevel item. 302*b1cdbd2cSJim Jagielski 303*b1cdbd2cSJim Jagielski @param rText 304*b1cdbd2cSJim Jagielski sets the title text of the item 305*b1cdbd2cSJim Jagielski 306*b1cdbd2cSJim Jagielski @param nDestId 307*b1cdbd2cSJim Jagielski declares which Dest (created with CreateDest) the outline item 308*b1cdbd2cSJim Jagielski will point to 309*b1cdbd2cSJim Jagielski 310*b1cdbd2cSJim Jagielski @returns 311*b1cdbd2cSJim Jagielski the outline item id of the new item 312*b1cdbd2cSJim Jagielski */ 313*b1cdbd2cSJim Jagielski sal_Int32 CreateOutlineItem( sal_Int32 nParent = 0, const rtl::OUString& rText = rtl::OUString(), sal_Int32 nDestID = -1 ); 314*b1cdbd2cSJim Jagielski 315*b1cdbd2cSJim Jagielski /** Set an outline item's parent 316*b1cdbd2cSJim Jagielski 317*b1cdbd2cSJim Jagielski @param nItem 318*b1cdbd2cSJim Jagielski specififies which item should be reparented. 319*b1cdbd2cSJim Jagielski 320*b1cdbd2cSJim Jagielski @param nNewParent 321*b1cdbd2cSJim Jagielski specifies which outline item will be the item's new parent. 322*b1cdbd2cSJim Jagielski Use 0 for reparenting to top level. 323*b1cdbd2cSJim Jagielski 324*b1cdbd2cSJim Jagielski @returns 325*b1cdbd2cSJim Jagielski -1 if the item does not exist 326*b1cdbd2cSJim Jagielski -2 if the new parent does not exist, item will be reparented to top level. 327*b1cdbd2cSJim Jagielski */ 328*b1cdbd2cSJim Jagielski sal_Int32 SetOutlineItemParent( sal_Int32 nItem, sal_Int32 nNewParent ); 329*b1cdbd2cSJim Jagielski 330*b1cdbd2cSJim Jagielski /** Set an outline item's title text 331*b1cdbd2cSJim Jagielski 332*b1cdbd2cSJim Jagielski @param nItem 333*b1cdbd2cSJim Jagielski specififies which item should get a new text 334*b1cdbd2cSJim Jagielski 335*b1cdbd2cSJim Jagielski @param rText 336*b1cdbd2cSJim Jagielski sets the title text of the item 337*b1cdbd2cSJim Jagielski 338*b1cdbd2cSJim Jagielski @returns 339*b1cdbd2cSJim Jagielski 0 if the item exists and the text was changed 340*b1cdbd2cSJim Jagielski -1 if the item does not exist 341*b1cdbd2cSJim Jagielski */ 342*b1cdbd2cSJim Jagielski sal_Int32 SetOutlineItemText( sal_Int32 nItem, const rtl::OUString& rText ); 343*b1cdbd2cSJim Jagielski 344*b1cdbd2cSJim Jagielski /** Set an outline item's destination 345*b1cdbd2cSJim Jagielski 346*b1cdbd2cSJim Jagielski @param nItem 347*b1cdbd2cSJim Jagielski specififies which item should get a new dest 348*b1cdbd2cSJim Jagielski 349*b1cdbd2cSJim Jagielski @param nDestID 350*b1cdbd2cSJim Jagielski specifies the item's new destination 351*b1cdbd2cSJim Jagielski 352*b1cdbd2cSJim Jagielski @returns 353*b1cdbd2cSJim Jagielski -1 if the item does not exist 354*b1cdbd2cSJim Jagielski -2 if the new dest does not exist, dest will remain unchanged 355*b1cdbd2cSJim Jagielski */ 356*b1cdbd2cSJim Jagielski sal_Int32 SetOutlineItemDest( sal_Int32 nItem, sal_Int32 nDestID ); 357*b1cdbd2cSJim Jagielski 358*b1cdbd2cSJim Jagielski /** Create a new note on a page 359*b1cdbd2cSJim Jagielski 360*b1cdbd2cSJim Jagielski @param rRect 361*b1cdbd2cSJim Jagielski active rectangle of the note (that is the area that has to be 362*b1cdbd2cSJim Jagielski hit to popup the annotation) 363*b1cdbd2cSJim Jagielski 364*b1cdbd2cSJim Jagielski @param rNote 365*b1cdbd2cSJim Jagielski specifies the contents of the note 366*b1cdbd2cSJim Jagielski 367*b1cdbd2cSJim Jagielski @param nPageNr 368*b1cdbd2cSJim Jagielski number of page the note is on (as returned by NewPage) 369*b1cdbd2cSJim Jagielski or -1 in which case the current page is used 370*b1cdbd2cSJim Jagielski */ 371*b1cdbd2cSJim Jagielski void CreateNote( const Rectangle& rRect, const PDFNote& rNote, sal_Int32 nPageNr = -1 ); 372*b1cdbd2cSJim Jagielski 373*b1cdbd2cSJim Jagielski /** begin a new logical structure element 374*b1cdbd2cSJim Jagielski 375*b1cdbd2cSJim Jagielski BeginStructureElement/EndStructureElement calls build the logical structure 376*b1cdbd2cSJim Jagielski of the PDF - the basis for tagged PDF. Structural elements are implemented 377*b1cdbd2cSJim Jagielski using marked content tags. Each structural element can contain sub elements 378*b1cdbd2cSJim Jagielski (e.g. a section can contain a heading and a paragraph). The structure hierarchy 379*b1cdbd2cSJim Jagielski is build automatically from the Begin/EndStructureElement calls. 380*b1cdbd2cSJim Jagielski 381*b1cdbd2cSJim Jagielski A structural element need not be contained on one page; e.g. paragraphs often 382*b1cdbd2cSJim Jagielski run from one page to the next. In this case the corresponding EndStructureElement 383*b1cdbd2cSJim Jagielski must be called while drawing the next page. 384*b1cdbd2cSJim Jagielski 385*b1cdbd2cSJim Jagielski BeginStructureElement and EndStructureElement must be called only after 386*b1cdbd2cSJim Jagielski <member scope="vcl">PDFWriter::NewPage</member> has been called and before 387*b1cdbd2cSJim Jagielski <member scope="vcl">PDFWriter::Emit</member>gets called. The current page 388*b1cdbd2cSJim Jagielski number is an implicit context parameter for Begin/EndStructureElement. 389*b1cdbd2cSJim Jagielski 390*b1cdbd2cSJim Jagielski For pagination artifacts that are not part of the logical structure 391*b1cdbd2cSJim Jagielski of the document (like header, footer or page number) the special 392*b1cdbd2cSJim Jagielski StructElement <code>NonStructElement</code> exists. To place content 393*b1cdbd2cSJim Jagielski outside of the struture tree simply call 394*b1cdbd2cSJim Jagielski <code>BeginStructureElement( NonStructElement )</code> then draw your 395*b1cdbd2cSJim Jagielski content and then call <code>EndStructureElement()</code>. Any children 396*b1cdbd2cSJim Jagielski of a <code>NonStructElement</code> will not be part of the structure as well. 397*b1cdbd2cSJim Jagielski 398*b1cdbd2cSJim Jagielski @param eType 399*b1cdbd2cSJim Jagielski denotes what kind of element to begin (e.g. a heading or paragraph) 400*b1cdbd2cSJim Jagielski 401*b1cdbd2cSJim Jagielski @param rAlias 402*b1cdbd2cSJim Jagielski the specified alias will be used as structure tag. Also an entry in the PDF's 403*b1cdbd2cSJim Jagielski role map will be created mapping alias to regular structure type. 404*b1cdbd2cSJim Jagielski 405*b1cdbd2cSJim Jagielski @returns 406*b1cdbd2cSJim Jagielski the id of the newly created structural element 407*b1cdbd2cSJim Jagielski */ 408*b1cdbd2cSJim Jagielski sal_Int32 BeginStructureElement( PDFWriter::StructElement eType, const rtl::OUString& rAlias = rtl::OUString() ); 409*b1cdbd2cSJim Jagielski /** end a logical structure element 410*b1cdbd2cSJim Jagielski 411*b1cdbd2cSJim Jagielski @see BeginStructureElement 412*b1cdbd2cSJim Jagielski */ 413*b1cdbd2cSJim Jagielski void EndStructureElement(); 414*b1cdbd2cSJim Jagielski /** set the current structure element 415*b1cdbd2cSJim Jagielski 416*b1cdbd2cSJim Jagielski <p> 417*b1cdbd2cSJim Jagielski For different purposes it may be useful to paint a structure element's 418*b1cdbd2cSJim Jagielski content discontinously. In that case an already existing structure element 419*b1cdbd2cSJim Jagielski can be appended to by using <code>SetCurrentStructureElement</code>. The 420*b1cdbd2cSJim Jagielski refenrenced structure element becomes the current structure element with 421*b1cdbd2cSJim Jagielski all consequences: all following structure elements are appended as children 422*b1cdbd2cSJim Jagielski of the current element. 423*b1cdbd2cSJim Jagielski </p> 424*b1cdbd2cSJim Jagielski 425*b1cdbd2cSJim Jagielski @param nElement 426*b1cdbd2cSJim Jagielski the id of the new current structure element 427*b1cdbd2cSJim Jagielski 428*b1cdbd2cSJim Jagielski @returns 429*b1cdbd2cSJim Jagielski <true/> if the current structure element could be set successfully 430*b1cdbd2cSJim Jagielski <false/> if the current structure element could not be changed 431*b1cdbd2cSJim Jagielski (e.g. if the passed element id is invalid) 432*b1cdbd2cSJim Jagielski */ 433*b1cdbd2cSJim Jagielski bool SetCurrentStructureElement( sal_Int32 nElement ); 434*b1cdbd2cSJim Jagielski /** get the current structure element id 435*b1cdbd2cSJim Jagielski 436*b1cdbd2cSJim Jagielski @returns 437*b1cdbd2cSJim Jagielski the id of the current structure element 438*b1cdbd2cSJim Jagielski */ 439*b1cdbd2cSJim Jagielski sal_Int32 GetCurrentStructureElement(); 440*b1cdbd2cSJim Jagielski 441*b1cdbd2cSJim Jagielski /** set a structure attribute on the current structural element 442*b1cdbd2cSJim Jagielski 443*b1cdbd2cSJim Jagielski SetStructureAttribute sets an attribute of the current structural element to a 444*b1cdbd2cSJim Jagielski new value. A consistency check is performed before actually setting the value; 445*b1cdbd2cSJim Jagielski if the check fails, the function returns <FALSE/> and the attribute remains 446*b1cdbd2cSJim Jagielski unchanged. 447*b1cdbd2cSJim Jagielski 448*b1cdbd2cSJim Jagielski @param eAttr 449*b1cdbd2cSJim Jagielski denotes what attribute to change 450*b1cdbd2cSJim Jagielski 451*b1cdbd2cSJim Jagielski @param eVal 452*b1cdbd2cSJim Jagielski the value to set the attribute to 453*b1cdbd2cSJim Jagielski 454*b1cdbd2cSJim Jagielski @returns 455*b1cdbd2cSJim Jagielski <TRUE/> if the value was valid and the change has been performed, 456*b1cdbd2cSJim Jagielski <FALSE/> if the attribute or value was invalid; attribute remains unchanged 457*b1cdbd2cSJim Jagielski */ 458*b1cdbd2cSJim Jagielski bool SetStructureAttribute( PDFWriter::StructAttribute eAttr, PDFWriter::StructAttributeValue eVal ); 459*b1cdbd2cSJim Jagielski /** set a structure attribute on the current structural element 460*b1cdbd2cSJim Jagielski 461*b1cdbd2cSJim Jagielski SetStructureAttributeNumerical sets an attribute of the current structural element 462*b1cdbd2cSJim Jagielski to a new numerical value. A consistency check is performed before actually setting 463*b1cdbd2cSJim Jagielski the value; if the check fails, the function returns <FALSE/> and the attribute 464*b1cdbd2cSJim Jagielski remains unchanged. 465*b1cdbd2cSJim Jagielski 466*b1cdbd2cSJim Jagielski @param eAttr 467*b1cdbd2cSJim Jagielski denotes what attribute to change 468*b1cdbd2cSJim Jagielski 469*b1cdbd2cSJim Jagielski @param nValue 470*b1cdbd2cSJim Jagielski the value to set the attribute to 471*b1cdbd2cSJim Jagielski 472*b1cdbd2cSJim Jagielski @returns 473*b1cdbd2cSJim Jagielski <TRUE/> if the value was valid and the change has been performed, 474*b1cdbd2cSJim Jagielski <FALSE/> if the attribute or value was invalid; attribute remains unchanged 475*b1cdbd2cSJim Jagielski */ 476*b1cdbd2cSJim Jagielski bool SetStructureAttributeNumerical( PDFWriter::StructAttribute eAttr, sal_Int32 nValue ); 477*b1cdbd2cSJim Jagielski /** set the bounding box of a structural element 478*b1cdbd2cSJim Jagielski 479*b1cdbd2cSJim Jagielski SetStructureBoundingBox sets the BBox attribute to a new value. Since the BBox 480*b1cdbd2cSJim Jagielski attribute can only be applied to <code>Table</code>, <code>Figure</code>, 481*b1cdbd2cSJim Jagielski <code>Form</code> and <code>Formula</code> elements, a call of this function 482*b1cdbd2cSJim Jagielski for other element types will be ignored and the BBox attribute not be set. 483*b1cdbd2cSJim Jagielski 484*b1cdbd2cSJim Jagielski @param rRect 485*b1cdbd2cSJim Jagielski the new bounding box for the structural element 486*b1cdbd2cSJim Jagielski */ 487*b1cdbd2cSJim Jagielski void SetStructureBoundingBox( const Rectangle& rRect ); 488*b1cdbd2cSJim Jagielski 489*b1cdbd2cSJim Jagielski /** set the ActualText attribute of a structural element 490*b1cdbd2cSJim Jagielski 491*b1cdbd2cSJim Jagielski ActualText contains the Unicode text without layout artifacts that is shown by 492*b1cdbd2cSJim Jagielski a structural element. For example if a line is ended prematurely with a break in 493*b1cdbd2cSJim Jagielski a word and continued on the next line (e.g. "happen-<newline>stance") the 494*b1cdbd2cSJim Jagielski corresponding ActualText would contain the unbroken line (e.g. "happenstance"). 495*b1cdbd2cSJim Jagielski 496*b1cdbd2cSJim Jagielski @param rText 497*b1cdbd2cSJim Jagielski contains the complete logical text the structural element displays. 498*b1cdbd2cSJim Jagielski */ 499*b1cdbd2cSJim Jagielski void SetActualText( const String& rText ); 500*b1cdbd2cSJim Jagielski 501*b1cdbd2cSJim Jagielski /** set the Alt attribute of a strutural element 502*b1cdbd2cSJim Jagielski 503*b1cdbd2cSJim Jagielski Alt is s replacement text describing the contents of a structural element. This 504*b1cdbd2cSJim Jagielski is mainly used by accessibility applications; e.g. a screen reader would read 505*b1cdbd2cSJim Jagielski the Alt replacement text for an image to a visually impaired user. 506*b1cdbd2cSJim Jagielski 507*b1cdbd2cSJim Jagielski @param rText 508*b1cdbd2cSJim Jagielski contains the replacement text for the structural element 509*b1cdbd2cSJim Jagielski */ 510*b1cdbd2cSJim Jagielski void SetAlternateText( const String& rText ); 511*b1cdbd2cSJim Jagielski 512*b1cdbd2cSJim Jagielski /** Sets the time in seconds a page will appear before the next 513*b1cdbd2cSJim Jagielski page is shown automatically 514*b1cdbd2cSJim Jagielski 515*b1cdbd2cSJim Jagielski @param nSeconds 516*b1cdbd2cSJim Jagielski time in seconds the current page will be shown; pass 0 for manual advancement 517*b1cdbd2cSJim Jagielski 518*b1cdbd2cSJim Jagielski @param nPageNr 519*b1cdbd2cSJim Jagielski the page number to apply the autoadvance time to; -1 denotes the current page 520*b1cdbd2cSJim Jagielski */ 521*b1cdbd2cSJim Jagielski void SetAutoAdvanceTime( sal_uInt32 nSeconds, sal_Int32 nPageNr = -1 ); 522*b1cdbd2cSJim Jagielski 523*b1cdbd2cSJim Jagielski /** Sets the transitional effect to be applied when the current page gets shown. 524*b1cdbd2cSJim Jagielski 525*b1cdbd2cSJim Jagielski @param eType 526*b1cdbd2cSJim Jagielski the kind of effect to be used; use Regular to disable transitional effects 527*b1cdbd2cSJim Jagielski for this page 528*b1cdbd2cSJim Jagielski 529*b1cdbd2cSJim Jagielski @param nMilliSec 530*b1cdbd2cSJim Jagielski the duration of the transitional effect in milliseconds; 531*b1cdbd2cSJim Jagielski set 0 to disable transitional effects 532*b1cdbd2cSJim Jagielski 533*b1cdbd2cSJim Jagielski @param nPageNr 534*b1cdbd2cSJim Jagielski the page number to apply the effect to; -1 denotes the current page 535*b1cdbd2cSJim Jagielski */ 536*b1cdbd2cSJim Jagielski void SetPageTransition( PDFWriter::PageTransition eType, sal_uInt32 nMilliSec, sal_Int32 nPageNr = -1 ); 537*b1cdbd2cSJim Jagielski 538*b1cdbd2cSJim Jagielski /** create a new form control 539*b1cdbd2cSJim Jagielski 540*b1cdbd2cSJim Jagielski This function creates a new form control in the PDF and sets its various 541*b1cdbd2cSJim Jagielski properties. Do not pass an actual AnyWidget as <code>rControlType</code> 542*b1cdbd2cSJim Jagielski will be cast to the type described by the type member. 543*b1cdbd2cSJim Jagielski 544*b1cdbd2cSJim Jagielski @param rControlType 545*b1cdbd2cSJim Jagielski a descendant of <code>AnyWidget</code> determing the control's properties 546*b1cdbd2cSJim Jagielski */ 547*b1cdbd2cSJim Jagielski void CreateControl( const PDFWriter::AnyWidget& rControlType, sal_Int32 nPageNr = -1 ); 548*b1cdbd2cSJim Jagielski }; 549*b1cdbd2cSJim Jagielski 550*b1cdbd2cSJim Jagielski } 551*b1cdbd2cSJim Jagielski 552*b1cdbd2cSJim Jagielski #endif 553