Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / sw / source / core / access / accframe.hxx
blobc069292e11f3df4bb6ae204b2a4776a3a48cafd9
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 .
20 #pragma once
22 #include <swrect.hxx>
24 #include <sal/types.h>
25 #include <rtl/ustring.hxx>
27 #include <list>
28 #include "accfrmobj.hxx"
30 class SwAccessibleMap;
31 class SwFrame;
32 class SwViewShell;
34 // Any method of this class must be called with an acquired solar mutex!
36 class SwAccessibleFrame
38 SwRect maVisArea;
39 const SwFrame* mpFrame;
40 const bool mbIsInPagePreview;
42 protected:
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 );
49 // private:
50 static sw::access::SwAccessibleChild GetChild( SwAccessibleMap& rAccMap,
51 const SwRect& rVisArea,
52 const SwFrame& rFrame,
53 sal_Int32& rPos,
54 bool bInPagePreview);
56 static bool GetChildIndex( SwAccessibleMap& rAccMap,
57 const SwRect& rVisArea,
58 const SwFrame& rFrame,
59 const sw::access::SwAccessibleChild& rChild,
60 sal_Int32& rPos,
61 bool bInPagePreview );
63 static sw::access::SwAccessibleChild GetChildAtPixel( const SwRect& rVisArea,
64 const SwFrame& rFrame,
65 const Point& rPos,
66 bool bInPagePreview,
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;
79 public:
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;
85 protected:
86 bool IsInPagePreview() const
88 return mbIsInPagePreview;
91 void ClearFrame()
93 mpFrame = nullptr;
96 SwAccessibleFrame( const SwRect& rVisArea,
97 const SwFrame *pFrame,
98 bool bIsPagePreview );
99 virtual ~SwAccessibleFrame();
100 public:
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;
110 protected:
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
137 return maVisArea;
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: */