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