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 //IAccessibility2 Implementation 2009----- 37 #ifndef _FMTURL_HXX //autogen 38 #include <fmturl.hxx> 39 #endif 40 //-----IAccessibility2 Implementation 2009 41 using namespace ::com::sun::star::lang; 42 using namespace ::com::sun::star::uno; 43 using namespace ::com::sun::star::accessibility; 44 using ::rtl::OUString; 45 46 const sal_Char sServiceName[] = "com.sun.star.text.AccessibleTextGraphicObject"; 47 const sal_Char sImplementationName[] = "com.sun.star.comp.Writer.SwAccessibleGraphic"; 48 49 SwAccessibleGraphic::SwAccessibleGraphic( 50 SwAccessibleMap* pInitMap, 51 const SwFlyFrm* pFlyFrm ) : 52 SwAccessibleNoTextFrame( pInitMap, AccessibleRole::GRAPHIC, pFlyFrm ) 53 { 54 } 55 56 SwAccessibleGraphic::~SwAccessibleGraphic() 57 { 58 } 59 60 OUString SAL_CALL SwAccessibleGraphic::getImplementationName() 61 throw( RuntimeException ) 62 { 63 return OUString(RTL_CONSTASCII_USTRINGPARAM(sImplementationName)); 64 } 65 66 sal_Bool SAL_CALL SwAccessibleGraphic::supportsService( 67 const ::rtl::OUString& sTestServiceName) 68 throw (uno::RuntimeException) 69 { 70 return sTestServiceName.equalsAsciiL( sServiceName, 71 sizeof(sServiceName)-1 ) || 72 sTestServiceName.equalsAsciiL( sAccessibleServiceName, 73 sizeof(sAccessibleServiceName)-1 ); 74 } 75 76 Sequence< OUString > SAL_CALL SwAccessibleGraphic::getSupportedServiceNames() 77 throw( uno::RuntimeException ) 78 { 79 Sequence< OUString > aRet(2); 80 OUString* pArray = aRet.getArray(); 81 pArray[0] = OUString( RTL_CONSTASCII_USTRINGPARAM(sServiceName) ); 82 pArray[1] = OUString( RTL_CONSTASCII_USTRINGPARAM(sAccessibleServiceName) ); 83 return aRet; 84 } 85 86 Sequence< sal_Int8 > SAL_CALL SwAccessibleGraphic::getImplementationId() 87 throw(RuntimeException) 88 { 89 vos::OGuard aGuard(Application::GetSolarMutex()); 90 static Sequence< sal_Int8 > aId( 16 ); 91 static sal_Bool bInit = sal_False; 92 if(!bInit) 93 { 94 rtl_createUuid( (sal_uInt8 *)(aId.getArray() ), 0, sal_True ); 95 bInit = sal_True; 96 } 97 return aId; 98 } 99 //IAccessibility2 Implementation 2009----- 100 // Return this object's role. 101 sal_Int16 SAL_CALL SwAccessibleGraphic::getAccessibleRole (void) 102 throw (::com::sun::star::uno::RuntimeException) 103 { 104 SwFmtURL aURL( ((SwLayoutFrm*)GetFrm())->GetFmt()->GetURL() ); 105 106 if(aURL.GetMap() ) 107 return AccessibleRole::IMAGE_MAP ; 108 return AccessibleRole::GRAPHIC ; 109 } 110 //-----IAccessibility2 Implementation 2009 111