bump product version to 4.1.6.2
[LibreOffice.git] / sdext / source / pdfimport / inc / contentsink.hxx
blob3470ebcfacee0101d3d96ad2846eb73487aa4445
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_PDFI_CONTENTSINK_HXX
21 #define INCLUDED_PDFI_CONTENTSINK_HXX
23 #include <com/sun/star/uno/Reference.hxx>
24 #include <com/sun/star/uno/Sequence.hxx>
25 #include <com/sun/star/rendering/ARGBColor.hpp>
26 #include <boost/shared_ptr.hpp>
28 namespace com { namespace sun { namespace star {
29 namespace rendering
31 class XPolyPolygon2D;
33 namespace geometry
35 struct Matrix2D;
36 struct AffineMatrix2D;
37 struct RealRectangle2D;
38 struct RealPoint2D;
39 struct RealSize2D;
41 namespace beans
43 struct PropertyValue;
44 } } } }
46 namespace pdfi
48 struct FontAttributes
50 FontAttributes( const OUString& familyName_,
51 bool isBold_,
52 bool isItalic_,
53 bool isUnderline_,
54 bool isOutline_,
55 double size_ ) :
56 familyName(familyName_),
57 isBold(isBold_),
58 isItalic(isItalic_),
59 isUnderline(isUnderline_),
60 isOutline(isOutline_),
61 size(size_)
64 FontAttributes() :
65 familyName(),
66 isBold(false),
67 isItalic(false),
68 isUnderline(false),
69 isOutline(false),
70 size(0.0)
73 OUString familyName;
74 bool isBold;
75 bool isItalic;
76 bool isUnderline;
77 bool isOutline;
78 double size; // device pixel
80 bool operator==(const FontAttributes& rFont) const
82 return familyName == rFont.familyName &&
83 !isBold == !rFont.isBold &&
84 !isItalic == !rFont.isItalic &&
85 !isUnderline == !rFont.isUnderline &&
86 !isOutline == !rFont.isOutline &&
87 size == rFont.size;
91 /** (preliminary) API wrapper around xpdf
93 Wraps the functionality currently used from xpdf's OutputDev
94 interface. Subject to change.
96 struct ContentSink
98 virtual ~ContentSink() {}
100 /// Total number of pages for upcoming document
101 virtual void setPageNum( sal_Int32 nNumPages ) = 0;
102 virtual void startPage( const ::com::sun::star::geometry::RealSize2D& rSize ) = 0;
103 virtual void endPage() = 0;
105 virtual void hyperLink( const ::com::sun::star::geometry::RealRectangle2D& rBounds,
106 const OUString& rURI ) = 0;
108 virtual void pushState() = 0;
109 virtual void popState() = 0;
111 virtual void setFlatness( double ) = 0;
112 virtual void setTransformation( const ::com::sun::star::geometry::AffineMatrix2D& rMatrix ) = 0;
113 virtual void setLineDash( const ::com::sun::star::uno::Sequence<double>& dashes,
114 double start ) = 0;
115 virtual void setLineJoin( sal_Int8 lineJoin ) = 0;
116 virtual void setLineCap( sal_Int8 lineCap ) = 0;
117 virtual void setMiterLimit(double) = 0;
118 virtual void setLineWidth(double) = 0;
119 virtual void setFillColor( const ::com::sun::star::rendering::ARGBColor& rColor ) = 0;
120 virtual void setStrokeColor( const ::com::sun::star::rendering::ARGBColor& rColor ) = 0;
121 virtual void setBlendMode( sal_Int8 blendMode ) = 0;
122 virtual void setFont( const FontAttributes& rFont ) = 0;
123 virtual void setTextRenderMode( sal_Int32 ) = 0;
126 virtual void strokePath( const ::com::sun::star::uno::Reference<
127 ::com::sun::star::rendering::XPolyPolygon2D >& rPath ) = 0;
128 virtual void fillPath( const ::com::sun::star::uno::Reference<
129 ::com::sun::star::rendering::XPolyPolygon2D >& rPath ) = 0;
130 virtual void eoFillPath( const ::com::sun::star::uno::Reference<
131 ::com::sun::star::rendering::XPolyPolygon2D >& rPath ) = 0;
133 virtual void intersectClip(const ::com::sun::star::uno::Reference<
134 ::com::sun::star::rendering::XPolyPolygon2D >& rPath) = 0;
135 virtual void intersectEoClip(const ::com::sun::star::uno::Reference<
136 ::com::sun::star::rendering::XPolyPolygon2D >& rPath) = 0;
138 virtual void drawGlyphs( const OUString& rGlyphs,
139 const ::com::sun::star::geometry::RealRectangle2D& rRect,
140 const ::com::sun::star::geometry::Matrix2D& rFontMatrix ) = 0;
142 /// issued when a sequence of associated glyphs is drawn
143 virtual void endText() = 0;
145 /// draws given bitmap as a mask (using current fill color)
146 virtual void drawMask(const ::com::sun::star::uno::Sequence<
147 ::com::sun::star::beans::PropertyValue>& xBitmap,
148 bool bInvert ) = 0;
149 /// Given image must already be color-mapped and normalized to sRGB.
150 virtual void drawImage(const ::com::sun::star::uno::Sequence<
151 ::com::sun::star::beans::PropertyValue>& xBitmap ) = 0;
152 /** Given image must already be color-mapped and normalized to sRGB.
154 maskColors must contain two sequences of color components
156 virtual void drawColorMaskedImage(const ::com::sun::star::uno::Sequence<
157 ::com::sun::star::beans::PropertyValue>& xBitmap,
158 const ::com::sun::star::uno::Sequence<
159 ::com::sun::star::uno::Any>& xMaskColors ) = 0;
160 virtual void drawMaskedImage(const ::com::sun::star::uno::Sequence<
161 ::com::sun::star::beans::PropertyValue>& xBitmap,
162 const ::com::sun::star::uno::Sequence<
163 ::com::sun::star::beans::PropertyValue>& xMask,
164 bool bInvertMask) = 0;
165 virtual void drawAlphaMaskedImage(const ::com::sun::star::uno::Sequence<
166 ::com::sun::star::beans::PropertyValue>& xImage,
167 const ::com::sun::star::uno::Sequence<
168 ::com::sun::star::beans::PropertyValue>& xMask) = 0;
171 typedef boost::shared_ptr<ContentSink> ContentSinkSharedPtr;
174 #endif /* INCLUDED_PDFI_CONTENTSINK_HXX */
176 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */