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_SDEXT_SOURCE_PDFIMPORT_INC_CONTENTSINK_HXX
21 #define INCLUDED_SDEXT_SOURCE_PDFIMPORT_INC_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_
,
57 familyName(familyName_
),
60 isUnderline(isUnderline_
),
61 isOutline(isOutline_
),
81 double size
; // device pixel
84 bool operator==(const FontAttributes
& rFont
) const
86 return familyName
== rFont
.familyName
&&
87 !isBold
== !rFont
.isBold
&&
88 !isItalic
== !rFont
.isItalic
&&
89 !isUnderline
== !rFont
.isUnderline
&&
90 !isOutline
== !rFont
.isOutline
&&
92 ascent
== rFont
.ascent
;
96 /** (preliminary) API wrapper around xpdf
98 Wraps the functionality currently used from xpdf's OutputDev
99 interface. Subject to change.
103 virtual ~ContentSink() {}
105 /// Total number of pages for upcoming document
106 virtual void setPageNum( sal_Int32 nNumPages
) = 0;
107 virtual void startPage( const css::geometry::RealSize2D
& rSize
) = 0;
108 virtual void endPage() = 0;
110 virtual void hyperLink( const css::geometry::RealRectangle2D
& rBounds
,
111 const OUString
& rURI
) = 0;
113 virtual void pushState() = 0;
114 virtual void popState() = 0;
116 virtual void setFlatness( double ) = 0;
117 virtual void setTransformation( const css::geometry::AffineMatrix2D
& rMatrix
) = 0;
118 virtual void setLineDash( const css::uno::Sequence
<double>& dashes
,
120 virtual void setLineJoin( sal_Int8 lineJoin
) = 0;
121 virtual void setLineCap( sal_Int8 lineCap
) = 0;
122 virtual void setMiterLimit(double) = 0;
123 virtual void setLineWidth(double) = 0;
124 virtual void setFillColor( const css::rendering::ARGBColor
& rColor
) = 0;
125 virtual void setStrokeColor( const css::rendering::ARGBColor
& rColor
) = 0;
126 virtual void setBlendMode( sal_Int8 blendMode
) = 0;
127 virtual void setFont( const FontAttributes
& rFont
) = 0;
128 virtual void setTextRenderMode( sal_Int32
) = 0;
131 virtual void strokePath( const css::uno::Reference
<
132 css::rendering::XPolyPolygon2D
>& rPath
) = 0;
133 virtual void fillPath( const css::uno::Reference
<
134 css::rendering::XPolyPolygon2D
>& rPath
) = 0;
135 virtual void eoFillPath( const css::uno::Reference
<
136 css::rendering::XPolyPolygon2D
>& rPath
) = 0;
138 virtual void intersectClip(const css::uno::Reference
<
139 css::rendering::XPolyPolygon2D
>& rPath
) = 0;
140 virtual void intersectEoClip(const css::uno::Reference
<
141 css::rendering::XPolyPolygon2D
>& rPath
) = 0;
143 virtual void drawGlyphs( const OUString
& rGlyphs
,
144 const css::geometry::RealRectangle2D
& rRect
,
145 const css::geometry::Matrix2D
& rFontMatrix
,
146 double fontSize
) = 0;
148 /// issued when a sequence of associated glyphs is drawn
149 virtual void endText() = 0;
151 /// draws given bitmap as a mask (using current fill color)
152 virtual void drawMask(const css::uno::Sequence
<
153 css::beans::PropertyValue
>& xBitmap
,
155 /// Given image must already be color-mapped and normalized to sRGB.
156 virtual void drawImage(const css::uno::Sequence
<
157 css::beans::PropertyValue
>& xBitmap
) = 0;
158 /** Given image must already be color-mapped and normalized to sRGB.
160 maskColors must contain two sequences of color components
162 virtual void drawColorMaskedImage(const css::uno::Sequence
<
163 css::beans::PropertyValue
>& xBitmap
,
164 const css::uno::Sequence
<
165 css::uno::Any
>& xMaskColors
) = 0;
166 virtual void drawMaskedImage(const css::uno::Sequence
<
167 css::beans::PropertyValue
>& xBitmap
,
168 const css::uno::Sequence
<
169 css::beans::PropertyValue
>& xMask
,
170 bool bInvertMask
) = 0;
171 virtual void drawAlphaMaskedImage(const css::uno::Sequence
<
172 css::beans::PropertyValue
>& xImage
,
173 const css::uno::Sequence
<
174 css::beans::PropertyValue
>& xMask
) = 0;
177 typedef boost::shared_ptr
<ContentSink
> ContentSinkSharedPtr
;
180 #endif // INCLUDED_SDEXT_SOURCE_PDFIMPORT_INC_CONTENTSINK_HXX
182 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */