Branch data Line data Source code
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 <movedfwdfrmsbyobjpos.hxx>
21 : : #include <txtfrm.hxx>
22 : : #include <rowfrm.hxx>
23 : : #include <pagefrm.hxx>
24 : : #include <ndtxt.hxx>
25 : : #include <switerator.hxx>
26 : :
27 : 0 : SwMovedFwdFrmsByObjPos::SwMovedFwdFrmsByObjPos()
28 : : {
29 : 0 : }
30 : :
31 : 0 : SwMovedFwdFrmsByObjPos::~SwMovedFwdFrmsByObjPos()
32 : : {
33 : 0 : Clear();
34 : 0 : }
35 : :
36 : 0 : void SwMovedFwdFrmsByObjPos::Insert( const SwTxtFrm& _rMovedFwdFrmByObjPos,
37 : : const sal_uInt32 _nToPageNum )
38 : : {
39 [ # # ][ # # ]: 0 : if ( maMovedFwdFrms.end() ==
40 [ # # ]: 0 : maMovedFwdFrms.find( _rMovedFwdFrmByObjPos.GetTxtNode() ) )
41 : : {
42 [ # # ]: 0 : const NodeMapEntry aEntry( _rMovedFwdFrmByObjPos.GetTxtNode(), _nToPageNum );
43 [ # # ]: 0 : maMovedFwdFrms.insert( aEntry );
44 : : }
45 : 0 : }
46 : :
47 : 0 : void SwMovedFwdFrmsByObjPos::Remove( const SwTxtFrm& _rTxtFrm )
48 : : {
49 [ # # ]: 0 : maMovedFwdFrms.erase( _rTxtFrm.GetTxtNode() );
50 : 0 : };
51 : :
52 : 0 : bool SwMovedFwdFrmsByObjPos::FrmMovedFwdByObjPos( const SwTxtFrm& _rTxtFrm,
53 : : sal_uInt32& _ornToPageNum ) const
54 : : {
55 [ # # ]: 0 : NodeMapIter aIter = maMovedFwdFrms.find( _rTxtFrm.GetTxtNode() );
56 [ # # ][ # # ]: 0 : if ( maMovedFwdFrms.end() != aIter )
57 : : {
58 [ # # ]: 0 : _ornToPageNum = (*aIter).second;
59 : 0 : return true;
60 : : }
61 : :
62 : 0 : return false;
63 : : }
64 : :
65 : : // #i26945#
66 : 0 : bool SwMovedFwdFrmsByObjPos::DoesRowContainMovedFwdFrm( const SwRowFrm& _rRowFrm ) const
67 : : {
68 : 0 : bool bDoesRowContainMovedFwdFrm( false );
69 : :
70 [ # # ]: 0 : const sal_uInt32 nPageNumOfRow = _rRowFrm.FindPageFrm()->GetPhyPageNum();
71 : :
72 : 0 : NodeMapIter aIter = maMovedFwdFrms.begin();
73 [ # # ][ # # ]: 0 : for ( ; aIter != maMovedFwdFrms.end(); ++aIter )
[ # # ]
74 : : {
75 [ # # ]: 0 : const NodeMapEntry& rEntry = *(aIter);
76 [ # # ]: 0 : if ( rEntry.second >= nPageNumOfRow )
77 : : {
78 [ # # ]: 0 : SwIterator<SwTxtFrm,SwTxtNode> aFrmIter( *rEntry.first );
79 [ # # ][ # # ]: 0 : for( SwTxtFrm* pTxtFrm = aFrmIter.First(); pTxtFrm; pTxtFrm = (SwTxtFrm*)aFrmIter.Next() )
[ # # ]
80 : : {
81 : : // #115759# - assure that found text frame
82 : : // is the first one.
83 [ # # ][ # # ]: 0 : if ( _rRowFrm.IsAnLower( pTxtFrm ) && !pTxtFrm->GetIndPrev() )
[ # # ][ # # ]
[ # # ]
84 : : {
85 : 0 : bDoesRowContainMovedFwdFrm = true;
86 : 0 : break;
87 : : }
88 [ # # ]: 0 : }
89 : : }
90 : : }
91 : :
92 : 0 : return bDoesRowContainMovedFwdFrm;
93 : : }
94 : :
95 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|