merge the formfield patch from ooo-build
[ooovba.git] / sdext / source / pdfimport / inc / contentsink.hxx
blobb902252676b9bfc614fffe7cea7875070aaffa5b
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: contentsink.hxx,v $
11 * $Revision: 1.2 $
13 * This file is part of OpenOffice.org.
15 * OpenOffice.org is free software: you can redistribute it and/or modify
16 * it under the terms of the GNU Lesser General Public License version 3
17 * only, as published by the Free Software Foundation.
19 * OpenOffice.org is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU Lesser General Public License version 3 for more details
23 * (a copy is included in the LICENSE file that accompanied this code).
25 * You should have received a copy of the GNU Lesser General Public License
26 * version 3 along with OpenOffice.org. If not, see
27 * <http://www.openoffice.org/license.html>
28 * for a copy of the LGPLv3 License.
30 ************************************************************************/
32 #ifndef INCLUDED_PDFI_CONTENTSINK_HXX
33 #define INCLUDED_PDFI_CONTENTSINK_HXX
35 #include <com/sun/star/uno/Reference.hxx>
36 #include <com/sun/star/uno/Sequence.hxx>
37 #include <com/sun/star/rendering/ARGBColor.hpp>
38 #include <boost/shared_ptr.hpp>
40 namespace rtl { class OUString; }
41 namespace com { namespace sun { namespace star {
42 namespace rendering
44 class XPolyPolygon2D;
46 namespace geometry
48 struct Matrix2D;
49 struct AffineMatrix2D;
50 struct RealRectangle2D;
51 struct RealPoint2D;
52 struct RealSize2D;
54 namespace beans
56 struct PropertyValue;
57 } } } }
59 namespace pdfi
61 struct FontAttributes
63 FontAttributes( const rtl::OUString& familyName_,
64 bool isBold_,
65 bool isItalic_,
66 bool isUnderline_,
67 bool isOutline_,
68 double size_ ) :
69 familyName(familyName_),
70 isBold(isBold_),
71 isItalic(isItalic_),
72 isUnderline(isUnderline_),
73 isOutline(isOutline_),
74 size(size_)
77 FontAttributes() :
78 familyName(),
79 isBold(false),
80 isItalic(false),
81 isUnderline(false),
82 isOutline(false),
83 size(0.0)
86 ::rtl::OUString familyName;
87 bool isBold;
88 bool isItalic;
89 bool isUnderline;
90 bool isOutline;
91 double size; // device pixel
93 bool operator==(const FontAttributes& rFont) const
95 return familyName == rFont.familyName &&
96 !isBold == !rFont.isBold &&
97 !isItalic == !rFont.isItalic &&
98 !isUnderline == !rFont.isUnderline &&
99 !isOutline == !rFont.isOutline &&
100 size == rFont.size;
104 /** (preliminary) API wrapper around xpdf
106 Wraps the functionality currently used from xpdf's OutputDev
107 interface. Subject to change.
109 struct ContentSink
111 virtual ~ContentSink() {}
113 /// Total number of pages for upcoming document
114 virtual void setPageNum( sal_Int32 nNumPages ) = 0;
115 virtual void startPage( const ::com::sun::star::geometry::RealSize2D& rSize ) = 0;
116 virtual void endPage() = 0;
118 virtual void hyperLink( const ::com::sun::star::geometry::RealRectangle2D& rBounds,
119 const ::rtl::OUString& rURI ) = 0;
121 virtual void pushState() = 0;
122 virtual void popState() = 0;
124 virtual void setFlatness( double ) = 0;
125 virtual void setTransformation( const ::com::sun::star::geometry::AffineMatrix2D& rMatrix ) = 0;
126 virtual void setLineDash( const ::com::sun::star::uno::Sequence<double>& dashes,
127 double start ) = 0;
128 virtual void setLineJoin( sal_Int8 lineJoin ) = 0;
129 virtual void setLineCap( sal_Int8 lineCap ) = 0;
130 virtual void setMiterLimit(double) = 0;
131 virtual void setLineWidth(double) = 0;
132 virtual void setFillColor( const ::com::sun::star::rendering::ARGBColor& rColor ) = 0;
133 virtual void setStrokeColor( const ::com::sun::star::rendering::ARGBColor& rColor ) = 0;
134 virtual void setBlendMode( sal_Int8 blendMode ) = 0;
135 virtual void setFont( const FontAttributes& rFont ) = 0;
136 virtual void setTextRenderMode( sal_Int32 ) = 0;
139 virtual void strokePath( const ::com::sun::star::uno::Reference<
140 ::com::sun::star::rendering::XPolyPolygon2D >& rPath ) = 0;
141 virtual void fillPath( const ::com::sun::star::uno::Reference<
142 ::com::sun::star::rendering::XPolyPolygon2D >& rPath ) = 0;
143 virtual void eoFillPath( const ::com::sun::star::uno::Reference<
144 ::com::sun::star::rendering::XPolyPolygon2D >& rPath ) = 0;
146 virtual void intersectClip(const ::com::sun::star::uno::Reference<
147 ::com::sun::star::rendering::XPolyPolygon2D >& rPath) = 0;
148 virtual void intersectEoClip(const ::com::sun::star::uno::Reference<
149 ::com::sun::star::rendering::XPolyPolygon2D >& rPath) = 0;
151 virtual void drawGlyphs( const rtl::OUString& rGlyphs,
152 const ::com::sun::star::geometry::RealRectangle2D& rRect,
153 const ::com::sun::star::geometry::Matrix2D& rFontMatrix ) = 0;
155 /// issued when a sequence of associated glyphs is drawn
156 virtual void endText() = 0;
158 /// draws given bitmap as a mask (using current fill color)
159 virtual void drawMask(const ::com::sun::star::uno::Sequence<
160 ::com::sun::star::beans::PropertyValue>& xBitmap,
161 bool bInvert ) = 0;
162 /// Given image must already be color-mapped and normalized to sRGB.
163 virtual void drawImage(const ::com::sun::star::uno::Sequence<
164 ::com::sun::star::beans::PropertyValue>& xBitmap ) = 0;
165 /** Given image must already be color-mapped and normalized to sRGB.
167 maskColors must contain two sequences of color components
169 virtual void drawColorMaskedImage(const ::com::sun::star::uno::Sequence<
170 ::com::sun::star::beans::PropertyValue>& xBitmap,
171 const ::com::sun::star::uno::Sequence<
172 ::com::sun::star::uno::Any>& xMaskColors ) = 0;
173 virtual void drawMaskedImage(const ::com::sun::star::uno::Sequence<
174 ::com::sun::star::beans::PropertyValue>& xBitmap,
175 const ::com::sun::star::uno::Sequence<
176 ::com::sun::star::beans::PropertyValue>& xMask,
177 bool bInvertMask) = 0;
178 virtual void drawAlphaMaskedImage(const ::com::sun::star::uno::Sequence<
179 ::com::sun::star::beans::PropertyValue>& xImage,
180 const ::com::sun::star::uno::Sequence<
181 ::com::sun::star::beans::PropertyValue>& xMask) = 0;
184 typedef boost::shared_ptr<ContentSink> ContentSinkSharedPtr;
187 #endif /* INCLUDED_PDFI_CONTENTSINK_HXX */