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"
22 #include <com/sun/star/awt/XWindow.hpp>
23 #include <toolkit/helper/vclunohelper.hxx>
24 #include <svx/ShapeTypeHandler.hxx>
25 #include <svx/AccessibleShape.hxx>
26 #include <svx/AccessibleShapeInfo.hxx>
28 using namespace ::com::sun::star
;
29 using namespace ::com::sun::star::accessibility
;
31 using ::com::sun::star::uno::Reference
;
36 AccessibleChartShape::AccessibleChartShape(
37 const AccessibleElementInfo
& rAccInfo
)
38 :impl::AccessibleChartShape_Base( rAccInfo
, true/*bMayHaveChildren*/, false/*bAlwaysTransparent*/ )
40 if ( !rAccInfo
.m_aOID
.isAdditionalShape() )
43 Reference
< drawing::XShape
> xShape( rAccInfo
.m_aOID
.getAdditionalShape() );
44 Reference
< XAccessible
> xParent
;
45 if ( rAccInfo
.m_pParent
)
47 xParent
.set( rAccInfo
.m_pParent
);
49 ::accessibility::AccessibleShapeInfo
aShapeInfo( xShape
, xParent
);
51 m_aShapeTreeInfo
.SetSdrView( rAccInfo
.m_pSdrView
);
52 m_aShapeTreeInfo
.SetController( nullptr );
53 m_aShapeTreeInfo
.SetWindow( VCLUnoHelper::GetWindow( rAccInfo
.m_xWindow
) );
54 m_aShapeTreeInfo
.SetViewForwarder( rAccInfo
.m_pViewForwarder
);
56 ::accessibility::ShapeTypeHandler
& rShapeHandler
= ::accessibility::ShapeTypeHandler::Instance();
57 m_pAccShape
= rShapeHandler
.CreateAccessibleObject( aShapeInfo
, m_aShapeTreeInfo
);
58 if ( m_pAccShape
.is() )
64 AccessibleChartShape::~AccessibleChartShape()
66 OSL_ASSERT( CheckDisposeState( false /* don't throw exceptions */ ) );
68 if ( m_pAccShape
.is() )
70 m_pAccShape
->dispose();
74 // ________ XServiceInfo ________
75 OUString
AccessibleChartShape::getImplementationName()
77 return "AccessibleChartShape";
80 // ________ XAccessibleContext ________
81 sal_Int64
AccessibleChartShape::getAccessibleChildCount()
84 if ( m_pAccShape
.is() )
86 nCount
= m_pAccShape
->getAccessibleChildCount();
91 Reference
< XAccessible
> AccessibleChartShape::getAccessibleChild( sal_Int64 i
)
93 Reference
< XAccessible
> xChild
;
94 if ( m_pAccShape
.is() )
96 xChild
= m_pAccShape
->getAccessibleChild( i
);
101 sal_Int16
AccessibleChartShape::getAccessibleRole()
104 if ( m_pAccShape
.is() )
106 nRole
= m_pAccShape
->getAccessibleRole();
111 OUString
AccessibleChartShape::getAccessibleDescription()
113 OUString aDescription
;
114 if ( m_pAccShape
.is() )
116 aDescription
= m_pAccShape
->getAccessibleDescription();
121 OUString
AccessibleChartShape::getAccessibleName()
124 if ( m_pAccShape
.is() )
126 aName
= m_pAccShape
->getAccessibleName();
131 // ________ XAccessibleComponent ________
132 sal_Bool
AccessibleChartShape::containsPoint( const awt::Point
& aPoint
)
134 bool bReturn
= false;
135 if ( m_pAccShape
.is() )
137 bReturn
= m_pAccShape
->containsPoint( aPoint
);
142 Reference
< XAccessible
> AccessibleChartShape::getAccessibleAtPoint( const awt::Point
& aPoint
)
144 Reference
< XAccessible
> xResult
;
145 if ( m_pAccShape
.is() )
147 xResult
.set( m_pAccShape
->getAccessibleAtPoint( aPoint
) );
152 awt::Rectangle
AccessibleChartShape::getBounds()
154 awt::Rectangle aBounds
;
155 if ( m_pAccShape
.is() )
157 aBounds
= m_pAccShape
->getBounds();
162 awt::Point
AccessibleChartShape::getLocation()
164 awt::Point aLocation
;
165 if ( m_pAccShape
.is() )
167 aLocation
= m_pAccShape
->getLocation();
172 awt::Point
AccessibleChartShape::getLocationOnScreen()
174 awt::Point aLocation
;
175 if ( m_pAccShape
.is() )
177 aLocation
= m_pAccShape
->getLocationOnScreen();
182 awt::Size
AccessibleChartShape::getSize()
185 if ( m_pAccShape
.is() )
187 aSize
= m_pAccShape
->getSize();
192 void AccessibleChartShape::grabFocus()
194 return AccessibleBase::grabFocus();
197 sal_Int32
AccessibleChartShape::getForeground()
200 if ( m_pAccShape
.is() )
202 nColor
= m_pAccShape
->getForeground();
207 sal_Int32
AccessibleChartShape::getBackground()
210 if ( m_pAccShape
.is() )
212 nColor
= m_pAccShape
->getBackground();
217 // ________ XAccessibleExtendedComponent ________
218 Reference
< awt::XFont
> AccessibleChartShape::getFont()
220 Reference
< awt::XFont
> xFont
;
221 if ( m_pAccShape
.is() )
223 xFont
.set( m_pAccShape
->getFont() );
228 OUString
AccessibleChartShape::getTitledBorderText()
231 if ( m_pAccShape
.is() )
233 aText
= m_pAccShape
->getTitledBorderText();
238 OUString
AccessibleChartShape::getToolTipText()
241 if ( m_pAccShape
.is() )
243 aText
= m_pAccShape
->getToolTipText();
250 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */