LibreOffice Module sw (master) 1
portxt.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#include <com/sun/star/i18n/ScriptType.hpp>
21#include <com/sun/star/i18n/XBreakIterator.hpp>
23#include <breakit.hxx>
24#include <hintids.hxx>
26#include <SwPortionHandler.hxx>
27#include "porlay.hxx"
28#include "inftxt.hxx"
29#include "guess.hxx"
30#include "porfld.hxx"
31#include <pagefrm.hxx>
32#include <tgrditem.hxx>
35
36#include <IMark.hxx>
37#include <pam.hxx>
38#include <doc.hxx>
39#include <xmloff/odffields.hxx>
40#include <viewopt.hxx>
41
42using namespace ::sw::mark;
43using namespace ::com::sun::star;
44using namespace ::com::sun::star::i18n::ScriptType;
45
46// Returns for how many characters an extra space has to be added
47// (for justified alignment).
49 const OUString* pStr, const SwLinePortion& rPor)
50{
51 TextFrameIndex nPos, nEnd;
52 const SwScriptInfo* pSI = nullptr;
53
54 if ( pStr )
55 {
56 // passing a string means we are inside a field
58 nEnd = TextFrameIndex(pStr->getLength());
59 }
60 else
61 {
62 nPos = rInf.GetIdx();
63 nEnd = rInf.GetIdx() + rPor.GetLen();
64 pStr = &rInf.GetText();
65 pSI = &const_cast<SwParaPortion*>(rInf.GetParaPortion())->GetScriptInfo();
66 }
67
68 TextFrameIndex nCnt(0);
69 sal_uInt8 nScript = 0;
70
71 // If portion consists of Asian characters and language is not
72 // Korean, we add extra space to each character.
73 // first we get the script type
74 if ( pSI )
75 nScript = pSI->ScriptType( nPos );
76 else
77 nScript = static_cast<sal_uInt8>(
78 g_pBreakIt->GetBreakIter()->getScriptType(*pStr, sal_Int32(nPos)));
79
80 // Note: rInf.GetIdx() can differ from nPos,
81 // e.g., when rPor is a field portion. nPos refers to the string passed
82 // to the function, rInf.GetIdx() refers to the original string.
83
84 // We try to find out which justification mode is required. This is done by
85 // evaluating the script type and the language attribute set for this portion
86
87 // Asian Justification: Each character get some extra space
88 if ( nEnd > nPos && ASIAN == nScript )
89 {
90 LanguageType aLang =
91 rInf.GetTextFrame()->GetLangOfChar(rInf.GetIdx(), nScript);
92
93 if (!MsLangId::isKorean(aLang))
94 {
95 const SwLinePortion* pPor = rPor.GetNextPortion();
96 if ( pPor && ( pPor->IsKernPortion() ||
97 pPor->IsControlCharPortion() ||
98 pPor->IsPostItsPortion() ) )
99 pPor = pPor->GetNextPortion();
100
101 nCnt += SwScriptInfo::CountCJKCharacters( *pStr, nPos, nEnd, aLang );
102
103 if ( !pPor || pPor->IsHolePortion() || pPor->InFixMargGrp() ||
104 pPor->IsBreakPortion() )
105 --nCnt;
106
107 return nCnt;
108 }
109 }
110
111 // Kashida Justification: Insert Kashidas
112 if ( nEnd > nPos && pSI && COMPLEX == nScript )
113 {
114 if ( SwScriptInfo::IsArabicText( *pStr, nPos, nEnd - nPos ) && pSI->CountKashida() )
115 {
116 const sal_Int32 nKashRes = pSI->KashidaJustify(nullptr, nullptr, nPos, nEnd - nPos);
117 // i60591: need to check result of KashidaJustify
118 // determine if kashida justification is applicable
119 if (nKashRes != -1)
120 return TextFrameIndex(nKashRes);
121 }
122 }
123
124 // Thai Justification: Each character cell gets some extra space
125 if ( nEnd > nPos && COMPLEX == nScript )
126 {
127 LanguageType aLang =
128 rInf.GetTextFrame()->GetLangOfChar(rInf.GetIdx(), nScript);
129
130 if ( LANGUAGE_THAI == aLang )
131 {
132 nCnt = SwScriptInfo::ThaiJustify(*pStr, nullptr, nPos, nEnd - nPos);
133
134 const SwLinePortion* pPor = rPor.GetNextPortion();
135 if ( pPor && ( pPor->IsKernPortion() ||
136 pPor->IsControlCharPortion() ||
137 pPor->IsPostItsPortion() ) )
138 pPor = pPor->GetNextPortion();
139
140 if ( nCnt && ( ! pPor || pPor->IsHolePortion() || pPor->InFixMargGrp() ) )
141 --nCnt;
142
143 return nCnt;
144 }
145 }
146
147 // Here starts the good old "Look for blanks and add space to them" part.
148 // Note: We do not want to add space to an isolated latin blank in front
149 // of some complex characters in RTL environment
150 const bool bDoNotAddSpace =
151 LATIN == nScript && (nEnd == nPos + TextFrameIndex(1)) && pSI &&
152 ( i18n::ScriptType::COMPLEX ==
153 pSI->ScriptType(nPos + TextFrameIndex(1))) &&
154 rInf.GetTextFrame() && rInf.GetTextFrame()->IsRightToLeft();
155
156 if ( bDoNotAddSpace )
157 return nCnt;
158
159 TextFrameIndex nTextEnd = std::min(nEnd, TextFrameIndex(pStr->getLength()));
160 for ( ; nPos < nTextEnd; ++nPos )
161 {
162 if (CH_BLANK == (*pStr)[ sal_Int32(nPos) ])
163 ++nCnt;
164 }
165
166 // We still have to examine the next character:
167 // If the next character is ASIAN and not KOREAN we have
168 // to add an extra space
169 // nPos refers to the original string, even if a field string has
170 // been passed to this function
171 nPos = rInf.GetIdx() + rPor.GetLen();
172 if (nPos < TextFrameIndex(rInf.GetText().getLength()))
173 {
174 sal_uInt8 nNextScript = 0;
175 const SwLinePortion* pPor = rPor.GetNextPortion();
176 if ( pPor && pPor->IsKernPortion() )
177 pPor = pPor->GetNextPortion();
178
179 if (!pPor || pPor->InFixMargGrp())
180 return nCnt;
181
182 // next character is inside a field?
183 if ( CH_TXTATR_BREAKWORD == rInf.GetChar( nPos ) && pPor->InExpGrp() )
184 {
185 bool bOldOnWin = rInf.OnWin();
186 const_cast<SwTextSizeInfo &>(rInf).SetOnWin( false );
187
188 OUString aStr;
189 pPor->GetExpText( rInf, aStr );
190 const_cast<SwTextSizeInfo &>(rInf).SetOnWin( bOldOnWin );
191
192 nNextScript = static_cast<sal_uInt8>(g_pBreakIt->GetBreakIter()->getScriptType( aStr, 0 ));
193 }
194 else
195 nNextScript = static_cast<sal_uInt8>(
196 g_pBreakIt->GetBreakIter()->getScriptType(rInf.GetText(), sal_Int32(nPos)));
197
198 if( ASIAN == nNextScript )
199 {
200 LanguageType aLang =
201 rInf.GetTextFrame()->GetLangOfChar(nPos, nNextScript);
202
203 if (!MsLangId::isKorean(aLang))
204 ++nCnt;
205 }
206 }
207
208 return nCnt;
209}
210
212{
213 SwTextPortion *const pNew(new SwTextPortion);
214 static_cast<SwLinePortion&>(*pNew) = rPortion;
215 pNew->SetWhichPor( PortionType::Text ); // overwrite that!
216 return pNew;
217}
218
220{
221 // The word/char is larger than the line
222 // Special case 1: The word is larger than the line
223 // We truncate ...
224 const sal_uInt16 nLineWidth = o3tl::narrowing<sal_uInt16>(rInf.Width() - rInf.X());
225 TextFrameIndex nLen = rGuess.CutPos() - rInf.GetIdx();
226 if (nLen > TextFrameIndex(0))
227 {
228 // special case: guess does not always provide the correct
229 // width, only in common cases.
230 if ( !rGuess.BreakWidth() )
231 {
232 rInf.SetLen( nLen );
233 SetLen( nLen );
234 CalcTextSize( rInf );
235
236 // changing these values requires also changing them in
237 // guess.cxx
238 sal_uInt16 nItalic = 0;
239 if( ITALIC_NONE != rInf.GetFont()->GetItalic() && !rInf.NotEOL() )
240 {
241 nItalic = Height() / 12;
242 }
243 Width( Width() + nItalic );
244 }
245 else
246 {
247 Width( rGuess.BreakWidth() );
248 SetLen( nLen );
249 }
250 }
251 // special case: first character does not fit to line
252 else if ( rGuess.CutPos() == rInf.GetLineStart() )
253 {
255 Width( nLineWidth );
256 }
257 else
258 {
260 Width( 0 );
261 }
262}
263
265{
266 Truncate();
267 Height( 0 );
268 Width( 0 );
270 SetAscent( 0 );
271 rInf.SetUnderflow( this );
272}
273
274static bool lcl_HasContent( const SwFieldPortion& rField, SwTextFormatInfo const &rInf )
275{
276 OUString aText;
277 return rField.GetExpText( rInf, aText ) && !aText.isEmpty();
278}
279
281{
282 // 5744: If only the hyphen does not fit anymore, we still need to wrap
283 // the word, or else return true!
284 if( rInf.IsUnderflow() && rInf.GetSoftHyphPos() )
285 {
286 // soft hyphen portion has triggered an underflow event because
287 // of an alternative spelling position
288 bool bFull = false;
289 const bool bHyph = rInf.ChgHyph( true );
290 if( rInf.IsHyphenate() )
291 {
292 SwTextGuess aGuess;
293 // check for alternative spelling left from the soft hyphen
294 // this should usually be true but
295 aGuess.AlternativeSpelling(rInf, rInf.GetSoftHyphPos() - TextFrameIndex(1));
296 bFull = CreateHyphen( rInf, aGuess );
297 OSL_ENSURE( bFull, "Problem with hyphenation!!!" );
298 }
299 rInf.ChgHyph( bHyph );
301 return bFull;
302 }
303
304 SwTextGuess aGuess;
305 const bool bFull = !aGuess.Guess( *this, rInf, Height() );
306
307 // these are the possible cases:
308 // A Portion fits to current line
309 // B Portion does not fit to current line but a possible line break
310 // within the portion has been found by the break iterator, 2 subcases
311 // B1 break is hyphen
312 // B2 break is word end
313 // C Portion does not fit to current line and no possible line break
314 // has been found by break iterator, 2 subcases:
315 // C1 break iterator found a possible line break in portion before us
316 // ==> this break is used (underflow)
317 // C2 break iterator does not found a possible line break at all:
318 // ==> line break
319
320 // case A: line not yet full
321 if ( !bFull )
322 {
323 Width( aGuess.BreakWidth() );
325 // Caution!
326 if( !InExpGrp() || InFieldGrp() )
327 SetLen( rInf.GetLen() );
328
329 short nKern = rInf.GetFont()->CheckKerning();
330 if( nKern > 0 && rInf.Width() < rInf.X() + Width() + nKern )
331 {
332 nKern = static_cast<short>(rInf.Width() - rInf.X() - Width() - 1);
333 if( nKern < 0 )
334 nKern = 0;
335 }
336 if( nKern )
337 new SwKernPortion( *this, nKern );
338 }
339 // special case: hanging portion
340 else if( bFull && aGuess.GetHangingPortion() )
341 {
342 Width( aGuess.BreakWidth() );
343 SetLen( aGuess.BreakPos() - rInf.GetIdx() );
345 Insert( aGuess.ReleaseHangingPortion() );
346 }
347 // breakPos >= index
348 else if (aGuess.BreakPos() >= rInf.GetIdx() && aGuess.BreakPos() != TextFrameIndex(COMPLETE_STRING))
349 {
350 // case B1
351 if( aGuess.HyphWord().is() && aGuess.BreakPos() > rInf.GetLineStart()
352 && ( aGuess.BreakPos() > rInf.GetIdx() ||
353 ( rInf.GetLast() && ! rInf.GetLast()->IsFlyPortion() ) ) )
354 {
355 CreateHyphen( rInf, aGuess );
356 if ( rInf.GetFly() )
357 rInf.GetRoot()->SetMidHyph( true );
358 else
359 rInf.GetRoot()->SetEndHyph( true );
360 }
361 // case C1
362 // - Footnote portions with fake line start (i.e., not at beginning of line)
363 // should keep together with the text portion. (Note: no keep together
364 // with only footnote portions.
365 // - TabPortions not at beginning of line should keep together with the
366 // text portion, if they are not followed by a blank
367 // (work around different definition of tab stop character - breaking or
368 // non breaking character - in compatibility mode)
369 else if ( ( IsFootnotePortion() && rInf.IsFakeLineStart() &&
370
371 rInf.IsOtherThanFootnoteInside() ) ||
372 ( rInf.GetLast() &&
374 rInf.GetLast()->InTabGrp() &&
375 rInf.GetLineStart() + rInf.GetLast()->GetLen() < rInf.GetIdx() &&
376 aGuess.BreakPos() == rInf.GetIdx() &&
377 CH_BLANK != rInf.GetChar( rInf.GetIdx() ) &&
378 CH_FULL_BLANK != rInf.GetChar( rInf.GetIdx() ) &&
379 CH_SIX_PER_EM != rInf.GetChar( rInf.GetIdx() ) ) )
380 BreakUnderflow( rInf );
381 // case B2
382 else if( rInf.GetIdx() > rInf.GetLineStart() ||
383 aGuess.BreakPos() > rInf.GetIdx() ||
384 // this is weird: during formatting the follow of a field
385 // the values rInf.GetIdx and rInf.GetLineStart are replaced
386 // IsFakeLineStart indicates GetIdx > GetLineStart
387 rInf.IsFakeLineStart() ||
388 rInf.GetFly() ||
389 rInf.IsFirstMulti() ||
390 ( rInf.GetLast() &&
391 ( rInf.GetLast()->IsFlyPortion() ||
392 ( rInf.GetLast()->InFieldGrp() &&
393 ! rInf.GetLast()->InNumberGrp() &&
394 ! rInf.GetLast()->IsErgoSumPortion() &&
395 lcl_HasContent(*static_cast<SwFieldPortion*>(rInf.GetLast()),rInf ) ) ) ) )
396 {
397 // GetLineWidth() takes care of DocumentSettingId::TAB_OVER_MARGIN.
398 if (aGuess.BreakWidth() <= rInf.GetLineWidth())
399 Width( aGuess.BreakWidth() );
400 else
401 // this actually should not happen
402 Width( sal_uInt16(rInf.Width() - rInf.X()) );
403
404 SetLen( aGuess.BreakPos() - rInf.GetIdx() );
405
406 OSL_ENSURE( aGuess.BreakStart() >= aGuess.FieldDiff(),
407 "Trouble with expanded field portions during line break" );
408 TextFrameIndex const nRealStart = aGuess.BreakStart() - aGuess.FieldDiff();
409 if( aGuess.BreakPos() < nRealStart && !InExpGrp() )
410 {
411 SwHolePortion *pNew = new SwHolePortion( *this );
412 pNew->SetLen( nRealStart - aGuess.BreakPos() );
413 pNew->Width(0);
414 pNew->ExtraBlankWidth( aGuess.ExtraBlankWidth() );
415 Insert( pNew );
416 }
417 }
418 else // case C2, last exit
419 BreakCut( rInf, aGuess );
420 }
421 // breakPos < index or no breakpos at all
422 else
423 {
424 bool bFirstPor = rInf.GetLineStart() == rInf.GetIdx();
425 if (aGuess.BreakPos() != TextFrameIndex(COMPLETE_STRING) &&
426 aGuess.BreakPos() != rInf.GetLineStart() &&
427 ( !bFirstPor || rInf.GetFly() || rInf.GetLast()->IsFlyPortion() ||
428 rInf.IsFirstMulti() ) &&
429 ( !rInf.GetLast()->IsBlankPortion() ||
430 SwBlankPortion::MayUnderflow(rInf, rInf.GetIdx() - TextFrameIndex(1), true)))
431 { // case C1 (former BreakUnderflow())
432 BreakUnderflow( rInf );
433 }
434 else
435 // case C2, last exit
436 BreakCut(rInf, aGuess);
437 }
438
439 return bFull;
440}
441
443{
444 // GetLineWidth() takes care of DocumentSettingId::TAB_OVER_MARGIN.
445 if( rInf.GetLineWidth() < 0 || (!GetLen() && !InExpGrp()) )
446 {
447 Height( 0 );
448 Width( 0 );
450 SetAscent( 0 );
451 SetNextPortion( nullptr ); // ????
452 return true;
453 }
454
455 OSL_ENSURE( rInf.RealWidth() || (rInf.X() == rInf.Width()),
456 "SwTextPortion::Format: missing real width" );
457 OSL_ENSURE( Height(), "SwTextPortion::Format: missing height" );
458
459 return Format_( rInf );
460}
461
462// Format end of line
463// 5083: We can have awkward cases e.g.:
464// "from {Santa}"
465// Santa wraps, "from " turns into "from" and " " in a justified
466// paragraph, in which the glue gets expanded instead of merged
467// with the MarginPortion.
468
469// rInf.nIdx points to the next word, nIdx-1 is the portion's last char
471{
472 if( ( GetNextPortion() &&
474 !GetLen() ||
475 rInf.GetIdx() >= TextFrameIndex(rInf.GetText().getLength()) ||
476 TextFrameIndex(1) >= rInf.GetIdx() ||
477 ' ' != rInf.GetChar(rInf.GetIdx() - TextFrameIndex(1)) ||
478 rInf.GetLast()->IsHolePortion() )
479 return;
480
481 // calculate number of blanks
482 TextFrameIndex nX(rInf.GetIdx() - TextFrameIndex(1));
483 TextFrameIndex nHoleLen(1);
484 while( nX && nHoleLen < GetLen() && CH_BLANK == rInf.GetChar( --nX ) )
485 nHoleLen++;
486
487 // First set ourselves and the insert, because there could be
488 // a SwLineLayout
489 sal_uInt16 nBlankSize;
490 if( nHoleLen == GetLen() )
491 nBlankSize = Width();
492 else
493 nBlankSize = sal_Int32(nHoleLen) * rInf.GetTextSize(OUString(' ')).Width();
494 Width( Width() - nBlankSize );
495 rInf.X( rInf.X() - nBlankSize );
496 SetLen( GetLen() - nHoleLen );
497 SwLinePortion *pHole = new SwHolePortion( *this );
498 static_cast<SwHolePortion *>( pHole )->SetBlankWidth( nBlankSize );
499 static_cast<SwHolePortion *>( pHole )->SetLen( nHoleLen );
500 Insert( pHole );
501
502}
503
505{
506 OSL_ENSURE( false, "SwTextPortion::GetModelPositionForViewPoint: don't use this method!" );
508}
509
510// The GetTextSize() assumes that the own length is correct
512{
513 SwPosSize aSize = rInf.GetTextSize();
514 if( !GetJoinBorderWithPrev() )
515 aSize.Width(aSize.Width() + rInf.GetFont()->GetLeftBorderSpace() );
516 if( !GetJoinBorderWithNext() )
517 aSize.Width(aSize.Width() + rInf.GetFont()->GetRightBorderSpace() );
518
519 aSize.Height(aSize.Height() +
520 rInf.GetFont()->GetTopBorderSpace() +
521 rInf.GetFont()->GetBottomBorderSpace() );
522
523 return aSize;
524}
525
526void SwTextPortion::Paint( const SwTextPaintInfo &rInf ) const
527{
528 if (rInf.OnWin() && TextFrameIndex(1) == rInf.GetLen()
529 && CH_TXT_ATR_FIELDEND == rInf.GetText()[sal_Int32(rInf.GetIdx())])
530 {
531 assert(false); // this is some debugging only code
532 rInf.DrawBackBrush( *this );
533 const OUString aText(CH_TXT_ATR_SUBST_FIELDEND);
534 rInf.DrawText(aText, *this, TextFrameIndex(0), TextFrameIndex(aText.getLength()));
535 }
536 else if (rInf.OnWin() && TextFrameIndex(1) == rInf.GetLen()
537 && CH_TXT_ATR_FIELDSTART == rInf.GetText()[sal_Int32(rInf.GetIdx())])
538 {
539 assert(false); // this is some debugging only code
540 rInf.DrawBackBrush( *this );
541 const OUString aText(CH_TXT_ATR_SUBST_FIELDSTART);
542 rInf.DrawText(aText, *this, TextFrameIndex(0), TextFrameIndex(aText.getLength()));
543 }
544 else if( GetLen() )
545 {
546 rInf.DrawBackBrush( *this );
547 rInf.DrawBorder( *this );
548
549 rInf.DrawCSDFHighlighting(*this);
550
551 // do we have to repaint a post it portion?
552 if( rInf.OnWin() && mpNextPortion && !mpNextPortion->Width() )
553 mpNextPortion->PrePaint( rInf, this );
554
555 auto const* pWrongList = rInf.GetpWrongList();
556 auto const* pGrammarCheckList = rInf.GetGrammarCheckList();
557 auto const* pSmarttags = rInf.GetSmartTags();
558
559 const bool bWrong = nullptr != pWrongList;
560 const bool bGrammarCheck = nullptr != pGrammarCheckList;
561 const bool bSmartTags = nullptr != pSmarttags;
562
563 if ( bWrong || bSmartTags || bGrammarCheck )
564 rInf.DrawMarkedText( *this, rInf.GetLen(), bWrong, bSmartTags, bGrammarCheck );
565 else
566 rInf.DrawText( *this, rInf.GetLen() );
567 }
568}
569
570bool SwTextPortion::GetExpText( const SwTextSizeInfo &, OUString & ) const
571{
572 return false;
573}
574
575// Responsible for the justified paragraph. They calculate the blank
576// count and the resulting added space.
578 TextFrameIndex& rCharCnt) const
579{
580 TextFrameIndex nCnt(0);
582
583 if ( rInf.SnapToGrid() )
584 {
585 SwTextGridItem const*const pGrid(GetGridItem(rInf.GetTextFrame()->FindPageFrame()));
586 if (pGrid && GRID_LINES_CHARS == pGrid->GetGridType() && pGrid->IsSnapToChars())
587 return TextFrameIndex(0);
588 }
589
591 {
592 if (OUString ExpOut;
594 || (GetExpText(rInf, ExpOut) && OUStringChar(CH_BLANK) == ExpOut))
595 && !InNumberGrp() && !IsCombinedPortion())
596 {
597 // OnWin() likes to return a blank instead of an empty string from
598 // time to time. We cannot use that here at all, however.
599 bool bOldOnWin = rInf.OnWin();
600 const_cast<SwTextSizeInfo &>(rInf).SetOnWin( false );
601
602 OUString aStr;
603 GetExpText( rInf, aStr );
604 const_cast<SwTextSizeInfo &>(rInf).SetOnWin( bOldOnWin );
605
606 nCnt = nCnt + lcl_AddSpace( rInf, &aStr, *this );
607 nPos = TextFrameIndex(aStr.getLength());
608 }
609 }
610 else if( !IsDropPortion() )
611 {
612 nCnt = nCnt + lcl_AddSpace( rInf, nullptr, *this );
613 nPos = GetLen();
614 }
615 rCharCnt = rCharCnt + nPos;
616 return nCnt;
617}
618
620{
621 TextFrameIndex nCnt(0);
622
623 if ( rInf.SnapToGrid() )
624 {
625 SwTextGridItem const*const pGrid(GetGridItem(rInf.GetTextFrame()->FindPageFrame()));
626 if (pGrid && GRID_LINES_CHARS == pGrid->GetGridType() && pGrid->IsSnapToChars())
627 return 0;
628 }
629
631 {
632 if (OUString ExpOut;
634 || (GetExpText(rInf, ExpOut) && OUStringChar(CH_BLANK) == ExpOut))
635 && !InNumberGrp() && !IsCombinedPortion())
636 {
637 // OnWin() likes to return a blank instead of an empty string from
638 // time to time. We cannot use that here at all, however.
639 bool bOldOnWin = rInf.OnWin();
640 const_cast<SwTextSizeInfo &>(rInf).SetOnWin( false );
641
642 OUString aStr;
643 GetExpText( rInf, aStr );
644 const_cast<SwTextSizeInfo &>(rInf).SetOnWin( bOldOnWin );
645 if( nSpaceAdd > 0 )
646 nCnt = nCnt + lcl_AddSpace( rInf, &aStr, *this );
647 else
648 {
649 nSpaceAdd = -nSpaceAdd;
650 nCnt = TextFrameIndex(aStr.getLength());
651 }
652 }
653 }
654 else if( !IsDropPortion() )
655 {
656 if( nSpaceAdd > 0 )
657 nCnt = nCnt + lcl_AddSpace( rInf, nullptr, *this );
658 else
659 {
660 nSpaceAdd = -nSpaceAdd;
661 nCnt = GetLen();
663
664 // we do not want an extra space in front of margin portions
665 if ( nCnt )
666 {
667 while ( pPor && !pPor->Width() && ! pPor->IsHolePortion() )
668 pPor = pPor->GetNextPortion();
669
670 if ( !pPor || pPor->InFixMargGrp() || pPor->IsHolePortion() )
671 --nCnt;
672 }
673 }
674 }
675
676 return sal_Int32(nCnt) * nSpaceAdd / SPACING_PRECISION_FACTOR;
677}
678
680{
681 rPH.Text( GetLen(), GetWhichPor() );
682}
683
685{
687}
688
690{
691 return SwTextPortion::Format(rTextFormatInfo);
692}
693
695{
696 if ( Width() )
697 {
699 SwTextSlot aPaintText( &rInf, this, true, true, OUString() );
700 SwTextPortion::Paint( rInf );
701 }
702 else
703 {
704 // highlight empty input field, elsewhere they are completely invisible for the user
705 SwRect aIntersect;
706 rInf.CalcRect(*this, &aIntersect);
707 const sal_uInt16 aAreaWidth = rInf.GetTextSize(OUString(' ')).Width();
708 aIntersect.Left(aIntersect.Left() - aAreaWidth/2);
709 aIntersect.Width(aAreaWidth);
710
711 if (aIntersect.HasArea()
712 && rInf.OnWin()
713 && rInf.GetOpt().IsFieldShadings()
714 && !rInf.GetOpt().IsPagePreview())
715 {
716 OutputDevice* pOut = const_cast<OutputDevice*>(rInf.GetOut());
718 pOut->SetFillColor(rInf.GetOpt().GetFieldShadingsColor());
719 pOut->SetLineColor();
720 pOut->DrawRect(aIntersect.SVRect());
721 pOut->Pop();
722 }
723 }
724}
725
726bool SwTextInputFieldPortion::GetExpText( const SwTextSizeInfo &rInf, OUString &rText ) const
727{
728 sal_Int32 nIdx(rInf.GetIdx());
729 sal_Int32 nLen(GetLen());
730 if ( rInf.GetChar( rInf.GetIdx() ) == CH_TXT_ATR_INPUTFIELDSTART )
731 {
732 ++nIdx;
733 --nLen;
734 }
735 if (rInf.GetChar(rInf.GetIdx() + GetLen() - TextFrameIndex(1)) == CH_TXT_ATR_INPUTFIELDEND)
736 {
737 --nLen;
738 }
739 rText = rInf.GetText().copy( nIdx, std::min( nLen, rInf.GetText().getLength() - nIdx ) );
740
741 return true;
742}
743
745{
746 SwTextSlot aFormatText( &rInf, this, true, false );
747 if (rInf.GetLen() == TextFrameIndex(0))
748 {
749 return SwPosSize( 0, 0 );
750 }
751
752 return rInf.GetTextSize();
753}
754
756 : m_nBlankWidth( 0 )
757{
759 Height( rPor.Height() );
760 Width(0);
761 SetAscent( rPor.GetAscent() );
763}
764
766
767// The GetTextSize() assumes that the own length is correct
769{
770 SwPosSize aSize = rInf.GetTextSize();
772 aSize.Width(aSize.Width() + rInf.GetFont()->GetLeftBorderSpace());
774 aSize.Width(aSize.Width() + rInf.GetFont()->GetRightBorderSpace());
775
776 aSize.Height(aSize.Height() +
777 rInf.GetFont()->GetTopBorderSpace() +
778 rInf.GetFont()->GetBottomBorderSpace());
779
780 return aSize;
781}
782
783void SwHolePortion::Paint( const SwTextPaintInfo &rInf ) const
784{
785 if( !rInf.GetOut() )
786 return;
787
788 bool bPDFExport = rInf.GetVsh()->GetViewOptions()->IsPDFExport();
789
790 // #i16816# export stuff only needed for tagged pdf support
791 if (bPDFExport && !SwTaggedPDFHelper::IsExportTaggedPDF( *rInf.GetOut()) )
792 return;
793
794 // #i68503# the hole must have no decoration for a consistent visual appearance
795 const SwFont* pOrigFont = rInf.GetFont();
796 std::unique_ptr<SwFont> pHoleFont;
797 std::optional<SwFontSave> oFontSave;
798 if( pOrigFont->GetUnderline() != LINESTYLE_NONE
799 || pOrigFont->GetOverline() != LINESTYLE_NONE
800 || pOrigFont->GetStrikeout() != STRIKEOUT_NONE )
801 {
802 pHoleFont.reset(new SwFont( *pOrigFont ));
803 pHoleFont->SetUnderline( LINESTYLE_NONE );
804 pHoleFont->SetOverline( LINESTYLE_NONE );
805 pHoleFont->SetStrikeout( STRIKEOUT_NONE );
806 oFontSave.emplace( rInf, pHoleFont.get() );
807 }
808
809 if (bPDFExport)
810 {
811 rInf.DrawText(" ", *this, TextFrameIndex(0), TextFrameIndex(1));
812 }
813 else
814 {
815 // tdf#43244: Paint spaces even at end of line,
816 // but only if this paint is not called for pdf export, to keep that pdf export intact
817 rInf.DrawText(*this, rInf.GetLen());
818 }
819
820 oFontSave.reset();
821 pHoleFont.reset();
822}
823
825{
826 return rInf.IsFull() || rInf.X() >= rInf.Width();
827}
828
830{
831 rPH.Text( GetLen(), GetWhichPor() );
832}
833
834void SwHolePortion::dumpAsXml(xmlTextWriterPtr pWriter, const OUString& rText, TextFrameIndex& nOffset) const
835{
836 (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SwHolePortion"));
837 dumpAsXmlAttributes(pWriter, rText, nOffset);
838 nOffset += GetLen();
839
840 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("blank-width"),
841 BAD_CAST(OString::number(m_nBlankWidth).getStr()));
842
843 (void)xmlTextWriterEndElement(pWriter);
844}
845
846void SwFieldMarkPortion::Paint( const SwTextPaintInfo & /*rInf*/) const
847{
848 // These shouldn't be painted!
849 //SwTextPortion::Paint(rInf);
850}
851
853{
854 Width(0);
855 return false;
856}
857
859{
860 SwPosition const aPosition(rInf.GetTextFrame()->MapViewToModelPos(rInf.GetIdx()));
861
862 IFieldmark const*const pBM = rInf.GetTextFrame()->GetDoc().getIDocumentMarkAccess()->getFieldmarkAt(aPosition);
863
864 OSL_ENSURE(pBM && pBM->GetFieldname( ) == ODF_FORMCHECKBOX,
865 "Where is my form field bookmark???");
866
867 if (pBM && pBM->GetFieldname( ) == ODF_FORMCHECKBOX)
868 {
869 const ICheckboxFieldmark* pCheckboxFm = dynamic_cast<ICheckboxFieldmark const*>(pBM);
870 bool bChecked = pCheckboxFm && pCheckboxFm->IsChecked();
871 rInf.DrawCheckBox(*this, bChecked);
872 }
873}
874
876{
877 SwPosition const aPosition(rInf.GetTextFrame()->MapViewToModelPos(rInf.GetIdx()));
878 IFieldmark const*const pBM = rInf.GetTextFrame()->GetDoc().getIDocumentMarkAccess()->getFieldmarkAt(aPosition);
879 OSL_ENSURE(pBM && pBM->GetFieldname( ) == ODF_FORMCHECKBOX, "Where is my form field bookmark???");
880 if (pBM && pBM->GetFieldname( ) == ODF_FORMCHECKBOX)
881 {
882 // the width of the checkbox portion is the same as its height since it's a square
883 // and that size depends on the font size.
884 // See:
885 // http://document-foundation-mail-archive.969070.n3.nabble.com/Wrong-copy-paste-in-SwFieldFormCheckboxPortion-Format-td4269112.html
886 Width( rInf.GetTextHeight( ) );
887 Height( rInf.GetTextHeight( ) );
888 SetAscent( rInf.GetAscent( ) );
889 }
890 return false;
891}
892
893/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal_Int32 nLineWidth
o3tl::strong_int< sal_Int32, struct Tag_TextFrameIndex > TextFrameIndex
Denotes a character index in a text frame at a layout level, after extent mapping from a text node at...
#define COMPLEX
#define ASIAN
SwBreakIt * g_pBreakIt
Definition: breakit.cxx:34
virtual ::sw::mark::IFieldmark * getFieldmarkAt(const SwPosition &rPos) const =0
get Fieldmark for CH_TXT_ATR_FIELDSTART/CH_TXT_ATR_FIELDEND at rPos
virtual bool get(DocumentSettingId id) const =0
Return the specified document setting.
static bool isKorean(LanguageType nLang)
static sal_uInt16 MayUnderflow(const SwTextFormatInfo &rInf, TextFrameIndex nIdx, bool bUnderflow)
If a Line is full of HardBlanks and overflows, we must not generate underflows! Causes problems with ...
Definition: porexp.cxx:118
css::uno::Reference< css::i18n::XBreakIterator > const & GetBreakIter() const
Definition: breakit.hxx:63
IDocumentSettingAccess const & getIDocumentSettingAccess() const
Definition: doc.cxx:190
IDocumentMarkAccess * getIDocumentMarkAccess()
Definition: docbm.cxx:1890
virtual void Paint(const SwTextPaintInfo &rInf) const override
Definition: portxt.cxx:858
virtual bool Format(SwTextFormatInfo &rInf) override
Definition: portxt.cxx:875
virtual bool Format(SwTextFormatInfo &rInf) override
Definition: portxt.cxx:852
virtual void Paint(const SwTextPaintInfo &rInf) const override
Definition: portxt.cxx:846
virtual bool GetExpText(const SwTextSizeInfo &rInf, OUString &rText) const override
Definition: porfld.cxx:471
To take Asian or other languages into consideration, an SwFont object consists of 3 SwSubFonts (Latin...
Definition: swfont.hxx:135
FontItalic GetItalic() const
Definition: swfont.hxx:285
sal_uInt16 GetBottomBorderSpace() const
Definition: swfont.hxx:880
sal_uInt16 GetTopBorderSpace() const
Definition: swfont.hxx:865
FontLineStyle GetUnderline() const
Definition: swfont.hxx:275
sal_uInt16 GetRightBorderSpace() const
Definition: swfont.hxx:895
FontStrikeout GetStrikeout() const
Definition: swfont.hxx:279
short CheckKerning()
Definition: swfont.hxx:327
FontLineStyle GetOverline() const
Definition: swfont.hxx:277
void SetUnderline(const FontLineStyle eUnderline)
Definition: swfont.hxx:552
sal_uInt16 GetLeftBorderSpace() const
Definition: swfont.hxx:910
bool IsRightToLeft() const
Definition: frame.hxx:993
SwPageFrame * FindPageFrame()
Definition: frame.hxx:686
virtual SwPosSize GetTextSize(const SwTextSizeInfo &rInfo) const override
Definition: portxt.cxx:768
sal_uInt16 m_nBlankWidth
Definition: portxt.hxx:65
virtual SwLinePortion * Compress() override
Definition: portxt.cxx:765
virtual bool Format(SwTextFormatInfo &rInf) override
Definition: portxt.cxx:824
SwHolePortion(const SwTextPortion &rPor)
Definition: portxt.cxx:755
virtual void Paint(const SwTextPaintInfo &rInf) const override
Definition: portxt.cxx:783
void dumpAsXml(xmlTextWriterPtr pWriter, const OUString &rText, TextFrameIndex &nOffset) const override
Definition: portxt.cxx:834
virtual void HandlePortion(SwPortionHandler &rPH) const override
Definition: portxt.cxx:829
void SetMidHyph(const bool bNew)
Definition: porlay.hxx:124
void SetEndHyph(const bool bNew)
Definition: porlay.hxx:122
Base class for anything that can be part of a line in the Writer layout.
Definition: porlin.hxx:52
bool IsBlankPortion() const
Definition: porlin.hxx:120
void dumpAsXmlAttributes(xmlTextWriterPtr writer, std::u16string_view rText, TextFrameIndex nOffset) const
Definition: porlin.cxx:333
SwLinePortion * mpNextPortion
Definition: porlin.hxx:55
virtual TextFrameIndex GetModelPositionForViewPoint(sal_uInt16 nOfst) const
the parameter is actually SwTwips apparently?
Definition: porlin.cxx:226
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
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
bool IsKernPortion() const
Definition: porlin.hxx:141
bool GetJoinBorderWithNext() const
Definition: porlin.hxx:178
void Truncate()
Definition: porlin.hxx:214
virtual bool GetExpText(const SwTextSizeInfo &rInf, OUString &rText) const
Definition: porlin.cxx:314
bool IsControlCharPortion() const
Definition: porlin.hxx:145
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 InTabGrp() const
Definition: porlin.hxx:107
bool IsBreakPortion() const
Definition: porlin.hxx:121
void CalcTextSize(const SwTextSizeInfo &rInfo)
Definition: porlin.cxx:139
void SetLen(TextFrameIndex const nLen)
Definition: porlin.hxx:78
bool IsCombinedPortion() const
Definition: porlin.hxx:138
bool IsHolePortion() const
Definition: porlin.hxx:135
bool InFieldGrp() const
Definition: porlin.hxx:111
bool IsFlyPortion() const
Definition: porlin.hxx:134
SwTwips ExtraBlankWidth() const
Definition: porlin.hxx:87
void SetWhichPor(const PortionType nNew)
Definition: porlin.hxx:101
bool InExpGrp() const
Definition: porlin.hxx:114
bool InFixMargGrp() const
Definition: porlin.hxx:115
void PrePaint(const SwTextPaintInfo &rInf, const SwLinePortion *pLast) const
Definition: porlin.cxx:77
virtual SwLinePortion * Insert(SwLinePortion *pPortion)
Definition: porlin.cxx:169
Collection of SwLineLayout instances, represents the paragraph text in Writer layout.
Definition: porlay.hxx:251
The SwPortionHandler interface implements a visitor for the layout engine's text portions.
virtual void Text(TextFrameIndex nLength, PortionType nType)=0
(empty) destructor
SwTwips Width() const
Definition: possiz.hxx:51
SwPosSize(const SwTwips nW=0, const SwTwips nH=0)
Definition: possiz.hxx:30
SwTwips Height() const
Definition: possiz.hxx:49
Of course Writer needs its own rectangles.
Definition: swrect.hxx:35
bool HasArea() const
Definition: swrect.hxx:300
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
sal_Int16 ScriptType(const TextFrameIndex nPos) const
Definition: porlay.cxx:1871
sal_Int32 KashidaJustify(KernArray *pKernArray, sal_Bool *pKashidaArray, TextFrameIndex nStt, TextFrameIndex nLen, tools::Long nSpaceAdd=0) const
Performs a kashida justification on the kerning array.
Definition: porlay.cxx:2307
static TextFrameIndex CountCJKCharacters(const OUString &rText, TextFrameIndex nPos, TextFrameIndex nEnd, LanguageType aLang)
Definition: porlay.cxx:2934
static TextFrameIndex ThaiJustify(std::u16string_view aText, KernArray *pKernArray, TextFrameIndex nIdx, TextFrameIndex nLen, TextFrameIndex nNumberOfBlanks=TextFrameIndex(0), tools::Long nSpaceAdd=0)
Performs a thai justification on the kerning array.
Definition: porlay.cxx:2569
size_t CountKashida() const
Definition: scriptinfo.hxx:152
static bool IsArabicText(const OUString &rText, TextFrameIndex nStt, TextFrameIndex nLen)
Checks if text is Arabic text.
Definition: porlay.cxx:2395
static bool IsExportTaggedPDF(const OutputDevice &rOut)
SwLinePortion * GetLast()
Definition: inftxt.hxx:566
bool IsFakeLineStart() const
Definition: inftxt.hxx:577
SwLineLayout * GetRoot()
Definition: inftxt.hxx:562
sal_uInt16 RealWidth() const
Definition: inftxt.hxx:554
TextFrameIndex GetLineStart() const
Definition: inftxt.hxx:595
bool IsUnderflow() const
Definition: inftxt.hxx:588
bool IsFull() const
Definition: inftxt.hxx:568
sal_uInt16 Width() const
Definition: inftxt.hxx:533
SwFlyPortion * GetFly()
Definition: inftxt.hxx:614
TextFrameIndex GetSoftHyphPos() const
Definition: inftxt.hxx:608
bool IsHyphenate() const
If the Hyphenator returns ERROR or the language is set to NOLANGUAGE we do not hyphenate.
Definition: inftxt.cxx:1658
SwTwips GetLineWidth()
Returns the distance between the current horizontal position and the end of the line.
Definition: inftxt.cxx:1935
void SetUnderflow(SwLinePortion *pNew)
Definition: inftxt.hxx:606
void SetSoftHyphPos(TextFrameIndex const nNew)
Definition: inftxt.hxx:609
bool ChgHyph(const bool bNew)
Definition: inftxt.cxx:2157
SwDoc & GetDoc()
Definition: txtfrm.hxx:475
SwPosition MapViewToModelPos(TextFrameIndex nIndex) const
Definition: txtfrm.cxx:1333
LanguageType GetLangOfChar(TextFrameIndex nIndex, sal_uInt16 nScript, bool bNoChar=false) const
Definition: txtfrm.cxx:1430
SwTextGrid GetGridType() const
Definition: tgrditem.hxx:81
bool IsSnapToChars() const
Definition: tgrditem.hxx:100
bool AlternativeSpelling(const SwTextFormatInfo &rInf, const TextFrameIndex nPos)
Definition: guess.cxx:672
SwHangingPortion * GetHangingPortion() const
Definition: guess.hxx:52
TextFrameIndex FieldDiff() const
Definition: guess.hxx:59
sal_uInt16 BreakWidth() const
Definition: guess.hxx:54
SwHangingPortion * ReleaseHangingPortion()
Definition: guess.hxx:53
TextFrameIndex BreakStart() const
Definition: guess.hxx:57
const css::uno::Reference< css::linguistic2::XHyphenatedWord > & HyphWord() const
Definition: guess.hxx:60
TextFrameIndex CutPos() const
Definition: guess.hxx:56
TextFrameIndex BreakPos() const
Definition: guess.hxx:58
bool Guess(const SwTextPortion &rPor, SwTextFormatInfo &rInf, const sal_uInt16 nHeight)
Definition: guess.cxx:52
sal_uInt16 ExtraBlankWidth() const
Definition: guess.hxx:55
SwParaPortion * GetParaPortion()
Definition: inftxt.hxx:121
virtual bool Format(SwTextFormatInfo &rInf) override
Definition: portxt.cxx:689
virtual bool GetExpText(const SwTextSizeInfo &rInf, OUString &rText) const override
Definition: portxt.cxx:726
virtual void Paint(const SwTextPaintInfo &rInf) const override
Definition: portxt.cxx:694
virtual SwPosSize GetTextSize(const SwTextSizeInfo &rInfo) const override
Definition: portxt.cxx:744
void DrawCSDFHighlighting(const SwLinePortion &rPor) const
Definition: inftxt.cxx:1336
void DrawMarkedText(const SwLinePortion &rPor, TextFrameIndex nLen, const bool bWrong, const bool bSmartTags, const bool bGrammarCheck) const
Definition: inftxt.hxx:767
sw::WrongListIterator * GetpWrongList() const
Definition: inftxt.hxx:454
void DrawText(const OUString &rText, const SwLinePortion &rPor, TextFrameIndex nIdx=TextFrameIndex(0), TextFrameIndex nLen=TextFrameIndex(COMPLETE_STRING), const bool bKern=false) const
Definition: inftxt.hxx:753
SwTwips X() const
Definition: inftxt.hxx:382
void CalcRect(const SwLinePortion &rPor, SwRect *pRect, SwRect *pIntersect=nullptr, const bool bInsideBox=false) const
Calculate the rectangular area where the portion takes place.
Definition: inftxt.cxx:735
void DrawBackBrush(const SwLinePortion &rPor) const
Definition: inftxt.cxx:1158
sw::WrongListIterator * GetGrammarCheckList() const
Definition: inftxt.hxx:457
void DrawViewOpt(const SwLinePortion &rPor, PortionType nWhich, const Color *pColor=nullptr) const
Definition: inftxt.cxx:1470
void DrawCheckBox(const SwFieldFormCheckboxPortion &rPor, bool bChecked) const
Definition: inftxt.cxx:1103
void DrawBorder(const SwLinePortion &rPor) const
Draw character border around a line portion.
Definition: inftxt.cxx:1291
sw::WrongListIterator * GetSmartTags() const
Definition: inftxt.hxx:460
This portion represents a part of the paragraph string.
Definition: portxt.hxx:27
virtual SwPosSize GetTextSize(const SwTextSizeInfo &rInfo) const override
Definition: portxt.cxx:511
virtual bool GetExpText(const SwTextSizeInfo &rInf, OUString &rText) const override
Definition: portxt.cxx:570
bool CreateHyphen(SwTextFormatInfo &rInf, SwTextGuess const &rGuess)
Definition: txthyph.cxx:252
virtual void Paint(const SwTextPaintInfo &rInf) const override
Definition: portxt.cxx:526
virtual void HandlePortion(SwPortionHandler &rPH) const override
Definition: portxt.cxx:679
void BreakUnderflow(SwTextFormatInfo &rInf)
Definition: portxt.cxx:264
virtual TextFrameIndex GetModelPositionForViewPoint(sal_uInt16 nOfst) const override
the parameter is actually SwTwips apparently?
Definition: portxt.cxx:504
void BreakCut(SwTextFormatInfo &rInf, const SwTextGuess &rGuess)
Definition: portxt.cxx:219
TextFrameIndex GetSpaceCnt(const SwTextSizeInfo &rInf, TextFrameIndex &rCnt) const
Definition: portxt.cxx:577
static SwTextPortion * CopyLinePortion(const SwLinePortion &rPortion)
Definition: portxt.cxx:211
virtual bool Format(SwTextFormatInfo &rInf) override
Definition: portxt.cxx:442
bool Format_(SwTextFormatInfo &rInf)
Definition: portxt.cxx:280
virtual void FormatEOL(SwTextFormatInfo &rInf) override
Definition: portxt.cxx:470
virtual tools::Long CalcSpacing(tools::Long nSpaceAdd, const SwTextSizeInfo &rInf) const override
Definition: portxt.cxx:619
SwTextFrame * GetTextFrame()
Definition: inftxt.hxx:288
vcl::RenderContext * GetOut()
Definition: inftxt.hxx:225
SwViewShell * GetVsh()
Definition: inftxt.hxx:222
const SwViewOption & GetOpt() const
Definition: inftxt.hxx:239
void SetLen(const TextFrameIndex nNew)
Definition: inftxt.hxx:276
sal_uInt16 GetTextHeight() const
Definition: inftxt.hxx:719
SwFont * GetFont()
Definition: inftxt.hxx:232
bool OnWin() const
Definition: inftxt.hxx:193
SwPosSize GetTextSize(OutputDevice *pOut, const SwScriptInfo *pSI, const OUString &rText, TextFrameIndex nIdx, TextFrameIndex nLen) const
Definition: inftxt.cxx:395
sal_uInt16 GetAscent() const
Definition: inftxt.hxx:713
sal_Unicode GetChar(TextFrameIndex const nPos) const
Definition: inftxt.hxx:241
TextFrameIndex GetLen() const
Definition: inftxt.hxx:275
bool IsOtherThanFootnoteInside() const
Definition: inftxt.hxx:202
bool NotEOL() const
Definition: inftxt.hxx:195
bool IsFirstMulti() const
Definition: inftxt.hxx:206
const OUString & GetText() const
Definition: inftxt.hxx:240
TextFrameIndex GetIdx() const
Definition: inftxt.hxx:273
bool SnapToGrid() const
Definition: inftxt.hxx:216
For the text replacement and restoration of SwTextSizeInfo.
Definition: inftxt.hxx:680
bool IsPagePreview() const
Definition: viewopt.hxx:799
bool IsPDFExport() const
Definition: viewopt.hxx:588
const Color & GetFieldShadingsColor() const
Definition: viewopt.cxx:522
bool IsFieldShadings() const
Definition: viewopt.hxx:835
const SwViewOption * GetViewOptions() const
Definition: viewsh.hxx:452
struct _xmlTextWriter * xmlTextWriterPtr
LINESTYLE_NONE
STRIKEOUT_NONE
ITALIC_NONE
constexpr OUStringLiteral CH_TXT_ATR_SUBST_FIELDSTART
Definition: hintids.hxx:186
#define CH_TXT_ATR_INPUTFIELDSTART
Definition: hintids.hxx:178
constexpr OUStringLiteral CH_TXT_ATR_SUBST_FIELDEND
Definition: hintids.hxx:187
#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 LANGUAGE_THAI
sal_uInt16 nPos
aStr
long Long
SwNodeOffset min(const SwNodeOffset &a, const SwNodeOffset &b)
Definition: nodeoffset.hxx:35
constexpr OUStringLiteral ODF_FORMCHECKBOX
SwTextGridItem const * GetGridItem(SwPageFrame const *const)
Definition: pagechg.cxx:2676
static TextFrameIndex lcl_AddSpace(const SwTextSizeInfo &rInf, const OUString *pStr, const SwLinePortion &rPor)
Definition: portxt.cxx:48
static bool lcl_HasContent(const SwFieldPortion &rField, SwTextFormatInfo const &rInf)
Definition: portxt.cxx:274
#define SPACING_PRECISION_FACTOR
Definition: scriptinfo.hxx:41
Marks a position in the document model.
Definition: pam.hxx:38
const sal_Unicode CH_SIX_PER_EM
Definition: swfont.hxx:49
const sal_Unicode CH_BLANK
Definition: swfont.hxx:42
const sal_Unicode CH_FULL_BLANK
Definition: swfont.hxx:47
constexpr sal_Int32 COMPLETE_STRING
Definition: swtypes.hxx:57
@ GRID_LINES_CHARS
Definition: tgrditem.hxx:30
unsigned char sal_uInt8
oslFileHandle & pOut