Line data Source code
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 : #ifndef _ACCFRMOBJSLIST_HXX
20 : #define _ACCFRMOBJSLIST_HXX
21 :
22 : #include <accfrmobj.hxx>
23 : #include <swrect.hxx>
24 :
25 : class SwAccessibleMap;
26 :
27 : class SwAccessibleChildSList;
28 :
29 : class SwAccessibleChildSList_const_iterator
30 : {
31 : private:
32 : friend class SwAccessibleChildSList;
33 :
34 : const SwAccessibleChildSList& rList; // The frame we are iterating over
35 : sw::access::SwAccessibleChild aCurr; // The current object
36 : sal_uInt16 nNextObj; // The index of the current sdr object
37 :
38 0 : inline SwAccessibleChildSList_const_iterator( const SwAccessibleChildSList& rLst )
39 : : rList( rLst )
40 0 : , nNextObj( 0 )
41 0 : {}
42 :
43 : SwAccessibleChildSList_const_iterator( const SwAccessibleChildSList& rLst,
44 : SwAccessibleMap& rAccMap );
45 :
46 : SwAccessibleChildSList_const_iterator& next();
47 : SwAccessibleChildSList_const_iterator& next_visible();
48 :
49 : public:
50 :
51 : inline SwAccessibleChildSList_const_iterator( const SwAccessibleChildSList_const_iterator& rIter )
52 : : rList( rIter.rList )
53 : , aCurr( rIter.aCurr )
54 : , nNextObj( rIter.nNextObj )
55 : {}
56 :
57 0 : inline bool operator==( const SwAccessibleChildSList_const_iterator& r ) const
58 : {
59 0 : return aCurr == r.aCurr;
60 : }
61 :
62 0 : inline bool operator!=(
63 : const SwAccessibleChildSList_const_iterator& r ) const
64 : {
65 0 : return !(*this == r);
66 : }
67 :
68 : SwAccessibleChildSList_const_iterator& operator++();
69 :
70 0 : inline const sw::access::SwAccessibleChild& operator*() const
71 : {
72 0 : return aCurr;
73 : }
74 : };
75 :
76 : // An iterator to iterate over a frame's child in any order
77 : class SwAccessibleChildSList
78 : {
79 : const SwRect maVisArea;
80 : const SwFrm& mrFrm;
81 : const bool mbVisibleChildrenOnly;
82 : SwAccessibleMap& mrAccMap;
83 :
84 : public:
85 :
86 : typedef SwAccessibleChildSList_const_iterator const_iterator;
87 :
88 0 : inline SwAccessibleChildSList( const SwFrm& rFrm,
89 : SwAccessibleMap& rAccMap )
90 : : maVisArea()
91 : , mrFrm( rFrm )
92 : , mbVisibleChildrenOnly( false )
93 0 : , mrAccMap( rAccMap )
94 0 : {}
95 :
96 0 : inline SwAccessibleChildSList( const SwRect& rVisArea,
97 : const SwFrm& rFrm,
98 : SwAccessibleMap& rAccMap )
99 : : maVisArea( rVisArea )
100 : , mrFrm( rFrm )
101 0 : , mbVisibleChildrenOnly( sw::access::SwAccessibleChild( &rFrm ).IsVisibleChildrenOnly() )
102 0 : , mrAccMap( rAccMap )
103 : {
104 0 : }
105 :
106 0 : inline const_iterator begin() const
107 : {
108 0 : return SwAccessibleChildSList_const_iterator( *this, mrAccMap );
109 : }
110 :
111 0 : inline const_iterator end() const
112 : {
113 0 : return SwAccessibleChildSList_const_iterator( *this );
114 : }
115 :
116 0 : inline const SwFrm& GetFrm() const
117 : {
118 0 : return mrFrm;
119 : }
120 :
121 0 : inline bool IsVisibleChildrenOnly() const
122 : {
123 0 : return mbVisibleChildrenOnly;
124 : }
125 :
126 0 : inline const SwRect& GetVisArea() const
127 : {
128 0 : return maVisArea;
129 : }
130 :
131 0 : inline SwAccessibleMap& GetAccMap() const
132 : {
133 0 : return mrAccMap;
134 : }
135 : };
136 :
137 : #endif
138 :
139 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|