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 "AccessiblePresentationOLEShape.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
AccessiblePresentationOLEShape(const AccessibleShapeInfo & rShapeInfo,const AccessibleShapeTreeInfo & rShapeTreeInfo)41 AccessiblePresentationOLEShape::AccessiblePresentationOLEShape (
42 const AccessibleShapeInfo& rShapeInfo,
43 const AccessibleShapeTreeInfo& rShapeTreeInfo)
44 : AccessibleOLEShape (rShapeInfo, rShapeTreeInfo)
45 {
46 }
47
48
49
50
~AccessiblePresentationOLEShape(void)51 AccessiblePresentationOLEShape::~AccessiblePresentationOLEShape (void)
52 {
53 }
54
55
56
57
58 //===== XServiceInfo ========================================================
59
60 ::rtl::OUString SAL_CALL
getImplementationName(void)61 AccessiblePresentationOLEShape::getImplementationName (void)
62 throw (::com::sun::star::uno::RuntimeException)
63 {
64 return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AccessiblePresentationOLEShape"));
65 }
66
67
68
69
70 /// Set this object's name if it is different to the current name.
71 ::rtl::OUString
CreateAccessibleBaseName(void)72 AccessiblePresentationOLEShape::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_OLE:
81 sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("ImpressOLE"));
82 break;
83 case PRESENTATION_CHART:
84 sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("ImpressChart"));
85 break;
86 case PRESENTATION_TABLE:
87 sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("ImpressTable"));
88 break;
89 default:
90 sName = ::rtl::OUString (
91 RTL_CONSTASCII_USTRINGPARAM("UnknownAccessibleImpressOLEShape"));
92 uno::Reference<drawing::XShapeDescriptor> xDescriptor (mxShape, uno::UNO_QUERY);
93 if (xDescriptor.is())
94 sName += ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM(": "))
95 + xDescriptor->getShapeType();
96 }
97
98 return sName;
99 }
100
101
102
103
104 ::rtl::OUString
CreateAccessibleDescription(void)105 AccessiblePresentationOLEShape::CreateAccessibleDescription (void)
106 throw (::com::sun::star::uno::RuntimeException)
107 {
108 // return createAccessibleName();
109 DescriptionGenerator aDG (mxShape);
110 ShapeTypeId nShapeType = ShapeTypeHandler::Instance().GetTypeId (mxShape);
111 switch (nShapeType)
112 {
113 case PRESENTATION_OLE:
114 aDG.Initialize (::rtl::OUString::createFromAscii ("PresentationOLEShape"));
115 //SVX_RESSTR(RID_SVXSTR_A11Y_ST_RECTANGLE));
116 aDG.AddProperty (OUString::createFromAscii ("CLSID"),
117 DescriptionGenerator::STRING);
118 break;
119 case PRESENTATION_CHART:
120 aDG.Initialize (::rtl::OUString::createFromAscii ("PresentationChartShape"));
121 //SVX_RESSTR(RID_SVXSTR_A11Y_ST_RECTANGLE));
122 aDG.AddProperty (OUString::createFromAscii ("CLSID"),
123 DescriptionGenerator::STRING);
124 break;
125 case PRESENTATION_TABLE:
126 aDG.Initialize (::rtl::OUString::createFromAscii ("PresentationTableShape"));
127 //SVX_RESSTR(RID_SVXSTR_A11Y_ST_RECTANGLE));
128 aDG.AddProperty (OUString::createFromAscii ("CLSID"),
129 DescriptionGenerator::STRING);
130 break;
131 default:
132 aDG.Initialize (::rtl::OUString::createFromAscii ("Unknown accessible presentation OLE shape"));
133 uno::Reference<drawing::XShapeDescriptor> xDescriptor (mxShape, uno::UNO_QUERY);
134 if (xDescriptor.is())
135 {
136 aDG.AppendString (::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("service name=")));
137 aDG.AppendString (xDescriptor->getShapeType());
138 }
139 }
140
141 return aDG();
142 }
143 // Return this object's role.
getAccessibleRole()144 sal_Int16 SAL_CALL AccessiblePresentationOLEShape::getAccessibleRole ()
145 throw (::com::sun::star::uno::RuntimeException)
146 {
147
148 return AccessibleRole::EMBEDDED_OBJECT ;
149 }
150 } // end of namespace accessibility
151