LibreOffice Module sw (master)  1
movedfwdfrmsbyobjpos.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 <movedfwdfrmsbyobjpos.hxx>
21 #include <txtfrm.hxx>
22 #include <rowfrm.hxx>
23 #include <pagefrm.hxx>
24 #include <calbck.hxx>
25 #include <ndtxt.hxx>
26 
28 {
29 }
30 
32 {
33  Clear();
34 }
35 
36 void SwMovedFwdFramesByObjPos::Insert( const SwTextFrame& _rMovedFwdFrameByObjPos,
37  const sal_uInt32 _nToPageNum )
38 {
39  maMovedFwdFrames.emplace(_rMovedFwdFrameByObjPos.GetTextNodeFirst(), _nToPageNum);
40 }
41 
43 {
44  maMovedFwdFrames.erase(_rTextFrame.GetTextNodeFirst());
45 }
46 
48  sal_uInt32& _ornToPageNum ) const
49 {
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 )
54  {
55  _ornToPageNum = (*aIter).second;
56  return true;
57  }
58 
59  return false;
60 }
61 
62 // #i26945#
64 {
65  bool bDoesRowContainMovedFwdFrame( false );
66 
67  const sal_uInt32 nPageNumOfRow = _rRowFrame.FindPageFrame()->GetPhyPageNum();
68 
69  for ( const auto & rEntry : maMovedFwdFrames )
70  {
71  if ( rEntry.second >= nPageNumOfRow )
72  {
74  for( SwTextFrame* pTextFrame = aFrameIter.First(); pTextFrame; pTextFrame = aFrameIter.Next() )
75  {
76  // #115759# - assure that found text frame
77  // is the first one.
78  if ( _rRowFrame.IsAnLower( pTextFrame ) && !pTextFrame->GetIndPrev() )
79  {
80  bDoesRowContainMovedFwdFrame = true;
81  break;
82  }
83  }
84  }
85  }
86 
87  return bDoesRowContainMovedFwdFrame;
88 }
89 
90 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool IsAnLower(const SwFrame *) const
Definition: findfrm.cxx:206
Represents the visualization of a paragraph.
Definition: txtfrm.hxx:149
void Insert(const SwTextFrame &_rMovedFwdFrameByObjPos, const sal_uInt32 _nToPageNum)
TElementType * Next()
Definition: calbck.hxx:373
sal_uInt16 GetPhyPageNum() const
Definition: pagefrm.hxx:190
SwTextNode * GetTextNodeFirst()
Definition: txtfrm.hxx:445
bool DoesRowContainMovedFwdFrame(const SwRowFrame &_rRowFrame) const
SwPageFrame * FindPageFrame()
Definition: frame.hxx:658
TElementType * First()
Definition: calbck.hxx:342
void Remove(const SwTextFrame &_rTextFrame)
bool FrameMovedFwdByObjPos(const SwTextFrame &_rTextFrame, sal_uInt32 &_ornToPageNum) const
SwRowFrame is one table row in the document layout.
Definition: rowfrm.hxx:28