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