Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #include <vcl/svapp.hxx>
21 : #include <com/sun/star/accessibility/AccessibleRole.hpp>
22 : #include <com/sun/star/uno/RuntimeException.hpp>
23 : #include <comphelper/servicehelper.hxx>
24 : #include <cppuhelper/supportsservice.hxx>
25 : #include <flyfrm.hxx>
26 : #include <fmturl.hxx>
27 : #include "accgraphic.hxx"
28 :
29 : using namespace ::com::sun::star;
30 : using namespace ::com::sun::star::lang;
31 : using namespace ::com::sun::star::uno;
32 : using namespace ::com::sun::star::accessibility;
33 :
34 1 : SwAccessibleGraphic::SwAccessibleGraphic(
35 : SwAccessibleMap* pInitMap,
36 : const SwFlyFrm* pFlyFrm ) :
37 1 : SwAccessibleNoTextFrame( pInitMap, AccessibleRole::GRAPHIC, pFlyFrm )
38 : {
39 1 : }
40 :
41 2 : SwAccessibleGraphic::~SwAccessibleGraphic()
42 : {
43 2 : }
44 :
45 1 : OUString SAL_CALL SwAccessibleGraphic::getImplementationName()
46 : throw( RuntimeException, std::exception )
47 : {
48 1 : return OUString("com.sun.star.comp.Writer.SwAccessibleGraphic");
49 : }
50 :
51 0 : sal_Bool SAL_CALL SwAccessibleGraphic::supportsService(const OUString& sTestServiceName)
52 : throw (uno::RuntimeException, std::exception)
53 : {
54 0 : return cppu::supportsService(this, sTestServiceName);
55 : }
56 :
57 0 : Sequence< OUString > SAL_CALL SwAccessibleGraphic::getSupportedServiceNames()
58 : throw( uno::RuntimeException, std::exception )
59 : {
60 0 : Sequence< OUString > aRet(2);
61 0 : OUString* pArray = aRet.getArray();
62 0 : pArray[0] = "com.sun.star.text.AccessibleTextGraphicObject";
63 0 : pArray[1] = sAccessibleServiceName;
64 0 : return aRet;
65 : }
66 :
67 0 : Sequence< sal_Int8 > SAL_CALL SwAccessibleGraphic::getImplementationId()
68 : throw(RuntimeException, std::exception)
69 : {
70 0 : return css::uno::Sequence<sal_Int8>();
71 : }
72 :
73 : // Return this object's role.
74 1 : sal_Int16 SAL_CALL SwAccessibleGraphic::getAccessibleRole()
75 : throw (::com::sun::star::uno::RuntimeException, std::exception)
76 : {
77 1 : SolarMutexGuard g;
78 :
79 2 : SwFormatURL aURL( static_cast<const SwLayoutFrm*>(GetFrm())->GetFormat()->GetURL() );
80 :
81 1 : if (aURL.GetMap())
82 0 : return AccessibleRole::IMAGE_MAP;
83 2 : return AccessibleRole::GRAPHIC;
84 177 : }
85 :
86 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|