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