fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / chart2 / source / controller / accessibility / AccessibleChartShape.cxx
blobaa90d3dafd71c327087c791e568fd3f7c422395a
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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;
35 namespace chart
38 AccessibleChartShape::AccessibleChartShape(
39 const AccessibleElementInfo& rAccInfo,
40 bool bMayHaveChildren, bool bAlwaysTransparent )
41 :impl::AccessibleChartShape_Base( rAccInfo, bMayHaveChildren, bAlwaysTransparent )
42 ,m_pAccShape( NULL )
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 );
66 if ( m_pAccShape )
68 m_pAccShape->acquire();
69 m_pAccShape->Init();
74 AccessibleChartShape::~AccessibleChartShape()
76 OSL_ASSERT( CheckDisposeState( false /* don't throw exceptions */ ) );
78 if ( m_pAccShape )
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)
96 sal_Int32 nCount(0);
97 if ( m_pAccShape )
99 nCount = m_pAccShape->getAccessibleChildCount();
101 return nCount;
104 Reference< XAccessible > AccessibleChartShape::getAccessibleChild( sal_Int32 i )
105 throw (lang::IndexOutOfBoundsException, RuntimeException, std::exception)
107 Reference< XAccessible > xChild;
108 if ( m_pAccShape )
110 xChild = m_pAccShape->getAccessibleChild( i );
112 return xChild;
115 sal_Int16 AccessibleChartShape::getAccessibleRole()
116 throw (RuntimeException, std::exception)
118 sal_Int16 nRole(0);
119 if ( m_pAccShape )
121 nRole = m_pAccShape->getAccessibleRole();
123 return nRole;
126 OUString AccessibleChartShape::getAccessibleDescription()
127 throw (::com::sun::star::uno::RuntimeException, std::exception)
129 OUString aDescription;
130 if ( m_pAccShape )
132 aDescription = m_pAccShape->getAccessibleDescription();
134 return aDescription;
137 OUString AccessibleChartShape::getAccessibleName()
138 throw (::com::sun::star::uno::RuntimeException, std::exception)
140 OUString aName;
141 if ( m_pAccShape )
143 aName = m_pAccShape->getAccessibleName();
145 return aName;
148 // ________ XAccessibleComponent ________
149 sal_Bool AccessibleChartShape::containsPoint( const awt::Point& aPoint )
150 throw (uno::RuntimeException, std::exception)
152 bool bReturn = false;
153 if ( m_pAccShape )
155 bReturn = m_pAccShape->containsPoint( aPoint );
157 return bReturn;
160 Reference< XAccessible > AccessibleChartShape::getAccessibleAtPoint( const awt::Point& aPoint )
161 throw (uno::RuntimeException, std::exception)
163 Reference< XAccessible > xResult;
164 if ( m_pAccShape )
166 xResult.set( m_pAccShape->getAccessibleAtPoint( aPoint ) );
168 return xResult;
171 awt::Rectangle AccessibleChartShape::getBounds()
172 throw (uno::RuntimeException, std::exception)
174 awt::Rectangle aBounds;
175 if ( m_pAccShape )
177 aBounds = m_pAccShape->getBounds();
179 return aBounds;
182 awt::Point AccessibleChartShape::getLocation()
183 throw (uno::RuntimeException, std::exception)
185 awt::Point aLocation;
186 if ( m_pAccShape )
188 aLocation = m_pAccShape->getLocation();
190 return aLocation;
193 awt::Point AccessibleChartShape::getLocationOnScreen()
194 throw (uno::RuntimeException, std::exception)
196 awt::Point aLocation;
197 if ( m_pAccShape )
199 aLocation = m_pAccShape->getLocationOnScreen();
201 return aLocation;
204 awt::Size AccessibleChartShape::getSize()
205 throw (uno::RuntimeException, std::exception)
207 awt::Size aSize;
208 if ( m_pAccShape )
210 aSize = m_pAccShape->getSize();
212 return aSize;
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)
224 sal_Int32 nColor(0);
225 if ( m_pAccShape )
227 nColor = m_pAccShape->getForeground();
229 return nColor;
232 sal_Int32 AccessibleChartShape::getBackground()
233 throw (uno::RuntimeException, std::exception)
235 sal_Int32 nColor(0);
236 if ( m_pAccShape )
238 nColor = m_pAccShape->getBackground();
240 return nColor;
243 // ________ XAccessibleExtendedComponent ________
244 Reference< awt::XFont > AccessibleChartShape::getFont()
245 throw (uno::RuntimeException, std::exception)
247 Reference< awt::XFont > xFont;
248 if ( m_pAccShape )
250 xFont.set( m_pAccShape->getFont() );
252 return xFont;
255 OUString AccessibleChartShape::getTitledBorderText()
256 throw (uno::RuntimeException, std::exception)
258 OUString aText;
259 if ( m_pAccShape )
261 aText = m_pAccShape->getTitledBorderText();
263 return aText;
266 OUString AccessibleChartShape::getToolTipText()
267 throw (::com::sun::star::uno::RuntimeException, std::exception)
269 OUString aText;
270 if ( m_pAccShape )
272 aText = m_pAccShape->getToolTipText();
274 return aText;
277 } // namespace chart
279 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */