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/brushitem.hxx>
33 #include <editeng/splwrap.hxx>
34 #include <editeng/pgrditem.hxx>
35 #include <editeng/tstpitem.hxx>
36 #include <editeng/shaditem.hxx>
37 
38 #include <SwSmartTagMgr.hxx>
39 #include <breakit.hxx>
41 #include <paintfrm.hxx>
42 #include <swmodule.hxx>
43 #include <vcl/svapp.hxx>
44 #include <viewsh.hxx>
45 #include <viewopt.hxx>
46 #include <frmtool.hxx>
49 #include <IDocumentMarkAccess.hxx>
50 #include <paratr.hxx>
51 #include <rootfrm.hxx>
52 #include "inftxt.hxx"
53 #include <noteurl.hxx>
54 #include "porftn.hxx"
55 #include "porrst.hxx"
56 #include "itratr.hxx"
57 #include "portab.hxx"
58 #include <wrong.hxx>
59 #include <doc.hxx>
60 #include <pam.hxx>
61 #include <numrule.hxx>
63 #include <docsh.hxx>
64 #include <strings.hrc>
65 #include <o3tl/deleter.hxx>
66 #include <vcl/gdimtf.hxx>
67 #include <vcl/virdev.hxx>
68 #include <vcl/gradient.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() && !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 
966  sal_uInt16 nOldWidth = rPor.Width();
967  const_cast<SwLinePortion&>(rPor).Width( LINE_BREAK_WIDTH );
968 
969  SwRect aRect;
970  CalcRect( rPor, &aRect );
971 
972  if( aRect.HasArea() )
973  {
974  const sal_Unicode cChar = GetTextFrame()->IsRightToLeft() ?
976  const sal_uInt8 nOptions = 0;
977 
978  lcl_DrawSpecial( *this, rPor, aRect, NON_PRINTING_CHARACTER_COLOR, cChar, nOptions );
979  }
980 
981  const_cast<SwLinePortion&>(rPor).Width( nOldWidth );
982 }
983 
985 {
987  SwRect aRect( static_cast<const SwArrowPortion&>(rPor).GetPos(), aSize );
988  sal_Unicode cChar;
989  if( static_cast<const SwArrowPortion&>(rPor).IsLeft() )
990  {
991  aRect.Pos().AdjustY(20 - GetAscent() );
992  aRect.Pos().AdjustX(20 );
993  if( aSize.Height() > rPor.Height() )
994  aRect.Height( rPor.Height() );
995  cChar = CHAR_LEFT_ARROW;
996  }
997  else
998  {
999  if( aSize.Height() > rPor.Height() )
1000  aRect.Height( rPor.Height() );
1001  aRect.Pos().AdjustY( -(aRect.Height() + 20) );
1002  aRect.Pos().AdjustX( -(aRect.Width() + 20) );
1003  cChar = CHAR_RIGHT_ARROW;
1004  }
1005 
1006  if ( GetTextFrame()->IsVertical() )
1008 
1009  if( aRect.HasArea() )
1010  {
1011  const sal_uInt8 nOptions = 0;
1012  lcl_DrawSpecial( *this, rPor, aRect, COL_LIGHTRED, cChar, nOptions );
1013  }
1014 }
1015 
1016 void SwTextPaintInfo::DrawPostIts( bool bScript ) const
1017 {
1018  if( !OnWin() || !m_pOpt->IsPostIts() )
1019  return;
1020 
1021  Size aSize;
1022  Point aTmp;
1023 
1024  const sal_uInt16 nPostItsWidth = SwViewOption::GetPostItsWidth( GetOut() );
1025  const sal_uInt16 nFontHeight = m_pFnt->GetHeight( m_pVsh, *GetOut() );
1026  const sal_uInt16 nFontAscent = m_pFnt->GetAscent( m_pVsh, *GetOut() );
1027 
1028  switch ( m_pFnt->GetOrientation( GetTextFrame()->IsVertical() ).get() )
1029  {
1030  case 0 :
1031  aSize.setWidth( nPostItsWidth );
1032  aSize.setHeight( nFontHeight );
1033  aTmp.setX( m_aPos.X() );
1034  aTmp.setY( m_aPos.Y() - nFontAscent );
1035  break;
1036  case 900 :
1037  aSize.setHeight( nPostItsWidth );
1038  aSize.setWidth( nFontHeight );
1039  aTmp.setX( m_aPos.X() - nFontAscent );
1040  aTmp.setY( m_aPos.Y() );
1041  break;
1042  case 2700 :
1043  aSize.setHeight( nPostItsWidth );
1044  aSize.setWidth( nFontHeight );
1045  aTmp.setX( m_aPos.X() - nFontHeight +
1046  nFontAscent );
1047  aTmp.setY( m_aPos.Y() );
1048  break;
1049  }
1050 
1051  SwRect aTmpRect( aTmp, aSize );
1052 
1053  if ( GetTextFrame()->IsRightToLeft() )
1054  GetTextFrame()->SwitchLTRtoRTL( aTmpRect );
1055 
1056  if ( GetTextFrame()->IsVertical() )
1058 
1059  SwViewOption::PaintPostIts( const_cast<OutputDevice*>(GetOut()), aTmpRect, bScript );
1060 
1061 }
1062 
1063 void SwTextPaintInfo::DrawCheckBox(const SwFieldFormCheckboxPortion &rPor, bool bChecked) const
1064 {
1065  SwRect aIntersect;
1066  CalcRect( rPor, &aIntersect );
1067  if ( !aIntersect.HasArea() )
1068  return;
1069 
1070  if (OnWin() && SwViewOption::IsFieldShadings() &&
1071  !GetOpt().IsPagePreview())
1072  {
1073  OutputDevice* pOut = const_cast<OutputDevice*>(GetOut());
1076  pOut->SetLineColor();
1077  pOut->DrawRect( aIntersect.SVRect() );
1078  pOut->Pop();
1079  }
1080  const int delta=10;
1081  tools::Rectangle r(aIntersect.Left()+delta, aIntersect.Top()+delta, aIntersect.Right()-delta, aIntersect.Bottom()-delta);
1083  m_pOut->SetLineColor( Color(0, 0, 0));
1084  m_pOut->SetFillColor();
1085  m_pOut->DrawRect( r );
1086  if (bChecked)
1087  {
1088  m_pOut->DrawLine(r.TopLeft(), r.BottomRight());
1089  m_pOut->DrawLine(r.TopRight(), r.BottomLeft());
1090  }
1091  m_pOut->Pop();
1092 }
1093 
1094 void SwTextPaintInfo::DrawBackground( const SwLinePortion &rPor, const Color *pColor ) const
1095 {
1096  OSL_ENSURE( OnWin(), "SwTextPaintInfo::DrawBackground: printer pollution ?" );
1097 
1098  SwRect aIntersect;
1099  CalcRect( rPor, nullptr, &aIntersect, true );
1100 
1101  if ( !aIntersect.HasArea() )
1102  return;
1103 
1104  OutputDevice* pOut = const_cast<OutputDevice*>(GetOut());
1106 
1107  if ( pColor )
1108  pOut->SetFillColor( *pColor );
1109  else
1111 
1112  pOut->SetLineColor();
1113 
1114  DrawRect( aIntersect, true );
1115  pOut->Pop();
1116 }
1117 
1119 {
1120  {
1121  SwRect aIntersect;
1122  CalcRect( rPor, &aIntersect, nullptr, true );
1123  if(aIntersect.HasArea())
1124  {
1125  SwPosition const aPosition(m_pFrame->MapViewToModelPos(GetIdx()));
1126  const ::sw::mark::IMark* pFieldmark =
1128  bool bIsStartMark = (TextFrameIndex(1) == GetLen()
1129  && CH_TXT_ATR_FIELDSTART == GetText()[sal_Int32(GetIdx())]);
1130  if(pFieldmark) {
1131  SAL_INFO("sw.core", "Found Fieldmark " << pFieldmark->ToString());
1132  }
1133  if(bIsStartMark)
1134  SAL_INFO("sw.core", "Found StartMark");
1135  if (OnWin() && (pFieldmark!=nullptr || bIsStartMark) &&
1137  !GetOpt().IsPagePreview())
1138  {
1139  OutputDevice* pOutDev = const_cast<OutputDevice*>(GetOut());
1142  pOutDev->SetLineColor( );
1143  pOutDev->DrawRect( aIntersect.SVRect() );
1144  pOutDev->Pop();
1145  }
1146  }
1147  }
1148 
1149  SwRect aIntersect;
1150  CalcRect( rPor, nullptr, &aIntersect, true );
1151 
1152  if ( !aIntersect.HasArea() )
1153  return;
1154 
1155  OutputDevice* pTmpOut = const_cast<OutputDevice*>(GetOut());
1156 
1157  // #i16816# tagged pdf support
1158  SwTaggedPDFHelper aTaggedPDFHelper( nullptr, nullptr, nullptr, *pTmpOut );
1159 
1160  Color aFillColor;
1161 
1163  {
1164  aFillColor = m_pFnt->GetHighlightColor();
1165  }
1166  else
1167  {
1168  if( !m_pFnt->GetBackColor() )
1169  return;
1170  aFillColor = *m_pFnt->GetBackColor();
1171  }
1172 
1173  // tdf#104349 do not highlight portions of space chars before end of line if the compatibility option is enabled
1174  // for LTR mode only
1175  if ( !GetTextFrame()->IsRightToLeft() )
1176  {
1177  if (GetTextFrame()->GetDoc().getIDocumentSettingAccess().get(DocumentSettingId::MS_WORD_COMP_TRAILING_BLANKS))
1178  {
1179  bool draw = false;
1180  bool full = false;
1181  SwLinePortion *pPos = const_cast<SwLinePortion *>(&rPor);
1182  TextFrameIndex nIdx = GetIdx();
1183  TextFrameIndex nLen;
1184 
1185  do
1186  {
1187  nLen = pPos->GetLen();
1188  for (TextFrameIndex i = nIdx; i < (nIdx + nLen); ++i)
1189  {
1190  if (i < TextFrameIndex(GetText().getLength())
1191  && GetText()[sal_Int32(i)] == CH_TXTATR_NEWLINE)
1192  {
1193  if ( i >= (GetIdx() + rPor.GetLen()) )
1194  {
1195  goto drawcontinue;
1196  }
1197  }
1198  if (i >= TextFrameIndex(GetText().getLength())
1199  || GetText()[sal_Int32(i)] != CH_BLANK)
1200  {
1201  draw = true;
1202  if ( i >= (GetIdx() + rPor.GetLen()) )
1203  {
1204  full = true;
1205  goto drawcontinue;
1206  }
1207  }
1208  }
1209  nIdx += nLen;
1210  pPos = pPos->GetNextPortion();
1211  } while ( pPos );
1212 
1213  drawcontinue:
1214 
1215  if ( !draw )
1216  return;
1217 
1218  if ( !full )
1219  {
1220  pPos = const_cast<SwLinePortion *>(&rPor);
1221  nIdx = GetIdx();
1222 
1223  nLen = pPos->GetLen();
1224  for (TextFrameIndex i = nIdx + nLen - TextFrameIndex(1);
1225  i >= nIdx; --i)
1226  {
1227  if (i < TextFrameIndex(GetText().getLength())
1228  && GetText()[sal_Int32(i)] == CH_TXTATR_NEWLINE)
1229  {
1230  continue;
1231  }
1232  if (i >= TextFrameIndex(GetText().getLength())
1233  || GetText()[sal_Int32(i)] != CH_BLANK)
1234  {
1235  sal_uInt16 nOldWidth = rPor.Width();
1236  sal_uInt16 nNewWidth = GetTextSize(m_pOut, nullptr,
1237  GetText(), nIdx, (i + TextFrameIndex(1) - nIdx)).Width();
1238 
1239  const_cast<SwLinePortion&>(rPor).Width( nNewWidth );
1240  CalcRect( rPor, nullptr, &aIntersect, true );
1241  const_cast<SwLinePortion&>(rPor).Width( nOldWidth );
1242 
1243  if ( !aIntersect.HasArea() )
1244  {
1245  return;
1246  }
1247 
1248  break;
1249  }
1250  }
1251  }
1252  }
1253  }
1254 
1256 
1257  pTmpOut->SetFillColor(aFillColor);
1258  pTmpOut->SetLineColor();
1259 
1260  DrawRect( aIntersect, false );
1261 
1262  pTmpOut->Pop();
1263 }
1264 
1266 {
1267  SwRect aDrawArea;
1268  CalcRect( rPor, &aDrawArea );
1269  if ( aDrawArea.HasArea() )
1270  {
1271  PaintCharacterBorder(*m_pFnt, aDrawArea, GetTextFrame()->IsVertical(),
1272  GetTextFrame()->IsVertLRBT(), rPor.GetJoinBorderWithPrev(),
1273  rPor.GetJoinBorderWithNext());
1274  }
1275 }
1276 
1278  PortionType nWhich, const Color *pColor ) const
1279 {
1280  if( !OnWin() || IsMulti() )
1281  return;
1282 
1283  bool bDraw = false;
1284  switch( nWhich )
1285  {
1286  case PortionType::Footnote:
1287  case PortionType::QuoVadis:
1288  case PortionType::Number:
1289  case PortionType::Field:
1290  case PortionType::Hidden:
1291  case PortionType::Tox:
1292  case PortionType::Ref:
1293  case PortionType::Meta:
1295  if ( !GetOpt().IsPagePreview()
1296  && !GetOpt().IsReadonly()
1298  && ( PortionType::Number != nWhich
1299  || m_pFrame->GetTextNodeForParaProps()->HasMarkedLabel())) // #i27615#
1300  {
1301  bDraw = PortionType::Footnote != nWhich || m_pFrame->IsFootnoteAllowed();
1302  }
1303  break;
1304  case PortionType::Bookmark:
1305  // no shading
1306  break;
1308  // input field shading also in read-only mode
1309  if ( !GetOpt().IsPagePreview()
1311  {
1312  bDraw = true;
1313  }
1314  break;
1315  case PortionType::Table:
1316  if ( GetOpt().IsTab() ) bDraw = true;
1317  break;
1319  if ( GetOpt().IsSoftHyph() )bDraw = true;
1320  break;
1321  case PortionType::Blank:
1322  if ( GetOpt().IsHardBlank())bDraw = true;
1323  break;
1324  default:
1325  {
1326  OSL_ENSURE( false, "SwTextPaintInfo::DrawViewOpt: don't know how to draw this" );
1327  break;
1328  }
1329  }
1330  if ( bDraw )
1331  DrawBackground( rPor, pColor );
1332 }
1333 
1335  sal_Int16 nMinLeading, sal_Int16 nMinTrailing, bool bNoCapsHyphenation )
1336 {
1337  sal_Int32 nLen = rVals.getLength();
1338 
1339  if (0 == nLen) // yet to be initialized?
1340  {
1341  rVals.realloc( 3 );
1342  PropertyValue *pVal = rVals.getArray();
1343 
1344  pVal[0].Name = UPN_HYPH_MIN_LEADING;
1345  pVal[0].Handle = UPH_HYPH_MIN_LEADING;
1346  pVal[0].Value <<= nMinLeading;
1347 
1348  pVal[1].Name = UPN_HYPH_MIN_TRAILING;
1349  pVal[1].Handle = UPH_HYPH_MIN_TRAILING;
1350  pVal[1].Value <<= nMinTrailing;
1351 
1352  pVal[2].Name = UPN_HYPH_NO_CAPS;
1353  pVal[2].Handle = UPH_HYPH_NO_CAPS;
1354  pVal[2].Value <<= bNoCapsHyphenation;
1355  }
1356  else if (3 == nLen) // already initialized once?
1357  {
1358  PropertyValue *pVal = rVals.getArray();
1359  pVal[0].Value <<= nMinLeading;
1360  pVal[1].Value <<= nMinTrailing;
1361  pVal[2].Value <<= bNoCapsHyphenation;
1362  }
1363  else {
1364  OSL_FAIL( "unexpected size of sequence" );
1365  }
1366 }
1367 
1369 {
1370  OSL_ENSURE( 3 == m_aHyphVals.getLength(),
1371  "hyphenation values not yet initialized" );
1372  return m_aHyphVals;
1373 }
1374 
1375 bool SwTextFormatInfo::InitHyph( const bool bAutoHyphen )
1376 {
1377  const SwAttrSet& rAttrSet = GetTextFrame()->GetTextNodeForParaProps()->GetSwAttrSet();
1378  SetHanging( rAttrSet.GetHangingPunctuation().GetValue() );
1379  SetScriptSpace( rAttrSet.GetScriptSpace().GetValue() );
1380  SetForbiddenChars( rAttrSet.GetForbiddenRule().GetValue() );
1381  const SvxHyphenZoneItem &rAttr = rAttrSet.GetHyphenZone();
1382  MaxHyph() = rAttr.GetMaxHyphens();
1383  const bool bAuto = bAutoHyphen || rAttr.IsHyphen();
1384  if( bAuto || m_bInterHyph )
1385  {
1386  const sal_Int16 nMinimalLeading = std::max(rAttr.GetMinLead(), sal_uInt8(2));
1387  const sal_Int16 nMinimalTrailing = rAttr.GetMinTrail();
1388  const bool bNoCapsHyphenation = rAttr.IsNoCapsHyphenation();
1389  lcl_InitHyphValues( m_aHyphVals, nMinimalLeading, nMinimalTrailing, bNoCapsHyphenation);
1390  }
1391  return bAuto;
1392 }
1393 
1394 void SwTextFormatInfo::CtorInitTextFormatInfo( OutputDevice* pRenderContext, SwTextFrame *pNewFrame, const bool bNewInterHyph,
1395  const bool bNewQuick, const bool bTst )
1396 {
1397  CtorInitTextPaintInfo( pRenderContext, pNewFrame, SwRect() );
1398 
1399  m_bQuick = bNewQuick;
1400  m_bInterHyph = bNewInterHyph;
1401 
1403  m_bAutoHyph = InitHyph();
1404 
1405  m_bIgnoreFly = false;
1406  m_bFakeLineStart = false;
1407  m_bShift = false;
1408  m_bDropInit = false;
1409  m_bTestFormat = bTst;
1410  m_nLeft = 0;
1411  m_nRight = 0;
1412  m_nFirst = 0;
1413  m_nRealWidth = 0;
1414  m_nForcedLeftMargin = 0;
1415  m_pRest = nullptr;
1416  m_nLineHeight = 0;
1417  m_nLineNetHeight = 0;
1419 
1420  SvtCTLOptions::TextNumerals const nTextNumerals(
1421  SW_MOD()->GetCTLOptions().GetCTLTextNumerals());
1422  // cannot cache for NUMERALS_CONTEXT because we need to know the string
1423  // for the whole paragraph now
1424  if (nTextNumerals != SvtCTLOptions::NUMERALS_CONTEXT)
1425  {
1426  // set digit mode to what will be used later to get same results
1427  SwDigitModeModifier const m(*m_pRef, LANGUAGE_NONE /*dummy*/);
1428  assert(m_pRef->GetDigitLanguage() != LANGUAGE_NONE);
1430  }
1431 
1432  Init();
1433 }
1434 
1443 {
1444  if( !m_bInterHyph && !m_bAutoHyph )
1445  return false;
1446 
1447  LanguageType eTmp = GetFont()->GetLanguage();
1448  if( LANGUAGE_DONTKNOW == eTmp || LANGUAGE_NONE == eTmp )
1449  return false;
1450 
1451  uno::Reference< XHyphenator > xHyph = ::GetHyphenator();
1452  if (!xHyph.is())
1453  return false;
1454 
1455  if (m_bInterHyph)
1456  SvxSpellWrapper::CheckHyphLang( xHyph, eTmp );
1457 
1458  if (!xHyph->hasLocale(g_pBreakIt->GetLocale(eTmp)))
1459  {
1460  SfxObjectShell* pShell = m_pFrame->GetDoc().GetDocShell();
1461  if (pShell)
1462  {
1463  pShell->AppendInfoBarWhenReady(
1464  "hyphenationmissing", SwResId(STR_HYPH_MISSING),
1465  SwResId(STR_HYPH_MISSING_DETAIL)
1466  .replaceFirst("%1", LanguageTag::convertToBcp47( g_pBreakIt->GetLocale(eTmp))),
1467  InfobarType::WARNING);
1468  }
1469  }
1470 
1471  return xHyph->hasLocale( g_pBreakIt->GetLocale(eTmp) );
1472 }
1473 
1475 {
1477  if( 1 >= pDrop->GetLines() ||
1478  ( !pDrop->GetChars() && !pDrop->GetWholeWord() ) )
1479  pDrop = nullptr;
1480  return pDrop;
1481 }
1482 
1484 {
1485  // Not initialized: pRest, nLeft, nRight, nFirst, nRealWidth
1486  X(0);
1489 
1490  // generally we do not allow number portions in follows, except...
1491  if ( GetTextFrame()->IsFollow() )
1492  {
1493  const SwTextFrame* pMaster = GetTextFrame()->FindMaster();
1494  OSL_ENSURE(pMaster, "pTextFrame without Master");
1495  const SwLinePortion* pTmpPara = pMaster ? pMaster->GetPara() : nullptr;
1496 
1497  // there is a master for this follow and the master does not have
1498  // any contents (especially it does not have a number portion)
1499  m_bNumDone = ! pTmpPara ||
1500  ! static_cast<const SwParaPortion*>(pTmpPara)->GetFirstPortion()->IsFlyPortion();
1501  }
1502 
1503  m_pRoot = nullptr;
1504  m_pLast = nullptr;
1505  m_pFly = nullptr;
1506  m_pLastTab = nullptr;
1507  m_pUnderflow = nullptr;
1508  m_cTabDecimal = 0;
1510  m_nForcedLeftMargin = 0;
1514  m_cHookChar = 0;
1515  SetIdx(TextFrameIndex(0));
1517  SetPaintOfst(0);
1518 }
1519 
1520 SwTextFormatInfo::SwTextFormatInfo(OutputDevice* pRenderContext, SwTextFrame *pFrame, const bool bInterHyphL,
1521  const bool bQuickL, const bool bTst)
1522 {
1523  CtorInitTextFormatInfo(pRenderContext, pFrame, bInterHyphL, bQuickL, bTst);
1524 }
1525 
1535  SwLineLayout& rLay, SwTwips nActWidth ) :
1536  SwTextPaintInfo( rInf ),
1537  m_pRoot(&rLay),
1538  m_pLast(&rLay),
1539  m_pFly(nullptr),
1540  m_pUnderflow(nullptr),
1541  m_pRest(nullptr),
1542  m_pLastTab(nullptr),
1543  m_nSoftHyphPos(TextFrameIndex(0)),
1544  m_nLineStart(rInf.GetIdx()),
1545  m_nUnderScorePos(TextFrameIndex(COMPLETE_STRING)),
1546  m_nLeft(rInf.m_nLeft),
1547  m_nRight(rInf.m_nRight),
1548  m_nFirst(rInf.m_nLeft),
1549  m_nRealWidth(sal_uInt16(nActWidth)),
1550  m_nWidth(m_nRealWidth),
1551  m_nLineHeight(0),
1552  m_nLineNetHeight(0),
1553  m_nForcedLeftMargin(0),
1554  m_bFull(false),
1555  m_bFootnoteDone(true),
1556  m_bErgoDone(true),
1557  m_bNumDone(true),
1558  m_bArrowDone(true),
1559  m_bStop(false),
1560  m_bNewLine(true),
1561  m_bShift(false),
1562  m_bUnderflow(false),
1563  m_bInterHyph(false),
1564  m_bAutoHyph(false),
1565  m_bDropInit(false),
1566  m_bQuick(rInf.m_bQuick),
1567  m_bNoEndHyph(false),
1568  m_bNoMidHyph(false),
1569  m_bIgnoreFly(false),
1570  m_bFakeLineStart(false),
1571  m_bTabOverflow( false ),
1572  m_bTestFormat(rInf.m_bTestFormat),
1573  m_cTabDecimal(0),
1574  m_cHookChar(0),
1575  m_nMaxHyph(0)
1576 {
1577  SetMulti( true );
1578  SetFirstMulti( rInf.IsFirstMulti() );
1579 }
1580 
1582 {
1583  const sal_uInt16 nHeight = pCurr->GetRealHeight();
1584  for( SwLinePortion *pPor = pCurr->GetNextPortion(); pPor; pPor = pPor->GetNextPortion() )
1585  {
1586  if( pPor->IsFootnotePortion() && nHeight > static_cast<SwFootnotePortion*>(pPor)->Orig() )
1587  {
1588  SetLineHeight( nHeight );
1589  SetLineNetHeight( pCurr->Height() );
1590  return true;
1591  }
1592  }
1593  return false;
1594 }
1595 
1597  TextFrameIndex const nEnd)
1598 {
1599  m_cHookChar = 0;
1600  TextFrameIndex i = nStart;
1601 
1602  // Used for decimal tab handling:
1603  const sal_Unicode cTabDec = GetLastTab() ? GetTabDecimal() : 0;
1604  const sal_Unicode cThousandSep = ',' == cTabDec ? '.' : ',';
1605 
1606  // #i45951# German (Switzerland) uses ' as thousand separator
1607  const sal_Unicode cThousandSep2 = ',' == cTabDec ? '.' : '\'';
1608 
1609  bool bNumFound = false;
1611 
1612  for( ; i < nEnd; ++i )
1613  {
1614  const sal_Unicode cPos = GetChar( i );
1615  switch( cPos )
1616  {
1617  case CH_TXTATR_BREAKWORD:
1618  case CH_TXTATR_INWORD:
1619  if( !HasHint( i ))
1620  break;
1621  [[fallthrough]];
1622 
1623  case CHAR_SOFTHYPHEN:
1624  case CHAR_HARDHYPHEN:
1625  case CHAR_HARDBLANK:
1626  case CH_TAB:
1627  case CH_BREAK:
1628  case CHAR_ZWSP :
1629  case CHAR_WJ :
1630  m_cHookChar = cPos;
1631  return i;
1632 
1633  case CHAR_UNDERSCORE:
1635  m_nUnderScorePos = i;
1636  break;
1637 
1638  default:
1639  if ( cTabDec )
1640  {
1641  if( cTabDec == cPos )
1642  {
1643  OSL_ENSURE( cPos, "Unexpected end of string" );
1644  if( cPos ) // robust
1645  {
1646  m_cHookChar = cPos;
1647  return i;
1648  }
1649  }
1650 
1651  // Compatibility: First non-digit character behind a
1652  // a digit character becomes the hook character
1653  if ( bTabCompat )
1654  {
1655  if ( ( 0x2F < cPos && cPos < 0x3A ) ||
1656  ( bNumFound && ( cPos == cThousandSep || cPos == cThousandSep2 ) ) )
1657  {
1658  bNumFound = true;
1659  }
1660  else
1661  {
1662  if ( bNumFound )
1663  {
1664  m_cHookChar = cPos;
1665  SetTabDecimal( cPos );
1666  return i;
1667  }
1668  }
1669  }
1670  }
1671  }
1672  }
1673 
1674  // Check if character *behind* the portion has
1675  // to become the hook:
1676  if (i == nEnd && i < TextFrameIndex(GetText().getLength()) && bNumFound)
1677  {
1678  const sal_Unicode cPos = GetChar( i );
1679  if ( cPos != cTabDec && cPos != cThousandSep && cPos !=cThousandSep2 && ( 0x2F >= cPos || cPos >= 0x3A ) )
1680  {
1681  m_cHookChar = GetChar( i );
1683  }
1684  }
1685 
1686  return i;
1687 }
1688 
1690 {
1691  if( GetLast() )
1692  {
1693  if( GetLast()->IsKernPortion() )
1694  return true;
1695  if( GetLast()->Width() || ( GetLast()->GetLen() &&
1696  !GetLast()->IsHolePortion() ) )
1697  return false;
1698  }
1699  SwLinePortion* pPor = GetRoot();
1700  SwLinePortion *pKern = nullptr;
1701  while( pPor )
1702  {
1703  if( pPor->IsKernPortion() )
1704  pKern = pPor;
1705  else if( pPor->Width() || ( pPor->GetLen() && !pPor->IsHolePortion() ) )
1706  pKern = nullptr;
1707  pPor = pPor->GetNextPortion();
1708  }
1709  if( pKern )
1710  {
1711  SetLast( pKern );
1712  return true;
1713  }
1714  return false;
1715 }
1716 
1718 {
1719  SwTwips nLineWidth = Width() - X();
1720 
1721  const bool bTabOverMargin = GetTextFrame()->GetDoc().getIDocumentSettingAccess().get(
1723  const bool bTabOverSpacing = GetTextFrame()->GetDoc().getIDocumentSettingAccess().get(
1725  if (!bTabOverMargin && !bTabOverSpacing)
1726  return nLineWidth;
1727 
1728  SwTabPortion* pLastTab = GetLastTab();
1729  if (!pLastTab)
1730  return nLineWidth;
1731 
1732  // Consider tab portions over the printing bounds of the text frame.
1733  if (pLastTab->GetTabPos() <= Width())
1734  return nLineWidth;
1735 
1736  // Calculate the width that starts at the left (or in case of first line:
1737  // first) margin, but ends after the right paragraph margin:
1738  //
1739  // +--------------------+
1740  // |LL| |RR|
1741  // +--------------------+
1742  // ^ m_nLeftMargin (absolute)
1743  // ^ nLeftMarginWidth (relative to m_nLeftMargin), X() is relative to this
1744  // ^ right margin
1745  // ^ paragraph right
1746  // <--------------------> is GetTextFrame()->getFrameArea().Width()
1747  // <--------------> is Width()
1748  // <-----------------> is what we need to be able to compare to X() (nTextFrameWidth)
1749  SwTwips nLeftMarginWidth = m_nLeftMargin - GetTextFrame()->getFrameArea().Left();
1750  SwTwips nTextFrameWidth = GetTextFrame()->getFrameArea().Width() - nLeftMarginWidth;
1751 
1752  // If there is one such tab portion, then text is allowed to use the full
1753  // text frame area to the right (RR above, but not LL).
1754  nLineWidth = nTextFrameWidth - X();
1755 
1756  if (!bTabOverMargin) // thus bTabOverSpacing only
1757  {
1758  // right, center, decimal can back-fill all the available space - same as TabOverMargin
1759  if (pLastTab->GetWhichPor() == PortionType::TabLeft)
1760  nLineWidth = nTextFrameWidth - pLastTab->GetTabPos();
1761  }
1762  return nLineWidth;
1763 }
1764 
1766  const SwTextSizeInfo *pNew,
1767  const SwLinePortion *pPor,
1768  bool bTextLen,
1769  bool bExgLists,
1770  OUString const & rCh )
1771  : pOldText(nullptr)
1772  , m_pOldSmartTagList(nullptr)
1773  , m_pOldGrammarCheckList(nullptr)
1774  , nIdx(0)
1775  , nLen(0)
1776  , pInf(nullptr)
1777 {
1778  if( rCh.isEmpty() )
1779  {
1780  bOn = pPor->GetExpText( *pNew, aText );
1781  }
1782  else
1783  {
1784  aText = rCh;
1785  bOn = true;
1786  }
1787 
1788  // The text is replaced ...
1789  if( !bOn )
1790  return;
1791 
1792  pInf = const_cast<SwTextSizeInfo*>(pNew);
1793  nIdx = pInf->GetIdx();
1794  nLen = pInf->GetLen();
1795  pOldText = &(pInf->GetText());
1797  pInf->SetText( aText );
1798  pInf->SetIdx(TextFrameIndex(0));
1799  pInf->SetLen(bTextLen ? TextFrameIndex(pInf->GetText().getLength()) : pPor->GetLen());
1800  pInf->SetCachedVclData(nullptr);
1801 
1802  // ST2
1803  if ( !bExgLists )
1804  return;
1805 
1806  m_pOldSmartTagList = static_cast<SwTextPaintInfo*>(pInf)->GetSmartTags();
1807  if (m_pOldSmartTagList)
1808  {
1809  std::pair<SwTextNode const*, sal_Int32> pos(pNew->GetTextFrame()->MapViewToModel(nIdx));
1810  SwWrongList const*const pSmartTags(pos.first->GetSmartTags());
1811  if (pSmartTags)
1812  {
1813  const sal_uInt16 nPos = pSmartTags->GetWrongPos(pos.second);
1814  const sal_Int32 nListPos = pSmartTags->Pos(nPos);
1815  if (nListPos == pos.second && pSmartTags->SubList(nPos) != nullptr)
1816  {
1817  m_pTempIter.reset(new sw::WrongListIterator(*pSmartTags->SubList(nPos)));
1818  static_cast<SwTextPaintInfo*>(pInf)->SetSmartTags(m_pTempIter.get());
1819  }
1820  else if (!m_pTempList && nPos < pSmartTags->Count()
1821  && nListPos < pos.second && !aText.isEmpty())
1822  {
1824  m_pTempList->Insert( OUString(), nullptr, 0, aText.getLength(), 0 );
1826  static_cast<SwTextPaintInfo*>(pInf)->SetSmartTags(m_pTempIter.get());
1827  }
1828  else
1829  static_cast<SwTextPaintInfo*>(pInf)->SetSmartTags(nullptr);
1830  }
1831  else
1832  static_cast<SwTextPaintInfo*>(pInf)->SetSmartTags(nullptr);
1833  }
1834  m_pOldGrammarCheckList = static_cast<SwTextPaintInfo*>(pInf)->GetGrammarCheckList();
1836  return;
1837 
1838  std::pair<SwTextNode const*, sal_Int32> pos(pNew->GetTextFrame()->MapViewToModel(nIdx));
1839  SwWrongList const*const pGrammar(pos.first->GetGrammarCheck());
1840  if (pGrammar)
1841  {
1842  const sal_uInt16 nPos = pGrammar->GetWrongPos(pos.second);
1843  const sal_Int32 nListPos = pGrammar->Pos(nPos);
1844  if (nListPos == pos.second && pGrammar->SubList(nPos) != nullptr)
1845  {
1846  m_pTempIter.reset(new sw::WrongListIterator(*pGrammar->SubList(nPos)));
1847  static_cast<SwTextPaintInfo*>(pInf)->SetGrammarCheckList(m_pTempIter.get());
1848  }
1849  else if (!m_pTempList && nPos < pGrammar->Count()
1850  && nListPos < pos.second && !aText.isEmpty())
1851  {
1853  m_pTempList->Insert( OUString(), nullptr, 0, aText.getLength(), 0 );
1855  static_cast<SwTextPaintInfo*>(pInf)->SetGrammarCheckList(m_pTempIter.get());
1856  }
1857  else
1858  static_cast<SwTextPaintInfo*>(pInf)->SetGrammarCheckList(nullptr);
1859  }
1860  else
1861  static_cast<SwTextPaintInfo*>(pInf)->SetGrammarCheckList(nullptr);
1862 }
1863 
1865 {
1866  if( !bOn )
1867  return;
1868 
1870  pInf->SetText( *pOldText );
1871  pInf->SetIdx( nIdx );
1872  pInf->SetLen( nLen );
1873 
1874  // ST2
1875  // Restore old smart tag list
1876  if (m_pOldSmartTagList)
1877  static_cast<SwTextPaintInfo*>(pInf)->SetSmartTags(m_pOldSmartTagList);
1879  static_cast<SwTextPaintInfo*>(pInf)->SetGrammarCheckList(m_pOldGrammarCheckList);
1880 }
1881 
1883  SwAttrIter* pItr)
1884  : pInf(nullptr)
1885  , pFnt(pNew ? const_cast<SwTextSizeInfo&>(rInf).GetFont() : nullptr)
1886  , pIter(nullptr)
1887 {
1888  if( !pFnt )
1889  return;
1890 
1891  pInf = &const_cast<SwTextSizeInfo&>(rInf);
1892  // In these cases we temporarily switch to the new font:
1893  // 1. the fonts have a different magic number
1894  // 2. they have different script types
1895  // 3. their background colors differ (this is not covered by 1.)
1896  if( pFnt->DifferentFontCacheId( pNew, pFnt->GetActual() ) ||
1897  pNew->GetActual() != pFnt->GetActual() ||
1898  ( ! pNew->GetBackColor() && pFnt->GetBackColor() ) ||
1899  ( pNew->GetBackColor() && ! pFnt->GetBackColor() ) ||
1900  ( pNew->GetBackColor() && pFnt->GetBackColor() &&
1901  ( *pNew->GetBackColor() != *pFnt->GetBackColor() ) ) )
1902  {
1903  pNew->SetTransparent( true );
1904  pNew->SetAlign( ALIGN_BASELINE );
1905  pInf->SetFont( pNew );
1906  }
1907  else
1908  pFnt = nullptr;
1909  pNew->Invalidate();
1910  pNew->ChgPhysFnt( pInf->GetVsh(), *pInf->GetOut() );
1911  if( pItr && pItr->GetFnt() == pFnt )
1912  {
1913  pIter = pItr;
1914  pIter->SetFnt( pNew );
1915  }
1916 }
1917 
1919 {
1920  if( pFnt )
1921  {
1922  // Reset SwFont
1923  pFnt->Invalidate();
1924  pInf->SetFont( pFnt );
1925  if( pIter )
1926  {
1927  pIter->SetFnt( pFnt );
1929  }
1930  }
1931 }
1932 
1933 bool SwTextFormatInfo::ChgHyph( const bool bNew )
1934 {
1935  const bool bOld = m_bAutoHyph;
1936  if( m_bAutoHyph != bNew )
1937  {
1938  m_bAutoHyph = bNew;
1939  InitHyph( bNew );
1940  // Set language in the Hyphenator
1941  if( m_pFnt )
1943  }
1944  return bOld;
1945 }
1946 
1947 
1949 {
1950  if (m_nLastBookmarkPos != GetIdx())
1951  {
1953  return true;
1954  }
1955  else
1956  {
1957  return false;
1958  }
1959 }
1960 
1961 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool bOn
Definition: inftxt.hxx:684
void SetEndColor(const Color &rColor)
vcl::RenderContext * GetOut() const
Definition: viewsh.hxx:338
TextFrameIndex m_nLastBookmarkPos
need to check for bookmarks at every portion
Definition: inftxt.hxx:473
#define CHAR_WJ
Definition: swtypes.hxx:168
void SetLineNetHeight(const sal_uInt16 nNew)
Definition: inftxt.hxx:596
virtual void Height(const SwTwips nNew, const bool bText=true) override
Definition: porlay.cxx:199
OutDevType GetOutDevType() const
const sal_Unicode CH_BREAK
Definition: swfont.hxx:43
bool LastKernPortion()
Definition: inftxt.cxx:1689
bool IsFirstMulti() const
Definition: inftxt.hxx:205
VclPtr< OutputDevice > m_pRef
Definition: inftxt.hxx:143
Represents the visualization of a paragraph.
Definition: txtfrm.hxx:158
#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:582
const SvxHyphenZoneItem & GetHyphenZone(bool=true) const
Definition: paratr.hxx:206
sal_uInt16 GetLeftBorderSpace() const
Definition: swfont.hxx:900
#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:1118
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:35
bool IsPagePreview() const
Definition: viewopt.hxx:635
SwRect m_aPaintRect
Definition: inftxt.hxx:347
bool GetWholeWord() const
Definition: paratr.hxx:107
const SvxForbiddenRuleItem & GetForbiddenRule(bool=true) const
Definition: paratr.hxx:216
bool IsInDocBody() const
Definition: frame.hxx:944
bool CheckFootnotePortion_(SwLineLayout const *pCurr)
Definition: inftxt.cxx:1581
std::shared_ptr< vcl::text::TextLayoutCache > m_pOldCachedVclData
Definition: inftxt.hxx:676
bool InSpaceGrp() const
Definition: porlin.hxx:110
const css::beans::PropertyValues & GetHyphValues() const
Definition: inftxt.cxx:1368
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:1352
bool InNumberGrp() const
Definition: porlin.hxx:103
static void lcl_InitHyphValues(PropertyValues &rVals, sal_Int16 nMinLeading, sal_Int16 nMinTrailing, bool bNoCapsHyphenation)
Definition: inftxt.cxx:1334
bool IsTransparent() const
sal_Unicode m_cTabDecimal
Definition: inftxt.hxx:508
void SetPos(const Point &rNew)
Definition: inftxt.hxx:429
void Left(const tools::Long nLeft)
Definition: swrect.hxx:197
virtual tools::Long CalcSpacing(tools::Long nSpaceAdd, const SwTextSizeInfo &rInf) const
Definition: porlin.cxx:305
bool m_bForbiddenChars
Definition: inftxt.hxx:173
bool GetJoinBorderWithPrev() const
Definition: porlin.hxx:171
void SwitchHorizontalToVertical(SwRect &rRect) const
Calculates the coordinates of a rectangle when switching from horizontal to vertical layout...
Definition: txtfrm.cxx:475
TextFrameIndex m_nLen
Definition: inftxt.hxx:156
sal_Unicode GetTabDecimal() const
Definition: inftxt.hxx:616
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)
constexpr::Color COL_AUTO(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
void SetLast(SwLinePortion *pNewLast)
Definition: inftxt.hxx:561
SwTabPortion * GetLastTab()
Definition: inftxt.hxx:614
Size GetTextSize_(SwDrawTextInfo &rInf)
Definition: swfont.hxx:306
TextFrameIndex ScanPortionEnd(TextFrameIndex nStart, TextFrameIndex nEnd)
Definition: inftxt.cxx:1596
tools::Long GetLen(const Point &rPnt)
Definition: doc.hxx:188
void DrawBorder(const SwLinePortion &rPor) const
Draw character border around a line portion.
Definition: inftxt.cxx:1265
Size SvLSize() const
Definition: possiz.hxx:54
bool DifferentFontCacheId(const SwFont *pFnt, SwFontScript nWhich)
Definition: swfont.hxx:200
void SetKanaComp(short nNew)
Definition: drawfont.hxx:533
SwParaPortion * GetPara()
Definition: txtcache.cxx:90
SwFont * m_pFnt
Definition: inftxt.hxx:150
SwTextSizeInfo * pInf
Definition: inftxt.hxx:697
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:4442
const SvxBrushItem * m_pBrushItem
Definition: inftxt.hxx:344
bool m_bFootnoteDone
Definition: inftxt.hxx:487
void SetScriptSpace(const bool bNew)
Definition: inftxt.hxx:212
#define CHAR_HARDBLANK
Definition: swtypes.hxx:162
const MapMode & GetMapMode() const
std::map< sal_Int32, std::shared_ptr< SetItemPropertyStorage > > PropertyValues
const OUString * pOldText
Definition: inftxt.hxx:677
bool IsHangingPortion() const
Definition: porlin.hxx:134
#define CH_TXTATR_NEWLINE
Definition: hintids.hxx:173
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:740
tools::Long GetSpaceAdd() const
Definition: inftxt.hxx:440
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:204
constexpr OUStringLiteral UPN_HYPH_MIN_TRAILING
void DrawPostIts(bool bScript) const
Definition: inftxt.cxx:1016
IDocumentMarkAccess * getIDocumentMarkAccess()
Definition: docbm.cxx:1790
void SetText(const OUString &rNew)
Definition: inftxt.hxx:275
void SetMulti(const bool bNew)
Definition: inftxt.hxx:204
const std::shared_ptr< vcl::text::TextLayoutCache > & GetCachedVclData() const
Definition: inftxt.hxx:328
Of course Writer needs its own rectangles.
Definition: swrect.hxx:34
bool InFieldGrp() const
Definition: porlin.hxx:105
const OUString & GetText() const
Returns the text portion we want to edit (for inline see underneath)
Definition: txtfrm.cxx:1295
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:172
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:553
void SetEndIntensity(sal_uInt16 nIntens)
Collection of SwLineLayout instances, represents the paragraph text in Writer layout.
Definition: porlay.hxx:251
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:1933
bool m_bHanging
Definition: inftxt.hxx:171
bool m_bFakeLineStart
Definition: inftxt.hxx:502
void DrawText_(SwDrawTextInfo &rInf)
Definition: swfont.hxx:314
bool IsVertLRBT() const
Definition: frame.hxx:984
void AddTop(const tools::Long nAdd)
Definition: swrect.cxx:128
void SetColor(const Color &rColor)
Definition: swfont.hxx:411
size_t CountCompChg() const
Definition: scriptinfo.hxx:162
#define CHAR_SOFTHYPHEN
Definition: swtypes.hxx:164
#define CHAR_LEFT_ARROW
Definition: inftxt.cxx:76
static OutputDevice * GetDefaultDevice()
SwTwips m_nFirst
Definition: inftxt.hxx:477
OUString SwResId(TranslateId aId)
Definition: swmodule.cxx:165
constexpr tools::Long Width() const
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:170
SwTwips m_nRight
Definition: inftxt.hxx:476
void SetSteps(sal_uInt16 nSteps)
sal_uInt16 sal_Unicode
#define CH_TXTATR_INWORD
Definition: hintids.hxx:171
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:1124
#define CHAR_LINEBREAK_RTL
Definition: inftxt.cxx:81
const SwRect & getFrameArea() const
Definition: frame.hxx:180
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:543
sal_uInt16 GetAscent(SwViewShell const *pSh, const OutputDevice &rOut)
Definition: swfont.hxx:323
void SetOut(OutputDevice &rNew)
Definition: drawfont.hxx:394
TextFrameIndex nLen
Definition: inftxt.hxx:683
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:1063
oslFileHandle & pOut
void SetStartColor(const Color &rColor)
void DrawViewOpt(const SwLinePortion &rPor, PortionType nWhich, const Color *pColor=nullptr) const
Definition: inftxt.cxx:1277
bool m_bNotEOL
Definition: inftxt.hxx:159
SwLinePortion * m_pUnderflow
Definition: inftxt.hxx:465
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:1394
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:942
void DrawTextOpaque(SwDrawTextInfo &rInf)
This method is called by DrawText().
Definition: txtfly.cxx:446
const std::optional< Color > & GetBackColor() const
Definition: swfont.hxx:190
void SetCachedVclData(std::shared_ptr< vcl::text::TextLayoutCache > const &pCachedVclData)
Definition: inftxt.hxx:332
constexpr OUStringLiteral UPN_IS_GRAMMAR_AUTO
void DrawLine(const Point &rStartPt, const Point &rEndPt)
void SetHyphPos(TextFrameIndex *const pNew)
Definition: drawfont.hxx:407
const SvxHangingPunctuationItem & GetHangingPunctuation(bool=true) const
Definition: paratr.hxx:214
const ::std::vector< Color > ImpSvNumberformatScan::StandardColor COL_LIGHTRED
SwFontScript GetActual() const
Definition: swfont.hxx:182
bool IsBlank(bool bHard=false) const
Definition: viewopt.hxx:225
void SetPaintOfst(const SwTwips nNew)
Definition: inftxt.hxx:735
void DrawRect(const tools::Rectangle &rRect)
bool InFixMargGrp() const
Definition: porlin.hxx:109
TextFrameIndex GetOffset() const
Definition: txtfrm.hxx:438
void DrawBackground(const SwLinePortion &rPor, const Color *pColor=nullptr) const
Definition: inftxt.cxx:1094
This portion represents a part of the paragraph string.
Definition: portxt.hxx:26
sal_uInt16 m_nRealWidth
Definition: inftxt.hxx:480
SwTwips Y() const
Definition: inftxt.hxx:380
sal_uInt16 m_nWidth
Definition: inftxt.hxx:481
SwTextSizeInfo * pInf
Definition: inftxt.hxx:685
bool m_bTestFormat
Definition: inftxt.hxx:506
const SwViewOption & GetOpt() const
Definition: inftxt.hxx:238
void SetStyleName(const OUString &rStyleName, const SwFontScript nWhich)
Definition: swfont.hxx:474
SwTextNode const * GetTextNodeForParaProps() const
Definition: txtfrm.cxx:1305
void SetLineColor()
sal_uInt16 m_nLineNetHeight
Definition: inftxt.hxx:483
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:640
css::beans::PropertyValues m_aHyphVals
Definition: inftxt.hxx:460
TextFrameIndex m_nIdx
Definition: inftxt.hxx:155
tools::Long GetKanaDiff() const
Definition: drawfont.hxx:288
#define SW_MOD()
Definition: swmodule.hxx:256
#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:310
int i
TextFrameIndex m_nTextStart
Definition: inftxt.hxx:109
TextFrameIndex m_nUnderScorePos
enlarge repaint if underscore has been found
Definition: inftxt.hxx:472
Collection of SwLinePortion instances, representing one line of text.
Definition: porlay.hxx:80
const SvxParaVertAlignItem & GetParaVertAlign(bool=true) const
Definition: paratr.hxx:218
SwTwips GetRealHeight() const
Definition: porlay.hxx:171
SwTwips GetLineWidth()
Returns the distance between the current horizontal position and the end of the line.
Definition: inftxt.cxx:1717
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:383
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:345
SwParaPortion * GetParaPortion()
Definition: inftxt.hxx:121
bool IsFlyPortion() const
Definition: porlin.hxx:128
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:1375
std::unique_ptr< SwWrongList > m_pTempList
Definition: inftxt.hxx:680
SwTextSlot(const SwTextSizeInfo *pNew, const SwLinePortion *pPor, bool bTextLen, bool bExgLists, OUString const &rCh=OUString())
Definition: inftxt.cxx:1765
const sal_Unicode CH_BLANK
Definition: swfont.hxx:42
bool IsKernPortion() const
Definition: porlin.hxx:135
void SelectFont()
Definition: inftxt.cxx:364
SwLineInfo()
Definition: inftxt.cxx:86
Align GetValue() const
bool HasArea() const
Definition: swrect.hxx:300
void SetFillColor()
sw::WrongListIterator * m_pGrammarCheckList
Definition: inftxt.hxx:341
const Color & GetLineColor() const
#define CHAR_UNDERSCORE
Definition: inftxt.cxx:75
#define CH_TXT_ATR_FIELDSTART
Definition: hintids.hxx:179
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:527
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:4865
SwLineLayout * GetRoot()
Definition: inftxt.hxx:556
const SwFormatDrop * GetDropFormat() const
Definition: inftxt.cxx:1474
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:317
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:509
sw::WrongListIterator * m_pSmartTags
Definition: inftxt.hxx:342
SwFont * GetFnt()
Definition: itratr.hxx:103
#define NON_PRINTING_CHARACTER_COLOR
Definition: txtfrm.hxx:51
#define CHAR_ZWSP
Definition: swtypes.hxx:167
void DrawTab(const SwLinePortion &rPor) const
Definition: inftxt.cxx:944
const std::optional< editeng::SvxBorderLine > & GetLeftBorder() const
Definition: swfont.hxx:339
SwAttrIter * pIter
Definition: inftxt.hxx:699
SwTwips m_nLeft
Definition: inftxt.hxx:475
TextFrameIndex GetIdx() const
Definition: inftxt.hxx:271
#define SPECIAL_FONT_HEIGHT
Definition: porrst.hxx:38
const IDocumentSettingAccess * getIDocumentSettingAccess() const
Provides access to the document setting interface.
Definition: node.cxx:2097
bool IsDropPortion() const
Definition: porlin.hxx:124
void DrawRect(const SwRect &rRect, bool bRetouche) const
Definition: inftxt.cxx:932
void SetTabDecimal(const sal_Unicode cNew)
Definition: inftxt.hxx:617
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:50
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:273
bool SnapToGrid() const
Definition: inftxt.hxx:215
TextFrameIndex GetLen() const
Definition: porlin.hxx:75
void CtorInitTextPaintInfo(OutputDevice *pRenderContext, SwTextFrame *pFrame, const SwRect &rPaint)
Definition: inftxt.cxx:480
SwTextFrame * GetTextFrame()
Definition: inftxt.hxx:284
SwLineLayout * m_pRoot
Definition: inftxt.hxx:462
sal_Int32 nLineWidth
std::pair< SwTextNode *, sal_Int32 > MapViewToModel(TextFrameIndex nIndex) const
map position in potentially merged text frame to SwPosition
Definition: txtfrm.cxx:1233
static void PaintPostIts(OutputDevice *pOut, const SwRect &rRect, bool bIsScript)
Definition: viewopt.cxx:144
tools::Long SwTwips
Definition: swtypes.hxx:52
bool IsNoSymbol() const
Definition: inftxt.hxx:278
SwTabPortion * m_pLastTab
Definition: inftxt.hxx:468
const OUString & GetText() const
Definition: inftxt.hxx:239
virtual void Format(vcl::RenderContext *pRenderContext, const SwBorderAttrs *pAttrs=nullptr) override
Definition: frmform.cxx:1756
bool IsHolePortion() const
Definition: porlin.hxx:129
SwTextFrame * m_pFrame
Definition: inftxt.hxx:152
VclPtr< OutputDevice > m_pOut
Definition: inftxt.hxx:142
SwTwips & GetAscent()
Definition: porlin.hxx:78
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:428
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:378
void SwitchLTRtoRTL(SwRect &rRect) const
Calculates the coordinates of a rectangle when switching from LTR to RTL layout.
Definition: txtfrm.cxx:685
#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:482
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:279
#define CHAR_HARDHYPHEN
Definition: swtypes.hxx:163
void SwitchRTLtoLTR(SwRect &rRect) const
Calculates the coordinates of a rectangle when switching from RTL to LTR layout.
Definition: txtfrm.hxx:735
#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:1442
tools::Rectangle SVRect() const
Definition: swrect.hxx:292
void SetLen(const TextFrameIndex nNew)
Definition: inftxt.hxx:274
SwTwips Width() const
Definition: possiz.hxx:52
OUString aText
Definition: inftxt.hxx:675
void SetFirstMulti(const bool bNew)
Definition: inftxt.hxx:206
void SetAlign(const TextAlign eAlign)
Definition: swfont.hxx:514
SwTextFrame * FindMaster() const
Definition: flowfrm.cxx:738
constexpr tools::Long Height() const
void SetSize(const Size &rSize, const SwFontScript nWhich)
Definition: swfont.hxx:734
unsigned char sal_uInt8
PortionType GetWhichPor() const
Definition: porlin.hxx:96
OUString const & GetDefBulletFontname()
retrieve font family name used for the default bullet list characters
Definition: number.cxx:1324
const SvxLineSpacingItem * m_pSpace
Definition: inftxt.hxx:65
LanguageType GetDigitLanguage() const
std::unique_ptr< sw::WrongListIterator > m_pTempIter
Definition: inftxt.hxx:681
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:349
#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:988
void SetFamily(const FontFamily eFamily, const SwFontScript nWhich)
Definition: swfont.hxx:448
void Top(const tools::Long nTop)
Definition: swrect.hxx:206
void SetCharSet(const rtl_TextEncoding eCharSet, const SwFontScript nWhich)
Definition: swfont.hxx:487
TextFrameIndex GetLen() const
Definition: inftxt.hxx:273
void SetSnapToGrid(bool bNew)
Definition: drawfont.hxx:574
sw::WrongListIterator * m_pWrongList
Definition: inftxt.hxx:340
bool IsFootnoteAllowed() const
Definition: ftnfrm.cxx:877
SwTwips m_nLeftMargin
First or left margin, depending on context.
Definition: inftxt.hxx:479
void SetLineStart(TextFrameIndex const nNew)
Definition: inftxt.hxx:590
bool InTextGrp() const
Definition: porlin.hxx:99
SwFontSave(const SwTextSizeInfo &rInf, SwFont *pFnt, SwAttrIter *pItr=nullptr)
Definition: inftxt.cxx:1882
SwParaPortion * m_pPara
Definition: inftxt.hxx:108
sw::WrongListIterator * m_pOldSmartTagList
Definition: inftxt.hxx:678
SwScriptInfo & GetScriptInfo()
Definition: porlay.hxx:292
double getLength(const B2DPolygon &rCandidate)
SwFontScript
Definition: swfont.hxx:122
SwLinePortion * GetLast()
Definition: inftxt.hxx:560
const Color & GetHighlightColor() const
Definition: swfont.hxx:192
void Invalidate()
Definition: swfont.hxx:328
SwFont * pFnt
Definition: inftxt.hxx:698
static std::shared_ptr< vcl::text::TextLayoutCache > CreateTextLayoutCache(OUString const &)
virtual bool get(DocumentSettingId id) const =0
Return the specified document setting.
bool CheckCurrentPosBookmark()
Definition: inftxt.cxx:1948
TextFrameIndex nIdx
Definition: inftxt.hxx:682
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:715
void SetName(const OUString &rName, const SwFontScript nWhich)
Definition: swfont.hxx:461
TextFrameIndex GetTextBreak(SwDrawTextInfo const &rInf, tools::Long nTextWidth)
Definition: fntcache.cxx:2392
void DrawRedArrow(const SwLinePortion &rPor) const
Definition: inftxt.cxx:984
#define UPH_HYPH_MIN_LEADING
constexpr sal_Int32 COMPLETE_STRING
Definition: swtypes.hxx:58
SwLinePortion * m_pLast
Definition: inftxt.hxx:463
SwTextInfo()
Definition: inftxt.hxx:112
void setHeight(tools::Long nHeight)
bool m_bTabOverflow
Definition: inftxt.hxx:505
static TextFrameIndex GetMinLen(const SwTextSizeInfo &rInf)
Definition: inftxt.cxx:173
bool IsVertical() const
Definition: frame.hxx:974
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:2855
void SetLineHeight(const sal_uInt16 nNew)
Definition: inftxt.hxx:594
css::uno::Any GetProperty(const OUString &rPropertyName) const
SwDoc & GetDoc()
Definition: txtfrm.hxx:460
void SetFont(SwFont *pNew)
Definition: drawfont.hxx:450
static sal_Int16 CheckHyphLang(css::uno::Reference< css::linguistic2::XHyphenator >const &xHyph, LanguageType nLang)
bool IsOn() const
Definition: txtfly.hxx:313
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:353
sal_uInt16 GetKanaComp() const
Definition: inftxt.hxx:324
bool GetJoinBorderWithNext() const
Definition: porlin.hxx:172
SwLinePortion * GetNextPortion() const
Definition: porlin.hxx:73
SwTextFormatInfo(OutputDevice *pRenderContext, SwTextFrame *pFrame, const bool bInterHyphL=false, const bool bQuickL=false, const bool bTst=false)
Definition: inftxt.cxx:1520
static bool FlushVout()
Output virtual Device (e.g. for animations)
Definition: virtoutp.cxx:30
void SetIdx(const TextFrameIndex nNew)
Definition: inftxt.hxx:272
sal_uInt16 m_nForcedLeftMargin
Definition: inftxt.hxx:484
SwViewShell * GetCurrShell() const
Definition: rootfrm.hxx:207
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
SwPosition MapViewToModelPos(TextFrameIndex nIndex) const
Definition: txtfrm.cxx:1248
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:280
SwRootFrame * getRootFrame()
Definition: frame.hxx:680
SwNoteURL * pNoteURL
Definition: noteurl.cxx:23
TextFrameIndex m_nSoftHyphPos
SoftHyphPos for Hyphenation.
Definition: inftxt.hxx:470
void SetStartIntensity(sal_uInt16 nIntens)
sal_uInt16 nPos
const Color & GetFillColor() const
SwLinePortion * m_pRest
Definition: inftxt.hxx:466
sal_uInt16 GetAscent() const
Definition: inftxt.hxx:706
std::vector< tools::Long > * m_pSpaceAdd
Definition: inftxt.hxx:343
sw::WrongListIterator * m_pOldGrammarCheckList
Definition: inftxt.hxx:679
bool IsBlankPortion() const
Definition: porlin.hxx:114
SwFlyPortion * m_pFly
Definition: inftxt.hxx:464