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_sw.hxx" 26 27 28 #include <vcl/svapp.hxx> 29 #include <com/sun/star/accessibility/AccessibleRole.hpp> 30 #include <com/sun/star/uno/RuntimeException.hpp> 31 #include <rtl/uuid.h> 32 #include <flyfrm.hxx> 33 #include "accgraphic.hxx" 34 35 using namespace ::com::sun::star; 36 using namespace ::com::sun::star::lang; 37 using namespace ::com::sun::star::uno; 38 using namespace ::com::sun::star::accessibility; 39 using ::rtl::OUString; 40 41 const sal_Char sServiceName[] = "com.sun.star.text.AccessibleTextGraphicObject"; 42 const sal_Char sImplementationName[] = "com.sun.star.comp.Writer.SwAccessibleGraphic"; 43 44 SwAccessibleGraphic::SwAccessibleGraphic( 45 SwAccessibleMap* pInitMap, 46 const SwFlyFrm* pFlyFrm ) : 47 SwAccessibleNoTextFrame( pInitMap, AccessibleRole::GRAPHIC, pFlyFrm ) 48 { 49 } 50 51 SwAccessibleGraphic::~SwAccessibleGraphic() 52 { 53 } 54 55 OUString SAL_CALL SwAccessibleGraphic::getImplementationName() 56 throw( RuntimeException ) 57 { 58 return OUString(RTL_CONSTASCII_USTRINGPARAM(sImplementationName)); 59 } 60 61 sal_Bool SAL_CALL SwAccessibleGraphic::supportsService( 62 const ::rtl::OUString& sTestServiceName) 63 throw (uno::RuntimeException) 64 { 65 return sTestServiceName.equalsAsciiL( sServiceName, 66 sizeof(sServiceName)-1 ) || 67 sTestServiceName.equalsAsciiL( sAccessibleServiceName, 68 sizeof(sAccessibleServiceName)-1 ); 69 } 70 71 Sequence< OUString > SAL_CALL SwAccessibleGraphic::getSupportedServiceNames() 72 throw( uno::RuntimeException ) 73 { 74 Sequence< OUString > aRet(2); 75 OUString* pArray = aRet.getArray(); 76 pArray[0] = OUString( RTL_CONSTASCII_USTRINGPARAM(sServiceName) ); 77 pArray[1] = OUString( RTL_CONSTASCII_USTRINGPARAM(sAccessibleServiceName) ); 78 return aRet; 79 } 80 81 Sequence< sal_Int8 > SAL_CALL SwAccessibleGraphic::getImplementationId() 82 throw(RuntimeException) 83 { 84 vos::OGuard aGuard(Application::GetSolarMutex()); 85 static Sequence< sal_Int8 > aId( 16 ); 86 static sal_Bool bInit = sal_False; 87 if(!bInit) 88 { 89 rtl_createUuid( (sal_uInt8 *)(aId.getArray() ), 0, sal_True ); 90 bInit = sal_True; 91 } 92 return aId; 93 } 94