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 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_svx.hxx"
26 
27 #include <svx/SvxShapeTypes.hxx>
28 #include <svx/AccessibleShape.hxx>
29 #include <svx/AccessibleGraphicShape.hxx>
30 #include <svx/AccessibleOLEShape.hxx>
31 #include <svx/AccessibleControlShape.hxx>
32 #include <svx/AccessibleTableShape.hxx>
33 
34 namespace accessibility {
35 
CreateSvxAccessibleShape(const AccessibleShapeInfo & rShapeInfo,const AccessibleShapeTreeInfo & rShapeTreeInfo,ShapeTypeId nId)36 AccessibleShape* CreateSvxAccessibleShape (
37     const AccessibleShapeInfo& rShapeInfo,
38     const AccessibleShapeTreeInfo& rShapeTreeInfo,
39     ShapeTypeId nId)
40 {
41     switch (nId)
42     {
43         case DRAWING_3D_CUBE:
44         case DRAWING_3D_EXTRUDE:
45         case DRAWING_3D_LATHE:
46         case DRAWING_3D_SCENE:
47         case DRAWING_3D_SPHERE:
48         case DRAWING_CAPTION:
49         case DRAWING_CLOSED_BEZIER:
50         case DRAWING_CLOSED_FREEHAND:
51         case DRAWING_CONNECTOR:
52         case DRAWING_ELLIPSE:
53         case DRAWING_GROUP:
54         case DRAWING_LINE:
55         case DRAWING_MEASURE:
56         case DRAWING_OPEN_BEZIER:
57         case DRAWING_OPEN_FREEHAND:
58         case DRAWING_PAGE:
59         case DRAWING_POLY_POLYGON:
60         case DRAWING_POLY_LINE:
61         case DRAWING_POLY_POLYGON_PATH:
62         case DRAWING_POLY_LINE_PATH:
63         case DRAWING_RECTANGLE:
64         case DRAWING_TEXT:
65         // --> OD 2004-11-29 #i37790# - default accessiblility shape for
66         // com::sun::star::drawing::CustomShape
67         case DRAWING_CUSTOM:
68         // <--
69         // --> OD 2008-05-19 #i85429# - default accessiblility shape for
70         // com::sun::star::drawing::MediaShape
71         case DRAWING_MEDIA:
72         // <--
73             return new AccessibleShape (rShapeInfo, rShapeTreeInfo);
74 
75         case DRAWING_CONTROL:
76             return new AccessibleControlShape (rShapeInfo, rShapeTreeInfo);
77 
78         case DRAWING_GRAPHIC_OBJECT:
79             return new AccessibleGraphicShape (rShapeInfo, rShapeTreeInfo);
80 
81         case DRAWING_APPLET:
82         case DRAWING_FRAME:
83         case DRAWING_OLE:
84         case DRAWING_PLUGIN:
85             return new AccessibleOLEShape (rShapeInfo, rShapeTreeInfo);
86 
87 		case DRAWING_TABLE:
88 			return new AccessibleTableShape( rShapeInfo, rShapeTreeInfo );
89 
90 		default:
91 	        return NULL;
92     }
93 }
94 
95 
96 
97 ShapeTypeDescriptor aSvxShapeTypeList[] = {
98     ShapeTypeDescriptor (DRAWING_TEXT,
99         ::rtl::OUString::createFromAscii ("com.sun.star.drawing.TextShape"),
100         CreateSvxAccessibleShape),
101     ShapeTypeDescriptor (DRAWING_RECTANGLE,
102         ::rtl::OUString::createFromAscii ("com.sun.star.drawing.RectangleShape"),
103         CreateSvxAccessibleShape),
104     ShapeTypeDescriptor (   DRAWING_ELLIPSE,
105         ::rtl::OUString::createFromAscii ("com.sun.star.drawing.EllipseShape"),
106         CreateSvxAccessibleShape ),
107     ShapeTypeDescriptor (   DRAWING_CONTROL,
108         ::rtl::OUString::createFromAscii ("com.sun.star.drawing.ControlShape"),
109         CreateSvxAccessibleShape ),
110     ShapeTypeDescriptor (   DRAWING_CONNECTOR,
111         ::rtl::OUString::createFromAscii ("com.sun.star.drawing.ConnectorShape"),
112         CreateSvxAccessibleShape ),
113     ShapeTypeDescriptor (   DRAWING_MEASURE,
114         ::rtl::OUString::createFromAscii ("com.sun.star.drawing.MeasureShape"),
115         CreateSvxAccessibleShape ),
116     ShapeTypeDescriptor (   DRAWING_LINE,
117         ::rtl::OUString::createFromAscii ("com.sun.star.drawing.LineShape"),
118         CreateSvxAccessibleShape ),
119     ShapeTypeDescriptor (   DRAWING_POLY_POLYGON,
120         ::rtl::OUString::createFromAscii ("com.sun.star.drawing.PolyPolygonShape"),
121         CreateSvxAccessibleShape ),
122     ShapeTypeDescriptor (   DRAWING_POLY_LINE,
123         ::rtl::OUString::createFromAscii ("com.sun.star.drawing.PolyLineShape"),
124         CreateSvxAccessibleShape ),
125     ShapeTypeDescriptor (   DRAWING_OPEN_BEZIER,
126         ::rtl::OUString::createFromAscii ("com.sun.star.drawing.OpenBezierShape"),
127         CreateSvxAccessibleShape ),
128     ShapeTypeDescriptor (   DRAWING_CLOSED_BEZIER,
129         ::rtl::OUString::createFromAscii ("com.sun.star.drawing.ClosedBezierShape"),
130         CreateSvxAccessibleShape ),
131     ShapeTypeDescriptor (   DRAWING_OPEN_FREEHAND,
132         ::rtl::OUString::createFromAscii ("com.sun.star.drawing.OpenFreeHandShape"),
133         CreateSvxAccessibleShape ),
134     ShapeTypeDescriptor (   DRAWING_CLOSED_FREEHAND,
135         ::rtl::OUString::createFromAscii ("com.sun.star.drawing.ClosedFreeHandShape"),
136         CreateSvxAccessibleShape ),
137     ShapeTypeDescriptor (   DRAWING_POLY_POLYGON_PATH,
138         ::rtl::OUString::createFromAscii ("com.sun.star.drawing.PolyPolygonPathShape"),
139         CreateSvxAccessibleShape ),
140     ShapeTypeDescriptor (   DRAWING_POLY_LINE_PATH,
141         ::rtl::OUString::createFromAscii ("com.sun.star.drawing.PolyLinePathShape"),
142         CreateSvxAccessibleShape ),
143     ShapeTypeDescriptor (   DRAWING_GRAPHIC_OBJECT,
144         ::rtl::OUString::createFromAscii ("com.sun.star.drawing.GraphicObjectShape"),
145         CreateSvxAccessibleShape ),
146     ShapeTypeDescriptor (   DRAWING_GROUP,
147         ::rtl::OUString::createFromAscii ("com.sun.star.drawing.GroupShape"),
148         CreateSvxAccessibleShape ),
149     ShapeTypeDescriptor (   DRAWING_OLE,
150         ::rtl::OUString::createFromAscii ("com.sun.star.drawing.OLE2Shape"),
151         CreateSvxAccessibleShape ),
152     ShapeTypeDescriptor (   DRAWING_PAGE,
153         ::rtl::OUString::createFromAscii ("com.sun.star.drawing.PageShape"),
154         CreateSvxAccessibleShape ),
155     ShapeTypeDescriptor (   DRAWING_CAPTION,
156         ::rtl::OUString::createFromAscii ("com.sun.star.drawing.CaptionShape"),
157         CreateSvxAccessibleShape ),
158     ShapeTypeDescriptor (   DRAWING_FRAME,
159         ::rtl::OUString::createFromAscii ("com.sun.star.drawing.FrameShape"),
160         CreateSvxAccessibleShape ),
161     ShapeTypeDescriptor (   DRAWING_PLUGIN,
162         ::rtl::OUString::createFromAscii ("com.sun.star.drawing.PluginShape"),
163         CreateSvxAccessibleShape ),
164     ShapeTypeDescriptor (   DRAWING_APPLET,
165         ::rtl::OUString::createFromAscii ("com.sun.star.drawing.AppletShape"),
166         CreateSvxAccessibleShape ),
167     ShapeTypeDescriptor (   DRAWING_3D_SCENE,
168         ::rtl::OUString::createFromAscii ("com.sun.star.drawing.Shape3DSceneObject"),
169         CreateSvxAccessibleShape ),
170     ShapeTypeDescriptor (   DRAWING_3D_CUBE,
171         ::rtl::OUString::createFromAscii ("com.sun.star.drawing.Shape3DCubeObject"),
172         CreateSvxAccessibleShape ),
173     ShapeTypeDescriptor (   DRAWING_3D_SPHERE,
174         ::rtl::OUString::createFromAscii ("com.sun.star.drawing.Shape3DSphereObject"),
175         CreateSvxAccessibleShape ),
176     ShapeTypeDescriptor (   DRAWING_3D_LATHE,
177         ::rtl::OUString::createFromAscii ("com.sun.star.drawing.Shape3DLatheObject"),
178         CreateSvxAccessibleShape ),
179     ShapeTypeDescriptor (   DRAWING_3D_EXTRUDE,
180         ::rtl::OUString::createFromAscii ("com.sun.star.drawing.Shape3DExtrudeObject"),
181         CreateSvxAccessibleShape ),
182     ShapeTypeDescriptor (   DRAWING_CUSTOM,
183         ::rtl::OUString::createFromAscii ("com.sun.star.drawing.CustomShape"),
184         CreateSvxAccessibleShape ),
185 	ShapeTypeDescriptor (	DRAWING_TABLE,
186 		rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.TableShape" ) ),
187 		CreateSvxAccessibleShape ),
188     ShapeTypeDescriptor (   DRAWING_MEDIA,
189         rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.MediaShape" ) ),
190         CreateSvxAccessibleShape ),
191 
192 };
193 
194 
RegisterDrawShapeTypes(void)195 void RegisterDrawShapeTypes (void)
196 {
197     // --> OD 2004-11-26 #i37790#
198     ShapeTypeHandler::Instance().AddShapeTypeList ( DRAWING_END, aSvxShapeTypeList);
199     // <--
200 }
201 
202 
203 } // end of namespace accessibility
204