update dev300-m58
[ooovba.git] / svx / source / accessibility / AccessibleOLEShape.cxx
blob76142ed8f22fa229dafb5da596e69802cd1b2090
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: AccessibleOLEShape.cxx,v $
10 * $Revision: 1.20 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_svx.hxx"
35 #include <svx/AccessibleOLEShape.hxx>
37 #include <svx/ShapeTypeHandler.hxx>
38 #include <svx/SvxShapeTypes.hxx>
40 using namespace accessibility;
41 using namespace ::com::sun::star;
42 using namespace ::com::sun::star::uno;
43 using namespace ::com::sun::star::accessibility;
45 //===== internal ============================================================
47 AccessibleOLEShape::AccessibleOLEShape (
48 const AccessibleShapeInfo& rShapeInfo,
49 const AccessibleShapeTreeInfo& rShapeTreeInfo)
50 : AccessibleShape (rShapeInfo, rShapeTreeInfo)
57 AccessibleOLEShape::~AccessibleOLEShape (void)
64 //===== XAccessibleAction ===================================================
66 sal_Int32 SAL_CALL AccessibleOLEShape::getAccessibleActionCount (void)
67 throw (::com::sun::star::uno::RuntimeException)
69 return 0;
75 sal_Bool SAL_CALL AccessibleOLEShape::doAccessibleAction (sal_Int32 /*nIndex*/)
76 throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
78 throw lang::IndexOutOfBoundsException();
84 ::rtl::OUString SAL_CALL AccessibleOLEShape::getAccessibleActionDescription (sal_Int32 /*nIndex*/)
85 throw (::com::sun::star::lang::IndexOutOfBoundsException,
86 ::com::sun::star::uno::RuntimeException)
88 throw lang::IndexOutOfBoundsException();
94 Reference<XAccessibleKeyBinding> SAL_CALL AccessibleOLEShape::getAccessibleActionKeyBinding (sal_Int32 /*nIndex*/)
95 throw (::com::sun::star::lang::IndexOutOfBoundsException,
96 ::com::sun::star::uno::RuntimeException)
98 throw lang::IndexOutOfBoundsException();
104 //===== XInterface ==========================================================
106 com::sun::star::uno::Any SAL_CALL
107 AccessibleOLEShape::queryInterface (const com::sun::star::uno::Type & rType)
108 throw (::com::sun::star::uno::RuntimeException)
110 ::com::sun::star::uno::Any aReturn = AccessibleShape::queryInterface (rType);
111 if ( ! aReturn.hasValue())
112 aReturn = ::cppu::queryInterface (rType,
113 static_cast<XAccessibleAction*>(this));
114 return aReturn;
119 void SAL_CALL
120 AccessibleOLEShape::acquire (void)
121 throw ()
123 AccessibleShape::acquire ();
128 void SAL_CALL
129 AccessibleOLEShape::release (void)
130 throw ()
132 AccessibleShape::release ();
138 //===== XServiceInfo ========================================================
140 ::rtl::OUString SAL_CALL
141 AccessibleOLEShape::getImplementationName (void)
142 throw (::com::sun::star::uno::RuntimeException)
144 return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AccessibleOLEShape"));
150 ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL
151 AccessibleOLEShape::getSupportedServiceNames (void)
152 throw (::com::sun::star::uno::RuntimeException)
154 ThrowIfDisposed();
155 // Get list of supported service names from base class...
156 uno::Sequence< ::rtl::OUString > aServiceNames =
157 AccessibleShape::getSupportedServiceNames();
158 sal_Int32 nCount (aServiceNames.getLength());
160 // ...and add additional names.
161 aServiceNames.realloc (nCount + 1);
162 static const ::rtl::OUString sAdditionalServiceName (RTL_CONSTASCII_USTRINGPARAM(
163 "com.sun.star.drawing.AccessibleOLEShape"));
164 aServiceNames[nCount] = sAdditionalServiceName;
166 return aServiceNames;
172 //===== XTypeProvider ===================================================
174 uno::Sequence<uno::Type> SAL_CALL
175 AccessibleOLEShape::getTypes (void)
176 throw (uno::RuntimeException)
178 // Get list of types from the context base implementation...
179 uno::Sequence<uno::Type> aTypeList (AccessibleShape::getTypes());
180 // ...and add the additional type for the component.
181 long nTypeCount = aTypeList.getLength();
182 aTypeList.realloc (nTypeCount + 1);
183 const uno::Type aActionType =
184 ::getCppuType((const uno::Reference<XAccessibleAction>*)0);
185 aTypeList[nTypeCount] = aActionType;
187 return aTypeList;
193 /// Set this object's name if is different to the current name.
194 ::rtl::OUString
195 AccessibleOLEShape::CreateAccessibleBaseName (void)
196 throw (::com::sun::star::uno::RuntimeException)
198 ::rtl::OUString sName;
200 ShapeTypeId nShapeType = ShapeTypeHandler::Instance().GetTypeId (mxShape);
201 switch (nShapeType)
203 case DRAWING_APPLET:
204 sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("AppletOLEShape"));
205 break;
206 case DRAWING_FRAME:
207 sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("FrameOLEShape"));
208 break;
209 case DRAWING_OLE:
210 sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("OLEShape"));
211 break;
212 case DRAWING_PLUGIN:
213 sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("PluginOLEShape"));
214 break;
216 default:
217 sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("UnknownAccessibleOLEShape"));
218 uno::Reference<drawing::XShapeDescriptor> xDescriptor (mxShape, uno::UNO_QUERY);
219 if (xDescriptor.is())
220 sName += ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM(": "))
221 + xDescriptor->getShapeType();
224 return sName;
229 ::rtl::OUString
230 AccessibleOLEShape::CreateAccessibleDescription (void)
231 throw (::com::sun::star::uno::RuntimeException)
233 return CreateAccessibleName ();