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