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