CWS-TOOLING: integrate CWS os146
[LibreOffice.git] / canvas / source / cairo / cairo_cairo.hxx
blob10832ac27be64ca6e1da0640e5a8dc36a251f8df
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 #ifndef _CAIROCANVAS_CAIRO_HXX
29 #define _CAIROCANVAS_CAIRO_HXX
31 #include <sal/config.h>
32 #include <boost/shared_ptr.hpp>
34 struct SystemEnvData;
35 struct BitmapSystemData;
36 struct SystemGraphicsData;
37 class VirtualDevice;
38 class OutputDevice;
39 class Window;
40 class Size;
42 #include <cairo.h> //cannot be inside a namespace, otherwise Quartz fails to compile.
44 namespace cairo {
45 typedef cairo_t Cairo;
46 typedef cairo_matrix_t Matrix;
47 typedef cairo_format_t Format;
48 typedef cairo_content_t Content;
49 typedef cairo_pattern_t Pattern;
51 typedef boost::shared_ptr<cairo_surface_t> CairoSurfaceSharedPtr;
52 typedef boost::shared_ptr<Cairo> CairoSharedPtr;
54 const SystemEnvData* GetSysData(const Window *pOutputWindow);
56 /** Cairo surface interface
58 For each cairo-supported platform, there's an implementation of
59 this interface
61 struct Surface
63 public:
64 virtual ~Surface() {}
66 // Query methods
67 virtual CairoSharedPtr getCairo() const = 0;
68 virtual CairoSurfaceSharedPtr getCairoSurface() const = 0;
69 virtual boost::shared_ptr<Surface> getSimilar( Content aContent, int width, int height ) const = 0;
71 /// factory for VirDev on this surface
72 virtual boost::shared_ptr<VirtualDevice> createVirtualDevice() const = 0;
74 /// Resize the surface (possibly destroying content)
75 virtual void Resize( int width, int height ) = 0;
77 /// Flush all pending output to surface
78 virtual void flush() const = 0;
81 typedef boost::shared_ptr<Surface> SurfaceSharedPtr;
83 /// Create Surface from given cairo surface
84 SurfaceSharedPtr createSurface( const CairoSurfaceSharedPtr& rSurface );
85 /// Create surface with given dimensions
86 SurfaceSharedPtr createSurface( const OutputDevice& rRefDevice,
87 int x, int y, int width, int height );
88 /// Create Surface for given bitmap data
89 SurfaceSharedPtr createBitmapSurface( const OutputDevice& rRefDevice,
90 const BitmapSystemData& rData,
91 const Size& rSize );
93 /// Check whether cairo will work on given window
94 bool IsCairoWorking( OutputDevice* );
97 #endif