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