xref: /aoo41x/main/sw/source/core/access/accgraphic.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 <com/sun/star/accessibility/AccessibleRole.hpp>
34 #include <com/sun/star/uno/RuntimeException.hpp>
35 #include <rtl/uuid.h>
36 #include <flyfrm.hxx>
37 #include "accgraphic.hxx"
38 
39 using namespace ::com::sun::star;
40 using namespace ::com::sun::star::lang;
41 using namespace ::com::sun::star::uno;
42 using namespace ::com::sun::star::accessibility;
43 using ::rtl::OUString;
44 
45 const sal_Char sServiceName[] = "com.sun.star.text.AccessibleTextGraphicObject";
46 const sal_Char sImplementationName[] = "com.sun.star.comp.Writer.SwAccessibleGraphic";
47 
48 SwAccessibleGraphic::SwAccessibleGraphic(
49         SwAccessibleMap* pInitMap,
50         const SwFlyFrm* pFlyFrm  ) :
51     SwAccessibleNoTextFrame( pInitMap, AccessibleRole::GRAPHIC, pFlyFrm )
52 {
53 }
54 
55 SwAccessibleGraphic::~SwAccessibleGraphic()
56 {
57 }
58 
59 OUString SAL_CALL SwAccessibleGraphic::getImplementationName()
60         throw( RuntimeException )
61 {
62 	return OUString(RTL_CONSTASCII_USTRINGPARAM(sImplementationName));
63 }
64 
65 sal_Bool SAL_CALL SwAccessibleGraphic::supportsService(
66 		const ::rtl::OUString& sTestServiceName)
67     throw (uno::RuntimeException)
68 {
69 	return sTestServiceName.equalsAsciiL( sServiceName,
70 										  sizeof(sServiceName)-1 ) ||
71 		   sTestServiceName.equalsAsciiL( sAccessibleServiceName,
72 				   						  sizeof(sAccessibleServiceName)-1 );
73 }
74 
75 Sequence< OUString > SAL_CALL SwAccessibleGraphic::getSupportedServiceNames()
76         throw( uno::RuntimeException )
77 {
78 	Sequence< OUString > aRet(2);
79 	OUString* pArray = aRet.getArray();
80 	pArray[0] = OUString( RTL_CONSTASCII_USTRINGPARAM(sServiceName) );
81 	pArray[1] = OUString( RTL_CONSTASCII_USTRINGPARAM(sAccessibleServiceName) );
82 	return aRet;
83 }
84 
85 Sequence< sal_Int8 > SAL_CALL SwAccessibleGraphic::getImplementationId()
86 		throw(RuntimeException)
87 {
88     vos::OGuard aGuard(Application::GetSolarMutex());
89     static Sequence< sal_Int8 > aId( 16 );
90     static sal_Bool bInit = sal_False;
91     if(!bInit)
92     {
93         rtl_createUuid( (sal_uInt8 *)(aId.getArray() ), 0, sal_True );
94         bInit = sal_True;
95     }
96     return aId;
97 }
98