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 :
20 : #ifndef INCLUDED_SW_SOURCE_CORE_ACCESS_ACCFRAME_HXX
21 : #define INCLUDED_SW_SOURCE_CORE_ACCESS_ACCFRAME_HXX
22 :
23 : #include <swrect.hxx>
24 :
25 : #include <sal/types.h>
26 : #include <rtl/ustring.hxx>
27 :
28 : #include <list>
29 : #include <accfrmobj.hxx>
30 :
31 : class SwAccessibleMap;
32 : class SwFrm;
33 : class SwViewShell;
34 : namespace sw { namespace access {
35 : class SwAccessibleChild;
36 : }}
37 :
38 : // Any method of this class must be called with an acquired solar mutex!
39 :
40 : class SwAccessibleFrame
41 : {
42 : SwRect maVisArea;
43 : const SwFrm* mpFrm;
44 : const bool mbIsInPagePreview;
45 :
46 : protected:
47 : // #i77106# - method needs to be called by new class <SwAccessibleTableColHeaders>
48 : static sal_Int32 GetChildCount( SwAccessibleMap& rAccMap,
49 : const SwRect& rVisArea,
50 : const SwFrm *pFrm,
51 : bool bInPagePreviewr );
52 :
53 : // private:
54 : static sw::access::SwAccessibleChild GetChild( SwAccessibleMap& rAccMap,
55 : const SwRect& rVisArea,
56 : const SwFrm& rFrm,
57 : sal_Int32& rPos,
58 : bool bInPagePreview);
59 :
60 : static bool GetChildIndex( SwAccessibleMap& rAccMap,
61 : const SwRect& rVisArea,
62 : const SwFrm& rFrm,
63 : const sw::access::SwAccessibleChild& rChild,
64 : sal_Int32& rPos,
65 : bool bInPagePreview );
66 :
67 : static sw::access::SwAccessibleChild GetChildAtPixel( const SwRect& rVisArea,
68 : const SwFrm& rFrm,
69 : const Point& rPos,
70 : bool bInPagePreview,
71 : SwAccessibleMap& rAccMap );
72 :
73 : static void GetChildren( SwAccessibleMap& rAccMap,
74 : const SwRect& rVisArea,
75 : const SwFrm& rFrm,
76 : ::std::list< sw::access::SwAccessibleChild >& rChildren,
77 : bool bInPagePreview );
78 :
79 : protected:
80 : bool IsEditable( SwViewShell *pVSh ) const;
81 :
82 : bool IsOpaque( SwViewShell *pVSh ) const;
83 :
84 : bool IsShowing( const SwAccessibleMap& rAccMap,
85 : const sw::access::SwAccessibleChild& rFrmOrObj ) const;
86 : inline bool IsShowing( const SwRect& rFrm ) const;
87 : inline bool IsShowing( const SwAccessibleMap& rAccMap ) const;
88 :
89 2826 : inline bool IsInPagePreview() const
90 : {
91 2826 : return mbIsInPagePreview;
92 : }
93 :
94 32 : inline void ClearFrm()
95 : {
96 32 : mpFrm = 0;
97 32 : }
98 :
99 : SwAccessibleFrame( const SwRect& rVisArea,
100 : const SwFrm *pFrm,
101 : bool bIsPagePreview );
102 : virtual ~SwAccessibleFrame();
103 :
104 : // MT: Move to private area?
105 : bool bIsAccDocUse;
106 : public:
107 : // Return the SwFrm this context is attached to.
108 11728 : const SwFrm* GetFrm() const { return mpFrm; };
109 :
110 : static const SwFrm* GetParent( const sw::access::SwAccessibleChild& rFrmOrObj,
111 : bool bInPagePreview );
112 :
113 : sal_Int32 GetChildIndex( SwAccessibleMap& rAccMap,
114 : const sw::access::SwAccessibleChild& rChild ) const;
115 :
116 : protected:
117 : // Return the bounding box of the frame clipped to the vis area. If
118 : // no frame is specified, use this' frame.
119 : SwRect GetBounds( const SwAccessibleMap& rAccMap,
120 : const SwFrm *pFrm = 0 );
121 :
122 : // Return the upper that has a context attached. This might be
123 : // another one than the immediate upper.
124 : inline const SwFrm *GetParent() const;
125 :
126 : // Return the lower count or the nth lower, there the lowers have a
127 : // not be same one as the SwFrm's lowers
128 : sal_Int32 GetChildCount( SwAccessibleMap& rAccMap ) const;
129 : sw::access::SwAccessibleChild GetChild( SwAccessibleMap& rAccMap,
130 : sal_Int32 nPos ) const;
131 : sw::access::SwAccessibleChild GetChildAtPixel( const Point& rPos,
132 : SwAccessibleMap& rAccMap ) const;
133 : void GetChildren( SwAccessibleMap& rAccMap,
134 : ::std::list< sw::access::SwAccessibleChild >& rChildren ) const;
135 :
136 132 : inline void SetVisArea( const SwRect& rNewVisArea )
137 : {
138 132 : maVisArea = rNewVisArea;
139 132 : }
140 :
141 345 : inline const SwRect& GetVisArea() const
142 : {
143 345 : return maVisArea;
144 : }
145 :
146 : OUString GetFormattedPageNumber() const;
147 : };
148 :
149 189 : inline bool SwAccessibleFrame::IsShowing( const SwRect& rFrm ) const
150 : {
151 189 : return rFrm.IsOver( maVisArea );
152 : }
153 :
154 159 : inline bool SwAccessibleFrame::IsShowing( const SwAccessibleMap& rAccMap ) const
155 : {
156 159 : sw::access::SwAccessibleChild aFrmOrObj( GetFrm() );
157 159 : return IsShowing( rAccMap, aFrmOrObj );
158 : }
159 :
160 2454 : inline const SwFrm *SwAccessibleFrame::GetParent() const
161 : {
162 2454 : sw::access::SwAccessibleChild aFrmOrObj( GetFrm() );
163 2454 : return GetParent( aFrmOrObj, IsInPagePreview() );
164 : }
165 :
166 : #endif
167 :
168 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|