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