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