1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
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.
14  *
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).
20  *
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.
25  *
26  ************************************************************************/
27 
28 #ifndef _SD_ACCESSIBILITY_ACCESSIBLE_VIEW_FORWARDER_HXX
29 #define _SD_ACCESSIBILITY_ACCESSIBLE_VIEW_FORWARDER_HXX
30 
31 #include <svx/IAccessibleViewForwarder.hxx>
32 
33 class SdrPaintView;
34 class OutputDevice;
35 
36 namespace accessibility {
37 
38 
39 /**	<p>This class provides the means to transform between internal coordinates
40     and screen coordinates without giving direct access to the underlying
41     view.  It represents a certain window.  A call to
42     <method>GetVisArea</method> returns the corresponding visible
43     rectangle.</p>
44 
45     @attention
46         Note, that modifications of the underlying view that lead to
47         different transformations between internal and screen coordinates or
48         change the validity of the forwarder have to be signaled seperately.
49 */
50 class AccessibleViewForwarder
51     :	public IAccessibleViewForwarder
52 {
53 public:
54     //=====  internal  ========================================================
55 
56     AccessibleViewForwarder (SdrPaintView* pView, OutputDevice& rDevice);
57 
58 	virtual ~AccessibleViewForwarder (void);
59 
60     //=====  IAccessibleViewforwarder  ========================================
61 
62     /** This method informs you about the state of the forwarder.  Do not
63         use it when the returned value is <false/>.
64 
65     	@return
66             Return <true/> if the view forwarder is valid and <false/> else.
67      */
68 	virtual sal_Bool IsValid (void) const;
69 
70     /** Returns the area of the underlying document that is visible in the
71     * corresponding window.
72 
73     	@return
74             The rectangle of the visible part of the document.
75      */
76     virtual Rectangle GetVisibleArea() const;
77 
78     /** Transform the specified point from internal coordinates to an
79         absolute screen position.
80 
81     	@param rPoint
82             Point in internal coordinates.
83 
84         @return
85             The same point but in screen coordinates relative to the upper
86             left corner of the (current) screen.
87      */
88     virtual Point LogicToPixel (const Point& rPoint) const;
89 
90     /** Transform the specified size from internal coordinates to a screen
91     * position.
92 
93     	@param rSize
94             Size in internal coordinates.
95 
96         @return
97             The same size but in screen coordinates.
98      */
99     virtual Size LogicToPixel (const Size& rSize) const;
100 
101     /** Transform the specified point from absolute screen coordinates to
102         internal coordinates.
103 
104     	@param rPoint
105             Point in screen coordinates relative to the upper left corner of
106             the (current) screen.
107 
108         @return
109             The same point but in internal coordinates.
110      */
111     virtual Point PixelToLogic (const Point& rPoint) const;
112 
113     /** Transform the specified Size from screen coordinates to internal
114         coordinates.
115 
116     	@param rSize
117             Size in screen coordinates.
118 
119         @return
120             The same size but in internal coordinates.
121      */
122     virtual Size PixelToLogic (const Size& rSize) const;
123 
124 protected:
125     SdrPaintView* mpView;
126     sal_uInt16 mnWindowId;
127     OutputDevice& mrDevice;
128 
129 private:
130     AccessibleViewForwarder (AccessibleViewForwarder&);
131     AccessibleViewForwarder& operator= (AccessibleViewForwarder&);
132 };
133 
134 } // end of namespace accessibility
135 
136 #endif
137