fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / svx / source / accessibility / AccessibleOLEShape.cxx
blobd8b742cc767ad30488d85cf92c39fb05b61f5c2c
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <svx/AccessibleOLEShape.hxx>
22 #include <svx/ShapeTypeHandler.hxx>
23 #include <svx/SvxShapeTypes.hxx>
25 using namespace accessibility;
26 using namespace ::com::sun::star;
27 using namespace ::com::sun::star::uno;
28 using namespace ::com::sun::star::accessibility;
30 //===== internal ============================================================
32 AccessibleOLEShape::AccessibleOLEShape (
33 const AccessibleShapeInfo& rShapeInfo,
34 const AccessibleShapeTreeInfo& rShapeTreeInfo)
35 : AccessibleShape (rShapeInfo, rShapeTreeInfo)
42 AccessibleOLEShape::~AccessibleOLEShape (void)
49 //===== XAccessibleAction ===================================================
51 sal_Int32 SAL_CALL AccessibleOLEShape::getAccessibleActionCount (void)
52 throw (::com::sun::star::uno::RuntimeException)
54 return 0;
60 sal_Bool SAL_CALL AccessibleOLEShape::doAccessibleAction (sal_Int32 /*nIndex*/)
61 throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
63 throw lang::IndexOutOfBoundsException();
69 OUString SAL_CALL AccessibleOLEShape::getAccessibleActionDescription (sal_Int32 /*nIndex*/)
70 throw (::com::sun::star::lang::IndexOutOfBoundsException,
71 ::com::sun::star::uno::RuntimeException)
73 throw lang::IndexOutOfBoundsException();
79 Reference<XAccessibleKeyBinding> SAL_CALL AccessibleOLEShape::getAccessibleActionKeyBinding (sal_Int32 /*nIndex*/)
80 throw (::com::sun::star::lang::IndexOutOfBoundsException,
81 ::com::sun::star::uno::RuntimeException)
83 throw lang::IndexOutOfBoundsException();
89 //===== XInterface ==========================================================
91 com::sun::star::uno::Any SAL_CALL
92 AccessibleOLEShape::queryInterface (const com::sun::star::uno::Type & rType)
93 throw (::com::sun::star::uno::RuntimeException)
95 ::com::sun::star::uno::Any aReturn = AccessibleShape::queryInterface (rType);
96 if ( ! aReturn.hasValue())
97 aReturn = ::cppu::queryInterface (rType,
98 static_cast<XAccessibleAction*>(this));
99 return aReturn;
104 void SAL_CALL
105 AccessibleOLEShape::acquire (void)
106 throw ()
108 AccessibleShape::acquire ();
113 void SAL_CALL
114 AccessibleOLEShape::release (void)
115 throw ()
117 AccessibleShape::release ();
123 //===== XServiceInfo ========================================================
125 OUString SAL_CALL
126 AccessibleOLEShape::getImplementationName (void)
127 throw (::com::sun::star::uno::RuntimeException)
129 return OUString("AccessibleOLEShape");
135 ::com::sun::star::uno::Sequence< OUString> SAL_CALL
136 AccessibleOLEShape::getSupportedServiceNames (void)
137 throw (::com::sun::star::uno::RuntimeException)
139 ThrowIfDisposed();
140 // Get list of supported service names from base class...
141 uno::Sequence< OUString > aServiceNames =
142 AccessibleShape::getSupportedServiceNames();
143 sal_Int32 nCount (aServiceNames.getLength());
145 // ...and add additional names.
146 aServiceNames.realloc (nCount + 1);
147 static const OUString sAdditionalServiceName ("com.sun.star.drawing.AccessibleOLEShape");
148 aServiceNames[nCount] = sAdditionalServiceName;
150 return aServiceNames;
156 //===== XTypeProvider ===================================================
158 uno::Sequence<uno::Type> SAL_CALL
159 AccessibleOLEShape::getTypes (void)
160 throw (uno::RuntimeException)
162 // Get list of types from the context base implementation...
163 uno::Sequence<uno::Type> aTypeList (AccessibleShape::getTypes());
164 // ...and add the additional type for the component.
165 long nTypeCount = aTypeList.getLength();
166 aTypeList.realloc (nTypeCount + 1);
167 const uno::Type aActionType =
168 ::getCppuType((const uno::Reference<XAccessibleAction>*)0);
169 aTypeList[nTypeCount] = aActionType;
171 return aTypeList;
177 /// Set this object's name if is different to the current name.
178 OUString
179 AccessibleOLEShape::CreateAccessibleBaseName (void)
180 throw (::com::sun::star::uno::RuntimeException)
182 OUString sName;
184 ShapeTypeId nShapeType = ShapeTypeHandler::Instance().GetTypeId (mxShape);
185 switch (nShapeType)
187 case DRAWING_APPLET:
188 sName = "AppletOLEShape";
189 break;
190 case DRAWING_FRAME:
191 sName = "FrameOLEShape";
192 break;
193 case DRAWING_OLE:
194 sName = "OLEShape";
195 break;
196 case DRAWING_PLUGIN:
197 sName = "PluginOLEShape";
198 break;
200 default:
201 sName = "UnknownAccessibleOLEShape";
202 uno::Reference<drawing::XShapeDescriptor> xDescriptor (mxShape, uno::UNO_QUERY);
203 if (xDescriptor.is())
204 sName += ": " + xDescriptor->getShapeType();
207 return sName;
212 OUString
213 AccessibleOLEShape::CreateAccessibleDescription (void)
214 throw (::com::sun::star::uno::RuntimeException)
216 return CreateAccessibleName ();
219 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */