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