LibreOffice Module cppcanvas (master) 1
canvas.hxx
Go to the documentation of this file.
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#include <memory>
25
26namespace basegfx
27{
28 class B2DHomMatrix;
29 class B2DPolyPolygon;
30}
31
33{
34 class XCanvas;
35 struct ViewState;
36}
37
38
39/* Definition of BitmapCanvas */
40
41namespace cppcanvas
42{
43 class PolyPolygon;
44 class Canvas;
45
46 // forward declaration, since tools::PolyPolygon also references Canvas
47 typedef std::shared_ptr< PolyPolygon > PolyPolygonSharedPtr;
48
49 // forward declaration, since cloneCanvas() also references Canvas
50 typedef std::shared_ptr< Canvas > CanvasSharedPtr;
51
54 class Canvas
55 {
56 public:
65 static constexpr auto ANTIALIASING_EXTRA_SIZE=2;
66
67 Canvas() = default;
68 Canvas(Canvas const &) = default;
69 Canvas(Canvas &&) = default;
70 Canvas & operator =(Canvas const &) = default;
71#if !(defined __GNUC__ && !defined __clang__ && __GNUC__ == 8) // bogus -Werror=virtual-move-assign
72 Canvas & operator =(Canvas &&) = default;
73#endif
74
75 virtual ~Canvas() {}
76
77 virtual void setTransformation( const ::basegfx::B2DHomMatrix& rMatrix ) = 0;
78 virtual ::basegfx::B2DHomMatrix getTransformation() const = 0;
79
80 virtual void setClip( const ::basegfx::B2DPolyPolygon& rClipPoly ) = 0;
81 virtual void setClip() = 0;
82
87 virtual ::basegfx::B2DPolyPolygon const* getClip() const = 0;
88
89 virtual CanvasSharedPtr clone() const = 0;
90 virtual void clear() const = 0;
91
92 // this should be considered private. if RTTI gets enabled
93 // someday, remove that to a separate interface
94 virtual css::uno::Reference<
95 css::rendering::XCanvas > getUNOCanvas() const = 0;
96 virtual css::rendering::ViewState getViewState() const = 0;
97 };
98
99}
100
101#endif // INCLUDED_CPPCANVAS_CANVAS_HXX
102
103/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Canvas interface.
Definition: canvas.hxx:55
virtual void setClip()=0
virtual void setClip(const ::basegfx::B2DPolyPolygon &rClipPoly)=0
virtual CanvasSharedPtr clone() const =0
Canvas & operator=(Canvas const &)=default
virtual void clear() const =0
virtual void setTransformation(const ::basegfx::B2DHomMatrix &rMatrix)=0
virtual css::uno::Reference< css::rendering::XCanvas > getUNOCanvas() const =0
Canvas(Canvas &&)=default
virtual ::basegfx::B2DPolyPolygon const * getClip() const =0
Get current clip.
virtual ::basegfx::B2DHomMatrix getTransformation() const =0
virtual css::rendering::ViewState getViewState() const =0
static constexpr auto ANTIALIASING_EXTRA_SIZE
Extra pixel used when canvas anti-aliases.
Definition: canvas.hxx:65
Canvas(Canvas const &)=default
virtual ~Canvas()
Definition: canvas.hxx:75
std::shared_ptr< PolyPolygon > PolyPolygonSharedPtr
Definition: canvas.hxx:44
std::shared_ptr< Canvas > CanvasSharedPtr
ViewState