1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <movedfwdfrmsbyobjpos.hxx>
23 #include <pagefrm.hxx>
27 SwMovedFwdFramesByObjPos::SwMovedFwdFramesByObjPos()
31 SwMovedFwdFramesByObjPos::~SwMovedFwdFramesByObjPos()
36 void SwMovedFwdFramesByObjPos::Insert( const SwTextFrame
& _rMovedFwdFrameByObjPos
,
37 const sal_uInt32 _nToPageNum
)
39 maMovedFwdFrames
.emplace(_rMovedFwdFrameByObjPos
.GetTextNodeFirst(), _nToPageNum
);
42 void SwMovedFwdFramesByObjPos::Remove( const SwTextFrame
& _rTextFrame
)
44 maMovedFwdFrames
.erase(_rTextFrame
.GetTextNodeFirst());
47 bool SwMovedFwdFramesByObjPos::FrameMovedFwdByObjPos( const SwTextFrame
& _rTextFrame
,
48 sal_uInt32
& _ornToPageNum
) const
50 // sw_redlinehide: assumption: this wants to uniquely identify all
51 // SwTextFrame belonging to the same paragraph, so just use first one as key
52 auto aIter
= maMovedFwdFrames
.find( _rTextFrame
.GetTextNodeFirst() );
53 if ( maMovedFwdFrames
.end() != aIter
)
55 _ornToPageNum
= (*aIter
).second
;
63 bool SwMovedFwdFramesByObjPos::DoesRowContainMovedFwdFrame( const SwRowFrame
& _rRowFrame
) const
65 bool bDoesRowContainMovedFwdFrame( false );
67 const sal_uInt32 nPageNumOfRow
= _rRowFrame
.FindPageFrame()->GetPhyPageNum();
69 for ( const auto & rEntry
: maMovedFwdFrames
)
71 if ( rEntry
.second
>= nPageNumOfRow
)
73 SwIterator
<SwTextFrame
, SwTextNode
, sw::IteratorMode::UnwrapMulti
> aFrameIter(*rEntry
.first
);
74 for( SwTextFrame
* pTextFrame
= aFrameIter
.First(); pTextFrame
; pTextFrame
= aFrameIter
.Next() )
76 // #115759# - assure that found text frame
78 if ( _rRowFrame
.IsAnLower( pTextFrame
) && !pTextFrame
->GetIndPrev() )
80 bDoesRowContainMovedFwdFrame
= true;
87 return bDoesRowContainMovedFwdFrame
;
90 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */