| 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 "AccessibleChartShape.hxx" |
| 21 |
|
| 22 |
#include <svx/ShapeTypeHandler.hxx> |
| 23 |
#include <svx/AccessibleShape.hxx> |
| 24 |
#include <svx/AccessibleShapeInfo.hxx> |
| 25 |
|
| 26 |
using namespace ::com::sun::star; |
| 27 |
using namespace ::com::sun::star::accessibility; |
| 28 |
|
| 29 |
using ::com::sun::star::uno::Reference; |
| 30 |
|
| 31 |
namespace chart |
| 32 |
{ |
| 33 |
|
| 34 |
AccessibleChartShape::AccessibleChartShape( |
| 35 |
const AccessibleElementInfo& rAccInfo ) |
| 36 |
:AccessibleBase(rAccInfo, true/*bMayHaveChildren*/, false/*bAlwaysTransparent*/) |
| 37 |
{ |
| 38 |
if ( !rAccInfo.m_aOID.isAdditionalShape() ) |
| 39 |
return; |
| 40 |
|
| 41 |
Reference< drawing::XShape > xShape( rAccInfo.m_aOID.getAdditionalShape() ); |
| 42 |
Reference< XAccessible > xParent; |
| 43 |
if ( rAccInfo.m_pParent ) |
| 44 |
{ |
| 45 |
xParent.set( rAccInfo.m_pParent ); |
| 46 |
} |
| 47 |
::accessibility::AccessibleShapeInfo aShapeInfo( xShape, xParent ); |
| 48 |
|
| 49 |
m_aShapeTreeInfo.SetSdrView( rAccInfo.m_pSdrView ); |
| 50 |
m_aShapeTreeInfo.SetController( nullptr ); |
| 51 |
m_aShapeTreeInfo.SetWindow(rAccInfo.m_pWindow); |
| 52 |
m_aShapeTreeInfo.SetViewForwarder( rAccInfo.m_pViewForwarder ); |
| 53 |
|
| 54 |
::accessibility::ShapeTypeHandler& rShapeHandler = ::accessibility::ShapeTypeHandler::Instance(); |
| 55 |
m_pAccShape = rShapeHandler.CreateAccessibleObject( aShapeInfo, m_aShapeTreeInfo ); |
| 56 |
if ( m_pAccShape.is() ) |
| 57 |
{ |
| 58 |
m_pAccShape->Init(); |
| 59 |
} |
| 60 |
} |
| 61 |
|
| 62 |
AccessibleChartShape::~AccessibleChartShape() |
| 63 |
{ |
| 64 |
OSL_ASSERT(!isAlive()); |
| 65 |
|
| 66 |
if ( m_pAccShape.is() ) |
| 67 |
{ |
| 68 |
m_pAccShape->dispose(); |
| 69 |
} |
| 70 |
} |
| 71 |
|
| 72 |
// ________ XAccessibleContext ________ |
| 73 |
sal_Int64 AccessibleChartShape::getAccessibleChildCount() |
| 74 |
{ |
| 75 |
sal_Int64 nCount(0); |
| 76 |
if ( m_pAccShape.is() ) |
| 77 |
{ |
| 78 |
nCount = m_pAccShape->getAccessibleChildCount(); |
| 79 |
} |
| 80 |
return nCount; |
| 81 |
} |
| 82 |
|
| 83 |
Reference< XAccessible > AccessibleChartShape::getAccessibleChild( sal_Int64 i ) |
| 84 |
{ |
| 85 |
Reference< XAccessible > xChild; |
| 86 |
if ( m_pAccShape.is() ) |
| 87 |
{ |
| 88 |
xChild = m_pAccShape->getAccessibleChild( i ); |
| 89 |
} |
| 90 |
return xChild; |
| 91 |
} |
| 92 |
|
| 93 |
sal_Int16 AccessibleChartShape::getAccessibleRole() |
| 94 |
{ |
| 95 |
sal_Int16 nRole(0); |
| 96 |
if ( m_pAccShape.is() ) |
| 97 |
{ |
| 98 |
nRole = m_pAccShape->getAccessibleRole(); |
| 99 |
} |
| 100 |
return nRole; |
| 101 |
} |
| 102 |
|
| 103 |
OUString AccessibleChartShape::getAccessibleDescription() |
| 104 |
{ |
| 105 |
OUString aDescription; |
| 106 |
if ( m_pAccShape.is() ) |
| 107 |
{ |
| 108 |
aDescription = m_pAccShape->getAccessibleDescription(); |
| 109 |
} |
| 110 |
return aDescription; |
| 111 |
} |
| 112 |
|
| 113 |
OUString AccessibleChartShape::getAccessibleName() |
| 114 |
{ |
| 115 |
OUString aName; |
| 116 |
if ( m_pAccShape.is() ) |
| 117 |
{ |
| 118 |
aName = m_pAccShape->getAccessibleName(); |
| 119 |
} |
| 120 |
return aName; |
| 121 |
} |
| 122 |
|
| 123 |
// ________ XAccessibleComponent ________ |
| 124 |
|
| 125 |
Reference< XAccessible > AccessibleChartShape::getAccessibleAtPoint( const awt::Point& aPoint ) |
| 126 |
{ |
| 127 |
Reference< XAccessible > xResult; |
| 128 |
if ( m_pAccShape.is() ) |
| 129 |
{ |
| 130 |
xResult.set( m_pAccShape->getAccessibleAtPoint( aPoint ) ); |
| 131 |
} |
| 132 |
return xResult; |
| 133 |
} |
| 134 |
|
| 135 |
awt::Rectangle AccessibleChartShape::implGetBounds() |
| 136 |
{ |
| 137 |
awt::Rectangle aBounds; |
| 138 |
if ( m_pAccShape.is() ) |
| 139 |
{ |
| 140 |
aBounds = m_pAccShape->getBounds(); |
| 141 |
} |
| 142 |
return aBounds; |
| 143 |
} |
| 144 |
|
| 145 |
sal_Int32 AccessibleChartShape::getForeground() |
| 146 |
{ |
| 147 |
sal_Int32 nColor(0); |
| 148 |
if ( m_pAccShape.is() ) |
| 149 |
{ |
| 150 |
nColor = m_pAccShape->getForeground(); |
| 151 |
} |
| 152 |
return nColor; |
| 153 |
} |
| 154 |
|
| 155 |
sal_Int32 AccessibleChartShape::getBackground() |
| 156 |
{ |
| 157 |
sal_Int32 nColor(0); |
| 158 |
if ( m_pAccShape.is() ) |
| 159 |
{ |
| 160 |
nColor = m_pAccShape->getBackground(); |
| 161 |
} |
| 162 |
return nColor; |
| 163 |
} |
| 164 |
|
| 165 |
// ________ XAccessibleExtendedComponent ________ |
| 166 |
|
| 167 |
OUString AccessibleChartShape::getTitledBorderText() |
| 168 |
{ |
| 169 |
OUString aText; |
| 170 |
if ( m_pAccShape.is() ) |
| 171 |
{ |
| 172 |
aText = m_pAccShape->getTitledBorderText(); |
| 173 |
} |
| 174 |
return aText; |
| 175 |
} |
| 176 |
|
| 177 |
OUString AccessibleChartShape::getToolTipText() |
| 178 |
{ |
| 179 |
OUString aText; |
| 180 |
if ( m_pAccShape.is() ) |
| 181 |
{ |
| 182 |
aText = m_pAccShape->getToolTipText(); |
| 183 |
} |
| 184 |
return aText; |
| 185 |
} |
| 186 |
|
| 187 |
} // namespace chart |
| 188 |
|
| 189 |
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |