1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
24 #include <sal/types.h>
25 #include <rtl/ustring.hxx>
28 #include "accfrmobj.hxx"
30 class SwAccessibleMap
;
34 // Any method of this class must be called with an acquired solar mutex!
36 class SwAccessibleFrame
39 const SwFrame
* mpFrame
;
40 const bool mbIsInPagePreview
;
43 // #i77106# - method needs to be called by new class <SwAccessibleTableColHeaders>
44 static sal_Int32
GetChildCount( SwAccessibleMap
& rAccMap
,
45 const SwRect
& rVisArea
,
46 const SwFrame
*pFrame
,
47 bool bInPagePreviewr
);
50 static sw::access::SwAccessibleChild
GetChild( SwAccessibleMap
& rAccMap
,
51 const SwRect
& rVisArea
,
52 const SwFrame
& rFrame
,
56 static bool GetChildIndex( SwAccessibleMap
& rAccMap
,
57 const SwRect
& rVisArea
,
58 const SwFrame
& rFrame
,
59 const sw::access::SwAccessibleChild
& rChild
,
61 bool bInPagePreview
);
63 static sw::access::SwAccessibleChild
GetChildAtPixel( const SwRect
& rVisArea
,
64 const SwFrame
& rFrame
,
67 SwAccessibleMap
& rAccMap
);
69 static void GetChildren( SwAccessibleMap
& rAccMap
,
70 const SwRect
& rVisArea
,
71 const SwFrame
& rFrame
,
72 std::list
< sw::access::SwAccessibleChild
>& rChildren
,
73 bool bInPagePreview
);
75 bool IsEditable( SwViewShell
const *pVSh
) const;
77 bool IsOpaque( SwViewShell
const *pVSh
) const;
80 bool IsShowing( const SwAccessibleMap
& rAccMap
,
81 const sw::access::SwAccessibleChild
& rFrameOrObj
) const;
82 inline bool IsShowing( const SwRect
& rFrame
) const;
83 inline bool IsShowing( const SwAccessibleMap
& rAccMap
) const;
86 bool IsInPagePreview() const
88 return mbIsInPagePreview
;
96 SwAccessibleFrame( const SwRect
& rVisArea
,
97 const SwFrame
*pFrame
,
98 bool bIsPagePreview
);
99 virtual ~SwAccessibleFrame();
101 // Return the SwFrame this context is attached to.
102 const SwFrame
* GetFrame() const { return mpFrame
; };
104 static const SwFrame
* GetParent( const sw::access::SwAccessibleChild
& rFrameOrObj
,
105 bool bInPagePreview
);
107 sal_Int32
GetChildIndex( SwAccessibleMap
& rAccMap
,
108 const sw::access::SwAccessibleChild
& rChild
) const;
111 // Return the bounding box of the frame clipped to the visible area.
112 // If no frame is specified, use this' frame.
113 SwRect
GetBounds( const SwAccessibleMap
& rAccMap
,
114 const SwFrame
*pFrame
= nullptr );
116 // Return the upper that has a context attached. This might be
117 // another one than the immediate upper.
118 inline const SwFrame
*GetParent() const;
120 // Return the lower count or the nth lower, there the lowers have a
121 // not be same one as the SwFrame's lowers
122 sal_Int32
GetChildCount( SwAccessibleMap
& rAccMap
) const;
123 sw::access::SwAccessibleChild
GetChild( SwAccessibleMap
& rAccMap
,
124 sal_Int32 nPos
) const;
125 sw::access::SwAccessibleChild
GetChildAtPixel( const Point
& rPos
,
126 SwAccessibleMap
& rAccMap
) const;
127 void GetChildren( SwAccessibleMap
& rAccMap
,
128 std::list
< sw::access::SwAccessibleChild
>& rChildren
) const;
130 void SetVisArea( const SwRect
& rNewVisArea
)
132 maVisArea
= rNewVisArea
;
135 const SwRect
& GetVisArea() const
140 OUString
GetFormattedPageNumber() const;
143 inline bool SwAccessibleFrame::IsShowing( const SwRect
& rFrame
) const
145 return !rFrame
.IsEmpty() && rFrame
.Overlaps( maVisArea
);
148 inline bool SwAccessibleFrame::IsShowing( const SwAccessibleMap
& rAccMap
) const
150 sw::access::SwAccessibleChild
aFrameOrObj( GetFrame() );
151 return IsShowing( rAccMap
, aFrameOrObj
);
154 inline const SwFrame
*SwAccessibleFrame::GetParent() const
156 sw::access::SwAccessibleChild
aFrameOrObj( GetFrame() );
157 return GetParent( aFrameOrObj
, IsInPagePreview() );
160 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */