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