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_CPPCANVAS_RENDERER_HXX
21 #define INCLUDED_CPPCANVAS_RENDERER_HXX
23 #include <sal/types.h>
24 #include <rtl/ustring.hxx>
26 #include <boost/shared_ptr.hpp>
27 #include <boost/optional.hpp>
28 #include <basegfx/matrix/b2dhommatrix.hxx>
29 #include <cppcanvas/canvasgraphic.hxx>
30 #include <cppcanvas/color.hxx>
37 /* Definition of Renderer interface */
42 class Renderer
: public virtual CanvasGraphic
45 /** Render subset of metafile to given canvas
47 This method renders the given subset of the content to the
51 The index of the first action to be rendered (the indices
52 correspond roughly to the action indices of the
53 originating GDIMetaFile. Note, although, that certain
54 actions, e.g. text, accounts for more than one index: a
55 text produces as many addressable indices as it has
59 The index of the first action _not_ painted anymore,
60 i.e. the action after the last action rendered (the
61 indices correspond roughly to the action indices of the
62 originating GDIMetaFile. Note, although, that certain
63 actions, e.g. text, accounts for more than one index: a
64 text produces as many addressable indices as it has
67 @return whether the rendering finished successfully.
69 virtual bool drawSubset( sal_Int32 nStartIndex
,
70 sal_Int32 nEndIndex
) const = 0;
72 /** Query bounding box of metafile subset
74 This method queries the actual bounding box of the given
75 subset, when rendered on the associated canvas.
78 The index of the first action to be rendered (the indices
79 correspond roughly to the action indices of the
80 originating GDIMetaFile. Note, although, that certain
81 actions, e.g. text, accounts for more than one index: a
82 text produces as many addressable indices as it has
86 The index of the first action _not_ painted anymore,
87 i.e. the action after the last action rendered (the
88 indices correspond roughly to the action indices of the
89 originating GDIMetaFile. Note, although, that certain
90 actions, e.g. text, accounts for more than one index: a
91 text produces as many addressable indices as it has
94 @return the bounding box of the specified subset
96 virtual ::basegfx::B2DRange
getSubsetArea( sal_Int32 nStartIndex
,
97 sal_Int32 nEndIndex
) const = 0;
99 /** Parameters for the Renderer
103 /// Optionally forces the fill color attribute for all actions
104 ::boost::optional
< Color::IntSRGBA
> maFillColor
;
106 /// Optionally forces the line color attribute for all actions
107 ::boost::optional
< Color::IntSRGBA
> maLineColor
;
109 /// Optionally forces the text color attribute for all actions
110 ::boost::optional
< Color::IntSRGBA
> maTextColor
;
112 /// Optionally forces the given fontname for all text actions
113 ::boost::optional
< OUString
> maFontName
;
115 /** Optionally transforms all text output actions with the
116 given matrix (in addition to the overall canvas
119 Note that the matrix given here is applied to the unit
120 rect coordinate system, i.e. the metafile is assumed
121 to be contained in the unit rect.
123 ::boost::optional
< ::basegfx::B2DHomMatrix
> maTextTransformation
;
125 /// Optionally forces the given font weight for all text actions
126 ::boost::optional
< sal_Int8
> maFontWeight
;
128 /// Optionally forces the given font letter form (italics etc.) for all text actions
129 ::boost::optional
< sal_Int8
> maFontLetterForm
;
131 /// Optionally forces the given font proportion (condensed, monospaced etc.) for all text actions
132 ::boost::optional
< sal_Int8
> maFontProportion
;
134 /// Optionally forces underlining for all text actions
135 ::boost::optional
< bool > maFontUnderline
;
139 typedef ::boost::shared_ptr
< ::cppcanvas::Renderer
> RendererSharedPtr
;
142 #endif // INCLUDED_CPPCANVAS_RENDERER_HXX
144 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */