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