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 <basegfx/vector/b2enums.hxx>
24 #include <com/sun/star/uno/Reference.hxx>
25 #include <com/sun/star/uno/Sequence.hxx>
26 #include <com/sun/star/rendering/ARGBColor.hpp>
29 namespace com::sun::star
{
37 struct AffineMatrix2D
;
38 struct RealRectangle2D
;
52 FontAttributes( OUString familyName_
,
58 familyName(std::move(familyName_
)),
59 fontWeight(std::move(sFontWeight
)),
61 isUnderline(isUnderline_
),
69 fontWeight(u
"normal"_ustr
),
82 double size
; // device pixel
85 bool operator==(const FontAttributes
& rFont
) const
87 return familyName
== rFont
.familyName
&&
88 fontWeight
== rFont
.fontWeight
&&
89 !isItalic
== !rFont
.isItalic
&&
90 !isUnderline
== !rFont
.isUnderline
&&
91 !isOutline
== !rFont
.isOutline
&&
93 ascent
== rFont
.ascent
;
97 /** (preliminary) API wrapper around xpdf
99 Wraps the functionality currently used from xpdf's OutputDev
100 interface. Subject to change.
104 virtual ~ContentSink() {}
106 /// Total number of pages for upcoming document
107 virtual void setPageNum( sal_Int32 nNumPages
) = 0;
108 virtual void startPage( const css::geometry::RealSize2D
& rSize
) = 0;
109 virtual void endPage() = 0;
111 virtual void hyperLink( const css::geometry::RealRectangle2D
& rBounds
,
112 const OUString
& rURI
) = 0;
114 virtual void pushState() = 0;
115 virtual void popState() = 0;
117 virtual void setFlatness( double ) = 0;
118 virtual void setTransformation( const css::geometry::AffineMatrix2D
& rMatrix
) = 0;
119 virtual void setLineDash( const css::uno::Sequence
<double>& dashes
,
121 virtual void setLineJoin( basegfx::B2DLineJoin lineJoin
) = 0;
122 virtual void setLineCap( sal_Int8 lineCap
) = 0;
123 virtual void setMiterLimit(double) = 0;
124 virtual void setLineWidth(double) = 0;
125 virtual void setFillColor( const css::rendering::ARGBColor
& rColor
) = 0;
126 virtual void setStrokeColor( const css::rendering::ARGBColor
& rColor
) = 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 intersectClipToStroke(const css::uno::Reference
<
141 css::rendering::XPolyPolygon2D
>& rPath
) = 0;
142 virtual void intersectEoClip(const css::uno::Reference
<
143 css::rendering::XPolyPolygon2D
>& rPath
) = 0;
145 virtual void drawGlyphs( const OUString
& rGlyphs
,
146 const css::geometry::RealRectangle2D
& rRect
,
147 const css::geometry::Matrix2D
& rFontMatrix
,
148 double fontSize
) = 0;
150 /// issued when a sequence of associated glyphs is drawn
151 virtual void endText() = 0;
153 /// draws given bitmap as a mask (using current fill color)
154 virtual void drawMask(const css::uno::Sequence
<
155 css::beans::PropertyValue
>& xBitmap
,
157 /// Given image must already be color-mapped and normalized to sRGB.
158 virtual void drawImage(const css::uno::Sequence
<
159 css::beans::PropertyValue
>& xBitmap
) = 0;
160 /** Given image must already be color-mapped and normalized to sRGB.
162 maskColors must contain two sequences of color components
164 virtual void drawColorMaskedImage(const css::uno::Sequence
<
165 css::beans::PropertyValue
>& xBitmap
,
166 const css::uno::Sequence
<
167 css::uno::Any
>& xMaskColors
) = 0;
168 virtual void drawMaskedImage(const css::uno::Sequence
<
169 css::beans::PropertyValue
>& xBitmap
,
170 const css::uno::Sequence
<
171 css::beans::PropertyValue
>& xMask
,
172 bool bInvertMask
) = 0;
173 virtual void drawAlphaMaskedImage(const css::uno::Sequence
<
174 css::beans::PropertyValue
>& xImage
,
175 const css::uno::Sequence
<
176 css::beans::PropertyValue
>& xMask
) = 0;
177 virtual void tilingPatternFill(int nX0
, int nY0
, int nX1
, int nY1
,
178 double nxStep
, double nyStep
,
180 css::geometry::AffineMatrix2D
& rMat
,
181 const css::uno::Sequence
<css::beans::PropertyValue
>& xTile
) = 0;
184 typedef std::shared_ptr
<ContentSink
> ContentSinkSharedPtr
;
187 #endif // INCLUDED_SDEXT_SOURCE_PDFIMPORT_INC_CONTENTSINK_HXX
189 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */