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 :
20 : #ifndef INCLUDED_SW_SOURCE_CORE_ACCESS_ACCFRMOBJSLIST_HXX
21 : #define INCLUDED_SW_SOURCE_CORE_ACCESS_ACCFRMOBJSLIST_HXX
22 :
23 : #include <accfrmobj.hxx>
24 : #include <swrect.hxx>
25 :
26 : class SwAccessibleMap;
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 1382 : inline SwAccessibleChildSList_const_iterator( const SwAccessibleChildSList& rLst )
39 : : rList( rLst )
40 1382 : , nNextObj( 0 )
41 1382 : {}
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 : inline SwAccessibleChildSList_const_iterator( const SwAccessibleChildSList_const_iterator& rIter )
51 : : rList( rIter.rList )
52 : , aCurr( rIter.aCurr )
53 : , nNextObj( rIter.nNextObj )
54 : {}
55 :
56 1514 : inline bool operator==( const SwAccessibleChildSList_const_iterator& r ) const
57 : {
58 1514 : return aCurr == r.aCurr;
59 : }
60 :
61 1514 : inline bool operator!=(
62 : const SwAccessibleChildSList_const_iterator& r ) const
63 : {
64 1514 : return !(*this == r);
65 : }
66 :
67 : SwAccessibleChildSList_const_iterator& operator++();
68 :
69 815 : inline const sw::access::SwAccessibleChild& operator*() const
70 : {
71 815 : return aCurr;
72 : }
73 : };
74 :
75 : // An iterator to iterate over a frame's child in any order
76 : class SwAccessibleChildSList
77 : {
78 : const SwRect maVisArea;
79 : const SwFrm& mrFrm;
80 : const bool mbVisibleChildrenOnly;
81 : SwAccessibleMap& mrAccMap;
82 :
83 : public:
84 : typedef SwAccessibleChildSList_const_iterator const_iterator;
85 :
86 213 : inline SwAccessibleChildSList( const SwFrm& rFrm,
87 : SwAccessibleMap& rAccMap )
88 : : maVisArea()
89 : , mrFrm( rFrm )
90 : , mbVisibleChildrenOnly( false )
91 213 : , mrAccMap( rAccMap )
92 213 : {}
93 :
94 486 : inline SwAccessibleChildSList( const SwRect& rVisArea,
95 : const SwFrm& rFrm,
96 : SwAccessibleMap& rAccMap )
97 : : maVisArea( rVisArea )
98 : , mrFrm( rFrm )
99 972 : , mbVisibleChildrenOnly( sw::access::SwAccessibleChild( &rFrm ).IsVisibleChildrenOnly() )
100 1458 : , mrAccMap( rAccMap )
101 : {
102 486 : }
103 :
104 699 : inline const_iterator begin() const
105 : {
106 699 : return SwAccessibleChildSList_const_iterator( *this, mrAccMap );
107 : }
108 :
109 1382 : inline const_iterator end() const
110 : {
111 1382 : return SwAccessibleChildSList_const_iterator( *this );
112 : }
113 :
114 1390 : inline const SwFrm& GetFrm() const
115 : {
116 1390 : return mrFrm;
117 : }
118 :
119 1514 : inline bool IsVisibleChildrenOnly() const
120 : {
121 1514 : return mbVisibleChildrenOnly;
122 : }
123 :
124 306 : inline const SwRect& GetVisArea() const
125 : {
126 306 : return maVisArea;
127 : }
128 :
129 64 : inline SwAccessibleMap& GetAccMap() const
130 : {
131 64 : return mrAccMap;
132 : }
133 : };
134 :
135 : #endif
136 :
137 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|