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 {
63 return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AccessiblePresentationGraphicShape"));
64 }
65
66
67
68
69 /// Set this object's name if is different to the current name.
70 ::rtl::OUString
CreateAccessibleBaseName(void)71 AccessiblePresentationGraphicShape::CreateAccessibleBaseName (void)
72 {
73 ::rtl::OUString sName;
74
75 ShapeTypeId nShapeType = ShapeTypeHandler::Instance().GetTypeId (mxShape);
76 switch (nShapeType)
77 {
78 case PRESENTATION_GRAPHIC_OBJECT:
79 sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("ImpressGraphicObject"));
80 break;
81 default:
82 sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("UnknownAccessibleImpressShape"));
83 uno::Reference<drawing::XShapeDescriptor> xDescriptor (mxShape, uno::UNO_QUERY);
84 if (xDescriptor.is())
85 sName += ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM(": "))
86 + xDescriptor->getShapeType();
87 }
88
89 return sName;
90 }
91
92
93
94
95 ::rtl::OUString
CreateAccessibleDescription(void)96 AccessiblePresentationGraphicShape::CreateAccessibleDescription (void)
97 {
98 // return createAccessibleName ();
99 DescriptionGenerator aDG (mxShape);
100 ShapeTypeId nShapeType = ShapeTypeHandler::Instance().GetTypeId (mxShape);
101 switch (nShapeType)
102 {
103 case PRESENTATION_GRAPHIC_OBJECT:
104 aDG.Initialize (::rtl::OUString::createFromAscii ("PresentationGraphicShape"));
105 break;
106 default:
107 aDG.Initialize (
108 ::rtl::OUString::createFromAscii ("Unknown accessible presentation graphic shape"));
109 uno::Reference<drawing::XShapeDescriptor> xDescriptor (mxShape, uno::UNO_QUERY);
110 if (xDescriptor.is())
111 {
112 aDG.AppendString (::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("service name=")));
113 aDG.AppendString (xDescriptor->getShapeType());
114 }
115 }
116
117 return aDG();
118 }
getAccessibleRole()119 sal_Int16 SAL_CALL AccessiblePresentationGraphicShape::getAccessibleRole ()
120 {
121
122 return AccessibleRole::GRAPHIC ;
123 }
124 } // end of namespace accessibility
125