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_TEXTACTION_HXX
25 #define _CPPCANVAS_TEXTACTION_HXX
26 
27 #include <com/sun/star/uno/Sequence.hxx>
28 
29 #include <action.hxx>
30 #include <cppcanvas/canvas.hxx>
31 #include <cppcanvas/renderer.hxx>
32 #include <tools/poly.hxx>
33 #include <tools/gen.hxx>
34 
35 class VirtualDevice;
36 class Point;
37 class Color;
38 class String;
39 
40 
41 /* Definition of internal::TextActionFactory 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 TextActionFactory
57         {
58         public:
59             /** Create text action, optionally shadow/relief effect
60 
61             	Note that this method accepts all coordinates in
62             	logical coordinates.
63 
64             	@param pDXArray
65                 Pointer to array of logical character offsets (or NULL)
66 
67             	@param bSubsettable
68                 When this parameter is set to true, the generated
69                 action might consume slightly more memory, but is
70                 subsettable (Action::render( Subset ) works on
71                 characters)
72              */
73             static ActionSharedPtr createTextAction( const ::Point&					rStartPoint,
74                                                      const ::Size&					rReliefOffset,
75                                                      const ::Color&					rReliefColor,
76                                                      const ::Size&					rShadowOffset,
77                                                      const ::Color&					rShadowColor,
78                                                      const ::String& 				rText,
79                                                      sal_Int32 						nStartPos,
80                                                      sal_Int32 						nLen,
81                                                      const sal_Int32*				pDXArray,
82                                                      VirtualDevice&					rVDev,
83                                                      const CanvasSharedPtr&			rCanvas,
84                                                      const OutDevState& 			rState,
85                                                      const Renderer::Parameters& 	rParms,
86                                                      bool							bSubsettable );
87 
88         private:
89             // static factory, disable big four
90             TextActionFactory();
91             ~TextActionFactory();
92             TextActionFactory(const TextActionFactory&);
93             TextActionFactory& operator=( const TextActionFactory& );
94         };
95     }
96 }
97 
98 #endif /* _CPPCANVAS_TEXTACTION_HXX */
99