LibreOffice Module sw (master)  1
txtfrm.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 <config_wasm_strip.h>
21 
22 #include <hintids.hxx>
23 #include <hints.hxx>
24 #include <svl/ctloptions.hxx>
25 #include <editeng/lspcitem.hxx>
26 #include <editeng/lrspitem.hxx>
27 #include <editeng/brushitem.hxx>
28 #include <editeng/pgrditem.hxx>
29 #include <unotools/configmgr.hxx>
30 #include <swmodule.hxx>
31 #include <SwSmartTagMgr.hxx>
32 #include <doc.hxx>
36 #include <rootfrm.hxx>
37 #include <pagefrm.hxx>
38 #include <viewsh.hxx>
39 #include <pam.hxx>
40 #include <ndtxt.hxx>
41 #include <paratr.hxx>
42 #include <viewopt.hxx>
43 #include <flyfrm.hxx>
44 #include <tabfrm.hxx>
45 #include <frmatr.hxx>
46 #include <frmtool.hxx>
47 #include <tgrditem.hxx>
48 #include <dbg_lay.hxx>
49 #include <fmtfld.hxx>
50 #include <fmtftn.hxx>
51 #include <txtfld.hxx>
52 #include <txtftn.hxx>
53 #include <ftninfo.hxx>
54 #include <fmtline.hxx>
55 #include <txtfrm.hxx>
56 #include <notxtfrm.hxx>
57 #include <sectfrm.hxx>
58 #include "itrform2.hxx"
59 #include "widorp.hxx"
60 #include "txtcache.hxx"
61 #include <fntcache.hxx>
62 #include <SwGrammarMarkUp.hxx>
63 #include <lineinfo.hxx>
64 #include <SwPortionHandler.hxx>
65 #include <dcontact.hxx>
66 #include <sortedobjs.hxx>
67 #include <txtflcnt.hxx>
68 #include <fmtflcnt.hxx>
69 #include <fmtcntnt.hxx>
70 #include <numrule.hxx>
71 #include <IGrammarContact.hxx>
72 #include <calbck.hxx>
73 #include <ftnidx.hxx>
74 #include <ftnfrm.hxx>
75 
76 #include <wrtsh.hxx>
77 #include <view.hxx>
78 #include <edtwin.hxx>
79 #include <FrameControlsManager.hxx>
80 
81 namespace sw {
82 
84  : m_pMerged(rFrame.GetMergedPara())
85  , m_pNode(m_pMerged ? nullptr : rFrame.GetTextNodeFirst())
86  , m_CurrentExtent(0)
87  , m_CurrentHint(0)
88  {
89  }
90 
92  {
93  if (m_pMerged)
94  {
95  while (m_CurrentExtent < m_pMerged->extents.size())
96  {
97  sw::Extent const& rExtent(m_pMerged->extents[m_CurrentExtent]);
98  if (SwpHints const*const pHints = rExtent.pNode->GetpSwpHints())
99  {
100  while (m_CurrentHint < pHints->Count())
101  {
102  SwTextAttr *const pHint(pHints->Get(m_CurrentHint));
103  if (rExtent.nEnd < pHint->GetStart()
104  // <= if it has no end or isn't empty
105  || (rExtent.nEnd == pHint->GetStart()
106  && (!pHint->GetEnd()
107  || *pHint->GetEnd() != pHint->GetStart())))
108  {
109  break;
110  }
111  ++m_CurrentHint;
112  if (rExtent.nStart <= pHint->GetStart())
113  {
114  if (ppNode)
115  {
116  *ppNode = rExtent.pNode;
117  }
118  return pHint;
119  }
120  }
121  }
122  ++m_CurrentExtent;
123  if (m_CurrentExtent < m_pMerged->extents.size() &&
124  rExtent.pNode != m_pMerged->extents[m_CurrentExtent].pNode)
125  {
126  m_CurrentHint = 0; // reset
127  }
128  }
129  return nullptr;
130  }
131  else
132  {
133  SwpHints const*const pHints(m_pNode->GetpSwpHints());
134  if (pHints)
135  {
136  if (m_CurrentHint < pHints->Count())
137  {
138  SwTextAttr const*const pHint(pHints->Get(m_CurrentHint));
139  ++m_CurrentHint;
140  if (ppNode)
141  {
142  *ppNode = m_pNode;
143  }
144  return pHint;
145  }
146  }
147  return nullptr;
148  }
149  }
150 
152  : m_pNode(rFrame.GetMergedPara() ? nullptr : rFrame.GetTextNodeFirst())
153  , m_CurrentHint(0)
154  {
155  if (!m_pNode)
156  {
157  MergedAttrIterReverse iter(rFrame);
158  SwTextNode const* pNode(nullptr);
159  while (SwTextAttr const* pHint = iter.PrevAttr(&pNode))
160  {
161  m_Hints.emplace_back(pNode, pHint);
162  }
163  }
164  }
165 
167  {
168  if (m_pNode)
169  {
170  SwpHints const*const pHints(m_pNode->GetpSwpHints());
171  if (pHints)
172  {
173  if (m_CurrentHint < pHints->Count())
174  {
175  SwTextAttr const*const pHint(
176  pHints->GetSortedByEnd(m_CurrentHint));
177  ++m_CurrentHint;
178  rpNode = m_pNode;
179  return pHint;
180  }
181  }
182  return nullptr;
183  }
184  else
185  {
186  if (m_CurrentHint < m_Hints.size())
187  {
188  auto const ret = m_Hints[m_Hints.size() - m_CurrentHint - 1];
189  ++m_CurrentHint;
190  rpNode = ret.first;
191  return ret.second;
192  }
193  return nullptr;
194  }
195  }
196 
198  {
199  assert(0 < m_CurrentHint); // should only rewind as far as 0
200  --m_CurrentHint;
201  }
202 
204  : MergedAttrIterBase(rFrame)
205  {
206  if (m_pMerged)
207  {
209  SwpHints const*const pHints(0 < m_CurrentExtent
210  ? m_pMerged->extents[m_CurrentExtent-1].pNode->GetpSwpHints()
211  : nullptr);
212  if (pHints)
213  {
214  pHints->SortIfNeedBe();
215  m_CurrentHint = pHints->Count();
216  }
217  }
218  else
219  {
220  if (SwpHints const*const pHints = m_pNode->GetpSwpHints())
221  {
222  pHints->SortIfNeedBe();
223  m_CurrentHint = pHints->Count();
224  }
225  }
226  }
227 
229  {
230  if (m_pMerged)
231  {
232  while (0 < m_CurrentExtent)
233  {
234  sw::Extent const& rExtent(m_pMerged->extents[m_CurrentExtent-1]);
235  if (SwpHints const*const pHints = rExtent.pNode->GetpSwpHints())
236  {
237  while (0 < m_CurrentHint)
238  {
239  SwTextAttr *const pHint(
240  pHints->GetSortedByEnd(m_CurrentHint - 1));
241  if (pHint->GetAnyEnd() < rExtent.nStart
242  // <= if it has end and isn't empty
243  || (pHint->GetEnd()
244  && *pHint->GetEnd() != pHint->GetStart()
245  && *pHint->GetEnd() == rExtent.nStart))
246  {
247  break;
248  }
249  --m_CurrentHint;
250  if (pHint->GetAnyEnd() <= rExtent.nEnd)
251  {
252  if (ppNode)
253  {
254  *ppNode = rExtent.pNode;
255  }
256  return pHint;
257  }
258  }
259  }
260  --m_CurrentExtent;
261  if (0 < m_CurrentExtent &&
262  rExtent.pNode != m_pMerged->extents[m_CurrentExtent-1].pNode)
263  {
264  SwpHints const*const pHints(
265  m_pMerged->extents[m_CurrentExtent-1].pNode->GetpSwpHints());
266  m_CurrentHint = pHints ? pHints->Count() : 0; // reset
267  if (pHints)
268  pHints->SortIfNeedBe();
269  }
270  }
271  return nullptr;
272  }
273  else
274  {
275  SwpHints const*const pHints(m_pNode->GetpSwpHints());
276  if (pHints && 0 < m_CurrentHint)
277  {
278  SwTextAttr const*const pHint(pHints->GetSortedByEnd(m_CurrentHint - 1));
279  --m_CurrentHint;
280  if (ppNode)
281  {
282  *ppNode = m_pNode;
283  }
284  return pHint;
285  }
286  return nullptr;
287  }
288  }
289 
290  bool FrameContainsNode(SwContentFrame const& rFrame, SwNodeOffset const nNodeIndex)
291  {
292  if (rFrame.IsTextFrame())
293  {
294  SwTextFrame const& rTextFrame(static_cast<SwTextFrame const&>(rFrame));
295  if (sw::MergedPara const*const pMerged = rTextFrame.GetMergedPara())
296  {
297  SwNodeOffset const nFirst(pMerged->pFirstNode->GetIndex());
298  SwNodeOffset const nLast(pMerged->pLastNode->GetIndex());
299  return (nFirst <= nNodeIndex && nNodeIndex <= nLast);
300  }
301  else
302  {
303  return rTextFrame.GetTextNodeFirst()->GetIndex() == nNodeIndex;
304  }
305  }
306  else
307  {
308  assert(rFrame.IsNoTextFrame());
309  return static_cast<SwNoTextFrame const&>(rFrame).GetNode()->GetIndex() == nNodeIndex;
310  }
311  }
312 
313  bool IsParaPropsNode(SwRootFrame const& rLayout, SwTextNode const& rNode)
314  {
315  if (rLayout.HasMergedParas())
316  {
317  if (SwTextFrame const*const pFrame = static_cast<SwTextFrame*>(rNode.getLayoutFrame(&rLayout)))
318  {
319  sw::MergedPara const*const pMerged(pFrame->GetMergedPara());
320  if (pMerged && pMerged->pParaPropsNode != &rNode)
321  {
322  return false;
323  }
324  }
325  }
326  return true;
327  }
328 
329  SwTextNode *
330  GetParaPropsNode(SwRootFrame const& rLayout, SwNodeIndex const& rPos)
331  {
332  SwTextNode *const pTextNode(rPos.GetNode().GetTextNode());
333  if (pTextNode && !sw::IsParaPropsNode(rLayout, *pTextNode))
334  {
335  return static_cast<SwTextFrame*>(pTextNode->getLayoutFrame(&rLayout))->GetMergedPara()->pParaPropsNode;
336  }
337  else
338  {
339  return pTextNode;
340  }
341  }
342 
343  SwPosition
344  GetParaPropsPos(SwRootFrame const& rLayout, SwPosition const& rPos)
345  {
346  SwPosition pos(rPos);
347  SwTextNode const*const pNode(pos.nNode.GetNode().GetTextNode());
348  if (pNode)
349  {
350  pos.nNode = *sw::GetParaPropsNode(rLayout, *pNode);
351  pos.nContent.Assign(pos.nNode.GetNode().GetContentNode(), 0);
352  }
353  return pos;
354  }
355 
356  std::pair<SwTextNode *, SwTextNode *>
357  GetFirstAndLastNode(SwRootFrame const& rLayout, SwNodeIndex const& rPos)
358  {
359  SwTextNode *const pTextNode(rPos.GetNode().GetTextNode());
360  if (pTextNode && rLayout.HasMergedParas())
361  {
362  if (SwTextFrame const*const pFrame = static_cast<SwTextFrame*>(pTextNode->getLayoutFrame(&rLayout)))
363  {
364  if (sw::MergedPara const*const pMerged = pFrame->GetMergedPara())
365  {
366  return std::make_pair(pMerged->pFirstNode, const_cast<SwTextNode*>(pMerged->pLastNode));
367  }
368  }
369  }
370  return std::make_pair(pTextNode, pTextNode);
371  }
372 
373  SwTextNode const& GetAttrMerged(SfxItemSet & rFormatSet,
374  SwTextNode const& rNode, SwRootFrame const*const pLayout)
375  {
376  rNode.SwContentNode::GetAttr(rFormatSet);
377  if (pLayout && pLayout->HasMergedParas())
378  {
379  auto pFrame = static_cast<SwTextFrame*>(rNode.getLayoutFrame(pLayout));
380  if (sw::MergedPara const*const pMerged = pFrame ? pFrame->GetMergedPara() : nullptr)
381  {
382  if (pMerged->pFirstNode != &rNode)
383  {
384  rFormatSet.ClearItem(RES_PAGEDESC);
385  rFormatSet.ClearItem(RES_BREAK);
386  static_assert(RES_PAGEDESC + 1 == sal_uInt16(RES_BREAK),
387  "first-node items must be adjacent");
388  SfxItemSetFixed<RES_PAGEDESC, RES_BREAK> firstSet(*rFormatSet.GetPool());
389  pMerged->pFirstNode->SwContentNode::GetAttr(firstSet);
390  rFormatSet.Put(firstSet);
391 
392  }
393  if (pMerged->pParaPropsNode != &rNode)
394  {
395  for (sal_uInt16 i = RES_PARATR_BEGIN; i != RES_FRMATR_END; ++i)
396  {
397  if (i != RES_PAGEDESC && i != RES_BREAK)
398  {
399  rFormatSet.ClearItem(i);
400  }
401  }
402  for (sal_uInt16 i = XATTR_FILL_FIRST; i <= XATTR_FILL_LAST; ++i)
403  {
404  rFormatSet.ClearItem(i);
405  }
409  propsSet(*rFormatSet.GetPool());
410  pMerged->pParaPropsNode->SwContentNode::GetAttr(propsSet);
411  rFormatSet.Put(propsSet);
412  return *pMerged->pParaPropsNode;
413  }
414  // keep all the CHRATR/UNKNOWNATR anyway...
415  }
416  }
417  return rNode;
418  }
419 
420 } // namespace sw
421 
424 {
425  {
427 
428  if ( ! mbIsSwapped )
429  {
430  const tools::Long nPrtOfstX = aPrt.Pos().X();
431  aPrt.Pos().setX( aPrt.Pos().Y() );
432 
433  if( IsVertLR() )
434  {
435  aPrt.Pos().setY( nPrtOfstX );
436  }
437  else
438  {
439  aPrt.Pos().setY( getFrameArea().Width() - ( nPrtOfstX + aPrt.Width() ) );
440  }
441  }
442  else
443  {
444  const tools::Long nPrtOfstY = aPrt.Pos().Y();
445  aPrt.Pos().setY( aPrt.Pos().X() );
446 
447  if( IsVertLR() )
448  {
449  aPrt.Pos().setX( nPrtOfstY );
450  }
451  else
452  {
453  aPrt.Pos().setX( getFrameArea().Height() - ( nPrtOfstY + aPrt.Height() ) );
454  }
455  }
456 
457  const tools::Long nPrtWidth = aPrt.Width();
458  aPrt.Width( aPrt.Height() );
459  aPrt.Height( nPrtWidth );
460  }
461 
462  {
463  const tools::Long nFrameWidth = getFrameArea().Width();
465  aFrm.Width( aFrm.Height() );
466  aFrm.Height( nFrameWidth );
467  }
468 
470 }
471 
477 {
478  // calc offset inside frame
479  tools::Long nOfstX, nOfstY;
480  if ( IsVertLR() )
481  {
482  if (IsVertLRBT())
483  {
484  // X and Y offsets here mean the position of the point that will be the top left corner
485  // after the switch.
486  nOfstX = rRect.Left() + rRect.Width() - getFrameArea().Left();
487  nOfstY = rRect.Top() - getFrameArea().Top();
488  }
489  else
490  {
491  nOfstX = rRect.Left() - getFrameArea().Left();
492  nOfstY = rRect.Top() - getFrameArea().Top();
493  }
494  }
495  else
496  {
497  nOfstX = rRect.Left() - getFrameArea().Left();
498  nOfstY = rRect.Top() + rRect.Height() - getFrameArea().Top();
499  }
500 
501  const tools::Long nWidth = rRect.Width();
502  const tools::Long nHeight = rRect.Height();
503 
504  if ( IsVertLR() )
505  {
506  rRect.Left(getFrameArea().Left() + nOfstY);
507  }
508  else
509  {
510  if ( mbIsSwapped )
511  rRect.Left( getFrameArea().Left() + getFrameArea().Height() - nOfstY );
512  else
513  // frame is rotated
514  rRect.Left( getFrameArea().Left() + getFrameArea().Width() - nOfstY );
515  }
516 
517  if (IsVertLRBT())
518  {
519  if (mbIsSwapped)
520  rRect.Top(getFrameArea().Top() + getFrameArea().Width() - nOfstX);
521  else
522  rRect.Top(getFrameArea().Top() + getFrameArea().Height() - nOfstX);
523  }
524  else
525  rRect.Top(getFrameArea().Top() + nOfstX);
526  rRect.Width( nHeight );
527  rRect.Height( nWidth );
528 }
529 
534 void SwTextFrame::SwitchHorizontalToVertical( Point& rPoint ) const
535 {
536  if (IsVertLRBT())
537  {
538  // The horizontal origo is the top left corner, the LRBT origo is the
539  // bottom left corner. Finally x and y has to be swapped.
540  SAL_WARN_IF(!mbIsSwapped, "sw.core",
541  "SwTextFrame::SwitchHorizontalToVertical, IsVertLRBT, not swapped");
542  Point aPoint(rPoint);
543  rPoint.setX(getFrameArea().Left() + (aPoint.Y() - getFrameArea().Top()));
544  // This would be bottom - x delta, but bottom is top + height, finally
545  // width (and not height), as it's swapped.
546  rPoint.setY(getFrameArea().Top() + getFrameArea().Width()
547  - (aPoint.X() - getFrameArea().Left()));
548  return;
549  }
550 
551  // calc offset inside frame
552  const tools::Long nOfstX = rPoint.X() - getFrameArea().Left();
553  const tools::Long nOfstY = rPoint.Y() - getFrameArea().Top();
554  if ( IsVertLR() )
555  rPoint.setX( getFrameArea().Left() + nOfstY );
556  else
557  {
558  if ( mbIsSwapped )
559  rPoint.setX( getFrameArea().Left() + getFrameArea().Height() - nOfstY );
560  else
561  // calc rotated coords
562  rPoint.setX( getFrameArea().Left() + getFrameArea().Width() - nOfstY );
563  }
564 
565  rPoint.setY( getFrameArea().Top() + nOfstX );
566 }
567 
573 {
574  Point aTmp( 0, nLimit );
576  return aTmp.X();
577 }
578 
584 {
585  tools::Long nOfstX;
586 
587  // calc offset inside frame
588  if ( IsVertLR() )
589  nOfstX = rRect.Left() - getFrameArea().Left();
590  else
591  {
592  if ( mbIsSwapped )
593  nOfstX = getFrameArea().Left() + getFrameArea().Height() - ( rRect.Left() + rRect.Width() );
594  else
595  nOfstX = getFrameArea().Left() + getFrameArea().Width() - ( rRect.Left() + rRect.Width() );
596  }
597 
598  tools::Long nOfstY;
599  if (IsVertLRBT())
600  {
601  // Note that mbIsSwapped only affects the frame area, not rRect, so rRect.Height() is used
602  // here unconditionally.
603  if (mbIsSwapped)
604  nOfstY = getFrameArea().Top() + getFrameArea().Width() - (rRect.Top() + rRect.Height());
605  else
606  nOfstY = getFrameArea().Top() + getFrameArea().Height() - (rRect.Top() + rRect.Height());
607  }
608  else
609  nOfstY = rRect.Top() - getFrameArea().Top();
610  const tools::Long nWidth = rRect.Height();
611  const tools::Long nHeight = rRect.Width();
612 
613  // calc rotated coords
614  rRect.Left( getFrameArea().Left() + nOfstY );
615  rRect.Top( getFrameArea().Top() + nOfstX );
616  rRect.Width( nWidth );
617  rRect.Height( nHeight );
618 }
619 
624 void SwTextFrame::SwitchVerticalToHorizontal( Point& rPoint ) const
625 {
626  tools::Long nOfstX;
627 
628  // calc offset inside frame
629  if ( IsVertLR() )
630  // X offset is Y - left.
631  nOfstX = rPoint.X() - getFrameArea().Left();
632  else
633  {
634  // X offset is right - X.
635  if ( mbIsSwapped )
636  nOfstX = getFrameArea().Left() + getFrameArea().Height() - rPoint.X();
637  else
638  nOfstX = getFrameArea().Left() + getFrameArea().Width() - rPoint.X();
639  }
640 
641  tools::Long nOfstY;
642  if (IsVertLRBT())
643  {
644  // Y offset is bottom - Y.
645  if (mbIsSwapped)
646  nOfstY = getFrameArea().Top() + getFrameArea().Width() - rPoint.Y();
647  else
648  nOfstY = getFrameArea().Top() + getFrameArea().Height() - rPoint.Y();
649  }
650  else
651  // Y offset is Y - top.
652  nOfstY = rPoint.Y() - getFrameArea().Top();
653 
654  // calc rotated coords
655  rPoint.setX( getFrameArea().Left() + nOfstY );
656  rPoint.setY( getFrameArea().Top() + nOfstX );
657 }
658 
664 {
665  Point aTmp( nLimit, 0 );
667  return aTmp.Y();
668 }
669 
670 SwFrameSwapper::SwFrameSwapper( const SwTextFrame* pTextFrame, bool bSwapIfNotSwapped )
671  : pFrame( pTextFrame ), bUndo( false )
672 {
673  if (pFrame->IsVertical() && bSwapIfNotSwapped != pFrame->IsSwapped())
674  {
675  bUndo = true;
676  const_cast<SwTextFrame*>(pFrame)->SwapWidthAndHeight();
677  }
678 }
679 
681 {
682  if ( bUndo )
683  const_cast<SwTextFrame*>(pFrame)->SwapWidthAndHeight();
684 }
685 
687 {
688  SwSwapIfNotSwapped swap(const_cast<SwTextFrame *>(this));
689 
690  tools::Long nWidth = rRect.Width();
691  rRect.Left( 2 * ( getFrameArea().Left() + getFramePrintArea().Left() ) +
692  getFramePrintArea().Width() - rRect.Right() - 1 );
693 
694  rRect.Width( nWidth );
695 }
696 
697 void SwTextFrame::SwitchLTRtoRTL( Point& rPoint ) const
698 {
699  SwSwapIfNotSwapped swap(const_cast<SwTextFrame *>(this));
700 
701  rPoint.setX( 2 * ( getFrameArea().Left() + getFramePrintArea().Left() ) + getFramePrintArea().Width() - rPoint.X() - 1 );
702 }
703 
705  m_rOut( rOutp ), m_nOldLayoutMode( rOutp.GetLayoutMode() )
706 {
707 }
708 
710 {
711  const_cast<OutputDevice&>(m_rOut).SetLayoutMode( m_nOldLayoutMode );
712 }
713 
714 void SwLayoutModeModifier::Modify( bool bChgToRTL )
715 {
716  const_cast<OutputDevice&>(m_rOut).SetLayoutMode( bChgToRTL ?
719 }
720 
722 {
723  const vcl::text::ComplexTextLayoutFlags nNewLayoutMode = m_nOldLayoutMode & ~vcl::text::ComplexTextLayoutFlags::BiDiStrong;
724  const_cast<OutputDevice&>(m_rOut).SetLayoutMode( nNewLayoutMode );
725 }
726 
728  rOut( rOutp ), nOldLanguageType( rOutp.GetDigitLanguage() )
729 {
730  LanguageType eLang = eCurLang;
732  eLang = LANGUAGE_ENGLISH_US;
733  else
734  {
735  const SvtCTLOptions::TextNumerals nTextNumerals = SW_MOD()->GetCTLOptions().GetCTLTextNumerals();
736 
737  if ( SvtCTLOptions::NUMERALS_HINDI == nTextNumerals )
739  else if ( SvtCTLOptions::NUMERALS_ARABIC == nTextNumerals )
740  eLang = LANGUAGE_ENGLISH;
741  else if ( SvtCTLOptions::NUMERALS_SYSTEM == nTextNumerals )
742  eLang = ::GetAppLanguage();
743  }
744 
745  const_cast<OutputDevice&>(rOut).SetDigitLanguage( eLang );
746 }
747 
749 {
750  const_cast<OutputDevice&>(rOut).SetDigitLanguage( nOldLanguageType );
751 }
752 
754 {
755  OSL_ENSURE( !IsLocked(), "+SwTextFrame::Init: this is locked." );
756  if( !IsLocked() )
757  {
758  ClearPara();
759  SetHasRotatedPortions(false);
760  // set flags directly to save a ResetPreps call,
761  // and thereby an unnecessary GetPara call
762  // don't set bOrphan, bLocked or bWait to false!
763  // bOrphan = bFlag7 = bFlag8 = false;
764  }
765 }
766 
768  sw::FrameMode const eMode)
769  : SwContentFrame( pNode, pSib )
770  , mnAllLines( 0 )
771  , mnThisLines( 0 )
772  , mnFlyAnchorOfst( 0 )
773  , mnFlyAnchorOfstNoWrap( 0 )
774  , mnFlyAnchorVertOfstNoWrap( 0 )
775  , mnFootnoteLine( 0 )
776  , mnHeightOfLastLine( 0 )
777  , mnAdditionalFirstLineOffset( 0 )
778  , mnOffset( 0 )
779  , mnCacheIndex( USHRT_MAX )
780  , mbLocked( false )
781  , mbWidow( false )
782  , mbJustWidow( false )
783  , mbEmpty( false )
784  , mbInFootnoteConnect( false )
785  , mbFootnote( false )
786  , mbRepaint( false )
787  , mbHasRotatedPortions( false )
788  , mbFieldFollow( false )
789  , mbHasAnimation( false )
790  , mbIsSwapped( false )
791  , mbFollowFormatAllowed( true )
792 {
794  // note: this may call SwClientNotify if it's in a list so do it last
795  // note: this may change this->pRegisteredIn to m_pMergedPara->listeners
796  m_pMergedPara = CheckParaRedlineMerge(*this, *pNode, eMode);
797 }
798 
799 namespace sw {
800 
801 SwTextFrame * MakeTextFrame(SwTextNode & rNode, SwFrame *const pSibling,
802  sw::FrameMode const eMode)
803 {
804  return new SwTextFrame(&rNode, pSibling, eMode);
805 }
806 
808  SwRootFrame const& rLayout, SwTextNode const& rTextNode,
809  std::vector<std::pair<sal_Int32, sal_Int32>> const*const pExtents)
810 {
811  if (pExtents && pExtents->empty())
812  {
813  return; // nothing to do
814  }
815  const SwFootnoteIdxs &rFootnoteIdxs = rTextNode.GetDoc().GetFootnoteIdxs();
816  size_t nPos = 0;
817  SwNodeOffset const nIndex = rTextNode.GetIndex();
818  rFootnoteIdxs.SeekEntry( rTextNode, &nPos );
819  if (nPos < rFootnoteIdxs.size())
820  {
821  while (nPos && &rTextNode == &(rFootnoteIdxs[ nPos ]->GetTextNode()))
822  --nPos;
823  if (nPos || &rTextNode != &(rFootnoteIdxs[ nPos ]->GetTextNode()))
824  ++nPos;
825  }
826  size_t iter(0);
827  for ( ; nPos < rFootnoteIdxs.size(); ++nPos)
828  {
829  SwTextFootnote* pTextFootnote = rFootnoteIdxs[ nPos ];
830  if (pTextFootnote->GetTextNode().GetIndex() > nIndex)
831  break;
832  if (pExtents)
833  {
834  while ((*pExtents)[iter].second <= pTextFootnote->GetStart())
835  {
836  ++iter;
837  if (iter == pExtents->size())
838  {
839  return;
840  }
841  }
842  if (pTextFootnote->GetStart() < (*pExtents)[iter].first)
843  {
844  continue;
845  }
846  }
847  pTextFootnote->DelFrames(&rLayout);
848  }
849 }
850 
851 } // namespace sw
852 
854 {
855  // Remove associated SwParaPortion from s_pTextCache
856  ClearPara();
857 
858  assert(!GetDoc().IsInDtor()); // this shouldn't be happening with ViewShell owning layout
859  if (!GetDoc().IsInDtor() && HasFootnote())
860  {
861  if (m_pMergedPara)
862  {
863  SwTextNode const* pNode(nullptr);
864  for (auto const& e : m_pMergedPara->extents)
865  {
866  if (e.pNode != pNode)
867  {
868  pNode = e.pNode;
869  // sw_redlinehide: not sure if it's necessary to check
870  // if the nodes are still alive here, which would require
871  // accessing WriterMultiListener::m_vDepends
872  sw::RemoveFootnotesForNode(*getRootFrame(), *pNode, nullptr);
873  }
874  }
875  }
876  else
877  {
878  SwTextNode *const pNode(static_cast<SwTextNode*>(GetDep()));
879  if (pNode)
880  {
881  sw::RemoveFootnotesForNode(*getRootFrame(), *pNode, nullptr);
882  }
883  }
884  }
885 
886  if (!GetDoc().IsInDtor())
887  {
888  if (SwView* pView = GetActiveView())
889  pView->GetEditWin().GetFrameControlsManager().RemoveControls(this);
890  }
891 
893 }
894 
896 {
897  RemoveFromCache();
898 }
899 
900 namespace sw {
901 
902 // 1. if real insert => correct nStart/nEnd for full nLen
903 // 2. if rl un-delete => do not correct nStart/nEnd but just include un-deleted
905  bool const isRealInsert,
906  SwTextNode const& rNode, sal_Int32 const nIndex, sal_Int32 const nLen)
907 {
908  assert(!isRealInsert || nLen); // can 0 happen? yes, for redline in empty node
909  assert(nIndex <= rNode.Len());
910  assert(nIndex + nLen <= rNode.Len());
911  assert(rMerged.pFirstNode->GetIndex() <= rNode.GetIndex() && rNode.GetIndex() <= rMerged.pLastNode->GetIndex());
912  if (!nLen)
913  {
914  return TextFrameIndex(0);
915  }
916  OUStringBuffer text(rMerged.mergedText);
917  sal_Int32 nTFIndex(0); // index used for insertion at the end
918  sal_Int32 nInserted(0);
919  bool bInserted(false);
920  bool bFoundNode(false);
921  auto itInsert(rMerged.extents.end());
922  for (auto it = rMerged.extents.begin(); it != rMerged.extents.end(); ++it)
923  {
924  if (it->pNode == &rNode)
925  {
926  if (isRealInsert)
927  {
928  bFoundNode = true;
929  if (it->nStart <= nIndex && nIndex <= it->nEnd)
930  { // note: this can happen only once
931  text.insert(nTFIndex + (nIndex - it->nStart),
932  rNode.GetText().subView(nIndex, nLen));
933  it->nEnd += nLen;
934  nInserted = nLen;
935  assert(!bInserted);
936  bInserted = true;
937  }
938  else if (nIndex < it->nStart)
939  {
940  if (itInsert == rMerged.extents.end())
941  {
942  itInsert = it;
943  }
944  it->nStart += nLen;
945  it->nEnd += nLen;
946  }
947  }
948  else
949  {
950  assert(it == rMerged.extents.begin() || (it-1)->pNode != &rNode || (it-1)->nEnd < nIndex);
951  if (nIndex + nLen < it->nStart)
952  {
953  itInsert = it;
954  break;
955  }
956  if (nIndex < it->nStart)
957  {
958  text.insert(nTFIndex,
959  rNode.GetText().subView(nIndex, it->nStart - nIndex));
960  nInserted += it->nStart - nIndex;
961  it->nStart = nIndex;
962  bInserted = true;
963  }
964  assert(it->nStart <= nIndex);
965  if (nIndex <= it->nEnd)
966  {
967  nTFIndex += it->nEnd - it->nStart;
968  while (it->nEnd < nIndex + nLen)
969  {
970  auto *const pNext(
971  (it+1) != rMerged.extents.end() && (it+1)->pNode == it->pNode
972  ? &*(it+1)
973  : nullptr);
974  if (pNext && pNext->nStart <= nIndex + nLen)
975  {
976  text.insert(nTFIndex,
977  rNode.GetText().subView(it->nEnd, pNext->nStart - it->nEnd));
978  nTFIndex += pNext->nStart - it->nEnd;
979  nInserted += pNext->nStart - it->nEnd;
980  pNext->nStart = it->nStart;
981  it = rMerged.extents.erase(it);
982  }
983  else
984  {
985  text.insert(nTFIndex,
986  rNode.GetText().subView(it->nEnd, nIndex + nLen - it->nEnd));
987  nTFIndex += nIndex + nLen - it->nEnd;
988  nInserted += nIndex + nLen - it->nEnd;
989  it->nEnd = nIndex + nLen;
990  }
991  }
992  bInserted = true;
993  break;
994  }
995  }
996  }
997  else if (rNode.GetIndex() < it->pNode->GetIndex() || bFoundNode)
998  {
999  if (itInsert == rMerged.extents.end())
1000  {
1001  itInsert = it;
1002  }
1003  break;
1004  }
1005  if (itInsert == rMerged.extents.end())
1006  {
1007  nTFIndex += it->nEnd - it->nStart;
1008  }
1009  }
1010 // assert((bFoundNode || rMerged.extents.empty()) && "text node not found - why is it sending hints to us");
1011  if (!bInserted)
1012  { // must be in a gap
1013  rMerged.extents.emplace(itInsert, const_cast<SwTextNode*>(&rNode), nIndex, nIndex + nLen);
1014  text.insert(nTFIndex, rNode.GetText().subView(nIndex, nLen));
1015  nInserted = nLen;
1016  if (rMerged.extents.size() == 1 // also if it was empty!
1017  || rMerged.pParaPropsNode->GetIndex() < rNode.GetIndex())
1018  { // text inserted after current para-props node
1020  rMerged.pParaPropsNode = &const_cast<SwTextNode&>(rNode);
1021  rMerged.pParaPropsNode->AddToListRLHidden();
1022  }
1023  // called from SwRangeRedline::InvalidateRange()
1025  {
1026  const_cast<SwTextNode&>(rNode).SetRedlineMergeFlag(SwNode::Merge::NonFirst);
1027  }
1028  }
1029  rMerged.mergedText = text.makeStringAndClear();
1030  return TextFrameIndex(nInserted);
1031 }
1032 
1033 // 1. if real delete => correct nStart/nEnd for full nLen
1034 // 2. if rl delete => do not correct nStart/nEnd but just exclude deleted
1036  bool const isRealDelete,
1037  SwTextNode const& rNode, sal_Int32 nIndex, sal_Int32 const nLen)
1038 {
1039  assert(nIndex <= rNode.Len());
1040  assert(rMerged.pFirstNode->GetIndex() <= rNode.GetIndex() && rNode.GetIndex() <= rMerged.pLastNode->GetIndex());
1041  OUStringBuffer text(rMerged.mergedText);
1042  sal_Int32 nTFIndex(0);
1043  sal_Int32 nToDelete(nLen);
1044  sal_Int32 nDeleted(0);
1045  size_t nFoundNode(0);
1046  size_t nErased(0);
1047  auto it = rMerged.extents.begin();
1048  for (; it != rMerged.extents.end(); )
1049  {
1050  bool bErase(false);
1051  if (it->pNode == &rNode)
1052  {
1053  ++nFoundNode;
1054  if (nIndex + nToDelete < it->nStart)
1055  {
1056  nToDelete = 0;
1057  if (!isRealDelete)
1058  {
1059  break;
1060  }
1061  it->nStart -= nLen;
1062  it->nEnd -= nLen;
1063  }
1064  else
1065  {
1066  if (nIndex < it->nStart)
1067  {
1068  // do not adjust nIndex into the text frame index space!
1069  nToDelete -= it->nStart - nIndex;
1070  nIndex = it->nStart;
1071  // note: continue with the if check below, no else!
1072  }
1073  if (it->nStart <= nIndex && nIndex < it->nEnd)
1074  {
1075  sal_Int32 const nDeleteHere(nIndex + nToDelete <= it->nEnd
1076  ? nToDelete
1077  : it->nEnd - nIndex);
1078  text.remove(nTFIndex + (nIndex - it->nStart), nDeleteHere);
1079  bErase = nDeleteHere == it->nEnd - it->nStart;
1080  if (bErase)
1081  {
1082  ++nErased;
1083  assert(it->nStart == nIndex);
1084  it = rMerged.extents.erase(it);
1085  }
1086  else if (isRealDelete)
1087  { // adjust for deleted text
1088  it->nStart -= (nLen - nToDelete);
1089  it->nEnd -= (nLen - nToDelete + nDeleteHere);
1090  if (it != rMerged.extents.begin()
1091  && (it-1)->pNode == &rNode
1092  && (it-1)->nEnd == it->nStart)
1093  { // merge adjacent extents
1094  nTFIndex += it->nEnd - it->nStart;
1095  (it-1)->nEnd = it->nEnd;
1096  it = rMerged.extents.erase(it);
1097  bErase = true; // skip increment
1098  }
1099  }
1100  else
1101  { // exclude text marked as deleted
1102  if (nIndex + nDeleteHere == it->nEnd)
1103  {
1104  it->nEnd -= nDeleteHere;
1105  }
1106  else
1107  {
1108  if (nIndex == it->nStart)
1109  {
1110  it->nStart += nDeleteHere;
1111  }
1112  else
1113  {
1114  sal_Int32 const nOldEnd(it->nEnd);
1115  it->nEnd = nIndex;
1116  it = rMerged.extents.emplace(it+1,
1117  it->pNode, nIndex + nDeleteHere, nOldEnd);
1118  }
1119  assert(nDeleteHere == nToDelete);
1120  }
1121  }
1122  nDeleted += nDeleteHere;
1123  nToDelete -= nDeleteHere;
1124  nIndex += nDeleteHere;
1125  if (!isRealDelete && nToDelete == 0)
1126  {
1127  break;
1128  }
1129  }
1130  }
1131  }
1132  else if (nFoundNode != 0)
1133  {
1134  break;
1135  }
1136  if (!bErase)
1137  {
1138  nTFIndex += it->nEnd - it->nStart;
1139  ++it;
1140  }
1141  }
1142 // assert(nFoundNode != 0 && "text node not found - why is it sending hints to us");
1143  assert(nIndex <= rNode.Len() + nLen);
1144  // if there's a remaining deletion, it must be in gap at the end of the node
1145 // can't do: might be last one in node was erased assert(nLen == 0 || rMerged.empty() || (it-1)->nEnd <= nIndex);
1146  // note: if first node gets deleted then that must call DelFrames as
1147  // pFirstNode is never updated
1148  if (nErased && nErased == nFoundNode)
1149  { // all visible text from node was erased
1150 #if 1
1151  if (rMerged.pParaPropsNode == &rNode)
1152  {
1154  rMerged.pParaPropsNode = rMerged.extents.empty()
1155  ? const_cast<SwTextNode*>(rMerged.pLastNode)
1156  : rMerged.extents.front().pNode;
1157  rMerged.pParaPropsNode->AddToListRLHidden();
1158  }
1159 #endif
1160 // NOPE must listen on all non-hidden nodes; particularly on pLastNode rMerged.listener.EndListening(&const_cast<SwTextNode&>(rNode));
1161  }
1162  rMerged.mergedText = text.makeStringAndClear();
1163  return TextFrameIndex(nDeleted);
1164 }
1165 
1166 std::pair<SwTextNode*, sal_Int32>
1167 MapViewToModel(MergedPara const& rMerged, TextFrameIndex const i_nIndex)
1168 {
1169  sal_Int32 nIndex(i_nIndex);
1170  sw::Extent const* pExtent(nullptr);
1171  for (const auto& rExt : rMerged.extents)
1172  {
1173  pExtent = &rExt;
1174  if (nIndex < (pExtent->nEnd - pExtent->nStart))
1175  {
1176  return std::make_pair(pExtent->pNode, pExtent->nStart + nIndex);
1177  }
1178  nIndex = nIndex - (pExtent->nEnd - pExtent->nStart);
1179  }
1180  assert(nIndex == 0 && "view index out of bounds");
1181  return pExtent
1182  ? std::make_pair(pExtent->pNode, pExtent->nEnd) //1-past-the-end index
1183  : std::make_pair(const_cast<SwTextNode*>(rMerged.pLastNode), rMerged.pLastNode->Len());
1184 }
1185 
1186 TextFrameIndex MapModelToView(MergedPara const& rMerged, SwTextNode const*const pNode, sal_Int32 const nIndex)
1187 {
1188  assert(rMerged.pFirstNode->GetIndex() <= pNode->GetIndex()
1189  && pNode->GetIndex() <= rMerged.pLastNode->GetIndex());
1190  sal_Int32 nRet(0);
1191  bool bFoundNode(false);
1192  for (auto const& e : rMerged.extents)
1193  {
1194  if (pNode->GetIndex() < e.pNode->GetIndex())
1195  {
1196  return TextFrameIndex(nRet);
1197  }
1198  if (e.pNode == pNode)
1199  {
1200  if (e.nStart <= nIndex && nIndex <= e.nEnd)
1201  {
1202  return TextFrameIndex(nRet + (nIndex - e.nStart));
1203  }
1204  else if (nIndex < e.nStart)
1205  {
1206  // in gap before this extent => map to 0 here TODO???
1207  return TextFrameIndex(nRet);
1208  }
1209  bFoundNode = true;
1210  }
1211  else if (bFoundNode)
1212  {
1213  break;
1214  }
1215  nRet += e.nEnd - e.nStart;
1216  }
1217  if (bFoundNode)
1218  {
1219  // must be in a gap at the end of the node
1220  assert(nIndex <= pNode->Len());
1221  return TextFrameIndex(nRet);
1222  }
1223  else if (rMerged.extents.empty())
1224  {
1225  assert(nIndex <= pNode->Len());
1226  return TextFrameIndex(0);
1227  }
1228  return TextFrameIndex(rMerged.mergedText.getLength());
1229 }
1230 
1231 } // namespace sw
1232 
1233 std::pair<SwTextNode*, sal_Int32>
1235 {
1236 //nope assert(GetPara());
1237  sw::MergedPara const*const pMerged(GetMergedPara());
1238  if (pMerged)
1239  {
1240  return sw::MapViewToModel(*pMerged, nIndex);
1241  }
1242  else
1243  {
1244  return std::make_pair(static_cast<SwTextNode*>(const_cast<sw::BroadcastingModify*>(
1245  SwFrame::GetDep())), sal_Int32(nIndex));
1246  }
1247 }
1248 
1250 {
1251  std::pair<SwTextNode*, sal_Int32> const ret(MapViewToModel(nIndex));
1252  return SwPosition(*ret.first, ret.second);
1253 }
1254 
1255 TextFrameIndex SwTextFrame::MapModelToView(SwTextNode const*const pNode, sal_Int32 const nIndex) const
1256 {
1257 //nope assert(GetPara());
1258  sw::MergedPara const*const pMerged(GetMergedPara());
1259  if (pMerged)
1260  {
1261  return sw::MapModelToView(*pMerged, pNode, nIndex);
1262  }
1263  else
1264  {
1265  assert(static_cast<SwTextNode*>(const_cast<sw::BroadcastingModify*>(SwFrame::GetDep())) == pNode);
1266  return TextFrameIndex(nIndex);
1267  }
1268 }
1269 
1271 {
1272  SwTextNode const*const pNode(rPos.nNode.GetNode().GetTextNode());
1273  sal_Int32 const nIndex(rPos.nContent.GetIndex());
1274  return MapModelToView(pNode, nIndex);
1275 }
1276 
1277 void SwTextFrame::SetMergedPara(std::unique_ptr<sw::MergedPara> p)
1278 {
1279  SwTextNode *const pFirst(m_pMergedPara ? m_pMergedPara->pFirstNode : nullptr);
1280  m_pMergedPara = std::move(p);
1281  if (pFirst)
1282  {
1283  if (m_pMergedPara)
1284  {
1285  assert(pFirst == m_pMergedPara->pFirstNode);
1286  }
1287  else
1288  {
1289  pFirst->Add(this); // must register at node again
1290  }
1291  }
1292  // postcondition: frame must be listening somewhere
1293  assert(m_pMergedPara || GetDep());
1294 }
1295 
1296 const OUString& SwTextFrame::GetText() const
1297 {
1298 //nope assert(GetPara());
1299  sw::MergedPara const*const pMerged(GetMergedPara());
1300  if (pMerged)
1301  return pMerged->mergedText;
1302  else
1303  return static_cast<SwTextNode const*>(SwFrame::GetDep())->GetText();
1304 }
1305 
1307 {
1308  // FIXME can GetPara be 0 ? yes... this is needed in SwContentNotify::SwContentNotify() which is called before any formatting is started
1309 //nope assert(GetPara());
1310  sw::MergedPara const*const pMerged(GetMergedPara());
1311  if (pMerged)
1312  {
1313 // assert(pMerged->pFirstNode == pMerged->pParaPropsNode); // surprising news!
1314  return pMerged->pParaPropsNode;
1315  }
1316  else
1317  return static_cast<SwTextNode const*>(SwFrame::GetDep());
1318 }
1319 
1321 {
1322  sw::MergedPara const*const pMerged(GetMergedPara());
1323  if (pMerged)
1324  return pMerged->extents.empty()
1325  ? pMerged->pFirstNode
1326  : pMerged->extents.front().pNode;
1327  else
1328  return static_cast<SwTextNode const*>(SwFrame::GetDep());
1329 }
1330 
1332 {
1333 //nope assert(GetPara());
1334  sw::MergedPara const*const pMerged(GetMergedPara());
1335  if (pMerged)
1336  return pMerged->pFirstNode;
1337  else
1338  return static_cast<SwTextNode const*>(SwFrame::GetDep());
1339 }
1340 
1342 {
1343  return GetTextNodeFirst()->GetDoc();
1344 }
1345 
1347  sal_uInt16 const nScript, bool const bNoChar) const
1348 {
1349  // a single character can be mapped uniquely!
1350  std::pair<SwTextNode const*, sal_Int32> const pos(MapViewToModel(nIndex));
1351  return pos.first->GetLang(pos.second, bNoChar ? 0 : 1, nScript);
1352 }
1353 
1355 {
1356  if ( GetCacheIdx() != USHRT_MAX )
1357  {
1358  if (SwParaPortion *pPara = GetPara())
1359  pPara->ResetPreps();
1360  }
1361 }
1362 
1364 {
1365  SwFrameSwapper aSwapper( this, true );
1366 
1367  if( !getFrameArea().Width() && isFrameAreaDefinitionValid() && GetUpper()->isFrameAreaDefinitionValid() ) // invalid when stack overflows (StackHack)!
1368  {
1369 // OSL_FAIL( "SwTextFrame::IsHiddenNow: thin frame" );
1370  return true;
1371  }
1372 
1373  bool bHiddenCharsHidePara(false);
1374  bool bHiddenParaField(false);
1375  if (m_pMergedPara)
1376  {
1377  TextFrameIndex nHiddenStart(COMPLETE_STRING);
1378  TextFrameIndex nHiddenEnd(0);
1379  if (auto const pScriptInfo = GetScriptInfo())
1380  {
1381  pScriptInfo->GetBoundsOfHiddenRange(TextFrameIndex(0),
1382  nHiddenStart, nHiddenEnd);
1383  }
1384  else // ParaPortion is created in Format, but this is called earlier
1385  {
1386  SwScriptInfo aInfo;
1387  aInfo.InitScriptInfo(*m_pMergedPara->pFirstNode, m_pMergedPara.get(), IsRightToLeft());
1389  nHiddenStart, nHiddenEnd);
1390  }
1391  if (TextFrameIndex(0) == nHiddenStart &&
1392  TextFrameIndex(GetText().getLength()) <= nHiddenEnd)
1393  {
1394  bHiddenCharsHidePara = true;
1395  }
1396  sw::MergedAttrIter iter(*this);
1397  SwTextNode const* pNode(nullptr);
1398  int nNewResultWeight = 0;
1399  for (SwTextAttr const* pHint = iter.NextAttr(&pNode); pHint; pHint = iter.NextAttr(&pNode))
1400  {
1401  if (pHint->Which() == RES_TXTATR_FIELD)
1402  {
1403  // see also SwpHints::CalcHiddenParaField()
1404  const SwFormatField& rField = pHint->GetFormatField();
1405  int nCurWeight = pNode->GetDoc().FieldCanHideParaWeight(rField.GetField()->GetTyp()->Which());
1406  if (nCurWeight > nNewResultWeight)
1407  {
1408  nNewResultWeight = nCurWeight;
1409  bHiddenParaField = pNode->GetDoc().FieldHidesPara(*rField.GetField());
1410  }
1411  else if (nCurWeight == nNewResultWeight && bHiddenParaField)
1412  {
1413  // Currently, for both supported hiding types (HiddenPara, Database), "Don't hide"
1414  // takes precedence - i.e., if there's a "Don't hide" field of that weight, we only
1415  // care about fields of higher weight.
1416  bHiddenParaField = pNode->GetDoc().FieldHidesPara(*rField.GetField());
1417  }
1418  }
1419  }
1420  }
1421  else
1422  {
1423  bHiddenCharsHidePara = static_cast<SwTextNode const*>(SwFrame::GetDep())->HasHiddenCharAttribute( true );
1424  bHiddenParaField = static_cast<SwTextNode const*>(SwFrame::GetDep())->IsHiddenByParaField();
1425  }
1426  const SwViewShell* pVsh = getRootFrame()->GetCurrShell();
1427 
1428  if ( pVsh && ( bHiddenCharsHidePara || bHiddenParaField ) )
1429  {
1430 
1431  if (
1432  ( bHiddenParaField &&
1433  ( !pVsh->GetViewOptions()->IsShowHiddenPara() &&
1434  !pVsh->GetViewOptions()->IsFieldName() ) ) ||
1435  ( bHiddenCharsHidePara &&
1436  !pVsh->GetViewOptions()->IsShowHiddenChar() ) )
1437  {
1438  return true;
1439  }
1440  }
1441 
1442  return false;
1443 }
1444 
1447 {
1448  OSL_ENSURE( !GetFollow() && IsHiddenNow(),
1449  "HideHidden on visible frame of hidden frame has follow" );
1450 
1453 
1454  // format information is obsolete
1455  ClearPara();
1456 }
1457 
1459 {
1460  SwPageFrame *pPage = nullptr;
1461  sw::MergedAttrIter iter(*this);
1462  SwTextNode const* pNode(nullptr);
1463  for (SwTextAttr const* pHt = iter.NextAttr(&pNode); pHt; pHt = iter.NextAttr(&pNode))
1464  {
1465  if (pHt->Which() == RES_TXTATR_FTN)
1466  {
1467  TextFrameIndex const nIdx(MapModelToView(pNode, pHt->GetStart()));
1468  if (nEnd < nIdx)
1469  break;
1470  if (nStart <= nIdx)
1471  {
1472  if (!pPage)
1473  pPage = FindPageFrame();
1474  pPage->RemoveFootnote( this, static_cast<const SwTextFootnote*>(pHt) );
1475  }
1476  }
1477  }
1478 }
1479 
1489 bool sw_HideObj( const SwTextFrame& _rFrame,
1490  const RndStdIds _eAnchorType,
1491  SwPosition const& rAnchorPos,
1492  SwAnchoredObject* _pAnchoredObj )
1493 {
1494  bool bRet( true );
1495 
1496  if (_eAnchorType == RndStdIds::FLY_AT_CHAR)
1497  {
1498  const IDocumentSettingAccess *const pIDSA = &_rFrame.GetDoc().getIDocumentSettingAccess();
1503  _rFrame.IsInDocBody() && !_rFrame.FindNextCnt() )
1504  {
1505  SwTextNode const& rNode(*rAnchorPos.nNode.GetNode().GetTextNode());
1506  assert(FrameContainsNode(_rFrame, rNode.GetIndex()));
1507  sal_Int32 const nObjAnchorPos(rAnchorPos.nContent.GetIndex());
1508  const sal_Unicode cAnchorChar = nObjAnchorPos < rNode.Len()
1509  ? rNode.GetText()[nObjAnchorPos]
1510  : 0;
1511  if (cAnchorChar == CH_TXTATR_BREAKWORD)
1512  {
1513  const SwTextAttr* const pHint(
1514  rNode.GetTextAttrForCharAt(nObjAnchorPos, RES_TXTATR_FLYCNT));
1515  if ( pHint )
1516  {
1517  const SwFrameFormat* pFrameFormat =
1518  static_cast<const SwTextFlyCnt*>(pHint)->GetFlyCnt().GetFrameFormat();
1519  if ( pFrameFormat->Which() == RES_FLYFRMFMT )
1520  {
1521  SwNodeIndex nContentIndex = *(pFrameFormat->GetContent().GetContentIdx());
1522  ++nContentIndex;
1523  if ( nContentIndex.GetNode().IsNoTextNode() )
1524  {
1525  bRet = false;
1526  // set needed data structure values for object positioning
1527  SwRectFnSet aRectFnSet(&_rFrame);
1528  SwRect aLastCharRect( _rFrame.getFrameArea() );
1529  aRectFnSet.SetWidth( aLastCharRect, 1 );
1530  _pAnchoredObj->maLastCharRect = aLastCharRect;
1531  _pAnchoredObj->mnLastTopOfLine = aRectFnSet.GetTop(aLastCharRect);
1532  }
1533  }
1534  }
1535  }
1536  }
1537  }
1538 
1539  return bRet;
1540 }
1541 
1553 {
1554  if ( GetDrawObjs() )
1555  {
1556  if ( IsHiddenNow() )
1557  {
1558  // complete paragraph is hidden. Thus, hide all objects
1559  for (SwAnchoredObject* i : *GetDrawObjs())
1560  {
1561  SdrObject* pObj = i->DrawObj();
1562  SwContact* pContact = static_cast<SwContact*>(pObj->GetUserCall());
1563  // under certain conditions
1564  const RndStdIds eAnchorType( pContact->GetAnchorId() );
1565  if ((eAnchorType != RndStdIds::FLY_AT_CHAR) ||
1566  sw_HideObj(*this, eAnchorType, pContact->GetContentAnchor(),
1567  i ))
1568  {
1569  pContact->MoveObjToInvisibleLayer( pObj );
1570  }
1571  }
1572  }
1573  else
1574  {
1575  // paragraph is visible, but can contain hidden text portion.
1576  // first we check if objects are allowed to be hidden:
1577  const SwViewShell* pVsh = getRootFrame()->GetCurrShell();
1578  const bool bShouldBeHidden = !pVsh || !pVsh->GetWin() ||
1579  !pVsh->GetViewOptions()->IsShowHiddenChar();
1580 
1581  // Thus, show all objects, which are anchored at paragraph and
1582  // hide/show objects, which are anchored at/as character, according
1583  // to the visibility of the anchor character.
1584  for (SwAnchoredObject* i : *GetDrawObjs())
1585  {
1586  SdrObject* pObj = i->DrawObj();
1587  SwContact* pContact = static_cast<SwContact*>(pObj->GetUserCall());
1588  // Determine anchor type only once
1589  const RndStdIds eAnchorType( pContact->GetAnchorId() );
1590 
1591  if (eAnchorType == RndStdIds::FLY_AT_PARA)
1592  {
1593  pContact->MoveObjToVisibleLayer( pObj );
1594  }
1595  else if ((eAnchorType == RndStdIds::FLY_AT_CHAR) ||
1596  (eAnchorType == RndStdIds::FLY_AS_CHAR))
1597  {
1598  sal_Int32 nHiddenStart;
1599  sal_Int32 nHiddenEnd;
1600  const SwPosition& rAnchor = pContact->GetContentAnchor();
1602  *rAnchor.nNode.GetNode().GetTextNode(),
1603  rAnchor.nContent.GetIndex(), nHiddenStart, nHiddenEnd);
1604  // Under certain conditions
1605  if ( nHiddenStart != COMPLETE_STRING && bShouldBeHidden &&
1606  sw_HideObj(*this, eAnchorType, rAnchor, i))
1607  {
1608  pContact->MoveObjToInvisibleLayer( pObj );
1609  }
1610  else
1611  pContact->MoveObjToVisibleLayer( pObj );
1612  }
1613  else
1614  {
1615  OSL_FAIL( "<SwTextFrame::HideAndShowObjects()> - object not anchored at/inside paragraph!?" );
1616  }
1617  }
1618  }
1619  }
1620 
1621  if (IsFollow())
1622  {
1623  SwTextFrame *pMaster = FindMaster();
1624  OSL_ENSURE(pMaster, "SwTextFrame without master");
1625  if (pMaster)
1626  pMaster->HideAndShowObjects();
1627  }
1628 }
1629 
1636 TextFrameIndex SwTextFrame::FindBrk(const OUString &rText,
1637  const TextFrameIndex nStart,
1638  const TextFrameIndex nEnd)
1639 {
1640  sal_Int32 nFound = sal_Int32(nStart);
1641  const sal_Int32 nEndLine = std::min(sal_Int32(nEnd), rText.getLength() - 1);
1642 
1643  // Skip all leading blanks.
1644  while( nFound <= nEndLine && ' ' == rText[nFound] )
1645  {
1646  nFound++;
1647  }
1648 
1649  // A tricky situation with the TextAttr-Dummy-character (in this case "$"):
1650  // "Dr.$Meyer" at the beginning of the second line. Typing a blank after that
1651  // doesn't result in the word moving into first line, even though that would work.
1652  // For this reason we don't skip the dummy char.
1653  while( nFound <= nEndLine && ' ' != rText[nFound] )
1654  {
1655  nFound++;
1656  }
1657 
1658  return TextFrameIndex(nFound);
1659 }
1660 
1661 bool SwTextFrame::IsIdxInside(TextFrameIndex const nPos, TextFrameIndex const nLen) const
1662 {
1663 // Silence over-eager warning emitted at least by GCC trunk towards 6:
1664 #if defined __GNUC__ && !defined __clang__
1665 #pragma GCC diagnostic push
1666 #pragma GCC diagnostic ignored "-Wstrict-overflow"
1667 #endif
1668  if (nLen != TextFrameIndex(COMPLETE_STRING) && GetOffset() > nPos + nLen) // the range preceded us
1669 #if defined __GNUC__ && !defined __clang__
1670 #pragma GCC diagnostic pop
1671 #endif
1672  return false;
1673 
1674  if( !GetFollow() ) // the range doesn't precede us,
1675  return true; // nobody follows us.
1676 
1677  TextFrameIndex const nMax = GetFollow()->GetOffset();
1678 
1679  // either the range overlap or our text has been deleted
1680  // sw_redlinehide: GetText() should be okay here because it has already
1681  // been updated in the INS/DEL hint case
1682  if (nMax > nPos || nMax > TextFrameIndex(GetText().getLength()))
1683  return true;
1684 
1685  // changes made in the first line of a follow can modify the master
1686  const SwParaPortion* pPara = GetFollow()->GetPara();
1687  return pPara && ( nPos <= nMax + pPara->GetLen() );
1688 }
1689 
1690 inline void SwTextFrame::InvalidateRange(const SwCharRange &aRange, const tools::Long nD)
1691 {
1692  if ( IsIdxInside( aRange.Start(), aRange.Len() ) )
1693  InvalidateRange_( aRange, nD );
1694 }
1695 
1697 {
1698  if ( !HasPara() )
1699  { InvalidateSize();
1700  return;
1701  }
1702 
1703  SetWidow( false );
1704  SwParaPortion *pPara = GetPara();
1705 
1706  bool bInv = false;
1707  if( 0 != nD )
1708  {
1709  // In nDelta the differences between old and new
1710  // linelengths are being added, that's why it's negative
1711  // if chars have been added and positive, if chars have
1712  // deleted
1713  pPara->SetDelta(pPara->GetDelta() + nD);
1714  bInv = true;
1715  }
1716  SwCharRange &rReformat = pPara->GetReformat();
1717  if(aRange != rReformat) {
1718  if (TextFrameIndex(COMPLETE_STRING) == rReformat.Len())
1719  rReformat = aRange;
1720  else
1721  rReformat += aRange;
1722  bInv = true;
1723  }
1724  if(bInv)
1725  {
1726  InvalidateSize();
1727  }
1728 }
1729 
1731 {
1732  OSL_ENSURE( ! IsVertical() || ! IsSwapped(),
1733  "SwTextFrame::CalcLineSpace with swapped frame!" );
1734 
1735  if( IsLocked() || !HasPara() )
1736  return;
1737 
1738  if( GetDrawObjs() ||
1739  GetTextNodeForParaProps()->GetSwAttrSet().GetLRSpace().IsAutoFirst())
1740  {
1741  Init();
1742  return;
1743  }
1744 
1745  SwParaPortion *const pPara(GetPara());
1746  assert(pPara);
1747  if (pPara->IsFixLineHeight())
1748  {
1749  Init();
1750  return;
1751  }
1752 
1753  Size aNewSize( getFramePrintArea().SSize() );
1754 
1755  SwTextFormatInfo aInf( getRootFrame()->GetCurrShell()->GetOut(), this );
1756  SwTextFormatter aLine( this, &aInf );
1757  if( aLine.GetDropLines() )
1758  {
1759  Init();
1760  return;
1761  }
1762 
1763  aLine.Top();
1764  aLine.RecalcRealHeight();
1765 
1766  aNewSize.setHeight( (aLine.Y() - getFrameArea().Top()) + aLine.GetLineHeight() );
1767 
1768  SwTwips nDelta = aNewSize.Height() - getFramePrintArea().Height();
1769  // Underflow with free-flying frames
1770  if( aInf.GetTextFly().IsOn() )
1771  {
1772  SwRect aTmpFrame( getFrameArea() );
1773  if( nDelta < 0 )
1774  aTmpFrame.Height( getFramePrintArea().Height() );
1775  else
1776  aTmpFrame.Height( aNewSize.Height() );
1777  if( aInf.GetTextFly().Relax( aTmpFrame ) )
1778  {
1779  Init();
1780  return;
1781  }
1782  }
1783 
1784  if( !nDelta )
1785  return;
1786 
1787  SwTextFrameBreak aBreak( this );
1788  if( GetFollow() || aBreak.IsBreakNow( aLine ) )
1789  {
1790  // if there is a Follow() or if we need to break here, reformat
1791  Init();
1792  }
1793  else
1794  {
1795  // everything is business as usual...
1796  pPara->SetPrepAdjust();
1797  pPara->SetPrep();
1798  }
1799 }
1800 
1801 static void lcl_SetWrong( SwTextFrame& rFrame, SwTextNode const& rNode,
1802  sal_Int32 const nPos, sal_Int32 const nCnt, bool const bMove)
1803 {
1804  if ( !rFrame.IsFollow() )
1805  {
1806  SwTextNode* pTextNode = const_cast<SwTextNode*>(&rNode);
1807  IGrammarContact* pGrammarContact = getGrammarContact( *pTextNode );
1808  SwGrammarMarkUp* pWrongGrammar = pGrammarContact ?
1809  pGrammarContact->getGrammarCheck( *pTextNode, false ) :
1810  pTextNode->GetGrammarCheck();
1811  bool bGrammarProxy = pWrongGrammar != pTextNode->GetGrammarCheck();
1812  if( bMove )
1813  {
1814  if( pTextNode->GetWrong() )
1815  pTextNode->GetWrong()->Move( nPos, nCnt );
1816  if( pWrongGrammar )
1817  pWrongGrammar->MoveGrammar( nPos, nCnt );
1818  if( bGrammarProxy && pTextNode->GetGrammarCheck() )
1819  pTextNode->GetGrammarCheck()->MoveGrammar( nPos, nCnt );
1820  if( pTextNode->GetSmartTags() )
1821  pTextNode->GetSmartTags()->Move( nPos, nCnt );
1822  }
1823  else
1824  {
1825  if( pTextNode->GetWrong() )
1826  pTextNode->GetWrong()->Invalidate( nPos, nCnt );
1827  if( pWrongGrammar )
1828  pWrongGrammar->Invalidate( nPos, nCnt );
1829  if( pTextNode->GetSmartTags() )
1830  pTextNode->GetSmartTags()->Invalidate( nPos, nCnt );
1831  }
1832  const sal_Int32 nEnd = nPos + (nCnt > 0 ? nCnt : 1 );
1833  if ( !pTextNode->GetWrong() && !pTextNode->IsWrongDirty() )
1834  {
1835  pTextNode->SetWrong( std::make_unique<SwWrongList>( WRONGLIST_SPELL ) );
1836  pTextNode->GetWrong()->SetInvalid( nPos, nEnd );
1837  }
1838  if ( !pTextNode->GetSmartTags() && !pTextNode->IsSmartTagDirty() )
1839  {
1840  pTextNode->SetSmartTags( std::make_unique<SwWrongList>( WRONGLIST_SMARTTAG ) );
1841  pTextNode->GetSmartTags()->SetInvalid( nPos, nEnd );
1842  }
1844  pTextNode->SetGrammarCheckDirty( true );
1845  pTextNode->SetWordCountDirty( true );
1846  pTextNode->SetAutoCompleteWordDirty( true );
1847  pTextNode->SetSmartTagDirty( true );
1848  }
1849 
1850  SwRootFrame *pRootFrame = rFrame.getRootFrame();
1851  if (pRootFrame)
1852  {
1853  pRootFrame->SetNeedGrammarCheck( true );
1854  }
1855 
1856  SwPageFrame *pPage = rFrame.FindPageFrame();
1857  if( pPage )
1858  {
1859  pPage->InvalidateSpelling();
1860  pPage->InvalidateAutoCompleteWords();
1861  pPage->InvalidateWordCount();
1862  pPage->InvalidateSmartTags();
1863  }
1864 }
1865 
1866 static void lcl_SetScriptInval(SwTextFrame& rFrame, TextFrameIndex const nPos)
1867 {
1868  if( rFrame.GetPara() )
1869  rFrame.GetPara()->GetScriptInfo().SetInvalidityA( nPos );
1870 }
1871 
1872 // note: SwClientNotify will be called once for every frame => just fix own Ofst
1873 static void lcl_ModifyOfst(SwTextFrame & rFrame,
1874  TextFrameIndex const nPos, TextFrameIndex const nLen,
1875  TextFrameIndex (* op)(TextFrameIndex const&, TextFrameIndex const&))
1876 {
1877  assert(nLen != TextFrameIndex(COMPLETE_STRING));
1878  if (rFrame.IsFollow() && nPos < rFrame.GetOffset())
1879  {
1880  rFrame.ManipOfst( std::max(nPos, op(rFrame.GetOffset(), nLen)) );
1881  assert(sal_Int32(rFrame.GetOffset()) <= rFrame.GetText().getLength());
1882  }
1883 }
1884 
1885 namespace {
1886 
1887 void UpdateMergedParaForMove(sw::MergedPara & rMerged,
1888  SwTextFrame & rTextFrame,
1889  bool & o_rbRecalcFootnoteFlag,
1890  SwTextNode const& rDestNode,
1891  SwTextNode const& rNode,
1892  sal_Int32 const nDestStart,
1893  sal_Int32 const nSourceStart,
1894  sal_Int32 const nLen)
1895 {
1896  std::vector<std::pair<sal_Int32, sal_Int32>> deleted;
1897  sal_Int32 const nSourceEnd(nSourceStart + nLen);
1898  sal_Int32 nLastEnd(0);
1899  for (const auto& rExt : rMerged.extents)
1900  {
1901  if (rExt.pNode == &rNode)
1902  {
1903  sal_Int32 const nStart(std::max(nLastEnd, nSourceStart));
1904  sal_Int32 const nEnd(std::min(rExt.nStart, nSourceEnd));
1905  if (nStart < nEnd)
1906  {
1907  deleted.emplace_back(nStart, nEnd);
1908  }
1909  nLastEnd = rExt.nEnd;
1910  if (nSourceEnd <= rExt.nEnd)
1911  {
1912  break;
1913  }
1914  }
1915  else if (rNode.GetIndex() < rExt.pNode->GetIndex())
1916  {
1917  break;
1918  }
1919  }
1920  if (nLastEnd != rNode.Len()) // without nLen, string yet to be removed
1921  {
1922  if (nLastEnd < nSourceEnd)
1923  {
1924  deleted.emplace_back(std::max(nLastEnd, nSourceStart), nSourceEnd);
1925  }
1926  }
1927  if (deleted.empty())
1928  return;
1929 
1930  o_rbRecalcFootnoteFlag = true;
1931  for (auto const& it : deleted)
1932  {
1933  sal_Int32 const nStart(it.first - nSourceStart + nDestStart);
1934  TextFrameIndex const nDeleted = UpdateMergedParaForDelete(rMerged, false,
1935  rDestNode, nStart, it.second - it.first);
1936 //FIXME asserts valid for join - but if called from split, the new node isn't there yet and it will be added later... assert(nDeleted);
1937 // assert(nDeleted == it.second - it.first);
1938  if(nDeleted)
1939  {
1940  // InvalidateRange/lcl_SetScriptInval was called sufficiently for SwInsText
1941  lcl_SetWrong(rTextFrame, rDestNode, nStart, it.first - it.second, false);
1942  TextFrameIndex const nIndex(sw::MapModelToView(rMerged, &rDestNode, nStart));
1943  lcl_ModifyOfst(rTextFrame, nIndex, nDeleted, &o3tl::operator-<sal_Int32, Tag_TextFrameIndex>);
1944  }
1945  }
1946 }
1947 
1948 } // namespace
1949 
1954 #if !ENABLE_WASM_STRIP_ACCESSIBILITY
1955 static bool isA11yRelevantAttribute(sal_uInt16 nWhich)
1956 {
1957  return nWhich != RES_CHRATR_RSID;
1958 }
1959 
1960 static bool hasA11yRelevantAttribute( const std::vector<sal_uInt16>& rWhichFmtAttr )
1961 {
1962  for( sal_uInt16 nWhich : rWhichFmtAttr )
1963  if ( isA11yRelevantAttribute( nWhich ) )
1964  return true;
1965 
1966  return false;
1967 }
1968 #endif // ENABLE_WASM_STRIP_ACCESSIBILITY
1969 
1970 // Note: for now this overrides SwClient::SwClientNotify; the intermediary
1971 // classes still override SwClient::Modify, which should continue to work
1972 // as their implementation of SwClientNotify is SwClient's which calls Modify.
1973 // Therefore we also don't need to call SwClient::SwClientNotify(rModify, rHint)
1974 // because that's all it does, and this implementation calls
1975 // SwContentFrame::SwClientNotify() when appropriate.
1976 void SwTextFrame::SwClientNotify(SwModify const& rModify, SfxHint const& rHint)
1977 {
1978  SfxPoolItem const* pOld(nullptr);
1979  SfxPoolItem const* pNew(nullptr);
1980  sw::MoveText const* pMoveText(nullptr);
1981  sw::RedlineDelText const* pRedlineDelText(nullptr);
1982  sw::RedlineUnDelText const* pRedlineUnDelText(nullptr);
1983 
1984  sal_uInt16 nWhich = 0;
1985  if (rHint.GetId() == SfxHintId::SwLegacyModify)
1986  {
1987  auto pHint = static_cast<const sw::LegacyModifyHint*>(&rHint);
1988  pOld = pHint->m_pOld;
1989  pNew = pHint->m_pNew;
1990  nWhich = pHint->GetWhich();
1991  }
1992  else if (auto const pHt = dynamic_cast<sw::MoveText const*>(&rHint))
1993  {
1994  pMoveText = pHt;
1995  }
1996  else if (auto const pHynt = dynamic_cast<sw::RedlineDelText const*>(&rHint))
1997  {
1998  pRedlineDelText = pHynt;
1999  }
2000  else if (auto const pHnt = dynamic_cast<sw::RedlineUnDelText const*>(&rHint))
2001  {
2002  pRedlineUnDelText = pHnt;
2003  }
2004  else
2005  {
2006  assert(!"unexpected hint");
2007  }
2008 
2009  if (m_pMergedPara)
2010  {
2011  assert(m_pMergedPara->listener.IsListeningTo(&rModify));
2012  }
2013 
2014  SwTextNode const& rNode(static_cast<SwTextNode const&>(rModify));
2015 
2016  // modifications concerning frame attributes are processed by the base class
2017  if( IsInRange( aFrameFormatSetRange, nWhich ) || RES_FMT_CHG == nWhich )
2018  {
2019  if (m_pMergedPara)
2020  { // ignore item set changes that don't apply
2021  SwTextNode const*const pAttrNode(
2022  (nWhich == RES_PAGEDESC || nWhich == RES_BREAK)
2023  ? m_pMergedPara->pFirstNode
2024  : m_pMergedPara->pParaPropsNode);
2025  if (pAttrNode != &rModify)
2026  {
2027  return;
2028  }
2029  }
2031  if( nWhich == RES_FMT_CHG && getRootFrame()->GetCurrShell() )
2032  {
2033  // collection has changed
2034  Prepare();
2035  InvalidatePrt_();
2036  lcl_SetWrong( *this, rNode, 0, COMPLETE_STRING, false );
2037  SetDerivedR2L( false );
2038  CheckDirChange();
2039  // Force complete paint due to existing indents.
2040  SetCompletePaint();
2042  }
2043  return;
2044  }
2045 
2046  if (m_pMergedPara && m_pMergedPara->pParaPropsNode != &rModify)
2047  {
2048  if (isPARATR(nWhich) || isPARATR_LIST(nWhich)) // FRMATR handled above
2049  {
2050  return; // ignore it
2051  }
2052  }
2053 
2054  Broadcast(SfxHint()); // notify SwAccessibleParagraph
2055 
2056  // while locked ignore all modifications
2057  if( IsLocked() )
2058  return;
2059 
2060  // save stack
2061  // warning: one has to ensure that all variables are set
2062  TextFrameIndex nPos;
2063  TextFrameIndex nLen;
2064  bool bSetFieldsDirty = false;
2065  bool bRecalcFootnoteFlag = false;
2066 
2067  if (pRedlineDelText)
2068  {
2069  if (m_pMergedPara)
2070  {
2071  sal_Int32 const nNPos = pRedlineDelText->nStart;
2072  sal_Int32 const nNLen = pRedlineDelText->nLen;
2073  nPos = MapModelToView(&rNode, nNPos);
2074  // update merged before doing anything else
2075  nLen = UpdateMergedParaForDelete(*m_pMergedPara, false, rNode, nNPos, nNLen);
2076  const sal_Int32 m = -nNLen;
2077  if (nLen && IsIdxInside(nPos, nLen))
2078  {
2079  InvalidateRange( SwCharRange(nPos, TextFrameIndex(1)), m );
2080  }
2081  lcl_SetWrong( *this, rNode, nNPos, m, false );
2082  if (nLen)
2083  {
2084  lcl_SetScriptInval( *this, nPos );
2085  bSetFieldsDirty = bRecalcFootnoteFlag = true;
2086  lcl_ModifyOfst(*this, nPos, nLen, &o3tl::operator-<sal_Int32, Tag_TextFrameIndex>);
2087  }
2088  }
2089  }
2090  else if (pRedlineUnDelText)
2091  {
2092  if (m_pMergedPara)
2093  {
2094  sal_Int32 const nNPos = pRedlineUnDelText->nStart;
2095  sal_Int32 const nNLen = pRedlineUnDelText->nLen;
2096  nPos = MapModelToView(&rNode, nNPos);
2097  nLen = UpdateMergedParaForInsert(*m_pMergedPara, false, rNode, nNPos, nNLen);
2098  if (IsIdxInside(nPos, nLen))
2099  {
2100  if (!nLen)
2101  {
2102  // Refresh NumPortions even when line is empty!
2103  if (nPos)
2104  InvalidateSize();
2105  else
2106  Prepare();
2107  }
2108  else
2109  InvalidateRange_( SwCharRange( nPos, nLen ), nNLen );
2110  }
2111  lcl_SetWrong( *this, rNode, nNPos, nNLen, false );
2112  lcl_SetScriptInval( *this, nPos );
2113  bSetFieldsDirty = true;
2114  lcl_ModifyOfst(*this, nPos, nLen, &o3tl::operator+<sal_Int32, Tag_TextFrameIndex>);
2115  }
2116  }
2117  else if (pMoveText)
2118  {
2119  if (m_pMergedPara
2120  && m_pMergedPara->pFirstNode->GetIndex() <= pMoveText->pDestNode->GetIndex()
2121  && pMoveText->pDestNode->GetIndex() <= m_pMergedPara->pLastNode->GetIndex())
2122  { // if it's not 2 nodes in merged frame, assume the target node doesn't have frames at all
2123  assert(abs(rNode.GetIndex() - pMoveText->pDestNode->GetIndex()) == SwNodeOffset(1));
2124  UpdateMergedParaForMove(*m_pMergedPara,
2125  *this,
2126  bRecalcFootnoteFlag,
2127  *pMoveText->pDestNode, rNode,
2128  pMoveText->nDestStart,
2129  pMoveText->nSourceStart,
2130  pMoveText->nLen);
2131  }
2132  else
2133  {
2134  // there is a situation where this is okay: from JoinNext, which will then call CheckResetRedlineMergeFlag, which will then create merged from scratch for this frame
2135  // assert(!m_pMergedPara || !getRootFrame()->IsHideRedlines() || !pMoveText->pDestNode->getLayoutFrame(getRootFrame()));
2136  }
2137  }
2138  else switch (nWhich)
2139  {
2140  case RES_LINENUMBER:
2141  {
2142  assert(false); // should have been forwarded to SwContentFrame
2144  }
2145  break;
2146  case RES_INS_TXT:
2147  {
2148  sal_Int32 const nNPos = static_cast<const SwInsText*>(pNew)->nPos;
2149  sal_Int32 const nNLen = static_cast<const SwInsText*>(pNew)->nLen;
2150  nPos = MapModelToView(&rNode, nNPos);
2151  // unlike redlines, inserting into fieldmark must be explicitly handled
2152  bool isHidden(false);
2153  switch (getRootFrame()->GetFieldmarkMode())
2154  {
2156  isHidden = static_cast<const SwInsText*>(pNew)->isInsideFieldmarkResult;
2157  break;
2159  isHidden = static_cast<const SwInsText*>(pNew)->isInsideFieldmarkCommand;
2160  break;
2161  case sw::FieldmarkMode::ShowBoth: // just to avoid the warning
2162  break;
2163  }
2164  if (!isHidden)
2165  {
2166  nLen = TextFrameIndex(nNLen);
2167  if (m_pMergedPara)
2168  {
2169  UpdateMergedParaForInsert(*m_pMergedPara, true, rNode, nNPos, nNLen);
2170  }
2171  if( IsIdxInside( nPos, nLen ) )
2172  {
2173  if( !nLen )
2174  {
2175  // Refresh NumPortions even when line is empty!
2176  if( nPos )
2177  InvalidateSize();
2178  else
2179  Prepare();
2180  }
2181  else
2182  InvalidateRange_( SwCharRange( nPos, nLen ), nNLen );
2183  }
2184  lcl_SetScriptInval( *this, nPos );
2185  bSetFieldsDirty = true;
2186  lcl_ModifyOfst(*this, nPos, nLen, &o3tl::operator+<sal_Int32, Tag_TextFrameIndex>);
2187  }
2188  lcl_SetWrong( *this, rNode, nNPos, nNLen, true );
2189  }
2190  break;
2191  case RES_DEL_CHR:
2192  {
2193  sal_Int32 const nNPos = static_cast<const SwDelChr*>(pNew)->nPos;
2194  nPos = MapModelToView(&rNode, nNPos);
2195  if (m_pMergedPara)
2196  {
2197  nLen = UpdateMergedParaForDelete(*m_pMergedPara, true, rNode, nNPos, 1);
2198  }
2199  else
2200  {
2201  nLen = TextFrameIndex(1);
2202  }
2203  lcl_SetWrong( *this, rNode, nNPos, -1, true );
2204  if (nLen)
2205  {
2206  InvalidateRange( SwCharRange(nPos, nLen), -1 );
2207  lcl_SetScriptInval( *this, nPos );
2208  bSetFieldsDirty = bRecalcFootnoteFlag = true;
2209  lcl_ModifyOfst(*this, nPos, nLen, &o3tl::operator-<sal_Int32, Tag_TextFrameIndex>);
2210  }
2211  }
2212  break;
2213  case RES_DEL_TXT:
2214  {
2215  sal_Int32 const nNPos = static_cast<const SwDelText*>(pNew)->nStart;
2216  sal_Int32 const nNLen = static_cast<const SwDelText*>(pNew)->nLen;
2217  nPos = MapModelToView(&rNode, nNPos);
2218  if (m_pMergedPara)
2219  { // update merged before doing anything else
2220  nLen = UpdateMergedParaForDelete(*m_pMergedPara, true, rNode, nNPos, nNLen);
2221  }
2222  else
2223  {
2224  nLen = TextFrameIndex(nNLen);
2225  }
2226  const sal_Int32 m = -nNLen;
2227  if ((!m_pMergedPara || nLen) && IsIdxInside(nPos, nLen))
2228  {
2229  if( !nLen )
2230  InvalidateSize();
2231  else
2232  InvalidateRange( SwCharRange(nPos, TextFrameIndex(1)), m );
2233  }
2234  lcl_SetWrong( *this, rNode, nNPos, m, true );
2235  if (nLen)
2236  {
2237  lcl_SetScriptInval( *this, nPos );
2238  bSetFieldsDirty = bRecalcFootnoteFlag = true;
2239  lcl_ModifyOfst(*this, nPos, nLen, &o3tl::operator-<sal_Int32, Tag_TextFrameIndex>);
2240  }
2241  }
2242  break;
2243  case RES_UPDATE_ATTR:
2244  {
2245  const SwUpdateAttr* pNewUpdate = static_cast<const SwUpdateAttr*>(pNew);
2246 
2247  sal_Int32 const nNPos = pNewUpdate->getStart();
2248  sal_Int32 const nNLen = pNewUpdate->getEnd() - nNPos;
2249  nPos = MapModelToView(&rNode, nNPos);
2250  nLen = MapModelToView(&rNode, nNPos + nNLen) - nPos;
2251  if( IsIdxInside( nPos, nLen ) )
2252  {
2253  // We need to reformat anyways, even if the invalidated
2254  // range is empty.
2255  // E.g.: empty line, set 14 pt!
2256 
2257  // FootnoteNumbers need to be formatted
2258  if( !nLen )
2259  nLen = TextFrameIndex(1);
2260 
2261  InvalidateRange_( SwCharRange( nPos, nLen) );
2262  const sal_uInt16 nTmp = pNewUpdate->getWhichAttr();
2263 
2264  if( ! nTmp || RES_TXTATR_CHARFMT == nTmp || RES_TXTATR_INETFMT == nTmp || RES_TXTATR_AUTOFMT == nTmp ||
2265  RES_FMT_CHG == nTmp || RES_ATTRSET_CHG == nTmp )
2266  {
2267  lcl_SetWrong( *this, rNode, nNPos, nNPos + nNLen, false );
2268  lcl_SetScriptInval( *this, nPos );
2269  }
2270  }
2271 
2272 #if !ENABLE_WASM_STRIP_ACCESSIBILITY
2273  if( isA11yRelevantAttribute( pNewUpdate->getWhichAttr() ) &&
2274  hasA11yRelevantAttribute( pNewUpdate->getFmtAttrs() ) )
2275  {
2276  SwViewShell* pViewSh = getRootFrame() ? getRootFrame()->GetCurrShell() : nullptr;
2277  if ( pViewSh )
2278  {
2279  pViewSh->InvalidateAccessibleParaAttrs( *this );
2280  }
2281  }
2282 #endif
2283  }
2284  break;
2285  case RES_OBJECTDYING:
2286  break;
2287 
2289  {
2290  CalcLineSpace();
2291  InvalidateSize();
2292  InvalidatePrt_();
2293  if( IsInSct() && !GetPrev() )
2294  {
2295  SwSectionFrame *pSect = FindSctFrame();
2296  if( pSect->ContainsAny() == this )
2297  pSect->InvalidatePrt();
2298  }
2299 
2300  // i#11859
2301  // (1) Also invalidate next frame on next page/column.
2302  // (2) Skip empty sections and hidden paragraphs
2303  // Thus, use method <InvalidateNextPrtArea()>
2305 
2306  SetCompletePaint();
2307  }
2308  break;
2309 
2310  case RES_TXTATR_FIELD:
2311  case RES_TXTATR_ANNOTATION:
2312  {
2313  sal_Int32 const nNPos = static_cast<const SwFormatField*>(pNew)->GetTextField()->GetStart();
2314  nPos = MapModelToView(&rNode, nNPos);
2315  if (IsIdxInside(nPos, TextFrameIndex(1)))
2316  {
2317  if( pNew == pOld )
2318  {
2319  // only repaint
2320  // opt: invalidate window?
2321  InvalidatePage();
2322  SetCompletePaint();
2323  }
2324  else
2326  }
2327  bSetFieldsDirty = true;
2328  // ST2
2329  if ( SwSmartTagMgr::Get().IsSmartTagsEnabled() )
2330  lcl_SetWrong( *this, rNode, nNPos, nNPos + 1, false );
2331  }
2332  break;
2333 
2334  case RES_TXTATR_FTN :
2335  {
2336  if (!IsInFootnote())
2337  { // the hint may be sent from the anchor node, or from a
2338  // node in the footnote; the anchor index is only valid in the
2339  // anchor node!
2340  assert(&rNode == &static_cast<const SwFormatFootnote*>(pNew)->GetTextFootnote()->GetTextNode());
2341  nPos = MapModelToView(&rNode,
2342  static_cast<const SwFormatFootnote*>(pNew)->GetTextFootnote()->GetStart());
2343  }
2344 #ifdef _MSC_VER
2345  else nPos = TextFrameIndex(42); // shut up MSVC 2017 spurious warning C4701
2346 #endif
2347  if (IsInFootnote() || IsIdxInside(nPos, TextFrameIndex(1)))
2348  Prepare( PrepareHint::FootnoteInvalidation, static_cast<const SwFormatFootnote*>(pNew)->GetTextFootnote() );
2349  break;
2350  }
2351 
2352  case RES_ATTRSET_CHG:
2353  {
2355 
2356  const SwAttrSet& rNewSet = *static_cast<const SwAttrSetChg*>(pNew)->GetChgSet();
2357  int nClear = 0;
2358  sal_uInt16 nCount = rNewSet.Count();
2359 
2360  if( const SwFormatFootnote* pItem = rNewSet.GetItemIfSet( RES_TXTATR_FTN, false ) )
2361  {
2362  nPos = MapModelToView(&rNode, pItem->GetTextFootnote()->GetStart());
2363  if (IsIdxInside(nPos, TextFrameIndex(1)))
2365  nClear = 0x01;
2366  --nCount;
2367  }
2368 
2369  if( const SwFormatField* pItem = rNewSet.GetItemIfSet( RES_TXTATR_FIELD, false ) )
2370  {
2371  nPos = MapModelToView(&rNode, pItem->GetTextField()->GetStart());
2372  if (IsIdxInside(nPos, TextFrameIndex(1)))
2373  {
2374  const SfxPoolItem* pOldItem = pOld ?
2375  &(static_cast<const SwAttrSetChg*>(pOld)->GetChgSet()->Get(RES_TXTATR_FIELD)) : nullptr;
2376  if( pItem == pOldItem )
2377  {
2378  InvalidatePage();
2379  SetCompletePaint();
2380  }
2381  else
2383  }
2384  nClear |= 0x02;
2385  --nCount;
2386  }
2387  bool bLineSpace = SfxItemState::SET == rNewSet.GetItemState(
2388  RES_PARATR_LINESPACING, false ),
2389  bRegister = SfxItemState::SET == rNewSet.GetItemState(
2390  RES_PARATR_REGISTER, false );
2391  if ( bLineSpace || bRegister )
2392  {
2393  if (!m_pMergedPara || m_pMergedPara->pParaPropsNode == &rModify)
2394  {
2396  CalcLineSpace();
2397  InvalidateSize();
2398  InvalidatePrt_();
2399 
2400  // i#11859
2401  // (1) Also invalidate next frame on next page/column.
2402  // (2) Skip empty sections and hidden paragraphs
2403  // Thus, use method <InvalidateNextPrtArea()>
2405 
2406  SetCompletePaint();
2407  }
2408  nClear |= 0x04;
2409  if ( bLineSpace )
2410  {
2411  --nCount;
2412  if ((!m_pMergedPara || m_pMergedPara->pParaPropsNode == &rModify)
2413  && IsInSct() && !GetPrev())
2414  {
2415  SwSectionFrame *pSect = FindSctFrame();
2416  if( pSect->ContainsAny() == this )
2417  pSect->InvalidatePrt();
2418  }
2419  }
2420  if ( bRegister )
2421  --nCount;
2422  }
2423  if ( SfxItemState::SET == rNewSet.GetItemState( RES_PARATR_SPLIT,
2424  false ))
2425  {
2426  if (!m_pMergedPara || m_pMergedPara->pParaPropsNode == &rModify)
2427  {
2428  if (GetPrev())
2429  CheckKeep();
2430  Prepare();
2431  InvalidateSize();
2432  }
2433  nClear |= 0x08;
2434  --nCount;
2435  }
2436 
2437  if( SfxItemState::SET == rNewSet.GetItemState( RES_BACKGROUND, false)
2438  && (!m_pMergedPara || m_pMergedPara->pParaPropsNode == &rModify)
2439  && !IsFollow() && GetDrawObjs() )
2440  {
2441  SwSortedObjs *pObjs = GetDrawObjs();
2442  for ( size_t i = 0; GetDrawObjs() && i < pObjs->size(); ++i )
2443  {
2444  SwAnchoredObject* pAnchoredObj = (*pObjs)[i];
2445  if ( auto pFly = pAnchoredObj->DynCastFlyFrame() )
2446  {
2447  if( !pFly->IsFlyInContentFrame() )
2448  {
2449  const SvxBrushItem &rBack =
2450  pFly->GetAttrSet()->GetBackground();
2451  // #GetTransChg#
2452  // following condition determines, if the fly frame
2453  // "inherites" the background color of text frame.
2454  // This is the case, if fly frame background
2455  // color is "no fill"/"auto fill" and if the fly frame
2456  // has no background graphic.
2457  // Thus, check complete fly frame background
2458  // color and *not* only its transparency value
2459  if ( (rBack.GetColor() == COL_TRANSPARENT) &&
2460  rBack.GetGraphicPos() == GPOS_NONE )
2461  {
2462  pFly->SetCompletePaint();
2463  pFly->InvalidatePage();
2464  }
2465  }
2466  }
2467  }
2468  }
2469 
2470  if ( SfxItemState::SET ==
2471  rNewSet.GetItemState( RES_TXTATR_CHARFMT, false ) )
2472  {
2473  lcl_SetWrong( *this, rNode, 0, COMPLETE_STRING, false );
2474  lcl_SetScriptInval( *this, TextFrameIndex(0) );
2475  }
2476  else if ( SfxItemState::SET ==
2477  rNewSet.GetItemState( RES_CHRATR_LANGUAGE, false ) ||
2478  SfxItemState::SET ==
2479  rNewSet.GetItemState( RES_CHRATR_CJK_LANGUAGE, false ) ||
2480  SfxItemState::SET ==
2481  rNewSet.GetItemState( RES_CHRATR_CTL_LANGUAGE, false ) )
2482  lcl_SetWrong( *this, rNode, 0, COMPLETE_STRING, false );
2483  else if ( SfxItemState::SET ==
2484  rNewSet.GetItemState( RES_CHRATR_FONT, false ) ||
2485  SfxItemState::SET ==
2486  rNewSet.GetItemState( RES_CHRATR_CJK_FONT, false ) ||
2487  SfxItemState::SET ==
2488  rNewSet.GetItemState( RES_CHRATR_CTL_FONT, false ) )
2489  lcl_SetScriptInval( *this, TextFrameIndex(0) );
2490  else if ( SfxItemState::SET ==
2491  rNewSet.GetItemState( RES_FRAMEDIR, false )
2492  && (!m_pMergedPara || m_pMergedPara->pParaPropsNode == &rModify))
2493  {
2494  SetDerivedR2L( false );
2495  CheckDirChange();
2496  // Force complete paint due to existing indents.
2497  SetCompletePaint();
2498  }
2499 
2500  if( nCount )
2501  {
2502  if( getRootFrame()->GetCurrShell() )
2503  {
2504  Prepare();
2505  InvalidatePrt_();
2506  }
2507 
2508  if (nClear || (m_pMergedPara &&
2509  (m_pMergedPara->pParaPropsNode != &rModify ||
2510  m_pMergedPara->pFirstNode != &rModify)))
2511  {
2512  assert(pOld);
2513  SwAttrSetChg aOldSet( *static_cast<const SwAttrSetChg*>(pOld) );
2514  SwAttrSetChg aNewSet( *static_cast<const SwAttrSetChg*>(pNew) );
2515 
2516  if (m_pMergedPara && m_pMergedPara->pParaPropsNode != &rModify)
2517  {
2518  for (sal_uInt16 i = RES_PARATR_BEGIN; i != RES_FRMATR_END; ++i)
2519  {
2520  if (i != RES_BREAK && i != RES_PAGEDESC)
2521  {
2522  aOldSet.ClearItem(i);
2523  aNewSet.ClearItem(i);
2524  }
2525  }
2526  for (sal_uInt16 i = XATTR_FILL_FIRST; i <= XATTR_FILL_LAST; ++i)
2527  {
2528  aOldSet.ClearItem(i);
2529  aNewSet.ClearItem(i);
2530  }
2531  }
2532  if (m_pMergedPara && m_pMergedPara->pFirstNode != &rModify)
2533  {
2534  aOldSet.ClearItem(RES_BREAK);
2535  aNewSet.ClearItem(RES_BREAK);
2536  aOldSet.ClearItem(RES_PAGEDESC);
2537  aNewSet.ClearItem(RES_PAGEDESC);
2538  }
2539 
2540  if( 0x01 & nClear )
2541  {
2542  aOldSet.ClearItem( RES_TXTATR_FTN );
2543  aNewSet.ClearItem( RES_TXTATR_FTN );
2544  }
2545  if( 0x02 & nClear )
2546  {
2547  aOldSet.ClearItem( RES_TXTATR_FIELD );
2548  aNewSet.ClearItem( RES_TXTATR_FIELD );
2549  }
2550  if ( 0x04 & nClear )
2551  {
2552  if ( bLineSpace )
2553  {
2554  aOldSet.ClearItem( RES_PARATR_LINESPACING );
2555  aNewSet.ClearItem( RES_PARATR_LINESPACING );
2556  }
2557  if ( bRegister )
2558  {
2559  aOldSet.ClearItem( RES_PARATR_REGISTER );
2560  aNewSet.ClearItem( RES_PARATR_REGISTER );
2561  }
2562  }
2563  if ( 0x08 & nClear )
2564  {
2565  aOldSet.ClearItem( RES_PARATR_SPLIT );
2566  aNewSet.ClearItem( RES_PARATR_SPLIT );
2567  }
2568  if (aOldSet.Count() || aNewSet.Count())
2569  {
2570  SwContentFrame::SwClientNotify(rModify, sw::LegacyModifyHint(&aOldSet, &aNewSet));
2571  }
2572  }
2573  else
2575  }
2576 
2577 #if !ENABLE_WASM_STRIP_ACCESSIBILITY
2578  if (isA11yRelevantAttribute(nWhich))
2579  {
2580  SwViewShell* pViewSh = getRootFrame() ? getRootFrame()->GetCurrShell() : nullptr;
2581  if ( pViewSh )
2582  {
2583  pViewSh->InvalidateAccessibleParaAttrs( *this );
2584  }
2585  }
2586 #endif
2587  }
2588  break;
2589 
2590  // Process SwDocPosUpdate
2591  case RES_DOCPOS_UPDATE:
2592  {
2593  if( pOld && pNew )
2594  {
2595  const SwDocPosUpdate *pDocPos = static_cast<const SwDocPosUpdate*>(pOld);
2596  if( pDocPos->nDocPos <= getFrameArea().Top() )
2597  {
2598  const SwFormatField *pField = static_cast<const SwFormatField *>(pNew);
2599  TextFrameIndex const nIndex(MapModelToView(&rNode,
2600  pField->GetTextField()->GetStart()));
2602  }
2603  }
2604  break;
2605  }
2606  case RES_PARATR_SPLIT:
2607  if ( GetPrev() )
2608  CheckKeep();
2609  Prepare();
2610  bSetFieldsDirty = true;
2611  break;
2612  case RES_FRAMEDIR :
2613  assert(false); // should have been forwarded to SwContentFrame
2614  SetDerivedR2L( false );
2615  CheckDirChange();
2616  break;
2617  default:
2618  {
2619  Prepare();
2620  InvalidatePrt_();
2621  if ( !nWhich )
2622  {
2623  // is called by e. g. HiddenPara with 0
2624  SwFrame *pNxt = FindNext();
2625  if ( nullptr != pNxt )
2626  pNxt->InvalidatePrt();
2627  }
2628  }
2629  } // switch
2630 
2631  if( bSetFieldsDirty )
2633 
2634  if ( bRecalcFootnoteFlag )
2635  CalcFootnoteFlag();
2636 }
2637 
2638 bool SwTextFrame::GetInfo( SfxPoolItem &rHint ) const
2639 {
2640  if ( RES_VIRTPAGENUM_INFO == rHint.Which() && IsInDocBody() && ! IsFollow() )
2641  {
2642  SwVirtPageNumInfo &rInfo = static_cast<SwVirtPageNumInfo&>(rHint);
2643  const SwPageFrame *pPage = FindPageFrame();
2644  if ( pPage )
2645  {
2646  if ( pPage == rInfo.GetOrigPage() && !GetPrev() )
2647  {
2648  // this should be the one
2649  // (could only differ temporarily; is that disturbing?)
2650  rInfo.SetInfo( pPage, this );
2651  return false;
2652  }
2653  if ( pPage->GetPhyPageNum() < rInfo.GetOrigPage()->GetPhyPageNum() &&
2654  (!rInfo.GetPage() || pPage->GetPhyPageNum() > rInfo.GetPage()->GetPhyPageNum()))
2655  {
2656  // this could be the one
2657  rInfo.SetInfo( pPage, this );
2658  }
2659  }
2660  }
2661  return true;
2662 }
2663 
2664 void SwTextFrame::PrepWidows( const sal_uInt16 nNeed, bool bNotify )
2665 {
2666  OSL_ENSURE(GetFollow() && nNeed, "+SwTextFrame::Prepare: lost all friends");
2667 
2668  SwParaPortion *pPara = GetPara();
2669  if ( !pPara )
2670  return;
2671  pPara->SetPrepWidows();
2672 
2673  sal_uInt16 nHave = nNeed;
2674 
2675  // We yield a few lines and shrink in CalcPreps()
2676  SwSwapIfNotSwapped swap( this );
2677 
2678  SwTextSizeInfo aInf( this );
2679  SwTextMargin aLine( this, &aInf );
2680  aLine.Bottom();
2681  TextFrameIndex nTmpLen = aLine.GetCurr()->GetLen();
2682  while( nHave && aLine.PrevLine() )
2683  {
2684  if( nTmpLen )
2685  --nHave;
2686  nTmpLen = aLine.GetCurr()->GetLen();
2687  }
2688 
2689  // If it's certain that we can yield lines, the Master needs
2690  // to check the widow rule
2691  if( !nHave )
2692  {
2693  bool bSplit = true;
2694  if( !IsFollow() ) // only a master decides about orphans
2695  {
2696  const WidowsAndOrphans aWidOrp( this );
2697  bSplit = ( aLine.GetLineNr() >= aWidOrp.GetOrphansLines() &&
2698  aLine.GetLineNr() >= aLine.GetDropLines() );
2699  }
2700 
2701  if( bSplit )
2702  {
2703  GetFollow()->SetOffset( aLine.GetEnd() );
2704  aLine.TruncLines( true );
2705  if( pPara->IsFollowField() )
2706  GetFollow()->SetFieldFollow( true );
2707  }
2708  }
2709  if ( bNotify )
2710  {
2711  InvalidateSize_();
2712  InvalidatePage();
2713  }
2714 }
2715 
2716 static bool lcl_ErgoVadis(SwTextFrame* pFrame, TextFrameIndex & rPos, const PrepareHint ePrep)
2717 {
2718  const SwFootnoteInfo &rFootnoteInfo = pFrame->GetDoc().GetFootnoteInfo();
2719  if( ePrep == PrepareHint::ErgoSum )
2720  {
2721  if( rFootnoteInfo.m_aErgoSum.isEmpty() )
2722  return false;
2723  rPos = pFrame->GetOffset();
2724  }
2725  else
2726  {
2727  if( rFootnoteInfo.m_aQuoVadis.isEmpty() )
2728  return false;
2729  if( pFrame->HasFollow() )
2730  rPos = pFrame->GetFollow()->GetOffset();
2731  else
2732  rPos = TextFrameIndex(pFrame->GetText().getLength());
2733  if( rPos )
2734  --rPos; // our last character
2735  }
2736  return true;
2737 }
2738 
2739 // Silence over-eager warning emitted at least by GCC 5.3.1
2740 #if defined __GNUC__ && !defined __clang__
2741 # pragma GCC diagnostic push
2742 # pragma GCC diagnostic ignored "-Wstrict-overflow"
2743 #endif
2744 bool SwTextFrame::Prepare( const PrepareHint ePrep, const void* pVoid,
2745  bool bNotify )
2746 {
2747  bool bParaPossiblyInvalid = false;
2748 
2749  SwFrameSwapper aSwapper( this, false );
2750 
2751  if ( IsEmpty() )
2752  {
2753  switch ( ePrep )
2754  {
2756  SetInvalidVert( true ); // Test
2757  [[fallthrough]];
2759  case PrepareHint::Widows:
2760  case PrepareHint::FootnoteInvalidationGone : return bParaPossiblyInvalid;
2761 
2763  {
2764  // We also need an InvalidateSize for Areas (with and without columns),
2765  // so that we format and bUndersized is set (if needed)
2766  if( IsInFly() || IsInSct() )
2767  {
2768  SwTwips nTmpBottom = GetUpper()->getFrameArea().Top() +
2770  if( nTmpBottom < getFrameArea().Bottom() )
2771  break;
2772  }
2773  // Are there any free-flying frames on this page?
2774  SwTextFly aTextFly( this );
2775  if( aTextFly.IsOn() )
2776  {
2777  // Does any free-flying frame overlap?
2778  if ( aTextFly.Relax() || IsUndersized() )
2779  break;
2780  }
2782  break;
2783 
2784  SwTextGridItem const*const pGrid(GetGridItem(FindPageFrame()));
2785  if (pGrid && GetTextNodeForParaProps()->GetSwAttrSet().GetParaGrid().GetValue())
2786  break;
2787 
2788  // i#28701 - consider anchored objects
2789  if ( GetDrawObjs() )
2790  break;
2791 
2792  return bParaPossiblyInvalid;
2793  }
2794  default:
2795  break;
2796  }
2797  }
2798 
2799  if( !HasPara() && PrepareHint::MustFit != ePrep )
2800  {
2801  SetInvalidVert( true ); // Test
2802  OSL_ENSURE( !IsLocked(), "SwTextFrame::Prepare: three of a perfect pair" );
2803  if ( bNotify )
2804  InvalidateSize();
2805  else
2806  InvalidateSize_();
2807  return bParaPossiblyInvalid;
2808  }
2809 
2810  // Get object from cache while locking
2811  SwTextLineAccess aAccess( this );
2812  SwParaPortion *pPara = aAccess.GetPara();
2813 
2814  switch( ePrep )
2815  {
2817  {
2819  aFrm.Height(0);
2820  }
2821 
2822  {
2824  aPrt.Height(0);
2825  }
2826 
2827  InvalidatePrt_();
2828  InvalidateSize_();
2829  [[fallthrough]];
2831  pPara->SetPrepAdjust();
2832  if( IsFootnoteNumFrame() != pPara->IsFootnoteNum() ||
2833  IsUndersized() )
2834  {
2836  if( GetOffset() && !IsFollow() )
2838  }
2839  break;
2840  case PrepareHint::MustFit :
2841  pPara->SetPrepMustFit(true);
2842  [[fallthrough]];
2844  pPara->SetPrepAdjust();
2845  break;
2846  case PrepareHint::Widows :
2847  // MustFit is stronger than anything else
2848  if( pPara->IsPrepMustFit() )
2849  return bParaPossiblyInvalid;
2850  // see comment in WidowsAndOrphans::FindOrphans and CalcPreps()
2851  PrepWidows( *static_cast<const sal_uInt16 *>(pVoid), bNotify );
2852  break;
2853 
2855  {
2856  SwTextFootnote const *pFootnote = static_cast<SwTextFootnote const *>(pVoid);
2857  if( IsInFootnote() )
2858  {
2859  // Am I the first TextFrame of a footnote?
2860  if( !GetPrev() )
2861  // So we're a TextFrame of the footnote, which has
2862  // to display the footnote number or the ErgoSum text
2864 
2865  if( !GetNext() )
2866  {
2867  // We're the last Footnote; we need to update the
2868  // QuoVadis texts now
2869  const SwFootnoteInfo &rFootnoteInfo = GetDoc().GetFootnoteInfo();
2870  if( !pPara->UpdateQuoVadis( rFootnoteInfo.m_aQuoVadis ) )
2871  {
2872  TextFrameIndex nPos = pPara->GetParLen();
2873  if( nPos )
2874  --nPos;
2876  }
2877  }
2878  }
2879  else
2880  {
2881  // We are the TextFrame _with_ the footnote
2882  TextFrameIndex const nPos = MapModelToView(
2883  &pFootnote->GetTextNode(), pFootnote->GetStart());
2885  }
2886  break;
2887  }
2889  {
2890  // Test
2891  {
2892  SetInvalidVert( false );
2893  bool bOld = IsVertical();
2894  SetInvalidVert( true );
2895  if( bOld != IsVertical() )
2897  }
2898 
2899  if( HasFollow() )
2900  {
2901  TextFrameIndex nNxtOfst = GetFollow()->GetOffset();
2902  if( nNxtOfst )
2903  --nNxtOfst;
2904  InvalidateRange(SwCharRange( nNxtOfst, TextFrameIndex(1)), 1);
2905  }
2906  if( IsInFootnote() )
2907  {
2908  TextFrameIndex nPos;
2909  if( lcl_ErgoVadis( this, nPos, PrepareHint::QuoVadis ) )
2911  if( lcl_ErgoVadis( this, nPos, PrepareHint::ErgoSum ) )
2913  }
2914  // If we have a page number field, we must invalidate those spots
2915  SwTextNode const* pNode(nullptr);
2916  sw::MergedAttrIter iter(*this);
2917  TextFrameIndex const nEnd = GetFollow()
2919  for (SwTextAttr const* pHt = iter.NextAttr(&pNode); pHt; pHt = iter.NextAttr(&pNode))
2920  {
2921  TextFrameIndex const nStart(MapModelToView(pNode, pHt->GetStart()));
2922  if (nStart >= GetOffset())
2923  {
2924  if (nStart >= nEnd)
2925  break;
2926 
2927  // If we're flowing back and own a Footnote, the Footnote also flows
2928  // with us. So that it doesn't obstruct us, we send ourselves
2929  // an ADJUST_FRM.
2930  // pVoid != 0 means MoveBwd()
2931  const sal_uInt16 nWhich = pHt->Which();
2932  if (RES_TXTATR_FIELD == nWhich ||
2933  (HasFootnote() && pVoid && RES_TXTATR_FTN == nWhich))
2934  InvalidateRange(SwCharRange(nStart, TextFrameIndex(1)), 1);
2935  }
2936  }
2937  // A new boss, a new chance for growing
2938  if( IsUndersized() )
2939  {
2940  InvalidateSize_();
2942  }
2943  break;
2944  }
2945 
2947  {
2948  if ( isFramePrintAreaValid() )
2949  {
2950  SwTextGridItem const*const pGrid(GetGridItem(FindPageFrame()));
2951  if (pGrid && GetTextNodeForParaProps()->GetSwAttrSet().GetParaGrid().GetValue())
2952  InvalidatePrt();
2953  }
2954 
2955  // If we don't overlap with anybody:
2956  // did any free-flying frame overlapped _before_ the position change?
2957  bool bFormat = pPara->HasFly();
2958  if( !bFormat )
2959  {
2960  if( IsInFly() )
2961  {
2962  SwTwips nTmpBottom = GetUpper()->getFrameArea().Top() +
2964  if( nTmpBottom < getFrameArea().Bottom() )
2965  bFormat = true;
2966  }
2967  if( !bFormat )
2968  {
2969  if ( GetDrawObjs() )
2970  {
2971  const size_t nCnt = GetDrawObjs()->size();
2972  for ( size_t i = 0; i < nCnt; ++i )
2973  {
2974  SwAnchoredObject* pAnchoredObj = (*GetDrawObjs())[i];
2975  // i#28701 - consider all
2976  // to-character anchored objects
2977  if ( pAnchoredObj->GetFrameFormat().GetAnchor().GetAnchorId()
2978  == RndStdIds::FLY_AT_CHAR )
2979  {
2980  bFormat = true;
2981  break;
2982  }
2983  }
2984  }
2985  if( !bFormat )
2986  {
2987  // Are there any free-flying frames on this page?
2988  SwTextFly aTextFly( this );
2989  if( aTextFly.IsOn() )
2990  {
2991  // Does any free-flying frame overlap?
2992  const bool bRelaxed = aTextFly.Relax();
2993  bFormat = bRelaxed || IsUndersized();
2994  if (bRelaxed)
2995  {
2996  // It's possible that pPara was deleted above; retrieve it again
2997  pPara = aAccess.GetPara();
2998  }
2999  }
3000  }
3001  }
3002  }
3003 
3004  if( bFormat )
3005  {
3006  if( !IsLocked() )
3007  {
3008  if( pPara->GetRepaint().HasArea() )
3009  SetCompletePaint();
3010  Init();
3011  pPara = nullptr;
3012  InvalidateSize_();
3013  }
3014  }
3015  else
3016  {
3017  if (GetTextNodeForParaProps()->GetSwAttrSet().GetRegister().GetValue())
3018  bParaPossiblyInvalid = Prepare( PrepareHint::Register, nullptr, bNotify );
3019  // The Frames need to be readjusted, which caused by changes
3020  // in position
3021  else if( HasFootnote() )
3022  {
3023  bParaPossiblyInvalid = Prepare( PrepareHint::AdjustSizeWithoutFormatting, nullptr, bNotify );
3024  InvalidateSize_();
3025  }
3026  else
3027  return bParaPossiblyInvalid; // So that there's no SetPrep()
3028 
3029  if (bParaPossiblyInvalid)
3030  {
3031  // It's possible that pPara was deleted above; retrieve it again
3032  pPara = aAccess.GetPara();
3033  }
3034 
3035  }
3036  break;
3037  }
3038  case PrepareHint::Register:
3039  if (GetTextNodeForParaProps()->GetSwAttrSet().GetRegister().GetValue())
3040  {
3041  pPara->SetPrepAdjust();
3042  CalcLineSpace();
3043 
3044  // It's possible that pPara was deleted above; retrieve it again
3045  bParaPossiblyInvalid = true;
3046  pPara = aAccess.GetPara();
3047 
3048  InvalidateSize();
3049  InvalidatePrt_();
3050  SwFrame* pNxt = GetIndNext();
3051  if ( nullptr != pNxt )
3052  {
3053  pNxt->InvalidatePrt_();
3054  if ( pNxt->IsLayoutFrame() )
3055  pNxt->InvalidatePage();
3056  }
3057  SetCompletePaint();
3058  }
3059  break;
3061  {
3062  // If a Follow is calling us, because a footnote is being deleted, our last
3063  // line has to be formatted, so that the first line of the Follow can flow up.
3064  // Which had flowed to the next page to be together with the footnote (this is
3065  // especially true for areas with columns)
3066  OSL_ENSURE( GetFollow(), "PrepareHint::FootnoteInvalidationGone may only be called by Follow" );
3067  TextFrameIndex nPos = GetFollow()->GetOffset();
3068  if( IsFollow() && GetOffset() == nPos ) // If we don't have a mass of text, we call our
3069  FindMaster()->Prepare( PrepareHint::FootnoteInvalidationGone ); // Master's Prepare
3070  if( nPos )
3071  --nPos; // The char preceding our Follow
3073  return bParaPossiblyInvalid;
3074  }
3075  case PrepareHint::ErgoSum:
3076  case PrepareHint::QuoVadis:
3077  {
3078  TextFrameIndex nPos;
3079  if( lcl_ErgoVadis( this, nPos, ePrep ) )
3081  }
3082  break;
3084  {
3085  if( pVoid )
3086  {
3087  TextFrameIndex const nWhere = CalcFlyPos( static_cast<SwFrameFormat const *>(pVoid) );
3088  OSL_ENSURE( TextFrameIndex(COMPLETE_STRING) != nWhere, "Prepare: Why me?" );
3090  return bParaPossiblyInvalid;
3091  }
3092  [[fallthrough]]; // else: continue with default case block
3093  }
3094  case PrepareHint::Clear:
3095  default:
3096  {
3097  if( IsLocked() )
3098  {
3099  if( PrepareHint::FlyFrameArrive == ePrep || PrepareHint::FlyFrameLeave == ePrep )
3100  {
3101  TextFrameIndex const nLen = (GetFollow()
3102  ? GetFollow()->GetOffset()
3104  - GetOffset();
3105  InvalidateRange( SwCharRange( GetOffset(), nLen ) );
3106  }
3107  }
3108  else
3109  {
3110  if( pPara->GetRepaint().HasArea() )
3111  SetCompletePaint();
3112  Init();
3113  pPara = nullptr;
3114  if( GetOffset() && !IsFollow() )
3115  SetOffset_( TextFrameIndex(0) );
3116  if ( bNotify )
3117  InvalidateSize();
3118  else
3119  InvalidateSize_();
3120  }
3121  return bParaPossiblyInvalid; // no SetPrep() happened
3122  }
3123  }
3124  if( pPara )
3125  {
3126  pPara->SetPrep();
3127  }
3128 
3129  return bParaPossiblyInvalid;
3130 }
3131 #if defined __GNUC__ && !defined __clang__
3132 # pragma GCC diagnostic pop
3133 #endif
3134 
3144 {
3148 public:
3149  SwTestFormat( SwTextFrame* pTextFrame, const SwFrame* pPrv, SwTwips nMaxHeight );
3150  ~SwTestFormat();
3151 };
3152 
3153 SwTestFormat::SwTestFormat( SwTextFrame* pTextFrame, const SwFrame* pPre, SwTwips nMaxHeight )
3154  : pFrame( pTextFrame )
3155 {
3158 
3159  SwRectFnSet aRectFnSet(pFrame);
3160  SwTwips nLower = aRectFnSet.GetBottomMargin(*pFrame);
3161 
3162  {
3163  // indeed, here the GetUpper()->getFramePrintArea() gets copied and manipulated
3166  aFrm += pFrame->GetUpper()->getFrameArea().Pos();
3167  aRectFnSet.SetHeight( aFrm, nMaxHeight );
3168 
3169  if( pFrame->GetPrev() )
3170  {
3171  aRectFnSet.SetPosY(
3172  aFrm,
3173  aRectFnSet.GetBottom(pFrame->GetPrev()->getFrameArea()) - ( aRectFnSet.IsVert() ? nMaxHeight + 1 : 0 ) );
3174  }
3175  }
3176 
3178  const SwBorderAttrs &rAttrs = *aAccess.Get();
3179 
3180  {
3182  aRectFnSet.SetPosX(aPrt, rAttrs.CalcLeft( pFrame ) );
3183  }
3184 
3185  if( pPre )
3186  {
3187  SwTwips nUpper = pFrame->CalcUpperSpace( &rAttrs, pPre );
3189  aRectFnSet.SetPosY(aPrt, nUpper );
3190  }
3191 
3192  {
3194  aRectFnSet.SetHeight( aPrt, std::max( tools::Long(0) , aRectFnSet.GetHeight(pFrame->getFrameArea()) - aRectFnSet.GetTop(aPrt) - nLower ) );
3195  aRectFnSet.SetWidth( aPrt, aRectFnSet.GetWidth(pFrame->getFrameArea()) - ( rAttrs.CalcLeft( pFrame ) + rAttrs.CalcRight( pFrame ) ) );
3196  }
3197 
3198  pOldPara = pFrame->HasPara() ? pFrame->GetPara() : nullptr;
3199  pFrame->SetPara( new SwParaPortion(), false );
3200  OSL_ENSURE( ! pFrame->IsSwapped(), "A frame is swapped before Format_" );
3201 
3202  if ( pFrame->IsVertical() )
3204 
3205  SwTextFormatInfo aInf( pFrame->getRootFrame()->GetCurrShell()->GetOut(), pFrame, false, true, true );
3206  SwTextFormatter aLine( pFrame, &aInf );
3207 
3208  pFrame->Format_( aLine, aInf );
3209 
3210  if ( pFrame->IsVertical() )
3212 
3213  OSL_ENSURE( ! pFrame->IsSwapped(), "A frame is swapped after Format_" );
3214 }
3215 
3217 {
3218  {
3220  aFrm.setSwRect(aOldFrame);
3221  }
3222 
3223  {
3225  aPrt.setSwRect(aOldPrt);
3226  }
3227 
3228  pFrame->SetPara( pOldPara );
3229 }
3230 
3231 bool SwTextFrame::TestFormat( const SwFrame* pPrv, SwTwips &rMaxHeight, bool &bSplit )
3232 {
3234 
3235  if( IsLocked() && GetUpper()->getFramePrintArea().Width() <= 0 )
3236  return false;
3237 
3238  SwTestFormat aSave( this, pPrv, rMaxHeight );
3239 
3240  return SwTextFrame::WouldFit( rMaxHeight, bSplit, true );
3241 }
3242 
3255 bool SwTextFrame::WouldFit( SwTwips &rMaxHeight, bool &bSplit, bool bTst )
3256 {
3257  OSL_ENSURE( ! IsVertical() || ! IsSwapped(),
3258  "SwTextFrame::WouldFit with swapped frame" );
3259  SwRectFnSet aRectFnSet(this);
3260 
3261  if( IsLocked() )
3262  return false;
3263 
3264  // it can happen that the IdleCollector removed the cached information
3265  if( !IsEmpty() )
3266  GetFormatted();
3267 
3268  // i#27801 - correction: 'short cut' for empty paragraph
3269  // can *not* be applied, if test format is in progress. The test format doesn't
3270  // adjust the frame and the printing area - see method <SwTextFrame::Format_(..)>,
3271  // which is called in <SwTextFrame::TestFormat(..)>
3272  if ( IsEmpty() && !bTst )
3273  {
3274  bSplit = false;
3275  SwTwips nHeight = aRectFnSet.IsVert() ? getFramePrintArea().SSize().Width() : getFramePrintArea().SSize().Height();
3276  if( rMaxHeight < nHeight )
3277  return false;
3278  else
3279  {
3280  rMaxHeight -= nHeight;
3281  return true;
3282  }
3283  }
3284 
3285  // GetPara can still be 0 in edge cases
3286  // We return true in order to be reformatted on the new Page
3287  OSL_ENSURE( HasPara() || IsHiddenNow(), "WouldFit: GetFormatted() and then !HasPara()" );
3288  if( !HasPara() || ( !aRectFnSet.GetHeight(getFrameArea()) && IsHiddenNow() ) )
3289  return true;
3290 
3291  // Because the Orphan flag only exists for a short moment, we also check
3292  // whether the Framesize is set to very huge by CalcPreps, in order to
3293  // force a MoveFwd
3294  if (IsWidow() || (aRectFnSet.IsVert()
3295  ? (0 == getFrameArea().Left())
3296  : (sw::WIDOW_MAGIC - 20000 < getFrameArea().Bottom())))
3297  {
3298  SetWidow(false);
3299  if ( GetFollow() )
3300  {
3301  // If we've ended up here due to a Widow request by our Follow, we check
3302  // whether there's a Follow with a real height at all.
3303  // Else (e.g. for newly created SctFrames) we ignore the IsWidow() and
3304  // still check if we can find enough room
3305  if (((!aRectFnSet.IsVert() && getFrameArea().Bottom() <= sw::WIDOW_MAGIC - 20000) ||
3306  ( aRectFnSet.IsVert() && 0 < getFrameArea().Left() ) ) &&
3307  ( GetFollow()->IsVertical() ?
3308  !GetFollow()->getFrameArea().Width() :
3309  !GetFollow()->getFrameArea().Height() ) )
3310  {
3311  SwTextFrame* pFoll = GetFollow()->GetFollow();
3312  while( pFoll &&
3313  ( pFoll->IsVertical() ?
3314  !pFoll->getFrameArea().Width() :
3315  !pFoll->getFrameArea().Height() ) )
3316  pFoll = pFoll->GetFollow();
3317  if( pFoll )
3318  return false;
3319  }
3320  else
3321  return false;
3322  }
3323  }
3324 
3325  SwSwapIfNotSwapped swap( this );
3326 
3327  SwTextSizeInfo aInf( this );
3328  SwTextMargin aLine( this, &aInf );
3329 
3330  WidowsAndOrphans aFrameBreak( this, rMaxHeight, bSplit );
3331 
3332  bool bRet = true;
3333 
3334  aLine.Bottom();
3335  // is breaking necessary?
3336  bSplit = !aFrameBreak.IsInside( aLine );
3337  if ( bSplit )
3338  bRet = !aFrameBreak.IsKeepAlways() && aFrameBreak.WouldFit( aLine, rMaxHeight, bTst );
3339  else
3340  {
3341  // we need the total height including the current line
3342  aLine.Top();
3343  do
3344  {
3345  rMaxHeight -= aLine.GetLineHeight();
3346  } while ( aLine.Next() );
3347  }
3348 
3349  return bRet;
3350 }
3351 
3353 {
3354  OSL_ENSURE( ! IsVertical() || ! IsSwapped(),
3355  "SwTextFrame::GetParHeight with swapped frame" );
3356 
3357  if( !HasPara() )
3358  { // For non-empty paragraphs this is a special case
3359  // For UnderSized we can simply just ask 1 Twip more
3360  sal_uInt16 nRet = o3tl::narrowing<sal_uInt16>(getFramePrintArea().SSize().Height());
3361  if( IsUndersized() )
3362  {
3363  if( IsEmpty() || GetText().isEmpty() )
3364  nRet = o3tl::narrowing<sal_uInt16>(EmptyHeight());
3365  else
3366  ++nRet;
3367  }
3368  return nRet;
3369  }
3370 
3371  // TODO: Refactor and improve code
3372  const SwLineLayout* pLineLayout = GetPara();
3373  SwTwips nHeight = pLineLayout ? pLineLayout->GetRealHeight() : 0;
3374 
3375  // Is this paragraph scrolled? Our height until now is at least
3376  // one line height too low then
3377  if( GetOffset() && !IsFollow() )
3378  nHeight *= 2;
3379 
3380  while ( pLineLayout && pLineLayout->GetNext() )
3381  {
3382  pLineLayout = pLineLayout->GetNext();
3383  nHeight = nHeight + pLineLayout->GetRealHeight();
3384  }
3385 
3386  return nHeight;
3387 }
3388 
3392 SwTextFrame* SwTextFrame::GetFormatted( bool bForceQuickFormat )
3393 {
3394  vcl::RenderContext* pRenderContext = getRootFrame()->GetCurrShell()->GetOut();
3395  SwSwapIfSwapped swap( this );
3396 
3397  // In case the SwLineLayout was cleared out of the s_pTextCache, recreate it
3398  // Not for empty paragraphs
3399  if( !HasPara() && !(isFrameAreaDefinitionValid() && IsEmpty()) )
3400  {
3401  // Calc() must be called, because frame position can be wrong
3402  const bool bFormat = isFrameAreaSizeValid();
3403  Calc(pRenderContext); // calls Format() if invalid
3404 
3405  // If the flags were valid (hence bFormat=true), Calc did nothing,
3406  // so Format() must be called manually in order to recreate
3407  // the SwLineLayout that has been deleted from the
3408  // SwTextFrame::s_pTextCache (hence !HasPara() above).
3409  // Optimization with FormatQuick()
3410  if( bFormat && !FormatQuick( bForceQuickFormat ) )
3411  Format(getRootFrame()->GetCurrShell()->GetOut());
3412  }
3413 
3414  return this;
3415 }
3416 
3418 {
3419  // i#31490
3420  // If we are currently locked, we better return with a
3421  // fairly reasonable value:
3422  if ( IsLocked() )
3423  return getFramePrintArea().Width();
3424 
3425  SwParaPortion* pOldPara = GetPara();
3426  SwParaPortion *pDummy = new SwParaPortion();
3427  SetPara( pDummy, false );
3428  const SwPageFrame* pPage = FindPageFrame();
3429 
3430  const Point aOldFramePos = getFrameArea().Pos();
3431  const SwTwips nOldFrameWidth = getFrameArea().Width();
3432  const SwTwips nOldPrtWidth = getFramePrintArea().Width();
3433  const SwTwips nPageWidth = GetUpper()->IsVertical() ?
3434  pPage->getFramePrintArea().Height() :
3435  pPage->getFramePrintArea().Width();
3436 
3437  {
3439  aFrm.Width( nPageWidth );
3440  }
3441 
3442  {
3444  aPrt.Width( nPageWidth );
3445  }
3446 
3447  // i#25422 objects anchored as character in RTL
3448  if ( IsRightToLeft() )
3449  {
3451  aFrm.Pos().AdjustX(nOldFrameWidth - nPageWidth );
3452  }
3453 
3454  TextFrameLockGuard aLock( this );
3455 
3456  SwTextFormatInfo aInf( getRootFrame()->GetCurrShell()->GetOut(), this, false, true, true );
3457  aInf.SetIgnoreFly( true );
3458  SwTextFormatter aLine( this, &aInf );
3459  SwHookOut aHook( aInf );
3460 
3461  // i#54031 - assure minimum of MINLAY twips.
3462  const SwTwips nMax = std::max( SwTwips(MINLAY), aLine.CalcFitToContent_() + 1 );
3463 
3464  {
3466  aFrm.Width( nOldFrameWidth );
3467 
3468  // i#25422 objects anchored as character in RTL
3469  if ( IsRightToLeft() )
3470  {
3471  aFrm.Pos() = aOldFramePos;
3472  }
3473  }
3474 
3475  {
3477  aPrt.Width( nOldPrtWidth );
3478  }
3479 
3480  SetPara( pOldPara );
3481 
3482  return nMax;
3483 }
3484 
3492 {
3493  if ( IsLocked() )
3494  return;
3495 
3496  // reset additional first line offset
3498 
3499  const SwTextNode* pTextNode( GetTextNodeForParaProps() );
3500  // sw_redlinehide: check that pParaPropsNode is the correct one
3501  assert(pTextNode->IsNumbered(getRootFrame()) == pTextNode->IsNumbered(nullptr));
3502  if (!(pTextNode->IsNumbered(getRootFrame()) &&
3503  pTextNode->IsCountedInList() && pTextNode->GetNumRule()))
3504  return;
3505 
3506  int nListLevel = pTextNode->GetActualListLevel();
3507 
3508  if (nListLevel < 0)
3509  nListLevel = 0;
3510 
3511  if (nListLevel >= MAXLEVEL)
3512  nListLevel = MAXLEVEL - 1;
3513 
3514  const SwNumFormat& rNumFormat =
3515  pTextNode->GetNumRule()->Get( o3tl::narrowing<sal_uInt16>(nListLevel) );
3517  return;
3518 
3519  // keep current paragraph portion and apply dummy paragraph portion
3520  SwParaPortion* pOldPara = GetPara();
3521  SwParaPortion *pDummy = new SwParaPortion();
3522  SetPara( pDummy, false );
3523 
3524  // lock paragraph
3525  TextFrameLockGuard aLock( this );
3526 
3527  // simulate text formatting
3528  SwTextFormatInfo aInf( getRootFrame()->GetCurrShell()->GetOut(), this, false, true, true );
3529  aInf.SetIgnoreFly( true );
3530  SwTextFormatter aLine( this, &aInf );
3531  SwHookOut aHook( aInf );
3532  aLine.CalcFitToContent_();
3533 
3534  // determine additional first line offset
3535  const SwLinePortion* pFirstPortion = aLine.GetCurr()->GetFirstPortion();
3536  if ( pFirstPortion->InNumberGrp() && !pFirstPortion->IsFootnoteNumPortion() )
3537  {
3538  SwTwips nNumberPortionWidth( pFirstPortion->Width() );
3539 
3540  const SwLinePortion* pPortion = pFirstPortion->GetNextPortion();
3541  while ( pPortion &&
3542  pPortion->InNumberGrp() && !pPortion->IsFootnoteNumPortion())
3543  {
3544  nNumberPortionWidth += pPortion->Width();
3545  pPortion = pPortion->GetNextPortion();
3546  }
3547 
3548  if ( ( IsRightToLeft() &&
3549  rNumFormat.GetNumAdjust() == SvxAdjust::Left ) ||
3550  ( !IsRightToLeft() &&
3551  rNumFormat.GetNumAdjust() == SvxAdjust::Right ) )
3552  {
3553  mnAdditionalFirstLineOffset = -nNumberPortionWidth;
3554  }
3555  else if ( rNumFormat.GetNumAdjust() == SvxAdjust::Center )
3556  {
3557  mnAdditionalFirstLineOffset = -(nNumberPortionWidth/2);
3558  }
3559  }
3560 
3561  // restore paragraph portion
3562  SetPara( pOldPara );
3563 }
3564 
3577 void SwTextFrame::CalcHeightOfLastLine( const bool _bUseFont )
3578 {
3579  // i#71281
3580  // Invalidate printing area, if height of last line changes
3581  const SwTwips nOldHeightOfLastLine( mnHeightOfLastLine );
3582 
3583  // determine output device
3584  SwViewShell* pVsh = getRootFrame()->GetCurrShell();
3585  OSL_ENSURE( pVsh, "<SwTextFrame::_GetHeightOfLastLineForPropLineSpacing()> - no SwViewShell" );
3586 
3587  // i#78921
3588  // There could be no <SwViewShell> instance in the case of loading a binary
3589  // StarOffice file format containing an embedded Writer document.
3590  if ( !pVsh )
3591  {
3592  return;
3593  }
3594  OutputDevice* pOut = pVsh->GetOut();
3595  const IDocumentSettingAccess *const pIDSA = &GetDoc().getIDocumentSettingAccess();
3596  if ( !pVsh->GetViewOptions()->getBrowseMode() ||
3597  pVsh->GetViewOptions()->IsPrtFormat() )
3598  {
3600  }
3601  OSL_ENSURE( pOut, "<SwTextFrame::_GetHeightOfLastLineForPropLineSpacing()> - no OutputDevice" );
3602 
3603  if ( !pOut )
3604  {
3605  return;
3606  }
3607 
3608  // determine height of last line
3609  if ( _bUseFont || pIDSA->get(DocumentSettingId::OLD_LINE_SPACING ) )
3610  {
3611  // former determination of last line height for proportional line
3612  // spacing - take height of font set at the paragraph
3613  // FIXME actually... must the font match across all nodes?
3614  SwFont aFont( &GetTextNodeForParaProps()->GetSwAttrSet(), pIDSA );
3615 
3616  // we must ensure that the font is restored correctly on the OutputDevice
3617  // otherwise Last!=Owner could occur
3618  if ( pLastFont )
3619  {
3620  SwFntObj *pOldFont = pLastFont;
3621  pLastFont = nullptr;
3622  aFont.SetFntChg( true );
3623  aFont.ChgPhysFnt( pVsh, *pOut );
3624  mnHeightOfLastLine = aFont.GetHeight( pVsh, *pOut );
3625  assert(pLastFont && "coverity[var_deref_model] - pLastFont should be set in SwSubFont::ChgFnt");
3626  pLastFont->Unlock();
3627  pLastFont = pOldFont;
3628  pLastFont->SetDevFont( pVsh, *pOut );
3629  }
3630  else
3631  {
3632  vcl::Font aOldFont = pOut->GetFont();
3633  aFont.SetFntChg( true );
3634  aFont.ChgPhysFnt( pVsh, *pOut );
3635  mnHeightOfLastLine = aFont.GetHeight( pVsh, *pOut );
3636  assert(pLastFont && "coverity[var_deref_model] - pLastFont should be set in SwSubFont::ChgFnt");
3637  pLastFont->Unlock();
3638  pLastFont = nullptr;
3639  pOut->SetFont( aOldFont );
3640  }
3641  }
3642  else
3643  {
3644  // new determination of last line height - take actually height of last line
3645  // i#89000
3646  // assure same results, if paragraph is undersized
3647  if ( IsUndersized() )
3648  {
3649  mnHeightOfLastLine = 0;
3650  }
3651  else
3652  {
3653  bool bCalcHeightOfLastLine = true;
3654  if ( ( !HasPara() && IsEmpty( ) ) || GetText().isEmpty() )
3655  {
3657  bCalcHeightOfLastLine = false;
3658  }
3659 
3660  if ( bCalcHeightOfLastLine )
3661  {
3662  OSL_ENSURE( HasPara(),
3663  "<SwTextFrame::CalcHeightOfLastLine()> - missing paragraph portions." );
3664  const SwLineLayout* pLineLayout = GetPara();
3665  while ( pLineLayout && pLineLayout->GetNext() )
3666  {
3667  // iteration to last line
3668  pLineLayout = pLineLayout->GetNext();
3669  }
3670  if ( pLineLayout )
3671  {
3672  SwTwips nAscent, nDescent, nDummy1, nDummy2;
3673  // i#47162 - suppress consideration of
3674  // fly content portions and the line portion.
3675  pLineLayout->MaxAscentDescent( nAscent, nDescent,
3676  nDummy1, nDummy2,
3677  nullptr, true );
3678  // i#71281
3679  // Suppress wrong invalidation of printing area, if method is
3680  // called recursive.
3681  // Thus, member <mnHeightOfLastLine> is only set directly, if
3682  // no recursive call is needed.
3683  const SwTwips nNewHeightOfLastLine = nAscent + nDescent;
3684  // i#47162 - if last line only contains
3685  // fly content portions, <mnHeightOfLastLine> is zero.
3686  // In this case determine height of last line by the font
3687  if ( nNewHeightOfLastLine == 0 )
3688  {
3689  CalcHeightOfLastLine( true );
3690  }
3691  else
3692  {
3693  mnHeightOfLastLine = nNewHeightOfLastLine;
3694  }
3695  }
3696  }
3697  }
3698  }
3699  // i#71281
3700  // invalidate printing area, if height of last line changes
3701  if ( mnHeightOfLastLine != nOldHeightOfLastLine )
3702  {
3703  InvalidatePrt();
3704  }
3705 }
3706 
3716 tools::Long SwTextFrame::GetLineSpace( const bool _bNoPropLineSpace ) const
3717 {
3718  tools::Long nRet = 0;
3719 
3721 
3722  switch( rSpace.GetInterLineSpaceRule() )
3723  {
3724  case SvxInterLineSpaceRule::Prop:
3725  {
3726  if ( _bNoPropLineSpace )
3727  {
3728  break;
3729  }
3730 
3731  // i#11860 - adjust spacing implementation for object positioning
3732  // - compatibility to MS Word
3733  nRet = GetHeightOfLastLine();
3734 
3735  tools::Long nTmp = nRet;
3736  nTmp *= rSpace.GetPropLineSpace();
3737  nTmp /= 100;
3738  nTmp -= nRet;
3739  if ( nTmp > 0 )
3740  nRet = nTmp;
3741  else
3742  nRet = 0;
3743  }
3744  break;
3745  case SvxInterLineSpaceRule::Fix:
3746  {
3747  if ( rSpace.GetInterLineSpace() > 0 )
3748  nRet = rSpace.GetInterLineSpace();
3749  }
3750  break;
3751  default:
3752  break;
3753  }
3754  return nRet;
3755 }
3756 
3758 {
3759  if ( !HasPara() )
3760  {
3761  if( IsEmpty() && isFrameAreaDefinitionValid() )
3762  return IsVertical() ? o3tl::narrowing<sal_uInt16>(getFramePrintArea().Width()) : o3tl::narrowing<sal_uInt16>(getFramePrintArea().Height());
3763  return USHRT_MAX;
3764  }
3765  const SwParaPortion *pPara = GetPara();
3766  if ( !pPara )
3767  return USHRT_MAX;
3768 
3769  return pPara->Height();
3770 }
3771 
3773 {
3774  sal_uInt16 nRet = 0;
3775  SwTextFrame *pFrame = this;
3776  do
3777  {
3778  pFrame->GetFormatted();
3779  if( !pFrame->HasPara() )
3780  break;
3781  SwTextSizeInfo aInf( pFrame );
3782  SwTextMargin aLine( pFrame, &aInf );
3783  if (TextFrameIndex(COMPLETE_STRING) == nPos)
3784  aLine.Bottom();
3785  else
3786  aLine.CharToLine( nPos );
3787  nRet = nRet + aLine.GetLineNr();
3788  pFrame = pFrame->GetFollow();
3789  } while ( pFrame && pFrame->GetOffset() <= nPos );
3790  return nRet;
3791 }
3792 
3794 {
3795  // not necessary to format here (GetFormatted etc.), because we have to come from there!
3796  sal_uInt32 nNew = 0;
3797  const SwLineNumberInfo &rInf = GetDoc().GetLineNumberInfo();
3798  if ( !GetText().isEmpty() && HasPara() )
3799  {
3800  SwTextSizeInfo aInf( this );
3801  SwTextMargin aLine( this, &aInf );
3802  if ( rInf.IsCountBlankLines() )
3803  {
3804  aLine.Bottom();
3805  nNew = aLine.GetLineNr();
3806  }
3807  else
3808  {
3809  do
3810  {
3811  if( aLine.GetCurr()->HasContent() )
3812  ++nNew;
3813  } while ( aLine.NextLine() );
3814  }
3815  }
3816  else if ( rInf.IsCountBlankLines() )
3817  nNew = 1;
3818 
3819  if ( nNew == mnThisLines )
3820  return;
3821 
3823  {
3825  mnThisLines = nNew;
3827  SwFrame *pNxt = GetNextContentFrame();
3828  while( pNxt && pNxt->IsInTab() )
3829  {
3830  pNxt = pNxt->FindTabFrame();
3831  if( nullptr != pNxt )
3832  pNxt = pNxt->FindNextCnt();
3833  }
3834  if( pNxt )
3835  pNxt->InvalidateLineNum();
3836 
3837  // Extend repaint to the bottom.
3838  if ( HasPara() )
3839  {
3840  SwRepaint& rRepaint = GetPara()->GetRepaint();
3841  rRepaint.Bottom( std::max( rRepaint.Bottom(),
3843  }
3844  }
3845  else // Paragraphs which are not counted should not manipulate the AllLines.
3846  mnThisLines = nNew;
3847 }
3848 
3850 {
3851  ValidateLineNum();
3852 
3853  if ( IsInTab() )
3854  return;
3855 
3856  const sal_uLong nOld = GetAllLines();
3858  sal_uLong nNewNum;
3859  const bool bRestart = GetDoc().GetLineNumberInfo().IsRestartEachPage();
3860 
3861  if ( !IsFollow() && rLineNum.GetStartValue() && rLineNum.IsCount() )
3862  nNewNum = rLineNum.GetStartValue() - 1;
3863  // If it is a follow or not has not be considered if it is a restart at each page; the
3864  // restart should also take effect at follows.
3865  else if ( bRestart && FindPageFrame()->FindFirstBodyContent() == this )
3866  {
3867  nNewNum = 0;
3868  }
3869  else
3870  {
3872  while ( pPrv &&
3873  (pPrv->IsInTab() || pPrv->IsInDocBody() != IsInDocBody()) )
3874  pPrv = pPrv->GetPrevContentFrame();
3875 
3876  // i#78254 Restart line numbering at page change
3877  // First body content may be in table!
3878  if ( bRestart && pPrv && pPrv->FindPageFrame() != FindPageFrame() )
3879  pPrv = nullptr;
3880 
3881  nNewNum = pPrv ? static_cast<SwTextFrame*>(pPrv)->GetAllLines() : 0;
3882  }
3883  if ( rLineNum.IsCount() )
3884  nNewNum += GetThisLines();
3885 
3886  if ( nOld == nNewNum )
3887  return;
3888 
3889  mnAllLines = nNewNum;
3891  while ( pNxt &&
3892  (pNxt->IsInTab() || pNxt->IsInDocBody() != IsInDocBody()) )
3893  pNxt = pNxt->GetNextContentFrame();
3894  if ( pNxt )
3895  {
3896  if ( pNxt->GetUpper() != GetUpper() )
3897  pNxt->InvalidateLineNum();
3898  else
3899  pNxt->InvalidateLineNum_();
3900  }
3901 }
3902 
3904 {
3905  const SwParaPortion* pPara = isFrameAreaDefinitionValid() ? GetPara() : nullptr;
3906 
3907  if (pPara)
3908  {
3909  if ( IsFollow() )
3910  rPH.Skip( GetOffset() );
3911 
3912  const SwLineLayout* pLine = pPara;
3913  while ( pLine )
3914  {
3915  const SwLinePortion* pPor = pLine->GetFirstPortion();
3916  while ( pPor )
3917  {
3918  pPor->HandlePortion( rPH );
3919  pPor = pPor->GetNextPortion();
3920  }
3921 
3922  rPH.LineBreak(pLine->Width());
3923  pLine = pLine->GetNext();
3924  }
3925  }
3926 
3927  rPH.Finish();
3928 }
3929 
3931 {
3932  const SwParaPortion* pPara = GetPara();
3933  return pPara ? &pPara->GetScriptInfo() : nullptr;
3934 }
3935 
3939 static SwTwips lcl_CalcFlyBasePos( const SwTextFrame& rFrame, SwRect aFlyRect,
3940  SwTextFly const & rTextFly )
3941 {
3942  SwRectFnSet aRectFnSet(&rFrame);
3943  SwTwips nRet = rFrame.IsRightToLeft() ?
3944  aRectFnSet.GetRight(rFrame.getFrameArea()) :
3945  aRectFnSet.GetLeft(rFrame.getFrameArea());
3946 
3947  do
3948  {
3949  SwRect aRect = rTextFly.GetFrame( aFlyRect );
3950  if ( 0 != aRectFnSet.GetWidth(aRect) )
3951  {
3952  if ( rFrame.IsRightToLeft() )
3953  {
3954  if ( aRectFnSet.GetRight(aRect) -
3955  aRectFnSet.GetRight(aFlyRect) >= 0 )
3956  {
3957  aRectFnSet.SetRight(
3958 aFlyRect, aRectFnSet.GetLeft(aRect) );
3959  nRet = aRectFnSet.GetLeft(aRect);
3960  }
3961  else
3962  break;
3963  }
3964  else
3965  {
3966  if ( aRectFnSet.GetLeft(aFlyRect) -
3967  aRectFnSet.GetLeft(aRect) >= 0 )
3968  {
3969  aRectFnSet.SetLeft(
3970 aFlyRect, aRectFnSet.GetRight(aRect) + 1 );
3971  nRet = aRectFnSet.GetRight(aRect);
3972  }
3973  else
3974  break;
3975  }
3976  }
3977  else
3978  break;
3979  }
3980  while ( aRectFnSet.GetWidth(aFlyRect) > 0 );
3981 
3982  return nRet;
3983 }
3984 
3986 {
3987  OSL_ENSURE( !IsVertical() || !IsSwapped(),
3988  "SwTextFrame::CalcBasePosForFly with swapped frame!" );
3989 
3990  if (!GetDoc().getIDocumentSettingAccess().get(DocumentSettingId::ADD_FLY_OFFSETS))
3991  return;
3992 
3993  SwRectFnSet aRectFnSet(this);
3994 
3995  SwRect aFlyRect( getFrameArea().Pos() + getFramePrintArea().Pos(), getFramePrintArea().SSize() );
3996 
3997  // Get first 'real' line and adjust position and height of line rectangle.
3998  // Correct behaviour if no 'real' line exists
3999  // (empty paragraph with and without a dummy portion)
4000  SwTwips nFlyAnchorVertOfstNoWrap = 0;
4001  {
4002  SwTwips nTop = aRectFnSet.GetTop(aFlyRect);
4003  const SwLineLayout* pLay = GetPara();
4004  SwTwips nLineHeight = 200;
4005  while( pLay && pLay->IsDummy() && pLay->GetNext() )
4006  {
4007  nTop += pLay->Height();
4008  nFlyAnchorVertOfstNoWrap += pLay->Height();
4009  pLay = pLay->GetNext();
4010  }
4011  if ( pLay )
4012  {
4013  nLineHeight = pLay->Height();
4014  }
4015  aRectFnSet.SetTopAndHeight( aFlyRect, nTop, nLineHeight );
4016  }
4017 
4018  SwTextFly aTextFly( this );
4019  aTextFly.SetIgnoreCurrentFrame( true );
4020  aTextFly.SetIgnoreContour( true );
4021  // ignore objects in page header|footer for
4022  // text frames not in page header|footer
4023  aTextFly.SetIgnoreObjsInHeaderFooter( true );
4024  SwTwips nRet1 = lcl_CalcFlyBasePos( *this, aFlyRect, aTextFly );
4025  aTextFly.SetIgnoreCurrentFrame( false );
4026  SwTwips nRet2 = lcl_CalcFlyBasePos( *this, aFlyRect, aTextFly );
4027 
4028  // make values relative to frame start position
4029  SwTwips nLeft = IsRightToLeft() ?
4030  aRectFnSet.GetRight(getFrameArea()) :
4031  aRectFnSet.GetLeft(getFrameArea());
4032 
4033  mnFlyAnchorOfst = nRet1 - nLeft;
4034  mnFlyAnchorOfstNoWrap = nRet2 - nLeft;
4035 
4036  if (!GetDoc().getIDocumentSettingAccess().get(DocumentSettingId::ADD_VERTICAL_FLY_OFFSETS))
4037  return;
4038 
4039  if (mnFlyAnchorOfstNoWrap > 0)
4040  mnFlyAnchorVertOfstNoWrap = nFlyAnchorVertOfstNoWrap;
4041 }
4042 
4043 SwTwips SwTextFrame::GetBaseVertOffsetForFly(bool bIgnoreFlysAnchoredAtThisFrame) const
4044 {
4045  return bIgnoreFlysAnchoredAtThisFrame ? 0 : mnFlyAnchorVertOfstNoWrap;
4046 }
4047 
4052 {
4054  for( const SwTextFrame *pFrame = aIter.First(); pFrame; pFrame = aIter.Next() )
4055  {
4056  SwRect aRec( pFrame->GetPaintArea() );
4057  const SwRootFrame *pRootFrame = pFrame->getRootFrame();
4058  SwViewShell *pCurShell = pRootFrame ? pRootFrame->GetCurrShell() : nullptr;
4059  if( pCurShell )
4060  pCurShell->InvalidateWindows( aRec );
4061  }
4062 }
4063 
4065 {
4066  if (pWrtSh && pWrtSh->GetViewOptions()->IsShowOutlineContentVisibilityButton() &&
4068  {
4069  SwEditWin& rEditWin = pWrtSh->GetView().GetEditWin();
4070  SwFrameControlsManager& rMngr = rEditWin.GetFrameControlsManager();
4072  }
4073 }
4074 
4075 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void HideHidden()
Removes Textfrm's attachments, when it's hidden.
Definition: txtfrm.cxx:1446
void SetWordCountDirty(bool bNew) const
Definition: txtedt.cxx:2297
vcl::RenderContext * GetOut() const
Definition: viewsh.hxx:339
void SetHasRotatedPortions(bool bHasRotatedPortions)
Definition: txtftn.cxx:97
bool GetValue() const
SwFntObj * pLastFont
Definition: fntcache.cxx:67
void CalcAdditionalFirstLineOffset()
Simulate format for a list item paragraph, whose list level attributes are in LABEL_ALIGNMENT mode...
Definition: txtfrm.cxx:3491
SwNodeOffset min(const SwNodeOffset &a, const SwNodeOffset &b)
Definition: nodeoffset.hxx:35
virtual void Height(const SwTwips nNew, const bool bText=true) override
Definition: porlay.cxx:225
void Init()
This is public, as it needs to be called by some methods in order to save the Prepare USE WITH CAUTIO...
Definition: txtfrm.cxx:753
bool HasContent() const
Definition: porlay.hxx:133
Base class for the following contact objects (frame + draw objects).
Definition: dcontact.hxx:66
Base class of the Writer layout elements.
Definition: frame.hxx:314
Represents the visualization of a paragraph.
Definition: txtfrm.hxx:162
constexpr TypedWhichId< SvxFrameDirectionItem > RES_FRAMEDIR(120)
constexpr TypedWhichId< SwFormatPageDesc > RES_PAGEDESC(93)
void SwitchVerticalToHorizontal(SwRect &rRect) const
Calculates the coordinates of a rectangle when switching from vertical to horizontal layout...
Definition: txtfrm.cxx:583
LanguageType nOldLanguageType
Definition: txtfrm.hxx:948
tools::Long GetRight(const SwRect &rRect) const
Definition: frame.hxx:1379
SwTwips GetParHeight() const
Returns the sum of line height in pLine.
Definition: txtfrm.cxx:3352
bool IsFootnoteNum() const
Definition: porlay.hxx:319
SwTwips GetBaseVertOffsetForFly(bool bIgnoreFlysAnchoredAtThisFrame) const
Definition: txtfrm.cxx:4043
void Right(const tools::Long nRight)
Definition: swrect.hxx:202
SwTextNode const *const m_pNode
Definition: txtfrm.hxx:991
sal_Int32 nIndex
void Add(SwClient *pDepend)
Definition: calbck.cxx:172
bool IsFollow() const
Definition: flowfrm.hxx:166
const SwSortedObjs * GetDrawObjs() const
Definition: frame.hxx:564
sal_uInt16 GetPropLineSpace() const
void SetWrong(std::unique_ptr< SwWrongList > pNew)
Definition: txtedt.cxx:2212
void SetIgnoreCurrentFrame(bool bNew)
Definition: txtfly.hxx:367
SwTwips EmptyHeight() const
Definition: porrst.cxx:311
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
sal_uInt16 GetLineNr() const
Definition: itrtxt.hxx:87
Marks a position in the document model.
Definition: pam.hxx:36
SwTextNode const & GetAttrMerged(SfxItemSet &rFormatSet, SwTextNode const &rNode, SwRootFrame const *pLayout)
Definition: txtfrm.cxx:373
void SetPrepAdjust()
Definition: porlay.hxx:311
constexpr TypedWhichId< SvxFontItem > RES_CHRATR_CTL_FONT(27)
SwContentFrame * GetNextContentFrame() const
Definition: cntfrm.hxx:115
const SwField * GetField() const
Definition: fmtfld.hxx:116
static SwTwips lcl_CalcFlyBasePos(const SwTextFrame &rFrame, SwRect aFlyRect, SwTextFly const &rTextFly)
Helper function for SwTextFrame::CalcBasePosForFly()
Definition: txtfrm.cxx:3939
SwContentNode * GetNode(SwPaM &rPam, bool &rbFirst, SwMoveFnCollection const &fnMove, bool const bInReadOnly, SwRootFrame const *const i_pLayout)
This function returns the next node in direction of search.
Definition: pam.cxx:821
bool IsInDocBody() const
Definition: frame.hxx:943
const SwPageFrame * GetOrigPage() const
Definition: hints.hxx:327
bool IsInFly() const
Definition: frame.hxx:961
bool IsInRange(const WhichRangesContainer &pRange, const sal_uInt16 nId)
check if ID is in range of attribute set IDs
Definition: swatrset.cxx:434
sal_Int32 nSourceStart
Definition: hints.hxx:114
void SetPosY(SwRect &rRect, tools::Long nNew) const
Definition: frame.hxx:1400
#define LANGUAGE_ARABIC_SAUDI_ARABIA
SwRect aOldPrt
Definition: txtfrm.cxx:3147
bool IsInSct() const
Definition: frame.hxx:967
LanguageType GetLangOfChar(TextFrameIndex nIndex, sal_uInt16 nScript, bool bNoChar=false) const
Definition: txtfrm.cxx:1346
const SwTwips WIDOW_MAGIC
Definition: txtfrm.hxx:1026
SwDigitModeModifier(const OutputDevice &rOutp, LanguageType eCurLang)
Definition: txtfrm.cxx:727
const OutputDevice & rOut
Definition: txtfrm.hxx:947
const SwLineNumberInfo & GetLineNumberInfo() const
Definition: lineinfo.cxx:49
#define LANGUAGE_ENGLISH_US
SwView * GetActiveView()
Definition: swmodul1.cxx:116
SwLineLayout * GetNext()
Definition: porlay.hxx:159
const OUString & GetText() const
Definition: ndtxt.hxx:218
bool IsSwapped() const
Definition: txtfrm.hxx:539
bool IsOutline() const
Returns if this text node is an outline.
Definition: ndtxt.cxx:4030
bool IsWrongDirty() const
Definition: txtedt.cxx:2323
const SwLineLayout * NextLine()
Definition: itrtxt.cxx:124
bool InNumberGrp() const
Definition: porlin.hxx:106
constexpr TypedWhichId< SwFormatChg > RES_FMT_CHG(162)
SwpHints * GetpSwpHints()
Definition: ndtxt.hxx:226
std::string GetValue
bool HasPara() const
Definition: txtfrm.hxx:823
IDocumentDeviceAccess const & getIDocumentDeviceAccess() const
Definition: doc.cxx:238
void CalcBaseOfstForFly()
Definition: txtfrm.cxx:3985
void InvalidateAccessibleParaAttrs(const SwTextFrame &rTextFrame)
invalidate attributes for paragraphs and paragraph's characters
Definition: viewsh.cxx:2623
void Move(sal_Int32 nPos, sal_Int32 nDiff)
Change all values after the given position.
Definition: wrong.cxx:266
void Left(const tools::Long nLeft)
Definition: swrect.hxx:197
SwNodeIndex nNode
Definition: pam.hxx:38
GPOS_NONE
virtual SwGrammarMarkUp * getGrammarCheck(SwTextNode &rTextNode, bool bCreate)=0
getGrammarCheck checks if the given text node is blocked by the current cursor if not...
void SetCompletePaint() const
Definition: frame.hxx:994
SwParaPortion * GetPara()
Definition: txtcache.cxx:50
bool IsInFootnote() const
Definition: frame.hxx:949
void SwitchHorizontalToVertical(SwRect &rRect) const
Calculates the coordinates of a rectangle when switching from horizontal to vertical layout...
Definition: txtfrm.cxx:476
static void repaintTextFrames(const SwTextNode &rNode)
Repaint all text frames of the given text node.
Definition: txtfrm.cxx:4051
bool FrameContainsNode(SwContentFrame const &rFrame, SwNodeOffset nNodeIndex)
Definition: txtfrm.cxx:290
void SetNeedGrammarCheck(bool bVal)
Definition: rootfrm.hxx:262
void setSwRect(const SwRect &rNew)
Definition: frame.hxx:198
void SetDerivedR2L(bool bNew)
Definition: frame.hxx:632
SwTwips CalcFitToContent()
Simulates a formatting as if there were not right margin or Flys or other obstacles and returns the w...
Definition: txtfrm.cxx:3417
virtual sal_Int32 Len() const override
Definition: ndtxt.cxx:277
sal_uIntPtr sal_uLong
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_LANGUAGE(10)
long Long
constexpr::Color COL_TRANSPARENT(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
const SwRect & getFramePrintArea() const
Definition: frame.hxx:180
virtual bool Prepare(const PrepareHint ePrep=PrepareHint::Clear, const void *pVoid=nullptr, bool bNotify=true) override
SwContentFrame: the shortcut for the Frames If the void* casts wrongly, it's its own fault! The void*...
Definition: txtfrm.cxx:2744
virtual bool GetInfo(SfxPoolItem &) const override
Definition: txtfrm.cxx:2638
void InvalidateLineNum_()
Definition: frame.hxx:795
The SwPortionHandler interface implements a visitor for the layout engine's text portions.
#define MINLAY
Definition: swtypes.hxx:62
void SetInvalidityA(const TextFrameIndex nPos)
Definition: scriptinfo.hxx:113
SwRect aOldFrame
Definition: txtfrm.cxx:3147
SwTextFrame(SwTextNode *const, SwFrame *, sw::FrameMode eMode)
Definition: txtfrm.cxx:767
static SwCache & GetCache()
Definition: frame.hxx:521
SwTextNode const * GetTextNodeForFirstText() const
Definition: txtfrm.cxx:1320
constexpr TypedWhichId< SwRegisterItem > RES_PARATR_REGISTER(71)
tools::Long CalcRight(const SwFrame *pCaller) const
Definition: frmtool.cxx:2309
sw::MergedPara * GetMergedPara()
Definition: txtfrm.hxx:454
The purpose of this class is to be the universal interface between formatting/text output and the pos...
Definition: txtfly.hxx:121
SwContentFrame * getLayoutFrame(const SwRootFrame *, const SwPosition *pPos=nullptr, std::pair< Point, bool > const *pViewPosAndCalcFrame=nullptr) const
Definition: node.cxx:1210
void InvalidateSize_()
Definition: frame.hxx:771
Definition: doc.hxx:187
constexpr sal_uInt16 RES_FRMATR_END(133)
sal_uInt32 mnThisLines
Definition: txtfrm.hxx:180
TElementType * Next()
Definition: calbck.hxx:364
bool HasFollow() const
Definition: flowfrm.hxx:165
constexpr sal_uInt8 MAXLEVEL
Definition: swtypes.hxx:92
SwParaPortion * GetPara()
Definition: txtcache.cxx:90
SwTextAttr const * PrevAttr(SwTextNode const **ppNode=nullptr)
Definition: txtfrm.cxx:228
void SetIgnoreFly(const bool bNew)
Definition: inftxt.hxx:571
constexpr TypedWhichId< SvxFormatBreakItem > RES_BREAK(94)
SwNode & GetNode() const
Definition: ndindex.hxx:128
void CharToLine(TextFrameIndex)
Definition: itrtxt.cxx:193
void Format_(vcl::RenderContext *pRenderContext, SwParaPortion *pPara)
Definition: frmform.cxx:1732
SwEditWin & GetEditWin()
Definition: view.hxx:416
bool IsVert() const
Definition: frame.hxx:1366
sal_Int32 nStart
Definition: hints.hxx:134
const SwLineLayout * Next()
Definition: itrtxt.cxx:107
bool IsSmartTagDirty() const
Definition: txtedt.cxx:2349
void HideAndShowObjects()
Hides respectively shows objects, which are anchored at paragraph, at/as a character of the paragraph...
Definition: txtfrm.cxx:1552
void Pos(const Point &rNew)
Definition: swrect.hxx:171
constexpr TypedWhichId< SwInsText > RES_INS_TXT(164)
bool WouldFit(SwTextMargin &rLine, SwTwips &rMaxHeight, bool bTest)
Definition: widorp.cxx:528
Dialog to specify the properties of date form field.
SwFrame * FindNext()
Definition: frame.hxx:1141
virtual void Calc(vcl::RenderContext *pRenderContext) const
Definition: trvlfrm.cxx:1788
void MaxAscentDescent(SwTwips &_orAscent, SwTwips &_orDescent, SwTwips &_orObjAscent, SwTwips &_orObjDescent, const SwLinePortion *_pDontConsiderPortion=nullptr, const bool _bNoFlyCntPorAndLinePor=false) const
determine ascent and descent for positioning of as-character anchored object
Definition: porlay.cxx:749
bool IsKeepAlways() const
Definition: widorp.hxx:38
Of course Writer needs its own rectangles.
Definition: swrect.hxx:34
const OUString & GetText() const
Returns the text portion we want to edit (for inline see underneath)
Definition: txtfrm.cxx:1296
tools::Long GetWidth(const SwRect &rRect) const
Definition: frame.hxx:1380
SwNodeOffset abs(const SwNodeOffset &a)
Definition: nodeoffset.hxx:34
bool IsShowHiddenPara() const
Definition: viewopt.hxx:397
bool IsCountBlankLines() const
Definition: lineinfo.hxx:83
SwTwips Y() const
Definition: itrtxt.hxx:90
void SetGrammarCheckDirty(bool bNew) const
Definition: txtedt.cxx:2328
The root element of a Writer document layout.
Definition: rootfrm.hxx:81
SwTextNode * pNode
Definition: txtfrm.hxx:88
WhichRangesContainer const aFrameFormatSetRange(svl::Items< RES_FRMATR_BEGIN, RES_FRMATR_END-1, RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1, XATTR_FILL_FIRST, XATTR_FILL_LAST >)
Collection of SwLineLayout instances, represents the paragraph text in Writer layout.
Definition: porlay.hxx:250
sal_uInt16 GetOrphansLines() const
Definition: widorp.hxx:61
void SetPara(SwParaPortion *pNew, bool bDelete=true)
Definition: txtcache.cxx:129
const SwTwips nDocPos
Definition: hints.hxx:248
int GetActualListLevel() const
Returns the actual list level of this text node, when it is a list item.
Definition: ndtxt.cxx:4140
constexpr TypedWhichId< SvxFontItem > RES_CHRATR_FONT(7)
void ValidateLineNum()
Definition: frame.hxx:760
bool TestFormat(const SwFrame *pPrv, SwTwips &nMaxHeight, bool &bSplit)
The WouldFit equivalent for temporarily rewired TextFrames nMaxHeight returns the required size here ...
Definition: txtfrm.cxx:3231
SfxHintId GetId() const
bool isFrameAreaDefinitionValid() const
Definition: frame.hxx:171
TextFrameIndex & Start()
Definition: porlay.hxx:45
void SetOutlineContentVisibilityButton(const SwContentFrame *pContentFrame)
virtual void SwClientNotify(const SwModify &, const SfxHint &) override
Definition: wsfrm.cxx:2340
constexpr TypedWhichId< SwFlyFrameFormat > RES_FLYFRMFMT(156)
SwTextAttr const * NextAttr(SwTextNode const **ppNode=nullptr)
Definition: txtfrm.cxx:91
void CalcFootnoteFlag(TextFrameIndex nStop=TextFrameIndex(COMPLETE_STRING))
Does the Frame have a local footnote (in this Frame or Follow)?
Definition: txtftn.cxx:103
void CheckDirChange()
checks the layout direction and invalidates the lower frames recursively, if necessary.
Definition: ssfrm.cxx:194
bool IsVertLRBT() const
Definition: frame.hxx:983
virtual void Finish()=0
end of paragraph.
bool FormatQuick(bool bForceQuickFormat)
Definition: frmform.cxx:2020
sal_uInt16 GetPhyPageNum() const
Definition: pagefrm.hxx:204
bool IsHiddenNow() const
Hidden.
Definition: txtfrm.cxx:1363
tools::Long GetTop(const SwRect &rRect) const
Definition: frame.hxx:1376
Used by the UI to modify the document model.
Definition: wrtsh.hxx:96
void CalcLineSpace()
Definition: txtfrm.cxx:1730
IDocumentFieldsAccess const & getIDocumentFieldsAccess() const
Definition: doc.cxx:357
#define CH_TXTATR_BREAKWORD
Definition: hintids.hxx:173
sal_Int32 nDestStart
Definition: hints.hxx:113
SwRect GetFrame(const SwRect &rPortion) const
Definition: txtfly.hxx:362
const SwRegisterItem & GetRegister(bool=true) const
Definition: paratr.hxx:198
bool IsFieldName() const
Definition: viewopt.hxx:269
SwTwips CalcUpperSpace(const SwBorderAttrs *pAttrs=nullptr, const SwFrame *pPr=nullptr, const bool _bConsiderGrid=true) const
method to determine the upper space hold by the frame
Definition: flowfrm.cxx:1457
IGrammarContact * getGrammarContact(const SwTextNode &rTextNode)
getGrammarContact() delivers the grammar contact of the document (for a given textnode) ...
Definition: docnew.cxx:806
sal_uInt16 sal_Unicode
void InvalidateNextPrtArea()
method to invalidate printing area of next frame #i11859#
Definition: findfrm.cxx:1336
wrapper class for the positioning of Writer fly frames and drawing objects
std::vector< std::pair< SwTextNode const *, SwTextAttr const * > > m_Hints
Definition: txtfrm.hxx:1008
bool IsRestartEachPage() const
Definition: lineinfo.hxx:89
sal_Int32 getEnd() const
Definition: hints.hxx:212
const SwScriptInfo * GetScriptInfo() const
Returns the script info stored at the paraportion.
Definition: txtfrm.cxx:3930
SvxGraphicPosition GetGraphicPos() const
void RemoveFromListRLHidden()
Definition: ndtxt.cxx:4368
const SwView & GetView() const
Definition: wrtsh.hxx:437
SwFrameControlsManager & GetFrameControlsManager()
Definition: edtwin.cxx:6705
void SortIfNeedBe() const
Trigger the sorting if necessary.
Definition: ndhints.hxx:176
const SwPageFrame * GetPage() const
Definition: hints.hxx:326
constexpr sal_uInt16 RES_PARATR_BEGIN(RES_TXTATR_END)
new delete redline is created
Definition: hints.hxx:121
constexpr TypedWhichId< SwDocPosUpdate > RES_DOCPOS_UPDATE(169)
constexpr TypedWhichId< SwFormatFootnote > RES_TXTATR_FTN(59)
SwIndex nContent
Definition: pam.hxx:39
const SwRect & getFrameArea() const
Definition: frame.hxx:179
const SwTextField * GetTextField() const
Definition: fmtfld.hxx:134
bool getBrowseMode() const
Definition: viewopt.hxx:472
vcl::text::ComplexTextLayoutFlags m_nOldLayoutMode
Definition: txtfrm.hxx:937
size_t pos
const vcl::Font & GetFont() const
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_CTL_LANGUAGE(29)
A wrapper around SfxPoolItem to store the start position of (usually) a text portion, with an optional end.
Definition: txatbase.hxx:43
sal_uLong GetThisLines() const
Definition: txtfrm.hxx:672
bool IsInTab() const
Definition: frame.hxx:955
std::unique_ptr< sw::MergedPara > CheckParaRedlineMerge(SwTextFrame &rFrame, SwTextNode &rTextNode, FrameMode eMode)
Definition: redlnitr.cxx:208
void SetInfo(const SwPageFrame *pPg, const SwFrame *pF)
Definition: hints.hxx:329
sal_Int32 nEnd
Definition: txtfrm.hxx:90
static bool IsFuzzing()
SwTestFormat(SwTextFrame *pTextFrame, const SwFrame *pPrv, SwTwips nMaxHeight)
Definition: txtfrm.cxx:3153
int nCount
void SetDelta(tools::Long nDelta)
Definition: porlay.hxx:289
bool IsTextFrame() const
Definition: frame.hxx:1234
sal_uInt16 GetCacheIdx() const
Definition: txtfrm.hxx:617
sal_Int32 GetStart() const
Definition: txatbase.hxx:88
void SetFntChg(const bool bNew)
Definition: swfont.hxx:209
TextFrameIndex UpdateMergedParaForDelete(MergedPara &rMerged, bool isRealDelete, SwTextNode const &rNode, sal_Int32 nIndex, sal_Int32 nLen)
Definition: txtfrm.cxx:1035
oslFileHandle & pOut
void InitScriptInfo(const SwTextNode &rNode, sw::MergedPara const *pMerged, bool bRTL)
Definition: porlay.cxx:1064
bool HasFly() const
Definition: porlay.hxx:302
void Width(tools::Long nNew)
Definition: swrect.hxx:189
const SwTextFrame * pFrame
Definition: txtfrm.hxx:927
const OutputDevice & m_rOut
Definition: txtfrm.hxx:936
virtual ~SwTextFrame() override
Definition: txtfrm.cxx:895
virtual void LineBreak(sal_Int32 nWidth)=0
line break.
sal_uLong GetStartValue() const
Definition: fmtline.hxx:57
constexpr TypedWhichId< SwFormatCharFormat > RES_TXTATR_CHARFMT(52)
Describes parts of multiple text nodes, which will form a text frame, even when redlines are hidden a...
Definition: txtfrm.hxx:960
SwContentFrame * GetPrevContentFrame() const
Definition: cntfrm.hxx:123
constexpr TypedWhichId< SwFormatAutoFormat > RES_TXTATR_AUTOFMT(50)
void ChgPhysFnt(SwViewShell const *pSh, OutputDevice &rOut)
Definition: swfont.cxx:893
tools::Long GetLeft(const SwRect &rRect) const
Definition: frame.hxx:1378
void SetWrongDirty(WrongState eNew) const
Definition: txtedt.cxx:2310
size_type size() const
sal_Int32 getStart() const
Definition: hints.hxx:207
virtual void MoveObjToVisibleLayer(SdrObject *_pDrawObj)
method to move drawing object to corresponding visible layer
Definition: dcontact.cxx:210
static void lcl_ModifyOfst(SwTextFrame &rFrame, TextFrameIndex const nPos, TextFrameIndex const nLen, TextFrameIndex(*op)(TextFrameIndex const &, TextFrameIndex const &))
Definition: txtfrm.cxx:1873
SwTextFrame * GetFollow()
Definition: txtfrm.hxx:859
TextFrameIndex GetOffset() const
Definition: txtfrm.hxx:442
constexpr TypedWhichId< SwFormatINetFormat > RES_TXTATR_INETFMT(51)
FrameMode
Definition: txtfrm.hxx:105
void SetIgnoreObjsInHeaderFooter(const bool bNew)
Definition: txtfly.hxx:377
std::vector< Extent > extents
Definition: txtfrm.hxx:963
bool IsFollowField() const
Definition: porlay.hxx:314
bool IsShowOutlineContentVisibilityButton() const
Definition: viewopt.cxx:99
static bool isA11yRelevantAttribute(sal_uInt16 nWhich)
Related: fdo#56031 filter out attribute changes that don't matter for humans/a11y to stop flooding th...
Definition: txtfrm.cxx:1955
void MoveGrammar(sal_Int32 nPos, sal_Int32 nDiff)
void PrepWidows(const sal_uInt16 nNeed, bool bNotify)
Definition: txtfrm.cxx:2664
exports com.sun.star. text
const Color & GetColor() const
bool IsEmpty() const
Definition: txtfrm.hxx:525
void ResetPreps()
Definition: txtfrm.cxx:1354
Describes a part of a single text node, which will be part of a text frame, even when redlines are hi...
Definition: txtfrm.hxx:86
void swap(cow_wrapper< T, P > &a, cow_wrapper< T, P > &b)
SwTextNode * GetTextNodeFirst()
Definition: txtfrm.hxx:461
void SetInvalidVert(bool bNew)
Definition: frame.hxx:630
bool IsInDtor() const
Definition: frame.hxx:892
SwTextNode const * GetTextNodeForParaProps() const
Definition: txtfrm.cxx:1306
void InvalidateAutoCompleteWords() const
Definition: pagefrm.hxx:393
SwTwips mnFlyAnchorOfst
Definition: txtfrm.hxx:184
delete redline is removed
Definition: hints.hxx:131
void SetIgnoreContour(bool bNew)
Definition: txtfly.hxx:372
SwTextFootnote * SeekEntry(const SwNodeIndex &rIdx, size_t *pPos=nullptr) const
Definition: ftnidx.cxx:409
constexpr TypedWhichId< SwFormatField > RES_TXTATR_FIELD(RES_TXTATR_NOEND_BEGIN)
bool IsFootnoteNumPortion() const
Definition: porlin.hxx:125
sal_uInt16 ClearItem(sal_uInt16 nWhich=0)
Style of a layout element.
Definition: frmfmt.hxx:59
bool IsWidow() const
Definition: txtfrm.hxx:523
SwTwips CalcFitToContent_()
Definition: itrform2.cxx:2103
PrepareHint
Definition: swtypes.hxx:193
void Bottom()
Definition: itrtxt.cxx:185
TextFrameIndex MapModelToViewPos(SwPosition const &rPos) const
Definition: txtfrm.cxx:1270
#define SW_MOD()
Definition: swmodule.hxx:255
constexpr TypedWhichId< SwUpdateAttr > RES_UPDATE_ATTR(167)
void InvalidateLineNum()
Definition: frame.hxx:1050
bool IsDummy() const
Definition: porlay.hxx:151
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
void InvalidatePrt()
Definition: frame.hxx:1036
void InvalidateSpelling() const
Definition: pagefrm.hxx:384
sw::BroadcastingModify * GetDep()
use these so we can grep for SwFrame's GetRegisteredIn accesses beware that SwTextFrame may return sw...
Definition: frame.hxx:476
const SwFormatAnchor & GetAnchor(bool=true) const
Definition: fmtanchr.hxx:81
int i
ComplexTextLayoutFlags
void SetSmartTagDirty(bool bNew) const
Definition: txtedt.cxx:2341
Collection of SwLinePortion instances, representing one line of text.
Definition: porlay.hxx:78
SwTwips GetRealHeight() const
Definition: porlay.hxx:169
SwDoc & GetDoc()
Definition: node.hxx:213
bool IsInside(SwTextMargin const &rLine) const
BP 18.6.93: Widows.
Definition: widorp.cxx:102
void Top()
Definition: itrtxt.hxx:99
SwFrame * GetIndNext()
Definition: frame.hxx:727
Window class for the Writer edit area, this is the one handling mouse and keyboard events and doing t...
Definition: edtwin.hxx:59
SwIndex & Assign(SwIndexReg *, sal_Int32)
Definition: index.cxx:206
RndStdIds GetAnchorId() const
Definition: fmtanchr.hxx:65
static SwSmartTagMgr & Get()
size_t size() const
Definition: sortedobjs.cxx:43
SwTextFly & GetTextFly()
Definition: inftxt.hxx:384
Mutex aLock
tools::Long CalcLeft(const SwFrame *pCaller) const
Definition: frmtool.cxx:2371
SwPageFrame * FindPageFrame()
Definition: frame.hxx:680
constexpr TypedWhichId< SwFormatFlyCnt > RES_TXTATR_FLYCNT(58)
sal_uLong GetAllLines() const
For displaying the line numbers.
Definition: txtfrm.hxx:671
Helper class which can be used instead of the macros if a function has too many returns.
Definition: txtfrm.hxx:925
SwCharRange & GetReformat()
Definition: porlay.hxx:287
RndStdIds GetAnchorId() const
Definition: dcontact.hxx:145
void RecalcRealHeight()
Definition: itrform2.cxx:1864
Count
TextFrameIndex MapModelToView(MergedPara const &, SwTextNode const *pNode, sal_Int32 nIndex)
Definition: txtfrm.cxx:1186
void UpdateOutlineContentVisibilityButton(SwWrtShell *pWrtSh) const
Definition: txtfrm.cxx:4064
SwContentFrame * FindNextCnt(const bool _bInSameFootnote=false)
Definition: findfrm.cxx:215
TElementType * First()
Definition: calbck.hxx:356
SwTextGridItem const * GetGridItem(SwPageFrame const *const)
Definition: pagechg.cxx:2589
void ManipOfst(TextFrameIndex const nNewOfst)
Definition: txtfrm.hxx:445
SwContentNode * GetContentNode()
Definition: node.hxx:625
SwNodeOffset GetIndex() const
Definition: node.hxx:292
void InvalidatePage(const SwPageFrame *pPage=nullptr) const
Invalidates the page in which the Frame is currently placed.
Definition: wsfrm.cxx:607
SwLinePortion * GetFirstPortion() const
Definition: porlay.cxx:827
tools::Long GetHeight(const SwRect &rRect) const
Definition: frame.hxx:1381
sal_uInt16 Count() const
void InvalidateRange(const SwCharRange &, const tools::Long=0)
Definition: txtfrm.cxx:1690
iterate SwTextAttr in potentially merged text frame
Definition: txtfrm.hxx:987
std::pair< SwTextNode *, sal_Int32 > MapViewToModel(MergedPara const &, TextFrameIndex nIndex)
Definition: txtfrm.cxx:1167
constexpr TypedWhichId< SwVirtPageNumInfo > RES_VIRTPAGENUM_INFO(180)
void SetAutoCompleteWordDirty(bool bNew) const
Definition: txtedt.cxx:2354
void SetRight(SwRect &rRect, tools::Long nNew) const
Definition: frame.hxx:1388
virtual const SwFlyFrame * DynCastFlyFrame() const
SwLayoutFrame * GetUpper()
Definition: frame.hxx:678
bool HasArea() const
Definition: swrect.hxx:300
constexpr sal_uInt16 XATTR_FILL_FIRST(XATTRSET_LINE+1)
bool Relax(const SwRect &rRect)
If there is no flying object frame standing in rRect (usually the current row), then we are turning o...
Definition: txtfly.hxx:324
void SetOffset_(TextFrameIndex nNewOfst)
Definition: frmform.cxx:766
void InvalidateSmartTags() const
Definition: pagefrm.hxx:389
constexpr TypedWhichId< SwAttrSetChg > RES_ATTRSET_CHG(163)
bool isFramePrintAreaValid() const
Definition: frame.hxx:168
SwGrammarMarkUp * GetGrammarCheck()
Definition: txtedt.cxx:2257
bool IsUndersized() const
Definition: flowfrm.hxx:158
SwTextNode * pParaPropsNode
most paragraph properties are taken from the first non-empty node
Definition: txtfrm.hxx:968
SwNumRule * GetNumRule(bool bInParent=true) const
Returns numbering rule of this text node.
Definition: ndtxt.cxx:2834
virtual void HandlePortion(SwPortionHandler &rPH) const
Definition: porlin.cxx:316
virtual bool SetFieldsDirty(bool b, const SwNode *pChk, SwNodeOffset nLen)=0
void Invalidate(sal_Int32 nBegin, sal_Int32 nEnd)
Definition: wrong.cxx:425
Provides access to settings of a document.
bool IsNoTextNode() const
Definition: node.hxx:658
SvxInterLineSpaceRule GetInterLineSpaceRule() const
SwFrame * GetPrev()
Definition: frame.hxx:677
SwTextFrame * GetFormatted(bool bForceQuickFormat=false)
In case the SwLineLayout was cleared out of the s_pTextCache, recreate it.
Definition: txtfrm.cxx:3392
constexpr TypedWhichId< SvxLineSpacingItem > RES_PARATR_LINESPACING(RES_PARATR_BEGIN)
void SetSmartTags(std::unique_ptr< SwWrongList > pNew)
Definition: txtedt.cxx:2267
void RemoveFootnotesForNode(SwRootFrame const &rLayout, SwTextNode const &rTextNode, std::vector< std::pair< sal_Int32, sal_Int32 >> const *const pExtents)
Definition: txtfrm.cxx:807
void Modify(bool bChgToRTL)
Definition: txtfrm.cxx:714
SwWrongList * GetSmartTags()
Definition: txtedt.cxx:2287
Marks a node in the document model.
Definition: ndindex.hxx:30
SvxAdjust GetNumAdjust() const
sal_Int32 nLen
Definition: hints.hxx:115
void RecalcAllLines()
Definition: txtfrm.cxx:3849
void RemoveFromCache()
Removes this frame completely from the Cache.
Definition: txtcache.cxx:120
const SvxLineSpacingItem & GetLineSpacing(bool=true) const
Definition: paratr.hxx:192
text is moved into pDestNode
Definition: hints.hxx:109
void TruncLines(bool bNoteFollow=false)
Definition: itrtxt.cxx:330
OUString mergedText
note: cannot be const currently to avoid UB because SwTextGuess::Guess const_casts it and modifies it...
Definition: txtfrm.hxx:966
SwTextNode * pDestNode
Definition: hints.hxx:112
void SSize(const Size &rNew)
Definition: swrect.hxx:180
bool IsLocked() const
Definition: txtfrm.hxx:521
int FieldCanHideParaWeight(SwFieldIds eFieldId) const
Definition: doc.cxx:1333
TextFrameIndex GetParLen() const
Definition: porlay.cxx:2562
bool isFrameAreaSizeValid() const
Definition: frame.hxx:167
static void lcl_SetScriptInval(SwTextFrame &rFrame, TextFrameIndex const nPos)
Definition: txtfrm.cxx:1866
SvxNumPositionAndSpaceMode GetPositionAndSpaceMode() const
TextFrameIndex GetLen() const
Definition: porlin.hxx:76
void CalcHeightOfLastLine(const bool _bUseFont=false)
method to determine height of last line, needed for proportional line spacing
Definition: txtfrm.cxx:3577
A page of the document layout.
Definition: pagefrm.hxx:57
SfxItemPool * GetPool() const
SwTextFrame * MakeTextFrame(SwTextNode &rNode, SwFrame *, sw::FrameMode eMode)
Definition: txtfrm.cxx:801
std::pair< SwTextNode *, sal_Int32 > MapViewToModel(TextFrameIndex nIndex) const
map position in potentially merged text frame to SwPosition
Definition: txtfrm.cxx:1234
tools::Long SwTwips
Definition: swtypes.hxx:51
void InvalidateWindows(const SwRect &rRect)
Definition: viewsh.cxx:556
virtual void Format(vcl::RenderContext *pRenderContext, const SwBorderAttrs *pAttrs=nullptr) override
Definition: frmform.cxx:1791
short GetInterLineSpace() const
sal_Int32 nStart
Definition: hints.hxx:124
< purpose of derivation from SwClient: character style for displaying the numbers.
Definition: lineinfo.hxx:37
SwBorderAttrs * Get()
Definition: frmtool.cxx:2681
SwTextNode * GetParaPropsNode(SwRootFrame const &rLayout, SwNodeIndex const &rNode)
Definition: txtfrm.cxx:330
bool isPARATR(const sal_uInt16 nWhich)
Definition: hintids.hxx:495
SwFieldType * GetTyp() const
Definition: fldbas.hxx:398
void InvalidateSize()
Definition: frame.hxx:1029
SwSectionFrame * FindSctFrame()
Definition: frame.hxx:1115
const SwNodeIndex * GetContentIdx() const
Definition: fmtcntnt.hxx:46
MergedAttrIterByEnd(SwTextFrame const &rFrame)
Definition: txtfrm.cxx:151
constexpr TypedWhichId< SvxRsidItem > RES_CHRATR_RSID(39)
constexpr TypedWhichId< SwFormatField > RES_TXTATR_ANNOTATION(60)
SwPosition GetParaPropsPos(SwRootFrame const &rLayout, SwPosition const &rPos)
Definition: txtfrm.cxx:344
bool RemoveFootnote(const SwContentFrame *, const SwTextFootnote *, bool bPrep=true)
Definition: ftnfrm.cxx:1734
void SwitchLTRtoRTL(SwRect &rRect) const
Calculates the coordinates of a rectangle when switching from LTR to RTL layout.
Definition: txtfrm.cxx:686
sal_uInt16 Which() const
for Querying of Writer-functions.
Definition: format.hxx:82
Base class for anything that can be part of a line in the Writer layout.
Definition: porlin.hxx:51
const SwNumFormat & Get(sal_uInt16 i) const
Definition: number.cxx:86
bool IsFootnoteNumFrame() const
Am I a FootnoteFrame, with a number at the start of the paragraph?
Definition: txtfrm.hxx:626
void SetTopAndHeight(SwRect &rRect, tools::Long nTop, tools::Long nHeight) const
Definition: frame.hxx:1427
sal_uInt16 Count() const
Definition: hints.hxx:307
void SetPosX(SwRect &rRect, tools::Long nNew) const
Definition: frame.hxx:1399
bool IsLayoutFrame() const
Definition: frame.hxx:1170
bool IsPrepMustFit() const
Definition: porlay.hxx:310
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
void Bottom(const tools::Long nBottom)
Definition: swrect.hxx:211
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:79
void Broadcast(const SfxHint &rHint)
sal_uInt16 GetLineCount(TextFrameIndex nPos)
Determines the line count.
Definition: txtfrm.cxx:3772
void SetDevFont(const SwViewShell *pSh, OutputDevice &rOut)
Definition: fntcache.cxx:575
bool IsBreakNow(SwTextMargin &rLine)
Definition: widorp.cxx:218
#define LANGUAGE_ENGLISH
void SetWidth(SwRect &rRect, tools::Long nNew) const
Definition: frame.hxx:1389
bool IsVertLR() const
Definition: frame.hxx:979
An SwTextAttr container, stores all directly formatted text portions for a text node.
Definition: ndhints.hxx:67
constexpr TypedWhichId< SvxBrushItem > RES_BACKGROUND(105)
SwTwips Width() const
Definition: possiz.hxx:51
tools::Long GetBottomMargin(const SwFrame &rFrame) const
Definition: frame.hxx:1403
SwTwips mnAdditionalFirstLineOffset
Definition: txtfrm.hxx:197
bool UpdateQuoVadis(std::u16string_view rQuo)
Is called in SwTextFrame::Prepare()
Definition: txtftn.cxx:1568
void CheckKeep()
Definition: flowfrm.cxx:146
void SetOffset(TextFrameIndex nNewOfst)
Definition: txtfrm.hxx:869
constexpr TypedWhichId< SvxFormatSplitItem > RES_PARATR_SPLIT(65)
virtual SwFrameFormat & GetFrameFormat()=0
#define SAL_WARN_IF(condition, area, stream)
SwTextFrame * FindMaster() const
Definition: flowfrm.cxx:737
constexpr tools::Long Height() const
bool IsNumbered(SwRootFrame const *pLayout=nullptr) const
Returns is this text node is numbered.
Definition: ndtxt.cxx:2902
SwRepaint & GetRepaint()
Definition: porlay.hxx:285
void ClearPara()
Removes the Line information from the Cache but retains the entry itself.
Definition: txtcache.cxx:104
const SwViewOption * GetViewOptions() const
Definition: viewsh.hxx:428
vcl::Window * GetWin() const
Definition: viewsh.hxx:338
const SwFrame * ContainsAny(const bool _bInvestigateFootnoteForSections=false) const
Method doesn't investigate content of footnotes by default.
Definition: findfrm.cxx:129
void SetFont(const vcl::Font &rNewFont)
tools::Long GetLineSpace(const bool _bNoPropLineSpacing=false) const
Returns the additional line spacing for the next paragraph.
Definition: txtfrm.cxx:3716
SwTextNode const *const m_pNode
Definition: txtfrm.hxx:1009
MergedAttrIterBase(SwTextFrame const &rFrame)
Definition: txtfrm.cxx:83
static TextFrameIndex UpdateMergedParaForInsert(MergedPara &rMerged, bool const isRealInsert, SwTextNode const &rNode, sal_Int32 const nIndex, sal_Int32 const nLen)
Definition: txtfrm.cxx:904
void SetFieldFollow(const bool bNew)
Definition: txtfrm.hxx:252
TextFrameIndex MapModelToView(SwTextNode const *pNode, sal_Int32 nIndex) const
Definition: txtfrm.cxx:1255
sal_Int32 GetIndex() const
Definition: index.hxx:91
bool IsCountedInList() const
Definition: ndtxt.cxx:4277
void SetHeight(SwRect &rRect, tools::Long nNew) const
Definition: frame.hxx:1390
bool IsNoTextFrame() const
Definition: frame.hxx:1238
SwTwips GetHeightOfLastLine() const
Definition: txtfrm.hxx:771
void SetMergedPara(std::unique_ptr< sw::MergedPara > p)
Definition: txtfrm.cxx:1277
void SwapWidthAndHeight()
Swaps width and height of the text frame.
Definition: txtfrm.cxx:423
LanguageType GetAppLanguage()
Definition: init.cxx:725
IDocumentSettingAccess const & getIDocumentSettingAccess() const
Definition: doc.cxx:176
constexpr TypedWhichId< SvxFontItem > RES_CHRATR_CJK_FONT(22)
SwTwips mnFlyAnchorOfstNoWrap
Definition: txtfrm.hxx:186
bool IsRightToLeft() const
Definition: frame.hxx:987
std::unique_ptr< sw::MergedPara > m_pMergedPara
redline merge data
Definition: txtfrm.hxx:200
void Top(const tools::Long nTop)
Definition: swrect.hxx:206
bool FieldHidesPara(const SwField &rField) const
Definition: doc.cxx:1348
static TextFrameIndex FindBrk(const OUString &rText, TextFrameIndex nStart, TextFrameIndex nEnd)
Returns the first possible break point in the current line.
Definition: txtfrm.cxx:1636
sal_Int32 nLen
Definition: hints.hxx:125
Organizer of the contact between SwTextNodes and grammar checker.
SwFrameType mnFrameType
Definition: frame.hxx:414
sal_Int32 nStart
Definition: txtfrm.hxx:89
TextFrameIndex CalcFlyPos(SwFrameFormat const *pSearch)
Calculates the position of FlyInContentFrames.
Definition: porfly.cxx:184
SwWrongList * GetWrong()
Definition: txtedt.cxx:2229
virtual OutputDevice * getReferenceDevice(bool bCreate) const =0
Returns the current reference device.
MergedAttrIterReverse(SwTextFrame const &rFrame)
Definition: txtfrm.cxx:203
const SwLineLayout * PrevLine()
Definition: itrtxt.cxx:170
bool IsPrtFormat() const
Definition: viewopt.hxx:541
bool sw_HideObj(const SwTextFrame &_rFrame, const RndStdIds _eAnchorType, SwPosition const &rAnchorPos, SwAnchoredObject *_pAnchoredObj)
as-character anchored graphics, which are used for a graphic bullet list.
Definition: txtfrm.cxx:1489
o3tl::strong_int< sal_Int32, struct Tag_SwNodeOffset > SwNodeOffset
Definition: nodeoffset.hxx:16
SwScriptInfo & GetScriptInfo()
Definition: porlay.hxx:291
double getLength(const B2DPolygon &rCandidate)
const std::vector< sal_uInt16 > & getFmtAttrs() const
Definition: hints.hxx:222
void SetPrep()
Definition: porlay.hxx:305
bool IsParaPropsNode(SwRootFrame const &rLayout, SwTextNode const &rNode)
Definition: txtfrm.cxx:313
sal_Int32 nLen
Definition: hints.hxx:135
virtual void Skip(TextFrameIndex nLength)=0
skip characters.
virtual void MoveObjToInvisibleLayer(SdrObject *_pDrawObj)
method to move drawing object to corresponding invisible layer
Definition: dcontact.cxx:237
void SetWidow(const bool bNew)
Definition: txtfrm.hxx:249
virtual bool get(DocumentSettingId id) const =0
Return the specified document setting.
void DelFrames(const SwRootFrame *)
Definition: atrftn.cxx:469
const SwAttrSet & GetSwAttrSet() const
Does node has already its own auto-attributes? Access to SwAttrSet.
Definition: node.hxx:724
const SwFormatContent & GetContent(bool=true) const
Definition: fmtcntnt.hxx:55
static void lcl_SetWrong(SwTextFrame &rFrame, SwTextNode const &rNode, sal_Int32 const nPos, sal_Int32 const nCnt, bool const bMove)
Definition: txtfrm.cxx:1801
SwParaPortion * pOldPara
Definition: txtfrm.cxx:3146
bool IsFixLineHeight() const
Definition: porlay.hxx:316
void Unlock()
Definition: swcache.cxx:480
static bool GetBoundsOfHiddenRange(const SwTextNode &rNode, sal_Int32 nPos, sal_Int32 &rnStartPos, sal_Int32 &rnEndPos, std::vector< sal_Int32 > *pList=nullptr)
Hidden text range information - static and non-version.
Definition: porlay.cxx:1949
constexpr sal_Int32 COMPLETE_STRING
Definition: swtypes.hxx:57
void SetPrepMustFit(const bool bNew)
Definition: porlay.hxx:309
void SetPrepWidows()
Definition: porlay.hxx:307
static bool lcl_ErgoVadis(SwTextFrame *pFrame, TextFrameIndex &rPos, const PrepareHint ePrep)
Definition: txtfrm.cxx:2716
void setHeight(tools::Long nHeight)
OUString m_aQuoVadis
Definition: ftninfo.hxx:95
const SwLineLayout * GetCurr() const
Definition: itrtxt.hxx:83
SwTextNode const * pLastNode
mainly for sanity checks
Definition: txtfrm.hxx:972
bool IsVertical() const
Definition: frame.hxx:973
tools::Long GetBottom(const SwRect &rRect) const
Definition: frame.hxx:1377
SwTextAttr const * NextAttr(SwTextNode const *&rpNode)
Definition: txtfrm.cxx:166
SwDocPosUpdate is sent to signal that only the frames from or to a specified document-global position...
Definition: hints.hxx:245
virtual void DestroyImpl() override
Definition: txtfrm.cxx:853
void InvalidatePrt_()
Definition: frame.hxx:779
SwFootnoteIdxs & GetFootnoteIdxs()
Definition: doc.hxx:633
void ClearItem(sal_uInt16 nWhichL)
Definition: hints.cxx:131
void AddToListRLHidden()
Definition: ndtxt.cxx:4337
void SetLeft(SwRect &rRect, tools::Long nNew) const
Definition: frame.hxx:1387
RndStdIds
SwDoc & GetDoc()
Definition: txtfrm.hxx:464
SwTwips mnHeightOfLastLine
Definition: txtfrm.hxx:192
virtual bool WouldFit(SwTwips &nMaxHeight, bool &bSplit, bool bTst) override
nMaxHeight is the required height bSplit indicates, that the paragraph has to be split bTst indicates...
Definition: txtfrm.cxx:3255
constexpr TypedWhichId< SwFormatLineNumber > RES_LINENUMBER(116)
tools::Long GetDelta() const
Definition: porlay.hxx:290
constexpr sal_uInt16 XATTR_FILL_LAST(XATTR_FILLBACKGROUND)
Small Helper class: Prepares a test format.
Definition: txtfrm.cxx:3143
bool HasMergedParas() const
Definition: rootfrm.hxx:425
bool IsOn() const
Definition: txtfly.hxx:319
static bool hasA11yRelevantAttribute(const std::vector< sal_uInt16 > &rWhichFmtAttr)
Definition: txtfrm.cxx:1960
Left
A container for the Header/Footer, PageBreak, and Outline Content Visibility controls.
SwTextNode *const pFirstNode
except break attributes, those are taken from the first node
Definition: txtfrm.hxx:970
bool IsShowHiddenChar(bool bHard=false) const
Definition: viewopt.hxx:321
sal_uInt16 getWhichAttr() const
Definition: hints.hxx:217
SwTwips mnFlyAnchorVertOfstNoWrap
The y position for wrap-through flys anchored at this paragraph.
Definition: txtfrm.hxx:188
SwTwips GetLineHeight() const
Definition: itrtxt.hxx:116
constexpr TypedWhichId< SwDelChr > RES_DEL_CHR(165)
bool IsCount() const
Definition: fmtline.hxx:58
tuple m
TextFrameIndex GetEnd() const
Definition: itrtxt.hxx:89
sal_uInt16 GetDropLines() const
Definition: itrtxt.hxx:202
sal_uInt16 FirstLineHeight() const
Returns the first line height.
Definition: txtfrm.cxx:3757
void VisitPortions(SwPortionHandler &rPH) const
Visit all portions for Accessibility.
Definition: txtfrm.cxx:3903
SwLinePortion * GetNextPortion() const
Definition: porlin.hxx:74
void InvalidateWordCount() const
Definition: pagefrm.hxx:397
SwViewShell * GetCurrShell() const
Definition: rootfrm.hxx:206
void InvalidateRange_(const SwCharRange &, const tools::Long=0)
Definition: txtfrm.cxx:1696
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 Height(tools::Long nNew)
Definition: swrect.hxx:193
constexpr TypedWhichId< SwDelText > RES_DEL_TXT(166)
SwPosition MapViewToModelPos(TextFrameIndex nIndex) const
Definition: txtfrm.cxx:1249
TextFrameIndex & Len()
Definition: porlay.hxx:49
SwFieldIds Which() const
Definition: fldbas.hxx:273
SdrObjUserCall * GetUserCall() const
bool IsIdxInside(TextFrameIndex nPos, TextFrameIndex nLen) const
Definition: txtfrm.cxx:1661
sw::MergedPara const *const m_pMerged
Definition: txtfrm.hxx:990
Merge GetRedlineMergeFlag() const
Definition: node.hxx:99
const SwPosition & GetContentAnchor() const
Definition: dcontact.hxx:152
const SwTextNode & GetTextNode() const
Definition: txtftn.hxx:70
tools::Long GetHeight() const
Definition: swfont.hxx:284
const SwFootnoteInfo & GetFootnoteInfo() const
Definition: doc.hxx:629
sal_uInt16 Which() const
SwRootFrame * getRootFrame()
Definition: frame.hxx:679
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_CJK_LANGUAGE(24)
bool mbIsSwapped
Definition: txtfrm.hxx:238
OUString m_aErgoSum
Definition: ftninfo.hxx:96
void SetInvalid(sal_Int32 nBegin, sal_Int32 nEnd)
Definition: wrong.cxx:253
constexpr TypedWhichId< SwPtrMsgPoolItem > RES_OBJECTDYING(RES_MSG_BEGIN)
Definition: view.hxx:144
void HideFootnotes(TextFrameIndex nStart, TextFrameIndex nEnd)
Definition: txtfrm.cxx:1458
sal_uInt16 nPos
virtual void SwClientNotify(SwModify const &rModify, SfxHint const &rHint) override
Definition: txtfrm.cxx:1976
std::pair< SwTextNode *, SwTextNode * > GetFirstAndLastNode(SwRootFrame const &rLayout, SwNodeIndex const &rPos)
Definition: txtfrm.cxx:357
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:864
virtual void DestroyImpl() override
Definition: ssfrm.cxx:426
bool isPARATR_LIST(const sal_uInt16 nWhich)
Definition: hintids.hxx:499
bool m_bDetectedRangeSegmentation false
void ChgThisLines()
Definition: txtfrm.cxx:3793
#define PROTOCOL_ENTER(pFrame, nFunc, nAct, pPar)
Definition: dbg_lay.hxx:92
SwTabFrame * FindTabFrame()
Definition: frame.hxx:1099
SwTextFrame * pFrame
Definition: txtfrm.cxx:3145
SwFrameSwapper(const SwTextFrame *pFrame, bool bSwapIfNotSwapped)
Definition: txtfrm.cxx:670
SwFrame * GetNext()
Definition: frame.hxx:676
const SwFormatLineNumber & GetLineNumber(bool=true) const
Definition: fmtline.hxx:64
SwLayoutModeModifier(const OutputDevice &rOutp)
Definition: txtfrm.cxx:704
bool HasFootnote() const
Definition: txtfrm.hxx:526
sal_uInt32 mnAllLines
Definition: txtfrm.hxx:179