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_pRuler.reset( new SvxTabStopItem( 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_pRuler->Insert( aListTabStop );
111 
112  // remove default tab stops, which are before the inserted list tab stop
113  for ( sal_uInt16 i = 0; i < m_pRuler->Count(); i++ )
114  {
115  if ( (*m_pRuler)[i].GetTabPos() < m_nListTabStopPosition &&
116  (*m_pRuler)[i].GetAdjustment() == SvxTabAdjust::Default )
117  {
118  m_pRuler->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_pRuler->Count(); i++ )
128  {
129  if ( (*m_pRuler)[i].GetTabPos() == 0 &&
130  (*m_pRuler)[i].GetAdjustment() == SvxTabAdjust::Default )
131  {
132  m_pRuler->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  {
283  m_pOut->SetLayoutMode( ComplexTextLayoutFlags::BiDiStrong | ComplexTextLayoutFlags::BiDiRtl );
284  m_pRef->SetLayoutMode( ComplexTextLayoutFlags::BiDiStrong | ComplexTextLayoutFlags::BiDiRtl );
286  }
287  else
288  {
289  m_pOut->SetLayoutMode( ComplexTextLayoutFlags::BiDiStrong );
290  m_pRef->SetLayoutMode( ComplexTextLayoutFlags::BiDiStrong );
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::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::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::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 
525 static bool lcl_IsDarkBackground( const SwTextPaintInfo& rInf )
526 {
527  std::optional<Color> pCol = rInf.GetFont()->GetBackColor();
528  if( ! pCol || COL_TRANSPARENT == *pCol )
529  {
530  const SvxBrushItem* pItem;
531  SwRect aOrigBackRect;
533 
534  // Consider, that [GetBackgroundBrush(...)] can set <pCol>
535  // See implementation in /core/layout/paintfrm.cxx
536  // There is a background color, if there is a background brush and
537  // its color is *not* "no fill"/"auto fill".
538  if( rInf.GetTextFrame()->GetBackgroundBrush( aFillAttributes, pItem, pCol, aOrigBackRect, false, /*bConsiderTextBox=*/false ) )
539  {
540  if ( !pCol )
541  pCol = pItem->GetColor();
542 
543  // Determined color <pCol> can be <COL_TRANSPARENT>. Thus, check it.
544  if ( *pCol == COL_TRANSPARENT)
545  pCol.reset();
546  }
547  else
548  pCol.reset();
549  }
550 
551  if( !pCol )
552  pCol = aGlobalRetoucheColor;
553 
554  return pCol->IsDark();
555 }
556 
557 namespace
558 {
563 class SwTransparentTextGuard
564 {
566  GDIMetaFile m_aContentMetafile;
567  MapMode m_aNewMapMode;
568  SwRect m_aPorRect;
569  SwTextPaintInfo& m_rPaintInf;
570  SwDrawTextInfo& m_rDrawInf;
571 
572 public:
573  SwTransparentTextGuard(const SwLinePortion& rPor, SwTextPaintInfo& rPaintInf,
574  SwDrawTextInfo& rDrawInf);
575  ~SwTransparentTextGuard();
576 };
577 
578 SwTransparentTextGuard::SwTransparentTextGuard(const SwLinePortion& rPor,
579  SwTextPaintInfo& rPaintInf, SwDrawTextInfo& rDrawInf)
580  : m_aNewMapMode(rPaintInf.GetOut()->GetMapMode())
581  , m_rPaintInf(rPaintInf)
582  , m_rDrawInf(rDrawInf)
583 {
584  rPaintInf.CalcRect(rPor, &m_aPorRect);
585  rDrawInf.SetOut(*m_aContentVDev);
586  m_aContentVDev->SetMapMode(rPaintInf.GetOut()->GetMapMode());
587  m_aContentMetafile.Record(m_aContentVDev.get());
588  m_aContentVDev->SetLineColor(rPaintInf.GetOut()->GetLineColor());
589  m_aContentVDev->SetFillColor(rPaintInf.GetOut()->GetFillColor());
590  m_aContentVDev->SetFont(rPaintInf.GetOut()->GetFont());
591  m_aContentVDev->SetDrawMode(rPaintInf.GetOut()->GetDrawMode());
592  m_aContentVDev->SetSettings(rPaintInf.GetOut()->GetSettings());
593  m_aContentVDev->SetRefPoint(rPaintInf.GetOut()->GetRefPoint());
594 }
595 
596 SwTransparentTextGuard::~SwTransparentTextGuard()
597 {
598  m_aContentMetafile.Stop();
599  m_aContentMetafile.WindStart();
600  m_aNewMapMode.SetOrigin(m_aPorRect.TopLeft());
601  m_aContentMetafile.SetPrefMapMode(m_aNewMapMode);
602  m_aContentMetafile.SetPrefSize(m_aPorRect.SSize());
603  m_rDrawInf.SetOut(*m_rPaintInf.GetOut());
604  Gradient aVCLGradient;
605  sal_uInt8 nTransPercentVcl = 255 - m_rPaintInf.GetFont()->GetColor().GetAlpha();
606  const Color aTransColor(nTransPercentVcl, nTransPercentVcl, nTransPercentVcl);
607  aVCLGradient.SetStyle(GradientStyle::Linear);
608  aVCLGradient.SetStartColor(aTransColor);
609  aVCLGradient.SetEndColor(aTransColor);
610  aVCLGradient.SetAngle(0_deg10);
611  aVCLGradient.SetBorder(0);
612  aVCLGradient.SetOfsX(0);
613  aVCLGradient.SetOfsY(0);
614  aVCLGradient.SetStartIntensity(100);
615  aVCLGradient.SetEndIntensity(100);
616  aVCLGradient.SetSteps(2);
617  m_rPaintInf.GetOut()->DrawTransparent(m_aContentMetafile, m_aPorRect.TopLeft(),
618  m_aPorRect.SSize(), aVCLGradient);
619 }
620 }
621 
622 void SwTextPaintInfo::DrawText_( const OUString &rText, const SwLinePortion &rPor,
623  TextFrameIndex const nStart, TextFrameIndex const nLength,
624  const bool bKern, const bool bWrong,
625  const bool bSmartTag,
626  const bool bGrammarCheck )
627 {
628  if( !nLength )
629  return;
630 
631  // The SwScriptInfo is useless if we are inside a field portion
632  SwScriptInfo* pSI = nullptr;
633  if ( ! rPor.InFieldGrp() )
634  pSI = &GetParaPortion()->GetScriptInfo();
635 
636  // in some cases, kana compression is not allowed or suppressed for
637  // performance reasons
638  sal_uInt16 nComp = 0;
639  if ( ! IsMulti() )
640  nComp = GetKanaComp();
641 
642  bool bCfgIsAutoGrammar = false;
643  SvtLinguConfig().GetProperty( UPN_IS_GRAMMAR_AUTO ) >>= bCfgIsAutoGrammar;
644  const bool bBullet = OnWin() && GetOpt().IsBlank() && IsNoSymbol();
645  const bool bTmpWrong = bWrong && OnWin() && GetOpt().IsOnlineSpell();
646  const bool bTmpGrammarCheck = bGrammarCheck && OnWin() && bCfgIsAutoGrammar && GetOpt().IsOnlineSpell();
647  const bool bTmpSmart = bSmartTag && OnWin() && !GetOpt().IsPagePreview() && SwSmartTagMgr::Get().IsSmartTagsEnabled();
648 
649  OSL_ENSURE( GetParaPortion(), "No paragraph!");
650  SwDrawTextInfo aDrawInf( m_pFrame->getRootFrame()->GetCurrShell(), *m_pOut, pSI, rText, nStart, nLength,
651  rPor.Width(), bBullet );
652 
653  aDrawInf.SetUnderFnt( m_pUnderFnt );
654 
655  const tools::Long nSpaceAdd = ( rPor.IsBlankPortion() || rPor.IsDropPortion() ||
656  rPor.InNumberGrp() ) ? 0 : GetSpaceAdd();
657  if ( nSpaceAdd )
658  {
659  TextFrameIndex nCharCnt(0);
660  // #i41860# Thai justified alignment needs some
661  // additional information:
662  aDrawInf.SetNumberOfBlanks( rPor.InTextGrp() ?
663  static_cast<const SwTextPortion&>(rPor).GetSpaceCnt( *this, nCharCnt ) :
664  TextFrameIndex(0) );
665  }
666 
667  aDrawInf.SetSpace( nSpaceAdd );
668  aDrawInf.SetKanaComp( nComp );
669 
670  // the font is used to identify the current script via nActual
671  aDrawInf.SetFont( m_pFnt );
672  // the frame is used to identify the orientation
673  aDrawInf.SetFrame( GetTextFrame() );
674  // we have to know if the paragraph should snap to grid
675  aDrawInf.SetSnapToGrid( SnapToGrid() );
676  // for underlining we must know when not to add extra space behind
677  // a character in justified mode
678  aDrawInf.SetSpaceStop( ! rPor.GetNextPortion() ||
679  rPor.GetNextPortion()->InFixMargGrp() ||
680  rPor.GetNextPortion()->IsHolePortion() );
681 
682  // Draw text next to the left border
683  Point aFontPos(m_aPos);
684  if( m_pFnt->GetLeftBorder() && !static_cast<const SwTextPortion&>(rPor).GetJoinBorderWithPrev() )
685  {
686  const sal_uInt16 nLeftBorderSpace = m_pFnt->GetLeftBorderSpace();
687  if ( GetTextFrame()->IsRightToLeft() )
688  {
689  aFontPos.AdjustX( -nLeftBorderSpace );
690  }
691  else
692  {
693  switch( m_pFnt->GetOrientation(GetTextFrame()->IsVertical()).get() )
694  {
695  case 0 :
696  aFontPos.AdjustX(nLeftBorderSpace );
697  break;
698  case 900 :
699  aFontPos.AdjustY( -nLeftBorderSpace );
700  break;
701  case 1800 :
702  aFontPos.AdjustX( -nLeftBorderSpace );
703  break;
704  case 2700 :
705  aFontPos.AdjustY(nLeftBorderSpace );
706  break;
707  }
708  }
709  if( aFontPos.X() < 0 )
710  aFontPos.setX( 0 );
711  if( aFontPos.Y() < 0 )
712  aFontPos.setY( 0 );
713  }
714 
715  // Handle semi-transparent text if necessary.
716  std::unique_ptr<SwTransparentTextGuard, o3tl::default_delete<SwTransparentTextGuard>> pTransparentText;
718  {
719  pTransparentText.reset(new SwTransparentTextGuard(rPor, *this, aDrawInf));
720  }
721 
722  if( GetTextFly().IsOn() )
723  {
724  // aPos needs to be the TopLeft, because we cannot calculate the
725  // ClipRects otherwise
726  const Point aPoint( aFontPos.X(), aFontPos.Y() - rPor.GetAscent() );
727  const Size aSize( rPor.Width(), rPor.Height() );
728  aDrawInf.SetPos( aPoint );
729  aDrawInf.SetSize( aSize );
730  aDrawInf.SetAscent( rPor.GetAscent() );
731  aDrawInf.SetKern( bKern ? rPor.Width() : 0 );
732  aDrawInf.SetWrong( bTmpWrong ? m_pWrongList : nullptr );
733  aDrawInf.SetGrammarCheck( bTmpGrammarCheck ? m_pGrammarCheckList : nullptr );
734  aDrawInf.SetSmartTags( bTmpSmart ? m_pSmartTags : nullptr );
735  GetTextFly().DrawTextOpaque( aDrawInf );
736  }
737  else
738  {
739  aDrawInf.SetPos( aFontPos );
740  if( bKern )
741  m_pFnt->DrawStretchText_( aDrawInf );
742  else
743  {
744  aDrawInf.SetWrong( bTmpWrong ? m_pWrongList : nullptr );
745  aDrawInf.SetGrammarCheck( bTmpGrammarCheck ? m_pGrammarCheckList : nullptr );
746  aDrawInf.SetSmartTags( bTmpSmart ? m_pSmartTags : nullptr );
747  m_pFnt->DrawText_( aDrawInf );
748  }
749  }
750 }
751 
753  SwRect* pRect, SwRect* pIntersect,
754  const bool bInsideBox ) const
755 {
756  Size aSize( rPor.Width(), rPor.Height() );
757  if( rPor.IsHangingPortion() )
758  aSize.setWidth( static_cast<const SwHangingPortion&>(rPor).GetInnerWidth() );
759  if( rPor.InSpaceGrp() && GetSpaceAdd() )
760  {
761  SwTwips nAdd = rPor.CalcSpacing( GetSpaceAdd(), *this );
762  if( rPor.InFieldGrp() && GetSpaceAdd() < 0 && nAdd )
764  aSize.AdjustWidth(nAdd );
765  }
766 
767  Point aPoint;
768 
769  if( IsRotated() )
770  {
771  tools::Long nTmp = aSize.Width();
772  aSize.setWidth( aSize.Height() );
773  aSize.setHeight( nTmp );
774  if ( 1 == GetDirection() )
775  {
776  aPoint.setX( X() - rPor.GetAscent() );
777  aPoint.setY( Y() - aSize.Height() );
778  }
779  else
780  {
781  aPoint.setX( X() - rPor.Height() + rPor.GetAscent() );
782  aPoint.setY( Y() );
783  }
784  }
785  else
786  {
787  aPoint.setX( X() );
788  if (GetTextFrame()->IsVertLR() && !GetTextFrame()->IsVertLRBT())
789  aPoint.setY( Y() - rPor.Height() + rPor.GetAscent() );
790  else
791  aPoint.setY( Y() - rPor.GetAscent() );
792  }
793 
794  // Adjust x coordinate if we are inside a bidi portion
795  const bool bFrameDir = GetTextFrame()->IsRightToLeft();
796  const bool bCounterDir = ( !bFrameDir && DIR_RIGHT2LEFT == GetDirection() ) ||
797  ( bFrameDir && DIR_LEFT2RIGHT == GetDirection() );
798 
799  if ( bCounterDir )
800  aPoint.AdjustX( -(aSize.Width()) );
801 
802  SwRect aRect( aPoint, aSize );
803 
804  if ( GetTextFrame()->IsRightToLeft() )
805  GetTextFrame()->SwitchLTRtoRTL( aRect );
806 
807  if ( GetTextFrame()->IsVertical() )
809 
810  if( bInsideBox && rPor.InTextGrp() )
811  {
812  const bool bJoinWithPrev =
813  static_cast<const SwTextPortion&>(rPor).GetJoinBorderWithPrev();
814  const bool bJoinWithNext =
815  static_cast<const SwTextPortion&>(rPor).GetJoinBorderWithNext();
816  const bool bIsVert = GetTextFrame()->IsVertical();
817  const bool bIsVertLRBT = GetTextFrame()->IsVertLRBT();
818  aRect.AddTop( GetFont()->CalcShadowSpace(SvxShadowItemSide::TOP, bIsVert, bIsVertLRBT,
819  bJoinWithPrev, bJoinWithNext));
820  aRect.AddBottom( - GetFont()->CalcShadowSpace(SvxShadowItemSide::BOTTOM, bIsVert, bIsVertLRBT,
821  bJoinWithPrev, bJoinWithNext));
822  aRect.AddLeft( GetFont()->CalcShadowSpace(SvxShadowItemSide::LEFT, bIsVert, bIsVertLRBT,
823  bJoinWithPrev, bJoinWithNext));
824  aRect.AddRight( - GetFont()->CalcShadowSpace(SvxShadowItemSide::RIGHT, bIsVert, bIsVertLRBT,
825  bJoinWithPrev, bJoinWithNext));
826  }
827 
828  if ( pRect )
829  *pRect = aRect;
830 
831  if( aRect.HasArea() && pIntersect )
832  {
833  ::SwAlignRect( aRect, GetVsh(), GetOut() );
834 
835  if ( GetOut()->IsClipRegion() )
836  {
837  SwRect aClip( GetOut()->GetClipRegion().GetBoundRect() );
838  aRect.Intersection( aClip );
839  }
840 
841  *pIntersect = aRect;
842  }
843 }
844 
855 static void lcl_DrawSpecial( const SwTextPaintInfo& rTextPaintInfo, const SwLinePortion& rPor,
856  SwRect& rRect, const Color& rCol, sal_Unicode cChar,
857  sal_uInt8 nOptions )
858 {
859  bool bCenter = 0 != ( nOptions & DRAW_SPECIAL_OPTIONS_CENTER );
860  bool bRotate = 0 != ( nOptions & DRAW_SPECIAL_OPTIONS_ROTATE );
861 
862  // rRect is given in absolute coordinates
863  if ( rTextPaintInfo.GetTextFrame()->IsRightToLeft() )
864  rTextPaintInfo.GetTextFrame()->SwitchRTLtoLTR( rRect );
865  if ( rTextPaintInfo.GetTextFrame()->IsVertical() )
866  rTextPaintInfo.GetTextFrame()->SwitchVerticalToHorizontal( rRect );
867 
868  const SwFont* pOldFnt = rTextPaintInfo.GetFont();
869 
870  // Font is generated only once:
871  static SwFont s_aFnt = [&]()
872  {
873  SwFont tmp( *pOldFnt );
874  tmp.SetFamily( FAMILY_DONTKNOW, tmp.GetActual() );
876  tmp.SetStyleName(OUString(), tmp.GetActual());
877  tmp.SetCharSet( RTL_TEXTENCODING_SYMBOL, tmp.GetActual() );
878  return tmp;
879  }();
880 
881  // Some of the current values are set at the font:
882  if ( ! bRotate )
883  s_aFnt.SetVertical( 0_deg10, rTextPaintInfo.GetTextFrame()->IsVertical() );
884  else
885  s_aFnt.SetVertical( pOldFnt->GetOrientation() );
886 
887  s_aFnt.SetColor(rCol);
888 
889  Size aFontSize( 0, SPECIAL_FONT_HEIGHT );
890  s_aFnt.SetSize( aFontSize, s_aFnt.GetActual() );
891 
892  SwTextPaintInfo& rNonConstTextPaintInfo = const_cast<SwTextPaintInfo&>(rTextPaintInfo);
893 
894  rNonConstTextPaintInfo.SetFont( &s_aFnt );
895 
896  // The maximum width depends on the current orientation
897  const Degree10 nDir = s_aFnt.GetOrientation( rTextPaintInfo.GetTextFrame()->IsVertical() );
898  SwTwips nMaxWidth;
899  if (nDir == 900_deg10 || nDir == 2700_deg10)
900  nMaxWidth = rRect.Height();
901  else
902  {
903  assert(nDir == 0_deg10); //Unknown direction set at font
904  nMaxWidth = rRect.Width();
905  }
906 
907  // check if char fits into rectangle
908  const OUString aTmp( cChar );
909  aFontSize = rTextPaintInfo.GetTextSize( aTmp ).SvLSize();
910  while ( aFontSize.Width() > nMaxWidth )
911  {
912  SwTwips nFactor = ( 100 * aFontSize.Width() ) / nMaxWidth;
913  const SwTwips nOldWidth = aFontSize.Width();
914 
915  // new height for font
916  const SwFontScript nAct = s_aFnt.GetActual();
917  aFontSize.setHeight( ( 100 * s_aFnt.GetSize( nAct ).Height() ) / nFactor );
918  aFontSize.setWidth( ( 100 * s_aFnt.GetSize( nAct).Width() ) / nFactor );
919 
920  if ( !aFontSize.Width() && !aFontSize.Height() )
921  break;
922 
923  s_aFnt.SetSize( aFontSize, nAct );
924 
925  aFontSize = rTextPaintInfo.GetTextSize( aTmp ).SvLSize();
926 
927  if ( aFontSize.Width() >= nOldWidth )
928  break;
929  }
930 
931  const Point aOldPos( rTextPaintInfo.GetPos() );
932 
933  // adjust values so that tab is vertically and horizontally centered
934  SwTwips nX = rRect.Left();
935  SwTwips nY = rRect.Top();
936  switch ( nDir.get() )
937  {
938  case 0 :
939  if ( bCenter )
940  nX += ( rRect.Width() - aFontSize.Width() ) / 2;
941  nY += ( rRect.Height() - aFontSize.Height() ) / 2 + rTextPaintInfo.GetAscent();
942  break;
943  case 900 :
944  if ( bCenter )
945  nX += ( rRect.Width() - aFontSize.Height() ) / 2 + rTextPaintInfo.GetAscent();
946  nY += ( rRect.Height() + aFontSize.Width() ) / 2;
947  break;
948  case 2700 :
949  if ( bCenter )
950  nX += ( rRect.Width() + aFontSize.Height() ) / 2 - rTextPaintInfo.GetAscent();
951  nY += ( rRect.Height() - aFontSize.Width() ) / 2;
952  break;
953  }
954 
955  Point aTmpPos( nX, nY );
956  rNonConstTextPaintInfo.SetPos( aTmpPos );
957  sal_uInt16 nOldWidth = rPor.Width();
958  const_cast<SwLinePortion&>(rPor).Width( o3tl::narrowing<sal_uInt16>(aFontSize.Width()) );
959  rTextPaintInfo.DrawText( aTmp, rPor );
960  const_cast<SwLinePortion&>(rPor).Width( nOldWidth );
961  rNonConstTextPaintInfo.SetFont( const_cast<SwFont*>(pOldFnt) );
962  rNonConstTextPaintInfo.SetPos( aOldPos );
963 }
964 
965 void SwTextPaintInfo::DrawRect( const SwRect &rRect, bool bRetouche ) const
966 {
967  if ( OnWin() || !bRetouche )
968  {
969  if( m_aTextFly.IsOn() )
970  const_cast<SwTextPaintInfo*>(this)->GetTextFly().
971  DrawFlyRect( m_pOut, rRect );
972  else
973  m_pOut->DrawRect( rRect.SVRect() );
974  }
975 }
976 
977 void SwTextPaintInfo::DrawTab( const SwLinePortion &rPor ) const
978 {
979  if( !OnWin() )
980  return;
981 
982  SwRect aRect;
983  CalcRect( rPor, &aRect );
984 
985  if ( ! aRect.HasArea() )
986  return;
987 
990 
991  lcl_DrawSpecial( *this, rPor, aRect, NON_PRINTING_CHARACTER_COLOR, cChar, nOptions );
992 }
993 
995 {
996  if( !OnWin() )
997  return;
998 
999  sal_uInt16 nOldWidth = rPor.Width();
1000  const_cast<SwLinePortion&>(rPor).Width( LINE_BREAK_WIDTH );
1001 
1002  SwRect aRect;
1003  CalcRect( rPor, &aRect );
1004 
1005  if( aRect.HasArea() )
1006  {
1007  const sal_Unicode cChar = GetTextFrame()->IsRightToLeft() ?
1009  const sal_uInt8 nOptions = 0;
1010 
1011  lcl_DrawSpecial( *this, rPor, aRect, NON_PRINTING_CHARACTER_COLOR, cChar, nOptions );
1012  }
1013 
1014  const_cast<SwLinePortion&>(rPor).Width( nOldWidth );
1015 }
1016 
1018 {
1020  SwRect aRect( static_cast<const SwArrowPortion&>(rPor).GetPos(), aSize );
1021  sal_Unicode cChar;
1022  if( static_cast<const SwArrowPortion&>(rPor).IsLeft() )
1023  {
1024  aRect.Pos().AdjustY(20 - GetAscent() );
1025  aRect.Pos().AdjustX(20 );
1026  if( aSize.Height() > o3tl::narrowing<SwTwips>(rPor.Height()) )
1027  aRect.Height( rPor.Height() );
1028  cChar = CHAR_LEFT_ARROW;
1029  }
1030  else
1031  {
1032  if( aSize.Height() > o3tl::narrowing<SwTwips>(rPor.Height()) )
1033  aRect.Height( rPor.Height() );
1034  aRect.Pos().AdjustY( -(aRect.Height() + 20) );
1035  aRect.Pos().AdjustX( -(aRect.Width() + 20) );
1036  cChar = CHAR_RIGHT_ARROW;
1037  }
1038 
1039  if ( GetTextFrame()->IsVertical() )
1041 
1042  if( aRect.HasArea() )
1043  {
1044  const sal_uInt8 nOptions = 0;
1045  lcl_DrawSpecial( *this, rPor, aRect, COL_LIGHTRED, cChar, nOptions );
1046  }
1047 }
1048 
1049 void SwTextPaintInfo::DrawPostIts( bool bScript ) const
1050 {
1051  if( !OnWin() || !m_pOpt->IsPostIts() )
1052  return;
1053 
1054  Size aSize;
1055  Point aTmp;
1056 
1057  const sal_uInt16 nPostItsWidth = SwViewOption::GetPostItsWidth( GetOut() );
1058  const sal_uInt16 nFontHeight = m_pFnt->GetHeight( m_pVsh, *GetOut() );
1059  const sal_uInt16 nFontAscent = m_pFnt->GetAscent( m_pVsh, *GetOut() );
1060 
1061  switch ( m_pFnt->GetOrientation( GetTextFrame()->IsVertical() ).get() )
1062  {
1063  case 0 :
1064  aSize.setWidth( nPostItsWidth );
1065  aSize.setHeight( nFontHeight );
1066  aTmp.setX( m_aPos.X() );
1067  aTmp.setY( m_aPos.Y() - nFontAscent );
1068  break;
1069  case 900 :
1070  aSize.setHeight( nPostItsWidth );
1071  aSize.setWidth( nFontHeight );
1072  aTmp.setX( m_aPos.X() - nFontAscent );
1073  aTmp.setY( m_aPos.Y() );
1074  break;
1075  case 2700 :
1076  aSize.setHeight( nPostItsWidth );
1077  aSize.setWidth( nFontHeight );
1078  aTmp.setX( m_aPos.X() - nFontHeight +
1079  nFontAscent );
1080  aTmp.setY( m_aPos.Y() );
1081  break;
1082  }
1083 
1084  SwRect aTmpRect( aTmp, aSize );
1085 
1086  if ( GetTextFrame()->IsRightToLeft() )
1087  GetTextFrame()->SwitchLTRtoRTL( aTmpRect );
1088 
1089  if ( GetTextFrame()->IsVertical() )
1091 
1092  SwViewOption::PaintPostIts( const_cast<OutputDevice*>(GetOut()), aTmpRect, bScript );
1093 
1094 }
1095 
1096 void SwTextPaintInfo::DrawCheckBox(const SwFieldFormCheckboxPortion &rPor, bool bChecked) const
1097 {
1098  SwRect aIntersect;
1099  CalcRect( rPor, &aIntersect );
1100  if ( !aIntersect.HasArea() )
1101  return;
1102 
1103  if (OnWin() && SwViewOption::IsFieldShadings() &&
1104  !GetOpt().IsPagePreview())
1105  {
1106  OutputDevice* pOut = const_cast<OutputDevice*>(GetOut());
1107  pOut->Push( PushFlags::LINECOLOR | PushFlags::FILLCOLOR );
1109  pOut->SetLineColor();
1110  pOut->DrawRect( aIntersect.SVRect() );
1111  pOut->Pop();
1112  }
1113  const int delta=10;
1114  tools::Rectangle r(aIntersect.Left()+delta, aIntersect.Top()+delta, aIntersect.Right()-delta, aIntersect.Bottom()-delta);
1115  m_pOut->Push( PushFlags::LINECOLOR | PushFlags::FILLCOLOR );
1116  m_pOut->SetLineColor( Color(0, 0, 0));
1117  m_pOut->SetFillColor();
1118  m_pOut->DrawRect( r );
1119  if (bChecked)
1120  {
1121  m_pOut->DrawLine(r.TopLeft(), r.BottomRight());
1122  m_pOut->DrawLine(r.TopRight(), r.BottomLeft());
1123  }
1124  m_pOut->Pop();
1125 }
1126 
1127 void SwTextPaintInfo::DrawBackground( const SwLinePortion &rPor, const Color *pColor ) const
1128 {
1129  OSL_ENSURE( OnWin(), "SwTextPaintInfo::DrawBackground: printer pollution ?" );
1130 
1131  SwRect aIntersect;
1132  CalcRect( rPor, nullptr, &aIntersect, true );
1133 
1134  if ( !aIntersect.HasArea() )
1135  return;
1136 
1137  OutputDevice* pOut = const_cast<OutputDevice*>(GetOut());
1138  pOut->Push( PushFlags::LINECOLOR | PushFlags::FILLCOLOR );
1139 
1140  // For dark background we do not want to have a filled rectangle
1141  if ( GetVsh() && GetVsh()->GetWin() && lcl_IsDarkBackground( *this ) )
1142  {
1144  }
1145  else
1146  {
1147  if ( pColor )
1148  pOut->SetFillColor( *pColor );
1149  else
1151 
1152  pOut->SetLineColor();
1153  }
1154 
1155  DrawRect( aIntersect, true );
1156  pOut->Pop();
1157 }
1158 
1160 {
1161  {
1162  SwRect aIntersect;
1163  CalcRect( rPor, &aIntersect, nullptr, true );
1164  if(aIntersect.HasArea())
1165  {
1166  SwPosition const aPosition(m_pFrame->MapViewToModelPos(GetIdx()));
1167  const ::sw::mark::IMark* pFieldmark =
1169  bool bIsStartMark = (TextFrameIndex(1) == GetLen()
1170  && CH_TXT_ATR_FIELDSTART == GetText()[sal_Int32(GetIdx())]);
1171  if(pFieldmark) {
1172  SAL_INFO("sw.core", "Found Fieldmark " << pFieldmark->ToString());
1173  }
1174  if(bIsStartMark)
1175  SAL_INFO("sw.core", "Found StartMark");
1176  if (OnWin() && (pFieldmark!=nullptr || bIsStartMark) &&
1178  !GetOpt().IsPagePreview())
1179  {
1180  OutputDevice* pOutDev = const_cast<OutputDevice*>(GetOut());
1181  pOutDev->Push( PushFlags::LINECOLOR | PushFlags::FILLCOLOR );
1183  pOutDev->SetLineColor( );
1184  pOutDev->DrawRect( aIntersect.SVRect() );
1185  pOutDev->Pop();
1186  }
1187  }
1188  }
1189 
1190  SwRect aIntersect;
1191  CalcRect( rPor, nullptr, &aIntersect, true );
1192 
1193  if ( !aIntersect.HasArea() )
1194  return;
1195 
1196  OutputDevice* pTmpOut = const_cast<OutputDevice*>(GetOut());
1197 
1198  // #i16816# tagged pdf support
1199  SwTaggedPDFHelper aTaggedPDFHelper( nullptr, nullptr, nullptr, *pTmpOut );
1200 
1201  Color aFillColor;
1202 
1204  {
1205  aFillColor = m_pFnt->GetHighlightColor();
1206  }
1207  else
1208  {
1209  if( !m_pFnt->GetBackColor() )
1210  return;
1211  aFillColor = *m_pFnt->GetBackColor();
1212  }
1213 
1214  // tdf#104349 do not highlight portions of space chars before end of line if the compatibility option is enabled
1215  // for LTR mode only
1216  if ( !GetTextFrame()->IsRightToLeft() )
1217  {
1218  if (GetTextFrame()->GetDoc().getIDocumentSettingAccess().get(DocumentSettingId::MS_WORD_COMP_TRAILING_BLANKS))
1219  {
1220  bool draw = false;
1221  bool full = false;
1222  SwLinePortion *pPos = const_cast<SwLinePortion *>(&rPor);
1223  TextFrameIndex nIdx = GetIdx();
1224  TextFrameIndex nLen;
1225 
1226  do
1227  {
1228  nLen = pPos->GetLen();
1229  for (TextFrameIndex i = nIdx; i < (nIdx + nLen); ++i)
1230  {
1231  if (i < TextFrameIndex(GetText().getLength())
1232  && GetText()[sal_Int32(i)] == CH_TXTATR_NEWLINE)
1233  {
1234  if ( i >= (GetIdx() + rPor.GetLen()) )
1235  {
1236  goto drawcontinue;
1237  }
1238  }
1239  if (i >= TextFrameIndex(GetText().getLength())
1240  || GetText()[sal_Int32(i)] != CH_BLANK)
1241  {
1242  draw = true;
1243  if ( i >= (GetIdx() + rPor.GetLen()) )
1244  {
1245  full = true;
1246  goto drawcontinue;
1247  }
1248  }
1249  }
1250  nIdx += nLen;
1251  pPos = pPos->GetNextPortion();
1252  } while ( pPos );
1253 
1254  drawcontinue:
1255 
1256  if ( !draw )
1257  return;
1258 
1259  if ( !full )
1260  {
1261  pPos = const_cast<SwLinePortion *>(&rPor);
1262  nIdx = GetIdx();
1263 
1264  nLen = pPos->GetLen();
1265  for (TextFrameIndex i = nIdx + nLen - TextFrameIndex(1);
1266  i >= nIdx; --i)
1267  {
1268  if (i < TextFrameIndex(GetText().getLength())
1269  && GetText()[sal_Int32(i)] == CH_TXTATR_NEWLINE)
1270  {
1271  continue;
1272  }
1273  if (i >= TextFrameIndex(GetText().getLength())
1274  || GetText()[sal_Int32(i)] != CH_BLANK)
1275  {
1276  sal_uInt16 nOldWidth = rPor.Width();
1277  sal_uInt16 nNewWidth = GetTextSize(m_pOut, nullptr,
1278  GetText(), nIdx, (i + TextFrameIndex(1) - nIdx)).Width();
1279 
1280  const_cast<SwLinePortion&>(rPor).Width( nNewWidth );
1281  CalcRect( rPor, nullptr, &aIntersect, true );
1282  const_cast<SwLinePortion&>(rPor).Width( nOldWidth );
1283 
1284  if ( !aIntersect.HasArea() )
1285  {
1286  return;
1287  }
1288 
1289  break;
1290  }
1291  }
1292  }
1293  }
1294  }
1295 
1296  pTmpOut->Push( PushFlags::LINECOLOR | PushFlags::FILLCOLOR );
1297 
1298  pTmpOut->SetFillColor(aFillColor);
1299  pTmpOut->SetLineColor();
1300 
1301  DrawRect( aIntersect, false );
1302 
1303  pTmpOut->Pop();
1304 }
1305 
1307 {
1308  SwRect aDrawArea;
1309  CalcRect( rPor, &aDrawArea );
1310  if ( aDrawArea.HasArea() )
1311  {
1312  PaintCharacterBorder(*m_pFnt, aDrawArea, GetTextFrame()->IsVertical(),
1313  GetTextFrame()->IsVertLRBT(), rPor.GetJoinBorderWithPrev(),
1314  rPor.GetJoinBorderWithNext());
1315  }
1316 }
1317 
1319  PortionType nWhich, const Color *pColor ) const
1320 {
1321  if( !OnWin() || IsMulti() )
1322  return;
1323 
1324  bool bDraw = false;
1325  switch( nWhich )
1326  {
1327  case PortionType::Footnote:
1328  case PortionType::QuoVadis:
1329  case PortionType::Number:
1330  case PortionType::Field:
1331  case PortionType::Hidden:
1332  case PortionType::Tox:
1333  case PortionType::Ref:
1334  case PortionType::Meta:
1336  if ( !GetOpt().IsPagePreview()
1337  && !GetOpt().IsReadonly()
1339  && ( PortionType::Number != nWhich
1340  || m_pFrame->GetTextNodeForParaProps()->HasMarkedLabel())) // #i27615#
1341  {
1342  bDraw = PortionType::Footnote != nWhich || m_pFrame->IsFootnoteAllowed();
1343  }
1344  break;
1345  case PortionType::Bookmark:
1346  // no shading
1347  break;
1349  // input field shading also in read-only mode
1350  if ( !GetOpt().IsPagePreview()
1352  {
1353  bDraw = true;
1354  }
1355  break;
1356  case PortionType::Table:
1357  if ( GetOpt().IsTab() ) bDraw = true;
1358  break;
1360  if ( GetOpt().IsSoftHyph() )bDraw = true;
1361  break;
1362  case PortionType::Blank:
1363  if ( GetOpt().IsHardBlank())bDraw = true;
1364  break;
1365  default:
1366  {
1367  OSL_ENSURE( false, "SwTextPaintInfo::DrawViewOpt: don't know how to draw this" );
1368  break;
1369  }
1370  }
1371  if ( bDraw )
1372  DrawBackground( rPor, pColor );
1373 }
1374 
1376  sal_Int16 nMinLeading, sal_Int16 nMinTrailing, bool bNoCapsHyphenation )
1377 {
1378  sal_Int32 nLen = rVals.getLength();
1379 
1380  if (0 == nLen) // yet to be initialized?
1381  {
1382  rVals.realloc( 3 );
1383  PropertyValue *pVal = rVals.getArray();
1384 
1385  pVal[0].Name = UPN_HYPH_MIN_LEADING;
1386  pVal[0].Handle = UPH_HYPH_MIN_LEADING;
1387  pVal[0].Value <<= nMinLeading;
1388 
1389  pVal[1].Name = UPN_HYPH_MIN_TRAILING;
1390  pVal[1].Handle = UPH_HYPH_MIN_TRAILING;
1391  pVal[1].Value <<= nMinTrailing;
1392 
1393  pVal[2].Name = UPN_HYPH_NO_CAPS;
1394  pVal[2].Handle = UPH_HYPH_NO_CAPS;
1395  pVal[2].Value <<= bNoCapsHyphenation;
1396  }
1397  else if (3 == nLen) // already initialized once?
1398  {
1399  PropertyValue *pVal = rVals.getArray();
1400  pVal[0].Value <<= nMinLeading;
1401  pVal[1].Value <<= nMinTrailing;
1402  pVal[2].Value <<= bNoCapsHyphenation;
1403  }
1404  else {
1405  OSL_FAIL( "unexpected size of sequence" );
1406  }
1407 }
1408 
1410 {
1411  OSL_ENSURE( 3 == m_aHyphVals.getLength(),
1412  "hyphenation values not yet initialized" );
1413  return m_aHyphVals;
1414 }
1415 
1416 bool SwTextFormatInfo::InitHyph( const bool bAutoHyphen )
1417 {
1418  const SwAttrSet& rAttrSet = GetTextFrame()->GetTextNodeForParaProps()->GetSwAttrSet();
1419  SetHanging( rAttrSet.GetHangingPunctuation().GetValue() );
1420  SetScriptSpace( rAttrSet.GetScriptSpace().GetValue() );
1421  SetForbiddenChars( rAttrSet.GetForbiddenRule().GetValue() );
1422  const SvxHyphenZoneItem &rAttr = rAttrSet.GetHyphenZone();
1423  MaxHyph() = rAttr.GetMaxHyphens();
1424  const bool bAuto = bAutoHyphen || rAttr.IsHyphen();
1425  if( bAuto || m_bInterHyph )
1426  {
1427  const sal_Int16 nMinimalLeading = std::max(rAttr.GetMinLead(), sal_uInt8(2));
1428  const sal_Int16 nMinimalTrailing = rAttr.GetMinTrail();
1429  const bool bNoCapsHyphenation = rAttr.IsNoCapsHyphenation();
1430  lcl_InitHyphValues( m_aHyphVals, nMinimalLeading, nMinimalTrailing, bNoCapsHyphenation);
1431  }
1432  return bAuto;
1433 }
1434 
1435 void SwTextFormatInfo::CtorInitTextFormatInfo( OutputDevice* pRenderContext, SwTextFrame *pNewFrame, const bool bNewInterHyph,
1436  const bool bNewQuick, const bool bTst )
1437 {
1438  CtorInitTextPaintInfo( pRenderContext, pNewFrame, SwRect() );
1439 
1440  m_bQuick = bNewQuick;
1441  m_bInterHyph = bNewInterHyph;
1442 
1444  m_bAutoHyph = InitHyph();
1445 
1446  m_bIgnoreFly = false;
1447  m_bFakeLineStart = false;
1448  m_bShift = false;
1449  m_bDropInit = false;
1450  m_bTestFormat = bTst;
1451  m_nLeft = 0;
1452  m_nRight = 0;
1453  m_nFirst = 0;
1454  m_nRealWidth = 0;
1455  m_nForcedLeftMargin = 0;
1456  m_pRest = nullptr;
1457  m_nLineHeight = 0;
1458  m_nLineNetHeight = 0;
1460 
1461  SvtCTLOptions::TextNumerals const nTextNumerals(
1462  SW_MOD()->GetCTLOptions().GetCTLTextNumerals());
1463  // cannot cache for NUMERALS_CONTEXT because we need to know the string
1464  // for the whole paragraph now
1465  if (nTextNumerals != SvtCTLOptions::NUMERALS_CONTEXT)
1466  {
1467  // set digit mode to what will be used later to get same results
1468  SwDigitModeModifier const m(*m_pRef, LANGUAGE_NONE /*dummy*/);
1469  assert(m_pRef->GetDigitLanguage() != LANGUAGE_NONE);
1471  }
1472 
1473  Init();
1474 }
1475 
1484 {
1485  if( !m_bInterHyph && !m_bAutoHyph )
1486  return false;
1487 
1488  LanguageType eTmp = GetFont()->GetLanguage();
1489  if( LANGUAGE_DONTKNOW == eTmp || LANGUAGE_NONE == eTmp )
1490  return false;
1491 
1492  uno::Reference< XHyphenator > xHyph = ::GetHyphenator();
1493  if (!xHyph.is())
1494  return false;
1495 
1496  if (m_bInterHyph)
1497  SvxSpellWrapper::CheckHyphLang( xHyph, eTmp );
1498 
1499  if (!xHyph->hasLocale(g_pBreakIt->GetLocale(eTmp)))
1500  {
1501  SfxObjectShell* pShell = m_pFrame->GetDoc().GetDocShell();
1502  if (pShell)
1503  {
1504  pShell->AppendInfoBarWhenReady(
1505  "hyphenationmissing", SwResId(STR_HYPH_MISSING),
1506  SwResId(STR_HYPH_MISSING_DETAIL)
1507  .replaceFirst("%1", LanguageTag::convertToBcp47( g_pBreakIt->GetLocale(eTmp))),
1508  InfobarType::WARNING);
1509  }
1510  }
1511 
1512  return xHyph->hasLocale( g_pBreakIt->GetLocale(eTmp) );
1513 }
1514 
1516 {
1518  if( 1 >= pDrop->GetLines() ||
1519  ( !pDrop->GetChars() && !pDrop->GetWholeWord() ) )
1520  pDrop = nullptr;
1521  return pDrop;
1522 }
1523 
1525 {
1526  // Not initialized: pRest, nLeft, nRight, nFirst, nRealWidth
1527  X(0);
1530 
1531  // generally we do not allow number portions in follows, except...
1532  if ( GetTextFrame()->IsFollow() )
1533  {
1534  const SwTextFrame* pMaster = GetTextFrame()->FindMaster();
1535  OSL_ENSURE(pMaster, "pTextFrame without Master");
1536  const SwLinePortion* pTmpPara = pMaster ? pMaster->GetPara() : nullptr;
1537 
1538  // there is a master for this follow and the master does not have
1539  // any contents (especially it does not have a number portion)
1540  m_bNumDone = ! pTmpPara ||
1541  ! static_cast<const SwParaPortion*>(pTmpPara)->GetFirstPortion()->IsFlyPortion();
1542  }
1543 
1544  m_pRoot = nullptr;
1545  m_pLast = nullptr;
1546  m_pFly = nullptr;
1547  m_pLastTab = nullptr;
1548  m_pUnderflow = nullptr;
1549  m_cTabDecimal = 0;
1551  m_nForcedLeftMargin = 0;
1555  m_cHookChar = 0;
1556  SetIdx(TextFrameIndex(0));
1558  SetPaintOfst(0);
1559 }
1560 
1561 SwTextFormatInfo::SwTextFormatInfo(OutputDevice* pRenderContext, SwTextFrame *pFrame, const bool bInterHyphL,
1562  const bool bQuickL, const bool bTst)
1563 {
1564  CtorInitTextFormatInfo(pRenderContext, pFrame, bInterHyphL, bQuickL, bTst);
1565 }
1566 
1576  SwLineLayout& rLay, SwTwips nActWidth ) :
1577  SwTextPaintInfo( rInf ),
1578  m_pRoot(&rLay),
1579  m_pLast(&rLay),
1580  m_pFly(nullptr),
1581  m_pUnderflow(nullptr),
1582  m_pRest(nullptr),
1583  m_pLastTab(nullptr),
1584  m_nSoftHyphPos(TextFrameIndex(0)),
1585  m_nLineStart(rInf.GetIdx()),
1586  m_nUnderScorePos(TextFrameIndex(COMPLETE_STRING)),
1587  m_nLeft(rInf.m_nLeft),
1588  m_nRight(rInf.m_nRight),
1589  m_nFirst(rInf.m_nLeft),
1590  m_nRealWidth(sal_uInt16(nActWidth)),
1591  m_nWidth(m_nRealWidth),
1592  m_nLineHeight(0),
1593  m_nLineNetHeight(0),
1594  m_nForcedLeftMargin(0),
1595  m_bFull(false),
1596  m_bFootnoteDone(true),
1597  m_bErgoDone(true),
1598  m_bNumDone(true),
1599  m_bArrowDone(true),
1600  m_bStop(false),
1601  m_bNewLine(true),
1602  m_bShift(false),
1603  m_bUnderflow(false),
1604  m_bInterHyph(false),
1605  m_bAutoHyph(false),
1606  m_bDropInit(false),
1607  m_bQuick(rInf.m_bQuick),
1608  m_bNoEndHyph(false),
1609  m_bNoMidHyph(false),
1610  m_bIgnoreFly(false),
1611  m_bFakeLineStart(false),
1612  m_bTabOverflow( false ),
1613  m_bTestFormat(rInf.m_bTestFormat),
1614  m_cTabDecimal(0),
1615  m_cHookChar(0),
1616  m_nMaxHyph(0)
1617 {
1618  SetMulti( true );
1619  SetFirstMulti( rInf.IsFirstMulti() );
1620 }
1621 
1623 {
1624  const sal_uInt16 nHeight = pCurr->GetRealHeight();
1625  for( SwLinePortion *pPor = pCurr->GetNextPortion(); pPor; pPor = pPor->GetNextPortion() )
1626  {
1627  if( pPor->IsFootnotePortion() && nHeight > static_cast<SwFootnotePortion*>(pPor)->Orig() )
1628  {
1629  SetLineHeight( nHeight );
1630  SetLineNetHeight( pCurr->Height() );
1631  return true;
1632  }
1633  }
1634  return false;
1635 }
1636 
1638  TextFrameIndex const nEnd)
1639 {
1640  m_cHookChar = 0;
1641  TextFrameIndex i = nStart;
1642 
1643  // Used for decimal tab handling:
1644  const sal_Unicode cTabDec = GetLastTab() ? GetTabDecimal() : 0;
1645  const sal_Unicode cThousandSep = ',' == cTabDec ? '.' : ',';
1646 
1647  // #i45951# German (Switzerland) uses ' as thousand separator
1648  const sal_Unicode cThousandSep2 = ',' == cTabDec ? '.' : '\'';
1649 
1650  bool bNumFound = false;
1652 
1653  for( ; i < nEnd; ++i )
1654  {
1655  const sal_Unicode cPos = GetChar( i );
1656  switch( cPos )
1657  {
1658  case CH_TXTATR_BREAKWORD:
1659  case CH_TXTATR_INWORD:
1660  if( !HasHint( i ))
1661  break;
1662  [[fallthrough]];
1663 
1664  case CHAR_SOFTHYPHEN:
1665  case CHAR_HARDHYPHEN:
1666  case CHAR_HARDBLANK:
1667  case CH_TAB:
1668  case CH_BREAK:
1669  case CHAR_ZWSP :
1670  case CHAR_WJ :
1671  m_cHookChar = cPos;
1672  return i;
1673 
1674  case CHAR_UNDERSCORE:
1676  m_nUnderScorePos = i;
1677  break;
1678 
1679  default:
1680  if ( cTabDec )
1681  {
1682  if( cTabDec == cPos )
1683  {
1684  OSL_ENSURE( cPos, "Unexpected end of string" );
1685  if( cPos ) // robust
1686  {
1687  m_cHookChar = cPos;
1688  return i;
1689  }
1690  }
1691 
1692  // Compatibility: First non-digit character behind a
1693  // a digit character becomes the hook character
1694  if ( bTabCompat )
1695  {
1696  if ( ( 0x2F < cPos && cPos < 0x3A ) ||
1697  ( bNumFound && ( cPos == cThousandSep || cPos == cThousandSep2 ) ) )
1698  {
1699  bNumFound = true;
1700  }
1701  else
1702  {
1703  if ( bNumFound )
1704  {
1705  m_cHookChar = cPos;
1706  SetTabDecimal( cPos );
1707  return i;
1708  }
1709  }
1710  }
1711  }
1712  }
1713  }
1714 
1715  // Check if character *behind* the portion has
1716  // to become the hook:
1717  if (i == nEnd && i < TextFrameIndex(GetText().getLength()) && bNumFound)
1718  {
1719  const sal_Unicode cPos = GetChar( i );
1720  if ( cPos != cTabDec && cPos != cThousandSep && cPos !=cThousandSep2 && ( 0x2F >= cPos || cPos >= 0x3A ) )
1721  {
1722  m_cHookChar = GetChar( i );
1724  }
1725  }
1726 
1727  return i;
1728 }
1729 
1731 {
1732  if( GetLast() )
1733  {
1734  if( GetLast()->IsKernPortion() )
1735  return true;
1736  if( GetLast()->Width() || ( GetLast()->GetLen() &&
1737  !GetLast()->IsHolePortion() ) )
1738  return false;
1739  }
1740  SwLinePortion* pPor = GetRoot();
1741  SwLinePortion *pKern = nullptr;
1742  while( pPor )
1743  {
1744  if( pPor->IsKernPortion() )
1745  pKern = pPor;
1746  else if( pPor->Width() || ( pPor->GetLen() && !pPor->IsHolePortion() ) )
1747  pKern = nullptr;
1748  pPor = pPor->GetNextPortion();
1749  }
1750  if( pKern )
1751  {
1752  SetLast( pKern );
1753  return true;
1754  }
1755  return false;
1756 }
1757 
1759 {
1760  SwTwips nLineWidth = Width() - X();
1761 
1762  const bool bTabOverMargin = GetTextFrame()->GetDoc().getIDocumentSettingAccess().get(
1764  const bool bTabOverSpacing = GetTextFrame()->GetDoc().getIDocumentSettingAccess().get(
1766  if (!bTabOverMargin && !bTabOverSpacing)
1767  return nLineWidth;
1768 
1769  SwTabPortion* pLastTab = GetLastTab();
1770  if (!pLastTab)
1771  return nLineWidth;
1772 
1773  // Consider tab portions over the printing bounds of the text frame.
1774  if (pLastTab->GetTabPos() <= Width())
1775  return nLineWidth;
1776 
1777  // Calculate the width that starts at the left (or in case of first line:
1778  // first) margin, but ends after the right paragraph margin:
1779  //
1780  // +--------------------+
1781  // |LL| |RR|
1782  // +--------------------+
1783  // ^ m_nLeftMargin (absolute)
1784  // ^ nLeftMarginWidth (relative to m_nLeftMargin), X() is relative to this
1785  // ^ right margin
1786  // ^ paragraph right
1787  // <--------------------> is GetTextFrame()->getFrameArea().Width()
1788  // <--------------> is Width()
1789  // <-----------------> is what we need to be able to compare to X() (nTextFrameWidth)
1790  SwTwips nLeftMarginWidth = m_nLeftMargin - GetTextFrame()->getFrameArea().Left();
1791  SwTwips nTextFrameWidth = GetTextFrame()->getFrameArea().Width() - nLeftMarginWidth;
1792 
1793  // If there is one such tab portion, then text is allowed to use the full
1794  // text frame area to the right (RR above, but not LL).
1795  nLineWidth = nTextFrameWidth - X();
1796 
1797  if (!bTabOverMargin) // thus bTabOverSpacing only
1798  {
1799  // right, center, decimal can back-fill all the available space - same as TabOverMargin
1800  if (pLastTab->GetWhichPor() == PortionType::TabLeft)
1801  nLineWidth = nTextFrameWidth - pLastTab->GetTabPos();
1802  }
1803  return nLineWidth;
1804 }
1805 
1807  const SwTextSizeInfo *pNew,
1808  const SwLinePortion *pPor,
1809  bool bTextLen,
1810  bool bExgLists,
1811  OUString const & rCh )
1812  : pOldText(nullptr)
1813  , m_pOldSmartTagList(nullptr)
1814  , m_pOldGrammarCheckList(nullptr)
1815  , nIdx(0)
1816  , nLen(0)
1817  , pInf(nullptr)
1818 {
1819  if( rCh.isEmpty() )
1820  {
1821  bOn = pPor->GetExpText( *pNew, aText );
1822  }
1823  else
1824  {
1825  aText = rCh;
1826  bOn = true;
1827  }
1828 
1829  // The text is replaced ...
1830  if( !bOn )
1831  return;
1832 
1833  pInf = const_cast<SwTextSizeInfo*>(pNew);
1834  nIdx = pInf->GetIdx();
1835  nLen = pInf->GetLen();
1836  pOldText = &(pInf->GetText());
1838  pInf->SetText( aText );
1839  pInf->SetIdx(TextFrameIndex(0));
1840  pInf->SetLen(bTextLen ? TextFrameIndex(pInf->GetText().getLength()) : pPor->GetLen());
1841  pInf->SetCachedVclData(nullptr);
1842 
1843  // ST2
1844  if ( !bExgLists )
1845  return;
1846 
1847  m_pOldSmartTagList = static_cast<SwTextPaintInfo*>(pInf)->GetSmartTags();
1848  if (m_pOldSmartTagList)
1849  {
1850  std::pair<SwTextNode const*, sal_Int32> pos(pNew->GetTextFrame()->MapViewToModel(nIdx));
1851  SwWrongList const*const pSmartTags(pos.first->GetSmartTags());
1852  if (pSmartTags)
1853  {
1854  const sal_uInt16 nPos = pSmartTags->GetWrongPos(pos.second);
1855  const sal_Int32 nListPos = pSmartTags->Pos(nPos);
1856  if (nListPos == pos.second && pSmartTags->SubList(nPos) != nullptr)
1857  {
1858  m_pTempIter.reset(new sw::WrongListIterator(*pSmartTags->SubList(nPos)));
1859  static_cast<SwTextPaintInfo*>(pInf)->SetSmartTags(m_pTempIter.get());
1860  }
1861  else if (!m_pTempList && nPos < pSmartTags->Count()
1862  && nListPos < pos.second && !aText.isEmpty())
1863  {
1865  m_pTempList->Insert( OUString(), nullptr, 0, aText.getLength(), 0 );
1867  static_cast<SwTextPaintInfo*>(pInf)->SetSmartTags(m_pTempIter.get());
1868  }
1869  else
1870  static_cast<SwTextPaintInfo*>(pInf)->SetSmartTags(nullptr);
1871  }
1872  else
1873  static_cast<SwTextPaintInfo*>(pInf)->SetSmartTags(nullptr);
1874  }
1875  m_pOldGrammarCheckList = static_cast<SwTextPaintInfo*>(pInf)->GetGrammarCheckList();
1877  return;
1878 
1879  std::pair<SwTextNode const*, sal_Int32> pos(pNew->GetTextFrame()->MapViewToModel(nIdx));
1880  SwWrongList const*const pGrammar(pos.first->GetGrammarCheck());
1881  if (pGrammar)
1882  {
1883  const sal_uInt16 nPos = pGrammar->GetWrongPos(pos.second);
1884  const sal_Int32 nListPos = pGrammar->Pos(nPos);
1885  if (nListPos == pos.second && pGrammar->SubList(nPos) != nullptr)
1886  {
1887  m_pTempIter.reset(new sw::WrongListIterator(*pGrammar->SubList(nPos)));
1888  static_cast<SwTextPaintInfo*>(pInf)->SetGrammarCheckList(m_pTempIter.get());
1889  }
1890  else if (!m_pTempList && nPos < pGrammar->Count()
1891  && nListPos < pos.second && !aText.isEmpty())
1892  {
1894  m_pTempList->Insert( OUString(), nullptr, 0, aText.getLength(), 0 );
1896  static_cast<SwTextPaintInfo*>(pInf)->SetGrammarCheckList(m_pTempIter.get());
1897  }
1898  else
1899  static_cast<SwTextPaintInfo*>(pInf)->SetGrammarCheckList(nullptr);
1900  }
1901  else
1902  static_cast<SwTextPaintInfo*>(pInf)->SetGrammarCheckList(nullptr);
1903 }
1904 
1906 {
1907  if( !bOn )
1908  return;
1909 
1911  pInf->SetText( *pOldText );
1912  pInf->SetIdx( nIdx );
1913  pInf->SetLen( nLen );
1914 
1915  // ST2
1916  // Restore old smart tag list
1917  if (m_pOldSmartTagList)
1918  static_cast<SwTextPaintInfo*>(pInf)->SetSmartTags(m_pOldSmartTagList);
1920  static_cast<SwTextPaintInfo*>(pInf)->SetGrammarCheckList(m_pOldGrammarCheckList);
1921 }
1922 
1924  SwAttrIter* pItr)
1925  : pInf(nullptr)
1926  , pFnt(pNew ? const_cast<SwTextSizeInfo&>(rInf).GetFont() : nullptr)
1927  , pIter(nullptr)
1928 {
1929  if( !pFnt )
1930  return;
1931 
1932  pInf = &const_cast<SwTextSizeInfo&>(rInf);
1933  // In these cases we temporarily switch to the new font:
1934  // 1. the fonts have a different magic number
1935  // 2. they have different script types
1936  // 3. their background colors differ (this is not covered by 1.)
1937  if( pFnt->DifferentFontCacheId( pNew, pFnt->GetActual() ) ||
1938  pNew->GetActual() != pFnt->GetActual() ||
1939  ( ! pNew->GetBackColor() && pFnt->GetBackColor() ) ||
1940  ( pNew->GetBackColor() && ! pFnt->GetBackColor() ) ||
1941  ( pNew->GetBackColor() && pFnt->GetBackColor() &&
1942  ( *pNew->GetBackColor() != *pFnt->GetBackColor() ) ) )
1943  {
1944  pNew->SetTransparent( true );
1945  pNew->SetAlign( TextAlign::Baseline );
1946  pInf->SetFont( pNew );
1947  }
1948  else
1949  pFnt = nullptr;
1950  pNew->Invalidate();
1951  pNew->ChgPhysFnt( pInf->GetVsh(), *pInf->GetOut() );
1952  if( pItr && pItr->GetFnt() == pFnt )
1953  {
1954  pIter = pItr;
1955  pIter->SetFnt( pNew );
1956  }
1957 }
1958 
1960 {
1961  if( pFnt )
1962  {
1963  // Reset SwFont
1964  pFnt->Invalidate();
1965  pInf->SetFont( pFnt );
1966  if( pIter )
1967  {
1968  pIter->SetFnt( pFnt );
1970  }
1971  }
1972 }
1973 
1974 bool SwTextFormatInfo::ChgHyph( const bool bNew )
1975 {
1976  const bool bOld = m_bAutoHyph;
1977  if( m_bAutoHyph != bNew )
1978  {
1979  m_bAutoHyph = bNew;
1980  InitHyph( bNew );
1981  // Set language in the Hyphenator
1982  if( m_pFnt )
1984  }
1985  return bOld;
1986 }
1987 
1988 
1990 {
1991  if (m_nLastBookmarkPos != GetIdx())
1992  {
1994  return true;
1995  }
1996  else
1997  {
1998  return false;
1999  }
2000 }
2001 
2002 /* 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:167
std::unique_ptr< SvxTabStopItem > m_pRuler
Definition: inftxt.hxx:64
void SetLineNetHeight(const sal_uInt16 nNew)
Definition: inftxt.hxx:596
OutDevType GetOutDevType() const
const sal_Unicode CH_BREAK
Definition: swfont.hxx:43
bool LastKernPortion()
Definition: inftxt.cxx:1730
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:199
SwViewShell * GetVsh()
Definition: inftxt.hxx:221
#define UPN_HYPH_NO_CAPS
void DrawBackBrush(const SwLinePortion &rPor) const
Definition: inftxt.cxx:1159
void SetSnapToGrid(const bool bN)
Definition: inftxt.hxx:216
const SwFormatDrop & GetDrop(bool=true) const
Definition: paratr.hxx:208
std::shared_ptr< vcl::TextLayoutCache > m_pOldCachedVclData
Definition: inftxt.hxx:676
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:940
virtual void Height(const sal_uInt32 nNew, const bool bText=true) override
Definition: porlay.cxx:202
bool CheckFootnotePortion_(SwLineLayout const *pCurr)
Definition: inftxt.cxx:1622
bool InSpaceGrp() const
Definition: porlin.hxx:108
const css::beans::PropertyValues & GetHyphValues() const
Definition: inftxt.cxx:1409
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:101
static void lcl_InitHyphValues(PropertyValues &rVals, sal_Int16 nMinLeading, sal_Int16 nMinTrailing, bool bNoCapsHyphenation)
Definition: inftxt.cxx:1375
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:194
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:169
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
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:1637
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:1306
Size SvLSize() const
Definition: possiz.hxx:53
bool DifferentFontCacheId(const SwFont *pFnt, SwFontScript nWhich)
Definition: swfont.hxx:200
void SetKanaComp(short nNew)
Definition: drawfont.hxx:531
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:4460
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:161
const MapMode & GetMapMode() const
std::map< sal_Int32, std::shared_ptr< SetItemPropertyStorage > > PropertyValues
void SetLayoutMode(ComplexTextLayoutFlags nTextLayoutMode)
const OUString * pOldText
Definition: inftxt.hxx:677
bool IsHangingPortion() const
Definition: porlin.hxx:132
#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:168
void SetBorder(sal_uInt16 nBorder)
const Size & GetSize(SwFontScript nWhich) const
Definition: swfont.hxx:204
void DrawPostIts(bool bScript) const
Definition: inftxt.cxx:1049
IDocumentMarkAccess * getIDocumentMarkAccess()
Definition: docbm.cxx:1794
void SetText(const OUString &rNew)
Definition: inftxt.hxx:275
void SetMulti(const bool bNew)
Definition: inftxt.hxx:204
Of course Writer needs its own rectangles.
Definition: swrect.hxx:34
bool InFieldGrp() const
Definition: porlin.hxx:103
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:170
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:622
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:247
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:1974
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:980
#define UPN_HYPH_MIN_TRAILING
void AddTop(const tools::Long nAdd)
Definition: swrect.cxx:165
void SetColor(const Color &rColor)
Definition: swfont.hxx:411
size_t CountCompChg() const
Definition: scriptinfo.hxx:162
#define CHAR_SOFTHYPHEN
Definition: swtypes.hxx:163
#define CHAR_LEFT_ARROW
Definition: inftxt.cxx:76
static OutputDevice * GetDefaultDevice()
SwTwips m_nFirst
Definition: inftxt.hxx:477
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:1127
#define CHAR_LINEBREAK_RTL
Definition: inftxt.cxx:81
#define UPN_IS_GRAMMAR_AUTO
const SwRect & getFrameArea() const
Definition: frame.hxx:178
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:541
sal_uInt16 GetAscent(SwViewShell const *pSh, const OutputDevice &rOut)
Definition: swfont.hxx:323
void SetOut(OutputDevice &rNew)
Definition: drawfont.hxx:392
TextFrameIndex nLen
Definition: inftxt.hxx:683
SwBreakIt * g_pBreakIt
Definition: breakit.cxx:33
SwRect & Intersection(const SwRect &rRect)
Definition: swrect.cxx:56
void CtorInitLineInfo(const SwAttrSet &rAttrSet, const SwTextNode &rTextNode)
Definition: inftxt.cxx:99
bool m_bScriptSpace
Definition: inftxt.hxx:172
void DrawCheckBox(const SwFieldFormCheckboxPortion &rPor, bool bChecked) const
Definition: inftxt.cxx:1096
std::shared_ptr< SdrAllFillAttributesHelper > SdrAllFillAttributesHelperPtr
Definition: format.hxx:41
oslFileHandle & pOut
void SetStartColor(const Color &rColor)
void DrawViewOpt(const SwLinePortion &rPor, PortionType nWhich, const Color *pColor=nullptr) const
Definition: inftxt.cxx:1318
bool m_bNotEOL
Definition: inftxt.hxx:159
SwLinePortion * m_pUnderflow
Definition: inftxt.hxx:465
void Width(tools::Long nNew)
Definition: swrect.hxx:186
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:1435
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:447
const std::optional< Color > & GetBackColor() const
Definition: swfont.hxx:190
void DrawLine(const Point &rStartPt, const Point &rEndPt)
void SetHyphPos(TextFrameIndex *const pNew)
Definition: drawfont.hxx:405
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:107
TextFrameIndex GetOffset() const
Definition: txtfrm.hxx:438
void DrawBackground(const SwLinePortion &rPor, const Color *pColor=nullptr) const
Definition: inftxt.cxx:1127
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
const Color & GetColor() const
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
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:286
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: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:78
const SvxParaVertAlignItem & GetParaVertAlign(bool=true) const
Definition: paratr.hxx:218
bool IsDark() const
SwTwips GetLineWidth()
Returns the distance between the current horizontal position and the end of the line.
Definition: inftxt.cxx:1758
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:994
SwTextFly & GetTextFly()
Definition: inftxt.hxx:383
const sal_Unicode CH_TAB
Definition: swfont.hxx:44
void AddBottom(const tools::Long nAdd)
Definition: swrect.cxx:167
SwTextFly m_aTextFly
Definition: inftxt.hxx:345
SwParaPortion * GetParaPortion()
Definition: inftxt.hxx:121
bool IsFlyPortion() const
Definition: porlin.hxx:126
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:1416
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:1806
const sal_Unicode CH_BLANK
Definition: swfont.hxx:42
bool IsKernPortion() const
Definition: porlin.hxx:133
void SelectFont()
Definition: inftxt.cxx:364
SwLineInfo()
Definition: inftxt.cxx:86
Align GetValue() const
bool HasArea() const
Definition: swrect.hxx:287
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:752
sal_uInt16 Width() const
Definition: inftxt.hxx:527
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:4863
SwLineLayout * GetRoot()
Definition: inftxt.hxx:556
const SwFormatDrop * GetDropFormat() const
Definition: inftxt.cxx:1515
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:166
void DrawTab(const SwLinePortion &rPor) const
Definition: inftxt.cxx:977
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:2093
bool IsDropPortion() const
Definition: porlin.hxx:122
void DrawRect(const SwRect &rRect, bool bRetouche) const
Definition: inftxt.cxx:965
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:164
DrawModeFlags GetDrawMode() const
sal_uInt8 GetChars() const
Definition: paratr.hxx:104
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:73
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:50
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:1754
bool IsHolePortion() const
Definition: porlin.hxx:127
SwTextFrame * m_pFrame
Definition: inftxt.hxx:152
VclPtr< OutputDevice > m_pOut
Definition: inftxt.hxx:142
sal_uInt32 Height() const
Definition: possiz.hxx:49
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
const std::shared_ptr< vcl::TextLayoutCache > & GetCachedVclData() const
Definition: inftxt.hxx:328
#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:49
bool GetBackgroundBrush(drawinglayer::attribute::SdrAllFillAttributesHelperPtr &rFillAttributes, const SvxBrushItem *&rpBrush, std::optional< Color > &rxColor, 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:7282
void SetAngle(Degree10 nAngle)
void AddLeft(const tools::Long nAdd)
Definition: swrect.cxx:162
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:855
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:208
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:162
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:1483
tools::Rectangle SVRect() const
Definition: swrect.hxx:279
void SetLen(const TextFrameIndex nNew)
Definition: inftxt.hxx:274
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:94
OUString const & GetDefBulletFontname()
retrieve font family name used for the default bullet list characters
Definition: number.cxx:1328
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)
static Color & GetFontColor()
Definition: viewopt.cxx:456
IDocumentSettingAccess const & getIDocumentSettingAccess() const
Definition: doc.cxx:176
#define UPN_HYPH_MIN_LEADING
bool OnWin() const
Definition: inftxt.hxx:192
bool IsRightToLeft() const
Definition: frame.hxx:984
void SetFamily(const FontFamily eFamily, const SwFontScript nWhich)
Definition: swfont.hxx:448
void Top(const tools::Long nTop)
Definition: swrect.hxx:203
void SetCharSet(const rtl_TextEncoding eCharSet, const SwFontScript nWhich)
Definition: swfont.hxx:487
TextFrameIndex GetLen() const
Definition: inftxt.hxx:273
void SetCachedVclData(std::shared_ptr< vcl::TextLayoutCache > const &pCachedVclData)
Definition: inftxt.hxx:332
void SetSnapToGrid(bool bNew)
Definition: drawfont.hxx:572
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:97
SwFontSave(const SwTextSizeInfo &rInf, SwFont *pFnt, SwAttrIter *pItr=nullptr)
Definition: inftxt.cxx:1923
SwParaPortion * m_pPara
Definition: inftxt.hxx:108
sw::WrongListIterator * m_pOldSmartTagList
Definition: inftxt.hxx:678
SwScriptInfo & GetScriptInfo()
Definition: porlay.hxx:288
double getLength(const B2DPolygon &rCandidate)
SwFontScript
Definition: swfont.hxx:122
TextFrameIndex GetTextBreak(const tools::Long nLineWidth, const TextFrameIndex nMaxLen, const sal_uInt16 nComp, vcl::TextLayoutCache const *) const
Definition: inftxt.cxx:433
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
virtual bool get(DocumentSettingId id) const =0
Return the specified document setting.
bool CheckCurrentPosBookmark()
Definition: inftxt.cxx:1989
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:2416
void DrawRedArrow(const SwLinePortion &rPor) const
Definition: inftxt.cxx:1017
#define UPH_HYPH_MIN_LEADING
constexpr sal_Int32 COMPLETE_STRING
Definition: swtypes.hxx:56
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:970
uno::Reference< linguistic2::XHyphenator > GetHyphenator()
Definition: swtypes.cxx:57
#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:2872
void SetLineHeight(const sal_uInt16 nNew)
Definition: inftxt.hxx:594
css::uno::Any GetProperty(const OUString &rPropertyName) const
SwDoc & GetDoc()
Definition: txtfrm.hxx:460
static bool lcl_IsDarkBackground(const SwTextPaintInfo &rInf)
Returns if the current background color is dark.
Definition: inftxt.cxx:525
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
sal_uInt32 & GetAscent()
Definition: porlin.hxx:76
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:354
sal_uInt16 GetKanaComp() const
Definition: inftxt.hxx:324
sal_uInt32 Width() const
Definition: possiz.hxx:51
bool GetJoinBorderWithNext() const
Definition: porlin.hxx:170
SwLinePortion * GetNextPortion() const
Definition: porlin.hxx:71
SwTextFormatInfo(OutputDevice *pRenderContext, SwTextFrame *pFrame, const bool bInterHyphL=false, const bool bQuickL=false, const bool bTst=false)
Definition: inftxt.cxx:1561
OUString SwResId(std::string_view aId)
Definition: swmodule.cxx:165
static bool FlushVout()
Output virtual Device (e.g. for animations)
Definition: virtoutp.cxx:30
void Push(PushFlags nFlags=PushFlags::ALL)
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:190
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
Color aGlobalRetoucheColor
Definition: paintfrm.cxx:247
SwRootFrame * getRootFrame()
Definition: frame.hxx:678
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
sal_uInt32 GetRealHeight() const
Definition: porlay.hxx:169
std::vector< tools::Long > * m_pSpaceAdd
Definition: inftxt.hxx:343
sw::WrongListIterator * m_pOldGrammarCheckList
Definition: inftxt.hxx:679
bool IsBlankPortion() const
Definition: porlin.hxx:112
SwFlyPortion * m_pFly
Definition: inftxt.hxx:464