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