LCOV - code coverage report
Current view: top level - svx/source/accessibility - SvxShapeTypes.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 7 12 58.3 %
Date: 2014-11-03 Functions: 2 2 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : 
      21             : #include <svx/SvxShapeTypes.hxx>
      22             : #include <svx/AccessibleShape.hxx>
      23             : #include <svx/AccessibleGraphicShape.hxx>
      24             : #include <svx/AccessibleOLEShape.hxx>
      25             : #include <svx/AccessibleControlShape.hxx>
      26             : #include <AccessibleTableShape.hxx>
      27             : 
      28             : namespace accessibility {
      29             : 
      30           8 : AccessibleShape* CreateSvxAccessibleShape (
      31             :     const AccessibleShapeInfo& rShapeInfo,
      32             :     const AccessibleShapeTreeInfo& rShapeTreeInfo,
      33             :     ShapeTypeId nId)
      34             : {
      35           8 :     switch (nId)
      36             :     {
      37             :         case DRAWING_3D_CUBE:
      38             :         case DRAWING_3D_EXTRUDE:
      39             :         case DRAWING_3D_LATHE:
      40             :         case DRAWING_3D_SCENE:
      41             :         case DRAWING_3D_SPHERE:
      42             :         case DRAWING_CAPTION:
      43             :         case DRAWING_CLOSED_BEZIER:
      44             :         case DRAWING_CLOSED_FREEHAND:
      45             :         case DRAWING_CONNECTOR:
      46             :         case DRAWING_ELLIPSE:
      47             :         case DRAWING_GROUP:
      48             :         case DRAWING_LINE:
      49             :         case DRAWING_MEASURE:
      50             :         case DRAWING_OPEN_BEZIER:
      51             :         case DRAWING_OPEN_FREEHAND:
      52             :         case DRAWING_PAGE:
      53             :         case DRAWING_POLY_POLYGON:
      54             :         case DRAWING_POLY_LINE:
      55             :         case DRAWING_POLY_POLYGON_PATH:
      56             :         case DRAWING_POLY_LINE_PATH:
      57             :         case DRAWING_RECTANGLE:
      58             :         case DRAWING_TEXT:
      59             :         // Default accessiblility shape for
      60             :         // com::sun::star::drawing::CustomShape (#i37790#)
      61             :         case DRAWING_CUSTOM:
      62             :         // Default accessiblility shape for
      63             :         // com::sun::star::drawing::MediaShape (#i85429#)
      64             :         case DRAWING_MEDIA:
      65           8 :             return new AccessibleShape (rShapeInfo, rShapeTreeInfo);
      66             : 
      67             :         case DRAWING_CONTROL:
      68           0 :             return new AccessibleControlShape (rShapeInfo, rShapeTreeInfo);
      69             : 
      70             :         case DRAWING_GRAPHIC_OBJECT:
      71           0 :             return new AccessibleGraphicShape (rShapeInfo, rShapeTreeInfo);
      72             : 
      73             :         case DRAWING_APPLET:
      74             :         case DRAWING_FRAME:
      75             :         case DRAWING_OLE:
      76             :         case DRAWING_PLUGIN:
      77           0 :             return new AccessibleOLEShape (rShapeInfo, rShapeTreeInfo);
      78             : 
      79             :         case DRAWING_TABLE:
      80           0 :             return new AccessibleTableShape( rShapeInfo, rShapeTreeInfo );
      81             : 
      82             :         default:
      83           0 :             return NULL;
      84             :     }
      85             : }
      86             : 
      87          36 : void RegisterDrawShapeTypes (void)
      88             : {
      89             :     /** List of shape type descriptors corresponding to the
      90             :         <type>SvxShapeTypes</type> enum.
      91             :     */
      92             :     ShapeTypeDescriptor aSvxShapeTypeList[] = {
      93             :         ShapeTypeDescriptor ( DRAWING_TEXT, "com.sun.star.drawing.TextShape",
      94             :             CreateSvxAccessibleShape),
      95             :         ShapeTypeDescriptor (DRAWING_RECTANGLE, "com.sun.star.drawing.RectangleShape",
      96             :             CreateSvxAccessibleShape),
      97             :         ShapeTypeDescriptor ( DRAWING_ELLIPSE, "com.sun.star.drawing.EllipseShape",
      98             :             CreateSvxAccessibleShape ),
      99             :         ShapeTypeDescriptor ( DRAWING_CONTROL, "com.sun.star.drawing.ControlShape",
     100             :             CreateSvxAccessibleShape ),
     101             :         ShapeTypeDescriptor ( DRAWING_CONNECTOR, "com.sun.star.drawing.ConnectorShape",
     102             :             CreateSvxAccessibleShape ),
     103             :         ShapeTypeDescriptor ( DRAWING_MEASURE, "com.sun.star.drawing.MeasureShape",
     104             :             CreateSvxAccessibleShape ),
     105             :         ShapeTypeDescriptor ( DRAWING_LINE, "com.sun.star.drawing.LineShape",
     106             :             CreateSvxAccessibleShape ),
     107             :         ShapeTypeDescriptor ( DRAWING_POLY_POLYGON, "com.sun.star.drawing.PolyPolygonShape",
     108             :             CreateSvxAccessibleShape ),
     109             :         ShapeTypeDescriptor ( DRAWING_POLY_LINE, "com.sun.star.drawing.PolyLineShape",
     110             :             CreateSvxAccessibleShape ),
     111             :         ShapeTypeDescriptor ( DRAWING_OPEN_BEZIER, "com.sun.star.drawing.OpenBezierShape",
     112             :             CreateSvxAccessibleShape ),
     113             :         ShapeTypeDescriptor ( DRAWING_CLOSED_BEZIER, "com.sun.star.drawing.ClosedBezierShape",
     114             :             CreateSvxAccessibleShape ),
     115             :         ShapeTypeDescriptor ( DRAWING_OPEN_FREEHAND, "com.sun.star.drawing.OpenFreeHandShape",
     116             :             CreateSvxAccessibleShape ),
     117             :         ShapeTypeDescriptor ( DRAWING_CLOSED_FREEHAND, "com.sun.star.drawing.ClosedFreeHandShape",
     118             :             CreateSvxAccessibleShape ),
     119             :         ShapeTypeDescriptor ( DRAWING_POLY_POLYGON_PATH, "com.sun.star.drawing.PolyPolygonPathShape",
     120             :             CreateSvxAccessibleShape ),
     121             :         ShapeTypeDescriptor ( DRAWING_POLY_LINE_PATH, "com.sun.star.drawing.PolyLinePathShape",
     122             :             CreateSvxAccessibleShape ),
     123             :         ShapeTypeDescriptor ( DRAWING_GRAPHIC_OBJECT, "com.sun.star.drawing.GraphicObjectShape",
     124             :             CreateSvxAccessibleShape ),
     125             :         ShapeTypeDescriptor ( DRAWING_GROUP, "com.sun.star.drawing.GroupShape",
     126             :             CreateSvxAccessibleShape ),
     127             :         ShapeTypeDescriptor ( DRAWING_OLE, "com.sun.star.drawing.OLE2Shape",
     128             :             CreateSvxAccessibleShape ),
     129             :         ShapeTypeDescriptor ( DRAWING_PAGE, "com.sun.star.drawing.PageShape",
     130             :             CreateSvxAccessibleShape ),
     131             :         ShapeTypeDescriptor ( DRAWING_CAPTION, "com.sun.star.drawing.CaptionShape",
     132             :             CreateSvxAccessibleShape ),
     133             :         ShapeTypeDescriptor ( DRAWING_FRAME, "com.sun.star.drawing.FrameShape",
     134             :             CreateSvxAccessibleShape ),
     135             :         ShapeTypeDescriptor ( DRAWING_PLUGIN, "com.sun.star.drawing.PluginShape",
     136             :             CreateSvxAccessibleShape ),
     137             :         ShapeTypeDescriptor ( DRAWING_APPLET, "com.sun.star.drawing.AppletShape",
     138             :             CreateSvxAccessibleShape ),
     139             :         ShapeTypeDescriptor ( DRAWING_3D_SCENE, "com.sun.star.drawing.Shape3DSceneObject",
     140             :             CreateSvxAccessibleShape ),
     141             :         ShapeTypeDescriptor ( DRAWING_3D_CUBE, "com.sun.star.drawing.Shape3DCubeObject",
     142             :             CreateSvxAccessibleShape ),
     143             :         ShapeTypeDescriptor ( DRAWING_3D_SPHERE, "com.sun.star.drawing.Shape3DSphereObject",
     144             :             CreateSvxAccessibleShape ),
     145             :         ShapeTypeDescriptor ( DRAWING_3D_LATHE, "com.sun.star.drawing.Shape3DLatheObject",
     146             :             CreateSvxAccessibleShape ),
     147             :         ShapeTypeDescriptor ( DRAWING_3D_EXTRUDE, "com.sun.star.drawing.Shape3DExtrudeObject",
     148             :             CreateSvxAccessibleShape ),
     149             :         ShapeTypeDescriptor ( DRAWING_CUSTOM, "com.sun.star.drawing.CustomShape",
     150             :             CreateSvxAccessibleShape ),
     151             :         ShapeTypeDescriptor ( DRAWING_TABLE, "com.sun.star.drawing.TableShape",
     152             :             CreateSvxAccessibleShape ),
     153             :         ShapeTypeDescriptor ( DRAWING_MEDIA, "com.sun.star.drawing.MediaShape",
     154             :             CreateSvxAccessibleShape ),
     155             : 
     156        1152 :     };
     157             : 
     158             :     // Crash while inserting callout with activated accesibility (#i37790#)
     159        1152 :     ShapeTypeHandler::Instance().AddShapeTypeList ( DRAWING_END, aSvxShapeTypeList);
     160          36 : }
     161             : 
     162             : } // end of namespace accessibility
     163             : 
     164             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10