11d2dbeb0SAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
31d2dbeb0SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
41d2dbeb0SAndrew Rist * or more contributor license agreements. See the NOTICE file
51d2dbeb0SAndrew Rist * distributed with this work for additional information
61d2dbeb0SAndrew Rist * regarding copyright ownership. The ASF licenses this file
71d2dbeb0SAndrew Rist * to you under the Apache License, Version 2.0 (the
81d2dbeb0SAndrew Rist * "License"); you may not use this file except in compliance
91d2dbeb0SAndrew Rist * with the License. You may obtain a copy of the License at
10cdf0e10cSrcweir *
111d2dbeb0SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir *
131d2dbeb0SAndrew Rist * Unless required by applicable law or agreed to in writing,
141d2dbeb0SAndrew Rist * software distributed under the License is distributed on an
151d2dbeb0SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
161d2dbeb0SAndrew Rist * KIND, either express or implied. See the License for the
171d2dbeb0SAndrew Rist * specific language governing permissions and limitations
181d2dbeb0SAndrew Rist * under the License.
19cdf0e10cSrcweir *
201d2dbeb0SAndrew Rist *************************************************************/
211d2dbeb0SAndrew Rist
221d2dbeb0SAndrew Rist
23cdf0e10cSrcweir #ifndef _ACCFRAME_HXX
24cdf0e10cSrcweir #define _ACCFRAME_HXX
25cdf0e10cSrcweir
26cdf0e10cSrcweir #include <swrect.hxx>
27cdf0e10cSrcweir
28cdf0e10cSrcweir #include <sal/types.h>
29cdf0e10cSrcweir #include <tools/string.hxx>
30cdf0e10cSrcweir
31cdf0e10cSrcweir #include <list>
32cdf0e10cSrcweir #include <accfrmobj.hxx>
33cdf0e10cSrcweir
34cdf0e10cSrcweir class SwAccessibleMap;
35cdf0e10cSrcweir class SwFrm;
36cdf0e10cSrcweir class ViewShell;
37cdf0e10cSrcweir namespace sw { namespace access {
38cdf0e10cSrcweir class SwAccessibleChild;
39cdf0e10cSrcweir }}
40cdf0e10cSrcweir
41cdf0e10cSrcweir // Any method of this class must be called with an acquired solar mutex!
42cdf0e10cSrcweir
43cdf0e10cSrcweir class SwAccessibleFrame
44cdf0e10cSrcweir {
45cdf0e10cSrcweir SwRect maVisArea;
46cdf0e10cSrcweir const SwFrm* mpFrm;
47cdf0e10cSrcweir const sal_Bool mbIsInPagePreview;
48cdf0e10cSrcweir
49cdf0e10cSrcweir protected:
50cdf0e10cSrcweir // --> OD 2007-06-29 #i77106#
51cdf0e10cSrcweir // method needs to be called by new class <SwAccessibleTableColHeaders>
52cdf0e10cSrcweir static sal_Int32 GetChildCount( SwAccessibleMap& rAccMap,
53cdf0e10cSrcweir const SwRect& rVisArea,
54cdf0e10cSrcweir const SwFrm *pFrm,
55*ca62e2c2SSteve Yin sal_Bool bInPagePreviewr );
56*ca62e2c2SSteve Yin
57*ca62e2c2SSteve Yin // private:
58cdf0e10cSrcweir static sw::access::SwAccessibleChild GetChild( SwAccessibleMap& rAccMap,
59cdf0e10cSrcweir const SwRect& rVisArea,
60cdf0e10cSrcweir const SwFrm& rFrm,
61cdf0e10cSrcweir sal_Int32& rPos,
62cdf0e10cSrcweir sal_Bool bInPagePreview);
63cdf0e10cSrcweir
64cdf0e10cSrcweir static sal_Bool GetChildIndex( SwAccessibleMap& rAccMap,
65cdf0e10cSrcweir const SwRect& rVisArea,
66cdf0e10cSrcweir const SwFrm& rFrm,
67cdf0e10cSrcweir const sw::access::SwAccessibleChild& rChild,
68cdf0e10cSrcweir sal_Int32& rPos,
69cdf0e10cSrcweir sal_Bool bInPagePreview );
70cdf0e10cSrcweir
71cdf0e10cSrcweir static sw::access::SwAccessibleChild GetChildAtPixel( const SwRect& rVisArea,
72cdf0e10cSrcweir const SwFrm& rFrm,
73cdf0e10cSrcweir const Point& rPos,
74cdf0e10cSrcweir sal_Bool bInPagePreview,
75cdf0e10cSrcweir SwAccessibleMap& rAccMap );
76cdf0e10cSrcweir
77cdf0e10cSrcweir static void GetChildren( SwAccessibleMap& rAccMap,
78cdf0e10cSrcweir const SwRect& rVisArea,
79cdf0e10cSrcweir const SwFrm& rFrm,
80cdf0e10cSrcweir ::std::list< sw::access::SwAccessibleChild >& rChildren,
81cdf0e10cSrcweir sal_Bool bInPagePreview );
82cdf0e10cSrcweir
83cdf0e10cSrcweir protected:
84cdf0e10cSrcweir
85cdf0e10cSrcweir sal_Bool IsEditable( ViewShell *pVSh ) const;
86cdf0e10cSrcweir
87cdf0e10cSrcweir sal_Bool IsOpaque( ViewShell *pVSh ) const;
88cdf0e10cSrcweir
89cdf0e10cSrcweir sal_Bool IsShowing( const SwAccessibleMap& rAccMap,
90cdf0e10cSrcweir const sw::access::SwAccessibleChild& rFrmOrObj ) const;
91cdf0e10cSrcweir inline sal_Bool IsShowing( const SwRect& rFrm ) const;
92cdf0e10cSrcweir inline sal_Bool IsShowing( const SwAccessibleMap& rAccMap ) const;
93cdf0e10cSrcweir
IsInPagePreview() const94cdf0e10cSrcweir inline sal_Bool IsInPagePreview() const
95cdf0e10cSrcweir {
96cdf0e10cSrcweir return mbIsInPagePreview;
97cdf0e10cSrcweir }
98cdf0e10cSrcweir
ClearFrm()99cdf0e10cSrcweir inline void ClearFrm()
100cdf0e10cSrcweir {
101cdf0e10cSrcweir mpFrm = 0;
102cdf0e10cSrcweir }
103cdf0e10cSrcweir
104cdf0e10cSrcweir SwAccessibleFrame( const SwRect& rVisArea,
105cdf0e10cSrcweir const SwFrm *pFrm,
106cdf0e10cSrcweir sal_Bool bIsPagePreview );
107cdf0e10cSrcweir virtual ~SwAccessibleFrame();
108cdf0e10cSrcweir
109*ca62e2c2SSteve Yin // MT: Move to private area?
110*ca62e2c2SSteve Yin sal_Bool bIsAccDocUse;
111*ca62e2c2SSteve Yin
112*ca62e2c2SSteve Yin
113cdf0e10cSrcweir public:
114cdf0e10cSrcweir // Return the SwFrm this context is attached to.
GetFrm() const115cdf0e10cSrcweir const SwFrm* GetFrm() const { return mpFrm; };
116cdf0e10cSrcweir
117cdf0e10cSrcweir static const SwFrm* GetParent( const sw::access::SwAccessibleChild& rFrmOrObj,
118cdf0e10cSrcweir sal_Bool bInPagePreview );
119cdf0e10cSrcweir
120cdf0e10cSrcweir sal_Int32 GetChildIndex( SwAccessibleMap& rAccMap,
121cdf0e10cSrcweir const sw::access::SwAccessibleChild& rChild ) const;
122cdf0e10cSrcweir
123cdf0e10cSrcweir protected:
124cdf0e10cSrcweir
125cdf0e10cSrcweir // Return the bounding box of the frame clipped to the vis area. If
126cdf0e10cSrcweir // no frame is specified, use this' frame.
127cdf0e10cSrcweir SwRect GetBounds( const SwAccessibleMap& rAccMap,
128cdf0e10cSrcweir const SwFrm *pFrm = 0 );
129cdf0e10cSrcweir
130cdf0e10cSrcweir // Return the upper that has a context attached. This might be
131cdf0e10cSrcweir // another one than the immediate upper.
132cdf0e10cSrcweir inline const SwFrm *GetParent() const;
133cdf0e10cSrcweir
134cdf0e10cSrcweir // Return the lower count or the nth lower, there the lowers have a
135cdf0e10cSrcweir // not be same one as the SwFrm's lowers
136cdf0e10cSrcweir sal_Int32 GetChildCount( SwAccessibleMap& rAccMap ) const;
137cdf0e10cSrcweir sw::access::SwAccessibleChild GetChild( SwAccessibleMap& rAccMap,
138cdf0e10cSrcweir sal_Int32 nPos ) const;
139cdf0e10cSrcweir sw::access::SwAccessibleChild GetChildAtPixel( const Point& rPos,
140cdf0e10cSrcweir SwAccessibleMap& rAccMap ) const;
141cdf0e10cSrcweir void GetChildren( SwAccessibleMap& rAccMap,
142cdf0e10cSrcweir ::std::list< sw::access::SwAccessibleChild >& rChildren ) const;
143cdf0e10cSrcweir
SetVisArea(const SwRect & rNewVisArea)144cdf0e10cSrcweir inline void SetVisArea( const SwRect& rNewVisArea )
145cdf0e10cSrcweir {
146cdf0e10cSrcweir maVisArea = rNewVisArea;
147cdf0e10cSrcweir }
148cdf0e10cSrcweir
GetVisArea() const149cdf0e10cSrcweir inline const SwRect& GetVisArea() const
150cdf0e10cSrcweir {
151cdf0e10cSrcweir return maVisArea;
152cdf0e10cSrcweir }
153cdf0e10cSrcweir
154cdf0e10cSrcweir
155cdf0e10cSrcweir String GetFormattedPageNumber() const;
156cdf0e10cSrcweir };
157cdf0e10cSrcweir
IsShowing(const SwRect & rFrm) const158cdf0e10cSrcweir inline sal_Bool SwAccessibleFrame::IsShowing( const SwRect& rFrm ) const
159cdf0e10cSrcweir {
160cdf0e10cSrcweir return rFrm.IsOver( maVisArea );
161cdf0e10cSrcweir }
162cdf0e10cSrcweir
IsShowing(const SwAccessibleMap & rAccMap) const163cdf0e10cSrcweir inline sal_Bool SwAccessibleFrame::IsShowing( const SwAccessibleMap& rAccMap ) const
164cdf0e10cSrcweir {
165cdf0e10cSrcweir sw::access::SwAccessibleChild aFrmOrObj( GetFrm() );
166cdf0e10cSrcweir return IsShowing( rAccMap, aFrmOrObj );
167cdf0e10cSrcweir }
168cdf0e10cSrcweir
GetParent() const169cdf0e10cSrcweir inline const SwFrm *SwAccessibleFrame::GetParent() const
170cdf0e10cSrcweir {
171cdf0e10cSrcweir sw::access::SwAccessibleChild aFrmOrObj( GetFrm() );
172cdf0e10cSrcweir return GetParent( aFrmOrObj, IsInPagePreview() );
173cdf0e10cSrcweir }
174cdf0e10cSrcweir
175cdf0e10cSrcweir #endif
176cdf0e10cSrcweir
177