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 <rtl/uuid.h> 30 #ifndef _ACCESS_HRC 31 #include "access.hrc" 32 #endif 33 #include <accpreview.hxx> 34 35 //IAccessibility2 Implementation 2009----- 36 #ifndef _COM_SUN_STAR_ACCESSIBILITY_ACCESSIBLESTATETYPE_HPP_ 37 #include <com/sun/star/accessibility/AccessibleStateType.hpp> 38 #endif 39 //-----IAccessibility2 Implementation 2009 40 41 const sal_Char sServiceName[] = "com.sun.star.text.AccessibleTextDocumentPageView"; 42 const sal_Char sImplementationName[] = "com.sun.star.comp.Writer.SwAccessibleDocumentPageView"; 43 44 45 // using namespace accessibility; 46 47 using ::com::sun::star::lang::IndexOutOfBoundsException; 48 using ::com::sun::star::uno::RuntimeException; 49 using ::com::sun::star::uno::Sequence; 50 using ::rtl::OUString; 51 52 53 54 55 // 56 // SwAccessiblePreview 57 // 58 59 SwAccessiblePreview::SwAccessiblePreview( SwAccessibleMap *pMp ) : 60 SwAccessibleDocumentBase( pMp ) 61 { 62 //IAccessibility2 Implementation 2009----- 63 SetName( GetResource( STR_ACCESS_PREVIEW_DOC_NAME ) ); 64 //-----IAccessibility2 Implementation 2009 65 } 66 67 SwAccessiblePreview::~SwAccessiblePreview() 68 { 69 } 70 71 OUString SwAccessiblePreview::getImplementationName( ) 72 throw( RuntimeException ) 73 { 74 return OUString( RTL_CONSTASCII_USTRINGPARAM( sImplementationName ) ); 75 } 76 77 sal_Bool SwAccessiblePreview::supportsService( const OUString& rServiceName ) 78 throw( RuntimeException ) 79 { 80 return rServiceName.equalsAsciiL( 81 RTL_CONSTASCII_STRINGPARAM( sServiceName) ) || 82 rServiceName.equalsAsciiL( 83 RTL_CONSTASCII_STRINGPARAM( sAccessibleServiceName ) ); 84 } 85 86 Sequence<OUString> SwAccessiblePreview::getSupportedServiceNames( ) 87 throw( RuntimeException ) 88 { 89 Sequence<OUString> aSeq( 2 ); 90 aSeq[0] = OUString( RTL_CONSTASCII_USTRINGPARAM( sServiceName ) ); 91 aSeq[1] = OUString( RTL_CONSTASCII_USTRINGPARAM( sAccessibleServiceName ) ); 92 return aSeq; 93 } 94 95 Sequence< sal_Int8 > SAL_CALL SwAccessiblePreview::getImplementationId() 96 throw(RuntimeException) 97 { 98 vos::OGuard aGuard(Application::GetSolarMutex()); 99 static Sequence< sal_Int8 > aId( 16 ); 100 static sal_Bool bInit = sal_False; 101 if(!bInit) 102 { 103 rtl_createUuid( (sal_uInt8 *)(aId.getArray() ), 0, sal_True ); 104 bInit = sal_True; 105 } 106 return aId; 107 } 108 //IAccessibility2 Implementation 2009----- 109 OUString SAL_CALL SwAccessiblePreview::getAccessibleDescription (void) throw (com::sun::star::uno::RuntimeException) 110 { 111 return GetResource( STR_ACCESS_PREVIEW_DOC_NAME ); 112 } 113 114 OUString SAL_CALL SwAccessiblePreview::getAccessibleName (void) throw (::com::sun::star::uno::RuntimeException) 115 { 116 OUString sName = SwAccessibleDocumentBase::getAccessibleName(); 117 sName += OUString::createFromAscii(" "); 118 sName += GetResource( STR_ACCESS_PREVIEW_DOC_SUFFIX ); 119 return sName; 120 } 121 void SwAccessiblePreview::_InvalidateFocus() 122 { 123 FireStateChangedEvent( ::com::sun::star::accessibility::AccessibleStateType::FOCUSED, sal_True ); 124 } 125 //-----IAccessibility2 Implementation 2009 126