1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _CPPCANVAS_POLYPOLYACTION_HXX
25 #define _CPPCANVAS_POLYPOLYACTION_HXX
26 
27 #include <action.hxx>
28 #include <cppcanvas/canvas.hxx>
29 
30 
31 namespace basegfx {
32     class B2DPolyPolygon;
33 }
34 namespace com { namespace sun { namespace star { namespace rendering
35 {
36     struct Texture;
37     struct StrokeAttributes;
38 } } } }
39 
40 
41 /* Definition of internal::PolyPolyActionFactory class */
42 
43 namespace cppcanvas
44 {
45     namespace internal
46     {
47         struct OutDevState;
48 
49         /** Creates encapsulated converters between GDIMetaFile and
50             XCanvas. The Canvas argument is deliberately placed at the
51             constructor, to force reconstruction of this object for a
52             new canvas. This considerably eases internal state
53             handling, since a lot of the internal state (e.g. fonts,
54             text layout) is Canvas-dependent.
55          */
56         class PolyPolyActionFactory
57         {
58         public:
59             /// Create polygon, fill/stroke according to state
60             static ActionSharedPtr createPolyPolyAction( const ::basegfx::B2DPolyPolygon&,
61                                                          const CanvasSharedPtr&,
62                                                          const OutDevState& 	);
63 
64             /// Create texture-filled polygon
65             static ActionSharedPtr createPolyPolyAction( const ::basegfx::B2DPolyPolygon&,
66                                                          const CanvasSharedPtr&,
67                                                          const OutDevState&,
68                                                          const ::com::sun::star::rendering::Texture& );
69 
70             /// Create line polygon (always stroked, not filled)
71             static ActionSharedPtr createLinePolyPolyAction( const ::basegfx::B2DPolyPolygon&,
72                                                              const CanvasSharedPtr&,
73                                                              const OutDevState& );
74 
75             /// Create stroked polygon
76             static ActionSharedPtr createPolyPolyAction( const ::basegfx::B2DPolyPolygon&,
77                                                          const CanvasSharedPtr&,
78                                                          const OutDevState&,
79                                                          const ::com::sun::star::rendering::StrokeAttributes& );
80 
81             /// For transparent painting of the given polygon (normally, we take the colors always opaque)
82             static ActionSharedPtr createPolyPolyAction( const ::basegfx::B2DPolyPolygon&,
83                                                          const CanvasSharedPtr&,
84                                                          const OutDevState&,
85                                                          int nTransparency );
86 
87         private:
88             // static factory, disable big four
89             PolyPolyActionFactory();
90             ~PolyPolyActionFactory();
91             PolyPolyActionFactory(const PolyPolyActionFactory&);
92             PolyPolyActionFactory& operator=( const PolyPolyActionFactory& );
93         };
94     }
95 }
96 
97 #endif /* _CPPCANVAS_POLYPOLYACTION_HXX */
98