LibreOffice Module sw (master)  1
itrcrsr.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 <ndtxt.hxx>
21 #include <doc.hxx>
22 #include <paratr.hxx>
23 #include <flyfrm.hxx>
24 #include <pam.hxx>
25 #include <swselectionlist.hxx>
26 #include <sortedobjs.hxx>
27 #include <editeng/adjustitem.hxx>
28 #include <editeng/lspcitem.hxx>
29 #include <editeng/lrspitem.hxx>
30 #include <frmatr.hxx>
31 #include <tgrditem.hxx>
33 #include <pagefrm.hxx>
34 
35 #include "itrtxt.hxx"
36 #include <txtfrm.hxx>
37 #include <flyfrms.hxx>
38 #include "porfld.hxx"
39 #include "porfly.hxx"
40 #include "pordrop.hxx"
41 #include <crstate.hxx>
42 #include "pormulti.hxx"
43 #include <numrule.hxx>
44 #include <com/sun/star/i18n/ScriptType.hpp>
45 
46 // Not reentrant !!!
47 // is set in GetCharRect and is interpreted in UnitUp/Down.
48 bool SwTextCursor::bRightMargin = false;
49 
50 // After calculating the position of a character during GetCharRect
51 // this function allows to find the coordinates of a position (defined
52 // in pCMS->pSpecialPos) inside a special portion (e.g., a field)
54  const SwCursorMoveState& rCMS,
55  const SwLinePortion& rPor )
56 {
57  OSL_ENSURE( rCMS.m_pSpecialPos, "Information about special pos missing" );
58 
59  if ( rPor.InFieldGrp() && !static_cast<const SwFieldPortion&>(rPor).GetExp().isEmpty() )
60  {
61  const sal_Int32 nCharOfst = rCMS.m_pSpecialPos->nCharOfst;
62  sal_Int32 nFieldIdx = 0;
63  sal_Int32 nFieldLen = 0;
64 
65  OUString sString;
66  const OUString* pString = nullptr;
67  const SwLinePortion* pPor = &rPor;
68  do
69  {
70  if ( pPor->InFieldGrp() )
71  {
72  sString = static_cast<const SwFieldPortion*>(pPor)->GetExp();
73  pString = &sString;
74  nFieldLen = pString->getLength();
75  }
76  else
77  {
78  pString = nullptr;
79  nFieldLen = 0;
80  }
81 
82  if ( ! pPor->GetNextPortion() || nFieldIdx + nFieldLen > nCharOfst )
83  break;
84 
85  nFieldIdx = nFieldIdx + nFieldLen;
86  rOrig.Pos().AdjustX(pPor->Width() );
87  pPor = pPor->GetNextPortion();
88 
89  } while ( true );
90 
91  OSL_ENSURE( nCharOfst >= nFieldIdx, "Request of position inside field failed" );
92  sal_Int32 nLen = nCharOfst - nFieldIdx + 1;
93 
94  if ( pString )
95  {
96  // get script for field portion
97  rInf.GetFont()->SetActual( SwScriptInfo::WhichFont(0, *pString) );
98 
99  TextFrameIndex const nOldLen = pPor->GetLen();
100  const_cast<SwLinePortion*>(pPor)->SetLen(TextFrameIndex(nLen - 1));
101  const SwTwips nX1 = pPor->GetLen() ?
102  pPor->GetTextSize( rInf ).Width() :
103  0;
104 
105  SwTwips nX2 = 0;
106  if ( rCMS.m_bRealWidth )
107  {
108  const_cast<SwLinePortion*>(pPor)->SetLen(TextFrameIndex(nLen));
109  nX2 = pPor->GetTextSize( rInf ).Width();
110  }
111 
112  const_cast<SwLinePortion*>(pPor)->SetLen( nOldLen );
113 
114  rOrig.Pos().AdjustX(nX1 );
115  rOrig.Width( ( nX2 > nX1 ) ?
116  ( nX2 - nX1 ) :
117  1 );
118  }
119  }
120  else
121  {
122  // special cases: no common fields, e.g., graphic number portion,
123  // FlyInCntPortions, Notes
124  rOrig.Width( rCMS.m_bRealWidth && rPor.Width() ? rPor.Width() : 1 );
125  }
126 }
127 
128 // #i111284#
129 namespace {
130  bool IsLabelAlignmentActive( const SwTextNode& rTextNode )
131  {
132  bool bRet( false );
133 
134  if ( rTextNode.GetNumRule() )
135  {
136  int nListLevel = rTextNode.GetActualListLevel();
137 
138  if (nListLevel < 0)
139  nListLevel = 0;
140 
141  if (nListLevel >= MAXLEVEL)
142  nListLevel = MAXLEVEL - 1;
143 
144  const SwNumFormat& rNumFormat =
145  rTextNode.GetNumRule()->Get( static_cast<sal_uInt16>(nListLevel) );
147  {
148  bRet = true;
149  }
150  }
151 
152  return bRet;
153  }
154 } // end of anonymous namespace
155 
157 {
158  CtorInitTextIter( pNewFrame, pNewInf );
159 
160  m_pInf = pNewInf;
161  GetInfo().SetFont( GetFnt() );
162  const SwTextNode *const pNode = m_pFrame->GetTextNodeForParaProps();
163 
164  const SvxLRSpaceItem &rSpace = pNode->GetSwAttrSet().GetLRSpace();
165  // #i95907#
166  // #i111284#
167  const SwTextNode *pTextNode = m_pFrame->GetTextNodeForParaProps();
168  const bool bLabelAlignmentActive = IsLabelAlignmentActive( *pTextNode );
169  const bool bListLevelIndentsApplicable = pTextNode->AreListLevelIndentsApplicable();
170  const bool bListLevelIndentsApplicableAndLabelAlignmentActive = bListLevelIndentsApplicable && bLabelAlignmentActive;
171 
172  // Carefully adjust the text formatting ranges.
173 
174  // This whole area desperately needs some rework. There are
175  // quite a couple of values that need to be considered:
176  // 1. paragraph indent
177  // 2. paragraph first line indent
178  // 3. numbering indent
179  // 4. numbering spacing to text
180  // 5. paragraph border
181  // Note: These values have already been used during calculation
182  // of the printing area of the paragraph.
183  const int nLMWithNum = pNode->GetLeftMarginWithNum( true );
184  if ( m_pFrame->IsRightToLeft() )
185  {
186  // this calculation is identical this the calculation for L2R layout - see below
189  nLMWithNum -
190  pNode->GetLeftMarginWithNum() -
191  // #i95907#
192  // #i111284#
193  // rSpace.GetLeft() + rSpace.GetTextLeft();
194  ( bListLevelIndentsApplicableAndLabelAlignmentActive
195  ? 0
196  : ( rSpace.GetLeft() - rSpace.GetTextLeft() ) );
197  }
198  else
199  {
200  // #i95907#
201  // #i111284#
202  if ( bListLevelIndentsApplicableAndLabelAlignmentActive ||
204  {
205  // this calculation is identical this the calculation for R2L layout - see above
208  nLMWithNum -
209  pNode->GetLeftMarginWithNum() -
210  // #i95907#
211  // #i111284#
212  ( bListLevelIndentsApplicableAndLabelAlignmentActive
213  ? 0
214  : ( rSpace.GetLeft() - rSpace.GetTextLeft() ) );
215  }
216  else
217  {
219  std::max( long( rSpace.GetTextLeft() + nLMWithNum ),
221  }
222  }
223 
225 
226  if( nLeft >= nRight &&
227  // #i53066# Omit adjustment of nLeft for numbered
228  // paras inside cells inside new documents:
230  !m_pFrame->IsInTab() ||
231  ( !nLMWithNum && !(bLabelAlignmentActive && !bListLevelIndentsApplicable) ) ) )
232  {
234  if( nLeft >= nRight ) // e.g. with large paragraph indentations in slim table columns
235  nRight = nLeft + 1; // einen goennen wir uns immer
236  }
237 
238  if( m_pFrame->IsFollow() && m_pFrame->GetOfst() )
239  nFirst = nLeft;
240  else
241  {
242  short nFLOfst = 0;
243  long nFirstLineOfs = 0;
244  if( !pNode->GetFirstLineOfsWithNum( nFLOfst ) &&
245  rSpace.IsAutoFirst() )
246  {
247  nFirstLineOfs = GetFnt()->GetSize( GetFnt()->GetActual() ).Height();
248  LanguageType const aLang = m_pFrame->GetLangOfChar(
249  TextFrameIndex(0), css::i18n::ScriptType::ASIAN);
250  if (aLang != LANGUAGE_KOREAN && aLang != LANGUAGE_JAPANESE)
251  nFirstLineOfs<<=1;
252 
253  const SvxLineSpacingItem *pSpace = m_aLineInf.GetLineSpacing();
254  if( pSpace )
255  {
256  switch( pSpace->GetLineSpaceRule() )
257  {
258  case SvxLineSpaceRule::Auto:
259  break;
260  case SvxLineSpaceRule::Min:
261  {
262  if( nFirstLineOfs < pSpace->GetLineHeight() )
263  nFirstLineOfs = pSpace->GetLineHeight();
264  break;
265  }
266  case SvxLineSpaceRule::Fix:
267  nFirstLineOfs = pSpace->GetLineHeight();
268  break;
269  default: OSL_FAIL( ": unknown LineSpaceRule" );
270  }
271  switch( pSpace->GetInterLineSpaceRule() )
272  {
273  case SvxInterLineSpaceRule::Off:
274  break;
275  case SvxInterLineSpaceRule::Prop:
276  {
277  long nTmp = pSpace->GetPropLineSpace();
278  // 50% is the minimum, at 0% we switch to
279  // the default value 100%...
280  if( nTmp < 50 )
281  nTmp = nTmp ? 50 : 100;
282 
283  nTmp *= nFirstLineOfs;
284  nTmp /= 100;
285  if( !nTmp )
286  ++nTmp;
287  nFirstLineOfs = nTmp;
288  break;
289  }
290  case SvxInterLineSpaceRule::Fix:
291  {
292  nFirstLineOfs += pSpace->GetInterLineSpace();
293  break;
294  }
295  default: OSL_FAIL( ": unknown InterLineSpaceRule" );
296  }
297  }
298  }
299  else
300  nFirstLineOfs = nFLOfst;
301 
302  // #i95907#
303  // #i111284#
304  if ( m_pFrame->IsRightToLeft() ||
305  bListLevelIndentsApplicableAndLabelAlignmentActive ||
307  {
308  nFirst = nLeft + nFirstLineOfs;
309  }
310  else
311  {
313  std::max( rSpace.GetTextLeft() + nLMWithNum+ nFirstLineOfs,
315  }
316 
317  // Note: <SwTextFrame::GetAdditionalFirstLineOffset()> returns a negative
318  // value for the new list label position and space mode LABEL_ALIGNMENT
319  // and label alignment CENTER and RIGHT in L2R layout respectively
320  // label alignment LEFT and CENTER in R2L layout
322 
323  if( nFirst >= nRight )
324  nFirst = nRight - 1;
325  }
327  nAdjust = rAdjust.GetAdjust();
328 
329  // left is left and right is right
330  if ( m_pFrame->IsRightToLeft() )
331  {
332  if ( SvxAdjust::Left == nAdjust )
333  nAdjust = SvxAdjust::Right;
334  else if ( SvxAdjust::Right == nAdjust )
335  nAdjust = SvxAdjust::Left;
336  }
337 
338  m_bOneBlock = rAdjust.GetOneWord() == SvxAdjust::Block;
339  m_bLastBlock = rAdjust.GetLastBlock() == SvxAdjust::Block;
340  m_bLastCenter = rAdjust.GetLastBlock() == SvxAdjust::Center;
341 
342  // #i91133#
344 
345  DropInit();
346 }
347 
349 {
351  const SwParaPortion *pPara = GetInfo().GetParaPortion();
352  if( pPara )
353  {
354  const SwDropPortion *pPorDrop = pPara->FindDropPortion();
355  if ( pPorDrop )
356  {
357  nDropLeft = pPorDrop->GetDropLeft();
358  nDropLines = pPorDrop->GetLines();
359  nDropHeight = pPorDrop->GetDropHeight();
360  nDropDescent = pPorDrop->GetDropDescent();
361  }
362  }
363 }
364 
365 // The function is interpreting / observing / evaluating / keeping / respecting the first line indention and the specified width.
367 {
368  SwTwips nRet = GetLeftMargin();
369  if( GetAdjust() != SvxAdjust::Left &&
371  {
372  // If the first portion is a Margin, then the
373  // adjustment is expressed by the portions.
374  if( GetAdjust() == SvxAdjust::Right )
375  nRet = Right() - CurrWidth();
376  else if( GetAdjust() == SvxAdjust::Center )
377  nRet += (GetLineWidth() - CurrWidth()) / 2;
378  }
379  return nRet;
380 }
381 
383 {
384  CtorInitTextMargin( pNewFrame, pNewInf );
385  // 6096: Attention, the iterators are derived!
386  // GetInfo().SetOut( GetInfo().GetWin() );
387 }
388 
389 // 1170: Ancient bug: Shift-End forgets the last character ...
391  SwCursorMoveState* pCMS, const long nMax )
392 {
393  // 1170: Ambiguity of document positions
394  bRightMargin = true;
395  CharCursorToLine(nOfst);
396 
397  // Somehow twisted: nOfst names the position behind the last
398  // character of the last line == This is the position in front of the first character
399  // of the line, in which we are situated:
400  if( nOfst != GetStart() || !m_pCurr->GetLen() )
401  {
402  // 8810: Master line RightMargin, after that LeftMargin
403  GetCharRect( pOrig, nOfst, pCMS, nMax );
404  bRightMargin = nOfst >= GetEnd() && nOfst < TextFrameIndex(GetInfo().GetText().getLength());
405  return;
406  }
407 
408  if( !GetPrev() || !GetPrev()->GetLen() || !PrevLine() )
409  {
410  GetCharRect( pOrig, nOfst, pCMS, nMax );
411  return;
412  }
413 
414  // If necessary, as catch up, do the adjustment
415  GetAdjusted();
416 
417  long nX = 0;
418  long nLast = 0;
420 
421  sal_uInt16 nTmpHeight, nTmpAscent;
422  CalcAscentAndHeight( nTmpAscent, nTmpHeight );
423  sal_uInt16 nPorHeight = nTmpHeight;
424  sal_uInt16 nPorAscent = nTmpAscent;
425 
426  // Search for the last Text/EndPortion of the line
427  while( pPor )
428  {
429  nX = nX + pPor->Width();
430  if( pPor->InTextGrp() || ( pPor->GetLen() && !pPor->IsFlyPortion()
431  && !pPor->IsHolePortion() ) || pPor->IsBreakPortion() )
432  {
433  nLast = nX;
434  nPorHeight = pPor->Height();
435  nPorAscent = pPor->GetAscent();
436  }
437  pPor = pPor->GetNextPortion();
438  }
439 
440  const Size aCharSize( 1, nTmpHeight );
441  pOrig->Pos( GetTopLeft() );
442  pOrig->SSize( aCharSize );
443  pOrig->Pos().AdjustX(nLast );
444  const SwTwips nTmpRight = Right() - 1;
445  if( pOrig->Left() > nTmpRight )
446  pOrig->Pos().setX( nTmpRight );
447 
448  if ( pCMS && pCMS->m_bRealHeight )
449  {
450  if ( nTmpAscent > nPorAscent )
451  pCMS->m_aRealHeight.setX( nTmpAscent - nPorAscent );
452  else
453  pCMS->m_aRealHeight.setX( 0 );
454  OSL_ENSURE( nPorHeight, "GetCharRect: Missing Portion-Height" );
455  pCMS->m_aRealHeight.setY( nPorHeight );
456  }
457 }
458 
459 // internal function, called by SwTextCursor::GetCharRect() to calculate
460 // the relative character position in the current line.
461 // pOrig refers to x and y coordinates, width and height of the cursor
462 // pCMS is used for restricting the cursor, if there are different font
463 // heights in one line ( first value = offset to y of pOrig, second
464 // value = real height of (shortened) cursor
466  SwCursorMoveState* pCMS )
467 {
468  const OUString aText = GetInfo().GetText();
469  SwTextSizeInfo aInf( GetInfo(), &aText, m_nStart );
470  if( GetPropFont() )
471  aInf.GetFont()->SetProportion( GetPropFont() );
472  sal_uInt16 nTmpAscent, nTmpHeight; // Line height
473  CalcAscentAndHeight( nTmpAscent, nTmpHeight );
474  const Size aCharSize( 1, nTmpHeight );
475  const Point aCharPos;
476  pOrig->Pos( aCharPos );
477  pOrig->SSize( aCharSize );
478 
479  // If we are looking for a position inside a field which covers
480  // more than one line we may not skip any "empty portions" at the
481  // beginning of a line
482  const bool bInsideFirstField = pCMS && pCMS->m_pSpecialPos &&
483  ( pCMS->m_pSpecialPos->nLineOfst ||
485  pCMS->m_pSpecialPos->nExtendRange );
486 
487  bool bWidth = pCMS && pCMS->m_bRealWidth;
488  if( !m_pCurr->GetLen() && !m_pCurr->Width() )
489  {
490  if ( pCMS && pCMS->m_bRealHeight )
491  {
492  pCMS->m_aRealHeight.setX( 0 );
493  pCMS->m_aRealHeight.setY( nTmpHeight );
494  }
495  }
496  else
497  {
498  sal_uInt16 nPorHeight = nTmpHeight;
499  sal_uInt16 nPorAscent = nTmpAscent;
500  SwTwips nX = 0;
501  SwTwips nTmpFirst = 0;
503  SwBidiPortion* pLastBidiPor = nullptr;
504  TextFrameIndex nLastBidiIdx(-1);
505  SwTwips nLastBidiPorWidth = 0;
506  std::deque<sal_uInt16>* pKanaComp = m_pCurr->GetpKanaComp();
507  sal_uInt16 nSpaceIdx = 0;
508  size_t nKanaIdx = 0;
509  long nSpaceAdd = m_pCurr->IsSpaceAdd() ? m_pCurr->GetLLSpaceAdd( 0 ) : 0;
510 
511  bool bNoText = true;
512 
513  // First all portions without Len at beginning of line are skipped.
514  // Exceptions are the mean special portions from WhichFirstPortion:
515  // Num, ErgoSum, FootnoteNum, FieldRests
516  // 8477: but also the only Textportion of an empty line with
517  // Right/Center-Adjustment! So not just pPor->GetExpandPortion() ...
518  while( pPor && !pPor->GetLen() && ! bInsideFirstField )
519  {
520  nX += pPor->Width();
521  if ( pPor->InSpaceGrp() && nSpaceAdd )
522  nX += pPor->CalcSpacing( nSpaceAdd, aInf );
523  if( bNoText )
524  nTmpFirst = nX;
525  // 8670: EndPortions count once as TextPortions.
526  // if( pPor->InTextGrp() || pPor->IsBreakPortion() )
527  if( pPor->InTextGrp() || pPor->IsBreakPortion() || pPor->InTabGrp() )
528  {
529  bNoText = false;
530  nTmpFirst = nX;
531  }
532  if( pPor->IsMultiPortion() && static_cast<SwMultiPortion*>(pPor)->HasTabulator() )
533  {
534  if ( m_pCurr->IsSpaceAdd() )
535  {
536  if ( ++nSpaceIdx < m_pCurr->GetLLSpaceAddCount() )
537  nSpaceAdd = m_pCurr->GetLLSpaceAdd( nSpaceIdx );
538  else
539  nSpaceAdd = 0;
540  }
541 
542  if( pKanaComp && ( nKanaIdx + 1 ) < pKanaComp->size() )
543  ++nKanaIdx;
544  }
545  if( pPor->InFixMargGrp() )
546  {
547  if( pPor->IsMarginPortion() )
548  bNoText = false;
549  else
550  {
551  // fix margin portion => next SpaceAdd, KanaComp value
552  if ( m_pCurr->IsSpaceAdd() )
553  {
554  if ( ++nSpaceIdx < m_pCurr->GetLLSpaceAddCount() )
555  nSpaceAdd = m_pCurr->GetLLSpaceAdd( nSpaceIdx );
556  else
557  nSpaceAdd = 0;
558  }
559 
560  if( pKanaComp && ( nKanaIdx + 1 ) < pKanaComp->size() )
561  ++nKanaIdx;
562  }
563  }
564  pPor = pPor->GetNextPortion();
565  }
566 
567  if( !pPor )
568  {
569  // There's just Spezialportions.
570  nX = nTmpFirst;
571  }
572  else
573  {
574  if( !pPor->IsMarginPortion() && !pPor->IsPostItsPortion() &&
575  (!pPor->InFieldGrp() || pPor->GetAscent() ) )
576  {
577  nPorHeight = pPor->Height();
578  nPorAscent = pPor->GetAscent();
579  }
580  while( pPor && !pPor->IsBreakPortion() && ( aInf.GetIdx() < nOfst ||
581  ( bWidth && ( pPor->IsKernPortion() || pPor->IsMultiPortion() ) ) ) )
582  {
583  if( !pPor->IsMarginPortion() && !pPor->IsPostItsPortion() &&
584  (!pPor->InFieldGrp() || pPor->GetAscent() ) )
585  {
586  nPorHeight = pPor->Height();
587  nPorAscent = pPor->GetAscent();
588  }
589 
590  // If we are behind the portion, we add the portion width to
591  // nX. Special case: nOfst = aInf.GetIdx() + pPor->GetLen().
592  // For common portions (including BidiPortions) we want to add
593  // the portion width to nX. For MultiPortions, nExtra = 0,
594  // therefore we go to the 'else' branch and start a recursion.
595  const TextFrameIndex nExtra( (pPor->IsMultiPortion()
596  && !static_cast<SwMultiPortion*>(pPor)->IsBidi()
597  && !bWidth)
598  ? 0 : 1 );
599  if ( aInf.GetIdx() + pPor->GetLen() < nOfst + nExtra )
600  {
601  if ( pPor->InSpaceGrp() && nSpaceAdd )
602  nX += pPor->PrtWidth() +
603  pPor->CalcSpacing( nSpaceAdd, aInf );
604  else
605  {
606  if( pPor->InFixMargGrp() && ! pPor->IsMarginPortion() )
607  {
608  // update to current SpaceAdd, KanaComp values
609  if ( m_pCurr->IsSpaceAdd() )
610  {
611  if ( ++nSpaceIdx < m_pCurr->GetLLSpaceAddCount() )
612  nSpaceAdd = m_pCurr->GetLLSpaceAdd( nSpaceIdx );
613  else
614  nSpaceAdd = 0;
615  }
616 
617  if ( pKanaComp &&
618  ( nKanaIdx + 1 ) < pKanaComp->size()
619  )
620  ++nKanaIdx;
621  }
622  if ( !pPor->IsFlyPortion() || ( pPor->GetNextPortion() &&
623  !pPor->GetNextPortion()->IsMarginPortion() ) )
624  nX += pPor->PrtWidth();
625  }
626  if( pPor->IsMultiPortion() )
627  {
628  if ( static_cast<SwMultiPortion*>(pPor)->HasTabulator() )
629  {
630  if ( m_pCurr->IsSpaceAdd() )
631  {
632  if ( ++nSpaceIdx < m_pCurr->GetLLSpaceAddCount() )
633  nSpaceAdd = m_pCurr->GetLLSpaceAdd( nSpaceIdx );
634  else
635  nSpaceAdd = 0;
636  }
637 
638  if( pKanaComp && ( nKanaIdx + 1 ) < pKanaComp->size() )
639  ++nKanaIdx;
640  }
641 
642  // if we are right behind a BidiPortion, we have to
643  // hold a pointer to the BidiPortion in order to
644  // find the correct cursor position, depending on the
645  // cursor level
646  if ( static_cast<SwMultiPortion*>(pPor)->IsBidi() &&
647  aInf.GetIdx() + pPor->GetLen() == nOfst )
648  {
649  pLastBidiPor = static_cast<SwBidiPortion*>(pPor);
650  nLastBidiIdx = aInf.GetIdx();
651  nLastBidiPorWidth = pLastBidiPor->Width() +
652  pLastBidiPor->CalcSpacing( nSpaceAdd, aInf );
653  }
654  }
655 
656  aInf.SetIdx( aInf.GetIdx() + pPor->GetLen() );
657  pPor = pPor->GetNextPortion();
658  }
659  else
660  {
661  if( pPor->IsMultiPortion() )
662  {
663  nTmpAscent = AdjustBaseLine( *m_pCurr, pPor );
664  GetInfo().SetMulti( true );
665  pOrig->Pos().AdjustY(nTmpAscent - nPorAscent );
666 
667  if( pCMS && pCMS->m_b2Lines )
668  {
669  const bool bRecursion (pCMS->m_p2Lines);
670  if ( !bRecursion )
671  {
672  pCMS->m_p2Lines.reset(new Sw2LinesPos);
673  pCMS->m_p2Lines->aLine = SwRect(aCharPos, aCharSize);
674  }
675 
676  if( static_cast<SwMultiPortion*>(pPor)->HasRotation() )
677  {
678  if( static_cast<SwMultiPortion*>(pPor)->IsRevers() )
679  pCMS->m_p2Lines->nMultiType = MultiPortionType::ROT_270;
680  else
681  pCMS->m_p2Lines->nMultiType = MultiPortionType::ROT_90;
682  }
683  else if( static_cast<SwMultiPortion*>(pPor)->IsDouble() )
684  pCMS->m_p2Lines->nMultiType = MultiPortionType::TWOLINE;
685  else if( static_cast<SwMultiPortion*>(pPor)->IsBidi() )
686  pCMS->m_p2Lines->nMultiType = MultiPortionType::BIDI;
687  else
688  pCMS->m_p2Lines->nMultiType = MultiPortionType::RUBY;
689 
690  SwTwips nTmpWidth = pPor->Width();
691  if( nSpaceAdd )
692  nTmpWidth += pPor->CalcSpacing(nSpaceAdd, aInf);
693 
694  SwRect aRect( Point(aCharPos.X() + nX, pOrig->Top() ),
695  Size( nTmpWidth, pPor->Height() ) );
696 
697  if ( ! bRecursion )
698  pCMS->m_p2Lines->aPortion = aRect;
699  else
700  pCMS->m_p2Lines->aPortion2 = aRect;
701  }
702 
703  // In a multi-portion we use GetCharRect()-function
704  // recursively and must add the x-position
705  // of the multi-portion.
706  TextFrameIndex const nOldStart = m_nStart;
707  SwTwips nOldY = m_nY;
708  sal_uInt8 nOldProp = GetPropFont();
709  m_nStart = aInf.GetIdx();
710  SwLineLayout* pOldCurr = m_pCurr;
711  m_pCurr = &static_cast<SwMultiPortion*>(pPor)->GetRoot();
712  if( static_cast<SwMultiPortion*>(pPor)->IsDouble() )
713  SetPropFont( 50 );
714 
715  SwTextGridItem const*const pGrid(
716  GetGridItem(GetTextFrame()->FindPageFrame()));
717  const bool bHasGrid = pGrid && GetInfo().SnapToGrid();
718  const sal_uInt16 nRubyHeight = bHasGrid ?
719  pGrid->GetRubyHeight() : 0;
720 
721  if( m_nStart + m_pCurr->GetLen() <= nOfst && GetNext() &&
722  ( ! static_cast<SwMultiPortion*>(pPor)->IsRuby() ||
723  static_cast<SwMultiPortion*>(pPor)->OnTop() ) )
724  {
725  sal_uInt16 nOffset;
726  // in grid mode we may only add the height of the
727  // ruby line if ruby line is on top
728  if ( bHasGrid &&
729  static_cast<SwMultiPortion*>(pPor)->IsRuby() &&
730  static_cast<SwMultiPortion*>(pPor)->OnTop() )
731  nOffset = nRubyHeight;
732  else
733  nOffset = GetLineHeight();
734 
735  pOrig->Pos().AdjustY(nOffset );
736  Next();
737  }
738 
739  const bool bSpaceChg = static_cast<SwMultiPortion*>(pPor)->
740  ChgSpaceAdd( m_pCurr, nSpaceAdd );
741  Point aOldPos = pOrig->Pos();
742 
743  // Ok, for ruby portions in grid mode we have to
744  // temporarily set the inner line height to the
745  // outer line height because that value is needed
746  // for the adjustment inside the recursion
747  const sal_uInt16 nOldRubyHeight = m_pCurr->Height();
748  const sal_uInt16 nOldRubyRealHeight = m_pCurr->GetRealHeight();
749  const bool bChgHeight =
750  static_cast<SwMultiPortion*>(pPor)->IsRuby() && bHasGrid;
751 
752  if ( bChgHeight )
753  {
754  m_pCurr->Height( pOldCurr->Height() - nRubyHeight );
755  m_pCurr->SetRealHeight( pOldCurr->GetRealHeight() -
756  nRubyHeight );
757  }
758 
759  SwLayoutModeModifier aLayoutModeModifier( *GetInfo().GetOut() );
760  if ( static_cast<SwMultiPortion*>(pPor)->IsBidi() )
761  {
762  aLayoutModeModifier.Modify(
763  static_cast<SwBidiPortion*>(pPor)->GetLevel() % 2 );
764  }
765 
766  GetCharRect_( pOrig, nOfst, pCMS );
767 
768  if ( bChgHeight )
769  {
770  m_pCurr->Height( nOldRubyHeight );
771  m_pCurr->SetRealHeight( nOldRubyRealHeight );
772  }
773 
774  // if we are still in the first row of
775  // our 2 line multiportion, we use the FirstMulti flag
776  // to indicate this
777  if ( static_cast<SwMultiPortion*>(pPor)->IsDouble() )
778  {
779  // the recursion may have damaged our font size
780  SetPropFont( nOldProp );
781  GetInfo().GetFont()->SetProportion( 100 );
782 
783  if ( m_pCurr == &static_cast<SwMultiPortion*>(pPor)->GetRoot() )
784  {
785  GetInfo().SetFirstMulti( true );
786 
787  // we want to treat a double line portion like a
788  // single line portion, if there is no text in
789  // the second line
790  if ( !m_pCurr->GetNext() ||
791  !m_pCurr->GetNext()->GetLen() )
792  GetInfo().SetMulti( false );
793  }
794  }
795  // ruby portions are treated like single line portions
796  else if( static_cast<SwMultiPortion*>(pPor)->IsRuby() ||
797  static_cast<SwMultiPortion*>(pPor)->IsBidi() )
798  GetInfo().SetMulti( false );
799 
800  // calculate cursor values
801  if( static_cast<SwMultiPortion*>(pPor)->HasRotation() )
802  {
803  GetInfo().SetMulti( false );
804  long nTmp = pOrig->Width();
805  pOrig->Width( pOrig->Height() );
806  pOrig->Height( nTmp );
807  nTmp = pOrig->Left() - aOldPos.X();
808 
809  // if we travel into our rotated portion from
810  // a line below, we have to take care, that the
811  // y coord in pOrig is less than line height:
812  if ( nTmp )
813  nTmp--;
814 
815  pOrig->Pos().setX( nX + aOldPos.X() );
816  if( static_cast<SwMultiPortion*>(pPor)->IsRevers() )
817  pOrig->Pos().setY( aOldPos.Y() + nTmp );
818  else
819  pOrig->Pos().setY( aOldPos.Y()
820  + pPor->Height() - nTmp - pOrig->Height() );
821  if ( pCMS && pCMS->m_bRealHeight )
822  {
823  pCMS->m_aRealHeight.setY( -pCMS->m_aRealHeight.Y() );
824  // result for rotated multi portion is not
825  // correct for reverse (270 degree) portions
826  if( static_cast<SwMultiPortion*>(pPor)->IsRevers() )
827  {
830  // if vertical alignment is set to auto,
831  // we switch from base line alignment
832  // to centered alignment
833  pCMS->m_aRealHeight.setX(
834  ( pOrig->Width() +
835  pCMS->m_aRealHeight.Y() ) / 2 );
836  else
837  pCMS->m_aRealHeight.setX(
838  pOrig->Width() -
839  pCMS->m_aRealHeight.X() +
840  pCMS->m_aRealHeight.Y() );
841  }
842  }
843  }
844  else
845  {
846  pOrig->Pos().AdjustY(aOldPos.Y() );
847  if ( static_cast<SwMultiPortion*>(pPor)->IsBidi() )
848  {
849  const SwTwips nPorWidth = pPor->Width() +
850  pPor->CalcSpacing( nSpaceAdd, aInf );
851  const SwTwips nInsideOfst = pOrig->Pos().X();
852  pOrig->Pos().setX( nX + nPorWidth -
853  nInsideOfst - pOrig->Width() );
854  }
855  else
856  pOrig->Pos().AdjustX(nX );
857 
858  if( static_cast<SwMultiPortion*>(pPor)->HasBrackets() )
859  pOrig->Pos().AdjustX(
860  static_cast<SwDoubleLinePortion*>(pPor)->PreWidth() );
861  }
862 
863  if( bSpaceChg )
865 
866  m_pCurr = pOldCurr;
867  m_nStart = nOldStart;
868  m_nY = nOldY;
869  m_bPrev = false;
870 
871  return;
872  }
873  if ( pPor->PrtWidth() )
874  {
875  TextFrameIndex const nOldLen = pPor->GetLen();
876  pPor->SetLen( nOfst - aInf.GetIdx() );
877  aInf.SetLen( pPor->GetLen() );
878  if( nX || !pPor->InNumberGrp() )
879  {
880  SeekAndChg( aInf );
881  const bool bOldOnWin = aInf.OnWin();
882  aInf.SetOnWin( false ); // no BULLETs!
883  SwTwips nTmp = nX;
884  aInf.SetKanaComp( pKanaComp );
885  aInf.SetKanaIdx( nKanaIdx );
886  nX += pPor->GetTextSize( aInf ).Width();
887  aInf.SetOnWin( bOldOnWin );
888  if ( pPor->InSpaceGrp() && nSpaceAdd )
889  nX += pPor->CalcSpacing( nSpaceAdd, aInf );
890  if( bWidth )
891  {
892  pPor->SetLen(pPor->GetLen() + TextFrameIndex(1));
893  aInf.SetLen( pPor->GetLen() );
894  aInf.SetOnWin( false ); // no BULLETs!
895  nTmp += pPor->GetTextSize( aInf ).Width();
896  aInf.SetOnWin( bOldOnWin );
897  if ( pPor->InSpaceGrp() && nSpaceAdd )
898  nTmp += pPor->CalcSpacing(nSpaceAdd, aInf);
899  pOrig->Width( nTmp - nX );
900  }
901  }
902  pPor->SetLen( nOldLen );
903 
904  // Shift the cursor with the right border width
905  // Note: nX remains positive because GetTextSize() also include the width of the right border
906  if( aInf.GetIdx() < nOfst && nOfst < aInf.GetIdx() + pPor->GetLen() )
907  {
908  // Find the current drop portion part and use its right border
909  if( pPor->IsDropPortion() && static_cast<SwDropPortion*>(pPor)->GetLines() > 1 )
910  {
911  SwDropPortion* pDrop = static_cast<SwDropPortion*>(pPor);
912  const SwDropPortionPart* pCurrPart = pDrop->GetPart();
913  TextFrameIndex nSumLength(0);
914  while( pCurrPart && (nSumLength += pCurrPart->GetLen()) < nOfst - aInf.GetIdx() )
915  {
916  pCurrPart = pCurrPart->GetFollow();
917  }
918  if( pCurrPart && nSumLength != nOfst - aInf.GetIdx() &&
919  pCurrPart->GetFont().GetRightBorder() && !pCurrPart->GetJoinBorderWithNext() )
920  {
921  nX -= pCurrPart->GetFont().GetRightBorderSpace();
922  }
923  }
924  else if( GetInfo().GetFont()->GetRightBorder() && !pPor->GetJoinBorderWithNext())
925  {
926  nX -= GetInfo().GetFont()->GetRightBorderSpace();
927  }
928  }
929  }
930  bWidth = false;
931  break;
932  }
933  }
934  }
935 
936  if( pPor )
937  {
938  OSL_ENSURE( !pPor->InNumberGrp() || bInsideFirstField, "Number surprise" );
939  bool bEmptyField = false;
940  if( pPor->InFieldGrp() && pPor->GetLen() )
941  {
942  SwFieldPortion *pTmp = static_cast<SwFieldPortion*>(pPor);
943  while( pTmp->HasFollow() && pTmp->GetExp().isEmpty() )
944  {
945  sal_uInt16 nAddX = pTmp->Width();
946  SwLinePortion *pNext = pTmp->GetNextPortion();
947  while( pNext && !pNext->InFieldGrp() )
948  {
949  OSL_ENSURE( !pNext->GetLen(), "Where's my field follow?" );
950  nAddX = nAddX + pNext->Width();
951  pNext = pNext->GetNextPortion();
952  }
953  if( !pNext )
954  break;
955  pTmp = static_cast<SwFieldPortion*>(pNext);
956  nPorHeight = pTmp->Height();
957  nPorAscent = pTmp->GetAscent();
958  nX += nAddX;
959  bEmptyField = true;
960  }
961  }
962  // 8513: Fields in justified text, skipped
963  while( pPor && !pPor->GetLen() && ! bInsideFirstField &&
964  ( pPor->IsFlyPortion() || pPor->IsKernPortion() ||
965  pPor->IsBlankPortion() || pPor->InTabGrp() ||
966  ( !bEmptyField && pPor->InFieldGrp() ) ) )
967  {
968  if ( pPor->InSpaceGrp() && nSpaceAdd )
969  nX += pPor->PrtWidth() +
970  pPor->CalcSpacing( nSpaceAdd, aInf );
971  else
972  {
973  if( pPor->InFixMargGrp() && ! pPor->IsMarginPortion() )
974  {
975  if ( m_pCurr->IsSpaceAdd() )
976  {
977  if ( ++nSpaceIdx < m_pCurr->GetLLSpaceAddCount() )
978  nSpaceAdd = m_pCurr->GetLLSpaceAdd( nSpaceIdx );
979  else
980  nSpaceAdd = 0;
981  }
982 
983  if( pKanaComp && ( nKanaIdx + 1 ) < pKanaComp->size() )
984  ++nKanaIdx;
985  }
986  if ( !pPor->IsFlyPortion() || ( pPor->GetNextPortion() &&
987  !pPor->GetNextPortion()->IsMarginPortion() ) )
988  nX += pPor->PrtWidth();
989  }
990  if( pPor->IsMultiPortion() &&
991  static_cast<SwMultiPortion*>(pPor)->HasTabulator() )
992  {
993  if ( m_pCurr->IsSpaceAdd() )
994  {
995  if ( ++nSpaceIdx < m_pCurr->GetLLSpaceAddCount() )
996  nSpaceAdd = m_pCurr->GetLLSpaceAdd( nSpaceIdx );
997  else
998  nSpaceAdd = 0;
999  }
1000 
1001  if( pKanaComp && ( nKanaIdx + 1 ) < pKanaComp->size() )
1002  ++nKanaIdx;
1003  }
1004  if( !pPor->IsFlyPortion() )
1005  {
1006  nPorHeight = pPor->Height();
1007  nPorAscent = pPor->GetAscent();
1008  }
1009  pPor = pPor->GetNextPortion();
1010  }
1011 
1012  if( aInf.GetIdx() == nOfst && pPor && pPor->InHyphGrp() &&
1013  pPor->GetNextPortion() && pPor->GetNextPortion()->InFixGrp() )
1014  {
1015  // All special portions have to be skipped
1016  // Taking the German word "zusammen" as example: zu-[FLY]sammen, 'u' == 19, 's' == 20; Right()
1017  // Without the adjustment we end up in front of '-', with the
1018  // adjustment in front of the 's'.
1019  while( pPor && !pPor->GetLen() )
1020  {
1021  nX += pPor->Width();
1022  if( !pPor->IsMarginPortion() )
1023  {
1024  nPorHeight = pPor->Height();
1025  nPorAscent = pPor->GetAscent();
1026  }
1027  pPor = pPor->GetNextPortion();
1028  }
1029  }
1030  if( pPor && pCMS )
1031  {
1032  if( pCMS->m_bFieldInfo && pPor->InFieldGrp() && pPor->Width() )
1033  pOrig->Width( pPor->Width() );
1034  if( pPor->IsDropPortion() )
1035  {
1036  nPorAscent = static_cast<SwDropPortion*>(pPor)->GetDropHeight();
1037  // The drop height is only calculated, if we have more than
1038  // one line. Otherwise it is 0.
1039  if ( ! nPorAscent)
1040  nPorAscent = pPor->Height();
1041  nPorHeight = nPorAscent;
1042  pOrig->Height( nPorHeight +
1043  static_cast<SwDropPortion*>(pPor)->GetDropDescent() );
1044  if( nTmpHeight < pOrig->Height() )
1045  {
1046  nTmpAscent = nPorAscent;
1047  nTmpHeight = sal_uInt16( pOrig->Height() );
1048  }
1049  }
1050  if( bWidth && pPor->PrtWidth() && pPor->GetLen() &&
1051  aInf.GetIdx() == nOfst )
1052  {
1053  if( !pPor->IsFlyPortion() && pPor->Height() &&
1054  pPor->GetAscent() )
1055  {
1056  nPorHeight = pPor->Height();
1057  nPorAscent = pPor->GetAscent();
1058  }
1059  SwTwips nTmp;
1060  if (TextFrameIndex(2) > pPor->GetLen())
1061  {
1062  nTmp = pPor->Width();
1063  if ( pPor->InSpaceGrp() && nSpaceAdd )
1064  nTmp += pPor->CalcSpacing( nSpaceAdd, aInf );
1065  }
1066  else
1067  {
1068  const bool bOldOnWin = aInf.OnWin();
1069  TextFrameIndex const nOldLen = pPor->GetLen();
1070  pPor->SetLen( TextFrameIndex(1) );
1071  aInf.SetLen( pPor->GetLen() );
1072  SeekAndChg( aInf );
1073  aInf.SetOnWin( false ); // no BULLETs!
1074  aInf.SetKanaComp( pKanaComp );
1075  aInf.SetKanaIdx( nKanaIdx );
1076  nTmp = pPor->GetTextSize( aInf ).Width();
1077  aInf.SetOnWin( bOldOnWin );
1078  if ( pPor->InSpaceGrp() && nSpaceAdd )
1079  nTmp += pPor->CalcSpacing( nSpaceAdd, aInf );
1080  pPor->SetLen( nOldLen );
1081  }
1082  pOrig->Width( nTmp );
1083  }
1084 
1085  // travel inside field portion?
1086  if ( pCMS->m_pSpecialPos )
1087  {
1088  // apply attributes to font
1089  Seek( nOfst );
1090  lcl_GetCharRectInsideField( aInf, *pOrig, *pCMS, *pPor );
1091  }
1092  }
1093  }
1094 
1095  // special case: We are at the beginning of a BidiPortion or
1096  // directly behind a BidiPortion
1097  if ( pCMS &&
1098  ( pLastBidiPor ||
1099  ( pPor &&
1100  pPor->IsMultiPortion() &&
1101  static_cast<SwMultiPortion*>(pPor)->IsBidi() ) ) )
1102  {
1103  // we determine if the cursor has to blink before or behind
1104  // the bidi portion
1105  if ( pLastBidiPor )
1106  {
1107  const sal_uInt8 nPortionLevel = pLastBidiPor->GetLevel();
1108 
1109  if ( pCMS->m_nCursorBidiLevel >= nPortionLevel )
1110  {
1111  // we came from inside the bidi portion, we want to blink
1112  // behind the portion
1113  pOrig->Pos().AdjustX( -nLastBidiPorWidth );
1114 
1115  // Again, there is a special case: logically behind
1116  // the portion can actually mean that the cursor is inside
1117  // the portion. This can happen is the last portion
1118  // inside the bidi portion is a nested bidi portion
1119  SwLineLayout& rLineLayout =
1120  static_cast<SwMultiPortion*>(pLastBidiPor)->GetRoot();
1121 
1122  const SwLinePortion *pLast = rLineLayout.FindLastPortion();
1123  if ( pLast->IsMultiPortion() )
1124  {
1125  OSL_ENSURE( static_cast<const SwMultiPortion*>(pLast)->IsBidi(),
1126  "Non-BidiPortion inside BidiPortion" );
1127  TextFrameIndex const nIdx = aInf.GetIdx();
1128  // correct the index before using CalcSpacing.
1129  aInf.SetIdx(nLastBidiIdx);
1130  pOrig->Pos().AdjustX(pLast->Width() +
1131  pLast->CalcSpacing( nSpaceAdd, aInf ) );
1132  aInf.SetIdx(nIdx);
1133  }
1134  }
1135  }
1136  else
1137  {
1138  const sal_uInt8 nPortionLevel = static_cast<SwBidiPortion*>(pPor)->GetLevel();
1139 
1140  if ( pCMS->m_nCursorBidiLevel >= nPortionLevel )
1141  {
1142  // we came from inside the bidi portion, we want to blink
1143  // behind the portion
1144  pOrig->Pos().AdjustX(pPor->Width() +
1145  pPor->CalcSpacing( nSpaceAdd, aInf ) );
1146  }
1147  }
1148  }
1149 
1150  pOrig->Pos().AdjustX(nX );
1151 
1152  if ( pCMS && pCMS->m_bRealHeight )
1153  {
1154  nTmpAscent = AdjustBaseLine( *m_pCurr, nullptr, nPorHeight, nPorAscent );
1155  if ( nTmpAscent > nPorAscent )
1156  pCMS->m_aRealHeight.setX( nTmpAscent - nPorAscent );
1157  else
1158  pCMS->m_aRealHeight.setX( 0 );
1159  OSL_ENSURE( nPorHeight, "GetCharRect: Missing Portion-Height" );
1160  if ( nTmpHeight > nPorHeight )
1161  pCMS->m_aRealHeight.setY( nPorHeight );
1162  else
1163  pCMS->m_aRealHeight.setY( nTmpHeight );
1164  }
1165  }
1166 }
1167 
1169  SwCursorMoveState* pCMS, const long nMax )
1170 {
1171  CharCursorToLine(nOfst);
1172 
1173  // Indicates that a position inside a special portion (field, number portion)
1174  // is requested.
1175  const bool bSpecialPos = pCMS && pCMS->m_pSpecialPos;
1176  TextFrameIndex nFindOfst = nOfst;
1177 
1178  if ( bSpecialPos )
1179  {
1180  const SwSPExtendRange nExtendRange = pCMS->m_pSpecialPos->nExtendRange;
1181 
1182  OSL_ENSURE( ! pCMS->m_pSpecialPos->nLineOfst || SwSPExtendRange::BEFORE != nExtendRange,
1183  "LineOffset AND Number Portion?" );
1184 
1185  // portions which are behind the string
1186  if ( SwSPExtendRange::BEHIND == nExtendRange )
1187  ++nFindOfst;
1188 
1189  // skip lines for fields which cover more than one line
1190  for ( sal_uInt16 i = 0; i < pCMS->m_pSpecialPos->nLineOfst; i++ )
1191  Next();
1192  }
1193 
1194  // If necessary, as catch up, do the adjustment
1195  GetAdjusted();
1196 
1197  const Point aCharPos( GetTopLeft() );
1198 
1199  GetCharRect_( pOrig, nFindOfst, pCMS );
1200 
1201  // This actually would have to be "-1 LogicToPixel", but that seems too
1202  // expensive, so it's a value (-12), that should hopefully be OK.
1203  const SwTwips nTmpRight = Right() - 12;
1204 
1205  pOrig->Pos().AdjustX(aCharPos.X() );
1206  pOrig->Pos().AdjustY(aCharPos.Y() );
1207 
1208  if( pCMS && pCMS->m_b2Lines && pCMS->m_p2Lines )
1209  {
1210  pCMS->m_p2Lines->aLine.Pos().AdjustX(aCharPos.X() );
1211  pCMS->m_p2Lines->aLine.Pos().AdjustY(aCharPos.Y() );
1212  pCMS->m_p2Lines->aPortion.Pos().AdjustX(aCharPos.X() );
1213  pCMS->m_p2Lines->aPortion.Pos().AdjustY(aCharPos.Y() );
1214  }
1215 
1217  // Make sure the cursor respects the right margin, unless in compat mode, where the tab size has priority over the margin size.
1218  if( pOrig->Left() > nTmpRight && !bTabOverMargin)
1219  pOrig->Pos().setX( nTmpRight );
1220 
1221  if( nMax )
1222  {
1223  if( pOrig->Top() + pOrig->Height() > nMax )
1224  {
1225  if( pOrig->Top() > nMax )
1226  pOrig->Top( nMax );
1227  pOrig->Height( nMax - pOrig->Top() );
1228  }
1229  if ( pCMS && pCMS->m_bRealHeight && pCMS->m_aRealHeight.Y() >= 0 )
1230  {
1231  long nTmp = pCMS->m_aRealHeight.X() + pOrig->Top();
1232  if( nTmp >= nMax )
1233  {
1234  pCMS->m_aRealHeight.setX( nMax - pOrig->Top() );
1235  pCMS->m_aRealHeight.setY( 0 );
1236  }
1237  else if( nTmp + pCMS->m_aRealHeight.Y() > nMax )
1238  pCMS->m_aRealHeight.setY( nMax - nTmp );
1239  }
1240  }
1241  long nOut = pOrig->Right() - GetTextFrame()->getFrameArea().Right();
1242  if( nOut > 0 )
1243  {
1244  if( GetTextFrame()->getFrameArea().Width() < GetTextFrame()->getFramePrintArea().Left()
1245  + GetTextFrame()->getFramePrintArea().Width() )
1248  if( nOut > 0 )
1249  pOrig->Pos().AdjustX( -(nOut + 10) );
1250  }
1251 }
1252 
1257 static bool ConsiderNextPortionForCursorOffset(const SwLinePortion* pPor, sal_uInt16 nWidth30, sal_uInt16 nX)
1258 {
1259  if (!pPor->GetNextPortion())
1260  {
1261  return false;
1262  }
1263 
1264  // If we're past the target position, stop the iteration in general.
1265  // Exception: don't stop the iteration between as-char fly portions and their comments.
1266  if (nWidth30 >= nX && (!pPor->IsFlyCntPortion() || !pPor->GetNextPortion()->IsPostItsPortion()))
1267  {
1268  return false;
1269  }
1270 
1271  return !pPor->IsBreakPortion();
1272 }
1273 
1274 // Return: Offset in String
1276  bool bChgNode, SwCursorMoveState* pCMS ) const
1277 {
1278  // If necessary, as catch up, do the adjustment
1279  GetAdjusted();
1280 
1281  const OUString &rText = GetInfo().GetText();
1282  TextFrameIndex nOffset(0);
1283 
1284  // x is the horizontal offset within the line.
1285  SwTwips x = rPoint.X();
1286  const SwTwips nLeftMargin = GetLineStart();
1288  ( GetCurr()->IsHanging() ? GetCurr()->GetHangingMargin() : 0 );
1289  if( nRightMargin == nLeftMargin )
1290  nRightMargin += 30;
1291 
1292  const bool bLeftOver = x < nLeftMargin;
1293  if( bLeftOver )
1294  x = nLeftMargin;
1295  const bool bRightOver = x > nRightMargin;
1296  if( bRightOver )
1297  x = nRightMargin;
1298 
1299  const bool bRightAllowed = pCMS && ( pCMS->m_eState == MV_NONE );
1300 
1301  // Until here everything in document coordinates.
1302  x -= nLeftMargin;
1303 
1304  sal_uInt16 nX = sal_uInt16( x );
1305 
1306  // If there are attribute changes in the line, search for the paragraph,
1307  // in which nX is situated.
1309  TextFrameIndex nCurrStart = m_nStart;
1310  bool bHolePortion = false;
1311  bool bLastHyph = false;
1312 
1313  std::deque<sal_uInt16> *pKanaComp = m_pCurr->GetpKanaComp();
1314  TextFrameIndex const nOldIdx = GetInfo().GetIdx();
1315  sal_uInt16 nSpaceIdx = 0;
1316  size_t nKanaIdx = 0;
1317  long nSpaceAdd = m_pCurr->IsSpaceAdd() ? m_pCurr->GetLLSpaceAdd( 0 ) : 0;
1318  short nKanaComp = pKanaComp ? (*pKanaComp)[0] : 0;
1319 
1320  // nWidth is the width of the line, or the width of
1321  // the paragraph with the font change, in which nX is situated.
1322 
1323  sal_uInt16 nWidth = pPor->Width();
1324  if ( m_pCurr->IsSpaceAdd() || pKanaComp )
1325  {
1326  if ( pPor->InSpaceGrp() && nSpaceAdd )
1327  {
1328  const_cast<SwTextSizeInfo&>(GetInfo()).SetIdx( nCurrStart );
1329  nWidth = nWidth + sal_uInt16( pPor->CalcSpacing( nSpaceAdd, GetInfo() ) );
1330  }
1331  if( ( pPor->InFixMargGrp() && ! pPor->IsMarginPortion() ) ||
1332  ( pPor->IsMultiPortion() && static_cast<SwMultiPortion*>(pPor)->HasTabulator() )
1333  )
1334  {
1335  if ( m_pCurr->IsSpaceAdd() )
1336  {
1337  if ( ++nSpaceIdx < m_pCurr->GetLLSpaceAddCount() )
1338  nSpaceAdd = m_pCurr->GetLLSpaceAdd( nSpaceIdx );
1339  else
1340  nSpaceAdd = 0;
1341  }
1342 
1343  if( pKanaComp )
1344  {
1345  if ( nKanaIdx + 1 < pKanaComp->size() )
1346  nKanaComp = (*pKanaComp)[++nKanaIdx];
1347  else
1348  nKanaComp = 0;
1349  }
1350  }
1351  }
1352 
1353  sal_uInt16 nWidth30;
1354  if ( pPor->IsPostItsPortion() )
1355  nWidth30 = 30 + pPor->GetViewWidth( GetInfo() ) / 2;
1356  else
1357  nWidth30 = ! nWidth && pPor->GetLen() && pPor->InToxRefOrFieldGrp() ?
1358  30 :
1359  nWidth;
1360 
1361  while (ConsiderNextPortionForCursorOffset(pPor, nWidth30, nX))
1362  {
1363  nX = nX - nWidth;
1364  nCurrStart = nCurrStart + pPor->GetLen();
1365  bHolePortion = pPor->IsHolePortion();
1366  pPor = pPor->GetNextPortion();
1367  nWidth = pPor->Width();
1368  if ( m_pCurr->IsSpaceAdd() || pKanaComp )
1369  {
1370  if ( pPor->InSpaceGrp() && nSpaceAdd )
1371  {
1372  const_cast<SwTextSizeInfo&>(GetInfo()).SetIdx( nCurrStart );
1373  nWidth = nWidth + sal_uInt16( pPor->CalcSpacing( nSpaceAdd, GetInfo() ) );
1374  }
1375 
1376  if( ( pPor->InFixMargGrp() && ! pPor->IsMarginPortion() ) ||
1377  ( pPor->IsMultiPortion() && static_cast<SwMultiPortion*>(pPor)->HasTabulator() )
1378  )
1379  {
1380  if ( m_pCurr->IsSpaceAdd() )
1381  {
1382  if ( ++nSpaceIdx < m_pCurr->GetLLSpaceAddCount() )
1383  nSpaceAdd = m_pCurr->GetLLSpaceAdd( nSpaceIdx );
1384  else
1385  nSpaceAdd = 0;
1386  }
1387 
1388  if ( pKanaComp )
1389  {
1390  if( nKanaIdx + 1 < pKanaComp->size() )
1391  nKanaComp = (*pKanaComp)[++nKanaIdx];
1392  else
1393  nKanaComp = 0;
1394  }
1395  }
1396  }
1397 
1398  if ( pPor->IsPostItsPortion() )
1399  nWidth30 = 30 + pPor->GetViewWidth( GetInfo() ) / 2;
1400  else
1401  nWidth30 = ! nWidth && pPor->GetLen() && pPor->InToxRefOrFieldGrp() ?
1402  30 :
1403  nWidth;
1404  if( !pPor->IsFlyPortion() && !pPor->IsMarginPortion() )
1405  bLastHyph = pPor->InHyphGrp();
1406  }
1407 
1408  const bool bLastPortion = (nullptr == pPor->GetNextPortion());
1409 
1410  if( nX==nWidth )
1411  {
1412  SwLinePortion *pNextPor = pPor->GetNextPortion();
1413  while( pNextPor && pNextPor->InFieldGrp() && !pNextPor->Width() )
1414  {
1415  nCurrStart = nCurrStart + pPor->GetLen();
1416  pPor = pNextPor;
1417  if( !pPor->IsFlyPortion() && !pPor->IsMarginPortion() )
1418  bLastHyph = pPor->InHyphGrp();
1419  pNextPor = pPor->GetNextPortion();
1420  }
1421  }
1422 
1423  const_cast<SwTextSizeInfo&>(GetInfo()).SetIdx( nOldIdx );
1424 
1425  TextFrameIndex nLength = pPor->GetLen();
1426 
1427  const bool bFieldInfo = pCMS && pCMS->m_bFieldInfo;
1428 
1429  if( bFieldInfo && ( nWidth30 < nX || bRightOver || bLeftOver ||
1430  ( pPor->InNumberGrp() && !pPor->IsFootnoteNumPortion() ) ||
1431  ( pPor->IsMarginPortion() && nWidth > nX + 30 ) ) )
1432  pCMS->m_bPosCorr = true;
1433 
1434  // #i27615#
1435  if (pCMS && pCMS->m_bInFrontOfLabel)
1436  {
1437  if (! (2 * nX < nWidth && pPor->InNumberGrp() &&
1438  !pPor->IsFootnoteNumPortion()))
1439  pCMS->m_bInFrontOfLabel = false;
1440  }
1441 
1442  // 7684: We are exactly ended up at their HyphPortion. It is our task to
1443  // provide, that we end up in the String.
1444  // 7993: If length = 0, then we must exit...
1445  if( !nLength )
1446  {
1447  if( pCMS )
1448  {
1449  if( pPor->IsFlyPortion() && bFieldInfo )
1450  pCMS->m_bPosCorr = true;
1451 
1452  if (!bRightOver && nX)
1453  {
1454  if( pPor->IsFootnoteNumPortion())
1455  pCMS->m_bFootnoteNoInfo = true;
1456  else if (pPor->InNumberGrp() ) // #i23726#
1457  {
1458  pCMS->m_nInNumPortionOffset = nX;
1459  pCMS->m_bInNumPortion = true;
1460  }
1461  }
1462  }
1463  if( !nCurrStart )
1464  return TextFrameIndex(0);
1465 
1466  // 7849, 7816: pPor->GetHyphPortion is mandatory!
1467  if( bHolePortion || ( !bRightAllowed && bLastHyph ) ||
1468  ( pPor->IsMarginPortion() && !pPor->GetNextPortion() &&
1469  // 46598: Consider the situation: We might end up behind the last character,
1470  // in the last line of a centered paragraph
1471  nCurrStart < TextFrameIndex(rText.getLength())))
1472  --nCurrStart;
1473  else if( pPor->InFieldGrp() && static_cast<SwFieldPortion*>(pPor)->IsFollow()
1474  && nWidth > nX )
1475  {
1476  if( bFieldInfo )
1477  --nCurrStart;
1478  else
1479  {
1480  sal_uInt16 nHeight = pPor->Height();
1481  if ( !nHeight || nHeight > nWidth )
1482  nHeight = nWidth;
1483  if( bChgNode && nWidth - nHeight/2 > nX )
1484  --nCurrStart;
1485  }
1486  }
1487  return nCurrStart;
1488  }
1489  if (TextFrameIndex(1) == nLength)
1490  {
1491  if ( nWidth )
1492  {
1493  // no quick return for as-character frames, we want to peek inside
1494  if (!(bChgNode && pPos && pPor->IsFlyCntPortion())
1495  // if we want to get the position inside the field, we should not return
1496  && (!pCMS || !pCMS->m_pSpecialPos))
1497  {
1498  if ( pPor->InFieldGrp() ||
1499  ( pPor->IsMultiPortion() &&
1500  static_cast<SwMultiPortion*>(pPor)->IsBidi() ) )
1501  {
1502  sal_uInt16 nHeight = 0;
1503  if( !bFieldInfo )
1504  {
1505  nHeight = pPor->Height();
1506  if ( !nHeight || nHeight > nWidth )
1507  nHeight = nWidth;
1508  }
1509 
1510  if( nWidth - nHeight/2 <= nX &&
1511  ( ! pPor->InFieldGrp() ||
1512  !static_cast<SwFieldPortion*>(pPor)->HasFollow() ) )
1513  ++nCurrStart;
1514  }
1515  else if ( ( !pPor->IsFlyPortion() || ( pPor->GetNextPortion() &&
1516  !pPor->GetNextPortion()->IsMarginPortion() &&
1517  !pPor->GetNextPortion()->IsHolePortion() ) )
1518  && ( nWidth/2 < nX ) &&
1519  ( !bFieldInfo ||
1520  ( pPor->GetNextPortion() &&
1521  pPor->GetNextPortion()->IsPostItsPortion() ) )
1522  && ( bRightAllowed || !bLastHyph ))
1523  ++nCurrStart;
1524 
1525  return nCurrStart;
1526  }
1527  }
1528  else
1529  {
1530  if ( pPor->IsPostItsPortion() || pPor->IsBreakPortion() ||
1531  pPor->InToxRefGrp() )
1532  {
1533  if (pPor->IsPostItsPortion())
1534  {
1535  // Offset would be nCurrStart + nLength below, do the same for post-it portions.
1536  nCurrStart += pPor->GetLen();
1537  }
1538  return nCurrStart;
1539  }
1540  if ( pPor->InFieldGrp() )
1541  {
1542  if( bRightOver && !static_cast<SwFieldPortion*>(pPor)->HasFollow() )
1543  ++nCurrStart;
1544  return nCurrStart;
1545  }
1546  }
1547  }
1548 
1549  // Skip space at the end of the line
1550  if( bLastPortion && (m_pCurr->GetNext() || m_pFrame->GetFollow() )
1551  && rText[sal_Int32(nCurrStart + nLength) - 1] == ' ' )
1552  --nLength;
1553 
1554  if( nWidth > nX ||
1555  ( nWidth == nX && pPor->IsMultiPortion() && static_cast<SwMultiPortion*>(pPor)->IsDouble() ) )
1556  {
1557  if( pPor->IsMultiPortion() )
1558  {
1559  // In a multi-portion we use GetCursorOfst()-function recursively
1560  SwTwips nTmpY = rPoint.Y() - m_pCurr->GetAscent() + pPor->GetAscent();
1561  // if we are in the first line of a double line portion, we have
1562  // to add a value to nTmpY for not staying in this line
1563  // we also want to skip the first line, if we are inside ruby
1564  if ( ( static_cast<SwTextSizeInfo*>(m_pInf)->IsMulti() &&
1565  static_cast<SwTextSizeInfo*>(m_pInf)->IsFirstMulti() ) ||
1566  ( static_cast<SwMultiPortion*>(pPor)->IsRuby() &&
1567  static_cast<SwMultiPortion*>(pPor)->OnTop() ) )
1568  nTmpY += static_cast<SwMultiPortion*>(pPor)->Height();
1569 
1570  // Important for cursor traveling in ruby portions:
1571  // We have to set nTmpY to 0 in order to stay in the first row
1572  // if the phonetic line is the second row
1573  if ( static_cast<SwMultiPortion*>(pPor)->IsRuby() &&
1574  ! static_cast<SwMultiPortion*>(pPor)->OnTop() )
1575  nTmpY = 0;
1576 
1577  SwTextCursorSave aSave( const_cast<SwTextCursor*>(this), static_cast<SwMultiPortion*>(pPor),
1578  nTmpY, nX, nCurrStart, nSpaceAdd );
1579 
1580  SwLayoutModeModifier aLayoutModeModifier( *GetInfo().GetOut() );
1581  if ( static_cast<SwMultiPortion*>(pPor)->IsBidi() )
1582  {
1583  const sal_uInt8 nBidiLevel = static_cast<SwBidiPortion*>(pPor)->GetLevel();
1584  aLayoutModeModifier.Modify( nBidiLevel % 2 );
1585  }
1586 
1587  if( static_cast<SwMultiPortion*>(pPor)->HasRotation() )
1588  {
1589  nTmpY -= m_nY;
1590  if( !static_cast<SwMultiPortion*>(pPor)->IsRevers() )
1591  nTmpY = pPor->Height() - nTmpY;
1592  if( nTmpY < 0 )
1593  nTmpY = 0;
1594  nX = static_cast<sal_uInt16>(nTmpY);
1595  }
1596 
1597  if( static_cast<SwMultiPortion*>(pPor)->HasBrackets() )
1598  {
1599  const sal_uInt16 nPreWidth = static_cast<SwDoubleLinePortion*>(pPor)->PreWidth();
1600  if ( nX > nPreWidth )
1601  nX = nX - nPreWidth;
1602  else
1603  nX = 0;
1604  }
1605 
1606  return GetCursorOfst( pPos, Point( GetLineStart() + nX, rPoint.Y() ),
1607  bChgNode, pCMS );
1608  }
1609  if( pPor->InTextGrp() )
1610  {
1611  sal_uInt8 nOldProp;
1612  if( GetPropFont() )
1613  {
1614  const_cast<SwFont*>(GetFnt())->SetProportion( GetPropFont() );
1615  nOldProp = GetFnt()->GetPropr();
1616  }
1617  else
1618  nOldProp = 0;
1619  {
1620  SwTextSizeInfo aSizeInf( GetInfo(), &rText, nCurrStart );
1621  const_cast<SwTextCursor*>(this)->SeekAndChg( aSizeInf );
1622  SwTextSlot aDiffText( &aSizeInf, static_cast<SwTextPortion*>(pPor), false, false );
1623  SwFontSave aSave( aSizeInf, pPor->IsDropPortion() ?
1624  static_cast<SwDropPortion*>(pPor)->GetFnt() : nullptr );
1625 
1626  SwParaPortion* pPara = const_cast<SwParaPortion*>(GetInfo().GetParaPortion());
1627  OSL_ENSURE( pPara, "No paragraph!" );
1628 
1629  SwDrawTextInfo aDrawInf( aSizeInf.GetVsh(),
1630  *aSizeInf.GetOut(),
1631  &pPara->GetScriptInfo(),
1632  aSizeInf.GetText(),
1633  aSizeInf.GetIdx(),
1634  pPor->GetLen() );
1635 
1636  // Drop portion works like a multi portion, just its parts are not portions
1637  if( pPor->IsDropPortion() && static_cast<SwDropPortion*>(pPor)->GetLines() > 1 )
1638  {
1639  SwDropPortion* pDrop = static_cast<SwDropPortion*>(pPor);
1640  const SwDropPortionPart* pCurrPart = pDrop->GetPart();
1641  sal_uInt16 nSumWidth = 0;
1642  sal_uInt16 nSumBorderWidth = 0;
1643  // Shift offset with the right and left border of previous parts and left border of actual one
1644  while (pCurrPart && nSumWidth <= nX - sal_Int32(nCurrStart))
1645  {
1646  nSumWidth += pCurrPart->GetWidth();
1647  if( pCurrPart->GetFont().GetLeftBorder() && !pCurrPart->GetJoinBorderWithPrev() )
1648  {
1649  nSumBorderWidth += pCurrPart->GetFont().GetLeftBorderSpace();
1650  }
1651  if (nSumWidth <= nX - sal_Int32(nCurrStart) && pCurrPart->GetFont().GetRightBorder() &&
1652  !pCurrPart->GetJoinBorderWithNext() )
1653  {
1654  nSumBorderWidth += pCurrPart->GetFont().GetRightBorderSpace();
1655  }
1656  pCurrPart = pCurrPart->GetFollow();
1657  }
1658  nX = std::max(0, nX - nSumBorderWidth);
1659  }
1660  // Shift the offset with the left border width
1661  else if( GetInfo().GetFont()->GetLeftBorder() && !pPor->GetJoinBorderWithPrev() )
1662  {
1663  nX = std::max(0, nX - GetInfo().GetFont()->GetLeftBorderSpace());
1664  }
1665 
1666  aDrawInf.SetOfst( nX );
1667 
1668  if ( nSpaceAdd )
1669  {
1670  TextFrameIndex nCharCnt(0);
1671  // #i41860# Thai justified alignment needs some
1672  // additional information:
1673  aDrawInf.SetNumberOfBlanks( pPor->InTextGrp() ?
1674  static_cast<const SwTextPortion*>(pPor)->GetSpaceCnt( aSizeInf, nCharCnt ) :
1675  TextFrameIndex(0) );
1676  }
1677 
1678  if ( pPor->InFieldGrp() && pCMS && pCMS->m_pSpecialPos )
1679  aDrawInf.SetLen( TextFrameIndex(COMPLETE_STRING) );
1680 
1681  aDrawInf.SetSpace( nSpaceAdd );
1682  aDrawInf.SetFont( aSizeInf.GetFont() );
1683  aDrawInf.SetFrame( m_pFrame );
1684  aDrawInf.SetSnapToGrid( aSizeInf.SnapToGrid() );
1685  aDrawInf.SetPosMatchesBounds( pCMS && pCMS->m_bPosMatchesBounds );
1686 
1687  if ( SwFontScript::CJK == aSizeInf.GetFont()->GetActual() &&
1688  pPara->GetScriptInfo().CountCompChg() &&
1689  ! pPor->InFieldGrp() )
1690  aDrawInf.SetKanaComp( nKanaComp );
1691 
1692  nLength = aSizeInf.GetFont()->GetCursorOfst_( aDrawInf );
1693 
1694  // get position inside field portion?
1695  if ( pPor->InFieldGrp() && pCMS && pCMS->m_pSpecialPos )
1696  {
1697  pCMS->m_pSpecialPos->nCharOfst = sal_Int32(nLength);
1698  nLength = TextFrameIndex(0);
1699  }
1700 
1701  // set cursor bidi level
1702  if ( pCMS )
1703  pCMS->m_nCursorBidiLevel =
1704  aDrawInf.GetCursorBidiLevel();
1705 
1706  if( bFieldInfo && nLength == pPor->GetLen() &&
1707  ( ! pPor->GetNextPortion() ||
1708  ! pPor->GetNextPortion()->IsPostItsPortion() ) )
1709  --nLength;
1710  }
1711  if( nOldProp )
1712  const_cast<SwFont*>(GetFnt())->SetProportion( nOldProp );
1713  }
1714  else
1715  {
1716  sw::FlyContentPortion* pFlyPor(nullptr);
1717  if(bChgNode && pPos && (pFlyPor = dynamic_cast<sw::FlyContentPortion*>(pPor)))
1718  {
1719  // JP 24.11.94: if the Position is not in Fly, then
1720  // we many not return with COMPLETE_STRING as value!
1721  // (BugId: 9692 + Change in feshview)
1722  SwFlyInContentFrame *pTmp = pFlyPor->GetFlyFrame();
1723  SwFrame* pLower = pTmp->GetLower();
1724  bool bChgNodeInner = pLower
1725  && (pLower->IsTextFrame() || pLower->IsLayoutFrame());
1726  Point aTmpPoint( rPoint );
1727 
1728  if ( m_pFrame->IsRightToLeft() )
1729  m_pFrame->SwitchLTRtoRTL( aTmpPoint );
1730 
1731  if ( m_pFrame->IsVertical() )
1732  m_pFrame->SwitchHorizontalToVertical( aTmpPoint );
1733 
1734  if( bChgNodeInner && pTmp->getFrameArea().IsInside( aTmpPoint ) &&
1735  !( pTmp->IsProtected() ) )
1736  {
1737  pFlyPor->GetFlyCursorOfst(aTmpPoint, *pPos, pCMS);
1738  // After a change of the frame, our font must be still
1739  // available for/in the OutputDevice.
1740  // For comparison: Paint and new SwFlyCntPortion !
1741  static_cast<SwTextSizeInfo*>(m_pInf)->SelectFont();
1742 
1743  // 6776: The pIter->GetCursorOfst is returning here
1744  // from a nesting with COMPLETE_STRING.
1746  }
1747  }
1748  else
1749  nLength = pPor->GetCursorOfst( nX );
1750  }
1751  }
1752  nOffset = nCurrStart + nLength;
1753 
1754  // 7684: We end up in front of the HyphPortion. We must assure
1755  // that we end up in the string.
1756  // If we are at end of line in front of FlyFrames, we must proceed the same way.
1757  if( nOffset && pPor->GetLen() == nLength && pPor->GetNextPortion() &&
1758  !pPor->GetNextPortion()->GetLen() && pPor->GetNextPortion()->InHyphGrp() )
1759  --nOffset;
1760 
1761  return nOffset;
1762 }
1763 
1781 bool SwTextFrame::FillSelection( SwSelectionList& rSelList, const SwRect& rRect ) const
1782 {
1783  bool bRet = false;
1784  // GetPaintArea() instead getFrameArea() for negative indents
1785  SwRect aTmpFrame( GetPaintArea() );
1786  if( !rRect.IsOver( aTmpFrame ) )
1787  return false;
1788  if( rSelList.checkContext( this ) )
1789  {
1790  SwRect aRect( aTmpFrame );
1791  aRect.Intersection( rRect );
1793  if( IsEmpty() )
1794  {
1795  SwPaM *pPam = new SwPaM( aPosL, aPosL );
1796  rSelList.insertPaM( pPam );
1797  }
1798  else if( aRect.HasArea() )
1799  {
1800  SwPosition aOld(aPosL.nNode.GetNodes().GetEndOfContent());
1801  SwPosition aPosR( aPosL );
1802  Point aPoint;
1803  SwTextInfo aInf( const_cast<SwTextFrame*>(this) );
1804  SwTextIter aLine( const_cast<SwTextFrame*>(this), &aInf );
1805  // We have to care for top-to-bottom layout, where right becomes top etc.
1806  SwRectFnSet aRectFnSet(this);
1807  SwTwips nTop = aRectFnSet.GetTop(aRect);
1808  SwTwips nBottom = aRectFnSet.GetBottom(aRect);
1809  SwTwips nLeft = aRectFnSet.GetLeft(aRect);
1810  SwTwips nRight = aRectFnSet.GetRight(aRect);
1811  SwTwips nY = aLine.Y(); // Top position of the first line
1812  SwTwips nLastY = nY;
1813  while( nY < nTop && aLine.Next() ) // line above rectangle
1814  {
1815  nLastY = nY;
1816  nY = aLine.Y();
1817  }
1818  bool bLastLine = false;
1819  if( nY < nTop && !aLine.GetNext() )
1820  {
1821  bLastLine = true;
1822  nY += aLine.GetLineHeight();
1823  }
1824  do // check the lines for overlapping
1825  {
1826  if( nLastY < nTop ) // if the last line was above rectangle
1827  nLastY = nTop;
1828  if( nY > nBottom ) // if the current line leaves the rectangle
1829  nY = nBottom;
1830  if( nY >= nLastY ) // gotcha: overlapping
1831  {
1832  nLastY += nY;
1833  nLastY /= 2;
1834  if( aRectFnSet.IsVert() )
1835  {
1836  aPoint.setX( nLastY );
1837  aPoint.setY( nLeft );
1838  }
1839  else
1840  {
1841  aPoint.setX( nLeft );
1842  aPoint.setY( nLastY );
1843  }
1844  // Looking for the position of the left border of the rectangle
1845  // in this text line
1846  SwCursorMoveState aState( MV_UPDOWN );
1847  if( GetCursorOfst( &aPosL, aPoint, &aState ) )
1848  {
1849  if( aRectFnSet.IsVert() )
1850  {
1851  aPoint.setX( nLastY );
1852  aPoint.setY( nRight );
1853  }
1854  else
1855  {
1856  aPoint.setX( nRight );
1857  aPoint.setY( nLastY );
1858  }
1859  // If we get a right position and if the left position
1860  // is not the same like the left position of the line before
1861  // which could happen e.g. for field portions or fly frames
1862  // a SwPaM will be inserted with these positions
1863  if( GetCursorOfst( &aPosR, aPoint, &aState ) &&
1864  aOld != aPosL)
1865  {
1866  SwPaM *pPam = new SwPaM( aPosL, aPosR );
1867  rSelList.insertPaM( pPam );
1868  aOld = aPosL;
1869  }
1870  }
1871  }
1872  if( aLine.Next() )
1873  {
1874  nLastY = nY;
1875  nY = aLine.Y();
1876  }
1877  else if( !bLastLine )
1878  {
1879  bLastLine = true;
1880  nLastY = nY;
1881  nY += aLine.GetLineHeight();
1882  }
1883  else
1884  break;
1885  }while( nLastY < nBottom );
1886  }
1887  }
1888  if( GetDrawObjs() )
1889  {
1890  const SwSortedObjs &rObjs = *GetDrawObjs();
1891  for (SwAnchoredObject* pAnchoredObj : rObjs)
1892  {
1893  if( dynamic_cast< const SwFlyFrame *>( pAnchoredObj ) == nullptr )
1894  continue;
1895  const SwFlyFrame* pFly = static_cast<const SwFlyFrame*>(pAnchoredObj);
1896  if( pFly->IsFlyInContentFrame() && pFly->FillSelection( rSelList, rRect ) )
1897  bRet = true;
1898  }
1899  }
1900  return bRet;
1901 }
1902 
1903 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
long GetLeft() const
void CtorInitTextIter(SwTextFrame *pFrame, SwTextInfo *pInf)
Definition: itrtxt.cxx:34
std::deque< sal_uInt16 > * GetpKanaComp() const
Definition: porlay.hxx:184
Base class of the Writer layout elements.
Definition: frame.hxx:295
Represents the visualization of a paragraph.
Definition: txtfrm.hxx:149
const SvxLRSpaceItem & GetLRSpace(bool=true) const
Definition: frmatr.hxx:44
sal_uInt16 GetLeftBorderSpace() const
Definition: swfont.hxx:908
SwFontScript WhichFont(TextFrameIndex nIdx) const
Definition: porlay.cxx:718
bool m_bFieldInfo
should be fields recognized?
Definition: crstate.hxx:142
SwViewShell * GetVsh()
Definition: inftxt.hxx:228
bool IsFollow() const
Definition: flowfrm.hxx:166
const SwSortedObjs * GetDrawObjs() const
Definition: frame.hxx:543
sal_uInt16 GetPropLineSpace() const
void GetAdjusted() const
Definition: itrtxt.hxx:250
bool InToxRefGrp() const
Definition: porlin.hxx:105
virtual bool FillSelection(SwSelectionList &rList, const SwRect &rRect) const override
Looks for text portions which are inside the given rectangle.
Definition: itrcrsr.cxx:1781
Marks a position in the document model.
Definition: pam.hxx:35
sal_uInt16 GetDropDescent() const
Definition: itrtxt.hxx:207
static bool bRightMargin
Definition: itrtxt.hxx:268
sal_Int32 nCharOfst
Definition: crstate.hxx:110
long GetLeftMarginWithNum(bool bTextLeft=false) const
Returns the additional indents of this text node and its numbering.
Definition: ndtxt.cxx:3152
sal_uInt16 nDropHeight
Definition: itrtxt.hxx:148
bool IsHanging() const
Definition: porlay.hxx:129
sal_uInt16 GetLines() const
Definition: pordrop.hxx:88
static bool ConsiderNextPortionForCursorOffset(const SwLinePortion *pPor, sal_uInt16 nWidth30, sal_uInt16 nX)
Determines if SwTextCursor::GetCursorOfst() should consider the next portion when calculating the doc...
Definition: itrcrsr.cxx:1257
SvxAdjust GetAdjust() const
LanguageType GetLangOfChar(TextFrameIndex nIndex, sal_uInt16 nScript, bool bNoChar=false) const
Definition: txtfrm.cxx:1330
bool InSpaceGrp() const
Definition: porlin.hxx:109
bool m_bRealHeight
should the real height be calculated?
Definition: crstate.hxx:141
sal_uInt16 Height() const
Definition: possiz.hxx:44
SwFont * GetFont()
Definition: inftxt.hxx:238
SwLineLayout * GetNext()
Definition: porlay.hxx:143
sal_uInt16 GetDropLeft() const
Definition: pordrop.hxx:92
bool InNumberGrp() const
Definition: porlin.hxx:102
virtual long CalcSpacing(long nSpaceAdd, const SwTextSizeInfo &rInf) const override
Definition: pormulti.cxx:194
TextFrameIndex GetStart() const
Definition: itrtxt.hxx:88
long Height() const
SwNodeIndex nNode
Definition: pam.hxx:37
sal_uInt8 GetPropr() const
Definition: swfont.hxx:280
bool GetJoinBorderWithPrev() const
Definition: porlin.hxx:168
void SwitchHorizontalToVertical(SwRect &rRect) const
Calculates the coordinates of a rectangle when switching from horizontal to vertical layout...
Definition: txtfrm.cxx:471
sal_uInt16 GetRightBorderSpace() const
Definition: swfont.hxx:893
default
Definition: crstate.hxx:123
bool GetFirstLineOfsWithNum(short &rFirstOffset) const
Returns the combined first line indent of this text node and its numbering.
Definition: ndtxt.cxx:3195
void SetPropFont(const sal_uInt8 nNew)
Definition: itratr.hxx:107
SwTwips GetHangingMargin() const
Definition: porlay.hxx:158
const SwRect & getFramePrintArea() const
Definition: frame.hxx:176
void SetOnWin(const bool bNew)
Definition: inftxt.hxx:200
#define LANGUAGE_KOREAN
sal_uInt8 m_nCursorBidiLevel
Definition: crstate.hxx:139
bool m_bRealWidth
Calculation of the width required.
Definition: crstate.hxx:149
sal_uInt16 GetDropHeight() const
Definition: itrtxt.hxx:205
void Height(long nNew)
Definition: swrect.hxx:189
long GetBottom(const SwRect &rRect) const
Definition: frame.hxx:1354
TextFrameIndex GetOfst() const
Definition: txtfrm.hxx:428
void SetLen(TextFrameIndex const nLen)
Definition: porlin.hxx:75
bool SeekAndChg(SwTextSizeInfo &rInf)
Definition: itrtxt.hxx:310
Cursor Up/Down.
Definition: crstate.hxx:124
long SwTwips
Definition: swtypes.hxx:49
SwDropPortionPart * GetPart() const
Definition: pordrop.hxx:94
This class is used as parameter for creation of a block cursor selection.
bool IsVert() const
Definition: frame.hxx:1343
const SwLineLayout * Next()
Definition: itrtxt.cxx:106
void Pos(const Point &rNew)
Definition: swrect.hxx:167
bool AreListLevelIndentsApplicable() const
Determines, if the list level indent attributes can be applied to the paragraph.
Definition: ndtxt.cxx:4403
const Size & GetSize(SwFontScript nWhich) const
Definition: swfont.hxx:205
SwLineInfo m_aLineInf
Definition: itrtxt.hxx:33
bool checkContext(const SwFrame *pCheck)
Checks if the context of the list is equal to the context of the frame.
void SetKanaComp(std::deque< sal_uInt16 > *pNew)
Definition: inftxt.hxx:329
void SetMulti(const bool bNew)
Definition: inftxt.hxx:211
Of course Writer needs its own rectangles.
Definition: swrect.hxx:34
bool m_bLastCenter
Definition: itrtxt.hxx:48
bool InFieldGrp() const
Definition: porlin.hxx:104
long GetLeftMarginForTabCalculation() const
return left margin for tab stop position calculation
Definition: ndtxt.cxx:3299
SwTwips Y() const
Definition: itrtxt.hxx:90
float x
Collection of SwLineLayout instances, represents the paragraph text in Writer layout.
Definition: porlay.hxx:229
int GetActualListLevel() const
Returns the actual list level of this text node, when it is a list item.
Definition: ndtxt.cxx:4088
const SvxLineSpacingItem * GetLineSpacing() const
Definition: inftxt.hxx:86
SvxAdjust GetOneWord() const
bool Seek(TextFrameIndex nPos)
Enables the attributes used at char pos nPos in the logical font.
Definition: itratr.cxx:300
SvxLineSpaceRule GetLineSpaceRule() const
void GetCharRect_(SwRect *, TextFrameIndex, SwCursorMoveState *)
Definition: itrcrsr.cxx:465
SwFlyInContentFrame * GetFlyFrame()
Definition: porfly.hxx:72
long GetLen(const Point &rPnt)
bool IsMarginPortion() const
Definition: porlin.hxx:124
SwRect GetPaintArea() const
|* The paintarea is the area, in which the content of a frame is allowed |* to be displayed...
Definition: ssfrm.cxx:581
bool InToxRefOrFieldGrp() const
Definition: porlin.hxx:106
wrapper class for the positioning of Writer fly frames and drawing objects
void GetFlyCursorOfst(Point &rPoint, SwPosition &rPos, SwCursorMoveState *pCMS) const
Definition: porfly.hxx:73
sal_uInt16 GetLineHeight() const
void Top(const long nTop)
Definition: swrect.hxx:202
bool InHyphGrp() const
Definition: porlin.hxx:101
bool IsBreakPortion() const
Definition: porlin.hxx:114
const SwRect & getFrameArea() const
Definition: frame.hxx:175
void setX(long nX)
bool IsInTab() const
Definition: frame.hxx:931
int m_nInNumPortionOffset
distance from number portion's start
Definition: crstate.hxx:164
SwRect & Intersection(const SwRect &rRect)
Definition: swrect.cxx:54
void SetKanaIdx(sal_uInt16 nNew)
Definition: inftxt.hxx:327
SwTwips Right() const
Definition: itrtxt.hxx:181
bool IsTextFrame() const
Definition: frame.hxx:1210
const sal_uInt8 MAXLEVEL
Definition: swtypes.hxx:95
SwTwips nRight
Definition: itrtxt.hxx:145
bool IsSpaceAdd() const
Definition: porlay.hxx:165
long GetLeft(const SwRect &rRect) const
Definition: frame.hxx:1355
long GetRight(const SwRect &rRect) const
Definition: frame.hxx:1356
void Right(const long nRight)
Definition: swrect.hxx:198
void setY(long nY)
bool IsFlyInContentFrame() const
Definition: flyfrm.hxx:193
void insertPaM(SwPaM *pPam)
Adds a text portion to the selection list.
if(nullptr==pCandidateA||nullptr==pCandidateB)
SwFontScript GetActual() const
Definition: swfont.hxx:183
SwTextFrame * GetFollow()
Definition: txtfrm.hxx:848
bool InFixMargGrp() const
Definition: porlin.hxx:108
This portion represents a part of the paragraph string.
Definition: portxt.hxx:27
SwNode & GetEndOfContent() const
Regular ContentSection (i.e. the BodyText).
Definition: ndarr.hxx:163
SwTwips CurrWidth() const
Definition: itrtxt.hxx:183
bool IsEmpty() const
Definition: txtfrm.hxx:511
void CalcAscentAndHeight(sal_uInt16 &rAscent, sal_uInt16 &rHeight) const
Definition: itrtxt.cxx:63
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:136
void SetRealHeight(sal_uInt16 nNew)
Definition: porlay.hxx:152
const OUString & GetExp() const
Definition: porfld.hxx:66
bool m_bPrev
Definition: itrtxt.hxx:44
SwTextNode const * GetTextNodeForParaProps() const
Definition: txtfrm.cxx:1290
sal_uInt8 GetLevel() const
Definition: pormulti.hxx:224
bool IsFootnoteNumPortion() const
Definition: porlin.hxx:119
SwTextInfo * m_pInf
Definition: itrtxt.hxx:35
virtual TextFrameIndex GetCursorOfst(sal_uInt16 nOfst) const
the parameter is actually SwTwips apparently?
Definition: porlin.cxx:224
virtual sal_uInt16 GetViewWidth(const SwTextSizeInfo &rInf) const
Definition: porlin.cxx:64
sal_uInt16 AdjustBaseLine(const SwLineLayout &rLine, const SwLinePortion *pPor, sal_uInt16 nPorHeight=0, sal_uInt16 nAscent=0, const bool bAutoToCentered=false) const
Definition: itrtxt.cxx:212
TextFrameIndex GetCursorOfst(SwPosition *pPos, const Point &rPoint, bool bChgNode, SwCursorMoveState *=nullptr) const
Definition: itrcrsr.cxx:1275
sal_uInt16 GetDropDescent() const
Definition: pordrop.hxx:91
SwTwips Left() const
Definition: itrtxt.hxx:333
SwTwips GetLineStart() const
Definition: itrcrsr.cxx:366
Collection of SwLinePortion instances, representing one line of text.
Definition: porlay.hxx:78
const SwLineInfo & GetLineInfo() const
Definition: itrtxt.hxx:128
vcl::RenderContext * GetOut()
Definition: inftxt.hxx:231
static void ResetSpaceAdd(SwLineLayout *pCurr)
Definition: pormulti.cxx:524
const o3tl::optional< editeng::SvxBorderLine > & GetLeftBorder() const
Definition: swfont.hxx:342
void SetFont(SwFont *pNew)
Definition: inftxt.hxx:240
SwParaPortion * GetParaPortion()
Definition: inftxt.hxx:128
bool IsFlyPortion() const
Definition: porlin.hxx:125
sal_uInt16 nDropDescent
Definition: itrtxt.hxx:149
SwTextGridItem const * GetGridItem(SwPageFrame const *const)
Definition: pagechg.cxx:2514
int i
SwLinePortion * GetFirstPortion() const
Definition: porlay.cxx:667
bool IsKernPortion() const
Definition: porlin.hxx:132
bool HasArea() const
Definition: swrect.hxx:290
SvxAdjust GetLastBlock() const
const SvxAdjustItem & GetAdjust(bool=true) const
Definition: paratr.hxx:180
void CtorInitTextMargin(SwTextFrame *pFrame, SwTextSizeInfo *pInf)
Definition: itrcrsr.cxx:156
SwTwips GetLeftMargin() const
Definition: itrtxt.hxx:328
SvxAdjust nAdjust
Definition: itrtxt.hxx:151
SwNumRule * GetNumRule(bool bInParent=true) const
Returns numbering rule of this text node.
Definition: ndtxt.cxx:2804
const SwLineLayout * GetPrev()
Definition: itrtxt.cxx:81
SvxInterLineSpaceRule GetInterLineSpaceRule() const
SwFont * GetFnt()
Definition: itratr.hxx:103
void Modify(bool bChgToRTL)
Definition: txtfrm.cxx:709
sal_uInt16 GetLineHeight() const
Definition: itrtxt.hxx:116
TextFrameIndex GetIdx() const
Definition: inftxt.hxx:278
const IDocumentSettingAccess * getIDocumentSettingAccess() const
Provides access to the document setting interface.
Definition: node.cxx:2052
bool IsDropPortion() const
Definition: porlin.hxx:121
bool m_bInFrontOfLabel
cursor in front of label
Definition: crstate.hxx:162
void SSize(const Size &rNew)
Definition: swrect.hxx:176
Point m_aRealHeight
contains then the position/height of the cursor
Definition: crstate.hxx:137
bool SnapToGrid() const
Definition: inftxt.hxx:222
SvxNumPositionAndSpaceMode GetPositionAndSpaceMode() const
SwTwips GetLineEnd() const
Definition: itrtxt.hxx:185
TextFrameIndex GetLen() const
Definition: porlin.hxx:74
sal_uInt16 nDropLines
Definition: itrtxt.hxx:150
bool m_bLastBlock
Definition: itrtxt.hxx:47
bool InTabGrp() const
Definition: porlin.hxx:100
bool m_b2Lines
Check 2line portions and fill p2Lines.
Definition: crstate.hxx:150
long X() const
Point GetTopLeft() const
Definition: itrtxt.hxx:186
const OUString & GetText() const
Definition: inftxt.hxx:246
short GetInterLineSpace() const
std::unique_ptr< Sw2LinesPos > m_p2Lines
for selections inside/around 2line portions
Definition: crstate.hxx:135
bool IsHolePortion() const
Definition: porlin.hxx:126
sal_uInt16 nLineOfst
Definition: crstate.hxx:111
sal_uInt16 GetWidth() const
Definition: pordrop.hxx:52
bool IsMultiPortion() const
Definition: porlin.hxx:134
bool m_bOneBlock
Definition: itrtxt.hxx:46
bool m_bFootnoteNoInfo
recognized footnote numbering
Definition: crstate.hxx:144
void SwitchLTRtoRTL(SwRect &rRect) const
Calculates the coordinates of a rectangle when switching from LTR to RTL layout.
Definition: txtfrm.cxx:681
SwTextFrame * m_pFrame
Definition: itrtxt.hxx:34
Base class for anything that can be part of a line in the Writer layout.
Definition: porlin.hxx:50
const SwNumFormat & Get(sal_uInt16 i) const
Definition: number.cxx:77
long GetLLSpaceAdd(sal_uInt16 nIdx)
Definition: porlay.hxx:177
bool m_bInNumPortion
point is in number portion #i23726#
Definition: crstate.hxx:163
void CtorInitTextCursor(SwTextFrame *pFrame, SwTextSizeInfo *pInf)
Definition: itrcrsr.cxx:382
bool IsLayoutFrame() const
Definition: frame.hxx:1146
void Left(const long nLeft)
Definition: swrect.hxx:193
HFONT SelectFont(HDC hDC, HFONT hFont)
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:79
TextFrameIndex m_nStart
Definition: itrtxt.hxx:41
SwTwips nLeft
Definition: itrtxt.hxx:144
void SetLen(const TextFrameIndex nNew)
Definition: inftxt.hxx:281
TextFrameIndex GetLen() const
Definition: pordrop.hxx:51
For the text replacement and restoration of SwTextSizeInfo.
Definition: inftxt.hxx:677
general base class for all free-flowing frames
Definition: flyfrm.hxx:60
TextFrameIndex GetCursorOfst_(SwDrawTextInfo &rInf)
Definition: swfont.hxx:314
long const nLeftMargin
void SetFirstMulti(const bool bNew)
Definition: inftxt.hxx:213
SwTwips mnTabLeft
Definition: itrtxt.hxx:153
sal_uInt8 GetPropFont() const
Definition: itratr.hxx:106
unsigned char sal_uInt8
const SwNodes & GetNodes() const
Definition: ndindex.hxx:156
void Width(long nNew)
Definition: swrect.hxx:185
bool GetJoinBorderWithNext() const
Definition: pordrop.hxx:56
void GetEndCharRect(SwRect *, TextFrameIndex, SwCursorMoveState *=nullptr, const long nMax=0)
Definition: itrcrsr.cxx:390
SwLinePortion * FindLastPortion()
Definition: porlin.cxx:180
bool IsInside(const Point &rPOINT) const
Definition: swrect.cxx:107
SwTwips nFirst
Definition: itrtxt.hxx:146
void SetActual(SwFontScript nNew)
Definition: swfont.hxx:747
IDocumentSettingAccess const & getIDocumentSettingAccess() const
Definition: doc.cxx:175
SvxAdjust GetAdjust() const
Definition: itrtxt.hxx:190
bool OnWin() const
Definition: inftxt.hxx:199
SwTextSizeInfo & GetInfo()
Definition: itrtxt.hxx:216
SwTwips GetAdditionalFirstLineOffset() const
Definition: txtfrm.hxx:632
bool IsRightToLeft() const
Definition: frame.hxx:963
virtual SwPosSize GetTextSize(const SwTextSizeInfo &rInfo) const
Definition: porlin.cxx:232
SwFrame * GetLower()
Definition: findfrm.cxx:169
const o3tl::optional< editeng::SvxBorderLine > & GetRightBorder() const
Definition: swfont.hxx:341
bool HasFollow() const
Definition: porfld.hxx:88
SwSpecialPos * m_pSpecialPos
for positions inside fields
Definition: crstate.hxx:136
bool InTextGrp() const
Definition: porlin.hxx:98
sal_uInt16 Width() const
Definition: possiz.hxx:46
const SwLineLayout * PrevLine()
Definition: itrtxt.cxx:168
CursorMoveState m_eState
Definition: crstate.hxx:138
double getLength(const B2DPolygon &rCandidate)
void GetCharRect(SwRect *, TextFrameIndex, SwCursorMoveState *=nullptr, const long nMax=0)
Definition: itrcrsr.cxx:1168
SwSPExtendRange
SwSpecialPos.
Definition: crstate.hxx:103
virtual bool get(DocumentSettingId id) const =0
Return the specified document setting.
SwTwips m_nY
Definition: itrtxt.hxx:39
const SwAttrSet & GetSwAttrSet() const
Does node has already its own auto-attributes? Access to SwAttrSet.
Definition: node.hxx:723
bool m_bPosMatchesBounds
GetCursorOfst should not return the next position if screen position is inside second have of bound r...
Definition: crstate.hxx:152
bool m_bPosCorr
Point had to be corrected.
Definition: crstate.hxx:143
const SwDropPortion * FindDropPortion() const
Definition: porlay.cxx:2169
sal_uInt16 GetRealHeight() const
Definition: porlay.hxx:153
const SwLineLayout * GetNext() const
Definition: itrtxt.hxx:84
sal_uInt16 GetLineWidth() const
Definition: itrtxt.hxx:191
const SwLineLayout * GetCurr() const
Definition: itrtxt.hxx:83
bool IsVertical() const
Definition: frame.hxx:949
long GetTop(const SwRect &rRect) const
Definition: frame.hxx:1353
SwDropPortionPart * GetFollow() const
Definition: pordrop.hxx:48
SwSPExtendRange nExtendRange
Definition: crstate.hxx:112
const SwLineLayout * CharCursorToLine(TextFrameIndex const nPos)
Definition: itrtxt.cxx:200
SwDoc & GetDoc()
Definition: txtfrm.hxx:450
virtual bool GetCursorOfst(SwPosition *, Point &, SwCursorMoveState *=nullptr, bool bTestBackground=false) const override
In nOffset returns the offset of the char within the set text buffer, which is closest to the positio...
Definition: frmcrsr.cxx:661
SwTextFrame * GetTextFrame()
Definition: itrtxt.hxx:134
SwLineLayout * m_pCurr
Definition: itrtxt.hxx:36
void PrtWidth(sal_uInt16 nNewWidth)
Definition: porlin.hxx:80
TextFrameIndex GetEnd() const
Definition: itrtxt.hxx:89
sal_Int32 const nLength
long const nRightMargin
void SetProportion(const sal_uInt8 nNewPropr)
Definition: swfont.hxx:765
void DropInit()
Definition: itrcrsr.cxx:348
bool IsOver(const SwRect &rRect) const
Definition: swrect.cxx:125
bool GetJoinBorderWithNext() const
Definition: porlin.hxx:169
SwLinePortion * GetNextPortion() const
Definition: porlin.hxx:72
bool InFixGrp() const
Definition: porlin.hxx:103
void SetIdx(const TextFrameIndex nNew)
Definition: inftxt.hxx:279
SvxParaVertAlignItem::Align GetVertAlign() const
Definition: inftxt.hxx:92
long GetTextLeft() const
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...
class for collecting anchored objects
Definition: sortedobjs.hxx:48
SwPosition MapViewToModelPos(TextFrameIndex nIndex) const
Definition: txtfrm.cxx:1235
#define LANGUAGE_JAPANESE
bool IsAutoFirst() const
virtual long CalcSpacing(long nSpaceAdd, const SwTextSizeInfo &rInf) const
Definition: porlin.cxx:307
sal_uInt16 nDropLeft
Definition: itrtxt.hxx:147
bool IsFlyCntPortion() const
Definition: porlin.hxx:112
sal_uInt16 GetRubyHeight() const
Definition: tgrditem.hxx:78
sal_uInt16 & GetAscent()
Definition: porlin.hxx:77
const sal_Int32 COMPLETE_STRING
Definition: swtypes.hxx:61
static void lcl_GetCharRectInsideField(SwTextSizeInfo &rInf, SwRect &rOrig, const SwCursorMoveState &rCMS, const SwLinePortion &rPor)
Definition: itrcrsr.cxx:53
long Y() const
bool IsPostItsPortion() const
Definition: porlin.hxx:128
SwFont & GetFont() const
Definition: pordrop.hxx:50
virtual bool FillSelection(SwSelectionList &rList, const SwRect &rRect) const override
Definition: trvlfrm.cxx:365
sal_uInt16 GetDropHeight() const
Definition: pordrop.hxx:90
bool IsProtected() const
Is the Frame or rather the Section in which it lies protected?
Definition: trvlfrm.cxx:1625
bool IsBlankPortion() const
Definition: porlin.hxx:113
bool GetJoinBorderWithPrev() const
Definition: pordrop.hxx:55