LibreOffice Module sw (master) 1
accfrmobjslist.cxx
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#include "accfrmobjslist.hxx"
21#include <accmap.hxx>
22#include "acccontext.hxx"
23
24#include <pagefrm.hxx>
25#include <sortedobjs.hxx>
26#include <anchoredobject.hxx>
27
28using namespace ::sw::access;
29
31 const SwAccessibleChildSList& rLst,
32 SwAccessibleMap& rAccMap )
33 : m_rList( rLst ),
34 m_aCurr( m_rList.GetFrame().GetLower() ),
35 m_nNextObj( 0 )
36{
37 if( !m_aCurr.GetSwFrame() )
38 {
39 const SwFrame& rFrame = m_rList.GetFrame();
40 if( rFrame.IsPageFrame() )
41 {
42 const SwPageFrame& rPgFrame = static_cast< const SwPageFrame& >( rFrame );
43 const SwSortedObjs *pObjs = rPgFrame.GetSortedObjs();
44 if( pObjs && pObjs->size() )
45 {
46 m_aCurr = (*pObjs)[m_nNextObj++]->GetDrawObj();
47 }
48 }
49 else if( rFrame.IsTextFrame() )
50 {
51 const SwSortedObjs *pObjs = rFrame.GetDrawObjs();
52 if ( pObjs && pObjs->size() )
53 {
54 m_aCurr = (*pObjs)[m_nNextObj++]->GetDrawObj();
55 while( m_aCurr.IsValid() && !m_aCurr.IsBoundAsChar() )
56 {
57 m_aCurr = (m_nNextObj < pObjs->size())
58 ? (*pObjs)[m_nNextObj++]->GetDrawObj()
59 : static_cast< const SdrObject *>( nullptr );
60 }
61 }
62 if ( !m_aCurr.IsValid() )
63 {
65 rAccMap.GetContextImpl( &rFrame, false );
66 if( xAccImpl.is() )
67 {
68 SwAccessibleContext* pAccImpl = xAccImpl.get();
69 m_aCurr = SwAccessibleChild( pAccImpl->GetAdditionalAccessibleChild( 0 ) );
70 ++m_nNextObj;
71 }
72 }
73 }
74 }
75
77 {
78 // Find the first visible
79 while( m_aCurr.IsValid() &&
81 !m_aCurr.GetBox( rAccMap ).Overlaps( m_rList.GetVisArea() ) )
82 {
83 next();
84 }
85 }
86}
87
89{
90 bool bNextTaken( true );
92 {
93 bNextTaken = false;
94 }
95 else if( m_aCurr.GetSwFrame() )
96 {
98 if( !m_aCurr.GetSwFrame() )
99 {
100 bNextTaken = false;
101 }
102 }
103
104 if( !bNextTaken )
105 {
106 const SwFrame& rFrame = m_rList.GetFrame();
107 if( rFrame.IsPageFrame() )
108 {
109 const SwPageFrame& rPgFrame = static_cast< const SwPageFrame& >( rFrame );
110 const SwSortedObjs *pObjs = rPgFrame.GetSortedObjs();
111 m_aCurr = ( pObjs && m_nNextObj < pObjs->size() )
112 ? (*pObjs)[m_nNextObj++]->GetDrawObj()
113 : static_cast< const SdrObject *>( nullptr );
114 }
115 else if( rFrame.IsTextFrame() )
116 {
117 const SwSortedObjs* pObjs = rFrame.GetDrawObjs();
118 const size_t nObjsCount = pObjs ? pObjs->size() : 0;
119 m_aCurr = ( pObjs && m_nNextObj < nObjsCount )
120 ? (*pObjs)[m_nNextObj++]->GetDrawObj()
121 : static_cast< const SdrObject *>( nullptr );
122 while( m_aCurr.IsValid() && !m_aCurr.IsBoundAsChar() )
123 {
124 m_aCurr = ( m_nNextObj < nObjsCount )
125 ? (*pObjs)[m_nNextObj++]->GetDrawObj()
126 : static_cast< const SdrObject *>( nullptr );
127 }
128 if ( !m_aCurr.IsValid() )
129 {
131 m_rList.GetAccMap().GetContextImpl( &rFrame, false );
132 if( xAccImpl.is() )
133 {
134 SwAccessibleContext* pAccImpl = xAccImpl.get();
135 m_aCurr = SwAccessibleChild( pAccImpl->GetAdditionalAccessibleChild( m_nNextObj - nObjsCount ) );
136 ++m_nNextObj;
137 }
138 }
139 }
140 }
141
142 return *this;
143}
144
146{
147 next();
148 while( m_aCurr.IsValid() &&
151 {
152 next();
153 }
154
155 return *this;
156}
157
159{
161}
162
163/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const std::vector< OUString > & m_rList
SwAccessibleChildSList_const_iterator & next()
const SwAccessibleChildSList & m_rList
sw::access::SwAccessibleChild m_aCurr
SwAccessibleChildSList_const_iterator & operator++()
SwAccessibleChildSList_const_iterator(const SwAccessibleChildSList &rLst)
SwAccessibleChildSList_const_iterator & next_visible()
bool IsVisibleChildrenOnly() const
SwAccessibleMap & GetAccMap() const
const SwRect & GetVisArea() const
const SwFrame & GetFrame() const
vcl::Window * GetAdditionalAccessibleChild(const sal_Int32 nIndex)
#i88070# - get additional accessible child by index
::rtl::Reference< SwAccessibleContext > GetContextImpl(const SwFrame *pFrame, bool bCreate=true)
Definition: accmap.cxx:1914
Base class of the Writer layout elements.
Definition: frame.hxx:315
bool IsTextFrame() const
Definition: frame.hxx:1240
SwFrame * GetNext()
Definition: frame.hxx:682
bool IsPageFrame() const
Definition: frame.hxx:1184
const SwSortedObjs * GetDrawObjs() const
Definition: frame.hxx:568
A page of the document layout.
Definition: pagefrm.hxx:60
const SwSortedObjs * GetSortedObjs() const
Definition: pagefrm.hxx:136
bool Overlaps(const SwRect &rRect) const
Definition: swrect.hxx:374
class for collecting anchored objects
Definition: sortedobjs.hxx:49
size_t size() const
Definition: sortedobjs.cxx:43
SwRect GetBox(const SwAccessibleMap &rAccMap) const
Definition: accfrmobj.cxx:213
const SwFrame * GetSwFrame() const
Definition: accfrmobj.hxx:63
bool AlwaysIncludeAsChild() const
indicating, if accessible child is included even, if the corresponding object is not visible.
Definition: accfrmobj.cxx:290
const SdrObject * GetDrawObject() const
Definition: accfrmobj.hxx:64
vcl::Window * GetWindow() const
Definition: accfrmobj.hxx:65