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>
25 #include <switerator.hxx>
27 SwMovedFwdFrmsByObjPos::SwMovedFwdFrmsByObjPos()
31 SwMovedFwdFrmsByObjPos::~SwMovedFwdFrmsByObjPos()
36 void SwMovedFwdFrmsByObjPos::Insert( const SwTxtFrm
& _rMovedFwdFrmByObjPos
,
37 const sal_uInt32 _nToPageNum
)
39 if ( maMovedFwdFrms
.end() ==
40 maMovedFwdFrms
.find( _rMovedFwdFrmByObjPos
.GetTxtNode() ) )
42 const NodeMapEntry
aEntry( _rMovedFwdFrmByObjPos
.GetTxtNode(), _nToPageNum
);
43 maMovedFwdFrms
.insert( aEntry
);
47 void SwMovedFwdFrmsByObjPos::Remove( const SwTxtFrm
& _rTxtFrm
)
49 maMovedFwdFrms
.erase( _rTxtFrm
.GetTxtNode() );
52 bool SwMovedFwdFrmsByObjPos::FrmMovedFwdByObjPos( const SwTxtFrm
& _rTxtFrm
,
53 sal_uInt32
& _ornToPageNum
) const
55 NodeMapIter aIter
= maMovedFwdFrms
.find( _rTxtFrm
.GetTxtNode() );
56 if ( maMovedFwdFrms
.end() != aIter
)
58 _ornToPageNum
= (*aIter
).second
;
66 bool SwMovedFwdFrmsByObjPos::DoesRowContainMovedFwdFrm( const SwRowFrm
& _rRowFrm
) const
68 bool bDoesRowContainMovedFwdFrm( false );
70 const sal_uInt32 nPageNumOfRow
= _rRowFrm
.FindPageFrm()->GetPhyPageNum();
72 NodeMapIter aIter
= maMovedFwdFrms
.begin();
73 for ( ; aIter
!= maMovedFwdFrms
.end(); ++aIter
)
75 const NodeMapEntry
& rEntry
= *(aIter
);
76 if ( rEntry
.second
>= nPageNumOfRow
)
78 SwIterator
<SwTxtFrm
,SwTxtNode
> aFrmIter( *rEntry
.first
);
79 for( SwTxtFrm
* pTxtFrm
= aFrmIter
.First(); pTxtFrm
; pTxtFrm
= (SwTxtFrm
*)aFrmIter
.Next() )
81 // #115759# - assure that found text frame
83 if ( _rRowFrm
.IsAnLower( pTxtFrm
) && !pTxtFrm
->GetIndPrev() )
85 bDoesRowContainMovedFwdFrm
= true;
92 return bDoesRowContainMovedFwdFrm
;
95 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */