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());
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  const bool bAllFieldTypes = nResType == SwFieldIds::Unknown;
733  for( size_t i=0; i < nSize; ++i )
734  {
735  pFieldType = rFieldTypes[ i ].get();
736  if (bAllFieldTypes || nResType == pFieldType->Which())
737  {
738  ::lcl_MakeFieldLst( aSrtLst, *pFieldType, IsReadOnlyAvailable() );
739  }
740  }
741  }
742 
743  // found no fields?
744  if( aSrtLst.empty() )
745  return false;
746 
748  SwCursor* pCursor = getShellCursor( true );
749  {
750  // (1998): Always use field for search so that the right one is found as
751  // well some are in frames that are anchored to a paragraph that has a
752  // field
753  const SwPosition& rPos = *pCursor->GetPoint();
754 
755  SwTextNode* pTNd = rPos.nNode.GetNode().GetTextNode();
756  OSL_ENSURE( pTNd, "No ContentNode" );
757 
758  SwTextField * pTextField = pTNd->GetFieldTextAttrAt( rPos.nContent.GetIndex(), true );
759  const bool bDelField = ( pTextField == nullptr );
760  sal_Int32 nContentOffset = -1;
761 
762  if( bDelField )
763  {
764  // create dummy for the search
765  SwFormatField* pFormatField = new SwFormatField( SwDateTimeField(
766  static_cast<SwDateTimeFieldType*>(mxDoc->getIDocumentFieldsAccess().GetSysFieldType( SwFieldIds::DateTime ) ) ) );
767 
768  pTextField = new SwTextField( *pFormatField, rPos.nContent.GetIndex(),
769  mxDoc->IsClipBoard() );
770  pTextField->ChgTextNode( pTNd );
771  }
772  else
773  {
774  // the cursor might be anywhere inside the input field,
775  // but we will be searching for the field start
776  if (pTextField->Which() == RES_TXTATR_INPUTFIELD
777  && rPos.nContent.GetIndex() != pTextField->GetStart())
778  nContentOffset = pTextField->GetStart();
779  }
780  bool isSrch;
781  it = lcl_FindField(isSrch, aSrtLst,
782  GetLayout(), pTNd, pTextField, rPos, nContentOffset);
783 
784  if( bDelField )
785  {
786  auto const pFormat(static_cast<SwFormatField*>(&pTextField->GetAttr()));
787  delete pTextField;
788  delete pFormat;
789  }
790 
791  if( it != aSrtLst.end() && isSrch ) // found
792  {
793  if( bNext )
794  {
795  if( ++it == aSrtLst.end() )
796  return false; // already at the end
797  }
798  else
799  {
800  if( it == aSrtLst.begin() )
801  return false; // no more steps backward possible
802  --it;
803  }
804  }
805  else // not found
806  {
807  if( bNext )
808  {
809  if( it == aSrtLst.end() )
810  return false;
811  }
812  else
813  {
814  if( it == aSrtLst.begin() )
815  return false; // no more steps backward possible
816  --it;
817  }
818  }
819  }
820  const SetGetExpField& rFnd = **it;
821 
822  CurrShell aCurr( this );
823  SwCallLink aLk( *this ); // watch Cursor-Moves
824  SwCursorSaveState aSaveState( *pCursor );
825 
826  rFnd.GetPosOfContent( *pCursor->GetPoint() );
829  if( bRet )
831  return bRet;
832 }
833 
835 {
836  bool bRet = false;
837  SwCursor* pCursor = getShellCursor(true);
838 
839  CurrShell aCurr(this);
840  SwCallLink aLk(*this); // watch Cursor-Moves
841  SwCursorSaveState aSaveState(*pCursor);
842 
843  pCursor->GetPoint()->nNode = rTextFootnote.GetTextNode();
844  pCursor->GetPoint()->nContent.Assign(const_cast<SwTextNode*>(&rTextFootnote.GetTextNode()),
845  rTextFootnote.GetStart());
846  bRet = !pCursor->IsSelOvr();
847  if (bRet)
849  return bRet;
850 }
851 
853 {
854  bool bRet = false;
855  SwTextField const*const pTextField(rField.GetTextField());
856  if (pTextField
857  && (!GetLayout()->IsHideRedlines()
859  GetDoc()->getIDocumentRedlineAccess(), *pTextField)))
860  {
861  CurrShell aCurr( this );
862  SwCallLink aLk( *this ); // watch Cursor-Moves
863 
864  SwCursor* pCursor = getShellCursor( true );
865  SwCursorSaveState aSaveState( *pCursor );
866 
867  SwTextNode* pTNd = pTextField->GetpTextNode();
868  pCursor->GetPoint()->nNode = *pTNd;
869  pCursor->GetPoint()->nContent.Assign( pTNd, pTextField->GetStart() );
870 
871  bRet = !pCursor->IsSelOvr();
872  if( bRet )
874  }
875  return bRet;
876 }
877 
879  const SwPosition* pPos,
880  const bool bIncludeInputFieldAtStart )
881 {
882  SwTextField* pTextField = nullptr;
883 
884  SwTextNode * const pNode = pPos->nNode.GetNode().GetTextNode();
885  if ( pNode != nullptr )
886  {
887  pTextField = pNode->GetFieldTextAttrAt( pPos->nContent.GetIndex(), bIncludeInputFieldAtStart );
888  }
889 
890  return pTextField;
891 }
892 
894  const SwPaM* pCursor,
895  const bool bIncludeInputFieldAtStart )
896 {
897  SwTextField* pFieldAtCursor = nullptr;
898 
899  SwTextField* pTextField = GetTextFieldAtPos( pCursor->Start(), bIncludeInputFieldAtStart );
900  if ( pTextField != nullptr
901  && pCursor->Start()->nNode == pCursor->End()->nNode )
902  {
903  const sal_Int32 nTextFieldLength =
904  pTextField->End() != nullptr
905  ? *(pTextField->End()) - pTextField->GetStart()
906  : 1;
907  if ( ( pCursor->End()->nContent.GetIndex() - pCursor->Start()->nContent.GetIndex() ) <= nTextFieldLength )
908  {
909  pFieldAtCursor = pTextField;
910  }
911  }
912 
913  return pFieldAtCursor;
914 }
915 
917  const SwPaM *const pCursor,
918  const bool bIncludeInputFieldAtStart)
919 {
920  SwTextField *const pField(GetTextFieldAtCursor(pCursor, bIncludeInputFieldAtStart));
921  return pField
922  ? const_cast<SwField*>(pField->GetFormatField().GetField())
923  : nullptr;
924 }
925 
926 SwField* SwCursorShell::GetCurField( const bool bIncludeInputFieldAtStart ) const
927 {
928  SwPaM* pCursor = GetCursor();
929  if ( pCursor->IsMultiSelection() )
930  {
931  // multi selection not handled.
932  return nullptr;
933  }
934 
935  SwField* pCurField = GetFieldAtCursor( pCursor, bIncludeInputFieldAtStart );
936  if ( pCurField != nullptr
937  && SwFieldIds::Table == pCurField->GetTyp()->Which() )
938  {
939  // table formula? convert internal name into external
940  const SwTableNode* pTableNd = IsCursorInTable();
941  static_cast<SwTableField*>(pCurField)->PtrToBoxNm( pTableNd ? &pTableNd->GetTable() : nullptr );
942  }
943 
944  return pCurField;
945 }
946 
948 {
949  for(SwPaM& rCursor : GetCursor()->GetRingContainer())
950  {
951  if (dynamic_cast<const SwTextInputField*>(GetTextFieldAtCursor(&rCursor, true)))
952  return true;
953  }
954  return false;
955 }
956 
958 {
959  return dynamic_cast<const SwTextInputField*>(GetTextFieldAtPos( &rPos, false )) != nullptr;
960 }
961 
962 bool SwCursorShell::DocPtInsideInputField( const Point& rDocPt ) const
963 {
964  SwPosition aPos( *(GetCursor()->Start()) );
965  Point aDocPt( rDocPt );
966  if ( GetLayout()->GetModelPositionForViewPoint( &aPos, aDocPt ) )
967  {
968  return PosInsideInputField( aPos );
969  }
970  return false;
971 }
972 
974 {
975  const SwTextInputField* pTextInputField = dynamic_cast<const SwTextInputField*>(GetTextFieldAtPos( &rPos, true ));
976  assert(pTextInputField != nullptr
977  && "<SwEditShell::StartOfInputFieldAtPos(..)> - no Input Field at given position");
978  return pTextInputField->GetStart();
979 }
980 
982 {
983  const SwTextInputField* pTextInputField = dynamic_cast<const SwTextInputField*>(GetTextFieldAtPos( &rPos, true ));
984  assert(pTextInputField != nullptr
985  && "<SwEditShell::EndOfInputFieldAtPos(..)> - no Input Field at given position");
986  return *(pTextInputField->End());
987 }
988 
990 {
991  SwCursor* pCursor = getShellCursor( true );
992 
993  CurrShell aCurr( this );
994  SwCallLink aLk( *this ); // watch Cursor-Moves
995  SwCursorSaveState aSaveState( *pCursor );
996 
997  const SwNodes& rNds = GetDoc()->GetNodes();
998  SwTextNode* pTextNd = rNds.GetOutLineNds()[ nIdx ]->GetTextNode();
999  pCursor->GetPoint()->nNode = *pTextNd;
1000  pCursor->GetPoint()->nContent.Assign( pTextNd, 0 );
1001 
1002  if( !pCursor->IsSelOvr() )
1004 }
1005 
1006 bool SwCursorShell::GotoOutline( const OUString& rName )
1007 {
1008  SwCursor* pCursor = getShellCursor( true );
1009 
1010  CurrShell aCurr( this );
1011  SwCallLink aLk( *this ); // watch Cursor-Moves
1012  SwCursorSaveState aSaveState( *pCursor );
1013 
1014  bool bRet = false;
1015  if (mxDoc->GotoOutline(*pCursor->GetPoint(), rName, GetLayout())
1016  && !pCursor->IsSelOvr())
1017  {
1019  bRet = true;
1020  }
1021  return bRet;
1022 }
1023 
1026 {
1027  const SwNodes& rNds = GetDoc()->GetNodes();
1028 
1029  if ( rNds.GetOutLineNds().empty() )
1030  {
1031  SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::NavElementNotFound );
1032  return false;
1033  }
1034 
1035  SwCursor* pCursor = getShellCursor( true );
1036  SwNode* pNd = &(pCursor->GetNode());
1038  bool bUseFirst = !rNds.GetOutLineNds().Seek_Entry( pNd, &nPos );
1039  SwOutlineNodes::size_type const nStartPos(nPos);
1040 
1041  do
1042  {
1043  if (!bUseFirst)
1044  {
1045  ++nPos;
1046  }
1047  if (rNds.GetOutLineNds().size() <= nPos)
1048  {
1049  nPos = 0;
1050  }
1051 
1052  if (bUseFirst)
1053  {
1054  bUseFirst = false;
1055  }
1056  else
1057  {
1058  if (nPos == nStartPos)
1059  {
1060  SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::NavElementNotFound );
1061  return false;
1062  }
1063  }
1064 
1065  pNd = rNds.GetOutLineNds()[ nPos ];
1066  }
1067  while (!sw::IsParaPropsNode(*GetLayout(), *pNd->GetTextNode()));
1068 
1069  if (nPos < nStartPos)
1070  {
1071  SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::EndWrapped );
1072  }
1073  else
1074  {
1075  SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::Empty );
1076  }
1077 
1078  CurrShell aCurr( this );
1079  SwCallLink aLk( *this ); // watch Cursor-Moves
1080  SwCursorSaveState aSaveState( *pCursor );
1081  pCursor->GetPoint()->nNode = *pNd;
1082  pCursor->GetPoint()->nContent.Assign( pNd->GetTextNode(), 0 );
1083 
1084  bool bRet = !pCursor->IsSelOvr();
1085  if( bRet )
1087  return bRet;
1088 }
1089 
1092 {
1093  const SwNodes& rNds = GetDoc()->GetNodes();
1094 
1095  if ( rNds.GetOutLineNds().empty() )
1096  {
1097  SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::NavElementNotFound );
1098  return false;
1099  }
1100 
1101  SwCursor* pCursor = getShellCursor( true );
1102  SwNode* pNd = &(pCursor->GetNode());
1104  bool bRet = false;
1105  (void)rNds.GetOutLineNds().Seek_Entry(pNd, &nPos);
1106  SwOutlineNodes::size_type const nStartPos(nPos);
1107 
1108  do
1109  {
1110  if (nPos == 0)
1111  {
1112  nPos = rNds.GetOutLineNds().size() - 1;
1113  }
1114  else
1115  {
1116  --nPos; // before
1117  }
1118  if (nPos == nStartPos)
1119  {
1120  pNd = nullptr;
1121  break;
1122  }
1123 
1124  pNd = rNds.GetOutLineNds()[ nPos ];
1125  }
1126  while (!sw::IsParaPropsNode(*GetLayout(), *pNd->GetTextNode()));
1127 
1128  if (pNd)
1129  {
1130  if (nStartPos < nPos)
1131  {
1132  SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::StartWrapped );
1133  }
1134  else
1135  {
1136  SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::Empty );
1137  }
1138  CurrShell aCurr( this );
1139  SwCallLink aLk( *this ); // watch Cursor-Moves
1140  SwCursorSaveState aSaveState( *pCursor );
1141  pCursor->GetPoint()->nNode = *pNd;
1142  pCursor->GetPoint()->nContent.Assign( pNd->GetTextNode(), 0 );
1143 
1144  bRet = !pCursor->IsSelOvr();
1145  if( bRet )
1147  }
1148  else
1149  {
1150  SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::NavElementNotFound );
1151  }
1152  return bRet;
1153 }
1154 
1157 {
1158  SwPaM* pCursor = pPaM ? pPaM : getShellCursor(true);
1159  const SwNodes& rNds = GetDoc()->GetNodes();
1160 
1161  SwNode* pNd = &(pCursor->GetNode());
1163  if( rNds.GetOutLineNds().Seek_Entry( pNd, &nPos ))
1164  nPos++; // is at correct position; take next for while
1165 
1166  while( nPos-- ) // check the one in front of the current
1167  {
1168  pNd = rNds.GetOutLineNds()[ nPos ];
1169 
1170  if (sw::IsParaPropsNode(*GetLayout(), *pNd->GetTextNode())
1171  && pNd->GetTextNode()->GetAttrOutlineLevel()-1 <= nLevel)
1172  {
1173  if (pNd->GetIndex() < rNds.GetEndOfExtras().GetIndex()
1174  && pCursor->GetNode().GetIndex() > rNds.GetEndOfExtras().GetIndex())
1175  {
1176  // node found in extras but cursor position is not in extras
1177  return SwOutlineNodes::npos;
1178  }
1179  return nPos;
1180  }
1181  }
1182  return SwOutlineNodes::npos; // no more left
1183 }
1184 
1186  bool bWithChildren , bool bKillPams)
1187 {
1188  const SwNodes& rNds = GetDoc()->GetNodes();
1189  const SwOutlineNodes& rOutlNds = rNds.GetOutLineNds();
1190  if( rOutlNds.empty() )
1191  return;
1192 
1193  CurrShell aCurr( this );
1194  SwCallLink aLk( *this ); // watch Cursor-Moves
1195 
1196  if( nSttPos > nEndPos ) // parameters switched?
1197  {
1198  OSL_ENSURE( false, "Start > End for array access" );
1199  std::swap(nSttPos, nEndPos);
1200  }
1201 
1202  SwNode* pSttNd = rOutlNds[ nSttPos ];
1203  SwNode* pEndNd = rOutlNds[ nEndPos ];
1204 
1205  if( bWithChildren )
1206  {
1207  const int nLevel = pEndNd->GetTextNode()->GetAttrOutlineLevel()-1;
1208  for( ++nEndPos; nEndPos < rOutlNds.size(); ++nEndPos )
1209  {
1210  pEndNd = rOutlNds[ nEndPos ];
1211  const int nNxtLevel = pEndNd->GetTextNode()->GetAttrOutlineLevel()-1;
1212  if( nNxtLevel <= nLevel )
1213  break; // EndPos is now on the next one
1214  }
1215  }
1216  // if without children then set onto next one
1217  else if( ++nEndPos < rOutlNds.size() )
1218  pEndNd = rOutlNds[ nEndPos ];
1219 
1220  if( nEndPos == rOutlNds.size() ) // no end found
1221  pEndNd = &rNds.GetEndOfContent();
1222 
1223  if( bKillPams )
1224  KillPams();
1225 
1226  SwCursorSaveState aSaveState( *m_pCurrentCursor );
1227 
1228  // set end to the end of the previous content node
1229  m_pCurrentCursor->GetPoint()->nNode = *pSttNd;
1232  m_pCurrentCursor->GetPoint()->nNode = *pEndNd;
1233  m_pCurrentCursor->Move( fnMoveBackward, GoInNode ); // end of predecessor
1234 
1235  // and everything is already selected
1236  bool bRet = !m_pCurrentCursor->IsSelOvr();
1237  if( bRet )
1239 }
1240 
1242 bool SwCursorShell::GotoRefMark( const OUString& rRefMark, sal_uInt16 nSubType,
1243  sal_uInt16 nSeqNo )
1244 {
1245  CurrShell aCurr( this );
1246  SwCallLink aLk( *this ); // watch Cursor-Moves
1247  SwCursorSaveState aSaveState( *m_pCurrentCursor );
1248 
1249  sal_Int32 nPos = -1;
1250  SwTextNode* pTextNd = SwGetRefFieldType::FindAnchor( GetDoc(), rRefMark,
1251  nSubType, nSeqNo, &nPos, nullptr, GetLayout());
1252  if( pTextNd && pTextNd->GetNodes().IsDocNodes() )
1253  {
1254  m_pCurrentCursor->GetPoint()->nNode = *pTextNd;
1255  m_pCurrentCursor->GetPoint()->nContent.Assign( pTextNd, nPos );
1256 
1257  if( !m_pCurrentCursor->IsSelOvr() )
1258  {
1260  return true;
1261  }
1262  }
1263  return false;
1264 }
1265 
1266 bool SwCursorShell::IsPageAtPos( const Point &rPt ) const
1267 {
1268  if( GetLayout() )
1269  return nullptr != GetLayout()->GetPageAtPos( rPt );
1270  return false;
1271 }
1272 
1273 bool SwCursorShell::GetContentAtPos( const Point& rPt,
1274  SwContentAtPos& rContentAtPos,
1275  bool bSetCursor,
1276  SwRect* pFieldRect )
1277 {
1278  CurrShell aCurr( this );
1279  bool bRet = false;
1280 
1281  if( !IsTableMode() )
1282  {
1283  Point aPt( rPt );
1284  SwPosition aPos( *m_pCurrentCursor->GetPoint() );
1285 
1286  SwTextNode* pTextNd;
1287  SwCursorMoveState aTmpState;
1288  aTmpState.m_bFieldInfo = true;
1289  aTmpState.m_bExactOnly = !( IsAttrAtPos::Outline & rContentAtPos.eContentAtPos );
1290  aTmpState.m_bContentCheck = bool(IsAttrAtPos::ContentCheck & rContentAtPos.eContentAtPos);
1291  aTmpState.m_bSetInReadOnly = IsReadOnlyAvailable();
1292 
1293  SwSpecialPos aSpecialPos;
1294  aTmpState.m_pSpecialPos = ( IsAttrAtPos::SmartTag & rContentAtPos.eContentAtPos ) ?
1295  &aSpecialPos : nullptr;
1296 
1297  const bool bCursorFoundExact = GetLayout()->GetModelPositionForViewPoint( &aPos, aPt, &aTmpState );
1298  pTextNd = aPos.nNode.GetNode().GetTextNode();
1299 
1300  const SwNodes& rNds = GetDoc()->GetNodes();
1301  if( pTextNd
1302  && IsAttrAtPos::Outline & rContentAtPos.eContentAtPos
1303  && !rNds.GetOutLineNds().empty() )
1304  {
1305  // only for nodes in outline nodes
1307  if(rNds.GetOutLineNds().Seek_Entry(pTextNd, &nPos))
1308  {
1309  rContentAtPos.eContentAtPos = IsAttrAtPos::Outline;
1310  rContentAtPos.sStr = sw::GetExpandTextMerged(GetLayout(), *pTextNd, true, false, ExpandMode::ExpandFootnote);
1311  rContentAtPos.aFnd.pNode = pTextNd;
1312  bRet = true;
1313  }
1314  }
1315  else if ( IsAttrAtPos::ContentCheck & rContentAtPos.eContentAtPos
1316  && bCursorFoundExact )
1317  {
1318  bRet = true;
1319  }
1320  else if( pTextNd
1321  && IsAttrAtPos::NumLabel & rContentAtPos.eContentAtPos)
1322  {
1323  bRet = aTmpState.m_bInNumPortion;
1324  rContentAtPos.aFnd.pNode = sw::GetParaPropsNode(*GetLayout(), aPos.nNode);
1325 
1326  Size aSizeLogic(aTmpState.m_nInNumPortionOffset, 0);
1327  Size aSizePixel = GetWin()->LogicToPixel(aSizeLogic);
1328  rContentAtPos.nDist = aSizePixel.Width();
1329  }
1330  else if( bCursorFoundExact && pTextNd )
1331  {
1332  SwContentFrame *pFrame(nullptr);
1333  if( !aTmpState.m_bPosCorr )
1334  {
1335  SwTextAttr* pTextAttr;
1336  if ( IsAttrAtPos::SmartTag & rContentAtPos.eContentAtPos
1337  && !aTmpState.m_bFootnoteNoInfo )
1338  {
1339  const SwWrongList* pSmartTagList = pTextNd->GetSmartTags();
1340  sal_Int32 nCurrent = aPos.nContent.GetIndex();
1341  const sal_Int32 nBegin = nCurrent;
1342  sal_Int32 nLen = 1;
1343 
1344  if (pSmartTagList && pSmartTagList->InWrongWord(nCurrent, nLen) && !pTextNd->IsSymbolAt(nBegin))
1345  {
1346  const sal_uInt16 nIndex = pSmartTagList->GetWrongPos( nBegin );
1347  const SwWrongList* pSubList = pSmartTagList->SubList( nIndex );
1348  if ( pSubList )
1349  {
1350  nCurrent = aTmpState.m_pSpecialPos->nCharOfst;
1351 
1352  if ( pSubList->InWrongWord( nCurrent, nLen ) )
1353  bRet = true;
1354  }
1355  else
1356  bRet = true;
1357 
1358  if( bRet && bSetCursor )
1359  {
1360  SwCursorSaveState aSaveState( *m_pCurrentCursor );
1361  SwCallLink aLk( *this ); // watch Cursor-Moves
1363  *m_pCurrentCursor->GetPoint() = aPos;
1365  bRet = false;
1366  else
1367  UpdateCursor();
1368  }
1369  if( bRet )
1370  {
1371  rContentAtPos.eContentAtPos = IsAttrAtPos::SmartTag;
1372 
1373  std::pair<Point, bool> tmp(aPt, true);
1374  if (pFieldRect)
1375  {
1376  pFrame = pTextNd->getLayoutFrame(GetLayout(), nullptr, &tmp);
1377  if (pFrame)
1378  pFrame->GetCharRect( *pFieldRect, aPos, &aTmpState );
1379  }
1380  }
1381  }
1382  }
1383 
1384  if ( !bRet
1386  && !aTmpState.m_bFootnoteNoInfo )
1387  {
1388  pTextAttr = pTextNd->GetFieldTextAttrAt( aPos.nContent.GetIndex() );
1389  const SwField* pField = pTextAttr != nullptr
1390  ? pTextAttr->GetFormatField().GetField()
1391  : nullptr;
1392  if ( IsAttrAtPos::ClickField & rContentAtPos.eContentAtPos
1393  && pField && !pField->HasClickHdl() )
1394  {
1395  pField = nullptr;
1396  }
1397 
1398  if ( pField )
1399  {
1400  if (pFieldRect)
1401  {
1402  std::pair<Point, bool> tmp(aPt, true);
1403  pFrame = pTextNd->getLayoutFrame(GetLayout(), nullptr, &tmp);
1404  if (pFrame)
1405  {
1406  //tdf#116397 now that we looking for the bounds of the field drop the SmartTag
1407  //index within field setting so we don't the bounds of the char within the field
1408  SwSpecialPos* pSpecialPos = aTmpState.m_pSpecialPos;
1409  aTmpState.m_pSpecialPos = nullptr;
1410  pFrame->GetCharRect( *pFieldRect, aPos, &aTmpState );
1411  aTmpState.m_pSpecialPos = pSpecialPos;
1412  }
1413  }
1414 
1415  if( bSetCursor )
1416  {
1417  SwCallLink aLk( *this ); // watch Cursor-Moves
1418  SwCursorSaveState aSaveState( *m_pCurrentCursor );
1420  *m_pCurrentCursor->GetPoint() = aPos;
1421  if( m_pCurrentCursor->IsSelOvr() )
1422  {
1423  // allow click fields in protected sections
1424  // only placeholder is not possible
1425  if( IsAttrAtPos::Field & rContentAtPos.eContentAtPos
1426  || SwFieldIds::JumpEdit == pField->Which() )
1427  pField = nullptr;
1428  }
1429  else
1430  UpdateCursor();
1431  }
1432  else if( SwFieldIds::Table == pField->Which() &&
1433  static_cast<const SwTableField*>(pField)->IsIntrnlName() )
1434  {
1435  // create from internal (for CORE) the external
1436  // (for UI) formula
1437  const SwTableNode* pTableNd = pTextNd->FindTableNode();
1438  if( pTableNd ) // is in a table
1439  const_cast<SwTableField*>(static_cast<const SwTableField*>(pField))->PtrToBoxNm( &pTableNd->GetTable() );
1440  }
1441  }
1442 
1443  if( pField )
1444  {
1445  rContentAtPos.aFnd.pField = pField;
1446  rContentAtPos.pFndTextAttr = pTextAttr;
1447  rContentAtPos.eContentAtPos = IsAttrAtPos::Field;
1448  bRet = true;
1449  }
1450  }
1451 
1452  if( !bRet && IsAttrAtPos::FormControl & rContentAtPos.eContentAtPos )
1453  {
1454  IDocumentMarkAccess* pMarksAccess = GetDoc()->getIDocumentMarkAccess( );
1455  sw::mark::IFieldmark* pFieldBookmark = pMarksAccess->getFieldmarkFor( aPos );
1456  if (bCursorFoundExact && pFieldBookmark)
1457  {
1458  rContentAtPos.eContentAtPos = IsAttrAtPos::FormControl;
1459  rContentAtPos.aFnd.pFieldmark = pFieldBookmark;
1460  bRet=true;
1461  }
1462  }
1463 
1464  if( !bRet && IsAttrAtPos::Ftn & rContentAtPos.eContentAtPos )
1465  {
1466  if( aTmpState.m_bFootnoteNoInfo )
1467  {
1468  // over the footnote's char
1469  bRet = true;
1470  if( bSetCursor )
1471  {
1472  *m_pCurrentCursor->GetPoint() = aPos;
1473  if( !GotoFootnoteAnchor() )
1474  bRet = false;
1475  }
1476  if( bRet )
1477  rContentAtPos.eContentAtPos = IsAttrAtPos::Ftn;
1478  }
1479  else if ( nullptr != ( pTextAttr = pTextNd->GetTextAttrForCharAt(
1480  aPos.nContent.GetIndex(), RES_TXTATR_FTN )) )
1481  {
1482  bRet = true;
1483  if( bSetCursor )
1484  {
1485  SwCallLink aLk( *this ); // watch Cursor-Moves
1486  SwCursorSaveState aSaveState( *m_pCurrentCursor );
1487  m_pCurrentCursor->GetPoint()->nNode = *static_cast<SwTextFootnote*>(pTextAttr)->GetStartNode();
1490  true, !IsReadOnlyAvailable() );
1491 
1492  if( pCNd )
1493  {
1494  m_pCurrentCursor->GetPoint()->nContent.Assign( pCNd, 0 );
1497  bRet = false;
1498  else
1499  UpdateCursor();
1500  }
1501  else
1502  bRet = false;
1503  }
1504 
1505  if( bRet )
1506  {
1507  rContentAtPos.eContentAtPos = IsAttrAtPos::Ftn;
1508  rContentAtPos.pFndTextAttr = pTextAttr;
1509  rContentAtPos.aFnd.pAttr = &pTextAttr->GetAttr();
1510 
1511  if (pFieldRect)
1512  {
1513  std::pair<Point, bool> tmp(aPt, true);
1514  pFrame = pTextNd->getLayoutFrame(GetLayout(), nullptr, &tmp);
1515  if (pFrame)
1516  pFrame->GetCharRect( *pFieldRect, aPos, &aTmpState );
1517  }
1518  }
1519  }
1520  }
1521 
1522  if( !bRet
1524  && !aTmpState.m_bFootnoteNoInfo )
1525  {
1526  pTextAttr = nullptr;
1527  if( IsAttrAtPos::ToxMark & rContentAtPos.eContentAtPos )
1528  {
1529  std::vector<SwTextAttr *> const marks(
1530  pTextNd->GetTextAttrsAt(
1531  aPos.nContent.GetIndex(), RES_TXTATR_TOXMARK));
1532  if (!marks.empty())
1533  { // hmm... can only return 1 here
1534  pTextAttr = *marks.begin();
1535  }
1536  }
1537 
1538  if( !pTextAttr &&
1539  IsAttrAtPos::RefMark & rContentAtPos.eContentAtPos )
1540  {
1541  std::vector<SwTextAttr *> const marks(
1542  pTextNd->GetTextAttrsAt(
1543  aPos.nContent.GetIndex(), RES_TXTATR_REFMARK));
1544  if (!marks.empty())
1545  { // hmm... can only return 1 here
1546  pTextAttr = *marks.begin();
1547  }
1548  }
1549 
1550  if( pTextAttr )
1551  {
1552  bRet = true;
1553  if( bSetCursor )
1554  {
1555  SwCallLink aLk( *this ); // watch Cursor-Moves
1556  SwCursorSaveState aSaveState( *m_pCurrentCursor );
1558  *m_pCurrentCursor->GetPoint() = aPos;
1560  bRet = false;
1561  else
1562  UpdateCursor();
1563  }
1564 
1565  if( bRet )
1566  {
1567  const sal_Int32* pEnd = pTextAttr->GetEnd();
1568  if( pEnd )
1569  rContentAtPos.sStr =
1570  pTextNd->GetExpandText(GetLayout(), pTextAttr->GetStart(), *pEnd - pTextAttr->GetStart());
1571  else if( RES_TXTATR_TOXMARK == pTextAttr->Which())
1572  rContentAtPos.sStr =
1573  pTextAttr->GetTOXMark().GetAlternativeText();
1574 
1575  rContentAtPos.eContentAtPos =
1576  RES_TXTATR_TOXMARK == pTextAttr->Which()
1579  rContentAtPos.pFndTextAttr = pTextAttr;
1580  rContentAtPos.aFnd.pAttr = &pTextAttr->GetAttr();
1581 
1582  std::pair<Point, bool> tmp(aPt, true);
1583  if (pFieldRect)
1584  {
1585  pFrame = pTextNd->getLayoutFrame(GetLayout(), nullptr, &tmp);
1586  if (pFrame)
1587  pFrame->GetCharRect( *pFieldRect, aPos, &aTmpState );
1588  }
1589  }
1590  }
1591  }
1592 
1593  if ( !bRet
1594  && IsAttrAtPos::InetAttr & rContentAtPos.eContentAtPos
1595  && !aTmpState.m_bFootnoteNoInfo )
1596  {
1597  sal_Int32 index = aPos.nContent.GetIndex();
1598  pTextAttr = pTextNd->GetTextAttrAt(index, RES_TXTATR_INETFMT);
1599 
1600  if(!pTextAttr && index > 0)
1601  pTextAttr = pTextNd->GetTextAttrAt(index - 1, RES_TXTATR_INETFMT);
1602  // "detect" only INetAttrs with URLs
1603  if( pTextAttr && !pTextAttr->GetINetFormat().GetValue().isEmpty() )
1604  {
1605  bRet = true;
1606  if( bSetCursor )
1607  {
1608  SwCursorSaveState aSaveState( *m_pCurrentCursor );
1609  SwCallLink aLk( *this ); // watch Cursor-Moves
1611  *m_pCurrentCursor->GetPoint() = aPos;
1614  bRet = false;
1615  else
1616  UpdateCursor();
1617  }
1618  if( bRet )
1619  {
1620  const sal_Int32 nSt = pTextAttr->GetStart();
1621  const sal_Int32 nEnd = *pTextAttr->End();
1622 
1623  rContentAtPos.sStr = pTextNd->GetExpandText(GetLayout(), nSt, nEnd-nSt);
1624 
1625  rContentAtPos.aFnd.pAttr = &pTextAttr->GetAttr();
1626  rContentAtPos.eContentAtPos = IsAttrAtPos::InetAttr;
1627  rContentAtPos.pFndTextAttr = pTextAttr;
1628 
1629  if (pFieldRect)
1630  {
1631  std::pair<Point, bool> tmp(aPt, true);
1632  pFrame = pTextNd->getLayoutFrame(GetLayout(), nullptr, &tmp);
1633  if (pFrame)
1634  {
1635  //get bounding box of range
1636  SwRect aStart;
1637  SwPosition aStartPos(*pTextNd, nSt);
1638  pFrame->GetCharRect(aStart, aStartPos, &aTmpState);
1639  SwRect aEnd;
1640  SwPosition aEndPos(*pTextNd, nEnd);
1641  pFrame->GetCharRect(aEnd, aEndPos, &aTmpState);
1642  if (aStart.Top() != aEnd.Top() || aStart.Bottom() != aEnd.Bottom())
1643  {
1644  aStart.Left(pFrame->getFrameArea().Left());
1645  aEnd.Right(pFrame->getFrameArea().Right());
1646  }
1647  *pFieldRect = aStart.Union(aEnd);
1648  }
1649  }
1650  }
1651  }
1652  }
1653 
1654  if( !bRet && IsAttrAtPos::Redline & rContentAtPos.eContentAtPos )
1655  {
1656  const SwRangeRedline* pRedl = GetDoc()->getIDocumentRedlineAccess().GetRedline(aPos, nullptr);
1657 
1658  if( pRedl )
1659  {
1660  rContentAtPos.aFnd.pRedl = pRedl;
1661  rContentAtPos.eContentAtPos = IsAttrAtPos::Redline;
1662  rContentAtPos.pFndTextAttr = nullptr;
1663  bRet = true;
1664 
1665  if (pFieldRect)
1666  {
1667  std::pair<Point, bool> tmp(aPt, true);
1668  pFrame = pTextNd->getLayoutFrame(GetLayout(), nullptr, &tmp);
1669  if( pFrame )
1670  {
1671  // not sure if this should be limited to one
1672  // paragraph, or mark the entire redline; let's
1673  // leave it limited to one for now...
1674  sal_Int32 nStart;
1675  sal_Int32 nEnd;
1676  pRedl->CalcStartEnd(pTextNd->GetIndex(), nStart, nEnd);
1677  if (nStart == COMPLETE_STRING)
1678  {
1679  // consistency: found pRedl, so there must be
1680  // something in pTextNd
1681  assert(nEnd != COMPLETE_STRING);
1682  nStart = 0;
1683  }
1684  if (nEnd == COMPLETE_STRING)
1685  {
1686  nEnd = pTextNd->Len();
1687  }
1688  //get bounding box of range
1689  SwRect aStart;
1690  pFrame->GetCharRect(aStart, SwPosition(*pTextNd, nStart), &aTmpState);
1691  SwRect aEnd;
1692  pFrame->GetCharRect(aEnd, SwPosition(*pTextNd, nEnd), &aTmpState);
1693  if (aStart.Top() != aEnd.Top() || aStart.Bottom() != aEnd.Bottom())
1694  {
1695  aStart.Left(pFrame->getFrameArea().Left());
1696  aEnd.Right(pFrame->getFrameArea().Right());
1697  }
1698  *pFieldRect = aStart.Union(aEnd);
1699  }
1700  }
1701  }
1702  }
1703  }
1704 
1705  if( !bRet
1706  && ( IsAttrAtPos::TableBoxFml & rContentAtPos.eContentAtPos
1707 #ifdef DBG_UTIL
1708  || IsAttrAtPos::TableBoxValue & rContentAtPos.eContentAtPos
1709 #endif
1710  ) )
1711  {
1712  const SwTableNode* pTableNd;
1713  const SwTableBox* pBox;
1714  const SwStartNode* pSttNd = pTextNd->FindTableBoxStartNode();
1715  const SfxPoolItem* pItem;
1716  if( pSttNd && nullptr != ( pTableNd = pTextNd->FindTableNode()) &&
1717  nullptr != ( pBox = pTableNd->GetTable().GetTableBox(
1718  pSttNd->GetIndex() )) &&
1719 #ifdef DBG_UTIL
1720  ( SfxItemState::SET == pBox->GetFrameFormat()->GetItemState(
1721  RES_BOXATR_FORMULA, false, &pItem ) ||
1722  SfxItemState::SET == pBox->GetFrameFormat()->GetItemState(
1723  RES_BOXATR_VALUE, false, &pItem ))
1724 #else
1725  SfxItemState::SET == pBox->GetFrameFormat()->GetItemState(
1726  RES_BOXATR_FORMULA, false, &pItem )
1727 #endif
1728  )
1729  {
1730  std::pair<Point, bool> tmp(aPt, true);
1731  SwFrame* pF = pTextNd->getLayoutFrame(GetLayout(), nullptr, &tmp);
1732  if( pF )
1733  {
1734  // then the CellFrame
1735  pFrame = static_cast<SwContentFrame*>(pF);
1736  while( pF && !pF->IsCellFrame() )
1737  pF = pF->GetUpper();
1738  }
1739 
1740  if( aTmpState.m_bPosCorr )
1741  {
1742  if( pF && !pF->getFrameArea().Contains( aPt ))
1743  pF = nullptr;
1744  }
1745  else if( !pF )
1746  pF = pFrame;
1747 
1748  if( pF ) // only then it is valid
1749  {
1750  // create from internal (for CORE) the external
1751  // (for UI) formula
1752  rContentAtPos.eContentAtPos = IsAttrAtPos::TableBoxFml;
1753 #ifdef DBG_UTIL
1754  if( RES_BOXATR_VALUE == pItem->Which() )
1755  rContentAtPos.eContentAtPos = IsAttrAtPos::TableBoxValue;
1756  else
1757 #endif
1758  const_cast<SwTableBoxFormula&>(pItem->StaticWhichCast(RES_BOXATR_FORMULA)).PtrToBoxNm( &pTableNd->GetTable() );
1759 
1760  bRet = true;
1761  if( bSetCursor )
1762  {
1763  SwCallLink aLk( *this ); // watch Cursor-Moves
1764  SwCursorSaveState aSaveState( *m_pCurrentCursor );
1765  *m_pCurrentCursor->GetPoint() = aPos;
1768  bRet = false;
1769  else
1770  UpdateCursor();
1771  }
1772 
1773  if( bRet )
1774  {
1775  if( pFieldRect )
1776  {
1777  *pFieldRect = pF->getFramePrintArea();
1778  *pFieldRect += pF->getFrameArea().Pos();
1779  }
1780  rContentAtPos.pFndTextAttr = nullptr;
1781  rContentAtPos.aFnd.pAttr = pItem;
1782  }
1783  }
1784  }
1785  }
1786 
1787 #ifdef DBG_UTIL
1788  if( !bRet && IsAttrAtPos::CurrAttrs & rContentAtPos.eContentAtPos )
1789  {
1790  const sal_Int32 n = aPos.nContent.GetIndex();
1792  if( pTextNd->GetpSwpHints() )
1793  {
1794  for( size_t i = 0; i < pTextNd->GetSwpHints().Count(); ++i )
1795  {
1796  const SwTextAttr* pHt = pTextNd->GetSwpHints().Get(i);
1797  const sal_Int32 nAttrStart = pHt->GetStart();
1798  if( nAttrStart > n ) // over the section
1799  break;
1800 
1801  if( nullptr != pHt->End() && (
1802  ( nAttrStart < n &&
1803  ( pHt->DontExpand() ? n < *pHt->End()
1804  : n <= *pHt->End() )) ||
1805  ( n == nAttrStart &&
1806  ( nAttrStart == *pHt->End() || !n ))) )
1807  {
1808  aSet.Put( pHt->GetAttr() );
1809  }
1810  }
1811  if( pTextNd->HasSwAttrSet() &&
1812  pTextNd->GetpSwAttrSet()->Count() )
1813  {
1814  SfxItemSet aFormatSet( pTextNd->GetSwAttrSet() );
1815  // remove all from format set that are also in TextSet
1816  aFormatSet.Differentiate( aSet );
1817  // now merge all together
1818  aSet.Put( aFormatSet );
1819  }
1820  }
1821  else
1822  pTextNd->SwContentNode::GetAttr( aSet );
1823 
1824  rContentAtPos.sStr = "Pos: (";
1825  rContentAtPos.sStr += OUString::number( aPos.nNode.GetIndex());
1826  rContentAtPos.sStr += ":";
1827  rContentAtPos.sStr += OUString::number( aPos.nContent.GetIndex());
1828  rContentAtPos.sStr += ")";
1829  rContentAtPos.sStr += "\nParagraph Style: ";
1830  rContentAtPos.sStr += pTextNd->GetFormatColl()->GetName();
1831  if( pTextNd->GetCondFormatColl() )
1832  {
1833  rContentAtPos.sStr += "\nConditional Style: " + pTextNd->GetCondFormatColl()->GetName();
1834  }
1835 
1836  if( aSet.Count() )
1837  {
1838  OUStringBuffer sAttrs;
1839  SfxItemIter aIter( aSet );
1840  const SfxPoolItem* pItem = aIter.GetCurItem();
1841  const IntlWrapper aInt(SvtSysLocale().GetUILanguageTag());
1842  do
1843  {
1844  if( !IsInvalidItem( pItem ))
1845  {
1846  OUString aStr;
1847  GetDoc()->GetAttrPool().GetPresentation(*pItem,
1848  MapUnit::MapCM, aStr, aInt);
1849  if (!sAttrs.isEmpty())
1850  sAttrs.append(", ");
1851  sAttrs.append(aStr);
1852  }
1853  pItem = aIter.NextItem();
1854  } while (pItem);
1855  if (!sAttrs.isEmpty())
1856  {
1857  if( !rContentAtPos.sStr.isEmpty() )
1858  rContentAtPos.sStr += "\n";
1859  rContentAtPos.sStr += "Attr: " + sAttrs.toString();
1860  }
1861  }
1862  bRet = true;
1863  rContentAtPos.eContentAtPos = IsAttrAtPos::CurrAttrs;
1864  }
1865 #endif
1866  }
1867  }
1868 
1869  if( !bRet )
1870  {
1871  rContentAtPos.eContentAtPos = IsAttrAtPos::NONE;
1872  rContentAtPos.aFnd.pField = nullptr;
1873  }
1874  return bRet;
1875 }
1876 
1877 // #i90516#
1879 {
1880  const SwPostItField* pPostItField = nullptr;
1881 
1882  if ( !IsTableMode() )
1883  {
1884  const SwPosition* pCursorPos = GetCursor_()->GetPoint();
1885  const SwTextNode* pTextNd = pCursorPos->nNode.GetNode().GetTextNode();
1886  if ( pTextNd )
1887  {
1888  SwTextAttr* pTextAttr = pTextNd->GetFieldTextAttrAt( pCursorPos->nContent.GetIndex() );
1889  const SwField* pField = pTextAttr != nullptr ? pTextAttr->GetFormatField().GetField() : nullptr;
1890  if ( pField && pField->Which()== SwFieldIds::Postit )
1891  {
1892  pPostItField = static_cast<const SwPostItField*>(pField);
1893  }
1894  }
1895  }
1896 
1897  return pPostItField;
1898 }
1899 
1902 {
1903  const SwTextNode* pNd = nullptr;
1904  if( pFndTextAttr )
1905  {
1906  switch( eContentAtPos )
1907  {
1908  case IsAttrAtPos::Field:
1910  pNd = static_txtattr_cast<SwTextField const*>(pFndTextAttr)->GetpTextNode();
1911  break;
1912 
1913  case IsAttrAtPos::Ftn:
1914  pNd = &static_cast<const SwTextFootnote*>(pFndTextAttr)->GetTextNode();
1915  break;
1916 
1917  case IsAttrAtPos::InetAttr:
1918  pNd = static_txtattr_cast<SwTextINetFormat const*>(pFndTextAttr)->GetpTextNode();
1919  break;
1920 
1921  default:
1922  break;
1923  }
1924  }
1925 
1926  if( !pNd )
1927  return false;
1928  if( pNd->IsInProtectSect() )
1929  return true;
1930 
1931  const SwContentFrame* pFrame = pNd->getLayoutFrame(pNd->GetDoc().getIDocumentLayoutAccess().GetCurrentLayout(), nullptr, nullptr);
1932  return pFrame && pFrame->IsProtected() ;
1933 }
1934 
1936 {
1937  bool bRet = false;
1938  const SwTextNode* pNd = nullptr;
1940  {
1941  const SwTextFootnote* pTextFootnote = static_cast<const SwTextFootnote*>(pFndTextAttr);
1942  if(pTextFootnote->GetStartNode())
1943  {
1944  SwStartNode* pSttNd = pTextFootnote->GetStartNode()->GetNode().GetStartNode();
1945  SwPaM aTemp( *pSttNd );
1946  aTemp.Move(fnMoveForward, GoInNode);
1947  SwContentNode* pContentNode = aTemp.GetContentNode();
1948  if(pContentNode && pContentNode->IsTextNode())
1949  pNd = pContentNode->GetTextNode();
1950  }
1951  }
1952  if(pNd)
1953  {
1955  SwTextFrame* pTmpFrame = aIter.First();
1956  while( pTmpFrame )
1957  {
1958  if ( !pTmpFrame->IsFollow())
1959  {
1960  bRet = pTmpFrame->IsRightToLeft();
1961  break;
1962  }
1963  pTmpFrame = aIter.Next();
1964  }
1965  }
1966  return bRet;
1967 }
1968 
1969 bool SwCursorShell::SelectText( const sal_Int32 nStart,
1970  const sal_Int32 nEnd )
1971 {
1972  CurrShell aCurr( this );
1973  bool bRet = false;
1974 
1975  SwCallLink aLk( *this );
1976  SwCursorSaveState aSaveState( *m_pCurrentCursor );
1977 
1978  SwPosition& rPos = *m_pCurrentCursor->GetPoint();
1980  rPos.nContent = nStart;
1982  rPos.nContent = nEnd;
1983 
1984  if( !m_pCurrentCursor->IsSelOvr() )
1985  {
1986  UpdateCursor();
1987  bRet = true;
1988  }
1989 
1990  return bRet;
1991 }
1992 
1993 bool SwCursorShell::SelectTextAttr( sal_uInt16 nWhich,
1994  bool bExpand,
1995  const SwTextAttr* pTextAttr )
1996 {
1997  CurrShell aCurr( this );
1998  bool bRet = false;
1999 
2000  if( !IsTableMode() )
2001  {
2002  if( !pTextAttr )
2003  {
2004  SwPosition& rPos = *m_pCurrentCursor->GetPoint();
2005  SwTextNode* pTextNd = rPos.nNode.GetNode().GetTextNode();
2006  pTextAttr = pTextNd
2007  ? pTextNd->GetTextAttrAt(rPos.nContent.GetIndex(),
2008  nWhich,
2010  : nullptr;
2011  }
2012 
2013  if( pTextAttr )
2014  {
2015  const sal_Int32* pEnd = pTextAttr->End();
2016  bRet = SelectText( pTextAttr->GetStart(), ( pEnd ? *pEnd : pTextAttr->GetStart() + 1 ) );
2017  }
2018  }
2019  return bRet;
2020 }
2021 
2023 {
2024  bool bRet = false;
2025  if( rAttr.GetpTextNode() )
2026  {
2027  SwCursor* pCursor = getShellCursor( true );
2028 
2029  CurrShell aCurr( this );
2030  SwCallLink aLk( *this ); // watch Cursor-Moves
2031  SwCursorSaveState aSaveState( *pCursor );
2032 
2033  pCursor->GetPoint()->nNode = *rAttr.GetpTextNode();
2034  pCursor->GetPoint()->nContent.Assign( const_cast<SwTextNode*>(rAttr.GetpTextNode()),
2035  rAttr.GetStart() );
2036  bRet = !pCursor->IsSelOvr();
2037  if( bRet )
2039  }
2040  return bRet;
2041 }
2042 
2043 const SwFormatINetFormat* SwCursorShell::FindINetAttr( std::u16string_view rName ) const
2044 {
2045  return mxDoc->FindINetAttr( rName );
2046 }
2047 
2048 bool SwCursorShell::GetShadowCursorPos( const Point& rPt, SwFillMode eFillMode,
2049  SwRect& rRect, sal_Int16& rOrient )
2050 {
2051 
2052  CurrShell aCurr( this );
2053  bool bRet = false;
2054 
2055  if (!IsTableMode() && !HasSelection()
2056  && GetDoc()->GetIDocumentUndoRedo().DoesUndo())
2057  {
2058  Point aPt( rPt );
2059  SwPosition aPos( *m_pCurrentCursor->GetPoint() );
2060 
2061  SwFillCursorPos aFPos( eFillMode );
2062  SwCursorMoveState aTmpState( &aFPos );
2063 
2064  if( GetLayout()->GetModelPositionForViewPoint( &aPos, aPt, &aTmpState ) &&
2065  !aPos.nNode.GetNode().IsProtect())
2066  {
2067  // start position in protected section?
2068  rRect = aFPos.aCursor;
2069  rOrient = aFPos.eOrient;
2070  bRet = true;
2071  }
2072  }
2073  return bRet;
2074 }
2075 
2076 bool SwCursorShell::SetShadowCursorPos( const Point& rPt, SwFillMode eFillMode )
2077 {
2078  CurrShell aCurr( this );
2079  bool bRet = false;
2080 
2081  if (!IsTableMode() && !HasSelection()
2082  && GetDoc()->GetIDocumentUndoRedo().DoesUndo())
2083  {
2084  Point aPt( rPt );
2085  SwPosition aPos( *m_pCurrentCursor->GetPoint() );
2086 
2087  SwFillCursorPos aFPos( eFillMode );
2088  SwCursorMoveState aTmpState( &aFPos );
2089 
2090  if( GetLayout()->GetModelPositionForViewPoint( &aPos, aPt, &aTmpState ) )
2091  {
2092  SwCallLink aLk( *this ); // watch Cursor-Moves
2093  StartAction();
2094 
2095  SwContentNode* pCNd = aPos.nNode.GetNode().GetContentNode();
2097  // If only the paragraph attributes "Adjust" or "LRSpace" are set,
2098  // then the following should not delete those again.
2099  if( 0 == aFPos.nParaCnt + aFPos.nColumnCnt &&
2100  ( SwFillMode::Indent == aFPos.eMode ||
2101  ( text::HoriOrientation::NONE != aFPos.eOrient &&
2102  0 == aFPos.nTabCnt + aFPos.nSpaceCnt )) &&
2103  pCNd && pCNd->Len() )
2104  nUndoId = SwUndoId::EMPTY;
2105 
2106  GetDoc()->GetIDocumentUndoRedo().StartUndo( nUndoId, nullptr );
2107 
2108  SwTextFormatColl* pNextFormat = nullptr;
2109  SwTextNode* pTNd = pCNd ? pCNd->GetTextNode() : nullptr;
2110  if( pTNd )
2111  pNextFormat = &pTNd->GetTextColl()->GetNextTextFormatColl();
2112 
2113  const SwSectionNode* pSectNd = pCNd ? pCNd->FindSectionNode() : nullptr;
2114  if( pSectNd && aFPos.nParaCnt )
2115  {
2116  SwNodeIndex aEnd( aPos.nNode, 1 );
2117  while( aEnd.GetNode().IsEndNode() &&
2118  &aEnd.GetNode() !=
2119  pSectNd->EndOfSectionNode() )
2120  ++aEnd;
2121 
2122  if( aEnd.GetNode().IsEndNode() &&
2123  pCNd->Len() == aPos.nContent.GetIndex() )
2124  aPos.nNode = *pSectNd->EndOfSectionNode();
2125  }
2126 
2127  for( sal_uInt16 n = 0; n < aFPos.nParaCnt + aFPos.nColumnCnt; ++n )
2128  {
2130  if( !n && pNextFormat )
2131  {
2132  *m_pCurrentCursor->GetPoint() = aPos;
2133  GetDoc()->SetTextFormatColl( *m_pCurrentCursor, pNextFormat, false );
2134  }
2135  if( n < aFPos.nColumnCnt )
2136  {
2137  *m_pCurrentCursor->GetPoint() = aPos;
2139  SvxFormatBreakItem( SvxBreak::ColumnBefore, RES_BREAK ) );
2140  }
2141  }
2142 
2143  *m_pCurrentCursor->GetPoint() = aPos;
2144  switch( aFPos.eMode )
2145  {
2146  case SwFillMode::Indent:
2147  if( nullptr != (pCNd = aPos.nNode.GetNode().GetContentNode() ))
2148  {
2151  RES_LR_SPACE, RES_LR_SPACE> aSet( GetDoc()->GetAttrPool() );
2152  SvxLRSpaceItem aLR(pCNd->GetAttr(RES_LR_SPACE).StaticWhichCast(RES_LR_SPACE));
2153  aLR.SetTextLeft( aFPos.nTabCnt );
2154  aLR.SetTextFirstLineOffset( 0 );
2155  aSet.Put( aLR );
2156 
2157  const SvxAdjustItem& rAdj = pCNd->GetAttr(RES_PARATR_ADJUST).StaticWhichCast(RES_PARATR_ADJUST);
2158  if( SvxAdjust::Left != rAdj.GetAdjust() )
2159  aSet.Put( SvxAdjustItem( SvxAdjust::Left, RES_PARATR_ADJUST ) );
2160 
2162  }
2163  else {
2164  OSL_ENSURE( false, "No ContentNode" );
2165  }
2166  break;
2167 
2168  case SwFillMode::Tab:
2169  case SwFillMode::TabSpace:
2170  case SwFillMode::Space:
2171  {
2172  OUStringBuffer sInsert;
2173  if (aFPos.eMode == SwFillMode::Space)
2174  {
2175  comphelper::string::padToLength(sInsert, sInsert.getLength() + aFPos.nSpaceOnlyCnt, ' ');
2176  }
2177  else
2178  {
2179  if (aFPos.nTabCnt)
2180  comphelper::string::padToLength(sInsert, aFPos.nTabCnt, '\t');
2181  if (aFPos.nSpaceCnt)
2182  comphelper::string::padToLength(sInsert, sInsert.getLength() + aFPos.nSpaceCnt, ' ');
2183  }
2184  if (!sInsert.isEmpty())
2185  GetDoc()->getIDocumentContentOperations().InsertString( *m_pCurrentCursor, sInsert.makeStringAndClear());
2186  }
2187  [[fallthrough]]; // still need to set orientation
2188  case SwFillMode::Margin:
2189  if( text::HoriOrientation::NONE != aFPos.eOrient )
2190  {
2191  SvxAdjustItem aAdj( SvxAdjust::Left, RES_PARATR_ADJUST );
2192  switch( aFPos.eOrient )
2193  {
2194  case text::HoriOrientation::CENTER:
2195  aAdj.SetAdjust( SvxAdjust::Center );
2196  break;
2197  case text::HoriOrientation::RIGHT:
2198  aAdj.SetAdjust( SvxAdjust::Right );
2199  break;
2200  default:
2201  break;
2202  }
2204  }
2205  break;
2206  }
2207 
2208  GetDoc()->GetIDocumentUndoRedo().EndUndo( nUndoId, nullptr );
2209  EndAction();
2210 
2211  bRet = true;
2212  }
2213  }
2214  return bRet;
2215 }
2216 
2218 {
2219  const SwRangeRedline* pFnd = nullptr;
2220  if( !IsTableMode() )
2221  {
2222  CurrShell aCurr( this );
2223  SwCallLink aLk( *this ); // watch Cursor-Moves
2224  SwCursorSaveState aSaveState( *m_pCurrentCursor );
2225 
2226  // ensure point is at the end so alternating SelNext/SelPrev works
2227  NormalizePam(false);
2229 
2230  // at the end of the document, go to the start of the document, and try again
2231  if ( !pFnd )
2232  {
2235  }
2236 
2239  else
2240  pFnd = nullptr;
2241  }
2242  return pFnd;
2243 }
2244 
2246 {
2247  const SwRangeRedline* pFnd = nullptr;
2248  if( !IsTableMode() )
2249  {
2250  CurrShell aCurr( this );
2251  SwCallLink aLk( *this ); // watch Cursor-Moves
2252  SwCursorSaveState aSaveState( *m_pCurrentCursor );
2253 
2254  // ensure point is at the start so alternating SelNext/SelPrev works
2255  NormalizePam(true);
2257 
2258  // at the start of the document, go to the end of the document, and try again
2259  if ( !pFnd )
2260  {
2263  }
2264 
2267  else
2268  pFnd = nullptr;
2269  }
2270  return pFnd;
2271 }
2272 
2274 {
2275  const SwRangeRedline* pFnd = nullptr;
2276  SwCallLink aLk( *this ); // watch Cursor-Moves
2277  SwCursorSaveState aSaveState( *m_pCurrentCursor );
2278 
2279  pFnd = GetDoc()->getIDocumentRedlineAccess().GetRedlineTable()[ nArrPos ];
2280  if( pFnd )
2281  {
2282  *m_pCurrentCursor->GetPoint() = *pFnd->Start();
2283 
2285  if( !pIdx->GetNode().IsContentNode() )
2286  {
2287  SwContentNode* pCNd = GetDoc()->GetNodes().GoNextSection( pIdx,
2288  true, IsReadOnlyAvailable() );
2289  if( pCNd )
2290  {
2291  if( *pIdx <= pFnd->End()->nNode )
2292  m_pCurrentCursor->GetPoint()->nContent.Assign( pCNd, 0 );
2293  else
2294  pFnd = nullptr;
2295  }
2296  }
2297 
2298  if( pFnd && bSelect )
2299  {
2301  if( RedlineType::FmtColl == pFnd->GetType() )
2302  {
2303  SwContentNode* pCNd = pIdx->GetNode().GetContentNode();
2304  m_pCurrentCursor->GetPoint()->nContent.Assign( pCNd, pCNd->Len() );
2305  m_pCurrentCursor->GetMark()->nContent.Assign( pCNd, 0 );
2306  }
2307  else
2308  *m_pCurrentCursor->GetPoint() = *pFnd->End();
2309 
2310  pIdx = &m_pCurrentCursor->GetPoint()->nNode;
2311  if( !pIdx->GetNode().IsContentNode() )
2312  {
2313  SwContentNode* pCNd = SwNodes::GoPrevSection( pIdx,
2314  true, IsReadOnlyAvailable() );
2315  if( pCNd )
2316  {
2317  if( *pIdx >= m_pCurrentCursor->GetMark()->nNode )
2318  m_pCurrentCursor->GetPoint()->nContent.Assign( pCNd, pCNd->Len() );
2319  else
2320  pFnd = nullptr;
2321  }
2322  }
2323  }
2324 
2325  if( !pFnd )
2326  {
2329  }
2330  else if( bSelect && *m_pCurrentCursor->GetMark() == *m_pCurrentCursor->GetPoint() )
2332 
2336  else
2337  {
2338  pFnd = nullptr;
2339  if( bSelect )
2341  }
2342  }
2343  return pFnd;
2344 }
2345 
2347 {
2348  const SwRangeRedline* pFnd = nullptr;
2349  if( !IsTableMode() )
2350  {
2351  CurrShell aCurr( this );
2352 
2354  const SwRangeRedline* pTmp = rTable[ nArrPos ];
2355  sal_uInt16 nSeqNo = pTmp->GetSeqNo();
2356  if( nSeqNo && bSelect )
2357  {
2358  bool bCheck = false;
2359  int nLoopCnt = 2;
2360  SwRedlineTable::size_type nArrSavPos = nArrPos;
2361 
2362  do {
2363  pTmp = GotoRedline_( nArrPos, true );
2364 
2365  if( !pFnd )
2366  pFnd = pTmp;
2367 
2368  if( pTmp && bCheck )
2369  {
2370  // Check for overlaps. These can happen when FormatColl-
2371  // Redlines were stretched over a whole paragraph
2372  SwPaM* pCur = m_pCurrentCursor;
2373  SwPaM* pNextPam = pCur->GetNext();
2374  SwPosition* pCStt = pCur->Start(), *pCEnd = pCur->End();
2375  while( pCur != pNextPam )
2376  {
2377  const SwPosition *pNStt = pNextPam->Start(),
2378  *pNEnd = pNextPam->End();
2379 
2380  bool bDel = true;
2381  switch( ::ComparePosition( *pCStt, *pCEnd,
2382  *pNStt, *pNEnd ))
2383  {
2384  case SwComparePosition::Inside: // Pos1 is completely in Pos2
2385  if( !pCur->HasMark() )
2386  {
2387  pCur->SetMark();
2388  *pCur->GetMark() = *pNStt;
2389  }
2390  else
2391  *pCStt = *pNStt;
2392  *pCEnd = *pNEnd;
2393  break;
2394 
2395  case SwComparePosition::Outside: // Pos2 is completely in Pos1
2396  case SwComparePosition::Equal: // Pos1 has same size as Pos2
2397  break;
2398 
2399  case SwComparePosition::OverlapBefore: // Pos1 overlaps Pos2 at beginning
2400  if( !pCur->HasMark() )
2401  pCur->SetMark();
2402  *pCEnd = *pNEnd;
2403  break;
2404  case SwComparePosition::OverlapBehind: // Pos1 overlaps Pos2 at end
2405  if( !pCur->HasMark() )
2406  {
2407  pCur->SetMark();
2408  *pCur->GetMark() = *pNStt;
2409  }
2410  else
2411  *pCStt = *pNStt;
2412  break;
2413 
2414  default:
2415  bDel = false;
2416  }
2417 
2418  if( bDel )
2419  {
2420  // not needed anymore
2421  SwPaM* pPrevPam = pNextPam->GetPrev();
2422  delete pNextPam;
2423  pNextPam = pPrevPam;
2424  }
2425  pNextPam = pNextPam->GetNext();
2426  }
2427  }
2428 
2429  SwRedlineTable::size_type nFndPos = 2 == nLoopCnt
2430  ? rTable.FindNextOfSeqNo( nArrPos )
2431  : rTable.FindPrevOfSeqNo( nArrPos );
2432  if( SwRedlineTable::npos != nFndPos ||
2433  ( 0 != ( --nLoopCnt ) && SwRedlineTable::npos != (
2434  nFndPos = rTable.FindPrevOfSeqNo( nArrSavPos ))) )
2435  {
2436  if( pTmp )
2437  {
2438  // create new cursor
2439  CreateCursor();
2440  bCheck = true;
2441  }
2442  nArrPos = nFndPos;
2443  }
2444  else
2445  nLoopCnt = 0;
2446 
2447  } while( nLoopCnt );
2448  }
2449  else
2450  pFnd = GotoRedline_( nArrPos, bSelect );
2451  }
2452  return pFnd;
2453 }
2454 
2456 {
2457  SwNodes& rNds = GetDoc()->GetNodes();
2458  const SwNode* pBodyEndNd = &rNds.GetEndOfContent();
2459  const SwNode* pBodySttNd = pBodyEndNd->StartOfSectionNode();
2460  sal_uLong nBodySttNdIdx = pBodySttNd->GetIndex();
2461  Point aPt;
2462 
2463  SetGetExpField aCmpPos( SwPosition( bNext ? *pBodyEndNd : *pBodySttNd ) );
2464  SetGetExpField aCurPos( bNext ? *m_pCurrentCursor->End() : *m_pCurrentCursor->Start() );
2465  if( aCurPos.GetNode() < nBodySttNdIdx )
2466  {
2467  const SwContentNode* pCNd = aCurPos.GetNodeFromContent()->GetContentNode();
2468  std::pair<Point, bool> tmp(aPt, true);
2469  if (pCNd)
2470  {
2471  SwContentFrame* pFrame = pCNd->getLayoutFrame(GetLayout(), nullptr, &tmp);
2472  if( pFrame )
2473  aCurPos.SetBodyPos( *pFrame );
2474  }
2475  }
2476 
2477  // check first all the hyperlink fields
2478  {
2479  const SwTextNode* pTextNd;
2480  const SwCharFormats* pFormats = GetDoc()->GetCharFormats();
2481  for( SwCharFormats::size_type n = pFormats->size(); 1 < n; )
2482  {
2483  SwIterator<SwTextINetFormat,SwCharFormat> aIter(*(*pFormats)[--n]);
2484 
2485  for( SwTextINetFormat* pFnd = aIter.First(); pFnd; pFnd = aIter.Next() )
2486  {
2487  pTextNd = pFnd->GetpTextNode();
2488  if( pTextNd && pTextNd->GetNodes().IsDocNodes() )
2489  {
2490  SwTextINetFormat& rAttr = *pFnd;
2491  SwPosition aTmpPos( *pTextNd );
2492  SetGetExpField aPos( aTmpPos.nNode, rAttr );
2493  if (pTextNd->GetIndex() < nBodySttNdIdx)
2494  {
2495  std::pair<Point, bool> tmp(aPt, true);
2496  SwContentFrame* pFrame = pTextNd->getLayoutFrame(GetLayout(), nullptr, &tmp);
2497  if (pFrame)
2498  {
2499  aPos.SetBodyPos( *pFrame );
2500  }
2501  }
2502 
2503  if( bNext
2504  ? ( aPos < aCmpPos && aCurPos < aPos )
2505  : ( aCmpPos < aPos && aPos < aCurPos ))
2506  {
2507  OUString sText(pTextNd->GetExpandText(GetLayout(),
2508  rAttr.GetStart(),
2509  *rAttr.GetEnd() - rAttr.GetStart() ) );
2510 
2511  sText = sText.replaceAll("\x0a", "");
2512  sText = comphelper::string::strip(sText, ' ');
2513 
2514  if( !sText.isEmpty() )
2515  aCmpPos = aPos;
2516  }
2517  }
2518  }
2519  }
2520  }
2521 
2522  // then check all the Flys with a URL or image map
2523  {
2524  const SwFrameFormats* pFormats = GetDoc()->GetSpzFrameFormats();
2525  for( SwFrameFormats::size_type n = 0, nEnd = pFormats->size(); n < nEnd; ++n )
2526  {
2527  SwFlyFrameFormat* pFormat = static_cast<SwFlyFrameFormat*>((*pFormats)[ n ]);
2528  const SwFormatURL& rURLItem = pFormat->GetURL();
2529  if( rURLItem.GetMap() || !rURLItem.GetURL().isEmpty() )
2530  {
2531  SwFlyFrame* pFly = pFormat->GetFrame( &aPt );
2532  SwPosition aTmpPos( *pBodySttNd );
2533  if( pFly &&
2534  GetBodyTextNode( *GetDoc(), aTmpPos, *pFly->GetLower() ) )
2535  {
2536  SetGetExpField aPos( *pFormat, &aTmpPos );
2537 
2538  if( bNext
2539  ? ( aPos < aCmpPos && aCurPos < aPos )
2540  : ( aCmpPos < aPos && aPos < aCurPos ))
2541  aCmpPos = aPos;
2542  }
2543  }
2544  }
2545  }
2546 
2547  // found any URL ?
2548  bool bRet = false;
2549  const SwTextINetFormat* pFndAttr = aCmpPos.GetINetFormat();
2550  const SwFlyFrameFormat* pFndFormat = aCmpPos.GetFlyFormat();
2551  if( pFndAttr || pFndFormat )
2552  {
2553  CurrShell aCurr( this );
2554  SwCallLink aLk( *this );
2555 
2556  // found a text attribute ?
2557  if( pFndAttr )
2558  {
2559  SwCursorSaveState aSaveState( *m_pCurrentCursor );
2560 
2561  aCmpPos.GetPosOfContent( *m_pCurrentCursor->GetPoint() );
2564  m_pCurrentCursor->GetPoint()->nContent = *pFndAttr->End();
2565 
2567  {
2570  bRet = true;
2571  }
2572  }
2573  // found a draw object ?
2574  else if( RES_DRAWFRMFMT == pFndFormat->Which() )
2575  {
2576  const SdrObject* pSObj = pFndFormat->FindSdrObject();
2577  if (pSObj)
2578  {
2579  static_cast<SwFEShell*>(this)->SelectObj( pSObj->GetCurrentBoundRect().Center() );
2580  MakeSelVisible();
2581  bRet = true;
2582  }
2583  }
2584  else // then is it a fly
2585  {
2586  SwFlyFrame* pFly = pFndFormat->GetFrame(&aPt);
2587  if( pFly )
2588  {
2589  static_cast<SwFEShell*>(this)->SelectFlyFrame( *pFly );
2590  MakeSelVisible();
2591  bRet = true;
2592  }
2593  }
2594  }
2595  return bRet;
2596 }
2597 
2598 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
vcl::RenderContext * GetOut() const
Definition: viewsh.hxx:339
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:683
Starts a section of nodes in the document model.
Definition: node.hxx:312
bool IsInRTLText() const
Definition: crstrvl.cxx:1935
Base class of the Writer layout elements.
Definition: frame.hxx:315
Represents the visualization of a paragraph.
Definition: txtfrm.hxx:158
virtual sal_Int32 Len() const
Definition: node.cxx:1246
void DeleteMark()
Definition: pam.hxx:177
bool ContainsPageDesc(const SwPageDesc *pDesc, size_t *pPos) const
Definition: docdesc.cxx:946
void KillPams()
Definition: crsrsh.cxx:1022
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:1571
SwNode & GetNode(bool bPoint=true) const
Definition: pam.hxx:223
void Right(const tools::Long nRight)
Definition: swrect.hxx:202
static SwField * GetFieldAtCursor(const SwPaM *pCursor, const bool bIncludeInputFieldAtStart)
Definition: crstrvl.cxx:916
SwShellCursor * m_pCurrentCursor
current cursor
Definition: crsrsh.hxx:176
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:2134
bool IsInProtectTable(bool bMove=false, bool bChgCursor=true)
Definition: swcrsr.cxx:568
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:35
const SwTableBox * GetTableBox(const OUString &rName, const bool bPerformValidCheck=false) const
Definition: swtable.cxx:1336
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:1352
static SwContentNode * GetContentNode(SwDoc &rDoc, SwNodeIndex &rIdx, bool bNext)
Definition: fltshell.cxx:53
const SwRangeRedline * SelNextRedline()
Definition: crstrvl.cxx:2217
check overlapping PaMs
Definition: crsrsh.hxx:155
void Left(const tools::Long nLeft)
Definition: swrect.hxx:197
SwNodeIndex nNode
Definition: pam.hxx:37
bool IsTableMode() const
Definition: crsrsh.hxx:643
keep Up/Down on columns
Definition: crsrsh.hxx:153
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
OString strip(std::string_view rIn, char c)
sal_uInt16 char char * pDesc
SwShellCursor * getShellCursor(bool bBlock)
Delivers the current shell cursor.
Definition: crsrsh.cxx:3039
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:46
size_type FindPrevOfSeqNo(size_type nSttPos) const
Definition: docredln.cxx:690
const SwRect & getFramePrintArea() const
Definition: frame.hxx:181
Pos1 is as large as Pos2.
const SfxPoolItem * pAttr
Definition: crsrsh.hxx:97
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:2346
Pos1 completely contained in Pos2.
SwContentFrame * getLayoutFrame(const SwRootFrame *, const SwPosition *pPos=nullptr, std::pair< Point, bool > const *pViewPosAndCalcFrame=nullptr) const
Definition: node.cxx:1213
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:647
virtual bool IsSelOvr(SwCursorSelOverFlags eFlags=SwCursorSelOverFlags::CheckNodeSection|SwCursorSelOverFlags::Toggle|SwCursorSelOverFlags::ChangePos)
Definition: swcrsr.cxx:226
Definition: doc.hxx:188
static SwContentNode * GoPrevSection(SwNodeIndex *, bool bSkipHidden=true, bool bSkipProtect=true)
Definition: nodes.cxx:1968
TElementType * Next()
Definition: calbck.hxx:365
bool m_bSetInReadOnly
ReadOnly areas may be entered.
Definition: crstate.hxx:148
virtual void MakeSelVisible()
show the current selected "object"
Definition: crsrsh.cxx:3075
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:171
IDocumentMarkAccess * getIDocumentMarkAccess()
Definition: docbm.cxx:1790
IDocumentUndoRedo & GetIDocumentUndoRedo()
Definition: doc.cxx:144
virtual bool InsertPoolItem(const SwPaM &rRg, const SfxPoolItem &, const SetAttrMode nFlags=SetAttrMode::DEFAULT, SwRootFrame const *pLayout=nullptr, SwTextAttr **ppNewTextAttr=nullptr)=0
Insert an attribute.
virtual void Calc(vcl::RenderContext *pRenderContext) const
Definition: trvlfrm.cxx:1788
SwCharFormatsBase::size_type size_type
Definition: charformats.hxx:63
bool IsCellFrame() const
Definition: frame.hxx:1227
Of course Writer needs its own rectangles.
Definition: swrect.hxx:34
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:1691
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:203
void CalcStartEnd(sal_uLong nNdIdx, sal_Int32 &rStart, sal_Int32 &rEnd) const
Calculates the intersection with text node number nNdIdx.
Definition: docredln.cxx:1333
The root element of a Writer document layout.
Definition: rootfrm.hxx:82
const SwFrameFormats * GetSpzFrameFormats() const
Definition: doc.hxx:744
int GetAttrOutlineLevel() const
Returns outline level of this text node.
Definition: ndtxt.cxx:3983
bool HasSelection() const
Does the current cursor create a selection?
Definition: crsrsh.cxx:2518
void GatherFields(std::vector< SwFormatField * > &rvFormatFields, bool bCollectOnlyInDocNodes=true) const
Definition: fldbas.cxx:208
Array of Undo-history.
Definition: docary.hxx:192
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:343
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:180
void NormalizePam(bool bPointFirst=true)
Ensure point and mark of the current PaM are in a specific order.
Definition: crsrsh.cxx:970
const SwTextField * GetTextField() const
Definition: fmtfld.hxx:128
SwSectionNode * GetSectionNode()
Definition: section.cxx:952
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:1085
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:926
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:102
Pos2 completely contained in Pos1.
only for debugging
OUString sStr
Definition: crsrsh.hxx:104
const SwTable & GetTable() const
Definition: node.hxx:499
SwFillMode
Definition: crstate.hxx:28
union SwContentAtPos::@24 aFnd
SwDoc * GetDoc() const
Definition: viewsh.hxx:282
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:2455
const IDocumentRedlineAccess & getIDocumentRedlineAccess() const
Provides access to the document redline interface.
Definition: viewsh.cxx:2718
size_type size() const
constexpr TypedWhichId< SwFormatFootnote > RES_TXTATR_FTN(58)
void SetBodyPos(const SwContentFrame &rFrame)
Definition: docfld.cxx:196
SwPaM * GetNext()
Definition: pam.hxx:264
void PtrToBoxNm(const SwTable *pTable)
create from the internal formula (for CORE) the external formula (for UI)
Definition: cellfml.cxx:580
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:100
SwNode & GetEndOfContent() const
Regular ContentSection (i.e. the BodyText).
Definition: ndarr.hxx:160
bool HasClickHdl() const
Does the field possess an action on its ClickHandler? (e.g. INetFields, ...).
Definition: fldbas.cxx:393
SwShellCursor * GetCursor_()
Definition: crsrsh.hxx:328
bool SelectText(const sal_Int32 nStart, const sal_Int32 nEnd)
Definition: crstrvl.cxx:1969
const OUString & GetAlternativeText() const
Definition: tox.hxx:570
bool IsContentNode() const
Definition: node.hxx:629
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:613
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
const SwTableNode * IsCursorInTable() const
Definition: crsrsh.hxx:886
bool SetShadowCursorPos(const Point &rPt, SwFillMode eFillMode)
Definition: crstrvl.cxx:2076
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:2048
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:1231
Point LogicToPixel(const Point &rLogicPt) const
static constexpr auto npos
Definition: ndarr.hxx:78
SwPaM * CreateCursor()
delete the current cursor and make the following into the current
Definition: crsrsh.cxx:124
int i
bool GoInNode(SwPaM &rPam, SwMoveFnCollection const &fnMove)
Definition: pam.cxx:961
const SwField * pField
Definition: crsrsh.hxx:96
const SwFrame * GetLastLower() const
Definition: findfrm.cxx:1831
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:67
SwIndex & Assign(SwIndexReg *, sal_Int32)
Definition: index.cxx:206
const SwPageDesc & GetPageDesc(const size_t i) const
Definition: doc.hxx:881
SwPageFrame * FindPageFrame()
Definition: frame.hxx:681
const SwRangeRedline * SelPrevRedline()
Definition: crstrvl.cxx:2245
bool ActionPend() const
Definition: viewsh.hxx:196
TElementType * First()
Definition: calbck.hxx:357
SwPageDesc * GetPageDesc()
Definition: pagefrm.hxx:143
SwContentNode * GetContentNode()
Definition: node.hxx:616
vector_type::size_type size_type
Definition: docary.hxx:223
SwFieldIds
Definition: fldbas.hxx:44
bool GotoINetAttr(const SwTextINetFormat &rAttr)
Definition: crstrvl.cxx:2022
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:679
Marks a character position inside a document model node.
Definition: index.hxx:33
size_t size() const
Definition: docary.hxx:88
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:1266
SwWrtShell * GetWrtShell()
Access to the SwWrtShell belonging to SwView.
Definition: docsh.hxx:224
const SwFlyFrameFormat * GetFlyFormat() const
Definition: docfld.hxx:96
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:1091
Marks a node in the document model.
Definition: ndindex.hxx:31
SwFrameFormat * GetFrameFormat()
Definition: swtable.hxx:444
bool IsEndNode() const
Definition: node.hxx:633
const SwOutlineNodes & GetOutLineNds() const
Array of all OutlineNodes.
Definition: ndarr.hxx:228
SwNodes & GetNodes()
Node is in which nodes-array/doc?
Definition: node.hxx:694
T static_txtattr_cast(S *s)
Definition: txatbase.hxx:241
SwContentNode * pNode
Definition: crsrsh.hxx:99
ring_container GetRingContainer()
const_iterator end() const
SwTextField * GetFieldTextAttrAt(const sal_Int32 nIndex, const bool bIncludeInputFieldAtStart=false) const
Definition: ndtxt.cxx:1735
bool SelectTextAttr(sal_uInt16 nWhich, bool bExpand, const SwTextAttr *pAttr=nullptr)
Definition: crstrvl.cxx:1993
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:1156
tuple index
bool empty() const
void SetAdjust(const SvxAdjust eType)
bool IsInProtectSect() const
is the node in a protected section?
Definition: crstrvl.cxx:1901
const SwTextNode * GetpTextNode() const
Definition: txtinet.hxx:45
SwStartNode * GetStartNode()
Definition: node.hxx:592
void GotoTOXMarkBase()
jump to index of TOXMark
Definition: crstrvl.cxx:370
const SwTextAttr * pFndTextAttr
Definition: crsrsh.hxx:105
A page of the document layout.
Definition: pagefrm.hxx:57
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:2273
static sal_Int32 EndOfInputFieldAtPos(const SwPosition &rPos)
Definition: crstrvl.cxx:981
const SwPosition * Start() const
Definition: pam.hxx:212
constexpr sal_uInt16 POOLATTR_END(RES_UNKNOWNATR_END)
bool Contains(const Point &rPOINT) const
Definition: swrect.hxx:356
Point Center() const
Definition: swrect.hxx:338
tools::Long GetUpDownX() const
Definition: crsrsh.hxx:347
constexpr Point Center() const
SwTextNode * GetParaPropsNode(SwRootFrame const &rLayout, SwNodeIndex const &rNode)
Definition: txtfrm.cxx:328
SwFieldType * GetTyp() const
Definition: fldbas.hxx:392
bool IsInProtectSect() const
Is node in a protected area?
Definition: node.cxx:416
size_t size() const
Definition: charformats.hxx:71
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
void StartAction()
Definition: crsrsh.cxx:227
DEFAULT: (Start <= nIndex < End)
Definition: ndtxt.hxx:370
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:962
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:683
IDocumentUndoRedo const & GetIDocumentUndoRedo() const
Provides access to the document undo/redo interface.
Definition: viewsh.cxx:2728
SwFrameFormat & GetMaster()
Definition: pagedesc.hxx:238
sal_uLong EndOfSectionIndex() const
Definition: node.hxx:678
void Bottom(const tools::Long nBottom)
Definition: swrect.hxx:211
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
SwCursor * GetCursor(bool bMakeTableCursor=true) const
Return pointer to the current shell cursor.
Definition: crsrsh.cxx:195
const SwStartNode * GetSttNd() const
Definition: swtable.hxx:458
SwFieldIds Which() const
ResId.
Definition: fldbas.cxx:245
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:3336
const SwCharFormats * GetCharFormats() const
Definition: doc.hxx:740
general base class for all free-flowing frames
Definition: flyfrm.hxx:78
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:2447
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:338
static sal_Int32 StartOfInputFieldAtPos(const SwPosition &rPos)
Definition: crstrvl.cxx:973
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
void Differentiate(const SfxItemSet &rSet)
SwNodes & GetNodes()
Definition: doc.hxx:409
SAL_DLLPRIVATE void MoveCursorToNum()
Definition: crstrvl.cxx:80
constexpr TypedWhichId< SwTableBoxFormula > RES_BOXATR_FORMULA(151)
const SwTextINetFormat * GetINetFormat() const
Definition: docfld.hxx:94
static bool PosInsideInputField(const SwPosition &rPos)
Definition: crstrvl.cxx:957
const SwPosition * End() const
Definition: pam.hxx:217
bool IsRightToLeft() const
Definition: frame.hxx:988
void Top(const tools::Long nTop)
Definition: swrect.hxx:206
RedlineType GetType(sal_uInt16 nPos=0) const
Definition: docredln.cxx:1840
const sal_Int32 * End() const
Definition: txatbase.hxx:152
SwTableBox is one table cell in the document model.
Definition: swtable.hxx:405
const SwFormatINetFormat * FindINetAttr(std::u16string_view rName) const
Definition: crstrvl.cxx:2043
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:1615
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:154
bool IsParaPropsNode(SwRootFrame const &rLayout, SwTextNode const &rNode)
Definition: txtfrm.cxx:311
void MakeOutlineSel(SwOutlineNodes::size_type nSttPos, SwOutlineNodes::size_type nEndPos, bool bWithChildren, bool bKillPams=true)
Definition: crstrvl.cxx:1185
Header, for PageFormats Client of FrameFormat describing the header.
Definition: fmthdft.hxx:33
void ClearMark()
Definition: crsrsh.cxx:939
static bool GotoPrevNum(SwPosition &, SwRootFrame const *pLayout, bool bOverUpper=true)
Definition: docnum.cxx:1701
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:98
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
constexpr sal_Int32 COMPLETE_STRING
Definition: swtypes.hxx:58
const SfxPoolItem & GetAttr() const
Definition: txatbase.hxx:163
bool IsVertical() const
Definition: frame.hxx:974
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
SwContentFrame * FindContentFrame(const SwDoc &rDoc, const SwRootFrame &rLayout) const
Definition: tox.hxx:186
bool IsDocNodes() const
Is the NodesArray the regular one of Doc? (and not the UndoNds, ...) Implementation in doc...
Definition: nodes.cxx:2327
bool EndOfSection(bool bSelect=false)
Definition: move.cxx:314
size_t size() const
void GetPosOfContent(SwPosition &rPos) const
Definition: docfld.cxx:178
make visible in spite of Readonly
Definition: crsrsh.hxx:156
const SwTextTOXMark * GetTextTOXMark() const
Definition: tox.hxx:160
SwFrameFormatsBase::size_type size_type
bool GetContentAtPos(const Point &rPt, SwContentAtPos &rContentAtPos, bool bSetCursor=false, SwRect *pFieldRect=nullptr)
Definition: crstrvl.cxx:1273
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
static SwNode * GetStartNode(SwOutlineNodes const *pOutlNds, int nOutlineLevel, SwOutlineNodes::size_type *nOutl)
Definition: docglbl.cxx:89
virtual const SwRedlineTable & GetRedlineTable() const =0
SwRect m_aCharRect
Char-SRectangle on which the cursor is located.
Definition: crsrsh.hxx:165
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:722
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:158
SwRootFrame * GetLayout() const
Definition: viewsh.cxx:2116
const SwPostItField * GetPostItFieldAtCursor() const
Definition: crstrvl.cxx:1878
SwSectionFormats & GetSections()
Definition: doc.hxx:1338
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:893
bool IsTextNode() const
Definition: node.hxx:637
bool GotoOutline(const OUString &rName)
Definition: crstrvl.cxx:1006
static constexpr size_type npos
Definition: docary.hxx:224
void GotoNextNum()
go to next/previous point on the same level
Definition: crstrvl.cxx:116
SwFieldIds Which() const
Definition: fldbas.hxx:272
const SwTextNode & GetTextNode() const
Definition: txtftn.hxx:70
aStr
SwContentNode * GoNext(SwNodeIndex *) const
Definition: nodes.cxx:1293
bool GotoFormatField(const SwFormatField &rField)
Definition: crstrvl.cxx:852
SdrObject * FindSdrObject()
Definition: frmfmt.hxx:140
bool IsFooterFrame() const
Definition: frame.hxx:1195
sal_uInt16 Which() const
constexpr TypedWhichId< SvxAdjustItem > RES_PARATR_ADJUST(64)
Pos1 overlaps Pos2 at the beginning.
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:1242
fill with spaces
std::vector< std::unique_ptr< SetGetExpField > >::const_iterator const_iterator
const SfxPoolItem * GetCurItem() const
SwTextFormatColl & GetNextTextFormatColl() const
Definition: fmtcol.hxx:104
const SwAttrPool & GetAttrPool() const
Definition: doc.hxx:1319
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:2344
const SwFormatINetFormat & GetINetFormat() const
Definition: txatbase.hxx:228
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:856
bool GotoNextOutline()
jump to next node with outline num.
Definition: crstrvl.cxx:1025
bool IsHeaderFrame() const
Definition: frame.hxx:1191
SwFlyFrame * GetFrame(const Point *pDocPos=nullptr) const
Definition: atrfrm.cxx:3125
void EndAction(const bool bIdleEnd=false)
Definition: crsrsh.cxx:244
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:878
Base class of the Writer document model elements.
Definition: node.hxx:80
SwTextFormatColl * GetTextColl() const
Definition: ndtxt.hxx:850
OStringBuffer & padToLength(OStringBuffer &rBuffer, sal_Int32 nLength, char cFill= '\0')
bool CursorInsideInputField() const
Definition: crstrvl.cxx:947
typedef void(CALLTYPE *GetFuncDataPtr)(sal_uInt16 &nNo