LibreOffice Module sw (master) 1
itrform2.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 <hintids.hxx>
21
22#include <memory>
23#include <com/sun/star/i18n/ScriptType.hpp>
24#include <editeng/lspcitem.hxx>
25#include <txtflcnt.hxx>
26#include <txtftn.hxx>
27#include <flyfrms.hxx>
28#include <fmtflcnt.hxx>
29#include <fmtftn.hxx>
30#include <ftninfo.hxx>
31#include <charfmt.hxx>
33#include <layfrm.hxx>
34#include <viewsh.hxx>
35#include <viewopt.hxx>
36#include <paratr.hxx>
37#include "itrform2.hxx"
38#include "porrst.hxx"
39#include "portab.hxx"
40#include "porfly.hxx"
41#include "portox.hxx"
42#include "porref.hxx"
43#include "porfld.hxx"
44#include "porftn.hxx"
45#include "porhyph.hxx"
46#include "pordrop.hxx"
47#include "redlnitr.hxx"
48#include <sortedobjs.hxx>
49#include <fmtanchr.hxx>
50#include <pagefrm.hxx>
51#include <tgrditem.hxx>
52#include <doc.hxx>
53#include "pormulti.hxx"
55#include <xmloff/odffields.hxx>
57#include <IMark.hxx>
61#include <comphelper/string.hxx>
62#include <docsh.hxx>
63#include <unocrsrhelper.hxx>
65#include <com/sun/star/rdf/Statement.hpp>
66#include <com/sun/star/rdf/URI.hpp>
67#include <com/sun/star/rdf/URIs.hpp>
68#include <com/sun/star/rdf/XDocumentMetadataAccess.hpp>
69#include <com/sun/star/rdf/XLiteral.hpp>
70#include <com/sun/star/text/XTextContent.hpp>
71
72using namespace ::com::sun::star;
73
74namespace {
76 tools::Long lcl_CalcOptRepaint( SwTextFormatter &rThis,
77 SwLineLayout const &rCurr,
78 TextFrameIndex nOldLineEnd,
79 const std::vector<tools::Long> &rFlyStarts );
81 bool lcl_BuildHiddenPortion(const SwTextSizeInfo& rInf, TextFrameIndex &rPos);
82
83 // Check whether the two font has the same border
84 bool lcl_HasSameBorder(const SwFont& rFirst, const SwFont& rSecond);
85}
86
87static void ClearFly( SwTextFormatInfo &rInf )
88{
89 delete rInf.GetFly();
90 rInf.SetFly(nullptr);
91}
92
94{
95 CtorInitTextPainter( pNewFrame, pNewInf );
96 m_pInf = pNewInf;
98 m_pMulti = nullptr;
99
100 m_bOnceMore = false;
101 m_bFlyInContentBase = false;
102 m_bTruncLines = false;
107 m_pByEndIter.reset();
108 m_pFirstOfBorderMerge = nullptr;
109
110 if (m_nStart > TextFrameIndex(GetInfo().GetText().getLength()))
111 {
112 OSL_ENSURE( false, "+SwTextFormatter::CTOR: bad offset" );
113 m_nStart = TextFrameIndex(GetInfo().GetText().getLength());
114 }
115
116}
117
119{
120 // Extremely unlikely, but still possible
121 // e.g.: field splits up, widows start to matter
122 if( GetInfo().GetRest() )
123 {
124 delete GetInfo().GetRest();
125 GetInfo().SetRest(nullptr);
126 }
127}
128
130{
131 // Insert BEHIND the current element
132 if ( m_pCurr )
133 {
134 pLay->SetNext( m_pCurr->GetNext() );
135 m_pCurr->SetNext( pLay );
136 }
137 else
138 m_pCurr = pLay;
139}
140
142{
143 // We want the rest height relative to the page.
144 // If we're in a table, then pFrame->GetUpper() is not the page.
145
146 // GetFrameRstHeight() is being called with Footnote.
147 // Wrong: const SwFrame *pUpper = pFrame->GetUpper();
148 const SwFrame *pPage = m_pFrame->FindPageFrame();
149 const SwTwips nHeight = pPage->getFrameArea().Top()
150 + pPage->getFramePrintArea().Top()
151 + pPage->getFramePrintArea().Height() - Y();
152 if( 0 > nHeight )
153 return m_pCurr->Height();
154 else
155 return sal_uInt16( nHeight );
156}
157
159{
160 if (pPortion == m_pFirstOfBorderMerge)
161 {
162 m_pFirstOfBorderMerge = nullptr;
163 return true;
164 }
165 return false;
166}
167
169{
170 // Save values and initialize rInf
171 SwLinePortion *pUnderflow = rInf.GetUnderflow();
172 if( !pUnderflow )
173 return nullptr;
174
175 // We format backwards, i.e. attribute changes can happen the next
176 // line again.
177 // Can be seen in 8081.sdw, if you enter text in the first line
178
179 TextFrameIndex const nSoftHyphPos = rInf.GetSoftHyphPos();
180 TextFrameIndex const nUnderScorePos = rInf.GetUnderScorePos();
181
182 // Save flys and set to 0, or else segmentation fault
183 // Not ClearFly(rInf) !
184 SwFlyPortion *pFly = rInf.GetFly();
185 rInf.SetFly( nullptr );
186
187 FeedInf( rInf );
188 rInf.SetLast( m_pCurr );
189 // pUnderflow does not need to be deleted, because it will drown in the following
190 // Truncate()
191 rInf.SetUnderflow(nullptr);
192 rInf.SetSoftHyphPos( nSoftHyphPos );
193 rInf.SetUnderScorePos( nUnderScorePos );
194 rInf.SetPaintOfst( GetLeftMargin() );
195
196 // We look for the portion with the under-flow position
198 if( pPor != pUnderflow )
199 {
200 // pPrev will be the last portion before pUnderflow,
201 // which still has a real width.
202 // Exception: SoftHyphPortion must not be forgotten, of course!
203 // Although they don't have a width.
204 SwLinePortion *pTmpPrev = pPor;
205 while( pPor && pPor != pUnderflow )
206 {
207 if( !pPor->IsKernPortion() &&
208 ( pPor->Width() || pPor->IsSoftHyphPortion() ) )
209 {
210 while( pTmpPrev != pPor )
211 {
212 pTmpPrev->Move( rInf );
213 rInf.SetLast( pTmpPrev );
214 pTmpPrev = pTmpPrev->GetNextPortion();
215 OSL_ENSURE( pTmpPrev, "Underflow: losing control!" );
216 };
217 }
218 pPor = pPor->GetNextPortion();
219 }
220 pPor = pTmpPrev;
221 if( pPor && // Skip flys and initials when underflow.
222 ( pPor->IsFlyPortion() || pPor->IsDropPortion() ||
223 pPor->IsFlyCntPortion() ) )
224 {
225 pPor->Move( rInf );
226 rInf.SetLast( pPor );
227 rInf.SetStopUnderflow( true );
228 pPor = pUnderflow;
229 }
230 }
231
232 // What? The under-flow portion is not in the portion chain?
233 OSL_ENSURE( pPor, "SwTextFormatter::Underflow: overflow but underflow" );
234
235 // Snapshot
236 if ( pPor==rInf.GetLast() )
237 {
238 // We end up here, if the portion triggering the under-flow
239 // spans over the whole line. E.g. if a word spans across
240 // multiple lines and flows into a fly in the second line.
241 rInf.SetFly( pFly );
242 pPor->Truncate();
243 return pPor; // Is that enough?
244 }
245 // End the snapshot
246
247 // X + Width == 0 with SoftHyph > Line?!
248 if( !pPor || !(rInf.X() + pPor->Width()) )
249 {
250 delete pFly;
251 return nullptr;
252 }
253
254 // Preparing for Format()
255 // We need to chip off the chain behind pLast, because we Insert after the Format()
256 SeekAndChg( rInf );
257
258 // line width is adjusted, so that pPor does not fit to current
259 // line anymore
260 rInf.Width( rInf.X() + (pPor->Width() ? pPor->Width() - 1 : 0) );
261 rInf.SetLen( pPor->GetLen() );
262 rInf.SetFull( false );
263 if( pFly )
264 {
265 // We need to recalculate the FlyPortion due to the following reason:
266 // If the base line is lowered by a big font in the middle of the line,
267 // causing overlapping with a fly, the FlyPortion has a wrong size/fixed
268 // size.
269 rInf.SetFly( pFly );
270 CalcFlyWidth( rInf );
271 }
272 rInf.GetLast()->SetNextPortion(nullptr);
273
274 // The SwLineLayout is an exception to this, which splits at the first
275 // portion change.
276 // Here only the other way around:
277 if( rInf.GetLast() == m_pCurr )
278 {
279 if( pPor->InTextGrp() && !pPor->InExpGrp() )
280 {
281 const PortionType nOldWhich = m_pCurr->GetWhichPor();
282 *static_cast<SwLinePortion*>(m_pCurr) = *pPor;
284 m_pCurr->SetWhichPor( nOldWhich );
285 pPor->SetNextPortion( nullptr );
286 delete pPor;
287 pPor = m_pCurr;
288 }
289 }
290
291 // Make sure that m_pFirstOfBorderMerge does not point to a portion which
292 // will be deleted by Truncate() below.
293 SwLinePortion* pNext = pPor->GetNextPortion();
294 while (pNext)
295 {
297 break;
298 pNext = pNext->GetNextPortion();
299 }
300 pPor->Truncate();
301 SwLinePortion *const pRest( rInf.GetRest() );
302 if (pRest && pRest->InFieldGrp() &&
303 static_cast<SwFieldPortion*>(pRest)->IsNoLength())
304 {
305 // HACK: decrement again, so we pick up the suffix in next line!
306 m_pByEndIter->PrevAttr();
307 }
308 delete pRest;
309 rInf.SetRest(nullptr);
310 return pPor;
311}
312
314 SwLinePortion *pPor )
315{
316 SwLinePortion *pLast = nullptr;
317 // The new portion is inserted, but everything's different for
318 // LineLayout...
319 if( pPor == m_pCurr )
320 {
321 if ( m_pCurr->GetNextPortion() )
322 {
323 pLast = pPor;
324 pPor = m_pCurr->GetNextPortion();
325 }
326
327 // i#112181 - Prevent footnote anchor being wrapped to next line
328 // without preceding word
330 }
331 else
332 {
333 pLast = rInf.GetLast();
334 if( pLast->GetNextPortion() )
335 {
336 while( pLast->GetNextPortion() )
337 pLast = pLast->GetNextPortion();
338 rInf.SetLast( pLast );
339 }
340 pLast->Insert( pPor );
341
343
344 // Adjust maxima
345 if( m_pCurr->Height() < pPor->Height() )
346 m_pCurr->Height( pPor->Height(), pPor->IsTextPortion() );
347 if( m_pCurr->GetAscent() < pPor->GetAscent() )
348 m_pCurr->SetAscent( pPor->GetAscent() );
351
352 if (GetTextFrame()->GetDoc().getIDocumentSettingAccess().get(DocumentSettingId::MS_WORD_COMP_MIN_LINE_HEIGHT_BY_FLY))
353 {
354 // For DOCX with compat=14 the only shape in line defines height of the line in spite of used font
355 if (pLast->IsFlyCntPortion() && pPor->IsTextPortion() && pPor->GetLen() == TextFrameIndex(0))
356 {
357 m_pCurr->SetAscent(pLast->GetAscent());
358 m_pCurr->Height(pLast->Height());
359 }
360 }
361 }
362
363 // Sometimes chains are constructed (e.g. by hyphenate)
364 rInf.SetLast( pPor );
365 while( pPor )
366 {
367 if (!pPor->IsDropPortion())
368 MergeCharacterBorder(*pPor, pLast, rInf);
369
370 pPor->Move( rInf );
371 rInf.SetLast( pPor );
372 pLast = pPor;
373 pPor = pPor->GetNextPortion();
374 }
375}
376
378{
379 OSL_ENSURE( rInf.GetText().getLength() < COMPLETE_STRING,
380 "SwTextFormatter::BuildPortions: bad text length in info" );
381
382 rInf.ChkNoHyph( CntEndHyph(), CntMidHyph() );
383
384 // First NewTextPortion() decides whether pCurr ends up in pPor.
385 // We need to make sure that the font is being set in any case.
386 // This is done automatically in CalcAscent.
387 rInf.SetLast( m_pCurr );
388 rInf.ForcedLeftMargin( 0 );
389
390 OSL_ENSURE( m_pCurr->FindLastPortion() == m_pCurr, "pLast supposed to equal pCurr" );
391
392 if( !m_pCurr->GetAscent() && !m_pCurr->Height() )
393 CalcAscent( rInf, m_pCurr );
394
395 SeekAndChg( rInf );
396
397 // Width() is shortened in CalcFlyWidth if we have a FlyPortion
398 OSL_ENSURE( !rInf.X() || m_pMulti, "SwTextFormatter::BuildPortion X=0?" );
399 CalcFlyWidth( rInf );
400 SwFlyPortion *pFly = rInf.GetFly();
401 if( pFly )
402 {
403 if ( 0 < pFly->GetFix() )
404 ClearFly( rInf );
405 else
406 rInf.SetFull(true);
407 }
408
409 ::std::optional<TextFrameIndex> oMovedFlyIndex;
410 if (SwTextFrame const*const pFollow = GetTextFrame()->GetFollow())
411 {
412 // flys are always on master!
413 if (GetTextFrame()->GetDrawObjs() && pFollow->GetUpper() != GetTextFrame()->GetUpper())
414 {
415 for (SwAnchoredObject const*const pAnchoredObj : *GetTextFrame()->GetDrawObjs())
416 {
417 // tdf#146500 try to stop where a fly is anchored in the follow
418 // that has recently been moved (presumably by splitting this
419 // frame); similar to check in SwFlowFrame::MoveBwd()
420 if (pAnchoredObj->RestartLayoutProcess()
421 && !pAnchoredObj->IsTmpConsiderWrapInfluence())
422 {
423 SwFormatAnchor const& rAnchor(pAnchoredObj->GetFrameFormat().GetAnchor());
424 assert(rAnchor.GetAnchorId() == RndStdIds::FLY_AT_CHAR || rAnchor.GetAnchorId() == RndStdIds::FLY_AT_PARA);
425 TextFrameIndex const nAnchor(GetTextFrame()->MapModelToViewPos(*rAnchor.GetContentAnchor()));
426 if (pFollow->GetOffset() <= nAnchor
427 && (pFollow->GetFollow() == nullptr
428 || nAnchor < pFollow->GetFollow()->GetOffset()))
429 {
430 if (!oMovedFlyIndex || nAnchor < *oMovedFlyIndex)
431 {
432 oMovedFlyIndex.emplace(nAnchor);
433 }
434 }
435 }
436 }
437 }
438 }
439
440 SwLinePortion *pPor = NewPortion(rInf, oMovedFlyIndex);
441
442 // Asian grid stuff
443 SwTextGridItem const*const pGrid(GetGridItem(m_pFrame->FindPageFrame()));
444 const bool bHasGrid = pGrid && rInf.SnapToGrid() &&
445 GRID_LINES_CHARS == pGrid->GetGridType();
446
447
448 const SwDoc & rDoc = rInf.GetTextFrame()->GetDoc();
449 const sal_uInt16 nGridWidth = bHasGrid ? GetGridWidth(*pGrid, rDoc) : 0;
450
451 // used for grid mode only:
452 // the pointer is stored, because after formatting of non-asian text,
453 // the width of the kerning portion has to be adjusted
454 // Inserting a SwKernPortion before a SwTabPortion isn't necessary
455 // and will break the SwTabPortion.
456 SwKernPortion* pGridKernPortion = nullptr;
457
458 bool bFull = false;
459 SwTwips nUnderLineStart = 0;
460 rInf.Y( Y() );
461
462 while( pPor && !rInf.IsStop() )
463 {
464 OSL_ENSURE(rInf.GetLen() < TextFrameIndex(COMPLETE_STRING) &&
465 rInf.GetIdx() <= TextFrameIndex(rInf.GetText().getLength()),
466 "SwTextFormatter::BuildPortions: bad length in info" );
467
468 // We have to check the script for fields in order to set the
469 // correct nActual value for the font.
470 if( pPor->InFieldGrp() )
471 static_cast<SwFieldPortion*>(pPor)->CheckScript( rInf );
472
473 if( ! bHasGrid && rInf.HasScriptSpace() &&
474 rInf.GetLast() && rInf.GetLast()->InTextGrp() &&
475 rInf.GetLast()->Width() && !rInf.GetLast()->InNumberGrp() )
476 {
477 SwFontScript nNxtActual = rInf.GetFont()->GetActual();
478 SwFontScript nLstActual = nNxtActual;
479 sal_uInt16 nLstHeight = o3tl::narrowing<sal_uInt16>(rInf.GetFont()->GetHeight());
480 bool bAllowBehind = false;
481 const CharClass& rCC = GetAppCharClass();
482
483 // are there any punctuation characters on both sides
484 // of the kerning portion?
485 if ( pPor->InFieldGrp() )
486 {
487 OUString aAltText;
488 if ( static_cast<SwFieldPortion*>(pPor)->GetExpText( rInf, aAltText ) &&
489 !aAltText.isEmpty() )
490 {
491 bAllowBehind = rCC.isLetterNumeric( aAltText, 0 );
492
493 const SwFont* pTmpFnt = static_cast<SwFieldPortion*>(pPor)->GetFont();
494 if ( pTmpFnt )
495 nNxtActual = pTmpFnt->GetActual();
496 }
497 }
498 else
499 {
500 const OUString& rText = rInf.GetText();
501 sal_Int32 nIdx = sal_Int32(rInf.GetIdx());
502 bAllowBehind = nIdx < rText.getLength() && rCC.isLetterNumeric(rText, nIdx);
503 }
504
505 const SwLinePortion* pLast = rInf.GetLast();
506 if ( bAllowBehind && pLast )
507 {
508 bool bAllowBefore = false;
509
510 if ( pLast->InFieldGrp() )
511 {
512 OUString aAltText;
513 if ( static_cast<const SwFieldPortion*>(pLast)->GetExpText( rInf, aAltText ) &&
514 !aAltText.isEmpty() )
515 {
516 bAllowBefore = rCC.isLetterNumeric( aAltText, aAltText.getLength() - 1 );
517
518 const SwFont* pTmpFnt = static_cast<const SwFieldPortion*>(pLast)->GetFont();
519 if ( pTmpFnt )
520 {
521 nLstActual = pTmpFnt->GetActual();
522 nLstHeight = o3tl::narrowing<sal_uInt16>(pTmpFnt->GetHeight());
523 }
524 }
525 }
526 else if ( rInf.GetIdx() )
527 {
528 bAllowBefore = rCC.isLetterNumeric(rInf.GetText(), sal_Int32(rInf.GetIdx()) - 1);
529 // Note: ScriptType returns values in [1,4]
530 if ( bAllowBefore )
531 nLstActual = SwFontScript(m_pScriptInfo->ScriptType(rInf.GetIdx() - TextFrameIndex(1)) - 1);
532 }
533
534 nLstHeight /= 5;
535 // does the kerning portion still fit into the line?
536 if( bAllowBefore && ( nLstActual != nNxtActual ) &&
537 nLstHeight && rInf.X() + nLstHeight <= rInf.Width() &&
538 ! pPor->InTabGrp() )
539 {
540 SwKernPortion* pKrn =
541 new SwKernPortion( *rInf.GetLast(), nLstHeight,
542 pLast->InFieldGrp() && pPor->InFieldGrp() );
543
544 // ofz#58550 Direct-leak, pKrn adds itself as the NextPortion
545 // of rInf.GetLast(), but may use CopyLinePortion to add a copy
546 // of itself, which will then be left dangling with the following
547 // SetNextPortion(nullptr)
548 SwLinePortion *pNext = rInf.GetLast()->GetNextPortion();
549 if (pNext != pKrn)
550 delete pNext;
551
552 rInf.GetLast()->SetNextPortion( nullptr );
553 InsertPortion( rInf, pKrn );
554 }
555 }
556 }
557 else if ( bHasGrid && ! pGridKernPortion && ! m_pMulti && ! pPor->InTabGrp() )
558 {
559 // insert a grid kerning portion
560 pGridKernPortion = pPor->IsKernPortion() ?
561 static_cast<SwKernPortion*>(pPor) :
562 new SwKernPortion( *m_pCurr );
563
564 // if we have a new GridKernPortion, we initially calculate
565 // its size so that its ends on the grid
566 const SwPageFrame* pPageFrame = m_pFrame->FindPageFrame();
567 const SwLayoutFrame* pBody = pPageFrame->FindBodyCont();
568 SwRectFnSet aRectFnSet(pPageFrame);
569
570 const tools::Long nGridOrigin = pBody ?
571 aRectFnSet.GetPrtLeft(*pBody) :
572 aRectFnSet.GetPrtLeft(*pPageFrame);
573
574 SwTwips nStartX = rInf.X() + GetLeftMargin();
575 if ( aRectFnSet.IsVert() )
576 {
577 Point aPoint( nStartX, 0 );
579 nStartX = aPoint.Y();
580 }
581
582 const SwTwips nOfst = nStartX - nGridOrigin;
583 if ( nOfst )
584 {
585 const sal_uLong i = ( nOfst > 0 ) ?
586 ( ( nOfst - 1 ) / nGridWidth + 1 ) :
587 0;
588 const SwTwips nKernWidth = i * nGridWidth - nOfst;
589 const SwTwips nRestWidth = rInf.Width() - rInf.X();
590
591 if ( nKernWidth <= nRestWidth )
592 pGridKernPortion->Width( nKernWidth );
593 }
594
595 if ( pGridKernPortion != pPor )
596 InsertPortion( rInf, pGridKernPortion );
597 }
598
599 if( pPor->IsDropPortion() )
600 MergeCharacterBorder(*static_cast<SwDropPortion*>(pPor));
601
602 // the multi-portion has its own format function
603 if( pPor->IsMultiPortion() && ( !m_pMulti || m_pMulti->IsBidi() ) )
604 bFull = BuildMultiPortion( rInf, *static_cast<SwMultiPortion*>(pPor) );
605 else
606 bFull = pPor->Format( rInf );
607
608 if( rInf.IsRuby() && !rInf.GetRest() )
609 bFull = true;
610
611 // if we are underlined, we store the beginning of this underlined
612 // segment for repaint optimization
613 if ( LINESTYLE_NONE != m_pFont->GetUnderline() && ! nUnderLineStart )
614 nUnderLineStart = GetLeftMargin() + rInf.X();
615
616 if ( pPor->IsFlyPortion() )
617 m_pCurr->SetFly( true );
618 // some special cases, where we have to take care for the repaint
619 // offset:
620 // 1. Underlined portions due to special underline feature
621 // 2. Right Tab
622 // 3. BidiPortions
623 // 4. other Multiportions
624 // 5. DropCaps
625 // 6. Grid Mode
626 else if ( ( ! rInf.GetPaintOfst() || nUnderLineStart < rInf.GetPaintOfst() ) &&
627 // 1. Underlined portions
628 nUnderLineStart &&
629 // reformat is at end of an underlined portion and next portion
630 // is not underlined
631 ( ( rInf.GetReformatStart() == rInf.GetIdx() &&
633 ) ||
634 // reformat is inside portion and portion is underlined
635 ( rInf.GetReformatStart() >= rInf.GetIdx() &&
636 rInf.GetReformatStart() <= rInf.GetIdx() + pPor->GetLen() &&
638 rInf.SetPaintOfst( nUnderLineStart );
639 else if ( ! rInf.GetPaintOfst() &&
640 // 2. Right Tab
641 ( ( pPor->InTabGrp() && !pPor->IsTabLeftPortion() ) ||
642 // 3. BidiPortions
643 ( pPor->IsMultiPortion() && static_cast<SwMultiPortion*>(pPor)->IsBidi() ) ||
644 // 4. Multi Portion and 5. Drop Caps
645 ( ( pPor->IsDropPortion() || pPor->IsMultiPortion() ) &&
646 rInf.GetReformatStart() >= rInf.GetIdx() &&
647 rInf.GetReformatStart() <= rInf.GetIdx() + pPor->GetLen() )
648 // 6. Grid Mode
649 || ( bHasGrid && SwFontScript::CJK != m_pFont->GetActual() )
650 )
651 )
652 // we store the beginning of the critical portion as our
653 // paint offset
654 rInf.SetPaintOfst( GetLeftMargin() + rInf.X() );
655
656 // under one of these conditions we are allowed to delete the
657 // start of the underline portion
658 if ( IsUnderlineBreak( *pPor, *m_pFont ) )
659 nUnderLineStart = 0;
660
661 if( pPor->IsFlyCntPortion() || ( pPor->IsMultiPortion() &&
662 static_cast<SwMultiPortion*>(pPor)->HasFlyInContent() ) )
664 // bUnderflow needs to be reset or we wrap again at the next softhyphen
665 if ( !bFull )
666 {
667 rInf.ClrUnderflow();
668 if( ! bHasGrid && rInf.HasScriptSpace() && pPor->InTextGrp() &&
669 pPor->GetLen() && !pPor->InFieldGrp() )
670 {
671 // The distance between two different scripts is set
672 // to 20% of the fontheight.
673 TextFrameIndex const nTmp = rInf.GetIdx() + pPor->GetLen();
674 if (nTmp == m_pScriptInfo->NextScriptChg(nTmp - TextFrameIndex(1)) &&
675 nTmp != TextFrameIndex(rInf.GetText().getLength()) &&
676 (m_pScriptInfo->ScriptType(nTmp - TextFrameIndex(1)) == css::i18n::ScriptType::ASIAN ||
677 m_pScriptInfo->ScriptType(nTmp) == css::i18n::ScriptType::ASIAN) )
678 {
679 const SwTwips nDist = rInf.GetFont()->GetHeight()/5;
680
681 if( nDist )
682 {
683 // we do not want a kerning portion if any end
684 // would be a punctuation character
685 const CharClass& rCC = GetAppCharClass();
686 if (rCC.isLetterNumeric(rInf.GetText(), sal_Int32(nTmp) - 1)
687 && rCC.isLetterNumeric(rInf.GetText(), sal_Int32(nTmp)))
688 {
689 // does the kerning portion still fit into the line?
690 if ( rInf.X() + pPor->Width() + nDist <= rInf.Width() )
691 new SwKernPortion( *pPor, nDist );
692 else
693 bFull = true;
694 }
695 }
696 }
697 }
698 }
699
700 if ( bHasGrid && pPor != pGridKernPortion && ! m_pMulti && ! pPor->InTabGrp() )
701 {
702 TextFrameIndex const nTmp = rInf.GetIdx() + pPor->GetLen();
703 const SwTwips nRestWidth = rInf.Width() - rInf.X() - pPor->Width();
704
705 const SwFontScript nCurrScript = m_pFont->GetActual(); // pScriptInfo->ScriptType( rInf.GetIdx() );
706 const SwFontScript nNextScript =
707 nTmp >= TextFrameIndex(rInf.GetText().getLength())
709 : m_pScriptInfo->WhichFont(nTmp);
710
711 // snap non-asian text to grid if next portion is ASIAN or
712 // there are no more portions in this line
713 // be careful when handling an underflow event: the gridkernportion
714 // could have been deleted
715 if ( nRestWidth > 0 && SwFontScript::CJK != nCurrScript &&
716 ! rInf.IsUnderflow() && ( bFull || SwFontScript::CJK == nNextScript ) )
717 {
718 OSL_ENSURE( pGridKernPortion, "No GridKernPortion available" );
719
720 // calculate size
721 SwLinePortion* pTmpPor = pGridKernPortion->GetNextPortion();
722 sal_uInt16 nSumWidth = pPor->Width();
723 while ( pTmpPor )
724 {
725 nSumWidth = nSumWidth + pTmpPor->Width();
726 pTmpPor = pTmpPor->GetNextPortion();
727 }
728
729 const SwTwips i = nSumWidth ?
730 ( nSumWidth - 1 ) / nGridWidth + 1 :
731 0;
732 const SwTwips nTmpWidth = i * nGridWidth;
733 const SwTwips nKernWidth = std::min(nTmpWidth - nSumWidth, nRestWidth);
734 const SwTwips nKernWidth_1 = pGrid->IsSnapToChars() ?
735 nKernWidth / 2 : 0;
736
737 OSL_ENSURE( nKernWidth <= nRestWidth,
738 "Not enough space left for adjusting non-asian text in grid mode" );
739 if (nKernWidth_1)
740 {
741 pGridKernPortion->Width( pGridKernPortion->Width() + nKernWidth_1 );
742 rInf.X( rInf.X() + nKernWidth_1 );
743 }
744
745 if ( ! bFull && nKernWidth - nKernWidth_1 > 0 )
746 new SwKernPortion( *pPor, static_cast<short>(nKernWidth - nKernWidth_1),
747 false, true );
748
749 pGridKernPortion = nullptr;
750 }
751 else if ( pPor->IsMultiPortion() || pPor->InFixMargGrp() ||
752 pPor->IsFlyCntPortion() || pPor->InNumberGrp() ||
753 pPor->InFieldGrp() || nCurrScript != nNextScript )
754 // next portion should snap to grid
755 pGridKernPortion = nullptr;
756 }
757
758 rInf.SetFull( bFull );
759
760 // Restportions from fields with multiple lines don't yet have the right ascent
761 if ( !pPor->GetLen() && !pPor->IsFlyPortion()
762 && !pPor->IsGrfNumPortion() && ! pPor->InNumberGrp()
763 && !pPor->IsMultiPortion() )
764 CalcAscent( rInf, pPor );
765
766 InsertPortion( rInf, pPor );
767 if (pPor->IsMultiPortion() && (!m_pMulti || m_pMulti->IsBidi()))
768 {
769 (void) rInf.CheckCurrentPosBookmark(); // bookmark was already created inside MultiPortion!
770 }
771 pPor = NewPortion(rInf, oMovedFlyIndex);
772 }
773
774 if( !rInf.IsStop() )
775 {
776 // The last right centered, decimal tab
777 SwTabPortion *pLastTab = rInf.GetLastTab();
778 if( pLastTab )
779 pLastTab->FormatEOL( rInf );
780 else if( rInf.GetLast() && rInf.LastKernPortion() )
781 rInf.GetLast()->FormatEOL( rInf );
782 }
784 && static_cast<SwNumberPortion*>(m_pCurr->GetNextPortion())->IsHide() )
785 rInf.SetNumDone( false );
786
787 // Delete fly in any case
788 ClearFly( rInf );
789
790 // Reinit the tab overflow flag after the line
791 rInf.SetTabOverflow( false );
792}
793
795{
796 if( SvxAdjust::Left != GetAdjust() && !m_pMulti)
797 {
798 pCurrent->SetFormatAdj(true);
799 if( IsFlyInCntBase() )
800 {
801 CalcAdjLine( pCurrent );
802 // For e.g. centered fly we need to switch the RefPoint
803 // That's why bAlways = true
804 UpdatePos( pCurrent, GetTopLeft(), GetStart(), true );
805 }
806 }
807}
808
810{
811 bool bCalc = false;
812 if ( pPor->InFieldGrp() && static_cast<SwFieldPortion*>(pPor)->GetFont() )
813 {
814 // Numbering + InterNetFields can keep an own font, then their size is
815 // independent from hard attribute values
816 SwFont* pFieldFnt = static_cast<SwFieldPortion*>(pPor)->m_pFont.get();
817 SwFontSave aSave( rInf, pFieldFnt );
818 pPor->Height( rInf.GetTextHeight() );
819 pPor->SetAscent( rInf.GetAscent() );
820 bCalc = true;
821 }
822 // i#89179
823 // tab portion representing the list tab of a list label gets the
824 // same height and ascent as the corresponding number portion
825 else if ( pPor->InTabGrp() && pPor->GetLen() == TextFrameIndex(0) &&
826 rInf.GetLast() && rInf.GetLast()->InNumberGrp() &&
827 static_cast<const SwNumberPortion*>(rInf.GetLast())->HasFont() )
828 {
829 const SwLinePortion* pLast = rInf.GetLast();
830 pPor->Height( pLast->Height() );
831 pPor->SetAscent( pLast->GetAscent() );
832 }
833 else if (pPor->GetWhichPor() == PortionType::Bookmark
834 && rInf.GetIdx() == TextFrameIndex(rInf.GetText().getLength()))
835 {
836 // bookmark at end of paragraph: *don't* advance iterator, use the
837 // current font instead; it's possible that there's a font size on the
838 // paragraph and it's overridden on the last line of the paragraph and
839 // we don't want to apply it via SwBookmarkPortion and grow the line
840 // height (example: n758883.docx)
841 SwLinePortion const*const pLast = rInf.GetLast();
842 assert(pLast);
843 pPor->Height( pLast->Height(), false );
844 pPor->SetAscent( pLast->GetAscent() );
845 }
846 else
847 {
848 const SwLinePortion *pLast = rInf.GetLast();
849 bool bChg = false;
850
851 // In empty lines the attributes are switched on via SeekStart
852 const bool bFirstPor = rInf.GetLineStart() == rInf.GetIdx();
853 if ( pPor->IsQuoVadisPortion() )
854 bChg = SeekStartAndChg( rInf, true );
855 else
856 {
857 if( bFirstPor )
858 {
859 if( !rInf.GetText().isEmpty() )
860 {
861 if ( pPor->GetLen() || !rInf.GetIdx()
862 || ( m_pCurr != pLast && !pLast->IsFlyPortion() )
863 || !m_pCurr->IsRest() ) // instead of !rInf.GetRest()
864 bChg = SeekAndChg( rInf );
865 else
866 bChg = SeekAndChgBefore( rInf );
867 }
868 else if ( m_pMulti )
869 // do not open attributes starting at 0 in empty multi
870 // portions (rotated numbering followed by a footnote
871 // can cause trouble, because the footnote attribute
872 // starts at 0, but if we open it, the attribute handler
873 // cannot handle it.
874 bChg = false;
875 else
876 bChg = SeekStartAndChg( rInf );
877 }
878 else
879 bChg = SeekAndChg( rInf );
880 }
881 if( bChg || bFirstPor || !pPor->GetAscent()
882 || !rInf.GetLast()->InTextGrp() )
883 {
885 pPor->SetAscent( rInf.GetAscent() );
886 pPor->Height( rInf.GetTextHeight() );
887 bCalc = true;
888 }
889 else
890 {
891 pPor->Height( pLast->Height() );
892 pPor->SetAscent( pLast->GetAscent() );
893 }
894 }
895
896 if( pPor->InTextGrp() && bCalc )
897 {
898 pPor->SetAscent(pPor->GetAscent() +
899 rInf.GetFont()->GetTopBorderSpace());
900 pPor->Height(pPor->Height() +
901 rInf.GetFont()->GetTopBorderSpace() +
902 rInf.GetFont()->GetBottomBorderSpace() );
903 }
904}
905
906namespace {
907
908class SwMetaPortion : public SwTextPortion
909{
910 Color m_aShadowColor;
911public:
912 SwMetaPortion() { SetWhichPor( PortionType::Meta ); }
913 virtual void Paint( const SwTextPaintInfo &rInf ) const override;
914 void SetShadowColor(const Color& rCol ) { m_aShadowColor = rCol; }
915};
916
918class SwContentControlPortion : public SwTextPortion
919{
920 SwTextContentControl* m_pTextContentControl;
921public:
922 SwContentControlPortion(SwTextContentControl* pTextContentControl);
923 virtual void Paint(const SwTextPaintInfo& rInf) const override;
924
926 bool DescribePDFControl(const SwTextPaintInfo& rInf) const;
927};
928}
929
930void SwMetaPortion::Paint( const SwTextPaintInfo &rInf ) const
931{
932 if ( Width() )
933 {
934 rInf.DrawViewOpt( *this, PortionType::Meta,
935 // custom shading (RDF metadata)
936 COL_BLACK == m_aShadowColor
937 ? nullptr
938 : &m_aShadowColor );
939
940 SwTextPortion::Paint( rInf );
941 }
942}
943
944SwContentControlPortion::SwContentControlPortion(SwTextContentControl* pTextContentControl)
945 : m_pTextContentControl(pTextContentControl)
946{
947 SetWhichPor(PortionType::ContentControl);
948}
949
950bool SwContentControlPortion::DescribePDFControl(const SwTextPaintInfo& rInf) const
951{
952 auto pPDFExtOutDevData = dynamic_cast<vcl::PDFExtOutDevData*>(rInf.GetOut()->GetExtOutDevData());
953 if (!pPDFExtOutDevData)
954 {
955 return false;
956 }
957
958 if (!pPDFExtOutDevData->GetIsExportFormFields())
959 {
960 return false;
961 }
962
963 if (!m_pTextContentControl)
964 {
965 return false;
966 }
967
968 const SwFormatContentControl& rFormatContentControl = m_pTextContentControl->GetContentControl();
969 const std::shared_ptr<SwContentControl>& pContentControl = rFormatContentControl.GetContentControl();
970 if (!pContentControl)
971 {
972 return false;
973 }
974
975 // Check if this is the first content control portion of this content control.
976 SwTextNode* pTextNode = pContentControl->GetTextNode();
977 sal_Int32 nStart = m_pTextContentControl->GetStart();
978 sal_Int32 nEnd = *m_pTextContentControl->GetEnd();
979 TextFrameIndex nViewStart = rInf.GetTextFrame()->MapModelToView(pTextNode, nStart);
980 TextFrameIndex nViewEnd = rInf.GetTextFrame()->MapModelToView(pTextNode, nEnd);
981 // The content control portion starts 1 char after the starting dummy character.
982 if (rInf.GetIdx() != nViewStart + TextFrameIndex(1))
983 {
984 // Ignore: don't process and also don't emit plain text fallback.
985 return true;
986 }
987
988 std::unique_ptr<vcl::PDFWriter::AnyWidget> pDescriptor;
989 switch (pContentControl->GetType())
990 {
993 {
994 pDescriptor = std::make_unique<vcl::PDFWriter::EditWidget>();
995 break;
996 }
998 {
999 pDescriptor = std::make_unique<vcl::PDFWriter::CheckBoxWidget>();
1000 auto pCheckBoxWidget = static_cast<vcl::PDFWriter::CheckBoxWidget*>(pDescriptor.get());
1001 pCheckBoxWidget->Checked = pContentControl->GetChecked();
1002 pCheckBoxWidget->OnValue = pContentControl->GetCheckedState();
1003 pCheckBoxWidget->OffValue = pContentControl->GetUncheckedState();
1004 break;
1005 }
1007 {
1008 pDescriptor = std::make_unique<vcl::PDFWriter::ListBoxWidget>();
1009 auto pListWidget = static_cast<vcl::PDFWriter::ListBoxWidget*>(pDescriptor.get());
1010 pListWidget->DropDown = true;
1011 for (const auto& rItem : pContentControl->GetListItems())
1012 {
1013 pListWidget->Entries.push_back(rItem.m_aDisplayText);
1014 }
1015 break;
1016 }
1018 {
1019 pDescriptor = std::make_unique<vcl::PDFWriter::ComboBoxWidget>();
1020 auto pComboWidget = static_cast<vcl::PDFWriter::ComboBoxWidget*>(pDescriptor.get());
1021 for (const auto& rItem : pContentControl->GetListItems())
1022 {
1023 pComboWidget->Entries.push_back(rItem.m_aDisplayText);
1024 }
1025 break;
1026 }
1028 {
1029 pDescriptor = std::make_unique<vcl::PDFWriter::EditWidget>();
1030 auto pEditWidget = static_cast<vcl::PDFWriter::EditWidget*>(pDescriptor.get());
1031 pEditWidget->Format = vcl::PDFWriter::Date;
1032 // GetDateFormat() uses a syntax that works with SvNumberFormatter::PutEntry(), PDF's
1033 // AFDate_FormatEx() uses a similar syntax, but uses lowercase characters in case of
1034 // "Y", "M" and "D" at least.
1035 pEditWidget->DateFormat = pContentControl->GetDateFormat().toAsciiLowerCase();
1036 break;
1037 }
1038 default:
1039 break;
1040 }
1041
1042 if (!pDescriptor)
1043 {
1044 return false;
1045 }
1046
1047 const SwFont* pFont = rInf.GetFont();
1048 if (pFont)
1049 {
1050 pDescriptor->TextFont = pFont->GetActualFont();
1051 }
1052
1053 // Description for accessibility purposes.
1054 if (!pContentControl->GetAlias().isEmpty())
1055 {
1056 pDescriptor->Description = pContentControl->GetAlias();
1057 }
1058
1059 // Map the text of the content control to the descriptor's text.
1060 SwPosition aPoint(*pTextNode, nStart);
1061 SwPosition aMark(*pTextNode, nEnd);
1062 SwPaM aPam(aMark, aPoint);
1063 OUString aText = aPam.GetText();
1064 static sal_Unicode const aForbidden[] = {
1066 0
1067 };
1068 pDescriptor->Text = comphelper::string::removeAny(aText, aForbidden);
1069
1070 // Calculate the bounding rectangle of this content control, which can be one or more layout
1071 // portions in one or more lines.
1072 SwRect aLocation;
1073 auto pTextFrame = const_cast<SwTextFrame*>(rInf.GetTextFrame());
1074 SwTextSizeInfo aInf(pTextFrame);
1075 SwTextCursor aLine(pTextFrame, &aInf);
1076 SwRect aStartRect, aEndRect;
1077 aLine.GetCharRect(&aStartRect, nViewStart);
1078 aLine.GetCharRect(&aEndRect, nViewEnd);
1079
1080 // Handling RTL text direction
1081 if(rInf.GetTextFrame()->IsRightToLeft())
1082 {
1083 rInf.GetTextFrame()->SwitchLTRtoRTL( aStartRect );
1084 rInf.GetTextFrame()->SwitchLTRtoRTL( aEndRect );
1085 }
1086 // TODO: handle rInf.GetTextFrame()->IsVertical()
1087
1088 aLocation = aStartRect;
1089 aLocation.Union(aEndRect);
1090 pDescriptor->Location = aLocation.SVRect();
1091
1092 pPDFExtOutDevData->BeginStructureElement(vcl::PDFWriter::Form);
1093 pPDFExtOutDevData->CreateControl(*pDescriptor);
1094 pPDFExtOutDevData->EndStructureElement();
1095
1096 return true;
1097}
1098
1099void SwContentControlPortion::Paint(const SwTextPaintInfo& rInf) const
1100{
1101 if (Width())
1102 {
1104
1105 if (DescribePDFControl(rInf))
1106 {
1107 return;
1108 }
1109
1111 }
1112}
1113
1114namespace sw::mark {
1115 OUString ExpandFieldmark(IFieldmark* pBM)
1116 {
1117 if (pBM->GetFieldname() == ODF_FORMCHECKBOX)
1118 {
1119 ::sw::mark::ICheckboxFieldmark const*const pCheckboxFm(
1120 dynamic_cast<ICheckboxFieldmark const*>(pBM));
1121 assert(pCheckboxFm);
1122 return pCheckboxFm->IsChecked()
1123 ? OUString(u"\u2612")
1124 : OUString(u"\u2610");
1125 }
1126 assert(pBM->GetFieldname() == ODF_FORMDROPDOWN);
1127 const IFieldmark::parameter_map_t* const pParameters = pBM->GetParameters();
1128 sal_Int32 nCurrentIdx = 0;
1129 const IFieldmark::parameter_map_t::const_iterator pResult = pParameters->find(ODF_FORMDROPDOWN_RESULT);
1130 if(pResult != pParameters->end())
1131 pResult->second >>= nCurrentIdx;
1132
1133 const IFieldmark::parameter_map_t::const_iterator pListEntries = pParameters->find(OUString(ODF_FORMDROPDOWN_LISTENTRY));
1134 if (pListEntries != pParameters->end())
1135 {
1136 uno::Sequence< OUString > vListEntries;
1137 pListEntries->second >>= vListEntries;
1138 if (nCurrentIdx < vListEntries.getLength())
1139 return vListEntries[nCurrentIdx];
1140 }
1141
1142 static constexpr OUStringLiteral vEnSpaces = u"\u2002\u2002\u2002\u2002\u2002";
1143 return vEnSpaces;
1144 }
1145}
1146
1148{
1149 SwTextPortion *pPor = nullptr;
1150 if( GetFnt()->IsTox() )
1151 {
1152 pPor = new SwToxPortion;
1153 }
1154 else if ( GetFnt()->IsInputField() )
1155 {
1156 if (rInf.GetOpt().IsFieldName())
1157 {
1158 OUString aFieldName = SwFieldType::GetTypeStr(SwFieldTypesEnum::Input);
1159 // assume this is only the *first* portion and follows will be created elsewhere => input field must start at Idx
1160 assert(rInf.GetText()[sal_Int32(rInf.GetIdx())] == CH_TXT_ATR_INPUTFIELDSTART);
1161 TextFrameIndex nFieldLen(-1);
1162 for (TextFrameIndex i = rInf.GetIdx() + TextFrameIndex(1); ; ++i)
1163 {
1164 assert(rInf.GetText()[sal_Int32(i)] != CH_TXT_ATR_INPUTFIELDSTART); // can't nest
1165 if (rInf.GetText()[sal_Int32(i)] == CH_TXT_ATR_INPUTFIELDEND)
1166 {
1167 nFieldLen = i + TextFrameIndex(1) - rInf.GetIdx();
1168 break;
1169 }
1170 }
1171 assert(2 <= sal_Int32(nFieldLen));
1172 pPor = new SwFieldPortion(aFieldName, nullptr, false, nFieldLen);
1173 }
1174 else
1175 {
1176 pPor = new SwTextInputFieldPortion();
1177 }
1178 }
1179 else
1180 {
1181 if( GetFnt()->IsRef() )
1182 pPor = new SwRefPortion;
1183 else if (GetFnt()->IsMeta())
1184 {
1185 auto pMetaPor = new SwMetaPortion;
1186
1187 // set custom LO_EXT_SHADING color, if it exists
1188 SwTextFrame const*const pFrame(rInf.GetTextFrame());
1189 SwPosition aPosition(pFrame->MapViewToModelPos(rInf.GetIdx()));
1190 SwPaM aPam(aPosition);
1191 uno::Reference<text::XTextContent> const xRet(
1193 *aPam.GetPointNode().GetTextNode(), aPosition.GetContentIndex(), false) );
1194 if (xRet.is())
1195 {
1196 const SwDoc & rDoc = rInf.GetTextFrame()->GetDoc();
1197 static uno::Reference< uno::XComponentContext > xContext(
1198 ::comphelper::getProcessComponentContext());
1199
1200 static uno::Reference< rdf::XURI > xODF_SHADING(
1201 rdf::URI::createKnown(xContext, rdf::URIs::LO_EXT_SHADING), uno::UNO_SET_THROW);
1202
1203 uno::Reference<rdf::XDocumentMetadataAccess> xDocumentMetadataAccess(
1204 rDoc.GetDocShell()->GetBaseModel(), uno::UNO_QUERY);
1205
1206 const css::uno::Reference<css::rdf::XResource> xSubject(xRet, uno::UNO_QUERY);
1207 const uno::Reference<rdf::XRepository>& xRepository =
1208 xDocumentMetadataAccess->getRDFRepository();
1209 const uno::Reference<container::XEnumeration> xEnum(
1210 xRepository->getStatements(xSubject, xODF_SHADING, nullptr), uno::UNO_SET_THROW);
1211
1212 while (xEnum->hasMoreElements())
1213 {
1214 rdf::Statement stmt;
1215 if (!(xEnum->nextElement() >>= stmt)) {
1216 throw uno::RuntimeException();
1217 }
1218 const uno::Reference<rdf::XLiteral> xObject(stmt.Object, uno::UNO_QUERY);
1219 if (!xObject.is()) continue;
1220 if (xEnum->hasMoreElements()) {
1221 SAL_INFO("sw.uno", "ignoring other odf:shading statements");
1222 }
1223 Color rColor = Color::STRtoRGB(xObject->getValue());
1224 pMetaPor->SetShadowColor(rColor);
1225 break;
1226 }
1227 }
1228 pPor = pMetaPor;
1229 }
1230 else if (GetFnt()->IsContentControl())
1231 {
1232 SwTextFrame const*const pFrame(rInf.GetTextFrame());
1233 SwPosition aPosition(pFrame->MapViewToModelPos(rInf.GetIdx()));
1234 SwTextNode* pTextNode = aPosition.GetNode().GetTextNode();
1235 SwTextContentControl* pTextContentControl = nullptr;
1236 if (pTextNode)
1237 {
1238 sal_Int32 nIndex = aPosition.GetContentIndex();
1240 {
1241 pTextContentControl = static_txtattr_cast<SwTextContentControl*>(pAttr);
1242 }
1243 }
1244 pPor = new SwContentControlPortion(pTextContentControl);
1245 }
1246 else
1247 {
1248 // Only at the End!
1249 // If pCurr does not have a width, it can however already have content.
1250 // E.g. for non-displayable characters
1251
1252 auto const ch(rInf.GetText()[sal_Int32(rInf.GetIdx())]);
1253 SwTextFrame const*const pFrame(rInf.GetTextFrame());
1254 SwPosition aPosition(pFrame->MapViewToModelPos(rInf.GetIdx()));
1255 sw::mark::IFieldmark *pBM = pFrame->GetDoc().getIDocumentMarkAccess()->getInnerFieldmarkFor(aPosition);
1256 if(pBM != nullptr && pBM->GetFieldname( ) == ODF_FORMDATE)
1257 {
1259 pPor = new SwFieldFormDatePortion(pBM, true);
1260 else if (ch == CH_TXT_ATR_FIELDSEP)
1261 pPor = new SwFieldMarkPortion(); // it's added in DateFieldmark?
1262 else if (ch == CH_TXT_ATR_FIELDEND)
1263 pPor = new SwFieldFormDatePortion(pBM, false);
1264 }
1265 else if (ch == CH_TXT_ATR_FIELDSTART)
1266 pPor = new SwFieldMarkPortion();
1267 else if (ch == CH_TXT_ATR_FIELDSEP)
1268 pPor = new SwFieldMarkPortion();
1269 else if (ch == CH_TXT_ATR_FIELDEND)
1270 pPor = new SwFieldMarkPortion();
1271 else if (ch == CH_TXT_ATR_FORMELEMENT)
1272 {
1273 OSL_ENSURE(pBM != nullptr, "Where is my form field bookmark???");
1274 if (pBM != nullptr)
1275 {
1276 if (pBM->GetFieldname( ) == ODF_FORMCHECKBOX)
1277 {
1278 pPor = new SwFieldFormCheckboxPortion();
1279 }
1280 else if (pBM->GetFieldname( ) == ODF_FORMDROPDOWN)
1281 {
1283 }
1284 /* we need to check for ODF_FORMTEXT for scenario having FormFields inside FORMTEXT.
1285 * Otherwise file will crash on open.
1286 */
1287 else if (pBM->GetFieldname( ) == ODF_FORMTEXT)
1288 {
1289 pPor = new SwFieldMarkPortion();
1290 }
1291 }
1292 }
1293 if( !pPor )
1294 {
1295 if( !rInf.X() && !m_pCurr->GetNextPortion() && !m_pCurr->GetLen() )
1296 pPor = m_pCurr;
1297 else
1298 pPor = new SwTextPortion;
1299 }
1300 }
1301 }
1302 return pPor;
1303}
1304
1305// We calculate the length, the following portion limits are defined:
1306// 1) Tabs
1307// 2) Linebreaks
1308// 3) CH_TXTATR_BREAKWORD / CH_TXTATR_INWORD
1309// 4) next attribute change
1310
1312{
1313 // If we're at the line's beginning, we take pCurr
1314 // If pCurr is not derived from SwTextPortion, we need to duplicate
1315 Seek( rInf.GetIdx() );
1316 SwTextPortion *pPor = WhichTextPor( rInf );
1317
1318 // until next attribute change:
1319 const TextFrameIndex nNextAttr = GetNextAttr();
1320 TextFrameIndex nNextChg = std::min(nNextAttr, TextFrameIndex(rInf.GetText().getLength()));
1321
1322 // end of script type:
1323 const TextFrameIndex nNextScript = m_pScriptInfo->NextScriptChg(rInf.GetIdx());
1324 nNextChg = std::min( nNextChg, nNextScript );
1325
1326 // end of direction:
1327 const TextFrameIndex nNextDir = m_pScriptInfo->NextDirChg(rInf.GetIdx());
1328 nNextChg = std::min( nNextChg, nNextDir );
1329
1330 // hidden change (potentially via bookmark):
1331 const TextFrameIndex nNextHidden = m_pScriptInfo->NextHiddenChg(rInf.GetIdx());
1332 nNextChg = std::min( nNextChg, nNextHidden );
1333
1334 // bookmarks
1335 const TextFrameIndex nNextBookmark = m_pScriptInfo->NextBookmark(rInf.GetIdx());
1336 nNextChg = std::min(nNextChg, nNextBookmark);
1337
1338 // Turbo boost:
1339 // We assume that font characters are not larger than twice
1340 // as wide as height.
1341 // Very crazy: we need to take the ascent into account.
1342
1343 // Mind the trap! GetSize() contains the wished-for height, the real height
1344 // is only known in CalcAscent!
1345
1346 // The ratio is even crazier: a blank in Times New Roman has an ascent of
1347 // 182, a height of 200 and a width of 53!
1348 // It follows that a line with a lot of blanks is processed incorrectly.
1349 // Therefore we increase from factor 2 to 8 (due to negative kerning).
1350
1351 pPor->SetLen(TextFrameIndex(1));
1352 CalcAscent( rInf, pPor );
1353
1354 const SwFont* pTmpFnt = rInf.GetFont();
1355 sal_Int32 nExpect = std::min( sal_Int32( pTmpFnt->GetHeight() ),
1356 sal_Int32( pPor->GetAscent() ) ) / 8;
1357 if ( !nExpect )
1358 nExpect = 1;
1359 nExpect = sal_Int32(rInf.GetIdx()) + (rInf.GetLineWidth() / nExpect);
1360 if (TextFrameIndex(nExpect) > rInf.GetIdx() && nNextChg > TextFrameIndex(nExpect))
1361 nNextChg = TextFrameIndex(std::min(nExpect, rInf.GetText().getLength()));
1362
1363 // we keep an invariant during method calls:
1364 // there are no portion ending characters like hard spaces
1365 // or tabs in [ nLeftScanIdx, nRightScanIdx ]
1366 if ( m_nLeftScanIdx <= rInf.GetIdx() && rInf.GetIdx() <= m_nRightScanIdx )
1367 {
1368 if ( nNextChg > m_nRightScanIdx )
1369 nNextChg = m_nRightScanIdx =
1370 rInf.ScanPortionEnd( m_nRightScanIdx, nNextChg );
1371 }
1372 else
1373 {
1374 m_nLeftScanIdx = rInf.GetIdx();
1375 nNextChg = m_nRightScanIdx =
1376 rInf.ScanPortionEnd( rInf.GetIdx(), nNextChg );
1377 }
1378
1379 pPor->SetLen( nNextChg - rInf.GetIdx() );
1380 rInf.SetLen( pPor->GetLen() );
1381 return pPor;
1382}
1383
1384// first portions have no length
1386{
1387 SwLinePortion *pPor = nullptr;
1388
1389 if( rInf.GetRest() )
1390 {
1391 // Tabs and fields
1392 if( '\0' != rInf.GetHookChar() )
1393 return nullptr;
1394
1395 pPor = rInf.GetRest();
1396 if( pPor->IsErgoSumPortion() )
1397 rInf.SetErgoDone(true);
1398 else
1399 if( pPor->IsFootnoteNumPortion() )
1400 rInf.SetFootnoteDone(true);
1401 else
1402 if( pPor->InNumberGrp() )
1403 rInf.SetNumDone(true);
1404
1405 rInf.SetRest(nullptr);
1406 m_pCurr->SetRest( true );
1407 return pPor;
1408 }
1409
1410 // We can stand in the follow, it's crucial that
1411 // pFrame->GetOffset() == 0!
1412 if( rInf.GetIdx() )
1413 {
1414 // We now too can elongate FootnotePortions and ErgoSumPortions
1415
1416 // 1. The ErgoSumTexts
1417 if( !rInf.IsErgoDone() )
1418 {
1420 pPor = NewErgoSumPortion( rInf );
1421 rInf.SetErgoDone( true );
1422 }
1423
1424 // 2. Arrow portions
1425 if( !pPor && !rInf.IsArrowDone() )
1426 {
1427 if( m_pFrame->GetOffset() && !m_pFrame->IsFollow() &&
1428 rInf.GetIdx() == m_pFrame->GetOffset() )
1429 pPor = new SwArrowPortion( *m_pCurr );
1430 rInf.SetArrowDone( true );
1431 }
1432
1433 // 3. Kerning portions at beginning of line in grid mode
1434 if ( ! pPor && ! m_pCurr->GetNextPortion() )
1435 {
1436 SwTextGridItem const*const pGrid(
1437 GetGridItem(GetTextFrame()->FindPageFrame()));
1438 if ( pGrid )
1439 pPor = new SwKernPortion( *m_pCurr );
1440 }
1441
1442 // 4. The line rests (multiline fields)
1443 if( !pPor )
1444 {
1445 pPor = rInf.GetRest();
1446 // Only for pPor of course
1447 if( pPor )
1448 {
1449 m_pCurr->SetRest( true );
1450 rInf.SetRest(nullptr);
1451 }
1452 }
1453 }
1454 else
1455 {
1456 // 5. The foot note count
1457 if( !rInf.IsFootnoteDone() )
1458 {
1459 OSL_ENSURE( ( ! rInf.IsMulti() && ! m_pMulti ) || m_pMulti->HasRotation(),
1460 "Rotated number portion trouble" );
1461
1462 const bool bFootnoteNum = m_pFrame->IsFootnoteNumFrame();
1463 rInf.GetParaPortion()->SetFootnoteNum( bFootnoteNum );
1464 if( bFootnoteNum )
1465 pPor = NewFootnoteNumPortion( rInf );
1466 rInf.SetFootnoteDone( true );
1467 }
1468
1469 // 6. The ErgoSumTexts of course also exist in the TextMaster,
1470 // it's crucial whether the SwFootnoteFrame is aFollow
1471 if( !rInf.IsErgoDone() && !pPor && ! rInf.IsMulti() )
1472 {
1474 pPor = NewErgoSumPortion( rInf );
1475 rInf.SetErgoDone( true );
1476 }
1477
1478 // 7. The numbering
1479 if( !rInf.IsNumDone() && !pPor )
1480 {
1481 OSL_ENSURE( ( ! rInf.IsMulti() && ! m_pMulti ) || m_pMulti->HasRotation(),
1482 "Rotated number portion trouble" );
1483
1484 // If we're in the follow, then of course not
1485 if (GetTextFrame()->GetTextNodeForParaProps()->GetNumRule())
1486 pPor = NewNumberPortion( rInf );
1487 rInf.SetNumDone( true );
1488 }
1489 // 8. The DropCaps
1490 if( !pPor && GetDropFormat() && ! rInf.IsMulti() )
1491 pPor = NewDropPortion( rInf );
1492
1493 // 9. Kerning portions at beginning of line in grid mode
1494 if ( !pPor && !m_pCurr->GetNextPortion() )
1495 {
1496 SwTextGridItem const*const pGrid(
1497 GetGridItem(GetTextFrame()->FindPageFrame()));
1498 if ( pGrid )
1499 pPor = new SwKernPortion( *m_pCurr );
1500 }
1501 }
1502
1503 // 10. Decimal tab portion at the beginning of each line in table cells
1504 if ( !pPor && !m_pCurr->GetNextPortion() &&
1505 GetTextFrame()->IsInTab() &&
1506 GetTextFrame()->GetDoc().getIDocumentSettingAccess().get(DocumentSettingId::TAB_COMPAT))
1507 {
1508 pPor = NewTabPortion( rInf, true );
1509 }
1510
1511 // 11. suffix of meta-field
1512 if (!pPor)
1513 {
1514 pPor = TryNewNoLengthPortion(rInf);
1515 }
1516
1517 // 12. bookmarks
1518 // check this *last* so that BuildMultiPortion() can find it!
1519 if (!pPor && rInf.CheckCurrentPosBookmark())
1520 {
1521 const auto& bookmark = m_pScriptInfo->GetBookmarks(rInf.GetIdx());
1522 if (!bookmark.empty())
1523 {
1524 // only for character width, maybe replaced with ] later
1525 sal_Unicode mark = '[';
1526
1527 pPor = new SwBookmarkPortion(mark, bookmark);
1528 }
1529 }
1530
1531 return pPor;
1532}
1533
1534static bool lcl_OldFieldRest( const SwLineLayout* pCurr )
1535{
1536 if( !pCurr->GetNext() )
1537 return false;
1538 const SwLinePortion *pPor = pCurr->GetNext()->GetNextPortion();
1539 bool bRet = false;
1540 while( pPor && !bRet )
1541 {
1542 bRet = (pPor->InFieldGrp() && static_cast<const SwFieldPortion*>(pPor)->IsFollow()) ||
1543 (pPor->IsMultiPortion() && static_cast<const SwMultiPortion*>(pPor)->IsFollowField());
1544 if( !pPor->GetLen() )
1545 break;
1546 pPor = pPor->GetNextPortion();
1547 }
1548 return bRet;
1549}
1550
1551/* NewPortion sets rInf.nLen
1552 * A SwTextPortion is limited by a tab, break, txtatr or attr change
1553 * We can have three cases:
1554 * 1) The line is full and the wrap was not emulated
1555 * -> return 0;
1556 * 2) The line is full and a wrap was emulated
1557 * -> Reset width and return new FlyPortion
1558 * 3) We need to construct a new portion
1559 * -> CalcFlyWidth emulates the width and return portion, if needed
1560 */
1561
1563 ::std::optional<TextFrameIndex> const oMovedFlyIndex)
1564{
1565 if (oMovedFlyIndex && *oMovedFlyIndex <= rInf.GetIdx())
1566 {
1567 SAL_WARN_IF(*oMovedFlyIndex != rInf.GetIdx(), "sw.core", "stopping too late, no portion break at fly anchor?");
1568 rInf.SetStop(true);
1569 return nullptr;
1570 }
1571
1572 // Underflow takes precedence
1573 rInf.SetStopUnderflow( false );
1574 if( rInf.GetUnderflow() )
1575 {
1576 OSL_ENSURE( rInf.IsFull(), "SwTextFormatter::NewPortion: underflow but not full" );
1577 return Underflow( rInf );
1578 }
1579
1580 // If the line is full, flys and Underflow portions could be waiting ...
1581 if( rInf.IsFull() )
1582 {
1583 // LineBreaks and Flys (bug05.sdw)
1584 // IsDummy()
1585 if( rInf.IsNewLine() && (!rInf.GetFly() || !m_pCurr->IsDummy()) )
1586 return nullptr;
1587
1588 // When the text bumps into the Fly, or when the Fly comes first because
1589 // it juts out over the left edge, GetFly() is returned.
1590 // When IsFull() and no GetFly() is available, naturally zero is returned.
1591 if( rInf.GetFly() )
1592 {
1593 if( rInf.GetLast()->IsBreakPortion() )
1594 {
1595 delete rInf.GetFly();
1596 rInf.SetFly( nullptr );
1597 }
1598
1599 return rInf.GetFly();
1600 }
1601
1602 // A nasty special case: A frame without wrap overlaps the Footnote area.
1603 // We must declare the Footnote portion as rest of line, so that
1604 // SwTextFrame::Format doesn't abort (the text mass already was formatted).
1605 if( rInf.GetRest() )
1606 rInf.SetNewLine( true );
1607 else
1608 {
1609 // When the next line begins with a rest of a field, but now no
1610 // rest remains, the line must definitely be formatted anew!
1611 if( lcl_OldFieldRest( GetCurr() ) )
1612 rInf.SetNewLine( true );
1613 else
1614 {
1615 SwLinePortion *pFirst = WhichFirstPortion( rInf );
1616 if( pFirst )
1617 {
1618 rInf.SetNewLine( true );
1619 if( pFirst->InNumberGrp() )
1620 rInf.SetNumDone( false) ;
1621 delete pFirst;
1622 }
1623 }
1624 }
1625
1626 return nullptr;
1627 }
1628
1629 SwLinePortion *pPor = WhichFirstPortion( rInf );
1630
1631 // Check for Hidden Portion:
1632 if ( !pPor )
1633 {
1634 TextFrameIndex nEnd = rInf.GetIdx();
1635 if ( ::lcl_BuildHiddenPortion( rInf, nEnd ) )
1636 pPor = new SwHiddenTextPortion( nEnd - rInf.GetIdx() );
1637 }
1638
1639 if( !pPor )
1640 {
1641 if( ( !m_pMulti || m_pMulti->IsBidi() ) &&
1642 // i#42734
1643 // No multi portion if there is a hook character waiting:
1644 ( !rInf.GetRest() || '\0' == rInf.GetHookChar() ) )
1645 {
1646 // We open a multiportion part, if we enter a multi-line part
1647 // of the paragraph.
1648 TextFrameIndex nEnd = rInf.GetIdx();
1649 std::optional<SwMultiCreator> pCreate = rInf.GetMultiCreator( nEnd, m_pMulti );
1650 if( pCreate )
1651 {
1652 SwMultiPortion* pTmp = nullptr;
1653
1654 if ( SwMultiCreatorId::Bidi == pCreate->nId )
1655 pTmp = new SwBidiPortion( nEnd, pCreate->nLevel );
1656 else if ( SwMultiCreatorId::Ruby == pCreate->nId )
1657 {
1658 pTmp = new SwRubyPortion( *pCreate, *rInf.GetFont(),
1659 GetTextFrame()->GetDoc().getIDocumentSettingAccess(),
1660 nEnd, TextFrameIndex(0), rInf );
1661 }
1662 else if( SwMultiCreatorId::Rotate == pCreate->nId )
1663 {
1664 pTmp = new SwRotatedPortion( *pCreate, nEnd,
1665 GetTextFrame()->IsRightToLeft() );
1667 }
1668 else
1669 pTmp = new SwDoubleLinePortion( *pCreate, nEnd );
1670
1671 pCreate.reset();
1672 CalcFlyWidth( rInf );
1673
1674 return pTmp;
1675 }
1676 }
1677 // Tabs and Fields
1678 sal_Unicode cChar = rInf.GetHookChar();
1679
1680 if( cChar )
1681 {
1682 /* We fetch cChar again to be sure that the tab is pending now and
1683 * didn't move to the next line (as happens behind frames).
1684 * However, when a FieldPortion is in the rest, we must naturally fetch
1685 * the cChar from the field content, e.g. DecimalTabs and fields (22615)
1686 */
1687 if( !rInf.GetRest() || !rInf.GetRest()->InFieldGrp() )
1688 cChar = rInf.GetChar( rInf.GetIdx() );
1689 rInf.ClearHookChar();
1690 }
1691 else
1692 {
1693 if (rInf.GetIdx() >= TextFrameIndex(rInf.GetText().getLength()))
1694 {
1695 rInf.SetFull(true);
1696 CalcFlyWidth( rInf );
1697 return pPor;
1698 }
1699 cChar = rInf.GetChar( rInf.GetIdx() );
1700 }
1701
1702 switch( cChar )
1703 {
1704 case CH_TAB:
1705 pPor = NewTabPortion( rInf, false ); break;
1706
1707 case CH_BREAK:
1708 {
1709 SwTextAttr* pHint = GetAttr(rInf.GetIdx());
1710 pPor = new SwBreakPortion(*rInf.GetLast(), pHint);
1711 break;
1712 }
1713
1714 case CHAR_SOFTHYPHEN: // soft hyphen
1715 pPor = new SwSoftHyphPortion; break;
1716
1717 case CHAR_HARDBLANK: // no-break space
1718 // Please check tdf#115067 if you want to edit the char
1719 pPor = new SwBlankPortion( cChar ); break;
1720
1721 case CHAR_HARDHYPHEN: // non-breaking hyphen
1722 pPor = new SwBlankPortion( '-' ); break;
1723
1724 case CHAR_ZWSP: // zero width space
1725 case CHAR_WJ : // word joiner
1726 pPor = new SwControlCharPortion( cChar ); break;
1727
1729 case CH_TXTATR_INWORD:
1730 if( rInf.HasHint( rInf.GetIdx() ) )
1731 {
1732 pPor = NewExtraPortion( rInf );
1733 break;
1734 }
1735 [[fallthrough]];
1736 default :
1737 {
1738 SwTabPortion* pLastTabPortion = rInf.GetLastTab();
1739 if ( pLastTabPortion && cChar == rInf.GetTabDecimal() )
1740 {
1741 // Abandon dec. tab position if line is full
1742 // We have a decimal tab portion in the line and the next character has to be
1743 // aligned at the tab stop position. We store the width from the beginning of
1744 // the tab stop portion up to the portion containing the decimal separator:
1745 if (GetTextFrame()->GetDoc().getIDocumentSettingAccess().get(DocumentSettingId::TAB_COMPAT) /*rInf.GetVsh()->IsTabCompat();*/ &&
1746 PortionType::TabDecimal == pLastTabPortion->GetWhichPor() )
1747 {
1748 OSL_ENSURE( rInf.X() >= pLastTabPortion->GetFix(), "Decimal tab stop position cannot be calculated" );
1749 const sal_uInt16 nWidthOfPortionsUpToDecimalPosition = o3tl::narrowing<sal_uInt16>(rInf.X() - pLastTabPortion->GetFix() );
1750 static_cast<SwTabDecimalPortion*>(pLastTabPortion)->SetWidthOfPortionsUpToDecimalPosition( nWidthOfPortionsUpToDecimalPosition );
1751 rInf.SetTabDecimal( 0 );
1752 }
1753 else
1754 rInf.SetFull( rInf.GetLastTab()->Format( rInf ) );
1755 }
1756
1757 if( rInf.GetRest() )
1758 {
1759 if( rInf.IsFull() )
1760 {
1761 rInf.SetNewLine(true);
1762 return nullptr;
1763 }
1764 pPor = rInf.GetRest();
1765 rInf.SetRest(nullptr);
1766 }
1767 else
1768 {
1769 if( rInf.IsFull() )
1770 return nullptr;
1771 pPor = NewTextPortion( rInf );
1772 }
1773 break;
1774 }
1775 }
1776
1777 // if a portion is created despite there being a pending RestPortion,
1778 // then it is a field which has been split (e.g. because it contains a Tab)
1779 if( pPor && rInf.GetRest() )
1780 pPor->SetLen(TextFrameIndex(0));
1781
1782 // robust:
1783 if( !pPor || rInf.IsStop() )
1784 {
1785 delete pPor;
1786 return nullptr;
1787 }
1788 }
1789
1790 assert(pPor && "can only reach here with pPor existing");
1791
1792 // Special portions containing numbers (footnote anchor, footnote number,
1793 // numbering) can be contained in a rotated portion, if the user
1794 // choose a rotated character attribute.
1795 if (!m_pMulti)
1796 {
1797 if ( pPor->IsFootnotePortion() )
1798 {
1799 const SwTextFootnote* pTextFootnote = static_cast<SwFootnotePortion*>(pPor)->GetTextFootnote();
1800
1801 if ( pTextFootnote )
1802 {
1803 SwFormatFootnote& rFootnote = const_cast<SwFormatFootnote&>(pTextFootnote->GetFootnote());
1804 const SwDoc *const pDoc = &rInf.GetTextFrame()->GetDoc();
1805 const SwEndNoteInfo* pInfo;
1806 if( rFootnote.IsEndNote() )
1807 pInfo = &pDoc->GetEndNoteInfo();
1808 else
1809 pInfo = &pDoc->GetFootnoteInfo();
1810 const SwAttrSet& rSet = pInfo->GetAnchorCharFormat(const_cast<SwDoc&>(*pDoc))->GetAttrSet();
1811
1812 Degree10 nDir(0);
1814 nDir = pItem->GetValue();
1815
1816 if ( nDir )
1817 {
1818 delete pPor;
1819 pPor = new SwRotatedPortion(rInf.GetIdx() + TextFrameIndex(1),
1820 900_deg10 == nDir
1822 : DIR_TOP2BOTTOM );
1823 }
1824 }
1825 }
1826 else if ( pPor->InNumberGrp() )
1827 {
1828 const SwFont* pNumFnt = static_cast<SwFieldPortion*>(pPor)->GetFont();
1829
1830 if ( pNumFnt )
1831 {
1832 Degree10 nDir = pNumFnt->GetOrientation( rInf.GetTextFrame()->IsVertical() );
1833 if ( nDir )
1834 {
1835 delete pPor;
1836 pPor = new SwRotatedPortion(TextFrameIndex(0), 900_deg10 == nDir
1838 : DIR_TOP2BOTTOM );
1839
1840 rInf.SetNumDone( false );
1841 rInf.SetFootnoteDone( false );
1842 }
1843 }
1844 }
1845 }
1846
1847 // The font is set in output device,
1848 // the ascent and the height will be calculated.
1849 if( !pPor->GetAscent() && !pPor->Height() )
1850 CalcAscent( rInf, pPor );
1851 rInf.SetLen( pPor->GetLen() );
1852
1853 // In CalcFlyWidth Width() will be shortened if a FlyPortion is present.
1854 CalcFlyWidth( rInf );
1855
1856 // One must not forget that pCurr as GetLast() must provide reasonable values:
1857 if( !m_pCurr->Height() )
1858 {
1859 OSL_ENSURE( m_pCurr->Height(), "SwTextFormatter::NewPortion: limbo dance" );
1860 m_pCurr->Height( pPor->Height(), false );
1861 m_pCurr->SetAscent( pPor->GetAscent() );
1862 }
1863
1864 OSL_ENSURE(pPor->Height(), "SwTextFormatter::NewPortion: something went wrong");
1865 if( pPor->IsPostItsPortion() && rInf.X() >= rInf.Width() && rInf.GetFly() )
1866 {
1867 delete pPor;
1868 pPor = rInf.GetFly();
1869 }
1870 return pPor;
1871}
1872
1874{
1875 OSL_ENSURE( ! m_pFrame->IsVertical() || m_pFrame->IsSwapped(),
1876 "SwTextFormatter::FormatLine( nStartPos ) with unswapped frame" );
1877
1878 // For the formatting routines, we set pOut to the reference device.
1879 SwHookOut aHook( GetInfo() );
1880 if (GetInfo().GetLen() < TextFrameIndex(GetInfo().GetText().getLength()))
1881 GetInfo().SetLen(TextFrameIndex(GetInfo().GetText().getLength()));
1882
1883 bool bBuild = true;
1884 SetFlyInCntBase( false );
1885 GetInfo().SetLineHeight( 0 );
1887
1888 // Recycling must be suppressed by changed line height and also
1889 // by changed ascent (lowering of baseline).
1890 const SwTwips nOldHeight = m_pCurr->Height();
1891 const SwTwips nOldAscent = m_pCurr->GetAscent();
1892
1893 m_pCurr->SetEndHyph( false );
1894 m_pCurr->SetMidHyph( false );
1895
1896 // fly positioning can make it necessary format a line several times
1897 // for this, we have to keep a copy of our rest portion
1898 SwLinePortion* pField = GetInfo().GetRest();
1899 std::unique_ptr<SwFieldPortion> xSaveField;
1900
1901 if ( pField && pField->InFieldGrp() && !pField->IsFootnotePortion() )
1902 xSaveField.reset(new SwFieldPortion( *static_cast<SwFieldPortion*>(pField) ));
1903
1904 // for an optimal repaint rectangle, we want to compare fly portions
1905 // before and after the BuildPortions call
1906 const bool bOptimizeRepaint = AllowRepaintOpt();
1907 TextFrameIndex const nOldLineEnd = nStartPos + m_pCurr->GetLen();
1908 std::vector<tools::Long> flyStarts;
1909
1910 // these are the conditions for a fly position comparison
1911 if ( bOptimizeRepaint && m_pCurr->IsFly() )
1912 {
1914 tools::Long nPOfst = 0;
1915 while ( pPor )
1916 {
1917 if ( pPor->IsFlyPortion() )
1918 // insert start value of fly portion
1919 flyStarts.push_back( nPOfst );
1920
1921 nPOfst += pPor->Width();
1922 pPor = pPor->GetNextPortion();
1923 }
1924 }
1925
1926 // Here soon the underflow check follows.
1927 while( bBuild )
1928 {
1929 GetInfo().SetFootnoteInside( false );
1931
1932 // These values must not be reset by FormatReset();
1933 const bool bOldNumDone = GetInfo().IsNumDone();
1934 const bool bOldFootnoteDone = GetInfo().IsFootnoteDone();
1935 const bool bOldArrowDone = GetInfo().IsArrowDone();
1936 const bool bOldErgoDone = GetInfo().IsErgoDone();
1937
1938 // besides other things, this sets the repaint offset to 0
1939 FormatReset( GetInfo() );
1940
1941 GetInfo().SetNumDone( bOldNumDone );
1942 GetInfo().SetFootnoteDone(bOldFootnoteDone);
1943 GetInfo().SetArrowDone( bOldArrowDone );
1944 GetInfo().SetErgoDone( bOldErgoDone );
1945
1946 // build new portions for this line
1948
1949 if( GetInfo().IsStop() )
1950 {
1952 m_pCurr->Height( GetFrameRstHeight() + 1, false );
1954
1955 // Don't oversize the line in case of split flys, so we don't try to move the anchor
1956 // of a precede fly forward, next to its follow.
1958 {
1960 }
1961
1962 m_pCurr->Width(0);
1963 m_pCurr->Truncate();
1964 return nStartPos;
1965 }
1966 else if( GetInfo().IsDropInit() )
1967 {
1968 DropInit();
1969 GetInfo().SetDropInit( false );
1970 }
1971
1972 m_pCurr->CalcLine( *this, GetInfo() );
1974
1975 //i#120864 For Special case that at the first calculation couldn't get
1976 //correct height. And need to recalculate for the right height.
1977 SwLinePortion* pPorTmp = m_pCurr->GetNextPortion();
1978 if ( IsFlyInCntBase() && (!IsQuick() || (pPorTmp && pPorTmp->IsFlyCntPortion() && !pPorTmp->GetNextPortion() &&
1979 m_pCurr->Height() > pPorTmp->Height())))
1980 {
1981 SwTwips nTmpAscent, nTmpHeight;
1982 CalcAscentAndHeight( nTmpAscent, nTmpHeight );
1983 AlignFlyInCntBase( Y() + tools::Long( nTmpAscent ) );
1984 m_pCurr->CalcLine( *this, GetInfo() );
1986 }
1987
1988 // bBuild decides if another lap of honor is done
1990 {
1992 bBuild = false;
1993 }
1994 else
1995 {
1996 bBuild = ( GetInfo().GetTextFly().IsOn() && ChkFlyUnderflow(GetInfo()) )
1998 if( bBuild )
1999 {
2000 // fdo44018-2.doc: only restore m_bNumDone if a SwNumberPortion will be truncated
2001 for (SwLinePortion * pPor = m_pCurr->GetNextPortion(); pPor; pPor = pPor->GetNextPortion())
2002 {
2003 if (pPor->InNumberGrp())
2004 {
2005 GetInfo().SetNumDone( bOldNumDone );
2006 break;
2007 }
2008 }
2010
2011 // delete old rest
2012 if ( GetInfo().GetRest() )
2013 {
2014 delete GetInfo().GetRest();
2015 GetInfo().SetRest( nullptr );
2016 }
2017
2018 // set original rest portion
2019 if ( xSaveField )
2020 GetInfo().SetRest( new SwFieldPortion( *xSaveField ) );
2021
2023 m_pCurr->Width(0);
2024 m_pCurr->Truncate();
2025 }
2026 }
2027 }
2028
2029 // In case of compat mode, it's possible that a tab portion is wider after
2030 // formatting than before. If this is the case, we also have to make sure
2031 // the SwLineLayout is wider as well.
2032 if (GetInfo().GetTextFrame()->GetDoc().getIDocumentSettingAccess().get(DocumentSettingId::TAB_OVER_MARGIN))
2033 {
2034 sal_uInt16 nSum = 0;
2036
2037 while (pPor)
2038 {
2039 nSum += pPor->Width();
2040 pPor = pPor->GetNextPortion();
2041 }
2042
2043 if (nSum > m_pCurr->Width())
2044 m_pCurr->Width(nSum);
2045 }
2046
2047 // calculate optimal repaint rectangle
2048 if ( bOptimizeRepaint )
2049 {
2050 GetInfo().SetPaintOfst( ::lcl_CalcOptRepaint( *this, *m_pCurr, nOldLineEnd, flyStarts ) );
2051 flyStarts.clear();
2052 }
2053 else
2054 // Special case: we do not allow an optimization of the repaint
2055 // area, but during formatting the repaint offset is set to indicate
2056 // a maximum value for the offset. This value has to be reset:
2057 GetInfo().SetPaintOfst( 0 );
2058
2059 // This corrects the start of the reformat range if something has
2060 // moved to the next line. Otherwise IsFirstReformat in AllowRepaintOpt
2061 // will give us a wrong result if we have to reformat another line
2062 GetInfo().GetParaPortion()->GetReformat().LeftMove( GetInfo().GetIdx() );
2063
2064 // delete master copy of rest portion
2065 xSaveField.reset();
2066
2067 TextFrameIndex const nNewStart = nStartPos + m_pCurr->GetLen();
2068
2069 // adjust text if kana compression is enabled
2070 if ( GetInfo().CompressLine() )
2071 {
2072 SwTwips nRepaintOfst = CalcKanaAdj( m_pCurr );
2073
2074 // adjust repaint offset
2075 if ( nRepaintOfst < GetInfo().GetPaintOfst() )
2076 GetInfo().SetPaintOfst( nRepaintOfst );
2077 }
2078
2080
2081 if( nOldHeight != m_pCurr->Height() || nOldAscent != m_pCurr->GetAscent() )
2082 {
2084 GetInfo().SetPaintOfst( 0 ); // changed line height => no recycling
2085 // all following line must be painted and when Flys are around,
2086 // also formatted
2087 GetInfo().SetShift( true );
2088 }
2089
2090 if ( IsFlyInCntBase() && !IsQuick() )
2092
2093 return nNewStart;
2094}
2095
2097{
2098 do
2099 {
2101 } while (Next());
2102}
2103
2105{
2106 SwTwips nLineHeight = m_pCurr->Height();
2107 m_pCurr->SetClipping( false );
2108
2109 SwTextGridItem const*const pGrid(GetGridItem(m_pFrame->FindPageFrame()));
2110 if ( pGrid && GetInfo().SnapToGrid() )
2111 {
2112 const sal_uInt16 nGridWidth = pGrid->GetBaseHeight();
2113 const sal_uInt16 nRubyHeight = pGrid->GetRubyHeight();
2114 const bool bRubyTop = ! pGrid->GetRubyTextBelow();
2115
2116 nLineHeight = nGridWidth + nRubyHeight;
2117 const sal_uInt16 nAmpRatio = (m_pCurr->Height() + nLineHeight - 1)/nLineHeight;
2118 nLineHeight *= nAmpRatio;
2119
2120 const sal_uInt16 nAsc = m_pCurr->GetAscent() +
2121 ( bRubyTop ?
2122 ( nLineHeight - m_pCurr->Height() + nRubyHeight ) / 2 :
2123 ( nLineHeight - m_pCurr->Height() - nRubyHeight ) / 2 );
2124
2125 m_pCurr->Height( nLineHeight, false );
2126 m_pCurr->SetAscent( nAsc );
2128
2129 // we ignore any line spacing options except from ...
2131 if ( ! IsParaLine() && pSpace &&
2132 SvxInterLineSpaceRule::Prop == pSpace->GetInterLineSpaceRule() )
2133 {
2134 sal_uLong nTmp = pSpace->GetPropLineSpace();
2135
2136 if( nTmp < 100 )
2137 nTmp = 100;
2138
2139 nTmp *= nLineHeight;
2140 nLineHeight = nTmp / 100;
2141 }
2142
2143 m_pCurr->SetRealHeight( nLineHeight );
2144 return;
2145 }
2146
2147 // The dummy flag is set on lines that only contain flyportions, these shouldn't
2148 // consider register-true and so on. Unfortunately an empty line can be at
2149 // the end of a paragraph (empty paragraphs or behind a Shift-Return),
2150 // which should consider the register.
2151 if (!m_pCurr->IsDummy() || (!m_pCurr->GetNext()
2152 && GetStart() >= TextFrameIndex(GetTextFrame()->GetText().getLength())
2153 && !bNewLine))
2154 {
2156 if( pSpace )
2157 {
2158 switch( pSpace->GetLineSpaceRule() )
2159 {
2160 case SvxLineSpaceRule::Auto:
2161 // shrink first line of paragraph too on spacing < 100%
2162 if (IsParaLine() &&
2163 pSpace->GetInterLineSpaceRule() == SvxInterLineSpaceRule::Prop
2165 {
2166 tools::Long nTmp = pSpace->GetPropLineSpace();
2167 // Word will render < 50% too but it's just not readable
2168 if( nTmp < 50 )
2169 nTmp = nTmp ? 50 : 100;
2170 if (nTmp<100) { // code adapted from fixed line height
2171 nTmp *= nLineHeight;
2172 nTmp /= 100;
2173 if( !nTmp )
2174 ++nTmp;
2175 nLineHeight = nTmp;
2176 sal_uInt16 nAsc = ( 4 * nLineHeight ) / 5; // 80%
2177#if 0
2178 // could do clipping here (like Word does)
2179 // but at 0.5 its unreadable either way...
2180 if( nAsc < pCurr->GetAscent() ||
2181 nLineHeight - nAsc < pCurr->Height() -
2182 pCurr->GetAscent() )
2183 pCurr->SetClipping( true );
2184#endif
2185 m_pCurr->SetAscent( nAsc );
2186 m_pCurr->Height( nLineHeight, false );
2188 }
2189 }
2190 break;
2191 case SvxLineSpaceRule::Min:
2192 {
2193 if( nLineHeight < pSpace->GetLineHeight() )
2194 nLineHeight = pSpace->GetLineHeight();
2195 break;
2196 }
2197 case SvxLineSpaceRule::Fix:
2198 {
2199 nLineHeight = pSpace->GetLineHeight();
2200 const sal_uInt16 nAsc = ( 4 * nLineHeight ) / 5; // 80%
2201 if( nAsc < m_pCurr->GetAscent() ||
2202 nLineHeight - nAsc < m_pCurr->Height() - m_pCurr->GetAscent() )
2203 m_pCurr->SetClipping( true );
2204 m_pCurr->Height( nLineHeight, false );
2205 m_pCurr->SetAscent( nAsc );
2207 }
2208 break;
2209 default: OSL_FAIL( ": unknown LineSpaceRule" );
2210 }
2211 // Note: for the _first_ line the line spacing of the previous
2212 // paragraph is applied in SwFlowFrame::CalcUpperSpace()
2213 if( !IsParaLine() )
2214 switch( pSpace->GetInterLineSpaceRule() )
2215 {
2216 case SvxInterLineSpaceRule::Off:
2217 break;
2218 case SvxInterLineSpaceRule::Prop:
2219 {
2220 tools::Long nTmp = pSpace->GetPropLineSpace();
2221 // 50% is the minimum, if 0% we switch to the
2222 // default value 100% ...
2223 if( nTmp < 50 )
2224 nTmp = nTmp ? 50 : 100;
2225
2226 // extend line height by (nPropLineSpace - 100) percent of the font height
2227 nTmp -= 100;
2228 nTmp *= m_pCurr->GetTextHeight();
2229 nTmp /= 100;
2230 nTmp += nLineHeight;
2231 if (nTmp < 1)
2232 nTmp = 1;
2233 nLineHeight = nTmp;
2234 break;
2235 }
2236 case SvxInterLineSpaceRule::Fix:
2237 {
2238 nLineHeight = nLineHeight + pSpace->GetInterLineSpace();
2239 break;
2240 }
2241 default: OSL_FAIL( ": unknown InterLineSpaceRule" );
2242 }
2243 }
2244
2245 if( IsRegisterOn() )
2246 {
2247 SwTwips nTmpY = Y() + m_pCurr->GetAscent() + nLineHeight - m_pCurr->Height();
2248 SwRectFnSet aRectFnSet(m_pFrame);
2249 if ( aRectFnSet.IsVert() )
2250 nTmpY = m_pFrame->SwitchHorizontalToVertical( nTmpY );
2251 nTmpY = aRectFnSet.YDiff( nTmpY, RegStart() );
2252 const sal_uInt16 nDiff = sal_uInt16( nTmpY % RegDiff() );
2253 if( nDiff )
2254 nLineHeight += RegDiff() - nDiff;
2255 }
2256 }
2257 m_pCurr->SetRealHeight( nLineHeight );
2258}
2259
2261{
2262 // delete Fly in any case!
2263 ClearFly( rInf );
2264 rInf.Init();
2265
2266 rInf.ChkNoHyph( CntEndHyph(), CntMidHyph() );
2267 rInf.SetRoot( m_pCurr );
2268 rInf.SetLineStart( m_nStart );
2269 rInf.SetIdx( m_nStart );
2270 rInf.Left( Left() );
2271 rInf.Right( Right() );
2272 rInf.First( FirstLeft() );
2273 rInf.LeftMargin(GetLeftMargin());
2274
2275 rInf.RealWidth( sal_uInt16(rInf.Right() - GetLeftMargin()) );
2276 rInf.Width( rInf.RealWidth() );
2277 if( const_cast<SwTextFormatter*>(this)->GetRedln() )
2278 {
2279 const_cast<SwTextFormatter*>(this)->GetRedln()->Clear( const_cast<SwTextFormatter*>(this)->GetFnt() );
2280 const_cast<SwTextFormatter*>(this)->GetRedln()->Reset();
2281 }
2282}
2283
2285{
2286 m_pFirstOfBorderMerge = nullptr;
2287 m_pCurr->Truncate();
2288 m_pCurr->Init();
2289
2290 // delete pSpaceAdd and pKanaComp
2294 FeedInf( rInf );
2295}
2296
2298{
2299 if( m_pDropFormat )
2300 {
2301 const sal_uInt16 nOldDrop = GetDropHeight();
2303 m_bOnceMore = nOldDrop != GetDropHeight();
2304 }
2305 else
2306 m_bOnceMore = false;
2307 return m_bOnceMore;
2308}
2309
2311{
2312 SwTwips nRet = Y() + GetLineHeight();
2314 if( nMin && ++nMin > nRet )
2315 {
2318 if( nRet + nDist < nMin )
2319 {
2320 const bool bRepaint = HasTruncLines() &&
2321 GetInfo().GetParaPortion()->GetRepaint().Bottom() == nRet-1;
2322 nRet = nMin - nDist;
2323 if( bRepaint )
2324 {
2325 const_cast<SwRepaint&>(GetInfo().GetParaPortion()
2326 ->GetRepaint()).Bottom( nRet-1 );
2327 const_cast<SwTextFormatInfo&>(GetInfo()).SetPaintOfst( 0 );
2328 }
2329 }
2330 }
2331 return nRet;
2332}
2333
2334// FME/OD: This routine does a limited text formatting.
2336{
2337 FormatReset( GetInfo() );
2339 m_pCurr->CalcLine( *this, GetInfo() );
2340 return m_pCurr->Width();
2341}
2342
2343// determines if the calculation of a repaint offset is allowed
2344// otherwise each line is painted from 0 (this is a copy of the beginning
2345// of the former SwTextFormatter::Recycle() function
2347{
2348 // reformat position in front of current line? Only in this case
2349 // we want to set the repaint offset
2350 bool bOptimizeRepaint = m_nStart < GetInfo().GetReformatStart() &&
2351 m_pCurr->GetLen();
2352
2353 // a special case is the last line of a block adjusted paragraph:
2354 if ( bOptimizeRepaint )
2355 {
2356 switch( GetAdjust() )
2357 {
2358 case SvxAdjust::Block:
2359 {
2360 if( IsLastBlock() || IsLastCenter() )
2361 bOptimizeRepaint = false;
2362 else
2363 {
2364 // ????: blank in the last master line (blocksat.sdw)
2365 bOptimizeRepaint = nullptr == m_pCurr->GetNext() && !m_pFrame->GetFollow();
2366 if ( bOptimizeRepaint )
2367 {
2369 while ( pPos && !pPos->IsFlyPortion() )
2370 pPos = pPos->GetNextPortion();
2371 bOptimizeRepaint = !pPos;
2372 }
2373 }
2374 break;
2375 }
2376 case SvxAdjust::Center:
2377 case SvxAdjust::Right:
2378 bOptimizeRepaint = false;
2379 break;
2380 default: ;
2381 }
2382 }
2383
2384 // Again another special case: invisible SoftHyphs
2385 const TextFrameIndex nReformat = GetInfo().GetReformatStart();
2386 if (bOptimizeRepaint && TextFrameIndex(COMPLETE_STRING) != nReformat)
2387 {
2388 const sal_Unicode cCh = nReformat >= TextFrameIndex(GetInfo().GetText().getLength())
2389 ? 0
2390 : GetInfo().GetText()[ sal_Int32(nReformat) ];
2391 bOptimizeRepaint = ( CH_TXTATR_BREAKWORD != cCh && CH_TXTATR_INWORD != cCh )
2392 || ! GetInfo().HasHint( nReformat );
2393 }
2394
2395 return bOptimizeRepaint;
2396}
2397
2399{
2400 OSL_ENSURE( ! m_pFrame->IsVertical() || m_pFrame->IsSwapped(),
2401 "SwTextFormatter::CalcUnclipped with unswapped frame" );
2402
2403 SwTwips nFlyAsc, nFlyDesc;
2404 m_pCurr->MaxAscentDescent( rTop, rBottom, nFlyAsc, nFlyDesc );
2405 rTop = Y() + GetCurr()->GetAscent();
2406 rBottom = rTop + nFlyDesc;
2407 rTop -= nFlyAsc;
2408}
2409
2410void SwTextFormatter::UpdatePos( SwLineLayout *pCurrent, Point aStart,
2411 TextFrameIndex const nStartIdx, bool bAlways) const
2412{
2413 OSL_ENSURE( ! m_pFrame->IsVertical() || m_pFrame->IsSwapped(),
2414 "SwTextFormatter::UpdatePos with unswapped frame" );
2415
2416 if( GetInfo().IsTest() )
2417 return;
2418 SwLinePortion *pFirst = pCurrent->GetFirstPortion();
2419 SwLinePortion *pPos = pFirst;
2420 SwTextPaintInfo aTmpInf( GetInfo() );
2421 aTmpInf.SetpSpaceAdd( pCurrent->GetpLLSpaceAdd() );
2422 aTmpInf.ResetSpaceIdx();
2423 aTmpInf.SetKanaComp( pCurrent->GetpKanaComp() );
2424 aTmpInf.ResetKanaIdx();
2425
2426 // The frame's size
2427 aTmpInf.SetIdx( nStartIdx );
2428 aTmpInf.SetPos( aStart );
2429
2430 SwTwips nTmpAscent, nTmpDescent, nFlyAsc, nFlyDesc;
2431 pCurrent->MaxAscentDescent( nTmpAscent, nTmpDescent, nFlyAsc, nFlyDesc );
2432
2433 const SwTwips nTmpHeight = pCurrent->GetRealHeight();
2434 SwTwips nAscent = pCurrent->GetAscent() + nTmpHeight - pCurrent->Height();
2436 if( GetMulti() )
2437 {
2438 aTmpInf.SetDirection( GetMulti()->GetDirection() );
2439 if( GetMulti()->HasRotation() )
2440 {
2441 nFlags |= AsCharFlags::Rotate;
2442 if( GetMulti()->IsRevers() )
2443 {
2444 nFlags |= AsCharFlags::Reverse;
2445 aTmpInf.X( aTmpInf.X() - nAscent );
2446 }
2447 else
2448 aTmpInf.X( aTmpInf.X() + nAscent );
2449 }
2450 else
2451 {
2452 if ( GetMulti()->IsBidi() )
2453 nFlags |= AsCharFlags::Bidi;
2454 aTmpInf.Y( aTmpInf.Y() + nAscent );
2455 }
2456 }
2457 else
2458 aTmpInf.Y( aTmpInf.Y() + nAscent );
2459
2460 while( pPos )
2461 {
2462 // We only know one case where changing the position (caused by the
2463 // adjustment) could be relevant for a portion: We need to SetRefPoint
2464 // for FlyCntPortions.
2465 if( ( pPos->IsFlyCntPortion() || pPos->IsGrfNumPortion() )
2466 && ( bAlways || !IsQuick() ) )
2467 {
2468 pCurrent->MaxAscentDescent( nTmpAscent, nTmpDescent, nFlyAsc, nFlyDesc, pPos );
2469
2470 if( pPos->IsGrfNumPortion() )
2471 {
2472 if( !nFlyAsc && !nFlyDesc )
2473 {
2474 nTmpAscent = nAscent;
2475 nFlyAsc = nAscent;
2476 nTmpDescent = nTmpHeight - nAscent;
2477 nFlyDesc = nTmpDescent;
2478 }
2479 static_cast<SwGrfNumPortion*>(pPos)->SetBase( nTmpAscent, nTmpDescent,
2480 nFlyAsc, nFlyDesc );
2481 }
2482 else
2483 {
2484 Point aBase( aTmpInf.GetPos() );
2485 if ( GetInfo().GetTextFrame()->IsVertical() )
2487
2488 static_cast<SwFlyCntPortion*>(pPos)->SetBase( *aTmpInf.GetTextFrame(),
2489 aBase, nTmpAscent, nTmpDescent, nFlyAsc,
2490 nFlyDesc, nFlags );
2491 }
2492 }
2493 if( pPos->IsMultiPortion() && static_cast<SwMultiPortion*>(pPos)->HasFlyInContent() )
2494 {
2495 OSL_ENSURE( !GetMulti(), "Too much multi" );
2496 const_cast<SwTextFormatter*>(this)->m_pMulti = static_cast<SwMultiPortion*>(pPos);
2497 SwLineLayout *pLay = &GetMulti()->GetRoot();
2498 Point aSt( aTmpInf.X(), aStart.Y() );
2499
2500 if ( GetMulti()->HasBrackets() )
2501 {
2502 OSL_ENSURE( GetMulti()->IsDouble(), "Brackets only for doubles");
2503 aSt.AdjustX(static_cast<SwDoubleLinePortion*>(GetMulti())->PreWidth() );
2504 }
2505 else if( GetMulti()->HasRotation() )
2506 {
2507 aSt.AdjustY(pCurrent->GetAscent() - GetMulti()->GetAscent() );
2508 if( GetMulti()->IsRevers() )
2509 aSt.AdjustX(GetMulti()->Width() );
2510 else
2511 aSt.AdjustY(GetMulti()->Height() );
2512 }
2513 else if ( GetMulti()->IsBidi() )
2514 // jump to end of the bidi portion
2515 aSt.AdjustX(pLay->Width() );
2516
2517 TextFrameIndex nStIdx = aTmpInf.GetIdx();
2518 do
2519 {
2520 UpdatePos( pLay, aSt, nStIdx, bAlways );
2521 nStIdx = nStIdx + pLay->GetLen();
2522 aSt.AdjustY(pLay->Height() );
2523 pLay = pLay->GetNext();
2524 } while ( pLay );
2525 const_cast<SwTextFormatter*>(this)->m_pMulti = nullptr;
2526 }
2527 pPos->Move( aTmpInf );
2528 pPos = pPos->GetNextPortion();
2529 }
2530}
2531
2533{
2534 OSL_ENSURE( ! m_pFrame->IsVertical() || m_pFrame->IsSwapped(),
2535 "SwTextFormatter::AlignFlyInCntBase with unswapped frame" );
2536
2537 if( GetInfo().IsTest() )
2538 return;
2540 SwLinePortion *pPos = pFirst;
2542 if( GetMulti() && GetMulti()->HasRotation() )
2543 {
2544 nFlags |= AsCharFlags::Rotate;
2545 if( GetMulti()->IsRevers() )
2546 nFlags |= AsCharFlags::Reverse;
2547 }
2548
2549 SwTwips nTmpAscent, nTmpDescent, nFlyAsc, nFlyDesc;
2550
2551 while( pPos )
2552 {
2553 if( pPos->IsFlyCntPortion() || pPos->IsGrfNumPortion() )
2554 {
2555 m_pCurr->MaxAscentDescent( nTmpAscent, nTmpDescent, nFlyAsc, nFlyDesc, pPos );
2556
2557 if( pPos->IsGrfNumPortion() )
2558 static_cast<SwGrfNumPortion*>(pPos)->SetBase( nTmpAscent, nTmpDescent,
2559 nFlyAsc, nFlyDesc );
2560 else
2561 {
2562 Point aBase;
2563 if ( GetInfo().GetTextFrame()->IsVertical() )
2564 {
2565 nBaseLine = GetInfo().GetTextFrame()->SwitchHorizontalToVertical( nBaseLine );
2566 aBase = Point( nBaseLine, static_cast<SwFlyCntPortion*>(pPos)->GetRefPoint().Y() );
2567 }
2568 else
2569 aBase = Point( static_cast<SwFlyCntPortion*>(pPos)->GetRefPoint().X(), nBaseLine );
2570
2571 static_cast<SwFlyCntPortion*>(pPos)->SetBase( *GetInfo().GetTextFrame(), aBase, nTmpAscent, nTmpDescent,
2572 nFlyAsc, nFlyDesc, nFlags );
2573 }
2574 }
2575 pPos = pPos->GetNextPortion();
2576 }
2577}
2578
2580{
2581 OSL_ENSURE( rInf.GetTextFly().IsOn(), "SwTextFormatter::ChkFlyUnderflow: why?" );
2582 if( GetCurr() )
2583 {
2584 // First we check, whether a fly overlaps with the line.
2585 // = GetLineHeight()
2586 const sal_uInt16 nHeight = GetCurr()->GetRealHeight();
2587 SwRect aLine( GetLeftMargin(), Y(), rInf.RealWidth(), nHeight );
2588
2589 SwRect aLineVert( aLine );
2590 if ( m_pFrame->IsVertical() )
2592 SwRect aInter( rInf.GetTextFly().GetFrame( aLineVert ) );
2593 if ( m_pFrame->IsVertical() )
2595
2596 if( !aInter.HasArea() )
2597 return false;
2598
2599 // We now check every portion that could have lowered for overlapping
2600 // with the fly.
2601 const SwLinePortion *pPos = GetCurr()->GetFirstPortion();
2602 aLine.Pos().setY( Y() + GetCurr()->GetRealHeight() - GetCurr()->Height() );
2603 aLine.Height( GetCurr()->Height() );
2604
2605 while( pPos )
2606 {
2607 aLine.Width( pPos->Width() );
2608
2609 aLineVert = aLine;
2610 if ( m_pFrame->IsVertical() )
2612 aInter = rInf.GetTextFly().GetFrame( aLineVert );
2613 if ( m_pFrame->IsVertical() )
2615
2616 // New flys from below?
2617 if( !pPos->IsFlyPortion() )
2618 {
2619 if( aInter.Overlaps( aLine ) )
2620 {
2621 aInter.Intersection_( aLine );
2622 if( aInter.HasArea() )
2623 {
2624 // To be evaluated during reformat of this line:
2625 // RealHeight including spacing
2626 rInf.SetLineHeight( nHeight );
2627 // Height without extra spacing
2628 rInf.SetLineNetHeight( m_pCurr->Height() );
2629 return true;
2630 }
2631 }
2632 }
2633 else
2634 {
2635 // The fly portion is not intersected by a fly anymore
2636 if ( ! aInter.Overlaps( aLine ) )
2637 {
2638 rInf.SetLineHeight( nHeight );
2639 rInf.SetLineNetHeight( m_pCurr->Height() );
2640 return true;
2641 }
2642 else
2643 {
2644 aInter.Intersection_( aLine );
2645
2646 // No area means a fly has become invalid because of
2647 // lowering the line => reformat the line
2648 // we also have to reformat the line, if the fly size
2649 // differs from the intersection interval's size.
2650 if( ! aInter.HasArea() ||
2651 static_cast<const SwFlyPortion*>(pPos)->GetFixWidth() != aInter.Width() )
2652 {
2653 rInf.SetLineHeight( nHeight );
2654 rInf.SetLineNetHeight( m_pCurr->Height() );
2655 return true;
2656 }
2657 }
2658 }
2659
2660 aLine.Left( aLine.Left() + pPos->Width() );
2661 pPos = pPos->GetNextPortion();
2662 }
2663 }
2664 return false;
2665}
2666
2668{
2669 if( GetMulti() || rInf.GetFly() )
2670 return;
2671
2672 SwTextFly& rTextFly = rInf.GetTextFly();
2673 if( !rTextFly.IsOn() || rInf.IsIgnoreFly() )
2674 return;
2675
2676 const SwLinePortion *pLast = rInf.GetLast();
2677
2678 tools::Long nAscent;
2679 tools::Long nTop = Y();
2680 tools::Long nHeight;
2681
2682 if( rInf.GetLineHeight() )
2683 {
2684 // Real line height has already been calculated, we only have to
2685 // search for intersections in the lower part of the strip
2686 nAscent = m_pCurr->GetAscent();
2687 nHeight = rInf.GetLineNetHeight();
2688 nTop += rInf.GetLineHeight() - nHeight;
2689 }
2690 else
2691 {
2692 // We make a first guess for the lines real height
2693 if ( ! m_pCurr->GetRealHeight() )
2695
2696 nAscent = pLast->GetAscent();
2697 nHeight = pLast->Height();
2698
2699 if ( m_pCurr->GetRealHeight() > nHeight )
2700 nTop += m_pCurr->GetRealHeight() - nHeight;
2701 else
2702 // Important for fixed space between lines
2703 nHeight = m_pCurr->GetRealHeight();
2704 }
2705
2706 const tools::Long nLeftMar = GetLeftMargin();
2707 const tools::Long nLeftMin = (rInf.X() || GetDropLeft()) ? nLeftMar : GetLeftMin();
2708
2709 SwRect aLine( rInf.X() + nLeftMin, nTop, rInf.RealWidth() - rInf.X()
2710 + nLeftMar - nLeftMin , nHeight );
2711
2712 // tdf#116486: consider also the upper margin from getFramePrintArea because intersections
2713 // with this additional space should lead to repositioning of paragraphs
2714 // For compatibility we grab a related compat flag:
2715 if (GetTextFrame()->GetDoc().getIDocumentSettingAccess().get(DocumentSettingId::ADD_VERTICAL_FLY_OFFSETS)
2716 && IsFirstTextLine())
2717 {
2718 const tools::Long nUpper = m_pFrame->getFramePrintArea().Top();
2719 // Increase the rectangle
2720 if( nUpper > 0 && nTop >= nUpper )
2721 aLine.SubTop( nUpper );
2722 }
2723 SwRect aLineVert( aLine );
2724 if ( m_pFrame->IsRightToLeft() )
2725 m_pFrame->SwitchLTRtoRTL( aLineVert );
2726
2727 if ( m_pFrame->IsVertical() )
2729
2730 // GetFrame(...) determines and returns the intersection rectangle
2731 SwRect aInter( rTextFly.GetFrame( aLineVert ) );
2732
2733 if ( m_pFrame->IsRightToLeft() )
2734 m_pFrame->SwitchRTLtoLTR( aInter );
2735
2736 if ( m_pFrame->IsVertical() )
2738
2739 if (!aInter.IsEmpty() && aInter.Bottom() < nTop)
2740 {
2741 // Intersects with the frame area (with upper margin), but not with the print area (without
2742 // upper margin). Don't reserve space for the fly portion in this case, text is allowed to
2743 // flow there.
2744 aInter.Height(0);
2745 }
2746
2747 if( !aInter.Overlaps( aLine ) )
2748 return;
2749
2750 aLine.Left( rInf.X() + nLeftMar );
2751 bool bForced = false;
2752 if( aInter.Left() <= nLeftMin )
2753 {
2754 SwTwips nFrameLeft = GetTextFrame()->getFrameArea().Left();
2755 if( GetTextFrame()->getFramePrintArea().Left() < 0 )
2756 nFrameLeft += GetTextFrame()->getFramePrintArea().Left();
2757 if( aInter.Left() < nFrameLeft )
2758 aInter.Left(nFrameLeft); // both sets left and reduces width
2759
2760 tools::Long nAddMar = 0;
2761 if (GetTextFrame()->IsRightToLeft())
2762 {
2763 nAddMar = GetTextFrame()->getFrameArea().Right() - Right();
2764 if ( nAddMar < 0 )
2765 nAddMar = 0;
2766 }
2767 else
2768 nAddMar = nLeftMar - nFrameLeft;
2769
2770 aInter.Width( aInter.Width() + nAddMar );
2771 // For a negative first line indent, we set this flag to show
2772 // that the indentation/margin has been moved.
2773 // This needs to be respected by the DefaultTab at the zero position.
2774 if( IsFirstTextLine() && HasNegFirst() )
2775 bForced = true;
2776 }
2777 aInter.Intersection( aLine );
2778 if( !aInter.HasArea() )
2779 return;
2780
2781 const bool bFullLine = aLine.Left() == aInter.Left() &&
2782 aLine.Right() == aInter.Right();
2783
2784 // Although no text is left, we need to format another line,
2785 // because also empty lines need to avoid a Fly with no wrapping.
2786 if (bFullLine && rInf.GetIdx() == TextFrameIndex(rInf.GetText().getLength()))
2787 {
2788 rInf.SetNewLine( true );
2789 // We know that for dummies, it holds ascent == height
2790 m_pCurr->SetDummy(true);
2791 }
2792
2793 // aInter becomes frame-local
2794 aInter.Pos().AdjustX( -nLeftMar );
2795 SwFlyPortion *pFly = new SwFlyPortion( aInter );
2796 if( bForced )
2797 {
2799 rInf.ForcedLeftMargin( o3tl::narrowing<sal_uInt16>(aInter.Width()) );
2800 }
2801
2802 if( bFullLine )
2803 {
2804 // In order to properly flow around Flys with different
2805 // wrapping attributes, we need to increase by units of line height.
2806 // The last avoiding line should be adjusted in height, so that
2807 // we don't get a frame spacing effect.
2808 // It is important that ascent == height, because the FlyPortion
2809 // values are transferred to pCurr in CalcLine and IsDummy() relies
2810 // on this behaviour.
2811 // To my knowledge we only have two places where DummyLines can be
2812 // created: here and in MakeFlyDummies.
2813 // IsDummy() is evaluated in IsFirstTextLine(), when moving lines
2814 // and in relation with DropCaps.
2815 pFly->Height( aInter.Height() );
2816
2817 // nNextTop now contains the margin's bottom edge, which we avoid
2818 // or the next margin's top edge, which we need to respect.
2819 // That means we can comfortably grow up to this value; that's how
2820 // we save a few empty lines.
2821 tools::Long nNextTop = rTextFly.GetNextTop();
2822 if ( m_pFrame->IsVertical() )
2823 nNextTop = m_pFrame->SwitchVerticalToHorizontal( nNextTop );
2824 if( nNextTop > aInter.Bottom() )
2825 {
2826 SwTwips nH = nNextTop - aInter.Top();
2827 if( nH < SAL_MAX_UINT16 )
2828 pFly->Height( nH );
2829 }
2830 if( nAscent < pFly->Height() )
2831 pFly->SetAscent( nAscent );
2832 else
2833 pFly->SetAscent( pFly->Height() );
2834 }
2835 else
2836 {
2837 if (rInf.GetIdx() == TextFrameIndex(rInf.GetText().getLength()))
2838 {
2839 // Don't use nHeight, or we have a huge descent
2840 pFly->Height( pLast->Height() );
2841 pFly->SetAscent( pLast->GetAscent() );
2842 }
2843 else
2844 {
2845 pFly->Height( aInter.Height() );
2846 if( nAscent < pFly->Height() )
2847 pFly->SetAscent( nAscent );
2848 else
2849 pFly->SetAscent( pFly->Height() );
2850 }
2851 }
2852
2853 rInf.SetFly( pFly );
2854
2855 if( pFly->GetFix() < rInf.Width() )
2856 rInf.Width( pFly->GetFix() );
2857
2858 SwTextGridItem const*const pGrid(GetGridItem(m_pFrame->FindPageFrame()));
2859 if ( !pGrid )
2860 return;
2861
2862 const SwPageFrame* pPageFrame = m_pFrame->FindPageFrame();
2863 const SwLayoutFrame* pBody = pPageFrame->FindBodyCont();
2864
2865 SwRectFnSet aRectFnSet(pPageFrame);
2866
2867 const tools::Long nGridOrigin = pBody ?
2868 aRectFnSet.GetPrtLeft(*pBody) :
2869 aRectFnSet.GetPrtLeft(*pPageFrame);
2870
2871 const SwDoc & rDoc = rInf.GetTextFrame()->GetDoc();
2872 const sal_uInt16 nGridWidth = GetGridWidth(*pGrid, rDoc);
2873
2874 SwTwips nStartX = GetLeftMargin();
2875 if ( aRectFnSet.IsVert() )
2876 {
2877 Point aPoint( nStartX, 0 );
2879 nStartX = aPoint.Y();
2880 }
2881
2882 const SwTwips nOfst = nStartX - nGridOrigin;
2883 const SwTwips nTmpWidth = rInf.Width() + nOfst;
2884
2885 const SwTwips i = nTmpWidth / nGridWidth + 1;
2886
2887 const SwTwips nNewWidth = ( i - 1 ) * nGridWidth - nOfst;
2888 if ( nNewWidth > 0 )
2889 rInf.Width( nNewWidth );
2890 else
2891 rInf.Width( 0 );
2892
2893
2894}
2895
2897 SwTextAttr *pHint ) const
2898{
2899 const SwFrame *pFrame = m_pFrame;
2900
2901 SwFlyInContentFrame *pFly;
2902 SwFrameFormat* pFrameFormat = static_cast<SwTextFlyCnt*>(pHint)->GetFlyCnt().GetFrameFormat();
2903 if( RES_FLYFRMFMT == pFrameFormat->Which() )
2904 {
2905 // set Lock pFrame to avoid m_pCurr getting deleted
2907 pFly = static_cast<SwTextFlyCnt*>(pHint)->GetFlyFrame(pFrame);
2908 }
2909 else
2910 pFly = nullptr;
2911 // aBase is the document-global position, from which the new extra portion is placed
2912 // aBase.X() = Offset in the line after the current position
2913 // aBase.Y() = LineIter.Y() + Ascent of the current position
2914
2915 SwTwips nTmpAscent, nTmpDescent, nFlyAsc, nFlyDesc;
2916 // i#11859 - use new method <SwLineLayout::MaxAscentDescent(..)>
2917 // to change line spacing behaviour at paragraph - Compatibility to MS Word
2918 //SwLinePortion *pPos = pCurr->GetFirstPortion();
2919 //lcl_MaxAscDescent( pPos, nTmpAscent, nTmpDescent, nFlyAsc, nFlyDesc );
2920 m_pCurr->MaxAscentDescent( nTmpAscent, nTmpDescent, nFlyAsc, nFlyDesc );
2921
2922 // If the ascent of the frame is larger than the ascent of the current position,
2923 // we use this one when calculating the base, or the frame would be positioned
2924 // too much to the top, sliding down after all causing a repaint in an area
2925 // he actually never was in.
2926 SwTwips nAscent = 0;
2927
2928 const bool bTextFrameVertical = GetInfo().GetTextFrame()->IsVertical();
2929
2930 const bool bUseFlyAscent = pFly && pFly->isFrameAreaPositionValid() &&
2931 0 != ( bTextFrameVertical ?
2932 pFly->GetRefPoint().X() :
2933 pFly->GetRefPoint().Y() );
2934
2935 if ( bUseFlyAscent )
2936 nAscent = std::abs( int( bTextFrameVertical ?
2937 pFly->GetRelPos().X() :
2938 pFly->GetRelPos().Y() ) );
2939
2940 // Check if be prefer to use the ascent of the last portion:
2941 if ( IsQuick() ||
2942 !bUseFlyAscent ||
2943 nAscent < rInf.GetLast()->GetAscent() )
2944 {
2945 nAscent = rInf.GetLast()->GetAscent();
2946 }
2947 else if( nAscent > nFlyAsc )
2948 nFlyAsc = nAscent;
2949
2950 Point aBase( GetLeftMargin() + rInf.X(), Y() + nAscent );
2952 if( GetMulti() && GetMulti()->HasRotation() )
2953 {
2954 nMode |= AsCharFlags::Rotate;
2955 if( GetMulti()->IsRevers() )
2956 nMode |= AsCharFlags::Reverse;
2957 }
2958
2959 Point aTmpBase( aBase );
2960 if ( GetInfo().GetTextFrame()->IsVertical() )
2962
2963 SwFlyCntPortion* pRet(nullptr);
2964 if( pFly )
2965 {
2966 pRet = sw::FlyContentPortion::Create(*GetInfo().GetTextFrame(), pFly, aTmpBase, nTmpAscent, nTmpDescent, nFlyAsc, nFlyDesc, nMode);
2967 // We need to make sure that our font is set again in the OutputDevice
2968 // It could be that the FlyInCnt was added anew and GetFlyFrame() would
2969 // in turn cause, that it'd be created anew again.
2970 // This one's frames get formatted right away, which change the font.
2971 rInf.SelectFont();
2972 if( pRet->GetAscent() > nAscent )
2973 {
2974 aBase.setY( Y() + pRet->GetAscent() );
2975 nMode |= AsCharFlags::UlSpace;
2976 if( !rInf.IsTest() )
2977 {
2978 aTmpBase = aBase;
2979 if ( GetInfo().GetTextFrame()->IsVertical() )
2981
2982 pRet->SetBase( *rInf.GetTextFrame(), aTmpBase, nTmpAscent,
2983 nTmpDescent, nFlyAsc, nFlyDesc, nMode );
2984 }
2985 }
2986 }
2987 else
2988 {
2989 pRet = sw::DrawFlyCntPortion::Create(*rInf.GetTextFrame(), *pFrameFormat, aTmpBase, nTmpAscent, nTmpDescent, nFlyAsc, nFlyDesc, nMode);
2990 }
2991 return pRet;
2992}
2993
2994/* Drop portion is a special case, because it has parts which aren't portions
2995 but we have handle them just like portions */
2997{
2998 if( rPortion.GetLines() <= 1 )
2999 return;
3000
3001 SwDropPortionPart* pCurrPart = rPortion.GetPart();
3002 while( pCurrPart )
3003 {
3004 if( pCurrPart->GetFollow() &&
3005 ::lcl_HasSameBorder(pCurrPart->GetFont(), pCurrPart->GetFollow()->GetFont()) )
3006 {
3007 pCurrPart->SetJoinBorderWithNext(true);
3008 pCurrPart->GetFollow()->SetJoinBorderWithPrev(true);
3009 }
3010 pCurrPart = pCurrPart->GetFollow();
3011 }
3012}
3013
3015{
3016 const SwFont aCurFont = *rInf.GetFont();
3017 if( !aCurFont.HasBorder() )
3018 return;
3019
3020 if (pPrev && pPrev->GetJoinBorderWithNext() )
3021 {
3022 // In some case border merge is called twice to the portion
3023 if( !rPortion.GetJoinBorderWithPrev() )
3024 {
3025 rPortion.SetJoinBorderWithPrev(true);
3026 if( rPortion.InTextGrp() && rPortion.Width() > aCurFont.GetLeftBorderSpace() )
3027 rPortion.Width(rPortion.Width() - aCurFont.GetLeftBorderSpace());
3028 }
3029 }
3030 else
3031 {
3032 rPortion.SetJoinBorderWithPrev(false);
3033 m_pFirstOfBorderMerge = &rPortion;
3034 }
3035
3036 // Get next portion's font
3037 bool bSeek = false;
3038 if (!rInf.IsFull() && // Not the last portion of the line (in case of line break)
3039 rInf.GetIdx() + rPortion.GetLen() != TextFrameIndex(rInf.GetText().getLength())) // Not the last portion of the paragraph
3040 {
3041 bSeek = Seek(rInf.GetIdx() + rPortion.GetLen());
3042 }
3043 // Don't join the next portion if SwKernPortion sits between two different boxes.
3044 bool bDisconnect = rPortion.IsKernPortion() && !rPortion.GetJoinBorderWithPrev();
3045 // If next portion has the same border then merge
3046 if( bSeek && GetFnt()->HasBorder() && ::lcl_HasSameBorder(aCurFont, *GetFnt()) && !bDisconnect )
3047 {
3048 // In some case border merge is called twice to the portion
3049 if( !rPortion.GetJoinBorderWithNext() )
3050 {
3051 rPortion.SetJoinBorderWithNext(true);
3052 if( rPortion.InTextGrp() && rPortion.Width() > aCurFont.GetRightBorderSpace() )
3053 rPortion.Width(rPortion.Width() - aCurFont.GetRightBorderSpace());
3054 }
3055 }
3056 // If this is the last portion of the merge group then make the real height merge
3057 else
3058 {
3059 rPortion.SetJoinBorderWithNext(false);
3060 if( m_pFirstOfBorderMerge != &rPortion )
3061 {
3062 // Calculate maximum height and ascent
3064 sal_uInt16 nMaxAscent = 0;
3065 sal_uInt16 nMaxHeight = 0;
3066 bool bReachCurrent = false;
3067 while( pActPor )
3068 {
3069 if( nMaxHeight < pActPor->Height() )
3070 nMaxHeight = pActPor->Height();
3071 if( nMaxAscent < pActPor->GetAscent() )
3072 nMaxAscent = pActPor->GetAscent();
3073
3074 pActPor = pActPor->GetNextPortion();
3075 if( !pActPor && !bReachCurrent )
3076 {
3077 pActPor = &rPortion;
3078 bReachCurrent = true;
3079 }
3080 }
3081
3082 // Change all portion's height and ascent
3083 pActPor = m_pFirstOfBorderMerge;
3084 bReachCurrent = false;
3085 while( pActPor )
3086 {
3087 if( nMaxHeight > pActPor->Height() )
3088 pActPor->Height(nMaxHeight);
3089 if( nMaxAscent > pActPor->GetAscent() )
3090 pActPor->SetAscent(nMaxAscent);
3091
3092 pActPor = pActPor->GetNextPortion();
3093 if( !pActPor && !bReachCurrent )
3094 {
3095 pActPor = &rPortion;
3096 bReachCurrent = true;
3097 }
3098 }
3099 m_pFirstOfBorderMerge = nullptr;
3100 }
3101 }
3102 Seek(rInf.GetIdx());
3103}
3104
3105namespace {
3106 // calculates and sets optimal repaint offset for the current line
3107 tools::Long lcl_CalcOptRepaint( SwTextFormatter &rThis,
3108 SwLineLayout const &rCurr,
3109 TextFrameIndex const nOldLineEnd,
3110 const std::vector<tools::Long> &rFlyStarts )
3111 {
3112 SwTextFormatInfo& txtFormatInfo = rThis.GetInfo();
3113 if ( txtFormatInfo.GetIdx() < txtFormatInfo.GetReformatStart() )
3114 // the reformat position is behind our new line, that means
3115 // something of our text has moved to the next line
3116 return 0;
3117
3118 TextFrameIndex nReformat = std::min(txtFormatInfo.GetReformatStart(), nOldLineEnd);
3119
3120 // in case we do not have any fly in our line, our repaint position
3121 // is the changed position - 1
3122 if ( rFlyStarts.empty() && ! rCurr.IsFly() )
3123 {
3124 // this is the maximum repaint offset determined during formatting
3125 // for example: the beginning of the first right tab stop
3126 // if this value is 0, this means that we do not have an upper
3127 // limit for the repaint offset
3128 const tools::Long nFormatRepaint = txtFormatInfo.GetPaintOfst();
3129
3130 if (nReformat < txtFormatInfo.GetLineStart() + TextFrameIndex(3))
3131 return 0;
3132
3133 // step back two positions for smoother repaint
3134 nReformat -= TextFrameIndex(2);
3135
3136 // i#28795, i#34607, i#38388
3137 // step back more characters, this is required by complex scripts
3138 // e.g., for Khmer (thank you, Javier!)
3139 static const TextFrameIndex nMaxContext(10);
3140 if (nReformat > txtFormatInfo.GetLineStart() + nMaxContext)
3141 nReformat = nReformat - nMaxContext;
3142 else
3143 {
3144 nReformat = txtFormatInfo.GetLineStart();
3145 //reset the margin flag - prevent loops
3147 }
3148
3149 // Weird situation: Our line used to end with a hole portion
3150 // and we delete some characters at the end of our line. We have
3151 // to take care for repainting the blanks which are not anymore
3152 // covered by the hole portion
3153 while ( nReformat > txtFormatInfo.GetLineStart() &&
3154 CH_BLANK == txtFormatInfo.GetChar( nReformat ) )
3155 --nReformat;
3156
3157 OSL_ENSURE( nReformat < txtFormatInfo.GetIdx(), "Reformat too small for me!" );
3158 SwRect aRect;
3159
3160 // Note: GetChareRect is not const. It definitely changes the
3161 // bMulti flag. We have to save and restore the old value.
3162 bool bOldMulti = txtFormatInfo.IsMulti();
3163 rThis.GetCharRect( &aRect, nReformat );
3164 txtFormatInfo.SetMulti( bOldMulti );
3165
3166 return nFormatRepaint ? std::min( aRect.Left(), nFormatRepaint ) :
3167 aRect.Left();
3168 }
3169 else
3170 {
3171 // nReformat may be wrong, if something around flys has changed:
3172 // we compare the former and the new fly positions in this line
3173 // if anything has changed, we carefully have to adjust the right
3174 // repaint position
3175 tools::Long nPOfst = 0;
3176 size_t nCnt = 0;
3177 tools::Long nX = 0;
3178 TextFrameIndex nIdx = rThis.GetInfo().GetLineStart();
3179 SwLinePortion* pPor = rCurr.GetFirstPortion();
3180
3181 while ( pPor )
3182 {
3183 if ( pPor->IsFlyPortion() )
3184 {
3185 // compare start of fly with former start of fly
3186 if (nCnt < rFlyStarts.size() &&
3187 nX == rFlyStarts[ nCnt ] &&
3188 nIdx < nReformat
3189 )
3190 // found fix position, nothing has changed left from nX
3191 nPOfst = nX + pPor->Width();
3192 else
3193 break;
3194
3195 nCnt++;
3196 }
3197 nX = nX + pPor->Width();
3198 nIdx = nIdx + pPor->GetLen();
3199 pPor = pPor->GetNextPortion();
3200 }
3201
3202 return nPOfst + rThis.GetLeftMargin();
3203 }
3204 }
3205
3206 // Determine if we need to build hidden portions
3207 bool lcl_BuildHiddenPortion(const SwTextSizeInfo& rInf, TextFrameIndex & rPos)
3208 {
3209 // Only if hidden text should not be shown:
3210 // if ( rInf.GetVsh() && rInf.GetVsh()->GetWin() && rInf.GetOpt().IsShowHiddenChar() )
3211 const bool bShowInDocView = rInf.GetVsh() && rInf.GetVsh()->GetWin() && rInf.GetOpt().IsShowHiddenChar();
3212 const bool bShowForPrinting = rInf.GetOpt().IsShowHiddenChar( true ) && rInf.GetOpt().IsPrinting();
3213 if (bShowInDocView || bShowForPrinting)
3214 return false;
3215
3216 const SwScriptInfo& rSI = rInf.GetParaPortion()->GetScriptInfo();
3217 TextFrameIndex nHiddenStart;
3218 TextFrameIndex nHiddenEnd;
3219 rSI.GetBoundsOfHiddenRange( rPos, nHiddenStart, nHiddenEnd );
3220 if ( nHiddenEnd )
3221 {
3222 rPos = nHiddenEnd;
3223 return true;
3224 }
3225
3226 return false;
3227 }
3228
3229 bool lcl_HasSameBorder(const SwFont& rFirst, const SwFont& rSecond)
3230 {
3231 return
3232 rFirst.GetTopBorder() == rSecond.GetTopBorder() &&
3233 rFirst.GetBottomBorder() == rSecond.GetBottomBorder() &&
3234 rFirst.GetLeftBorder() == rSecond.GetLeftBorder() &&
3235 rFirst.GetRightBorder() == rSecond.GetRightBorder() &&
3236 rFirst.GetTopBorderDist() == rSecond.GetTopBorderDist() &&
3237 rFirst.GetBottomBorderDist() == rSecond.GetBottomBorderDist() &&
3238 rFirst.GetLeftBorderDist() == rSecond.GetLeftBorderDist() &&
3239 rFirst.GetRightBorderDist() == rSecond.GetRightBorderDist() &&
3240 rFirst.GetOrientation() == rSecond.GetOrientation() &&
3241 rFirst.GetShadowColor() == rSecond.GetShadowColor() &&
3242 rFirst.GetShadowWidth() == rSecond.GetShadowWidth() &&
3243 rFirst.GetShadowLocation() == rSecond.GetShadowLocation();
3244 }
3245
3246} //end unnamed namespace
3247
3248/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
@ MS_WORD_COMP_MIN_LINE_HEIGHT_BY_FLY
@ PROP_LINE_SPACING_SHRINKS_FIRST_LINE
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...
bool isLetterNumeric(const OUString &rStr, sal_Int32 nPos) const
static Color STRtoRGB(std::u16string_view colorname)
virtual sw::mark::IFieldmark * getInnerFieldmarkFor(const SwPosition &pos) const =0
virtual bool get(DocumentSettingId id) const =0
Return the specified document setting.
vcl::ExtOutDevData * GetExtOutDevData() const
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
css::uno::Reference< css::frame::XModel3 > GetBaseModel() const
sal_uInt16 GetPropLineSpace() const
SvxInterLineSpaceRule GetInterLineSpaceRule() const
SvxLineSpaceRule GetLineSpaceRule() const
sal_uInt16 GetLineHeight() const
short GetInterLineSpace() const
wrapper class for the positioning of Writer fly frames and drawing objects
Indicator that the content does not fit into a fixed height frame (red triangle on the UI).
Definition: porrst.hxx:116
SwRedlineItr * GetRedln()
Definition: itratr.hxx:81
SwFont * GetFnt()
Definition: itratr.hxx:103
SwScriptInfo * m_pScriptInfo
Definition: itratr.hxx:40
TextFrameIndex GetNextAttr() const
Definition: itratr.cxx:734
bool Seek(TextFrameIndex nPos)
Enables the attributes used at char pos nPos in the logical font.
Definition: itratr.cxx:306
SwTextAttr * GetAttr(TextFrameIndex nPos) const
Returns the attribute for a position.
Definition: itratr.cxx:147
SwFont * m_pFont
Definition: itratr.hxx:39
Non-breaking space or non-breaking hyphen.
Definition: porexp.hxx:43
for showing bookmark starts and ends; note that in contrast to SwControlCharPortion these do not have...
Definition: porrst.hxx:186
void LeftMove(TextFrameIndex const nNew)
Definition: porlay.hxx:47
Definition: doc.hxx:197
const SwFootnoteInfo & GetFootnoteInfo() const
Definition: doc.hxx:643
IDocumentSettingAccess const & getIDocumentSettingAccess() const
Definition: doc.cxx:190
IDocumentMarkAccess * getIDocumentMarkAccess()
Definition: docbm.cxx:1890
const SwEndNoteInfo & GetEndNoteInfo() const
Definition: doc.hxx:645
SwDocShell * GetDocShell()
Definition: doc.hxx:1367
SwFont & GetFont() const
Definition: pordrop.hxx:52
void SetJoinBorderWithPrev(const bool bJoinPrev)
Definition: pordrop.hxx:59
void SetJoinBorderWithNext(const bool bJoinNext)
Definition: pordrop.hxx:60
SwDropPortionPart * GetFollow() const
Definition: pordrop.hxx:50
Text portion for the Format -> Paragraph -> Drop Caps functionality.
Definition: pordrop.hxx:65
sal_uInt16 GetLines() const
Definition: pordrop.hxx:91
SwDropPortionPart * GetPart() const
Definition: pordrop.hxx:97
SwCharFormat * GetAnchorCharFormat(SwDoc &rDoc) const
Definition: docftn.cxx:182
bool IsNoLength() const
Definition: porfld.hxx:58
bool HasFont() const
Definition: porfld.hxx:69
bool IsHide() const
Definition: porfld.hxx:89
const SwFont * GetFont() const
Definition: porfld.hxx:71
static const OUString & GetTypeStr(SwFieldTypesEnum nTypeId)
Definition: fldbas.cxx:124
sal_uInt16 GetFix() const
Definition: porglue.hxx:61
This portion represents an as-character anchored fly (shape, frame, etc.)
Definition: porfly.hxx:45
void SetBase(const SwTextFrame &rFrame, const Point &rBase, tools::Long nLnAscent, tools::Long nLnDescent, tools::Long nFlyAscent, tools::Long nFlyDescent, AsCharFlags nFlags)
After setting the RefPoints, the ascent needs to be recalculated because it is dependent on RelPos.
Definition: porfly.cxx:342
Flys that are anchored as a character in the content.
Definition: flyfrms.hxx:210
const Point & GetRefPoint() const
Definition: flyfrms.hxx:229
Point const & GetRelPos() const
Definition: flyincnt.cxx:200
To take Asian or other languages into consideration, an SwFont object consists of 3 SwSubFonts (Latin...
Definition: swfont.hxx:135
sal_uInt16 GetBottomBorderSpace() const
Definition: swfont.hxx:880
sal_uInt16 GetTopBorderSpace() const
Definition: swfont.hxx:865
const std::optional< editeng::SvxBorderLine > & GetTopBorder() const
Definition: swfont.hxx:346
const std::optional< editeng::SvxBorderLine > & GetRightBorder() const
Definition: swfont.hxx:348
sal_uInt16 GetBottomBorderDist() const
Definition: swfont.hxx:367
FontLineStyle GetUnderline() const
Definition: swfont.hxx:275
Degree10 GetOrientation(const bool bVertLayout=false, const bool bVertFormatLRBT=false) const
Definition: swfont.cxx:412
sal_uInt16 GetRightBorderSpace() const
Definition: swfont.hxx:895
sal_uInt16 GetShadowWidth() const
Definition: swfont.hxx:385
const Color & GetShadowColor() const
Definition: swfont.hxx:384
const std::optional< editeng::SvxBorderLine > & GetBottomBorder() const
Definition: swfont.hxx:347
const SvxFont & GetActualFont() const
Definition: swfont.hxx:189
sal_uInt16 GetTopBorderDist() const
Definition: swfont.hxx:366
SwFontScript GetActual() const
Definition: swfont.hxx:187
sal_uInt16 GetRightBorderDist() const
Definition: swfont.hxx:368
const std::optional< editeng::SvxBorderLine > & GetLeftBorder() const
Definition: swfont.hxx:349
SvxShadowLocation GetShadowLocation() const
Definition: swfont.hxx:386
sal_uInt16 GetLeftBorderDist() const
Definition: swfont.hxx:369
bool HasBorder() const
Check whether font has any border on any side.
Definition: swfont.hxx:925
tools::Long GetHeight() const
Definition: swfont.hxx:287
sal_uInt16 GetLeftBorderSpace() const
Definition: swfont.hxx:910
SwLayoutFrame * FindBodyCont()
Searches the first ContentFrame in BodyText below the page.
Definition: findfrm.cxx:48
FlyAnchors.
Definition: fmtanchr.hxx:37
RndStdIds GetAnchorId() const
Definition: fmtanchr.hxx:67
const SwPosition * GetContentAnchor() const
Definition: fmtanchr.hxx:74
SfxPoolItem subclass that wraps an SwContentControl.
const std::shared_ptr< SwContentControl > & GetContentControl() const
sal_uInt8 GetLines() const
Definition: paratr.hxx:110
bool IsEndNote() const
Definition: fmtftn.hxx:73
sal_uInt16 Which() const
for Querying of Writer-functions.
Definition: format.hxx:82
const SwRect & getFrameArea() const
Definition: frame.hxx:179
bool isFrameAreaPositionValid() const
Definition: frame.hxx:166
const SwRect & getFramePrintArea() const
Definition: frame.hxx:180
Style of a layout element.
Definition: frmfmt.hxx:72
Base class of the Writer layout elements.
Definition: frame.hxx:315
SwFrame * GetIndPrev() const
Definition: frame.hxx:730
bool IsInFootnote() const
Definition: frame.hxx:955
bool IsRightToLeft() const
Definition: frame.hxx:993
SwLayoutFrame * GetUpper()
Definition: frame.hxx:684
bool IsVertical() const
Definition: frame.hxx:979
SwPageFrame * FindPageFrame()
Definition: frame.hxx:686
sal_uInt16 GetFixWidth() const
Definition: porglue.hxx:40
A layout frame is a frame that contains other frames (m_pLower), e.g. SwPageFrame or SwTabFrame.
Definition: layfrm.hxx:36
const SvxLineSpacingItem * GetLineSpacing() const
Definition: inftxt.hxx:79
Collection of SwLinePortion instances, representing one line of text.
Definition: porlay.hxx:79
void Init(SwLinePortion *pNextPortion=nullptr)
Definition: porlay.cxx:2747
void SetFormatAdj(const bool bNew)
Definition: porlay.hxx:120
void SetMidHyph(const bool bNew)
Definition: porlay.hxx:124
bool IsRest() const
Definition: porlay.hxx:129
void SetForcedLeftMargin()
Definition: porlay.hxx:142
SwTwips GetTextHeight() const
Definition: porlay.hxx:171
void FinishSpaceAdd()
Definition: porlay.hxx:186
SwLineLayout * GetNext()
Definition: porlay.hxx:159
void SetClipping(const bool bNew)
Definition: porlay.hxx:153
void ResetFlags()
Definition: porlay.cxx:831
SwLinePortion * GetFirstPortion() const
Definition: porlay.cxx:849
void FinishKanaComp()
Definition: porlay.hxx:201
void CalcLine(SwTextFormatter &rLine, SwTextFormatInfo &rInf)
Definition: porlay.cxx:380
void SetFly(const bool bNew)
Definition: porlay.hxx:126
virtual void Height(const SwTwips nNew, const bool bText=true) override
Definition: porlay.cxx:239
bool IsFly() const
Definition: porlay.hxx:127
void MaxAscentDescent(SwTwips &_orAscent, SwTwips &_orDescent, SwTwips &_orObjAscent, SwTwips &_orObjDescent, const SwLinePortion *_pDontConsiderPortion=nullptr, const bool _bNoFlyCntPorAndLinePor=false) const
determine ascent and descent for positioning of as-character anchored object
Definition: porlay.cxx:771
bool IsDummy() const
Definition: porlay.hxx:151
void SetRealHeight(SwTwips nNew)
Definition: porlay.hxx:168
SwTwips GetRealHeight() const
Definition: porlay.hxx:169
void SetEndHyph(const bool bNew)
Definition: porlay.hxx:122
void SetNext(SwLineLayout *pNew)
Definition: porlay.hxx:161
void SetDummy(const bool bNew)
Definition: porlay.hxx:150
void SetRest(const bool bNew)
Definition: porlay.hxx:128
std::vector< tools::Long > * GetpLLSpaceAdd() const
Definition: porlay.hxx:197
std::deque< sal_uInt16 > * GetpKanaComp() const
Definition: porlay.hxx:202
Base class for anything that can be part of a line in the Writer layout.
Definition: porlin.hxx:52
bool IsTextPortion() const
Definition: porlin.hxx:139
virtual void FormatEOL(SwTextFormatInfo &rInf)
Definition: porlin.cxx:269
bool IsSoftHyphPortion() const
Definition: porlin.hxx:136
bool InTextGrp() const
Definition: porlin.hxx:105
void SetJoinBorderWithNext(const bool bJoinNext)
Definition: porlin.hxx:180
SwLinePortion * GetNextPortion() const
Definition: porlin.hxx:75
void SetAscent(const SwTwips nNewAsc)
Definition: porlin.hxx:82
bool GetJoinBorderWithPrev() const
Definition: porlin.hxx:177
bool InNumberGrp() const
Definition: porlin.hxx:109
void SetHangingBaseline(const SwTwips nNewBaseline)
Definition: porlin.hxx:90
PortionType GetWhichPor() const
Definition: porlin.hxx:102
void SetNextPortion(SwLinePortion *pNew)
Definition: porlin.hxx:79
bool IsPostItsPortion() const
Definition: porlin.hxx:137
TextFrameIndex GetLen() const
Definition: porlin.hxx:77
void Move(SwTextPaintInfo &rInf)
Definition: porlin.cxx:272
SwLinePortion * FindLastPortion()
Definition: porlin.cxx:179
bool IsKernPortion() const
Definition: porlin.hxx:141
bool GetJoinBorderWithNext() const
Definition: porlin.hxx:178
void Truncate()
Definition: porlin.hxx:214
SwTwips GetHangingBaseline() const
Definition: porlin.hxx:89
bool IsFootnotePortion() const
Definition: porlin.hxx:129
SwTwips & GetAscent()
Definition: porlin.hxx:80
bool IsErgoSumPortion() const
Definition: porlin.hxx:122
bool IsDropPortion() const
Definition: porlin.hxx:130
bool IsTabLeftPortion() const
Definition: porlin.hxx:124
bool InTabGrp() const
Definition: porlin.hxx:107
bool IsBreakPortion() const
Definition: porlin.hxx:121
bool IsQuoVadisPortion() const
Definition: porlin.hxx:123
void SetLen(TextFrameIndex const nLen)
Definition: porlin.hxx:78
bool IsGrfNumPortion() const
Definition: porlin.hxx:118
bool IsMultiPortion() const
Definition: porlin.hxx:143
void SetJoinBorderWithPrev(const bool bJoinPrev)
Definition: porlin.hxx:179
bool InFieldGrp() const
Definition: porlin.hxx:111
bool IsFlyPortion() const
Definition: porlin.hxx:134
bool IsFootnoteNumPortion() const
Definition: porlin.hxx:128
virtual bool Format(SwTextFormatInfo &rInf)
Definition: porlin.cxx:241
void SetWhichPor(const PortionType nNew)
Definition: porlin.hxx:101
bool InExpGrp() const
Definition: porlin.hxx:114
bool IsFlyCntPortion() const
Definition: porlin.hxx:119
bool InFixMargGrp() const
Definition: porlin.hxx:115
virtual SwLinePortion * Insert(SwLinePortion *pPortion)
Definition: porlin.cxx:169
bool HasRotation() const
Definition: pormulti.hxx:146
bool IsBidi() const
Definition: pormulti.hxx:132
bool HasFlyInContent() const
Definition: pormulti.hxx:128
const SwLineLayout & GetRoot() const
Definition: pormulti.hxx:120
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:901
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:188
SwNode & GetPointNode() const
Definition: pam.hxx:275
A page of the document layout.
Definition: pagefrm.hxx:59
void SetFootnoteNum(const bool bNew)
Definition: porlay.hxx:318
SwCharRange & GetReformat()
Definition: porlay.hxx:287
void SetFixLineHeight()
Definition: porlay.hxx:315
SwRepaint & GetRepaint()
Definition: porlay.hxx:285
SwScriptInfo & GetScriptInfo()
Definition: porlay.hxx:291
SwTwips Width() const
Definition: possiz.hxx:51
SwTwips Height() const
Definition: possiz.hxx:49
bool IsVert() const
Definition: frame.hxx:1372
tools::Long YDiff(tools::Long n1, tools::Long n2) const
Definition: frame.hxx:1428
tools::Long GetPrtLeft(const SwFrame &rFrame) const
Definition: frame.hxx:1416
Of course Writer needs its own rectangles.
Definition: swrect.hxx:35
SwRect & Intersection(const SwRect &rRect)
Definition: swrect.cxx:57
void SubTop(const tools::Long nSub)
Definition: swrect.cxx:129
void Height(tools::Long nNew)
Definition: swrect.hxx:193
bool IsEmpty() const
Definition: swrect.hxx:304
bool HasArea() const
Definition: swrect.hxx:300
SwRect & Union(const SwRect &rRect)
Definition: swrect.cxx:35
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
SwRect & Intersection_(const SwRect &rRect)
Definition: swrect.cxx:81
void Pos(const Point &rNew)
Definition: swrect.hxx:171
bool Overlaps(const SwRect &rRect) const
Definition: swrect.hxx:374
tools::Rectangle SVRect() const
Definition: swrect.hxx:292
void Left(const tools::Long nLeft)
Definition: swrect.hxx:197
void Width(tools::Long nNew)
Definition: swrect.hxx:189
void Reset()
Definition: redlnitr.hxx:112
void Clear(SwFont *pFnt)
Definition: redlnitr.hxx:109
sal_Int16 ScriptType(const TextFrameIndex nPos) const
Definition: porlay.cxx:1898
TextFrameIndex NextDirChg(const TextFrameIndex nPos, const sal_uInt8 *pLevel=nullptr) const
Definition: porlay.cxx:1911
static bool GetBoundsOfHiddenRange(const SwTextNode &rNode, sal_Int32 nPos, sal_Int32 &rnStartPos, sal_Int32 &rnEndPos, std::vector< sal_Int32 > *pList=nullptr)
Hidden text range information - static and non-version.
Definition: porlay.cxx:2052
SwFontScript WhichFont(TextFrameIndex nIdx) const
Definition: porlay.cxx:900
std::vector< std::tuple< MarkKind, Color, OUString > > GetBookmarks(TextFrameIndex const nPos)
Definition: porlay.cxx:1963
TextFrameIndex NextHiddenChg(TextFrameIndex nPos) const
Definition: porlay.cxx:1938
TextFrameIndex NextScriptChg(TextFrameIndex nPos) const
Definition: porlay.cxx:1885
TextFrameIndex NextBookmark(TextFrameIndex nPos) const
Definition: porlay.cxx:1950
virtual bool Format(SwTextFormatInfo &rInf) override
Definition: txttab.cxx:338
virtual void FormatEOL(SwTextFormatInfo &rInf) override
Definition: txttab.cxx:348
void CalcAdjLine(SwLineLayout *pCurr)
Definition: itradj.cxx:670
SwTwips CalcKanaAdj(SwLineLayout *pCurr)
Definition: itradj.cxx:412
A wrapper around SfxPoolItem to store the start position of (usually) a text portion,...
Definition: txatbase.hxx:44
const SwFormatFootnote & GetFootnote() const
Definition: txatbase.hxx:208
SwTextAttr subclass that tracks the location of the wrapped SwFormatContentControl.
void GetCharRect(SwRect *, TextFrameIndex, SwCursorMoveState *=nullptr, const tools::Long nMax=0)
Definition: itrcrsr.cxx:1224
static void SetRightMargin(const bool bNew)
Definition: itrtxt.hxx:295
The purpose of this class is to be the universal interface between formatting/text output and the pos...
Definition: txtfly.hxx:122
SwTwips GetMinBottom() const
Definition: txtfly.hxx:346
SwRect GetFrame(const SwRect &rPortion) const
Definition: txtfly.hxx:366
bool IsOn() const
Definition: txtfly.hxx:323
tools::Long GetNextTop() const
Definition: txtfly.hxx:356
SwTextAttr subclass for footnotes and endnotes.
Definition: txtftn.hxx:34
void SetArrowDone(const bool bNew)
Definition: inftxt.hxx:637
SwLinePortion * GetLast()
Definition: inftxt.hxx:566
bool IsIgnoreFly() const
Definition: inftxt.hxx:575
void SetStop(const bool bNew)
Definition: inftxt.hxx:580
SwTabPortion * GetLastTab()
Definition: inftxt.hxx:620
void SetFly(SwFlyPortion *pNew)
Definition: inftxt.hxx:615
void SetErgoDone(const bool bNew)
Definition: inftxt.hxx:633
void ChkNoHyph(const sal_uInt8 bEnd, const sal_uInt8 bMid)
Definition: inftxt.hxx:572
void SetUnderScorePos(TextFrameIndex const nNew)
Definition: inftxt.hxx:647
void ClrUnderflow()
Definition: inftxt.hxx:589
const SwFormatDrop * GetDropFormat() const
Definition: inftxt.cxx:1690
void SetRoot(SwLineLayout *pNew)
Definition: inftxt.hxx:565
void SetRest(SwLinePortion *pNewRest)
Definition: inftxt.hxx:582
sal_uInt16 ForcedLeftMargin() const
Definition: inftxt.hxx:556
bool CheckFootnotePortion(SwLineLayout const *pCurr)
Definition: inftxt.hxx:654
void SetShift(const bool bNew)
Definition: inftxt.hxx:586
void SetLineStart(TextFrameIndex const nNew)
Definition: inftxt.hxx:596
bool IsTest() const
Definition: inftxt.hxx:593
void SetDropInit(const bool bNew)
Definition: inftxt.hxx:591
sal_uInt16 RealWidth() const
Definition: inftxt.hxx:554
void SetTabOverflow(bool bOverflow)
Definition: inftxt.hxx:667
TextFrameIndex GetLineStart() const
Definition: inftxt.hxx:595
void SetLineNetHeight(const sal_uInt16 nNew)
Definition: inftxt.hxx:602
SwTwips Right() const
Definition: inftxt.hxx:549
bool IsUnderflow() const
Definition: inftxt.hxx:588
const SwLinePortion * GetUnderflow() const
Definition: inftxt.hxx:604
bool LastKernPortion()
Definition: inftxt.cxx:1905
sal_Unicode GetHookChar() const
Definition: inftxt.hxx:627
void SetLineHeight(const sal_uInt16 nNew)
Definition: inftxt.hxx:600
bool IsNumDone() const
Definition: inftxt.hxx:634
bool IsErgoDone() const
Definition: inftxt.hxx:632
TextFrameIndex ScanPortionEnd(TextFrameIndex nStart, TextFrameIndex nEnd)
Definition: inftxt.cxx:1812
sal_uInt16 GetLineNetHeight() const
Definition: inftxt.hxx:601
SwTwips Left() const
Definition: inftxt.hxx:547
sal_uInt16 GetLineHeight() const
Definition: inftxt.hxx:599
void SetLast(SwLinePortion *pNewLast)
Definition: inftxt.hxx:567
bool IsFull() const
Definition: inftxt.hxx:568
SwLinePortion * GetRest()
Definition: inftxt.hxx:581
bool IsNewLine() const
Definition: inftxt.hxx:583
bool IsFootnoteDone() const
Definition: inftxt.hxx:630
sal_uInt16 Width() const
Definition: inftxt.hxx:533
void ClearHookChar()
Definition: inftxt.hxx:625
SwFlyPortion * GetFly()
Definition: inftxt.hxx:614
TextFrameIndex GetSoftHyphPos() const
Definition: inftxt.hxx:608
sal_Unicode GetTabDecimal() const
Definition: inftxt.hxx:622
void SetNumDone(const bool bNew)
Definition: inftxt.hxx:635
void SetNewLine(const bool bNew)
Definition: inftxt.hxx:584
void SetTabDecimal(const sal_Unicode cNew)
Definition: inftxt.hxx:623
bool IsArrowDone() const
Definition: inftxt.hxx:636
bool CheckCurrentPosBookmark()
Definition: inftxt.cxx:2170
TextFrameIndex GetUnderScorePos() const
Definition: inftxt.hxx:646
void SetFootnoteDone(const bool bNew)
Definition: inftxt.hxx:631
SwTwips GetLineWidth()
Returns the distance between the current horizontal position and the end of the line.
Definition: inftxt.cxx:1933
SwTwips First() const
Definition: inftxt.hxx:551
bool IsStop() const
Definition: inftxt.hxx:579
void SetUnderflow(SwLinePortion *pNew)
Definition: inftxt.hxx:606
TextFrameIndex GetReformatStart() const
Definition: inftxt.hxx:776
void LeftMargin(const SwTwips nNew)
Definition: inftxt.hxx:553
void SetFull(const bool bNew)
Definition: inftxt.hxx:569
void SetSoftHyphPos(TextFrameIndex const nNew)
Definition: inftxt.hxx:609
SwExpandPortion * TryNewNoLengthPortion(SwTextFormatInfo const &rInfo)
Try to create a new portion with zero length, for an end of a hint (where there is no CH_TXTATR).
Definition: txtfld.cxx:321
bool IsFlyInCntBase() const
Definition: itrform2.hxx:210
std::unique_ptr< sw::MergedAttrIterByEnd > m_pByEndIter
Definition: itrform2.hxx:45
bool m_bTruncLines
Definition: itrform2.hxx:43
sal_uInt16 GetFrameRstHeight() const
Definition: itrform2.cxx:141
bool AllowRepaintOpt() const
Definition: itrform2.cxx:2346
TextFrameIndex m_nRightScanIdx
Definition: itrform2.hxx:40
bool CalcOnceMore()
Definition: itrform2.cxx:2297
SwTextPortion * NewTextPortion(SwTextFormatInfo &rInf)
Definition: itrform2.cxx:1311
sal_uInt8 m_nContentEndHyph
Definition: itrform2.hxx:37
const sal_uInt8 & CntMidHyph() const
Definition: itrform2.hxx:220
bool ClearIfIsFirstOfBorderMerge(SwLinePortion const *pPortion)
Definition: itrform2.cxx:158
SwErgoSumPortion * NewErgoSumPortion(SwTextFormatInfo const &rInf) const
Definition: txtftn.cxx:1044
bool HasTruncLines() const
Definition: itrform2.hxx:204
SwMultiPortion * GetMulti() const
Definition: itrform2.hxx:199
void SetFlyInCntBase(bool bNew=true)
Definition: itrform2.hxx:211
bool m_bFlyInContentBase
Definition: itrform2.hxx:42
SwTabPortion * NewTabPortion(SwTextFormatInfo &rInf, bool bAuto) const
Definition: txttab.cxx:70
const sal_uInt8 & CntEndHyph() const
Definition: itrform2.hxx:219
void CalcFlyWidth(SwTextFormatInfo &rInf)
Calculation of the emulated right side.
Definition: itrform2.cxx:2667
void CalcUnclipped(SwTwips &rTop, SwTwips &rBottom)
Definition: itrform2.cxx:2398
void FormatReset(SwTextFormatInfo &rInf)
Definition: itrform2.cxx:2284
void CalcDropHeight(const sal_uInt16 nLines)
Definition: txtdrop.cxx:484
SwTwips CalcFitToContent_()
Definition: itrform2.cxx:2335
void CtorInitTextFormatter(SwTextFrame *pFrame, SwTextFormatInfo *pInf)
Definition: itrform2.cxx:93
SwLinePortion * NewPortion(SwTextFormatInfo &rInf, ::std::optional< TextFrameIndex >)
Definition: itrform2.cxx:1562
void AlignFlyInCntBase(tools::Long nBaseLine) const
Set all anchored as character objects to the passed BaseLine (in Y direction).
Definition: itrform2.cxx:2532
SwDropPortion * NewDropPortion(SwTextFormatInfo &rInf)
Definition: txtdrop.cxx:561
bool IsStop() const
Definition: itrform2.hxx:174
bool ChkFlyUnderflow(SwTextFormatInfo &rInf) const
This is called after the real height of the line has been calculated Therefore it is possible,...
Definition: itrform2.cxx:2579
bool IsNewLine() const
Definition: itrform2.hxx:177
void CalcAscent(SwTextFormatInfo &rInf, SwLinePortion *pPor)
Definition: itrform2.cxx:809
const SwFormatDrop * GetDropFormat() const
Definition: itrform2.hxx:196
void BuildPortions(SwTextFormatInfo &rInf)
Definition: itrform2.cxx:377
void CalcAdjustLine(SwLineLayout *pCurr)
Definition: itrform2.cxx:794
TextFrameIndex FormatLine(TextFrameIndex nStart)
Definition: itrform2.cxx:1873
SwMultiPortion * m_pMulti
Definition: itrform2.hxx:36
SwNumberPortion * NewNumberPortion(SwTextFormatInfo &rInf) const
Definition: txtfld.cxx:589
SwLinePortion * WhichFirstPortion(SwTextFormatInfo &rInf)
Definition: itrform2.cxx:1385
void UpdatePos(SwLineLayout *pCurr, Point aStart, TextFrameIndex nStartIdx, bool bAlways=false) const
The position of the portions changes with the adjustment.
Definition: itrform2.cxx:2410
SwLinePortion * NewExtraPortion(SwTextFormatInfo &rInf)
Definition: txtfld.cxx:360
bool BuildMultiPortion(SwTextFormatInfo &rInf, SwMultiPortion &rMulti)
Definition: pormulti.cxx:1907
TextFrameIndex m_nLeftScanIdx
Definition: itrform2.hxx:39
static void MergeCharacterBorder(SwDropPortion const &rPortion)
Merge border of the drop portion with modifying the font of the portions' part.
Definition: itrform2.cxx:2996
SwNumberPortion * NewFootnoteNumPortion(SwTextFormatInfo const &rInf) const
The portion for the Footnote Numbering in the Footnote Area.
Definition: txtftn.cxx:933
void CalcRealHeight(bool bNewLine=false)
Definition: itrform2.cxx:2104
bool IsQuick() const
Definition: itrform2.hxx:180
const SwFormatDrop * m_pDropFormat
Definition: itrform2.hxx:35
SwFlyCntPortion * NewFlyCntPortion(SwTextFormatInfo &rInf, SwTextAttr *pHt) const
Sets a new portion for an object anchored as character.
Definition: itrform2.cxx:2896
void FeedInf(SwTextFormatInfo &rInf) const
Definition: itrform2.cxx:2260
SwTextPortion * WhichTextPor(SwTextFormatInfo &rInf) const
Definition: itrform2.cxx:1147
SwLinePortion * m_pFirstOfBorderMerge
Definition: itrform2.hxx:46
void RecalcRealHeight()
Definition: itrform2.cxx:2096
SwLinePortion * Underflow(SwTextFormatInfo &rInf)
Definition: itrform2.cxx:168
void InsertPortion(SwTextFormatInfo &rInf, SwLinePortion *pPor)
Definition: itrform2.cxx:313
SwTwips CalcBottomLine() const
Definition: itrform2.cxx:2310
SwTextFormatInfo & GetInfo()
Definition: itrform2.hxx:213
virtual ~SwTextFormatter() override
Definition: itrform2.cxx:118
void Insert(SwLineLayout *pLine)
Definition: itrform2.cxx:129
sal_uInt8 m_nContentMidHyph
Definition: itrform2.hxx:38
Represents the visualization of a paragraph.
Definition: txtfrm.hxx:168
bool IsFootnoteNumFrame() const
Am I a FootnoteFrame, with a number at the start of the paragraph?
Definition: txtfrm.hxx:637
SwDoc & GetDoc()
Definition: txtfrm.hxx:475
void SwitchVerticalToHorizontal(SwRect &rRect) const
Calculates the coordinates of a rectangle when switching from vertical to horizontal layout.
Definition: txtfrm.cxx:580
SwTextFrame * GetFollow()
Definition: txtfrm.hxx:876
SwPosition MapViewToModelPos(TextFrameIndex nIndex) const
Definition: txtfrm.cxx:1246
TextFrameIndex GetOffset() const
Definition: txtfrm.hxx:453
void SwitchLTRtoRTL(SwRect &rRect) const
Calculates the coordinates of a rectangle when switching from LTR to RTL layout.
Definition: txtfrm.cxx:683
bool IsSwapped() const
Definition: txtfrm.hxx:550
void SwitchRTLtoLTR(SwRect &rRect) const
Calculates the coordinates of a rectangle when switching from RTL to LTR layout.
Definition: txtfrm.hxx:750
TextFrameIndex MapModelToView(SwTextNode const *pNode, sal_Int32 nIndex) const
Definition: txtfrm.cxx:1252
void SetHasRotatedPortions(bool bHasRotatedPortions)
Definition: txtftn.cxx:98
void SwitchHorizontalToVertical(SwRect &rRect) const
Calculates the coordinates of a rectangle when switching from horizontal to vertical layout.
Definition: txtfrm.cxx:473
bool HasNonLastSplitFlyDrawObj() const
This text frame may have a split fly frames anchored to it.
Definition: itratr.cxx:1483
sal_uInt16 GetBaseHeight() const
Definition: tgrditem.hxx:75
bool GetRubyTextBelow() const
Definition: tgrditem.hxx:85
sal_uInt16 GetRubyHeight() const
Definition: tgrditem.hxx:78
SwTextGrid GetGridType() const
Definition: tgrditem.hxx:81
bool IsSnapToChars() const
Definition: tgrditem.hxx:100
SwParaPortion * GetParaPortion()
Definition: inftxt.hxx:121
SwTwips Y() const
Definition: itrtxt.hxx:90
bool SeekAndChgBefore(SwTextSizeInfo &rInf)
Definition: itrtxt.hxx:316
TextFrameIndex GetStart() const
Definition: itrtxt.hxx:88
bool SeekStartAndChg(SwTextSizeInfo &rInf, const bool bPara=false)
Definition: itrtxt.hxx:324
void Bottom()
Definition: itrtxt.cxx:186
bool IsFirstTextLine() const
Definition: itrtxt.hxx:120
SwLineLayout * m_pCurr
Definition: itrtxt.hxx:36
SwTwips GetLineHeight() const
Definition: itrtxt.hxx:116
const SwLineLayout * Next()
Definition: itrtxt.cxx:108
SwTextFrame * m_pFrame
Definition: itrtxt.hxx:34
sal_uInt16 RegDiff() const
Definition: itrtxt.hxx:93
const SwLineLayout * GetCurr() const
Definition: itrtxt.hxx:83
SwTextFrame * GetTextFrame()
Definition: itrtxt.hxx:134
TextFrameIndex m_nStart
Definition: itrtxt.hxx:41
SwTwips RegStart() const
Definition: itrtxt.hxx:92
void CalcAscentAndHeight(SwTwips &rAscent, SwTwips &rHeight) const
Definition: itrtxt.cxx:64
SwTextInfo * m_pInf
Definition: itrtxt.hxx:35
bool IsParaLine() const
Definition: itrtxt.hxx:125
SwLineInfo m_aLineInf
Definition: itrtxt.hxx:33
bool SeekAndChg(SwTextSizeInfo &rInf)
Definition: itrtxt.hxx:311
bool IsRegisterOn() const
Definition: itrtxt.hxx:94
sal_uInt16 GetDropLeft() const
Definition: itrtxt.hxx:204
void DropInit()
Definition: itrcrsr.cxx:361
Point GetTopLeft() const
Definition: itrtxt.hxx:186
SwTwips Right() const
Definition: itrtxt.hxx:181
bool IsLastCenter() const
Definition: itrtxt.hxx:189
bool IsLastBlock() const
Definition: itrtxt.hxx:188
SwTwips GetLeftMargin() const
Definition: itrtxt.hxx:329
sal_uInt16 GetDropHeight() const
Definition: itrtxt.hxx:205
SwTwips Left() const
Definition: itrtxt.hxx:334
SwTwips FirstLeft() const
Definition: itrtxt.hxx:182
bool HasNegFirst() const
Definition: itrtxt.hxx:194
SvxAdjust GetAdjust() const
Definition: itrtxt.hxx:190
SwTwips GetLeftMin() const
Definition: itrtxt.hxx:193
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:112
SwTextAttr * GetTextAttrAt(sal_Int32 const nIndex, sal_uInt16 const nWhich, ::sw::GetTextAttrMode const eMode=::sw::GetTextAttrMode::Default) const
get the innermost text attribute covering position nIndex.
Definition: ndtxt.cxx:1802
void SetpSpaceAdd(std::vector< tools::Long > *pNew)
Definition: inftxt.hxx:450
void SetPaintOfst(const SwTwips nNew)
Definition: inftxt.hxx:748
SwTextFly & GetTextFly()
Definition: inftxt.hxx:387
SwTwips X() const
Definition: inftxt.hxx:382
void SetPos(const Point &rNew)
Definition: inftxt.hxx:435
SwTwips GetPaintOfst() const
Definition: inftxt.hxx:743
const Point & GetPos() const
Definition: inftxt.hxx:434
void DrawViewOpt(const SwLinePortion &rPor, PortionType nWhich, const Color *pColor=nullptr) const
Definition: inftxt.cxx:1468
void ResetSpaceIdx()
Definition: inftxt.hxx:442
SwTwips Y() const
Definition: inftxt.hxx:384
void CtorInitTextPainter(SwTextFrame *pFrame, SwTextPaintInfo *pInf)
Definition: itrpaint.cxx:64
This portion represents a part of the paragraph string.
Definition: portxt.hxx:27
virtual void Paint(const SwTextPaintInfo &rInf) const override
Definition: portxt.cxx:529
SwTextFrame * GetTextFrame()
Definition: inftxt.hxx:288
vcl::RenderContext * GetOut()
Definition: inftxt.hxx:225
sal_uInt16 GetHangingBaseline() const
Definition: inftxt.hxx:725
SwViewShell * GetVsh()
Definition: inftxt.hxx:222
const SwViewOption & GetOpt() const
Definition: inftxt.hxx:239
void SetMulti(const bool bNew)
Definition: inftxt.hxx:205
void SetLen(const TextFrameIndex nNew)
Definition: inftxt.hxx:276
void ResetKanaIdx()
Definition: inftxt.hxx:323
void ResetMaxWidthDiff()
Definition: inftxt.hxx:311
sal_uInt16 GetTextHeight() const
Definition: inftxt.hxx:719
SwFont * GetFont()
Definition: inftxt.hxx:232
void SetIdx(const TextFrameIndex nNew)
Definition: inftxt.hxx:274
bool HasScriptSpace() const
Definition: inftxt.hxx:212
void SetDirection(const sal_uInt8 nNew)
Definition: inftxt.hxx:219
sal_uInt16 GetAscent() const
Definition: inftxt.hxx:713
sal_Unicode GetChar(TextFrameIndex const nPos) const
Definition: inftxt.hxx:241
bool IsRuby() const
Definition: inftxt.hxx:208
void SetKanaComp(std::deque< sal_uInt16 > *pNew)
Definition: inftxt.hxx:326
TextFrameIndex GetLen() const
Definition: inftxt.hxx:275
bool IsOtherThanFootnoteInside() const
Definition: inftxt.hxx:202
void SelectFont()
Definition: inftxt.cxx:377
void SetFootnoteInside(const bool bNew)
Definition: inftxt.hxx:201
std::optional< SwMultiCreator > GetMultiCreator(TextFrameIndex &rPos, SwMultiPortion const *pM) const
Definition: pormulti.cxx:934
const OUString & GetText() const
Definition: inftxt.hxx:240
TextFrameIndex GetIdx() const
Definition: inftxt.hxx:273
bool SnapToGrid() const
Definition: inftxt.hxx:216
void SetOtherThanFootnoteInside(const bool bNew)
Definition: inftxt.hxx:203
bool HasHint(TextFrameIndex nPos) const
Definition: inftxt.cxx:488
bool IsMulti() const
Definition: inftxt.hxx:204
void SetStopUnderflow(const bool bNew)
Definition: inftxt.hxx:199
bool IsPrinting() const
Definition: viewopt.hxx:596
bool IsShowHiddenChar(bool bHard=false) const
Definition: viewopt.hxx:489
bool IsFieldName() const
Definition: viewopt.hxx:419
vcl::Window * GetWin() const
Definition: viewsh.hxx:363
static DrawFlyCntPortion * Create(const SwTextFrame &rFrame, SwFrameFormat const &rFormat, const Point &rBase, tools::Long nAsc, tools::Long nDescent, tools::Long nFlyAsc, tools::Long nFlyDesc, AsCharFlags nFlags)
Definition: porfly.cxx:302
static FlyContentPortion * Create(const SwTextFrame &rFrame, SwFlyInContentFrame *pFly, const Point &rBase, tools::Long nAscent, tools::Long nDescent, tools::Long nFlyAsc, tools::Long nFlyDesc, AsCharFlags nFlags)
Definition: porfly.cxx:295
virtual bool IsChecked() const =0
virtual editeng::HangulHanjaConversion::ConversionDirection GetDirection(editeng::HangulHanjaConversion::ConversionDirection _eDefaultDirection) const override
float u
LINESTYLE_NONE
#define CH_TXT_ATR_FIELDSEP
Definition: hintids.hxx:184
#define CH_TXT_ATR_INPUTFIELDSTART
Definition: hintids.hxx:178
#define CH_TXT_ATR_FORMELEMENT
Definition: hintids.hxx:181
constexpr TypedWhichId< SwFlyFrameFormat > RES_FLYFRMFMT(162)
constexpr TypedWhichId< SwFormatContentControl > RES_TXTATR_CONTENTCONTROL(56)
constexpr TypedWhichId< SvxCharRotateItem > RES_CHRATR_ROTATE(32)
#define CH_TXTATR_INWORD
Definition: hintids.hxx:175
#define CH_TXT_ATR_INPUTFIELDEND
Definition: hintids.hxx:179
#define CH_TXT_ATR_FIELDEND
Definition: hintids.hxx:185
#define CH_TXT_ATR_FIELDSTART
Definition: hintids.hxx:183
#define CH_TXTATR_BREAKWORD
Definition: hintids.hxx:174
#define DIR_BOTTOM2TOP
Definition: inftxt.hxx:55
#define DIR_TOP2BOTTOM
Definition: inftxt.hxx:57
CharClass & GetAppCharClass()
Definition: init.cxx:721
sal_Int32 nIndex
static bool lcl_OldFieldRest(const SwLineLayout *pCurr)
Definition: itrform2.cxx:1534
static void ClearFly(SwTextFormatInfo &rInf)
Definition: itrform2.cxx:87
bool IsUnderlineBreak(const SwLinePortion &rPor, const SwFont &rFnt)
Definition: itrpaint.cxx:47
#define SAL_WARN_IF(condition, area, stream)
#define SAL_INFO(area, stream)
uno::Reference< text::XTextContent > GetNestedTextContent(SwTextNode const &rTextNode, sal_Int32 const nIndex, bool const bParent)
SwNumRule * GetNumRule(SwTextFormatColl &rTextFormatColl)
determines the list style, which directly set at the given paragraph style
Definition: fmtcol.cxx:74
double getLength(const B2DPolygon &rCandidate)
OUString removeAny(std::u16string_view rIn, sal_Unicode const *const pChars)
int i
tools::Long SnapToGrid(KernArray &rKernArray, std::u16string_view aText, 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:176
OUString ExpandFieldmark(IFieldmark *pBM)
Definition: itrform2.cxx:1115
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
@ Parent
EXPAND : (Start < nIndex <= End)
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
SwNodeOffset abs(const SwNodeOffset &a)
Definition: nodeoffset.hxx:34
constexpr OUStringLiteral ODF_FORMTEXT
constexpr OUStringLiteral ODF_FORMDROPDOWN_RESULT
constexpr OUStringLiteral ODF_FORMDROPDOWN_LISTENTRY
constexpr OUStringLiteral ODF_FORMCHECKBOX
constexpr OUStringLiteral ODF_FORMDATE
constexpr OUStringLiteral ODF_FORMDROPDOWN
SwTextGridItem const * GetGridItem(SwPageFrame const *const)
Definition: pagechg.cxx:2659
sal_uInt16 GetGridWidth(SwTextGridItem const &, SwDoc const &)
Definition: pagechg.cxx:2673
static SfxItemSet & rSet
sal_uIntPtr sal_uLong
Marks a position in the document model.
Definition: pam.hxx:38
SwNode & GetNode() const
Definition: pam.hxx:81
sal_Int32 GetContentIndex() const
Definition: pam.hxx:85
std::vector< OUString > Entries
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
#define CHAR_HARDBLANK
Definition: swtypes.hxx:173
tools::Long SwTwips
Definition: swtypes.hxx:51
#define CHAR_SOFTHYPHEN
Definition: swtypes.hxx:175
#define CHAR_WJ
Definition: swtypes.hxx:179
#define CHAR_HARDHYPHEN
Definition: swtypes.hxx:174
#define CHAR_ZWSP
Definition: swtypes.hxx:178
constexpr sal_Int32 COMPLETE_STRING
Definition: swtypes.hxx:57
@ GRID_LINES_CHARS
Definition: tgrditem.hxx:30
Left
PortionType
Definition: txttypes.hxx:24
#define SAL_MAX_UINT16
sal_uInt16 sal_Unicode