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 "accembedded.hxx" 34 //IAccessibility2 Implementation 2009----- 35 #include "cntfrm.hxx" 36 #include "ndole.hxx" 37 #include <doc.hxx> 38 #include <docsh.hxx> 39 #include <../../ui/inc/wrtsh.hxx> 40 #include <../../ui/inc/view.hxx> 41 //-----IAccessibility2 Implementation 2009 42 43 using namespace ::com::sun::star; 44 using namespace ::com::sun::star::lang; 45 using namespace ::com::sun::star::accessibility; 46 using ::rtl::OUString; 47 48 const sal_Char sServiceName[] = "com.sun.star.text.AccessibleTextEmbeddedObject"; 49 const sal_Char sImplementationName[] = "com.sun.star.comp.Writer.SwAccessibleEmbeddedObject"; 50 51 SwAccessibleEmbeddedObject::SwAccessibleEmbeddedObject( 52 SwAccessibleMap* pInitMap, 53 const SwFlyFrm* pFlyFrm ) : 54 SwAccessibleNoTextFrame( pInitMap, AccessibleRole::EMBEDDED_OBJECT, pFlyFrm ) 55 { 56 } 57 58 SwAccessibleEmbeddedObject::~SwAccessibleEmbeddedObject() 59 { 60 } 61 62 //IAccessibility2 Implementation 2009----- 63 //===== XInterface ========================================================== 64 com::sun::star::uno::Any SAL_CALL 65 SwAccessibleEmbeddedObject::queryInterface (const com::sun::star::uno::Type & rType) 66 throw (::com::sun::star::uno::RuntimeException) 67 { 68 ::com::sun::star::uno::Any aReturn = SwAccessibleNoTextFrame::queryInterface (rType); 69 if ( ! aReturn.hasValue()) 70 aReturn = ::cppu::queryInterface (rType, 71 static_cast< ::com::sun::star::accessibility::XAccessibleExtendedAttributes* >(this) ); 72 return aReturn; 73 } 74 75 void SAL_CALL 76 SwAccessibleEmbeddedObject::acquire (void) 77 throw () 78 { 79 SwAccessibleNoTextFrame::acquire (); 80 } 81 82 void SAL_CALL 83 SwAccessibleEmbeddedObject::release (void) 84 throw () 85 { 86 SwAccessibleNoTextFrame::release (); 87 } 88 //-----IAccessibility2 Implementation 2009 89 90 OUString SAL_CALL SwAccessibleEmbeddedObject::getImplementationName() 91 throw( uno::RuntimeException ) 92 { 93 return OUString(RTL_CONSTASCII_USTRINGPARAM(sImplementationName)); 94 } 95 96 sal_Bool SAL_CALL SwAccessibleEmbeddedObject::supportsService( 97 const ::rtl::OUString& sTestServiceName) 98 throw (uno::RuntimeException) 99 { 100 return sTestServiceName.equalsAsciiL( sServiceName, 101 sizeof(sServiceName)-1 ) || 102 sTestServiceName.equalsAsciiL( sAccessibleServiceName, 103 sizeof(sAccessibleServiceName)-1 ); 104 } 105 106 uno::Sequence< OUString > SAL_CALL SwAccessibleEmbeddedObject::getSupportedServiceNames() 107 throw( uno::RuntimeException ) 108 { 109 uno::Sequence< OUString > aRet(2); 110 OUString* pArray = aRet.getArray(); 111 pArray[0] = OUString( RTL_CONSTASCII_USTRINGPARAM(sServiceName) ); 112 pArray[1] = OUString( RTL_CONSTASCII_USTRINGPARAM(sAccessibleServiceName) ); 113 return aRet; 114 } 115 116 117 uno::Sequence< sal_Int8 > SAL_CALL SwAccessibleEmbeddedObject::getImplementationId() 118 throw(uno::RuntimeException) 119 { 120 vos::OGuard aGuard(Application::GetSolarMutex()); 121 static uno::Sequence< sal_Int8 > aId( 16 ); 122 static sal_Bool bInit = sal_False; 123 if(!bInit) 124 { 125 rtl_createUuid( (sal_uInt8 *)(aId.getArray() ), 0, sal_True ); 126 bInit = sal_True; 127 } 128 return aId; 129 } 130 //IAccessibility2 Implementation 2009----- 131 //===== XAccessibleExtendedAttributes ======================================================== 132 ::com::sun::star::uno::Any SAL_CALL SwAccessibleEmbeddedObject::getExtendedAttributes() 133 throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) 134 { 135 ::com::sun::star::uno::Any strRet; 136 ::rtl::OUString style; 137 SwFlyFrm* pFFrm = getFlyFrm(); 138 139 if( pFFrm ) 140 { 141 style = ::rtl::OUString::createFromAscii("style:"); 142 SwCntntFrm* pCFrm; 143 pCFrm = pFFrm->ContainsCntnt(); 144 if( pCFrm ) 145 { 146 SwCntntNode* pCNode = pCFrm->GetNode(); 147 if( pCNode ) 148 { 149 style += ((SwOLENode*)pCNode)->GetOLEObj().GetStyleString(); 150 } 151 } 152 style += ::rtl::OUString::createFromAscii(";"); 153 } 154 strRet <<= style; 155 return strRet; 156 } 157 //-----IAccessibility2 Implementation 2009 158