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 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_sd.hxx"
30 #include "AccessiblePresentationGraphicShape.hxx"
31 
32 #include "SdShapeTypes.hxx"
33 
34 #include <svx/DescriptionGenerator.hxx>
35 #include <rtl/ustring.h>
36 
37 using namespace ::rtl;
38 using namespace ::com::sun::star;
39 using namespace	::com::sun::star::accessibility;
40 
41 namespace accessibility {
42 
43 //=====  internal  ============================================================
44 
45 AccessiblePresentationGraphicShape::AccessiblePresentationGraphicShape (
46     const AccessibleShapeInfo& rShapeInfo,
47     const AccessibleShapeTreeInfo& rShapeTreeInfo)
48     : AccessibleGraphicShape (rShapeInfo, rShapeTreeInfo)
49 {
50 }
51 
52 
53 
54 
55 AccessiblePresentationGraphicShape::~AccessiblePresentationGraphicShape (void)
56 {
57 }
58 
59 
60 
61 
62 //=====  XServiceInfo  ========================================================
63 
64 ::rtl::OUString SAL_CALL
65     AccessiblePresentationGraphicShape::getImplementationName (void)
66     throw (::com::sun::star::uno::RuntimeException)
67 {
68 	return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AccessiblePresentationGraphicShape"));
69 }
70 
71 
72 
73 
74 ///	Set this object's name if is different to the current name.
75 ::rtl::OUString
76     AccessiblePresentationGraphicShape::CreateAccessibleBaseName (void)
77     throw (::com::sun::star::uno::RuntimeException)
78 {
79     ::rtl::OUString sName;
80 
81     ShapeTypeId nShapeType = ShapeTypeHandler::Instance().GetTypeId (mxShape);
82     switch (nShapeType)
83     {
84         case PRESENTATION_GRAPHIC_OBJECT:
85             sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("ImpressGraphicObject"));
86             break;
87         default:
88             sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("UnknownAccessibleImpressShape"));
89             uno::Reference<drawing::XShapeDescriptor> xDescriptor (mxShape, uno::UNO_QUERY);
90             if (xDescriptor.is())
91                 sName += ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM(": "))
92                     + xDescriptor->getShapeType();
93     }
94 
95     return sName;
96 }
97 
98 
99 
100 
101 ::rtl::OUString
102     AccessiblePresentationGraphicShape::CreateAccessibleDescription (void)
103     throw (::com::sun::star::uno::RuntimeException)
104 {
105     //    return createAccessibleName ();
106     DescriptionGenerator aDG (mxShape);
107     ShapeTypeId nShapeType = ShapeTypeHandler::Instance().GetTypeId (mxShape);
108     switch (nShapeType)
109     {
110         case PRESENTATION_GRAPHIC_OBJECT:
111             aDG.Initialize (::rtl::OUString::createFromAscii ("PresentationGraphicShape"));
112             break;
113         default:
114             aDG.Initialize (
115                 ::rtl::OUString::createFromAscii ("Unknown accessible presentation graphic shape"));
116             uno::Reference<drawing::XShapeDescriptor> xDescriptor (mxShape, uno::UNO_QUERY);
117             if (xDescriptor.is())
118             {
119                 aDG.AppendString (::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("service name=")));
120                 aDG.AppendString (xDescriptor->getShapeType());
121             }
122     }
123 
124     return aDG();
125 }
126 
127 } // end of namespace accessibility
128