xref: /AOO41X/main/vcl/source/gdi/pdfwriter_impl.hxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir #ifndef _VCL_PDFWRITER_IMPL_HXX
28*cdf0e10cSrcweir #define _VCL_PDFWRITER_IMPL_HXX
29*cdf0e10cSrcweir 
30*cdf0e10cSrcweir #include "vcl/pdfwriter.hxx"
31*cdf0e10cSrcweir #include "rtl/ustring.hxx"
32*cdf0e10cSrcweir #include "osl/file.h"
33*cdf0e10cSrcweir #include "tools/gen.hxx"
34*cdf0e10cSrcweir #include "tools/stream.hxx"
35*cdf0e10cSrcweir #include "vcl/outdev.hxx"
36*cdf0e10cSrcweir #include "vcl/bitmapex.hxx"
37*cdf0e10cSrcweir #include "vcl/gradient.hxx"
38*cdf0e10cSrcweir #include "vcl/hatch.hxx"
39*cdf0e10cSrcweir #include "vcl/wall.hxx"
40*cdf0e10cSrcweir #include "outdata.hxx"
41*cdf0e10cSrcweir #include "rtl/strbuf.hxx"
42*cdf0e10cSrcweir #include "rtl/cipher.h"
43*cdf0e10cSrcweir #include "rtl/digest.h"
44*cdf0e10cSrcweir #include "com/sun/star/util/XURLTransformer.hpp"
45*cdf0e10cSrcweir #include "com/sun/star/lang/Locale.hpp"
46*cdf0e10cSrcweir 
47*cdf0e10cSrcweir #include <sallayout.hxx>
48*cdf0e10cSrcweir #include "pdffontcache.hxx"
49*cdf0e10cSrcweir 
50*cdf0e10cSrcweir #include <vector>
51*cdf0e10cSrcweir #include <map>
52*cdf0e10cSrcweir #include <hash_map>
53*cdf0e10cSrcweir #include <list>
54*cdf0e10cSrcweir 
55*cdf0e10cSrcweir #include <boost/shared_array.hpp>
56*cdf0e10cSrcweir 
57*cdf0e10cSrcweir class ImplFontSelectData;
58*cdf0e10cSrcweir class ImplFontMetricData;
59*cdf0e10cSrcweir class FontSubsetInfo;
60*cdf0e10cSrcweir class ZCodec;
61*cdf0e10cSrcweir class EncHashTransporter;
62*cdf0e10cSrcweir struct BitStreamState;
63*cdf0e10cSrcweir 
64*cdf0e10cSrcweir // the maximum password length
65*cdf0e10cSrcweir #define ENCRYPTED_PWD_SIZE     32
66*cdf0e10cSrcweir #define MD5_DIGEST_SIZE        16
67*cdf0e10cSrcweir #define SECUR_40BIT_KEY         5
68*cdf0e10cSrcweir // security 128 bit
69*cdf0e10cSrcweir #define SECUR_128BIT_KEY       16
70*cdf0e10cSrcweir // maximum length of MD5 digest input, in step 2 of algorithm 3.1
71*cdf0e10cSrcweir // PDF spec ver. 1.4: see there for details
72*cdf0e10cSrcweir #define MAXIMUM_RC4_KEY_LENGTH (SECUR_128BIT_KEY+3+2)
73*cdf0e10cSrcweir 
74*cdf0e10cSrcweir namespace vcl
75*cdf0e10cSrcweir {
76*cdf0e10cSrcweir 
77*cdf0e10cSrcweir class PDFSalLayout;
78*cdf0e10cSrcweir class PDFStreamIf;
79*cdf0e10cSrcweir class Matrix3;
80*cdf0e10cSrcweir 
81*cdf0e10cSrcweir class PDFWriterImpl
82*cdf0e10cSrcweir {
83*cdf0e10cSrcweir     friend class PDFSalLayout;
84*cdf0e10cSrcweir     friend class PDFStreamIf;
85*cdf0e10cSrcweir public:
86*cdf0e10cSrcweir     // definition of structs
87*cdf0e10cSrcweir     struct BuiltinFont
88*cdf0e10cSrcweir     {
89*cdf0e10cSrcweir         const char *        		m_pName;                     // Name
90*cdf0e10cSrcweir         const char *        		m_pStyleName;                // StyleName
91*cdf0e10cSrcweir         const char *        		m_pPSName;					 // PSName
92*cdf0e10cSrcweir         int							m_nAscent;
93*cdf0e10cSrcweir         int							m_nDescent;
94*cdf0e10cSrcweir         FontFamily					m_eFamily;                   // Family
95*cdf0e10cSrcweir 		CharSet						m_eCharSet;                  // CharSet
96*cdf0e10cSrcweir 	    FontPitch					m_ePitch;                    // Pitch
97*cdf0e10cSrcweir 		FontWidth					m_eWidthType;                // WidthType
98*cdf0e10cSrcweir 		FontWeight					m_eWeight;                   // Weight
99*cdf0e10cSrcweir 		FontItalic					m_eItalic;                   // Italic
100*cdf0e10cSrcweir         int							m_aWidths[256];				 // character metrics
101*cdf0e10cSrcweir 
102*cdf0e10cSrcweir         rtl::OString getNameObject() const;
103*cdf0e10cSrcweir     };
104*cdf0e10cSrcweir 
105*cdf0e10cSrcweir 
106*cdf0e10cSrcweir     enum ResourceKind { ResXObject, ResExtGState, ResShading, ResPattern };
107*cdf0e10cSrcweir     typedef std::map< rtl::OString, sal_Int32 > ResourceMap;
108*cdf0e10cSrcweir     struct ResourceDict
109*cdf0e10cSrcweir     {
110*cdf0e10cSrcweir         // note: handle fonts globally for performance
111*cdf0e10cSrcweir         ResourceMap m_aXObjects;
112*cdf0e10cSrcweir         ResourceMap m_aExtGStates;
113*cdf0e10cSrcweir         ResourceMap m_aShadings;
114*cdf0e10cSrcweir         ResourceMap m_aPatterns;
115*cdf0e10cSrcweir 
116*cdf0e10cSrcweir         void append( rtl::OStringBuffer&, sal_Int32 nFontDictObject );
117*cdf0e10cSrcweir     };
118*cdf0e10cSrcweir 
119*cdf0e10cSrcweir     struct PDFPage
120*cdf0e10cSrcweir     {
121*cdf0e10cSrcweir         PDFWriterImpl*				m_pWriter;
122*cdf0e10cSrcweir         sal_Int32					m_nPageWidth;			// in inch/72
123*cdf0e10cSrcweir         sal_Int32					m_nPageHeight;			// in inch/72
124*cdf0e10cSrcweir         PDFWriter::Orientation		m_eOrientation;
125*cdf0e10cSrcweir         sal_Int32					m_nPageObject;
126*cdf0e10cSrcweir         sal_Int32					m_nPageIndex;
127*cdf0e10cSrcweir         std::vector<sal_Int32>		m_aStreamObjects;
128*cdf0e10cSrcweir         sal_Int32					m_nStreamLengthObject;
129*cdf0e10cSrcweir         sal_uInt64					m_nBeginStreamPos;
130*cdf0e10cSrcweir         std::vector<sal_Int32>		m_aAnnotations;
131*cdf0e10cSrcweir         std::vector<sal_Int32>		m_aMCIDParents;
132*cdf0e10cSrcweir         PDFWriter::PageTransition	m_eTransition;
133*cdf0e10cSrcweir         sal_uInt32					m_nTransTime;
134*cdf0e10cSrcweir         sal_uInt32					m_nDuration;
135*cdf0e10cSrcweir         bool                        m_bHasWidgets;
136*cdf0e10cSrcweir 
137*cdf0e10cSrcweir         PDFPage( PDFWriterImpl* pWriter, sal_Int32 nPageWidth, sal_Int32 nPageHeight, PDFWriter::Orientation eOrientation );
138*cdf0e10cSrcweir         ~PDFPage();
139*cdf0e10cSrcweir 
140*cdf0e10cSrcweir         void beginStream();
141*cdf0e10cSrcweir         void endStream();
142*cdf0e10cSrcweir         bool emit( sal_Int32 nParentPage );
143*cdf0e10cSrcweir 
144*cdf0e10cSrcweir         // converts point from ref device coordinates to
145*cdf0e10cSrcweir         // page coordinates and appends the point to the buffer
146*cdf0e10cSrcweir         // if bNeg is true, the coordinates are inverted AFTER transformation
147*cdf0e10cSrcweir         // to page (useful for transformation matrices
148*cdf0e10cSrcweir         // if pOutPoint is set it will be updated to the emitted point
149*cdf0e10cSrcweir         // (in PDF map mode, that is 10th of point)
150*cdf0e10cSrcweir         void appendPoint( const Point& rPoint, rtl::OStringBuffer& rBuffer, bool bNeg = false, Point* pOutPoint = NULL ) const;
151*cdf0e10cSrcweir         // appends a B2DPoint without further transformation
152*cdf0e10cSrcweir         void appendPixelPoint( const basegfx::B2DPoint& rPoint, rtl::OStringBuffer& rBuffer ) const;
153*cdf0e10cSrcweir         // appends a rectangle
154*cdf0e10cSrcweir         void appendRect( const Rectangle& rRect, rtl::OStringBuffer& rBuffer ) const;
155*cdf0e10cSrcweir         // converts a rectangle to 10th points page space
156*cdf0e10cSrcweir         void convertRect( Rectangle& rRect ) const;
157*cdf0e10cSrcweir         // appends a polygon optionally closing it
158*cdf0e10cSrcweir         void appendPolygon( const Polygon& rPoly, rtl::OStringBuffer& rBuffer, bool bClose = true ) const;
159*cdf0e10cSrcweir         // appends a polygon optionally closing it
160*cdf0e10cSrcweir         void appendPolygon( const basegfx::B2DPolygon& rPoly, rtl::OStringBuffer& rBuffer, bool bClose = true ) const;
161*cdf0e10cSrcweir         // appends a polypolygon optionally closing the subpaths
162*cdf0e10cSrcweir         void appendPolyPolygon( const PolyPolygon& rPolyPoly, rtl::OStringBuffer& rBuffer, bool bClose = true ) const;
163*cdf0e10cSrcweir         // appends a polypolygon optionally closing the subpaths
164*cdf0e10cSrcweir         void appendPolyPolygon( const basegfx::B2DPolyPolygon& rPolyPoly, rtl::OStringBuffer& rBuffer, bool bClose = true ) const;
165*cdf0e10cSrcweir         // converts a length (either vertical or horizontal; this
166*cdf0e10cSrcweir         // can be important if the source MapMode is not
167*cdf0e10cSrcweir         // symmetrical) to page length and appends it to the buffer
168*cdf0e10cSrcweir         // if pOutLength is set it will be updated to the emitted length
169*cdf0e10cSrcweir         // (in PDF map mode, that is 10th of point)
170*cdf0e10cSrcweir         void appendMappedLength( sal_Int32 nLength, rtl::OStringBuffer& rBuffer, bool bVertical = true, sal_Int32* pOutLength = NULL ) const;
171*cdf0e10cSrcweir         // the same for double values
172*cdf0e10cSrcweir         void appendMappedLength( double fLength, rtl::OStringBuffer& rBuffer, bool bVertical = true, sal_Int32* pOutLength = NULL, sal_Int32 nPrecision = 5 ) const;
173*cdf0e10cSrcweir         // appends LineInfo
174*cdf0e10cSrcweir         // returns false if too many dash array entry were created for
175*cdf0e10cSrcweir         // the implementation limits of some PDF readers
176*cdf0e10cSrcweir         bool appendLineInfo( const LineInfo& rInfo, rtl::OStringBuffer& rBuffer ) const;
177*cdf0e10cSrcweir         // appends a horizontal waveline with vertical offset (helper for drawWaveLine)
178*cdf0e10cSrcweir         void appendWaveLine( sal_Int32 nLength, sal_Int32 nYOffset, sal_Int32 nDelta, rtl::OStringBuffer& rBuffer ) const;
179*cdf0e10cSrcweir 
180*cdf0e10cSrcweir         sal_Int32 getWidth() const { return m_nPageWidth ? m_nPageWidth : m_pWriter->m_nInheritedPageWidth; }
181*cdf0e10cSrcweir         sal_Int32 getHeight() const { return m_nPageHeight ? m_nPageHeight : m_pWriter->m_nInheritedPageHeight; }
182*cdf0e10cSrcweir     };
183*cdf0e10cSrcweir 
184*cdf0e10cSrcweir     friend struct PDFPage;
185*cdf0e10cSrcweir 
186*cdf0e10cSrcweir     struct BitmapID
187*cdf0e10cSrcweir     {
188*cdf0e10cSrcweir         Size		m_aPixelSize;
189*cdf0e10cSrcweir         sal_Int32	m_nSize;
190*cdf0e10cSrcweir         sal_Int32	m_nChecksum;
191*cdf0e10cSrcweir         sal_Int32	m_nMaskChecksum;
192*cdf0e10cSrcweir 
193*cdf0e10cSrcweir         BitmapID() : m_nSize( 0 ), m_nChecksum( 0 ), m_nMaskChecksum( 0 ) {}
194*cdf0e10cSrcweir 
195*cdf0e10cSrcweir         BitmapID& operator=( const BitmapID& rCopy )
196*cdf0e10cSrcweir         {
197*cdf0e10cSrcweir             m_aPixelSize	= rCopy.m_aPixelSize;
198*cdf0e10cSrcweir             m_nSize			= rCopy.m_nSize;
199*cdf0e10cSrcweir             m_nChecksum		= rCopy.m_nChecksum;
200*cdf0e10cSrcweir             m_nMaskChecksum	= rCopy.m_nMaskChecksum;
201*cdf0e10cSrcweir             return *this;
202*cdf0e10cSrcweir         }
203*cdf0e10cSrcweir 
204*cdf0e10cSrcweir         bool operator==( const BitmapID& rComp )
205*cdf0e10cSrcweir         {
206*cdf0e10cSrcweir             return (m_aPixelSize == rComp.m_aPixelSize &&
207*cdf0e10cSrcweir                     m_nSize == rComp.m_nSize &&
208*cdf0e10cSrcweir                     m_nChecksum == rComp.m_nChecksum &&
209*cdf0e10cSrcweir                     m_nMaskChecksum == rComp.m_nMaskChecksum );
210*cdf0e10cSrcweir         }
211*cdf0e10cSrcweir     };
212*cdf0e10cSrcweir 
213*cdf0e10cSrcweir     struct BitmapEmit
214*cdf0e10cSrcweir     {
215*cdf0e10cSrcweir         BitmapID	m_aID;
216*cdf0e10cSrcweir         BitmapEx	m_aBitmap;
217*cdf0e10cSrcweir         sal_Int32	m_nObject;
218*cdf0e10cSrcweir         bool		m_bDrawMask;
219*cdf0e10cSrcweir 
220*cdf0e10cSrcweir         BitmapEmit() : m_bDrawMask( false ) {}
221*cdf0e10cSrcweir     };
222*cdf0e10cSrcweir 
223*cdf0e10cSrcweir     struct JPGEmit
224*cdf0e10cSrcweir     {
225*cdf0e10cSrcweir         BitmapID			m_aID;
226*cdf0e10cSrcweir         SvMemoryStream*		m_pStream;
227*cdf0e10cSrcweir         Bitmap				m_aMask;
228*cdf0e10cSrcweir         sal_Int32			m_nObject;
229*cdf0e10cSrcweir         bool                m_bTrueColor;
230*cdf0e10cSrcweir 
231*cdf0e10cSrcweir         JPGEmit() : m_pStream( NULL ) {}
232*cdf0e10cSrcweir         ~JPGEmit() { delete m_pStream; }
233*cdf0e10cSrcweir     };
234*cdf0e10cSrcweir 
235*cdf0e10cSrcweir     struct GradientEmit
236*cdf0e10cSrcweir     {
237*cdf0e10cSrcweir         Gradient	m_aGradient;
238*cdf0e10cSrcweir         Size		m_aSize;
239*cdf0e10cSrcweir         sal_Int32	m_nObject;
240*cdf0e10cSrcweir     };
241*cdf0e10cSrcweir 
242*cdf0e10cSrcweir 	// for tilings (drawWallpaper, begin/endPattern)
243*cdf0e10cSrcweir     struct TilingEmit
244*cdf0e10cSrcweir     {
245*cdf0e10cSrcweir         sal_Int32                   m_nObject;
246*cdf0e10cSrcweir         Rectangle                   m_aRectangle;
247*cdf0e10cSrcweir         Size                        m_aCellSize;
248*cdf0e10cSrcweir         SvtGraphicFill::Transform   m_aTransform;
249*cdf0e10cSrcweir         ResourceDict                m_aResources;
250*cdf0e10cSrcweir         SvMemoryStream*             m_pTilingStream;
251*cdf0e10cSrcweir 
252*cdf0e10cSrcweir         TilingEmit()
253*cdf0e10cSrcweir                 : m_nObject( 0 ),
254*cdf0e10cSrcweir                   m_pTilingStream( NULL )
255*cdf0e10cSrcweir         {}
256*cdf0e10cSrcweir     };
257*cdf0e10cSrcweir 
258*cdf0e10cSrcweir     // for transparency group XObjects
259*cdf0e10cSrcweir     struct TransparencyEmit
260*cdf0e10cSrcweir     {
261*cdf0e10cSrcweir         sal_Int32			m_nObject;
262*cdf0e10cSrcweir         sal_Int32			m_nExtGStateObject;
263*cdf0e10cSrcweir         double				m_fAlpha;
264*cdf0e10cSrcweir         Rectangle			m_aBoundRect;
265*cdf0e10cSrcweir         SvMemoryStream*		m_pContentStream;
266*cdf0e10cSrcweir         SvMemoryStream*		m_pSoftMaskStream;
267*cdf0e10cSrcweir 
268*cdf0e10cSrcweir         TransparencyEmit()
269*cdf0e10cSrcweir                 : m_nObject( 0 ),
270*cdf0e10cSrcweir                   m_nExtGStateObject( -1 ),
271*cdf0e10cSrcweir                   m_fAlpha( 0.0 ),
272*cdf0e10cSrcweir                   m_pContentStream( NULL ),
273*cdf0e10cSrcweir                   m_pSoftMaskStream( NULL )
274*cdf0e10cSrcweir         {}
275*cdf0e10cSrcweir         ~TransparencyEmit()
276*cdf0e10cSrcweir         {
277*cdf0e10cSrcweir             delete m_pContentStream;
278*cdf0e10cSrcweir             delete m_pSoftMaskStream;
279*cdf0e10cSrcweir         }
280*cdf0e10cSrcweir     };
281*cdf0e10cSrcweir 
282*cdf0e10cSrcweir     // font subsets
283*cdf0e10cSrcweir     class GlyphEmit
284*cdf0e10cSrcweir     {
285*cdf0e10cSrcweir         // performance: actually this should probably a vector;
286*cdf0e10cSrcweir         sal_Ucs		                    m_aBufferedUnicodes[3];
287*cdf0e10cSrcweir         sal_Int32                       m_nUnicodes;
288*cdf0e10cSrcweir         sal_Int32                       m_nMaxUnicodes;
289*cdf0e10cSrcweir         boost::shared_array<sal_Ucs>    m_pUnicodes;
290*cdf0e10cSrcweir         sal_uInt8                       m_nSubsetGlyphID;
291*cdf0e10cSrcweir 
292*cdf0e10cSrcweir     public:
293*cdf0e10cSrcweir         GlyphEmit() : m_nUnicodes(0), m_nSubsetGlyphID(0)
294*cdf0e10cSrcweir         {
295*cdf0e10cSrcweir             rtl_zeroMemory( m_aBufferedUnicodes, sizeof( m_aBufferedUnicodes ) );
296*cdf0e10cSrcweir             m_nMaxUnicodes = sizeof(m_aBufferedUnicodes)/sizeof(m_aBufferedUnicodes[0]);
297*cdf0e10cSrcweir         }
298*cdf0e10cSrcweir         ~GlyphEmit()
299*cdf0e10cSrcweir         {
300*cdf0e10cSrcweir         }
301*cdf0e10cSrcweir 
302*cdf0e10cSrcweir         void setGlyphId( sal_uInt8 i_nId ) { m_nSubsetGlyphID = i_nId; }
303*cdf0e10cSrcweir         sal_uInt8 getGlyphId() const { return m_nSubsetGlyphID; }
304*cdf0e10cSrcweir 
305*cdf0e10cSrcweir         void addCode( sal_Ucs i_cCode )
306*cdf0e10cSrcweir         {
307*cdf0e10cSrcweir             if( m_nUnicodes == m_nMaxUnicodes )
308*cdf0e10cSrcweir             {
309*cdf0e10cSrcweir                 sal_Ucs* pNew = new sal_Ucs[ 2 * m_nMaxUnicodes];
310*cdf0e10cSrcweir                 if( m_pUnicodes.get() )
311*cdf0e10cSrcweir                     rtl_copyMemory( pNew, m_pUnicodes.get(), m_nMaxUnicodes * sizeof(sal_Ucs) );
312*cdf0e10cSrcweir                 else
313*cdf0e10cSrcweir                     rtl_copyMemory( pNew, m_aBufferedUnicodes, m_nMaxUnicodes * sizeof(sal_Ucs) );
314*cdf0e10cSrcweir                 m_pUnicodes.reset( pNew );
315*cdf0e10cSrcweir                 m_nMaxUnicodes *= 2;
316*cdf0e10cSrcweir             }
317*cdf0e10cSrcweir             if( m_pUnicodes.get() )
318*cdf0e10cSrcweir                 m_pUnicodes[ m_nUnicodes++ ] = i_cCode;
319*cdf0e10cSrcweir             else
320*cdf0e10cSrcweir                 m_aBufferedUnicodes[ m_nUnicodes++ ] = i_cCode;
321*cdf0e10cSrcweir         }
322*cdf0e10cSrcweir         sal_Int32 countCodes() const { return m_nUnicodes; }
323*cdf0e10cSrcweir         sal_Ucs getCode( sal_Int32 i_nIndex ) const
324*cdf0e10cSrcweir         {
325*cdf0e10cSrcweir             sal_Ucs nRet = 0;
326*cdf0e10cSrcweir             if( i_nIndex < m_nUnicodes )
327*cdf0e10cSrcweir                 nRet = m_pUnicodes.get() ? m_pUnicodes[ i_nIndex ] : m_aBufferedUnicodes[ i_nIndex ];
328*cdf0e10cSrcweir             return nRet;
329*cdf0e10cSrcweir         }
330*cdf0e10cSrcweir     };
331*cdf0e10cSrcweir     typedef std::map< sal_GlyphId, GlyphEmit > FontEmitMapping;
332*cdf0e10cSrcweir     struct FontEmit
333*cdf0e10cSrcweir     {
334*cdf0e10cSrcweir         sal_Int32			m_nFontID;
335*cdf0e10cSrcweir         FontEmitMapping		m_aMapping;
336*cdf0e10cSrcweir 
337*cdf0e10cSrcweir         FontEmit( sal_Int32 nID ) : m_nFontID( nID ) {}
338*cdf0e10cSrcweir     };
339*cdf0e10cSrcweir     typedef std::list< FontEmit > FontEmitList;
340*cdf0e10cSrcweir     struct Glyph
341*cdf0e10cSrcweir     {
342*cdf0e10cSrcweir         sal_Int32	m_nFontID;
343*cdf0e10cSrcweir         sal_uInt8	m_nSubsetGlyphID;
344*cdf0e10cSrcweir     };
345*cdf0e10cSrcweir     typedef std::map< sal_GlyphId, Glyph > FontMapping;
346*cdf0e10cSrcweir     struct FontSubset
347*cdf0e10cSrcweir     {
348*cdf0e10cSrcweir         FontEmitList		m_aSubsets;
349*cdf0e10cSrcweir         FontMapping			m_aMapping;
350*cdf0e10cSrcweir     };
351*cdf0e10cSrcweir     typedef std::map< const ImplFontData*, FontSubset > FontSubsetData;
352*cdf0e10cSrcweir     struct EmbedCode
353*cdf0e10cSrcweir     {
354*cdf0e10cSrcweir         sal_Ucs				m_aUnicode;
355*cdf0e10cSrcweir         rtl::OString		m_aName;
356*cdf0e10cSrcweir     };
357*cdf0e10cSrcweir     struct EmbedEncoding
358*cdf0e10cSrcweir     {
359*cdf0e10cSrcweir         sal_Int32						m_nFontID;
360*cdf0e10cSrcweir         std::vector< EmbedCode >		m_aEncVector;
361*cdf0e10cSrcweir         std::map< sal_Ucs, sal_Int8 >	m_aCMap;
362*cdf0e10cSrcweir     };
363*cdf0e10cSrcweir     struct EmbedFont
364*cdf0e10cSrcweir     {
365*cdf0e10cSrcweir         sal_Int32						m_nNormalFontID;
366*cdf0e10cSrcweir         std::list< EmbedEncoding >		m_aExtendedEncodings;
367*cdf0e10cSrcweir 
368*cdf0e10cSrcweir         EmbedFont() : m_nNormalFontID( 0 ) {}
369*cdf0e10cSrcweir     };
370*cdf0e10cSrcweir     typedef std::map< const ImplFontData*, EmbedFont > FontEmbedData;
371*cdf0e10cSrcweir 
372*cdf0e10cSrcweir     struct PDFDest
373*cdf0e10cSrcweir     {
374*cdf0e10cSrcweir         sal_Int32					m_nPage;
375*cdf0e10cSrcweir         PDFWriter::DestAreaType		m_eType;
376*cdf0e10cSrcweir         Rectangle					m_aRect;
377*cdf0e10cSrcweir     };
378*cdf0e10cSrcweir 
379*cdf0e10cSrcweir //--->i56629
380*cdf0e10cSrcweir     struct PDFNamedDest
381*cdf0e10cSrcweir     {
382*cdf0e10cSrcweir         rtl::OUString               m_aDestName;
383*cdf0e10cSrcweir         sal_Int32					m_nPage;
384*cdf0e10cSrcweir         PDFWriter::DestAreaType		m_eType;
385*cdf0e10cSrcweir         Rectangle					m_aRect;
386*cdf0e10cSrcweir     };
387*cdf0e10cSrcweir //<---
388*cdf0e10cSrcweir 
389*cdf0e10cSrcweir     struct PDFOutlineEntry
390*cdf0e10cSrcweir     {
391*cdf0e10cSrcweir         sal_Int32					m_nParentID;
392*cdf0e10cSrcweir         sal_Int32					m_nObject;
393*cdf0e10cSrcweir         sal_Int32					m_nParentObject;
394*cdf0e10cSrcweir         sal_Int32					m_nNextObject;
395*cdf0e10cSrcweir         sal_Int32					m_nPrevObject;
396*cdf0e10cSrcweir         std::vector< sal_Int32 >	m_aChildren;
397*cdf0e10cSrcweir         rtl::OUString				m_aTitle;
398*cdf0e10cSrcweir         sal_Int32					m_nDestID;
399*cdf0e10cSrcweir 
400*cdf0e10cSrcweir         PDFOutlineEntry()
401*cdf0e10cSrcweir                 : m_nParentID( -1 ),
402*cdf0e10cSrcweir                   m_nObject( 0 ),
403*cdf0e10cSrcweir                   m_nParentObject( 0 ),
404*cdf0e10cSrcweir                   m_nNextObject( 0 ),
405*cdf0e10cSrcweir                   m_nPrevObject( 0 ),
406*cdf0e10cSrcweir                   m_nDestID( -1 )
407*cdf0e10cSrcweir         {}
408*cdf0e10cSrcweir     };
409*cdf0e10cSrcweir 
410*cdf0e10cSrcweir     struct PDFAnnotation
411*cdf0e10cSrcweir     {
412*cdf0e10cSrcweir         sal_Int32					m_nObject;
413*cdf0e10cSrcweir         Rectangle					m_aRect;
414*cdf0e10cSrcweir         sal_Int32					m_nPage;
415*cdf0e10cSrcweir 
416*cdf0e10cSrcweir         PDFAnnotation()
417*cdf0e10cSrcweir                 : m_nObject( -1 ),
418*cdf0e10cSrcweir                   m_nPage( -1 )
419*cdf0e10cSrcweir         {}
420*cdf0e10cSrcweir     };
421*cdf0e10cSrcweir 
422*cdf0e10cSrcweir     struct PDFLink : public PDFAnnotation
423*cdf0e10cSrcweir     {
424*cdf0e10cSrcweir         sal_Int32					m_nDest; // set to -1 for URL, to a dest else
425*cdf0e10cSrcweir         rtl::OUString				m_aURL;
426*cdf0e10cSrcweir         sal_Int32                   m_nStructParent; // struct parent entry
427*cdf0e10cSrcweir 
428*cdf0e10cSrcweir         PDFLink()
429*cdf0e10cSrcweir                 : m_nDest( -1 ),
430*cdf0e10cSrcweir                   m_nStructParent( -1 )
431*cdf0e10cSrcweir         {}
432*cdf0e10cSrcweir     };
433*cdf0e10cSrcweir 
434*cdf0e10cSrcweir     struct PDFNoteEntry : public PDFAnnotation
435*cdf0e10cSrcweir     {
436*cdf0e10cSrcweir         PDFNote						m_aContents;
437*cdf0e10cSrcweir 
438*cdf0e10cSrcweir         PDFNoteEntry()
439*cdf0e10cSrcweir         {}
440*cdf0e10cSrcweir     };
441*cdf0e10cSrcweir 
442*cdf0e10cSrcweir     typedef std::hash_map< rtl::OString, SvMemoryStream*, rtl::OStringHash > PDFAppearanceStreams;
443*cdf0e10cSrcweir     typedef std::hash_map< rtl::OString, PDFAppearanceStreams, rtl::OStringHash > PDFAppearanceMap;
444*cdf0e10cSrcweir 
445*cdf0e10cSrcweir     struct PDFWidget : public PDFAnnotation
446*cdf0e10cSrcweir     {
447*cdf0e10cSrcweir         PDFWriter::WidgetType		m_eType;
448*cdf0e10cSrcweir         rtl::OString				m_aName;
449*cdf0e10cSrcweir         rtl::OUString				m_aDescription;
450*cdf0e10cSrcweir         rtl::OUString				m_aText;
451*cdf0e10cSrcweir         sal_uInt16						m_nTextStyle;
452*cdf0e10cSrcweir         rtl::OUString				m_aValue;
453*cdf0e10cSrcweir         rtl::OString                m_aDAString;
454*cdf0e10cSrcweir         rtl::OString                m_aDRDict;
455*cdf0e10cSrcweir         rtl::OString				m_aMKDict;
456*cdf0e10cSrcweir 		rtl::OString				m_aMKDictCAString;	// i12626, added to be able to encrypt the /CA text string
457*cdf0e10cSrcweir 														// since the object number is not known at the moment
458*cdf0e10cSrcweir 														// of filling m_aMKDict, the string will be encrypted when emitted.
459*cdf0e10cSrcweir 														// the /CA string MUST BE the last added to m_aMKDict
460*cdf0e10cSrcweir 														// see code for details
461*cdf0e10cSrcweir         sal_Int32					m_nFlags;
462*cdf0e10cSrcweir         sal_Int32					m_nParent; // if not 0, parent's object number
463*cdf0e10cSrcweir         std::vector<sal_Int32>		m_aKids; // widget children, contains object numbers
464*cdf0e10cSrcweir         std::vector<sal_Int32>      m_aKidsIndex; // widget children, contains index to m_aWidgets
465*cdf0e10cSrcweir         rtl::OUString               m_aOnValue;
466*cdf0e10cSrcweir         sal_Int32                   m_nTabOrder; // lowest number gets first in tab order
467*cdf0e10cSrcweir         sal_Int32					m_nRadioGroup;
468*cdf0e10cSrcweir         sal_Int32					m_nMaxLen;
469*cdf0e10cSrcweir         bool                        m_bSubmit;
470*cdf0e10cSrcweir         bool                        m_bSubmitGet;
471*cdf0e10cSrcweir         sal_Int32                   m_nDest;
472*cdf0e10cSrcweir         std::vector<rtl::OUString>	m_aListEntries;
473*cdf0e10cSrcweir         std::vector<sal_Int32>      m_aSelectedEntries;
474*cdf0e10cSrcweir         PDFAppearanceMap			m_aAppearances;
475*cdf0e10cSrcweir         PDFWidget()
476*cdf0e10cSrcweir                 : m_eType( PDFWriter::PushButton ),
477*cdf0e10cSrcweir                   m_nTextStyle( 0 ),
478*cdf0e10cSrcweir                   m_nFlags( 0 ),
479*cdf0e10cSrcweir                   m_nParent( 0 ),
480*cdf0e10cSrcweir                   m_nRadioGroup( -1 ),
481*cdf0e10cSrcweir                   m_nMaxLen( 0 ),
482*cdf0e10cSrcweir                   m_bSubmit( false ),
483*cdf0e10cSrcweir                   m_bSubmitGet( false ),
484*cdf0e10cSrcweir                   m_nDest( -1 )
485*cdf0e10cSrcweir         {}
486*cdf0e10cSrcweir     };
487*cdf0e10cSrcweir 
488*cdf0e10cSrcweir     struct PDFStructureAttribute
489*cdf0e10cSrcweir     {
490*cdf0e10cSrcweir         PDFWriter::StructAttributeValue		eValue;
491*cdf0e10cSrcweir         sal_Int32							nValue;
492*cdf0e10cSrcweir 
493*cdf0e10cSrcweir         PDFStructureAttribute()
494*cdf0e10cSrcweir                 : eValue( PDFWriter::Invalid ),
495*cdf0e10cSrcweir                   nValue( 0 )
496*cdf0e10cSrcweir         {}
497*cdf0e10cSrcweir 
498*cdf0e10cSrcweir         PDFStructureAttribute( PDFWriter::StructAttributeValue eVal )
499*cdf0e10cSrcweir                 : eValue( eVal ),
500*cdf0e10cSrcweir                   nValue( 0 )
501*cdf0e10cSrcweir         {}
502*cdf0e10cSrcweir 
503*cdf0e10cSrcweir         PDFStructureAttribute( sal_Int32 nVal )
504*cdf0e10cSrcweir                 : eValue( PDFWriter::Invalid ),
505*cdf0e10cSrcweir                   nValue( nVal )
506*cdf0e10cSrcweir         {}
507*cdf0e10cSrcweir     };
508*cdf0e10cSrcweir 
509*cdf0e10cSrcweir     typedef std::map<PDFWriter::StructAttribute, PDFStructureAttribute > PDFStructAttributes;
510*cdf0e10cSrcweir 
511*cdf0e10cSrcweir     struct PDFStructureElementKid // for Kids entries
512*cdf0e10cSrcweir     {
513*cdf0e10cSrcweir         sal_Int32 nObject;  // an object number if nMCID is -1,
514*cdf0e10cSrcweir                             // else the page object relevant to MCID
515*cdf0e10cSrcweir         sal_Int32 nMCID;    // an MCID if >= 0
516*cdf0e10cSrcweir 
517*cdf0e10cSrcweir         PDFStructureElementKid( sal_Int32 nObj ) : nObject( nObj ), nMCID( -1 ) {}
518*cdf0e10cSrcweir         PDFStructureElementKid( sal_Int32 MCID, sal_Int32 nPage ) : nObject( nPage ), nMCID( MCID ) {}
519*cdf0e10cSrcweir     };
520*cdf0e10cSrcweir 
521*cdf0e10cSrcweir     struct PDFStructureElement
522*cdf0e10cSrcweir     {
523*cdf0e10cSrcweir         sal_Int32											m_nObject;
524*cdf0e10cSrcweir         PDFWriter::StructElement							m_eType;
525*cdf0e10cSrcweir         rtl::OString                                        m_aAlias;
526*cdf0e10cSrcweir         sal_Int32											m_nOwnElement; // index into structure vector
527*cdf0e10cSrcweir         sal_Int32											m_nParentElement; // index into structure vector
528*cdf0e10cSrcweir         sal_Int32											m_nFirstPageObject;
529*cdf0e10cSrcweir         bool												m_bOpenMCSeq;
530*cdf0e10cSrcweir         std::list< sal_Int32 >								m_aChildren; // indexes into structure vector
531*cdf0e10cSrcweir         std::list< PDFStructureElementKid >                 m_aKids;
532*cdf0e10cSrcweir         PDFStructAttributes									m_aAttributes;
533*cdf0e10cSrcweir         Rectangle											m_aBBox;
534*cdf0e10cSrcweir         rtl::OUString										m_aActualText;
535*cdf0e10cSrcweir         rtl::OUString										m_aAltText;
536*cdf0e10cSrcweir         com::sun::star::lang::Locale                        m_aLocale;
537*cdf0e10cSrcweir 
538*cdf0e10cSrcweir         // m_aContents contains the element's marked content sequence
539*cdf0e10cSrcweir         // as pairs of (page nr, MCID)
540*cdf0e10cSrcweir 
541*cdf0e10cSrcweir         PDFStructureElement()
542*cdf0e10cSrcweir                 : m_nObject( 0 ),
543*cdf0e10cSrcweir                   m_eType( PDFWriter::NonStructElement ),
544*cdf0e10cSrcweir                   m_nOwnElement( -1 ),
545*cdf0e10cSrcweir                   m_nParentElement( -1 ),
546*cdf0e10cSrcweir                   m_nFirstPageObject( 0 ),
547*cdf0e10cSrcweir                   m_bOpenMCSeq( false )
548*cdf0e10cSrcweir         {
549*cdf0e10cSrcweir         }
550*cdf0e10cSrcweir 
551*cdf0e10cSrcweir     };
552*cdf0e10cSrcweir 
553*cdf0e10cSrcweir     struct PDFAddStream
554*cdf0e10cSrcweir     {
555*cdf0e10cSrcweir         rtl::OUString           m_aMimeType;
556*cdf0e10cSrcweir         PDFOutputStream*        m_pStream;
557*cdf0e10cSrcweir         sal_Int32               m_nStreamObject;
558*cdf0e10cSrcweir         bool                    m_bCompress;
559*cdf0e10cSrcweir 
560*cdf0e10cSrcweir         PDFAddStream() : m_pStream( NULL ), m_nStreamObject( 0 ), m_bCompress( true ) {}
561*cdf0e10cSrcweir     };
562*cdf0e10cSrcweir 
563*cdf0e10cSrcweir 
564*cdf0e10cSrcweir     // helper structure for drawLayout and friends
565*cdf0e10cSrcweir     struct PDFGlyph
566*cdf0e10cSrcweir     {
567*cdf0e10cSrcweir         Point       m_aPos;
568*cdf0e10cSrcweir         sal_Int32   m_nNativeWidth;
569*cdf0e10cSrcweir         sal_Int32   m_nGlyphId;
570*cdf0e10cSrcweir         sal_Int32   m_nMappedFontId;
571*cdf0e10cSrcweir         sal_uInt8   m_nMappedGlyphId;
572*cdf0e10cSrcweir 
573*cdf0e10cSrcweir         PDFGlyph( const Point& rPos,
574*cdf0e10cSrcweir                   sal_Int32 nNativeWidth,
575*cdf0e10cSrcweir                   sal_Int32 nGlyphId,
576*cdf0e10cSrcweir                   sal_Int32 nFontId,
577*cdf0e10cSrcweir                   sal_uInt8 nMappedGlyphId )
578*cdf0e10cSrcweir         : m_aPos( rPos ), m_nNativeWidth( nNativeWidth ), m_nGlyphId( nGlyphId ),
579*cdf0e10cSrcweir           m_nMappedFontId( nFontId ), m_nMappedGlyphId( nMappedGlyphId )
580*cdf0e10cSrcweir         {}
581*cdf0e10cSrcweir     };
582*cdf0e10cSrcweir 
583*cdf0e10cSrcweir 
584*cdf0e10cSrcweir     static const sal_Char* getStructureTag( PDFWriter::StructElement );
585*cdf0e10cSrcweir     static const sal_Char* getAttributeTag( PDFWriter::StructAttribute eAtr );
586*cdf0e10cSrcweir     static const sal_Char* getAttributeValueTag( PDFWriter::StructAttributeValue eVal );
587*cdf0e10cSrcweir 
588*cdf0e10cSrcweir     // returns true if compression was done
589*cdf0e10cSrcweir     // else false
590*cdf0e10cSrcweir     static bool compressStream( SvMemoryStream* );
591*cdf0e10cSrcweir 
592*cdf0e10cSrcweir     static void convertLineInfoToExtLineInfo( const LineInfo& rIn, PDFWriter::ExtLineInfo& rOut );
593*cdf0e10cSrcweir private:
594*cdf0e10cSrcweir     static const BuiltinFont m_aBuiltinFonts[14];
595*cdf0e10cSrcweir 
596*cdf0e10cSrcweir     OutputDevice*						m_pReferenceDevice;
597*cdf0e10cSrcweir 
598*cdf0e10cSrcweir     MapMode								m_aMapMode; // PDFWriterImpl scaled units
599*cdf0e10cSrcweir     std::vector< PDFPage >				m_aPages;
600*cdf0e10cSrcweir     /* maps object numbers to file offsets (needed for xref) */
601*cdf0e10cSrcweir     std::vector< sal_uInt64 >			m_aObjects;
602*cdf0e10cSrcweir     /* contains Bitmaps until they are written to the
603*cdf0e10cSrcweir      *  file stream as XObjects*/
604*cdf0e10cSrcweir     std::list< BitmapEmit >				m_aBitmaps;
605*cdf0e10cSrcweir     /* contains JPG streams until written to file     */
606*cdf0e10cSrcweir     std::list<JPGEmit>					m_aJPGs;
607*cdf0e10cSrcweir     /*--->i56629 contains all named destinations ever set during the PDF creation,
608*cdf0e10cSrcweir        destination id is always the destination's position in this vector
609*cdf0e10cSrcweir      */
610*cdf0e10cSrcweir     std::vector<PDFNamedDest>		    m_aNamedDests;
611*cdf0e10cSrcweir     //<---
612*cdf0e10cSrcweir     /* contains all dests ever set during the PDF creation,
613*cdf0e10cSrcweir        dest id is always the dest's position in this vector
614*cdf0e10cSrcweir      */
615*cdf0e10cSrcweir     std::vector<PDFDest>				m_aDests;
616*cdf0e10cSrcweir     /** contains destinations accessible via a public Id, instead of being linked to by an ordinary link
617*cdf0e10cSrcweir     */
618*cdf0e10cSrcweir     ::std::map< sal_Int32, sal_Int32 >  m_aDestinationIdTranslation;
619*cdf0e10cSrcweir     /* contains all links ever set during PDF creation,
620*cdf0e10cSrcweir        link id is always the link's position in this vector
621*cdf0e10cSrcweir     */
622*cdf0e10cSrcweir     std::vector<PDFLink>				m_aLinks;
623*cdf0e10cSrcweir     /* makes correctly encoded for export to PDF URLS
624*cdf0e10cSrcweir     */
625*cdf0e10cSrcweir     com::sun::star::uno::Reference< com::sun::star::util::XURLTransformer > m_xTrans;
626*cdf0e10cSrcweir     /* maps arbitrary link ids for structure attributes to real link ids
627*cdf0e10cSrcweir        (for setLinkPropertyId)
628*cdf0e10cSrcweir     */
629*cdf0e10cSrcweir     std::map<sal_Int32, sal_Int32>		m_aLinkPropertyMap;
630*cdf0e10cSrcweir     /* contains all outline items,
631*cdf0e10cSrcweir        object 0 is the outline root
632*cdf0e10cSrcweir      */
633*cdf0e10cSrcweir     std::vector<PDFOutlineEntry>		m_aOutline;
634*cdf0e10cSrcweir     /* contains all notes set during PDF creation
635*cdf0e10cSrcweir      */
636*cdf0e10cSrcweir     std::vector<PDFNoteEntry>			m_aNotes;
637*cdf0e10cSrcweir 	/* the root of the structure tree
638*cdf0e10cSrcweir      */
639*cdf0e10cSrcweir     std::vector<PDFStructureElement>	m_aStructure;
640*cdf0e10cSrcweir     /* current object in the structure hierarchy
641*cdf0e10cSrcweir      */
642*cdf0e10cSrcweir     sal_Int32							m_nCurrentStructElement;
643*cdf0e10cSrcweir     /* structure parent tree */
644*cdf0e10cSrcweir     std::vector< rtl::OString >         m_aStructParentTree;
645*cdf0e10cSrcweir     /* emit strucure marks currently (aka. NonStructElement or not)
646*cdf0e10cSrcweir      */
647*cdf0e10cSrcweir     bool								m_bEmitStructure;
648*cdf0e10cSrcweir     bool								m_bNewMCID;
649*cdf0e10cSrcweir     /* role map of struct tree root */
650*cdf0e10cSrcweir     std::hash_map< rtl::OString, rtl::OString, rtl::OStringHash >
651*cdf0e10cSrcweir                                         m_aRoleMap;
652*cdf0e10cSrcweir 
653*cdf0e10cSrcweir     /* contains all widgets used in the PDF
654*cdf0e10cSrcweir      */
655*cdf0e10cSrcweir     std::vector<PDFWidget>				m_aWidgets;
656*cdf0e10cSrcweir     /* maps radio group id to index of radio group control in m_aWidgets */
657*cdf0e10cSrcweir     std::map< sal_Int32, sal_Int32 >	m_aRadioGroupWidgets;
658*cdf0e10cSrcweir     /* used to store control id during beginControlAppearance/endControlAppearance */
659*cdf0e10cSrcweir     sal_Int32							m_nCurrentControl;
660*cdf0e10cSrcweir     /* hash_map for field names, used to ensure unique field names */
661*cdf0e10cSrcweir     std::hash_map< rtl::OString, sal_Int32, rtl::OStringHash > m_aFieldNameMap;
662*cdf0e10cSrcweir 
663*cdf0e10cSrcweir     /* contains Bitmaps for gradient functions until they are written
664*cdf0e10cSrcweir      *  to the file stream */
665*cdf0e10cSrcweir     std::list< GradientEmit >			m_aGradients;
666*cdf0e10cSrcweir     /* contains bitmap tiling patterns */
667*cdf0e10cSrcweir     std::vector< TilingEmit >		    m_aTilings;
668*cdf0e10cSrcweir     std::list< TransparencyEmit >		m_aTransparentObjects;
669*cdf0e10cSrcweir     /*  contains all font subsets in use */
670*cdf0e10cSrcweir     FontSubsetData						m_aSubsets;
671*cdf0e10cSrcweir     bool                                m_bEmbedStandardFonts;
672*cdf0e10cSrcweir     FontEmbedData						m_aEmbeddedFonts;
673*cdf0e10cSrcweir     FontEmbedData                       m_aSystemFonts;
674*cdf0e10cSrcweir     sal_Int32							m_nNextFID;
675*cdf0e10cSrcweir     PDFFontCache                        m_aFontCache;
676*cdf0e10cSrcweir 
677*cdf0e10cSrcweir     sal_Int32							m_nInheritedPageWidth;  // in inch/72
678*cdf0e10cSrcweir     sal_Int32							m_nInheritedPageHeight; // in inch/72
679*cdf0e10cSrcweir     PDFWriter::Orientation				m_eInheritedOrientation;
680*cdf0e10cSrcweir     sal_Int32							m_nCurrentPage;
681*cdf0e10cSrcweir 
682*cdf0e10cSrcweir     sal_Int32							m_nCatalogObject;
683*cdf0e10cSrcweir     sal_Int32							m_nResourceDict;
684*cdf0e10cSrcweir     ResourceDict                        m_aGlobalResourceDict;
685*cdf0e10cSrcweir     sal_Int32                           m_nFontDictObject;
686*cdf0e10cSrcweir     std::map< sal_Int32, sal_Int32 >    m_aBuiltinFontToObjectMap;
687*cdf0e10cSrcweir 
688*cdf0e10cSrcweir     PDFWriter::PDFWriterContext			m_aContext;
689*cdf0e10cSrcweir     oslFileHandle						m_aFile;
690*cdf0e10cSrcweir     bool								m_bOpen;
691*cdf0e10cSrcweir 
692*cdf0e10cSrcweir 
693*cdf0e10cSrcweir     /* output redirection; e.g. to accumulate content streams for
694*cdf0e10cSrcweir        XObjects
695*cdf0e10cSrcweir      */
696*cdf0e10cSrcweir     struct StreamRedirect
697*cdf0e10cSrcweir     {
698*cdf0e10cSrcweir         SvStream*		m_pStream;
699*cdf0e10cSrcweir         MapMode   		m_aMapMode;
700*cdf0e10cSrcweir         Rectangle       m_aTargetRect;
701*cdf0e10cSrcweir         ResourceDict    m_aResourceDict;
702*cdf0e10cSrcweir     };
703*cdf0e10cSrcweir     std::list< StreamRedirect >			m_aOutputStreams;
704*cdf0e10cSrcweir 
705*cdf0e10cSrcweir     // graphics state
706*cdf0e10cSrcweir     struct GraphicsState
707*cdf0e10cSrcweir     {
708*cdf0e10cSrcweir         Font			                 m_aFont;
709*cdf0e10cSrcweir         MapMode			                 m_aMapMode;
710*cdf0e10cSrcweir         Color			                 m_aLineColor;
711*cdf0e10cSrcweir         Color			                 m_aFillColor;
712*cdf0e10cSrcweir         Color			                 m_aTextLineColor;
713*cdf0e10cSrcweir         Color			                 m_aOverlineColor;
714*cdf0e10cSrcweir         basegfx::B2DPolyPolygon			 m_aClipRegion;
715*cdf0e10cSrcweir         bool                             m_bClipRegion;
716*cdf0e10cSrcweir         sal_Int32		                 m_nAntiAlias;
717*cdf0e10cSrcweir         sal_Int32		                 m_nLayoutMode;
718*cdf0e10cSrcweir         LanguageType                     m_aDigitLanguage;
719*cdf0e10cSrcweir         sal_Int32		                 m_nTransparentPercent;
720*cdf0e10cSrcweir         sal_uInt16		                 m_nFlags;
721*cdf0e10cSrcweir         sal_uInt16                       m_nUpdateFlags;
722*cdf0e10cSrcweir 
723*cdf0e10cSrcweir         static const sal_uInt16 updateFont                  = 0x0001;
724*cdf0e10cSrcweir         static const sal_uInt16 updateMapMode               = 0x0002;
725*cdf0e10cSrcweir         static const sal_uInt16 updateLineColor             = 0x0004;
726*cdf0e10cSrcweir         static const sal_uInt16 updateFillColor             = 0x0008;
727*cdf0e10cSrcweir         static const sal_uInt16 updateTextLineColor         = 0x0010;
728*cdf0e10cSrcweir         static const sal_uInt16 updateOverlineColor         = 0x0020;
729*cdf0e10cSrcweir         static const sal_uInt16 updateClipRegion            = 0x0040;
730*cdf0e10cSrcweir         static const sal_uInt16 updateAntiAlias             = 0x0080;
731*cdf0e10cSrcweir         static const sal_uInt16 updateLayoutMode            = 0x0100;
732*cdf0e10cSrcweir         static const sal_uInt16 updateTransparentPercent    = 0x0200;
733*cdf0e10cSrcweir         static const sal_uInt16 updateDigitLanguage         = 0x0400;
734*cdf0e10cSrcweir 
735*cdf0e10cSrcweir         GraphicsState() :
736*cdf0e10cSrcweir                 m_aLineColor( COL_TRANSPARENT ),
737*cdf0e10cSrcweir                 m_aFillColor( COL_TRANSPARENT ),
738*cdf0e10cSrcweir                 m_aTextLineColor( COL_TRANSPARENT ),
739*cdf0e10cSrcweir                 m_aOverlineColor( COL_TRANSPARENT ),
740*cdf0e10cSrcweir                 m_bClipRegion( false ),
741*cdf0e10cSrcweir                 m_nAntiAlias( 1 ),
742*cdf0e10cSrcweir                 m_nLayoutMode( 0 ),
743*cdf0e10cSrcweir                 m_aDigitLanguage( 0 ),
744*cdf0e10cSrcweir                 m_nTransparentPercent( 0 ),
745*cdf0e10cSrcweir                 m_nFlags( 0xffff ),
746*cdf0e10cSrcweir                 m_nUpdateFlags( 0xffff )
747*cdf0e10cSrcweir         {}
748*cdf0e10cSrcweir         GraphicsState( const GraphicsState& rState ) :
749*cdf0e10cSrcweir                 m_aFont( rState.m_aFont ),
750*cdf0e10cSrcweir                 m_aMapMode( rState.m_aMapMode ),
751*cdf0e10cSrcweir                 m_aLineColor( rState.m_aLineColor ),
752*cdf0e10cSrcweir                 m_aFillColor( rState.m_aFillColor ),
753*cdf0e10cSrcweir                 m_aTextLineColor( rState.m_aTextLineColor ),
754*cdf0e10cSrcweir                 m_aOverlineColor( rState.m_aOverlineColor ),
755*cdf0e10cSrcweir                 m_aClipRegion( rState.m_aClipRegion ),
756*cdf0e10cSrcweir                 m_bClipRegion( rState.m_bClipRegion ),
757*cdf0e10cSrcweir                 m_nAntiAlias( rState.m_nAntiAlias ),
758*cdf0e10cSrcweir                 m_nLayoutMode( rState.m_nLayoutMode ),
759*cdf0e10cSrcweir                 m_aDigitLanguage( rState.m_aDigitLanguage ),
760*cdf0e10cSrcweir                 m_nTransparentPercent( rState.m_nTransparentPercent ),
761*cdf0e10cSrcweir                 m_nFlags( rState.m_nFlags ),
762*cdf0e10cSrcweir                 m_nUpdateFlags( rState.m_nUpdateFlags )
763*cdf0e10cSrcweir         {
764*cdf0e10cSrcweir         }
765*cdf0e10cSrcweir 
766*cdf0e10cSrcweir         GraphicsState& operator=(const GraphicsState& rState )
767*cdf0e10cSrcweir         {
768*cdf0e10cSrcweir             m_aFont					= rState.m_aFont;
769*cdf0e10cSrcweir             m_aMapMode				= rState.m_aMapMode;
770*cdf0e10cSrcweir             m_aLineColor			= rState.m_aLineColor;
771*cdf0e10cSrcweir             m_aFillColor			= rState.m_aFillColor;
772*cdf0e10cSrcweir             m_aTextLineColor		= rState.m_aTextLineColor;
773*cdf0e10cSrcweir             m_aOverlineColor		= rState.m_aOverlineColor;
774*cdf0e10cSrcweir             m_aClipRegion			= rState.m_aClipRegion;
775*cdf0e10cSrcweir             m_bClipRegion           = rState.m_bClipRegion;
776*cdf0e10cSrcweir             m_nAntiAlias			= rState.m_nAntiAlias;
777*cdf0e10cSrcweir             m_nLayoutMode			= rState.m_nLayoutMode;
778*cdf0e10cSrcweir             m_aDigitLanguage        = rState.m_aDigitLanguage;
779*cdf0e10cSrcweir             m_nTransparentPercent	= rState.m_nTransparentPercent;
780*cdf0e10cSrcweir             m_nFlags				= rState.m_nFlags;
781*cdf0e10cSrcweir             m_nUpdateFlags          = rState.m_nUpdateFlags;
782*cdf0e10cSrcweir             return *this;
783*cdf0e10cSrcweir         }
784*cdf0e10cSrcweir     };
785*cdf0e10cSrcweir     std::list< GraphicsState >				m_aGraphicsStack;
786*cdf0e10cSrcweir     GraphicsState							m_aCurrentPDFState;
787*cdf0e10cSrcweir 
788*cdf0e10cSrcweir     ZCodec*									m_pCodec;
789*cdf0e10cSrcweir     SvMemoryStream*							m_pMemStream;
790*cdf0e10cSrcweir 
791*cdf0e10cSrcweir     std::vector< PDFAddStream >             m_aAdditionalStreams;
792*cdf0e10cSrcweir     std::set< PDFWriter::ErrorCode >        m_aErrors;
793*cdf0e10cSrcweir 
794*cdf0e10cSrcweir     rtlDigest                               m_aDocDigest;
795*cdf0e10cSrcweir 
796*cdf0e10cSrcweir /*
797*cdf0e10cSrcweir variables for PDF security
798*cdf0e10cSrcweir i12626
799*cdf0e10cSrcweir */
800*cdf0e10cSrcweir /* used to cipher the stream data and for password management */
801*cdf0e10cSrcweir 	rtlCipher								m_aCipher;
802*cdf0e10cSrcweir 	rtlDigest								m_aDigest;
803*cdf0e10cSrcweir 	/* pad string used for password in Standard security handler */
804*cdf0e10cSrcweir 	static const sal_uInt8					s_nPadString[ENCRYPTED_PWD_SIZE];
805*cdf0e10cSrcweir 
806*cdf0e10cSrcweir 	/* the encryption key, formed with the user password according to algorithm 3.2, maximum length is 16 bytes + 3 + 2
807*cdf0e10cSrcweir 	for 128 bit security   */
808*cdf0e10cSrcweir 	sal_Int32								m_nKeyLength; // key length, 16 or 5
809*cdf0e10cSrcweir 	sal_Int32								m_nRC4KeyLength; // key length, 16 or 10, to be input to the algorith 3.1
810*cdf0e10cSrcweir 
811*cdf0e10cSrcweir 	/* set to true if the following stream must be encrypted, used inside writeBuffer() */
812*cdf0e10cSrcweir 	sal_Bool								m_bEncryptThisStream;
813*cdf0e10cSrcweir 
814*cdf0e10cSrcweir 	/* the numerical value of the access permissions, according to PDF spec, must be signed */
815*cdf0e10cSrcweir 	sal_Int32                               m_nAccessPermissions;
816*cdf0e10cSrcweir 	/* string to hold the PDF creation date */
817*cdf0e10cSrcweir 	rtl::OString						    m_aCreationDateString;
818*cdf0e10cSrcweir 	/* string to hold the PDF creation date, for PDF/A metadata */
819*cdf0e10cSrcweir 	rtl::OString						    m_aCreationMetaDateString;
820*cdf0e10cSrcweir 	/* the buffer where the data are encrypted, dynamically allocated */
821*cdf0e10cSrcweir 	sal_uInt8								*m_pEncryptionBuffer;
822*cdf0e10cSrcweir 	/* size of the buffer */
823*cdf0e10cSrcweir 	sal_Int32								m_nEncryptionBufferSize;
824*cdf0e10cSrcweir 
825*cdf0e10cSrcweir 	/* check and reallocate the buffer for encryption */
826*cdf0e10cSrcweir 	sal_Bool checkEncryptionBufferSize( register sal_Int32 newSize );
827*cdf0e10cSrcweir 	/* this function implements part of the PDF spec algorithm 3.1 in encryption, the rest (the actual encryption) is in PDFWriterImpl::writeBuffer */
828*cdf0e10cSrcweir     void checkAndEnableStreamEncryption( register sal_Int32 nObject );
829*cdf0e10cSrcweir 
830*cdf0e10cSrcweir 	void disableStreamEncryption() { m_bEncryptThisStream = false; };
831*cdf0e10cSrcweir 
832*cdf0e10cSrcweir 	/* */
833*cdf0e10cSrcweir     void enableStringEncryption( register sal_Int32 nObject );
834*cdf0e10cSrcweir 
835*cdf0e10cSrcweir // test if the encryption is active, if yes than encrypt the unicode string  and add to the OStringBuffer parameter
836*cdf0e10cSrcweir 	void appendUnicodeTextStringEncrypt( const rtl::OUString& rInString, const sal_Int32 nInObjectNumber, rtl::OStringBuffer& rOutBuffer );
837*cdf0e10cSrcweir 
838*cdf0e10cSrcweir 	void appendLiteralStringEncrypt( const rtl::OUString& rInString, const sal_Int32 nInObjectNumber, rtl::OStringBuffer& rOutBuffer, rtl_TextEncoding nEnc = RTL_TEXTENCODING_ASCII_US );
839*cdf0e10cSrcweir 	void appendLiteralStringEncrypt( const rtl::OString& rInString, const sal_Int32 nInObjectNumber, rtl::OStringBuffer& rOutBuffer );
840*cdf0e10cSrcweir 	void appendLiteralStringEncrypt( rtl::OStringBuffer& rInString, const sal_Int32 nInObjectNumber, rtl::OStringBuffer& rOutBuffer );
841*cdf0e10cSrcweir 
842*cdf0e10cSrcweir     /* creates fonts and subsets that will be emitted later */
843*cdf0e10cSrcweir     void registerGlyphs( int nGlyphs, sal_GlyphId* pGlyphs, sal_Int32* pGlpyhWidths, sal_Ucs* pUnicodes, sal_Int32* pUnicodesPerGlyph, sal_uInt8* pMappedGlyphs, sal_Int32* pMappedFontObjects, const ImplFontData* pFallbackFonts[] );
844*cdf0e10cSrcweir 
845*cdf0e10cSrcweir     /*  emits a text object according to the passed layout */
846*cdf0e10cSrcweir     /* TODO: remove rText as soon as SalLayout will change so that rText is not necessary anymore */
847*cdf0e10cSrcweir     void drawVerticalGlyphs( const std::vector<PDFGlyph>& rGlyphs, rtl::OStringBuffer& rLine, const Point& rAlignOffset, const Matrix3& rRotScale, double fAngle, double fXScale, double fSkew, sal_Int32 nFontHeight );
848*cdf0e10cSrcweir     void drawHorizontalGlyphs( const std::vector<PDFGlyph>& rGlyphs, rtl::OStringBuffer& rLine, const Point& rAlignOffset, double fAngle, double fXScale, double fSkew, sal_Int32 nFontHeight, sal_Int32 nPixelFontHeight );
849*cdf0e10cSrcweir     void drawLayout( SalLayout& rLayout, const String& rText, bool bTextLines );
850*cdf0e10cSrcweir     void drawRelief( SalLayout& rLayout, const String& rText, bool bTextLines );
851*cdf0e10cSrcweir     void drawShadow( SalLayout& rLayout, const String& rText, bool bTextLines );
852*cdf0e10cSrcweir 
853*cdf0e10cSrcweir     /*  writes differences between graphics stack and current real PDF
854*cdf0e10cSrcweir      *   state to the file
855*cdf0e10cSrcweir      */
856*cdf0e10cSrcweir     void updateGraphicsState();
857*cdf0e10cSrcweir 
858*cdf0e10cSrcweir     /* writes a transparency group object */
859*cdf0e10cSrcweir     bool writeTransparentObject( TransparencyEmit& rObject );
860*cdf0e10cSrcweir 
861*cdf0e10cSrcweir     /* writes an XObject of type image, may create
862*cdf0e10cSrcweir        a second for the mask
863*cdf0e10cSrcweir      */
864*cdf0e10cSrcweir     bool writeBitmapObject( BitmapEmit& rObject, bool bMask = false );
865*cdf0e10cSrcweir 
866*cdf0e10cSrcweir     bool writeJPG( JPGEmit& rEmit );
867*cdf0e10cSrcweir 
868*cdf0e10cSrcweir     /* tries to find the bitmap by its id and returns its emit data if exists,
869*cdf0e10cSrcweir        else creates a new emit data block */
870*cdf0e10cSrcweir     const BitmapEmit& createBitmapEmit( const BitmapEx& rBitmapEx, bool bDrawMask = false );
871*cdf0e10cSrcweir 
872*cdf0e10cSrcweir     /* writes the Do operation inside the content stream */
873*cdf0e10cSrcweir     void drawBitmap( const Point& rDestPt, const Size& rDestSize, const BitmapEmit& rBitmap, const Color& rFillColor );
874*cdf0e10cSrcweir     /* write the function object for a Gradient */
875*cdf0e10cSrcweir     bool writeGradientFunction( GradientEmit& rObject );
876*cdf0e10cSrcweir     /* creates a GradientEmit and returns its object number */
877*cdf0e10cSrcweir     sal_Int32 createGradient(  const Gradient& rGradient, const Size& rSize );
878*cdf0e10cSrcweir 
879*cdf0e10cSrcweir     /* writes all tilings */
880*cdf0e10cSrcweir     bool emitTilings();
881*cdf0e10cSrcweir     /* writes all gradient patterns */
882*cdf0e10cSrcweir     bool emitGradients();
883*cdf0e10cSrcweir     /* writes a builtin font object and returns its objectid (or 0 in case of failure ) */
884*cdf0e10cSrcweir     sal_Int32 emitBuiltinFont( const ImplFontData*, sal_Int32 nObject = -1 );
885*cdf0e10cSrcweir     /* writes a type1 embedded font object and returns its mapping from font ids to object ids (or 0 in case of failure ) */
886*cdf0e10cSrcweir     std::map< sal_Int32, sal_Int32 > emitEmbeddedFont( const ImplFontData*, EmbedFont& );
887*cdf0e10cSrcweir     /* writes a type1 system font object and returns its mapping from font ids to object ids (or 0 in case of failure ) */
888*cdf0e10cSrcweir     std::map< sal_Int32, sal_Int32 > emitSystemFont( const ImplFontData*, EmbedFont& );
889*cdf0e10cSrcweir     /* writes a font descriptor and returns its object id (or 0) */
890*cdf0e10cSrcweir     sal_Int32 emitFontDescriptor( const ImplFontData*, FontSubsetInfo&, sal_Int32 nSubsetID, sal_Int32 nStream );
891*cdf0e10cSrcweir     /* writes a ToUnicode cmap, returns the corresponding stream object */
892*cdf0e10cSrcweir     sal_Int32 createToUnicodeCMap( sal_uInt8* pEncoding, sal_Ucs* pUnicodes, sal_Int32* pUnicodesPerGlyph, sal_Int32* pEncToUnicodeIndex, int nGlyphs );
893*cdf0e10cSrcweir 
894*cdf0e10cSrcweir     /* get resource dict object number */
895*cdf0e10cSrcweir     sal_Int32 getResourceDictObj()
896*cdf0e10cSrcweir     {
897*cdf0e10cSrcweir         if( m_nResourceDict <= 0 )
898*cdf0e10cSrcweir             m_nResourceDict = createObject();
899*cdf0e10cSrcweir         return m_nResourceDict;
900*cdf0e10cSrcweir     }
901*cdf0e10cSrcweir     /* get the font dict object */
902*cdf0e10cSrcweir     sal_Int32 getFontDictObject()
903*cdf0e10cSrcweir     {
904*cdf0e10cSrcweir         if( m_nFontDictObject <= 0 )
905*cdf0e10cSrcweir             m_nFontDictObject = createObject();
906*cdf0e10cSrcweir         return m_nFontDictObject;
907*cdf0e10cSrcweir     }
908*cdf0e10cSrcweir     /* push resource into current (redirected) resource dict */
909*cdf0e10cSrcweir     void pushResource( ResourceKind eKind, const rtl::OString& rResource, sal_Int32 nObject );
910*cdf0e10cSrcweir 
911*cdf0e10cSrcweir     void appendBuiltinFontsToDict( rtl::OStringBuffer& rDict ) const;
912*cdf0e10cSrcweir     /* writes a the font dictionary and emits all font objects
913*cdf0e10cSrcweir      * returns object id of font directory (or 0 on error)
914*cdf0e10cSrcweir      */
915*cdf0e10cSrcweir     bool emitFonts();
916*cdf0e10cSrcweir 	/* writes the Resource dictionary;
917*cdf0e10cSrcweir      * returns dict object id (or 0 on error)
918*cdf0e10cSrcweir      */
919*cdf0e10cSrcweir     sal_Int32 emitResources();
920*cdf0e10cSrcweir     // appends a dest
921*cdf0e10cSrcweir     bool appendDest( sal_Int32 nDestID, rtl::OStringBuffer& rBuffer );
922*cdf0e10cSrcweir     // write all links
923*cdf0e10cSrcweir     bool emitLinkAnnotations();
924*cdf0e10cSrcweir     // write all notes
925*cdf0e10cSrcweir     bool emitNoteAnnotations();
926*cdf0e10cSrcweir     // write the appearance streams of a widget
927*cdf0e10cSrcweir     bool emitAppearances( PDFWidget& rWidget, rtl::OStringBuffer& rAnnotDict );
928*cdf0e10cSrcweir     // clean up radio button "On" values
929*cdf0e10cSrcweir     void ensureUniqueRadioOnValues();
930*cdf0e10cSrcweir     // write all widgets
931*cdf0e10cSrcweir     bool emitWidgetAnnotations();
932*cdf0e10cSrcweir     // writes all annotation objects
933*cdf0e10cSrcweir     bool emitAnnotations();
934*cdf0e10cSrcweir     // writes the dest dict for the catalog
935*cdf0e10cSrcweir     sal_Int32 emitDestDict();
936*cdf0e10cSrcweir     //write the named destination stuff
937*cdf0e10cSrcweir     sal_Int32 emitNamedDestinations();//i56629
938*cdf0e10cSrcweir     // writes outline dict and tree
939*cdf0e10cSrcweir     sal_Int32 emitOutline();
940*cdf0e10cSrcweir     // puts the attribute objects of a structure element into the returned string,
941*cdf0e10cSrcweir     // helper for emitStructure
942*cdf0e10cSrcweir     rtl::OString emitStructureAttributes( PDFStructureElement& rEle );
943*cdf0e10cSrcweir     //--->i94258
944*cdf0e10cSrcweir     // the maximum array elements allowed for PDF array object
945*cdf0e10cSrcweir     static const sal_uInt32 ncMaxPDFArraySize = 8191;
946*cdf0e10cSrcweir     //check if internal dummy container are needed in the structure elements
947*cdf0e10cSrcweir     void addInternalStructureContainer( PDFStructureElement& rEle );
948*cdf0e10cSrcweir     //<---i94258
949*cdf0e10cSrcweir     // writes document structure
950*cdf0e10cSrcweir     sal_Int32 emitStructure( PDFStructureElement& rEle );
951*cdf0e10cSrcweir     // writes structure parent tree
952*cdf0e10cSrcweir     sal_Int32 emitStructParentTree( sal_Int32 nTreeObject );
953*cdf0e10cSrcweir     // writes page tree and catalog
954*cdf0e10cSrcweir     bool emitCatalog();
955*cdf0e10cSrcweir     // writes xref and trailer
956*cdf0e10cSrcweir     bool emitTrailer();
957*cdf0e10cSrcweir     // emit additional streams collected; also create there object numbers
958*cdf0e10cSrcweir     bool emitAdditionalStreams();
959*cdf0e10cSrcweir     // emits info dict (if applicable)
960*cdf0e10cSrcweir     sal_Int32 emitInfoDict( );
961*cdf0e10cSrcweir 
962*cdf0e10cSrcweir     // acrobat reader 5 and 6 use the order of the annotations
963*cdf0e10cSrcweir     // as their tab order; since PDF1.5 one can make the
964*cdf0e10cSrcweir     // tab order explicit by using the structure tree
965*cdf0e10cSrcweir     void sortWidgets();
966*cdf0e10cSrcweir 
967*cdf0e10cSrcweir     // updates the count numbers of outline items
968*cdf0e10cSrcweir     sal_Int32 updateOutlineItemCount( std::vector< sal_Int32 >& rCounts,
969*cdf0e10cSrcweir                                       sal_Int32 nItemLevel,
970*cdf0e10cSrcweir                                       sal_Int32 nCurrentItemId );
971*cdf0e10cSrcweir     // default appearences for widgets
972*cdf0e10cSrcweir     sal_Int32 findRadioGroupWidget( const PDFWriter::RadioButtonWidget& rRadio );
973*cdf0e10cSrcweir     Font replaceFont( const Font& rControlFont, const Font& rAppSetFont );
974*cdf0e10cSrcweir     sal_Int32 getBestBuiltinFont( const Font& rFont );
975*cdf0e10cSrcweir     sal_Int32 getSystemFont( const Font& i_rFont );
976*cdf0e10cSrcweir 
977*cdf0e10cSrcweir     // used for edit and listbox
978*cdf0e10cSrcweir     Font drawFieldBorder( PDFWidget&, const PDFWriter::AnyWidget&, const StyleSettings& );
979*cdf0e10cSrcweir 
980*cdf0e10cSrcweir     void createDefaultPushButtonAppearance( PDFWidget&, const PDFWriter::PushButtonWidget& rWidget );
981*cdf0e10cSrcweir     void createDefaultCheckBoxAppearance( PDFWidget&, const PDFWriter::CheckBoxWidget& rWidget );
982*cdf0e10cSrcweir     void createDefaultRadioButtonAppearance( PDFWidget&, const PDFWriter::RadioButtonWidget& rWidget );
983*cdf0e10cSrcweir     void createDefaultEditAppearance( PDFWidget&, const PDFWriter::EditWidget& rWidget );
984*cdf0e10cSrcweir     void createDefaultListBoxAppearance( PDFWidget&, const PDFWriter::ListBoxWidget& rWidget );
985*cdf0e10cSrcweir 
986*cdf0e10cSrcweir     /* ensure proper escapement and uniqueness of field names */
987*cdf0e10cSrcweir     void createWidgetFieldName( sal_Int32 i_nWidgetsIndex, const PDFWriter::AnyWidget& i_rInWidget );
988*cdf0e10cSrcweir     /* adds an entry to m_aObjects and returns its index+1,
989*cdf0e10cSrcweir      * sets the offset to ~0
990*cdf0e10cSrcweir      */
991*cdf0e10cSrcweir     sal_Int32 createObject();
992*cdf0e10cSrcweir     /* sets the offset of object n to the current position of output file+1
993*cdf0e10cSrcweir      */
994*cdf0e10cSrcweir     bool updateObject( sal_Int32 n );
995*cdf0e10cSrcweir 
996*cdf0e10cSrcweir     bool writeBuffer( const void* pBuffer, sal_uInt64 nBytes );
997*cdf0e10cSrcweir     void beginCompression();
998*cdf0e10cSrcweir     void endCompression();
999*cdf0e10cSrcweir     void beginRedirect( SvStream* pStream, const Rectangle& );
1000*cdf0e10cSrcweir     // returns an empty rect if no redirection is happending
1001*cdf0e10cSrcweir     Rectangle getRedirectTargetRect() const;
1002*cdf0e10cSrcweir     SvStream* endRedirect();
1003*cdf0e10cSrcweir 
1004*cdf0e10cSrcweir     void endPage();
1005*cdf0e10cSrcweir 
1006*cdf0e10cSrcweir     void beginStructureElementMCSeq();
1007*cdf0e10cSrcweir     void endStructureElementMCSeq();
1008*cdf0e10cSrcweir     /** checks whether a non struct element lies in the ancestor hierarchy
1009*cdf0e10cSrcweir         of the current structure element
1010*cdf0e10cSrcweir 
1011*cdf0e10cSrcweir         @returns
1012*cdf0e10cSrcweir         <true/> if no NonStructElement was found in ancestor path and tagged
1013*cdf0e10cSrcweir         PDF output is enabled
1014*cdf0e10cSrcweir         <false/> else
1015*cdf0e10cSrcweir      */
1016*cdf0e10cSrcweir     bool checkEmitStructure();
1017*cdf0e10cSrcweir 
1018*cdf0e10cSrcweir     /* draws an emphasis mark */
1019*cdf0e10cSrcweir     void drawEmphasisMark(  long nX, long nY, const PolyPolygon& rPolyPoly, sal_Bool bPolyLine, const Rectangle& rRect1, const Rectangle& rRect2 );
1020*cdf0e10cSrcweir 
1021*cdf0e10cSrcweir     /* true if PDF/A-1a or PDF/A-1b is output */
1022*cdf0e10cSrcweir     sal_Bool        m_bIsPDF_A1;
1023*cdf0e10cSrcweir     PDFWriter&      m_rOuterFace;
1024*cdf0e10cSrcweir 
1025*cdf0e10cSrcweir     /*
1026*cdf0e10cSrcweir     i12626
1027*cdf0e10cSrcweir     methods for PDF security
1028*cdf0e10cSrcweir 
1029*cdf0e10cSrcweir     pad a password according  algorithm 3.2, step 1 */
1030*cdf0e10cSrcweir     static void padPassword( const rtl::OUString& i_rPassword, sal_uInt8* o_pPaddedPW );
1031*cdf0e10cSrcweir     /* algorithm 3.2: compute an encryption key */
1032*cdf0e10cSrcweir 	static bool computeEncryptionKey( EncHashTransporter*,
1033*cdf0e10cSrcweir 	                                  vcl::PDFWriter::PDFEncryptionProperties& io_rProperties,
1034*cdf0e10cSrcweir 	                                  sal_Int32 i_nAccessPermissions
1035*cdf0e10cSrcweir 	                                 );
1036*cdf0e10cSrcweir 	/* algorithm 3.3: computing the encryption dictionary'ss owner password value ( /O ) */
1037*cdf0e10cSrcweir 	static bool computeODictionaryValue( const sal_uInt8* i_pPaddedOwnerPassword, const sal_uInt8* i_pPaddedUserPassword,
1038*cdf0e10cSrcweir 	                                     std::vector< sal_uInt8 >& io_rOValue,
1039*cdf0e10cSrcweir 	                                     sal_Int32 i_nKeyLength
1040*cdf0e10cSrcweir 	                                    );
1041*cdf0e10cSrcweir 	/* algorithm 3.4 or 3.5: computing the encryption dictionary's user password value ( /U ) revision 2 or 3 of the standard security handler */
1042*cdf0e10cSrcweir 	static bool computeUDictionaryValue( EncHashTransporter* i_pTransporter,
1043*cdf0e10cSrcweir 	                                     vcl::PDFWriter::PDFEncryptionProperties& io_rProperties,
1044*cdf0e10cSrcweir 	                                     sal_Int32 i_nKeyLength,
1045*cdf0e10cSrcweir 	                                     sal_Int32 i_nAccessPermissions
1046*cdf0e10cSrcweir 	                                    );
1047*cdf0e10cSrcweir 
1048*cdf0e10cSrcweir 	static void computeDocumentIdentifier( std::vector< sal_uInt8 >& o_rIdentifier,
1049*cdf0e10cSrcweir 	                                       const vcl::PDFWriter::PDFDocInfo& i_rDocInfo,
1050*cdf0e10cSrcweir 	                                       rtl::OString& o_rCString1,
1051*cdf0e10cSrcweir 	                                       rtl::OString& o_rCString2
1052*cdf0e10cSrcweir 	                                      );
1053*cdf0e10cSrcweir 	static sal_Int32 computeAccessPermissions( const vcl::PDFWriter::PDFEncryptionProperties& i_rProperties,
1054*cdf0e10cSrcweir 	                                           sal_Int32& o_rKeyLength, sal_Int32& o_rRC4KeyLength );
1055*cdf0e10cSrcweir     void setupDocInfo();
1056*cdf0e10cSrcweir     bool prepareEncryption( const com::sun::star::uno::Reference< com::sun::star::beans::XMaterialHolder >& );
1057*cdf0e10cSrcweir 
1058*cdf0e10cSrcweir 	// helper for playMetafile
1059*cdf0e10cSrcweir     void implWriteGradient( const PolyPolygon& rPolyPoly, const Gradient& rGradient,
1060*cdf0e10cSrcweir                             VirtualDevice* pDummyVDev, const vcl::PDFWriter::PlayMetafileContext& );
1061*cdf0e10cSrcweir     void implWriteBitmapEx( const Point& rPoint, const Size& rSize, const BitmapEx& rBitmapEx,
1062*cdf0e10cSrcweir                            VirtualDevice* pDummyVDev, const vcl::PDFWriter::PlayMetafileContext& );
1063*cdf0e10cSrcweir 
1064*cdf0e10cSrcweir     // helpers for CCITT 1bit bitmap stream
1065*cdf0e10cSrcweir     void putG4Bits( sal_uInt32 i_nLength, sal_uInt32 i_nCode, BitStreamState& io_rState );
1066*cdf0e10cSrcweir     void putG4Span( long i_nSpan, bool i_bWhitePixel, BitStreamState& io_rState );
1067*cdf0e10cSrcweir     void writeG4Stream( BitmapReadAccess* i_pBitmap );
1068*cdf0e10cSrcweir 
1069*cdf0e10cSrcweir     // color helper functions
1070*cdf0e10cSrcweir     void appendStrokingColor( const Color& rColor, rtl::OStringBuffer& rBuffer );
1071*cdf0e10cSrcweir     void appendNonStrokingColor( const Color& rColor, rtl::OStringBuffer& rBuffer );
1072*cdf0e10cSrcweir public:
1073*cdf0e10cSrcweir     PDFWriterImpl( const PDFWriter::PDFWriterContext& rContext, const com::sun::star::uno::Reference< com::sun::star::beans::XMaterialHolder >&, PDFWriter& );
1074*cdf0e10cSrcweir     ~PDFWriterImpl();
1075*cdf0e10cSrcweir 
1076*cdf0e10cSrcweir     static com::sun::star::uno::Reference< com::sun::star::beans::XMaterialHolder >
1077*cdf0e10cSrcweir            initEncryption( const rtl::OUString& i_rOwnerPassword,
1078*cdf0e10cSrcweir                            const rtl::OUString& i_rUserPassword,
1079*cdf0e10cSrcweir                            bool b128Bit );
1080*cdf0e10cSrcweir 
1081*cdf0e10cSrcweir     /*	for OutputDevice so the reference device can have a list
1082*cdf0e10cSrcweir      *	that contains only suitable fonts (subsettable or builtin)
1083*cdf0e10cSrcweir      *	produces a new font list
1084*cdf0e10cSrcweir      */
1085*cdf0e10cSrcweir     ImplDevFontList* filterDevFontList( ImplDevFontList* pFontList );
1086*cdf0e10cSrcweir     /*  for OutputDevice: get layout for builtin fonts
1087*cdf0e10cSrcweir      */
1088*cdf0e10cSrcweir     bool isBuiltinFont( const ImplFontData* ) const;
1089*cdf0e10cSrcweir     SalLayout* GetTextLayout( ImplLayoutArgs& rArgs, ImplFontSelectData* pFont );
1090*cdf0e10cSrcweir     void getFontMetric( ImplFontSelectData* pFont, ImplFontMetricData* pMetric ) const;
1091*cdf0e10cSrcweir 
1092*cdf0e10cSrcweir 
1093*cdf0e10cSrcweir     /* for documentation of public functions please see pdfwriter.hxx */
1094*cdf0e10cSrcweir 
1095*cdf0e10cSrcweir     OutputDevice* getReferenceDevice();
1096*cdf0e10cSrcweir 
1097*cdf0e10cSrcweir     /* document structure */
1098*cdf0e10cSrcweir     sal_Int32 newPage( sal_Int32 nPageWidth , sal_Int32 nPageHeight, PDFWriter::Orientation eOrientation );
1099*cdf0e10cSrcweir     bool emit();
1100*cdf0e10cSrcweir     std::set< PDFWriter::ErrorCode > getErrors();
1101*cdf0e10cSrcweir     void insertError( PDFWriter::ErrorCode eErr ) { m_aErrors.insert( eErr ); }
1102*cdf0e10cSrcweir     void playMetafile( const GDIMetaFile&, vcl::PDFExtOutDevData*, const vcl::PDFWriter::PlayMetafileContext&, VirtualDevice* pDummyDev = NULL );
1103*cdf0e10cSrcweir 
1104*cdf0e10cSrcweir     Size getCurPageSize() const
1105*cdf0e10cSrcweir     {
1106*cdf0e10cSrcweir         Size aSize;
1107*cdf0e10cSrcweir         if( m_nCurrentPage >= 0 && m_nCurrentPage < (sal_Int32)m_aPages.size() )
1108*cdf0e10cSrcweir             aSize = Size( m_aPages[ m_nCurrentPage ].m_nPageWidth, m_aPages[ m_nCurrentPage ].m_nPageHeight );
1109*cdf0e10cSrcweir         return aSize;
1110*cdf0e10cSrcweir     }
1111*cdf0e10cSrcweir 
1112*cdf0e10cSrcweir     PDFWriter::PDFVersion getVersion() const { return m_aContext.Version; }
1113*cdf0e10cSrcweir 
1114*cdf0e10cSrcweir     void setDocumentLocale( const com::sun::star::lang::Locale& rLoc )
1115*cdf0e10cSrcweir     { m_aContext.DocumentLocale = rLoc; }
1116*cdf0e10cSrcweir 
1117*cdf0e10cSrcweir 
1118*cdf0e10cSrcweir     /* graphics state */
1119*cdf0e10cSrcweir     void push( sal_uInt16 nFlags );
1120*cdf0e10cSrcweir     void pop();
1121*cdf0e10cSrcweir 
1122*cdf0e10cSrcweir     void setFont( const Font& rFont );
1123*cdf0e10cSrcweir 
1124*cdf0e10cSrcweir     void setMapMode( const MapMode& rMapMode );
1125*cdf0e10cSrcweir     void setMapMode() { setMapMode( m_aMapMode ); }
1126*cdf0e10cSrcweir 
1127*cdf0e10cSrcweir 
1128*cdf0e10cSrcweir     const MapMode& getMapMode() { return m_aGraphicsStack.front().m_aMapMode; }
1129*cdf0e10cSrcweir 
1130*cdf0e10cSrcweir     void setLineColor( const Color& rColor )
1131*cdf0e10cSrcweir     {
1132*cdf0e10cSrcweir         m_aGraphicsStack.front().m_aLineColor = ImplIsColorTransparent(rColor) ? Color( COL_TRANSPARENT ) : rColor;
1133*cdf0e10cSrcweir         m_aGraphicsStack.front().m_nUpdateFlags |= GraphicsState::updateLineColor;
1134*cdf0e10cSrcweir     }
1135*cdf0e10cSrcweir 
1136*cdf0e10cSrcweir     void setFillColor( const Color& rColor )
1137*cdf0e10cSrcweir     {
1138*cdf0e10cSrcweir         m_aGraphicsStack.front().m_aFillColor = ImplIsColorTransparent(rColor) ? Color( COL_TRANSPARENT ) : rColor;
1139*cdf0e10cSrcweir         m_aGraphicsStack.front().m_nUpdateFlags |= GraphicsState::updateFillColor;
1140*cdf0e10cSrcweir     }
1141*cdf0e10cSrcweir 
1142*cdf0e10cSrcweir     void setTextLineColor()
1143*cdf0e10cSrcweir     {
1144*cdf0e10cSrcweir         m_aGraphicsStack.front().m_aTextLineColor = Color( COL_TRANSPARENT );
1145*cdf0e10cSrcweir         m_aGraphicsStack.front().m_nUpdateFlags |= GraphicsState::updateTextLineColor;
1146*cdf0e10cSrcweir     }
1147*cdf0e10cSrcweir 
1148*cdf0e10cSrcweir     void setTextLineColor( const Color& rColor )
1149*cdf0e10cSrcweir     {
1150*cdf0e10cSrcweir         m_aGraphicsStack.front().m_aTextLineColor = rColor;
1151*cdf0e10cSrcweir         m_aGraphicsStack.front().m_nUpdateFlags |= GraphicsState::updateTextLineColor;
1152*cdf0e10cSrcweir     }
1153*cdf0e10cSrcweir 
1154*cdf0e10cSrcweir     void setOverlineColor()
1155*cdf0e10cSrcweir     {
1156*cdf0e10cSrcweir         m_aGraphicsStack.front().m_aOverlineColor = Color( COL_TRANSPARENT );
1157*cdf0e10cSrcweir         m_aGraphicsStack.front().m_nUpdateFlags |= GraphicsState::updateOverlineColor;
1158*cdf0e10cSrcweir     }
1159*cdf0e10cSrcweir 
1160*cdf0e10cSrcweir     void setOverlineColor( const Color& rColor )
1161*cdf0e10cSrcweir     {
1162*cdf0e10cSrcweir         m_aGraphicsStack.front().m_aOverlineColor = rColor;
1163*cdf0e10cSrcweir         m_aGraphicsStack.front().m_nUpdateFlags |= GraphicsState::updateOverlineColor;
1164*cdf0e10cSrcweir     }
1165*cdf0e10cSrcweir 
1166*cdf0e10cSrcweir     void setTextFillColor( const Color& rColor )
1167*cdf0e10cSrcweir     {
1168*cdf0e10cSrcweir         m_aGraphicsStack.front().m_aFont.SetFillColor( rColor );
1169*cdf0e10cSrcweir         m_aGraphicsStack.front().m_aFont.SetTransparent( ImplIsColorTransparent( rColor ) ? sal_True : sal_False );
1170*cdf0e10cSrcweir         m_aGraphicsStack.front().m_nUpdateFlags |= GraphicsState::updateFont;
1171*cdf0e10cSrcweir     }
1172*cdf0e10cSrcweir     void setTextFillColor()
1173*cdf0e10cSrcweir     {
1174*cdf0e10cSrcweir         m_aGraphicsStack.front().m_aFont.SetFillColor( Color( COL_TRANSPARENT ) );
1175*cdf0e10cSrcweir         m_aGraphicsStack.front().m_aFont.SetTransparent( sal_True );
1176*cdf0e10cSrcweir         m_aGraphicsStack.front().m_nUpdateFlags |= GraphicsState::updateFont;
1177*cdf0e10cSrcweir     }
1178*cdf0e10cSrcweir     void setTextColor( const Color& rColor )
1179*cdf0e10cSrcweir     {
1180*cdf0e10cSrcweir         m_aGraphicsStack.front().m_aFont.SetColor( rColor );
1181*cdf0e10cSrcweir         m_aGraphicsStack.front().m_nUpdateFlags |= GraphicsState::updateFont;
1182*cdf0e10cSrcweir     }
1183*cdf0e10cSrcweir 
1184*cdf0e10cSrcweir     void clearClipRegion()
1185*cdf0e10cSrcweir     {
1186*cdf0e10cSrcweir         m_aGraphicsStack.front().m_aClipRegion.clear();
1187*cdf0e10cSrcweir         m_aGraphicsStack.front().m_bClipRegion = false;
1188*cdf0e10cSrcweir         m_aGraphicsStack.front().m_nUpdateFlags |= GraphicsState::updateClipRegion;
1189*cdf0e10cSrcweir     }
1190*cdf0e10cSrcweir 
1191*cdf0e10cSrcweir     void setClipRegion( const basegfx::B2DPolyPolygon& rRegion );
1192*cdf0e10cSrcweir 
1193*cdf0e10cSrcweir     void moveClipRegion( sal_Int32 nX, sal_Int32 nY );
1194*cdf0e10cSrcweir 
1195*cdf0e10cSrcweir     bool intersectClipRegion( const Rectangle& rRect );
1196*cdf0e10cSrcweir 
1197*cdf0e10cSrcweir     bool intersectClipRegion( const basegfx::B2DPolyPolygon& rRegion );
1198*cdf0e10cSrcweir 
1199*cdf0e10cSrcweir     void setLayoutMode( sal_Int32 nLayoutMode )
1200*cdf0e10cSrcweir     {
1201*cdf0e10cSrcweir         m_aGraphicsStack.front().m_nLayoutMode = nLayoutMode;
1202*cdf0e10cSrcweir         m_aGraphicsStack.front().m_nUpdateFlags |= GraphicsState::updateLayoutMode;
1203*cdf0e10cSrcweir     }
1204*cdf0e10cSrcweir 
1205*cdf0e10cSrcweir     void setDigitLanguage( LanguageType eLang )
1206*cdf0e10cSrcweir     {
1207*cdf0e10cSrcweir         m_aGraphicsStack.front().m_aDigitLanguage = eLang;
1208*cdf0e10cSrcweir         m_aGraphicsStack.front().m_nUpdateFlags |= GraphicsState::updateDigitLanguage;
1209*cdf0e10cSrcweir     }
1210*cdf0e10cSrcweir 
1211*cdf0e10cSrcweir     void setTextAlign( TextAlign eAlign )
1212*cdf0e10cSrcweir     {
1213*cdf0e10cSrcweir         m_aGraphicsStack.front().m_aFont.SetAlign( eAlign );
1214*cdf0e10cSrcweir         m_aGraphicsStack.front().m_nUpdateFlags |= GraphicsState::updateFont;
1215*cdf0e10cSrcweir     }
1216*cdf0e10cSrcweir 
1217*cdf0e10cSrcweir     void setAntiAlias( sal_Int32 nAntiAlias )
1218*cdf0e10cSrcweir     {
1219*cdf0e10cSrcweir         m_aGraphicsStack.front().m_nAntiAlias = nAntiAlias;
1220*cdf0e10cSrcweir         m_aGraphicsStack.front().m_nUpdateFlags |= GraphicsState::updateAntiAlias;
1221*cdf0e10cSrcweir     }
1222*cdf0e10cSrcweir 
1223*cdf0e10cSrcweir     /* actual drawing functions */
1224*cdf0e10cSrcweir     void drawText( const Point& rPos, const String& rText, xub_StrLen nIndex = 0, xub_StrLen nLen = STRING_LEN, bool bTextLines = true );
1225*cdf0e10cSrcweir     void drawTextArray( const Point& rPos, const String& rText, const sal_Int32* pDXArray = NULL, xub_StrLen nIndex = 0, xub_StrLen nLen = STRING_LEN, bool bTextLines = true );
1226*cdf0e10cSrcweir     void drawStretchText( const Point& rPos, sal_uLong nWidth, const String& rText,
1227*cdf0e10cSrcweir                           xub_StrLen nIndex = 0, xub_StrLen nLen = STRING_LEN,
1228*cdf0e10cSrcweir                           bool bTextLines = true  );
1229*cdf0e10cSrcweir     void drawText( const Rectangle& rRect, const String& rOrigStr, sal_uInt16 nStyle, bool bTextLines = true  );
1230*cdf0e10cSrcweir     void drawTextLine( const Point& rPos, long nWidth, FontStrikeout eStrikeout, FontUnderline eUnderline, FontUnderline eOverline, bool bUnderlineAbove );
1231*cdf0e10cSrcweir     void drawWaveTextLine( rtl::OStringBuffer& aLine, long nWidth, FontUnderline eTextLine, Color aColor, bool bIsAbove );
1232*cdf0e10cSrcweir     void drawStraightTextLine( rtl::OStringBuffer& aLine, long nWidth, FontUnderline eTextLine, Color aColor, bool bIsAbove );
1233*cdf0e10cSrcweir     void drawStrikeoutLine( rtl::OStringBuffer& aLine, long nWidth, FontStrikeout eStrikeout, Color aColor );
1234*cdf0e10cSrcweir     void drawStrikeoutChar( const Point& rPos, long nWidth, FontStrikeout eStrikeout );
1235*cdf0e10cSrcweir 
1236*cdf0e10cSrcweir     void drawLine( const Point& rStart, const Point& rStop );
1237*cdf0e10cSrcweir     void drawLine( const Point& rStart, const Point& rStop, const LineInfo& rInfo );
1238*cdf0e10cSrcweir     void drawPolygon( const Polygon& rPoly );
1239*cdf0e10cSrcweir     void drawPolyPolygon( const PolyPolygon& rPolyPoly );
1240*cdf0e10cSrcweir     void drawPolyLine( const Polygon& rPoly );
1241*cdf0e10cSrcweir     void drawPolyLine( const Polygon& rPoly, const LineInfo& rInfo );
1242*cdf0e10cSrcweir     void drawPolyLine( const Polygon& rPoly, const PDFWriter::ExtLineInfo& rInfo );
1243*cdf0e10cSrcweir     void drawWaveLine( const Point& rStart, const Point& rStop, sal_Int32 nDelta, sal_Int32 nLineWidth );
1244*cdf0e10cSrcweir 
1245*cdf0e10cSrcweir     void drawPixel( const Point& rPt, const Color& rColor );
1246*cdf0e10cSrcweir     void drawPixel( const Polygon& rPts, const Color* pColors = NULL );
1247*cdf0e10cSrcweir 
1248*cdf0e10cSrcweir     void drawRectangle( const Rectangle& rRect );
1249*cdf0e10cSrcweir     void drawRectangle( const Rectangle& rRect, sal_uInt32 nHorzRound, sal_uInt32 nVertRound );
1250*cdf0e10cSrcweir     void drawEllipse( const Rectangle& rRect );
1251*cdf0e10cSrcweir     void drawArc( const Rectangle& rRect, const Point& rStart, const Point& rStop, bool bWithPie, bool bWidthChord );
1252*cdf0e10cSrcweir 
1253*cdf0e10cSrcweir     void drawBitmap( const Point& rDestPoint, const Size& rDestSize, const Bitmap& rBitmap );
1254*cdf0e10cSrcweir     void drawBitmap( const Point& rDestPoint, const Size& rDestSize, const BitmapEx& rBitmap );
1255*cdf0e10cSrcweir     void drawMask( const Point& rDestPoint, const Size& rDestSize, const Bitmap& rBitmap, const Color& rFillColor );
1256*cdf0e10cSrcweir     void drawJPGBitmap( SvStream& rDCTData, bool bIsTrueColor, const Size& rSizePixel, const Rectangle& rTargetArea, const Bitmap& rMask );
1257*cdf0e10cSrcweir 
1258*cdf0e10cSrcweir     void drawGradient( const Rectangle& rRect, const Gradient& rGradient );
1259*cdf0e10cSrcweir     void drawGradient( const PolyPolygon& rPolyPoly, const Gradient& rGradient );
1260*cdf0e10cSrcweir     void drawHatch( const PolyPolygon& rPolyPoly, const Hatch& rHatch );
1261*cdf0e10cSrcweir     void drawWallpaper( const Rectangle& rRect, const Wallpaper& rWall );
1262*cdf0e10cSrcweir     void drawTransparent( const PolyPolygon& rPolyPoly, sal_uInt32 nTransparentPercent );
1263*cdf0e10cSrcweir     void beginTransparencyGroup();
1264*cdf0e10cSrcweir     void endTransparencyGroup( const Rectangle& rBoundingBox, sal_uInt32 nTransparentPercent );
1265*cdf0e10cSrcweir     void endTransparencyGroup( const Rectangle& rBoundingBox, const Bitmap& rAlphaMask );
1266*cdf0e10cSrcweir     void beginPattern( const Rectangle& rCell );
1267*cdf0e10cSrcweir     sal_Int32 endPattern( const SvtGraphicFill::Transform& rTransform );
1268*cdf0e10cSrcweir     void drawPolyPolygon( const PolyPolygon& rPolyPoly, sal_Int32 nPattern, bool bEOFill );
1269*cdf0e10cSrcweir 
1270*cdf0e10cSrcweir     void emitComment( const char* pComment );
1271*cdf0e10cSrcweir 
1272*cdf0e10cSrcweir     //--->i56629 named destinations
1273*cdf0e10cSrcweir     sal_Int32 createNamedDest( const rtl::OUString& sDestName, const Rectangle& rRect, sal_Int32 nPageNr = -1, PDFWriter::DestAreaType eType = PDFWriter::XYZ );
1274*cdf0e10cSrcweir 
1275*cdf0e10cSrcweir     //--->i59651
1276*cdf0e10cSrcweir     //emits output intent
1277*cdf0e10cSrcweir     sal_Int32   emitOutputIntent();
1278*cdf0e10cSrcweir 
1279*cdf0e10cSrcweir     //emits the document metadata
1280*cdf0e10cSrcweir     sal_Int32   emitDocumentMetadata();
1281*cdf0e10cSrcweir 
1282*cdf0e10cSrcweir     // links
1283*cdf0e10cSrcweir     sal_Int32 createLink( const Rectangle& rRect, sal_Int32 nPageNr = -1 );
1284*cdf0e10cSrcweir     sal_Int32 createDest( const Rectangle& rRect, sal_Int32 nPageNr = -1, PDFWriter::DestAreaType eType = PDFWriter::XYZ );
1285*cdf0e10cSrcweir     sal_Int32 registerDestReference( sal_Int32 nDestId, const Rectangle& rRect, sal_Int32 nPageNr = -1, PDFWriter::DestAreaType eType = PDFWriter::XYZ );
1286*cdf0e10cSrcweir     sal_Int32 setLinkDest( sal_Int32 nLinkId, sal_Int32 nDestId );
1287*cdf0e10cSrcweir     sal_Int32 setLinkURL( sal_Int32 nLinkId, const rtl::OUString& rURL );
1288*cdf0e10cSrcweir     void setLinkPropertyId( sal_Int32 nLinkId, sal_Int32 nPropertyId );
1289*cdf0e10cSrcweir 
1290*cdf0e10cSrcweir     // outline
1291*cdf0e10cSrcweir     sal_Int32 createOutlineItem( sal_Int32 nParent = 0, const rtl::OUString& rText = rtl::OUString(), sal_Int32 nDestID = -1 );
1292*cdf0e10cSrcweir     sal_Int32 setOutlineItemParent( sal_Int32 nItem, sal_Int32 nNewParent );
1293*cdf0e10cSrcweir     sal_Int32 setOutlineItemText( sal_Int32 nItem, const rtl::OUString& rText );
1294*cdf0e10cSrcweir     sal_Int32 setOutlineItemDest( sal_Int32 nItem, sal_Int32 nDestID );
1295*cdf0e10cSrcweir 
1296*cdf0e10cSrcweir     // notes
1297*cdf0e10cSrcweir     void createNote( const Rectangle& rRect, const PDFNote& rNote, sal_Int32 nPageNr = -1 );
1298*cdf0e10cSrcweir     // structure elements
1299*cdf0e10cSrcweir     sal_Int32 beginStructureElement( PDFWriter::StructElement eType, const rtl::OUString& rAlias );
1300*cdf0e10cSrcweir     void endStructureElement();
1301*cdf0e10cSrcweir     bool setCurrentStructureElement( sal_Int32 nElement );
1302*cdf0e10cSrcweir     sal_Int32 getCurrentStructureElement();
1303*cdf0e10cSrcweir     bool setStructureAttribute( enum PDFWriter::StructAttribute eAttr, enum PDFWriter::StructAttributeValue eVal );
1304*cdf0e10cSrcweir     bool setStructureAttributeNumerical( enum PDFWriter::StructAttribute eAttr, sal_Int32 nValue );
1305*cdf0e10cSrcweir     void setStructureBoundingBox( const Rectangle& rRect );
1306*cdf0e10cSrcweir     void setActualText( const String& rText );
1307*cdf0e10cSrcweir     void setAlternateText( const String& rText );
1308*cdf0e10cSrcweir 
1309*cdf0e10cSrcweir     // transitional effects
1310*cdf0e10cSrcweir     void setAutoAdvanceTime( sal_uInt32 nSeconds, sal_Int32 nPageNr = -1 );
1311*cdf0e10cSrcweir     void setPageTransition( PDFWriter::PageTransition eType, sal_uInt32 nMilliSec, sal_Int32 nPageNr = -1 );
1312*cdf0e10cSrcweir 
1313*cdf0e10cSrcweir     // controls
1314*cdf0e10cSrcweir     sal_Int32 createControl( const PDFWriter::AnyWidget& rControl, sal_Int32 nPageNr = -1 );
1315*cdf0e10cSrcweir     void beginControlAppearance( sal_Int32 nControl );
1316*cdf0e10cSrcweir     bool endControlAppearance( PDFWriter::WidgetState eState );
1317*cdf0e10cSrcweir 
1318*cdf0e10cSrcweir     // additional streams
1319*cdf0e10cSrcweir     void addStream( const String& rMimeType, PDFOutputStream* pStream, bool bCompress );
1320*cdf0e10cSrcweir 
1321*cdf0e10cSrcweir     // helper: eventually begin marked content sequence and
1322*cdf0e10cSrcweir     // emit a comment in debug case
1323*cdf0e10cSrcweir     void MARK( const char*
1324*cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 1
1325*cdf0e10cSrcweir         pString
1326*cdf0e10cSrcweir #endif
1327*cdf0e10cSrcweir         )
1328*cdf0e10cSrcweir     {
1329*cdf0e10cSrcweir         beginStructureElementMCSeq();
1330*cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 1
1331*cdf0e10cSrcweir         emitComment( pString );
1332*cdf0e10cSrcweir #endif
1333*cdf0e10cSrcweir     }
1334*cdf0e10cSrcweir };
1335*cdf0e10cSrcweir 
1336*cdf0e10cSrcweir }
1337*cdf0e10cSrcweir 
1338*cdf0e10cSrcweir #endif //_VCL_PDFEXPORT_HXX
1339*cdf0e10cSrcweir 
1340*cdf0e10cSrcweir 
1341