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 _CPPCANVAS_CANVAS_HXX
21 : #define _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 : namespace rtl
30 : {
31 : class OUString;
32 : }
33 :
34 : namespace basegfx
35 : {
36 : class B2DHomMatrix;
37 : class B2DPolyPolygon;
38 : }
39 :
40 : namespace com { namespace sun { namespace star { namespace rendering
41 : {
42 : class XCanvas;
43 : struct ViewState;
44 : } } } }
45 :
46 :
47 : /* Definition of BitmapCanvas */
48 :
49 : namespace cppcanvas
50 : {
51 : class PolyPolygon;
52 : class Canvas;
53 :
54 : // forward declaration, since PolyPolygon also references Canvas
55 : typedef ::boost::shared_ptr< PolyPolygon > PolyPolygonSharedPtr;
56 :
57 : // forward declaration, since cloneCanvas() also references Canvas
58 : typedef ::boost::shared_ptr< Canvas > CanvasSharedPtr;
59 :
60 : /** Canvas interface
61 : */
62 0 : class Canvas
63 : {
64 : public:
65 : enum
66 : {
67 : /** Extra pixel used when canvas anti-aliases.
68 :
69 : Enlarge the bounding box of drawing primitives by this
70 : amount in both dimensions, and on both sides of the
71 : bounds, to account for extra pixel touched outside the
72 : actual primitive bounding box, when the canvas
73 : performs anti-aliasing.
74 : */
75 : ANTIALIASING_EXTRA_SIZE=2
76 : };
77 :
78 0 : virtual ~Canvas() {}
79 :
80 : virtual void setTransformation( const ::basegfx::B2DHomMatrix& rMatrix ) = 0;
81 : virtual ::basegfx::B2DHomMatrix getTransformation() const = 0;
82 :
83 : virtual void setClip( const ::basegfx::B2DPolyPolygon& rClipPoly ) = 0;
84 : virtual void setClip() = 0;
85 :
86 : /** Get current clip
87 :
88 : @return NULL, if no clip is set, otherwise the current clip poly-polygon
89 : */
90 : virtual ::basegfx::B2DPolyPolygon const* getClip() const = 0;
91 :
92 : virtual FontSharedPtr createFont( const ::rtl::OUString& rFontName, const double& rCellSize ) const = 0;
93 :
94 : virtual ColorSharedPtr createColor() const = 0;
95 :
96 : virtual CanvasSharedPtr clone() const = 0;
97 : virtual void clear() const = 0;
98 :
99 : // this should be considered private. if RTTI gets enabled
100 : // someday, remove that to a separate interface
101 : virtual ::com::sun::star::uno::Reference<
102 : ::com::sun::star::rendering::XCanvas > getUNOCanvas() const = 0;
103 : virtual ::com::sun::star::rendering::ViewState getViewState() const = 0;
104 : };
105 :
106 : }
107 :
108 : #endif /* _CPPCANVAS_CANVAS_HXX */
109 :
110 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|