merged tag ooo/OOO330_m14
[LibreOffice.git] / chart2 / source / controller / accessibility / AccessibleViewForwarder.cxx
blob5014198761f8acb3bc7e6aee4bbfa7d7b28da208
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_chart2.hxx"
31 #include "AccessibleViewForwarder.hxx"
32 #include "AccessibleChartView.hxx"
34 #include <vcl/window.hxx>
36 using namespace ::com::sun::star;
39 namespace chart
42 AccessibleViewForwarder::AccessibleViewForwarder( AccessibleChartView* pAccChartView, Window* pWindow )
43 :m_pAccChartView( pAccChartView )
44 ,m_pWindow( pWindow )
45 ,m_aMapMode( MAP_100TH_MM )
49 AccessibleViewForwarder::~AccessibleViewForwarder()
53 // ________ IAccessibleViewforwarder ________
55 BOOL AccessibleViewForwarder::IsValid() const
57 return sal_True;
60 Rectangle AccessibleViewForwarder::GetVisibleArea() const
62 Rectangle aVisibleArea;
63 if ( m_pWindow )
65 aVisibleArea.SetPos( Point( 0, 0 ) );
66 aVisibleArea.SetSize( m_pWindow->GetOutputSizePixel() );
67 aVisibleArea = m_pWindow->PixelToLogic( aVisibleArea, m_aMapMode );
69 return aVisibleArea;
72 Point AccessibleViewForwarder::LogicToPixel( const Point& rPoint ) const
74 Point aPoint;
75 if ( m_pAccChartView && m_pWindow )
77 awt::Point aLocation = m_pAccChartView->getLocationOnScreen();
78 Point aTopLeft( aLocation.X, aLocation.Y );
79 aPoint = m_pWindow->LogicToPixel( rPoint, m_aMapMode ) + aTopLeft;
81 return aPoint;
84 Size AccessibleViewForwarder::LogicToPixel( const Size& rSize ) const
86 Size aSize;
87 if ( m_pWindow )
89 aSize = m_pWindow->LogicToPixel( rSize, m_aMapMode );
91 return aSize;
94 Point AccessibleViewForwarder::PixelToLogic( const Point& rPoint ) const
96 Point aPoint;
97 if ( m_pAccChartView && m_pWindow )
99 awt::Point aLocation = m_pAccChartView->getLocationOnScreen();
100 Point aTopLeft( aLocation.X, aLocation.Y );
101 aPoint = m_pWindow->PixelToLogic( rPoint - aTopLeft, m_aMapMode );
103 return aPoint;
106 Size AccessibleViewForwarder::PixelToLogic( const Size& rSize ) const
108 Size aSize;
109 if ( m_pWindow )
111 aSize = m_pWindow->PixelToLogic( rSize, m_aMapMode );
113 return aSize;
116 } // namespace chart