LibreOffice Module sw (master)  1
inftxt.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 <com/sun/star/linguistic2/XHyphenator.hpp>
21 
22 #include <unotools/linguprops.hxx>
23 #include <unotools/lingucfg.hxx>
24 #include <hintids.hxx>
25 #include <svl/ctloptions.hxx>
26 #include <sfx2/infobar.hxx>
27 #include <sfx2/printer.hxx>
28 #include <sal/log.hxx>
30 #include <editeng/hngpnctitem.hxx>
32 #include <editeng/splwrap.hxx>
33 #include <editeng/pgrditem.hxx>
34 #include <editeng/tstpitem.hxx>
35 #include <editeng/shaditem.hxx>
36 
37 #include <SwSmartTagMgr.hxx>
38 #include <breakit.hxx>
40 #include <swmodule.hxx>
41 #include <vcl/svapp.hxx>
42 #include <viewsh.hxx>
43 #include <viewopt.hxx>
44 #include <frmtool.hxx>
47 #include <IDocumentMarkAccess.hxx>
48 #include <paratr.hxx>
49 #include <rootfrm.hxx>
50 #include "inftxt.hxx"
51 #include <noteurl.hxx>
52 #include "porftn.hxx"
53 #include "porrst.hxx"
54 #include "itratr.hxx"
55 #include "portab.hxx"
56 #include <wrong.hxx>
57 #include <doc.hxx>
58 #include <pam.hxx>
59 #include <numrule.hxx>
61 #include <docsh.hxx>
62 #include <strings.hrc>
63 #include <o3tl/deleter.hxx>
64 #include <vcl/gdimtf.hxx>
65 #include <vcl/virdev.hxx>
66 #include <vcl/gradient.hxx>
67 #include <i18nlangtag/mslangid.hxx>
68 #include <formatlinebreak.hxx>
69 
70 using namespace ::com::sun::star;
71 using namespace ::com::sun::star::linguistic2;
72 using namespace ::com::sun::star::uno;
73 using namespace ::com::sun::star::beans;
74 
75 #define CHAR_UNDERSCORE u'_'
76 #define CHAR_LEFT_ARROW u'\x25C0'
77 #define CHAR_RIGHT_ARROW u'\x25B6'
78 #define CHAR_TAB u'\x2192'
79 #define CHAR_TAB_RTL u'\x2190'
80 #define CHAR_LINEBREAK u'\x21B5'
81 #define CHAR_LINEBREAK_RTL u'\x21B3'
82 
83 #define DRAW_SPECIAL_OPTIONS_CENTER 1
84 #define DRAW_SPECIAL_OPTIONS_ROTATE 2
85 
87  : m_pSpace( nullptr ),
88  m_nVertAlign( SvxParaVertAlignItem::Align::Automatic ),
89  m_nDefTabStop( 0 ),
90  m_bListTabStopIncluded( false ),
91  m_nListTabStopPosition( 0 )
92 {
93 }
94 
96 {
97 }
98 
100  const SwTextNode& rTextNode )
101 {
102  m_oRuler.emplace( rAttrSet.GetTabStops() );
104  {
105  m_bListTabStopIncluded = true;
106 
107  // insert the list tab stop into SvxTabItem instance <pRuler>
108  const SvxTabStop aListTabStop( m_nListTabStopPosition,
109  SvxTabAdjust::Left );
110  m_oRuler->Insert( aListTabStop );
111 
112  // remove default tab stops, which are before the inserted list tab stop
113  for ( sal_uInt16 i = 0; i < m_oRuler->Count(); i++ )
114  {
115  if ( (*m_oRuler)[i].GetTabPos() < m_nListTabStopPosition &&
116  (*m_oRuler)[i].GetAdjustment() == SvxTabAdjust::Default )
117  {
118  m_oRuler->Remove(i);
119  continue;
120  }
121  }
122  }
123 
125  {
126  // remove default tab stop at position 0
127  for ( sal_uInt16 i = 0; i < m_oRuler->Count(); i++ )
128  {
129  if ( (*m_oRuler)[i].GetTabPos() == 0 &&
130  (*m_oRuler)[i].GetAdjustment() == SvxTabAdjust::Default )
131  {
132  m_oRuler->Remove(i);
133  break;
134  }
135  }
136  }
137 
138  m_pSpace = &rAttrSet.GetLineSpacing();
139  m_nVertAlign = rAttrSet.GetParaVertAlign().GetValue();
140  m_nDefTabStop = USHRT_MAX;
141 }
142 
144 {
145  m_pPara = pFrame->GetPara();
146  m_nTextStart = pFrame->GetOffset();
147  if (!m_pPara)
148  {
149  SAL_WARN("sw.core", "+SwTextInfo::CTOR: missing paragraph information");
150  pFrame->Format(pFrame->getRootFrame()->GetCurrShell()->GetOut());
151  m_pPara = pFrame->GetPara();
152  }
153 }
154 
156  : m_pPara( const_cast<SwTextInfo&>(rInf).GetParaPortion() )
157  , m_nTextStart( rInf.GetTextStart() )
158 { }
159 
160 #if OSL_DEBUG_LEVEL > 0
161 
162 static void ChkOutDev( const SwTextSizeInfo &rInf )
163 {
164  if ( !rInf.GetVsh() )
165  return;
166 
167  const OutputDevice* pOut = rInf.GetOut();
168  const OutputDevice* pRef = rInf.GetRefDev();
169  OSL_ENSURE( pOut && pRef, "ChkOutDev: invalid output devices" );
170 }
171 #endif
172 
174 {
175  const TextFrameIndex nTextLen(rInf.GetText().getLength());
176  if (rInf.GetLen() == TextFrameIndex(COMPLETE_STRING))
177  return nTextLen;
178  const TextFrameIndex nInfLen = rInf.GetIdx() + rInf.GetLen();
179  return std::min(nTextLen, nInfLen);
180 }
181 
183 : m_pKanaComp(nullptr)
184 , m_pVsh(nullptr)
185 , m_pOut(nullptr)
186 , m_pRef(nullptr)
187 , m_pFnt(nullptr)
188 , m_pUnderFnt(nullptr)
189 , m_pFrame(nullptr)
190 , m_pOpt(nullptr)
191 , m_pText(nullptr)
192 , m_nIdx(0)
193 , m_nLen(0)
194 , m_nKanaIdx(0)
195 , m_bOnWin (false)
196 , m_bNotEOL (false)
197 , m_bURLNotify(false)
198 , m_bStopUnderflow(false)
199 , m_bFootnoteInside(false)
200 , m_bOtherThanFootnoteInside(false)
201 , m_bMulti(false)
202 , m_bFirstMulti(false)
203 , m_bRuby(false)
204 , m_bHanging(false)
205 , m_bScriptSpace(false)
206 , m_bForbiddenChars(false)
207 , m_bSnapToGrid(false)
208 , m_nDirection(0)
209 {}
210 
212  : SwTextInfo( rNew ),
213  m_pKanaComp(rNew.GetpKanaComp()),
214  m_pVsh(const_cast<SwTextSizeInfo&>(rNew).GetVsh()),
215  m_pOut(const_cast<SwTextSizeInfo&>(rNew).GetOut()),
216  m_pRef(const_cast<SwTextSizeInfo&>(rNew).GetRefDev()),
217  m_pFnt(const_cast<SwTextSizeInfo&>(rNew).GetFont()),
218  m_pUnderFnt(rNew.GetUnderFnt()),
219  m_pFrame(rNew.m_pFrame),
220  m_pOpt(&rNew.GetOpt()),
221  m_pText(&rNew.GetText()),
222  m_nIdx(rNew.GetIdx()),
223  m_nLen(rNew.GetLen()),
224  m_nKanaIdx( rNew.GetKanaIdx() ),
225  m_bOnWin( rNew.OnWin() ),
226  m_bNotEOL( rNew.NotEOL() ),
227  m_bURLNotify( rNew.URLNotify() ),
228  m_bStopUnderflow( rNew.StopUnderflow() ),
229  m_bFootnoteInside( rNew.IsFootnoteInside() ),
230  m_bOtherThanFootnoteInside( rNew.IsOtherThanFootnoteInside() ),
231  m_bMulti( rNew.IsMulti() ),
232  m_bFirstMulti( rNew.IsFirstMulti() ),
233  m_bRuby( rNew.IsRuby() ),
234  m_bHanging( rNew.IsHanging() ),
235  m_bScriptSpace( rNew.HasScriptSpace() ),
236  m_bForbiddenChars( rNew.HasForbiddenChars() ),
237  m_bSnapToGrid( rNew.SnapToGrid() ),
238  m_nDirection( rNew.GetDirection() )
239 {
240 #if OSL_DEBUG_LEVEL > 0
241  ChkOutDev( *this );
242 #endif
243 }
244 
246  TextFrameIndex const nNewIdx)
247 {
248  m_pKanaComp = nullptr;
249  m_nKanaIdx = 0;
250  m_pFrame = pFrame;
252  SwDoc const& rDoc(m_pFrame->GetDoc());
254 
255  // Get the output and reference device
256  if ( m_pVsh )
257  {
258  m_pOut = pRenderContext;
259  m_pRef = &m_pVsh->GetRefDev();
260  m_bOnWin = m_pVsh->GetWin() || OUTDEV_WINDOW == m_pOut->GetOutDevType() || m_pVsh->isOutputToWindow();
261  }
262  else
263  {
264  // Access via StarONE. We do not need a Shell or an active one.
265  if (rDoc.getIDocumentSettingAccess().get(DocumentSettingId::HTML_MODE))
266  {
267  // We can only pick the AppWin here? (there's nothing better to pick?)
269  }
270  else
271  m_pOut = rDoc.getIDocumentDeviceAccess().getPrinter(false);
272 
273  m_pRef = m_pOut;
274  }
275 
276 #if OSL_DEBUG_LEVEL > 0
277  ChkOutDev( *this );
278 #endif
279 
280  // Set default layout mode ( LTR or RTL ).
281  if ( m_pFrame->IsRightToLeft() )
282  {
286  }
287  else
288  {
292  }
293 
294  // The Options
295 
296  m_pOpt = m_pVsh ?
297  m_pVsh->GetViewOptions() :
298  SW_MOD()->GetViewOption(rDoc.getIDocumentSettingAccess().get(DocumentSettingId::HTML_MODE)); // Options from Module, due to StarONE
299 
300  // bURLNotify is set if MakeGraphic prepares it
301  // TODO: Unwind
303 
305  m_pFrame->IsInDocBody() );
306 
307  m_pFnt = nullptr;
308  m_pUnderFnt = nullptr;
309  m_pText = &m_pFrame->GetText();
310 
311  m_nIdx = nNewIdx;
313  m_bNotEOL = false;
316  m_bForbiddenChars = false;
317 
318  SetLen( GetMinLen( *this ) );
319 }
320 
321 SwTextSizeInfo::SwTextSizeInfo( const SwTextSizeInfo &rNew, const OUString* pText,
322  TextFrameIndex const nIndex)
323  : SwTextInfo( rNew ),
324  m_pKanaComp(rNew.GetpKanaComp()),
325  m_pVsh(const_cast<SwTextSizeInfo&>(rNew).GetVsh()),
326  m_pOut(const_cast<SwTextSizeInfo&>(rNew).GetOut()),
327  m_pRef(const_cast<SwTextSizeInfo&>(rNew).GetRefDev()),
328  m_pFnt(const_cast<SwTextSizeInfo&>(rNew).GetFont()),
329  m_pUnderFnt(rNew.GetUnderFnt()),
330  m_pFrame( rNew.m_pFrame ),
331  m_pOpt(&rNew.GetOpt()),
332  m_pText(pText),
333  m_nIdx(nIndex),
334  m_nLen(COMPLETE_STRING),
335  m_nKanaIdx( rNew.GetKanaIdx() ),
336  m_bOnWin( rNew.OnWin() ),
337  m_bNotEOL( rNew.NotEOL() ),
338  m_bURLNotify( rNew.URLNotify() ),
339  m_bStopUnderflow( rNew.StopUnderflow() ),
340  m_bFootnoteInside( rNew.IsFootnoteInside() ),
341  m_bOtherThanFootnoteInside( rNew.IsOtherThanFootnoteInside() ),
342  m_bMulti( rNew.IsMulti() ),
343  m_bFirstMulti( rNew.IsFirstMulti() ),
344  m_bRuby( rNew.IsRuby() ),
345  m_bHanging( rNew.IsHanging() ),
346  m_bScriptSpace( rNew.HasScriptSpace() ),
347  m_bForbiddenChars( rNew.HasForbiddenChars() ),
348  m_bSnapToGrid( rNew.SnapToGrid() ),
349  m_nDirection( rNew.GetDirection() )
350 {
351 #if OSL_DEBUG_LEVEL > 0
352  ChkOutDev( *this );
353 #endif
354  SetLen( GetMinLen( *this ) );
355 }
356 
358  TextFrameIndex const nIndex)
359  : m_bOnWin(false)
360 {
361  CtorInitTextSizeInfo( pTextFrame->getRootFrame()->GetCurrShell()->GetOut(), pTextFrame, nIndex );
362 }
363 
365 {
366  // The path needs to go via ChgPhysFnt or the FontMetricCache gets confused.
367  // In this case pLastMet has it's old value.
368  // Wrong: GetOut()->SetFont( GetFont()->GetFnt() );
369  GetFont()->Invalidate();
370  GetFont()->ChgPhysFnt( m_pVsh, *GetOut() );
371 }
372 
374 {
375  if( OnWin() )
377 
378  OSL_ENSURE( m_pOut == m_pVsh->GetOut(),
379  "SwTextSizeInfo::NoteAnimation() changed m_pOut" );
380 }
381 
383  const SwScriptInfo* pSI,
384  const OUString& rText,
385  const TextFrameIndex nIndex,
386  const TextFrameIndex nLength) const
387 {
388  SwDrawTextInfo aDrawInf( m_pVsh, *pOutDev, pSI, rText, nIndex, nLength );
389  aDrawInf.SetFrame( m_pFrame );
390  aDrawInf.SetFont( m_pFnt );
391  aDrawInf.SetSnapToGrid( SnapToGrid() );
392  aDrawInf.SetKanaComp( 0 );
393  return SwPosSize(m_pFnt->GetTextSize_( aDrawInf ));
394 }
395 
397 {
398  const SwScriptInfo& rSI =
399  const_cast<SwParaPortion*>(GetParaPortion())->GetScriptInfo();
400 
401  // in some cases, compression is not allowed or suppressed for
402  // performance reasons
403  sal_uInt16 nComp =( SwFontScript::CJK == GetFont()->GetActual() &&
404  rSI.CountCompChg() &&
405  ! IsMulti() ) ?
406  GetKanaComp() :
407  0 ;
408 
409  SwDrawTextInfo aDrawInf( m_pVsh, *m_pOut, &rSI, *m_pText, m_nIdx, m_nLen );
410  aDrawInf.SetFrame( m_pFrame );
411  aDrawInf.SetFont( m_pFnt );
412  aDrawInf.SetSnapToGrid( SnapToGrid() );
413  aDrawInf.SetKanaComp( nComp );
414  return SwPosSize(m_pFnt->GetTextSize_( aDrawInf ));
415 }
416 
418  const TextFrameIndex nLength, const sal_uInt16 nComp,
419  sal_uInt16& nMinSize, sal_uInt16& nMaxSizeDiff,
420  vcl::text::TextLayoutCache const*const pCache) const
421 {
422  SwDrawTextInfo aDrawInf( m_pVsh, *m_pOut, pSI, *m_pText, nIndex, nLength,
423  0, false, pCache);
424  aDrawInf.SetFrame( m_pFrame );
425  aDrawInf.SetFont( m_pFnt );
426  aDrawInf.SetSnapToGrid( SnapToGrid() );
427  aDrawInf.SetKanaComp( nComp );
428  SwPosSize aSize( m_pFnt->GetTextSize_( aDrawInf ) );
429  nMaxSizeDiff = o3tl::narrowing<sal_uInt16>(aDrawInf.GetKanaDiff());
430  nMinSize = aSize.Width();
431 }
432 
434  const TextFrameIndex nMaxLen,
435  const sal_uInt16 nComp,
436  vcl::text::TextLayoutCache const*const pCache) const
437 {
438  const SwScriptInfo& rScriptInfo =
439  const_cast<SwParaPortion*>(GetParaPortion())->GetScriptInfo();
440 
441  OSL_ENSURE( m_pRef == m_pOut, "GetTextBreak is supposed to use the RefDev" );
442  SwDrawTextInfo aDrawInf( m_pVsh, *m_pOut, &rScriptInfo,
443  *m_pText, GetIdx(), nMaxLen, 0, false, pCache );
444  aDrawInf.SetFrame( m_pFrame );
445  aDrawInf.SetFont( m_pFnt );
446  aDrawInf.SetSnapToGrid( SnapToGrid() );
447  aDrawInf.SetKanaComp( nComp );
448  aDrawInf.SetHyphPos( nullptr );
449 
450  return m_pFnt->GetTextBreak( aDrawInf, nLineWidth );
451 }
452 
454  const TextFrameIndex nMaxLen,
455  const sal_uInt16 nComp,
456  TextFrameIndex& rExtraCharPos,
457  vcl::text::TextLayoutCache const*const pCache) const
458 {
459  const SwScriptInfo& rScriptInfo =
460  const_cast<SwParaPortion*>(GetParaPortion())->GetScriptInfo();
461 
462  OSL_ENSURE( m_pRef == m_pOut, "GetTextBreak is supposed to use the RefDev" );
463  SwDrawTextInfo aDrawInf( m_pVsh, *m_pOut, &rScriptInfo,
464  *m_pText, GetIdx(), nMaxLen, 0, false, pCache );
465  aDrawInf.SetFrame( m_pFrame );
466  aDrawInf.SetFont( m_pFnt );
467  aDrawInf.SetSnapToGrid( SnapToGrid() );
468  aDrawInf.SetKanaComp( nComp );
469  aDrawInf.SetHyphPos( &rExtraCharPos );
470 
471  return m_pFnt->GetTextBreak( aDrawInf, nLineWidth );
472 }
473 
475 {
476  std::pair<SwTextNode const*, sal_Int32> const pos(m_pFrame->MapViewToModel(nPos));
477  return pos.first->GetTextAttrForCharAt(pos.second);
478 }
479 
480 void SwTextPaintInfo::CtorInitTextPaintInfo( OutputDevice* pRenderContext, SwTextFrame *pFrame, const SwRect &rPaint )
481 {
482  CtorInitTextSizeInfo( pRenderContext, pFrame, TextFrameIndex(0) );
483  m_aTextFly.CtorInitTextFly( pFrame );
484  m_aPaintRect = rPaint;
485  m_nSpaceIdx = 0;
486  m_pSpaceAdd = nullptr;
487  m_pWrongList = nullptr;
488  m_pGrammarCheckList = nullptr;
489  m_pSmartTags = nullptr;
490  m_pBrushItem = nullptr;
491 }
492 
493 SwTextPaintInfo::SwTextPaintInfo( const SwTextPaintInfo &rInf, const OUString* pText )
494  : SwTextSizeInfo( rInf, pText )
495  , m_pWrongList( rInf.GetpWrongList() )
496  , m_pGrammarCheckList( rInf.GetGrammarCheckList() )
497  , m_pSmartTags( rInf.GetSmartTags() )
498  , m_pSpaceAdd( rInf.GetpSpaceAdd() ),
499  m_pBrushItem( rInf.GetBrushItem() ),
500  m_aTextFly( rInf.GetTextFly() ),
501  m_aPos( rInf.GetPos() ),
502  m_aPaintRect( rInf.GetPaintRect() ),
503  m_nSpaceIdx( rInf.GetSpaceIdx() )
504 { }
505 
507  : SwTextSizeInfo( rInf )
508  , m_pWrongList( rInf.GetpWrongList() )
509  , m_pGrammarCheckList( rInf.GetGrammarCheckList() )
510  , m_pSmartTags( rInf.GetSmartTags() )
511  , m_pSpaceAdd( rInf.GetpSpaceAdd() ),
512  m_pBrushItem( rInf.GetBrushItem() ),
513  m_aTextFly( rInf.GetTextFly() ),
514  m_aPos( rInf.GetPos() ),
515  m_aPaintRect( rInf.GetPaintRect() ),
516  m_nSpaceIdx( rInf.GetSpaceIdx() )
517 { }
518 
520 {
521  CtorInitTextPaintInfo( pFrame->getRootFrame()->GetCurrShell()->GetOut(), pFrame, rPaint );
522 }
523 
524 namespace
525 {
530 class SwTransparentTextGuard
531 {
533  GDIMetaFile m_aContentMetafile;
534  MapMode m_aNewMapMode;
535  SwRect m_aPorRect;
536  SwTextPaintInfo& m_rPaintInf;
537  SwDrawTextInfo& m_rDrawInf;
538 
539 public:
540  SwTransparentTextGuard(const SwLinePortion& rPor, SwTextPaintInfo& rPaintInf,
541  SwDrawTextInfo& rDrawInf);
542  ~SwTransparentTextGuard();
543 };
544 
545 SwTransparentTextGuard::SwTransparentTextGuard(const SwLinePortion& rPor,
546  SwTextPaintInfo& rPaintInf, SwDrawTextInfo& rDrawInf)
547  : m_aNewMapMode(rPaintInf.GetOut()->GetMapMode())
548  , m_rPaintInf(rPaintInf)
549  , m_rDrawInf(rDrawInf)
550 {
551  rPaintInf.CalcRect(rPor, &m_aPorRect);
552  rDrawInf.SetOut(*m_aContentVDev);
553  m_aContentVDev->SetMapMode(rPaintInf.GetOut()->GetMapMode());
554  m_aContentMetafile.Record(m_aContentVDev.get());
555  m_aContentVDev->SetLineColor(rPaintInf.GetOut()->GetLineColor());
556  m_aContentVDev->SetFillColor(rPaintInf.GetOut()->GetFillColor());
557  m_aContentVDev->SetFont(rPaintInf.GetOut()->GetFont());
558  m_aContentVDev->SetDrawMode(rPaintInf.GetOut()->GetDrawMode());
559  m_aContentVDev->SetSettings(rPaintInf.GetOut()->GetSettings());
560  m_aContentVDev->SetRefPoint(rPaintInf.GetOut()->GetRefPoint());
561 }
562 
563 SwTransparentTextGuard::~SwTransparentTextGuard()
564 {
565  m_aContentMetafile.Stop();
566  m_aContentMetafile.WindStart();
567  m_aNewMapMode.SetOrigin(m_aPorRect.TopLeft());
568  m_aContentMetafile.SetPrefMapMode(m_aNewMapMode);
569  m_aContentMetafile.SetPrefSize(m_aPorRect.SSize());
570  m_rDrawInf.SetOut(*m_rPaintInf.GetOut());
571  Gradient aVCLGradient;
572  sal_uInt8 nTransPercentVcl = 255 - m_rPaintInf.GetFont()->GetColor().GetAlpha();
573  const Color aTransColor(nTransPercentVcl, nTransPercentVcl, nTransPercentVcl);
574  aVCLGradient.SetStyle(GradientStyle::Linear);
575  aVCLGradient.SetStartColor(aTransColor);
576  aVCLGradient.SetEndColor(aTransColor);
577  aVCLGradient.SetAngle(0_deg10);
578  aVCLGradient.SetBorder(0);
579  aVCLGradient.SetOfsX(0);
580  aVCLGradient.SetOfsY(0);
581  aVCLGradient.SetStartIntensity(100);
582  aVCLGradient.SetEndIntensity(100);
583  aVCLGradient.SetSteps(2);
584  m_rPaintInf.GetOut()->DrawTransparent(m_aContentMetafile, m_aPorRect.TopLeft(),
585  m_aPorRect.SSize(), aVCLGradient);
586 }
587 }
588 
589 void SwTextPaintInfo::DrawText_( const OUString &rText, const SwLinePortion &rPor,
590  TextFrameIndex const nStart, TextFrameIndex const nLength,
591  const bool bKern, const bool bWrong,
592  const bool bSmartTag,
593  const bool bGrammarCheck )
594 {
595  if( !nLength )
596  return;
597 
598  // The SwScriptInfo is useless if we are inside a field portion
599  SwScriptInfo* pSI = nullptr;
600  if ( ! rPor.InFieldGrp() )
601  pSI = &GetParaPortion()->GetScriptInfo();
602 
603  // in some cases, kana compression is not allowed or suppressed for
604  // performance reasons
605  sal_uInt16 nComp = 0;
606  if ( ! IsMulti() )
607  nComp = GetKanaComp();
608 
609  bool bCfgIsAutoGrammar = false;
610  SvtLinguConfig().GetProperty( UPN_IS_GRAMMAR_AUTO ) >>= bCfgIsAutoGrammar;
611  const bool bBullet = OnWin() && GetOpt().IsBlank() && IsNoSymbol();
612  const bool bTmpWrong = bWrong && OnWin() && GetOpt().IsOnlineSpell();
613  const bool bTmpGrammarCheck = bGrammarCheck && OnWin() && bCfgIsAutoGrammar && GetOpt().IsOnlineSpell();
614  const bool bTmpSmart = bSmartTag && OnWin() && !GetOpt().IsPagePreview() && SwSmartTagMgr::Get().IsSmartTagsEnabled();
615 
616  OSL_ENSURE( GetParaPortion(), "No paragraph!");
617  SwDrawTextInfo aDrawInf( m_pFrame->getRootFrame()->GetCurrShell(), *m_pOut, pSI, rText, nStart, nLength,
618  rPor.Width(), bBullet );
619 
620  aDrawInf.SetUnderFnt( m_pUnderFnt );
621 
622  const tools::Long nSpaceAdd = ( rPor.IsBlankPortion() || rPor.IsDropPortion() ||
623  rPor.InNumberGrp() ) ? 0 : GetSpaceAdd();
624  if ( nSpaceAdd )
625  {
626  TextFrameIndex nCharCnt(0);
627  // #i41860# Thai justified alignment needs some
628  // additional information:
629  aDrawInf.SetNumberOfBlanks( rPor.InTextGrp() ?
630  static_cast<const SwTextPortion&>(rPor).GetSpaceCnt( *this, nCharCnt ) :
631  TextFrameIndex(0) );
632  }
633 
634  aDrawInf.SetSpace( nSpaceAdd );
635  aDrawInf.SetKanaComp( nComp );
636 
637  // the font is used to identify the current script via nActual
638  aDrawInf.SetFont( m_pFnt );
639  // the frame is used to identify the orientation
640  aDrawInf.SetFrame( GetTextFrame() );
641  // we have to know if the paragraph should snap to grid
642  aDrawInf.SetSnapToGrid( SnapToGrid() );
643  // for underlining we must know when not to add extra space behind
644  // a character in justified mode
645  aDrawInf.SetSpaceStop( ! rPor.GetNextPortion() ||
646  rPor.GetNextPortion()->InFixMargGrp() ||
647  rPor.GetNextPortion()->IsHolePortion() );
648 
649  // Draw text next to the left border
650  Point aFontPos(m_aPos);
651  if( m_pFnt->GetLeftBorder() && rPor.InTextGrp() && !static_cast<const SwTextPortion&>(rPor).GetJoinBorderWithPrev() )
652  {
653  const sal_uInt16 nLeftBorderSpace = m_pFnt->GetLeftBorderSpace();
654  if ( GetTextFrame()->IsRightToLeft() )
655  {
656  aFontPos.AdjustX( -nLeftBorderSpace );
657  }
658  else
659  {
660  switch( m_pFnt->GetOrientation(GetTextFrame()->IsVertical()).get() )
661  {
662  case 0 :
663  aFontPos.AdjustX(nLeftBorderSpace );
664  break;
665  case 900 :
666  aFontPos.AdjustY( -nLeftBorderSpace );
667  break;
668  case 1800 :
669  aFontPos.AdjustX( -nLeftBorderSpace );
670  break;
671  case 2700 :
672  aFontPos.AdjustY(nLeftBorderSpace );
673  break;
674  }
675  }
676  if( aFontPos.X() < 0 )
677  aFontPos.setX( 0 );
678  if( aFontPos.Y() < 0 )
679  aFontPos.setY( 0 );
680  }
681 
682  // Handle semi-transparent text if necessary.
683  std::unique_ptr<SwTransparentTextGuard, o3tl::default_delete<SwTransparentTextGuard>> pTransparentText;
685  {
686  pTransparentText.reset(new SwTransparentTextGuard(rPor, *this, aDrawInf));
687  }
688 
689  if( GetTextFly().IsOn() )
690  {
691  // aPos needs to be the TopLeft, because we cannot calculate the
692  // ClipRects otherwise
693  const Point aPoint( aFontPos.X(), aFontPos.Y() - rPor.GetAscent() );
694  const Size aSize( rPor.Width(), rPor.Height() );
695  aDrawInf.SetPos( aPoint );
696  aDrawInf.SetSize( aSize );
697  aDrawInf.SetAscent( rPor.GetAscent() );
698  aDrawInf.SetKern( bKern ? rPor.Width() : 0 );
699  aDrawInf.SetWrong( bTmpWrong ? m_pWrongList : nullptr );
700  aDrawInf.SetGrammarCheck( bTmpGrammarCheck ? m_pGrammarCheckList : nullptr );
701  aDrawInf.SetSmartTags( bTmpSmart ? m_pSmartTags : nullptr );
702  GetTextFly().DrawTextOpaque( aDrawInf );
703  }
704  else
705  {
706  aDrawInf.SetPos( aFontPos );
707  if( bKern )
708  m_pFnt->DrawStretchText_( aDrawInf );
709  else
710  {
711  aDrawInf.SetWrong( bTmpWrong ? m_pWrongList : nullptr );
712  aDrawInf.SetGrammarCheck( bTmpGrammarCheck ? m_pGrammarCheckList : nullptr );
713  aDrawInf.SetSmartTags( bTmpSmart ? m_pSmartTags : nullptr );
714  m_pFnt->DrawText_( aDrawInf );
715  }
716  }
717 }
718 
720  SwRect* pRect, SwRect* pIntersect,
721  const bool bInsideBox ) const
722 {
723  Size aSize( rPor.Width(), rPor.Height() );
724  if( rPor.IsHangingPortion() )
725  aSize.setWidth( static_cast<const SwHangingPortion&>(rPor).GetInnerWidth() );
726  if( rPor.InSpaceGrp() && GetSpaceAdd() )
727  {
728  SwTwips nAdd = rPor.CalcSpacing( GetSpaceAdd(), *this );
729  if( rPor.InFieldGrp() && GetSpaceAdd() < 0 && nAdd )
731  aSize.AdjustWidth(nAdd );
732  }
733 
734  Point aPoint;
735 
736  if( IsRotated() )
737  {
738  tools::Long nTmp = aSize.Width();
739  aSize.setWidth( aSize.Height() );
740  aSize.setHeight( nTmp );
741  if ( 1 == GetDirection() )
742  {
743  aPoint.setX( X() - rPor.GetAscent() );
744  aPoint.setY( Y() - aSize.Height() );
745  }
746  else
747  {
748  aPoint.setX( X() - rPor.Height() + rPor.GetAscent() );
749  aPoint.setY( Y() );
750  }
751  }
752  else
753  {
754  aPoint.setX( X() );
755  if (GetTextFrame()->IsVertLR() && !GetTextFrame()->IsVertLRBT())
756  aPoint.setY( Y() - rPor.Height() + rPor.GetAscent() );
757  else
758  aPoint.setY( Y() - rPor.GetAscent() );
759  }
760 
761  // Adjust x coordinate if we are inside a bidi portion
762  const bool bFrameDir = GetTextFrame()->IsRightToLeft();
763  const bool bCounterDir = ( !bFrameDir && DIR_RIGHT2LEFT == GetDirection() ) ||
764  ( bFrameDir && DIR_LEFT2RIGHT == GetDirection() );
765 
766  if ( bCounterDir )
767  aPoint.AdjustX( -(aSize.Width()) );
768 
769  SwRect aRect( aPoint, aSize );
770 
771  if ( GetTextFrame()->IsRightToLeft() )
772  GetTextFrame()->SwitchLTRtoRTL( aRect );
773 
774  if ( GetTextFrame()->IsVertical() )
776 
777  if( bInsideBox && rPor.InTextGrp() )
778  {
779  const bool bJoinWithPrev =
780  static_cast<const SwTextPortion&>(rPor).GetJoinBorderWithPrev();
781  const bool bJoinWithNext =
782  static_cast<const SwTextPortion&>(rPor).GetJoinBorderWithNext();
783  const bool bIsVert = GetTextFrame()->IsVertical();
784  const bool bIsVertLRBT = GetTextFrame()->IsVertLRBT();
785  aRect.AddTop( GetFont()->CalcShadowSpace(SvxShadowItemSide::TOP, bIsVert, bIsVertLRBT,
786  bJoinWithPrev, bJoinWithNext));
787  aRect.AddBottom( - GetFont()->CalcShadowSpace(SvxShadowItemSide::BOTTOM, bIsVert, bIsVertLRBT,
788  bJoinWithPrev, bJoinWithNext));
789  aRect.AddLeft( GetFont()->CalcShadowSpace(SvxShadowItemSide::LEFT, bIsVert, bIsVertLRBT,
790  bJoinWithPrev, bJoinWithNext));
791  aRect.AddRight( - GetFont()->CalcShadowSpace(SvxShadowItemSide::RIGHT, bIsVert, bIsVertLRBT,
792  bJoinWithPrev, bJoinWithNext));
793  }
794 
795  if ( pRect )
796  *pRect = aRect;
797 
798  if( aRect.HasArea() && pIntersect )
799  {
800  ::SwAlignRect( aRect, GetVsh(), GetOut() );
801 
802  if ( GetOut()->IsClipRegion() )
803  {
804  SwRect aClip( GetOut()->GetClipRegion().GetBoundRect() );
805  aRect.Intersection( aClip );
806  }
807 
808  *pIntersect = aRect;
809  }
810 }
811 
822 static void lcl_DrawSpecial( const SwTextPaintInfo& rTextPaintInfo, const SwLinePortion& rPor,
823  SwRect& rRect, const Color& rCol, sal_Unicode cChar,
824  sal_uInt8 nOptions )
825 {
826  bool bCenter = 0 != ( nOptions & DRAW_SPECIAL_OPTIONS_CENTER );
827  bool bRotate = 0 != ( nOptions & DRAW_SPECIAL_OPTIONS_ROTATE );
828 
829  // rRect is given in absolute coordinates
830  if ( rTextPaintInfo.GetTextFrame()->IsRightToLeft() )
831  rTextPaintInfo.GetTextFrame()->SwitchRTLtoLTR( rRect );
832  if ( rTextPaintInfo.GetTextFrame()->IsVertical() )
833  rTextPaintInfo.GetTextFrame()->SwitchVerticalToHorizontal( rRect );
834 
835  const SwFont* pOldFnt = rTextPaintInfo.GetFont();
836 
837  // Font is generated only once:
838  static SwFont s_aFnt = [&]()
839  {
840  SwFont tmp( *pOldFnt );
841  tmp.SetFamily( FAMILY_DONTKNOW, tmp.GetActual() );
843  tmp.SetStyleName(OUString(), tmp.GetActual());
844  tmp.SetCharSet( RTL_TEXTENCODING_SYMBOL, tmp.GetActual() );
845  return tmp;
846  }();
847 
848  // Some of the current values are set at the font:
849  if ( ! bRotate )
850  s_aFnt.SetVertical( 0_deg10, rTextPaintInfo.GetTextFrame()->IsVertical() );
851  else
852  s_aFnt.SetVertical( pOldFnt->GetOrientation() );
853 
854  s_aFnt.SetColor(rCol);
855 
856  Size aFontSize( 0, SPECIAL_FONT_HEIGHT );
857  s_aFnt.SetSize( aFontSize, s_aFnt.GetActual() );
858 
859  SwTextPaintInfo& rNonConstTextPaintInfo = const_cast<SwTextPaintInfo&>(rTextPaintInfo);
860 
861  rNonConstTextPaintInfo.SetFont( &s_aFnt );
862 
863  // The maximum width depends on the current orientation
864  const Degree10 nDir = s_aFnt.GetOrientation( rTextPaintInfo.GetTextFrame()->IsVertical() );
865  SwTwips nMaxWidth;
866  if (nDir == 900_deg10 || nDir == 2700_deg10)
867  nMaxWidth = rRect.Height();
868  else
869  {
870  assert(nDir == 0_deg10); //Unknown direction set at font
871  nMaxWidth = rRect.Width();
872  }
873 
874  // check if char fits into rectangle
875  const OUString aTmp( cChar );
876  aFontSize = rTextPaintInfo.GetTextSize( aTmp ).SvLSize();
877  while ( aFontSize.Width() > nMaxWidth )
878  {
879  SwTwips nFactor = ( 100 * aFontSize.Width() ) / nMaxWidth;
880  const SwTwips nOldWidth = aFontSize.Width();
881 
882  // new height for font
883  const SwFontScript nAct = s_aFnt.GetActual();
884  aFontSize.setHeight( ( 100 * s_aFnt.GetSize( nAct ).Height() ) / nFactor );
885  aFontSize.setWidth( ( 100 * s_aFnt.GetSize( nAct).Width() ) / nFactor );
886 
887  if ( !aFontSize.Width() && !aFontSize.Height() )
888  break;
889 
890  s_aFnt.SetSize( aFontSize, nAct );
891 
892  aFontSize = rTextPaintInfo.GetTextSize( aTmp ).SvLSize();
893 
894  if ( aFontSize.Width() >= nOldWidth )
895  break;
896  }
897 
898  const Point aOldPos( rTextPaintInfo.GetPos() );
899 
900  // adjust values so that tab is vertically and horizontally centered
901  SwTwips nX = rRect.Left();
902  SwTwips nY = rRect.Top();
903  switch ( nDir.get() )
904  {
905  case 0 :
906  if ( bCenter )
907  nX += ( rRect.Width() - aFontSize.Width() ) / 2;
908  nY += ( rRect.Height() - aFontSize.Height() ) / 2 + rTextPaintInfo.GetAscent();
909  break;
910  case 900 :
911  if ( bCenter )
912  nX += ( rRect.Width() - aFontSize.Height() ) / 2 + rTextPaintInfo.GetAscent();
913  nY += ( rRect.Height() + aFontSize.Width() ) / 2;
914  break;
915  case 2700 :
916  if ( bCenter )
917  nX += ( rRect.Width() + aFontSize.Height() ) / 2 - rTextPaintInfo.GetAscent();
918  nY += ( rRect.Height() - aFontSize.Width() ) / 2;
919  break;
920  }
921 
922  Point aTmpPos( nX, nY );
923  rNonConstTextPaintInfo.SetPos( aTmpPos );
924  sal_uInt16 nOldWidth = rPor.Width();
925  const_cast<SwLinePortion&>(rPor).Width( o3tl::narrowing<sal_uInt16>(aFontSize.Width()) );
926  rTextPaintInfo.DrawText( aTmp, rPor );
927  const_cast<SwLinePortion&>(rPor).Width( nOldWidth );
928  rNonConstTextPaintInfo.SetFont( const_cast<SwFont*>(pOldFnt) );
929  rNonConstTextPaintInfo.SetPos( aOldPos );
930 }
931 
932 void SwTextPaintInfo::DrawRect( const SwRect &rRect, bool bRetouche ) const
933 {
934  if ( OnWin() || !bRetouche )
935  {
936  if( m_aTextFly.IsOn() )
937  const_cast<SwTextPaintInfo*>(this)->GetTextFly().
938  DrawFlyRect( m_pOut, rRect );
939  else
940  m_pOut->DrawRect( rRect.SVRect() );
941  }
942 }
943 
944 void SwTextPaintInfo::DrawTab( const SwLinePortion &rPor ) const
945 {
946  if( !OnWin() )
947  return;
948 
949  SwRect aRect;
950  CalcRect( rPor, &aRect );
951 
952  if ( ! aRect.HasArea() )
953  return;
954 
957 
958  lcl_DrawSpecial( *this, rPor, aRect, NON_PRINTING_CHARACTER_COLOR, cChar, nOptions );
959 }
960 
962 {
963  if( !OnWin() )
964  return;
965 
967  if (rPor.IsBreakPortion())
968  {
969  const auto& rBreakPortion = static_cast<const SwBreakPortion&>(rPor);
970  eClear = rBreakPortion.GetClear();
971  }
972 
973  sal_uInt16 nOldWidth = rPor.Width();
974  const_cast<SwLinePortion&>(rPor).Width( LINE_BREAK_WIDTH );
975 
976  SwRect aRect;
977  CalcRect( rPor, &aRect );
978 
979  if( aRect.HasArea() )
980  {
981  const sal_Unicode cChar = GetTextFrame()->IsRightToLeft() ?
983  const sal_uInt8 nOptions = 0;
984 
985  SwRect aTextRect(aRect);
986  if (eClear == SwLineBreakClear::LEFT || eClear == SwLineBreakClear::ALL)
987  aTextRect.AddLeft(30);
988  if (eClear == SwLineBreakClear::RIGHT || eClear == SwLineBreakClear::ALL)
989  aTextRect.AddRight(-30);
990  lcl_DrawSpecial( *this, rPor, aTextRect, NON_PRINTING_CHARACTER_COLOR, cChar, nOptions );
991 
992  if (eClear != SwLineBreakClear::NONE)
993  {
994  // Paint indicator if this clear is left/right/all.
997  if (eClear != SwLineBreakClear::RIGHT)
998  m_pOut->DrawLine(aRect.BottomLeft(), aRect.TopLeft());
999  if (eClear != SwLineBreakClear::LEFT)
1000  m_pOut->DrawLine(aRect.BottomRight(), aRect.TopRight());
1001  m_pOut->Pop();
1002  }
1003  }
1004 
1005  const_cast<SwLinePortion&>(rPor).Width( nOldWidth );
1006 }
1007 
1009 {
1011  SwRect aRect( static_cast<const SwArrowPortion&>(rPor).GetPos(), aSize );
1012  sal_Unicode cChar;
1013  if( static_cast<const SwArrowPortion&>(rPor).IsLeft() )
1014  {
1015  aRect.Pos().AdjustY(20 - GetAscent() );
1016  aRect.Pos().AdjustX(20 );
1017  if( aSize.Height() > rPor.Height() )
1018  aRect.Height( rPor.Height() );
1019  cChar = CHAR_LEFT_ARROW;
1020  }
1021  else
1022  {
1023  if( aSize.Height() > rPor.Height() )
1024  aRect.Height( rPor.Height() );
1025  aRect.Pos().AdjustY( -(aRect.Height() + 20) );
1026  aRect.Pos().AdjustX( -(aRect.Width() + 20) );
1027  cChar = CHAR_RIGHT_ARROW;
1028  }
1029 
1030  if ( GetTextFrame()->IsVertical() )
1032 
1033  if( aRect.HasArea() )
1034  {
1035  const sal_uInt8 nOptions = 0;
1036  lcl_DrawSpecial( *this, rPor, aRect, COL_LIGHTRED, cChar, nOptions );
1037  }
1038 }
1039 
1040 void SwTextPaintInfo::DrawPostIts( bool bScript ) const
1041 {
1042  if( !OnWin() || !m_pOpt->IsPostIts() )
1043  return;
1044 
1045  Size aSize;
1046  Point aTmp;
1047 
1048  const sal_uInt16 nPostItsWidth = SwViewOption::GetPostItsWidth( GetOut() );
1049  const sal_uInt16 nFontHeight = m_pFnt->GetHeight( m_pVsh, *GetOut() );
1050  const sal_uInt16 nFontAscent = m_pFnt->GetAscent( m_pVsh, *GetOut() );
1051 
1052  switch ( m_pFnt->GetOrientation( GetTextFrame()->IsVertical() ).get() )
1053  {
1054  case 0 :
1055  aSize.setWidth( nPostItsWidth );
1056  aSize.setHeight( nFontHeight );
1057  aTmp.setX( m_aPos.X() );
1058  aTmp.setY( m_aPos.Y() - nFontAscent );
1059  break;
1060  case 900 :
1061  aSize.setHeight( nPostItsWidth );
1062  aSize.setWidth( nFontHeight );
1063  aTmp.setX( m_aPos.X() - nFontAscent );
1064  aTmp.setY( m_aPos.Y() );
1065  break;
1066  case 2700 :
1067  aSize.setHeight( nPostItsWidth );
1068  aSize.setWidth( nFontHeight );
1069  aTmp.setX( m_aPos.X() - nFontHeight +
1070  nFontAscent );
1071  aTmp.setY( m_aPos.Y() );
1072  break;
1073  }
1074 
1075  SwRect aTmpRect( aTmp, aSize );
1076 
1077  if ( GetTextFrame()->IsRightToLeft() )
1078  GetTextFrame()->SwitchLTRtoRTL( aTmpRect );
1079 
1080  if ( GetTextFrame()->IsVertical() )
1082 
1083  SwViewOption::PaintPostIts( const_cast<OutputDevice*>(GetOut()), aTmpRect, bScript );
1084 
1085 }
1086 
1087 void SwTextPaintInfo::DrawCheckBox(const SwFieldFormCheckboxPortion &rPor, bool bChecked) const
1088 {
1089  SwRect aIntersect;
1090  CalcRect( rPor, &aIntersect );
1091  if ( !aIntersect.HasArea() )
1092  return;
1093 
1094  if (OnWin() && SwViewOption::IsFieldShadings() &&
1095  !GetOpt().IsPagePreview())
1096  {
1097  OutputDevice* pOut = const_cast<OutputDevice*>(GetOut());
1100  pOut->SetLineColor();
1101  pOut->DrawRect( aIntersect.SVRect() );
1102  pOut->Pop();
1103  }
1104  const int delta=10;
1105  tools::Rectangle r(aIntersect.Left()+delta, aIntersect.Top()+delta, aIntersect.Right()-delta, aIntersect.Bottom()-delta);
1107  m_pOut->SetLineColor( Color(0, 0, 0));
1108  m_pOut->SetFillColor();
1109  m_pOut->DrawRect( r );
1110  if (bChecked)
1111  {
1112  m_pOut->DrawLine(r.TopLeft(), r.BottomRight());
1113  m_pOut->DrawLine(r.TopRight(), r.BottomLeft());
1114  }
1115  m_pOut->Pop();
1116 }
1117 
1118 void SwTextPaintInfo::DrawBackground( const SwLinePortion &rPor, const Color *pColor ) const
1119 {
1120  OSL_ENSURE( OnWin(), "SwTextPaintInfo::DrawBackground: printer pollution ?" );
1121 
1122  SwRect aIntersect;
1123  CalcRect( rPor, nullptr, &aIntersect, true );
1124 
1125  if ( !aIntersect.HasArea() )
1126  return;
1127 
1128  OutputDevice* pOut = const_cast<OutputDevice*>(GetOut());
1130 
1131  if ( pColor )
1132  pOut->SetFillColor( *pColor );
1133  else
1135 
1136  pOut->SetLineColor();
1137 
1138  DrawRect( aIntersect, true );
1139  pOut->Pop();
1140 }
1141 
1143 {
1144  {
1145  SwRect aIntersect;
1146  CalcRect( rPor, &aIntersect, nullptr, true );
1147  if(aIntersect.HasArea())
1148  {
1149  SwPosition const aPosition(m_pFrame->MapViewToModelPos(GetIdx()));
1150  const ::sw::mark::IMark* pFieldmark =
1152  bool bIsStartMark = (TextFrameIndex(1) == GetLen()
1153  && CH_TXT_ATR_FIELDSTART == GetText()[sal_Int32(GetIdx())]);
1154  if(pFieldmark) {
1155  SAL_INFO("sw.core", "Found Fieldmark " << pFieldmark->ToString());
1156  }
1157  if(bIsStartMark)
1158  SAL_INFO("sw.core", "Found StartMark");
1159  if (OnWin() && (pFieldmark!=nullptr || bIsStartMark) &&
1161  !GetOpt().IsPagePreview())
1162  {
1163  OutputDevice* pOutDev = const_cast<OutputDevice*>(GetOut());
1166  pOutDev->SetLineColor( );
1167  pOutDev->DrawRect( aIntersect.SVRect() );
1168  pOutDev->Pop();
1169  }
1170  }
1171  }
1172 
1173  SwRect aIntersect;
1174  CalcRect( rPor, nullptr, &aIntersect, true );
1175 
1176  if ( !aIntersect.HasArea() )
1177  return;
1178 
1179  OutputDevice* pTmpOut = const_cast<OutputDevice*>(GetOut());
1180 
1181  // #i16816# tagged pdf support
1182  SwTaggedPDFHelper aTaggedPDFHelper( nullptr, nullptr, nullptr, *pTmpOut );
1183 
1184  Color aFillColor;
1185 
1187  {
1188  aFillColor = m_pFnt->GetHighlightColor();
1189  }
1190  else
1191  {
1192  if( !m_pFnt->GetBackColor() )
1193  return;
1194  aFillColor = *m_pFnt->GetBackColor();
1195  }
1196 
1197  // tdf#104349 do not highlight portions of space chars before end of line if the compatibility option is enabled
1198  // for LTR mode only
1199  if ( !GetTextFrame()->IsRightToLeft() )
1200  {
1201  if (GetTextFrame()->GetDoc().getIDocumentSettingAccess().get(DocumentSettingId::MS_WORD_COMP_TRAILING_BLANKS))
1202  {
1203  bool draw = false;
1204  bool full = false;
1205  SwLinePortion *pPos = const_cast<SwLinePortion *>(&rPor);
1206  TextFrameIndex nIdx = GetIdx();
1207  TextFrameIndex nLen;
1208 
1209  do
1210  {
1211  nLen = pPos->GetLen();
1212  for (TextFrameIndex i = nIdx; i < (nIdx + nLen); ++i)
1213  {
1214  if (i < TextFrameIndex(GetText().getLength())
1215  && GetText()[sal_Int32(i)] == CH_TXTATR_NEWLINE)
1216  {
1217  if ( i >= (GetIdx() + rPor.GetLen()) )
1218  {
1219  goto drawcontinue;
1220  }
1221  }
1222  if (i >= TextFrameIndex(GetText().getLength())
1223  || GetText()[sal_Int32(i)] != CH_BLANK)
1224  {
1225  draw = true;
1226  if ( i >= (GetIdx() + rPor.GetLen()) )
1227  {
1228  full = true;
1229  goto drawcontinue;
1230  }
1231  }
1232  }
1233  nIdx += nLen;
1234  pPos = pPos->GetNextPortion();
1235  } while ( pPos );
1236 
1237  drawcontinue:
1238 
1239  if ( !draw )
1240  return;
1241 
1242  if ( !full )
1243  {
1244  pPos = const_cast<SwLinePortion *>(&rPor);
1245  nIdx = GetIdx();
1246 
1247  nLen = pPos->GetLen();
1248  for (TextFrameIndex i = nIdx + nLen - TextFrameIndex(1);
1249  i >= nIdx; --i)
1250  {
1251  if (i < TextFrameIndex(GetText().getLength())
1252  && GetText()[sal_Int32(i)] == CH_TXTATR_NEWLINE)
1253  {
1254  continue;
1255  }
1256  if ((i + TextFrameIndex(1) ).get() > GetText().getLength())
1257  // prevent crash by not passing bad data down to GetTextSize->SwDrawTextInfo
1258  SAL_WARN("sw", "something dodgy, clamping text index to prevent crash");
1259  else if (i >= TextFrameIndex(GetText().getLength())
1260  || GetText()[sal_Int32(i)] != CH_BLANK)
1261  {
1262  sal_uInt16 nOldWidth = rPor.Width();
1263  sal_uInt16 nNewWidth = GetTextSize(m_pOut, nullptr,
1264  GetText(), nIdx, (i + TextFrameIndex(1) - nIdx)).Width();
1265 
1266  const_cast<SwLinePortion&>(rPor).Width( nNewWidth );
1267  CalcRect( rPor, nullptr, &aIntersect, true );
1268  const_cast<SwLinePortion&>(rPor).Width( nOldWidth );
1269 
1270  if ( !aIntersect.HasArea() )
1271  {
1272  return;
1273  }
1274 
1275  break;
1276  }
1277  }
1278  }
1279  }
1280  }
1281 
1283 
1284  pTmpOut->SetFillColor(aFillColor);
1285  pTmpOut->SetLineColor();
1286 
1287  DrawRect( aIntersect, false );
1288 
1289  pTmpOut->Pop();
1290 }
1291 
1293 {
1294  SwRect aDrawArea;
1295  CalcRect( rPor, &aDrawArea );
1296  if ( aDrawArea.HasArea() )
1297  {
1298  PaintCharacterBorder(*m_pFnt, aDrawArea, GetTextFrame()->IsVertical(),
1299  GetTextFrame()->IsVertLRBT(), rPor.GetJoinBorderWithPrev(),
1300  rPor.GetJoinBorderWithNext());
1301  }
1302 }
1303 
1305  PortionType nWhich, const Color *pColor ) const
1306 {
1307  if( !OnWin() || IsMulti() )
1308  return;
1309 
1310  bool bDraw = false;
1311  switch( nWhich )
1312  {
1313  case PortionType::Footnote:
1314  case PortionType::QuoVadis:
1315  case PortionType::Number:
1316  case PortionType::Field:
1317  case PortionType::Hidden:
1318  case PortionType::Tox:
1319  case PortionType::Ref:
1320  case PortionType::Meta:
1323  if ( !GetOpt().IsPagePreview()
1324  && !GetOpt().IsReadonly()
1326  && ( PortionType::Number != nWhich
1327  || m_pFrame->GetTextNodeForParaProps()->HasMarkedLabel())) // #i27615#
1328  {
1329  bDraw = PortionType::Footnote != nWhich || m_pFrame->IsFootnoteAllowed();
1330  }
1331  break;
1332  case PortionType::Bookmark:
1333  // no shading
1334  break;
1336  // input field shading also in read-only mode
1337  if ( !GetOpt().IsPagePreview()
1339  {
1340  bDraw = true;
1341  }
1342  break;
1343  case PortionType::Table:
1344  if ( GetOpt().IsTab() ) bDraw = true;
1345  break;
1347  if ( GetOpt().IsSoftHyph() )bDraw = true;
1348  break;
1349  case PortionType::Blank:
1350  if ( GetOpt().IsHardBlank())bDraw = true;
1351  break;
1352  default:
1353  {
1354  OSL_ENSURE( false, "SwTextPaintInfo::DrawViewOpt: don't know how to draw this" );
1355  break;
1356  }
1357  }
1358  if ( bDraw )
1359  DrawBackground( rPor, pColor );
1360 }
1361 
1363  sal_Int16 nMinLeading, sal_Int16 nMinTrailing, bool bNoCapsHyphenation )
1364 {
1365  sal_Int32 nLen = rVals.getLength();
1366 
1367  if (0 == nLen) // yet to be initialized?
1368  {
1369  rVals.realloc( 3 );
1370  PropertyValue *pVal = rVals.getArray();
1371 
1372  pVal[0].Name = UPN_HYPH_MIN_LEADING;
1373  pVal[0].Handle = UPH_HYPH_MIN_LEADING;
1374  pVal[0].Value <<= nMinLeading;
1375 
1376  pVal[1].Name = UPN_HYPH_MIN_TRAILING;
1377  pVal[1].Handle = UPH_HYPH_MIN_TRAILING;
1378  pVal[1].Value <<= nMinTrailing;
1379 
1380  pVal[2].Name = UPN_HYPH_NO_CAPS;
1381  pVal[2].Handle = UPH_HYPH_NO_CAPS;
1382  pVal[2].Value <<= bNoCapsHyphenation;
1383  }
1384  else if (3 == nLen) // already initialized once?
1385  {
1386  PropertyValue *pVal = rVals.getArray();
1387  pVal[0].Value <<= nMinLeading;
1388  pVal[1].Value <<= nMinTrailing;
1389  pVal[2].Value <<= bNoCapsHyphenation;
1390  }
1391  else {
1392  OSL_FAIL( "unexpected size of sequence" );
1393  }
1394 }
1395 
1397 {
1398  OSL_ENSURE( 3 == m_aHyphVals.getLength(),
1399  "hyphenation values not yet initialized" );
1400  return m_aHyphVals;
1401 }
1402 
1403 bool SwTextFormatInfo::InitHyph( const bool bAutoHyphen )
1404 {
1405  const SwAttrSet& rAttrSet = GetTextFrame()->GetTextNodeForParaProps()->GetSwAttrSet();
1406  SetHanging( rAttrSet.GetHangingPunctuation().GetValue() );
1407  SetScriptSpace( rAttrSet.GetScriptSpace().GetValue() );
1408  SetForbiddenChars( rAttrSet.GetForbiddenRule().GetValue() );
1409  const SvxHyphenZoneItem &rAttr = rAttrSet.GetHyphenZone();
1410  MaxHyph() = rAttr.GetMaxHyphens();
1411  const bool bAuto = bAutoHyphen || rAttr.IsHyphen();
1412  if( bAuto || m_bInterHyph )
1413  {
1414  const sal_Int16 nMinimalLeading = std::max(rAttr.GetMinLead(), sal_uInt8(2));
1415  const sal_Int16 nMinimalTrailing = rAttr.GetMinTrail();
1416  const bool bNoCapsHyphenation = rAttr.IsNoCapsHyphenation();
1417  lcl_InitHyphValues( m_aHyphVals, nMinimalLeading, nMinimalTrailing, bNoCapsHyphenation);
1418  }
1419  return bAuto;
1420 }
1421 
1422 void SwTextFormatInfo::CtorInitTextFormatInfo( OutputDevice* pRenderContext, SwTextFrame *pNewFrame, const bool bNewInterHyph,
1423  const bool bNewQuick, const bool bTst )
1424 {
1425  CtorInitTextPaintInfo( pRenderContext, pNewFrame, SwRect() );
1426 
1427  m_bQuick = bNewQuick;
1428  m_bInterHyph = bNewInterHyph;
1429 
1431  m_bAutoHyph = InitHyph();
1432 
1433  m_bIgnoreFly = false;
1434  m_bFakeLineStart = false;
1435  m_bShift = false;
1436  m_bDropInit = false;
1437  m_bTestFormat = bTst;
1438  m_nLeft = 0;
1439  m_nRight = 0;
1440  m_nFirst = 0;
1441  m_nRealWidth = 0;
1442  m_nForcedLeftMargin = 0;
1443  m_pRest = nullptr;
1444  m_nLineHeight = 0;
1445  m_nLineNetHeight = 0;
1447 
1448  SvtCTLOptions::TextNumerals const nTextNumerals(
1449  SW_MOD()->GetCTLOptions().GetCTLTextNumerals());
1450  // cannot cache for NUMERALS_CONTEXT because we need to know the string
1451  // for the whole paragraph now
1452  if (nTextNumerals != SvtCTLOptions::NUMERALS_CONTEXT)
1453  {
1454  // set digit mode to what will be used later to get same results
1455  SwDigitModeModifier const m(*m_pRef, LANGUAGE_NONE /*dummy*/);
1456  assert(m_pRef->GetDigitLanguage() != LANGUAGE_NONE);
1458  }
1459 
1460  Init();
1461 }
1462 
1471 {
1472  if( !m_bInterHyph && !m_bAutoHyph )
1473  return false;
1474 
1475  LanguageType eTmp = GetFont()->GetLanguage();
1476  // TODO: check for more ideographic langs w/o hyphenation as a concept
1477  if ( LANGUAGE_DONTKNOW == eTmp || LANGUAGE_NONE == eTmp
1478  || !MsLangId::usesHyphenation(eTmp) )
1479  return false;
1480 
1481  uno::Reference< XHyphenator > xHyph = ::GetHyphenator();
1482  if (!xHyph.is())
1483  return false;
1484 
1485  if (m_bInterHyph)
1486  SvxSpellWrapper::CheckHyphLang( xHyph, eTmp );
1487 
1488  if (!xHyph->hasLocale(g_pBreakIt->GetLocale(eTmp)))
1489  {
1490  SfxObjectShell* pShell = m_pFrame->GetDoc().GetDocShell();
1491  if (pShell)
1492  {
1493  pShell->AppendInfoBarWhenReady(
1494  "hyphenationmissing", SwResId(STR_HYPH_MISSING),
1495  SwResId(STR_HYPH_MISSING_DETAIL)
1496  .replaceFirst("%1", LanguageTag::convertToBcp47( g_pBreakIt->GetLocale(eTmp))),
1497  InfobarType::WARNING);
1498  }
1499  }
1500 
1501  return xHyph->hasLocale( g_pBreakIt->GetLocale(eTmp) );
1502 }
1503 
1505 {
1507  if( 1 >= pDrop->GetLines() ||
1508  ( !pDrop->GetChars() && !pDrop->GetWholeWord() ) )
1509  pDrop = nullptr;
1510  return pDrop;
1511 }
1512 
1514 {
1515  // Not initialized: pRest, nLeft, nRight, nFirst, nRealWidth
1516  X(0);
1519 
1520  // generally we do not allow number portions in follows, except...
1521  if ( GetTextFrame()->IsFollow() )
1522  {
1523  const SwTextFrame* pMaster = GetTextFrame()->FindMaster();
1524  OSL_ENSURE(pMaster, "pTextFrame without Master");
1525  const SwLinePortion* pTmpPara = pMaster ? pMaster->GetPara() : nullptr;
1526 
1527  // there is a master for this follow and the master does not have
1528  // any contents (especially it does not have a number portion)
1529  m_bNumDone = ! pTmpPara ||
1530  ! static_cast<const SwParaPortion*>(pTmpPara)->GetFirstPortion()->IsFlyPortion();
1531  }
1532 
1533  m_pRoot = nullptr;
1534  m_pLast = nullptr;
1535  m_pFly = nullptr;
1536  m_pLastTab = nullptr;
1537  m_pUnderflow = nullptr;
1538  m_cTabDecimal = 0;
1540  m_nForcedLeftMargin = 0;
1544  m_cHookChar = 0;
1545  SetIdx(TextFrameIndex(0));
1547  SetPaintOfst(0);
1548 }
1549 
1550 SwTextFormatInfo::SwTextFormatInfo(OutputDevice* pRenderContext, SwTextFrame *pFrame, const bool bInterHyphL,
1551  const bool bQuickL, const bool bTst)
1552 {
1553  CtorInitTextFormatInfo(pRenderContext, pFrame, bInterHyphL, bQuickL, bTst);
1554 }
1555 
1565  SwLineLayout& rLay, SwTwips nActWidth ) :
1566  SwTextPaintInfo( rInf ),
1567  m_pRoot(&rLay),
1568  m_pLast(&rLay),
1569  m_pFly(nullptr),
1570  m_pUnderflow(nullptr),
1571  m_pRest(nullptr),
1572  m_pLastTab(nullptr),
1573  m_nSoftHyphPos(TextFrameIndex(0)),
1574  m_nLineStart(rInf.GetIdx()),
1575  m_nUnderScorePos(TextFrameIndex(COMPLETE_STRING)),
1576  m_nLeft(rInf.m_nLeft),
1577  m_nRight(rInf.m_nRight),
1578  m_nFirst(rInf.m_nLeft),
1579  m_nRealWidth(sal_uInt16(nActWidth)),
1580  m_nWidth(m_nRealWidth),
1581  m_nLineHeight(0),
1582  m_nLineNetHeight(0),
1583  m_nForcedLeftMargin(0),
1584  m_bFull(false),
1585  m_bFootnoteDone(true),
1586  m_bErgoDone(true),
1587  m_bNumDone(true),
1588  m_bArrowDone(true),
1589  m_bStop(false),
1590  m_bNewLine(true),
1591  m_bShift(false),
1592  m_bUnderflow(false),
1593  m_bInterHyph(false),
1594  m_bAutoHyph(false),
1595  m_bDropInit(false),
1596  m_bQuick(rInf.m_bQuick),
1597  m_bNoEndHyph(false),
1598  m_bNoMidHyph(false),
1599  m_bIgnoreFly(false),
1600  m_bFakeLineStart(false),
1601  m_bTabOverflow( false ),
1602  m_bTestFormat(rInf.m_bTestFormat),
1603  m_cTabDecimal(0),
1604  m_cHookChar(0),
1605  m_nMaxHyph(0)
1606 {
1607  SetMulti( true );
1608  SetFirstMulti( rInf.IsFirstMulti() );
1609 }
1610 
1612 {
1613  const sal_uInt16 nHeight = pCurr->GetRealHeight();
1614  for( SwLinePortion *pPor = pCurr->GetNextPortion(); pPor; pPor = pPor->GetNextPortion() )
1615  {
1616  if( pPor->IsFootnotePortion() && nHeight > static_cast<SwFootnotePortion*>(pPor)->Orig() )
1617  {
1618  SetLineHeight( nHeight );
1619  SetLineNetHeight( pCurr->Height() );
1620  return true;
1621  }
1622  }
1623  return false;
1624 }
1625 
1627  TextFrameIndex const nEnd)
1628 {
1629  m_cHookChar = 0;
1630  TextFrameIndex i = nStart;
1631 
1632  // Used for decimal tab handling:
1633  const sal_Unicode cTabDec = GetLastTab() ? GetTabDecimal() : 0;
1634  const sal_Unicode cThousandSep = ',' == cTabDec ? '.' : ',';
1635 
1636  // #i45951# German (Switzerland) uses ' as thousand separator
1637  const sal_Unicode cThousandSep2 = ',' == cTabDec ? '.' : '\'';
1638 
1639  bool bNumFound = false;
1641 
1642  for( ; i < nEnd; ++i )
1643  {
1644  const sal_Unicode cPos = GetChar( i );
1645  switch( cPos )
1646  {
1647  case CH_TXTATR_BREAKWORD:
1648  case CH_TXTATR_INWORD:
1649  if( !HasHint( i ))
1650  break;
1651  [[fallthrough]];
1652 
1653  case CHAR_SOFTHYPHEN:
1654  case CHAR_HARDHYPHEN:
1655  case CHAR_HARDBLANK:
1656  case CH_TAB:
1657  case CH_BREAK:
1658  case CHAR_ZWSP :
1659  case CHAR_WJ :
1660  m_cHookChar = cPos;
1661  return i;
1662 
1663  case CHAR_UNDERSCORE:
1665  m_nUnderScorePos = i;
1666  break;
1667 
1668  default:
1669  if ( cTabDec )
1670  {
1671  if( cTabDec == cPos )
1672  {
1673  OSL_ENSURE( cPos, "Unexpected end of string" );
1674  if( cPos ) // robust
1675  {
1676  m_cHookChar = cPos;
1677  return i;
1678  }
1679  }
1680 
1681  // Compatibility: First non-digit character behind a
1682  // a digit character becomes the hook character
1683  if ( bTabCompat )
1684  {
1685  if ( ( 0x2F < cPos && cPos < 0x3A ) ||
1686  ( bNumFound && ( cPos == cThousandSep || cPos == cThousandSep2 ) ) )
1687  {
1688  bNumFound = true;
1689  }
1690  else
1691  {
1692  if ( bNumFound )
1693  {
1694  m_cHookChar = cPos;
1695  SetTabDecimal( cPos );
1696  return i;
1697  }
1698  }
1699  }
1700  }
1701  }
1702  }
1703 
1704  // Check if character *behind* the portion has
1705  // to become the hook:
1706  if (i == nEnd && i < TextFrameIndex(GetText().getLength()) && bNumFound)
1707  {
1708  const sal_Unicode cPos = GetChar( i );
1709  if ( cPos != cTabDec && cPos != cThousandSep && cPos !=cThousandSep2 && ( 0x2F >= cPos || cPos >= 0x3A ) )
1710  {
1711  m_cHookChar = GetChar( i );
1713  }
1714  }
1715 
1716  return i;
1717 }
1718 
1720 {
1721  if( GetLast() )
1722  {
1723  if( GetLast()->IsKernPortion() )
1724  return true;
1725  if( GetLast()->Width() || ( GetLast()->GetLen() &&
1726  !GetLast()->IsHolePortion() ) )
1727  return false;
1728  }
1729  SwLinePortion* pPor = GetRoot();
1730  SwLinePortion *pKern = nullptr;
1731  while( pPor )
1732  {
1733  if( pPor->IsKernPortion() )
1734  pKern = pPor;
1735  else if( pPor->Width() || ( pPor->GetLen() && !pPor->IsHolePortion() ) )
1736  pKern = nullptr;
1737  pPor = pPor->GetNextPortion();
1738  }
1739  if( pKern )
1740  {
1741  SetLast( pKern );
1742  return true;
1743  }
1744  return false;
1745 }
1746 
1748 {
1749  SwTwips nLineWidth = Width() - X();
1750 
1751  const bool bTabOverMargin = GetTextFrame()->GetDoc().getIDocumentSettingAccess().get(
1753  const bool bTabOverSpacing = GetTextFrame()->GetDoc().getIDocumentSettingAccess().get(
1755  if (!bTabOverMargin && !bTabOverSpacing)
1756  return nLineWidth;
1757 
1758  SwTabPortion* pLastTab = GetLastTab();
1759  if (!pLastTab)
1760  return nLineWidth;
1761 
1762  // Consider tab portions over the printing bounds of the text frame.
1763  if (pLastTab->GetTabPos() <= Width())
1764  return nLineWidth;
1765 
1766  // Calculate the width that starts at the left (or in case of first line:
1767  // first) margin, but ends after the right paragraph margin:
1768  //
1769  // +--------------------+
1770  // |LL| |RR|
1771  // +--------------------+
1772  // ^ m_nLeftMargin (absolute)
1773  // ^ nLeftMarginWidth (relative to m_nLeftMargin), X() is relative to this
1774  // ^ right margin
1775  // ^ paragraph right
1776  // <--------------------> is GetTextFrame()->getFrameArea().Width()
1777  // <--------------> is Width()
1778  // <-----------------> is what we need to be able to compare to X() (nTextFrameWidth)
1779  SwTwips nLeftMarginWidth = m_nLeftMargin - GetTextFrame()->getFrameArea().Left();
1780  SwTwips nTextFrameWidth = GetTextFrame()->getFrameArea().Width() - nLeftMarginWidth;
1781 
1782  // If there is one such tab portion, then text is allowed to use the full
1783  // text frame area to the right (RR above, but not LL).
1784  nLineWidth = nTextFrameWidth - X();
1785 
1786  if (!bTabOverMargin) // thus bTabOverSpacing only
1787  {
1788  // right, center, decimal can back-fill all the available space - same as TabOverMargin
1789  if (pLastTab->GetWhichPor() == PortionType::TabLeft)
1790  nLineWidth = nTextFrameWidth - pLastTab->GetTabPos();
1791  }
1792  return nLineWidth;
1793 }
1794 
1796  const SwTextSizeInfo *pNew,
1797  const SwLinePortion *pPor,
1798  bool bTextLen,
1799  bool bExgLists,
1800  OUString const & rCh )
1801  : pOldText(nullptr)
1802  , m_pOldSmartTagList(nullptr)
1803  , m_pOldGrammarCheckList(nullptr)
1804  , nIdx(0)
1805  , nLen(0)
1806  , pInf(nullptr)
1807 {
1808  if( rCh.isEmpty() )
1809  {
1810  bOn = pPor->GetExpText( *pNew, aText );
1811  }
1812  else
1813  {
1814  aText = rCh;
1815  bOn = true;
1816  }
1817 
1818  // The text is replaced ...
1819  if( !bOn )
1820  return;
1821 
1822  pInf = const_cast<SwTextSizeInfo*>(pNew);
1823  nIdx = pInf->GetIdx();
1824  nLen = pInf->GetLen();
1825  pOldText = &(pInf->GetText());
1827  pInf->SetText( aText );
1828  pInf->SetIdx(TextFrameIndex(0));
1829  pInf->SetLen(bTextLen ? TextFrameIndex(pInf->GetText().getLength()) : pPor->GetLen());
1830  pInf->SetCachedVclData(nullptr);
1831 
1832  // ST2
1833  if ( !bExgLists )
1834  return;
1835 
1836  m_pOldSmartTagList = static_cast<SwTextPaintInfo*>(pInf)->GetSmartTags();
1837  if (m_pOldSmartTagList)
1838  {
1839  std::pair<SwTextNode const*, sal_Int32> pos(pNew->GetTextFrame()->MapViewToModel(nIdx));
1840  SwWrongList const*const pSmartTags(pos.first->GetSmartTags());
1841  if (pSmartTags)
1842  {
1843  const sal_uInt16 nPos = pSmartTags->GetWrongPos(pos.second);
1844  const sal_Int32 nListPos = pSmartTags->Pos(nPos);
1845  if (nListPos == pos.second && pSmartTags->SubList(nPos) != nullptr)
1846  {
1847  m_pTempIter.reset(new sw::WrongListIterator(*pSmartTags->SubList(nPos)));
1848  static_cast<SwTextPaintInfo*>(pInf)->SetSmartTags(m_pTempIter.get());
1849  }
1850  else if (!m_pTempList && nPos < pSmartTags->Count()
1851  && nListPos < pos.second && !aText.isEmpty())
1852  {
1854  m_pTempList->Insert( OUString(), nullptr, 0, aText.getLength(), 0 );
1856  static_cast<SwTextPaintInfo*>(pInf)->SetSmartTags(m_pTempIter.get());
1857  }
1858  else
1859  static_cast<SwTextPaintInfo*>(pInf)->SetSmartTags(nullptr);
1860  }
1861  else
1862  static_cast<SwTextPaintInfo*>(pInf)->SetSmartTags(nullptr);
1863  }
1864  m_pOldGrammarCheckList = static_cast<SwTextPaintInfo*>(pInf)->GetGrammarCheckList();
1866  return;
1867 
1868  std::pair<SwTextNode const*, sal_Int32> pos(pNew->GetTextFrame()->MapViewToModel(nIdx));
1869  SwWrongList const*const pGrammar(pos.first->GetGrammarCheck());
1870  if (pGrammar)
1871  {
1872  const sal_uInt16 nPos = pGrammar->GetWrongPos(pos.second);
1873  const sal_Int32 nListPos = pGrammar->Pos(nPos);
1874  if (nListPos == pos.second && pGrammar->SubList(nPos) != nullptr)
1875  {
1876  m_pTempIter.reset(new sw::WrongListIterator(*pGrammar->SubList(nPos)));
1877  static_cast<SwTextPaintInfo*>(pInf)->SetGrammarCheckList(m_pTempIter.get());
1878  }
1879  else if (!m_pTempList && nPos < pGrammar->Count()
1880  && nListPos < pos.second && !aText.isEmpty())
1881  {
1883  m_pTempList->Insert( OUString(), nullptr, 0, aText.getLength(), 0 );
1885  static_cast<SwTextPaintInfo*>(pInf)->SetGrammarCheckList(m_pTempIter.get());
1886  }
1887  else
1888  static_cast<SwTextPaintInfo*>(pInf)->SetGrammarCheckList(nullptr);
1889  }
1890  else
1891  static_cast<SwTextPaintInfo*>(pInf)->SetGrammarCheckList(nullptr);
1892 }
1893 
1895 {
1896  if( !bOn )
1897  return;
1898 
1900  pInf->SetText( *pOldText );
1901  pInf->SetIdx( nIdx );
1902  pInf->SetLen( nLen );
1903 
1904  // ST2
1905  // Restore old smart tag list
1906  if (m_pOldSmartTagList)
1907  static_cast<SwTextPaintInfo*>(pInf)->SetSmartTags(m_pOldSmartTagList);
1909  static_cast<SwTextPaintInfo*>(pInf)->SetGrammarCheckList(m_pOldGrammarCheckList);
1910 }
1911 
1913  SwAttrIter* pItr)
1914  : pInf(nullptr)
1915  , pFnt(pNew ? const_cast<SwTextSizeInfo&>(rInf).GetFont() : nullptr)
1916  , pIter(nullptr)
1917 {
1918  if( !pFnt )
1919  return;
1920 
1921  pInf = &const_cast<SwTextSizeInfo&>(rInf);
1922  // In these cases we temporarily switch to the new font:
1923  // 1. the fonts have a different magic number
1924  // 2. they have different script types
1925  // 3. their background colors differ (this is not covered by 1.)
1926  if( pFnt->DifferentFontCacheId( pNew, pFnt->GetActual() ) ||
1927  pNew->GetActual() != pFnt->GetActual() ||
1928  ( ! pNew->GetBackColor() && pFnt->GetBackColor() ) ||
1929  ( pNew->GetBackColor() && ! pFnt->GetBackColor() ) ||
1930  ( pNew->GetBackColor() && pFnt->GetBackColor() &&
1931  ( *pNew->GetBackColor() != *pFnt->GetBackColor() ) ) )
1932  {
1933  pNew->SetTransparent( true );
1934  pNew->SetAlign( ALIGN_BASELINE );
1935  pInf->SetFont( pNew );
1936  }
1937  else
1938  pFnt = nullptr;
1939  pNew->Invalidate();
1940  pNew->ChgPhysFnt( pInf->GetVsh(), *pInf->GetOut() );
1941  if( pItr && pItr->GetFnt() == pFnt )
1942  {
1943  pIter = pItr;
1944  pIter->SetFnt( pNew );
1945  }
1946 }
1947 
1949 {
1950  if( pFnt )
1951  {
1952  // Reset SwFont
1953  pFnt->Invalidate();
1954  pInf->SetFont( pFnt );
1955  if( pIter )
1956  {
1957  pIter->SetFnt( pFnt );
1959  }
1960  }
1961 }
1962 
1963 bool SwTextFormatInfo::ChgHyph( const bool bNew )
1964 {
1965  const bool bOld = m_bAutoHyph;
1966  if( m_bAutoHyph != bNew )
1967  {
1968  m_bAutoHyph = bNew;
1969  InitHyph( bNew );
1970  // Set language in the Hyphenator
1971  if( m_pFnt )
1973  }
1974  return bOld;
1975 }
1976 
1977 
1979 {
1980  if (m_nLastBookmarkPos != GetIdx())
1981  {
1983  return true;
1984  }
1985  else
1986  {
1987  return false;
1988  }
1989 }
1990 
1991 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool bOn
Definition: inftxt.hxx:685
void SetEndColor(const Color &rColor)
vcl::RenderContext * GetOut() const
Definition: viewsh.hxx:339
TextFrameIndex m_nLastBookmarkPos
need to check for bookmarks at every portion
Definition: inftxt.hxx:474
#define CHAR_WJ
Definition: swtypes.hxx:167
SwNodeOffset min(const SwNodeOffset &a, const SwNodeOffset &b)
Definition: nodeoffset.hxx:35
void SetLineNetHeight(const sal_uInt16 nNew)
Definition: inftxt.hxx:597
virtual void Height(const SwTwips nNew, const bool bText=true) override
Definition: porlay.cxx:225
OutDevType GetOutDevType() const
const sal_Unicode CH_BREAK
Definition: swfont.hxx:43
bool LastKernPortion()
Definition: inftxt.cxx:1719
bool IsFirstMulti() const
Definition: inftxt.hxx:205
VclPtr< OutputDevice > m_pRef
Definition: inftxt.hxx:143
Represents the visualization of a paragraph.
Definition: txtfrm.hxx:162
#define LANGUAGE_NONE
~SwLineInfo()
Definition: inftxt.cxx:95
static Color & GetFieldShadingsColor()
Definition: viewopt.cxx:461
void SwitchVerticalToHorizontal(SwRect &rRect) const
Calculates the coordinates of a rectangle when switching from vertical to horizontal layout...
Definition: txtfrm.cxx:583
const SvxHyphenZoneItem & GetHyphenZone(bool=true) const
Definition: paratr.hxx:206
sal_uInt16 GetLeftBorderSpace() const
Definition: swfont.hxx:907
#define DRAW_SPECIAL_OPTIONS_ROTATE
Definition: inftxt.cxx:84
void Right(const tools::Long nRight)
Definition: swrect.hxx:202
SwViewShell * GetVsh()
Definition: inftxt.hxx:221
void DrawBackBrush(const SwLinePortion &rPor) const
Definition: inftxt.cxx:1142
void SetSnapToGrid(const bool bN)
Definition: inftxt.hxx:216
const SwFormatDrop & GetDrop(bool=true) const
Definition: paratr.hxx:208
Marks a position in the document model.
Definition: pam.hxx:36
bool IsPagePreview() const
Definition: viewopt.hxx:635
SwRect m_aPaintRect
Definition: inftxt.hxx:348
bool GetWholeWord() const
Definition: paratr.hxx:107
const SvxForbiddenRuleItem & GetForbiddenRule(bool=true) const
Definition: paratr.hxx:216
bool IsInDocBody() const
Definition: frame.hxx:943
bool CheckFootnotePortion_(SwLineLayout const *pCurr)
Definition: inftxt.cxx:1611
bool InSpaceGrp() const
Definition: porlin.hxx:113
const css::beans::PropertyValues & GetHyphValues() const
Definition: inftxt.cxx:1396
void setWidth(tools::Long nWidth)
SwFont * GetFont()
Definition: inftxt.hxx:231
const Point & GetRefPoint() const
const SvxTabStopItem & GetTabStops(bool=true) const
Definition: paratr.hxx:204
SwDocShell * GetDocShell()
Definition: doc.hxx:1351
bool InNumberGrp() const
Definition: porlin.hxx:106
static void lcl_InitHyphValues(PropertyValues &rVals, sal_Int16 nMinLeading, sal_Int16 nMinTrailing, bool bNoCapsHyphenation)
Definition: inftxt.cxx:1362
bool IsTransparent() const
sal_Unicode m_cTabDecimal
Definition: inftxt.hxx:509
void SetPos(const Point &rNew)
Definition: inftxt.hxx:430
void Left(const tools::Long nLeft)
Definition: swrect.hxx:197
virtual tools::Long CalcSpacing(tools::Long nSpaceAdd, const SwTextSizeInfo &rInf) const
Definition: porlin.cxx:306
bool m_bForbiddenChars
Definition: inftxt.hxx:173
bool GetJoinBorderWithPrev() const
Definition: porlin.hxx:174
void SwitchHorizontalToVertical(SwRect &rRect) const
Calculates the coordinates of a rectangle when switching from horizontal to vertical layout...
Definition: txtfrm.cxx:476
TextFrameIndex m_nLen
Definition: inftxt.hxx:156
sal_Unicode GetTabDecimal() const
Definition: inftxt.hxx:617
static OUString convertToBcp47(LanguageType nLangID)
sal_uInt8 GetLines() const
Definition: paratr.hxx:101
long Long
constexpr::Color COL_TRANSPARENT(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
sal_uInt16 m_nDefTabStop
Definition: inftxt.hxx:67
FAMILY_DONTKNOW
bool IsPostIts() const
Definition: viewopt.hxx:273
void Push(vcl::PushFlags nFlags=vcl::PushFlags::ALL)
SwLineBreakClear
Defines the location of a line break text wrapping restart.
constexpr::Color COL_AUTO(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
void SetLast(SwLinePortion *pNewLast)
Definition: inftxt.hxx:562
SwTabPortion * GetLastTab()
Definition: inftxt.hxx:615
static std::shared_ptr< const vcl::text::TextLayoutCache > CreateTextLayoutCache(OUString const &)
Size GetTextSize_(SwDrawTextInfo &rInf)
Definition: swfont.hxx:310
TextFrameIndex ScanPortionEnd(TextFrameIndex nStart, TextFrameIndex nEnd)
Definition: inftxt.cxx:1626
tools::Long GetLen(const Point &rPnt)
Definition: doc.hxx:187
void DrawBorder(const SwLinePortion &rPor) const
Draw character border around a line portion.
Definition: inftxt.cxx:1292
Size SvLSize() const
Definition: possiz.hxx:53
bool DifferentFontCacheId(const SwFont *pFnt, SwFontScript nWhich)
Definition: swfont.hxx:202
void SetKanaComp(short nNew)
Definition: drawfont.hxx:556
SwParaPortion * GetPara()
Definition: txtcache.cxx:90
SwFont * m_pFnt
Definition: inftxt.hxx:150
SwTextSizeInfo * pInf
Definition: inftxt.hxx:698
bool GetListTabStopPosition(tools::Long &nListTabStopPosition) const
Retrieves the list tab stop position, if the paragraph's list level defines one and this list tab sto...
Definition: ndtxt.cxx:4511
const SvxBrushItem * m_pBrushItem
Definition: inftxt.hxx:345
bool m_bFootnoteDone
Definition: inftxt.hxx:488
void SetScriptSpace(const bool bNew)
Definition: inftxt.hxx:212
#define CHAR_HARDBLANK
Definition: swtypes.hxx:161
const MapMode & GetMapMode() const
std::map< sal_Int32, std::shared_ptr< SetItemPropertyStorage > > PropertyValues
const OUString * pOldText
Definition: inftxt.hxx:678
bool IsHangingPortion() const
Definition: porlin.hxx:137
#define CH_TXTATR_NEWLINE
Definition: hintids.hxx:176
void DrawText(const OUString &rText, const SwLinePortion &rPor, TextFrameIndex nIdx=TextFrameIndex(0), TextFrameIndex nLen=TextFrameIndex(COMPLETE_STRING), const bool bKern=false) const
Definition: inftxt.hxx:747
tools::Long GetSpaceAdd() const
Definition: inftxt.hxx:441
void NoteAnimation() const
Definition: inftxt.cxx:373
void Pos(const Point &rNew)
Definition: swrect.hxx:171
void SetBorder(sal_uInt16 nBorder)
const Size & GetSize(SwFontScript nWhich) const
Definition: swfont.hxx:206
constexpr OUStringLiteral UPN_HYPH_MIN_TRAILING
void DrawPostIts(bool bScript) const
Definition: inftxt.cxx:1040
IDocumentMarkAccess * getIDocumentMarkAccess()
Definition: docbm.cxx:1792
void SetText(const OUString &rNew)
Definition: inftxt.hxx:276
void SetMulti(const bool bNew)
Definition: inftxt.hxx:204
Of course Writer needs its own rectangles.
Definition: swrect.hxx:34
bool InFieldGrp() const
Definition: porlin.hxx:108
const OUString & GetText() const
Returns the text portion we want to edit (for inline see underneath)
Definition: txtfrm.cxx:1296
bool HasHint(TextFrameIndex nPos) const
Definition: inftxt.cxx:474
sal_uInt16 m_nKanaIdx
Definition: inftxt.hxx:157
void SetFrame(const SwTextFrame *pNewFrame)
Definition: drawfont.hxx:174
tools::Long m_nListTabStopPosition
Definition: inftxt.hxx:69
SwPosSize GetTextSize(OutputDevice *pOut, const SwScriptInfo *pSI, const OUString &rText, TextFrameIndex nIdx, TextFrameIndex nLen) const
Definition: inftxt.cxx:382
void DrawText_(const OUString &rText, const SwLinePortion &rPor, const TextFrameIndex nIdx, const TextFrameIndex nLen, const bool bKern, const bool bWrong=false, const bool bSmartTag=false, const bool bGrammarCheck=false)
Definition: inftxt.cxx:589
void SetHanging(const bool bNew)
Definition: inftxt.hxx:210
sal_uInt8 & MaxHyph()
Definition: inftxt.hxx:554
void SetEndIntensity(sal_uInt16 nIntens)
Collection of SwLineLayout instances, represents the paragraph text in Writer layout.
Definition: porlay.hxx:250
Degree10 GetOrientation(const bool bVertLayout=false, const bool bVertFormatLRBT=false) const
Definition: swfont.cxx:412
#define DRAW_SPECIAL_OPTIONS_CENTER
Definition: inftxt.cxx:83
bool IsMulti() const
Definition: inftxt.hxx:203
bool ChgHyph(const bool bNew)
Definition: inftxt.cxx:1963
bool m_bHanging
Definition: inftxt.hxx:171
bool m_bFakeLineStart
Definition: inftxt.hxx:503
void DrawText_(SwDrawTextInfo &rInf)
Definition: swfont.hxx:318
bool IsVertLRBT() const
Definition: frame.hxx:983
void AddTop(const tools::Long nAdd)
Definition: swrect.cxx:128
void SetColor(const Color &rColor)
Definition: swfont.hxx:418
size_t CountCompChg() const
Definition: scriptinfo.hxx:162
#define CHAR_SOFTHYPHEN
Definition: swtypes.hxx:163
#define CHAR_LEFT_ARROW
Definition: inftxt.cxx:76
static OutputDevice * GetDefaultDevice()
SwTwips m_nFirst
Definition: inftxt.hxx:478
OUString SwResId(TranslateId aId)
Definition: swmodule.cxx:164
constexpr tools::Long Width() const
Point TopLeft() const
Definition: swrect.hxx:254
static sal_uInt16 GetPostItsWidth(const OutputDevice *pOut)
Definition: viewopt.cxx:138
sal_Int32 m_nPosition
current iteration index in text node
Definition: itratr.hxx:52
#define CH_TXTATR_BREAKWORD
Definition: hintids.hxx:173
SwTwips m_nRight
Definition: inftxt.hxx:477
void SetSteps(sal_uInt16 nSteps)
sal_uInt16 sal_Unicode
#define CH_TXTATR_INWORD
Definition: hintids.hxx:174
void AppendInfoBarWhenReady(const OUString &sId, const OUString &sPrimaryMessage, const OUString &sSecondaryMessage, InfobarType aInfobarType, bool bShowCloseButton=true)
#define UPH_HYPH_NO_CAPS
void SetOfsY(sal_uInt16 nOfsY)
void SwAlignRect(SwRect &rRect, const SwViewShell *pSh, const vcl::RenderContext *pRenderContext)
Function is also used outside this file.
Definition: paintfrm.cxx:1126
#define CHAR_LINEBREAK_RTL
Definition: inftxt.cxx:81
bool IsBreakPortion() const
Definition: porlin.hxx:118
const SwRect & getFrameArea() const
Definition: frame.hxx:179
OUTDEV_WINDOW
size_t pos
const vcl::Font & GetFont() const
void SetFnt(SwFont *pNew)
Definition: itratr.hxx:61
sal_Unicode GetChar(TextFrameIndex const nPos) const
Definition: inftxt.hxx:240
virtual ::sw::mark::IFieldmark * getFieldmarkFor(const SwPosition &pos) const =0
void SetUnderFnt(SwUnderlineFont *pULFnt)
Definition: drawfont.hxx:566
sal_uInt16 GetAscent(SwViewShell const *pSh, const OutputDevice &rOut)
Definition: swfont.hxx:327
void SetOut(OutputDevice &rNew)
Definition: drawfont.hxx:396
TextFrameIndex nLen
Definition: inftxt.hxx:684
SwBreakIt * g_pBreakIt
Definition: breakit.cxx:33
SwRect & Intersection(const SwRect &rRect)
Definition: swrect.cxx:57
void CtorInitLineInfo(const SwAttrSet &rAttrSet, const SwTextNode &rTextNode)
Definition: inftxt.cxx:99
void SetLayoutMode(vcl::text::ComplexTextLayoutFlags nTextLayoutMode)
bool m_bScriptSpace
Definition: inftxt.hxx:172
void DrawCheckBox(const SwFieldFormCheckboxPortion &rPor, bool bChecked) const
Definition: inftxt.cxx:1087
oslFileHandle & pOut
void SetStartColor(const Color &rColor)
void DrawViewOpt(const SwLinePortion &rPor, PortionType nWhich, const Color *pColor=nullptr) const
Definition: inftxt.cxx:1304
bool m_bNotEOL
Definition: inftxt.hxx:159
SwLinePortion * m_pUnderflow
Definition: inftxt.hxx:466
void Width(tools::Long nNew)
Definition: swrect.hxx:189
vcl::RenderContext * GetRefDev()
Definition: inftxt.hxx:228
bool m_bListTabStopIncluded
Definition: inftxt.hxx:68
void CtorInitTextFormatInfo(OutputDevice *pRenderContext, SwTextFrame *pFrame, const bool bInterHyph=false, const bool bQuick=false, const bool bTst=false)
Definition: inftxt.cxx:1422
sal_uInt8 GetDirection() const
Definition: inftxt.hxx:217
void CtorInitTextSizeInfo(OutputDevice *pRenderContext, SwTextFrame *pFrame, TextFrameIndex nIdx)
Definition: inftxt.cxx:245
void ChgPhysFnt(SwViewShell const *pSh, OutputDevice &rOut)
Definition: swfont.cxx:893
void DrawTextOpaque(SwDrawTextInfo &rInf)
This method is called by DrawText().
Definition: txtfly.cxx:449
const std::optional< Color > & GetBackColor() const
Definition: swfont.hxx:192
constexpr OUStringLiteral UPN_IS_GRAMMAR_AUTO
void DrawLine(const Point &rStartPt, const Point &rEndPt)
void SetHyphPos(TextFrameIndex *const pNew)
Definition: drawfont.hxx:409
const SvxHangingPunctuationItem & GetHangingPunctuation(bool=true) const
Definition: paratr.hxx:214
const ::std::vector< Color > ImpSvNumberformatScan::StandardColor COL_LIGHTRED
SwFontScript GetActual() const
Definition: swfont.hxx:184
bool IsBlank(bool bHard=false) const
Definition: viewopt.hxx:225
void SetPaintOfst(const SwTwips nNew)
Definition: inftxt.hxx:742
void DrawRect(const tools::Rectangle &rRect)
bool InFixMargGrp() const
Definition: porlin.hxx:112
TextFrameIndex GetOffset() const
Definition: txtfrm.hxx:442
void DrawBackground(const SwLinePortion &rPor, const Color *pColor=nullptr) const
Definition: inftxt.cxx:1118
This portion represents a part of the paragraph string.
Definition: portxt.hxx:26
sal_uInt16 m_nRealWidth
Definition: inftxt.hxx:481
SwTwips Y() const
Definition: inftxt.hxx:381
Point BottomRight() const
Definition: swrect.hxx:266
sal_uInt16 m_nWidth
Definition: inftxt.hxx:482
SwTextSizeInfo * pInf
Definition: inftxt.hxx:686
bool m_bTestFormat
Definition: inftxt.hxx:507
const SwViewOption & GetOpt() const
Definition: inftxt.hxx:238
void SetStyleName(const OUString &rStyleName, const SwFontScript nWhich)
Definition: swfont.hxx:481
SwTextNode const * GetTextNodeForParaProps() const
Definition: txtfrm.cxx:1306
void SetLineColor()
sal_uInt16 m_nLineNetHeight
Definition: inftxt.hxx:484
bool m_bStopUnderflow
Definition: inftxt.hxx:161
SwPosSize GetTextSize() const
Definition: inftxt.cxx:396
UNDERLYING_TYPE get() const
ALIGN_BASELINE
void SetTransparent(const bool bTrans)
Definition: swfont.hxx:647
css::beans::PropertyValues m_aHyphVals
Definition: inftxt.hxx:461
TextFrameIndex m_nIdx
Definition: inftxt.hxx:155
tools::Long GetKanaDiff() const
Definition: drawfont.hxx:290
#define SW_MOD()
Definition: swmodule.hxx:255
#define DIR_LEFT2RIGHT
Definition: inftxt.hxx:54
#define CHAR_TAB
Definition: inftxt.cxx:78
virtual bool GetExpText(const SwTextSizeInfo &rInf, OUString &rText) const
Definition: porlin.cxx:311
int i
TextFrameIndex m_nTextStart
Definition: inftxt.hxx:109
TextFrameIndex m_nUnderScorePos
enlarge repaint if underscore has been found
Definition: inftxt.hxx:473
Collection of SwLinePortion instances, representing one line of text.
Definition: porlay.hxx:78
const SvxParaVertAlignItem & GetParaVertAlign(bool=true) const
Definition: paratr.hxx:218
SwTwips GetRealHeight() const
Definition: porlay.hxx:169
SwTwips GetLineWidth()
Returns the distance between the current horizontal position and the end of the line.
Definition: inftxt.cxx:1747
static SwSmartTagMgr & Get()
vcl::RenderContext * GetOut()
Definition: inftxt.hxx:224
void SetFont(SwFont *pNew)
Definition: inftxt.hxx:233
void DrawLineBreak(const SwLinePortion &rPor) const
Definition: inftxt.cxx:961
SwTextFly & GetTextFly()
Definition: inftxt.hxx:384
const sal_Unicode CH_TAB
Definition: swfont.hxx:44
void AddBottom(const tools::Long nAdd)
Definition: swrect.cxx:130
SwTextFly m_aTextFly
Definition: inftxt.hxx:346
SwParaPortion * GetParaPortion()
Definition: inftxt.hxx:121
css::uno::Any GetProperty(std::u16string_view rPropertyName) const
bool IsFlyPortion() const
Definition: porlin.hxx:131
Count
const OUString * m_pText
Definition: inftxt.hxx:154
void SetVertical(Degree10 nDir, const bool bVertLayout=false, const bool bVertLayoutLRBT=false)
Definition: swfont.cxx:417
bool InitHyph(const bool bAuto=false)
Definition: inftxt.cxx:1403
std::unique_ptr< SwWrongList > m_pTempList
Definition: inftxt.hxx:681
SwTextSlot(const SwTextSizeInfo *pNew, const SwLinePortion *pPor, bool bTextLen, bool bExgLists, OUString const &rCh=OUString())
Definition: inftxt.cxx:1795
const sal_Unicode CH_BLANK
Definition: swfont.hxx:42
bool IsKernPortion() const
Definition: porlin.hxx:138
void SelectFont()
Definition: inftxt.cxx:364
SwLineInfo()
Definition: inftxt.cxx:86
Align GetValue() const
void SetCachedVclData(std::shared_ptr< const vcl::text::TextLayoutCache > const &pCachedVclData)
Definition: inftxt.hxx:333
bool HasArea() const
Definition: swrect.hxx:300
void SetFillColor()
sw::WrongListIterator * m_pGrammarCheckList
Definition: inftxt.hxx:342
const Color & GetLineColor() const
#define CHAR_UNDERSCORE
Definition: inftxt.cxx:75
#define CH_TXT_ATR_FIELDSTART
Definition: hintids.hxx:182
void CalcRect(const SwLinePortion &rPor, SwRect *pRect, SwRect *pIntersect=nullptr, const bool bInsideBox=false) const
Calculate the rectangular area where the portion takes place.
Definition: inftxt.cxx:719
sal_uInt16 Width() const
Definition: inftxt.hxx:528
constexpr OUStringLiteral UPN_HYPH_MIN_LEADING
void PaintCharacterBorder(const SwFont &rFont, const SwRect &rPaintArea, const bool bVerticalLayout, const bool bVerticalLayoutLRBT, const bool bJoinWithPrev, const bool bJoinWithNext)
Paint border around a run of characters using frame painting code.
Definition: paintfrm.cxx:4922
SwLineLayout * GetRoot()
Definition: inftxt.hxx:557
const SwFormatDrop * GetDropFormat() const
Definition: inftxt.cxx:1504
constexpr OUStringLiteral UPN_HYPH_NO_CAPS
SwUnderlineFont * m_pUnderFnt
Definition: inftxt.hxx:151
#define LANGUAGE_DONTKNOW
bool IsSmartTagsEnabled() const
void DrawStretchText_(SwDrawTextInfo &rInf)
Definition: swfont.hxx:321
PortionType
Definition: txttypes.hxx:23
sal_uInt16 GetTabPos() const
Definition: portab.hxx:38
sal_uInt8 m_nDirection
Definition: inftxt.hxx:175
sal_Unicode m_cHookChar
Definition: inftxt.hxx:510
sw::WrongListIterator * m_pSmartTags
Definition: inftxt.hxx:343
SwFont * GetFnt()
Definition: itratr.hxx:103
#define NON_PRINTING_CHARACTER_COLOR
Definition: txtfrm.hxx:53
#define CHAR_ZWSP
Definition: swtypes.hxx:166
void DrawTab(const SwLinePortion &rPor) const
Definition: inftxt.cxx:944
const std::optional< editeng::SvxBorderLine > & GetLeftBorder() const
Definition: swfont.hxx:346
SwAttrIter * pIter
Definition: inftxt.hxx:700
SwLineBreakClear GetClear() const
Definition: porrst.cxx:218
SwTwips m_nLeft
Definition: inftxt.hxx:476
TextFrameIndex GetIdx() const
Definition: inftxt.hxx:272
#define SPECIAL_FONT_HEIGHT
Definition: porrst.hxx:38
const IDocumentSettingAccess * getIDocumentSettingAccess() const
Provides access to the document setting interface.
Definition: node.cxx:2100
bool IsDropPortion() const
Definition: porlin.hxx:127
void DrawRect(const SwRect &rRect, bool bRetouche) const
Definition: inftxt.cxx:932
void SetTabDecimal(const sal_Unicode cNew)
Definition: inftxt.hxx:618
const SvxLineSpacingItem & GetLineSpacing(bool=true) const
Definition: paratr.hxx:192
const AllSettings & GetSettings() const
bool IsOnlineSpell() const
Definition: viewopt.hxx:371
void AddRight(const tools::Long nAdd)
Definition: swrect.cxx:127
SwTwips Height() const
Definition: possiz.hxx:49
DrawModeFlags GetDrawMode() const
sal_uInt8 GetChars() const
Definition: paratr.hxx:104
vcl::Font GetFont(vcl::Font const &rFont, DrawModeFlags nDrawMode, StyleSettings const &rStyleSettings)
bool m_bFootnoteInside
Definition: inftxt.hxx:162
static bool IsFieldShadings()
Definition: viewopt.hxx:671
void SetOfsX(sal_uInt16 nOfsX)
const Color & GetColor() const
Definition: swfont.hxx:277
bool SnapToGrid() const
Definition: inftxt.hxx:215
TextFrameIndex GetLen() const
Definition: porlin.hxx:76
void CtorInitTextPaintInfo(OutputDevice *pRenderContext, SwTextFrame *pFrame, const SwRect &rPaint)
Definition: inftxt.cxx:480
SwTextFrame * GetTextFrame()
Definition: inftxt.hxx:285
SwLineLayout * m_pRoot
Definition: inftxt.hxx:463
sal_Int32 nLineWidth
std::pair< SwTextNode *, sal_Int32 > MapViewToModel(TextFrameIndex nIndex) const
map position in potentially merged text frame to SwPosition
Definition: txtfrm.cxx:1234
static void PaintPostIts(OutputDevice *pOut, const SwRect &rRect, bool bIsScript)
Definition: viewopt.cxx:144
tools::Long SwTwips
Definition: swtypes.hxx:51
bool IsNoSymbol() const
Definition: inftxt.hxx:279
SwTabPortion * m_pLastTab
Definition: inftxt.hxx:469
const OUString & GetText() const
Definition: inftxt.hxx:239
virtual void Format(vcl::RenderContext *pRenderContext, const SwBorderAttrs *pAttrs=nullptr) override
Definition: frmform.cxx:1791
bool IsHolePortion() const
Definition: porlin.hxx:132
SwTextFrame * m_pFrame
Definition: inftxt.hxx:152
VclPtr< OutputDevice > m_pOut
Definition: inftxt.hxx:142
SwTwips & GetAscent()
Definition: porlin.hxx:79
static void ChkOutDev(const SwTextSizeInfo &rInf)
Definition: inftxt.cxx:162
void CtorInitTextInfo(SwTextFrame *pFrame)
Definition: inftxt.cxx:143
const Point & GetPos() const
Definition: inftxt.hxx:429
void SetForbiddenChars(const bool bN)
Definition: inftxt.hxx:214
#define CHAR_RIGHT_ARROW
Definition: inftxt.cxx:77
bool m_bOtherThanFootnoteInside
Definition: inftxt.hxx:163
SwTwips X() const
Definition: inftxt.hxx:379
void SwitchLTRtoRTL(SwRect &rRect) const
Calculates the coordinates of a rectangle when switching from LTR to RTL layout.
Definition: txtfrm.cxx:686
#define CHAR_LINEBREAK
Definition: inftxt.cxx:80
Base class for anything that can be part of a line in the Writer layout.
Definition: porlin.hxx:51
void SetAngle(Degree10 nAngle)
void AddLeft(const tools::Long nAdd)
Definition: swrect.cxx:125
static void lcl_DrawSpecial(const SwTextPaintInfo &rTextPaintInfo, const SwLinePortion &rPor, SwRect &rRect, const Color &rCol, sal_Unicode cChar, sal_uInt8 nOptions)
Draws a special portion E.g.
Definition: inftxt.cxx:822
bool m_bFirstMulti
Definition: inftxt.hxx:166
sal_uInt16 m_nLineHeight
Definition: inftxt.hxx:483
const css::lang::Locale & GetLocale(const LanguageType aLang)
Definition: breakit.hxx:67
void Bottom(const tools::Long nBottom)
Definition: swrect.hxx:211
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:79
const SwViewOption * m_pOpt
Definition: inftxt.hxx:153
std::deque< sal_uInt16 > * m_pKanaComp
Definition: inftxt.hxx:137
#define CHAR_TAB_RTL
Definition: inftxt.cxx:79
LanguageType GetLanguage() const
Definition: swfont.hxx:283
#define CHAR_HARDHYPHEN
Definition: swtypes.hxx:162
static bool usesHyphenation(LanguageType nLang)
void SwitchRTLtoLTR(SwRect &rRect) const
Calculates the coordinates of a rectangle when switching from RTL to LTR layout.
Definition: txtfrm.hxx:739
#define DIR_RIGHT2LEFT
Definition: inftxt.hxx:56
bool IsHyphenate() const
If the Hyphenator returns ERROR or the language is set to NOLANGUAGE we do not hyphenate.
Definition: inftxt.cxx:1470
tools::Rectangle SVRect() const
Definition: swrect.hxx:292
void SetLen(const TextFrameIndex nNew)
Definition: inftxt.hxx:275
SwTwips Width() const
Definition: possiz.hxx:51
OUString aText
Definition: inftxt.hxx:676
void SetFirstMulti(const bool bNew)
Definition: inftxt.hxx:206
void SetAlign(const TextAlign eAlign)
Definition: swfont.hxx:521
SwTextFrame * FindMaster() const
Definition: flowfrm.cxx:737
constexpr tools::Long Height() const
void SetSize(const Size &rSize, const SwFontScript nWhich)
Definition: swfont.hxx:741
unsigned char sal_uInt8
PortionType GetWhichPor() const
Definition: porlin.hxx:99
OUString const & GetDefBulletFontname()
retrieve font family name used for the default bullet list characters
Definition: number.cxx:1381
const SvxLineSpacingItem * m_pSpace
Definition: inftxt.hxx:65
LanguageType GetDigitLanguage() const
std::unique_ptr< sw::WrongListIterator > m_pTempIter
Definition: inftxt.hxx:682
const SvxParaGridItem & GetParaGrid(bool=true) const
Definition: paratr.hxx:220
const SvxScriptSpaceItem & GetScriptSpace(bool=true) const
Definition: paratr.hxx:212
sal_uInt16 m_nSpaceIdx
Definition: inftxt.hxx:350
#define SAL_INFO(area, stream)
IDocumentSettingAccess const & getIDocumentSettingAccess() const
Definition: doc.cxx:176
bool OnWin() const
Definition: inftxt.hxx:192
std::optional< SvxTabStopItem > m_oRuler
Definition: inftxt.hxx:64
bool IsRightToLeft() const
Definition: frame.hxx:987
void SetFamily(const FontFamily eFamily, const SwFontScript nWhich)
Definition: swfont.hxx:455
void Top(const tools::Long nTop)
Definition: swrect.hxx:206
void SetCharSet(const rtl_TextEncoding eCharSet, const SwFontScript nWhich)
Definition: swfont.hxx:494
TextFrameIndex GetLen() const
Definition: inftxt.hxx:274
void SetSnapToGrid(bool bNew)
Definition: drawfont.hxx:597
sw::WrongListIterator * m_pWrongList
Definition: inftxt.hxx:341
bool IsFootnoteAllowed() const
Definition: ftnfrm.cxx:887
virtual editeng::HangulHanjaConversion::ConversionDirection GetDirection(editeng::HangulHanjaConversion::ConversionDirection _eDefaultDirection) const override
SwTwips m_nLeftMargin
First or left margin, depending on context.
Definition: inftxt.hxx:480
void SetLineStart(TextFrameIndex const nNew)
Definition: inftxt.hxx:591
bool InTextGrp() const
Definition: porlin.hxx:102
SwFontSave(const SwTextSizeInfo &rInf, SwFont *pFnt, SwAttrIter *pItr=nullptr)
Definition: inftxt.cxx:1912
SwParaPortion * m_pPara
Definition: inftxt.hxx:108
sw::WrongListIterator * m_pOldSmartTagList
Definition: inftxt.hxx:679
SwScriptInfo & GetScriptInfo()
Definition: porlay.hxx:291
double getLength(const B2DPolygon &rCandidate)
SwFontScript
Definition: swfont.hxx:123
SwLinePortion * GetLast()
Definition: inftxt.hxx:561
const Color & GetHighlightColor() const
Definition: swfont.hxx:194
void Invalidate()
Definition: swfont.hxx:335
SwFont * pFnt
Definition: inftxt.hxx:699
virtual bool get(DocumentSettingId id) const =0
Return the specified document setting.
bool CheckCurrentPosBookmark()
Definition: inftxt.cxx:1978
TextFrameIndex nIdx
Definition: inftxt.hxx:683
bool m_bURLNotify
Definition: inftxt.hxx:160
const SwAttrSet & GetSwAttrSet() const
Does node has already its own auto-attributes? Access to SwAttrSet.
Definition: node.hxx:724
void SetName(const OUString &rName, const SwFontScript nWhich)
Definition: swfont.hxx:468
TextFrameIndex GetTextBreak(SwDrawTextInfo const &rInf, tools::Long nTextWidth)
Definition: fntcache.cxx:2213
void DrawRedArrow(const SwLinePortion &rPor) const
Definition: inftxt.cxx:1008
#define UPH_HYPH_MIN_LEADING
constexpr sal_Int32 COMPLETE_STRING
Definition: swtypes.hxx:57
SwLinePortion * m_pLast
Definition: inftxt.hxx:464
SwTextInfo()
Definition: inftxt.hxx:112
void setHeight(tools::Long nHeight)
bool m_bTabOverflow
Definition: inftxt.hxx:506
Point TopRight() const
Definition: swrect.hxx:258
static TextFrameIndex GetMinLen(const SwTextSizeInfo &rInf)
Definition: inftxt.cxx:173
bool IsVertical() const
Definition: frame.hxx:973
uno::Reference< linguistic2::XHyphenator > GetHyphenator()
Definition: swtypes.cxx:57
TextFrameIndex GetTextBreak(const tools::Long nLineWidth, const TextFrameIndex nMaxLen, const sal_uInt16 nComp, vcl::text::TextLayoutCache const *) const
Definition: inftxt.cxx:433
#define SPACING_PRECISION_FACTOR
Definition: scriptinfo.hxx:40
#define SAL_WARN(area, stream)
bool HasMarkedLabel() const
Returns if this text node has a marked label.
Definition: ndtxt.cxx:2908
void SetLineHeight(const sal_uInt16 nNew)
Definition: inftxt.hxx:595
SwDoc & GetDoc()
Definition: txtfrm.hxx:464
void SetFont(SwFont *pNew)
Definition: drawfont.hxx:471
static sal_Int16 CheckHyphLang(css::uno::Reference< css::linguistic2::XHyphenator >const &xHyph, LanguageType nLang)
bool IsOn() const
Definition: txtfly.hxx:319
tuple m
If SwFormatDrop is a Client, it is the CharFormat that describes the font for the DropCaps...
Definition: paratr.hxx:62
bool IsRotated() const
Definition: inftxt.hxx:219
void SetStyle(GradientStyle eStyle)
void CtorInitTextFly(const SwTextFrame *pFrame)
Definition: txtfly.cxx:356
sal_uInt16 GetKanaComp() const
Definition: inftxt.hxx:325
bool GetJoinBorderWithNext() const
Definition: porlin.hxx:175
SwLinePortion * GetNextPortion() const
Definition: porlin.hxx:74
SwTextFormatInfo(OutputDevice *pRenderContext, SwTextFrame *pFrame, const bool bInterHyphL=false, const bool bQuickL=false, const bool bTst=false)
Definition: inftxt.cxx:1550
static bool FlushVout()
Output virtual Device (e.g. for animations)
Definition: virtoutp.cxx:30
void SetIdx(const TextFrameIndex nNew)
Definition: inftxt.hxx:273
sal_uInt16 m_nForcedLeftMargin
Definition: inftxt.hxx:485
SwViewShell * GetCurrShell() const
Definition: rootfrm.hxx:206
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...
SwViewShell * m_pVsh
Definition: inftxt.hxx:139
void Height(tools::Long nNew)
Definition: swrect.hxx:193
std::shared_ptr< const vcl::text::TextLayoutCache > m_pOldCachedVclData
Definition: inftxt.hxx:677
SwPosition MapViewToModelPos(TextFrameIndex nIndex) const
Definition: txtfrm.cxx:1249
SvxParaVertAlignItem::Align m_nVertAlign
Definition: inftxt.hxx:66
#define UPH_HYPH_MIN_TRAILING
#define LINE_BREAK_WIDTH
Definition: porrst.hxx:37
tools::Long GetHeight() const
Definition: swfont.hxx:284
SwRootFrame * getRootFrame()
Definition: frame.hxx:679
const std::shared_ptr< const vcl::text::TextLayoutCache > & GetCachedVclData() const
Definition: inftxt.hxx:329
SwNoteURL * pNoteURL
Definition: noteurl.cxx:23
TextFrameIndex m_nSoftHyphPos
SoftHyphPos for Hyphenation.
Definition: inftxt.hxx:471
void SetStartIntensity(sal_uInt16 nIntens)
sal_uInt16 nPos
const Color & GetFillColor() const
SwLinePortion * m_pRest
Definition: inftxt.hxx:467
sal_uInt16 GetAscent() const
Definition: inftxt.hxx:707
Point BottomLeft() const
Definition: swrect.hxx:262
bool m_bDetectedRangeSegmentation false
std::vector< tools::Long > * m_pSpaceAdd
Definition: inftxt.hxx:344
sw::WrongListIterator * m_pOldGrammarCheckList
Definition: inftxt.hxx:680
bool IsBlankPortion() const
Definition: porlin.hxx:117
SwFlyPortion * m_pFly
Definition: inftxt.hxx:465