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
;
42 AccessibleViewForwarder::AccessibleViewForwarder( AccessibleChartView
* pAccChartView
, Window
* pWindow
)
43 :m_pAccChartView( pAccChartView
)
45 ,m_aMapMode( MAP_100TH_MM
)
49 AccessibleViewForwarder::~AccessibleViewForwarder()
53 // ________ IAccessibleViewforwarder ________
55 BOOL
AccessibleViewForwarder::IsValid() const
60 Rectangle
AccessibleViewForwarder::GetVisibleArea() const
62 Rectangle aVisibleArea
;
65 aVisibleArea
.SetPos( Point( 0, 0 ) );
66 aVisibleArea
.SetSize( m_pWindow
->GetOutputSizePixel() );
67 aVisibleArea
= m_pWindow
->PixelToLogic( aVisibleArea
, m_aMapMode
);
72 Point
AccessibleViewForwarder::LogicToPixel( const Point
& rPoint
) const
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
;
84 Size
AccessibleViewForwarder::LogicToPixel( const Size
& rSize
) const
89 aSize
= m_pWindow
->LogicToPixel( rSize
, m_aMapMode
);
94 Point
AccessibleViewForwarder::PixelToLogic( const Point
& rPoint
) const
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
);
106 Size
AccessibleViewForwarder::PixelToLogic( const Size
& rSize
) const
111 aSize
= m_pWindow
->PixelToLogic( rSize
, m_aMapMode
);