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