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