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 #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 SwFrame;
33 class SwViewShell;
34 
35 // Any method of this class must be called with an acquired solar mutex!
36 
38 {
40  const SwFrame* mpFrame;
41  const bool mbIsInPagePreview;
42 
43 protected:
44  // #i77106# - method needs to be called by new class <SwAccessibleTableColHeaders>
45  static sal_Int32 GetChildCount( SwAccessibleMap& rAccMap,
46  const SwRect& rVisArea,
47  const SwFrame *pFrame,
48  bool bInPagePreviewr );
49 
50 // private:
52  const SwRect& rVisArea,
53  const SwFrame& rFrame,
54  sal_Int32& rPos,
55  bool bInPagePreview);
56 
57  static bool GetChildIndex( SwAccessibleMap& rAccMap,
58  const SwRect& rVisArea,
59  const SwFrame& rFrame,
60  const sw::access::SwAccessibleChild& rChild,
61  sal_Int32& rPos,
62  bool bInPagePreview );
63 
65  const SwFrame& rFrame,
66  const Point& rPos,
67  bool bInPagePreview,
68  SwAccessibleMap& rAccMap );
69 
70  static void GetChildren( SwAccessibleMap& rAccMap,
71  const SwRect& rVisArea,
72  const SwFrame& rFrame,
73  std::list< sw::access::SwAccessibleChild >& rChildren,
74  bool bInPagePreview );
75 
76  bool IsEditable( SwViewShell const *pVSh ) const;
77 
78  bool IsOpaque( SwViewShell const *pVSh ) const;
79 
80 public:
81  bool IsShowing( const SwAccessibleMap& rAccMap,
82  const sw::access::SwAccessibleChild& rFrameOrObj ) const;
83  inline bool IsShowing( const SwRect& rFrame ) const;
84  inline bool IsShowing( const SwAccessibleMap& rAccMap ) const;
85 
86 protected:
87  bool IsInPagePreview() const
88  {
89  return mbIsInPagePreview;
90  }
91 
92  void ClearFrame()
93  {
94  mpFrame = nullptr;
95  }
96 
97  SwAccessibleFrame( const SwRect& rVisArea,
98  const SwFrame *pFrame,
99  bool bIsPagePreview );
100  virtual ~SwAccessibleFrame();
101 public:
102  // Return the SwFrame this context is attached to.
103  const SwFrame* GetFrame() const { return mpFrame; };
104 
105  static const SwFrame* GetParent( const sw::access::SwAccessibleChild& rFrameOrObj,
106  bool bInPagePreview );
107 
108  sal_Int32 GetChildIndex( SwAccessibleMap& rAccMap,
109  const sw::access::SwAccessibleChild& rChild ) const;
110 
111 protected:
112  // Return the bounding box of the frame clipped to the visible area.
113  // If no frame is specified, use this' frame.
114  SwRect GetBounds( const SwAccessibleMap& rAccMap,
115  const SwFrame *pFrame = nullptr );
116 
117  // Return the upper that has a context attached. This might be
118  // another one than the immediate upper.
119  inline const SwFrame *GetParent() const;
120 
121  // Return the lower count or the nth lower, there the lowers have a
122  // not be same one as the SwFrame's lowers
123  sal_Int32 GetChildCount( SwAccessibleMap& rAccMap ) const;
125  sal_Int32 nPos ) const;
127  SwAccessibleMap& rAccMap ) const;
128  void GetChildren( SwAccessibleMap& rAccMap,
129  std::list< sw::access::SwAccessibleChild >& rChildren ) const;
130 
131  void SetVisArea( const SwRect& rNewVisArea )
132  {
133  maVisArea = rNewVisArea;
134  }
135 
136  const SwRect& GetVisArea() const
137  {
138  return maVisArea;
139  }
140 
141  OUString GetFormattedPageNumber() const;
142 };
143 
144 inline bool SwAccessibleFrame::IsShowing( const SwRect& rFrame ) const
145 {
146  return !rFrame.IsEmpty() && rFrame.IsOver( maVisArea );
147 }
148 
149 inline bool SwAccessibleFrame::IsShowing( const SwAccessibleMap& rAccMap ) const
150 {
151  sw::access::SwAccessibleChild aFrameOrObj( GetFrame() );
152  return IsShowing( rAccMap, aFrameOrObj );
153 }
154 
156 {
157  sw::access::SwAccessibleChild aFrameOrObj( GetFrame() );
158  return GetParent( aFrameOrObj, IsInPagePreview() );
159 }
160 
161 #endif
162 
163 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Base class of the Writer layout elements.
Definition: frame.hxx:295
const SwFrame * mpFrame
Definition: accframe.hxx:40
Of course Writer needs its own rectangles.
Definition: swrect.hxx:34
static sal_Int32 GetChildCount(SwAccessibleMap &rAccMap, const SwRect &rVisArea, const SwFrame *pFrame, bool bInPagePreviewr)
Definition: accframe.cxx:41
bool IsInPagePreview() const
Definition: accframe.hxx:87
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:103
bool IsEmpty() const
Definition: swrect.hxx:294
bool IsOpaque(SwViewShell const *pVSh) const
Definition: accframe.cxx:356
static void GetChildren(SwAccessibleMap &rAccMap, const SwRect &rVisArea, const SwFrame &rFrame, std::list< sw::access::SwAccessibleChild > &rChildren, bool bInPagePreview)
Definition: accframe.cxx:277
const bool mbIsInPagePreview
Definition: accframe.hxx:41
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
void SetVisArea(const SwRect &rNewVisArea)
Definition: accframe.hxx:131
SwAccessibleFrame(const SwRect &rVisArea, const SwFrame *pFrame, bool bIsPagePreview)
Definition: accframe.cxx:407
SwRect GetBounds(const SwAccessibleMap &rAccMap, const SwFrame *pFrame=nullptr)
Definition: accframe.cxx:328
virtual ~SwAccessibleFrame()
Definition: accframe.cxx:417
bool IsEditable(SwViewShell const *pVSh) const
Definition: accframe.cxx:339
OUString GetFormattedPageNumber() const
Definition: accframe.cxx:427
const SwFrame * GetParent() const
Definition: accframe.hxx:155
const SwRect & GetVisArea() const
Definition: accframe.hxx:136
bool IsOver(const SwRect &rRect) const
Definition: swrect.cxx:125
static sw::access::SwAccessibleChild GetChildAtPixel(const SwRect &rVisArea, const SwFrame &rFrame, const Point &rPos, bool bInPagePreview, SwAccessibleMap &rAccMap)
Definition: accframe.cxx:204
bool IsShowing(const SwAccessibleMap &rAccMap, const sw::access::SwAccessibleChild &rFrameOrObj) const
Definition: accframe.cxx:473