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 : #include <svx/AccessibleOLEShape.hxx>
21 :
22 : #include <svx/ShapeTypeHandler.hxx>
23 : #include <svx/SvxShapeTypes.hxx>
24 :
25 : using namespace accessibility;
26 : using namespace ::com::sun::star;
27 : using namespace ::com::sun::star::uno;
28 : using namespace ::com::sun::star::accessibility;
29 :
30 : //===== internal ============================================================
31 :
32 0 : AccessibleOLEShape::AccessibleOLEShape (
33 : const AccessibleShapeInfo& rShapeInfo,
34 : const AccessibleShapeTreeInfo& rShapeTreeInfo)
35 0 : : AccessibleShape (rShapeInfo, rShapeTreeInfo)
36 : {
37 0 : }
38 :
39 :
40 :
41 :
42 0 : AccessibleOLEShape::~AccessibleOLEShape (void)
43 : {
44 0 : }
45 :
46 :
47 :
48 :
49 : //===== XAccessibleAction ===================================================
50 :
51 0 : sal_Int32 SAL_CALL AccessibleOLEShape::getAccessibleActionCount (void)
52 : throw (::com::sun::star::uno::RuntimeException)
53 : {
54 0 : return 0;
55 : }
56 :
57 :
58 :
59 :
60 0 : sal_Bool SAL_CALL AccessibleOLEShape::doAccessibleAction (sal_Int32 /*nIndex*/)
61 : throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
62 : {
63 0 : throw lang::IndexOutOfBoundsException();
64 : }
65 :
66 :
67 :
68 :
69 0 : ::rtl::OUString SAL_CALL AccessibleOLEShape::getAccessibleActionDescription (sal_Int32 /*nIndex*/)
70 : throw (::com::sun::star::lang::IndexOutOfBoundsException,
71 : ::com::sun::star::uno::RuntimeException)
72 : {
73 0 : throw lang::IndexOutOfBoundsException();
74 : }
75 :
76 :
77 :
78 :
79 0 : Reference<XAccessibleKeyBinding> SAL_CALL AccessibleOLEShape::getAccessibleActionKeyBinding (sal_Int32 /*nIndex*/)
80 : throw (::com::sun::star::lang::IndexOutOfBoundsException,
81 : ::com::sun::star::uno::RuntimeException)
82 : {
83 0 : throw lang::IndexOutOfBoundsException();
84 : }
85 :
86 :
87 :
88 :
89 : //===== XInterface ==========================================================
90 :
91 : com::sun::star::uno::Any SAL_CALL
92 0 : AccessibleOLEShape::queryInterface (const com::sun::star::uno::Type & rType)
93 : throw (::com::sun::star::uno::RuntimeException)
94 : {
95 0 : ::com::sun::star::uno::Any aReturn = AccessibleShape::queryInterface (rType);
96 0 : if ( ! aReturn.hasValue())
97 : aReturn = ::cppu::queryInterface (rType,
98 0 : static_cast<XAccessibleAction*>(this));
99 0 : return aReturn;
100 : }
101 :
102 :
103 :
104 : void SAL_CALL
105 0 : AccessibleOLEShape::acquire (void)
106 : throw ()
107 : {
108 0 : AccessibleShape::acquire ();
109 0 : }
110 :
111 :
112 :
113 : void SAL_CALL
114 0 : AccessibleOLEShape::release (void)
115 : throw ()
116 : {
117 0 : AccessibleShape::release ();
118 0 : }
119 :
120 :
121 :
122 :
123 : //===== XServiceInfo ========================================================
124 :
125 : ::rtl::OUString SAL_CALL
126 0 : AccessibleOLEShape::getImplementationName (void)
127 : throw (::com::sun::star::uno::RuntimeException)
128 : {
129 0 : return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AccessibleOLEShape"));
130 : }
131 :
132 :
133 :
134 :
135 : ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL
136 0 : AccessibleOLEShape::getSupportedServiceNames (void)
137 : throw (::com::sun::star::uno::RuntimeException)
138 : {
139 0 : ThrowIfDisposed();
140 : // Get list of supported service names from base class...
141 : uno::Sequence< ::rtl::OUString > aServiceNames =
142 0 : AccessibleShape::getSupportedServiceNames();
143 0 : sal_Int32 nCount (aServiceNames.getLength());
144 :
145 : // ...and add additional names.
146 0 : aServiceNames.realloc (nCount + 1);
147 : static const ::rtl::OUString sAdditionalServiceName (RTL_CONSTASCII_USTRINGPARAM(
148 0 : "com.sun.star.drawing.AccessibleOLEShape"));
149 0 : aServiceNames[nCount] = sAdditionalServiceName;
150 :
151 0 : return aServiceNames;
152 : }
153 :
154 :
155 :
156 :
157 : //===== XTypeProvider ===================================================
158 :
159 : uno::Sequence<uno::Type> SAL_CALL
160 0 : AccessibleOLEShape::getTypes (void)
161 : throw (uno::RuntimeException)
162 : {
163 : // Get list of types from the context base implementation...
164 0 : uno::Sequence<uno::Type> aTypeList (AccessibleShape::getTypes());
165 : // ...and add the additional type for the component.
166 0 : long nTypeCount = aTypeList.getLength();
167 0 : aTypeList.realloc (nTypeCount + 1);
168 : const uno::Type aActionType =
169 0 : ::getCppuType((const uno::Reference<XAccessibleAction>*)0);
170 0 : aTypeList[nTypeCount] = aActionType;
171 :
172 0 : return aTypeList;
173 : }
174 :
175 :
176 :
177 :
178 : /// Set this object's name if is different to the current name.
179 : ::rtl::OUString
180 0 : AccessibleOLEShape::CreateAccessibleBaseName (void)
181 : throw (::com::sun::star::uno::RuntimeException)
182 : {
183 0 : ::rtl::OUString sName;
184 :
185 0 : ShapeTypeId nShapeType = ShapeTypeHandler::Instance().GetTypeId (mxShape);
186 0 : switch (nShapeType)
187 : {
188 : case DRAWING_APPLET:
189 0 : sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("AppletOLEShape"));
190 : break;
191 : case DRAWING_FRAME:
192 0 : sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("FrameOLEShape"));
193 : break;
194 : case DRAWING_OLE:
195 0 : sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("OLEShape"));
196 : break;
197 : case DRAWING_PLUGIN:
198 0 : sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("PluginOLEShape"));
199 : break;
200 :
201 : default:
202 0 : sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("UnknownAccessibleOLEShape"));
203 0 : uno::Reference<drawing::XShapeDescriptor> xDescriptor (mxShape, uno::UNO_QUERY);
204 0 : if (xDescriptor.is())
205 : sName += ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM(": "))
206 0 : + xDescriptor->getShapeType();
207 : }
208 :
209 0 : return sName;
210 : }
211 :
212 :
213 :
214 : ::rtl::OUString
215 0 : AccessibleOLEShape::CreateAccessibleDescription (void)
216 : throw (::com::sun::star::uno::RuntimeException)
217 : {
218 0 : return CreateAccessibleName ();
219 : }
220 :
221 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|