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 { 60 return OUString(RTL_CONSTASCII_USTRINGPARAM(sImplementationName)); 61 } 62 63 sal_Bool SAL_CALL SwAccessibleGraphic::supportsService( 64 const ::rtl::OUString& sTestServiceName) 65 { 66 return sTestServiceName.equalsAsciiL( sServiceName, 67 sizeof(sServiceName)-1 ) || 68 sTestServiceName.equalsAsciiL( sAccessibleServiceName, 69 sizeof(sAccessibleServiceName)-1 ); 70 } 71 72 Sequence< OUString > SAL_CALL SwAccessibleGraphic::getSupportedServiceNames() 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 { 83 vos::OGuard aGuard(Application::GetSolarMutex()); 84 static Sequence< sal_Int8 > aId( 16 ); 85 static sal_Bool bInit = sal_False; 86 if(!bInit) 87 { 88 rtl_createUuid( (sal_uInt8 *)(aId.getArray() ), 0, sal_True ); 89 bInit = sal_True; 90 } 91 return aId; 92 } 93 // Return this object's role. 94 sal_Int16 SAL_CALL SwAccessibleGraphic::getAccessibleRole (void) 95 { 96 SwFmtURL aURL( ((SwLayoutFrm*)GetFrm())->GetFmt()->GetURL() ); 97 98 if(aURL.GetMap() ) 99 return AccessibleRole::IMAGE_MAP ; 100 return AccessibleRole::GRAPHIC ; 101 } 102