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