1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 // MARKER(update_precomp.py): autogen include statement, do not remove 25 #include "precompiled_chart2.hxx" 26 27 #include "AccessibleViewForwarder.hxx" 28 #include "AccessibleChartView.hxx" 29 30 #include <vcl/window.hxx> 31 32 using namespace ::com::sun::star; 33 34 35 namespace chart 36 { 37 38 AccessibleViewForwarder::AccessibleViewForwarder( AccessibleChartView* pAccChartView, Window* pWindow ) 39 :m_pAccChartView( pAccChartView ) 40 ,m_pWindow( pWindow ) 41 ,m_aMapMode( MAP_100TH_MM ) 42 { 43 } 44 45 AccessibleViewForwarder::~AccessibleViewForwarder() 46 { 47 } 48 49 // ________ IAccessibleViewforwarder ________ 50 51 sal_Bool AccessibleViewForwarder::IsValid() const 52 { 53 return sal_True; 54 } 55 56 Rectangle AccessibleViewForwarder::GetVisibleArea() const 57 { 58 Rectangle aVisibleArea; 59 if ( m_pWindow ) 60 { 61 aVisibleArea.SetPos( Point( 0, 0 ) ); 62 aVisibleArea.SetSize( m_pWindow->GetOutputSizePixel() ); 63 aVisibleArea = m_pWindow->PixelToLogic( aVisibleArea, m_aMapMode ); 64 } 65 return aVisibleArea; 66 } 67 68 Point AccessibleViewForwarder::LogicToPixel( const Point& rPoint ) const 69 { 70 Point aPoint; 71 if ( m_pAccChartView && m_pWindow ) 72 { 73 awt::Point aLocation = m_pAccChartView->getLocationOnScreen(); 74 Point aTopLeft( aLocation.X, aLocation.Y ); 75 aPoint = m_pWindow->LogicToPixel( rPoint, m_aMapMode ) + aTopLeft; 76 } 77 return aPoint; 78 } 79 80 Size AccessibleViewForwarder::LogicToPixel( const Size& rSize ) const 81 { 82 Size aSize; 83 if ( m_pWindow ) 84 { 85 aSize = m_pWindow->LogicToPixel( rSize, m_aMapMode ); 86 } 87 return aSize; 88 } 89 90 Point AccessibleViewForwarder::PixelToLogic( const Point& rPoint ) const 91 { 92 Point aPoint; 93 if ( m_pAccChartView && m_pWindow ) 94 { 95 awt::Point aLocation = m_pAccChartView->getLocationOnScreen(); 96 Point aTopLeft( aLocation.X, aLocation.Y ); 97 aPoint = m_pWindow->PixelToLogic( rPoint - aTopLeft, m_aMapMode ); 98 } 99 return aPoint; 100 } 101 102 Size AccessibleViewForwarder::PixelToLogic( const Size& rSize ) const 103 { 104 Size aSize; 105 if ( m_pWindow ) 106 { 107 aSize = m_pWindow->PixelToLogic( rSize, m_aMapMode ); 108 } 109 return aSize; 110 } 111 112 } // namespace chart 113