LibreOffice Module sw (master) 1
accframe.hxx
Go to the documentation of this file.
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#pragma once
21
22#include <swrect.hxx>
23
24#include <sal/types.h>
25#include <rtl/ustring.hxx>
26
27#include <list>
28#include "accfrmobj.hxx"
29
30class SwAccessibleMap;
31class SwFrame;
32class SwViewShell;
33
34// Any method of this class must be called with an acquired solar mutex!
35
37{
41
42protected:
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 );
48
49// private:
51 const SwRect& rVisArea,
52 const SwFrame& rFrame,
53 sal_Int32& rPos,
54 bool bInPagePreview);
55
56 static bool GetChildIndex( SwAccessibleMap& rAccMap,
57 const SwRect& rVisArea,
58 const SwFrame& rFrame,
60 sal_Int32& rPos,
61 bool bInPagePreview );
62
64 const SwFrame& rFrame,
65 const Point& rPos,
66 bool bInPagePreview,
67 SwAccessibleMap& rAccMap );
68
69 static void GetChildren( SwAccessibleMap& rAccMap,
70 const SwRect& rVisArea,
71 const SwFrame& rFrame,
72 std::list< sw::access::SwAccessibleChild >& rChildren,
73 bool bInPagePreview );
74
75 bool IsEditable( SwViewShell const *pVSh ) const;
76
77 bool IsOpaque( SwViewShell const *pVSh ) const;
78
79public:
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;
84
85protected:
86 bool IsInPagePreview() const
87 {
88 return mbIsInPagePreview;
89 }
90
92 {
93 mpFrame = nullptr;
94 }
95
96 SwAccessibleFrame( const SwRect& rVisArea,
97 const SwFrame *pFrame,
98 bool bIsPagePreview );
99 virtual ~SwAccessibleFrame();
100public:
101 // Return the SwFrame this context is attached to.
102 const SwFrame* GetFrame() const { return mpFrame; };
103
104 static const SwFrame* GetParent( const sw::access::SwAccessibleChild& rFrameOrObj,
105 bool bInPagePreview );
106
107 sal_Int32 GetChildIndex( SwAccessibleMap& rAccMap,
108 const sw::access::SwAccessibleChild& rChild ) const;
109
110protected:
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 );
115
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;
119
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;
124 sal_Int32 nPos ) const;
126 SwAccessibleMap& rAccMap ) const;
127 void GetChildren( SwAccessibleMap& rAccMap,
128 std::list< sw::access::SwAccessibleChild >& rChildren ) const;
129
130 void SetVisArea( const SwRect& rNewVisArea )
131 {
132 maVisArea = rNewVisArea;
133 }
134
135 const SwRect& GetVisArea() const
136 {
137 return maVisArea;
138 }
139
140 OUString GetFormattedPageNumber() const;
141};
142
143inline bool SwAccessibleFrame::IsShowing( const SwRect& rFrame ) const
144{
145 return !rFrame.IsEmpty() && rFrame.Overlaps( maVisArea );
146}
147
148inline bool SwAccessibleFrame::IsShowing( const SwAccessibleMap& rAccMap ) const
149{
151 return IsShowing( rAccMap, aFrameOrObj );
152}
153
155{
157 return GetParent( aFrameOrObj, IsInPagePreview() );
158}
159
160/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SwRect GetBounds(const SwAccessibleMap &rAccMap, const SwFrame *pFrame=nullptr)
Definition: accframe.cxx:328
bool IsInPagePreview() const
Definition: accframe.hxx:86
static void GetChildren(SwAccessibleMap &rAccMap, const SwRect &rVisArea, const SwFrame &rFrame, std::list< sw::access::SwAccessibleChild > &rChildren, bool bInPagePreview)
Definition: accframe.cxx:277
bool IsEditable(SwViewShell const *pVSh) const
Definition: accframe.cxx:339
static sal_Int32 GetChildCount(SwAccessibleMap &rAccMap, const SwRect &rVisArea, const SwFrame *pFrame, bool bInPagePreviewr)
Definition: accframe.cxx:41
static sw::access::SwAccessibleChild GetChildAtPixel(const SwRect &rVisArea, const SwFrame &rFrame, const Point &rPos, bool bInPagePreview, SwAccessibleMap &rAccMap)
Definition: accframe.cxx:204
static bool GetChildIndex(SwAccessibleMap &rAccMap, const SwRect &rVisArea, const SwFrame &rFrame, const sw::access::SwAccessibleChild &rChild, sal_Int32 &rPos, bool bInPagePreview)
Definition: accframe.cxx:138
bool IsOpaque(SwViewShell const *pVSh) const
Definition: accframe.cxx:356
bool IsShowing(const SwAccessibleMap &rAccMap, const sw::access::SwAccessibleChild &rFrameOrObj) const
Definition: accframe.cxx:473
const bool mbIsInPagePreview
Definition: accframe.hxx:40
static sw::access::SwAccessibleChild GetChild(SwAccessibleMap &rAccMap, const SwRect &rVisArea, const SwFrame &rFrame, sal_Int32 &rPos, bool bInPagePreview)
Definition: accframe.cxx:71
const SwFrame * GetFrame() const
Definition: accframe.hxx:102
const SwFrame * GetParent() const
Definition: accframe.hxx:154
SwAccessibleFrame(const SwRect &rVisArea, const SwFrame *pFrame, bool bIsPagePreview)
Definition: accframe.cxx:407
virtual ~SwAccessibleFrame()
Definition: accframe.cxx:417
void SetVisArea(const SwRect &rNewVisArea)
Definition: accframe.hxx:130
OUString GetFormattedPageNumber() const
Definition: accframe.cxx:427
const SwRect & GetVisArea() const
Definition: accframe.hxx:135
const SwFrame * mpFrame
Definition: accframe.hxx:39
Base class of the Writer layout elements.
Definition: frame.hxx:315
Of course Writer needs its own rectangles.
Definition: swrect.hxx:35
bool IsEmpty() const
Definition: swrect.hxx:304
bool Overlaps(const SwRect &rRect) const
Definition: swrect.hxx:374