Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 : #ifndef _ACCFRAME_HXX
20 : #define _ACCFRAME_HXX
21 :
22 : #include <swrect.hxx>
23 :
24 : #include <sal/types.h>
25 : #include <tools/string.hxx>
26 :
27 : #include <list>
28 : #include <accfrmobj.hxx>
29 :
30 : class SwAccessibleMap;
31 : class SwFrm;
32 : class ViewShell;
33 : namespace sw { namespace access {
34 : class SwAccessibleChild;
35 : }}
36 :
37 : // Any method of this class must be called with an acquired solar mutex!
38 :
39 : class SwAccessibleFrame
40 : {
41 : SwRect maVisArea;
42 : const SwFrm* mpFrm;
43 : const sal_Bool mbIsInPagePreview;
44 :
45 : protected:
46 : // #i77106# - method needs to be called by new class <SwAccessibleTableColHeaders>
47 : static sal_Int32 GetChildCount( SwAccessibleMap& rAccMap,
48 : const SwRect& rVisArea,
49 : const SwFrm *pFrm,
50 : sal_Bool bInPagePreview );
51 : private:
52 : static sw::access::SwAccessibleChild GetChild( SwAccessibleMap& rAccMap,
53 : const SwRect& rVisArea,
54 : const SwFrm& rFrm,
55 : sal_Int32& rPos,
56 : sal_Bool bInPagePreview);
57 :
58 : static sal_Bool GetChildIndex( SwAccessibleMap& rAccMap,
59 : const SwRect& rVisArea,
60 : const SwFrm& rFrm,
61 : const sw::access::SwAccessibleChild& rChild,
62 : sal_Int32& rPos,
63 : sal_Bool bInPagePreview );
64 :
65 : static sw::access::SwAccessibleChild GetChildAtPixel( const SwRect& rVisArea,
66 : const SwFrm& rFrm,
67 : const Point& rPos,
68 : sal_Bool bInPagePreview,
69 : SwAccessibleMap& rAccMap );
70 :
71 : static void GetChildren( SwAccessibleMap& rAccMap,
72 : const SwRect& rVisArea,
73 : const SwFrm& rFrm,
74 : ::std::list< sw::access::SwAccessibleChild >& rChildren,
75 : sal_Bool bInPagePreview );
76 :
77 : protected:
78 :
79 : sal_Bool IsEditable( ViewShell *pVSh ) const;
80 :
81 : sal_Bool IsOpaque( ViewShell *pVSh ) const;
82 :
83 : sal_Bool IsShowing( const SwAccessibleMap& rAccMap,
84 : const sw::access::SwAccessibleChild& rFrmOrObj ) const;
85 : inline sal_Bool IsShowing( const SwRect& rFrm ) const;
86 : inline sal_Bool IsShowing( const SwAccessibleMap& rAccMap ) const;
87 :
88 0 : inline sal_Bool IsInPagePreview() const
89 : {
90 0 : return mbIsInPagePreview;
91 : }
92 :
93 0 : inline void ClearFrm()
94 : {
95 0 : mpFrm = 0;
96 0 : }
97 :
98 : SwAccessibleFrame( const SwRect& rVisArea,
99 : const SwFrm *pFrm,
100 : sal_Bool bIsPagePreview );
101 : virtual ~SwAccessibleFrame();
102 :
103 : public:
104 : // Return the SwFrm this context is attached to.
105 0 : const SwFrm* GetFrm() const { return mpFrm; };
106 :
107 : static const SwFrm* GetParent( const sw::access::SwAccessibleChild& rFrmOrObj,
108 : sal_Bool bInPagePreview );
109 :
110 : sal_Int32 GetChildIndex( SwAccessibleMap& rAccMap,
111 : const sw::access::SwAccessibleChild& rChild ) const;
112 :
113 : protected:
114 :
115 : // Return the bounding box of the frame clipped to the vis area. If
116 : // no frame is specified, use this' frame.
117 : SwRect GetBounds( const SwAccessibleMap& rAccMap,
118 : const SwFrm *pFrm = 0 );
119 :
120 : // Return the upper that has a context attached. This might be
121 : // another one than the immediate upper.
122 : inline const SwFrm *GetParent() const;
123 :
124 : // Return the lower count or the nth lower, there the lowers have a
125 : // not be same one as the SwFrm's lowers
126 : sal_Int32 GetChildCount( SwAccessibleMap& rAccMap ) const;
127 : sw::access::SwAccessibleChild GetChild( SwAccessibleMap& rAccMap,
128 : sal_Int32 nPos ) const;
129 : sw::access::SwAccessibleChild GetChildAtPixel( const Point& rPos,
130 : SwAccessibleMap& rAccMap ) const;
131 : void GetChildren( SwAccessibleMap& rAccMap,
132 : ::std::list< sw::access::SwAccessibleChild >& rChildren ) const;
133 :
134 0 : inline void SetVisArea( const SwRect& rNewVisArea )
135 : {
136 0 : maVisArea = rNewVisArea;
137 0 : }
138 :
139 0 : inline const SwRect& GetVisArea() const
140 : {
141 0 : return maVisArea;
142 : }
143 :
144 :
145 : String GetFormattedPageNumber() const;
146 : };
147 :
148 0 : inline sal_Bool SwAccessibleFrame::IsShowing( const SwRect& rFrm ) const
149 : {
150 0 : return rFrm.IsOver( maVisArea );
151 : }
152 :
153 0 : inline sal_Bool SwAccessibleFrame::IsShowing( const SwAccessibleMap& rAccMap ) const
154 : {
155 0 : sw::access::SwAccessibleChild aFrmOrObj( GetFrm() );
156 0 : return IsShowing( rAccMap, aFrmOrObj );
157 : }
158 :
159 0 : inline const SwFrm *SwAccessibleFrame::GetParent() const
160 : {
161 0 : sw::access::SwAccessibleChild aFrmOrObj( GetFrm() );
162 0 : return GetParent( aFrmOrObj, IsInPagePreview() );
163 : }
164 :
165 : #endif
166 :
167 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|