xref: /aoo42x/main/sw/source/core/access/accpreview.cxx (revision cdf0e10c)
1  /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_sw.hxx"
30 
31 
32 #include <vcl/svapp.hxx>
33 #include <rtl/uuid.h>
34 #ifndef _ACCESS_HRC
35 #include "access.hrc"
36 #endif
37 #include <accpreview.hxx>
38 
39 
40 const sal_Char sServiceName[] = "com.sun.star.text.AccessibleTextDocumentPageView";
41 const sal_Char sImplementationName[] = "com.sun.star.comp.Writer.SwAccessibleDocumentPageView";
42 
43 
44 // using namespace accessibility;
45 
46 using ::com::sun::star::lang::IndexOutOfBoundsException;
47 using ::com::sun::star::uno::RuntimeException;
48 using ::com::sun::star::uno::Sequence;
49 using ::rtl::OUString;
50 
51 
52 
53 
54 //
55 // SwAccessiblePreview
56 //
57 
58 SwAccessiblePreview::SwAccessiblePreview( SwAccessibleMap *pMp ) :
59     SwAccessibleDocumentBase( pMp )
60 {
61 	SetName( GetResource( STR_ACCESS_DOC_NAME ) );
62 }
63 
64 SwAccessiblePreview::~SwAccessiblePreview()
65 {
66 }
67 
68 OUString SwAccessiblePreview::getImplementationName( )
69     throw( RuntimeException )
70 {
71     return OUString( RTL_CONSTASCII_USTRINGPARAM( sImplementationName ) );
72 }
73 
74 sal_Bool SwAccessiblePreview::supportsService( const OUString& rServiceName )
75     throw( RuntimeException )
76 {
77     return rServiceName.equalsAsciiL(
78         		RTL_CONSTASCII_STRINGPARAM( sServiceName) ) ||
79 		rServiceName.equalsAsciiL(
80 				RTL_CONSTASCII_STRINGPARAM( sAccessibleServiceName ) );
81 }
82 
83 Sequence<OUString> SwAccessiblePreview::getSupportedServiceNames( )
84     throw( RuntimeException )
85 {
86     Sequence<OUString> aSeq( 2 );
87     aSeq[0] = OUString( RTL_CONSTASCII_USTRINGPARAM( sServiceName ) );
88 	aSeq[1] = OUString( RTL_CONSTASCII_USTRINGPARAM( sAccessibleServiceName ) );
89     return aSeq;
90 }
91 
92 Sequence< sal_Int8 > SAL_CALL SwAccessiblePreview::getImplementationId()
93 		throw(RuntimeException)
94 {
95     vos::OGuard aGuard(Application::GetSolarMutex());
96     static Sequence< sal_Int8 > aId( 16 );
97     static sal_Bool bInit = sal_False;
98     if(!bInit)
99     {
100         rtl_createUuid( (sal_uInt8 *)(aId.getArray() ), 0, sal_True );
101         bInit = sal_True;
102     }
103     return aId;
104 }
105