LibreOffice Module sw (master)  1
crstrvl.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 <memory>
21 #include <utility>
22 #include <hintids.hxx>
23 #include <comphelper/string.hxx>
24 #include <svl/itemiter.hxx>
25 #include <editeng/lrspitem.hxx>
26 #include <editeng/adjustitem.hxx>
28 #include <svx/svdobj.hxx>
29 #include <osl/diagnose.h>
30 #include <crsrsh.hxx>
31 #include <doc.hxx>
32 #include <IDocumentUndoRedo.hxx>
36 #include <pagefrm.hxx>
37 #include <cntfrm.hxx>
38 #include <rootfrm.hxx>
39 #include <pam.hxx>
40 #include <ndtxt.hxx>
41 #include <fldbas.hxx>
42 #include <swtable.hxx>
43 #include <docary.hxx>
44 #include <txtfld.hxx>
45 #include <fmtfld.hxx>
46 #include <txtftn.hxx>
47 #include <txtinet.hxx>
48 #include <fmtinfmt.hxx>
49 #include <txttxmrk.hxx>
50 #include <frmfmt.hxx>
51 #include <flyfrm.hxx>
52 #include <viscrs.hxx>
53 #include "callnk.hxx"
54 #include <doctxm.hxx>
55 #include <docfld.hxx>
56 #include <expfld.hxx>
57 #include <reffld.hxx>
58 #include <flddat.hxx>
59 #include <cellatr.hxx>
60 #include <swundo.hxx>
61 #include <redline.hxx>
62 #include <fmtcntnt.hxx>
63 #include <fmthdft.hxx>
64 #include <pagedesc.hxx>
65 #include <fesh.hxx>
66 #include <charfmt.hxx>
67 #include <fmturl.hxx>
68 #include <txtfrm.hxx>
69 #include <wrong.hxx>
70 #include <calbck.hxx>
71 #include <unotools/intlwrapper.hxx>
72 #include <docufld.hxx>
73 #include <svx/srchdlg.hxx>
74 #include <frameformats.hxx>
75 #include <docsh.hxx>
76 #include <wrtsh.hxx>
77 
78 using namespace ::com::sun::star;
79 
81 {
82  SwCallLink aLk( *this ); // watch Cursor-Moves
83  SwCursorSaveState aSaveState( *m_pCurrentCursor );
84  if( ActionPend() )
85  return;
86  CurrShell aCurr( this );
87  // try to set cursor onto this position, at half of the char-
88  // SRectangle's height
90  std::pair<Point, bool> const tmp(aPt, true);
92  GetLayout(), m_pCurrentCursor->GetPoint(), &tmp);
94  pFrame->Calc(GetOut());
95  if( pFrame->IsVertical() )
96  {
97  aPt.setX(m_aCharRect.Center().getX());
98  aPt.setY(pFrame->getFrameArea().Top() + GetUpDownX());
99  }
100  else
101  {
102  aPt.setY(m_aCharRect.Center().getY());
103  aPt.setX(pFrame->getFrameArea().Left() + GetUpDownX());
104  }
108  {
112  }
113 }
114 
117 {
119  return;
120  MoveCursorToNum();
121 }
122 
124 {
126  return;
127  MoveCursorToNum();
128 }
129 
132 {
133  const SwFrame* pFrame = GetCurrFrame()->FindPageFrame();
134  while( pFrame && !pFrame->IsHeaderFrame() )
135  pFrame = pFrame->GetLower();
136  // found header, search 1. content frame
137  while( pFrame && !pFrame->IsContentFrame() )
138  pFrame = pFrame->GetLower();
139 
140  if( pFrame )
141  {
142  CurrShell aCurr( this );
143  // get header frame
144  SwCallLink aLk( *this ); // watch Cursor-Moves
145  SwCursor *pTmpCursor = getShellCursor( true );
146  SwCursorSaveState aSaveState( *pTmpCursor );
147  pFrame->Calc(GetOut());
148  Point aPt( pFrame->getFrameArea().Pos() + pFrame->getFramePrintArea().Pos() );
149  pFrame->GetModelPositionForViewPoint( pTmpCursor->GetPoint(), aPt );
150  if( !pTmpCursor->IsSelOvr() )
151  UpdateCursor();
152  else
153  pFrame = nullptr;
154  }
155  return nullptr != pFrame;
156 }
157 
160 {
161  const SwPageFrame* pFrame = GetCurrFrame()->FindPageFrame();
162  if( pFrame )
163  {
164  const SwFrame* pLower = pFrame->GetLastLower();
165 
166  while( pLower && !pLower->IsFooterFrame() )
167  pLower = pLower->GetLower();
168  // found footer, search 1. content frame
169  while( pLower && !pLower->IsContentFrame() )
170  pLower = pLower->GetLower();
171 
172  if( pLower )
173  {
174  SwCursor *pTmpCursor = getShellCursor( true );
175  CurrShell aCurr( this );
176  // get position in footer
177  SwCallLink aLk( *this ); // watch Cursor-Moves
178  SwCursorSaveState aSaveState( *pTmpCursor );
179  pLower->Calc(GetOut());
180  Point aPt( pLower->getFrameArea().Pos() + pLower->getFramePrintArea().Pos() );
181  pLower->GetModelPositionForViewPoint( pTmpCursor->GetPoint(), aPt );
182  if( !pTmpCursor->IsSelOvr() )
183  UpdateCursor();
184  else
185  pFrame = nullptr;
186  }
187  else
188  pFrame = nullptr;
189  }
190  else
191  pFrame = nullptr;
192  return nullptr != pFrame;
193 }
194 
195 bool SwCursorShell::SetCursorInHdFt( size_t nDescNo, bool bInHeader )
196 {
197  bool bRet = false;
198  SwDoc *pMyDoc = GetDoc();
199  const SwPageDesc* pDesc = nullptr;
200 
201  CurrShell aCurr( this );
202 
203  if( SIZE_MAX == nDescNo )
204  {
205  // take the current one
206  const SwContentFrame *pCurrFrame = GetCurrFrame();
207  const SwPageFrame* pPage = (pCurrFrame == nullptr) ? nullptr : pCurrFrame->FindPageFrame();
208  if( pPage && pMyDoc->ContainsPageDesc(
209  pPage->GetPageDesc(), &nDescNo) )
210  pDesc = pPage->GetPageDesc();
211  }
212  else
213  if (nDescNo < pMyDoc->GetPageDescCnt())
214  pDesc = &pMyDoc->GetPageDesc( nDescNo );
215 
216  if( pDesc )
217  {
218  // check if the attribute exists
219  const SwFormatContent* pCnt = nullptr;
220  if( bInHeader )
221  {
222  // mirrored pages? ignore for now
223  const SwFormatHeader& rHd = pDesc->GetMaster().GetHeader();
224  if( rHd.GetHeaderFormat() )
225  pCnt = &rHd.GetHeaderFormat()->GetContent();
226  }
227  else
228  {
229  const SwFormatFooter& rFt = pDesc->GetMaster().GetFooter();
230  if( rFt.GetFooterFormat() )
231  pCnt = &rFt.GetFooterFormat()->GetContent();
232  }
233 
234  if( pCnt && pCnt->GetContentIdx() )
235  {
236  SwNodeIndex aIdx( *pCnt->GetContentIdx(), 1 );
237  SwContentNode* pCNd = aIdx.GetNode().GetContentNode();
238  if( !pCNd )
239  pCNd = pMyDoc->GetNodes().GoNext( &aIdx );
240 
241  Point aPt( m_pCurrentCursor->GetPtPos() );
242 
243  std::pair<Point, bool> const tmp(aPt, false);
244  if (pCNd && nullptr != pCNd->getLayoutFrame(GetLayout(), nullptr, &tmp))
245  {
246  // then we can set the cursor in here
247  SwCallLink aLk( *this ); // watch Cursor-Moves
248  SwCursorSaveState aSaveState( *m_pCurrentCursor );
249 
250  ClearMark();
251 
253  rPos.nNode = *pCNd;
254  rPos.nContent.Assign( pCNd, 0 );
255 
256  bRet = !m_pCurrentCursor->IsSelOvr();
257  if( bRet )
260  }
261  }
262  }
263  return bRet;
264 }
265 
267 bool SwCursorShell::GotoNextTOXBase( const OUString* pName )
268 {
269  bool bRet = false;
270 
271  const SwSectionFormats& rFormats = GetDoc()->GetSections();
272  SwContentNode* pFnd = nullptr;
273  for( SwSectionFormats::size_type n = rFormats.size(); n; )
274  {
275  const SwSection* pSect = rFormats[ --n ]->GetSection();
276  if (SectionType::ToxContent == pSect->GetType())
277  {
278  SwSectionNode const*const pSectNd(
279  pSect->GetFormat()->GetSectionNode());
280  if ( pSectNd
281  && m_pCurrentCursor->GetPoint()->nNode < pSectNd->GetIndex()
282  && (!pFnd || pFnd->GetIndex() > pSectNd->GetIndex())
283  && (!pName || *pName ==
284  static_cast<SwTOXBaseSection const*>(pSect)->GetTOXName()))
285  {
286  SwNodeIndex aIdx(*pSectNd, 1);
287  SwContentNode* pCNd = aIdx.GetNode().GetContentNode();
288  if (!pCNd)
289  pCNd = GetDoc()->GetNodes().GoNext( &aIdx );
290  if (pCNd &&
291  pCNd->EndOfSectionIndex() <= pSectNd->EndOfSectionIndex())
292  {
293  SwContentFrame const*const pCFrame(
294  pCNd->getLayoutFrame(GetLayout()));
295  if (pCFrame &&
296  (IsReadOnlyAvailable() || !pCFrame->IsProtected()))
297  {
298  pFnd = pCNd;
299  }
300  }
301  }
302  }
303  }
304  if( pFnd )
305  {
306  SwCallLink aLk( *this ); // watch Cursor-Moves
307  SwCursorSaveState aSaveState( *m_pCurrentCursor );
308  m_pCurrentCursor->GetPoint()->nNode = *pFnd;
309  m_pCurrentCursor->GetPoint()->nContent.Assign( pFnd, 0 );
310  bRet = !m_pCurrentCursor->IsSelOvr();
311  if( bRet )
313  }
314  return bRet;
315 }
316 
318 bool SwCursorShell::GotoPrevTOXBase( const OUString* pName )
319 {
320  bool bRet = false;
321 
322  const SwSectionFormats& rFormats = GetDoc()->GetSections();
323  SwContentNode* pFnd = nullptr;
324  for( SwSectionFormats::size_type n = rFormats.size(); n; )
325  {
326  const SwSection* pSect = rFormats[ --n ]->GetSection();
327  if (SectionType::ToxContent == pSect->GetType())
328  {
329  SwSectionNode const*const pSectNd(
330  pSect->GetFormat()->GetSectionNode());
331  if ( pSectNd
332  && m_pCurrentCursor->GetPoint()->nNode > pSectNd->EndOfSectionIndex()
333  && (!pFnd || pFnd->GetIndex() < pSectNd->GetIndex())
334  && (!pName || *pName ==
335  static_cast<SwTOXBaseSection const*>(pSect)->GetTOXName()))
336  {
337  SwNodeIndex aIdx(*pSectNd, 1);
338  SwContentNode* pCNd = aIdx.GetNode().GetContentNode();
339  if (!pCNd)
340  pCNd = GetDoc()->GetNodes().GoNext( &aIdx );
341  if (pCNd &&
342  pCNd->EndOfSectionIndex() <= pSectNd->EndOfSectionIndex())
343  {
344  SwContentFrame const*const pCFrame(
345  pCNd->getLayoutFrame(GetLayout()));
346  if (pCFrame &&
347  (IsReadOnlyAvailable() || !pCFrame->IsProtected()))
348  {
349  pFnd = pCNd;
350  }
351  }
352  }
353  }
354  }
355 
356  if( pFnd )
357  {
358  SwCallLink aLk( *this ); // watch Cursor-Moves
359  SwCursorSaveState aSaveState( *m_pCurrentCursor );
360  m_pCurrentCursor->GetPoint()->nNode = *pFnd;
361  m_pCurrentCursor->GetPoint()->nContent.Assign( pFnd, 0 );
362  bRet = !m_pCurrentCursor->IsSelOvr();
363  if( bRet )
365  }
366  return bRet;
367 }
368 
371 {
372  SwTOXMarks aMarks;
373  sal_uInt16 nCnt = SwDoc::GetCurTOXMark(*m_pCurrentCursor->GetPoint(), aMarks);
374  if(!nCnt)
375  return;
376  // Take the 1. and get the index type. Ask it for the actual index.
377  const SwTOXType* pType = aMarks[0]->GetTOXType();
378  auto pContentFrame = pType->FindContentFrame(*GetDoc(), *GetLayout(), IsReadOnlyAvailable());
379  SwCallLink aLk(*this); // watch Cursor-Moves
380  SwCursorSaveState aSaveState(*m_pCurrentCursor);
381  assert(pContentFrame->IsTextFrame());
382  *m_pCurrentCursor->GetPoint() = static_cast<SwTextFrame const*>(pContentFrame)->MapViewToModelPos(TextFrameIndex(0));
385 }
386 
389 bool SwCursorShell::GotoNxtPrvTableFormula( bool bNext, bool bOnlyErrors )
390 {
391  SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::Empty );
392 
393  if( IsTableMode() )
394  return false;
395 
396  bool bFnd = false;
397  SwPosition aOldPos = *m_pCurrentCursor->GetPoint();
399 
400  Point aPt;
401  SwPosition aFndPos( GetDoc()->GetNodes().GetEndOfContent() );
402  if( !bNext )
403  aFndPos.nNode = 0;
404  SetGetExpField aFndGEF( aFndPos ), aCurGEF( rPos );
405 
406  {
407  const SwNode* pSttNd = rPos.nNode.GetNode().FindTableBoxStartNode();
408  if( pSttNd )
409  {
410  const SwTableBox* pTBox = pSttNd->FindTableNode()->GetTable().
411  GetTableBox( pSttNd->GetIndex() );
412  if( pTBox )
413  aCurGEF = SetGetExpField( *pTBox );
414  }
415  }
416 
417  if( rPos.nNode < GetDoc()->GetNodes().GetEndOfExtras() )
418  {
419  // also at collection use only the first frame
420  std::pair<Point, bool> const tmp(aPt, false);
422  &rPos, &tmp) );
423  }
424  {
425  sal_uInt32 nMaxItems = GetDoc()->GetAttrPool().GetItemCount2( RES_BOXATR_FORMULA );
426 
427  if( nMaxItems > 0 )
428  {
429  sal_uInt8 nMaxDo = 2;
430  do {
431  for (const SfxPoolItem* pItem : GetDoc()->GetAttrPool().GetItemSurrogates(RES_BOXATR_FORMULA))
432  {
433  const SwTableBox* pTBox;
434  auto pFormulaItem = dynamic_cast<const SwTableBoxFormula*>(pItem);
435  if( !pFormulaItem )
436  continue;
437  pTBox = pFormulaItem->GetTableBox();
438  if( pTBox &&
439  pTBox->GetSttNd() &&
440  pTBox->GetSttNd()->GetNodes().IsDocNodes() &&
441  ( !bOnlyErrors ||
442  !pFormulaItem->HasValidBoxes() ) )
443  {
444  SwNodeIndex aIdx( *pTBox->GetSttNd() );
445  const SwContentNode* pCNd = GetDoc()->GetNodes().GoNext( &aIdx );
446  std::pair<Point, bool> const tmp(aPt, false);
447  if (pCNd)
448  {
449  const SwContentFrame* pCFrame = pCNd->getLayoutFrame(GetLayout(), nullptr, &tmp);
450  if (pCFrame && (IsReadOnlyAvailable() || !pCFrame->IsProtected() ))
451  {
452  SetGetExpField aCmp( *pTBox );
453  aCmp.SetBodyPos( *pCFrame );
454 
455  if( bNext ? ( aCurGEF < aCmp && aCmp < aFndGEF )
456  : ( aCmp < aCurGEF && aFndGEF < aCmp ))
457  {
458  aFndGEF = aCmp;
459  bFnd = true;
460  }
461  }
462  }
463  }
464  }
465  if( !bFnd )
466  {
467  if( bNext )
468  {
469  rPos.nNode = 0;
470  rPos.nContent = 0;
471  aCurGEF = SetGetExpField( rPos );
472  SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::EndWrapped );
473  }
474  else
475  {
476  aCurGEF = SetGetExpField( SwPosition( GetDoc()->GetNodes().GetEndOfContent() ) );
477  SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::StartWrapped );
478  }
479  }
480  } while( !bFnd && --nMaxDo );
481  }
482  }
483 
484  if( bFnd )
485  {
486  CurrShell aCurr( this );
487  SwCallLink aLk( *this ); // watch Cursor-Moves
488  SwCursorSaveState aSaveState( *m_pCurrentCursor );
489 
490  aFndGEF.GetPosOfContent( rPos );
492 
493  bFnd = !m_pCurrentCursor->IsSelOvr();
494  if( bFnd )
497  }
498  else
499  {
500  rPos = aOldPos;
501  SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::NavElementNotFound );
502  }
503 
504  return bFnd;
505 }
506 
509 {
510  SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::Empty );
511 
512  if( IsTableMode() )
513  return false;
514 
515  bool bFnd = false;
517 
518  Point aPt;
519  SwPosition aFndPos( GetDoc()->GetNodes().GetEndOfContent() );
520  if( !bNext )
521  aFndPos.nNode = 0;
522  SetGetExpField aFndGEF( aFndPos ), aCurGEF( rPos );
523 
524  if( rPos.nNode.GetIndex() < GetDoc()->GetNodes().GetEndOfExtras().GetIndex() )
525  {
526  // also at collection use only the first frame
527  std::pair<Point, bool> const tmp(aPt, false);
528  aCurGEF.SetBodyPos( *rPos.nNode.GetNode().
529  GetContentNode()->getLayoutFrame(GetLayout(), &rPos, &tmp));
530  }
531 
532  {
533  const SwTextNode* pTextNd;
534  const SwTextTOXMark* pTextTOX;
535  sal_uInt32 nMaxItems = GetDoc()->GetAttrPool().GetItemCount2( RES_TXTATR_TOXMARK );
536 
537  if( nMaxItems > 0 )
538  {
539  do {
540  for (const SfxPoolItem* pItem : GetDoc()->GetAttrPool().GetItemSurrogates(RES_TXTATR_TOXMARK))
541  {
542  auto pToxMarkItem = dynamic_cast<const SwTOXMark*>(pItem);
543  if( !pToxMarkItem )
544  continue;
545  pTextTOX = pToxMarkItem->GetTextTOXMark();
546  if( !pTextTOX )
547  continue;
548  pTextNd = &pTextTOX->GetTextNode();
549  if( !pTextNd->GetNodes().IsDocNodes() )
550  continue;
551  std::pair<Point, bool> const tmp(aPt, false);
552  const SwContentFrame* pCFrame = pTextNd->getLayoutFrame(GetLayout(), nullptr, &tmp);
553  if( pCFrame && ( IsReadOnlyAvailable() || !pCFrame->IsProtected() ))
554  {
555  SwNodeIndex aNdIndex( *pTextNd ); // UNIX needs this object
556  SetGetExpField aCmp( aNdIndex, *pTextTOX );
557  aCmp.SetBodyPos( *pCFrame );
558 
559  if( bNext ? ( aCurGEF < aCmp && aCmp < aFndGEF )
560  : ( aCmp < aCurGEF && aFndGEF < aCmp ))
561  {
562  aFndGEF = aCmp;
563  bFnd = true;
564  }
565  }
566  }
567  if( !bFnd )
568  {
569  if ( bNext )
570  {
571  rPos.nNode = 0;
572  rPos.nContent = 0;
573  aCurGEF = SetGetExpField( rPos );
574  SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::EndWrapped );
575  }
576  else
577  {
578  aCurGEF = SetGetExpField( SwPosition( GetDoc()->GetNodes().GetEndOfContent() ) );
579  SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::StartWrapped );
580  }
581  }
582  } while ( !bFnd );
583  }
584  else
585  SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::NavElementNotFound );
586  }
587 
588  if( bFnd )
589  {
590  CurrShell aCurr( this );
591  SwCallLink aLk( *this ); // watch Cursor-Moves
592  SwCursorSaveState aSaveState( *m_pCurrentCursor );
593 
594  aFndGEF.GetPosOfContent( rPos );
595 
596  bFnd = !m_pCurrentCursor->IsSelOvr();
597  if( bFnd )
600  }
601  return bFnd;
602 }
603 
606  SwTOXSearch eDir )
607 {
608  CurrShell aCurr( this );
609  SwCallLink aLk( *this ); // watch Cursor-Moves
610  SwCursorSaveState aSaveState( *m_pCurrentCursor );
611 
612  const SwTOXMark& rNewMark = GetDoc()->GotoTOXMark( rStart, eDir,
614  // set position
615  SwPosition& rPos = *GetCursor()->GetPoint();
616  rPos.nNode = rNewMark.GetTextTOXMark()->GetTextNode();
617  rPos.nContent.Assign( rPos.nNode.GetNode().GetContentNode(),
618  rNewMark.GetTextTOXMark()->GetStart() );
619 
620  if( !m_pCurrentCursor->IsSelOvr() )
623 
624  return rNewMark;
625 }
626 
628 static void lcl_MakeFieldLst(
629  SetGetExpFields& rLst,
630  const SwFieldType& rFieldType,
631  const bool bInReadOnly,
632  const bool bChkInpFlag = false )
633 {
634  // always search the 1. frame
635  Point aPt;
636  std::vector<SwFormatField*> vFields;
637  rFieldType.GatherFields(vFields, false);
638  for(SwFormatField* pFormatField: vFields)
639  {
640  SwTextField* pTextField = pFormatField->GetTextField();
641  if ( pTextField != nullptr
642  && ( !bChkInpFlag
643  || static_cast<const SwSetExpField*>(pTextField->GetFormatField().GetField())->GetInputFlag() ) )
644  {
645  const SwTextNode& rTextNode = pTextField->GetTextNode();
646  std::pair<Point, bool> const tmp(aPt, false);
647  const SwContentFrame* pCFrame =
648  rTextNode.getLayoutFrame(
650  nullptr, &tmp);
651  if ( pCFrame != nullptr
652  && ( bInReadOnly || !pCFrame->IsProtected() ) )
653  {
654  std::unique_ptr<SetGetExpField> pNew(new SetGetExpField( SwNodeIndex( rTextNode ), pTextField ));
655  pNew->SetBodyPos( *pCFrame );
656  rLst.insert( std::move(pNew) );
657  }
658  }
659  }
660 }
661 
663 lcl_FindField(bool & o_rFound, SetGetExpFields const& rSrtLst,
664  SwRootFrame const *const pLayout, SwTextNode *const pTextNode,
665  SwTextField const *const pTextField, SwPosition const& rPos,
666  sal_Int32 const nContentOffset)
667 {
668  std::unique_ptr<SetGetExpField> pSrch;
669  std::unique_ptr<SwIndex> pIndex;
670  if (-1 == nContentOffset)
671  {
672  pSrch.reset(new SetGetExpField(rPos.nNode, pTextField, &rPos.nContent));
673  }
674  else
675  {
676  pIndex.reset(new SwIndex(rPos.nNode.GetNode().GetContentNode(), nContentOffset));
677  pSrch.reset(new SetGetExpField(rPos.nNode, pTextField, pIndex.get()));
678  }
679 
680  if (rPos.nNode.GetIndex() < pTextNode->GetNodes().GetEndOfExtras().GetIndex())
681  {
682  // also at collection use only the first frame
683  Point aPt;
684  std::pair<Point, bool> const tmp(aPt, false);
685  pSrch->SetBodyPos(*pTextNode->getLayoutFrame(pLayout, &rPos, &tmp));
686  }
687 
688  SetGetExpFields::const_iterator it = rSrtLst.lower_bound(pSrch.get());
689 
690  o_rFound = (it != rSrtLst.end()) && (**it == *pSrch);
691  return it;
692 }
693 
695  const SwFieldType* pFieldType,
696  const bool bNext,
697  const SwFieldIds nResType,
698  const bool bAddSetExpressionFieldsToInputFields )
699 {
700  // sorted list of all fields
701  SetGetExpFields aSrtLst;
702 
703  if ( pFieldType )
704  {
705  if( SwFieldIds::Input != pFieldType->Which() && !pFieldType->HasWriterListeners() )
706  {
707  return false;
708  }
709 
710  // found Modify object, add all fields to array
711  ::lcl_MakeFieldLst( aSrtLst, *pFieldType, IsReadOnlyAvailable() );
712 
713  if( SwFieldIds::Input == pFieldType->Which() && bAddSetExpressionFieldsToInputFields )
714  {
715  // there are hidden input fields in the set exp. fields
716  const SwFieldTypes& rFieldTypes = *mxDoc->getIDocumentFieldsAccess().GetFieldTypes();
717  const size_t nSize = rFieldTypes.size();
718  for( size_t i=0; i < nSize; ++i )
719  {
720  pFieldType = rFieldTypes[ i ].get();
721  if ( SwFieldIds::SetExp == pFieldType->Which() )
722  {
723  ::lcl_MakeFieldLst( aSrtLst, *pFieldType, IsReadOnlyAvailable(), true );
724  }
725  }
726  }
727  }
728  else
729  {
730  const SwFieldTypes& rFieldTypes = *mxDoc->getIDocumentFieldsAccess().GetFieldTypes();
731  const size_t nSize = rFieldTypes.size();
732  for( size_t i=0; i < nSize; ++i )
733  {
734  pFieldType = rFieldTypes[ i ].get();
735  if( nResType == pFieldType->Which() )
736  {
737  ::lcl_MakeFieldLst( aSrtLst, *pFieldType, IsReadOnlyAvailable() );
738  }
739  }
740  }
741 
742  // found no fields?
743  if( aSrtLst.empty() )
744  return false;
745 
747  SwCursor* pCursor = getShellCursor( true );
748  {
749  // (1998): Always use field for search so that the right one is found as
750  // well some are in frames that are anchored to a paragraph that has a
751  // field
752  const SwPosition& rPos = *pCursor->GetPoint();
753 
754  SwTextNode* pTNd = rPos.nNode.GetNode().GetTextNode();
755  OSL_ENSURE( pTNd, "No ContentNode" );
756 
757  SwTextField * pTextField = pTNd->GetFieldTextAttrAt( rPos.nContent.GetIndex(), true );
758  const bool bDelField = ( pTextField == nullptr );
759  sal_Int32 nContentOffset = -1;
760 
761  if( bDelField )
762  {
763  // create dummy for the search
764  SwFormatField* pFormatField = new SwFormatField( SwDateTimeField(
765  static_cast<SwDateTimeFieldType*>(mxDoc->getIDocumentFieldsAccess().GetSysFieldType( SwFieldIds::DateTime ) ) ) );
766 
767  pTextField = new SwTextField( *pFormatField, rPos.nContent.GetIndex(),
768  mxDoc->IsClipBoard() );
769  pTextField->ChgTextNode( pTNd );
770  }
771  else
772  {
773  // the cursor might be anywhere inside the input field,
774  // but we will be searching for the field start
775  if (pTextField->Which() == RES_TXTATR_INPUTFIELD
776  && rPos.nContent.GetIndex() != pTextField->GetStart())
777  nContentOffset = pTextField->GetStart();
778  }
779  bool isSrch;
780  it = lcl_FindField(isSrch, aSrtLst,
781  GetLayout(), pTNd, pTextField, rPos, nContentOffset);
782 
783  if( bDelField )
784  {
785  auto const pFormat(static_cast<SwFormatField*>(&pTextField->GetAttr()));
786  delete pTextField;
787  delete pFormat;
788  }
789 
790  if( it != aSrtLst.end() && isSrch ) // found
791  {
792  if( bNext )
793  {
794  if( ++it == aSrtLst.end() )
795  return false; // already at the end
796  }
797  else
798  {
799  if( it == aSrtLst.begin() )
800  return false; // no more steps backward possible
801  --it;
802  }
803  }
804  else // not found
805  {
806  if( bNext )
807  {
808  if( it == aSrtLst.end() )
809  return false;
810  }
811  else
812  {
813  if( it == aSrtLst.begin() )
814  return false; // no more steps backward possible
815  --it;
816  }
817  }
818  }
819  const SetGetExpField& rFnd = **it;
820 
821  CurrShell aCurr( this );
822  SwCallLink aLk( *this ); // watch Cursor-Moves
823  SwCursorSaveState aSaveState( *pCursor );
824 
825  rFnd.GetPosOfContent( *pCursor->GetPoint() );
828  if( bRet )
830  return bRet;
831 }
832 
834 {
835  bool bRet = false;
836  SwTextField const*const pTextField(rField.GetTextField());
837  if (pTextField
838  && (!GetLayout()->IsHideRedlines()
840  GetDoc()->getIDocumentRedlineAccess(), *pTextField)))
841  {
842  CurrShell aCurr( this );
843  SwCallLink aLk( *this ); // watch Cursor-Moves
844 
845  SwCursor* pCursor = getShellCursor( true );
846  SwCursorSaveState aSaveState( *pCursor );
847 
848  SwTextNode* pTNd = pTextField->GetpTextNode();
849  pCursor->GetPoint()->nNode = *pTNd;
850  pCursor->GetPoint()->nContent.Assign( pTNd, pTextField->GetStart() );
851 
852  bRet = !pCursor->IsSelOvr();
853  if( bRet )
855  }
856  return bRet;
857 }
858 
860  const SwPosition* pPos,
861  const bool bIncludeInputFieldAtStart )
862 {
863  SwTextField* pTextField = nullptr;
864 
865  SwTextNode * const pNode = pPos->nNode.GetNode().GetTextNode();
866  if ( pNode != nullptr )
867  {
868  pTextField = pNode->GetFieldTextAttrAt( pPos->nContent.GetIndex(), bIncludeInputFieldAtStart );
869  }
870 
871  return pTextField;
872 }
873 
875  const SwPaM* pCursor,
876  const bool bIncludeInputFieldAtStart )
877 {
878  SwTextField* pFieldAtCursor = nullptr;
879 
880  SwTextField* pTextField = GetTextFieldAtPos( pCursor->Start(), bIncludeInputFieldAtStart );
881  if ( pTextField != nullptr
882  && pCursor->Start()->nNode == pCursor->End()->nNode )
883  {
884  const sal_Int32 nTextFieldLength =
885  pTextField->End() != nullptr
886  ? *(pTextField->End()) - pTextField->GetStart()
887  : 1;
888  if ( ( pCursor->End()->nContent.GetIndex() - pCursor->Start()->nContent.GetIndex() ) <= nTextFieldLength )
889  {
890  pFieldAtCursor = pTextField;
891  }
892  }
893 
894  return pFieldAtCursor;
895 }
896 
898  const SwPaM *const pCursor,
899  const bool bIncludeInputFieldAtStart)
900 {
901  SwTextField *const pField(GetTextFieldAtCursor(pCursor, bIncludeInputFieldAtStart));
902  return pField
903  ? const_cast<SwField*>(pField->GetFormatField().GetField())
904  : nullptr;
905 }
906 
907 SwField* SwCursorShell::GetCurField( const bool bIncludeInputFieldAtStart ) const
908 {
909  SwPaM* pCursor = GetCursor();
910  if ( pCursor->IsMultiSelection() )
911  {
912  // multi selection not handled.
913  return nullptr;
914  }
915 
916  SwField* pCurField = GetFieldAtCursor( pCursor, bIncludeInputFieldAtStart );
917  if ( pCurField != nullptr
918  && SwFieldIds::Table == pCurField->GetTyp()->Which() )
919  {
920  // table formula? convert internal name into external
921  const SwTableNode* pTableNd = IsCursorInTable();
922  static_cast<SwTableField*>(pCurField)->PtrToBoxNm( pTableNd ? &pTableNd->GetTable() : nullptr );
923  }
924 
925  return pCurField;
926 }
927 
929 {
930  for(SwPaM& rCursor : GetCursor()->GetRingContainer())
931  {
932  if (dynamic_cast<const SwTextInputField*>(GetTextFieldAtCursor(&rCursor, true)))
933  return true;
934  }
935  return false;
936 }
937 
939 {
940  return dynamic_cast<const SwTextInputField*>(GetTextFieldAtPos( &rPos, false )) != nullptr;
941 }
942 
943 bool SwCursorShell::DocPtInsideInputField( const Point& rDocPt ) const
944 {
945  SwPosition aPos( *(GetCursor()->Start()) );
946  Point aDocPt( rDocPt );
947  if ( GetLayout()->GetModelPositionForViewPoint( &aPos, aDocPt ) )
948  {
949  return PosInsideInputField( aPos );
950  }
951  return false;
952 }
953 
955 {
956  const SwTextInputField* pTextInputField = dynamic_cast<const SwTextInputField*>(GetTextFieldAtPos( &rPos, true ));
957  assert(pTextInputField != nullptr
958  && "<SwEditShell::StartOfInputFieldAtPos(..)> - no Input Field at given position");
959  return pTextInputField->GetStart();
960 }
961 
963 {
964  const SwTextInputField* pTextInputField = dynamic_cast<const SwTextInputField*>(GetTextFieldAtPos( &rPos, true ));
965  assert(pTextInputField != nullptr
966  && "<SwEditShell::EndOfInputFieldAtPos(..)> - no Input Field at given position");
967  return *(pTextInputField->End());
968 }
969 
971 {
972  SwCursor* pCursor = getShellCursor( true );
973 
974  CurrShell aCurr( this );
975  SwCallLink aLk( *this ); // watch Cursor-Moves
976  SwCursorSaveState aSaveState( *pCursor );
977 
978  const SwNodes& rNds = GetDoc()->GetNodes();
979  SwTextNode* pTextNd = rNds.GetOutLineNds()[ nIdx ]->GetTextNode();
980  pCursor->GetPoint()->nNode = *pTextNd;
981  pCursor->GetPoint()->nContent.Assign( pTextNd, 0 );
982 
983  if( !pCursor->IsSelOvr() )
985 }
986 
987 bool SwCursorShell::GotoOutline( const OUString& rName )
988 {
989  SwCursor* pCursor = getShellCursor( true );
990 
991  CurrShell aCurr( this );
992  SwCallLink aLk( *this ); // watch Cursor-Moves
993  SwCursorSaveState aSaveState( *pCursor );
994 
995  bool bRet = false;
996  if (mxDoc->GotoOutline(*pCursor->GetPoint(), rName, GetLayout())
997  && !pCursor->IsSelOvr())
998  {
1000  bRet = true;
1001  }
1002  return bRet;
1003 }
1004 
1007 {
1008  const SwNodes& rNds = GetDoc()->GetNodes();
1009 
1010  if ( rNds.GetOutLineNds().empty() )
1011  {
1012  SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::NavElementNotFound );
1013  return false;
1014  }
1015 
1016  SwCursor* pCursor = getShellCursor( true );
1017  SwNode* pNd = &(pCursor->GetNode());
1019  bool bUseFirst = !rNds.GetOutLineNds().Seek_Entry( pNd, &nPos );
1020  SwOutlineNodes::size_type const nStartPos(nPos);
1021 
1022  do
1023  {
1024  if (!bUseFirst)
1025  {
1026  ++nPos;
1027  }
1028  if (rNds.GetOutLineNds().size() <= nPos)
1029  {
1030  nPos = 0;
1031  }
1032 
1033  if (bUseFirst)
1034  {
1035  bUseFirst = false;
1036  }
1037  else
1038  {
1039  if (nPos == nStartPos)
1040  {
1041  SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::NavElementNotFound );
1042  return false;
1043  }
1044  }
1045 
1046  pNd = rNds.GetOutLineNds()[ nPos ];
1047  }
1048  while (!sw::IsParaPropsNode(*GetLayout(), *pNd->GetTextNode()));
1049 
1050  if (nPos < nStartPos)
1051  {
1052  SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::EndWrapped );
1053  }
1054  else
1055  {
1056  SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::Empty );
1057  }
1058 
1059  CurrShell aCurr( this );
1060  SwCallLink aLk( *this ); // watch Cursor-Moves
1061  SwCursorSaveState aSaveState( *pCursor );
1062  pCursor->GetPoint()->nNode = *pNd;
1063  pCursor->GetPoint()->nContent.Assign( pNd->GetTextNode(), 0 );
1064 
1065  bool bRet = !pCursor->IsSelOvr();
1066  if( bRet )
1068  return bRet;
1069 }
1070 
1073 {
1074  const SwNodes& rNds = GetDoc()->GetNodes();
1075 
1076  if ( rNds.GetOutLineNds().empty() )
1077  {
1078  SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::NavElementNotFound );
1079  return false;
1080  }
1081 
1082  SwCursor* pCursor = getShellCursor( true );
1083  SwNode* pNd = &(pCursor->GetNode());
1085  bool bRet = false;
1086  (void)rNds.GetOutLineNds().Seek_Entry(pNd, &nPos);
1087  SwOutlineNodes::size_type const nStartPos(nPos);
1088 
1089  do
1090  {
1091  if (nPos == 0)
1092  {
1093  nPos = rNds.GetOutLineNds().size() - 1;
1094  }
1095  else
1096  {
1097  --nPos; // before
1098  }
1099  if (nPos == nStartPos)
1100  {
1101  pNd = nullptr;
1102  break;
1103  }
1104 
1105  pNd = rNds.GetOutLineNds()[ nPos ];
1106  }
1107  while (!sw::IsParaPropsNode(*GetLayout(), *pNd->GetTextNode()));
1108 
1109  if (pNd)
1110  {
1111  if (nStartPos < nPos)
1112  {
1113  SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::StartWrapped );
1114  }
1115  else
1116  {
1117  SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::Empty );
1118  }
1119  CurrShell aCurr( this );
1120  SwCallLink aLk( *this ); // watch Cursor-Moves
1121  SwCursorSaveState aSaveState( *pCursor );
1122  pCursor->GetPoint()->nNode = *pNd;
1123  pCursor->GetPoint()->nContent.Assign( pNd->GetTextNode(), 0 );
1124 
1125  bRet = !pCursor->IsSelOvr();
1126  if( bRet )
1128  }
1129  else
1130  {
1131  SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::NavElementNotFound );
1132  }
1133  return bRet;
1134 }
1135 
1138 {
1139  SwPaM* pCursor = pPaM ? pPaM : getShellCursor(true);
1140  const SwNodes& rNds = GetDoc()->GetNodes();
1141 
1142  SwNode* pNd = &(pCursor->GetNode());
1144  if( rNds.GetOutLineNds().Seek_Entry( pNd, &nPos ))
1145  nPos++; // is at correct position; take next for while
1146 
1147  while( nPos-- ) // check the one in front of the current
1148  {
1149  pNd = rNds.GetOutLineNds()[ nPos ];
1150 
1151  if (sw::IsParaPropsNode(*GetLayout(), *pNd->GetTextNode())
1152  && pNd->GetTextNode()->GetAttrOutlineLevel()-1 <= nLevel)
1153  {
1154  if (pNd->GetIndex() < rNds.GetEndOfExtras().GetIndex()
1155  && pCursor->GetNode().GetIndex() > rNds.GetEndOfExtras().GetIndex())
1156  {
1157  // node found in extras but cursor position is not in extras
1158  return SwOutlineNodes::npos;
1159  }
1160  return nPos;
1161  }
1162  }
1163  return SwOutlineNodes::npos; // no more left
1164 }
1165 
1167  bool bWithChildren , bool bKillPams)
1168 {
1169  const SwNodes& rNds = GetDoc()->GetNodes();
1170  const SwOutlineNodes& rOutlNds = rNds.GetOutLineNds();
1171  if( rOutlNds.empty() )
1172  return false;
1173 
1174  CurrShell aCurr( this );
1175  SwCallLink aLk( *this ); // watch Cursor-Moves
1176 
1177  if( nSttPos > nEndPos ) // parameters switched?
1178  {
1179  OSL_ENSURE( false, "Start > End for array access" );
1180  std::swap(nSttPos, nEndPos);
1181  }
1182 
1183  SwNode* pSttNd = rOutlNds[ nSttPos ];
1184  SwNode* pEndNd = rOutlNds[ nEndPos ];
1185 
1186  if( bWithChildren )
1187  {
1188  const int nLevel = pEndNd->GetTextNode()->GetAttrOutlineLevel()-1;
1189  for( ++nEndPos; nEndPos < rOutlNds.size(); ++nEndPos )
1190  {
1191  pEndNd = rOutlNds[ nEndPos ];
1192  const int nNxtLevel = pEndNd->GetTextNode()->GetAttrOutlineLevel()-1;
1193  if( nNxtLevel <= nLevel )
1194  break; // EndPos is now on the next one
1195  }
1196  }
1197  // if without children then set onto next one
1198  else if( ++nEndPos < rOutlNds.size() )
1199  pEndNd = rOutlNds[ nEndPos ];
1200 
1201  if( nEndPos == rOutlNds.size() ) // no end found
1202  pEndNd = &rNds.GetEndOfContent();
1203 
1204  if( bKillPams )
1205  KillPams();
1206 
1207  SwCursorSaveState aSaveState( *m_pCurrentCursor );
1208 
1209  // set end to the end of the previous content node
1210  m_pCurrentCursor->GetPoint()->nNode = *pSttNd;
1213  m_pCurrentCursor->GetPoint()->nNode = *pEndNd;
1214  m_pCurrentCursor->Move( fnMoveBackward, GoInNode ); // end of predecessor
1215 
1216  // and everything is already selected
1217  bool bRet = !m_pCurrentCursor->IsSelOvr();
1218  if( bRet )
1220  return bRet;
1221 }
1222 
1224 bool SwCursorShell::GotoRefMark( const OUString& rRefMark, sal_uInt16 nSubType,
1225  sal_uInt16 nSeqNo )
1226 {
1227  CurrShell aCurr( this );
1228  SwCallLink aLk( *this ); // watch Cursor-Moves
1229  SwCursorSaveState aSaveState( *m_pCurrentCursor );
1230 
1231  sal_Int32 nPos = -1;
1232  SwTextNode* pTextNd = SwGetRefFieldType::FindAnchor( GetDoc(), rRefMark,
1233  nSubType, nSeqNo, &nPos, nullptr, GetLayout());
1234  if( pTextNd && pTextNd->GetNodes().IsDocNodes() )
1235  {
1236  m_pCurrentCursor->GetPoint()->nNode = *pTextNd;
1237  m_pCurrentCursor->GetPoint()->nContent.Assign( pTextNd, nPos );
1238 
1239  if( !m_pCurrentCursor->IsSelOvr() )
1240  {
1242  return true;
1243  }
1244  }
1245  return false;
1246 }
1247 
1248 bool SwCursorShell::IsPageAtPos( const Point &rPt ) const
1249 {
1250  if( GetLayout() )
1251  return nullptr != GetLayout()->GetPageAtPos( rPt );
1252  return false;
1253 }
1254 
1255 bool SwCursorShell::GetContentAtPos( const Point& rPt,
1256  SwContentAtPos& rContentAtPos,
1257  bool bSetCursor,
1258  SwRect* pFieldRect )
1259 {
1260  CurrShell aCurr( this );
1261  bool bRet = false;
1262 
1263  if( !IsTableMode() )
1264  {
1265  Point aPt( rPt );
1266  SwPosition aPos( *m_pCurrentCursor->GetPoint() );
1267 
1268  SwTextNode* pTextNd;
1269  SwCursorMoveState aTmpState;
1270  aTmpState.m_bFieldInfo = true;
1271  aTmpState.m_bExactOnly = !( IsAttrAtPos::Outline & rContentAtPos.eContentAtPos );
1272  aTmpState.m_bContentCheck = bool(IsAttrAtPos::ContentCheck & rContentAtPos.eContentAtPos);
1273  aTmpState.m_bSetInReadOnly = IsReadOnlyAvailable();
1274 
1275  SwSpecialPos aSpecialPos;
1276  aTmpState.m_pSpecialPos = ( IsAttrAtPos::SmartTag & rContentAtPos.eContentAtPos ) ?
1277  &aSpecialPos : nullptr;
1278 
1279  const bool bCursorFoundExact = GetLayout()->GetModelPositionForViewPoint( &aPos, aPt, &aTmpState );
1280  pTextNd = aPos.nNode.GetNode().GetTextNode();
1281 
1282  const SwNodes& rNds = GetDoc()->GetNodes();
1283  if( pTextNd
1284  && IsAttrAtPos::Outline & rContentAtPos.eContentAtPos
1285  && !rNds.GetOutLineNds().empty() )
1286  {
1287  // only for nodes in outline nodes
1289  if(rNds.GetOutLineNds().Seek_Entry(pTextNd, &nPos))
1290  {
1291  rContentAtPos.eContentAtPos = IsAttrAtPos::Outline;
1292  rContentAtPos.sStr = sw::GetExpandTextMerged(GetLayout(), *pTextNd, true, false, ExpandMode::ExpandFootnote);
1293  rContentAtPos.aFnd.pNode = pTextNd;
1294  bRet = true;
1295  }
1296  }
1297  else if ( IsAttrAtPos::ContentCheck & rContentAtPos.eContentAtPos
1298  && bCursorFoundExact )
1299  {
1300  bRet = true;
1301  }
1302  else if( pTextNd
1303  && IsAttrAtPos::NumLabel & rContentAtPos.eContentAtPos)
1304  {
1305  bRet = aTmpState.m_bInNumPortion;
1306  rContentAtPos.aFnd.pNode = sw::GetParaPropsNode(*GetLayout(), aPos.nNode);
1307 
1308  Size aSizeLogic(aTmpState.m_nInNumPortionOffset, 0);
1309  Size aSizePixel = GetWin()->LogicToPixel(aSizeLogic);
1310  rContentAtPos.nDist = aSizePixel.Width();
1311  }
1312  else if( bCursorFoundExact && pTextNd )
1313  {
1314  SwContentFrame *pFrame(nullptr);
1315  if( !aTmpState.m_bPosCorr )
1316  {
1317  SwTextAttr* pTextAttr;
1318  if ( IsAttrAtPos::SmartTag & rContentAtPos.eContentAtPos
1319  && !aTmpState.m_bFootnoteNoInfo )
1320  {
1321  const SwWrongList* pSmartTagList = pTextNd->GetSmartTags();
1322  sal_Int32 nCurrent = aPos.nContent.GetIndex();
1323  const sal_Int32 nBegin = nCurrent;
1324  sal_Int32 nLen = 1;
1325 
1326  if (pSmartTagList && pSmartTagList->InWrongWord(nCurrent, nLen) && !pTextNd->IsSymbolAt(nBegin))
1327  {
1328  const sal_uInt16 nIndex = pSmartTagList->GetWrongPos( nBegin );
1329  const SwWrongList* pSubList = pSmartTagList->SubList( nIndex );
1330  if ( pSubList )
1331  {
1332  nCurrent = aTmpState.m_pSpecialPos->nCharOfst;
1333 
1334  if ( pSubList->InWrongWord( nCurrent, nLen ) )
1335  bRet = true;
1336  }
1337  else
1338  bRet = true;
1339 
1340  if( bRet && bSetCursor )
1341  {
1342  SwCursorSaveState aSaveState( *m_pCurrentCursor );
1343  SwCallLink aLk( *this ); // watch Cursor-Moves
1345  *m_pCurrentCursor->GetPoint() = aPos;
1347  bRet = false;
1348  else
1349  UpdateCursor();
1350  }
1351  if( bRet )
1352  {
1353  rContentAtPos.eContentAtPos = IsAttrAtPos::SmartTag;
1354 
1355  std::pair<Point, bool> tmp(aPt, true);
1356  if (pFieldRect)
1357  {
1358  pFrame = pTextNd->getLayoutFrame(GetLayout(), nullptr, &tmp);
1359  if (pFrame)
1360  pFrame->GetCharRect( *pFieldRect, aPos, &aTmpState );
1361  }
1362  }
1363  }
1364  }
1365 
1366  if ( !bRet
1368  && !aTmpState.m_bFootnoteNoInfo )
1369  {
1370  pTextAttr = pTextNd->GetFieldTextAttrAt( aPos.nContent.GetIndex() );
1371  const SwField* pField = pTextAttr != nullptr
1372  ? pTextAttr->GetFormatField().GetField()
1373  : nullptr;
1374  if ( IsAttrAtPos::ClickField & rContentAtPos.eContentAtPos
1375  && pField && !pField->HasClickHdl() )
1376  {
1377  pField = nullptr;
1378  }
1379 
1380  if ( pField )
1381  {
1382  if (pFieldRect)
1383  {
1384  std::pair<Point, bool> tmp(aPt, true);
1385  pFrame = pTextNd->getLayoutFrame(GetLayout(), nullptr, &tmp);
1386  if (pFrame)
1387  {
1388  //tdf#116397 now that we looking for the bounds of the field drop the SmartTag
1389  //index within field setting so we don't the bounds of the char within the field
1390  SwSpecialPos* pSpecialPos = aTmpState.m_pSpecialPos;
1391  aTmpState.m_pSpecialPos = nullptr;
1392  pFrame->GetCharRect( *pFieldRect, aPos, &aTmpState );
1393  aTmpState.m_pSpecialPos = pSpecialPos;
1394  }
1395  }
1396 
1397  if( bSetCursor )
1398  {
1399  SwCallLink aLk( *this ); // watch Cursor-Moves
1400  SwCursorSaveState aSaveState( *m_pCurrentCursor );
1402  *m_pCurrentCursor->GetPoint() = aPos;
1403  if( m_pCurrentCursor->IsSelOvr() )
1404  {
1405  // allow click fields in protected sections
1406  // only placeholder is not possible
1407  if( IsAttrAtPos::Field & rContentAtPos.eContentAtPos
1408  || SwFieldIds::JumpEdit == pField->Which() )
1409  pField = nullptr;
1410  }
1411  else
1412  UpdateCursor();
1413  }
1414  else if( SwFieldIds::Table == pField->Which() &&
1415  static_cast<const SwTableField*>(pField)->IsIntrnlName() )
1416  {
1417  // create from internal (for CORE) the external
1418  // (for UI) formula
1419  const SwTableNode* pTableNd = pTextNd->FindTableNode();
1420  if( pTableNd ) // is in a table
1421  const_cast<SwTableField*>(static_cast<const SwTableField*>(pField))->PtrToBoxNm( &pTableNd->GetTable() );
1422  }
1423  }
1424 
1425  if( pField )
1426  {
1427  rContentAtPos.aFnd.pField = pField;
1428  rContentAtPos.pFndTextAttr = pTextAttr;
1429  rContentAtPos.eContentAtPos = IsAttrAtPos::Field;
1430  bRet = true;
1431  }
1432  }
1433 
1434  if( !bRet && IsAttrAtPos::FormControl & rContentAtPos.eContentAtPos )
1435  {
1436  IDocumentMarkAccess* pMarksAccess = GetDoc()->getIDocumentMarkAccess( );
1437  sw::mark::IFieldmark* pFieldBookmark = pMarksAccess->getFieldmarkFor( aPos );
1438  if (bCursorFoundExact && pFieldBookmark)
1439  {
1440  rContentAtPos.eContentAtPos = IsAttrAtPos::FormControl;
1441  rContentAtPos.aFnd.pFieldmark = pFieldBookmark;
1442  bRet=true;
1443  }
1444  }
1445 
1446  if( !bRet && IsAttrAtPos::Ftn & rContentAtPos.eContentAtPos )
1447  {
1448  if( aTmpState.m_bFootnoteNoInfo )
1449  {
1450  // over the footnote's char
1451  bRet = true;
1452  if( bSetCursor )
1453  {
1454  *m_pCurrentCursor->GetPoint() = aPos;
1455  if( !GotoFootnoteAnchor() )
1456  bRet = false;
1457  }
1458  if( bRet )
1459  rContentAtPos.eContentAtPos = IsAttrAtPos::Ftn;
1460  }
1461  else if ( nullptr != ( pTextAttr = pTextNd->GetTextAttrForCharAt(
1462  aPos.nContent.GetIndex(), RES_TXTATR_FTN )) )
1463  {
1464  bRet = true;
1465  if( bSetCursor )
1466  {
1467  SwCallLink aLk( *this ); // watch Cursor-Moves
1468  SwCursorSaveState aSaveState( *m_pCurrentCursor );
1469  m_pCurrentCursor->GetPoint()->nNode = *static_cast<SwTextFootnote*>(pTextAttr)->GetStartNode();
1472  true, !IsReadOnlyAvailable() );
1473 
1474  if( pCNd )
1475  {
1476  m_pCurrentCursor->GetPoint()->nContent.Assign( pCNd, 0 );
1479  bRet = false;
1480  else
1481  UpdateCursor();
1482  }
1483  else
1484  bRet = false;
1485  }
1486 
1487  if( bRet )
1488  {
1489  rContentAtPos.eContentAtPos = IsAttrAtPos::Ftn;
1490  rContentAtPos.pFndTextAttr = pTextAttr;
1491  rContentAtPos.aFnd.pAttr = &pTextAttr->GetAttr();
1492 
1493  if (pFieldRect)
1494  {
1495  std::pair<Point, bool> tmp(aPt, true);
1496  pFrame = pTextNd->getLayoutFrame(GetLayout(), nullptr, &tmp);
1497  if (pFrame)
1498  pFrame->GetCharRect( *pFieldRect, aPos, &aTmpState );
1499  }
1500  }
1501  }
1502  }
1503 
1504  if( !bRet
1506  && !aTmpState.m_bFootnoteNoInfo )
1507  {
1508  pTextAttr = nullptr;
1509  if( IsAttrAtPos::ToxMark & rContentAtPos.eContentAtPos )
1510  {
1511  std::vector<SwTextAttr *> const marks(
1512  pTextNd->GetTextAttrsAt(
1513  aPos.nContent.GetIndex(), RES_TXTATR_TOXMARK));
1514  if (!marks.empty())
1515  { // hmm... can only return 1 here
1516  pTextAttr = *marks.begin();
1517  }
1518  }
1519 
1520  if( !pTextAttr &&
1521  IsAttrAtPos::RefMark & rContentAtPos.eContentAtPos )
1522  {
1523  std::vector<SwTextAttr *> const marks(
1524  pTextNd->GetTextAttrsAt(
1525  aPos.nContent.GetIndex(), RES_TXTATR_REFMARK));
1526  if (!marks.empty())
1527  { // hmm... can only return 1 here
1528  pTextAttr = *marks.begin();
1529  }
1530  }
1531 
1532  if( pTextAttr )
1533  {
1534  bRet = true;
1535  if( bSetCursor )
1536  {
1537  SwCallLink aLk( *this ); // watch Cursor-Moves
1538  SwCursorSaveState aSaveState( *m_pCurrentCursor );
1540  *m_pCurrentCursor->GetPoint() = aPos;
1542  bRet = false;
1543  else
1544  UpdateCursor();
1545  }
1546 
1547  if( bRet )
1548  {
1549  const sal_Int32* pEnd = pTextAttr->GetEnd();
1550  if( pEnd )
1551  rContentAtPos.sStr =
1552  pTextNd->GetExpandText(GetLayout(), pTextAttr->GetStart(), *pEnd - pTextAttr->GetStart());
1553  else if( RES_TXTATR_TOXMARK == pTextAttr->Which())
1554  rContentAtPos.sStr =
1555  pTextAttr->GetTOXMark().GetAlternativeText();
1556 
1557  rContentAtPos.eContentAtPos =
1558  RES_TXTATR_TOXMARK == pTextAttr->Which()
1561  rContentAtPos.pFndTextAttr = pTextAttr;
1562  rContentAtPos.aFnd.pAttr = &pTextAttr->GetAttr();
1563 
1564  std::pair<Point, bool> tmp(aPt, true);
1565  if (pFieldRect)
1566  {
1567  pFrame = pTextNd->getLayoutFrame(GetLayout(), nullptr, &tmp);
1568  if (pFrame)
1569  pFrame->GetCharRect( *pFieldRect, aPos, &aTmpState );
1570  }
1571  }
1572  }
1573  }
1574 
1575  if ( !bRet
1576  && IsAttrAtPos::InetAttr & rContentAtPos.eContentAtPos
1577  && !aTmpState.m_bFootnoteNoInfo )
1578  {
1579  sal_Int32 index = aPos.nContent.GetIndex();
1580  pTextAttr = pTextNd->GetTextAttrAt(index, RES_TXTATR_INETFMT);
1581 
1582  if(!pTextAttr && index > 0)
1583  pTextAttr = pTextNd->GetTextAttrAt(index - 1, RES_TXTATR_INETFMT);
1584  // "detect" only INetAttrs with URLs
1585  if( pTextAttr && !pTextAttr->GetINetFormat().GetValue().isEmpty() )
1586  {
1587  bRet = true;
1588  if( bSetCursor )
1589  {
1590  SwCursorSaveState aSaveState( *m_pCurrentCursor );
1591  SwCallLink aLk( *this ); // watch Cursor-Moves
1593  *m_pCurrentCursor->GetPoint() = aPos;
1596  bRet = false;
1597  else
1598  UpdateCursor();
1599  }
1600  if( bRet )
1601  {
1602  const sal_Int32 nSt = pTextAttr->GetStart();
1603  const sal_Int32 nEnd = *pTextAttr->End();
1604 
1605  rContentAtPos.sStr = pTextNd->GetExpandText(GetLayout(), nSt, nEnd-nSt);
1606 
1607  rContentAtPos.aFnd.pAttr = &pTextAttr->GetAttr();
1608  rContentAtPos.eContentAtPos = IsAttrAtPos::InetAttr;
1609  rContentAtPos.pFndTextAttr = pTextAttr;
1610 
1611  if (pFieldRect)
1612  {
1613  std::pair<Point, bool> tmp(aPt, true);
1614  pFrame = pTextNd->getLayoutFrame(GetLayout(), nullptr, &tmp);
1615  if (pFrame)
1616  {
1617  //get bounding box of range
1618  SwRect aStart;
1619  SwPosition aStartPos(*pTextNd, nSt);
1620  pFrame->GetCharRect(aStart, aStartPos, &aTmpState);
1621  SwRect aEnd;
1622  SwPosition aEndPos(*pTextNd, nEnd);
1623  pFrame->GetCharRect(aEnd, aEndPos, &aTmpState);
1624  if (aStart.Top() != aEnd.Top() || aStart.Bottom() != aEnd.Bottom())
1625  {
1626  aStart.Left(pFrame->getFrameArea().Left());
1627  aEnd.Right(pFrame->getFrameArea().Right());
1628  }
1629  *pFieldRect = aStart.Union(aEnd);
1630  }
1631  }
1632  }
1633  }
1634  }
1635 
1636  if( !bRet && IsAttrAtPos::Redline & rContentAtPos.eContentAtPos )
1637  {
1638  const SwRangeRedline* pRedl = GetDoc()->getIDocumentRedlineAccess().GetRedline(aPos, nullptr);
1639 
1640  if( pRedl )
1641  {
1642  rContentAtPos.aFnd.pRedl = pRedl;
1643  rContentAtPos.eContentAtPos = IsAttrAtPos::Redline;
1644  rContentAtPos.pFndTextAttr = nullptr;
1645  bRet = true;
1646 
1647  if (pFieldRect)
1648  {
1649  std::pair<Point, bool> tmp(aPt, true);
1650  pFrame = pTextNd->getLayoutFrame(GetLayout(), nullptr, &tmp);
1651  if( pFrame )
1652  {
1653  // not sure if this should be limited to one
1654  // paragraph, or mark the entire redline; let's
1655  // leave it limited to one for now...
1656  sal_Int32 nStart;
1657  sal_Int32 nEnd;
1658  pRedl->CalcStartEnd(pTextNd->GetIndex(), nStart, nEnd);
1659  if (nStart == COMPLETE_STRING)
1660  {
1661  // consistency: found pRedl, so there must be
1662  // something in pTextNd
1663  assert(nEnd != COMPLETE_STRING);
1664  nStart = 0;
1665  }
1666  if (nEnd == COMPLETE_STRING)
1667  {
1668  nEnd = pTextNd->Len();
1669  }
1670  //get bounding box of range
1671  SwRect aStart;
1672  pFrame->GetCharRect(aStart, SwPosition(*pTextNd, nStart), &aTmpState);
1673  SwRect aEnd;
1674  pFrame->GetCharRect(aEnd, SwPosition(*pTextNd, nEnd), &aTmpState);
1675  if (aStart.Top() != aEnd.Top() || aStart.Bottom() != aEnd.Bottom())
1676  {
1677  aStart.Left(pFrame->getFrameArea().Left());
1678  aEnd.Right(pFrame->getFrameArea().Right());
1679  }
1680  *pFieldRect = aStart.Union(aEnd);
1681  }
1682  }
1683  }
1684  }
1685  }
1686 
1687  if( !bRet
1688  && ( IsAttrAtPos::TableBoxFml & rContentAtPos.eContentAtPos
1689 #ifdef DBG_UTIL
1690  || IsAttrAtPos::TableBoxValue & rContentAtPos.eContentAtPos
1691 #endif
1692  ) )
1693  {
1694  const SwTableNode* pTableNd;
1695  const SwTableBox* pBox;
1696  const SwStartNode* pSttNd = pTextNd->FindTableBoxStartNode();
1697  const SfxPoolItem* pItem;
1698  if( pSttNd && nullptr != ( pTableNd = pTextNd->FindTableNode()) &&
1699  nullptr != ( pBox = pTableNd->GetTable().GetTableBox(
1700  pSttNd->GetIndex() )) &&
1701 #ifdef DBG_UTIL
1702  ( SfxItemState::SET == pBox->GetFrameFormat()->GetItemState(
1703  RES_BOXATR_FORMULA, false, &pItem ) ||
1704  SfxItemState::SET == pBox->GetFrameFormat()->GetItemState(
1705  RES_BOXATR_VALUE, false, &pItem ))
1706 #else
1707  SfxItemState::SET == pBox->GetFrameFormat()->GetItemState(
1708  RES_BOXATR_FORMULA, false, &pItem )
1709 #endif
1710  )
1711  {
1712  std::pair<Point, bool> tmp(aPt, true);
1713  SwFrame* pF = pTextNd->getLayoutFrame(GetLayout(), nullptr, &tmp);
1714  if( pF )
1715  {
1716  // then the CellFrame
1717  pFrame = static_cast<SwContentFrame*>(pF);
1718  while( pF && !pF->IsCellFrame() )
1719  pF = pF->GetUpper();
1720  }
1721 
1722  if( aTmpState.m_bPosCorr )
1723  {
1724  if( pF && !pF->getFrameArea().IsInside( aPt ))
1725  pF = nullptr;
1726  }
1727  else if( !pF )
1728  pF = pFrame;
1729 
1730  if( pF ) // only then it is valid
1731  {
1732  // create from internal (for CORE) the external
1733  // (for UI) formula
1734  rContentAtPos.eContentAtPos = IsAttrAtPos::TableBoxFml;
1735 #ifdef DBG_UTIL
1736  if( RES_BOXATR_VALUE == pItem->Which() )
1737  rContentAtPos.eContentAtPos = IsAttrAtPos::TableBoxValue;
1738  else
1739 #endif
1740  const_cast<SwTableBoxFormula&>(pItem->StaticWhichCast(RES_BOXATR_FORMULA)).PtrToBoxNm( &pTableNd->GetTable() );
1741 
1742  bRet = true;
1743  if( bSetCursor )
1744  {
1745  SwCallLink aLk( *this ); // watch Cursor-Moves
1746  SwCursorSaveState aSaveState( *m_pCurrentCursor );
1747  *m_pCurrentCursor->GetPoint() = aPos;
1750  bRet = false;
1751  else
1752  UpdateCursor();
1753  }
1754 
1755  if( bRet )
1756  {
1757  if( pFieldRect )
1758  {
1759  *pFieldRect = pF->getFramePrintArea();
1760  *pFieldRect += pF->getFrameArea().Pos();
1761  }
1762  rContentAtPos.pFndTextAttr = nullptr;
1763  rContentAtPos.aFnd.pAttr = pItem;
1764  }
1765  }
1766  }
1767  }
1768 
1769 #ifdef DBG_UTIL
1770  if( !bRet && IsAttrAtPos::CurrAttrs & rContentAtPos.eContentAtPos )
1771  {
1772  const sal_Int32 n = aPos.nContent.GetIndex();
1774  POOLATTR_END - 1>{} );
1775  if( pTextNd->GetpSwpHints() )
1776  {
1777  for( size_t i = 0; i < pTextNd->GetSwpHints().Count(); ++i )
1778  {
1779  const SwTextAttr* pHt = pTextNd->GetSwpHints().Get(i);
1780  const sal_Int32 nAttrStart = pHt->GetStart();
1781  if( nAttrStart > n ) // over the section
1782  break;
1783 
1784  if( nullptr != pHt->End() && (
1785  ( nAttrStart < n &&
1786  ( pHt->DontExpand() ? n < *pHt->End()
1787  : n <= *pHt->End() )) ||
1788  ( n == nAttrStart &&
1789  ( nAttrStart == *pHt->End() || !n ))) )
1790  {
1791  aSet.Put( pHt->GetAttr() );
1792  }
1793  }
1794  if( pTextNd->HasSwAttrSet() &&
1795  pTextNd->GetpSwAttrSet()->Count() )
1796  {
1797  SfxItemSet aFormatSet( pTextNd->GetSwAttrSet() );
1798  // remove all from format set that are also in TextSet
1799  aFormatSet.Differentiate( aSet );
1800  // now merge all together
1801  aSet.Put( aFormatSet );
1802  }
1803  }
1804  else
1805  pTextNd->SwContentNode::GetAttr( aSet );
1806 
1807  rContentAtPos.sStr = "Pos: (";
1808  rContentAtPos.sStr += OUString::number( aPos.nNode.GetIndex());
1809  rContentAtPos.sStr += ":";
1810  rContentAtPos.sStr += OUString::number( aPos.nContent.GetIndex());
1811  rContentAtPos.sStr += ")";
1812  rContentAtPos.sStr += "\nParagraph Style: ";
1813  rContentAtPos.sStr += pTextNd->GetFormatColl()->GetName();
1814  if( pTextNd->GetCondFormatColl() )
1815  {
1816  rContentAtPos.sStr += "\nConditional Style: " + pTextNd->GetCondFormatColl()->GetName();
1817  }
1818 
1819  if( aSet.Count() )
1820  {
1821  OUStringBuffer sAttrs;
1822  SfxItemIter aIter( aSet );
1823  const SfxPoolItem* pItem = aIter.GetCurItem();
1824  const IntlWrapper aInt(SvtSysLocale().GetUILanguageTag());
1825  do
1826  {
1827  if( !IsInvalidItem( pItem ))
1828  {
1829  OUString aStr;
1830  GetDoc()->GetAttrPool().GetPresentation(*pItem,
1831  MapUnit::MapCM, aStr, aInt);
1832  if (!sAttrs.isEmpty())
1833  sAttrs.append(", ");
1834  sAttrs.append(aStr);
1835  }
1836  pItem = aIter.NextItem();
1837  } while (pItem);
1838  if (!sAttrs.isEmpty())
1839  {
1840  if( !rContentAtPos.sStr.isEmpty() )
1841  rContentAtPos.sStr += "\n";
1842  rContentAtPos.sStr += "Attr: " + sAttrs.toString();
1843  }
1844  }
1845  bRet = true;
1846  rContentAtPos.eContentAtPos = IsAttrAtPos::CurrAttrs;
1847  }
1848 #endif
1849  }
1850  }
1851 
1852  if( !bRet )
1853  {
1854  rContentAtPos.eContentAtPos = IsAttrAtPos::NONE;
1855  rContentAtPos.aFnd.pField = nullptr;
1856  }
1857  return bRet;
1858 }
1859 
1860 // #i90516#
1862 {
1863  const SwPostItField* pPostItField = nullptr;
1864 
1865  if ( !IsTableMode() )
1866  {
1867  const SwPosition* pCursorPos = GetCursor_()->GetPoint();
1868  const SwTextNode* pTextNd = pCursorPos->nNode.GetNode().GetTextNode();
1869  if ( pTextNd )
1870  {
1871  SwTextAttr* pTextAttr = pTextNd->GetFieldTextAttrAt( pCursorPos->nContent.GetIndex() );
1872  const SwField* pField = pTextAttr != nullptr ? pTextAttr->GetFormatField().GetField() : nullptr;
1873  if ( pField && pField->Which()== SwFieldIds::Postit )
1874  {
1875  pPostItField = static_cast<const SwPostItField*>(pField);
1876  }
1877  }
1878  }
1879 
1880  return pPostItField;
1881 }
1882 
1885 {
1886  const SwTextNode* pNd = nullptr;
1887  if( pFndTextAttr )
1888  {
1889  switch( eContentAtPos )
1890  {
1891  case IsAttrAtPos::Field:
1893  pNd = static_txtattr_cast<SwTextField const*>(pFndTextAttr)->GetpTextNode();
1894  break;
1895 
1896  case IsAttrAtPos::Ftn:
1897  pNd = &static_cast<const SwTextFootnote*>(pFndTextAttr)->GetTextNode();
1898  break;
1899 
1900  case IsAttrAtPos::InetAttr:
1901  pNd = static_txtattr_cast<SwTextINetFormat const*>(pFndTextAttr)->GetpTextNode();
1902  break;
1903 
1904  default:
1905  break;
1906  }
1907  }
1908 
1909  if( !pNd )
1910  return false;
1911  if( pNd->IsInProtectSect() )
1912  return true;
1913 
1914  const SwContentFrame* pFrame = pNd->getLayoutFrame(pNd->GetDoc().getIDocumentLayoutAccess().GetCurrentLayout(), nullptr, nullptr);
1915  return pFrame && pFrame->IsProtected() ;
1916 }
1917 
1919 {
1920  bool bRet = false;
1921  const SwTextNode* pNd = nullptr;
1923  {
1924  const SwTextFootnote* pTextFootnote = static_cast<const SwTextFootnote*>(pFndTextAttr);
1925  if(pTextFootnote->GetStartNode())
1926  {
1927  SwStartNode* pSttNd = pTextFootnote->GetStartNode()->GetNode().GetStartNode();
1928  SwPaM aTemp( *pSttNd );
1929  aTemp.Move(fnMoveForward, GoInNode);
1930  SwContentNode* pContentNode = aTemp.GetContentNode();
1931  if(pContentNode && pContentNode->IsTextNode())
1932  pNd = pContentNode->GetTextNode();
1933  }
1934  }
1935  if(pNd)
1936  {
1938  SwTextFrame* pTmpFrame = aIter.First();
1939  while( pTmpFrame )
1940  {
1941  if ( !pTmpFrame->IsFollow())
1942  {
1943  bRet = pTmpFrame->IsRightToLeft();
1944  break;
1945  }
1946  pTmpFrame = aIter.Next();
1947  }
1948  }
1949  return bRet;
1950 }
1951 
1952 bool SwCursorShell::SelectText( const sal_Int32 nStart,
1953  const sal_Int32 nEnd )
1954 {
1955  CurrShell aCurr( this );
1956  bool bRet = false;
1957 
1958  SwCallLink aLk( *this );
1959  SwCursorSaveState aSaveState( *m_pCurrentCursor );
1960 
1961  SwPosition& rPos = *m_pCurrentCursor->GetPoint();
1963  rPos.nContent = nStart;
1965  rPos.nContent = nEnd;
1966 
1967  if( !m_pCurrentCursor->IsSelOvr() )
1968  {
1969  UpdateCursor();
1970  bRet = true;
1971  }
1972 
1973  return bRet;
1974 }
1975 
1976 bool SwCursorShell::SelectTextAttr( sal_uInt16 nWhich,
1977  bool bExpand,
1978  const SwTextAttr* pTextAttr )
1979 {
1980  CurrShell aCurr( this );
1981  bool bRet = false;
1982 
1983  if( !IsTableMode() )
1984  {
1985  if( !pTextAttr )
1986  {
1987  SwPosition& rPos = *m_pCurrentCursor->GetPoint();
1988  SwTextNode* pTextNd = rPos.nNode.GetNode().GetTextNode();
1989  pTextAttr = pTextNd
1990  ? pTextNd->GetTextAttrAt(rPos.nContent.GetIndex(),
1991  nWhich,
1993  : nullptr;
1994  }
1995 
1996  if( pTextAttr )
1997  {
1998  const sal_Int32* pEnd = pTextAttr->End();
1999  bRet = SelectText( pTextAttr->GetStart(), ( pEnd ? *pEnd : pTextAttr->GetStart() + 1 ) );
2000  }
2001  }
2002  return bRet;
2003 }
2004 
2006 {
2007  bool bRet = false;
2008  if( rAttr.GetpTextNode() )
2009  {
2010  SwCursor* pCursor = getShellCursor( true );
2011 
2012  CurrShell aCurr( this );
2013  SwCallLink aLk( *this ); // watch Cursor-Moves
2014  SwCursorSaveState aSaveState( *pCursor );
2015 
2016  pCursor->GetPoint()->nNode = *rAttr.GetpTextNode();
2017  pCursor->GetPoint()->nContent.Assign( const_cast<SwTextNode*>(rAttr.GetpTextNode()),
2018  rAttr.GetStart() );
2019  bRet = !pCursor->IsSelOvr();
2020  if( bRet )
2022  }
2023  return bRet;
2024 }
2025 
2026 const SwFormatINetFormat* SwCursorShell::FindINetAttr( std::u16string_view rName ) const
2027 {
2028  return mxDoc->FindINetAttr( rName );
2029 }
2030 
2031 bool SwCursorShell::GetShadowCursorPos( const Point& rPt, SwFillMode eFillMode,
2032  SwRect& rRect, sal_Int16& rOrient )
2033 {
2034 
2035  CurrShell aCurr( this );
2036  bool bRet = false;
2037 
2038  if (!IsTableMode() && !HasSelection()
2039  && GetDoc()->GetIDocumentUndoRedo().DoesUndo())
2040  {
2041  Point aPt( rPt );
2042  SwPosition aPos( *m_pCurrentCursor->GetPoint() );
2043 
2044  SwFillCursorPos aFPos( eFillMode );
2045  SwCursorMoveState aTmpState( &aFPos );
2046 
2047  if( GetLayout()->GetModelPositionForViewPoint( &aPos, aPt, &aTmpState ) &&
2048  !aPos.nNode.GetNode().IsProtect())
2049  {
2050  // start position in protected section?
2051  rRect = aFPos.aCursor;
2052  rOrient = aFPos.eOrient;
2053  bRet = true;
2054  }
2055  }
2056  return bRet;
2057 }
2058 
2059 bool SwCursorShell::SetShadowCursorPos( const Point& rPt, SwFillMode eFillMode )
2060 {
2061  CurrShell aCurr( this );
2062  bool bRet = false;
2063 
2064  if (!IsTableMode() && !HasSelection()
2065  && GetDoc()->GetIDocumentUndoRedo().DoesUndo())
2066  {
2067  Point aPt( rPt );
2068  SwPosition aPos( *m_pCurrentCursor->GetPoint() );
2069 
2070  SwFillCursorPos aFPos( eFillMode );
2071  SwCursorMoveState aTmpState( &aFPos );
2072 
2073  if( GetLayout()->GetModelPositionForViewPoint( &aPos, aPt, &aTmpState ) )
2074  {
2075  SwCallLink aLk( *this ); // watch Cursor-Moves
2076  StartAction();
2077 
2078  SwContentNode* pCNd = aPos.nNode.GetNode().GetContentNode();
2080  // If only the paragraph attributes "Adjust" or "LRSpace" are set,
2081  // then the following should not delete those again.
2082  if( 0 == aFPos.nParaCnt + aFPos.nColumnCnt &&
2083  ( SwFillMode::Indent == aFPos.eMode ||
2084  ( text::HoriOrientation::NONE != aFPos.eOrient &&
2085  0 == aFPos.nTabCnt + aFPos.nSpaceCnt )) &&
2086  pCNd && pCNd->Len() )
2087  nUndoId = SwUndoId::EMPTY;
2088 
2089  GetDoc()->GetIDocumentUndoRedo().StartUndo( nUndoId, nullptr );
2090 
2091  SwTextFormatColl* pNextFormat = nullptr;
2092  SwTextNode* pTNd = pCNd ? pCNd->GetTextNode() : nullptr;
2093  if( pTNd )
2094  pNextFormat = &pTNd->GetTextColl()->GetNextTextFormatColl();
2095 
2096  const SwSectionNode* pSectNd = pCNd ? pCNd->FindSectionNode() : nullptr;
2097  if( pSectNd && aFPos.nParaCnt )
2098  {
2099  SwNodeIndex aEnd( aPos.nNode, 1 );
2100  while( aEnd.GetNode().IsEndNode() &&
2101  &aEnd.GetNode() !=
2102  pSectNd->EndOfSectionNode() )
2103  ++aEnd;
2104 
2105  if( aEnd.GetNode().IsEndNode() &&
2106  pCNd->Len() == aPos.nContent.GetIndex() )
2107  aPos.nNode = *pSectNd->EndOfSectionNode();
2108  }
2109 
2110  for( sal_uInt16 n = 0; n < aFPos.nParaCnt + aFPos.nColumnCnt; ++n )
2111  {
2113  if( !n && pNextFormat )
2114  {
2115  *m_pCurrentCursor->GetPoint() = aPos;
2116  GetDoc()->SetTextFormatColl( *m_pCurrentCursor, pNextFormat, false );
2117  }
2118  if( n < aFPos.nColumnCnt )
2119  {
2120  *m_pCurrentCursor->GetPoint() = aPos;
2122  SvxFormatBreakItem( SvxBreak::ColumnBefore, RES_BREAK ) );
2123  }
2124  }
2125 
2126  *m_pCurrentCursor->GetPoint() = aPos;
2127  switch( aFPos.eMode )
2128  {
2129  case SwFillMode::Indent:
2130  if( nullptr != (pCNd = aPos.nNode.GetNode().GetContentNode() ))
2131  {
2132  SfxItemSet aSet(
2133  GetDoc()->GetAttrPool(),
2134  svl::Items<
2138  aLR.SetTextLeft( aFPos.nTabCnt );
2139  aLR.SetTextFirstLineOffset( 0 );
2140  aSet.Put( aLR );
2141 
2143  if( SvxAdjust::Left != rAdj.GetAdjust() )
2144  aSet.Put( SvxAdjustItem( SvxAdjust::Left, RES_PARATR_ADJUST ) );
2145 
2147  }
2148  else {
2149  OSL_ENSURE( false, "No ContentNode" );
2150  }
2151  break;
2152 
2153  case SwFillMode::Tab:
2154  case SwFillMode::TabSpace:
2155  case SwFillMode::Space:
2156  {
2157  OUStringBuffer sInsert;
2158  if (aFPos.eMode == SwFillMode::Space)
2159  {
2160  comphelper::string::padToLength(sInsert, sInsert.getLength() + aFPos.nSpaceOnlyCnt, ' ');
2161  }
2162  else
2163  {
2164  if (aFPos.nTabCnt)
2165  comphelper::string::padToLength(sInsert, aFPos.nTabCnt, '\t');
2166  if (aFPos.nSpaceCnt)
2167  comphelper::string::padToLength(sInsert, sInsert.getLength() + aFPos.nSpaceCnt, ' ');
2168  }
2169  if (!sInsert.isEmpty())
2170  GetDoc()->getIDocumentContentOperations().InsertString( *m_pCurrentCursor, sInsert.makeStringAndClear());
2171  }
2172  [[fallthrough]]; // still need to set orientation
2173  case SwFillMode::Margin:
2174  if( text::HoriOrientation::NONE != aFPos.eOrient )
2175  {
2176  SvxAdjustItem aAdj( SvxAdjust::Left, RES_PARATR_ADJUST );
2177  switch( aFPos.eOrient )
2178  {
2179  case text::HoriOrientation::CENTER:
2180  aAdj.SetAdjust( SvxAdjust::Center );
2181  break;
2182  case text::HoriOrientation::RIGHT:
2183  aAdj.SetAdjust( SvxAdjust::Right );
2184  break;
2185  default:
2186  break;
2187  }
2189  }
2190  break;
2191  }
2192 
2193  GetDoc()->GetIDocumentUndoRedo().EndUndo( nUndoId, nullptr );
2194  EndAction();
2195 
2196  bRet = true;
2197  }
2198  }
2199  return bRet;
2200 }
2201 
2203 {
2204  const SwRangeRedline* pFnd = nullptr;
2205  if( !IsTableMode() )
2206  {
2207  CurrShell aCurr( this );
2208  SwCallLink aLk( *this ); // watch Cursor-Moves
2209  SwCursorSaveState aSaveState( *m_pCurrentCursor );
2210 
2211  // ensure point is at the end so alternating SelNext/SelPrev works
2212  NormalizePam(false);
2214 
2215  // at the end of the document, go to the start of the document, and try again
2216  if ( !pFnd )
2217  {
2220  }
2221 
2224  else
2225  pFnd = nullptr;
2226  }
2227  return pFnd;
2228 }
2229 
2231 {
2232  const SwRangeRedline* pFnd = nullptr;
2233  if( !IsTableMode() )
2234  {
2235  CurrShell aCurr( this );
2236  SwCallLink aLk( *this ); // watch Cursor-Moves
2237  SwCursorSaveState aSaveState( *m_pCurrentCursor );
2238 
2239  // ensure point is at the start so alternating SelNext/SelPrev works
2240  NormalizePam(true);
2242 
2243  // at the start of the document, go to the end of the document, and try again
2244  if ( !pFnd )
2245  {
2248  }
2249 
2252  else
2253  pFnd = nullptr;
2254  }
2255  return pFnd;
2256 }
2257 
2259 {
2260  const SwRangeRedline* pFnd = nullptr;
2261  SwCallLink aLk( *this ); // watch Cursor-Moves
2262  SwCursorSaveState aSaveState( *m_pCurrentCursor );
2263 
2264  pFnd = GetDoc()->getIDocumentRedlineAccess().GetRedlineTable()[ nArrPos ];
2265  if( pFnd )
2266  {
2267  *m_pCurrentCursor->GetPoint() = *pFnd->Start();
2268 
2270  if( !pIdx->GetNode().IsContentNode() )
2271  {
2272  SwContentNode* pCNd = GetDoc()->GetNodes().GoNextSection( pIdx,
2273  true, IsReadOnlyAvailable() );
2274  if( pCNd )
2275  {
2276  if( *pIdx <= pFnd->End()->nNode )
2277  m_pCurrentCursor->GetPoint()->nContent.Assign( pCNd, 0 );
2278  else
2279  pFnd = nullptr;
2280  }
2281  }
2282 
2283  if( pFnd && bSelect )
2284  {
2286  if( RedlineType::FmtColl == pFnd->GetType() )
2287  {
2288  SwContentNode* pCNd = pIdx->GetNode().GetContentNode();
2289  m_pCurrentCursor->GetPoint()->nContent.Assign( pCNd, pCNd->Len() );
2290  m_pCurrentCursor->GetMark()->nContent.Assign( pCNd, 0 );
2291  }
2292  else
2293  *m_pCurrentCursor->GetPoint() = *pFnd->End();
2294 
2295  pIdx = &m_pCurrentCursor->GetPoint()->nNode;
2296  if( !pIdx->GetNode().IsContentNode() )
2297  {
2298  SwContentNode* pCNd = SwNodes::GoPrevSection( pIdx,
2299  true, IsReadOnlyAvailable() );
2300  if( pCNd )
2301  {
2302  if( *pIdx >= m_pCurrentCursor->GetMark()->nNode )
2303  m_pCurrentCursor->GetPoint()->nContent.Assign( pCNd, pCNd->Len() );
2304  else
2305  pFnd = nullptr;
2306  }
2307  }
2308  }
2309 
2310  if( !pFnd )
2311  {
2314  }
2315  else if( bSelect && *m_pCurrentCursor->GetMark() == *m_pCurrentCursor->GetPoint() )
2317 
2321  else
2322  {
2323  pFnd = nullptr;
2324  if( bSelect )
2326  }
2327  }
2328  return pFnd;
2329 }
2330 
2332 {
2333  const SwRangeRedline* pFnd = nullptr;
2334  if( !IsTableMode() )
2335  {
2336  CurrShell aCurr( this );
2337 
2339  const SwRangeRedline* pTmp = rTable[ nArrPos ];
2340  sal_uInt16 nSeqNo = pTmp->GetSeqNo();
2341  if( nSeqNo && bSelect )
2342  {
2343  bool bCheck = false;
2344  int nLoopCnt = 2;
2345  SwRedlineTable::size_type nArrSavPos = nArrPos;
2346 
2347  do {
2348  pTmp = GotoRedline_( nArrPos, true );
2349 
2350  if( !pFnd )
2351  pFnd = pTmp;
2352 
2353  if( pTmp && bCheck )
2354  {
2355  // Check for overlaps. These can happen when FormatColl-
2356  // Redlines were stretched over a whole paragraph
2357  SwPaM* pCur = m_pCurrentCursor;
2358  SwPaM* pNextPam = pCur->GetNext();
2359  SwPosition* pCStt = pCur->Start(), *pCEnd = pCur->End();
2360  while( pCur != pNextPam )
2361  {
2362  const SwPosition *pNStt = pNextPam->Start(),
2363  *pNEnd = pNextPam->End();
2364 
2365  bool bDel = true;
2366  switch( ::ComparePosition( *pCStt, *pCEnd,
2367  *pNStt, *pNEnd ))
2368  {
2369  case SwComparePosition::Inside: // Pos1 is completely in Pos2
2370  if( !pCur->HasMark() )
2371  {
2372  pCur->SetMark();
2373  *pCur->GetMark() = *pNStt;
2374  }
2375  else
2376  *pCStt = *pNStt;
2377  *pCEnd = *pNEnd;
2378  break;
2379 
2380  case SwComparePosition::Outside: // Pos2 is completely in Pos1
2381  case SwComparePosition::Equal: // Pos1 has same size as Pos2
2382  break;
2383 
2384  case SwComparePosition::OverlapBefore: // Pos1 overlaps Pos2 at beginning
2385  if( !pCur->HasMark() )
2386  pCur->SetMark();
2387  *pCEnd = *pNEnd;
2388  break;
2389  case SwComparePosition::OverlapBehind: // Pos1 overlaps Pos2 at end
2390  if( !pCur->HasMark() )
2391  {
2392  pCur->SetMark();
2393  *pCur->GetMark() = *pNStt;
2394  }
2395  else
2396  *pCStt = *pNStt;
2397  break;
2398 
2399  default:
2400  bDel = false;
2401  }
2402 
2403  if( bDel )
2404  {
2405  // not needed anymore
2406  SwPaM* pPrevPam = pNextPam->GetPrev();
2407  delete pNextPam;
2408  pNextPam = pPrevPam;
2409  }
2410  pNextPam = pNextPam->GetNext();
2411  }
2412  }
2413 
2414  SwRedlineTable::size_type nFndPos = 2 == nLoopCnt
2415  ? rTable.FindNextOfSeqNo( nArrPos )
2416  : rTable.FindPrevOfSeqNo( nArrPos );
2417  if( SwRedlineTable::npos != nFndPos ||
2418  ( 0 != ( --nLoopCnt ) && SwRedlineTable::npos != (
2419  nFndPos = rTable.FindPrevOfSeqNo( nArrSavPos ))) )
2420  {
2421  if( pTmp )
2422  {
2423  // create new cursor
2424  CreateCursor();
2425  bCheck = true;
2426  }
2427  nArrPos = nFndPos;
2428  }
2429  else
2430  nLoopCnt = 0;
2431 
2432  } while( nLoopCnt );
2433  }
2434  else
2435  pFnd = GotoRedline_( nArrPos, bSelect );
2436  }
2437  return pFnd;
2438 }
2439 
2441 {
2442  SwNodes& rNds = GetDoc()->GetNodes();
2443  const SwNode* pBodyEndNd = &rNds.GetEndOfContent();
2444  const SwNode* pBodySttNd = pBodyEndNd->StartOfSectionNode();
2445  sal_uLong nBodySttNdIdx = pBodySttNd->GetIndex();
2446  Point aPt;
2447 
2448  SetGetExpField aCmpPos( SwPosition( bNext ? *pBodyEndNd : *pBodySttNd ) );
2449  SetGetExpField aCurPos( bNext ? *m_pCurrentCursor->End() : *m_pCurrentCursor->Start() );
2450  if( aCurPos.GetNode() < nBodySttNdIdx )
2451  {
2452  const SwContentNode* pCNd = aCurPos.GetNodeFromContent()->GetContentNode();
2453  std::pair<Point, bool> tmp(aPt, true);
2454  if (pCNd)
2455  {
2456  SwContentFrame* pFrame = pCNd->getLayoutFrame(GetLayout(), nullptr, &tmp);
2457  if( pFrame )
2458  aCurPos.SetBodyPos( *pFrame );
2459  }
2460  }
2461 
2462  // check first all the hyperlink fields
2463  {
2464  const SwTextNode* pTextNd;
2465  const SwCharFormats* pFormats = GetDoc()->GetCharFormats();
2466  for( SwCharFormats::size_type n = pFormats->size(); 1 < n; )
2467  {
2468  SwIterator<SwTextINetFormat,SwCharFormat> aIter(*(*pFormats)[--n]);
2469 
2470  for( SwTextINetFormat* pFnd = aIter.First(); pFnd; pFnd = aIter.Next() )
2471  {
2472  pTextNd = pFnd->GetpTextNode();
2473  if( pTextNd && pTextNd->GetNodes().IsDocNodes() )
2474  {
2475  SwTextINetFormat& rAttr = *pFnd;
2476  SwPosition aTmpPos( *pTextNd );
2477  SetGetExpField aPos( aTmpPos.nNode, rAttr );
2478  if (pTextNd->GetIndex() < nBodySttNdIdx)
2479  {
2480  std::pair<Point, bool> tmp(aPt, true);
2481  SwContentFrame* pFrame = pTextNd->getLayoutFrame(GetLayout(), nullptr, &tmp);
2482  if (pFrame)
2483  {
2484  aPos.SetBodyPos( *pFrame );
2485  }
2486  }
2487 
2488  if( bNext
2489  ? ( aPos < aCmpPos && aCurPos < aPos )
2490  : ( aCmpPos < aPos && aPos < aCurPos ))
2491  {
2492  OUString sText(pTextNd->GetExpandText(GetLayout(),
2493  rAttr.GetStart(),
2494  *rAttr.GetEnd() - rAttr.GetStart() ) );
2495 
2496  sText = sText.replaceAll("\x0a", "");
2497  sText = comphelper::string::strip(sText, ' ');
2498 
2499  if( !sText.isEmpty() )
2500  aCmpPos = aPos;
2501  }
2502  }
2503  }
2504  }
2505  }
2506 
2507  // then check all the Flys with a URL or image map
2508  {
2509  const SwFrameFormats* pFormats = GetDoc()->GetSpzFrameFormats();
2510  for( SwFrameFormats::size_type n = 0, nEnd = pFormats->size(); n < nEnd; ++n )
2511  {
2512  SwFlyFrameFormat* pFormat = static_cast<SwFlyFrameFormat*>((*pFormats)[ n ]);
2513  const SwFormatURL& rURLItem = pFormat->GetURL();
2514  if( rURLItem.GetMap() || !rURLItem.GetURL().isEmpty() )
2515  {
2516  SwFlyFrame* pFly = pFormat->GetFrame( &aPt );
2517  SwPosition aTmpPos( *pBodySttNd );
2518  if( pFly &&
2519  GetBodyTextNode( *GetDoc(), aTmpPos, *pFly->GetLower() ) )
2520  {
2521  SetGetExpField aPos( *pFormat, &aTmpPos );
2522 
2523  if( bNext
2524  ? ( aPos < aCmpPos && aCurPos < aPos )
2525  : ( aCmpPos < aPos && aPos < aCurPos ))
2526  aCmpPos = aPos;
2527  }
2528  }
2529  }
2530  }
2531 
2532  // found any URL ?
2533  bool bRet = false;
2534  const SwTextINetFormat* pFndAttr = aCmpPos.GetINetFormat();
2535  const SwFlyFrameFormat* pFndFormat = aCmpPos.GetFlyFormat();
2536  if( pFndAttr || pFndFormat )
2537  {
2538  CurrShell aCurr( this );
2539  SwCallLink aLk( *this );
2540 
2541  // found a text attribute ?
2542  if( pFndAttr )
2543  {
2544  SwCursorSaveState aSaveState( *m_pCurrentCursor );
2545 
2546  aCmpPos.GetPosOfContent( *m_pCurrentCursor->GetPoint() );
2549  m_pCurrentCursor->GetPoint()->nContent = *pFndAttr->End();
2550 
2552  {
2555  bRet = true;
2556  }
2557  }
2558  // found a draw object ?
2559  else if( RES_DRAWFRMFMT == pFndFormat->Which() )
2560  {
2561  const SdrObject* pSObj = pFndFormat->FindSdrObject();
2562  if (pSObj)
2563  {
2564  static_cast<SwFEShell*>(this)->SelectObj( pSObj->GetCurrentBoundRect().Center() );
2565  MakeSelVisible();
2566  bRet = true;
2567  }
2568  }
2569  else // then is it a fly
2570  {
2571  SwFlyFrame* pFly = pFndFormat->GetFrame(&aPt);
2572  if( pFly )
2573  {
2574  static_cast<SwFEShell*>(this)->SelectFlyFrame( *pFly );
2575  MakeSelVisible();
2576  bRet = true;
2577  }
2578  }
2579  }
2580  return bRet;
2581 }
2582 
2583 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
vcl::RenderContext * GetOut() const
Definition: viewsh.hxx:338
SwSectionNode * FindSectionNode()
Search section node, in which it is.
Definition: ndsect.cxx:983
Instances of SwFields and those derived from it occur 0 to n times.
Definition: fldbas.hxx:240
const SwEndNode * EndOfSectionNode() const
Definition: node.hxx:686
Starts a section of nodes in the document model.
Definition: node.hxx:312
bool IsInRTLText() const
Definition: crstrvl.cxx:1918
Base class of the Writer layout elements.
Definition: frame.hxx:298
Represents the visualization of a paragraph.
Definition: txtfrm.hxx:157
virtual sal_Int32 Len() const
Definition: node.cxx:1245
void DeleteMark()
Definition: pam.hxx:177
bool ContainsPageDesc(const SwPageDesc *pDesc, size_t *pPos) const
Definition: docdesc.cxx:865
void KillPams()
Definition: crsrsh.cxx:1021
const_iterator lower_bound(const Value &x) const
sal_uLong GetIndex() const
Definition: node.hxx:291
virtual const SwRangeRedline * SelPrevRedline(SwPaM &rPam) const =0
bool m_bFieldInfo
should be fields recognized?
Definition: crstate.hxx:142
SAL_DLLPRIVATE void UpdateCursor(sal_uInt16 eFlags=SwCursorShell::SCROLLWIN|SwCursorShell::CHKRANGE, bool bIdleEnd=false)
Definition: crsrsh.cxx:1567
SwNode & GetNode(bool bPoint=true) const
Definition: pam.hxx:223
void Right(const tools::Long nRight)
Definition: swrect.hxx:200
static SwField * GetFieldAtCursor(const SwPaM *pCursor, const bool bIncludeInputFieldAtStart)
Definition: crstrvl.cxx:897
SwShellCursor * m_pCurrentCursor
current cursor
Definition: crsrsh.hxx:175
sal_Int32 nIndex
bool IsFollow() const
Definition: flowfrm.hxx:166
sal_uInt16 GetSeqNo() const
Definition: redline.hxx:221
Represents the style of a paragraph.
Definition: fmtcol.hxx:56
virtual bool GetPresentation(const SfxPoolItem &rItem, MapUnit ePresentationMetric, OUString &rText, const IntlWrapper &rIntlWrapper) const
Marks a position in the document model.
Definition: pam.hxx:35
virtual const tools::Rectangle & GetCurrentBoundRect() const
sal_Int32 nCharOfst
Definition: crstate.hxx:110
const SwNodes & GetNodes() const
Definition: viewsh.cxx:2085
bool IsInProtectTable(bool bMove=false, bool bChgCursor=true)
Definition: swcrsr.cxx:566
const SwField * GetField() const
Definition: fmtfld.hxx:110
bool IsMultiSelection() const
Definition: pam.hxx:272
const SwPageFrame * GetPageAtPos(const Point &rPt, const Size *pSize=nullptr, bool bExtend=false) const
Point rPt: The point that should be used to find the page Size pSize: If given, we return the (first)...
Definition: findfrm.cxx:573
SwRect & Union(const SwRect &rRect)
Definition: swrect.cxx:41
SwPaM * GetCursor(bool bMakeTableCursor=true) const
Return pointer to the current shell cursor.
Definition: crsrsh.cxx:194
const SwTableBox * GetTableBox(const OUString &rName, const bool bPerformValidCheck=false) const
Definition: swtable.cxx:1328
SvxAdjust GetAdjust() const
SwComparePosition ComparePosition(const T &rStt1, const T &rEnd1, const T &rStt2, const T &rEnd2)
Definition: pam.hxx:77
virtual const SwRootFrame * GetCurrentLayout() const =0
const SwFormatHeader & GetHeader(bool=true) const
Definition: fmthdft.hxx:97
SwUndoId
Definition: swundo.hxx:29
SwDocShell * GetDocShell()
Definition: doc.hxx:1353
static SwContentNode * GetContentNode(SwDoc &rDoc, SwNodeIndex &rIdx, bool bNext)
Definition: fltshell.cxx:53
const SwRangeRedline * SelNextRedline()
Definition: crstrvl.cxx:2202
check overlapping PaMs
Definition: crsrsh.hxx:154
void Left(const tools::Long nLeft)
Definition: swrect.hxx:195
SwNodeIndex nNode
Definition: pam.hxx:37
bool IsTableMode() const
Definition: crsrsh.hxx:643
keep Up/Down on columns
Definition: crsrsh.hxx:152
bool MoveFieldType(const SwFieldType *pFieldType, const bool bNext, const SwFieldIds nResType=SwFieldIds::Unknown, const bool bAddSetExpressionFieldsToInputFields=true)
Definition: crstrvl.cxx:694
virtual void InsertItemSet(const SwPaM &rRg, const SfxItemSet &, const SetAttrMode nFlags=SetAttrMode::DEFAULT, SwRootFrame const *pLayout=nullptr)=0
sal_uInt16 char char * pDesc
SwShellCursor * getShellCursor(bool bBlock)
Delivers the current shell cursor.
Definition: crsrsh.cxx:3038
const SwTextNode * GetBodyTextNode(const SwDoc &rDoc, SwPosition &rPos, const SwFrame &rFrame)
Forward declaration: get "BodyTextNode" for exp.fld in Fly's headers/footers/footnotes.
Definition: expfld.cxx:163
virtual const sal_Int32 * GetEnd() const
end position
Definition: txatbase.cxx:48
sal_uIntPtr sal_uLong
std::vector< SwTOXMark * > SwTOXMarks
Definition: tox.hxx:45
size_type FindPrevOfSeqNo(size_type nSttPos) const
Definition: docredln.cxx:660
const SwRect & getFramePrintArea() const
Definition: frame.hxx:179
Pos1 is as large as Pos2.
const SfxPoolItem * pAttr
Definition: crsrsh.hxx:96
const SwPosition * GetMark() const
Definition: pam.hxx:209
only align left, center, right
Base class of all fields.
Definition: fldbas.hxx:289
const SwRangeRedline * GotoRedline(SwRedlineTable::size_type nArrPos, bool bSelect)
Definition: crstrvl.cxx:2331
Pos1 completely contained in Pos2.
SwContentFrame * getLayoutFrame(const SwRootFrame *, const SwPosition *pPos=nullptr, std::pair< Point, bool > const *pViewPosAndCalcFrame=nullptr) const
Definition: node.cxx:1212
sal_Int64 n
virtual SwUndoId EndUndo(SwUndoId const eUndoId, SwRewriter const *const pRewriter)=0
Closes undo block.
Provides access to the marks of a document.
virtual void SetMark() override
Unless this is called, the getter method of Mark will return Point.
Definition: viscrs.cxx:652
virtual bool IsSelOvr(SwCursorSelOverFlags eFlags=SwCursorSelOverFlags::CheckNodeSection|SwCursorSelOverFlags::Toggle|SwCursorSelOverFlags::ChangePos)
Definition: swcrsr.cxx:224
Definition: doc.hxx:187
static SwContentNode * GoPrevSection(SwNodeIndex *, bool bSkipHidden=true, bool bSkipProtect=true)
Definition: nodes.cxx:1968
TElementType * Next()
Definition: calbck.hxx:333
bool m_bSetInReadOnly
ReadOnly areas may be entered.
Definition: crstate.hxx:148
virtual void MakeSelVisible()
show the current selected "object"
Definition: crsrsh.cxx:3074
constexpr TypedWhichId< SvxFormatBreakItem > RES_BREAK(94)
bool m_bExactOnly
let GetModelPositionForViewPoint look for exact matches only, i.e.
Definition: crstate.hxx:145
SwNode & GetNode() const
Definition: ndindex.hxx:119
bool GotoFootnoteAnchor()
jump from footnote to anchor
Definition: trvlfnfl.cxx:162
Content, content of frame (header, footer, fly).
Definition: fmtcntnt.hxx:31
SwSectionFormat * GetFormat()
Definition: section.hxx:336
void Pos(const Point &rNew)
Definition: swrect.hxx:169
IDocumentMarkAccess * getIDocumentMarkAccess()
Definition: docbm.cxx:1794
IDocumentUndoRedo & GetIDocumentUndoRedo()
Definition: doc.cxx:144
virtual void Calc(vcl::RenderContext *pRenderContext) const
Definition: trvlfrm.cxx:1788
bool IsCellFrame() const
Definition: frame.hxx:1207
Of course Writer needs its own rectangles.
Definition: swrect.hxx:35
sal_uInt16 Which() const
Definition: txatbase.hxx:114
virtual const sal_Int32 * GetEnd() const override
end position
Definition: txatbase.cxx:77
SwTextAttr * GetTextAttrAt(sal_Int32 const nIndex, sal_uInt16 const nWhich, enum GetTextAttrMode const eMode=DEFAULT) const
get the innermost text attribute covering position nIndex.
Definition: ndtxt.cxx:1731
bool GotoNxtPrvTableFormula(bool bNext=true, bool bOnlyErrors=false)
Jump to next/previous table formula Optionally it is possible to also jump to broken formulas...
Definition: crstrvl.cxx:389
constexpr TypedWhichId< SwTableBoxValue > RES_BOXATR_VALUE(152)
bool GotoHeaderText()
jump from the content to the header
Definition: crstrvl.cxx:131
IDocumentContentOperations const & getIDocumentContentOperations() const
Definition: doc.cxx:315
bool HasWriterListeners() const
Definition: calbck.hxx:197
void CalcStartEnd(sal_uLong nNdIdx, sal_Int32 &rStart, sal_Int32 &rEnd) const
Calculates the intersection with text node number nNdIdx.
Definition: docredln.cxx:1303
The root element of a Writer document layout.
Definition: rootfrm.hxx:82
const SwFrameFormats * GetSpzFrameFormats() const
Definition: doc.hxx:743
int GetAttrOutlineLevel() const
Returns outline level of this text node.
Definition: ndtxt.cxx:4022
bool HasSelection() const
Does the current cursor create a selection?
Definition: crsrsh.cxx:2515
bool MakeOutlineSel(SwOutlineNodes::size_type nSttPos, SwOutlineNodes::size_type nEndPos, bool bWithChildren, bool bKillPams=true)
Definition: crstrvl.cxx:1166
void GatherFields(std::vector< SwFormatField * > &rvFormatFields, bool bCollectOnlyInDocNodes=true) const
Definition: fldbas.cxx:205
Array of Undo-history.
Definition: docary.hxx:197
SwContentNode * GetContentNode(bool bPoint=true) const
Definition: pam.hxx:229
virtual bool GetModelPositionForViewPoint(SwPosition *, Point &, SwCursorMoveState *=nullptr, bool bTestBackground=false) const
Definition: unusedf.cxx:47
constexpr tools::Long Width() const
sal_uInt32 GetItemCount2(sal_uInt16 nWhich) const
virtual bool GetModelPositionForViewPoint(SwPosition *, Point &, SwCursorMoveState *=nullptr, bool bTestBackground=false) const override
Primary passes the call to the first page.
Definition: trvlfrm.cxx:425
const OUString & GetValue() const
Definition: fmtinfmt.hxx:75
const SfxPoolItem * NextItem()
void SetTextLeft(const tools::Long nL, const sal_uInt16 nProp=100)
SwWrongList * SubList(sal_uInt16 nIdx) const
Definition: wrong.hxx:342
constexpr TypedWhichId< SwDrawFrameFormat > RES_DRAWFRMFMT(159)
static SwTextNode * FindAnchor(SwDoc *pDoc, const OUString &rRefMark, sal_uInt16 nSubType, sal_uInt16 nSeqNo, sal_Int32 *pStt, sal_Int32 *pEnd=nullptr, SwRootFrame const *pLayout=nullptr)
Definition: reffld.cxx:1142
const SwTOXMark & GetTOXMark() const
Definition: txatbase.hxx:216
rtl::Reference< SwDoc > mxDoc
The document; never 0.
Definition: viewsh.hxx:171
SwIndex nContent
Definition: pam.hxx:38
const SwRect & getFrameArea() const
Definition: frame.hxx:178
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
void NormalizePam(bool bPointFirst=true)
Ensure point and mark of the current PaM are in a specific order.
Definition: crsrsh.cxx:969
const SwTextField * GetTextField() const
Definition: fmtfld.hxx:128
SwSectionNode * GetSectionNode()
Definition: section.cxx:957
bool SetTextFormatColl(const SwPaM &rRg, SwTextFormatColl *pFormat, const bool bReset=true, const bool bResetListAttrs=false, SwRootFrame const *pLayout=nullptr)
Add 4th optional parameter .
Definition: docfmt.cxx:1072
A wrapper around SfxPoolItem to store the start position of (usually) a text portion, with an optional end.
Definition: txatbase.hxx:41
virtual ::sw::mark::IFieldmark * getFieldmarkFor(const SwPosition &pos) const =0
SwTOXSearch
Definition: toxe.hxx:22
by left paragraph indentation
int m_nInNumPortionOffset
distance from number portion's start
Definition: crstate.hxx:164
SwField * GetCurField(const bool bIncludeInputFieldAtStart=false) const
Definition: crstrvl.cxx:907
Footer, for pageformats Client of FrameFormat describing the footer.
Definition: fmthdft.hxx:64
constexpr sal_uInt16 POOLATTR_BEGIN(HINT_BEGIN)
bool GotoPrevTOXBase(const OUString *=nullptr)
jump to previous index
Definition: crstrvl.cxx:318
sal_uLong GetIndex() const
Definition: ndindex.hxx:152
sal_Int32 GetStart() const
Definition: txatbase.hxx:86
IsAttrAtPos eContentAtPos
Definition: crsrsh.hxx:101
Pos2 completely contained in Pos1.
only for debugging
OUString sStr
Definition: crsrsh.hxx:103
const SwTable & GetTable() const
Definition: node.hxx:501
SwFillMode
Definition: crstate.hxx:28
union SwContentAtPos::@24 aFnd
SwDoc * GetDoc() const
Definition: viewsh.hxx:281
const SwFormatField & GetFormatField() const
Definition: txatbase.hxx:195
static void lcl_MakeFieldLst(SetGetExpFields &rLst, const SwFieldType &rFieldType, const bool bInReadOnly, const bool bChkInpFlag=false)
jump to next/previous field type
Definition: crstrvl.cxx:628
bool SelectNxtPrvHyperlink(bool bNext)
Definition: crstrvl.cxx:2440
const IDocumentRedlineAccess & getIDocumentRedlineAccess() const
Provides access to the document redline interface.
Definition: viewsh.cxx:2669
size_type size() const
constexpr TypedWhichId< SwFormatFootnote > RES_TXTATR_FTN(58)
void SetBodyPos(const SwContentFrame &rFrame)
Definition: docfld.cxx:176
SwPaM * GetNext()
Definition: pam.hxx:264
SW_DLLPUBLIC void PtrToBoxNm(const SwTable *pTable)
create from the internal formula (for CORE) the external formula (for UI)
Definition: cellfml.cxx:571
virtual bool GetCharRect(SwRect &, const SwPosition &, SwCursorMoveState *=nullptr, bool bAllowFarAway=true) const
Definition: unusedf.cxx:72
constexpr TypedWhichId< SwFormatINetFormat > RES_TXTATR_INETFMT(51)
Specific frame formats (frames, DrawObjects).
const sw::mark::IFieldmark * pFieldmark
Definition: crsrsh.hxx:99
SwNode & GetEndOfContent() const
Regular ContentSection (i.e. the BodyText).
Definition: ndarr.hxx:163
bool HasClickHdl() const
Does the field possess an action on its ClickHandler? (e.g. INetFields, ...).
Definition: fldbas.cxx:391
SwShellCursor * GetCursor_()
Definition: crsrsh.hxx:328
bool SelectText(const sal_Int32 nStart, const sal_Int32 nEnd)
Definition: crstrvl.cxx:1952
const OUString & GetAlternativeText() const
Definition: tox.hxx:578
bool IsContentNode() const
Definition: node.hxx:632
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:136
bool Move(SwMoveFnCollection const &fnMove=fnMoveForward, SwGoInDoc fnGo=GoInContent)
Movement of cursor.
Definition: pam.cxx:504
const SfxItemPool & GetAttrPool() const
Definition: viewsh.hxx:612
virtual bool InsertString(const SwPaM &rRg, const OUString &, const SwInsertFlags nInsertMode=SwInsertFlags::EMPTYEXPAND)=0
Insert string into existing text node at position rRg.Point().
sal_uInt16 char * pName
static SwNodePtr GetStartNode(SwOutlineNodes const *pOutlNds, int nOutlineLevel, SwOutlineNodes::size_type *nOutl)
Definition: docglbl.cxx:89
const SwTableNode * IsCursorInTable() const
Definition: crsrsh.hxx:889
bool SetShadowCursorPos(const Point &rPt, SwFillMode eFillMode)
Definition: crstrvl.cxx:2059
OUString GetExpandTextMerged(SwRootFrame const *const pLayout, SwTextNode const &rNode, bool const bWithNumber, bool const bWithSpacesForLevel, ExpandMode const i_mode)
bool GetShadowCursorPos(const Point &rPt, SwFillMode eFillMode, SwRect &rRect, sal_Int16 &rOrient)
Definition: crstrvl.cxx:2031
A helper class to save cursor state (position).
Definition: swcrsr.hxx:232
virtual SwUndoId StartUndo(SwUndoId const eUndoId, SwRewriter const *const pRewriter)=0
Opens undo block.
bool IsContentFrame() const
Definition: frame.hxx:1211
static constexpr auto npos
Definition: ndarr.hxx:79
SwPaM * CreateCursor()
delete the current cursor and make the following into the current
Definition: crsrsh.cxx:123
int i
bool GoInNode(SwPaM &rPam, SwMoveFnCollection const &fnMove)
Definition: pam.cxx:961
const SwField * pField
Definition: crsrsh.hxx:95
const SwFrame * GetLastLower() const
Definition: findfrm.cxx:1829
T & StaticWhichCast(TypedWhichId< T > nId)
const SwStartNode * StartOfSectionNode() const
Definition: node.hxx:132
SwDoc & GetDoc()
Definition: node.hxx:212
const SwFrameFormat * GetFooterFormat() const
Definition: fmthdft.hxx:85
const SwPosition * GetPoint() const
Definition: pam.hxx:207
bool SetCursorInHdFt(size_t nDescNo, bool bInHeader)
Definition: crstrvl.cxx:195
std::vector< SwSectionFormat * >::size_type size_type
Definition: docary.hxx:63
SwIndex & Assign(SwIndexReg *, sal_Int32)
Definition: index.cxx:206
const SwPageDesc & GetPageDesc(const size_t i) const
Definition: doc.hxx:882
SwPageFrame * FindPageFrame()
Definition: frame.hxx:663
const SwRangeRedline * SelPrevRedline()
Definition: crstrvl.cxx:2230
bool ActionPend() const
Definition: viewsh.hxx:196
TElementType * First()
Definition: calbck.hxx:325
SwPageDesc * GetPageDesc()
Definition: pagefrm.hxx:127
SwContentNode * GetContentNode()
Definition: node.hxx:619
vector_type::size_type size_type
Definition: docary.hxx:228
SwFieldIds
Definition: fldbas.hxx:44
bool GotoINetAttr(const SwTextINetFormat &rAttr)
Definition: crstrvl.cxx:2005
bool HasMark() const
A PaM marks a selection if Point and Mark are distinct positions.
Definition: pam.hxx:205
const SwFormatURL & GetURL(bool=true) const
Definition: fmturl.hxx:78
SwLayoutFrame * GetUpper()
Definition: frame.hxx:661
Marks a character position inside a document model node.
Definition: index.hxx:33
size_t size() const
Definition: docary.hxx:84
const SwFormatFooter & GetFooter(bool=true) const
Definition: fmthdft.hxx:99
bool GotoNextTOXBase(const OUString *=nullptr)
jump to the next index
Definition: crstrvl.cxx:267
bool IsPageAtPos(const Point &rPt) const
Definition: crstrvl.cxx:1248
SwWrtShell * GetWrtShell()
Access to the SwWrtShell belonging to SwView.
Definition: docsh.hxx:224
const SwFlyFrameFormat * GetFlyFormat() const
Definition: docfld.hxx:89
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
Definition: format.cxx:388
bool GotoPrevOutline()
jump to previous node with outline num.
Definition: crstrvl.cxx:1072
Marks a node in the document model.
Definition: ndindex.hxx:31
SwFrameFormat * GetFrameFormat()
Definition: swtable.hxx:431
bool IsEndNode() const
Definition: node.hxx:636
const SwOutlineNodes & GetOutLineNds() const
Array of all OutlineNodes.
Definition: ndarr.hxx:231
SwNodes & GetNodes()
Node is in which nodes-array/doc?
Definition: node.hxx:697
T static_txtattr_cast(S *s)
Definition: txatbase.hxx:241
SwContentNode * pNode
Definition: crsrsh.hxx:98
ring_container GetRingContainer()
const_iterator end() const
SwTextField * GetFieldTextAttrAt(const sal_Int32 nIndex, const bool bIncludeInputFieldAtStart=false) const
Definition: ndtxt.cxx:1775
bool SelectTextAttr(sal_uInt16 nWhich, bool bExpand, const SwTextAttr *pAttr=nullptr)
Definition: crstrvl.cxx:1976
SwOutlineNodes::size_type GetOutlinePos(sal_uInt8 nLevel=UCHAR_MAX, SwPaM *pPaM=nullptr)
search "outline position" before previous outline node at given level
Definition: crstrvl.cxx:1137
tuple index
bool empty() const
void SetAdjust(const SvxAdjust eType)
bool IsInProtectSect() const
is the node in a protected section?
Definition: crstrvl.cxx:1884
const SwTextNode * GetpTextNode() const
Definition: txtinet.hxx:45
SwStartNode * GetStartNode()
Definition: node.hxx:595
void GotoTOXMarkBase()
jump to index of TOXMark
Definition: crstrvl.cxx:370
const SwTextAttr * pFndTextAttr
Definition: crsrsh.hxx:104
A page of the document layout.
Definition: pagefrm.hxx:41
const SwTOXMark & GotoTOXMark(const SwTOXMark &rCurTOXMark, SwTOXSearch eDir, bool bInReadOnly)
Definition: doctxm.cxx:228
bool StartOfSection(bool bSelect=false)
Definition: move.cxx:308
static void SetSearchLabel(const SearchLabel &rSL)
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
Definition: doc.cxx:405
SAL_DLLPRIVATE const SwRangeRedline * GotoRedline_(SwRedlineTable::size_type nArrPos, bool bSelect)
Definition: crstrvl.cxx:2258
static sal_Int32 EndOfInputFieldAtPos(const SwPosition &rPos)
Definition: crstrvl.cxx:962
const SwPosition * Start() const
Definition: pam.hxx:212
constexpr sal_uInt16 POOLATTR_END(RES_UNKNOWNATR_END)
Point Center() const
Definition: swrect.cxx:35
tools::Long GetUpDownX() const
Definition: crsrsh.hxx:347
SwTextNode * GetParaPropsNode(SwRootFrame const &rLayout, SwNodeIndex const &rNode)
Definition: txtfrm.cxx:324
SwFieldType * GetTyp() const
Definition: fldbas.hxx:392
bool IsInProtectSect() const
Is node in a protected area?
Definition: node.cxx:416
const SwNodeIndex * GetContentIdx() const
Definition: fmtcntnt.hxx:46
const_iterator begin() const
virtual const SwRangeRedline * GetRedline(const SwPosition &rPos, SwRedlineTable::size_type *pFndPos) const =0
Point LogicToPixel(const Point &rLogicPt) const
void StartAction()
Definition: crsrsh.cxx:226
DEFAULT: (Start <= nIndex < End)
Definition: ndtxt.hxx:362
SwPaM * GetPrev()
Definition: pam.hxx:268
const ImageMap * GetMap() const
Definition: fmturl.hxx:68
bool m_bFootnoteNoInfo
recognized footnote numbering
Definition: crstate.hxx:144
sal_uInt16 Which() const
for Querying of Writer-functions.
Definition: format.hxx:82
bool DocPtInsideInputField(const Point &rDocPt) const
Definition: crstrvl.cxx:943
const SwTextNode & GetTextNode() const
Definition: txttxmrk.hxx:49
bool m_bInNumPortion
point is in number portion #i23726#
Definition: crstate.hxx:163
size_type FindNextOfSeqNo(size_type nSttPos) const
Definition: docredln.cxx:653
IDocumentUndoRedo const & GetIDocumentUndoRedo() const
Provides access to the document undo/redo interface.
Definition: viewsh.cxx:2679
SwFrameFormat & GetMaster()
Definition: pagedesc.hxx:239
sal_uLong EndOfSectionIndex() const
Definition: node.hxx:681
void Bottom(const tools::Long nBottom)
Definition: swrect.hxx:209
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:79
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
Definition: doc.cxx:335
bool IsReadOnlyAvailable() const
Definition: crsrsh.hxx:474
const SwStartNode * GetSttNd() const
Definition: swtable.hxx:445
SwFieldIds Which() const
ResId.
Definition: fldbas.cxx:243
default, fill with tabs
OUString GetExpandText(SwRootFrame const *pLayout, const sal_Int32 nIdx=0, const sal_Int32 nLen=-1, const bool bWithNum=false, const bool bAddSpaceAfterListLabelStr=false, const bool bWithSpacesForLevel=false, const ExpandMode eAdditionalMode=ExpandMode::ExpandFootnote) const
add 4th optional parameter indicating, when that a spa...
Definition: ndtxt.cxx:3374
const SwCharFormats * GetCharFormats() const
Definition: doc.hxx:739
general base class for all free-flowing frames
Definition: flyfrm.hxx:60
bool IsFieldDeletedInModel(IDocumentRedlineAccess const &rIDRA, SwTextField const &rTextField)
SwContentFrame * GetCurrFrame(const bool bCalcFrame=true) const
Get current frame in which the cursor is positioned.
Definition: crsrsh.cxx:2444
Pos1 overlaps Pos2 at the end.
unsigned char sal_uInt8
fill with spaces and tabs
static sal_uInt16 GetCurTOXMark(const SwPosition &rPos, SwTOXMarks &)
Get current table of contents Mark.
Definition: doctxm.cxx:116
vcl::Window * GetWin() const
Definition: viewsh.hxx:337
static sal_Int32 StartOfInputFieldAtPos(const SwPosition &rPos)
Definition: crstrvl.cxx:954
virtual bool InsertPoolItem(const SwPaM &rRg, const SfxPoolItem &, const SetAttrMode nFlags=SetAttrMode::DEFAULT, SwRootFrame const *pLayout=nullptr, bool bExpandCharToPara=false, SwTextAttr **ppNewTextAttr=nullptr)=0
Insert an attribute.
SwMoveFnCollection const & fnMoveForward
SwPam::Move()/Find() default argument.
Definition: paminit.cxx:59
sal_uInt16 GetWrongPos(sal_Int32 nValue) const
Find the first position that is greater or equal to the given value.
Definition: wrong.cxx:190
sal_Int32 GetIndex() const
Definition: index.hxx:91
bool InWrongWord(sal_Int32 &rChk, sal_Int32 &rLn) const
If a word is incorrectly selected, this method returns begin and length of it.
Definition: wrong.cxx:102
bool IsInside(const Point &rPOINT) const
Definition: swrect.cxx:105
OString strip(const OString &rIn, char c)
SwNodes & GetNodes()
Definition: doc.hxx:408
SAL_DLLPRIVATE void MoveCursorToNum()
Definition: crstrvl.cxx:80
constexpr TypedWhichId< SwTableBoxFormula > RES_BOXATR_FORMULA(151)
const SwTextINetFormat * GetINetFormat() const
Definition: docfld.hxx:87
static bool PosInsideInputField(const SwPosition &rPos)
Definition: crstrvl.cxx:938
const SwPosition * End() const
Definition: pam.hxx:217
bool IsRightToLeft() const
Definition: frame.hxx:968
void Top(const tools::Long nTop)
Definition: swrect.hxx:204
RedlineType GetType(sal_uInt16 nPos=0) const
Definition: docredln.cxx:1810
const sal_Int32 * End() const
Definition: txatbase.hxx:152
SwTableBox is one table cell in the document model.
Definition: swtable.hxx:392
const SwFormatINetFormat * FindINetAttr(std::u16string_view rName) const
Definition: crstrvl.cxx:2026
SwFrame * GetLower()
Definition: findfrm.cxx:170
static bool GotoNextNum(SwPosition &, SwRootFrame const *pLayout, bool bOverUpper=true, sal_uInt8 *pUpper=nullptr, sal_uInt8 *pLower=nullptr)
Definition: docnum.cxx:1618
const Point & GetPtPos() const
Definition: viscrs.hxx:141
SwSpecialPos * m_pSpecialPos
for positions inside fields
Definition: crstate.hxx:136
virtual const SwRangeRedline * SelNextRedline(SwPaM &rPam) const =0
constexpr TypedWhichId< SwTOXMark > RES_TXTATR_TOXMARK(47)
constexpr TypedWhichId< SvxLRSpaceItem > RES_LR_SPACE(91)
scroll window
Definition: crsrsh.hxx:153
bool IsParaPropsNode(SwRootFrame const &rLayout, SwTextNode const &rNode)
Definition: txtfrm.cxx:307
Header, for PageFormats Client of FrameFormat describing the header.
Definition: fmthdft.hxx:33
void ClearMark()
Definition: crsrsh.cxx:938
static bool GotoPrevNum(SwPosition &, SwRootFrame const *pLayout, bool bOverUpper=true)
Definition: docnum.cxx:1704
constexpr TypedWhichId< SwFormatField > RES_TXTATR_INPUTFIELD(55)
virtual bool AppendTextNode(SwPosition &rPos)=0
const SwStartNode * FindTableBoxStartNode() const
Definition: node.hxx:197
const SwRangeRedline * pRedl
Definition: crsrsh.hxx:97
const SwTOXMark & GotoTOXMark(const SwTOXMark &rStart, SwTOXSearch eDir)
traveling between marks
Definition: crstrvl.cxx:605
const SwFormatContent & GetContent(bool=true) const
Definition: fmtcntnt.hxx:55
SwMoveFnCollection const & fnMoveBackward
Definition: paminit.cxx:58
SwTableNode * FindTableNode()
Search table node, in which it is.
Definition: node.cxx:357
static SetGetExpFields::const_iterator lcl_FindField(bool &o_rFound, SetGetExpFields const &rSrtLst, SwRootFrame const *const pLayout, SwTextNode *const pTextNode, SwTextField const *const pTextField, SwPosition const &rPos, sal_Int32 const nContentOffset)
Definition: crstrvl.cxx:663
bool m_bPosCorr
Point had to be corrected.
Definition: crstate.hxx:143
SwContentFrame * FindContentFrame(const SwDoc &rDoc, const SwRootFrame &rLayout, const bool isReadOnlyAvailable) const
Definition: tox.hxx:188
const SfxPoolItem & GetAttr() const
Definition: txatbase.hxx:163
bool IsVertical() const
Definition: frame.hxx:954
bool DontExpand() const
Definition: txatbase.hxx:96
void GotoPrevNum()
Definition: crstrvl.cxx:123
SwNodeIndex * GetStartNode() const
Definition: txtftn.hxx:41
SwContentNode * GoNextSection(SwNodeIndex *, bool bSkipHidden=true, bool bSkipProtect=true) const
Go to next content-node that is not protected or hidden (Both set FALSE ==> GoNext/GoPrevious!!!).
Definition: nodes.cxx:1916
bool GotoNxtPrvTOXMark(bool bNext=true)
jump to next/previous index marker
Definition: crstrvl.cxx:508
bool IsDocNodes() const
Is the NodesArray the regular one of Doc? (and not the UndoNds, ...) Implementation in doc...
Definition: nodes.cxx:2329
bool EndOfSection(bool bSelect=false)
Definition: move.cxx:314
size_t size() const
void GetPosOfContent(SwPosition &rPos) const
Definition: docfld.cxx:158
make visible in spite of Readonly
Definition: crsrsh.hxx:155
const SwTextTOXMark * GetTextTOXMark() const
Definition: tox.hxx:162
SwFrameFormatsBase::size_type size_type
bool GetContentAtPos(const Point &rPt, SwContentAtPos &rContentAtPos, bool bSetCursor=false, SwRect *pFieldRect=nullptr)
Definition: crstrvl.cxx:1255
virtual void SetMark()
Unless this is called, the getter method of Mark will return Point.
Definition: pam.cxx:478
constexpr TypedWhichId< SwFormatRefMark > RES_TXTATR_REFMARK(RES_TXTATR_WITHEND_BEGIN)
SectionType GetType() const
Definition: section.hxx:170
bool Seek_Entry(SwNode *rP, size_type *pnPos) const
Definition: ndnum.cxx:32
virtual const SwRedlineTable & GetRedlineTable() const =0
SwRect m_aCharRect
Char-SRectangle on which the cursor is located.
Definition: crsrsh.hxx:164
SwTextNode & GetTextNode() const
Definition: txtfld.hxx:53
std::pair< const_iterator, bool > insert(Value &&x)
const SfxPoolItem & GetAttr(sal_uInt16 nWhich, bool bInParent=true) const
SS for PoolItems: hard attributation.
Definition: node.hxx:725
bool IsInvalidItem(const SfxPoolItem *pItem)
std::vector< SwNode * >::size_type size_type
SwNode & GetEndOfExtras() const
This is the last EndNode of a special section.
Definition: ndarr.hxx:161
SwRootFrame * GetLayout() const
Definition: viewsh.cxx:2067
const SwPostItField * GetPostItFieldAtCursor() const
Definition: crstrvl.cxx:1861
SwSectionFormats & GetSections()
Definition: doc.hxx:1339
o3tl::strong_int< sal_Int32, struct Tag_TextFrameIndex > TextFrameIndex
Denotes a character index in a text frame at a layout level, after extent mapping from a text node at...
static SwTextField * GetTextFieldAtCursor(const SwPaM *pCursor, const bool bIncludeInputFieldAtStart)
Definition: crstrvl.cxx:874
bool IsTextNode() const
Definition: node.hxx:640
bool GotoOutline(const OUString &rName)
Definition: crstrvl.cxx:987
static constexpr size_type npos
Definition: docary.hxx:229
void GotoNextNum()
go to next/previous point on the same level
Definition: crstrvl.cxx:116
SwFieldIds Which() const
Definition: fldbas.hxx:272
aStr
SwContentNode * GoNext(SwNodeIndex *) const
Definition: nodes.cxx:1293
bool GotoFormatField(const SwFormatField &rField)
Definition: crstrvl.cxx:833
SdrObject * FindSdrObject()
Definition: frmfmt.hxx:138
bool IsFooterFrame() const
Definition: frame.hxx:1175
const sal_Int32 COMPLETE_STRING
Definition: swtypes.hxx:61
sal_uInt16 Which() const
constexpr TypedWhichId< SvxAdjustItem > RES_PARATR_ADJUST(64)
Pos1 overlaps Pos2 at the beginning.
Point Center() const
only for debugging
const SwFrameFormat * GetHeaderFormat() const
Definition: fmthdft.hxx:54
sal_uInt16 nPos
bool GotoRefMark(const OUString &rRefMark, sal_uInt16 nSubType, sal_uInt16 nSeqNo)
jump to reference marker
Definition: crstrvl.cxx:1224
fill with spaces
std::vector< std::unique_ptr< SetGetExpField > >::const_iterator const_iterator
const SfxPoolItem * GetCurItem() const
SwTextFormatColl & GetNextTextFormatColl() const
Definition: fmtcol.hxx:102
const SwAttrPool & GetAttrPool() const
Definition: doc.hxx:1320
bool GotoFooterText()
jump from the content to the footer
Definition: crstrvl.cxx:159
void RestoreSavePos()
Restore cursor state to the one saved by SwCursorSaveState.
Definition: swcrsr.cxx:2337
const SwFormatINetFormat & GetINetFormat() const
Definition: txatbase.hxx:228
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:845
bool GotoNextOutline()
jump to next node with outline num.
Definition: crstrvl.cxx:1006
bool IsHeaderFrame() const
Definition: frame.hxx:1171
SwFlyFrame * GetFrame(const Point *pDocPos=nullptr) const
Definition: atrfrm.cxx:3065
void EndAction(const bool bIdleEnd=false)
Definition: crsrsh.cxx:243
bool IsProtected() const
Is the Frame or rather the Section in which it lies protected?
Definition: trvlfrm.cxx:1628
const OUString & GetURL() const
Definition: fmturl.hxx:66
static SwTextField * GetTextFieldAtPos(const SwPosition *pPos, const bool bIncludeInputFieldAtStart)
Definition: crstrvl.cxx:859
Base class of the Writer document model elements.
Definition: node.hxx:80
SwTextFormatColl * GetTextColl() const
Definition: ndtxt.hxx:839
OStringBuffer & padToLength(OStringBuffer &rBuffer, sal_Int32 nLength, char cFill= '\0')
bool CursorInsideInputField() const
Definition: crstrvl.cxx:928
typedef void(CALLTYPE *GetFuncDataPtr)(sal_uInt16 &nNo