update dev300-m58
[ooovba.git] / sw / source / core / layout / movedfwdfrmsbyobjpos.cxx
blob02c3c09efa10d6d50289b6ebead504b9d58a4e9a
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: movedfwdfrmsbyobjpos.cxx,v $
10 * $Revision: 1.10 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sw.hxx"
33 #include <movedfwdfrmsbyobjpos.hxx>
34 #include <txtfrm.hxx>
35 // --> OD 2004-10-05 #i26945#
36 #include <rowfrm.hxx>
37 #include <pagefrm.hxx>
38 #include <ndtxt.hxx>
39 // <--
41 SwMovedFwdFrmsByObjPos::SwMovedFwdFrmsByObjPos()
45 SwMovedFwdFrmsByObjPos::~SwMovedFwdFrmsByObjPos()
47 Clear();
50 void SwMovedFwdFrmsByObjPos::Insert( const SwTxtFrm& _rMovedFwdFrmByObjPos,
51 const sal_uInt32 _nToPageNum )
53 if ( maMovedFwdFrms.end() ==
54 maMovedFwdFrms.find( _rMovedFwdFrmByObjPos.GetTxtNode() ) )
56 const NodeMapEntry aEntry( _rMovedFwdFrmByObjPos.GetTxtNode(), _nToPageNum );
57 maMovedFwdFrms.insert( aEntry );
61 void SwMovedFwdFrmsByObjPos::Remove( const SwTxtFrm& _rTxtFrm )
63 maMovedFwdFrms.erase( _rTxtFrm.GetTxtNode() );
66 bool SwMovedFwdFrmsByObjPos::FrmMovedFwdByObjPos( const SwTxtFrm& _rTxtFrm,
67 sal_uInt32& _ornToPageNum ) const
69 NodeMapIter aIter = maMovedFwdFrms.find( _rTxtFrm.GetTxtNode() );
70 if ( maMovedFwdFrms.end() != aIter )
72 _ornToPageNum = (*aIter).second;
73 return true;
76 return false;
79 // --> OD 2004-10-05 #i26945#
80 bool SwMovedFwdFrmsByObjPos::DoesRowContainMovedFwdFrm( const SwRowFrm& _rRowFrm ) const
82 bool bDoesRowContainMovedFwdFrm( false );
84 const sal_uInt32 nPageNumOfRow = _rRowFrm.FindPageFrm()->GetPhyPageNum();
86 NodeMapIter aIter = maMovedFwdFrms.begin();
87 for ( ; aIter != maMovedFwdFrms.end(); ++aIter )
89 const NodeMapEntry& rEntry = *(aIter);
90 if ( rEntry.second >= nPageNumOfRow )
92 SwClientIter aFrmIter( *const_cast<SwTxtNode*>( rEntry.first ) );
93 for( SwTxtFrm* pTxtFrm = (SwTxtFrm*)aFrmIter.First( TYPE(SwTxtFrm) );
94 pTxtFrm;
95 pTxtFrm = (SwTxtFrm*)aFrmIter.Next() )
97 // --> OD 2004-12-03 #115759# - assure that found text frame
98 // is the first one.
99 if ( _rRowFrm.IsAnLower( pTxtFrm ) && !pTxtFrm->GetIndPrev() )
100 // <--
102 bDoesRowContainMovedFwdFrm = true;
103 break;
109 return bDoesRowContainMovedFwdFrm;
111 // <--