1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 // MARKER(update_precomp.py): autogen include statement, do not remove 29 #include "precompiled_svx.hxx" 30 31 32 #include <svx/AccessibleOLEShape.hxx> 33 34 #include <svx/ShapeTypeHandler.hxx> 35 #include <svx/SvxShapeTypes.hxx> 36 37 using namespace accessibility; 38 using namespace ::com::sun::star; 39 using namespace ::com::sun::star::uno; 40 using namespace ::com::sun::star::accessibility; 41 42 //===== internal ============================================================ 43 44 AccessibleOLEShape::AccessibleOLEShape ( 45 const AccessibleShapeInfo& rShapeInfo, 46 const AccessibleShapeTreeInfo& rShapeTreeInfo) 47 : AccessibleShape (rShapeInfo, rShapeTreeInfo) 48 { 49 } 50 51 52 53 54 AccessibleOLEShape::~AccessibleOLEShape (void) 55 { 56 } 57 58 59 60 61 //===== XAccessibleAction =================================================== 62 63 sal_Int32 SAL_CALL AccessibleOLEShape::getAccessibleActionCount (void) 64 throw (::com::sun::star::uno::RuntimeException) 65 { 66 return 0; 67 } 68 69 70 71 72 sal_Bool SAL_CALL AccessibleOLEShape::doAccessibleAction (sal_Int32 /*nIndex*/) 73 throw (lang::IndexOutOfBoundsException, uno::RuntimeException) 74 { 75 throw lang::IndexOutOfBoundsException(); 76 } 77 78 79 80 81 ::rtl::OUString SAL_CALL AccessibleOLEShape::getAccessibleActionDescription (sal_Int32 /*nIndex*/) 82 throw (::com::sun::star::lang::IndexOutOfBoundsException, 83 ::com::sun::star::uno::RuntimeException) 84 { 85 throw lang::IndexOutOfBoundsException(); 86 } 87 88 89 90 91 Reference<XAccessibleKeyBinding> SAL_CALL AccessibleOLEShape::getAccessibleActionKeyBinding (sal_Int32 /*nIndex*/) 92 throw (::com::sun::star::lang::IndexOutOfBoundsException, 93 ::com::sun::star::uno::RuntimeException) 94 { 95 throw lang::IndexOutOfBoundsException(); 96 } 97 98 99 100 101 //===== XInterface ========================================================== 102 103 com::sun::star::uno::Any SAL_CALL 104 AccessibleOLEShape::queryInterface (const com::sun::star::uno::Type & rType) 105 throw (::com::sun::star::uno::RuntimeException) 106 { 107 ::com::sun::star::uno::Any aReturn = AccessibleShape::queryInterface (rType); 108 if ( ! aReturn.hasValue()) 109 aReturn = ::cppu::queryInterface (rType, 110 static_cast<XAccessibleAction*>(this)); 111 return aReturn; 112 } 113 114 115 116 void SAL_CALL 117 AccessibleOLEShape::acquire (void) 118 throw () 119 { 120 AccessibleShape::acquire (); 121 } 122 123 124 125 void SAL_CALL 126 AccessibleOLEShape::release (void) 127 throw () 128 { 129 AccessibleShape::release (); 130 } 131 132 133 134 135 //===== XServiceInfo ======================================================== 136 137 ::rtl::OUString SAL_CALL 138 AccessibleOLEShape::getImplementationName (void) 139 throw (::com::sun::star::uno::RuntimeException) 140 { 141 return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AccessibleOLEShape")); 142 } 143 144 145 146 147 ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL 148 AccessibleOLEShape::getSupportedServiceNames (void) 149 throw (::com::sun::star::uno::RuntimeException) 150 { 151 ThrowIfDisposed(); 152 // Get list of supported service names from base class... 153 uno::Sequence< ::rtl::OUString > aServiceNames = 154 AccessibleShape::getSupportedServiceNames(); 155 sal_Int32 nCount (aServiceNames.getLength()); 156 157 // ...and add additional names. 158 aServiceNames.realloc (nCount + 1); 159 static const ::rtl::OUString sAdditionalServiceName (RTL_CONSTASCII_USTRINGPARAM( 160 "com.sun.star.drawing.AccessibleOLEShape")); 161 aServiceNames[nCount] = sAdditionalServiceName; 162 163 return aServiceNames; 164 } 165 166 167 168 169 //===== XTypeProvider =================================================== 170 171 uno::Sequence<uno::Type> SAL_CALL 172 AccessibleOLEShape::getTypes (void) 173 throw (uno::RuntimeException) 174 { 175 // Get list of types from the context base implementation... 176 uno::Sequence<uno::Type> aTypeList (AccessibleShape::getTypes()); 177 // ...and add the additional type for the component. 178 long nTypeCount = aTypeList.getLength(); 179 aTypeList.realloc (nTypeCount + 1); 180 const uno::Type aActionType = 181 ::getCppuType((const uno::Reference<XAccessibleAction>*)0); 182 aTypeList[nTypeCount] = aActionType; 183 184 return aTypeList; 185 } 186 187 188 189 190 /// Set this object's name if is different to the current name. 191 ::rtl::OUString 192 AccessibleOLEShape::CreateAccessibleBaseName (void) 193 throw (::com::sun::star::uno::RuntimeException) 194 { 195 ::rtl::OUString sName; 196 197 ShapeTypeId nShapeType = ShapeTypeHandler::Instance().GetTypeId (mxShape); 198 switch (nShapeType) 199 { 200 case DRAWING_APPLET: 201 sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("AppletOLEShape")); 202 break; 203 case DRAWING_FRAME: 204 sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("FrameOLEShape")); 205 break; 206 case DRAWING_OLE: 207 sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("OLEShape")); 208 break; 209 case DRAWING_PLUGIN: 210 sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("PluginOLEShape")); 211 break; 212 213 default: 214 sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("UnknownAccessibleOLEShape")); 215 uno::Reference<drawing::XShapeDescriptor> xDescriptor (mxShape, uno::UNO_QUERY); 216 if (xDescriptor.is()) 217 sName += ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM(": ")) 218 + xDescriptor->getShapeType(); 219 } 220 221 return sName; 222 } 223 224 225 226 ::rtl::OUString 227 AccessibleOLEShape::CreateAccessibleDescription (void) 228 throw (::com::sun::star::uno::RuntimeException) 229 { 230 return CreateAccessibleName (); 231 } 232 233