xref: /AOO41X/main/sw/source/core/access/accgraphic.cxx (revision 4d7c9de063a797b8b4f3d45e3561e82ad1f8ef1f)
1efeef26fSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3efeef26fSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4efeef26fSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5efeef26fSAndrew Rist  * distributed with this work for additional information
6efeef26fSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7efeef26fSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8efeef26fSAndrew Rist  * "License"); you may not use this file except in compliance
9efeef26fSAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11efeef26fSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13efeef26fSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14efeef26fSAndrew Rist  * software distributed under the License is distributed on an
15efeef26fSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16efeef26fSAndrew Rist  * KIND, either express or implied.  See the License for the
17efeef26fSAndrew Rist  * specific language governing permissions and limitations
18efeef26fSAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20efeef26fSAndrew Rist  *************************************************************/
21efeef26fSAndrew Rist 
22efeef26fSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sw.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir 
28cdf0e10cSrcweir #include <vcl/svapp.hxx>
29cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleRole.hpp>
30cdf0e10cSrcweir #include <com/sun/star/uno/RuntimeException.hpp>
31cdf0e10cSrcweir #include <rtl/uuid.h>
32cdf0e10cSrcweir #include <flyfrm.hxx>
33cdf0e10cSrcweir #include "accgraphic.hxx"
34cdf0e10cSrcweir 
35cdf0e10cSrcweir using namespace ::com::sun::star;
36*ca62e2c2SSteve Yin #ifndef _FMTURL_HXX //autogen
37*ca62e2c2SSteve Yin #include <fmturl.hxx>
38*ca62e2c2SSteve Yin #endif
39cdf0e10cSrcweir using namespace ::com::sun::star::lang;
40cdf0e10cSrcweir using namespace ::com::sun::star::uno;
41cdf0e10cSrcweir using namespace ::com::sun::star::accessibility;
42cdf0e10cSrcweir using ::rtl::OUString;
43cdf0e10cSrcweir 
44cdf0e10cSrcweir const sal_Char sServiceName[] = "com.sun.star.text.AccessibleTextGraphicObject";
45cdf0e10cSrcweir const sal_Char sImplementationName[] = "com.sun.star.comp.Writer.SwAccessibleGraphic";
46cdf0e10cSrcweir 
SwAccessibleGraphic(SwAccessibleMap * pInitMap,const SwFlyFrm * pFlyFrm)47cdf0e10cSrcweir SwAccessibleGraphic::SwAccessibleGraphic(
48cdf0e10cSrcweir         SwAccessibleMap* pInitMap,
49cdf0e10cSrcweir         const SwFlyFrm* pFlyFrm  ) :
50cdf0e10cSrcweir     SwAccessibleNoTextFrame( pInitMap, AccessibleRole::GRAPHIC, pFlyFrm )
51cdf0e10cSrcweir {
52cdf0e10cSrcweir }
53cdf0e10cSrcweir 
~SwAccessibleGraphic()54cdf0e10cSrcweir SwAccessibleGraphic::~SwAccessibleGraphic()
55cdf0e10cSrcweir {
56cdf0e10cSrcweir }
57cdf0e10cSrcweir 
getImplementationName()58cdf0e10cSrcweir OUString SAL_CALL SwAccessibleGraphic::getImplementationName()
59cdf0e10cSrcweir         throw( RuntimeException )
60cdf0e10cSrcweir {
61cdf0e10cSrcweir 	return OUString(RTL_CONSTASCII_USTRINGPARAM(sImplementationName));
62cdf0e10cSrcweir }
63cdf0e10cSrcweir 
supportsService(const::rtl::OUString & sTestServiceName)64cdf0e10cSrcweir sal_Bool SAL_CALL SwAccessibleGraphic::supportsService(
65cdf0e10cSrcweir 		const ::rtl::OUString& sTestServiceName)
66cdf0e10cSrcweir     throw (uno::RuntimeException)
67cdf0e10cSrcweir {
68cdf0e10cSrcweir 	return sTestServiceName.equalsAsciiL( sServiceName,
69cdf0e10cSrcweir 										  sizeof(sServiceName)-1 ) ||
70cdf0e10cSrcweir 		   sTestServiceName.equalsAsciiL( sAccessibleServiceName,
71cdf0e10cSrcweir 				   						  sizeof(sAccessibleServiceName)-1 );
72cdf0e10cSrcweir }
73cdf0e10cSrcweir 
getSupportedServiceNames()74cdf0e10cSrcweir Sequence< OUString > SAL_CALL SwAccessibleGraphic::getSupportedServiceNames()
75cdf0e10cSrcweir         throw( uno::RuntimeException )
76cdf0e10cSrcweir {
77cdf0e10cSrcweir 	Sequence< OUString > aRet(2);
78cdf0e10cSrcweir 	OUString* pArray = aRet.getArray();
79cdf0e10cSrcweir 	pArray[0] = OUString( RTL_CONSTASCII_USTRINGPARAM(sServiceName) );
80cdf0e10cSrcweir 	pArray[1] = OUString( RTL_CONSTASCII_USTRINGPARAM(sAccessibleServiceName) );
81cdf0e10cSrcweir 	return aRet;
82cdf0e10cSrcweir }
83cdf0e10cSrcweir 
getImplementationId()84cdf0e10cSrcweir Sequence< sal_Int8 > SAL_CALL SwAccessibleGraphic::getImplementationId()
85cdf0e10cSrcweir 		throw(RuntimeException)
86cdf0e10cSrcweir {
87cdf0e10cSrcweir     vos::OGuard aGuard(Application::GetSolarMutex());
88cdf0e10cSrcweir     static Sequence< sal_Int8 > aId( 16 );
89cdf0e10cSrcweir     static sal_Bool bInit = sal_False;
90cdf0e10cSrcweir     if(!bInit)
91cdf0e10cSrcweir     {
92cdf0e10cSrcweir         rtl_createUuid( (sal_uInt8 *)(aId.getArray() ), 0, sal_True );
93cdf0e10cSrcweir         bInit = sal_True;
94cdf0e10cSrcweir     }
95cdf0e10cSrcweir     return aId;
96cdf0e10cSrcweir }
97*ca62e2c2SSteve Yin //	Return this object's role.
getAccessibleRole(void)98*ca62e2c2SSteve Yin sal_Int16 SAL_CALL SwAccessibleGraphic::getAccessibleRole (void)
99*ca62e2c2SSteve Yin         throw (::com::sun::star::uno::RuntimeException)
100*ca62e2c2SSteve Yin {
101*ca62e2c2SSteve Yin 		SwFmtURL aURL( ((SwLayoutFrm*)GetFrm())->GetFmt()->GetURL() );
102*ca62e2c2SSteve Yin 
103*ca62e2c2SSteve Yin 		if(aURL.GetMap() )
104*ca62e2c2SSteve Yin 			return AccessibleRole::IMAGE_MAP ;
105*ca62e2c2SSteve Yin 		return AccessibleRole::GRAPHIC ;
106*ca62e2c2SSteve Yin }
107