LibreOffice Module sw (master) 1
porrst.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 <editeng/lspcitem.hxx>
23#include <editeng/lrspitem.hxx>
24#include <editeng/pgrditem.hxx>
25#include <vcl/svapp.hxx>
27
28#include <viewsh.hxx>
29#include <viewopt.hxx>
30#include <ndtxt.hxx>
31#include <pagefrm.hxx>
32#include <paratr.hxx>
33#include <SwPortionHandler.hxx>
34#include "porrst.hxx"
35#include "inftxt.hxx"
36#include "txtpaint.hxx"
37#include <swfntcch.hxx>
38#include <tgrditem.hxx>
39#include <pagedesc.hxx>
40#include <frmatr.hxx>
41#include "redlnitr.hxx"
42#include "atrhndl.hxx"
43#include <rootfrm.hxx>
44#include <formatlinebreak.hxx>
45#include <txatbase.hxx>
46
50
51#include <crsrsh.hxx>
52
54 const FontLineStyle eUL,
55 const FontStrikeout eStrkout,
56 const Color& rCol ) :
57 m_eUnderline( eUL ), m_eStrikeout( eStrkout ), m_aColor( rCol )
58{
59 Height( rPortion.Height() );
60 SetAscent( rPortion.GetAscent() );
62}
63
64void SwTmpEndPortion::Paint( const SwTextPaintInfo &rInf ) const
65{
66 if (!(rInf.OnWin() && rInf.GetOpt().IsParagraph()))
67 return;
68
69 const SwFont* pOldFnt = rInf.GetFont();
70
71 SwFont aFont(*pOldFnt);
72
73 // Paint strikeout/underline based on redline color and settings
74 // (with an extra pilcrow in the background, because there is
75 // no SetStrikeoutColor(), also SetUnderColor() doesn't work()).
77 {
78 aFont.SetColor( m_aColor );
81
82 const_cast<SwTextPaintInfo&>(rInf).SetFont(&aFont);
83
84 // draw the pilcrow with strikeout/underline in redline color
85 rInf.DrawText(CH_PAR, *this);
86
87 }
88
92 const_cast<SwTextPaintInfo&>(rInf).SetFont(&aFont);
93
94 // draw the pilcrow
95 rInf.DrawText(CH_PAR, *this);
96
97 const_cast<SwTextPaintInfo&>(rInf).SetFont(const_cast<SwFont*>(pOldFnt));
98}
99
101 : SwLinePortion( rPortion )
102{
104 m_eRedline = RedlineType::None;
106
108 if (pAttr && pAttr->Which() == RES_TXTATR_LINEBREAK)
109 {
110 m_eClear = pAttr->GetLineBreak().GetValue();
111 }
112 m_nTextHeight = 0;
113}
114
116{
117 return TextFrameIndex(0);
118}
119
121{ return 0; }
122
124{ return (GetNextPortion() && GetNextPortion()->InTextGrp() ? nullptr : this); }
125
126void SwBreakPortion::Paint( const SwTextPaintInfo &rInf ) const
127{
128 if( !(rInf.OnWin() && rInf.GetOpt().IsLineBreak()) )
129 return;
130
131 // Reduce height to text height for the duration of the print, so the vertical height will look
132 // correct for the line break character, even for clearing breaks.
133 SwTwips nHeight = Height();
134 auto pPortion = const_cast<SwBreakPortion*>(this);
135 pPortion->Height(m_nTextHeight, false);
136 comphelper::ScopeGuard g([pPortion, nHeight] { pPortion->Height(nHeight, false); });
137
138 rInf.DrawLineBreak( *this );
139
140 // paint redlining
141 if (m_eRedline == RedlineType::None)
142 return;
143
144 sal_Int16 nNoBreakWidth = rInf.GetTextSize(S_NOBREAK_FOR_REDLINE).Width();
145 if ( nNoBreakWidth > 0 )
146 {
147 // approximate portion size with multiple no-break spaces
148 // and draw these spaces (at least a single one) by DrawText
149 // painting the requested redline underline/strikeout
150 sal_Int16 nSpaces = (LINE_BREAK_WIDTH + nNoBreakWidth/2) / nNoBreakWidth;
151 OUStringBuffer aBuf(S_NOBREAK_FOR_REDLINE);
152 for (sal_Int16 i = 1; i < nSpaces; ++i)
154
155 const SwFont* pOldFnt = rInf.GetFont();
156
157 SwFont aFont(*pOldFnt);
158
159 if (m_eRedline == RedlineType::Delete)
161 else
163
164 const_cast<SwTextPaintInfo&>(rInf).SetFont(&aFont);
165
166 rInf.DrawText(aBuf.makeStringAndClear(), *this);
167
168 const_cast<SwTextPaintInfo&>(rInf).SetFont(const_cast<SwFont*>(pOldFnt));
169 }
170}
171
173{
174 const SwLinePortion *pRoot = rInf.GetRoot();
175 Width( 0 );
176 Height( pRoot->Height() );
178
179 // See if this is a clearing break. If so, calculate how much we need to "jump down" so the next
180 // line can again use the full text width.
182 {
183 SwTextFly& rTextFly = rInf.GetTextFly();
184 if (rTextFly.IsOn())
185 {
186 SwTwips nHeight = rTextFly.GetMaxBottom(*this, rInf) - rInf.Y();
187 if (nHeight > Height())
188 {
189 Height(nHeight, /*bText=*/false);
190 }
191 }
192 }
193
194 SetAscent( pRoot->GetAscent() );
195 if (rInf.GetIdx() + TextFrameIndex(1) == TextFrameIndex(rInf.GetText().getLength()))
196 rInf.SetNewLine( true );
197 return true;
198}
199
201{
202 rPH.Text( GetLen(), GetWhichPor() );
203}
204
205void SwBreakPortion::dumpAsXml(xmlTextWriterPtr pWriter, const OUString& rText, TextFrameIndex&
206 nOffset) const
207{
208 (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SwBreakPortion"));
209 dumpAsXmlAttributes(pWriter, rText, nOffset);
210 nOffset += GetLen();
211
212 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("text-height"),
213 BAD_CAST(OString::number(m_nTextHeight).getStr()));
214
215 (void)xmlTextWriterEndElement(pWriter);
216}
217
219
221 bool bBG, bool bGK ) :
222 m_nKern( nKrn ), m_bBackground( bBG ), m_bGridKern( bGK )
223{
224 Height( rPortion.Height() );
225 SetAscent( rPortion.GetAscent() );
228 if( m_nKern > 0 )
229 Width( m_nKern );
230 rPortion.Insert( this );
231}
232
234 m_nKern( 0 ), m_bBackground( false ), m_bGridKern( true )
235{
236 Height( rPortion.Height() );
237 SetAscent( rPortion.GetAscent() );
238
241}
242
243void SwKernPortion::Paint( const SwTextPaintInfo &rInf ) const
244{
245 if( !Width() )
246 return;
247
248 // bBackground is set for Kerning Portions between two fields
249 if ( m_bBackground )
250 rInf.DrawViewOpt( *this, PortionType::Field );
251
252 rInf.DrawBackBrush( *this );
254 rInf.DrawBorder( *this );
255
256 // do we have to repaint a post it portion?
257 if( rInf.OnWin() && mpNextPortion && !mpNextPortion->Width() )
258 mpNextPortion->PrePaint( rInf, this );
259
260 if( rInf.GetFont()->IsPaintBlank() )
261 {
262 SwRect aClipRect;
263 rInf.CalcRect( *this, &aClipRect );
264 SwSaveClip aClip( const_cast<OutputDevice*>(rInf.GetOut()) );
265 aClip.ChgClip( aClipRect );
266 rInf.DrawText(" ", *this, TextFrameIndex(0), TextFrameIndex(2), true );
267 }
268}
269
271{
272 if ( m_bGridKern )
273 return;
274
275 if( rInf.GetLast() == this )
276 rInf.SetLast( FindPrevPortion( rInf.GetRoot() ) );
277 if( m_nKern < 0 )
278 Width( -m_nKern );
279 else
280 Width( 0 );
281 rInf.GetLast()->FormatEOL( rInf );
282}
283
285 m_bLeft( true )
286{
287 Height( rPortion.Height() );
288 SetAscent( rPortion.GetAscent() );
291}
292
294 : m_bLeft( false )
295{
296 Height( o3tl::narrowing<sal_uInt16>(rInf.GetTextFrame()->getFramePrintArea().Height()) );
297 m_aPos.setX( rInf.GetTextFrame()->getFrameArea().Left() +
299 m_aPos.setY( rInf.GetTextFrame()->getFrameArea().Top() +
302}
303
304void SwArrowPortion::Paint( const SwTextPaintInfo &rInf ) const
305{
306 const_cast<SwArrowPortion*>(this)->m_aPos = rInf.GetPos();
307}
308
310
312{
313 if (IsCollapse()) {
315 if ( auto pCrSh = dynamic_cast<SwCursorShell*>( pSh ) ) {
316 // this is called during formatting so avoid recursive layout
317 SwContentFrame const*const pCurrFrame = pCrSh->GetCurrFrame(false);
318 if (pCurrFrame==static_cast<SwContentFrame const *>(this)) {
319 // do nothing
320 } else {
321 return 1;
322 }
323 } else {
324 return 1;
325 }
326 }
327 OSL_ENSURE( ! IsVertical() || ! IsSwapped(),"SwTextFrame::EmptyHeight with swapped frame" );
328
329 std::unique_ptr<SwFont> pFnt;
330 const SwTextNode& rTextNode = *GetTextNodeForParaProps();
331 const IDocumentSettingAccess* pIDSA = rTextNode.getIDocumentSettingAccess();
333 if ( rTextNode.HasSwAttrSet() )
334 {
335 const SwAttrSet *pAttrSet = &( rTextNode.GetSwAttrSet() );
336 pFnt.reset(new SwFont( pAttrSet, pIDSA ));
337 }
338 else
339 {
340 SwFontAccess aFontAccess( &rTextNode.GetAnyFormatColl(), pSh);
341 pFnt.reset(new SwFont( aFontAccess.Get()->GetFont() ));
342 pFnt->CheckFontCacheId( pSh, pFnt->GetActual() );
343 }
344
345 if ( IsVertical() )
346 pFnt->SetVertical( 2700_deg10 );
347
348 OutputDevice* pOut = pSh ? pSh->GetOut() : nullptr;
349 if ( !pOut || !pSh->GetViewOptions()->getBrowseMode() ||
350 pSh->GetViewOptions()->IsPrtFormat() )
351 {
353 }
354
355 const IDocumentRedlineAccess& rIDRA = rTextNode.getIDocumentRedlineAccess();
357 && !getRootFrame()->IsHideRedlines())
358 {
359 const SwRedlineTable::size_type nRedlPos = rIDRA.GetRedlinePos( rTextNode, RedlineType::Any );
360 if( SwRedlineTable::npos != nRedlPos )
361 {
362 SwAttrHandler aAttrHandler;
363 aAttrHandler.Init(rTextNode.GetSwAttrSet(),
364 *rTextNode.getIDocumentSettingAccess());
365 SwRedlineItr aRedln( rTextNode, *pFnt, aAttrHandler,
366 nRedlPos, SwRedlineItr::Mode::Show);
367 }
368 }
369
370 SwTwips nRet;
371 if( !pOut )
372 nRet = IsVertical() ?
373 getFramePrintArea().SSize().Width() + 1 :
374 getFramePrintArea().SSize().Height() + 1;
375 else
376 {
377 pFnt->SetFntChg( true );
378 pFnt->ChgPhysFnt( pSh, *pOut );
379 nRet = pFnt->GetHeight( pSh, *pOut );
380 }
381 return nRet;
382}
383
385{
386 OSL_ENSURE( ! IsVertical() || ! IsSwapped(),"SwTextFrame::FormatEmpty with swapped frame" );
387
388 bool bCollapse = EmptyHeight( ) == 1 && IsCollapse( );
389
390 // sw_redlinehide: just disable FormatEmpty optimisation for now
391 if (HasFollow() || GetMergedPara() || GetTextNodeFirst()->GetpSwpHints() ||
392 nullptr != GetTextNodeForParaProps()->GetNumRule() ||
393 GetTextNodeFirst()->HasHiddenCharAttribute(true) ||
394 IsInFootnote() || ( HasPara() && GetPara()->IsPrepMustFit() ) )
395 return false;
397 const SvxAdjust nAdjust = aSet.GetAdjust().GetAdjust();
398 if( !bCollapse && ( ( ( ! IsRightToLeft() && ( SvxAdjust::Left != nAdjust ) ) ||
399 ( IsRightToLeft() && ( SvxAdjust::Right != nAdjust ) ) ) ||
400 aSet.GetRegister().GetValue() ) )
401 return false;
402 const SvxLineSpacingItem &rSpacing = aSet.GetLineSpacing();
403 if( !bCollapse && ( SvxLineSpaceRule::Min == rSpacing.GetLineSpaceRule() ||
404 SvxLineSpaceRule::Fix == rSpacing.GetLineSpaceRule() ||
405 aSet.GetLRSpace().IsAutoFirst() ) )
406 return false;
407
408 SwTextFly aTextFly( this );
409 SwRect aRect;
410 bool bFirstFlyCheck = 0 != getFramePrintArea().Height();
411 if ( !bCollapse && bFirstFlyCheck &&
412 aTextFly.IsOn() && aTextFly.IsAnyObj( aRect ) )
413 return false;
414
415 // only need to check one node because of early return on GetMerged()
416 for (SwIndex const* pIndex = GetTextNodeFirst()->GetFirstIndex();
417 pIndex; pIndex = pIndex->GetNext())
418 {
419 sw::mark::IMark const*const pMark = pIndex->GetMark();
420 if (dynamic_cast<const sw::mark::IBookmark*>(pMark) != nullptr)
421 { // need bookmark portions!
422 return false;
423 }
424 }
425
426 SwTwips nHeight = EmptyHeight();
427
428 if (aSet.GetParaGrid().GetValue() &&
429 IsInDocBody() )
430 {
431 SwTextGridItem const*const pGrid(GetGridItem(FindPageFrame()));
432 if ( pGrid )
433 nHeight = pGrid->GetBaseHeight() + pGrid->GetRubyHeight();
434 }
435
436 SwRectFnSet aRectFnSet(this);
437 const SwTwips nChg = nHeight - aRectFnSet.GetHeight(getFramePrintArea());
438
439 if( !nChg )
440 SetUndersized( false );
441 AdjustFrame( nChg );
442
444 {
445 ClearPara();
447 }
448
450 if( !IsEmpty() )
451 {
452 SetEmpty( true );
454 }
455 if( !bCollapse && !bFirstFlyCheck &&
456 aTextFly.IsOn() && aTextFly.IsAnyObj( aRect ) )
457 return false;
458
459 // #i35635# - call method <HideAndShowObjects()>
460 // to assure that objects anchored at the empty paragraph are
461 // correctly visible resp. invisible.
463 return true;
464}
465
466bool SwTextFrame::FillRegister( SwTwips& rRegStart, sal_uInt16& rRegDiff )
467{
468 const SwFrame *pFrame = this;
469 rRegDiff = 0;
470 while( !( ( SwFrameType::Body | SwFrameType::Fly )
471 & pFrame->GetType() ) && pFrame->GetUpper() )
472 pFrame = pFrame->GetUpper();
473 if( ( SwFrameType::Body| SwFrameType::Fly ) & pFrame->GetType() )
474 {
475 SwRectFnSet aRectFnSet(pFrame);
476 rRegStart = aRectFnSet.GetPrtTop(*pFrame);
477 pFrame = pFrame->FindPageFrame();
478 if( pFrame->IsPageFrame() )
479 {
480 SwPageDesc* pDesc = const_cast<SwPageFrame*>(static_cast<const SwPageFrame*>(pFrame))->FindPageDesc();
481 if( pDesc )
482 {
483 rRegDiff = pDesc->GetRegHeight();
484 if( !rRegDiff )
485 {
486 const SwTextFormatColl *pFormat = pDesc->GetRegisterFormatColl();
487 if( pFormat )
488 {
489 const SvxLineSpacingItem &rSpace = pFormat->GetLineSpacing();
490 if( SvxLineSpaceRule::Fix == rSpace.GetLineSpaceRule() )
491 {
492 rRegDiff = rSpace.GetLineHeight();
493 pDesc->SetRegHeight( rRegDiff );
494 pDesc->SetRegAscent( ( 4 * rRegDiff ) / 5 );
495 }
496 else
497 {
499 SwFontAccess aFontAccess( pFormat, pSh );
500 SwFont aFnt( aFontAccess.Get()->GetFont() );
501
502 OutputDevice *pOut = nullptr;
503 if( !pSh || !pSh->GetViewOptions()->getBrowseMode() ||
504 pSh->GetViewOptions()->IsPrtFormat() )
506
507 if( pSh && !pOut )
508 pOut = pSh->GetWin()->GetOutDev();
509
510 if( !pOut )
512
513 MapMode aOldMap( pOut->GetMapMode() );
514 pOut->SetMapMode( MapMode( MapUnit::MapTwip ) );
515
516 aFnt.ChgFnt( pSh, *pOut );
517 rRegDiff = aFnt.GetHeight( pSh, *pOut );
518 sal_uInt16 nNetHeight = rRegDiff;
519
520 switch( rSpace.GetLineSpaceRule() )
521 {
522 case SvxLineSpaceRule::Auto:
523 break;
524 case SvxLineSpaceRule::Min:
525 {
526 if( rRegDiff < rSpace.GetLineHeight() )
527 rRegDiff = rSpace.GetLineHeight();
528 break;
529 }
530 default:
531 OSL_FAIL( ": unknown LineSpaceRule" );
532 }
533 switch( rSpace.GetInterLineSpaceRule() )
534 {
535 case SvxInterLineSpaceRule::Off:
536 break;
537 case SvxInterLineSpaceRule::Prop:
538 {
539 tools::Long nTmp = rSpace.GetPropLineSpace();
540 if( nTmp < 50 )
541 nTmp = nTmp ? 50 : 100;
542 nTmp *= rRegDiff;
543 nTmp /= 100;
544 if( !nTmp )
545 ++nTmp;
546 rRegDiff = o3tl::narrowing<sal_uInt16>(nTmp);
547 nNetHeight = rRegDiff;
548 break;
549 }
550 case SvxInterLineSpaceRule::Fix:
551 {
552 rRegDiff = rRegDiff + rSpace.GetInterLineSpace();
553 nNetHeight = rRegDiff;
554 break;
555 }
556 default: OSL_FAIL( ": unknown InterLineSpaceRule" );
557 }
558 pDesc->SetRegHeight( rRegDiff );
559 pDesc->SetRegAscent( rRegDiff - nNetHeight +
560 aFnt.GetAscent( pSh, *pOut ) );
561 pOut->SetMapMode( aOldMap );
562 }
563 }
564 }
565 const tools::Long nTmpDiff = pDesc->GetRegAscent() - rRegDiff;
566 if ( aRectFnSet.IsVert() )
567 rRegStart -= nTmpDiff;
568 else
569 rRegStart += nTmpDiff;
570 }
571 }
572 }
573 return ( 0 != rRegDiff );
574}
575
577{
578#ifdef DBG_UTIL
579 OutputDevice* pOut = const_cast<OutputDevice*>(rInf.GetOut());
581 Color aOldColor( pOut->GetFillColor() );
582 pOut->SetFillColor( aCol );
583 Point aPos( rInf.GetPos() );
584 aPos.AdjustY( -150 );
585 aPos.AdjustX( -25 );
586 SwRect aRect( aPos, Size( 100, 200 ) );
587 pOut->DrawRect( aRect.SVRect() );
588 pOut->SetFillColor( aOldColor );
589#else
590 (void)rInf;
591#endif
592}
593
595{
596 Width( 0 );
597 rInf.GetTextFrame()->HideFootnotes( rInf.GetIdx(), rInf.GetIdx() + GetLen() );
598
599 return false;
600};
601
603 OUString & rOutString, SwFont & rTmpFont, int &) const
604{
606 {
607 return false;
608 }
609
610 switch (mcChar)
611 {
612 case CHAR_ZWSP:
613 rOutString = "/"; break;
614// case CHAR_LRM :
615// rText = sal_Unicode(0x2514); break;
616// case CHAR_RLM :
617// rText = sal_Unicode(0x2518); break;
618 default:
619 assert(false);
620 break;
621 }
622
623 rTmpFont.SetEscapement( CHAR_ZWSP == mcChar ? DFLT_ESC_AUTO_SUB : -25 );
624 const sal_uInt16 nProp = 40;
625 rTmpFont.SetProportion( nProp ); // a smaller font
626
627 return true;
628}
629
631 OUString & rOutString, SwFont & rFont, int & rDeltaY) const
632{
633 if (!rTextPaintInfo.GetOpt().IsShowBookmarks())
634 {
635 return false;
636 }
637
638 rOutString = OUStringChar(mcChar);
639
640 // init font: we want OpenSymbol to ensure it doesn't look too crazy;
641 // thin and a bit higher than the surrounding text
642 auto const nOrigAscent(rFont.GetAscent(rTextPaintInfo.GetVsh(), *rTextPaintInfo.GetOut()));
643 rFont.SetName("OpenSymbol", rFont.GetActual());
644 Size aSize(rFont.GetSize(rFont.GetActual()));
645 // use also the external leading (line gap) of the portion, but don't use
646 // 100% of it because i can't figure out how to baseline align that
647 assert(aSize.Height() != 0);
648 auto const nFactor = aSize.Height() > 0 ? (Height() * 95) / aSize.Height() : Height();
649 rFont.SetProportion(nFactor);
650 rFont.SetWeight(WEIGHT_THIN, rFont.GetActual());
652 // reset these to default...
657 rFont.SetOutline(false);
658 rFont.SetShadow(false);
659 rFont.SetTransparent(false);
660 rFont.SetEmphasisMark(FontEmphasisMark::NONE);
661 rFont.SetEscapement(0);
662 rFont.SetPitch(PITCH_DONTKNOW, rFont.GetActual());
663 rFont.SetRelief(FontRelief::NONE);
664
665 // adjust Y position to account for different baselines of the fonts
666 auto const nOSAscent(rFont.GetAscent(rTextPaintInfo.GetVsh(), *rTextPaintInfo.GetOut()));
667 rDeltaY = nOSAscent - nOrigAscent;
668
669 return true;
670}
671
673{
674 if ( !Width() ) // is only set during prepaint mode
675 return;
676
677 rInf.DrawViewOpt(*this, GetWhichPor());
678
679 int deltaY(0);
680 SwFont aTmpFont( *rInf.GetFont() );
681 OUString aOutString;
682
683 if (!(rInf.OnWin()
684 && !rInf.GetOpt().IsPagePreview()
685 && !rInf.GetOpt().IsReadonly()
686 && DoPaint(rInf, aOutString, aTmpFont, deltaY)))
687 return;
688
689 SwFontSave aFontSave( rInf, &aTmpFont );
690
691 if ( !mnHalfCharWidth )
692 mnHalfCharWidth = rInf.GetTextSize( aOutString ).Width() / 2;
693
694 Point aOldPos = rInf.GetPos();
695 Point aNewPos( aOldPos );
696 auto const deltaX((Width() / 2) - mnHalfCharWidth);
697 switch (rInf.GetFont()->GetOrientation(rInf.GetTextFrame()->IsVertical()).get())
698 {
699 case 0:
700 aNewPos.AdjustX(deltaX);
701 aNewPos.AdjustY(deltaY);
702 break;
703 case 900:
704 aNewPos.AdjustY(-deltaX);
705 aNewPos.AdjustX(deltaY);
706 break;
707 case 2700:
708 aNewPos.AdjustY(deltaX);
709 aNewPos.AdjustX(-deltaY);
710 break;
711 default:
712 assert(false);
713 break;
714 }
715 const_cast< SwTextPaintInfo& >( rInf ).SetPos( aNewPos );
716
717 rInf.DrawText( aOutString, *this );
718
719 const_cast< SwTextPaintInfo& >( rInf ).SetPos( aOldPos );
720}
721
723{
724 const SwLinePortion* pRoot = rInf.GetRoot();
725 Width( 0 );
726 Height( pRoot->Height() );
727 SetAscent( pRoot->GetAscent() );
728
729 return false;
730}
731
733{
734 if( !mnViewWidth )
735 mnViewWidth = rInf.GetTextSize(OUString(' ')).Width();
736
737 return mnViewWidth;
738}
739
740/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
struct _xmlTextWriter * xmlTextWriterPtr
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...
static OutputDevice * GetDefaultDevice()
virtual OutputDevice * getReferenceDevice(bool bCreate) const =0
Returns the current reference device.
static bool IsShowChanges(const RedlineFlags eM)
virtual SwRedlineTable::size_type GetRedlinePos(const SwNode &rNode, RedlineType nType) const =0
virtual RedlineFlags GetRedlineFlags() const =0
Query the currently set redline mode.
Provides access to settings of a document.
bool GetValue() const
EnumT GetValue() const
constexpr tools::Long Height() const
SvxAdjust GetAdjust() const
bool IsAutoFirst() const
sal_uInt16 GetPropLineSpace() const
SvxInterLineSpaceRule GetInterLineSpaceRule() const
SvxLineSpaceRule GetLineSpaceRule() const
sal_uInt16 GetLineHeight() const
short GetInterLineSpace() const
Indicator that the content does not fit into a fixed height frame (red triangle on the UI).
Definition: porrst.hxx:115
SwArrowPortion(const SwLinePortion &rPortion)
Definition: porrst.cxx:284
virtual SwLinePortion * Compress() override
Definition: porrst.cxx:309
Point m_aPos
Definition: porrst.hxx:116
virtual void Paint(const SwTextPaintInfo &rInf) const override
Definition: porrst.cxx:304
Used by Attribute Iterators to organize attributes on stacks to find the valid attribute in each cate...
Definition: atrhndl.hxx:38
void Init(const SwAttrSet &rAttrSet, const IDocumentSettingAccess &rIDocumentSettingAccess)
Definition: atrstck.cxx:277
const SvxAdjustItem & GetAdjust(bool=true) const
Definition: paratr.hxx:194
const SvxLRSpaceItem & GetLRSpace(bool=true) const
Definition: frmatr.hxx:44
const SvxParaGridItem & GetParaGrid(bool=true) const
Definition: paratr.hxx:220
const SvxLineSpacingItem & GetLineSpacing(bool=true) const
Definition: paratr.hxx:192
const SwRegisterItem & GetRegister(bool=true) const
Definition: paratr.hxx:198
virtual bool DoPaint(SwTextPaintInfo const &rInf, OUString &rOutString, SwFont &rTmpFont, int &rDeltaY) const override
Definition: porrst.cxx:630
RedlineType m_eRedline
Definition: porrst.hxx:60
virtual void Paint(const SwTextPaintInfo &rInf) const override
Definition: porrst.cxx:126
static constexpr OUStringLiteral S_NOBREAK_FOR_REDLINE
Definition: porrst.hxx:83
virtual SwLinePortion * Compress() override
Definition: porrst.cxx:123
SwBreakPortion(const SwLinePortion &rPortion, const SwTextAttr *pAttr)
Definition: porrst.cxx:100
virtual bool Format(SwTextFormatInfo &rInf) override
Definition: porrst.cxx:172
SwLineBreakClear m_eClear
Tracks the type of the breaking clear from SwTextLineBreak, if there is one.
Definition: porrst.hxx:63
SwTwips m_nTextHeight
Height of the line-break character itself, without spacing added for clearing.
Definition: porrst.hxx:66
void dumpAsXml(xmlTextWriterPtr pWriter, const OUString &rText, TextFrameIndex &nOffset) const override
Definition: porrst.cxx:205
SwLineBreakClear GetClear() const
Definition: porrst.cxx:218
virtual sal_uInt16 GetViewWidth(const SwTextSizeInfo &rInf) const override
Definition: porrst.cxx:120
virtual TextFrameIndex GetModelPositionForViewPoint(sal_uInt16 nOfst) const override
the parameter is actually SwTwips apparently?
Definition: porrst.cxx:115
virtual void HandlePortion(SwPortionHandler &rPH) const override
Definition: porrst.cxx:200
SwContentFrame is the layout for content nodes: a common base class for text (paragraph) and non-text...
Definition: cntfrm.hxx:58
bool HasSwAttrSet() const
Definition: node.hxx:458
const SwAttrSet & GetSwAttrSet() const
Does node has already its own auto-attributes? Access to SwAttrSet.
Definition: node.hxx:726
SwFormatColl & GetAnyFormatColl() const
Definition: node.hxx:719
sal_uInt16 mnHalfCharWidth
Definition: porrst.hxx:163
sal_uInt16 mnViewWidth
Definition: porrst.hxx:162
virtual void Paint(const SwTextPaintInfo &rInf) const override
Definition: porrst.cxx:672
sal_Unicode mcChar
Definition: porrst.hxx:165
virtual bool Format(SwTextFormatInfo &rInf) override
Definition: porrst.cxx:722
virtual bool DoPaint(SwTextPaintInfo const &rInf, OUString &rOutString, SwFont &rTmpFont, int &rDeltaY) const
Definition: porrst.cxx:602
virtual sal_uInt16 GetViewWidth(const SwTextSizeInfo &rInf) const override
Definition: porrst.cxx:732
IDocumentDeviceAccess const & getIDocumentDeviceAccess() const
Definition: doc.cxx:238
void SetUndersized(const bool bNew)
Definition: flowfrm.hxx:157
bool HasFollow() const
Definition: flowfrm.hxx:165
SwFontObj * Get()
Definition: swfntcch.cxx:56
SwFont & GetFont()
Definition: swfntcch.hxx:58
void SetOverline(const FontLineStyle eOverline)
Definition: swfont.hxx:564
void ChgFnt(SwViewShell const *pSh, OutputDevice &rOut)
Definition: swfont.hxx:177
void SetStrikeout(const FontStrikeout eStrikeout)
Definition: swfont.hxx:579
void SetEscapement(const short nNewEsc)
Definition: swfont.hxx:788
const Size & GetSize(SwFontScript nWhich) const
Definition: swfont.hxx:206
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 SetEmphasisMark(const FontEmphasisMark eValue)
Definition: swfont.hxx:689
void SetName(const OUString &rName, const SwFontScript nWhich)
Definition: swfont.hxx:468
void SetProportion(const sal_uInt8 nNewPropr)
Definition: swfont.hxx:769
void SetOutline(const bool bOutline)
Definition: swfont.hxx:607
void SetPitch(const FontPitch ePitch, const SwFontScript nWhich)
Definition: swfont.hxx:508
SwFontScript GetActual() const
Definition: swfont.hxx:184
void SetShadow(const bool bShadow)
Definition: swfont.hxx:622
void SetColor(const Color &rColor)
Definition: swfont.hxx:418
bool IsPaintBlank() const
Definition: swfont.hxx:261
void SetTransparent(const bool bTrans)
Definition: swfont.hxx:647
void SetUnderline(const FontLineStyle eUnderline)
Definition: swfont.hxx:549
sal_uInt16 GetAscent(SwViewShell const *pSh, const OutputDevice &rOut)
Definition: swfont.hxx:327
void SetWeight(const FontWeight eWeight, const SwFontScript nWhich)
Definition: swfont.hxx:536
void SetRelief(const FontRelief eNew)
Definition: swfont.hxx:715
tools::Long GetHeight() const
Definition: swfont.hxx:284
const SvxLineSpacingItem & GetLineSpacing(bool=true) const
Paragraph-attributes - implemented in paratr.hxx.
Definition: paratr.hxx:226
const SwRect & getFrameArea() const
Definition: frame.hxx:179
const SwRect & getFramePrintArea() const
Definition: frame.hxx:180
Base class of the Writer layout elements.
Definition: frame.hxx:315
bool IsCollapse() const
Definition: calcmove.cxx:1051
bool IsInDocBody() const
Definition: frame.hxx:943
bool IsPageFrame() const
Definition: frame.hxx:1178
SwFrameType GetType() const
Definition: frame.hxx:519
bool IsInFootnote() const
Definition: frame.hxx:949
bool IsRightToLeft() const
Definition: frame.hxx:987
SwLayoutFrame * GetUpper()
Definition: frame.hxx:678
bool IsVertical() const
Definition: frame.hxx:973
SwRootFrame * getRootFrame()
Definition: frame.hxx:679
void SetCompletePaint() const
Definition: frame.hxx:994
SwPageFrame * FindPageFrame()
Definition: frame.hxx:680
virtual void Paint(const SwTextPaintInfo &rInf) const override
Definition: porrst.cxx:576
virtual bool Format(SwTextFormatInfo &rInf) override
Definition: porrst.cxx:594
Marks a character position inside a document model node.
Definition: index.hxx:34
virtual void Paint(const SwTextPaintInfo &rInf) const override
Definition: porrst.cxx:243
bool m_bGridKern
Definition: porrst.hxx:93
SwKernPortion(SwLinePortion &rPortion, short nKrn, bool bBG=false, bool bGridKern=false)
Definition: porrst.cxx:220
short m_nKern
Definition: porrst.hxx:91
bool m_bBackground
Definition: porrst.hxx:92
virtual void FormatEOL(SwTextFormatInfo &rInf) override
Definition: porrst.cxx:270
Base class for anything that can be part of a line in the Writer layout.
Definition: porlin.hxx:52
TextFrameIndex mnLineLength
Definition: porlin.hxx:57
void dumpAsXmlAttributes(xmlTextWriterPtr writer, std::u16string_view rText, TextFrameIndex nOffset) const
Definition: porlin.cxx:330
virtual void FormatEOL(SwTextFormatInfo &rInf)
Definition: porlin.cxx:266
SwLinePortion * mpNextPortion
Definition: porlin.hxx:55
bool InTextGrp() const
Definition: porlin.hxx:105
SwLinePortion * GetNextPortion() const
Definition: porlin.hxx:75
void SetAscent(const SwTwips nNewAsc)
Definition: porlin.hxx:82
bool GetJoinBorderWithPrev() const
Definition: porlin.hxx:177
PortionType GetWhichPor() const
Definition: porlin.hxx:102
TextFrameIndex GetLen() const
Definition: porlin.hxx:77
bool GetJoinBorderWithNext() const
Definition: porlin.hxx:178
SwTwips & GetAscent()
Definition: porlin.hxx:80
SwLinePortion * FindPrevPortion(const SwLinePortion *pRoot)
Definition: porlin.cxx:210
void SetWhichPor(const PortionType nNew)
Definition: porlin.hxx:101
void PrePaint(const SwTextPaintInfo &rInf, const SwLinePortion *pLast) const
Definition: porlin.cxx:77
virtual SwLinePortion * Insert(SwLinePortion *pPortion)
Definition: porlin.cxx:169
const IDocumentRedlineAccess & getIDocumentRedlineAccess() const
Provides access to the document redline interface.
Definition: node.cxx:2096
const IDocumentDeviceAccess & getIDocumentDeviceAccess() const
Provides access to the document device interface.
Definition: node.cxx:2095
const IDocumentSettingAccess * getIDocumentSettingAccess() const
Provides access to the document setting interface.
Definition: node.cxx:2094
sal_uInt16 GetRegHeight() const
Definition: pagedesc.hxx:258
void SetRegAscent(sal_uInt16 const nNew)
Definition: pagedesc.hxx:261
void SetRegHeight(sal_uInt16 const nNew)
Definition: pagedesc.hxx:260
sal_uInt16 GetRegAscent() const
Definition: pagedesc.hxx:259
const SwTextFormatColl * GetRegisterFormatColl() const
retrieve the style for the grid alignment
Definition: pagedesc.cxx:223
A page of the document layout.
Definition: pagefrm.hxx:58
SwPageDesc * FindPageDesc()
Definition: pagechg.cxx:755
The SwPortionHandler interface implements a visitor for the layout engine's text portions.
virtual void Text(TextFrameIndex nLength, PortionType nType, sal_Int32 nHeight=0, sal_Int32 nWidth=0)=0
(empty) destructor
SwTwips Width() const
Definition: possiz.hxx:51
SwTwips Height() const
Definition: possiz.hxx:49
bool IsVert() const
Definition: frame.hxx:1366
tools::Long GetHeight(const SwRect &rRect) const
Definition: frame.hxx:1381
tools::Long GetPrtTop(const SwFrame &rFrame) const
Definition: frame.hxx:1408
Of course Writer needs its own rectangles.
Definition: swrect.hxx:35
void Height(tools::Long nNew)
Definition: swrect.hxx:193
void Top(const tools::Long nTop)
Definition: swrect.hxx:206
void Right(const tools::Long nRight)
Definition: swrect.hxx:202
void Bottom(const tools::Long nBottom)
Definition: swrect.hxx:211
void SSize(const Size &rNew)
Definition: swrect.hxx:180
tools::Rectangle SVRect() const
Definition: swrect.hxx:292
void Left(const tools::Long nLeft)
Definition: swrect.hxx:197
static constexpr size_type npos
Definition: docary.hxx:223
vector_type::size_type size_type
Definition: docary.hxx:222
SwViewShell * GetCurrShell() const
Definition: rootfrm.hxx:206
void ChgClip(const SwRect &rRect, const SwTextFrame *pFrame=nullptr, bool bEnlargeRect=false, sal_Int32 nEnlargeTop=0, sal_Int32 nEnlargeBottom=0)
Definition: txtpaint.hxx:47
A wrapper around SfxPoolItem to store the start position of (usually) a text portion,...
Definition: txatbase.hxx:44
const SwFormatLineBreak & GetLineBreak() const
Definition: txatbase.hxx:214
sal_uInt16 Which() const
Definition: txatbase.hxx:116
The purpose of this class is to be the universal interface between formatting/text output and the pos...
Definition: txtfly.hxx:122
bool IsAnyObj(const SwRect &rRect) const
true when a frame or DrawObj must be taken in account.
Definition: txtfly.cxx:408
SwTwips GetMaxBottom(const SwBreakPortion &rPortion, const SwTextFormatInfo &rInfo) const
Gets the maximum of the fly frame bottoms.
Definition: txtfly.cxx:999
bool IsOn() const
Definition: txtfly.hxx:319
Represents the style of a paragraph.
Definition: fmtcol.hxx:59
SwLinePortion * GetLast()
Definition: inftxt.hxx:561
SwLineLayout * GetRoot()
Definition: inftxt.hxx:557
void SetLast(SwLinePortion *pNewLast)
Definition: inftxt.hxx:562
void SetNewLine(const bool bNew)
Definition: inftxt.hxx:579
SwDoc & GetDoc()
Definition: txtfrm.hxx:464
void HideAndShowObjects()
Hides respectively shows objects, which are anchored at paragraph, at/as a character of the paragraph...
Definition: txtfrm.cxx:1552
bool HasPara() const
Definition: txtfrm.hxx:823
bool FillRegister(SwTwips &rRegStart, sal_uInt16 &rRegDiff)
Determines the start position and step size of the register.
Definition: porrst.cxx:466
bool IsSwapped() const
Definition: txtfrm.hxx:539
void ClearPara()
Removes the Line information from the Cache but retains the entry itself.
Definition: txtcache.cxx:104
sw::MergedPara * GetMergedPara()
Definition: txtfrm.hxx:454
void AdjustFrame(const SwTwips nChgHeight, bool bHasToFit=false)
Definition: frmform.cxx:365
SwTwips EmptyHeight() const
Definition: porrst.cxx:311
SwParaPortion * GetPara()
Definition: txtcache.cxx:90
void SetHasRotatedPortions(bool bHasRotatedPortions)
Definition: txtftn.cxx:97
void HideFootnotes(TextFrameIndex nStart, TextFrameIndex nEnd)
Definition: txtfrm.cxx:1458
SwTextNode * GetTextNodeFirst()
Definition: txtfrm.hxx:461
void RemoveFromCache()
Removes this frame completely from the Cache.
Definition: txtcache.cxx:120
SwTextNode const * GetTextNodeForParaProps() const
Definition: txtfrm.cxx:1306
bool FormatEmpty()
Definition: porrst.cxx:384
void SetEmpty(const bool bNew)
Definition: txtfrm.hxx:251
bool GetHasRotatedPortions() const
Definition: txtfrm.hxx:534
bool IsEmpty() const
Definition: txtfrm.hxx:525
sal_uInt16 GetBaseHeight() const
Definition: tgrditem.hxx:75
sal_uInt16 GetRubyHeight() const
Definition: tgrditem.hxx:78
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:84
void DrawText(const OUString &rText, const SwLinePortion &rPor, TextFrameIndex nIdx=TextFrameIndex(0), TextFrameIndex nLen=TextFrameIndex(COMPLETE_STRING), const bool bKern=false) const
Definition: inftxt.hxx:747
SwTextFly & GetTextFly()
Definition: inftxt.hxx:384
const Point & GetPos() const
Definition: inftxt.hxx:429
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:719
void DrawBackBrush(const SwLinePortion &rPor) const
Definition: inftxt.cxx:1142
void DrawViewOpt(const SwLinePortion &rPor, PortionType nWhich, const Color *pColor=nullptr) const
Definition: inftxt.cxx:1304
void DrawBorder(const SwLinePortion &rPor) const
Draw character border around a line portion.
Definition: inftxt.cxx:1292
void DrawLineBreak(const SwLinePortion &rPor) const
Definition: inftxt.cxx:961
SwTwips Y() const
Definition: inftxt.hxx:381
SwTextFrame * GetTextFrame()
Definition: inftxt.hxx:285
vcl::RenderContext * GetOut()
Definition: inftxt.hxx:224
SwViewShell * GetVsh()
Definition: inftxt.hxx:221
const SwViewOption & GetOpt() const
Definition: inftxt.hxx:238
SwFont * GetFont()
Definition: inftxt.hxx:231
bool OnWin() const
Definition: inftxt.hxx:192
SwPosSize GetTextSize(OutputDevice *pOut, const SwScriptInfo *pSI, const OUString &rText, TextFrameIndex nIdx, TextFrameIndex nLen) const
Definition: inftxt.cxx:382
const OUString & GetText() const
Definition: inftxt.hxx:239
TextFrameIndex GetIdx() const
Definition: inftxt.hxx:272
const FontStrikeout m_eStrikeout
Definition: porrst.hxx:45
Color m_aColor
Definition: porrst.hxx:46
virtual void Paint(const SwTextPaintInfo &rInf) const override
Definition: porrst.cxx:64
SwTmpEndPortion(const SwLinePortion &rPortion, const FontLineStyle eUnderline, const FontStrikeout eStrikeout, const Color &rColor)
Definition: porrst.cxx:53
const FontLineStyle m_eUnderline
Definition: porrst.hxx:44
bool IsReadonly() const
Definition: viewopt.hxx:463
bool IsParagraph(bool bHard=false) const
Definition: viewopt.hxx:236
bool IsPagePreview() const
Definition: viewopt.hxx:635
bool IsShowBookmarks(bool const bHard=false) const
Definition: viewopt.hxx:246
bool IsPrtFormat() const
Definition: viewopt.hxx:541
bool getBrowseMode() const
Definition: viewopt.hxx:472
static bool IsFieldShadings()
Definition: viewopt.hxx:671
bool IsLineBreak(bool bHard=false) const
Definition: viewopt.hxx:252
static Color & GetFieldShadingsColor()
Definition: viewopt.cxx:461
vcl::RenderContext * GetOut() const
Definition: viewsh.hxx:339
const SwViewOption * GetViewOptions() const
Definition: viewsh.hxx:428
vcl::Window * GetWin() const
Definition: viewsh.hxx:338
::OutputDevice const * GetOutDev() const
Color m_aColor
#define DFLT_ESC_AUTO_SUB
FontLineStyle
LINESTYLE_NONE
FontStrikeout
STRIKEOUT_NONE
PITCH_DONTKNOW
ALIGN_BASELINE
WEIGHT_THIN
SwLineBreakClear
Defines the location of a line break text wrapping restart.
constexpr TypedWhichId< SwFormatLineBreak > RES_TXTATR_LINEBREAK(61)
aBuf
SwNumRule * GetNumRule(SwTextFormatColl &rTextFormatColl)
determines the list style, which directly set at the given paragraph style
Definition: fmtcol.cxx:76
int i
long Long
SwTextGridItem const * GetGridItem(SwPageFrame const *const)
Definition: pagechg.cxx:2595
#define LINE_BREAK_WIDTH
Definition: porrst.hxx:37
UNDERLYING_TYPE get() const
SvxAdjust
constexpr OUStringChar CH_PAR
Definition: swfont.hxx:45
tools::Long SwTwips
Definition: swtypes.hxx:51
#define CHAR_WJ
Definition: swtypes.hxx:167
#define CHAR_ZWSP
Definition: swtypes.hxx:166
#define NON_PRINTING_CHARACTER_COLOR
Definition: txtfrm.hxx:53
oslFileHandle & pOut