1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 #ifndef _ACCFRMOBJSLIST_HXX 24 #define _ACCFRMOBJSLIST_HXX 25 26 #include <accfrmobj.hxx> 27 #include <swrect.hxx> 28 29 class SwAccessibleMap; 30 31 class SwAccessibleChildSList; 32 33 class SwAccessibleChildSList_const_iterator 34 { 35 private: 36 friend class SwAccessibleChildSList; 37 38 const SwAccessibleChildSList& rList; // The frame we are iterating over 39 sw::access::SwAccessibleChild aCurr; // The current object 40 sal_uInt16 nNextObj; // The index of the current sdr object 41 SwAccessibleChildSList_const_iterator(const SwAccessibleChildSList & rLst)42 inline SwAccessibleChildSList_const_iterator( const SwAccessibleChildSList& rLst ) 43 : rList( rLst ) 44 , nNextObj( 0 ) 45 {} 46 47 SwAccessibleChildSList_const_iterator( const SwAccessibleChildSList& rLst, 48 SwAccessibleMap& rAccMap ); 49 50 SwAccessibleChildSList_const_iterator& next(); 51 SwAccessibleChildSList_const_iterator& next_visible(); 52 53 public: 54 SwAccessibleChildSList_const_iterator(const SwAccessibleChildSList_const_iterator & rIter)55 inline SwAccessibleChildSList_const_iterator( const SwAccessibleChildSList_const_iterator& rIter ) 56 : rList( rIter.rList ) 57 , aCurr( rIter.aCurr ) 58 , nNextObj( rIter.nNextObj ) 59 {} 60 operator ==(const SwAccessibleChildSList_const_iterator & r) const61 inline sal_Bool operator==( const SwAccessibleChildSList_const_iterator& r ) const 62 { 63 return aCurr == r.aCurr; 64 } 65 operator !=(const SwAccessibleChildSList_const_iterator & r) const66 inline sal_Bool operator!=( 67 const SwAccessibleChildSList_const_iterator& r ) const 68 { 69 return !(*this == r); 70 } 71 72 SwAccessibleChildSList_const_iterator& operator++(); 73 operator *() const74 inline const sw::access::SwAccessibleChild& operator*() const 75 { 76 return aCurr; 77 } 78 }; 79 80 // An iterator to iterate over a frame's child in any order 81 class SwAccessibleChildSList 82 { 83 const SwRect maVisArea; 84 const SwFrm& mrFrm; 85 const sal_Bool mbVisibleChildrenOnly; 86 SwAccessibleMap& mrAccMap; 87 88 public: 89 90 typedef SwAccessibleChildSList_const_iterator const_iterator; 91 SwAccessibleChildSList(const SwFrm & rFrm,SwAccessibleMap & rAccMap)92 inline SwAccessibleChildSList( const SwFrm& rFrm, 93 SwAccessibleMap& rAccMap ) 94 : maVisArea() 95 , mrFrm( rFrm ) 96 , mbVisibleChildrenOnly( sal_False ) 97 , mrAccMap( rAccMap ) 98 {} 99 SwAccessibleChildSList(const SwRect & rVisArea,const SwFrm & rFrm,SwAccessibleMap & rAccMap)100 inline SwAccessibleChildSList( const SwRect& rVisArea, 101 const SwFrm& rFrm, 102 SwAccessibleMap& rAccMap ) 103 : maVisArea( rVisArea ) 104 , mrFrm( rFrm ) 105 , mbVisibleChildrenOnly( sw::access::SwAccessibleChild( &rFrm ).IsVisibleChildrenOnly() ) 106 , mrAccMap( rAccMap ) 107 { 108 } 109 begin() const110 inline const_iterator begin() const 111 { 112 return SwAccessibleChildSList_const_iterator( *this, mrAccMap ); 113 } 114 end() const115 inline const_iterator end() const 116 { 117 return SwAccessibleChildSList_const_iterator( *this ); 118 } 119 GetFrm() const120 inline const SwFrm& GetFrm() const 121 { 122 return mrFrm; 123 } 124 IsVisibleChildrenOnly() const125 inline sal_Bool IsVisibleChildrenOnly() const 126 { 127 return mbVisibleChildrenOnly; 128 } 129 GetVisArea() const130 inline const SwRect& GetVisArea() const 131 { 132 return maVisArea; 133 } 134 GetAccMap() const135 inline SwAccessibleMap& GetAccMap() const 136 { 137 return mrAccMap; 138 } 139 }; 140 141 #endif 142