Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef INCLUDED_CPPCANVAS_CANVAS_HXX
21 : #define INCLUDED_CPPCANVAS_CANVAS_HXX
22 :
23 : #include <com/sun/star/uno/Reference.hxx>
24 :
25 : #include <boost/shared_ptr.hpp>
26 : #include <cppcanvas/font.hxx>
27 : #include <cppcanvas/color.hxx>
28 :
29 :
30 : namespace basegfx
31 : {
32 : class B2DHomMatrix;
33 : class B2DPolyPolygon;
34 : }
35 :
36 : namespace com { namespace sun { namespace star { namespace rendering
37 : {
38 : class XCanvas;
39 : struct ViewState;
40 : } } } }
41 :
42 :
43 : /* Definition of BitmapCanvas */
44 :
45 : namespace cppcanvas
46 : {
47 : class PolyPolygon;
48 : class Canvas;
49 :
50 : // forward declaration, since tools::PolyPolygon also references Canvas
51 : typedef ::boost::shared_ptr< PolyPolygon > PolyPolygonSharedPtr;
52 :
53 : // forward declaration, since cloneCanvas() also references Canvas
54 : typedef ::boost::shared_ptr< Canvas > CanvasSharedPtr;
55 :
56 : /** Canvas interface
57 : */
58 0 : class Canvas
59 : {
60 : public:
61 : enum
62 : {
63 : /** Extra pixel used when canvas anti-aliases.
64 :
65 : Enlarge the bounding box of drawing primitives by this
66 : amount in both dimensions, and on both sides of the
67 : bounds, to account for extra pixel touched outside the
68 : actual primitive bounding box, when the canvas
69 : performs anti-aliasing.
70 : */
71 : ANTIALIASING_EXTRA_SIZE=2
72 : };
73 :
74 0 : virtual ~Canvas() {}
75 :
76 : virtual void setTransformation( const ::basegfx::B2DHomMatrix& rMatrix ) = 0;
77 : virtual ::basegfx::B2DHomMatrix getTransformation() const = 0;
78 :
79 : virtual void setClip( const ::basegfx::B2DPolyPolygon& rClipPoly ) = 0;
80 : virtual void setClip() = 0;
81 :
82 : /** Get current clip
83 :
84 : @return NULL, if no clip is set, otherwise the current clip poly-polygon
85 : */
86 : virtual ::basegfx::B2DPolyPolygon const* getClip() const = 0;
87 :
88 : virtual FontSharedPtr createFont( const OUString& rFontName, const double& rCellSize ) const = 0;
89 :
90 : virtual ColorSharedPtr createColor() const = 0;
91 :
92 : virtual CanvasSharedPtr clone() const = 0;
93 : virtual void clear() const = 0;
94 :
95 : // this should be considered private. if RTTI gets enabled
96 : // someday, remove that to a separate interface
97 : virtual ::com::sun::star::uno::Reference<
98 : ::com::sun::star::rendering::XCanvas > getUNOCanvas() const = 0;
99 : virtual ::com::sun::star::rendering::ViewState getViewState() const = 0;
100 : };
101 :
102 : }
103 :
104 : #endif // INCLUDED_CPPCANVAS_CANVAS_HXX
105 :
106 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|