LibreOffice Module sw (master)  1
txtftn.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 <viewsh.hxx>
21 #include <doc.hxx>
23 #include <pagefrm.hxx>
24 #include <rootfrm.hxx>
25 #include <ndtxt.hxx>
26 #include <txtatr.hxx>
27 #include <SwPortionHandler.hxx>
28 #include <txtftn.hxx>
29 #include <flyfrm.hxx>
30 #include <fmtftn.hxx>
31 #include <ftninfo.hxx>
32 #include <charfmt.hxx>
33 #include <dflyobj.hxx>
34 #include <rowfrm.hxx>
35 #include <editeng/brushitem.hxx>
37 #include <breakit.hxx>
38 #include <com/sun/star/i18n/ScriptType.hpp>
39 #include <tabfrm.hxx>
40 #include <sortedobjs.hxx>
41 
42 #include <swfont.hxx>
43 #include "porftn.hxx"
44 #include "porfly.hxx"
45 #include "porlay.hxx"
46 #include <txtfrm.hxx>
47 #include "itrform2.hxx"
48 #include <ftnfrm.hxx>
49 #include <pagedesc.hxx>
50 #include "redlnitr.hxx"
51 #include <sectfrm.hxx>
52 #include <layouter.hxx>
53 #include <frmtool.hxx>
54 #include <ndindex.hxx>
55 
56 using namespace ::com::sun::star;
57 
59 {
60  if (IsInTab())
61  return false; // tdf#102073 first frame in cell doesn't have mpPrev set
62  const SwFootnoteFrame* pFootnote = FindFootnoteFrame()->GetMaster();
63  while( pFootnote && !pFootnote->ContainsContent() )
64  pFootnote = pFootnote->GetMaster();
65  return !pFootnote;
66 }
67 
72 {
73  SwTextFrame *pFrame = this;
74  const bool bFwd = MapModelToView(&pFootnote->GetTextNode(), pFootnote->GetStart()) >= GetOfst();
75  while( pFrame )
76  {
77  if( SwFootnoteBossFrame::FindFootnote( pFrame, pFootnote ) )
78  return pFrame;
79  pFrame = bFwd ? pFrame->GetFollow() :
80  pFrame->IsFollow() ? pFrame->FindMaster() : nullptr;
81  }
82  return pFrame;
83 }
84 
85 #ifdef DBG_UTIL
86 void SwTextFrame::CalcFootnoteFlag(TextFrameIndex nStop) // For testing the SplitFrame
87 #else
89 #endif
90 {
91  mbFootnote = false;
92 
93 #ifdef DBG_UTIL
94  const TextFrameIndex nEnd = nStop != TextFrameIndex(COMPLETE_STRING)
95  ? nStop
96  : GetFollow() ? GetFollow()->GetOfst() : TextFrameIndex(COMPLETE_STRING);
97 #else
98  const TextFrameIndex nEnd = GetFollow()
99  ? GetFollow()->GetOfst()
101 #endif
102 
103  SwTextNode const* pNode(nullptr);
104  sw::MergedAttrIter iter(*this);
105  for (SwTextAttr const* pHt = iter.NextAttr(&pNode); pHt; pHt = iter.NextAttr(&pNode))
106  {
107  if ( pHt->Which() == RES_TXTATR_FTN )
108  {
109  TextFrameIndex const nIdx(MapModelToView(pNode, pHt->GetStart()));
110  if ( nEnd < nIdx )
111  break;
112  if( GetOfst() <= nIdx )
113  {
114  mbFootnote = true;
115  break;
116  }
117  }
118  }
119 }
120 
122 {
123  OSL_ENSURE( HasFootnote(), "Who´s calling me?" );
125  const SwFootnoteFrame *pFootnote = pBoss->FindFirstFootnote( this );
126  if (pFootnote && FTNPOS_CHAPTER != GetDoc().GetFootnoteInfo().ePos &&
127  ( !pBoss->GetUpper()->IsSctFrame() ||
128  !static_cast<SwSectionFrame*>(pBoss->GetUpper())->IsFootnoteAtEnd() ) )
129  {
130  const SwFootnoteContFrame *pCont = pBoss->FindFootnoteCont();
131  bool bReArrange = true;
132 
133  SwRectFnSet aRectFnSet(this);
134  if ( pCont && aRectFnSet.YDiff( aRectFnSet.GetTop(pCont->getFrameArea()),
135  aRectFnSet.GetBottom(getFrameArea()) ) > 0 )
136  {
137  pBoss->RearrangeFootnotes( aRectFnSet.GetBottom(getFrameArea()), false,
138  pFootnote->GetAttr() );
140  ValidateFrame();
141  pFootnote = pBoss->FindFirstFootnote( this );
142  }
143  else
144  bReArrange = false;
145  if( !pCont || !pFootnote || bReArrange != (pFootnote->FindFootnoteBossFrame() == pBoss) )
146  {
147  SwTextFormatInfo aInf( getRootFrame()->GetCurrShell()->GetOut(), this );
148  SwTextFormatter aLine( this, &aInf );
149  aLine.TruncLines();
150  SetPara( nullptr ); // May be deleted!
151  ResetPreps();
152  return false;
153  }
154  }
155  return true;
156 }
157 
162 static SwTwips lcl_GetFootnoteLower( const SwTextFrame* pFrame, SwTwips nLower )
163 {
164  // nLower is an absolute value. It denotes the bottom of the line
165  // containing the footnote.
166  SwRectFnSet aRectFnSet(pFrame);
167 
168  OSL_ENSURE( !pFrame->IsVertical() || !pFrame->IsSwapped(),
169  "lcl_GetFootnoteLower with swapped frame" );
170 
171  SwTwips nAdd;
172  SwTwips nRet = nLower;
173 
174  // Check if text is inside a table.
175  if ( pFrame->IsInTab() )
176  {
177  // If pFrame is inside a table, we have to check if
178  // a) The table is not allowed to split or
179  // b) The table row is not allowed to split
180 
181  // Inside a table, there are no footnotes,
182  // see SwFrame::FindFootnoteBossFrame. So we don't have to check
183  // the case that pFrame is inside a (footnote collecting) section
184  // within the table.
185  const SwFrame* pRow = pFrame;
186  while( !pRow->IsRowFrame() || !pRow->GetUpper()->IsTabFrame() )
187  pRow = pRow->GetUpper();
188  const SwTabFrame* pTabFrame = static_cast<const SwTabFrame*>(pRow->GetUpper());
189 
190  OSL_ENSURE( pTabFrame && pRow &&
191  pRow->GetUpper()->IsTabFrame(), "Upper of row should be tab" );
192 
193  const bool bDontSplit = !pTabFrame->IsFollow() &&
194  !pTabFrame->IsLayoutSplitAllowed();
195 
196  SwTwips nMin = 0;
197  if ( bDontSplit )
198  nMin = aRectFnSet.GetBottom(pTabFrame->getFrameArea());
199  else if ( !static_cast<const SwRowFrame*>(pRow)->IsRowSplitAllowed() )
200  nMin = aRectFnSet.GetBottom(pRow->getFrameArea());
201 
202  if ( nMin && aRectFnSet.YDiff( nMin, nLower ) > 0 )
203  nRet = nMin;
204 
205  nAdd = aRectFnSet.GetBottomMargin(*pRow->GetUpper());
206  }
207  else
208  nAdd = aRectFnSet.GetBottomMargin(*pFrame);
209 
210  if( nAdd > 0 )
211  {
212  if ( aRectFnSet.IsVert() )
213  nRet -= nAdd;
214  else
215  nRet += nAdd;
216  }
217 
218  // #i10770#: If there are fly frames anchored at previous paragraphs,
219  // the deadline should consider their lower borders.
220  const SwFrame* pStartFrame = pFrame->GetUpper()->GetLower();
221  OSL_ENSURE( pStartFrame, "Upper has no lower" );
222  SwTwips nFlyLower = aRectFnSet.IsVert() ? LONG_MAX : 0;
223  while ( pStartFrame != pFrame )
224  {
225  OSL_ENSURE( pStartFrame, "Frame chain is broken" );
226  if ( pStartFrame->GetDrawObjs() )
227  {
228  const SwSortedObjs &rObjs = *pStartFrame->GetDrawObjs();
229  for (SwAnchoredObject* pAnchoredObj : rObjs)
230  {
231  SwRect aRect( pAnchoredObj->GetObjRect() );
232 
233  if ( dynamic_cast< const SwFlyFrame *>( pAnchoredObj ) == nullptr ||
234  static_cast<SwFlyFrame*>(pAnchoredObj)->isFrameAreaDefinitionValid() )
235  {
236  const SwTwips nBottom = aRectFnSet.GetBottom(aRect);
237  if ( aRectFnSet.YDiff( nBottom, nFlyLower ) > 0 )
238  nFlyLower = nBottom;
239  }
240  }
241  }
242 
243  pStartFrame = pStartFrame->GetNext();
244  }
245 
246  if ( aRectFnSet.IsVert() )
247  nRet = std::min( nRet, nFlyLower );
248  else
249  nRet = std::max( nRet, nFlyLower );
250 
251  return nRet;
252 }
253 
255 {
256  OSL_ENSURE( ! IsVertical() || ! IsSwapped(),
257  "SwTextFrame::GetFootnoteLine with swapped frame" );
258 
259  SwTextFrame *pThis = const_cast<SwTextFrame*>(this);
260 
261  if( !HasPara() )
262  {
263  // #109071# GetFormatted() does not work here, because most probably
264  // the frame is currently locked. We return the previous value.
265  return pThis->mnFootnoteLine > 0 ?
266  pThis->mnFootnoteLine :
268  }
269 
270  SwTwips nRet;
271  {
272  SwSwapIfNotSwapped swap(const_cast<SwTextFrame *>(this));
273 
274  SwTextInfo aInf( pThis );
275  SwTextIter aLine( pThis, &aInf );
277  &pFootnote->GetTextNode(), pFootnote->GetStart()));
278  aLine.CharToLine( nPos );
279 
280  nRet = aLine.Y() + SwTwips(aLine.GetLineHeight());
281  if( IsVertical() )
282  nRet = SwitchHorizontalToVertical( nRet );
283  }
284 
285  nRet = lcl_GetFootnoteLower( pThis, nRet );
286 
287  pThis->mnFootnoteLine = nRet;
288  return nRet;
289 }
290 
296 {
297  OSL_ENSURE( !IsFollow() && IsInFootnote(), "SwTextFrame::SetFootnoteLine: moon walk" );
298 
299  const SwFootnoteFrame *pFootnoteFrame = FindFootnoteFrame();
300  const SwTextFrame *pRef = static_cast<const SwTextFrame *>(pFootnoteFrame->GetRef());
302  if( pBoss != pRef->FindFootnoteBossFrame( !pFootnoteFrame->GetAttr()->
303  GetFootnote().IsEndNote() ) )
304  return 0;
305 
306  SwSwapIfSwapped swap(const_cast<SwTextFrame *>(this));
307 
308  SwTwips nHeight = pRef->IsInFootnoteConnect() ?
309  1 : pRef->GetFootnoteLine( pFootnoteFrame->GetAttr() );
310  if( nHeight )
311  {
312  // As odd as it may seem: the first Footnote on the page may not touch the
313  // Footnote Reference, when entering text in the Footnote Area.
314  const SwFrame *pCont = pFootnoteFrame->GetUpper();
315 
316  // Height within the Container which we're allowed to consume anyways
317  SwRectFnSet aRectFnSet(pCont);
318  SwTwips nTmp = aRectFnSet.YDiff( aRectFnSet.GetPrtBottom(*pCont),
319  aRectFnSet.GetTop(getFrameArea()) );
320 
321 #if OSL_DEBUG_LEVEL > 0
322  if( nTmp < 0 )
323  {
324  bool bInvalidPos = false;
325  const SwLayoutFrame* pTmp = GetUpper();
326  while( !bInvalidPos && pTmp )
327  {
328  bInvalidPos = !pTmp->isFrameAreaPositionValid() ||
329  !pTmp->Lower()->isFrameAreaPositionValid();
330  if( pTmp == pCont )
331  break;
332  pTmp = pTmp->GetUpper();
333  }
334  OSL_ENSURE( bInvalidPos, "Hanging below FootnoteCont" );
335  }
336 #endif
337 
338  if ( aRectFnSet.YDiff( aRectFnSet.GetTop(pCont->getFrameArea()), nHeight) > 0 )
339  {
340  // Growth potential of the container
341  if ( !pRef->IsInFootnoteConnect() )
342  {
343  SwSaveFootnoteHeight aSave( const_cast<SwFootnoteBossFrame*>(pBoss), nHeight );
344  nHeight = const_cast<SwFootnoteContFrame*>(static_cast<const SwFootnoteContFrame*>(pCont))->Grow( LONG_MAX, true );
345  }
346  else
347  nHeight = const_cast<SwFootnoteContFrame*>(static_cast<const SwFootnoteContFrame*>(pCont))->Grow( LONG_MAX, true );
348 
349  nHeight += nTmp;
350  if( nHeight < 0 )
351  nHeight = 0;
352  }
353  else
354  { // The container has to shrink
355  nTmp += aRectFnSet.YDiff( aRectFnSet.GetTop(pCont->getFrameArea()), nHeight);
356  if( nTmp > 0 )
357  nHeight = nTmp;
358  else
359  nHeight = 0;
360  }
361  }
362 
363  return nHeight;
364 }
365 
367 {
368  // Check whether we're in a FootnoteFrame
369  if( GetIndPrev() || !IsInFootnote() )
370  return nullptr;
371 
372  // To the preceding FootnoteFrame
373  SwFootnoteFrame *pFootnoteFrame = FindFootnoteFrame()->GetMaster();
374  if( !pFootnoteFrame )
375  return nullptr;
376 
377  // Now the last Content
378  SwContentFrame *pCnt = pFootnoteFrame->ContainsContent();
379  if( !pCnt )
380  return nullptr;
381  SwContentFrame *pLast;
382  do
383  { pLast = pCnt;
384  pCnt = pCnt->GetNextContentFrame();
385  } while( pCnt && pFootnoteFrame->IsAnLower( pCnt ) );
386  return static_cast<SwTextFrame*>(pLast);
387 }
388 
390 {
391  if ( !IsFootnoteAllowed() )
392  return;
393 
394  bool bRollBack = nLen != TextFrameIndex(COMPLETE_STRING);
395  TextFrameIndex nEnd;
396  SwTextFrame* pSource;
397  if( bRollBack )
398  {
399  nEnd = nStart + nLen;
400  pSource = GetFollow();
401  if( !pSource )
402  return;
403  }
404  else
405  {
407  pSource = this;
408  }
409 
410  SwPageFrame* pUpdate = nullptr;
411  bool bRemove = false;
412  SwFootnoteBossFrame *pFootnoteBoss = nullptr;
413  SwFootnoteBossFrame *pEndBoss = nullptr;
414  bool bFootnoteEndDoc = FTNPOS_CHAPTER == GetDoc().GetFootnoteInfo().ePos;
415  SwTextNode const* pNode(nullptr);
416  sw::MergedAttrIterReverse iter(*this);
417  for (SwTextAttr const* pHt = iter.PrevAttr(&pNode); pHt; pHt = iter.PrevAttr(&pNode))
418  {
419  if (RES_TXTATR_FTN != pHt->Which())
420  continue;
421 
422  TextFrameIndex const nIdx(MapModelToView(pNode, pHt->GetStart()));
423  if (nStart > nIdx)
424  break;
425 
426  if (nEnd >= nIdx)
427  {
428  SwTextFootnote const*const pFootnote(static_cast<SwTextFootnote const*>(pHt));
429  const bool bEndn = pFootnote->GetFootnote().IsEndNote();
430 
431  if (bEndn)
432  {
433  if (!pEndBoss)
434  pEndBoss = pSource->FindFootnoteBossFrame();
435  }
436  else
437  {
438  if (!pFootnoteBoss)
439  {
440  pFootnoteBoss = pSource->FindFootnoteBossFrame( true );
441  if( pFootnoteBoss->GetUpper()->IsSctFrame() )
442  {
443  SwSectionFrame* pSect = static_cast<SwSectionFrame*>(
444  pFootnoteBoss->GetUpper());
445  if (pSect->IsFootnoteAtEnd())
446  bFootnoteEndDoc = false;
447  }
448  }
449  }
450 
451  // We don't delete, but move instead.
452  // Three cases are to be considered:
453  // 1) There's neither Follow nor PrevFollow:
454  // -> RemoveFootnote() (maybe even a OSL_ENSURE(value))
455  //
456  // 2) nStart > GetOfst, I have a Follow
457  // -> Footnote moves into Follow
458  //
459  // 3) nStart < GetOfst, I am a Follow
460  // -> Footnote moves into the PrevFollow
461  //
462  // Both need to be on one Page/in one Column
463  SwFootnoteFrame *pFootnoteFrame = SwFootnoteBossFrame::FindFootnote(pSource, pFootnote);
464 
465  if (pFootnoteFrame)
466  {
467  const bool bEndDoc = bEndn || bFootnoteEndDoc;
468  if( bRollBack )
469  {
470  while (pFootnoteFrame)
471  {
472  pFootnoteFrame->SetRef( this );
473  pFootnoteFrame = pFootnoteFrame->GetFollow();
474  SetFootnote( true );
475  }
476  }
477  else if (GetFollow())
478  {
479  SwContentFrame *pDest = GetFollow();
480  while (pDest->GetFollow() && static_cast<SwTextFrame*>(pDest->
481  GetFollow())->GetOfst() <= nIdx)
482  pDest = pDest->GetFollow();
484  pDest,pFootnote),"SwTextFrame::RemoveFootnote: footnote exists");
485 
486  // Never deregister; always move
487  if (bEndDoc ||
488  !pFootnoteFrame->FindFootnoteBossFrame()->IsBefore(pDest->FindFootnoteBossFrame(!bEndn))
489  )
490  {
491  SwPageFrame* pTmp = pFootnoteFrame->FindPageFrame();
492  if( pUpdate && pUpdate != pTmp )
493  pUpdate->UpdateFootnoteNum();
494  pUpdate = pTmp;
495  while ( pFootnoteFrame )
496  {
497  pFootnoteFrame->SetRef( pDest );
498  pFootnoteFrame = pFootnoteFrame->GetFollow();
499  }
500  }
501  else
502  {
503  pFootnoteBoss->MoveFootnotes( this, pDest, pFootnote );
504  bRemove = true;
505  }
506  static_cast<SwTextFrame*>(pDest)->SetFootnote( true );
507 
508  OSL_ENSURE( SwFootnoteBossFrame::FindFootnote( pDest,
509  pFootnote),"SwTextFrame::RemoveFootnote: footnote ChgRef failed");
510  }
511  else
512  {
513  if (!bEndDoc || ( bEndn && pEndBoss->IsInSct() &&
515  pEndBoss->FindSctFrame(), nullptr ) ))
516  {
517  if( bEndn )
518  pEndBoss->RemoveFootnote( this, pFootnote );
519  else
520  pFootnoteBoss->RemoveFootnote( this, pFootnote );
521  bRemove = bRemove || !bEndDoc;
522  OSL_ENSURE( !SwFootnoteBossFrame::FindFootnote( this, pFootnote ),
523  "SwTextFrame::RemoveFootnote: can't get off that footnote" );
524  }
525  }
526  }
527  }
528  }
529  if (pUpdate)
530  pUpdate->UpdateFootnoteNum();
531 
532  // We break the oscillation
533  if (bRemove && !bFootnoteEndDoc && HasPara())
534  {
536  ValidateFrame();
537  }
538 
539  // We call the RemoveFootnote from within the FindBreak, because the last line is
540  // to be passed to the Follow. The Offset of the Follow is, however, outdated;
541  // it'll be set soon. CalcFntFlag depends on a correctly set Follow Offset.
542  // Therefore we temporarily calculate the Follow Offset here
544  if( HasFollow() && nStart > GetOfst() )
545  {
546  nOldOfst = GetFollow()->GetOfst();
547  GetFollow()->ManipOfst(nStart + (bRollBack ? nLen : TextFrameIndex(0)));
548  }
549  pSource->CalcFootnoteFlag();
550  if (nOldOfst < TextFrameIndex(COMPLETE_STRING))
551  GetFollow()->ManipOfst( nOldOfst );
552 }
553 
554 
574 void SwTextFrame::ConnectFootnote( SwTextFootnote *pFootnote, const SwTwips nDeadLine )
575 {
576  OSL_ENSURE( !IsVertical() || !IsSwapped(),
577  "SwTextFrame::ConnectFootnote with swapped frame" );
578 
579  mbFootnote = true;
580  mbInFootnoteConnect = true; // Just reset!
581  const bool bEnd = pFootnote->GetFootnote().IsEndNote();
582 
583  // We want to store this value, because it is needed as a fallback
584  // in GetFootnoteLine(), if there is no paragraph information available
585  mnFootnoteLine = nDeadLine;
586 
587  // We always need a parent (Page/Column)
588  SwSectionFrame *pSect;
589  SwContentFrame *pContent = this;
590  if( bEnd && IsInSct() )
591  {
592  pSect = FindSctFrame();
593  if( pSect->IsEndnAtEnd() )
594  pContent = pSect->FindLastContent( SwFindMode::EndNote );
595  if( !pContent )
596  pContent = this;
597  }
598 
599  SwFootnoteBossFrame *pBoss = pContent->FindFootnoteBossFrame( !bEnd );
600 
601  pSect = pBoss->FindSctFrame();
602  bool bDocEnd = bEnd ? !( pSect && pSect->IsEndnAtEnd() ) :
603  ( !( pSect && pSect->IsFootnoteAtEnd() ) &&
605 
606  // Footnote can be registered with the Follow
607  SwContentFrame *pSrcFrame = FindFootnoteRef( pFootnote );
608 
609  if( bDocEnd )
610  {
611  if( pSect && pSrcFrame )
612  {
613  SwFootnoteFrame *pFootnoteFrame = SwFootnoteBossFrame::FindFootnote( pSrcFrame, pFootnote );
614  if( pFootnoteFrame && pFootnoteFrame->IsInSct() )
615  {
616  pBoss->RemoveFootnote( pSrcFrame, pFootnote );
617  pSrcFrame = nullptr;
618  }
619  }
620  }
621  else if( bEnd && pSect )
622  {
623  SwFootnoteFrame *pFootnoteFrame = pSrcFrame ? SwFootnoteBossFrame::FindFootnote( pSrcFrame, pFootnote ) : nullptr;
624  if( pFootnoteFrame && !pFootnoteFrame->GetUpper() )
625  pFootnoteFrame = nullptr;
626  SwDoc *const pDoc = &GetDoc();
627  if( SwLayouter::Collecting( pDoc, pSect, pFootnoteFrame ) )
628  {
629  if( !pSrcFrame )
630  {
631  SwFootnoteFrame *pNew = new SwFootnoteFrame(pDoc->GetDfltFrameFormat(),this,this,pFootnote);
632  SwNodeIndex aIdx( *pFootnote->GetStartNode(), 1 );
633  ::InsertCnt_( pNew, pDoc, aIdx.GetIndex() );
635  }
636  else if( pSrcFrame != this )
637  SwFootnoteBossFrame::ChangeFootnoteRef( pSrcFrame, pFootnote, this );
638  mbInFootnoteConnect = false;
639  return;
640  }
641  else if( pSrcFrame )
642  {
643  SwFootnoteBossFrame *pFootnoteBoss = pFootnoteFrame->FindFootnoteBossFrame();
644  if( !pFootnoteBoss->IsInSct() ||
645  pFootnoteBoss->ImplFindSctFrame()->GetSection()!=pSect->GetSection() )
646  {
647  pBoss->RemoveFootnote( pSrcFrame, pFootnote );
648  pSrcFrame = nullptr;
649  }
650  }
651  }
652 
653  if( bDocEnd || bEnd )
654  {
655  if( !pSrcFrame )
656  pBoss->AppendFootnote( this, pFootnote );
657  else if( pSrcFrame != this )
658  SwFootnoteBossFrame::ChangeFootnoteRef( pSrcFrame, pFootnote, this );
659  mbInFootnoteConnect = false;
660  return;
661  }
662 
663  SwSaveFootnoteHeight aHeight( pBoss, nDeadLine );
664 
665  if( !pSrcFrame ) // No Footnote was found at all
666  pBoss->AppendFootnote( this, pFootnote );
667  else
668  {
669  SwFootnoteFrame *pFootnoteFrame = SwFootnoteBossFrame::FindFootnote( pSrcFrame, pFootnote );
670  SwFootnoteBossFrame *pFootnoteBoss = pFootnoteFrame->FindFootnoteBossFrame();
671 
672  bool bBrutal = false;
673 
674  if( pFootnoteBoss == pBoss ) // Ref and Footnote are on the same Page/Column
675  {
676  SwFrame *pCont = pFootnoteFrame->GetUpper();
677 
678  SwRectFnSet aRectFnSet(pCont);
679  long nDiff = aRectFnSet.YDiff( aRectFnSet.GetTop(pCont->getFrameArea()),
680  nDeadLine );
681 
682  if( nDiff >= 0 )
683  {
684  // If the Footnote has been registered to a Follow, we need to
685  // rewire it now too
686  if ( pSrcFrame != this )
687  SwFootnoteBossFrame::ChangeFootnoteRef( pSrcFrame, pFootnote, this );
688 
689  // We have some room left, so the Footnote can grow
690  if ( pFootnoteFrame->GetFollow() && nDiff > 0 )
691  {
692  SwFrameDeleteGuard aDeleteGuard(pCont);
693  SwTwips nHeight = aRectFnSet.GetHeight(pCont->getFrameArea());
694  pBoss->RearrangeFootnotes( nDeadLine, false, pFootnote );
696  ValidateFrame();
698  if ( pSh && nHeight == aRectFnSet.GetHeight(pCont->getFrameArea()) )
699  // So that we don't miss anything
700  pSh->InvalidateWindows( pCont->getFrameArea() );
701  }
702  mbInFootnoteConnect = false;
703  return;
704  }
705  else
706  bBrutal = true;
707  }
708  else
709  {
710  // Ref and Footnote are not on one Page; attempt to move is necessary
711  SwFrame* pTmp = this;
712  while( pTmp->GetNext() && pSrcFrame != pTmp )
713  pTmp = pTmp->GetNext();
714  if( pSrcFrame == pTmp )
715  bBrutal = true;
716  else
717  { // If our Parent is in a column Area, but the Page already has a
718  // FootnoteContainer, we can only brute force it
719  if( pSect && pSect->FindFootnoteBossFrame( !bEnd )->FindFootnoteCont() )
720  bBrutal = true;
721 
722  else if ( !pFootnoteFrame->GetPrev() ||
723  pFootnoteBoss->IsBefore( pBoss )
724  )
725  {
726  SwFootnoteBossFrame *pSrcBoss = pSrcFrame->FindFootnoteBossFrame( !bEnd );
727  pSrcBoss->MoveFootnotes( pSrcFrame, this, pFootnote );
728  }
729  else
730  SwFootnoteBossFrame::ChangeFootnoteRef( pSrcFrame, pFootnote, this );
731  }
732  }
733 
734  // The brute force method: Remove Footnote and append.
735  // We need to call SetFootnoteDeadLine(), as we can more easily adapt the
736  // nMaxFootnoteHeight after RemoveFootnote
737  if( bBrutal )
738  {
739  pBoss->RemoveFootnote( pSrcFrame, pFootnote, false );
740  std::unique_ptr<SwSaveFootnoteHeight> pHeight(bEnd ? nullptr : new SwSaveFootnoteHeight( pBoss, nDeadLine ));
741  pBoss->AppendFootnote( this, pFootnote );
742  }
743  }
744 
745  // In column Areas, that not yet reach the Page's border a RearrangeFootnotes is not
746  // useful yet, as the Footnote container has not yet been calculated
747  if( !pSect || !pSect->Growable() )
748  {
749  // Validate environment, to avoid oscillation
750  SwSaveFootnoteHeight aNochmal( pBoss, nDeadLine );
752  pBoss->RearrangeFootnotes( nDeadLine, true );
753  ValidateFrame();
754  }
755  else if( pSect->IsFootnoteAtEnd() )
756  {
758  ValidateFrame();
759  }
760 
761  mbInFootnoteConnect = false;
762 }
763 
768  SwTextAttr *pHint )
769 {
770  OSL_ENSURE( ! m_pFrame->IsVertical() || m_pFrame->IsSwapped(),
771  "NewFootnotePortion with unswapped frame" );
772 
773  if( !m_pFrame->IsFootnoteAllowed() )
774  return nullptr;
775 
776  SwTextFootnote *pFootnote = static_cast<SwTextFootnote*>(pHint);
777  const SwFormatFootnote& rFootnote = pFootnote->GetFootnote();
778  SwDoc *const pDoc = &m_pFrame->GetDoc();
779 
780  if( rInf.IsTest() )
781  return new SwFootnotePortion(rFootnote.GetViewNumStr(*pDoc, m_pFrame->getRootFrame()), pFootnote);
782 
784 
785  sal_uInt16 nReal;
786  {
787  sal_uInt16 nOldReal = m_pCurr->GetRealHeight();
788  sal_uInt16 nOldAscent = m_pCurr->GetAscent();
789  sal_uInt16 nOldHeight = m_pCurr->Height();
790  CalcRealHeight();
791  nReal = m_pCurr->GetRealHeight();
792  if( nReal < nOldReal )
793  nReal = nOldReal;
794  m_pCurr->SetRealHeight( nOldReal );
795  m_pCurr->Height( nOldHeight );
796  m_pCurr->SetAscent( nOldAscent );
797  }
798 
799  SwTwips nLower = Y() + nReal;
800 
801  const bool bVertical = m_pFrame->IsVertical();
802  if( bVertical )
803  nLower = m_pFrame->SwitchHorizontalToVertical( nLower );
804 
805  nLower = lcl_GetFootnoteLower( m_pFrame, nLower );
806 
807  // We just refresh.
808  // The Connect does not do anything useful in this case, but will
809  // mostly throw away the Footnote and create it anew.
810  if( !rInf.IsQuick() )
811  m_pFrame->ConnectFootnote( pFootnote, nLower );
812 
813  SwTextFrame *pScrFrame = m_pFrame->FindFootnoteRef( pFootnote );
815  SwFootnoteFrame *pFootnoteFrame = nullptr;
816  if( pScrFrame )
817  pFootnoteFrame = SwFootnoteBossFrame::FindFootnote( pScrFrame, pFootnote );
818 
819  // We see whether our Append has caused some Footnote to
820  // still be on the Page/Column. If not, our line disappears too,
821  // which will lead to the following undesired behaviour:
822  // Footnote1 still fits onto the Page/Column, but Footnote2 doesn't.
823  // The Footnote2 Reference remains on the Page/Column. The Footnote itself
824  // is on the next Page/Column.
825  //
826  // Exception: If the Page/Column cannot accommodate another line,
827  // the Footnote Reference should be moved to the next one.
828  if( !rFootnote.IsEndNote() )
829  {
830  SwSectionFrame *pSct = pBoss->FindSctFrame();
831  bool bAtSctEnd = pSct && pSct->IsFootnoteAtEnd();
832  if( FTNPOS_CHAPTER != pDoc->GetFootnoteInfo().ePos || bAtSctEnd )
833  {
834  SwFrame* pFootnoteCont = pBoss->FindFootnoteCont();
835  // If the Parent is within an Area, it can only be a Column of this
836  // Area. If this one is not the first Column, we can avoid it.
837  if( !m_pFrame->IsInTab() && ( GetLineNr() > 1 || m_pFrame->GetPrev() ||
838  ( !bAtSctEnd && m_pFrame->GetIndPrev() ) ||
839  ( pSct && pBoss->GetPrev() ) ) )
840  {
841  if( !pFootnoteCont )
842  {
843  rInf.SetStop( true );
844  return nullptr;
845  }
846  else
847  {
848  // There must not be any Footnote Containers in column Areas and at the same time on the
849  // Page/Page column
850  if( pSct && !bAtSctEnd ) // Is the Container in a (column) Area?
851  {
852  SwFootnoteBossFrame* pTmp = pBoss->FindSctFrame()->FindFootnoteBossFrame( true );
853  SwFootnoteContFrame* pFootnoteC = pTmp->FindFootnoteCont();
854  if( pFootnoteC )
855  {
856  SwFootnoteFrame* pTmpFrame = static_cast<SwFootnoteFrame*>(pFootnoteC->Lower());
857  if( pTmpFrame && *pTmpFrame < pFootnote )
858  {
859  rInf.SetStop( true );
860  return nullptr;
861  }
862  }
863  }
864  // Is this the last Line that fits?
865  SwTwips nTmpBot = Y() + nReal * 2;
866 
867  if( bVertical )
868  nTmpBot = m_pFrame->SwitchHorizontalToVertical( nTmpBot );
869 
870  SwRectFnSet aRectFnSet(pFootnoteCont);
871 
872  const long nDiff = aRectFnSet.YDiff(
873  aRectFnSet.GetTop(pFootnoteCont->getFrameArea()),
874  nTmpBot );
875 
876  if( pScrFrame && nDiff < 0 )
877  {
878  if( pFootnoteFrame )
879  {
880  SwFootnoteBossFrame *pFootnoteBoss = pFootnoteFrame->FindFootnoteBossFrame();
881  if( pFootnoteBoss != pBoss )
882  {
883  // We're in the last Line and the Footnote has moved
884  // to another Page. We also want to be on that Page!
885  rInf.SetStop( true );
886  return nullptr;
887  }
888  }
889  }
890  }
891  }
892  }
893  }
894  // Finally: Create FootnotePortion and exit ...
896  rFootnote.GetViewNumStr(*pDoc, m_pFrame->getRootFrame()),
897  pFootnote, nReal );
898  rInf.SetFootnoteInside( true );
899 
900  return pRet;
901  }
902 
907 {
908  OSL_ENSURE( m_pFrame->IsInFootnote() && !m_pFrame->GetIndPrev() && !rInf.IsFootnoteDone(),
909  "This is the wrong place for a ftnnumber" );
910  if( rInf.GetTextStart() != m_nStart ||
911  rInf.GetTextStart() != rInf.GetIdx() )
912  return nullptr;
913 
914  const SwFootnoteFrame* pFootnoteFrame = m_pFrame->FindFootnoteFrame();
915  const SwTextFootnote* pFootnote = pFootnoteFrame->GetAttr();
916 
917  // Aha! So we're in the Footnote Area!
918  SwFormatFootnote& rFootnote = const_cast<SwFormatFootnote&>(pFootnote->GetFootnote());
919 
920  SwDoc *const pDoc = &m_pFrame->GetDoc();
921  OUString aFootnoteText(rFootnote.GetViewNumStr(*pDoc, m_pFrame->getRootFrame(), true));
922 
923  const SwEndNoteInfo* pInfo;
924  if( rFootnote.IsEndNote() )
925  pInfo = &pDoc->GetEndNoteInfo();
926  else
927  pInfo = &pDoc->GetFootnoteInfo();
928  const SwAttrSet& rSet = pInfo->GetCharFormat(*pDoc)->GetAttrSet();
929 
930  const SwAttrSet* pParSet = &rInf.GetCharAttr();
931  const IDocumentSettingAccess* pIDSA = &pDoc->getIDocumentSettingAccess();
932  std::unique_ptr<SwFont> pNumFnt(new SwFont( pParSet, pIDSA ));
933 
934  // #i37142#
935  // Underline style of paragraph font should not be considered
936  // Overline style of paragraph font should not be considered
937  // Weight style of paragraph font should not be considered
938  // Posture style of paragraph font should not be considered
939  // See also #i18463# and SwTextFormatter::NewNumberPortion()
940  pNumFnt->SetUnderline( LINESTYLE_NONE );
941  pNumFnt->SetOverline( LINESTYLE_NONE );
942  pNumFnt->SetItalic( ITALIC_NONE, SwFontScript::Latin );
943  pNumFnt->SetItalic( ITALIC_NONE, SwFontScript::CJK );
944  pNumFnt->SetItalic( ITALIC_NONE, SwFontScript::CTL );
945  pNumFnt->SetWeight( WEIGHT_NORMAL, SwFontScript::Latin );
946  pNumFnt->SetWeight( WEIGHT_NORMAL, SwFontScript::CJK );
947  pNumFnt->SetWeight( WEIGHT_NORMAL, SwFontScript::CTL );
948 
949  pNumFnt->SetDiffFnt(&rSet, pIDSA );
950  pNumFnt->SetVertical( pNumFnt->GetOrientation(), m_pFrame->IsVertical() );
951 
952  SwFootnoteNumPortion* pNewPor = new SwFootnoteNumPortion( aFootnoteText, std::move(pNumFnt) );
953  pNewPor->SetLeft( !m_pFrame->IsRightToLeft() );
954  return pNewPor;
955 }
956 
957 static OUString lcl_GetPageNumber( const SwPageFrame* pPage )
958 {
959  OSL_ENSURE( pPage, "GetPageNumber: Homeless TextFrame" );
960  const sal_uInt16 nVirtNum = pPage->GetVirtPageNum();
961  const SvxNumberType& rNum = pPage->GetPageDesc()->GetNumType();
962  return rNum.GetNumStr( nVirtNum );
963 }
964 
966 {
967  // We cannot assume we're a Follow
968  if( !m_pFrame->IsInFootnote() || m_pFrame->GetPrev() ||
969  rInf.IsErgoDone() || rInf.GetIdx() != m_pFrame->GetOfst() ||
971  return nullptr;
972 
973  // we are in the footnote container
974  const SwFootnoteInfo &rFootnoteInfo = m_pFrame->GetDoc().GetFootnoteInfo();
975  SwTextFrame *pQuoFrame = m_pFrame->FindQuoVadisFrame();
976  if( !pQuoFrame )
977  return nullptr;
978  const SwPageFrame* pPage = m_pFrame->FindPageFrame();
979  const SwPageFrame* pQuoPage = pQuoFrame->FindPageFrame();
980  if( pPage == pQuoFrame->FindPageFrame() )
981  return nullptr; // If the QuoVadis is on the same Column/Page
982  const OUString aPage = lcl_GetPageNumber( pPage );
983  SwParaPortion *pPara = pQuoFrame->GetPara();
984  if( pPara )
985  pPara->SetErgoSumNum( aPage );
986  if( rFootnoteInfo.aErgoSum.isEmpty() )
987  return nullptr;
988  SwErgoSumPortion *pErgo = new SwErgoSumPortion( rFootnoteInfo.aErgoSum,
989  lcl_GetPageNumber( pQuoPage ) );
990  return pErgo;
991 }
992 
994 {
995  OSL_ENSURE( ! m_pFrame->IsVertical() || ! m_pFrame->IsSwapped(),
996  "SwTextFormatter::FormatQuoVadis with swapped frame" );
997 
999  return nOffset;
1000 
1001  const SwFrame* pErgoFrame = m_pFrame->FindFootnoteFrame()->GetFollow();
1002  if( !pErgoFrame && m_pFrame->HasFollow() )
1003  pErgoFrame = m_pFrame->GetFollow();
1004  if( !pErgoFrame )
1005  return nOffset;
1006 
1007  if( pErgoFrame == m_pFrame->GetNext() )
1008  {
1009  SwFrame *pCol = m_pFrame->FindColFrame();
1010  while( pCol && !pCol->GetNext() )
1011  pCol = pCol->GetUpper()->FindColFrame();
1012  if( pCol )
1013  return nOffset;
1014  }
1015  else
1016  {
1017  const SwPageFrame* pPage = m_pFrame->FindPageFrame();
1018  const SwPageFrame* pErgoPage = pErgoFrame->FindPageFrame();
1019  if( pPage == pErgoPage )
1020  return nOffset; // If the ErgoSum is on the same Page
1021  }
1022 
1023  SwTextFormatInfo &rInf = GetInfo();
1024  const SwFootnoteInfo &rFootnoteInfo = m_pFrame->GetDoc().GetFootnoteInfo();
1025  if( rFootnoteInfo.aQuoVadis.isEmpty() )
1026  return nOffset;
1027 
1028  // A remark on QuoVadis/ErgoSum:
1029  // We use the Font set for the Paragraph for these texts.
1030  // Thus, we initialize:
1031  // TODO: ResetFont();
1032  FeedInf( rInf );
1033  SeekStartAndChg( rInf, true );
1034  if( GetRedln() && m_pCurr->HasRedline() )
1035  {
1036  std::pair<SwTextNode const*, sal_Int32> const pos(
1037  GetTextFrame()->MapViewToModel(nOffset));
1038  GetRedln()->Seek(*m_pFont, pos.first->GetIndex(), pos.second, 0);
1039  }
1040 
1041  // A tricky special case: Flyfrms extend into the Line and are at the
1042  // position we want to insert the Quovadis text
1043  // Let's see if it is that bad indeed:
1045  sal_uInt16 nLastLeft = 0;
1046  while( pPor )
1047  {
1048  if ( pPor->IsFlyPortion() )
1049  nLastLeft = static_cast<SwFlyPortion*>(pPor)->GetFix() +
1050  static_cast<SwFlyPortion*>(pPor)->Width();
1051  pPor = pPor->GetNextPortion();
1052  }
1053 
1054  // The old game all over again: we want the Line to wrap around
1055  // at a certain point, so we adjust the width.
1056  // nLastLeft is now basically the right margin
1057  const sal_uInt16 nOldRealWidth = rInf.RealWidth();
1058  rInf.RealWidth( nOldRealWidth - nLastLeft );
1059 
1060  OUString aErgo = lcl_GetPageNumber( pErgoFrame->FindPageFrame() );
1061  SwQuoVadisPortion *pQuo = new SwQuoVadisPortion(rFootnoteInfo.aQuoVadis, aErgo );
1062  pQuo->SetAscent( rInf.GetAscent() );
1063  pQuo->Height( rInf.GetTextHeight() );
1064  pQuo->Format( rInf );
1065  sal_uInt16 nQuoWidth = pQuo->Width();
1066  SwLinePortion* pCurrPor = pQuo;
1067 
1068  while ( rInf.GetRest() )
1069  {
1070  SwLinePortion* pFollow = rInf.GetRest();
1071  rInf.SetRest( nullptr );
1072  pCurrPor->Move( rInf );
1073 
1074  OSL_ENSURE( pFollow->IsQuoVadisPortion(),
1075  "Quo Vadis, rest of QuoVadisPortion" );
1076 
1077  // format the rest and append it to the other QuoVadis parts
1078  pFollow->Format( rInf );
1079  nQuoWidth = nQuoWidth + pFollow->Width();
1080 
1081  pCurrPor->Append( pFollow );
1082  pCurrPor = pFollow;
1083  }
1084 
1085  Right( Right() - nQuoWidth );
1086 
1087  TextFrameIndex nRet;
1088  {
1090 
1091  nRet = FormatLine( m_nStart );
1092  }
1093 
1094  Right( rInf.Left() + nOldRealWidth - 1 );
1095 
1096  nLastLeft = nOldRealWidth - m_pCurr->Width();
1097  FeedInf( rInf );
1098 
1099  // It's possible that there's a Margin Portion at the end, which would
1100  // just cause a lot of trouble, when respanning
1101  pPor = m_pCurr->FindLastPortion();
1102  SwGluePortion *pGlue = pPor->IsMarginPortion() ? static_cast<SwMarginPortion*>(pPor) : nullptr;
1103  if( pGlue )
1104  {
1105  pGlue->Height( 0 );
1106  pGlue->Width( 0 );
1107  pGlue->SetLen(TextFrameIndex(0));
1108  pGlue->SetAscent( 0 );
1109  pGlue->SetNextPortion( nullptr );
1110  pGlue->SetFixWidth(0);
1111  }
1112 
1113  // Luxury: We make sure the QuoVadis text appears on the right, by
1114  // using Glues.
1115  nLastLeft = nLastLeft - nQuoWidth;
1116  if( nLastLeft )
1117  {
1118  if( nLastLeft > pQuo->GetAscent() ) // Minimum distance
1119  {
1120  switch( GetAdjust() )
1121  {
1122  case SvxAdjust::Block:
1123  {
1124  if( !m_pCurr->GetLen() ||
1126  nLastLeft = pQuo->GetAscent();
1127  nQuoWidth = nQuoWidth + nLastLeft;
1128  break;
1129  }
1130  case SvxAdjust::Right:
1131  {
1132  nLastLeft = pQuo->GetAscent();
1133  nQuoWidth = nQuoWidth + nLastLeft;
1134  break;
1135  }
1136  case SvxAdjust::Center:
1137  {
1138  nQuoWidth = nQuoWidth + pQuo->GetAscent();
1139  long nDiff = nLastLeft - nQuoWidth;
1140  if( nDiff < 0 )
1141  {
1142  nLastLeft = pQuo->GetAscent();
1143  nQuoWidth = static_cast<sal_uInt16>(-nDiff + nLastLeft);
1144  }
1145  else
1146  {
1147  nQuoWidth = 0;
1148  nLastLeft = sal_uInt16(( pQuo->GetAscent() + nDiff ) / 2);
1149  }
1150  break;
1151  }
1152  default:
1153  nQuoWidth = nQuoWidth + nLastLeft;
1154  }
1155  }
1156  else
1157  nQuoWidth = nQuoWidth + nLastLeft;
1158  if( nLastLeft )
1159  {
1160  pGlue = new SwGluePortion(0);
1161  pGlue->Width( nLastLeft );
1162  pPor->Append( pGlue );
1163  pPor = pPor->GetNextPortion();
1164  }
1165  }
1166 
1167  // Finally: we insert the QuoVadis Portion
1168  pCurrPor = pQuo;
1169  while ( pCurrPor )
1170  {
1171  // pPor->Append deletes the pPortion pointer of pPor.
1172  // Therefore we have to keep a pointer to the next portion
1173  pQuo = static_cast<SwQuoVadisPortion*>(pCurrPor->GetNextPortion());
1174  pPor->Append( pCurrPor );
1175  pPor = pPor->GetNextPortion();
1176  pCurrPor = pQuo;
1177  }
1178 
1179  m_pCurr->Width( m_pCurr->Width() + nQuoWidth );
1180 
1181  // And adjust again, due to the adjustment and due to the following special
1182  // case:
1183  // The DummyUser has set a smaller Font in the Line than the one used
1184  // by the QuoVadis text ...
1186 
1187  return nRet;
1188 }
1189 
1198 {
1199  sal_uInt16 nRstHeight = GetFrameRstHeight();
1200  if( m_pCurr && nRstHeight > m_pCurr->Height() )
1201  {
1202  SwLineLayout *pLay = new SwLineLayout;
1203  nRstHeight = nRstHeight - m_pCurr->Height();
1204  pLay->Height( nRstHeight );
1205  pLay->SetAscent( nRstHeight );
1206  Insert( pLay );
1207  Next();
1208  }
1209 }
1210 
1212 {
1215  std::unique_ptr<SwFont> pOld;
1216 
1217  SwFootnoteSave(const SwFootnoteSave&) = delete;
1218  SwFootnoteSave& operator=(const SwFootnoteSave&) = delete;
1219 
1220 public:
1221  SwFootnoteSave( const SwTextSizeInfo &rInf,
1222  const SwTextFootnote *pTextFootnote,
1223  const bool bApplyGivenScriptType,
1224  const SwFontScript nGivenScriptType );
1225  ~SwFootnoteSave() COVERITY_NOEXCEPT_FALSE;
1226 };
1227 
1229  const SwTextFootnote* pTextFootnote,
1230  const bool bApplyGivenScriptType,
1231  const SwFontScript nGivenScriptType )
1232  : pInf( &const_cast<SwTextSizeInfo&>(rInf) )
1233  , pFnt( nullptr )
1234 {
1235  if( pTextFootnote && rInf.GetTextFrame() )
1236  {
1237  pFnt = const_cast<SwTextSizeInfo&>(rInf).GetFont();
1238  pOld.reset( new SwFont( *pFnt ) );
1239  pOld->GetTox() = pFnt->GetTox();
1240  pFnt->GetTox() = 0;
1241  SwFormatFootnote& rFootnote = const_cast<SwFormatFootnote&>(pTextFootnote->GetFootnote());
1242  const SwDoc *const pDoc = &rInf.GetTextFrame()->GetDoc();
1243 
1244  // #i98418#
1245  if ( bApplyGivenScriptType )
1246  {
1247  pFnt->SetActual( nGivenScriptType );
1248  }
1249  else
1250  {
1251  // examine text and set script
1252  OUString aTmpStr(rFootnote.GetViewNumStr(*pDoc, rInf.GetTextFrame()->getRootFrame()));
1253  pFnt->SetActual( SwScriptInfo::WhichFont(0, aTmpStr) );
1254  }
1255 
1256  const SwEndNoteInfo* pInfo;
1257  if( rFootnote.IsEndNote() )
1258  pInfo = &pDoc->GetEndNoteInfo();
1259  else
1260  pInfo = &pDoc->GetFootnoteInfo();
1261  const SwAttrSet& rSet = pInfo->GetAnchorCharFormat(const_cast<SwDoc&>(*pDoc))->GetAttrSet();
1262  pFnt->SetDiffFnt( &rSet, &pDoc->getIDocumentSettingAccess() );
1263 
1264  // we reduce footnote size, if we are inside a double line portion
1265  if ( ! pOld->GetEscapement() && 50 == pOld->GetPropr() )
1266  {
1267  Size aSize = pFnt->GetSize( pFnt->GetActual() );
1268  pFnt->SetSize( Size( aSize.Width() / 2,
1269  aSize.Height() / 2 ),
1270  pFnt->GetActual() );
1271  }
1272 
1273  // set the correct rotation at the footnote font
1274  const SfxPoolItem* pItem;
1275  if( SfxItemState::SET == rSet.GetItemState( RES_CHRATR_ROTATE,
1276  true, &pItem ))
1277  pFnt->SetVertical( static_cast<const SvxCharRotateItem*>(pItem)->GetValue(),
1278  rInf.GetTextFrame()->IsVertical() );
1279 
1280  pFnt->ChgPhysFnt( pInf->GetVsh(), *pInf->GetOut() );
1281 
1282  if( SfxItemState::SET == rSet.GetItemState( RES_CHRATR_BACKGROUND,
1283  true, &pItem ))
1284  pFnt->SetBackColor( new Color( static_cast<const SvxBrushItem*>(pItem)->GetColor() ) );
1285  }
1286  else
1287  pFnt = nullptr;
1288 }
1289 
1290 SwFootnoteSave::~SwFootnoteSave() COVERITY_NOEXCEPT_FALSE
1291 {
1292  if( pFnt )
1293  {
1294  // Put back SwFont
1295  *pFnt = *pOld;
1296  pFnt->GetTox() = pOld->GetTox();
1297  pFnt->ChgPhysFnt( pInf->GetVsh(), *pInf->GetOut() );
1298  pOld.reset();
1299  }
1300 }
1301 
1302 SwFootnotePortion::SwFootnotePortion( const OUString &rExpand,
1303  SwTextFootnote *pFootn, sal_uInt16 nReal )
1304  : SwFieldPortion( rExpand, nullptr )
1305  , pFootnote(pFootn)
1306  , nOrigHeight( nReal )
1307  // #i98418#
1308  , mbPreferredScriptTypeSet( false )
1309  , mnPreferredScriptType( SwFontScript::Latin )
1310 {
1311  SetLen(TextFrameIndex(1));
1313 }
1314 
1315 bool SwFootnotePortion::GetExpText( const SwTextSizeInfo &, OUString &rText ) const
1316 {
1317  rText = m_aExpand;
1318  return true;
1319 }
1320 
1322 {
1323  // #i98418#
1324 // SwFootnoteSave aFootnoteSave( rInf, pFootnote );
1326  // the idx is manipulated in SwExpandPortion::Format
1327  // this flag indicates, that a footnote is allowed to trigger
1328  // an underflow during SwTextGuess::Guess
1329  rInf.SetFakeLineStart( rInf.GetIdx() > rInf.GetLineStart() );
1330  const bool bFull = SwFieldPortion::Format( rInf );
1331  rInf.SetFakeLineStart( false );
1332  SetAscent( rInf.GetAscent() );
1333  Height( rInf.GetTextHeight() );
1334  rInf.SetFootnoteDone( !bFull );
1335  if( !bFull )
1336  rInf.SetParaFootnote();
1337  return bFull;
1338 }
1339 
1341 {
1342  // #i98418#
1343 // SwFootnoteSave aFootnoteSave( rInf, pFootnote );
1345  rInf.DrawViewOpt( *this, PortionType::Footnote );
1346  SwExpandPortion::Paint( rInf );
1347 }
1348 
1350 {
1351  // #i98418#
1352 // SwFootnoteSave aFootnoteSave( rInfo, pFootnote );
1354  return SwExpandPortion::GetTextSize( rInfo );
1355 }
1356 
1357 // #i98418#
1359 {
1360  mbPreferredScriptTypeSet = true;
1361  mnPreferredScriptType = nPreferredScriptType;
1362 }
1363 
1364 SwFieldPortion *SwQuoVadisPortion::Clone( const OUString &rExpand ) const
1365 {
1366  return new SwQuoVadisPortion( rExpand, aErgo );
1367 }
1368 
1369 SwQuoVadisPortion::SwQuoVadisPortion( const OUString &rExp, const OUString& rStr )
1370  : SwFieldPortion( rExp ), aErgo(rStr)
1371 {
1372  SetLen(TextFrameIndex(0));
1374 }
1375 
1377 {
1378  // First try; maybe the Text fits
1379  CheckScript( rInf );
1380  bool bFull = SwFieldPortion::Format( rInf );
1381  SetLen(TextFrameIndex(0));
1382 
1383  if( bFull )
1384  {
1385  // Second try; we make the String shorter
1386  m_aExpand = "...";
1387  bFull = SwFieldPortion::Format( rInf );
1388  SetLen(TextFrameIndex(0));
1389  if( bFull )
1390  // Third try; we're done: we crush
1391  Width( sal_uInt16(rInf.Width() - rInf.X()) );
1392 
1393  // No multiline Fields for QuoVadis and ErgoSum
1394  if( rInf.GetRest() )
1395  {
1396  delete rInf.GetRest();
1397  rInf.SetRest( nullptr );
1398  }
1399  }
1400  return bFull;
1401 }
1402 
1403 bool SwQuoVadisPortion::GetExpText( const SwTextSizeInfo &, OUString &rText ) const
1404 {
1405  rText = m_aExpand;
1406  // if this QuoVadisPortion has a follow, the follow is responsible for
1407  // the ergo text.
1408  if ( ! HasFollow() )
1409  rText += aErgo;
1410  return true;
1411 }
1412 
1414 {
1415  rPH.Special( GetLen(), m_aExpand + aErgo, GetWhichPor() );
1416 }
1417 
1419 {
1420  // We _always_ want to output per DrawStretchText, because nErgo
1421  // can quickly switch
1422  if( PrtWidth() )
1423  {
1424  rInf.DrawViewOpt( *this, PortionType::QuoVadis );
1425  SwTextSlot aDiffText( &rInf, this, true, false );
1426  SwFontSave aSave( rInf, m_pFont.get() );
1427  rInf.DrawText( *this, rInf.GetLen(), true );
1428  }
1429 }
1430 
1431 SwFieldPortion *SwErgoSumPortion::Clone( const OUString &rExpand ) const
1432 {
1433  return new SwErgoSumPortion( rExpand, OUString() );
1434 }
1435 
1436 SwErgoSumPortion::SwErgoSumPortion(const OUString &rExp, const OUString& rStr)
1437  : SwFieldPortion( rExp )
1438 {
1439  SetLen(TextFrameIndex(0));
1440  m_aExpand += rStr;
1441 
1442  // One blank distance to the text
1443  m_aExpand += " ";
1445 }
1446 
1448 {
1449  return TextFrameIndex(0);
1450 }
1451 
1453 {
1454  const bool bFull = SwFieldPortion::Format( rInf );
1455  SetLen(TextFrameIndex(0));
1456  rInf.SetErgoDone( true );
1457 
1458  // No multiline Fields for QuoVadis and ErgoSum
1459  if( bFull && rInf.GetRest() )
1460  {
1461  delete rInf.GetRest();
1462  rInf.SetRest( nullptr );
1463  }
1464 
1465  // We return false in order to get some text into the current line,
1466  // even if it's full (better than looping)
1467  return false;
1468 }
1469 
1470 void SwParaPortion::SetErgoSumNum( const OUString& rErgo )
1471 {
1472  SwLineLayout *pLay = this;
1473  while( pLay->GetNext() )
1474  {
1475  pLay = pLay->GetNext();
1476  }
1477  SwLinePortion *pPor = pLay;
1478  SwQuoVadisPortion *pQuo = nullptr;
1479  while( pPor && !pQuo )
1480  {
1481  if ( pPor->IsQuoVadisPortion() )
1482  pQuo = static_cast<SwQuoVadisPortion*>(pPor);
1483  pPor = pPor->GetNextPortion();
1484  }
1485  if( pQuo )
1486  pQuo->SetNumber( rErgo );
1487 }
1488 
1492 bool SwParaPortion::UpdateQuoVadis( const OUString &rQuo )
1493 {
1494  SwLineLayout *pLay = this;
1495  while( pLay->GetNext() )
1496  {
1497  pLay = pLay->GetNext();
1498  }
1499  SwLinePortion *pPor = pLay;
1500  SwQuoVadisPortion *pQuo = nullptr;
1501  while( pPor && !pQuo )
1502  {
1503  if ( pPor->IsQuoVadisPortion() )
1504  pQuo = static_cast<SwQuoVadisPortion*>(pPor);
1505  pPor = pPor->GetNextPortion();
1506  }
1507 
1508  if( !pQuo )
1509  return false;
1510 
1511  return pQuo->GetQuoText() == rQuo;
1512 }
1513 
1514 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool IsAnLower(const SwFrame *) const
Definition: findfrm.cxx:206
SwTextSizeInfo * pInf
Definition: txtftn.cxx:1213
OUString GetNumStr(sal_Int32 nNo) const
long Width() const
virtual bool Format(SwTextFormatInfo &rInf)
Definition: porlin.cxx:241
Base class of the Writer layout elements.
Definition: frame.hxx:295
void Move(SwTextPaintInfo &rInf)
Definition: porlin.cxx:272
const sal_Unicode CH_BREAK
Definition: swfont.hxx:43
Represents the visualization of a paragraph.
Definition: txtfrm.hxx:149
TextFrameIndex FormatQuoVadis(TextFrameIndex nStart)
Definition: txtftn.cxx:993
SwCharFormat * GetAnchorCharFormat(SwDoc &rDoc) const
Definition: docftn.cxx:183
SwFontScript WhichFont(TextFrameIndex nIdx) const
Definition: porlay.cxx:724
bool IsLayoutSplitAllowed() const
Definition: tabfrm.cxx:5385
SwViewShell * GetVsh()
Definition: inftxt.hxx:228
bool IsFollow() const
Definition: flowfrm.hxx:166
const SwSortedObjs * GetDrawObjs() const
Definition: frame.hxx:543
sal_uInt16 GetLineNr() const
Definition: itrtxt.hxx:87
void InsertCnt_(SwLayoutFrame *pLay, SwDoc *pDoc, sal_uLong nIndex, bool bPages=false, sal_uLong nEndIndex=0, SwFrame *pPrv=nullptr, sw::FrameMode eMode=sw::FrameMode::New)
Definition: frmtool.cxx:1381
bool IsEndnAtEnd() const
Definition: sectfrm.hxx:148
virtual SwFieldPortion * Clone(const OUString &rExpand) const override
Definition: txtftn.cxx:1431
SwContentFrame * GetNextContentFrame() const
Definition: cntfrm.hxx:98
virtual void HandlePortion(SwPortionHandler &rPH) const override
Definition: txtftn.cxx:1413
SwTwips Grow(SwTwips, bool bTst=false, bool bInfo=false)
Definition: wsfrm.cxx:1463
bool IsQuick() const
Definition: inftxt.hxx:592
bool IsInSct() const
Definition: frame.hxx:943
sal_uInt16 Height() const
Definition: possiz.hxx:44
void MakeDummyLine()
This function creates a Line that reaches to the other Page Margin.
Definition: txtftn.cxx:1197
SwLineLayout * GetNext()
Definition: porlay.hxx:143
SwFootnoteFrame * ImplFindFootnoteFrame()
Definition: findfrm.cxx:504
bool SeekStartAndChg(SwTextSizeInfo &rInf, const bool bPara=false)
Definition: itrtxt.hxx:323
bool IsSwapped() const
Definition: txtfrm.hxx:524
bool HasPara() const
Definition: txtfrm.hxx:808
bool IsBefore(const SwLayoutFrame *_pCheckRefLayFrame) const
method to check relative position of layout frame to a given layout frame.
Definition: findfrm.cxx:233
long Height() const
static SwFootnoteFrame * FindFootnote(const SwContentFrame *, const SwTextFootnote *)
Definition: ftnfrm.cxx:1631
void SetFootnoteInside(const bool bNew)
Definition: inftxt.hxx:207
virtual void Paint(const SwTextPaintInfo &rInf) const override
Definition: porexp.cxx:64
bool IsInFootnote() const
Definition: frame.hxx:925
void SetFixWidth(const sal_uInt16 nNew)
Definition: porglue.hxx:38
void SwitchHorizontalToVertical(SwRect &rRect) const
Calculates the coordinates of a rectangle when switching from horizontal to vertical layout...
Definition: txtfrm.cxx:483
SwTwips mnFootnoteLine
Definition: txtfrm.hxx:176
The SwPortionHandler interface implements a visitor for the layout engine's text portions.
SwTabFrame is one table in the document layout, containing rows (which contain cells).
Definition: tabfrm.hxx:30
void SetFakeLineStart(const bool bNew)
Definition: inftxt.hxx:578
SwTwips Left() const
Definition: inftxt.hxx:547
Definition: doc.hxx:185
void SetBackColor(Color *pNewColor)
Definition: swfont.cxx:68
bool HasFollow() const
Definition: flowfrm.hxx:165
sal_uInt16 GetTextHeight() const
Definition: inftxt.hxx:717
void UpdateFootnoteNum()
Definition: ftnfrm.cxx:2380
SwParaPortion * GetPara()
Definition: txtcache.cxx:89
void SetErgoSumNum(const OUString &rErgo)
Definition: txtftn.cxx:1470
SwTextAttr const * PrevAttr(SwTextNode const **ppNode=nullptr)
Definition: txtfrm.cxx:234
bool IsErgoDone() const
Definition: inftxt.hxx:632
long GetBottom(const SwRect &rRect) const
Definition: frame.hxx:1354
TextFrameIndex GetOfst() const
Definition: txtfrm.hxx:426
short Seek(SwFont &rFnt, sal_uLong nNode, sal_Int32 nNew, sal_Int32 nOld)
Definition: redlnitr.cxx:534
void SetLen(TextFrameIndex const nLen)
Definition: porlin.hxx:74
SwFont * m_pFont
Definition: itratr.hxx:39
long SwTwips
Definition: swtypes.hxx:49
void CharToLine(TextFrameIndex)
Definition: itrtxt.cxx:194
static void ChangeFootnoteRef(const SwContentFrame *pOld, const SwTextFootnote *, SwContentFrame *pNew)
Definition: ftnfrm.cxx:1699
std::unique_ptr< SwFont > m_pFont
Definition: porfld.hxx:35
bool IsVert() const
Definition: frame.hxx:1343
void DrawText(const OUString &rText, const SwLinePortion &rPor, TextFrameIndex nIdx=TextFrameIndex(0), TextFrameIndex nLen=TextFrameIndex(COMPLETE_STRING), const bool bKern=false) const
Definition: inftxt.hxx:746
const SwLineLayout * Next()
Definition: itrtxt.cxx:109
sal_uInt16 RealWidth() const
Definition: inftxt.hxx:554
const Size & GetSize(SwFontScript nWhich) const
Definition: swfont.hxx:205
bool IsEndNote() const
Definition: fmtftn.hxx:73
Of course Writer needs its own rectangles.
Definition: swrect.hxx:34
virtual bool Format(SwTextFormatInfo &rInf) override
Definition: txtftn.cxx:1321
void RearrangeFootnotes(const SwTwips nDeadLine, const bool bLock, const SwTextFootnote *pAttr=nullptr)
Definition: ftnfrm.cxx:2163
SwTwips Y() const
Definition: itrtxt.hxx:90
css::chart::ChartAxisLabelPosition ePos
Collection of SwLineLayout instances, represents the paragraph text in Writer layout.
Definition: porlay.hxx:229
void SetPara(SwParaPortion *pNew, bool bDelete=true)
Definition: txtcache.cxx:128
OUString GetViewNumStr(const SwDoc &rDoc, SwRootFrame const *pLayout, bool bInclStrings=false) const
Returns string to be displayed of footnote / endnote.
Definition: atrftn.cxx:210
SwTextAttr const * NextAttr(SwTextNode const **ppNode=nullptr)
Definition: txtfrm.cxx:97
void CalcFootnoteFlag(TextFrameIndex nStop=TextFrameIndex(COMPLETE_STRING))
Does the Frame have a local footnote (in this Frame or Follow)?
Definition: txtftn.cxx:86
const OUString & GetQuoText() const
Definition: porftn.hxx:73
bool mbPreferredScriptTypeSet
Definition: porftn.hxx:31
SwTextFormatInfo & GetInfo()
Definition: itrform2.hxx:213
SwSectionFrame * ImplFindSctFrame()
Definition: findfrm.cxx:480
long YDiff(long n1, long n2) const
Definition: frame.hxx:1399
bool IsMarginPortion() const
Definition: porlin.hxx:123
void ValidateBodyFrame()
Definition: frmform.cxx:140
virtual void Paint(const SwTextPaintInfo &rInf) const override
Definition: txtftn.cxx:1418
static bool Collecting(SwDoc *pDoc, SwSectionFrame const *pSect, SwFootnoteFrame *pFootnote)
Definition: layouter.cxx:274
wrapper class for the positioning of Writer fly frames and drawing objects
void SetParaFootnote()
Definition: inftxt.hxx:780
long GetPrtBottom(const SwFrame &rFrame) const
Definition: frame.hxx:1386
LINESTYLE_NONE
const SwRect & getFrameArea() const
Definition: frame.hxx:175
SwFootnoteContFrame * FindFootnoteCont()
Definition: ftnfrm.cxx:964
void CollectEndnote(SwFootnoteFrame *pFootnote)
Definition: layouter.cxx:224
sal_Unicode GetChar(TextFrameIndex const nPos) const
Definition: inftxt.hxx:247
bool IsInTab() const
Definition: frame.hxx:931
SwTextFootnote *const pFootnote
Definition: porftn.hxx:28
void SetNumber(const OUString &rStr)
Definition: porftn.hxx:72
virtual bool GetExpText(const SwTextSizeInfo &rInf, OUString &rText) const override
Definition: txtftn.cxx:1315
long GetBottomMargin(const SwFrame &rFrame) const
Definition: frame.hxx:1380
SwTwips Right() const
Definition: itrtxt.hxx:181
SwTwips GetFootnoteLine(const SwTextFootnote *pFootnote) const
If we're a Footnote that grows towards its reference ...
Definition: txtftn.cxx:254
std::unique_ptr< SwFont > pOld
Definition: txtftn.cxx:1215
sal_Int32 GetStart() const
Definition: txatbase.hxx:82
bool IsSctFrame() const
Definition: frame.hxx:1190
void AppendFootnote(SwContentFrame *, SwTextFootnote *)
Definition: ftnfrm.cxx:1414
void CalcRealHeight(bool bNewLine=false)
Definition: itrform2.cxx:1682
void ChgPhysFnt(SwViewShell const *pSh, OutputDevice &rOut)
Definition: swfont.cxx:972
TextFrameIndex GetLineStart() const
Definition: inftxt.hxx:595
SwFootnoteSave(const SwFootnoteSave &)=delete
SwFontScript GetActual() const
Definition: swfont.hxx:183
virtual SwFieldPortion * Clone(const OUString &rExpand) const override
Definition: txtftn.cxx:1364
SwTextFrame * GetFollow()
Definition: txtfrm.hxx:844
void SetPreferredScriptType(SwFontScript nPreferredScriptType)
Definition: txtftn.cxx:1358
virtual void Special(TextFrameIndex nLength, const OUString &rText, PortionType nType, sal_Int32 nHeight=0, sal_Int32 nWidth=0, const SwFont *pFont=nullptr)=0
special portion.
sal_uInt16 GetVirtPageNum() const
Definition: trvlfrm.cxx:1806
SwQuoVadisPortion(const OUString &rExp, const OUString &rStr)
Definition: txtftn.cxx:1369
void ResetPreps()
Definition: txtfrm.cxx:1348
SwFootnoteFrame * FindFootnoteFrame()
Definition: frame.hxx:1083
void swap(cow_wrapper< T, P > &a, cow_wrapper< T, P > &b)
void SetRealHeight(sal_uInt16 nNew)
Definition: porlay.hxx:152
void CheckScript(const SwTextSizeInfo &rInf)
Definition: porfld.cxx:196
virtual SwLinePortion * Append(SwLinePortion *pPortion)
Definition: porlin.cxx:193
void SetLeft(bool bNew)
Definition: porfld.hxx:80
SwFootnotePortion * NewFootnotePortion(SwTextFormatInfo &rInf, SwTextAttr *pHt)
The portion for the Footnote Reference in the Text.
Definition: txtftn.cxx:767
void ConnectFootnote(SwTextFootnote *pFootnote, const SwTwips nDeadLine)
We basically only have two possibilities:
Definition: txtftn.cxx:574
SwFrame * GetIndPrev() const
Definition: frame.hxx:702
const SwContentFrame * GetFollow() const
Definition: cntfrm.hxx:114
#define RES_CHRATR_BACKGROUND
Definition: hintids.hxx:89
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
Collection of SwLinePortion instances, representing one line of text.
Definition: porlay.hxx:78
SwFootnoteSave & operator=(const SwFootnoteSave &)=delete
#define RES_TXTATR_FTN
Definition: hintids.hxx:152
vcl::RenderContext * GetOut()
Definition: inftxt.hxx:231
void SetStop(const bool bNew)
Definition: inftxt.hxx:580
SwPageFrame * FindPageFrame()
Definition: frame.hxx:658
void SetWhichPor(const PortionType nNew)
Definition: porlin.hxx:93
bool IsFlyPortion() const
Definition: porlin.hxx:124
bool IsInFootnoteConnect() const
Definition: txtfrm.hxx:511
TextFrameIndex MapModelToView(MergedPara const &, SwTextNode const *pNode, sal_Int32 nIndex)
Definition: txtfrm.cxx:1182
const SwFrame * Lower() const
Definition: layfrm.hxx:100
virtual SwLayouter * GetLayouter()=0
SwPageDesc * GetPageDesc()
Definition: pagefrm.hxx:129
void ManipOfst(TextFrameIndex const nNewOfst)
Definition: txtfrm.hxx:429
SwLinePortion * GetFirstPortion() const
Definition: porlay.cxx:673
SwSection * GetSection()
Definition: sectfrm.hxx:84
std::pair< SwTextNode *, sal_Int32 > MapViewToModel(MergedPara const &, TextFrameIndex nIndex)
Definition: txtfrm.cxx:1163
SwLayoutFrame * GetUpper()
Definition: frame.hxx:656
WEIGHT_NORMAL
SwFootnoteFrame * FindFirstFootnote()
Definition: ftnfrm.cxx:1010
static SwTwips lcl_GetFootnoteLower(const SwTextFrame *pFrame, SwTwips nLower)
Local helper function.
Definition: txtftn.cxx:162
sal_uInt16 Width() const
Definition: inftxt.hxx:533
SwFont * pFnt
Definition: txtftn.cxx:1214
bool IsRowFrame() const
Definition: frame.hxx:1198
SwFootnoteBossFrame * FindFootnoteBossFrame(bool bFootnotes=false)
Definition: findfrm.cxx:435
Provides access to settings of a document.
SwFrame * GetPrev()
Definition: frame.hxx:655
sal_uInt16 GetLineHeight() const
Definition: itrtxt.hxx:116
TextFrameIndex GetIdx() const
Definition: inftxt.hxx:278
Marks a node in the document model.
Definition: ndindex.hxx:31
SwTwips GetFootnoteFrameHeight_() const
Calculates the maximum reachable height for the TextFrame in the Footnote Area.
Definition: txtftn.cxx:295
OUString m_aExpand
Definition: porfld.hxx:34
bool isFrameAreaPositionValid() const
Definition: frame.hxx:162
void TruncLines(bool bNoteFollow=false)
Definition: itrtxt.cxx:324
static OUString lcl_GetPageNumber(const SwPageFrame *pPage)
Definition: txtftn.cxx:957
ITALIC_NONE
OUString aErgoSum
Definition: ftninfo.hxx:95
OUString aErgo
Definition: porftn.hxx:65
SwContentFrame * FindLastContent(SwFindMode nMode=SwFindMode::None)
Definition: sectfrm.cxx:905
TextFrameIndex GetLen() const
Definition: porlin.hxx:73
A page of the document layout.
Definition: pagefrm.hxx:40
const SwFormatFootnote & GetFootnote() const
Definition: txatbase.hxx:200
virtual bool GetExpText(const SwTextSizeInfo &rInf, OUString &rText) const override
Definition: txtftn.cxx:1403
SwErgoSumPortion * NewErgoSumPortion(SwTextFormatInfo const &rInf) const
Definition: txtftn.cxx:965
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
Definition: doc.cxx:437
void InvalidateWindows(const SwRect &rRect)
Definition: viewsh.cxx:550
const long LONG_MAX
Used in footnotes if they break across pages, master has this portion at the end. ...
Definition: porftn.hxx:63
const SwAttrSet & GetCharAttr() const
Definition: inftxt.hxx:774
SwSectionFrame * FindSctFrame()
Definition: frame.hxx:1091
const SwFootnoteFrame * GetMaster() const
Definition: ftnfrm.hxx:104
void ValidateFrame()
Definition: frmform.cxx:84
SwFrame * FindColFrame()
Definition: findfrm.cxx:529
const SwFrameFormat * GetDfltFrameFormat() const
Definition: doc.hxx:740
virtual TextFrameIndex GetCursorOfst(sal_uInt16 nOfst) const override
the parameter is actually SwTwips apparently?
Definition: txtftn.cxx:1447
bool RemoveFootnote(const SwContentFrame *, const SwTextFootnote *, bool bPrep=true)
Definition: ftnfrm.cxx:1671
SwTwips X() const
Definition: inftxt.hxx:385
bool mbInFootnoteConnect
Definition: txtfrm.hxx:218
SwTextFrame * m_pFrame
Definition: itrtxt.hxx:34
bool IsFootnoteNumFrame_() const
Definition: txtftn.cxx:58
Base class for anything that can be part of a line in the Writer layout.
Definition: porlin.hxx:49
void Left(const long nLeft)
Definition: swrect.hxx:193
#define RES_CHRATR_ROTATE
Definition: hintids.hxx:100
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:79
void Bottom(const long nBottom)
Definition: swrect.hxx:207
virtual SwPosSize GetTextSize(const SwTextSizeInfo &rInfo) const override
Definition: txtftn.cxx:1349
virtual bool Format(SwTextFormatInfo &rInf) override
Definition: porfld.cxx:293
TextFrameIndex m_nStart
Definition: itrtxt.hxx:41
bool Growable() const
checks whether the SectionFrame is still able to grow, as case may be the environment has to be asked...
Definition: sectfrm.cxx:2136
TextFrameIndex FormatLine(TextFrameIndex nStart)
Definition: itrform2.cxx:1469
void SetRef(SwContentFrame *pNew)
Definition: ftnfrm.hxx:112
SwCharFormat * GetCharFormat(SwDoc &rDoc) const
Definition: docftn.cxx:141
Used in footnotes if they break across pages, follow starts with this portion.
Definition: porftn.hxx:89
For the text replacement and restoration of SwTextSizeInfo.
Definition: inftxt.hxx:677
bool IsTabFrame() const
Definition: frame.hxx:1194
general base class for all free-flowing frames
Definition: flyfrm.hxx:60
void CalcAdjustLine(SwLineLayout *pCurr)
Definition: itrform2.cxx:722
sal_uInt8 & GetTox()
Definition: swfont.hxx:250
SwTextFrame * FindMaster() const
Definition: flowfrm.cxx:679
void SetSize(const Size &rSize, const SwFontScript nWhich)
Definition: swfont.hxx:737
PortionType GetWhichPor() const
Definition: porlin.hxx:94
void SetFootnoteDone(const bool bNew)
Definition: inftxt.hxx:631
void SetFootnote(const bool bNew)
Will be moved soon.
Definition: txtfrm.hxx:588
virtual void Paint(const SwTextPaintInfo &rInf) const override
Definition: txtftn.cxx:1340
SwLinePortion * GetRest()
Definition: inftxt.hxx:581
SwTextFrame * FindFootnoteRef(const SwTextFootnote *pFootnote)
Looks for the TextFrame matching the SwTextFootnote within a master-follow chain. ...
Definition: txtftn.cxx:71
TextFrameIndex MapModelToView(SwTextNode const *pNode, sal_Int32 nIndex) const
Definition: txtfrm.cxx:1251
SwLinePortion * FindLastPortion()
Definition: porlin.cxx:182
void SetActual(SwFontScript nNew)
Definition: swfont.hxx:747
IDocumentSettingAccess const & getIDocumentSettingAccess() const
Definition: doc.cxx:208
const SwFootnoteFrame * GetFollow() const
Definition: ftnfrm.hxx:101
SvxAdjust GetAdjust() const
Definition: itrtxt.hxx:190
bool CalcPrepFootnoteAdjust()
Definition: txtftn.cxx:121
bool IsRightToLeft() const
Definition: frame.hxx:963
TextFrameIndex GetLen() const
Definition: inftxt.hxx:280
const SwContentFrame * GetRef() const
Definition: ftnfrm.cxx:2863
SwFrame * GetLower()
Definition: findfrm.cxx:169
bool mbFootnote
Definition: txtfrm.hxx:219
void SetErgoDone(const bool bNew)
Definition: inftxt.hxx:633
bool IsFootnoteAllowed() const
Definition: ftnfrm.cxx:815
const SwTextFootnote * GetAttr() const
Definition: ftnfrm.hxx:107
bool HasFollow() const
Definition: porfld.hxx:88
sal_uInt16 Width() const
Definition: possiz.hxx:46
void MoveFootnotes(const SwContentFrame *pSrc, SwContentFrame *pDest, SwTextFootnote const *pAttr)
Definition: ftnfrm.cxx:2125
SwFontScript
Definition: swfont.hxx:122
long GetHeight(const SwRect &rRect) const
Definition: frame.hxx:1358
SwFontScript mnPreferredScriptType
Definition: porftn.hxx:32
SwNumberPortion * NewFootnoteNumPortion(SwTextFormatInfo const &rInf) const
The portion for the Footnote Numbering in the Footnote Area.
Definition: txtftn.cxx:906
void SetNextPortion(SwLinePortion *pNew)
Definition: porlin.hxx:75
void FeedInf(SwTextFormatInfo &rInf) const
Definition: itrform2.cxx:1835
sal_uInt16 GetRealHeight() const
Definition: porlay.hxx:153
~SwFootnoteSave() COVERITY_NOEXCEPT_FALSE
Definition: txtftn.cxx:1290
void SetAscent(const sal_uInt16 nNewAsc)
Definition: porlin.hxx:78
bool IsVertical() const
Definition: frame.hxx:949
long GetTop(const SwRect &rRect) const
Definition: frame.hxx:1353
SwNodeIndex * GetStartNode() const
Definition: txtftn.hxx:41
SwFootnotePos ePos
Definition: ftninfo.hxx:96
void Insert(SwLineLayout *pLine)
Definition: itrform2.cxx:123
SwDoc & GetDoc()
Definition: txtfrm.hxx:448
bool IsFootnoteAtEnd() const
Definition: sectfrm.hxx:147
void SetDiffFnt(const SfxItemSet *pSet, const IDocumentSettingAccess *pIDocumentSettingAccess)
Definition: swfont.cxx:496
bool HasRedline() const
Definition: porlay.hxx:125
bool IsTest() const
Definition: inftxt.hxx:593
SwTextFrame * GetTextFrame()
Definition: itrtxt.hxx:134
SwLineLayout * m_pCurr
Definition: itrtxt.hxx:36
const SwAttrSet & GetAttrSet() const
For querying the attribute array.
Definition: format.hxx:116
SwFootnotePortion(const OUString &rExpand, SwTextFootnote *pFootnote, sal_uInt16 nOrig=USHRT_MAX)
Definition: txtftn.cxx:1302
virtual bool Format(SwTextFormatInfo &rInf) override
Definition: txtftn.cxx:1376
bool IsQuoVadisPortion() const
Definition: porlin.hxx:115
sal_uInt16 PrtWidth() const
Definition: porlin.hxx:80
void SetVertical(sal_uInt16 nDir, const bool bVertLayout=false, const bool bVertLayoutLRBT=false)
Definition: swfont.cxx:441
SwLinePortion * GetNextPortion() const
Definition: porlin.hxx:71
const SwContentFrame * ContainsContent() const
Checks if the frame contains one or more ContentFrame's anywhere in his subsidiary structure; if so t...
Definition: findfrm.cxx:66
SwViewShell * GetCurrShell() const
Definition: rootfrm.hxx:204
sal_Int32 nPos
o3tl::strong_int< sal_Int32, struct Tag_TextFrameIndex > TextFrameIndex
Denotes a character index in a text frame at a layout level, after extent mapping from a text node at...
class for collecting anchored objects
Definition: sortedobjs.hxx:48
void SetRest(SwLinePortion *pNewRest)
Definition: inftxt.hxx:582
sal_uInt16 GetFrameRstHeight() const
Definition: itrform2.cxx:135
virtual SwPosSize GetTextSize(const SwTextSizeInfo &rInfo) const override
Definition: porexp.cxx:41
void RemoveFootnote(TextFrameIndex nStart, TextFrameIndex nLen=TextFrameIndex(COMPLETE_STRING))
Footnote.
Definition: txtftn.cxx:389
SwTextFrame * FindQuoVadisFrame()
Find the page number of ErgoSum and QuoVadis.
Definition: txtftn.cxx:366
const SwTextNode & GetTextNode() const
Definition: txtftn.hxx:69
sal_uInt16 & GetAscent()
Definition: porlin.hxx:76
const SwFootnoteInfo & GetFootnoteInfo() const
Definition: doc.hxx:623
SwRedlineItr * GetRedln()
Definition: itratr.hxx:81
TextFrameIndex GetTextStart() const
Definition: inftxt.hxx:130
const sal_Int32 COMPLETE_STRING
Definition: swtypes.hxx:61
SwRootFrame * getRootFrame()
Definition: frame.hxx:657
void DrawViewOpt(const SwLinePortion &rPor, PortionType nWhich) const
Definition: inftxt.cxx:1283
bool IsFootnoteDone() const
Definition: inftxt.hxx:630
const SwEndNoteInfo & GetEndNoteInfo() const
Definition: doc.hxx:625
virtual bool Format(SwTextFormatInfo &rInf) override
Definition: txtftn.cxx:1452
sal_uInt16 GetAscent() const
Definition: inftxt.hxx:710
OUString aQuoVadis
Definition: ftninfo.hxx:94
SwFrame * GetNext()
Definition: frame.hxx:654
SwErgoSumPortion(const OUString &rExp, const OUString &rStr)
Definition: txtftn.cxx:1436
bool HasFootnote() const
Definition: txtfrm.hxx:510
bool UpdateQuoVadis(const OUString &rQuo)
Is called in SwTextFrame::Prepare()
Definition: txtftn.cxx:1492
const SvxNumberType & GetNumType() const
Definition: pagedesc.hxx:192