1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include "AccessibleChartShape.hxx"
21 #include "ObjectHierarchy.hxx"
22 #include "ObjectIdentifier.hxx"
24 #include <toolkit/helper/vclunohelper.hxx>
25 #include <svx/ShapeTypeHandler.hxx>
26 #include <svx/AccessibleShape.hxx>
27 #include <svx/AccessibleShapeInfo.hxx>
29 using namespace ::com::sun::star
;
30 using namespace ::com::sun::star::accessibility
;
32 using ::com::sun::star::uno::Reference
;
33 using ::com::sun::star::uno::RuntimeException
;
38 AccessibleChartShape::AccessibleChartShape(
39 const AccessibleElementInfo
& rAccInfo
,
40 bool bMayHaveChildren
, bool bAlwaysTransparent
)
41 :impl::AccessibleChartShape_Base( rAccInfo
, bMayHaveChildren
, bAlwaysTransparent
)
44 if ( rAccInfo
.m_aOID
.isAdditionalShape() )
46 Reference
< drawing::XShape
> xShape( rAccInfo
.m_aOID
.getAdditionalShape() );
47 Reference
< XAccessible
> xParent
;
48 if ( rAccInfo
.m_pParent
)
50 xParent
.set( rAccInfo
.m_pParent
);
52 sal_Int32 nIndex
= -1;
53 if ( rAccInfo
.m_spObjectHierarchy
)
55 nIndex
= rAccInfo
.m_spObjectHierarchy
->getIndexInParent( rAccInfo
.m_aOID
);
57 ::accessibility::AccessibleShapeInfo
aShapeInfo( xShape
, xParent
, nIndex
);
59 m_aShapeTreeInfo
.SetSdrView( rAccInfo
.m_pSdrView
);
60 m_aShapeTreeInfo
.SetController( NULL
);
61 m_aShapeTreeInfo
.SetWindow( VCLUnoHelper::GetWindow( rAccInfo
.m_xWindow
) );
62 m_aShapeTreeInfo
.SetViewForwarder( rAccInfo
.m_pViewForwarder
);
64 ::accessibility::ShapeTypeHandler
& rShapeHandler
= ::accessibility::ShapeTypeHandler::Instance();
65 m_pAccShape
= rShapeHandler
.CreateAccessibleObject( aShapeInfo
, m_aShapeTreeInfo
);
68 m_pAccShape
->acquire();
74 AccessibleChartShape::~AccessibleChartShape()
76 OSL_ASSERT( CheckDisposeState( false /* don't throw exceptions */ ) );
80 m_pAccShape
->dispose();
81 m_pAccShape
->release();
85 // ________ XServiceInfo ________
86 OUString
AccessibleChartShape::getImplementationName()
87 throw (RuntimeException
, std::exception
)
89 return OUString( "AccessibleChartShape" );
92 // ________ XAccessibleContext ________
93 sal_Int32
AccessibleChartShape::getAccessibleChildCount()
94 throw (RuntimeException
, std::exception
)
99 nCount
= m_pAccShape
->getAccessibleChildCount();
104 Reference
< XAccessible
> AccessibleChartShape::getAccessibleChild( sal_Int32 i
)
105 throw (lang::IndexOutOfBoundsException
, RuntimeException
, std::exception
)
107 Reference
< XAccessible
> xChild
;
110 xChild
= m_pAccShape
->getAccessibleChild( i
);
115 sal_Int16
AccessibleChartShape::getAccessibleRole()
116 throw (RuntimeException
, std::exception
)
121 nRole
= m_pAccShape
->getAccessibleRole();
126 OUString
AccessibleChartShape::getAccessibleDescription()
127 throw (::com::sun::star::uno::RuntimeException
, std::exception
)
129 OUString aDescription
;
132 aDescription
= m_pAccShape
->getAccessibleDescription();
137 OUString
AccessibleChartShape::getAccessibleName()
138 throw (::com::sun::star::uno::RuntimeException
, std::exception
)
143 aName
= m_pAccShape
->getAccessibleName();
148 // ________ XAccessibleComponent ________
149 sal_Bool
AccessibleChartShape::containsPoint( const awt::Point
& aPoint
)
150 throw (uno::RuntimeException
, std::exception
)
152 bool bReturn
= false;
155 bReturn
= m_pAccShape
->containsPoint( aPoint
);
160 Reference
< XAccessible
> AccessibleChartShape::getAccessibleAtPoint( const awt::Point
& aPoint
)
161 throw (uno::RuntimeException
, std::exception
)
163 Reference
< XAccessible
> xResult
;
166 xResult
.set( m_pAccShape
->getAccessibleAtPoint( aPoint
) );
171 awt::Rectangle
AccessibleChartShape::getBounds()
172 throw (uno::RuntimeException
, std::exception
)
174 awt::Rectangle aBounds
;
177 aBounds
= m_pAccShape
->getBounds();
182 awt::Point
AccessibleChartShape::getLocation()
183 throw (uno::RuntimeException
, std::exception
)
185 awt::Point aLocation
;
188 aLocation
= m_pAccShape
->getLocation();
193 awt::Point
AccessibleChartShape::getLocationOnScreen()
194 throw (uno::RuntimeException
, std::exception
)
196 awt::Point aLocation
;
199 aLocation
= m_pAccShape
->getLocationOnScreen();
204 awt::Size
AccessibleChartShape::getSize()
205 throw (uno::RuntimeException
, std::exception
)
210 aSize
= m_pAccShape
->getSize();
215 void AccessibleChartShape::grabFocus()
216 throw (uno::RuntimeException
, std::exception
)
218 return AccessibleBase::grabFocus();
221 sal_Int32
AccessibleChartShape::getForeground()
222 throw (uno::RuntimeException
, std::exception
)
227 nColor
= m_pAccShape
->getForeground();
232 sal_Int32
AccessibleChartShape::getBackground()
233 throw (uno::RuntimeException
, std::exception
)
238 nColor
= m_pAccShape
->getBackground();
243 // ________ XAccessibleExtendedComponent ________
244 Reference
< awt::XFont
> AccessibleChartShape::getFont()
245 throw (uno::RuntimeException
, std::exception
)
247 Reference
< awt::XFont
> xFont
;
250 xFont
.set( m_pAccShape
->getFont() );
255 OUString
AccessibleChartShape::getTitledBorderText()
256 throw (uno::RuntimeException
, std::exception
)
261 aText
= m_pAccShape
->getTitledBorderText();
266 OUString
AccessibleChartShape::getToolTipText()
267 throw (::com::sun::star::uno::RuntimeException
, std::exception
)
272 aText
= m_pAccShape
->getToolTipText();
279 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */