1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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
{
36 struct AffineMatrix2D
;
37 struct RealRectangle2D
;
50 FontAttributes( const OUString
& familyName_
,
56 familyName(familyName_
),
59 isUnderline(isUnderline_
),
60 isOutline(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
&&
91 /** (preliminary) API wrapper around xpdf
93 Wraps the functionality currently used from xpdf's OutputDev
94 interface. Subject to change.
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
,
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
,
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: */