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