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  : pSpace( nullptr ),
88  nVertAlign( SvxParaVertAlignItem::Align::Automatic ),
89  nDefTabStop( 0 ),
90  bListTabStopIncluded( false ),
91  nListTabStopPosition( 0 )
92 {
93 }
94 
96 {
97 }
98 
100  const SwTextNode& rTextNode )
101 {
102  pRuler.reset( new SvxTabStopItem( rAttrSet.GetTabStops() ) );
103  if ( rTextNode.GetListTabStopPosition( nListTabStopPosition ) )
104  {
105  bListTabStopIncluded = true;
106 
107  // insert the list tab stop into SvxTabItem instance <pRuler>
108  const SvxTabStop aListTabStop( nListTabStopPosition,
109  SvxTabAdjust::Left );
110  pRuler->Insert( aListTabStop );
111 
112  // remove default tab stops, which are before the inserted list tab stop
113  for ( sal_uInt16 i = 0; i < pRuler->Count(); i++ )
114  {
115  if ( (*pRuler)[i].GetTabPos() < nListTabStopPosition &&
116  (*pRuler)[i].GetAdjustment() == SvxTabAdjust::Default )
117  {
118  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 < pRuler->Count(); i++ )
128  {
129  if ( (*pRuler)[i].GetTabPos() == 0 &&
130  (*pRuler)[i].GetAdjustment() == SvxTabAdjust::Default )
131  {
132  pRuler->Remove(i);
133  break;
134  }
135  }
136  }
137 
138  pSpace = &rAttrSet.GetLineSpacing();
139  nVertAlign = rAttrSet.GetParaVertAlign().GetValue();
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 = static_cast<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  aTextFly.CtorInitTextFly( pFrame );
484  aPaintRect = rPaint;
485  nSpaceIdx = 0;
486  pSpaceAdd = nullptr;
487  m_pWrongList = nullptr;
488  m_pGrammarCheckList = nullptr;
489  m_pSmartTags = nullptr;
490  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  , pSpaceAdd( rInf.GetpSpaceAdd() ),
499  pBrushItem( rInf.GetBrushItem() ),
500  aTextFly( rInf.GetTextFly() ),
501  aPos( rInf.GetPos() ),
502  aPaintRect( rInf.GetPaintRect() ),
503  nSpaceIdx( rInf.GetSpaceIdx() )
504 { }
505 
507  : SwTextSizeInfo( rInf )
508  , m_pWrongList( rInf.GetpWrongList() )
509  , m_pGrammarCheckList( rInf.GetGrammarCheckList() )
510  , m_pSmartTags( rInf.GetSmartTags() )
511  , pSpaceAdd( rInf.GetpSpaceAdd() ),
512  pBrushItem( rInf.GetBrushItem() ),
513  aTextFly( rInf.GetTextFly() ),
514  aPos( rInf.GetPos() ),
515  aPaintRect( rInf.GetPaintRect() ),
516  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  const 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 = nullptr;
546  }
547  else
548  pCol = nullptr;
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 = m_rPaintInf.GetFont()->GetColor().GetTransparency();
606  const Color aTransColor(nTransPercentVcl, nTransPercentVcl, nTransPercentVcl);
607  aVCLGradient.SetStyle(GradientStyle::Linear);
608  aVCLGradient.SetStartColor(aTransColor);
609  aVCLGradient.SetEndColor(aTransColor);
610  aVCLGradient.SetAngle(Degree10(0));
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(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;
717  if (m_pFnt->GetColor() != COL_AUTO && m_pFnt->GetColor().GetTransparency() != 0)
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( Degree10(0), 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 == Degree10(900) || nDir == Degree10(2700))
900  nMaxWidth = rRect.Height();
901  else
902  {
903  assert(nDir == Degree10(0)); //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( static_cast<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( 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() > rPor.Height() )
1027  aRect.Height( rPor.Height() );
1028  cChar = CHAR_LEFT_ARROW;
1029  }
1030  else
1031  {
1032  if( aSize.Height() > 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( aPos.X() );
1067  aTmp.setY( aPos.Y() - nFontAscent );
1068  break;
1069  case 900 :
1070  aSize.setHeight( nPostItsWidth );
1071  aSize.setWidth( nFontHeight );
1072  aTmp.setX( aPos.X() - nFontAscent );
1073  aTmp.setY( aPos.Y() );
1074  break;
1075  case 2700 :
1076  aSize.setHeight( nPostItsWidth );
1077  aSize.setWidth( nFontHeight );
1078  aTmp.setX( aPos.X() - nFontHeight +
1079  nFontAscent );
1080  aTmp.setY( 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  const tools::Rectangle aRect( aTmpRect.SVRect() );
1093  SwViewOption::PaintPostIts( const_cast<OutputDevice*>(GetOut()), aRect, bScript );
1094 
1095 }
1096 
1097 void SwTextPaintInfo::DrawCheckBox(const SwFieldFormCheckboxPortion &rPor, bool bChecked) const
1098 {
1099  SwRect aIntersect;
1100  CalcRect( rPor, &aIntersect );
1101  if ( !aIntersect.HasArea() )
1102  return;
1103 
1104  if (OnWin() && SwViewOption::IsFieldShadings() &&
1105  !GetOpt().IsPagePreview())
1106  {
1107  OutputDevice* pOut = const_cast<OutputDevice*>(GetOut());
1108  pOut->Push( PushFlags::LINECOLOR | PushFlags::FILLCOLOR );
1110  pOut->SetLineColor();
1111  pOut->DrawRect( aIntersect.SVRect() );
1112  pOut->Pop();
1113  }
1114  const int delta=10;
1115  tools::Rectangle r(aIntersect.Left()+delta, aIntersect.Top()+delta, aIntersect.Right()-delta, aIntersect.Bottom()-delta);
1116  m_pOut->Push( PushFlags::LINECOLOR | PushFlags::FILLCOLOR );
1117  m_pOut->SetLineColor( Color(0, 0, 0));
1118  m_pOut->SetFillColor();
1119  m_pOut->DrawRect( r );
1120  if (bChecked)
1121  {
1122  m_pOut->DrawLine(r.TopLeft(), r.BottomRight());
1123  m_pOut->DrawLine(r.TopRight(), r.BottomLeft());
1124  }
1125  m_pOut->Pop();
1126 }
1127 
1129 {
1130  OSL_ENSURE( OnWin(), "SwTextPaintInfo::DrawBackground: printer pollution ?" );
1131 
1132  SwRect aIntersect;
1133  CalcRect( rPor, nullptr, &aIntersect, true );
1134 
1135  if ( !aIntersect.HasArea() )
1136  return;
1137 
1138  OutputDevice* pOut = const_cast<OutputDevice*>(GetOut());
1139  pOut->Push( PushFlags::LINECOLOR | PushFlags::FILLCOLOR );
1140 
1141  // For dark background we do not want to have a filled rectangle
1142  if ( GetVsh() && GetVsh()->GetWin() && lcl_IsDarkBackground( *this ) )
1143  {
1145  }
1146  else
1147  {
1149  pOut->SetLineColor();
1150  }
1151 
1152  DrawRect( aIntersect, true );
1153  pOut->Pop();
1154 }
1155 
1157 {
1158  {
1159  SwRect aIntersect;
1160  CalcRect( rPor, &aIntersect, nullptr, true );
1161  if(aIntersect.HasArea())
1162  {
1163  SwPosition const aPosition(m_pFrame->MapViewToModelPos(GetIdx()));
1164  const ::sw::mark::IMark* pFieldmark =
1166  bool bIsStartMark = (TextFrameIndex(1) == GetLen()
1167  && CH_TXT_ATR_FIELDSTART == GetText()[sal_Int32(GetIdx())]);
1168  if(pFieldmark) {
1169  SAL_INFO("sw.core", "Found Fieldmark " << pFieldmark->ToString());
1170  }
1171  if(bIsStartMark)
1172  SAL_INFO("sw.core", "Found StartMark");
1173  if (OnWin() && (pFieldmark!=nullptr || bIsStartMark) &&
1175  !GetOpt().IsPagePreview())
1176  {
1177  OutputDevice* pOutDev = const_cast<OutputDevice*>(GetOut());
1178  pOutDev->Push( PushFlags::LINECOLOR | PushFlags::FILLCOLOR );
1180  pOutDev->SetLineColor( );
1181  pOutDev->DrawRect( aIntersect.SVRect() );
1182  pOutDev->Pop();
1183  }
1184  }
1185  }
1186 
1187  SwRect aIntersect;
1188  CalcRect( rPor, nullptr, &aIntersect, true );
1189 
1190  if ( !aIntersect.HasArea() )
1191  return;
1192 
1193  OutputDevice* pTmpOut = const_cast<OutputDevice*>(GetOut());
1194 
1195  // #i16816# tagged pdf support
1196  SwTaggedPDFHelper aTaggedPDFHelper( nullptr, nullptr, nullptr, *pTmpOut );
1197 
1198  Color aFillColor;
1199 
1201  {
1202  aFillColor = m_pFnt->GetHighlightColor();
1203  }
1204  else
1205  {
1206  if( !m_pFnt->GetBackColor() )
1207  return;
1208  aFillColor = *m_pFnt->GetBackColor();
1209  }
1210 
1211  // tdf#104349 do not highlight portions of space chars before end of line if the compatibility option is enabled
1212  // for LTR mode only
1213  if ( !GetTextFrame()->IsRightToLeft() )
1214  {
1215  if (GetTextFrame()->GetDoc().getIDocumentSettingAccess().get(DocumentSettingId::MS_WORD_COMP_TRAILING_BLANKS))
1216  {
1217  bool draw = false;
1218  bool full = false;
1219  SwLinePortion *pPos = const_cast<SwLinePortion *>(&rPor);
1220  TextFrameIndex nIdx = GetIdx();
1221  TextFrameIndex nLen;
1222 
1223  do
1224  {
1225  nLen = pPos->GetLen();
1226  for (TextFrameIndex i = nIdx; i < (nIdx + nLen); ++i)
1227  {
1228  if (i < TextFrameIndex(GetText().getLength())
1229  && GetText()[sal_Int32(i)] == CH_TXTATR_NEWLINE)
1230  {
1231  if ( i >= (GetIdx() + rPor.GetLen()) )
1232  {
1233  goto drawcontinue;
1234  }
1235  }
1236  if (i >= TextFrameIndex(GetText().getLength())
1237  || GetText()[sal_Int32(i)] != CH_BLANK)
1238  {
1239  draw = true;
1240  if ( i >= (GetIdx() + rPor.GetLen()) )
1241  {
1242  full = true;
1243  goto drawcontinue;
1244  }
1245  }
1246  }
1247  nIdx += nLen;
1248  pPos = pPos->GetNextPortion();
1249  } while ( pPos );
1250 
1251  drawcontinue:
1252 
1253  if ( !draw )
1254  return;
1255 
1256  if ( !full )
1257  {
1258  pPos = const_cast<SwLinePortion *>(&rPor);
1259  nIdx = GetIdx();
1260 
1261  nLen = pPos->GetLen();
1262  for (TextFrameIndex i = nIdx + nLen - TextFrameIndex(1);
1263  i >= nIdx; --i)
1264  {
1265  if (i < TextFrameIndex(GetText().getLength())
1266  && GetText()[sal_Int32(i)] == CH_TXTATR_NEWLINE)
1267  {
1268  continue;
1269  }
1270  if (i >= TextFrameIndex(GetText().getLength())
1271  || GetText()[sal_Int32(i)] != CH_BLANK)
1272  {
1273  sal_uInt16 nOldWidth = rPor.Width();
1274  sal_uInt16 nNewWidth = GetTextSize(m_pOut, nullptr,
1275  GetText(), nIdx, (i + TextFrameIndex(1) - nIdx)).Width();
1276 
1277  const_cast<SwLinePortion&>(rPor).Width( nNewWidth );
1278  CalcRect( rPor, nullptr, &aIntersect, true );
1279  const_cast<SwLinePortion&>(rPor).Width( nOldWidth );
1280 
1281  if ( !aIntersect.HasArea() )
1282  {
1283  return;
1284  }
1285 
1286  break;
1287  }
1288  }
1289  }
1290  }
1291  }
1292 
1293  pTmpOut->Push( PushFlags::LINECOLOR | PushFlags::FILLCOLOR );
1294 
1295  pTmpOut->SetFillColor(aFillColor);
1296  pTmpOut->SetLineColor();
1297 
1298  DrawRect( aIntersect, false );
1299 
1300  pTmpOut->Pop();
1301 }
1302 
1304 {
1305  SwRect aDrawArea;
1306  CalcRect( rPor, &aDrawArea );
1307  if ( aDrawArea.HasArea() )
1308  {
1309  PaintCharacterBorder(*m_pFnt, aDrawArea, GetTextFrame()->IsVertical(),
1310  GetTextFrame()->IsVertLRBT(), rPor.GetJoinBorderWithPrev(),
1311  rPor.GetJoinBorderWithNext());
1312  }
1313 }
1314 
1316  PortionType nWhich ) const
1317 {
1318  if( !OnWin() || IsMulti() )
1319  return;
1320 
1321  bool bDraw = false;
1322  switch( nWhich )
1323  {
1324  case PortionType::Footnote:
1325  case PortionType::QuoVadis:
1326  case PortionType::Number:
1327  case PortionType::Field:
1328  case PortionType::Hidden:
1329  case PortionType::Tox:
1330  case PortionType::Ref:
1331  case PortionType::Meta:
1333  if ( !GetOpt().IsPagePreview()
1334  && !GetOpt().IsReadonly()
1336  && ( PortionType::Number != nWhich
1337  || m_pFrame->GetTextNodeForParaProps()->HasMarkedLabel())) // #i27615#
1338  {
1339  bDraw = PortionType::Footnote != nWhich || m_pFrame->IsFootnoteAllowed();
1340  }
1341  break;
1342  case PortionType::Bookmark:
1343  // no shading
1344  break;
1346  // input field shading also in read-only mode
1347  if ( !GetOpt().IsPagePreview()
1349  {
1350  bDraw = true;
1351  }
1352  break;
1353  case PortionType::Table:
1354  if ( GetOpt().IsTab() ) bDraw = true;
1355  break;
1357  if ( GetOpt().IsSoftHyph() )bDraw = true;
1358  break;
1359  case PortionType::Blank:
1360  if ( GetOpt().IsHardBlank())bDraw = true;
1361  break;
1362  default:
1363  {
1364  OSL_ENSURE( false, "SwTextPaintInfo::DrawViewOpt: don't know how to draw this" );
1365  break;
1366  }
1367  }
1368  if ( bDraw )
1369  DrawBackground( rPor );
1370 }
1371 
1373  sal_Int16 nMinLeading, sal_Int16 nMinTrailing, bool bNoCapsHyphenation )
1374 {
1375  sal_Int32 nLen = rVals.getLength();
1376 
1377  if (0 == nLen) // yet to be initialized?
1378  {
1379  rVals.realloc( 3 );
1380  PropertyValue *pVal = rVals.getArray();
1381 
1382  pVal[0].Name = UPN_HYPH_MIN_LEADING;
1383  pVal[0].Handle = UPH_HYPH_MIN_LEADING;
1384  pVal[0].Value <<= nMinLeading;
1385 
1386  pVal[1].Name = UPN_HYPH_MIN_TRAILING;
1387  pVal[1].Handle = UPH_HYPH_MIN_TRAILING;
1388  pVal[1].Value <<= nMinTrailing;
1389 
1390  pVal[2].Name = UPN_HYPH_NO_CAPS;
1391  pVal[2].Handle = UPH_HYPH_NO_CAPS;
1392  pVal[2].Value <<= bNoCapsHyphenation;
1393  }
1394  else if (3 == nLen) // already initialized once?
1395  {
1396  PropertyValue *pVal = rVals.getArray();
1397  pVal[0].Value <<= nMinLeading;
1398  pVal[1].Value <<= nMinTrailing;
1399  pVal[2].Value <<= bNoCapsHyphenation;
1400  }
1401  else {
1402  OSL_FAIL( "unexpected size of sequence" );
1403  }
1404 }
1405 
1407 {
1408  OSL_ENSURE( 3 == m_aHyphVals.getLength(),
1409  "hyphenation values not yet initialized" );
1410  return m_aHyphVals;
1411 }
1412 
1413 bool SwTextFormatInfo::InitHyph( const bool bAutoHyphen )
1414 {
1415  const SwAttrSet& rAttrSet = GetTextFrame()->GetTextNodeForParaProps()->GetSwAttrSet();
1416  SetHanging( rAttrSet.GetHangingPunctuation().GetValue() );
1417  SetScriptSpace( rAttrSet.GetScriptSpace().GetValue() );
1418  SetForbiddenChars( rAttrSet.GetForbiddenRule().GetValue() );
1419  const SvxHyphenZoneItem &rAttr = rAttrSet.GetHyphenZone();
1420  MaxHyph() = rAttr.GetMaxHyphens();
1421  const bool bAuto = bAutoHyphen || rAttr.IsHyphen();
1422  if( bAuto || m_bInterHyph )
1423  {
1424  const sal_Int16 nMinimalLeading = std::max(rAttr.GetMinLead(), sal_uInt8(2));
1425  const sal_Int16 nMinimalTrailing = rAttr.GetMinTrail();
1426  const bool bNoCapsHyphenation = rAttr.IsNoCapsHyphenation();
1427  lcl_InitHyphValues( m_aHyphVals, nMinimalLeading, nMinimalTrailing, bNoCapsHyphenation);
1428  }
1429  return bAuto;
1430 }
1431 
1432 void SwTextFormatInfo::CtorInitTextFormatInfo( OutputDevice* pRenderContext, SwTextFrame *pNewFrame, const bool bNewInterHyph,
1433  const bool bNewQuick, const bool bTst )
1434 {
1435  CtorInitTextPaintInfo( pRenderContext, pNewFrame, SwRect() );
1436 
1437  m_bQuick = bNewQuick;
1438  m_bInterHyph = bNewInterHyph;
1439 
1441  m_bAutoHyph = InitHyph();
1442 
1443  m_bIgnoreFly = false;
1444  m_bFakeLineStart = false;
1445  m_bShift = false;
1446  m_bDropInit = false;
1447  m_bTestFormat = bTst;
1448  m_nLeft = 0;
1449  m_nRight = 0;
1450  m_nFirst = 0;
1451  m_nRealWidth = 0;
1452  m_nForcedLeftMargin = 0;
1453  m_pRest = nullptr;
1454  m_nLineHeight = 0;
1455  m_nLineNetHeight = 0;
1457 
1458  SvtCTLOptions::TextNumerals const nTextNumerals(
1459  SW_MOD()->GetCTLOptions().GetCTLTextNumerals());
1460  // cannot cache for NUMERALS_CONTEXT because we need to know the string
1461  // for the whole paragraph now
1462  if (nTextNumerals != SvtCTLOptions::NUMERALS_CONTEXT)
1463  {
1464  // set digit mode to what will be used later to get same results
1465  SwDigitModeModifier const m(*m_pRef, LANGUAGE_NONE /*dummy*/);
1468  }
1469 
1470  Init();
1471 }
1472 
1481 {
1482  if( !m_bInterHyph && !m_bAutoHyph )
1483  return false;
1484 
1485  LanguageType eTmp = GetFont()->GetLanguage();
1486  if( LANGUAGE_DONTKNOW == eTmp || LANGUAGE_NONE == eTmp )
1487  return false;
1488 
1489  uno::Reference< XHyphenator > xHyph = ::GetHyphenator();
1490  if (!xHyph.is())
1491  return false;
1492 
1493  if (m_bInterHyph)
1494  SvxSpellWrapper::CheckHyphLang( xHyph, eTmp );
1495 
1496  if (!xHyph->hasLocale(g_pBreakIt->GetLocale(eTmp)))
1497  {
1498  SfxObjectShell* pShell = m_pFrame->GetDoc().GetDocShell();
1499  if (pShell)
1500  {
1501  pShell->AppendInfoBarWhenReady(
1502  "hyphenationmissing", SwResId(STR_HYPH_MISSING),
1503  SwResId(STR_HYPH_MISSING_DETAIL)
1504  .replaceFirst("%1", g_pBreakIt->GetLocale(eTmp).Language),
1505  InfobarType::WARNING);
1506  }
1507  }
1508 
1509  return xHyph->hasLocale( g_pBreakIt->GetLocale(eTmp) );
1510 }
1511 
1513 {
1515  if( 1 >= pDrop->GetLines() ||
1516  ( !pDrop->GetChars() && !pDrop->GetWholeWord() ) )
1517  pDrop = nullptr;
1518  return pDrop;
1519 }
1520 
1522 {
1523  // Not initialized: pRest, nLeft, nRight, nFirst, nRealWidth
1524  X(0);
1527 
1528  // generally we do not allow number portions in follows, except...
1529  if ( GetTextFrame()->IsFollow() )
1530  {
1531  const SwTextFrame* pMaster = GetTextFrame()->FindMaster();
1532  OSL_ENSURE(pMaster, "pTextFrame without Master");
1533  const SwLinePortion* pTmpPara = pMaster ? pMaster->GetPara() : nullptr;
1534 
1535  // there is a master for this follow and the master does not have
1536  // any contents (especially it does not have a number portion)
1537  m_bNumDone = ! pTmpPara ||
1538  ! static_cast<const SwParaPortion*>(pTmpPara)->GetFirstPortion()->IsFlyPortion();
1539  }
1540 
1541  m_pRoot = nullptr;
1542  m_pLast = nullptr;
1543  m_pFly = nullptr;
1544  m_pLastTab = nullptr;
1545  m_pUnderflow = nullptr;
1546  m_cTabDecimal = 0;
1548  m_nForcedLeftMargin = 0;
1552  m_cHookChar = 0;
1553  SetIdx(TextFrameIndex(0));
1555  SetPaintOfst(0);
1556 }
1557 
1558 SwTextFormatInfo::SwTextFormatInfo(OutputDevice* pRenderContext, SwTextFrame *pFrame, const bool bInterHyphL,
1559  const bool bQuickL, const bool bTst)
1560 {
1561  CtorInitTextFormatInfo(pRenderContext, pFrame, bInterHyphL, bQuickL, bTst);
1562 }
1563 
1573  SwLineLayout& rLay, SwTwips nActWidth ) :
1574  SwTextPaintInfo( rInf ),
1575  m_pRoot(&rLay),
1576  m_pLast(&rLay),
1577  m_pFly(nullptr),
1578  m_pUnderflow(nullptr),
1579  m_pRest(nullptr),
1580  m_pLastTab(nullptr),
1581  m_nSoftHyphPos(TextFrameIndex(0)),
1582  m_nLineStart(rInf.GetIdx()),
1583  m_nUnderScorePos(TextFrameIndex(COMPLETE_STRING)),
1584  m_nLeft(rInf.m_nLeft),
1585  m_nRight(rInf.m_nRight),
1586  m_nFirst(rInf.m_nLeft),
1587  m_nRealWidth(sal_uInt16(nActWidth)),
1588  m_nWidth(m_nRealWidth),
1589  m_nLineHeight(0),
1590  m_nLineNetHeight(0),
1591  m_nForcedLeftMargin(0),
1592  m_bFull(false),
1593  m_bFootnoteDone(true),
1594  m_bErgoDone(true),
1595  m_bNumDone(true),
1596  m_bArrowDone(true),
1597  m_bStop(false),
1598  m_bNewLine(true),
1599  m_bShift(false),
1600  m_bUnderflow(false),
1601  m_bInterHyph(false),
1602  m_bAutoHyph(false),
1603  m_bDropInit(false),
1604  m_bQuick(rInf.m_bQuick),
1605  m_bNoEndHyph(false),
1606  m_bNoMidHyph(false),
1607  m_bIgnoreFly(false),
1608  m_bFakeLineStart(false),
1609  m_bTabOverflow( false ),
1610  m_bTestFormat(rInf.m_bTestFormat),
1611  m_cTabDecimal(0),
1612  m_cHookChar(0),
1613  m_nMaxHyph(0)
1614 {
1615  SetMulti( true );
1616  SetFirstMulti( rInf.IsFirstMulti() );
1617 }
1618 
1620 {
1621  const sal_uInt16 nHeight = pCurr->GetRealHeight();
1622  for( SwLinePortion *pPor = pCurr->GetNextPortion(); pPor; pPor = pPor->GetNextPortion() )
1623  {
1624  if( pPor->IsFootnotePortion() && nHeight > static_cast<SwFootnotePortion*>(pPor)->Orig() )
1625  {
1626  SetLineHeight( nHeight );
1627  SetLineNetHeight( pCurr->Height() );
1628  return true;
1629  }
1630  }
1631  return false;
1632 }
1633 
1635  TextFrameIndex const nEnd)
1636 {
1637  m_cHookChar = 0;
1638  TextFrameIndex i = nStart;
1639 
1640  // Used for decimal tab handling:
1641  const sal_Unicode cTabDec = GetLastTab() ? GetTabDecimal() : 0;
1642  const sal_Unicode cThousandSep = ',' == cTabDec ? '.' : ',';
1643 
1644  // #i45951# German (Switzerland) uses ' as thousand separator
1645  const sal_Unicode cThousandSep2 = ',' == cTabDec ? '.' : '\'';
1646 
1647  bool bNumFound = false;
1649 
1650  for( ; i < nEnd; ++i )
1651  {
1652  const sal_Unicode cPos = GetChar( i );
1653  switch( cPos )
1654  {
1655  case CH_TXTATR_BREAKWORD:
1656  case CH_TXTATR_INWORD:
1657  if( !HasHint( i ))
1658  break;
1659  [[fallthrough]];
1660 
1661  case CHAR_SOFTHYPHEN:
1662  case CHAR_HARDHYPHEN:
1663  case CHAR_HARDBLANK:
1664  case CH_TAB:
1665  case CH_BREAK:
1666  case CHAR_ZWSP :
1667  case CHAR_ZWNBSP :
1668  m_cHookChar = cPos;
1669  return i;
1670 
1671  case CHAR_UNDERSCORE:
1673  m_nUnderScorePos = i;
1674  break;
1675 
1676  default:
1677  if ( cTabDec )
1678  {
1679  if( cTabDec == cPos )
1680  {
1681  OSL_ENSURE( cPos, "Unexpected end of string" );
1682  if( cPos ) // robust
1683  {
1684  m_cHookChar = cPos;
1685  return i;
1686  }
1687  }
1688 
1689  // Compatibility: First non-digit character behind a
1690  // a digit character becomes the hook character
1691  if ( bTabCompat )
1692  {
1693  if ( ( 0x2F < cPos && cPos < 0x3A ) ||
1694  ( bNumFound && ( cPos == cThousandSep || cPos == cThousandSep2 ) ) )
1695  {
1696  bNumFound = true;
1697  }
1698  else
1699  {
1700  if ( bNumFound )
1701  {
1702  m_cHookChar = cPos;
1703  SetTabDecimal( cPos );
1704  return i;
1705  }
1706  }
1707  }
1708  }
1709  }
1710  }
1711 
1712  // Check if character *behind* the portion has
1713  // to become the hook:
1714  if (i == nEnd && i < TextFrameIndex(GetText().getLength()) && bNumFound)
1715  {
1716  const sal_Unicode cPos = GetChar( i );
1717  if ( cPos != cTabDec && cPos != cThousandSep && cPos !=cThousandSep2 && ( 0x2F >= cPos || cPos >= 0x3A ) )
1718  {
1719  m_cHookChar = GetChar( i );
1721  }
1722  }
1723 
1724  return i;
1725 }
1726 
1728 {
1729  if( GetLast() )
1730  {
1731  if( GetLast()->IsKernPortion() )
1732  return true;
1733  if( GetLast()->Width() || ( GetLast()->GetLen() &&
1734  !GetLast()->IsHolePortion() ) )
1735  return false;
1736  }
1737  SwLinePortion* pPor = GetRoot();
1738  SwLinePortion *pKern = nullptr;
1739  while( pPor )
1740  {
1741  if( pPor->IsKernPortion() )
1742  pKern = pPor;
1743  else if( pPor->Width() || ( pPor->GetLen() && !pPor->IsHolePortion() ) )
1744  pKern = nullptr;
1745  pPor = pPor->GetNextPortion();
1746  }
1747  if( pKern )
1748  {
1749  SetLast( pKern );
1750  return true;
1751  }
1752  return false;
1753 }
1754 
1756 {
1757  SwTwips nLineWidth = Width() - X();
1758 
1759  const bool bTabOverMargin = GetTextFrame()->GetDoc().getIDocumentSettingAccess().get(
1761  if (!bTabOverMargin)
1762  return nLineWidth;
1763 
1764  SwTabPortion* pLastTab = GetLastTab();
1765  if (!pLastTab)
1766  return nLineWidth;
1767 
1768  // Consider tab portions over the printing bounds of the text frame.
1769  if (pLastTab->GetTabPos() <= Width())
1770  return nLineWidth;
1771 
1772  // Calculate the width that starts at the left (or in case of first line:
1773  // first) margin, but ends after the right paragraph margin:
1774  //
1775  // +--------------------+
1776  // |LL| |RR|
1777  // +--------------------+
1778  // ^ m_nLeftMargin (absolute)
1779  // ^ nLeftMarginWidth (relative to m_nLeftMargin), X() is relative to this
1780  // ^ right margin
1781  // ^ paragraph right
1782  // <--------------------> is GetTextFrame()->getFrameArea().Width()
1783  // <--------------> is Width()
1784  // <-----------------> is what we need to be able to compare to X() (nTextFrameWidth)
1785  SwTwips nLeftMarginWidth = m_nLeftMargin - GetTextFrame()->getFrameArea().Left();
1786  SwTwips nTextFrameWidth = GetTextFrame()->getFrameArea().Width() - nLeftMarginWidth;
1787 
1788  // If there is one such tab portion, then text is allowed to use the full
1789  // text frame area to the right (RR above, but not LL).
1790  nLineWidth = nTextFrameWidth - X();
1791 
1792  return nLineWidth;
1793 }
1794 
1796  const SwTextSizeInfo *pNew,
1797  const SwLinePortion *pPor,
1798  bool bTextLen,
1799  bool bExgLists,
1800  OUString const & rCh )
1801  : pOldText(nullptr)
1802  , m_pOldSmartTagList(nullptr)
1803  , m_pOldGrammarCheckList(nullptr)
1804  , nIdx(0)
1805  , nLen(0)
1806  , pInf(nullptr)
1807 {
1808  if( rCh.isEmpty() )
1809  {
1810  bOn = pPor->GetExpText( *pNew, aText );
1811  }
1812  else
1813  {
1814  aText = rCh;
1815  bOn = true;
1816  }
1817 
1818  // The text is replaced ...
1819  if( !bOn )
1820  return;
1821 
1822  pInf = const_cast<SwTextSizeInfo*>(pNew);
1823  nIdx = pInf->GetIdx();
1824  nLen = pInf->GetLen();
1825  pOldText = &(pInf->GetText());
1827  pInf->SetText( aText );
1828  pInf->SetIdx(TextFrameIndex(0));
1829  pInf->SetLen(bTextLen ? TextFrameIndex(pInf->GetText().getLength()) : pPor->GetLen());
1830  pInf->SetCachedVclData(nullptr);
1831 
1832  // ST2
1833  if ( !bExgLists )
1834  return;
1835 
1836  m_pOldSmartTagList = static_cast<SwTextPaintInfo*>(pInf)->GetSmartTags();
1837  if (m_pOldSmartTagList)
1838  {
1839  std::pair<SwTextNode const*, sal_Int32> pos(pNew->GetTextFrame()->MapViewToModel(nIdx));
1840  SwWrongList const*const pSmartTags(pos.first->GetSmartTags());
1841  if (pSmartTags)
1842  {
1843  const sal_uInt16 nPos = pSmartTags->GetWrongPos(pos.second);
1844  const sal_Int32 nListPos = pSmartTags->Pos(nPos);
1845  if (nListPos == pos.second && pSmartTags->SubList(nPos) != nullptr)
1846  {
1847  m_pTempIter.reset(new sw::WrongListIterator(*pSmartTags->SubList(nPos)));
1848  static_cast<SwTextPaintInfo*>(pInf)->SetSmartTags(m_pTempIter.get());
1849  }
1850  else if (!m_pTempList && nPos < pSmartTags->Count()
1851  && nListPos < pos.second && !aText.isEmpty())
1852  {
1854  m_pTempList->Insert( OUString(), nullptr, 0, aText.getLength(), 0 );
1856  static_cast<SwTextPaintInfo*>(pInf)->SetSmartTags(m_pTempIter.get());
1857  }
1858  else
1859  static_cast<SwTextPaintInfo*>(pInf)->SetSmartTags(nullptr);
1860  }
1861  else
1862  static_cast<SwTextPaintInfo*>(pInf)->SetSmartTags(nullptr);
1863  }
1864  m_pOldGrammarCheckList = static_cast<SwTextPaintInfo*>(pInf)->GetGrammarCheckList();
1866  return;
1867 
1868  std::pair<SwTextNode const*, sal_Int32> pos(pNew->GetTextFrame()->MapViewToModel(nIdx));
1869  SwWrongList const*const pGrammar(pos.first->GetGrammarCheck());
1870  if (pGrammar)
1871  {
1872  const sal_uInt16 nPos = pGrammar->GetWrongPos(pos.second);
1873  const sal_Int32 nListPos = pGrammar->Pos(nPos);
1874  if (nListPos == pos.second && pGrammar->SubList(nPos) != nullptr)
1875  {
1876  m_pTempIter.reset(new sw::WrongListIterator(*pGrammar->SubList(nPos)));
1877  static_cast<SwTextPaintInfo*>(pInf)->SetGrammarCheckList(m_pTempIter.get());
1878  }
1879  else if (!m_pTempList && nPos < pGrammar->Count()
1880  && nListPos < pos.second && !aText.isEmpty())
1881  {
1883  m_pTempList->Insert( OUString(), nullptr, 0, aText.getLength(), 0 );
1885  static_cast<SwTextPaintInfo*>(pInf)->SetGrammarCheckList(m_pTempIter.get());
1886  }
1887  else
1888  static_cast<SwTextPaintInfo*>(pInf)->SetGrammarCheckList(nullptr);
1889  }
1890  else
1891  static_cast<SwTextPaintInfo*>(pInf)->SetGrammarCheckList(nullptr);
1892 }
1893 
1895 {
1896  if( !bOn )
1897  return;
1898 
1900  pInf->SetText( *pOldText );
1901  pInf->SetIdx( nIdx );
1902  pInf->SetLen( nLen );
1903 
1904  // ST2
1905  // Restore old smart tag list
1906  if (m_pOldSmartTagList)
1907  static_cast<SwTextPaintInfo*>(pInf)->SetSmartTags(m_pOldSmartTagList);
1909  static_cast<SwTextPaintInfo*>(pInf)->SetGrammarCheckList(m_pOldGrammarCheckList);
1910 }
1911 
1913  SwAttrIter* pItr)
1914  : pInf(nullptr)
1915  , pFnt(pNew ? const_cast<SwTextSizeInfo&>(rInf).GetFont() : nullptr)
1916  , pIter(nullptr)
1917 {
1918  if( !pFnt )
1919  return;
1920 
1921  pInf = &const_cast<SwTextSizeInfo&>(rInf);
1922  // In these cases we temporarily switch to the new font:
1923  // 1. the fonts have a different magic number
1924  // 2. they have different script types
1925  // 3. their background colors differ (this is not covered by 1.)
1926  if( pFnt->DifferentFontCacheId( pNew, pFnt->GetActual() ) ||
1927  pNew->GetActual() != pFnt->GetActual() ||
1928  ( ! pNew->GetBackColor() && pFnt->GetBackColor() ) ||
1929  ( pNew->GetBackColor() && ! pFnt->GetBackColor() ) ||
1930  ( pNew->GetBackColor() && pFnt->GetBackColor() &&
1931  ( *pNew->GetBackColor() != *pFnt->GetBackColor() ) ) )
1932  {
1933  pNew->SetTransparent( true );
1934  pNew->SetAlign( ALIGN_BASELINE );
1935  pInf->SetFont( pNew );
1936  }
1937  else
1938  pFnt = nullptr;
1939  pNew->Invalidate();
1940  pNew->ChgPhysFnt( pInf->GetVsh(), *pInf->GetOut() );
1941  if( pItr && pItr->GetFnt() == pFnt )
1942  {
1943  pIter = pItr;
1944  pIter->SetFnt( pNew );
1945  }
1946 }
1947 
1949 {
1950  if( pFnt )
1951  {
1952  // Reset SwFont
1953  pFnt->Invalidate();
1954  pInf->SetFont( pFnt );
1955  if( pIter )
1956  {
1957  pIter->SetFnt( pFnt );
1959  }
1960  }
1961 }
1962 
1963 bool SwTextFormatInfo::ChgHyph( const bool bNew )
1964 {
1965  const bool bOld = m_bAutoHyph;
1966  if( m_bAutoHyph != bNew )
1967  {
1968  m_bAutoHyph = bNew;
1969  InitHyph( bNew );
1970  // Set language in the Hyphenator
1971  if( m_pFnt )
1973  }
1974  return bOld;
1975 }
1976 
1977 
1979 {
1980  if (m_nLastBookmarkPos != GetIdx())
1981  {
1983  return true;
1984  }
1985  else
1986  {
1987  return false;
1988  }
1989 }
1990 
1991 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool bOn
Definition: inftxt.hxx:691
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:480
uno::Reference< linguistic2::XHyphenator > GetHyphenator()
Definition: swtypes.cxx:57
void SetLineNetHeight(const sal_uInt16 nNew)
Definition: inftxt.hxx:603
OutDevType GetOutDevType() const
const sal_Unicode CH_BREAK
Definition: swfont.hxx:43
bool LastKernPortion()
Definition: inftxt.cxx:1727
bool IsFirstMulti() const
Definition: inftxt.hxx:212
VclPtr< OutputDevice > m_pRef
Definition: inftxt.hxx:150
Represents the visualization of a paragraph.
Definition: txtfrm.hxx:151
#define LANGUAGE_NONE
~SwLineInfo()
Definition: inftxt.cxx:95
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:900
#define DRAW_SPECIAL_OPTIONS_ROTATE
Definition: inftxt.cxx:84
void Right(const tools::Long nRight)
Definition: swrect.hxx:200
SwViewShell * GetVsh()
Definition: inftxt.hxx:228
#define UPN_HYPH_NO_CAPS
void DrawBackBrush(const SwLinePortion &rPor) const
Definition: inftxt.cxx:1156
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:683
Marks a position in the document model.
Definition: pam.hxx:35
bool IsPagePreview() const
Definition: viewopt.hxx:624
bool GetWholeWord() const
Definition: paratr.hxx:92
const SvxForbiddenRuleItem & GetForbiddenRule(bool=true) const
Definition: paratr.hxx:202
bool IsInDocBody() const
Definition: frame.hxx:921
bool CheckFootnotePortion_(SwLineLayout const *pCurr)
Definition: inftxt.cxx:1619
bool InSpaceGrp() const
Definition: porlin.hxx:109
const css::beans::PropertyValues & GetHyphValues() const
Definition: inftxt.cxx:1406
void setWidth(tools::Long nWidth)
sal_uInt16 Height() const
Definition: possiz.hxx:50
SwFont * GetFont()
Definition: inftxt.hxx:238
const Point & GetRefPoint() const
const SvxTabStopItem & GetTabStops(bool=true) const
Definition: paratr.hxx:190
SwDocShell * GetDocShell()
Definition: doc.hxx:1348
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:1372
sal_Unicode m_cTabDecimal
Definition: inftxt.hxx:515
void SetPos(const Point &rNew)
Definition: inftxt.hxx:436
void Left(const tools::Long nLeft)
Definition: swrect.hxx:195
virtual tools::Long CalcSpacing(tools::Long nSpaceAdd, const SwTextSizeInfo &rInf) const
Definition: porlin.cxx:305
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:623
sal_uInt8 GetLines() const
Definition: paratr.hxx:86
sal_uInt8 GetTransparency() const
long Long
FAMILY_DONTKNOW
bool IsPostIts() const
Definition: viewopt.hxx:272
std::unique_ptr< SvxTabStopItem > pRuler
Definition: inftxt.hxx:70
void SetLast(SwLinePortion *pNewLast)
Definition: inftxt.hxx:568
SwTabPortion * GetLastTab()
Definition: inftxt.hxx:621
Size GetTextSize_(SwDrawTextInfo &rInf)
Definition: swfont.hxx:306
TextFrameIndex ScanPortionEnd(TextFrameIndex nStart, TextFrameIndex nEnd)
Definition: inftxt.cxx:1634
Definition: doc.hxx:184
void DrawBorder(const SwLinePortion &rPor) const
Draw character border around a line portion.
Definition: inftxt.cxx:1303
Size SvLSize() const
Definition: possiz.hxx:54
bool DifferentFontCacheId(const SwFont *pFnt, SwFontScript nWhich)
Definition: swfont.hxx:200
void SetKanaComp(short nNew)
Definition: drawfont.hxx:531
SwParaPortion * GetPara()
Definition: txtcache.cxx:89
SwFont * m_pFnt
Definition: inftxt.hxx:157
SwTextSizeInfo * pInf
Definition: inftxt.hxx:704
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:4455
bool m_bFootnoteDone
Definition: inftxt.hxx:494
void SetScriptSpace(const bool bNew)
Definition: inftxt.hxx:219
#define CHAR_HARDBLANK
Definition: swtypes.hxx:164
const MapMode & GetMapMode() const
std::map< sal_Int32, std::shared_ptr< SetItemPropertyStorage > > PropertyValues
long SwTwips
Definition: swtypes.hxx:49
void SetLayoutMode(ComplexTextLayoutFlags nTextLayoutMode)
const OUString * pOldText
Definition: inftxt.hxx:684
bool IsHangingPortion() const
Definition: porlin.hxx:131
#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:747
tools::Long GetSpaceAdd() const
Definition: inftxt.hxx:447
void NoteAnimation() const
Definition: inftxt.cxx:373
void Pos(const Point &rNew)
Definition: swrect.hxx:169
void SetBorder(sal_uInt16 nBorder)
const Size & GetSize(SwFontScript nWhich) const
Definition: swfont.hxx:204
const SvxLineSpacingItem * pSpace
Definition: inftxt.hxx:71
void DrawPostIts(bool bScript) const
Definition: inftxt.cxx:1049
IDocumentMarkAccess * getIDocumentMarkAccess()
Definition: docbm.cxx:1682
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:35
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:1283
tools::Long nListTabStopPosition
Definition: inftxt.hxx:75
bool HasHint(TextFrameIndex nPos) const
Definition: inftxt.cxx:474
sal_uInt16 m_nKanaIdx
Definition: inftxt.hxx:164
void SetFrame(const SwTextFrame *pNewFrame)
Definition: drawfont.hxx:170
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:217
sal_uInt8 & MaxHyph()
Definition: inftxt.hxx:560
void SetEndIntensity(sal_uInt16 nIntens)
Collection of SwLineLayout instances, represents the paragraph text in Writer layout.
Definition: porlay.hxx:240
Degree10 GetOrientation(const bool bVertLayout=false, const bool bVertFormatLRBT=false) const
Definition: swfont.cxx:433
#define DRAW_SPECIAL_OPTIONS_CENTER
Definition: inftxt.cxx:83
bool IsMulti() const
Definition: inftxt.hxx:210
bool ChgHyph(const bool bNew)
Definition: inftxt.cxx:1963
bool m_bHanging
Definition: inftxt.hxx:178
bool m_bFakeLineStart
Definition: inftxt.hxx:509
void DrawText_(SwDrawTextInfo &rInf)
Definition: swfont.hxx:314
bool IsVertLRBT() const
Definition: frame.hxx:961
#define UPN_HYPH_MIN_TRAILING
void AddTop(const tools::Long nAdd)
Definition: swrect.cxx:165
void SetColor(const Color &rColor)
Definition: swfont.hxx:411
const SvxBrushItem * pBrushItem
Definition: inftxt.hxx:351
size_t CountCompChg() const
Definition: scriptinfo.hxx:162
#define CHAR_SOFTHYPHEN
Definition: swtypes.hxx:166
long GetLen(const Point &rPnt)
#define CHAR_LEFT_ARROW
Definition: inftxt.cxx:76
static OutputDevice * GetDefaultDevice()
SwTwips m_nFirst
Definition: inftxt.hxx:484
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:170
SwTwips m_nRight
Definition: inftxt.hxx:483
void SetSteps(sal_uInt16 nSteps)
sal_uInt16 sal_Unicode
constexpr::Color COL_TRANSPARENT(0xFF, 0xFF, 0xFF, 0xFF)
#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:1120
#define CHAR_LINEBREAK_RTL
Definition: inftxt.cxx:81
#define UPN_IS_GRAMMAR_AUTO
const SwRect & getFrameArea() const
Definition: frame.hxx:177
OUTDEV_WINDOW
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
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:323
void SetOut(OutputDevice &rNew)
Definition: drawfont.hxx:392
TextFrameIndex nLen
Definition: inftxt.hxx:690
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:179
void DrawCheckBox(const SwFieldFormCheckboxPortion &rPor, bool bChecked) const
Definition: inftxt.cxx:1097
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
void Width(tools::Long nNew)
Definition: swrect.hxx:187
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:1432
sal_uInt8 GetDirection() const
Definition: inftxt.hxx:224
sal_uInt16 nDefTabStop
Definition: inftxt.hxx:73
void CtorInitTextSizeInfo(OutputDevice *pRenderContext, SwTextFrame *pFrame, TextFrameIndex nIdx)
Definition: inftxt.cxx:245
void ChgPhysFnt(SwViewShell const *pSh, OutputDevice &rOut)
Definition: swfont.cxx:963
void DrawTextOpaque(SwDrawTextInfo &rInf)
This method is called by DrawText().
Definition: txtfly.cxx:447
void DrawLine(const Point &rStartPt, const Point &rEndPt)
void SetAlign(const FontAlign eAlign)
Definition: swfont.hxx:514
void SetHyphPos(TextFrameIndex *const pNew)
Definition: drawfont.hxx:405
const SvxHangingPunctuationItem & GetHangingPunctuation(bool=true) const
Definition: paratr.hxx:200
const ::std::vector< Color > ImpSvNumberformatScan::StandardColor COL_LIGHTRED
SwFontScript GetActual() const
Definition: swfont.hxx:182
bool IsBlank(bool bHard=false) const
Definition: viewopt.hxx:224
void SetPaintOfst(const SwTwips nNew)
Definition: inftxt.hxx:742
void DrawRect(const tools::Rectangle &rRect)
bool InFixMargGrp() const
Definition: porlin.hxx:108
TextFrameIndex GetOffset() const
Definition: txtfrm.hxx:429
This portion represents a part of the paragraph string.
Definition: portxt.hxx:27
sal_uInt16 m_nRealWidth
Definition: inftxt.hxx:487
SwTwips Y() const
Definition: inftxt.hxx:387
sal_uInt16 m_nWidth
Definition: inftxt.hxx:488
const Color & GetColor() const
SwTextSizeInfo * pInf
Definition: inftxt.hxx:692
bool m_bTestFormat
Definition: inftxt.hxx:513
const SwViewOption & GetOpt() const
Definition: inftxt.hxx:245
void SetStyleName(const OUString &rStyleName, const SwFontScript nWhich)
Definition: swfont.hxx:474
SwTextNode const * GetTextNodeForParaProps() const
Definition: txtfrm.cxx:1293
void SetLineColor()
sal_uInt16 m_nLineNetHeight
Definition: inftxt.hxx:490
bool m_bStopUnderflow
Definition: inftxt.hxx:168
virtual void Height(const sal_uInt16 nNew, const bool bText=true) override
Definition: porlay.cxx:196
SwPosSize GetTextSize() const
Definition: inftxt.cxx:396
UNDERLYING_TYPE get() const
ALIGN_BASELINE
void SetTransparent(const bool bTrans)
Definition: swfont.hxx:640
css::beans::PropertyValues m_aHyphVals
Definition: inftxt.hxx:467
TextFrameIndex m_nIdx
Definition: inftxt.hxx:162
sal_uInt16 nSpaceIdx
Definition: inftxt.hxx:356
tools::Long GetKanaDiff() const
Definition: drawfont.hxx:286
static std::shared_ptr< vcl::TextLayoutCache > CreateTextLayoutCache(OUString const &)
#define SW_MOD()
Definition: swmodule.hxx:255
#define DIR_LEFT2RIGHT
Definition: inftxt.hxx:54
#define CHAR_TAB
Definition: inftxt.cxx:78
virtual bool GetExpText(const SwTextSizeInfo &rInf, OUString &rText) const
Definition: porlin.cxx:310
int i
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:1755
static SwSmartTagMgr & Get()
vcl::RenderContext * GetOut()
Definition: inftxt.hxx:231
void SetFont(SwFont *pNew)
Definition: inftxt.hxx:240
void DrawLineBreak(const SwLinePortion &rPor) const
Definition: inftxt.cxx:994
SwTextFly & GetTextFly()
Definition: inftxt.hxx:390
const sal_Unicode CH_TAB
Definition: swfont.hxx:44
void AddBottom(const tools::Long nAdd)
Definition: swrect.cxx:167
SwParaPortion * GetParaPortion()
Definition: inftxt.hxx:128
bool IsFlyPortion() const
Definition: porlin.hxx:125
Count
const OUString * m_pText
Definition: inftxt.hxx:161
void SetVertical(Degree10 nDir, const bool bVertLayout=false, const bool bVertLayoutLRBT=false)
Definition: swfont.cxx:438
bool InitHyph(const bool bAuto=false)
Definition: inftxt.cxx:1413
std::unique_ptr< SwWrongList > m_pTempList
Definition: inftxt.hxx:687
const Color * GetBackColor() const
Definition: swfont.hxx:190
SwTextSlot(const SwTextSizeInfo *pNew, const SwLinePortion *pPor, bool bTextLen, bool bExgLists, OUString const &rCh=OUString())
Definition: inftxt.cxx:1795
const sal_Unicode CH_BLANK
Definition: swfont.hxx:42
bool IsKernPortion() const
Definition: porlin.hxx:132
void SelectFont()
Definition: inftxt.cxx:364
SwLineInfo()
Definition: inftxt.cxx:86
Align GetValue() const
bool HasArea() const
Definition: swrect.hxx:288
void SetFillColor()
tools::Long Width() const
sw::WrongListIterator * m_pGrammarCheckList
Definition: inftxt.hxx:348
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:534
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:4762
SwLineLayout * GetRoot()
Definition: inftxt.hxx:563
const SwFormatDrop * GetDropFormat() const
Definition: inftxt.cxx:1512
SwUnderlineFont * m_pUnderFnt
Definition: inftxt.hxx:158
#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:39
sal_uInt8 m_nDirection
Definition: inftxt.hxx:182
sal_Unicode m_cHookChar
Definition: inftxt.hxx:516
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:169
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:706
SwTwips m_nLeft
Definition: inftxt.hxx:482
TextFrameIndex GetIdx() const
Definition: inftxt.hxx:278
#define SPECIAL_FONT_HEIGHT
Definition: porrst.hxx:37
const IDocumentSettingAccess * getIDocumentSettingAccess() const
Provides access to the document setting interface.
Definition: node.cxx:2110
bool IsDropPortion() const
Definition: porlin.hxx:121
void DrawRect(const SwRect &rRect, bool bRetouche) const
Definition: inftxt.cxx:965
void SetTabDecimal(const sal_Unicode cNew)
Definition: inftxt.hxx:624
const SvxLineSpacingItem & GetLineSpacing(bool=true) const
Definition: paratr.hxx:178
const AllSettings & GetSettings() const
OUString SwResId(const char *pId)
Definition: swmodule.cxx:165
bool IsOnlineSpell() const
Definition: viewopt.hxx:360
void AddRight(const tools::Long nAdd)
Definition: swrect.cxx:164
DrawModeFlags GetDrawMode() const
sal_uInt8 GetChars() const
Definition: paratr.hxx:89
bool m_bFootnoteInside
Definition: inftxt.hxx:169
static bool IsFieldShadings()
Definition: viewopt.hxx:660
void SetOfsX(sal_uInt16 nOfsX)
const Color & GetColor() const
Definition: swfont.hxx:273
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:480
SwTextFrame * GetTextFrame()
Definition: inftxt.hxx:291
SwLineLayout * m_pRoot
Definition: inftxt.hxx:469
sal_Int32 nLineWidth
std::pair< SwTextNode *, sal_Int32 > MapViewToModel(TextFrameIndex nIndex) const
map position in potentially merged text frame to SwPosition
Definition: txtfrm.cxx:1223
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:1748
bool IsHolePortion() const
Definition: porlin.hxx:126
SwTextFrame * m_pFrame
Definition: inftxt.hxx:159
VclPtr< OutputDevice > m_pOut
Definition: inftxt.hxx:149
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:435
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:77
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:80
Base class for anything that can be part of a line in the Writer layout.
Definition: porlin.hxx:50
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:173
sal_uInt16 m_nLineHeight
Definition: inftxt.hxx:489
const css::lang::Locale & GetLocale(const LanguageType aLang)
Definition: breakit.hxx:67
void Bottom(const tools::Long nBottom)
Definition: swrect.hxx:209
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:80
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:79
LanguageType GetLanguage() const
Definition: swfont.hxx:279
#define CHAR_HARDHYPHEN
Definition: swtypes.hxx:165
void SwitchRTLtoLTR(SwRect &rRect) const
Calculates the coordinates of a rectangle when switching from RTL to LTR layout.
Definition: txtfrm.hxx:726
#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:1480
tools::Rectangle SVRect() const
Definition: swrect.hxx:280
void SetLen(const TextFrameIndex nNew)
Definition: inftxt.hxx:281
OUString aText
Definition: inftxt.hxx:682
void SetFirstMulti(const bool bNew)
Definition: inftxt.hxx:213
SwTextFrame * FindMaster() const
Definition: flowfrm.cxx:681
void SetSize(const Size &rSize, const SwFontScript nWhich)
Definition: swfont.hxx:734
unsigned char sal_uInt8
OUString const & GetDefBulletFontname()
retrieve font family name used for the default bullet list characters
Definition: number.cxx:1310
const o3tl::enumarray< SvxAdjust, unsigned short > aSvxToUnoAdjust USHRT_MAX
Definition: unosett.cxx:254
LanguageType GetDigitLanguage() const
std::unique_ptr< sw::WrongListIterator > m_pTempIter
Definition: inftxt.hxx:688
const SvxParaGridItem & GetParaGrid(bool=true) const
Definition: paratr.hxx:206
const SvxScriptSpaceItem & GetScriptSpace(bool=true) const
Definition: paratr.hxx:198
#define SAL_INFO(area, stream)
static Color & GetFontColor()
Definition: viewopt.cxx:425
IDocumentSettingAccess const & getIDocumentSettingAccess() const
Definition: doc.cxx:176
#define UPN_HYPH_MIN_LEADING
bool OnWin() const
Definition: inftxt.hxx:199
bool IsRightToLeft() const
Definition: frame.hxx:965
void SetFamily(const FontFamily eFamily, const SwFontScript nWhich)
Definition: swfont.hxx:448
void Top(const tools::Long nTop)
Definition: swrect.hxx:204
void SetCharSet(const rtl_TextEncoding eCharSet, const SwFontScript nWhich)
Definition: swfont.hxx:487
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
tools::Long Height() const
sw::WrongListIterator * m_pWrongList
Definition: inftxt.hxx:347
bool IsFootnoteAllowed() const
Definition: ftnfrm.cxx:874
SwTwips m_nLeftMargin
First or left margin, depending on context.
Definition: inftxt.hxx:486
void SetLineStart(TextFrameIndex const nNew)
Definition: inftxt.hxx:597
bool InTextGrp() const
Definition: porlin.hxx:98
SwFontSave(const SwTextSizeInfo &rInf, SwFont *pFnt, SwAttrIter *pItr=nullptr)
Definition: inftxt.cxx:1912
sal_uInt16 Width() const
Definition: possiz.hxx:52
SwParaPortion * m_pPara
Definition: inftxt.hxx:115
sw::WrongListIterator * m_pOldSmartTagList
Definition: inftxt.hxx:685
SwScriptInfo & GetScriptInfo()
Definition: porlay.hxx:281
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:567
const Color & GetHighlightColor() const
Definition: swfont.hxx:192
void Invalidate()
Definition: swfont.hxx:328
SwFont * pFnt
Definition: inftxt.hxx:705
virtual bool get(DocumentSettingId id) const =0
Return the specified document setting.
bool CheckCurrentPosBookmark()
Definition: inftxt.cxx:1978
TextFrameIndex nIdx
Definition: inftxt.hxx:689
bool m_bURLNotify
Definition: inftxt.hxx:167
#define CHAR_ZWNBSP
Definition: swtypes.hxx:170
const SwAttrSet & GetSwAttrSet() const
Does node has already its own auto-attributes? Access to SwAttrSet.
Definition: node.hxx:722
void SetName(const OUString &rName, const SwFontScript nWhich)
Definition: swfont.hxx:461
TextFrameIndex GetTextBreak(SwDrawTextInfo const &rInf, tools::Long nTextWidth)
Definition: fntcache.cxx:2382
void DrawRedArrow(const SwLinePortion &rPor) const
Definition: inftxt.cxx:1017
#define UPH_HYPH_MIN_LEADING
SwLinePortion * m_pLast
Definition: inftxt.hxx:470
sal_uInt16 GetRealHeight() const
Definition: porlay.hxx:162
SwTextInfo()
Definition: inftxt.hxx:119
void setHeight(tools::Long nHeight)
bool m_bTabOverflow
Definition: inftxt.hxx:512
static TextFrameIndex GetMinLen(const SwTextSizeInfo &rInf)
Definition: inftxt.cxx:173
bool IsVertical() const
Definition: frame.hxx:951
#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:2860
void SetLineHeight(const sal_uInt16 nNew)
Definition: inftxt.hxx:601
css::uno::Any GetProperty(const OUString &rPropertyName) const
SwDoc & GetDoc()
Definition: txtfrm.hxx:451
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
void DrawBackground(const SwLinePortion &rPor) const
Definition: inftxt.cxx:1128
SwRect aPaintRect
Definition: inftxt.hxx:354
tuple m
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:354
sal_uInt16 GetKanaComp() const
Definition: inftxt.hxx:331
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:1558
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:491
SwViewShell * GetCurrShell() const
Definition: rootfrm.hxx:205
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 Height(tools::Long nNew)
Definition: swrect.hxx:191
SwPosition MapViewToModelPos(TextFrameIndex nIndex) const
Definition: txtfrm.cxx:1238
#define UPH_HYPH_MIN_TRAILING
#define LINE_BREAK_WIDTH
Definition: porrst.hxx:36
tools::Long GetHeight() const
Definition: swfont.hxx:280
Color aGlobalRetoucheColor
Definition: paintfrm.cxx:244
sal_uInt16 & GetAscent()
Definition: porlin.hxx:77
const sal_Int32 COMPLETE_STRING
Definition: swtypes.hxx:61
SwRootFrame * getRootFrame()
Definition: frame.hxx:659
void DrawViewOpt(const SwLinePortion &rPor, PortionType nWhich) const
Definition: inftxt.cxx:1315
SwNoteURL * pNoteURL
Definition: noteurl.cxx:23
TextFrameIndex m_nSoftHyphPos
SoftHyphPos for Hyphenation.
Definition: inftxt.hxx:477
void SetStartIntensity(sal_uInt16 nIntens)
sal_uInt16 nPos
const Color & GetFillColor() const
SwLinePortion * m_pRest
Definition: inftxt.hxx:473
sal_uInt16 GetAscent() const
Definition: inftxt.hxx:713
sw::WrongListIterator * m_pOldGrammarCheckList
Definition: inftxt.hxx:686
bool IsBlankPortion() const
Definition: porlin.hxx:113
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:7187
SwFlyPortion * m_pFly
Definition: inftxt.hxx:471