2010-10-14 08:27:31 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
re-base on ALv2 code. Includes (at least) relevant parts of:
linecap: Reintegrating finished LineCap feature
Patch contributed by Regina Henschel
http://svn.apache.org/viewvc?view=revision&revision=1232507
Patches contributed by Sven Jacobi
impress212: #i81610# fixed animation export
http://svn.apache.org/viewvc?view=revision&revision=1167620
impress212: drawinglayer gbuild environment changes
http://svn.apache.org/viewvc?view=revision&revision=1167627
http://svn.apache.org/viewvc?view=revision&revision=1167628
impress212: DffPropSet -> minor code improvements, removing table
http://svn.apache.org/viewvc?view=revision&revision=1167634
impress212: #158494# fixed excel import (text rotation)
http://svn.apache.org/viewvc?view=revision&revision=1167638
Patches contributed by Armin Le Grand
Svg: Reintegrated Svg replacement from /branches/alg/svgreplavement
http://svn.apache.org/viewvc?view=revision&revision=1220836
#118728# changed indentifying definitions for Svg file detection
http://svn.apache.org/viewvc?view=revision&revision=1229961
#118838# LineGeometry creation for complicated cases optimized to
create single Polygons
http://svn.apache.org/viewvc?view=revision&revision=1236232
#119176# corrected file type detection for SVG for svg files
without xml header
http://svn.apache.org/viewvc?view=revision&revision=1309445
#118728# Extended Svg file detection
http://svn.apache.org/viewvc?view=revision&revision=1230531
#118529# solve break converters and convert commands for OLEs and images
http://svn.apache.org/viewvc?view=revision&revision=1186168
svg: added WaE changes from branch svgreplacement to trunc
http://svn.apache.org/viewvc?view=revision&revision=1222974
svg: corrected missing member initialization
http://svn.apache.org/viewvc?view=revision&revision=1226134
fix for #118525#: Using primitives for chart sub-geometry visualisation
http://svn.apache.org/viewvc?view=revision&revision=1226879
#118898# Adapted ImpGraphic::ImplGetBitmap to correctly convert
metafiles to bitmapEx ...
http://svn.apache.org/viewvc?view=revision&revision=1293316
fix for #118525#: removed no longer used variable maOriginalMapMode, one
more exception eliminated
http://svn.apache.org/viewvc?view=revision&revision=1227097
#16758# Added buffering to the VDev usages of the VclProcessor2D derivates...
http://svn.apache.org/viewvc?view=revision&revision=1229521
#116758# Secured VDev buffer device to Vcl deinit
http://svn.apache.org/viewvc?view=revision&revision=1230574
#116758# added remembering allocated VDevs for VDevBuffer to be able to also
delete these when vcl goes down; it should never happen, but You never know
http://svn.apache.org/viewvc?view=revision&revision=1230927
#118730# Changed SvgClipPathNode to use MaskPrimitive2D for primitive
representation instead of TransparencePrimitive2D
http://svn.apache.org/viewvc?view=revision&revision=1231198
#118822# secured 3D geometry creation (slices) by subdividing the 2D
source polyPolygon early
http://svn.apache.org/viewvc?view=revision&revision=1234749
#118829# enhanced Svg gradient quality, obstacles avoided
http://svn.apache.org/viewvc?view=revision&revision=1235361
#118834# Unified usage of TextBreakupHelper as single tooling class
for i18n text primitive breakup
http://svn.apache.org/viewvc?view=revision&revision=1236110
#118853# added square pixel size limit to conversion of
TransparencePrimitive2D to Metafile action
http://svn.apache.org/viewvc?view=revision&revision=1237656
#118824# coreccted mirroring and boundrect when the graphicmanager
is used for bitmap output
http://svn.apache.org/viewvc?view=revision&revision=1240097
#115092# Corrected VclProcessor2D::RenderPolygonStrokePrimitive2D for
various optimization scenarios
http://svn.apache.org/viewvc?view=revision&revision=1241434
#118783# Corrected errors in ID strings, corrected Svg line/fill export,
corrected polygon close state
http://svn.apache.org/viewvc?view=revision&revision=1232006
#118796# corrected null-pointer usage in SVG text exporter
http://svn.apache.org/viewvc?view=revision&revision=1240262
#118729# Use GraphicStreamUrl and GraphicUrl to allow multi image
import with linked graphics, too
http://svn.apache.org/viewvc?view=revision&revision=1229962
#118898# corrected error in GDIMetaFile::GetBoundRect in handling
MetaFloatTransparentAction
http://svn.apache.org/viewvc?view=revision&revision=1293349
#118855# Corrected handling of possibly created empty clipRegions
after PolyPolygon clipping
http://svn.apache.org/viewvc?view=revision&revision=1237725
#115962# Better (but not yet optimal, see comments in task) handling
of MetaFloatTransparentAction in PDF export
http://svn.apache.org/viewvc?view=revision&revision=1241078
IP clearance: #118466# This patch removes librsvg, libcroco, libgsf, ...
http://svn.apache.org/viewvc?view=revision&revision=1200879
118779# Added svg content streaming in/out to ImpGraphic stream operators
http://svn.apache.org/viewvc?view=revision&revision=1231908
linecap: correctons for WaE and mac drawing
http://svn.apache.org/viewvc?view=revision&revision=1232793
svg: uses current system Dpi for Svg replacement image creation
http://svn.apache.org/viewvc?view=revision&revision=1233948
Patches contributed by Mathias Bauer (and others)
gnumake4 work variously
http://svn.apache.org/viewvc?view=revision&revision=1394326
http://svn.apache.org/viewvc?view=revision&revision=1396797
http://svn.apache.org/viewvc?view=revision&revision=1397315
http://svn.apache.org/viewvc?view=revision&revision=1394326
Remove duplicate header includes.
cws mba34issues01: #i117720#: convert assertion into warning
http://svn.apache.org/viewvc?view=revision&revision=1172352
118485 - Styles for OLEs are not saved. Submitted by Armin Le Grand.
http://svn.apache.org/viewvc?view=revision&revision=1182166
cws mba34issues01: #i117714#: remove assertion
http://svn.apache.org/viewvc?view=revision&revision=1172357
Patch contributed by Jurgen Schmidt
add some additional checks to ensure proper reading operations
http://svn.apache.org/viewvc?view=revision&revision=1209022
mostly prefer our stream / bounds checking work.
Patches contributed by Herbert Duerr
#i118816# add clarifying comment regarding Font::*Color*() methods
http://svn.apache.org/viewvc?view=revision&revision=1233833
extend macro->string handling for empty strings
http://svn.apache.org/viewvc?view=revision&revision=1175801
avoid magic constants for SALCOLOR_NONE
http://svn.apache.org/viewvc?view=revision&revision=1177543
initialize slant properly in ImplFontMetricData constructor (author=iorsh)
http://svn.apache.org/viewvc?view=revision&revision=1177551
#i118675# make check for extension updates more stable
http://svn.apache.org/viewvc?view=revision&revision=1214797
#a118617# remove VBasicEventListener.dll binary
There are no known users depending on its CLSID
http://svn.apache.org/viewvc?view=revision&revision=1203697
Patches contributed by Ariel Constenla-Haile
Fix build breaker on Linux/gcc
http://svn.apache.org/viewvc?view=revision&revision=1221104
Fix crash when trying to instantiate css.graphic.GraphicRasterizer_RSVG
http://svn.apache.org/viewvc?view=revision&revision=1215559
Patches contributed by Oliver-Rainer Wittmann
sw34bf06: #i117962# - method <SwFlyFrm::IsPaint(..)> - consider
instances of <SwFlyDrawObj>
http://svn.apache.org/viewvc?view=revision&revision=1172120
sw34bf06: #i117783# - Writer's implementation of XPagePrintable -
apply print settings to new printing routines
http://svn.apache.org/viewvc?view=revision&revision=1172115
gnumake4 work variously from Hans-Joachim Lankenau
http://svn.apache.org/viewvc?view=revision&revision=1397315
http://svn.apache.org/viewvc?view=revision&revision=1396797
http://svn.apache.org/viewvc?view=revision&revision=1396782
http://svn.apache.org/viewvc?view=revision&revision=1394707
plus some amount of re-splitting of legacy headers.
Patch contributed by Pavel Janik
WaE: Remove unused variables.
http://svn.apache.org/viewvc?view=revision&revision=1230697
Patches contributed by Takashi Ono
mingwport35: i#117795: MinGW port fix for vcl2gnumake
http://svn.apache.org/viewvc?view=revision&revision=1172091
mingwport35: i#117795: MinGW port fix for vcl2gnumake
http://svn.apache.org/viewvc?view=revision&revision=1172091
Patch contributed by Christian Lippka
impress212: #i98044# re enable Text menu for outline and title shapes
http://svn.apache.org/viewvc?view=revision&revision=1167639
Patch contributed by Andre Fischer
118674: Made category B code optional and disabled by default.
http://svn.apache.org/viewvc?view=revision&revision=1215131
118881: Ignore empty paragraphs after bullets.
http://svn.apache.org/viewvc?view=revision&revision=1296205
Patches contributed by Philipp Lohmann
ooo340fixes: #i117780# use rtl allocator
http://svn.apache.org/viewvc?view=revision&revision=1172087
ooo34gsl02: #i117807# fix an off by one error (index actually
inside the pfb section header)
http://svn.apache.org/viewvc?view=revision&revision=1167576
various cleanups, related compilation fixes, warning cleanups, re-working
of obsolete stl template pieces to use boost instead, changed string
classes, re-adapt KDE about data, about dialog, fixing warnings,
and other fixes & improvements.
Disable svg import / render for about/ branding code-paths for now.
Restore full icon theme set.
Remove OS/2 conditionals and sources.
Remove conflicting gtk/full-screen monitors support.
Retain existing svg rasterizer files - temporarily disabled.
Standardize stringificaiton and fixup dllpostfix issues.
Rename SvgGradientHelper::== to equalTo to avoid overloading issues.
Use the flat GdiPlus API for LineCaps calls.
2012-10-09 12:22:23 +01:00
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* This file incorporates work covered by the following license notice:
|
|
|
|
*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
|
|
* with this work for additional information regarding copyright
|
|
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
|
|
*/
|
2002-07-08 13:18:58 +00:00
|
|
|
#ifndef _VCL_PDFWRITER_IMPL_HXX
|
|
|
|
#define _VCL_PDFWRITER_IMPL_HXX
|
|
|
|
|
2008-01-29 07:23:20 +00:00
|
|
|
#include "vcl/pdfwriter.hxx"
|
|
|
|
#include "rtl/ustring.hxx"
|
|
|
|
#include "osl/file.h"
|
|
|
|
#include "tools/gen.hxx"
|
|
|
|
#include "tools/stream.hxx"
|
|
|
|
#include "vcl/outdev.hxx"
|
|
|
|
#include "vcl/bitmapex.hxx"
|
|
|
|
#include "vcl/gradient.hxx"
|
|
|
|
#include "vcl/hatch.hxx"
|
|
|
|
#include "vcl/wall.hxx"
|
2011-01-24 16:34:14 +01:00
|
|
|
#include "outdata.hxx"
|
2008-01-29 07:23:20 +00:00
|
|
|
#include "rtl/strbuf.hxx"
|
|
|
|
#include "rtl/cipher.h"
|
|
|
|
#include "rtl/digest.h"
|
|
|
|
#include "com/sun/star/util/XURLTransformer.hpp"
|
|
|
|
#include "com/sun/star/lang/Locale.hpp"
|
2010-10-18 12:28:33 +02:00
|
|
|
#include <sal/macros.h>
|
2002-07-08 13:18:58 +00:00
|
|
|
|
2011-01-24 16:34:14 +01:00
|
|
|
#include <sallayout.hxx>
|
2007-04-04 07:24:29 +00:00
|
|
|
#include "pdffontcache.hxx"
|
|
|
|
|
2002-07-08 13:18:58 +00:00
|
|
|
#include <vector>
|
|
|
|
#include <map>
|
2011-02-03 16:55:17 -07:00
|
|
|
#include <boost/unordered_map.hpp>
|
2002-07-08 13:18:58 +00:00
|
|
|
#include <list>
|
|
|
|
|
2009-12-18 11:44:01 +01:00
|
|
|
#include <boost/shared_array.hpp>
|
|
|
|
|
2011-10-27 16:08:14 +01:00
|
|
|
class FontSelectPattern;
|
2004-07-13 08:29:20 +00:00
|
|
|
class ImplFontMetricData;
|
2009-08-27 12:02:29 +00:00
|
|
|
class FontSubsetInfo;
|
2002-07-29 15:26:35 +00:00
|
|
|
class ZCodec;
|
2010-09-27 19:58:20 +02:00
|
|
|
class EncHashTransporter;
|
2011-01-12 17:11:03 +01:00
|
|
|
struct BitStreamState;
|
2002-07-08 13:18:58 +00:00
|
|
|
|
2006-07-13 10:17:26 +00:00
|
|
|
// the maximum password length
|
|
|
|
#define ENCRYPTED_PWD_SIZE 32
|
|
|
|
#define MD5_DIGEST_SIZE 16
|
|
|
|
#define SECUR_40BIT_KEY 5
|
|
|
|
// security 128 bit
|
|
|
|
#define SECUR_128BIT_KEY 16
|
|
|
|
// maximum length of MD5 digest input, in step 2 of algorithm 3.1
|
|
|
|
// PDF spec ver. 1.4: see there for details
|
|
|
|
#define MAXIMUM_RC4_KEY_LENGTH (SECUR_128BIT_KEY+3+2)
|
|
|
|
|
2002-07-08 13:18:58 +00:00
|
|
|
namespace vcl
|
|
|
|
{
|
|
|
|
|
2007-03-26 10:21:27 +00:00
|
|
|
class PDFStreamIf;
|
2007-04-04 07:24:29 +00:00
|
|
|
class Matrix3;
|
2003-03-27 16:59:30 +00:00
|
|
|
|
2002-07-08 13:18:58 +00:00
|
|
|
class PDFWriterImpl
|
|
|
|
{
|
2007-03-26 10:21:27 +00:00
|
|
|
friend class PDFStreamIf;
|
2002-07-15 11:04:39 +00:00
|
|
|
public:
|
|
|
|
// definition of structs
|
2002-07-20 14:54:30 +00:00
|
|
|
struct BuiltinFont
|
|
|
|
{
|
2002-07-22 11:44:39 +00:00
|
|
|
const char * m_pName; // Name
|
|
|
|
const char * m_pStyleName; // StyleName
|
|
|
|
const char * m_pPSName; // PSName
|
2002-07-20 14:54:30 +00:00
|
|
|
int m_nAscent;
|
|
|
|
int m_nDescent;
|
|
|
|
FontFamily m_eFamily; // Family
|
|
|
|
CharSet m_eCharSet; // CharSet
|
|
|
|
FontPitch m_ePitch; // Pitch
|
|
|
|
FontWidth m_eWidthType; // WidthType
|
|
|
|
FontWeight m_eWeight; // Weight
|
|
|
|
FontItalic m_eItalic; // Italic
|
|
|
|
int m_aWidths[256]; // character metrics
|
2007-04-16 13:21:42 +00:00
|
|
|
|
2013-04-07 12:06:47 +02:00
|
|
|
OString getNameObject() const;
|
2002-07-20 14:54:30 +00:00
|
|
|
};
|
2002-07-15 11:04:39 +00:00
|
|
|
|
2006-12-04 07:32:37 +00:00
|
|
|
|
|
|
|
enum ResourceKind { ResXObject, ResExtGState, ResShading, ResPattern };
|
2013-04-07 12:06:47 +02:00
|
|
|
typedef std::map< OString, sal_Int32 > ResourceMap;
|
2006-12-04 07:32:37 +00:00
|
|
|
struct ResourceDict
|
|
|
|
{
|
|
|
|
// note: handle fonts globally for performance
|
|
|
|
ResourceMap m_aXObjects;
|
|
|
|
ResourceMap m_aExtGStates;
|
|
|
|
ResourceMap m_aShadings;
|
|
|
|
ResourceMap m_aPatterns;
|
|
|
|
|
2013-04-07 12:06:47 +02:00
|
|
|
void append( OStringBuffer&, sal_Int32 nFontDictObject );
|
2006-12-04 07:32:37 +00:00
|
|
|
};
|
|
|
|
|
2002-07-08 13:18:58 +00:00
|
|
|
struct PDFPage
|
|
|
|
{
|
|
|
|
PDFWriterImpl* m_pWriter;
|
|
|
|
sal_Int32 m_nPageWidth; // in inch/72
|
|
|
|
sal_Int32 m_nPageHeight; // in inch/72
|
|
|
|
PDFWriter::Orientation m_eOrientation;
|
|
|
|
sal_Int32 m_nPageObject;
|
2004-09-08 15:22:06 +00:00
|
|
|
sal_Int32 m_nPageIndex;
|
2006-12-04 07:32:37 +00:00
|
|
|
std::vector<sal_Int32> m_aStreamObjects;
|
2002-07-08 13:18:58 +00:00
|
|
|
sal_Int32 m_nStreamLengthObject;
|
|
|
|
sal_uInt64 m_nBeginStreamPos;
|
2004-09-08 15:22:06 +00:00
|
|
|
std::vector<sal_Int32> m_aAnnotations;
|
|
|
|
std::vector<sal_Int32> m_aMCIDParents;
|
|
|
|
PDFWriter::PageTransition m_eTransition;
|
|
|
|
sal_uInt32 m_nTransTime;
|
|
|
|
sal_uInt32 m_nDuration;
|
2005-03-29 11:57:34 +00:00
|
|
|
bool m_bHasWidgets;
|
2002-07-08 13:18:58 +00:00
|
|
|
|
|
|
|
PDFPage( PDFWriterImpl* pWriter, sal_Int32 nPageWidth, sal_Int32 nPageHeight, PDFWriter::Orientation eOrientation );
|
|
|
|
~PDFPage();
|
|
|
|
|
|
|
|
void beginStream();
|
|
|
|
void endStream();
|
|
|
|
bool emit( sal_Int32 nParentPage );
|
|
|
|
|
|
|
|
// converts point from ref device coordinates to
|
|
|
|
// page coordinates and appends the point to the buffer
|
|
|
|
// if bNeg is true, the coordinates are inverted AFTER transformation
|
|
|
|
// to page (useful for transformation matrices
|
2003-12-01 08:54:35 +00:00
|
|
|
// if pOutPoint is set it will be updated to the emitted point
|
|
|
|
// (in PDF map mode, that is 10th of point)
|
2013-04-07 12:06:47 +02:00
|
|
|
void appendPoint( const Point& rPoint, OStringBuffer& rBuffer, bool bNeg = false, Point* pOutPoint = NULL ) const;
|
2010-01-19 18:33:02 +01:00
|
|
|
// appends a B2DPoint without further transformation
|
2013-04-07 12:06:47 +02:00
|
|
|
void appendPixelPoint( const basegfx::B2DPoint& rPoint, OStringBuffer& rBuffer ) const;
|
2002-07-08 13:18:58 +00:00
|
|
|
// appends a rectangle
|
2013-04-07 12:06:47 +02:00
|
|
|
void appendRect( const Rectangle& rRect, OStringBuffer& rBuffer ) const;
|
2002-07-24 15:09:45 +00:00
|
|
|
// converts a rectangle to 10th points page space
|
2004-09-08 15:22:06 +00:00
|
|
|
void convertRect( Rectangle& rRect ) const;
|
2002-07-08 13:18:58 +00:00
|
|
|
// appends a polygon optionally closing it
|
2013-04-07 12:06:47 +02:00
|
|
|
void appendPolygon( const Polygon& rPoly, OStringBuffer& rBuffer, bool bClose = true ) const;
|
2010-01-19 18:33:02 +01:00
|
|
|
// appends a polygon optionally closing it
|
2013-04-07 12:06:47 +02:00
|
|
|
void appendPolygon( const basegfx::B2DPolygon& rPoly, OStringBuffer& rBuffer, bool bClose = true ) const;
|
2002-07-08 13:18:58 +00:00
|
|
|
// appends a polypolygon optionally closing the subpaths
|
2013-04-07 12:06:47 +02:00
|
|
|
void appendPolyPolygon( const PolyPolygon& rPolyPoly, OStringBuffer& rBuffer, bool bClose = true ) const;
|
2010-01-19 18:33:02 +01:00
|
|
|
// appends a polypolygon optionally closing the subpaths
|
2013-04-07 12:06:47 +02:00
|
|
|
void appendPolyPolygon( const basegfx::B2DPolyPolygon& rPolyPoly, OStringBuffer& rBuffer, bool bClose = true ) const;
|
2002-07-08 13:18:58 +00:00
|
|
|
// converts a length (either vertical or horizontal; this
|
|
|
|
// can be important if the source MapMode is not
|
|
|
|
// symmetrical) to page length and appends it to the buffer
|
2003-12-01 08:54:35 +00:00
|
|
|
// if pOutLength is set it will be updated to the emitted length
|
|
|
|
// (in PDF map mode, that is 10th of point)
|
2013-04-07 12:06:47 +02:00
|
|
|
void appendMappedLength( sal_Int32 nLength, OStringBuffer& rBuffer, bool bVertical = true, sal_Int32* pOutLength = NULL ) const;
|
2002-10-10 14:06:37 +00:00
|
|
|
// the same for double values
|
2013-04-07 12:06:47 +02:00
|
|
|
void appendMappedLength( double fLength, OStringBuffer& rBuffer, bool bVertical = true, sal_Int32* pOutLength = NULL, sal_Int32 nPrecision = 5 ) const;
|
2002-07-08 13:18:58 +00:00
|
|
|
// appends LineInfo
|
2006-01-26 17:09:36 +00:00
|
|
|
// returns false if too many dash array entry were created for
|
|
|
|
// the implementation limits of some PDF readers
|
2013-04-07 12:06:47 +02:00
|
|
|
bool appendLineInfo( const LineInfo& rInfo, OStringBuffer& rBuffer ) const;
|
2002-07-29 11:48:30 +00:00
|
|
|
// appends a horizontal waveline with vertical offset (helper for drawWaveLine)
|
2013-04-07 12:06:47 +02:00
|
|
|
void appendWaveLine( sal_Int32 nLength, sal_Int32 nYOffset, sal_Int32 nDelta, OStringBuffer& rBuffer ) const;
|
2004-09-08 15:22:06 +00:00
|
|
|
|
|
|
|
sal_Int32 getWidth() const { return m_nPageWidth ? m_nPageWidth : m_pWriter->m_nInheritedPageWidth; }
|
|
|
|
sal_Int32 getHeight() const { return m_nPageHeight ? m_nPageHeight : m_pWriter->m_nInheritedPageHeight; }
|
2002-07-08 13:18:58 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
friend struct PDFPage;
|
|
|
|
|
2002-09-20 10:17:06 +00:00
|
|
|
struct BitmapID
|
|
|
|
{
|
|
|
|
Size m_aPixelSize;
|
|
|
|
sal_Int32 m_nSize;
|
|
|
|
sal_Int32 m_nChecksum;
|
|
|
|
sal_Int32 m_nMaskChecksum;
|
|
|
|
|
|
|
|
BitmapID() : m_nSize( 0 ), m_nChecksum( 0 ), m_nMaskChecksum( 0 ) {}
|
|
|
|
|
|
|
|
BitmapID& operator=( const BitmapID& rCopy )
|
|
|
|
{
|
|
|
|
m_aPixelSize = rCopy.m_aPixelSize;
|
|
|
|
m_nSize = rCopy.m_nSize;
|
|
|
|
m_nChecksum = rCopy.m_nChecksum;
|
|
|
|
m_nMaskChecksum = rCopy.m_nMaskChecksum;
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
2010-11-25 11:39:59 +00:00
|
|
|
bool operator==( const BitmapID& rComp ) const
|
2002-09-20 10:17:06 +00:00
|
|
|
{
|
|
|
|
return (m_aPixelSize == rComp.m_aPixelSize &&
|
|
|
|
m_nSize == rComp.m_nSize &&
|
|
|
|
m_nChecksum == rComp.m_nChecksum &&
|
|
|
|
m_nMaskChecksum == rComp.m_nMaskChecksum );
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2002-07-08 13:18:58 +00:00
|
|
|
struct BitmapEmit
|
|
|
|
{
|
2002-09-20 10:17:06 +00:00
|
|
|
BitmapID m_aID;
|
2002-07-08 13:18:58 +00:00
|
|
|
BitmapEx m_aBitmap;
|
|
|
|
sal_Int32 m_nObject;
|
2002-09-12 15:59:36 +00:00
|
|
|
bool m_bDrawMask;
|
|
|
|
|
|
|
|
BitmapEmit() : m_bDrawMask( false ) {}
|
2002-07-08 13:18:58 +00:00
|
|
|
};
|
|
|
|
|
2002-09-11 12:38:55 +00:00
|
|
|
struct JPGEmit
|
|
|
|
{
|
2002-09-20 10:17:06 +00:00
|
|
|
BitmapID m_aID;
|
2002-09-11 12:38:55 +00:00
|
|
|
SvMemoryStream* m_pStream;
|
|
|
|
Bitmap m_aMask;
|
|
|
|
sal_Int32 m_nObject;
|
2005-07-06 08:20:47 +00:00
|
|
|
bool m_bTrueColor;
|
2002-09-11 12:38:55 +00:00
|
|
|
|
2010-11-27 21:09:13 +00:00
|
|
|
JPGEmit() : m_pStream( NULL ), m_bTrueColor( false ) {}
|
2002-09-11 12:38:55 +00:00
|
|
|
~JPGEmit() { delete m_pStream; }
|
|
|
|
};
|
|
|
|
|
2002-07-08 13:18:58 +00:00
|
|
|
struct GradientEmit
|
|
|
|
{
|
|
|
|
Gradient m_aGradient;
|
|
|
|
Size m_aSize;
|
|
|
|
sal_Int32 m_nObject;
|
|
|
|
};
|
|
|
|
|
2006-12-04 07:32:37 +00:00
|
|
|
// for tilings (drawWallpaper, begin/endPattern)
|
|
|
|
struct TilingEmit
|
2002-07-08 13:18:58 +00:00
|
|
|
{
|
2006-12-04 07:32:37 +00:00
|
|
|
sal_Int32 m_nObject;
|
|
|
|
Rectangle m_aRectangle;
|
2007-06-11 13:25:28 +00:00
|
|
|
Size m_aCellSize;
|
2006-12-04 07:32:37 +00:00
|
|
|
SvtGraphicFill::Transform m_aTransform;
|
|
|
|
ResourceDict m_aResources;
|
|
|
|
SvMemoryStream* m_pTilingStream;
|
|
|
|
|
|
|
|
TilingEmit()
|
|
|
|
: m_nObject( 0 ),
|
|
|
|
m_pTilingStream( NULL )
|
|
|
|
{}
|
2002-07-08 13:18:58 +00:00
|
|
|
};
|
|
|
|
|
2002-07-24 15:09:45 +00:00
|
|
|
// for transparency group XObjects
|
|
|
|
struct TransparencyEmit
|
|
|
|
{
|
|
|
|
sal_Int32 m_nObject;
|
2004-09-08 15:22:06 +00:00
|
|
|
sal_Int32 m_nExtGStateObject;
|
2002-07-24 15:09:45 +00:00
|
|
|
double m_fAlpha;
|
|
|
|
Rectangle m_aBoundRect;
|
2004-09-08 15:22:06 +00:00
|
|
|
SvMemoryStream* m_pContentStream;
|
|
|
|
SvMemoryStream* m_pSoftMaskStream;
|
|
|
|
|
|
|
|
TransparencyEmit()
|
|
|
|
: m_nObject( 0 ),
|
|
|
|
m_nExtGStateObject( -1 ),
|
|
|
|
m_fAlpha( 0.0 ),
|
|
|
|
m_pContentStream( NULL ),
|
|
|
|
m_pSoftMaskStream( NULL )
|
|
|
|
{}
|
|
|
|
~TransparencyEmit()
|
|
|
|
{
|
|
|
|
delete m_pContentStream;
|
|
|
|
delete m_pSoftMaskStream;
|
|
|
|
}
|
2002-07-24 15:09:45 +00:00
|
|
|
};
|
|
|
|
|
2002-07-15 11:04:39 +00:00
|
|
|
// font subsets
|
2009-12-18 11:44:01 +01:00
|
|
|
class GlyphEmit
|
2002-07-15 11:04:39 +00:00
|
|
|
{
|
2009-12-17 17:25:17 +01:00
|
|
|
// performance: actually this should probably a vector;
|
2009-12-18 11:44:01 +01:00
|
|
|
sal_Ucs m_aBufferedUnicodes[3];
|
|
|
|
sal_Int32 m_nUnicodes;
|
|
|
|
sal_Int32 m_nMaxUnicodes;
|
|
|
|
boost::shared_array<sal_Ucs> m_pUnicodes;
|
|
|
|
sal_uInt8 m_nSubsetGlyphID;
|
2009-12-17 17:25:17 +01:00
|
|
|
|
2009-12-18 11:44:01 +01:00
|
|
|
public:
|
2009-12-17 17:25:17 +01:00
|
|
|
GlyphEmit() : m_nUnicodes(0), m_nSubsetGlyphID(0)
|
|
|
|
{
|
2012-08-13 11:21:13 +02:00
|
|
|
memset( m_aBufferedUnicodes, 0, sizeof( m_aBufferedUnicodes ) );
|
2010-10-18 12:28:33 +02:00
|
|
|
m_nMaxUnicodes = SAL_N_ELEMENTS(m_aBufferedUnicodes);
|
2009-12-18 11:44:01 +01:00
|
|
|
}
|
|
|
|
~GlyphEmit()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void setGlyphId( sal_uInt8 i_nId ) { m_nSubsetGlyphID = i_nId; }
|
|
|
|
sal_uInt8 getGlyphId() const { return m_nSubsetGlyphID; }
|
|
|
|
|
|
|
|
void addCode( sal_Ucs i_cCode )
|
|
|
|
{
|
|
|
|
if( m_nUnicodes == m_nMaxUnicodes )
|
|
|
|
{
|
|
|
|
sal_Ucs* pNew = new sal_Ucs[ 2 * m_nMaxUnicodes];
|
|
|
|
if( m_pUnicodes.get() )
|
2012-08-13 11:21:13 +02:00
|
|
|
memcpy( pNew, m_pUnicodes.get(), m_nMaxUnicodes * sizeof(sal_Ucs) );
|
2009-12-18 11:44:01 +01:00
|
|
|
else
|
2012-08-13 11:21:13 +02:00
|
|
|
memcpy( pNew, m_aBufferedUnicodes, m_nMaxUnicodes * sizeof(sal_Ucs) );
|
2009-12-18 11:44:01 +01:00
|
|
|
m_pUnicodes.reset( pNew );
|
|
|
|
m_nMaxUnicodes *= 2;
|
|
|
|
}
|
|
|
|
if( m_pUnicodes.get() )
|
|
|
|
m_pUnicodes[ m_nUnicodes++ ] = i_cCode;
|
|
|
|
else
|
|
|
|
m_aBufferedUnicodes[ m_nUnicodes++ ] = i_cCode;
|
|
|
|
}
|
|
|
|
sal_Int32 countCodes() const { return m_nUnicodes; }
|
|
|
|
sal_Ucs getCode( sal_Int32 i_nIndex ) const
|
|
|
|
{
|
|
|
|
sal_Ucs nRet = 0;
|
|
|
|
if( i_nIndex < m_nUnicodes )
|
|
|
|
nRet = m_pUnicodes.get() ? m_pUnicodes[ i_nIndex ] : m_aBufferedUnicodes[ i_nIndex ];
|
|
|
|
return nRet;
|
2009-12-17 17:25:17 +01:00
|
|
|
}
|
2002-07-15 11:04:39 +00:00
|
|
|
};
|
2008-03-31 12:25:57 +00:00
|
|
|
typedef std::map< sal_GlyphId, GlyphEmit > FontEmitMapping;
|
2002-07-15 11:04:39 +00:00
|
|
|
struct FontEmit
|
|
|
|
{
|
|
|
|
sal_Int32 m_nFontID;
|
|
|
|
FontEmitMapping m_aMapping;
|
|
|
|
|
|
|
|
FontEmit( sal_Int32 nID ) : m_nFontID( nID ) {}
|
|
|
|
};
|
|
|
|
typedef std::list< FontEmit > FontEmitList;
|
|
|
|
struct Glyph
|
|
|
|
{
|
|
|
|
sal_Int32 m_nFontID;
|
|
|
|
sal_uInt8 m_nSubsetGlyphID;
|
|
|
|
};
|
2008-08-27 11:11:35 +00:00
|
|
|
typedef std::map< sal_GlyphId, Glyph > FontMapping;
|
2002-07-15 11:04:39 +00:00
|
|
|
struct FontSubset
|
|
|
|
{
|
|
|
|
FontEmitList m_aSubsets;
|
|
|
|
FontMapping m_aMapping;
|
|
|
|
};
|
2012-06-19 06:24:37 -05:00
|
|
|
typedef std::map< const PhysicalFontFace*, FontSubset > FontSubsetData;
|
2003-04-17 14:18:15 +00:00
|
|
|
struct EmbedCode
|
|
|
|
{
|
2008-03-31 12:25:57 +00:00
|
|
|
sal_Ucs m_aUnicode;
|
2013-04-07 12:06:47 +02:00
|
|
|
OString m_aName;
|
2003-04-17 14:18:15 +00:00
|
|
|
};
|
|
|
|
struct EmbedEncoding
|
|
|
|
{
|
2008-03-31 12:25:57 +00:00
|
|
|
sal_Int32 m_nFontID;
|
|
|
|
std::vector< EmbedCode > m_aEncVector;
|
|
|
|
std::map< sal_Ucs, sal_Int8 > m_aCMap;
|
2003-04-17 14:18:15 +00:00
|
|
|
};
|
|
|
|
struct EmbedFont
|
|
|
|
{
|
|
|
|
sal_Int32 m_nNormalFontID;
|
|
|
|
std::list< EmbedEncoding > m_aExtendedEncodings;
|
2009-10-28 18:38:39 +01:00
|
|
|
|
|
|
|
EmbedFont() : m_nNormalFontID( 0 ) {}
|
2003-04-17 14:18:15 +00:00
|
|
|
};
|
2012-06-19 06:24:37 -05:00
|
|
|
typedef std::map< const PhysicalFontFace*, EmbedFont > FontEmbedData;
|
2004-09-08 15:22:06 +00:00
|
|
|
|
|
|
|
struct PDFDest
|
|
|
|
{
|
|
|
|
sal_Int32 m_nPage;
|
|
|
|
PDFWriter::DestAreaType m_eType;
|
|
|
|
Rectangle m_aRect;
|
|
|
|
};
|
|
|
|
|
2007-11-20 16:11:48 +00:00
|
|
|
//--->i56629
|
|
|
|
struct PDFNamedDest
|
|
|
|
{
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString m_aDestName;
|
2007-11-20 16:11:48 +00:00
|
|
|
sal_Int32 m_nPage;
|
|
|
|
PDFWriter::DestAreaType m_eType;
|
|
|
|
Rectangle m_aRect;
|
|
|
|
};
|
|
|
|
|
2004-09-08 15:22:06 +00:00
|
|
|
struct PDFOutlineEntry
|
|
|
|
{
|
|
|
|
sal_Int32 m_nParentID;
|
|
|
|
sal_Int32 m_nObject;
|
|
|
|
sal_Int32 m_nParentObject;
|
|
|
|
sal_Int32 m_nNextObject;
|
|
|
|
sal_Int32 m_nPrevObject;
|
|
|
|
std::vector< sal_Int32 > m_aChildren;
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString m_aTitle;
|
2004-09-08 15:22:06 +00:00
|
|
|
sal_Int32 m_nDestID;
|
|
|
|
|
|
|
|
PDFOutlineEntry()
|
|
|
|
: m_nParentID( -1 ),
|
|
|
|
m_nObject( 0 ),
|
|
|
|
m_nParentObject( 0 ),
|
|
|
|
m_nNextObject( 0 ),
|
|
|
|
m_nPrevObject( 0 ),
|
|
|
|
m_nDestID( -1 )
|
|
|
|
{}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct PDFAnnotation
|
|
|
|
{
|
|
|
|
sal_Int32 m_nObject;
|
|
|
|
Rectangle m_aRect;
|
|
|
|
sal_Int32 m_nPage;
|
|
|
|
|
|
|
|
PDFAnnotation()
|
|
|
|
: m_nObject( -1 ),
|
|
|
|
m_nPage( -1 )
|
|
|
|
{}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct PDFLink : public PDFAnnotation
|
|
|
|
{
|
|
|
|
sal_Int32 m_nDest; // set to -1 for URL, to a dest else
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString m_aURL;
|
2005-11-01 09:33:03 +00:00
|
|
|
sal_Int32 m_nStructParent; // struct parent entry
|
2004-09-08 15:22:06 +00:00
|
|
|
|
|
|
|
PDFLink()
|
2005-11-01 09:33:03 +00:00
|
|
|
: m_nDest( -1 ),
|
|
|
|
m_nStructParent( -1 )
|
2004-09-08 15:22:06 +00:00
|
|
|
{}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct PDFNoteEntry : public PDFAnnotation
|
|
|
|
{
|
|
|
|
PDFNote m_aContents;
|
|
|
|
|
|
|
|
PDFNoteEntry()
|
|
|
|
{}
|
|
|
|
};
|
|
|
|
|
2013-04-07 12:06:47 +02:00
|
|
|
typedef boost::unordered_map< OString, SvMemoryStream*, OStringHash > PDFAppearanceStreams;
|
|
|
|
typedef boost::unordered_map< OString, PDFAppearanceStreams, OStringHash > PDFAppearanceMap;
|
2004-09-08 15:22:06 +00:00
|
|
|
|
|
|
|
struct PDFWidget : public PDFAnnotation
|
|
|
|
{
|
|
|
|
PDFWriter::WidgetType m_eType;
|
2013-04-07 12:06:47 +02:00
|
|
|
OString m_aName;
|
|
|
|
OUString m_aDescription;
|
|
|
|
OUString m_aText;
|
2010-09-29 15:46:40 +08:00
|
|
|
sal_uInt16 m_nTextStyle;
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString m_aValue;
|
|
|
|
OString m_aDAString;
|
|
|
|
OString m_aDRDict;
|
|
|
|
OString m_aMKDict;
|
|
|
|
OString m_aMKDictCAString; // i12626, added to be able to encrypt the /CA text string
|
2006-07-13 10:17:26 +00:00
|
|
|
// since the object number is not known at the moment
|
|
|
|
// of filling m_aMKDict, the string will be encrypted when emitted.
|
|
|
|
// the /CA string MUST BE the last added to m_aMKDict
|
|
|
|
// see code for details
|
2004-09-08 15:22:06 +00:00
|
|
|
sal_Int32 m_nFlags;
|
|
|
|
sal_Int32 m_nParent; // if not 0, parent's object number
|
|
|
|
std::vector<sal_Int32> m_aKids; // widget children, contains object numbers
|
2005-10-19 10:49:22 +00:00
|
|
|
std::vector<sal_Int32> m_aKidsIndex; // widget children, contains index to m_aWidgets
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString m_aOnValue;
|
2005-03-29 11:57:34 +00:00
|
|
|
sal_Int32 m_nTabOrder; // lowest number gets first in tab order
|
2004-09-08 15:22:06 +00:00
|
|
|
sal_Int32 m_nRadioGroup;
|
|
|
|
sal_Int32 m_nMaxLen;
|
2006-07-10 16:26:01 +00:00
|
|
|
bool m_bSubmit;
|
2006-12-04 07:32:37 +00:00
|
|
|
bool m_bSubmitGet;
|
2006-07-10 16:26:01 +00:00
|
|
|
sal_Int32 m_nDest;
|
2013-04-07 12:06:47 +02:00
|
|
|
std::vector<OUString> m_aListEntries;
|
2006-12-04 07:32:37 +00:00
|
|
|
std::vector<sal_Int32> m_aSelectedEntries;
|
2004-09-08 15:22:06 +00:00
|
|
|
PDFAppearanceMap m_aAppearances;
|
|
|
|
PDFWidget()
|
|
|
|
: m_eType( PDFWriter::PushButton ),
|
|
|
|
m_nTextStyle( 0 ),
|
|
|
|
m_nFlags( 0 ),
|
|
|
|
m_nParent( 0 ),
|
|
|
|
m_nRadioGroup( -1 ),
|
2006-07-10 16:26:01 +00:00
|
|
|
m_nMaxLen( 0 ),
|
|
|
|
m_bSubmit( false ),
|
2006-12-04 07:32:37 +00:00
|
|
|
m_bSubmitGet( false ),
|
2006-07-10 16:26:01 +00:00
|
|
|
m_nDest( -1 )
|
2004-09-08 15:22:06 +00:00
|
|
|
{}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct PDFStructureAttribute
|
|
|
|
{
|
|
|
|
PDFWriter::StructAttributeValue eValue;
|
|
|
|
sal_Int32 nValue;
|
|
|
|
|
|
|
|
PDFStructureAttribute()
|
|
|
|
: eValue( PDFWriter::Invalid ),
|
|
|
|
nValue( 0 )
|
|
|
|
{}
|
|
|
|
|
|
|
|
PDFStructureAttribute( PDFWriter::StructAttributeValue eVal )
|
|
|
|
: eValue( eVal ),
|
|
|
|
nValue( 0 )
|
|
|
|
{}
|
|
|
|
|
|
|
|
PDFStructureAttribute( sal_Int32 nVal )
|
|
|
|
: eValue( PDFWriter::Invalid ),
|
|
|
|
nValue( nVal )
|
|
|
|
{}
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef std::map<PDFWriter::StructAttribute, PDFStructureAttribute > PDFStructAttributes;
|
|
|
|
|
2005-03-29 11:57:34 +00:00
|
|
|
struct PDFStructureElementKid // for Kids entries
|
|
|
|
{
|
|
|
|
sal_Int32 nObject; // an object number if nMCID is -1,
|
|
|
|
// else the page object relevant to MCID
|
|
|
|
sal_Int32 nMCID; // an MCID if >= 0
|
|
|
|
|
|
|
|
PDFStructureElementKid( sal_Int32 nObj ) : nObject( nObj ), nMCID( -1 ) {}
|
|
|
|
PDFStructureElementKid( sal_Int32 MCID, sal_Int32 nPage ) : nObject( nPage ), nMCID( MCID ) {}
|
|
|
|
};
|
|
|
|
|
2004-09-08 15:22:06 +00:00
|
|
|
struct PDFStructureElement
|
|
|
|
{
|
|
|
|
sal_Int32 m_nObject;
|
|
|
|
PDFWriter::StructElement m_eType;
|
2013-04-07 12:06:47 +02:00
|
|
|
OString m_aAlias;
|
2004-09-08 15:22:06 +00:00
|
|
|
sal_Int32 m_nOwnElement; // index into structure vector
|
|
|
|
sal_Int32 m_nParentElement; // index into structure vector
|
|
|
|
sal_Int32 m_nFirstPageObject;
|
|
|
|
bool m_bOpenMCSeq;
|
2008-12-01 13:29:22 +00:00
|
|
|
std::list< sal_Int32 > m_aChildren; // indexes into structure vector
|
2005-03-29 11:57:34 +00:00
|
|
|
std::list< PDFStructureElementKid > m_aKids;
|
2004-09-08 15:22:06 +00:00
|
|
|
PDFStructAttributes m_aAttributes;
|
|
|
|
Rectangle m_aBBox;
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString m_aActualText;
|
|
|
|
OUString m_aAltText;
|
2008-01-29 07:23:20 +00:00
|
|
|
com::sun::star::lang::Locale m_aLocale;
|
2004-09-08 15:22:06 +00:00
|
|
|
|
|
|
|
// m_aContents contains the element's marked content sequence
|
|
|
|
// as pairs of (page nr, MCID)
|
|
|
|
|
|
|
|
PDFStructureElement()
|
|
|
|
: m_nObject( 0 ),
|
|
|
|
m_eType( PDFWriter::NonStructElement ),
|
|
|
|
m_nOwnElement( -1 ),
|
|
|
|
m_nParentElement( -1 ),
|
|
|
|
m_nFirstPageObject( 0 ),
|
|
|
|
m_bOpenMCSeq( false )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2007-03-26 10:21:27 +00:00
|
|
|
struct PDFAddStream
|
|
|
|
{
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString m_aMimeType;
|
2007-03-26 10:21:27 +00:00
|
|
|
PDFOutputStream* m_pStream;
|
|
|
|
sal_Int32 m_nStreamObject;
|
|
|
|
bool m_bCompress;
|
|
|
|
|
|
|
|
PDFAddStream() : m_pStream( NULL ), m_nStreamObject( 0 ), m_bCompress( true ) {}
|
|
|
|
};
|
|
|
|
|
2007-04-04 07:24:29 +00:00
|
|
|
|
|
|
|
// helper structure for drawLayout and friends
|
|
|
|
struct PDFGlyph
|
|
|
|
{
|
|
|
|
Point m_aPos;
|
|
|
|
sal_Int32 m_nNativeWidth;
|
|
|
|
sal_Int32 m_nGlyphId;
|
|
|
|
sal_Int32 m_nMappedFontId;
|
|
|
|
sal_uInt8 m_nMappedGlyphId;
|
|
|
|
|
|
|
|
PDFGlyph( const Point& rPos,
|
|
|
|
sal_Int32 nNativeWidth,
|
|
|
|
sal_Int32 nGlyphId,
|
|
|
|
sal_Int32 nFontId,
|
|
|
|
sal_uInt8 nMappedGlyphId )
|
|
|
|
: m_aPos( rPos ), m_nNativeWidth( nNativeWidth ), m_nGlyphId( nGlyphId ),
|
|
|
|
m_nMappedFontId( nFontId ), m_nMappedGlyphId( nMappedGlyphId )
|
|
|
|
{}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2004-09-08 15:22:06 +00:00
|
|
|
static const sal_Char* getStructureTag( PDFWriter::StructElement );
|
|
|
|
static const sal_Char* getAttributeTag( PDFWriter::StructAttribute eAtr );
|
|
|
|
static const sal_Char* getAttributeValueTag( PDFWriter::StructAttributeValue eVal );
|
|
|
|
|
2004-10-28 09:33:41 +00:00
|
|
|
// returns true if compression was done
|
|
|
|
// else false
|
|
|
|
static bool compressStream( SvMemoryStream* );
|
|
|
|
|
2006-01-26 17:09:36 +00:00
|
|
|
static void convertLineInfoToExtLineInfo( const LineInfo& rIn, PDFWriter::ExtLineInfo& rOut );
|
2002-07-15 11:04:39 +00:00
|
|
|
private:
|
2002-07-20 14:54:30 +00:00
|
|
|
static const BuiltinFont m_aBuiltinFonts[14];
|
|
|
|
|
2004-09-08 15:22:06 +00:00
|
|
|
OutputDevice* m_pReferenceDevice;
|
2002-07-08 13:18:58 +00:00
|
|
|
|
2004-09-08 15:22:06 +00:00
|
|
|
MapMode m_aMapMode; // PDFWriterImpl scaled units
|
|
|
|
std::vector< PDFPage > m_aPages;
|
2002-07-08 13:18:58 +00:00
|
|
|
/* maps object numbers to file offsets (needed for xref) */
|
2004-09-08 15:22:06 +00:00
|
|
|
std::vector< sal_uInt64 > m_aObjects;
|
2002-07-08 13:18:58 +00:00
|
|
|
/* contains Bitmaps until they are written to the
|
|
|
|
* file stream as XObjects*/
|
2004-09-08 15:22:06 +00:00
|
|
|
std::list< BitmapEmit > m_aBitmaps;
|
|
|
|
/* contains JPG streams until written to file */
|
|
|
|
std::list<JPGEmit> m_aJPGs;
|
2007-11-20 16:11:48 +00:00
|
|
|
/*--->i56629 contains all named destinations ever set during the PDF creation,
|
|
|
|
destination id is always the destination's position in this vector
|
|
|
|
*/
|
|
|
|
std::vector<PDFNamedDest> m_aNamedDests;
|
2004-09-08 15:22:06 +00:00
|
|
|
/* contains all dests ever set during the PDF creation,
|
|
|
|
dest id is always the dest's position in this vector
|
|
|
|
*/
|
|
|
|
std::vector<PDFDest> m_aDests;
|
2010-12-01 09:57:05 +01:00
|
|
|
/** contains destinations accessible via a public Id, instead of being linked to by an ordinary link
|
|
|
|
*/
|
|
|
|
::std::map< sal_Int32, sal_Int32 > m_aDestinationIdTranslation;
|
2004-09-08 15:22:06 +00:00
|
|
|
/* contains all links ever set during PDF creation,
|
|
|
|
link id is always the link's position in this vector
|
|
|
|
*/
|
|
|
|
std::vector<PDFLink> m_aLinks;
|
2007-04-17 12:57:17 +00:00
|
|
|
/* makes correctly encoded for export to PDF URLS
|
|
|
|
*/
|
|
|
|
com::sun::star::uno::Reference< com::sun::star::util::XURLTransformer > m_xTrans;
|
2004-09-08 15:22:06 +00:00
|
|
|
/* maps arbitrary link ids for structure attributes to real link ids
|
|
|
|
(for setLinkPropertyId)
|
|
|
|
*/
|
|
|
|
std::map<sal_Int32, sal_Int32> m_aLinkPropertyMap;
|
|
|
|
/* contains all outline items,
|
|
|
|
object 0 is the outline root
|
2002-09-11 12:38:55 +00:00
|
|
|
*/
|
2004-09-08 15:22:06 +00:00
|
|
|
std::vector<PDFOutlineEntry> m_aOutline;
|
|
|
|
/* contains all notes set during PDF creation
|
|
|
|
*/
|
|
|
|
std::vector<PDFNoteEntry> m_aNotes;
|
|
|
|
/* the root of the structure tree
|
|
|
|
*/
|
|
|
|
std::vector<PDFStructureElement> m_aStructure;
|
|
|
|
/* current object in the structure hierarchy
|
|
|
|
*/
|
|
|
|
sal_Int32 m_nCurrentStructElement;
|
2005-11-01 09:33:03 +00:00
|
|
|
/* structure parent tree */
|
2013-04-07 12:06:47 +02:00
|
|
|
std::vector< OString > m_aStructParentTree;
|
2004-09-08 15:22:06 +00:00
|
|
|
/* emit strucure marks currently (aka. NonStructElement or not)
|
|
|
|
*/
|
|
|
|
bool m_bEmitStructure;
|
|
|
|
bool m_bNewMCID;
|
2008-01-29 07:23:20 +00:00
|
|
|
/* role map of struct tree root */
|
2013-04-07 12:06:47 +02:00
|
|
|
boost::unordered_map< OString, OString, OStringHash >
|
2008-01-29 07:23:20 +00:00
|
|
|
m_aRoleMap;
|
2004-09-08 15:22:06 +00:00
|
|
|
|
|
|
|
/* contains all widgets used in the PDF
|
|
|
|
*/
|
|
|
|
std::vector<PDFWidget> m_aWidgets;
|
|
|
|
/* maps radio group id to index of radio group control in m_aWidgets */
|
|
|
|
std::map< sal_Int32, sal_Int32 > m_aRadioGroupWidgets;
|
2011-02-03 16:55:17 -07:00
|
|
|
/* boost::unordered_map for field names, used to ensure unique field names */
|
2013-04-07 12:06:47 +02:00
|
|
|
boost::unordered_map< OString, sal_Int32, OStringHash > m_aFieldNameMap;
|
2002-09-11 12:38:55 +00:00
|
|
|
|
2002-07-08 13:18:58 +00:00
|
|
|
/* contains Bitmaps for gradient functions until they are written
|
|
|
|
* to the file stream */
|
2004-09-08 15:22:06 +00:00
|
|
|
std::list< GradientEmit > m_aGradients;
|
2002-07-08 13:18:58 +00:00
|
|
|
/* contains bitmap tiling patterns */
|
2006-12-04 07:32:37 +00:00
|
|
|
std::vector< TilingEmit > m_aTilings;
|
2004-09-08 15:22:06 +00:00
|
|
|
std::list< TransparencyEmit > m_aTransparentObjects;
|
2002-07-15 11:04:39 +00:00
|
|
|
/* contains all font subsets in use */
|
2004-09-08 15:22:06 +00:00
|
|
|
FontSubsetData m_aSubsets;
|
|
|
|
FontEmbedData m_aEmbeddedFonts;
|
2009-10-28 18:38:39 +01:00
|
|
|
FontEmbedData m_aSystemFonts;
|
2004-09-08 15:22:06 +00:00
|
|
|
sal_Int32 m_nNextFID;
|
2007-04-04 07:24:29 +00:00
|
|
|
PDFFontCache m_aFontCache;
|
2004-09-08 15:22:06 +00:00
|
|
|
|
|
|
|
sal_Int32 m_nInheritedPageWidth; // in inch/72
|
|
|
|
sal_Int32 m_nInheritedPageHeight; // in inch/72
|
|
|
|
PDFWriter::Orientation m_eInheritedOrientation;
|
|
|
|
sal_Int32 m_nCurrentPage;
|
2002-07-08 13:18:58 +00:00
|
|
|
|
2004-09-08 15:22:06 +00:00
|
|
|
sal_Int32 m_nCatalogObject;
|
2012-06-19 17:18:52 +03:00
|
|
|
// object number of the main signature dictionary
|
|
|
|
sal_Int32 m_nSignatureObject;
|
|
|
|
sal_Int64 m_nSignatureContentOffset;
|
|
|
|
sal_Int64 m_nSignatureLastByteRangeNoOffset;
|
2004-09-08 15:22:06 +00:00
|
|
|
sal_Int32 m_nResourceDict;
|
2006-12-04 07:32:37 +00:00
|
|
|
ResourceDict m_aGlobalResourceDict;
|
|
|
|
sal_Int32 m_nFontDictObject;
|
2007-04-16 13:21:42 +00:00
|
|
|
std::map< sal_Int32, sal_Int32 > m_aBuiltinFontToObjectMap;
|
2002-07-08 13:18:58 +00:00
|
|
|
|
2004-09-08 15:22:06 +00:00
|
|
|
PDFWriter::PDFWriterContext m_aContext;
|
|
|
|
oslFileHandle m_aFile;
|
|
|
|
bool m_bOpen;
|
2002-07-08 13:18:58 +00:00
|
|
|
|
2004-09-08 15:22:06 +00:00
|
|
|
|
|
|
|
/* output redirection; e.g. to accumulate content streams for
|
|
|
|
XObjects
|
|
|
|
*/
|
|
|
|
struct StreamRedirect
|
|
|
|
{
|
|
|
|
SvStream* m_pStream;
|
|
|
|
MapMode m_aMapMode;
|
2007-06-11 13:25:28 +00:00
|
|
|
Rectangle m_aTargetRect;
|
2006-12-04 07:32:37 +00:00
|
|
|
ResourceDict m_aResourceDict;
|
2004-09-08 15:22:06 +00:00
|
|
|
};
|
|
|
|
std::list< StreamRedirect > m_aOutputStreams;
|
2002-07-08 13:18:58 +00:00
|
|
|
|
|
|
|
// graphics state
|
|
|
|
struct GraphicsState
|
|
|
|
{
|
2010-01-19 18:33:02 +01:00
|
|
|
Font m_aFont;
|
|
|
|
MapMode m_aMapMode;
|
|
|
|
Color m_aLineColor;
|
|
|
|
Color m_aFillColor;
|
|
|
|
Color m_aTextLineColor;
|
|
|
|
Color m_aOverlineColor;
|
|
|
|
basegfx::B2DPolyPolygon m_aClipRegion;
|
|
|
|
bool m_bClipRegion;
|
|
|
|
sal_Int32 m_nAntiAlias;
|
|
|
|
sal_Int32 m_nLayoutMode;
|
|
|
|
LanguageType m_aDigitLanguage;
|
|
|
|
sal_Int32 m_nTransparentPercent;
|
|
|
|
sal_uInt16 m_nFlags;
|
|
|
|
sal_uInt16 m_nUpdateFlags;
|
2005-03-29 11:57:34 +00:00
|
|
|
|
|
|
|
static const sal_uInt16 updateFont = 0x0001;
|
|
|
|
static const sal_uInt16 updateMapMode = 0x0002;
|
|
|
|
static const sal_uInt16 updateLineColor = 0x0004;
|
|
|
|
static const sal_uInt16 updateFillColor = 0x0008;
|
|
|
|
static const sal_uInt16 updateTextLineColor = 0x0010;
|
2009-01-05 17:49:45 +00:00
|
|
|
static const sal_uInt16 updateOverlineColor = 0x0020;
|
|
|
|
static const sal_uInt16 updateClipRegion = 0x0040;
|
|
|
|
static const sal_uInt16 updateAntiAlias = 0x0080;
|
|
|
|
static const sal_uInt16 updateLayoutMode = 0x0100;
|
|
|
|
static const sal_uInt16 updateTransparentPercent = 0x0200;
|
|
|
|
static const sal_uInt16 updateDigitLanguage = 0x0400;
|
2002-07-08 13:18:58 +00:00
|
|
|
|
|
|
|
GraphicsState() :
|
|
|
|
m_aLineColor( COL_TRANSPARENT ),
|
|
|
|
m_aFillColor( COL_TRANSPARENT ),
|
2003-04-11 16:29:22 +00:00
|
|
|
m_aTextLineColor( COL_TRANSPARENT ),
|
2009-01-05 17:49:45 +00:00
|
|
|
m_aOverlineColor( COL_TRANSPARENT ),
|
2010-01-19 18:33:02 +01:00
|
|
|
m_bClipRegion( false ),
|
2002-09-17 10:15:44 +00:00
|
|
|
m_nAntiAlias( 1 ),
|
2002-07-15 11:04:39 +00:00
|
|
|
m_nLayoutMode( 0 ),
|
2009-12-01 18:01:53 +01:00
|
|
|
m_aDigitLanguage( 0 ),
|
2002-09-27 09:00:34 +00:00
|
|
|
m_nTransparentPercent( 0 ),
|
2005-03-29 11:57:34 +00:00
|
|
|
m_nFlags( 0xffff ),
|
|
|
|
m_nUpdateFlags( 0xffff )
|
2002-09-27 09:00:34 +00:00
|
|
|
{}
|
2002-07-08 13:18:58 +00:00
|
|
|
GraphicsState( const GraphicsState& rState ) :
|
|
|
|
m_aFont( rState.m_aFont ),
|
|
|
|
m_aMapMode( rState.m_aMapMode ),
|
|
|
|
m_aLineColor( rState.m_aLineColor ),
|
|
|
|
m_aFillColor( rState.m_aFillColor ),
|
|
|
|
m_aTextLineColor( rState.m_aTextLineColor ),
|
2009-01-05 17:49:45 +00:00
|
|
|
m_aOverlineColor( rState.m_aOverlineColor ),
|
2002-07-08 13:18:58 +00:00
|
|
|
m_aClipRegion( rState.m_aClipRegion ),
|
2010-01-19 18:33:02 +01:00
|
|
|
m_bClipRegion( rState.m_bClipRegion ),
|
2002-07-08 13:18:58 +00:00
|
|
|
m_nAntiAlias( rState.m_nAntiAlias ),
|
|
|
|
m_nLayoutMode( rState.m_nLayoutMode ),
|
2009-12-01 18:01:53 +01:00
|
|
|
m_aDigitLanguage( rState.m_aDigitLanguage ),
|
2002-09-27 09:00:34 +00:00
|
|
|
m_nTransparentPercent( rState.m_nTransparentPercent ),
|
2005-03-29 11:57:34 +00:00
|
|
|
m_nFlags( rState.m_nFlags ),
|
|
|
|
m_nUpdateFlags( rState.m_nUpdateFlags )
|
2002-07-08 13:18:58 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
GraphicsState& operator=(const GraphicsState& rState )
|
|
|
|
{
|
|
|
|
m_aFont = rState.m_aFont;
|
|
|
|
m_aMapMode = rState.m_aMapMode;
|
|
|
|
m_aLineColor = rState.m_aLineColor;
|
|
|
|
m_aFillColor = rState.m_aFillColor;
|
|
|
|
m_aTextLineColor = rState.m_aTextLineColor;
|
2009-01-05 17:49:45 +00:00
|
|
|
m_aOverlineColor = rState.m_aOverlineColor;
|
2002-07-08 13:18:58 +00:00
|
|
|
m_aClipRegion = rState.m_aClipRegion;
|
2010-01-19 18:33:02 +01:00
|
|
|
m_bClipRegion = rState.m_bClipRegion;
|
2002-07-08 13:18:58 +00:00
|
|
|
m_nAntiAlias = rState.m_nAntiAlias;
|
|
|
|
m_nLayoutMode = rState.m_nLayoutMode;
|
2009-12-01 18:01:53 +01:00
|
|
|
m_aDigitLanguage = rState.m_aDigitLanguage;
|
2002-07-08 13:18:58 +00:00
|
|
|
m_nTransparentPercent = rState.m_nTransparentPercent;
|
2002-09-27 09:00:34 +00:00
|
|
|
m_nFlags = rState.m_nFlags;
|
2005-03-29 11:57:34 +00:00
|
|
|
m_nUpdateFlags = rState.m_nUpdateFlags;
|
2002-07-08 13:18:58 +00:00
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
};
|
2004-09-08 15:22:06 +00:00
|
|
|
std::list< GraphicsState > m_aGraphicsStack;
|
|
|
|
GraphicsState m_aCurrentPDFState;
|
2002-07-08 13:18:58 +00:00
|
|
|
|
2004-09-08 15:22:06 +00:00
|
|
|
ZCodec* m_pCodec;
|
|
|
|
SvMemoryStream* m_pMemStream;
|
2002-07-29 15:26:35 +00:00
|
|
|
|
2007-03-26 10:21:27 +00:00
|
|
|
std::vector< PDFAddStream > m_aAdditionalStreams;
|
2008-03-05 16:11:06 +00:00
|
|
|
std::set< PDFWriter::ErrorCode > m_aErrors;
|
2007-03-26 10:21:27 +00:00
|
|
|
|
|
|
|
rtlDigest m_aDocDigest;
|
|
|
|
|
2006-07-13 10:17:26 +00:00
|
|
|
/*
|
|
|
|
variables for PDF security
|
|
|
|
i12626
|
|
|
|
*/
|
|
|
|
/* used to cipher the stream data and for password management */
|
|
|
|
rtlCipher m_aCipher;
|
|
|
|
rtlDigest m_aDigest;
|
2010-09-24 14:28:04 +02:00
|
|
|
/* pad string used for password in Standard security handler */
|
|
|
|
static const sal_uInt8 s_nPadString[ENCRYPTED_PWD_SIZE];
|
|
|
|
|
|
|
|
/* the encryption key, formed with the user password according to algorithm 3.2, maximum length is 16 bytes + 3 + 2
|
|
|
|
for 128 bit security */
|
2006-07-13 10:17:26 +00:00
|
|
|
sal_Int32 m_nKeyLength; // key length, 16 or 5
|
|
|
|
sal_Int32 m_nRC4KeyLength; // key length, 16 or 10, to be input to the algorith 3.1
|
|
|
|
|
2010-09-24 14:28:04 +02:00
|
|
|
/* set to true if the following stream must be encrypted, used inside writeBuffer() */
|
2013-06-12 10:26:29 +09:00
|
|
|
bool m_bEncryptThisStream;
|
2006-07-13 10:17:26 +00:00
|
|
|
|
2010-09-24 14:28:04 +02:00
|
|
|
/* the numerical value of the access permissions, according to PDF spec, must be signed */
|
2006-07-13 10:17:26 +00:00
|
|
|
sal_Int32 m_nAccessPermissions;
|
2010-09-24 14:28:04 +02:00
|
|
|
/* string to hold the PDF creation date */
|
2013-04-07 12:06:47 +02:00
|
|
|
OString m_aCreationDateString;
|
2010-09-24 14:28:04 +02:00
|
|
|
/* string to hold the PDF creation date, for PDF/A metadata */
|
2013-04-07 12:06:47 +02:00
|
|
|
OString m_aCreationMetaDateString;
|
2010-09-24 14:28:04 +02:00
|
|
|
/* the buffer where the data are encrypted, dynamically allocated */
|
2006-07-13 10:17:26 +00:00
|
|
|
sal_uInt8 *m_pEncryptionBuffer;
|
2010-09-24 14:28:04 +02:00
|
|
|
/* size of the buffer */
|
2006-07-13 10:17:26 +00:00
|
|
|
sal_Int32 m_nEncryptionBufferSize;
|
|
|
|
|
2010-09-24 14:28:04 +02:00
|
|
|
/* check and reallocate the buffer for encryption */
|
2013-06-12 10:26:29 +09:00
|
|
|
bool checkEncryptionBufferSize( register sal_Int32 newSize );
|
2010-09-24 14:28:04 +02:00
|
|
|
/* this function implements part of the PDF spec algorithm 3.1 in encryption, the rest (the actual encryption) is in PDFWriterImpl::writeBuffer */
|
|
|
|
void checkAndEnableStreamEncryption( register sal_Int32 nObject );
|
2006-07-13 10:17:26 +00:00
|
|
|
|
|
|
|
void disableStreamEncryption() { m_bEncryptThisStream = false; };
|
|
|
|
|
2010-09-24 14:28:04 +02:00
|
|
|
/* */
|
|
|
|
void enableStringEncryption( register sal_Int32 nObject );
|
2006-07-13 10:17:26 +00:00
|
|
|
|
|
|
|
// test if the encryption is active, if yes than encrypt the unicode string and add to the OStringBuffer parameter
|
2013-04-07 12:06:47 +02:00
|
|
|
void appendUnicodeTextStringEncrypt( const OUString& rInString, const sal_Int32 nInObjectNumber, OStringBuffer& rOutBuffer );
|
2006-07-13 10:17:26 +00:00
|
|
|
|
2013-04-07 12:06:47 +02:00
|
|
|
void appendLiteralStringEncrypt( const OUString& rInString, const sal_Int32 nInObjectNumber, OStringBuffer& rOutBuffer, rtl_TextEncoding nEnc = RTL_TEXTENCODING_ASCII_US );
|
|
|
|
void appendLiteralStringEncrypt( const OString& rInString, const sal_Int32 nInObjectNumber, OStringBuffer& rOutBuffer );
|
|
|
|
void appendLiteralStringEncrypt( OStringBuffer& rInString, const sal_Int32 nInObjectNumber, OStringBuffer& rOutBuffer );
|
2006-07-13 10:17:26 +00:00
|
|
|
|
2002-07-15 11:04:39 +00:00
|
|
|
/* creates fonts and subsets that will be emitted later */
|
2012-06-19 06:24:37 -05:00
|
|
|
void registerGlyphs( int nGlyphs, sal_GlyphId* pGlyphs, sal_Int32* pGlpyhWidths, sal_Ucs* pUnicodes, sal_Int32* pUnicodesPerGlyph, sal_uInt8* pMappedGlyphs, sal_Int32* pMappedFontObjects, const PhysicalFontFace* pFallbackFonts[] );
|
2002-07-15 11:04:39 +00:00
|
|
|
|
|
|
|
/* emits a text object according to the passed layout */
|
2002-07-20 14:54:30 +00:00
|
|
|
/* TODO: remove rText as soon as SalLayout will change so that rText is not necessary anymore */
|
2013-04-07 12:06:47 +02:00
|
|
|
void drawVerticalGlyphs( const std::vector<PDFGlyph>& rGlyphs, OStringBuffer& rLine, const Point& rAlignOffset, const Matrix3& rRotScale, double fAngle, double fXScale, double fSkew, sal_Int32 nFontHeight );
|
|
|
|
void drawHorizontalGlyphs( const std::vector<PDFGlyph>& rGlyphs, OStringBuffer& rLine, const Point& rAlignOffset, double fAngle, double fXScale, double fSkew, sal_Int32 nFontHeight, sal_Int32 nPixelFontHeight );
|
2013-07-30 13:08:03 +02:00
|
|
|
void drawLayout( SalLayout& rLayout, const OUString& rText, bool bTextLines );
|
|
|
|
void drawRelief( SalLayout& rLayout, const OUString& rText, bool bTextLines );
|
|
|
|
void drawShadow( SalLayout& rLayout, const OUString& rText, bool bTextLines );
|
2002-07-15 11:04:39 +00:00
|
|
|
|
2002-07-08 13:18:58 +00:00
|
|
|
/* writes differences between graphics stack and current real PDF
|
|
|
|
* state to the file
|
|
|
|
*/
|
|
|
|
void updateGraphicsState();
|
|
|
|
|
2002-07-24 15:09:45 +00:00
|
|
|
/* writes a transparency group object */
|
|
|
|
bool writeTransparentObject( TransparencyEmit& rObject );
|
|
|
|
|
2002-07-08 13:18:58 +00:00
|
|
|
/* writes an XObject of type image, may create
|
|
|
|
a second for the mask
|
|
|
|
*/
|
|
|
|
bool writeBitmapObject( BitmapEmit& rObject, bool bMask = false );
|
2002-09-11 12:38:55 +00:00
|
|
|
|
|
|
|
bool writeJPG( JPGEmit& rEmit );
|
|
|
|
|
2002-09-20 10:17:06 +00:00
|
|
|
/* tries to find the bitmap by its id and returns its emit data if exists,
|
|
|
|
else creates a new emit data block */
|
|
|
|
const BitmapEmit& createBitmapEmit( const BitmapEx& rBitmapEx, bool bDrawMask = false );
|
|
|
|
|
2002-07-08 13:18:58 +00:00
|
|
|
/* writes the Do operation inside the content stream */
|
|
|
|
void drawBitmap( const Point& rDestPt, const Size& rDestSize, const BitmapEmit& rBitmap, const Color& rFillColor );
|
|
|
|
/* write the function object for a Gradient */
|
|
|
|
bool writeGradientFunction( GradientEmit& rObject );
|
|
|
|
/* creates a GradientEmit and returns its object number */
|
|
|
|
sal_Int32 createGradient( const Gradient& rGradient, const Size& rSize );
|
2003-12-01 08:54:35 +00:00
|
|
|
|
2002-07-08 13:18:58 +00:00
|
|
|
/* writes all tilings */
|
|
|
|
bool emitTilings();
|
|
|
|
/* writes all gradient patterns */
|
|
|
|
bool emitGradients();
|
2002-07-20 14:54:30 +00:00
|
|
|
/* writes a builtin font object and returns its objectid (or 0 in case of failure ) */
|
2012-06-19 06:24:37 -05:00
|
|
|
sal_Int32 emitBuiltinFont( const PhysicalFontFace*, sal_Int32 nObject = -1 );
|
2003-04-17 14:18:15 +00:00
|
|
|
/* writes a type1 embedded font object and returns its mapping from font ids to object ids (or 0 in case of failure ) */
|
2012-06-19 06:24:37 -05:00
|
|
|
std::map< sal_Int32, sal_Int32 > emitEmbeddedFont( const PhysicalFontFace*, EmbedFont& );
|
2009-10-28 18:38:39 +01:00
|
|
|
/* writes a type1 system font object and returns its mapping from font ids to object ids (or 0 in case of failure ) */
|
2012-06-19 06:24:37 -05:00
|
|
|
std::map< sal_Int32, sal_Int32 > emitSystemFont( const PhysicalFontFace*, EmbedFont& );
|
2002-07-20 14:54:30 +00:00
|
|
|
/* writes a font descriptor and returns its object id (or 0) */
|
2012-06-19 06:24:37 -05:00
|
|
|
sal_Int32 emitFontDescriptor( const PhysicalFontFace*, FontSubsetInfo&, sal_Int32 nSubsetID, sal_Int32 nStream );
|
2002-07-20 14:54:30 +00:00
|
|
|
/* writes a ToUnicode cmap, returns the corresponding stream object */
|
2009-12-17 17:25:17 +01:00
|
|
|
sal_Int32 createToUnicodeCMap( sal_uInt8* pEncoding, sal_Ucs* pUnicodes, sal_Int32* pUnicodesPerGlyph, sal_Int32* pEncToUnicodeIndex, int nGlyphs );
|
2004-09-08 15:22:06 +00:00
|
|
|
|
|
|
|
/* get resource dict object number */
|
|
|
|
sal_Int32 getResourceDictObj()
|
|
|
|
{
|
|
|
|
if( m_nResourceDict <= 0 )
|
|
|
|
m_nResourceDict = createObject();
|
|
|
|
return m_nResourceDict;
|
|
|
|
}
|
2006-12-04 07:32:37 +00:00
|
|
|
/* get the font dict object */
|
|
|
|
sal_Int32 getFontDictObject()
|
|
|
|
{
|
|
|
|
if( m_nFontDictObject <= 0 )
|
|
|
|
m_nFontDictObject = createObject();
|
|
|
|
return m_nFontDictObject;
|
|
|
|
}
|
|
|
|
/* push resource into current (redirected) resource dict */
|
2013-04-07 12:06:47 +02:00
|
|
|
void pushResource( ResourceKind eKind, const OString& rResource, sal_Int32 nObject );
|
2004-09-08 15:22:06 +00:00
|
|
|
|
2013-04-07 12:06:47 +02:00
|
|
|
void appendBuiltinFontsToDict( OStringBuffer& rDict ) const;
|
2002-07-15 11:04:39 +00:00
|
|
|
/* writes a the font dictionary and emits all font objects
|
|
|
|
* returns object id of font directory (or 0 on error)
|
2002-07-08 13:18:58 +00:00
|
|
|
*/
|
2006-12-04 07:32:37 +00:00
|
|
|
bool emitFonts();
|
2002-07-08 13:18:58 +00:00
|
|
|
/* writes the Resource dictionary;
|
|
|
|
* returns dict object id (or 0 on error)
|
|
|
|
*/
|
|
|
|
sal_Int32 emitResources();
|
2004-09-08 15:22:06 +00:00
|
|
|
// appends a dest
|
2013-04-07 12:06:47 +02:00
|
|
|
bool appendDest( sal_Int32 nDestID, OStringBuffer& rBuffer );
|
2004-09-08 15:22:06 +00:00
|
|
|
// write all links
|
|
|
|
bool emitLinkAnnotations();
|
|
|
|
// write all notes
|
|
|
|
bool emitNoteAnnotations();
|
|
|
|
// write the appearance streams of a widget
|
2013-04-07 12:06:47 +02:00
|
|
|
bool emitAppearances( PDFWidget& rWidget, OStringBuffer& rAnnotDict );
|
2005-10-19 10:49:22 +00:00
|
|
|
// clean up radio button "On" values
|
|
|
|
void ensureUniqueRadioOnValues();
|
2004-09-08 15:22:06 +00:00
|
|
|
// write all widgets
|
|
|
|
bool emitWidgetAnnotations();
|
|
|
|
// writes all annotation objects
|
|
|
|
bool emitAnnotations();
|
|
|
|
// writes the dest dict for the catalog
|
|
|
|
sal_Int32 emitDestDict();
|
2007-11-20 16:11:48 +00:00
|
|
|
//write the named destination stuff
|
|
|
|
sal_Int32 emitNamedDestinations();//i56629
|
2004-09-08 15:22:06 +00:00
|
|
|
// writes outline dict and tree
|
|
|
|
sal_Int32 emitOutline();
|
|
|
|
// puts the attribute objects of a structure element into the returned string,
|
|
|
|
// helper for emitStructure
|
2013-04-07 12:06:47 +02:00
|
|
|
OString emitStructureAttributes( PDFStructureElement& rEle );
|
2008-12-01 13:29:22 +00:00
|
|
|
//--->i94258
|
|
|
|
// the maximum array elements allowed for PDF array object
|
|
|
|
static const sal_uInt32 ncMaxPDFArraySize = 8191;
|
|
|
|
//check if internal dummy container are needed in the structure elements
|
|
|
|
void addInternalStructureContainer( PDFStructureElement& rEle );
|
|
|
|
//<---i94258
|
2004-09-08 15:22:06 +00:00
|
|
|
// writes document structure
|
|
|
|
sal_Int32 emitStructure( PDFStructureElement& rEle );
|
|
|
|
// writes structure parent tree
|
2005-11-01 09:33:03 +00:00
|
|
|
sal_Int32 emitStructParentTree( sal_Int32 nTreeObject );
|
2002-07-08 13:18:58 +00:00
|
|
|
// writes page tree and catalog
|
|
|
|
bool emitCatalog();
|
2012-06-19 17:18:52 +03:00
|
|
|
// writes signature dictionary object
|
|
|
|
bool emitSignature();
|
|
|
|
// creates a PKCS7 object using the ByteRange and overwrite /Contents
|
|
|
|
// of the signature dictionary
|
|
|
|
bool finalizeSignature();
|
2002-07-08 13:18:58 +00:00
|
|
|
// writes xref and trailer
|
|
|
|
bool emitTrailer();
|
2007-03-26 10:21:27 +00:00
|
|
|
// emit additional streams collected; also create there object numbers
|
|
|
|
bool emitAdditionalStreams();
|
2006-07-13 10:17:26 +00:00
|
|
|
// emits info dict (if applicable)
|
|
|
|
sal_Int32 emitInfoDict( );
|
2004-09-08 15:22:06 +00:00
|
|
|
|
2005-03-29 11:57:34 +00:00
|
|
|
// acrobat reader 5 and 6 use the order of the annotations
|
|
|
|
// as their tab order; since PDF1.5 one can make the
|
|
|
|
// tab order explicit by using the structure tree
|
|
|
|
void sortWidgets();
|
|
|
|
|
2006-12-04 07:32:37 +00:00
|
|
|
// updates the count numbers of outline items
|
|
|
|
sal_Int32 updateOutlineItemCount( std::vector< sal_Int32 >& rCounts,
|
|
|
|
sal_Int32 nItemLevel,
|
|
|
|
sal_Int32 nCurrentItemId );
|
2004-09-08 15:22:06 +00:00
|
|
|
// default appearences for widgets
|
2005-10-19 10:49:22 +00:00
|
|
|
sal_Int32 findRadioGroupWidget( const PDFWriter::RadioButtonWidget& rRadio );
|
2004-09-08 15:22:06 +00:00
|
|
|
Font replaceFont( const Font& rControlFont, const Font& rAppSetFont );
|
2007-04-16 13:21:42 +00:00
|
|
|
sal_Int32 getBestBuiltinFont( const Font& rFont );
|
2009-10-28 18:38:39 +01:00
|
|
|
sal_Int32 getSystemFont( const Font& i_rFont );
|
2004-09-08 15:22:06 +00:00
|
|
|
|
2005-07-06 08:20:47 +00:00
|
|
|
// used for edit and listbox
|
|
|
|
Font drawFieldBorder( PDFWidget&, const PDFWriter::AnyWidget&, const StyleSettings& );
|
|
|
|
|
2004-09-08 15:22:06 +00:00
|
|
|
void createDefaultPushButtonAppearance( PDFWidget&, const PDFWriter::PushButtonWidget& rWidget );
|
|
|
|
void createDefaultCheckBoxAppearance( PDFWidget&, const PDFWriter::CheckBoxWidget& rWidget );
|
|
|
|
void createDefaultRadioButtonAppearance( PDFWidget&, const PDFWriter::RadioButtonWidget& rWidget );
|
|
|
|
void createDefaultEditAppearance( PDFWidget&, const PDFWriter::EditWidget& rWidget );
|
|
|
|
void createDefaultListBoxAppearance( PDFWidget&, const PDFWriter::ListBoxWidget& rWidget );
|
2002-07-08 13:18:58 +00:00
|
|
|
|
2005-10-19 10:49:22 +00:00
|
|
|
/* ensure proper escapement and uniqueness of field names */
|
2010-02-18 14:10:43 +01:00
|
|
|
void createWidgetFieldName( sal_Int32 i_nWidgetsIndex, const PDFWriter::AnyWidget& i_rInWidget );
|
2002-07-08 13:18:58 +00:00
|
|
|
/* adds an entry to m_aObjects and returns its index+1,
|
|
|
|
* sets the offset to ~0
|
|
|
|
*/
|
|
|
|
sal_Int32 createObject();
|
|
|
|
/* sets the offset of object n to the current position of output file+1
|
|
|
|
*/
|
|
|
|
bool updateObject( sal_Int32 n );
|
|
|
|
|
|
|
|
bool writeBuffer( const void* pBuffer, sal_uInt64 nBytes );
|
2002-07-29 15:26:35 +00:00
|
|
|
void beginCompression();
|
|
|
|
void endCompression();
|
2004-09-08 15:22:06 +00:00
|
|
|
void beginRedirect( SvStream* pStream, const Rectangle& );
|
|
|
|
SvStream* endRedirect();
|
|
|
|
|
2002-07-08 13:18:58 +00:00
|
|
|
void endPage();
|
2002-10-23 17:30:55 +00:00
|
|
|
|
2004-09-08 15:22:06 +00:00
|
|
|
void beginStructureElementMCSeq();
|
|
|
|
void endStructureElementMCSeq();
|
|
|
|
/** checks whether a non struct element lies in the ancestor hierarchy
|
|
|
|
of the current structure element
|
|
|
|
|
|
|
|
@returns
|
|
|
|
<true/> if no NonStructElement was found in ancestor path and tagged
|
|
|
|
PDF output is enabled
|
|
|
|
<false/> else
|
|
|
|
*/
|
|
|
|
bool checkEmitStructure();
|
|
|
|
|
2002-10-23 17:30:55 +00:00
|
|
|
/* draws an emphasis mark */
|
2010-09-29 15:46:40 +08:00
|
|
|
void drawEmphasisMark( long nX, long nY, const PolyPolygon& rPolyPoly, sal_Bool bPolyLine, const Rectangle& rRect1, const Rectangle& rRect2 );
|
2006-07-13 10:17:26 +00:00
|
|
|
|
2007-11-20 16:11:48 +00:00
|
|
|
/* true if PDF/A-1a or PDF/A-1b is output */
|
2013-06-12 10:26:29 +09:00
|
|
|
bool m_bIsPDF_A1;
|
2010-08-16 20:31:58 +02:00
|
|
|
PDFWriter& m_rOuterFace;
|
2007-11-20 16:11:48 +00:00
|
|
|
|
2010-09-24 14:28:04 +02:00
|
|
|
/*
|
|
|
|
i12626
|
|
|
|
methods for PDF security
|
|
|
|
|
|
|
|
pad a password according algorithm 3.2, step 1 */
|
2013-04-07 12:06:47 +02:00
|
|
|
static void padPassword( const OUString& i_rPassword, sal_uInt8* o_pPaddedPW );
|
2010-09-24 14:28:04 +02:00
|
|
|
/* algorithm 3.2: compute an encryption key */
|
2010-09-27 19:58:20 +02:00
|
|
|
static bool computeEncryptionKey( EncHashTransporter*,
|
2010-09-24 14:28:04 +02:00
|
|
|
vcl::PDFWriter::PDFEncryptionProperties& io_rProperties,
|
|
|
|
sal_Int32 i_nAccessPermissions
|
|
|
|
);
|
|
|
|
/* algorithm 3.3: computing the encryption dictionary'ss owner password value ( /O ) */
|
|
|
|
static bool computeODictionaryValue( const sal_uInt8* i_pPaddedOwnerPassword, const sal_uInt8* i_pPaddedUserPassword,
|
2010-09-27 19:58:20 +02:00
|
|
|
std::vector< sal_uInt8 >& io_rOValue,
|
2010-09-28 18:39:54 +02:00
|
|
|
sal_Int32 i_nKeyLength
|
2010-09-24 14:28:04 +02:00
|
|
|
);
|
|
|
|
/* algorithm 3.4 or 3.5: computing the encryption dictionary's user password value ( /U ) revision 2 or 3 of the standard security handler */
|
2010-09-27 19:58:20 +02:00
|
|
|
static bool computeUDictionaryValue( EncHashTransporter* i_pTransporter,
|
2010-09-24 14:28:04 +02:00
|
|
|
vcl::PDFWriter::PDFEncryptionProperties& io_rProperties,
|
2010-09-28 18:39:54 +02:00
|
|
|
sal_Int32 i_nKeyLength,
|
2010-09-24 14:28:04 +02:00
|
|
|
sal_Int32 i_nAccessPermissions
|
|
|
|
);
|
|
|
|
|
|
|
|
static void computeDocumentIdentifier( std::vector< sal_uInt8 >& o_rIdentifier,
|
|
|
|
const vcl::PDFWriter::PDFDocInfo& i_rDocInfo,
|
2013-04-07 12:06:47 +02:00
|
|
|
OString& o_rCString1,
|
|
|
|
OString& o_rCString2
|
2010-09-24 14:28:04 +02:00
|
|
|
);
|
|
|
|
static sal_Int32 computeAccessPermissions( const vcl::PDFWriter::PDFEncryptionProperties& i_rProperties,
|
|
|
|
sal_Int32& o_rKeyLength, sal_Int32& o_rRC4KeyLength );
|
|
|
|
void setupDocInfo();
|
2010-09-27 19:58:20 +02:00
|
|
|
bool prepareEncryption( const com::sun::star::uno::Reference< com::sun::star::beans::XMaterialHolder >& );
|
2006-07-13 10:17:26 +00:00
|
|
|
|
2010-08-16 20:31:58 +02:00
|
|
|
// helper for playMetafile
|
2011-02-01 16:12:05 +01:00
|
|
|
void implWriteGradient( const PolyPolygon& rPolyPoly, const Gradient& rGradient,
|
|
|
|
VirtualDevice* pDummyVDev, const vcl::PDFWriter::PlayMetafileContext& );
|
2010-08-16 20:31:58 +02:00
|
|
|
void implWriteBitmapEx( const Point& rPoint, const Size& rSize, const BitmapEx& rBitmapEx,
|
|
|
|
VirtualDevice* pDummyVDev, const vcl::PDFWriter::PlayMetafileContext& );
|
|
|
|
|
2011-01-12 17:11:03 +01:00
|
|
|
// helpers for CCITT 1bit bitmap stream
|
|
|
|
void putG4Bits( sal_uInt32 i_nLength, sal_uInt32 i_nCode, BitStreamState& io_rState );
|
|
|
|
void putG4Span( long i_nSpan, bool i_bWhitePixel, BitStreamState& io_rState );
|
|
|
|
void writeG4Stream( BitmapReadAccess* i_pBitmap );
|
2011-01-17 16:24:56 +01:00
|
|
|
|
|
|
|
// color helper functions
|
2013-04-07 12:06:47 +02:00
|
|
|
void appendStrokingColor( const Color& rColor, OStringBuffer& rBuffer );
|
|
|
|
void appendNonStrokingColor( const Color& rColor, OStringBuffer& rBuffer );
|
2002-07-08 13:18:58 +00:00
|
|
|
public:
|
2010-10-21 17:32:19 +02:00
|
|
|
PDFWriterImpl( const PDFWriter::PDFWriterContext& rContext, const com::sun::star::uno::Reference< com::sun::star::beans::XMaterialHolder >&, PDFWriter& );
|
2002-07-08 13:18:58 +00:00
|
|
|
~PDFWriterImpl();
|
|
|
|
|
2010-09-27 19:58:20 +02:00
|
|
|
static com::sun::star::uno::Reference< com::sun::star::beans::XMaterialHolder >
|
2013-04-07 12:06:47 +02:00
|
|
|
initEncryption( const OUString& i_rOwnerPassword,
|
|
|
|
const OUString& i_rUserPassword,
|
2010-09-27 19:58:20 +02:00
|
|
|
bool b128Bit );
|
2010-09-24 14:28:04 +02:00
|
|
|
|
2002-10-23 17:30:55 +00:00
|
|
|
/* for documentation of public functions please see pdfwriter.hxx */
|
2002-07-08 13:18:58 +00:00
|
|
|
|
|
|
|
OutputDevice* getReferenceDevice();
|
|
|
|
|
|
|
|
/* document structure */
|
|
|
|
sal_Int32 newPage( sal_Int32 nPageWidth , sal_Int32 nPageHeight, PDFWriter::Orientation eOrientation );
|
|
|
|
bool emit();
|
2008-03-05 16:11:06 +00:00
|
|
|
std::set< PDFWriter::ErrorCode > getErrors();
|
2008-10-01 13:31:44 +00:00
|
|
|
void insertError( PDFWriter::ErrorCode eErr ) { m_aErrors.insert( eErr ); }
|
2010-08-16 20:31:58 +02:00
|
|
|
void playMetafile( const GDIMetaFile&, vcl::PDFExtOutDevData*, const vcl::PDFWriter::PlayMetafileContext&, VirtualDevice* pDummyDev = NULL );
|
2008-10-01 13:31:44 +00:00
|
|
|
|
|
|
|
Size getCurPageSize() const
|
|
|
|
{
|
|
|
|
Size aSize;
|
|
|
|
if( m_nCurrentPage >= 0 && m_nCurrentPage < (sal_Int32)m_aPages.size() )
|
|
|
|
aSize = Size( m_aPages[ m_nCurrentPage ].m_nPageWidth, m_aPages[ m_nCurrentPage ].m_nPageHeight );
|
|
|
|
return aSize;
|
|
|
|
}
|
2002-07-08 13:18:58 +00:00
|
|
|
|
2004-09-08 15:22:06 +00:00
|
|
|
PDFWriter::PDFVersion getVersion() const { return m_aContext.Version; }
|
2003-05-28 11:31:14 +00:00
|
|
|
|
2008-01-29 07:23:20 +00:00
|
|
|
void setDocumentLocale( const com::sun::star::lang::Locale& rLoc )
|
|
|
|
{ m_aContext.DocumentLocale = rLoc; }
|
|
|
|
|
2002-07-08 13:18:58 +00:00
|
|
|
|
|
|
|
/* graphics state */
|
2002-09-27 09:00:34 +00:00
|
|
|
void push( sal_uInt16 nFlags );
|
|
|
|
void pop();
|
2002-07-08 13:18:58 +00:00
|
|
|
|
2005-04-20 09:51:34 +00:00
|
|
|
void setFont( const Font& rFont );
|
2002-07-08 13:18:58 +00:00
|
|
|
|
2002-09-11 08:55:40 +00:00
|
|
|
void setMapMode( const MapMode& rMapMode );
|
2002-07-08 13:18:58 +00:00
|
|
|
|
|
|
|
|
|
|
|
const MapMode& getMapMode() { return m_aGraphicsStack.front().m_aMapMode; }
|
|
|
|
|
|
|
|
void setLineColor( const Color& rColor )
|
2005-03-29 11:57:34 +00:00
|
|
|
{
|
|
|
|
m_aGraphicsStack.front().m_aLineColor = ImplIsColorTransparent(rColor) ? Color( COL_TRANSPARENT ) : rColor;
|
|
|
|
m_aGraphicsStack.front().m_nUpdateFlags |= GraphicsState::updateLineColor;
|
|
|
|
}
|
2002-07-08 13:18:58 +00:00
|
|
|
|
|
|
|
void setFillColor( const Color& rColor )
|
2005-03-29 11:57:34 +00:00
|
|
|
{
|
|
|
|
m_aGraphicsStack.front().m_aFillColor = ImplIsColorTransparent(rColor) ? Color( COL_TRANSPARENT ) : rColor;
|
|
|
|
m_aGraphicsStack.front().m_nUpdateFlags |= GraphicsState::updateFillColor;
|
|
|
|
}
|
2002-07-08 13:18:58 +00:00
|
|
|
|
|
|
|
void setTextLineColor()
|
2005-03-29 11:57:34 +00:00
|
|
|
{
|
|
|
|
m_aGraphicsStack.front().m_aTextLineColor = Color( COL_TRANSPARENT );
|
|
|
|
m_aGraphicsStack.front().m_nUpdateFlags |= GraphicsState::updateTextLineColor;
|
|
|
|
}
|
2002-07-08 13:18:58 +00:00
|
|
|
|
|
|
|
void setTextLineColor( const Color& rColor )
|
2005-03-29 11:57:34 +00:00
|
|
|
{
|
|
|
|
m_aGraphicsStack.front().m_aTextLineColor = rColor;
|
|
|
|
m_aGraphicsStack.front().m_nUpdateFlags |= GraphicsState::updateTextLineColor;
|
|
|
|
}
|
2002-07-08 13:18:58 +00:00
|
|
|
|
2009-01-05 17:49:45 +00:00
|
|
|
void setOverlineColor()
|
|
|
|
{
|
|
|
|
m_aGraphicsStack.front().m_aOverlineColor = Color( COL_TRANSPARENT );
|
|
|
|
m_aGraphicsStack.front().m_nUpdateFlags |= GraphicsState::updateOverlineColor;
|
|
|
|
}
|
|
|
|
|
|
|
|
void setOverlineColor( const Color& rColor )
|
|
|
|
{
|
|
|
|
m_aGraphicsStack.front().m_aOverlineColor = rColor;
|
|
|
|
m_aGraphicsStack.front().m_nUpdateFlags |= GraphicsState::updateOverlineColor;
|
|
|
|
}
|
|
|
|
|
2002-07-08 13:18:58 +00:00
|
|
|
void setTextFillColor( const Color& rColor )
|
|
|
|
{
|
|
|
|
m_aGraphicsStack.front().m_aFont.SetFillColor( rColor );
|
2010-09-29 15:46:40 +08:00
|
|
|
m_aGraphicsStack.front().m_aFont.SetTransparent( ImplIsColorTransparent( rColor ) ? sal_True : sal_False );
|
2005-03-29 11:57:34 +00:00
|
|
|
m_aGraphicsStack.front().m_nUpdateFlags |= GraphicsState::updateFont;
|
2002-07-08 13:18:58 +00:00
|
|
|
}
|
|
|
|
void setTextFillColor()
|
|
|
|
{
|
|
|
|
m_aGraphicsStack.front().m_aFont.SetFillColor( Color( COL_TRANSPARENT ) );
|
2010-09-29 15:46:40 +08:00
|
|
|
m_aGraphicsStack.front().m_aFont.SetTransparent( sal_True );
|
2005-03-29 11:57:34 +00:00
|
|
|
m_aGraphicsStack.front().m_nUpdateFlags |= GraphicsState::updateFont;
|
2002-07-08 13:18:58 +00:00
|
|
|
}
|
|
|
|
void setTextColor( const Color& rColor )
|
2005-03-29 11:57:34 +00:00
|
|
|
{
|
|
|
|
m_aGraphicsStack.front().m_aFont.SetColor( rColor );
|
|
|
|
m_aGraphicsStack.front().m_nUpdateFlags |= GraphicsState::updateFont;
|
|
|
|
}
|
2002-07-08 13:18:58 +00:00
|
|
|
|
|
|
|
void clearClipRegion()
|
2005-03-29 11:57:34 +00:00
|
|
|
{
|
2010-01-19 18:33:02 +01:00
|
|
|
m_aGraphicsStack.front().m_aClipRegion.clear();
|
|
|
|
m_aGraphicsStack.front().m_bClipRegion = false;
|
2005-03-29 11:57:34 +00:00
|
|
|
m_aGraphicsStack.front().m_nUpdateFlags |= GraphicsState::updateClipRegion;
|
|
|
|
}
|
2002-07-08 13:18:58 +00:00
|
|
|
|
2010-01-19 18:33:02 +01:00
|
|
|
void setClipRegion( const basegfx::B2DPolyPolygon& rRegion );
|
2002-07-08 13:18:58 +00:00
|
|
|
|
2002-09-19 10:47:41 +00:00
|
|
|
void moveClipRegion( sal_Int32 nX, sal_Int32 nY );
|
2002-07-08 13:18:58 +00:00
|
|
|
|
2002-09-19 10:47:41 +00:00
|
|
|
bool intersectClipRegion( const Rectangle& rRect );
|
2002-07-08 13:18:58 +00:00
|
|
|
|
2010-01-19 18:33:02 +01:00
|
|
|
bool intersectClipRegion( const basegfx::B2DPolyPolygon& rRegion );
|
2002-07-08 13:18:58 +00:00
|
|
|
|
|
|
|
void setLayoutMode( sal_Int32 nLayoutMode )
|
2005-03-29 11:57:34 +00:00
|
|
|
{
|
|
|
|
m_aGraphicsStack.front().m_nLayoutMode = nLayoutMode;
|
|
|
|
m_aGraphicsStack.front().m_nUpdateFlags |= GraphicsState::updateLayoutMode;
|
|
|
|
}
|
2002-07-08 13:18:58 +00:00
|
|
|
|
2006-01-26 17:09:36 +00:00
|
|
|
void setDigitLanguage( LanguageType eLang )
|
|
|
|
{
|
|
|
|
m_aGraphicsStack.front().m_aDigitLanguage = eLang;
|
|
|
|
m_aGraphicsStack.front().m_nUpdateFlags |= GraphicsState::updateDigitLanguage;
|
|
|
|
}
|
|
|
|
|
2002-07-08 13:18:58 +00:00
|
|
|
void setTextAlign( TextAlign eAlign )
|
2005-03-29 11:57:34 +00:00
|
|
|
{
|
|
|
|
m_aGraphicsStack.front().m_aFont.SetAlign( eAlign );
|
|
|
|
m_aGraphicsStack.front().m_nUpdateFlags |= GraphicsState::updateFont;
|
|
|
|
}
|
2002-07-08 13:18:58 +00:00
|
|
|
|
|
|
|
/* actual drawing functions */
|
2013-07-30 13:08:03 +02:00
|
|
|
void drawText( const Point& rPos, const OUString& rText, xub_StrLen nIndex = 0, xub_StrLen nLen = STRING_LEN, bool bTextLines = true );
|
|
|
|
void drawTextArray( const Point& rPos, const OUString& rText, const sal_Int32* pDXArray = NULL, xub_StrLen nIndex = 0, xub_StrLen nLen = STRING_LEN, bool bTextLines = true );
|
|
|
|
void drawStretchText( const Point& rPos, sal_uLong nWidth, const OUString& rText,
|
2002-10-08 18:38:58 +00:00
|
|
|
xub_StrLen nIndex = 0, xub_StrLen nLen = STRING_LEN,
|
|
|
|
bool bTextLines = true );
|
2013-07-30 13:08:03 +02:00
|
|
|
void drawText( const Rectangle& rRect, const OUString& rOrigStr, sal_uInt16 nStyle, bool bTextLines = true );
|
2009-01-05 17:49:45 +00:00
|
|
|
void drawTextLine( const Point& rPos, long nWidth, FontStrikeout eStrikeout, FontUnderline eUnderline, FontUnderline eOverline, bool bUnderlineAbove );
|
2013-04-07 12:06:47 +02:00
|
|
|
void drawWaveTextLine( OStringBuffer& aLine, long nWidth, FontUnderline eTextLine, Color aColor, bool bIsAbove );
|
|
|
|
void drawStraightTextLine( OStringBuffer& aLine, long nWidth, FontUnderline eTextLine, Color aColor, bool bIsAbove );
|
|
|
|
void drawStrikeoutLine( OStringBuffer& aLine, long nWidth, FontStrikeout eStrikeout, Color aColor );
|
2009-01-05 17:49:45 +00:00
|
|
|
void drawStrikeoutChar( const Point& rPos, long nWidth, FontStrikeout eStrikeout );
|
2002-07-08 13:18:58 +00:00
|
|
|
|
|
|
|
void drawLine( const Point& rStart, const Point& rStop );
|
|
|
|
void drawLine( const Point& rStart, const Point& rStop, const LineInfo& rInfo );
|
|
|
|
void drawPolygon( const Polygon& rPoly );
|
|
|
|
void drawPolyPolygon( const PolyPolygon& rPolyPoly );
|
|
|
|
void drawPolyLine( const Polygon& rPoly );
|
|
|
|
void drawPolyLine( const Polygon& rPoly, const LineInfo& rInfo );
|
2004-10-28 09:33:41 +00:00
|
|
|
void drawPolyLine( const Polygon& rPoly, const PDFWriter::ExtLineInfo& rInfo );
|
2002-07-08 13:18:58 +00:00
|
|
|
|
|
|
|
void drawPixel( const Point& rPt, const Color& rColor );
|
|
|
|
|
|
|
|
void drawRectangle( const Rectangle& rRect );
|
|
|
|
void drawRectangle( const Rectangle& rRect, sal_uInt32 nHorzRound, sal_uInt32 nVertRound );
|
|
|
|
void drawEllipse( const Rectangle& rRect );
|
|
|
|
void drawArc( const Rectangle& rRect, const Point& rStart, const Point& rStop, bool bWithPie, bool bWidthChord );
|
|
|
|
|
|
|
|
void drawBitmap( const Point& rDestPoint, const Size& rDestSize, const Bitmap& rBitmap );
|
|
|
|
void drawBitmap( const Point& rDestPoint, const Size& rDestSize, const BitmapEx& rBitmap );
|
2005-07-06 08:20:47 +00:00
|
|
|
void drawJPGBitmap( SvStream& rDCTData, bool bIsTrueColor, const Size& rSizePixel, const Rectangle& rTargetArea, const Bitmap& rMask );
|
2002-09-11 12:38:55 +00:00
|
|
|
|
2002-07-08 13:18:58 +00:00
|
|
|
void drawGradient( const Rectangle& rRect, const Gradient& rGradient );
|
|
|
|
void drawHatch( const PolyPolygon& rPolyPoly, const Hatch& rHatch );
|
|
|
|
void drawWallpaper( const Rectangle& rRect, const Wallpaper& rWall );
|
|
|
|
void drawTransparent( const PolyPolygon& rPolyPoly, sal_uInt32 nTransparentPercent );
|
2004-09-08 15:22:06 +00:00
|
|
|
void beginTransparencyGroup();
|
|
|
|
void endTransparencyGroup( const Rectangle& rBoundingBox, sal_uInt32 nTransparentPercent );
|
|
|
|
|
|
|
|
void emitComment( const char* pComment );
|
|
|
|
|
2007-11-20 16:11:48 +00:00
|
|
|
//--->i56629 named destinations
|
2013-04-07 12:06:47 +02:00
|
|
|
sal_Int32 createNamedDest( const OUString& sDestName, const Rectangle& rRect, sal_Int32 nPageNr = -1, PDFWriter::DestAreaType eType = PDFWriter::XYZ );
|
2007-11-20 16:11:48 +00:00
|
|
|
|
|
|
|
//--->i59651
|
|
|
|
//emits output intent
|
|
|
|
sal_Int32 emitOutputIntent();
|
|
|
|
|
|
|
|
//emits the document metadata
|
|
|
|
sal_Int32 emitDocumentMetadata();
|
|
|
|
|
2004-09-08 15:22:06 +00:00
|
|
|
// links
|
|
|
|
sal_Int32 createLink( const Rectangle& rRect, sal_Int32 nPageNr = -1 );
|
|
|
|
sal_Int32 createDest( const Rectangle& rRect, sal_Int32 nPageNr = -1, PDFWriter::DestAreaType eType = PDFWriter::XYZ );
|
2010-12-01 09:57:05 +01:00
|
|
|
sal_Int32 registerDestReference( sal_Int32 nDestId, const Rectangle& rRect, sal_Int32 nPageNr = -1, PDFWriter::DestAreaType eType = PDFWriter::XYZ );
|
2004-09-08 15:22:06 +00:00
|
|
|
sal_Int32 setLinkDest( sal_Int32 nLinkId, sal_Int32 nDestId );
|
2013-04-07 12:06:47 +02:00
|
|
|
sal_Int32 setLinkURL( sal_Int32 nLinkId, const OUString& rURL );
|
2004-09-08 15:22:06 +00:00
|
|
|
void setLinkPropertyId( sal_Int32 nLinkId, sal_Int32 nPropertyId );
|
|
|
|
|
|
|
|
// outline
|
2013-04-07 12:06:47 +02:00
|
|
|
sal_Int32 createOutlineItem( sal_Int32 nParent = 0, const OUString& rText = OUString(), sal_Int32 nDestID = -1 );
|
2004-09-08 15:22:06 +00:00
|
|
|
sal_Int32 setOutlineItemParent( sal_Int32 nItem, sal_Int32 nNewParent );
|
2013-04-07 12:06:47 +02:00
|
|
|
sal_Int32 setOutlineItemText( sal_Int32 nItem, const OUString& rText );
|
2004-09-08 15:22:06 +00:00
|
|
|
sal_Int32 setOutlineItemDest( sal_Int32 nItem, sal_Int32 nDestID );
|
|
|
|
|
|
|
|
// notes
|
|
|
|
void createNote( const Rectangle& rRect, const PDFNote& rNote, sal_Int32 nPageNr = -1 );
|
|
|
|
// structure elements
|
2013-04-07 12:06:47 +02:00
|
|
|
sal_Int32 beginStructureElement( PDFWriter::StructElement eType, const OUString& rAlias );
|
2004-09-08 15:22:06 +00:00
|
|
|
void endStructureElement();
|
|
|
|
bool setCurrentStructureElement( sal_Int32 nElement );
|
|
|
|
bool setStructureAttribute( enum PDFWriter::StructAttribute eAttr, enum PDFWriter::StructAttributeValue eVal );
|
|
|
|
bool setStructureAttributeNumerical( enum PDFWriter::StructAttribute eAttr, sal_Int32 nValue );
|
|
|
|
void setStructureBoundingBox( const Rectangle& rRect );
|
2013-07-30 13:08:03 +02:00
|
|
|
void setActualText( const OUString& rText );
|
|
|
|
void setAlternateText( const OUString& rText );
|
2004-09-08 15:22:06 +00:00
|
|
|
|
|
|
|
// transitional effects
|
|
|
|
void setAutoAdvanceTime( sal_uInt32 nSeconds, sal_Int32 nPageNr = -1 );
|
|
|
|
void setPageTransition( PDFWriter::PageTransition eType, sal_uInt32 nMilliSec, sal_Int32 nPageNr = -1 );
|
|
|
|
|
|
|
|
// controls
|
|
|
|
sal_Int32 createControl( const PDFWriter::AnyWidget& rControl, sal_Int32 nPageNr = -1 );
|
|
|
|
|
2007-03-26 10:21:27 +00:00
|
|
|
// additional streams
|
2013-07-30 13:08:03 +02:00
|
|
|
void addStream( const OUString& rMimeType, PDFOutputStream* pStream, bool bCompress );
|
2007-03-26 10:21:27 +00:00
|
|
|
|
2004-09-08 15:22:06 +00:00
|
|
|
// helper: eventually begin marked content sequence and
|
|
|
|
// emit a comment in debug case
|
2006-06-19 18:30:07 +00:00
|
|
|
void MARK( const char*
|
|
|
|
#if OSL_DEBUG_LEVEL > 1
|
|
|
|
pString
|
|
|
|
#endif
|
|
|
|
)
|
2004-09-08 15:22:06 +00:00
|
|
|
{
|
|
|
|
beginStructureElementMCSeq();
|
|
|
|
#if OSL_DEBUG_LEVEL > 1
|
|
|
|
emitComment( pString );
|
|
|
|
#endif
|
|
|
|
}
|
2002-07-08 13:18:58 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif //_VCL_PDFEXPORT_HXX
|
2007-11-23 09:44:53 +00:00
|
|
|
|
|
|
|
|
2010-10-14 08:27:31 +02:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|