xref: /AOO41X/main/cppcanvas/inc/cppcanvas/basegfxfactory.hxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
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.
14  *
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).
20  *
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.
25  *
26  ************************************************************************/
27 
28 #ifndef _CPPCANVAS_BASEGFXFACTORY_HXX
29 #define _CPPCANVAS_BASEGFXFACTORY_HXX
30 
31 #include <cppcanvas/canvas.hxx>
32 #include <cppcanvas/bitmapcanvas.hxx>
33 #include <cppcanvas/spritecanvas.hxx>
34 #include <cppcanvas/polypolygon.hxx>
35 #include <cppcanvas/bitmap.hxx>
36 #include <cppcanvas/renderer.hxx>
37 #include <cppcanvas/text.hxx>
38 #include <cppcanvas/sprite.hxx>
39 #include <basegfx/vector/b2isize.hxx>
40 
41 
42 namespace basegfx
43 {
44     class B2DPolygon;
45     class B2DPolyPolygon;
46 }
47 
48 namespace rtl
49 {
50     class OUString;
51 }
52 
53 /* Definition of BaseGfxFactory class */
54 
55 namespace cppcanvas
56 {
57     /** The BaseGfxFactory creates Canvas objects for various basegfx
58         primitives, such as polygons and bitmaps (not yet
59         implemented).
60 
61         Please note that the objects created for a specific Canvas can
62         only be drawn on exactly that canvas. You have to regenerate
63         them for different canvases.
64      */
65     class BaseGfxFactory
66     {
67     public:
68         static BaseGfxFactory& getInstance();
69 
70         /** Create a polygon from a ::basegfx::B2DPolygon
71 
72 			The created polygon initially has the same size in user
73 			coordinate space as the source polygon
74          */
75         PolyPolygonSharedPtr 	createPolyPolygon( const CanvasSharedPtr&, const ::basegfx::B2DPolygon& rPoly ) const;
76         PolyPolygonSharedPtr 	createPolyPolygon( const CanvasSharedPtr&, const ::basegfx::B2DPolyPolygon& rPoly ) const;
77 
78         /** Create an uninitialized bitmap with the given size
79          */
80         BitmapSharedPtr 		createBitmap( const CanvasSharedPtr&, const ::basegfx::B2ISize& rSize ) const;
81 
82         /** Create an uninitialized alpha bitmap with the given size
83          */
84         BitmapSharedPtr 		createAlphaBitmap( const CanvasSharedPtr&, const ::basegfx::B2ISize& rSize ) const;
85 
86         /** Create a text portion with the given content string
87          */
88         TextSharedPtr 			createText( const CanvasSharedPtr&, const ::rtl::OUString& ) const;
89 
90     private:
91         friend struct InitInstance2;
92 
93         // singleton
94         BaseGfxFactory();
95         ~BaseGfxFactory();
96 
97         // default: disabled copy/assignment
98         BaseGfxFactory(const BaseGfxFactory&);
99         BaseGfxFactory& operator=( const BaseGfxFactory& );
100     };
101 
102 }
103 
104 #endif /* _CPPCANVAS_BASEGFXFACTORY_HXX */
105