xref: /trunk/main/sw/source/core/access/accpreview.cxx (revision efeef26f)
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 
36 const sal_Char sServiceName[] = "com.sun.star.text.AccessibleTextDocumentPageView";
37 const sal_Char sImplementationName[] = "com.sun.star.comp.Writer.SwAccessibleDocumentPageView";
38 
39 
40 // using namespace accessibility;
41 
42 using ::com::sun::star::lang::IndexOutOfBoundsException;
43 using ::com::sun::star::uno::RuntimeException;
44 using ::com::sun::star::uno::Sequence;
45 using ::rtl::OUString;
46 
47 
48 
49 
50 //
51 // SwAccessiblePreview
52 //
53 
54 SwAccessiblePreview::SwAccessiblePreview( SwAccessibleMap *pMp ) :
55     SwAccessibleDocumentBase( pMp )
56 {
57 	SetName( GetResource( STR_ACCESS_DOC_NAME ) );
58 }
59 
60 SwAccessiblePreview::~SwAccessiblePreview()
61 {
62 }
63 
64 OUString SwAccessiblePreview::getImplementationName( )
65     throw( RuntimeException )
66 {
67     return OUString( RTL_CONSTASCII_USTRINGPARAM( sImplementationName ) );
68 }
69 
70 sal_Bool SwAccessiblePreview::supportsService( const OUString& rServiceName )
71     throw( RuntimeException )
72 {
73     return rServiceName.equalsAsciiL(
74         		RTL_CONSTASCII_STRINGPARAM( sServiceName) ) ||
75 		rServiceName.equalsAsciiL(
76 				RTL_CONSTASCII_STRINGPARAM( sAccessibleServiceName ) );
77 }
78 
79 Sequence<OUString> SwAccessiblePreview::getSupportedServiceNames( )
80     throw( RuntimeException )
81 {
82     Sequence<OUString> aSeq( 2 );
83     aSeq[0] = OUString( RTL_CONSTASCII_USTRINGPARAM( sServiceName ) );
84 	aSeq[1] = OUString( RTL_CONSTASCII_USTRINGPARAM( sAccessibleServiceName ) );
85     return aSeq;
86 }
87 
88 Sequence< sal_Int8 > SAL_CALL SwAccessiblePreview::getImplementationId()
89 		throw(RuntimeException)
90 {
91     vos::OGuard aGuard(Application::GetSolarMutex());
92     static Sequence< sal_Int8 > aId( 16 );
93     static sal_Bool bInit = sal_False;
94     if(!bInit)
95     {
96         rtl_createUuid( (sal_uInt8 *)(aId.getArray() ), 0, sal_True );
97         bInit = sal_True;
98     }
99     return aId;
100 }
101