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  SET_CURR_SHELL( 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  SET_CURR_SHELL( 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  SET_CURR_SHELL( 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  SET_CURR_SHELL( 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  bool bRet = false;
370 
371  SwTOXMarks aMarks;
372  sal_uInt16 nCnt = SwDoc::GetCurTOXMark( *m_pCurrentCursor->GetPoint(), aMarks );
373  if( nCnt )
374  {
375  // Take the 1. and get the index type. Search in its dependency list
376  // for the actual index
377  const SwTOXType* pType = aMarks[0]->GetTOXType();
378  SwIterator<SwTOXBase,SwTOXType> aIter( *pType );
379 
380  for( SwTOXBase* pTOX = aIter.First(); pTOX; pTOX = aIter.Next() )
381  {
382  auto pTOXBaseSection = dynamic_cast<const SwTOXBaseSection*>( pTOX);
383  if( !pTOXBaseSection )
384  continue;
385  auto pSectFormat = pTOXBaseSection->GetFormat();
386  if( !pSectFormat )
387  continue;
388  const SwSectionNode* pSectNd = pSectFormat->GetSectionNode();
389  if (!pSectNd)
390  continue;
391  SwNodeIndex aIdx( *pSectNd, 1 );
392  SwContentNode* pCNd = aIdx.GetNode().GetContentNode();
393  if( !pCNd )
394  pCNd = GetDoc()->GetNodes().GoNext( &aIdx );
395  if( !pCNd )
396  continue;
397  if( pCNd->EndOfSectionIndex() >= pSectNd->EndOfSectionIndex() )
398  continue;
399  const SwContentFrame* pCFrame = pCNd->getLayoutFrame( GetLayout() );
400  if( pCFrame && ( IsReadOnlyAvailable() || !pCFrame->IsProtected() ) )
401  {
402  SwCallLink aLk( *this ); // watch Cursor-Moves
403  SwCursorSaveState aSaveState( *m_pCurrentCursor );
404  assert(pCFrame->IsTextFrame());
406  static_cast<SwTextFrame const*>(pCFrame)
407  ->MapViewToModelPos(TextFrameIndex(0));
408  bRet = !m_pCurrentCursor->IsInProtectTable() &&
410  if( bRet )
412  break;
413  }
414  }
415  }
416 }
417 
420 bool SwCursorShell::GotoNxtPrvTableFormula( bool bNext, bool bOnlyErrors )
421 {
422  SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::Empty );
423 
424  if( IsTableMode() )
425  return false;
426 
427  bool bFnd = false;
428  SwPosition aOldPos = *m_pCurrentCursor->GetPoint();
430 
431  Point aPt;
432  SwPosition aFndPos( GetDoc()->GetNodes().GetEndOfContent() );
433  if( !bNext )
434  aFndPos.nNode = 0;
435  SetGetExpField aFndGEF( aFndPos ), aCurGEF( rPos );
436 
437  {
438  const SwNode* pSttNd = rPos.nNode.GetNode().FindTableBoxStartNode();
439  if( pSttNd )
440  {
441  const SwTableBox* pTBox = pSttNd->FindTableNode()->GetTable().
442  GetTableBox( pSttNd->GetIndex() );
443  if( pTBox )
444  aCurGEF = SetGetExpField( *pTBox );
445  }
446  }
447 
448  if( rPos.nNode < GetDoc()->GetNodes().GetEndOfExtras() )
449  {
450  // also at collection use only the first frame
451  std::pair<Point, bool> const tmp(aPt, false);
453  &rPos, &tmp) );
454  }
455  {
456  sal_uInt32 nMaxItems = GetDoc()->GetAttrPool().GetItemCount2( RES_BOXATR_FORMULA );
457 
458  if( nMaxItems > 0 )
459  {
460  sal_uInt8 nMaxDo = 2;
461  do {
462  for (const SfxPoolItem* pItem : GetDoc()->GetAttrPool().GetItemSurrogates(RES_BOXATR_FORMULA))
463  {
464  const SwTableBox* pTBox;
465  auto pFormulaItem = dynamic_cast<const SwTableBoxFormula*>(pItem);
466  if( !pFormulaItem )
467  continue;
468  pTBox = pFormulaItem->GetTableBox();
469  if( pTBox &&
470  pTBox->GetSttNd() &&
471  pTBox->GetSttNd()->GetNodes().IsDocNodes() &&
472  ( !bOnlyErrors ||
473  !pFormulaItem->HasValidBoxes() ) )
474  {
475  const SwContentFrame* pCFrame;
476  SwNodeIndex aIdx( *pTBox->GetSttNd() );
477  const SwContentNode* pCNd = GetDoc()->GetNodes().GoNext( &aIdx );
478  std::pair<Point, bool> const tmp(aPt, false);
479  if (pCNd)
480  {
481  pCFrame = pCNd->getLayoutFrame(GetLayout(), nullptr, &tmp);
482  if (pCFrame && (IsReadOnlyAvailable() || !pCFrame->IsProtected() ))
483  {
484  SetGetExpField aCmp( *pTBox );
485  aCmp.SetBodyPos( *pCFrame );
486 
487  if( bNext ? ( aCurGEF < aCmp && aCmp < aFndGEF )
488  : ( aCmp < aCurGEF && aFndGEF < aCmp ))
489  {
490  aFndGEF = aCmp;
491  bFnd = true;
492  }
493  }
494  }
495  }
496  }
497  if( !bFnd )
498  {
499  if( bNext )
500  {
501  rPos.nNode = 0;
502  rPos.nContent = 0;
503  aCurGEF = SetGetExpField( rPos );
504  SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::EndWrapped );
505  }
506  else
507  {
508  aCurGEF = SetGetExpField( SwPosition( GetDoc()->GetNodes().GetEndOfContent() ) );
509  SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::StartWrapped );
510  }
511  }
512  } while( !bFnd && --nMaxDo );
513  }
514  }
515 
516  if( bFnd )
517  {
518  SET_CURR_SHELL( this );
519  SwCallLink aLk( *this ); // watch Cursor-Moves
520  SwCursorSaveState aSaveState( *m_pCurrentCursor );
521 
522  aFndGEF.GetPosOfContent( rPos );
524 
525  bFnd = !m_pCurrentCursor->IsSelOvr();
526  if( bFnd )
529  }
530  else
531  {
532  rPos = aOldPos;
533  SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::NavElementNotFound );
534  }
535 
536  return bFnd;
537 }
538 
541 {
542  SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::Empty );
543 
544  if( IsTableMode() )
545  return false;
546 
547  bool bFnd = false;
549 
550  Point aPt;
551  SwPosition aFndPos( GetDoc()->GetNodes().GetEndOfContent() );
552  if( !bNext )
553  aFndPos.nNode = 0;
554  SetGetExpField aFndGEF( aFndPos ), aCurGEF( rPos );
555 
556  if( rPos.nNode.GetIndex() < GetDoc()->GetNodes().GetEndOfExtras().GetIndex() )
557  {
558  // also at collection use only the first frame
559  std::pair<Point, bool> const tmp(aPt, false);
560  aCurGEF.SetBodyPos( *rPos.nNode.GetNode().
561  GetContentNode()->getLayoutFrame(GetLayout(), &rPos, &tmp));
562  }
563 
564  {
565  const SwTextNode* pTextNd;
566  const SwTextTOXMark* pTextTOX;
567  sal_uInt32 nMaxItems = GetDoc()->GetAttrPool().GetItemCount2( RES_TXTATR_TOXMARK );
568 
569  if( nMaxItems > 0 )
570  {
571  do {
572  for (const SfxPoolItem* pItem : GetDoc()->GetAttrPool().GetItemSurrogates(RES_TXTATR_TOXMARK))
573  {
574  auto pToxMarkItem = dynamic_cast<const SwTOXMark*>(pItem);
575  if( !pToxMarkItem )
576  continue;
577  pTextTOX = pToxMarkItem->GetTextTOXMark();
578  if( !pTextTOX )
579  continue;
580  pTextNd = &pTextTOX->GetTextNode();
581  if( !pTextNd->GetNodes().IsDocNodes() )
582  continue;
583  std::pair<Point, bool> const tmp(aPt, false);
584  const SwContentFrame* pCFrame = pTextNd->getLayoutFrame(GetLayout(), nullptr, &tmp);
585  if( pCFrame && ( IsReadOnlyAvailable() || !pCFrame->IsProtected() ))
586  {
587  SwNodeIndex aNdIndex( *pTextNd ); // UNIX needs this object
588  SetGetExpField aCmp( aNdIndex, *pTextTOX );
589  aCmp.SetBodyPos( *pCFrame );
590 
591  if( bNext ? ( aCurGEF < aCmp && aCmp < aFndGEF )
592  : ( aCmp < aCurGEF && aFndGEF < aCmp ))
593  {
594  aFndGEF = aCmp;
595  bFnd = true;
596  }
597  }
598  }
599  if( !bFnd )
600  {
601  if ( bNext )
602  {
603  rPos.nNode = 0;
604  rPos.nContent = 0;
605  aCurGEF = SetGetExpField( rPos );
606  SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::EndWrapped );
607  }
608  else
609  {
610  aCurGEF = SetGetExpField( SwPosition( GetDoc()->GetNodes().GetEndOfContent() ) );
611  SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::StartWrapped );
612  }
613  }
614  } while ( !bFnd );
615  }
616  else
617  SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::NavElementNotFound );
618  }
619 
620  if( bFnd )
621  {
622  SET_CURR_SHELL( this );
623  SwCallLink aLk( *this ); // watch Cursor-Moves
624  SwCursorSaveState aSaveState( *m_pCurrentCursor );
625 
626  aFndGEF.GetPosOfContent( rPos );
627 
628  bFnd = !m_pCurrentCursor->IsSelOvr();
629  if( bFnd )
632  }
633  return bFnd;
634 }
635 
638  SwTOXSearch eDir )
639 {
640  SET_CURR_SHELL( this );
641  SwCallLink aLk( *this ); // watch Cursor-Moves
642  SwCursorSaveState aSaveState( *m_pCurrentCursor );
643 
644  const SwTOXMark& rNewMark = GetDoc()->GotoTOXMark( rStart, eDir,
646  // set position
647  SwPosition& rPos = *GetCursor()->GetPoint();
648  rPos.nNode = rNewMark.GetTextTOXMark()->GetTextNode();
649  rPos.nContent.Assign( rPos.nNode.GetNode().GetContentNode(),
650  rNewMark.GetTextTOXMark()->GetStart() );
651 
652  if( !m_pCurrentCursor->IsSelOvr() )
655 
656  return rNewMark;
657 }
658 
660 static void lcl_MakeFieldLst(
661  SetGetExpFields& rLst,
662  const SwFieldType& rFieldType,
663  const bool bInReadOnly,
664  const bool bChkInpFlag = false )
665 {
666  // always search the 1. frame
667  Point aPt;
668  std::vector<SwFormatField*> vFields;
669  rFieldType.GatherFields(vFields, false);
670  for(SwFormatField* pFormatField: vFields)
671  {
672  SwTextField* pTextField = pFormatField->GetTextField();
673  if ( pTextField != nullptr
674  && ( !bChkInpFlag
675  || static_cast<const SwSetExpField*>(pTextField->GetFormatField().GetField())->GetInputFlag() ) )
676  {
677  const SwTextNode& rTextNode = pTextField->GetTextNode();
678  std::pair<Point, bool> const tmp(aPt, false);
679  const SwContentFrame* pCFrame =
680  rTextNode.getLayoutFrame(
682  nullptr, &tmp);
683  if ( pCFrame != nullptr
684  && ( bInReadOnly || !pCFrame->IsProtected() ) )
685  {
686  std::unique_ptr<SetGetExpField> pNew(new SetGetExpField( SwNodeIndex( rTextNode ), pTextField ));
687  pNew->SetBodyPos( *pCFrame );
688  rLst.insert( std::move(pNew) );
689  }
690  }
691  }
692 }
693 
695 lcl_FindField(bool & o_rFound, SetGetExpFields const& rSrtLst,
696  SwRootFrame const *const pLayout, SwTextNode *const pTextNode,
697  SwTextField const *const pTextField, SwPosition const& rPos,
698  sal_Int32 const nContentOffset)
699 {
700  std::unique_ptr<SetGetExpField> pSrch;
701  std::unique_ptr<SwIndex> pIndex;
702  if (-1 == nContentOffset)
703  {
704  pSrch.reset(new SetGetExpField(rPos.nNode, pTextField, &rPos.nContent));
705  }
706  else
707  {
708  pIndex.reset(new SwIndex(rPos.nNode.GetNode().GetContentNode(), nContentOffset));
709  pSrch.reset(new SetGetExpField(rPos.nNode, pTextField, pIndex.get()));
710  }
711 
712  if (rPos.nNode.GetIndex() < pTextNode->GetNodes().GetEndOfExtras().GetIndex())
713  {
714  // also at collection use only the first frame
715  Point aPt;
716  std::pair<Point, bool> const tmp(aPt, false);
717  pSrch->SetBodyPos(*pTextNode->getLayoutFrame(pLayout, &rPos, &tmp));
718  }
719 
720  SetGetExpFields::const_iterator it = rSrtLst.lower_bound(pSrch.get());
721 
722  o_rFound = (it != rSrtLst.end()) && (**it == *pSrch);
723  return it;
724 }
725 
727  const SwFieldType* pFieldType,
728  const bool bNext,
729  const SwFieldIds nResType,
730  const bool bAddSetExpressionFieldsToInputFields )
731 {
732  // sorted list of all fields
733  SetGetExpFields aSrtLst;
734 
735  if ( pFieldType )
736  {
737  if( SwFieldIds::Input != pFieldType->Which() && !pFieldType->HasWriterListeners() )
738  {
739  return false;
740  }
741 
742  // found Modify object, add all fields to array
743  ::lcl_MakeFieldLst( aSrtLst, *pFieldType, IsReadOnlyAvailable() );
744 
745  if( SwFieldIds::Input == pFieldType->Which() && bAddSetExpressionFieldsToInputFields )
746  {
747  // there are hidden input fields in the set exp. fields
748  const SwFieldTypes& rFieldTypes = *mxDoc->getIDocumentFieldsAccess().GetFieldTypes();
749  const size_t nSize = rFieldTypes.size();
750  for( size_t i=0; i < nSize; ++i )
751  {
752  pFieldType = rFieldTypes[ i ].get();
753  if ( SwFieldIds::SetExp == pFieldType->Which() )
754  {
755  ::lcl_MakeFieldLst( aSrtLst, *pFieldType, IsReadOnlyAvailable(), true );
756  }
757  }
758  }
759  }
760  else
761  {
762  const SwFieldTypes& rFieldTypes = *mxDoc->getIDocumentFieldsAccess().GetFieldTypes();
763  const size_t nSize = rFieldTypes.size();
764  for( size_t i=0; i < nSize; ++i )
765  {
766  pFieldType = rFieldTypes[ i ].get();
767  if( nResType == pFieldType->Which() )
768  {
769  ::lcl_MakeFieldLst( aSrtLst, *pFieldType, IsReadOnlyAvailable() );
770  }
771  }
772  }
773 
774  // found no fields?
775  if( aSrtLst.empty() )
776  return false;
777 
779  SwCursor* pCursor = getShellCursor( true );
780  {
781  // (1998): Always use field for search so that the right one is found as
782  // well some are in frames that are anchored to a paragraph that has a
783  // field
784  const SwPosition& rPos = *pCursor->GetPoint();
785 
786  SwTextNode* pTNd = rPos.nNode.GetNode().GetTextNode();
787  OSL_ENSURE( pTNd, "No ContentNode" );
788 
789  SwTextField * pTextField = pTNd->GetFieldTextAttrAt( rPos.nContent.GetIndex(), true );
790  const bool bDelField = ( pTextField == nullptr );
791  sal_Int32 nContentOffset = -1;
792 
793  if( bDelField )
794  {
795  // create dummy for the search
796  SwFormatField* pFormatField = new SwFormatField( SwDateTimeField(
797  static_cast<SwDateTimeFieldType*>(mxDoc->getIDocumentFieldsAccess().GetSysFieldType( SwFieldIds::DateTime ) ) ) );
798 
799  pTextField = new SwTextField( *pFormatField, rPos.nContent.GetIndex(),
800  mxDoc->IsClipBoard() );
801  pTextField->ChgTextNode( pTNd );
802  }
803  else
804  {
805  // the cursor might be anywhere inside the input field,
806  // but we will be searching for the field start
807  if (pTextField->Which() == RES_TXTATR_INPUTFIELD
808  && rPos.nContent.GetIndex() != pTextField->GetStart())
809  nContentOffset = pTextField->GetStart();
810  }
811  bool isSrch;
812  it = lcl_FindField(isSrch, aSrtLst,
813  GetLayout(), pTNd, pTextField, rPos, nContentOffset);
814 
815  if( bDelField )
816  {
817  auto const pFormat(static_cast<SwFormatField*>(&pTextField->GetAttr()));
818  delete pTextField;
819  delete pFormat;
820  }
821 
822  if( it != aSrtLst.end() && isSrch ) // found
823  {
824  if( bNext )
825  {
826  if( ++it == aSrtLst.end() )
827  return false; // already at the end
828  }
829  else
830  {
831  if( it == aSrtLst.begin() )
832  return false; // no more steps backward possible
833  --it;
834  }
835  }
836  else // not found
837  {
838  if( bNext )
839  {
840  if( it == aSrtLst.end() )
841  return false;
842  }
843  else
844  {
845  if( it == aSrtLst.begin() )
846  return false; // no more steps backward possible
847  --it;
848  }
849  }
850  }
851  const SetGetExpField& rFnd = **it;
852 
853  SET_CURR_SHELL( this );
854  SwCallLink aLk( *this ); // watch Cursor-Moves
855  SwCursorSaveState aSaveState( *pCursor );
856 
857  rFnd.GetPosOfContent( *pCursor->GetPoint() );
860  if( bRet )
862  return bRet;
863 }
864 
866 {
867  bool bRet = false;
868  SwTextField const*const pTextField(rField.GetTextField());
869  if (pTextField
870  && (!GetLayout()->IsHideRedlines()
872  GetDoc()->getIDocumentRedlineAccess(), *pTextField)))
873  {
874  SET_CURR_SHELL( this );
875  SwCallLink aLk( *this ); // watch Cursor-Moves
876 
877  SwCursor* pCursor = getShellCursor( true );
878  SwCursorSaveState aSaveState( *pCursor );
879 
880  SwTextNode* pTNd = pTextField->GetpTextNode();
881  pCursor->GetPoint()->nNode = *pTNd;
882  pCursor->GetPoint()->nContent.Assign( pTNd, pTextField->GetStart() );
883 
884  bRet = !pCursor->IsSelOvr();
885  if( bRet )
887  }
888  return bRet;
889 }
890 
892  const SwPosition* pPos,
893  const bool bIncludeInputFieldAtStart )
894 {
895  SwTextField* pTextField = nullptr;
896 
897  SwTextNode * const pNode = pPos->nNode.GetNode().GetTextNode();
898  if ( pNode != nullptr )
899  {
900  pTextField = pNode->GetFieldTextAttrAt( pPos->nContent.GetIndex(), bIncludeInputFieldAtStart );
901  }
902 
903  return pTextField;
904 }
905 
907  const SwPaM* pCursor,
908  const bool bIncludeInputFieldAtStart )
909 {
910  SwTextField* pFieldAtCursor = nullptr;
911 
912  SwTextField* pTextField = GetTextFieldAtPos( pCursor->Start(), bIncludeInputFieldAtStart );
913  if ( pTextField != nullptr
914  && pCursor->Start()->nNode == pCursor->End()->nNode )
915  {
916  const sal_Int32 nTextFieldLength =
917  pTextField->End() != nullptr
918  ? *(pTextField->End()) - pTextField->GetStart()
919  : 1;
920  if ( ( pCursor->End()->nContent.GetIndex() - pCursor->Start()->nContent.GetIndex() ) <= nTextFieldLength )
921  {
922  pFieldAtCursor = pTextField;
923  }
924  }
925 
926  return pFieldAtCursor;
927 }
928 
930  const SwPaM *const pCursor,
931  const bool bIncludeInputFieldAtStart)
932 {
933  SwTextField *const pField(GetTextFieldAtCursor(pCursor, bIncludeInputFieldAtStart));
934  return pField
935  ? const_cast<SwField*>(pField->GetFormatField().GetField())
936  : nullptr;
937 }
938 
939 SwField* SwCursorShell::GetCurField( const bool bIncludeInputFieldAtStart ) const
940 {
941  SwPaM* pCursor = GetCursor();
942  if ( pCursor->IsMultiSelection() )
943  {
944  // multi selection not handled.
945  return nullptr;
946  }
947 
948  SwField* pCurField = GetFieldAtCursor( pCursor, bIncludeInputFieldAtStart );
949  if ( pCurField != nullptr
950  && SwFieldIds::Table == pCurField->GetTyp()->Which() )
951  {
952  // table formula? convert internal name into external
953  const SwTableNode* pTableNd = IsCursorInTable();
954  static_cast<SwTableField*>(pCurField)->PtrToBoxNm( pTableNd ? &pTableNd->GetTable() : nullptr );
955  }
956 
957  return pCurField;
958 }
959 
961 {
962  for(SwPaM& rCursor : GetCursor()->GetRingContainer())
963  {
964  if (dynamic_cast<const SwTextInputField*>(GetTextFieldAtCursor(&rCursor, false)))
965  return true;
966  }
967  return false;
968 }
969 
971 {
972  return dynamic_cast<const SwTextInputField*>(GetTextFieldAtPos( &rPos, false )) != nullptr;
973 }
974 
975 bool SwCursorShell::DocPtInsideInputField( const Point& rDocPt ) const
976 {
977  SwPosition aPos( *(GetCursor()->Start()) );
978  Point aDocPt( rDocPt );
979  if ( GetLayout()->GetModelPositionForViewPoint( &aPos, aDocPt ) )
980  {
981  return PosInsideInputField( aPos );
982  }
983  return false;
984 }
985 
987 {
988  const SwTextInputField* pTextInputField = dynamic_cast<const SwTextInputField*>(GetTextFieldAtPos( &rPos, true ));
989  assert(pTextInputField != nullptr
990  && "<SwEditShell::StartOfInputFieldAtPos(..)> - no Input Field at given position");
991  return pTextInputField->GetStart();
992 }
993 
995 {
996  const SwTextInputField* pTextInputField = dynamic_cast<const SwTextInputField*>(GetTextFieldAtPos( &rPos, true ));
997  assert(pTextInputField != nullptr
998  && "<SwEditShell::EndOfInputFieldAtPos(..)> - no Input Field at given position");
999  return *(pTextInputField->End());
1000 }
1001 
1003 {
1004  SwCursor* pCursor = getShellCursor( true );
1005 
1006  SET_CURR_SHELL( this );
1007  SwCallLink aLk( *this ); // watch Cursor-Moves
1008  SwCursorSaveState aSaveState( *pCursor );
1009 
1010  const SwNodes& rNds = GetDoc()->GetNodes();
1011  SwTextNode* pTextNd = rNds.GetOutLineNds()[ nIdx ]->GetTextNode();
1012  pCursor->GetPoint()->nNode = *pTextNd;
1013  pCursor->GetPoint()->nContent.Assign( pTextNd, 0 );
1014 
1015  if( !pCursor->IsSelOvr() )
1017 }
1018 
1019 bool SwCursorShell::GotoOutline( const OUString& rName )
1020 {
1021  SwCursor* pCursor = getShellCursor( true );
1022 
1023  SET_CURR_SHELL( this );
1024  SwCallLink aLk( *this ); // watch Cursor-Moves
1025  SwCursorSaveState aSaveState( *pCursor );
1026 
1027  bool bRet = false;
1028  if (mxDoc->GotoOutline(*pCursor->GetPoint(), rName, GetLayout())
1029  && !pCursor->IsSelOvr())
1030  {
1032  bRet = true;
1033  }
1034  return bRet;
1035 }
1036 
1039 {
1040  const SwNodes& rNds = GetDoc()->GetNodes();
1041 
1042  if ( rNds.GetOutLineNds().empty() )
1043  {
1044  SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::NavElementNotFound );
1045  return false;
1046  }
1047 
1048  SwCursor* pCursor = getShellCursor( true );
1049  SwNode* pNd = &(pCursor->GetNode());
1051  bool bUseFirst = !rNds.GetOutLineNds().Seek_Entry( pNd, &nPos );
1052  SwOutlineNodes::size_type const nStartPos(nPos);
1053 
1054  do
1055  {
1056  if (!bUseFirst)
1057  {
1058  ++nPos;
1059  }
1060  if (rNds.GetOutLineNds().size() <= nPos)
1061  {
1062  nPos = 0;
1063  }
1064 
1065  if (bUseFirst)
1066  {
1067  bUseFirst = false;
1068  }
1069  else
1070  {
1071  if (nPos == nStartPos)
1072  {
1073  SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::NavElementNotFound );
1074  return false;
1075  }
1076  }
1077 
1078  pNd = rNds.GetOutLineNds()[ nPos ];
1079  }
1080  while (!sw::IsParaPropsNode(*GetLayout(), *pNd->GetTextNode()));
1081 
1082  if (nPos < nStartPos)
1083  {
1084  SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::EndWrapped );
1085  }
1086  else
1087  {
1088  SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::Empty );
1089  }
1090 
1091  SET_CURR_SHELL( this );
1092  SwCallLink aLk( *this ); // watch Cursor-Moves
1093  SwCursorSaveState aSaveState( *pCursor );
1094  pCursor->GetPoint()->nNode = *pNd;
1095  pCursor->GetPoint()->nContent.Assign( pNd->GetTextNode(), 0 );
1096 
1097  bool bRet = !pCursor->IsSelOvr();
1098  if( bRet )
1100  return bRet;
1101 }
1102 
1105 {
1106  const SwNodes& rNds = GetDoc()->GetNodes();
1107 
1108  if ( rNds.GetOutLineNds().empty() )
1109  {
1110  SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::NavElementNotFound );
1111  return false;
1112  }
1113 
1114  SwCursor* pCursor = getShellCursor( true );
1115  SwNode* pNd = &(pCursor->GetNode());
1117  bool bRet = false;
1118  (void)rNds.GetOutLineNds().Seek_Entry(pNd, &nPos);
1119  SwOutlineNodes::size_type const nStartPos(nPos);
1120 
1121  do
1122  {
1123  if (nPos == 0)
1124  {
1125  nPos = rNds.GetOutLineNds().size() - 1;
1126  }
1127  else
1128  {
1129  --nPos; // before
1130  }
1131  if (nPos == nStartPos)
1132  {
1133  pNd = nullptr;
1134  break;
1135  }
1136 
1137  pNd = rNds.GetOutLineNds()[ nPos ];
1138  }
1139  while (!sw::IsParaPropsNode(*GetLayout(), *pNd->GetTextNode()));
1140 
1141  if (pNd)
1142  {
1143  if (nStartPos < nPos)
1144  {
1145  SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::StartWrapped );
1146  }
1147  else
1148  {
1149  SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::Empty );
1150  }
1151  SET_CURR_SHELL( this );
1152  SwCallLink aLk( *this ); // watch Cursor-Moves
1153  SwCursorSaveState aSaveState( *pCursor );
1154  pCursor->GetPoint()->nNode = *pNd;
1155  pCursor->GetPoint()->nContent.Assign( pNd->GetTextNode(), 0 );
1156 
1157  bRet = !pCursor->IsSelOvr();
1158  if( bRet )
1160  }
1161  else
1162  {
1163  SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::NavElementNotFound );
1164  }
1165  return bRet;
1166 }
1167 
1170 {
1171  SwPaM* pCursor = getShellCursor( true );
1172  const SwNodes& rNds = GetDoc()->GetNodes();
1173 
1174  SwNode* pNd = &(pCursor->GetNode());
1176  if( rNds.GetOutLineNds().Seek_Entry( pNd, &nPos ))
1177  nPos++; // is at correct position; take next for while
1178 
1179  while( nPos-- ) // check the one in front of the current
1180  {
1181  pNd = rNds.GetOutLineNds()[ nPos ];
1182 
1183  if (sw::IsParaPropsNode(*GetLayout(), *pNd->GetTextNode())
1184  && pNd->GetTextNode()->GetAttrOutlineLevel()-1 <= nLevel)
1185  {
1186  return nPos;
1187  }
1188  }
1189  return SwOutlineNodes::npos; // no more left
1190 }
1191 
1193  bool bWithChildren , bool bKillPams)
1194 {
1195  const SwNodes& rNds = GetDoc()->GetNodes();
1196  const SwOutlineNodes& rOutlNds = rNds.GetOutLineNds();
1197  if( rOutlNds.empty() )
1198  return false;
1199 
1200  SET_CURR_SHELL( this );
1201  SwCallLink aLk( *this ); // watch Cursor-Moves
1202 
1203  if( nSttPos > nEndPos ) // parameters switched?
1204  {
1205  OSL_ENSURE( false, "Start > End for array access" );
1206  std::swap(nSttPos, nEndPos);
1207  }
1208 
1209  SwNode* pSttNd = rOutlNds[ nSttPos ];
1210  SwNode* pEndNd = rOutlNds[ nEndPos ];
1211 
1212  if( bWithChildren )
1213  {
1214  const int nLevel = pEndNd->GetTextNode()->GetAttrOutlineLevel()-1;
1215  for( ++nEndPos; nEndPos < rOutlNds.size(); ++nEndPos )
1216  {
1217  pEndNd = rOutlNds[ nEndPos ];
1218  const int nNxtLevel = pEndNd->GetTextNode()->GetAttrOutlineLevel()-1;
1219  if( nNxtLevel <= nLevel )
1220  break; // EndPos is now on the next one
1221  }
1222  }
1223  // if without children then set onto next one
1224  else if( ++nEndPos < rOutlNds.size() )
1225  pEndNd = rOutlNds[ nEndPos ];
1226 
1227  if( nEndPos == rOutlNds.size() ) // no end found
1228  pEndNd = &rNds.GetEndOfContent();
1229 
1230  if( bKillPams )
1231  KillPams();
1232 
1233  SwCursorSaveState aSaveState( *m_pCurrentCursor );
1234 
1235  // set end to the end of the previous content node
1236  m_pCurrentCursor->GetPoint()->nNode = *pSttNd;
1239  m_pCurrentCursor->GetPoint()->nNode = *pEndNd;
1240  m_pCurrentCursor->Move( fnMoveBackward, GoInNode ); // end of predecessor
1241 
1242  // and everything is already selected
1243  bool bRet = !m_pCurrentCursor->IsSelOvr();
1244  if( bRet )
1246  return bRet;
1247 }
1248 
1250 bool SwCursorShell::GotoRefMark( const OUString& rRefMark, sal_uInt16 nSubType,
1251  sal_uInt16 nSeqNo )
1252 {
1253  SET_CURR_SHELL( this );
1254  SwCallLink aLk( *this ); // watch Cursor-Moves
1255  SwCursorSaveState aSaveState( *m_pCurrentCursor );
1256 
1257  sal_Int32 nPos = -1;
1258  SwTextNode* pTextNd = SwGetRefFieldType::FindAnchor( GetDoc(), rRefMark,
1259  nSubType, nSeqNo, &nPos, nullptr, GetLayout());
1260  if( pTextNd && pTextNd->GetNodes().IsDocNodes() )
1261  {
1262  m_pCurrentCursor->GetPoint()->nNode = *pTextNd;
1263  m_pCurrentCursor->GetPoint()->nContent.Assign( pTextNd, nPos );
1264 
1265  if( !m_pCurrentCursor->IsSelOvr() )
1266  {
1268  return true;
1269  }
1270  }
1271  return false;
1272 }
1273 
1274 bool SwCursorShell::IsPageAtPos( const Point &rPt ) const
1275 {
1276  if( GetLayout() )
1277  return nullptr != GetLayout()->GetPageAtPos( rPt );
1278  return false;
1279 }
1280 
1281 bool SwCursorShell::GetContentAtPos( const Point& rPt,
1282  SwContentAtPos& rContentAtPos,
1283  bool bSetCursor,
1284  SwRect* pFieldRect )
1285 {
1286  SET_CURR_SHELL( this );
1287  bool bRet = false;
1288 
1289  if( !IsTableMode() )
1290  {
1291  Point aPt( rPt );
1292  SwPosition aPos( *m_pCurrentCursor->GetPoint() );
1293 
1294  SwTextNode* pTextNd;
1295  SwContentFrame *pFrame(nullptr);
1296  SwTextAttr* pTextAttr;
1297  SwCursorMoveState aTmpState;
1298  aTmpState.m_bFieldInfo = true;
1299  aTmpState.m_bExactOnly = !( IsAttrAtPos::Outline & rContentAtPos.eContentAtPos );
1300  aTmpState.m_bContentCheck = bool(IsAttrAtPos::ContentCheck & rContentAtPos.eContentAtPos);
1301  aTmpState.m_bSetInReadOnly = IsReadOnlyAvailable();
1302 
1303  SwSpecialPos aSpecialPos;
1304  aTmpState.m_pSpecialPos = ( IsAttrAtPos::SmartTag & rContentAtPos.eContentAtPos ) ?
1305  &aSpecialPos : nullptr;
1306 
1307  const bool bCursorFoundExact = GetLayout()->GetModelPositionForViewPoint( &aPos, aPt, &aTmpState );
1308  pTextNd = aPos.nNode.GetNode().GetTextNode();
1309 
1310  const SwNodes& rNds = GetDoc()->GetNodes();
1311  if( pTextNd
1312  && IsAttrAtPos::Outline & rContentAtPos.eContentAtPos
1313  && !rNds.GetOutLineNds().empty() )
1314  {
1315  const SwTextNode* pONd = pTextNd->FindOutlineNodeOfLevel(MAXLEVEL-1, GetLayout());
1316  if( pONd )
1317  {
1318  rContentAtPos.eContentAtPos = IsAttrAtPos::Outline;
1319  rContentAtPos.sStr = sw::GetExpandTextMerged(GetLayout(), *pONd, true, false, ExpandMode::ExpandFootnote);
1320  bRet = true;
1321  }
1322  }
1323  else if ( IsAttrAtPos::ContentCheck & rContentAtPos.eContentAtPos
1324  && bCursorFoundExact )
1325  {
1326  bRet = true;
1327  }
1328  else if( pTextNd
1329  && IsAttrAtPos::NumLabel & rContentAtPos.eContentAtPos)
1330  {
1331  bRet = aTmpState.m_bInNumPortion;
1332  rContentAtPos.aFnd.pNode = sw::GetParaPropsNode(*GetLayout(), aPos.nNode);
1333 
1334  Size aSizeLogic(aTmpState.m_nInNumPortionOffset, 0);
1335  Size aSizePixel = GetWin()->LogicToPixel(aSizeLogic);
1336  rContentAtPos.nDist = aSizePixel.Width();
1337  }
1338  else if( bCursorFoundExact && pTextNd )
1339  {
1340  if( !aTmpState.m_bPosCorr )
1341  {
1342  if ( IsAttrAtPos::SmartTag & rContentAtPos.eContentAtPos
1343  && !aTmpState.m_bFootnoteNoInfo )
1344  {
1345  const SwWrongList* pSmartTagList = pTextNd->GetSmartTags();
1346  sal_Int32 nCurrent = aPos.nContent.GetIndex();
1347  const sal_Int32 nBegin = nCurrent;
1348  sal_Int32 nLen = 1;
1349 
1350  if (pSmartTagList && pSmartTagList->InWrongWord(nCurrent, nLen) && !pTextNd->IsSymbolAt(nBegin))
1351  {
1352  const sal_uInt16 nIndex = pSmartTagList->GetWrongPos( nBegin );
1353  const SwWrongList* pSubList = pSmartTagList->SubList( nIndex );
1354  if ( pSubList )
1355  {
1356  nCurrent = aTmpState.m_pSpecialPos->nCharOfst;
1357 
1358  if ( pSubList->InWrongWord( nCurrent, nLen ) )
1359  bRet = true;
1360  }
1361  else
1362  bRet = true;
1363 
1364  if( bRet && bSetCursor )
1365  {
1366  SwCursorSaveState aSaveState( *m_pCurrentCursor );
1367  SwCallLink aLk( *this ); // watch Cursor-Moves
1369  *m_pCurrentCursor->GetPoint() = aPos;
1371  bRet = false;
1372  else
1373  UpdateCursor();
1374  }
1375  if( bRet )
1376  {
1377  rContentAtPos.eContentAtPos = IsAttrAtPos::SmartTag;
1378 
1379  std::pair<Point, bool> tmp(aPt, true);
1380  if (pFieldRect)
1381  {
1382  pFrame = pTextNd->getLayoutFrame(GetLayout(), nullptr, &tmp);
1383  if (pFrame)
1384  pFrame->GetCharRect( *pFieldRect, aPos, &aTmpState );
1385  }
1386  }
1387  }
1388  }
1389 
1390  if ( !bRet
1392  && !aTmpState.m_bFootnoteNoInfo )
1393  {
1394  pTextAttr = pTextNd->GetFieldTextAttrAt( aPos.nContent.GetIndex() );
1395  const SwField* pField = pTextAttr != nullptr
1396  ? pTextAttr->GetFormatField().GetField()
1397  : nullptr;
1398  if ( IsAttrAtPos::ClickField & rContentAtPos.eContentAtPos
1399  && pField && !pField->HasClickHdl() )
1400  {
1401  pField = nullptr;
1402  }
1403 
1404  if ( pField )
1405  {
1406  if (pFieldRect)
1407  {
1408  std::pair<Point, bool> tmp(aPt, true);
1409  pFrame = pTextNd->getLayoutFrame(GetLayout(), nullptr, &tmp);
1410  if (pFrame)
1411  {
1412  //tdf#116397 now that we looking for the bounds of the field drop the SmartTag
1413  //index within field setting so we don't the bounds of the char within the field
1414  SwSpecialPos* pSpecialPos = aTmpState.m_pSpecialPos;
1415  aTmpState.m_pSpecialPos = nullptr;
1416  pFrame->GetCharRect( *pFieldRect, aPos, &aTmpState );
1417  aTmpState.m_pSpecialPos = pSpecialPos;
1418  }
1419  }
1420 
1421  if( bSetCursor )
1422  {
1423  SwCallLink aLk( *this ); // watch Cursor-Moves
1424  SwCursorSaveState aSaveState( *m_pCurrentCursor );
1426  *m_pCurrentCursor->GetPoint() = aPos;
1427  if( m_pCurrentCursor->IsSelOvr() )
1428  {
1429  // allow click fields in protected sections
1430  // only placeholder is not possible
1431  if( IsAttrAtPos::Field & rContentAtPos.eContentAtPos
1432  || SwFieldIds::JumpEdit == pField->Which() )
1433  pField = nullptr;
1434  }
1435  else
1436  UpdateCursor();
1437  }
1438  else if( SwFieldIds::Table == pField->Which() &&
1439  static_cast<const SwTableField*>(pField)->IsIntrnlName() )
1440  {
1441  // create from internal (for CORE) the external
1442  // (for UI) formula
1443  const SwTableNode* pTableNd = pTextNd->FindTableNode();
1444  if( pTableNd ) // is in a table
1445  const_cast<SwTableField*>(static_cast<const SwTableField*>(pField))->PtrToBoxNm( &pTableNd->GetTable() );
1446  }
1447  }
1448 
1449  if( pField )
1450  {
1451  rContentAtPos.aFnd.pField = pField;
1452  rContentAtPos.pFndTextAttr = pTextAttr;
1453  rContentAtPos.eContentAtPos = IsAttrAtPos::Field;
1454  bRet = true;
1455  }
1456  }
1457 
1458  if( !bRet && IsAttrAtPos::FormControl & rContentAtPos.eContentAtPos )
1459  {
1460  IDocumentMarkAccess* pMarksAccess = GetDoc()->getIDocumentMarkAccess( );
1461  sw::mark::IFieldmark* pFieldBookmark = pMarksAccess->getFieldmarkFor( aPos );
1462  if (bCursorFoundExact && pFieldBookmark)
1463  {
1464  rContentAtPos.eContentAtPos = IsAttrAtPos::FormControl;
1465  rContentAtPos.aFnd.pFieldmark = pFieldBookmark;
1466  bRet=true;
1467  }
1468  }
1469 
1470  if( !bRet && IsAttrAtPos::Ftn & rContentAtPos.eContentAtPos )
1471  {
1472  if( aTmpState.m_bFootnoteNoInfo )
1473  {
1474  // over the footnote's char
1475  bRet = true;
1476  if( bSetCursor )
1477  {
1478  *m_pCurrentCursor->GetPoint() = aPos;
1479  if( !GotoFootnoteAnchor() )
1480  bRet = false;
1481  }
1482  if( bRet )
1483  rContentAtPos.eContentAtPos = IsAttrAtPos::Ftn;
1484  }
1485  else if ( nullptr != ( pTextAttr = pTextNd->GetTextAttrForCharAt(
1486  aPos.nContent.GetIndex(), RES_TXTATR_FTN )) )
1487  {
1488  bRet = true;
1489  if( bSetCursor )
1490  {
1491  SwCallLink aLk( *this ); // watch Cursor-Moves
1492  SwCursorSaveState aSaveState( *m_pCurrentCursor );
1493  m_pCurrentCursor->GetPoint()->nNode = *static_cast<SwTextFootnote*>(pTextAttr)->GetStartNode();
1496  true, !IsReadOnlyAvailable() );
1497 
1498  if( pCNd )
1499  {
1500  m_pCurrentCursor->GetPoint()->nContent.Assign( pCNd, 0 );
1503  bRet = false;
1504  else
1505  UpdateCursor();
1506  }
1507  else
1508  bRet = false;
1509  }
1510 
1511  if( bRet )
1512  {
1513  rContentAtPos.eContentAtPos = IsAttrAtPos::Ftn;
1514  rContentAtPos.pFndTextAttr = pTextAttr;
1515  rContentAtPos.aFnd.pAttr = &pTextAttr->GetAttr();
1516 
1517  if (pFieldRect)
1518  {
1519  std::pair<Point, bool> tmp(aPt, true);
1520  pFrame = pTextNd->getLayoutFrame(GetLayout(), nullptr, &tmp);
1521  if (pFrame)
1522  pFrame->GetCharRect( *pFieldRect, aPos, &aTmpState );
1523  }
1524  }
1525  }
1526  }
1527 
1528  if( !bRet
1530  && !aTmpState.m_bFootnoteNoInfo )
1531  {
1532  pTextAttr = nullptr;
1533  if( IsAttrAtPos::ToxMark & rContentAtPos.eContentAtPos )
1534  {
1535  std::vector<SwTextAttr *> const marks(
1536  pTextNd->GetTextAttrsAt(
1537  aPos.nContent.GetIndex(), RES_TXTATR_TOXMARK));
1538  if (!marks.empty())
1539  { // hmm... can only return 1 here
1540  pTextAttr = *marks.begin();
1541  }
1542  }
1543 
1544  if( !pTextAttr &&
1545  IsAttrAtPos::RefMark & rContentAtPos.eContentAtPos )
1546  {
1547  std::vector<SwTextAttr *> const marks(
1548  pTextNd->GetTextAttrsAt(
1549  aPos.nContent.GetIndex(), RES_TXTATR_REFMARK));
1550  if (!marks.empty())
1551  { // hmm... can only return 1 here
1552  pTextAttr = *marks.begin();
1553  }
1554  }
1555 
1556  if( pTextAttr )
1557  {
1558  bRet = true;
1559  if( bSetCursor )
1560  {
1561  SwCallLink aLk( *this ); // watch Cursor-Moves
1562  SwCursorSaveState aSaveState( *m_pCurrentCursor );
1564  *m_pCurrentCursor->GetPoint() = aPos;
1566  bRet = false;
1567  else
1568  UpdateCursor();
1569  }
1570 
1571  if( bRet )
1572  {
1573  const sal_Int32* pEnd = pTextAttr->GetEnd();
1574  if( pEnd )
1575  rContentAtPos.sStr =
1576  pTextNd->GetExpandText(GetLayout(), pTextAttr->GetStart(), *pEnd - pTextAttr->GetStart());
1577  else if( RES_TXTATR_TOXMARK == pTextAttr->Which())
1578  rContentAtPos.sStr =
1579  pTextAttr->GetTOXMark().GetAlternativeText();
1580 
1581  rContentAtPos.eContentAtPos =
1582  RES_TXTATR_TOXMARK == pTextAttr->Which()
1585  rContentAtPos.pFndTextAttr = pTextAttr;
1586  rContentAtPos.aFnd.pAttr = &pTextAttr->GetAttr();
1587 
1588  std::pair<Point, bool> tmp(aPt, true);
1589  if (pFieldRect)
1590  {
1591  pFrame = pTextNd->getLayoutFrame(GetLayout(), nullptr, &tmp);
1592  if (pFrame)
1593  pFrame->GetCharRect( *pFieldRect, aPos, &aTmpState );
1594  }
1595  }
1596  }
1597  }
1598 
1599  if ( !bRet
1600  && IsAttrAtPos::InetAttr & rContentAtPos.eContentAtPos
1601  && !aTmpState.m_bFootnoteNoInfo )
1602  {
1603  pTextAttr = pTextNd->GetTextAttrAt(
1604  aPos.nContent.GetIndex(), RES_TXTATR_INETFMT);
1605  // "detect" only INetAttrs with URLs
1606  if( pTextAttr && !pTextAttr->GetINetFormat().GetValue().isEmpty() )
1607  {
1608  bRet = true;
1609  if( bSetCursor )
1610  {
1611  SwCursorSaveState aSaveState( *m_pCurrentCursor );
1612  SwCallLink aLk( *this ); // watch Cursor-Moves
1614  *m_pCurrentCursor->GetPoint() = aPos;
1617  bRet = false;
1618  else
1619  UpdateCursor();
1620  }
1621  if( bRet )
1622  {
1623  const sal_Int32 nSt = pTextAttr->GetStart();
1624  const sal_Int32 nEnd = *pTextAttr->End();
1625 
1626  rContentAtPos.sStr = pTextNd->GetExpandText(GetLayout(), nSt, nEnd-nSt);
1627 
1628  rContentAtPos.aFnd.pAttr = &pTextAttr->GetAttr();
1629  rContentAtPos.eContentAtPos = IsAttrAtPos::InetAttr;
1630  rContentAtPos.pFndTextAttr = pTextAttr;
1631 
1632  if (pFieldRect)
1633  {
1634  std::pair<Point, bool> tmp(aPt, true);
1635  pFrame = pTextNd->getLayoutFrame(GetLayout(), nullptr, &tmp);
1636  if (pFrame)
1637  {
1638  //get bounding box of range
1639  SwRect aStart;
1640  SwPosition aStartPos(*pTextNd, nSt);
1641  pFrame->GetCharRect(aStart, aStartPos, &aTmpState);
1642  SwRect aEnd;
1643  SwPosition aEndPos(*pTextNd, nEnd);
1644  pFrame->GetCharRect(aEnd, aEndPos, &aTmpState);
1645  if (aStart.Top() != aEnd.Top() || aStart.Bottom() != aEnd.Bottom())
1646  {
1647  aStart.Left(pFrame->getFrameArea().Left());
1648  aEnd.Right(pFrame->getFrameArea().Right());
1649  }
1650  *pFieldRect = aStart.Union(aEnd);
1651  }
1652  }
1653  }
1654  }
1655  }
1656 
1657  if( !bRet && IsAttrAtPos::Redline & rContentAtPos.eContentAtPos )
1658  {
1659  const SwRangeRedline* pRedl = GetDoc()->getIDocumentRedlineAccess().GetRedline(aPos, nullptr);
1660 
1661  if( pRedl )
1662  {
1663  rContentAtPos.aFnd.pRedl = pRedl;
1664  rContentAtPos.eContentAtPos = IsAttrAtPos::Redline;
1665  rContentAtPos.pFndTextAttr = nullptr;
1666  bRet = true;
1667 
1668  if (pFieldRect)
1669  {
1670  std::pair<Point, bool> tmp(aPt, true);
1671  pFrame = pTextNd->getLayoutFrame(GetLayout(), nullptr, &tmp);
1672  if( pFrame )
1673  {
1674  // not sure if this should be limited to one
1675  // paragraph, or mark the entire redline; let's
1676  // leave it limited to one for now...
1677  sal_Int32 nStart;
1678  sal_Int32 nEnd;
1679  pRedl->CalcStartEnd(pTextNd->GetIndex(), nStart, nEnd);
1680  if (nStart == COMPLETE_STRING)
1681  {
1682  // consistency: found pRedl, so there must be
1683  // something in pTextNd
1684  assert(nEnd != COMPLETE_STRING);
1685  nStart = 0;
1686  }
1687  if (nEnd == COMPLETE_STRING)
1688  {
1689  nEnd = pTextNd->Len();
1690  }
1691  //get bounding box of range
1692  SwRect aStart;
1693  pFrame->GetCharRect(aStart, SwPosition(*pTextNd, nStart), &aTmpState);
1694  SwRect aEnd;
1695  pFrame->GetCharRect(aEnd, SwPosition(*pTextNd, nEnd), &aTmpState);
1696  if (aStart.Top() != aEnd.Top() || aStart.Bottom() != aEnd.Bottom())
1697  {
1698  aStart.Left(pFrame->getFrameArea().Left());
1699  aEnd.Right(pFrame->getFrameArea().Right());
1700  }
1701  *pFieldRect = aStart.Union(aEnd);
1702  }
1703  }
1704  }
1705  }
1706  }
1707 
1708  if( !bRet
1709  && ( IsAttrAtPos::TableBoxFml & rContentAtPos.eContentAtPos
1710 #ifdef DBG_UTIL
1711  || IsAttrAtPos::TableBoxValue & rContentAtPos.eContentAtPos
1712 #endif
1713  ) )
1714  {
1715  const SwTableNode* pTableNd;
1716  const SwTableBox* pBox;
1717  const SwStartNode* pSttNd = pTextNd->FindTableBoxStartNode();
1718  const SfxPoolItem* pItem;
1719  if( pSttNd && nullptr != ( pTableNd = pTextNd->FindTableNode()) &&
1720  nullptr != ( pBox = pTableNd->GetTable().GetTableBox(
1721  pSttNd->GetIndex() )) &&
1722 #ifdef DBG_UTIL
1723  ( SfxItemState::SET == pBox->GetFrameFormat()->GetItemState(
1724  RES_BOXATR_FORMULA, false, &pItem ) ||
1725  SfxItemState::SET == pBox->GetFrameFormat()->GetItemState(
1726  RES_BOXATR_VALUE, false, &pItem ))
1727 #else
1728  SfxItemState::SET == pBox->GetFrameFormat()->GetItemState(
1729  RES_BOXATR_FORMULA, false, &pItem )
1730 #endif
1731  )
1732  {
1733  std::pair<Point, bool> tmp(aPt, true);
1734  SwFrame* pF = pTextNd->getLayoutFrame(GetLayout(), nullptr, &tmp);
1735  if( pF )
1736  {
1737  // then the CellFrame
1738  pFrame = static_cast<SwContentFrame*>(pF);
1739  while( pF && !pF->IsCellFrame() )
1740  pF = pF->GetUpper();
1741  }
1742 
1743  if( aTmpState.m_bPosCorr )
1744  {
1745  if( pF && !pF->getFrameArea().IsInside( aPt ))
1746  pF = nullptr;
1747  }
1748  else if( !pF )
1749  pF = pFrame;
1750 
1751  if( pF ) // only then it is valid
1752  {
1753  // create from internal (for CORE) the external
1754  // (for UI) formula
1755  rContentAtPos.eContentAtPos = IsAttrAtPos::TableBoxFml;
1756 #ifdef DBG_UTIL
1757  if( RES_BOXATR_VALUE == pItem->Which() )
1758  rContentAtPos.eContentAtPos = IsAttrAtPos::TableBoxValue;
1759  else
1760 #endif
1761  const_cast<SwTableBoxFormula*>(static_cast<const SwTableBoxFormula*>(pItem))->PtrToBoxNm( &pTableNd->GetTable() );
1762 
1763  bRet = true;
1764  if( bSetCursor )
1765  {
1766  SwCallLink aLk( *this ); // watch Cursor-Moves
1767  SwCursorSaveState aSaveState( *m_pCurrentCursor );
1768  *m_pCurrentCursor->GetPoint() = aPos;
1771  bRet = false;
1772  else
1773  UpdateCursor();
1774  }
1775 
1776  if( bRet )
1777  {
1778  if( pFieldRect )
1779  {
1780  *pFieldRect = pF->getFramePrintArea();
1781  *pFieldRect += pF->getFrameArea().Pos();
1782  }
1783  rContentAtPos.pFndTextAttr = nullptr;
1784  rContentAtPos.aFnd.pAttr = pItem;
1785  }
1786  }
1787  }
1788  }
1789 
1790 #ifdef DBG_UTIL
1791  if( !bRet && IsAttrAtPos::CurrAttrs & rContentAtPos.eContentAtPos )
1792  {
1793  const sal_Int32 n = aPos.nContent.GetIndex();
1795  POOLATTR_END - 1>{} );
1796  if( pTextNd->GetpSwpHints() )
1797  {
1798  for( size_t i = 0; i < pTextNd->GetSwpHints().Count(); ++i )
1799  {
1800  const SwTextAttr* pHt = pTextNd->GetSwpHints().Get(i);
1801  const sal_Int32 nAttrStart = pHt->GetStart();
1802  if( nAttrStart > n ) // over the section
1803  break;
1804 
1805  if( nullptr != pHt->End() && (
1806  ( nAttrStart < n &&
1807  ( pHt->DontExpand() ? n < *pHt->End()
1808  : n <= *pHt->End() )) ||
1809  ( n == nAttrStart &&
1810  ( nAttrStart == *pHt->End() || !n ))) )
1811  {
1812  aSet.Put( pHt->GetAttr() );
1813  }
1814  }
1815  if( pTextNd->HasSwAttrSet() &&
1816  pTextNd->GetpSwAttrSet()->Count() )
1817  {
1818  SfxItemSet aFormatSet( pTextNd->GetSwAttrSet() );
1819  // remove all from format set that are also in TextSet
1820  aFormatSet.Differentiate( aSet );
1821  // now merge all together
1822  aSet.Put( aFormatSet );
1823  }
1824  }
1825  else
1826  pTextNd->SwContentNode::GetAttr( aSet );
1827 
1828  rContentAtPos.sStr = "Pos: (";
1829  rContentAtPos.sStr += OUString::number( aPos.nNode.GetIndex());
1830  rContentAtPos.sStr += ":";
1831  rContentAtPos.sStr += OUString::number( aPos.nContent.GetIndex());
1832  rContentAtPos.sStr += ")";
1833  rContentAtPos.sStr += "\nParagraph Style: ";
1834  rContentAtPos.sStr += pTextNd->GetFormatColl()->GetName();
1835  if( pTextNd->GetCondFormatColl() )
1836  {
1837  rContentAtPos.sStr += "\nConditional Style: " + pTextNd->GetCondFormatColl()->GetName();
1838  }
1839 
1840  if( aSet.Count() )
1841  {
1842  OUStringBuffer sAttrs;
1843  SfxItemIter aIter( aSet );
1844  const SfxPoolItem* pItem = aIter.GetCurItem();
1845  const IntlWrapper aInt(SvtSysLocale().GetUILanguageTag());
1846  do
1847  {
1848  if( !IsInvalidItem( pItem ))
1849  {
1850  OUString aStr;
1851  GetDoc()->GetAttrPool().GetPresentation(*pItem,
1852  MapUnit::MapCM, aStr, aInt);
1853  if (!sAttrs.isEmpty())
1854  sAttrs.append(", ");
1855  sAttrs.append(aStr);
1856  }
1857  pItem = aIter.NextItem();
1858  } while (pItem);
1859  if (!sAttrs.isEmpty())
1860  {
1861  if( !rContentAtPos.sStr.isEmpty() )
1862  rContentAtPos.sStr += "\n";
1863  rContentAtPos.sStr += "Attr: " + sAttrs.toString();
1864  }
1865  }
1866  bRet = true;
1867  rContentAtPos.eContentAtPos = IsAttrAtPos::CurrAttrs;
1868  }
1869 #endif
1870  }
1871  }
1872 
1873  if( !bRet )
1874  {
1875  rContentAtPos.eContentAtPos = IsAttrAtPos::NONE;
1876  rContentAtPos.aFnd.pField = nullptr;
1877  }
1878  return bRet;
1879 }
1880 
1881 // #i90516#
1883 {
1884  const SwPostItField* pPostItField = nullptr;
1885 
1886  if ( !IsTableMode() )
1887  {
1888  const SwPosition* pCursorPos = GetCursor_()->GetPoint();
1889  const SwTextNode* pTextNd = pCursorPos->nNode.GetNode().GetTextNode();
1890  if ( pTextNd )
1891  {
1892  SwTextAttr* pTextAttr = pTextNd->GetFieldTextAttrAt( pCursorPos->nContent.GetIndex() );
1893  const SwField* pField = pTextAttr != nullptr ? pTextAttr->GetFormatField().GetField() : nullptr;
1894  if ( pField && pField->Which()== SwFieldIds::Postit )
1895  {
1896  pPostItField = static_cast<const SwPostItField*>(pField);
1897  }
1898  }
1899  }
1900 
1901  return pPostItField;
1902 }
1903 
1906 {
1907  const SwTextNode* pNd = nullptr;
1908  if( pFndTextAttr )
1909  {
1910  switch( eContentAtPos )
1911  {
1912  case IsAttrAtPos::Field:
1914  pNd = static_txtattr_cast<SwTextField const*>(pFndTextAttr)->GetpTextNode();
1915  break;
1916 
1917  case IsAttrAtPos::Ftn:
1918  pNd = &static_cast<const SwTextFootnote*>(pFndTextAttr)->GetTextNode();
1919  break;
1920 
1921  case IsAttrAtPos::InetAttr:
1922  pNd = static_txtattr_cast<SwTextINetFormat const*>(pFndTextAttr)->GetpTextNode();
1923  break;
1924 
1925  default:
1926  break;
1927  }
1928  }
1929 
1930  if( !pNd )
1931  return false;
1932  if( pNd->IsInProtectSect() )
1933  return true;
1934 
1935  const SwContentFrame* pFrame = pNd->getLayoutFrame(pNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), nullptr, nullptr);
1936  return pFrame && pFrame->IsProtected() ;
1937 }
1938 
1940 {
1941  bool bRet = false;
1942  const SwTextNode* pNd = nullptr;
1944  {
1945  const SwTextFootnote* pTextFootnote = static_cast<const SwTextFootnote*>(pFndTextAttr);
1946  if(pTextFootnote->GetStartNode())
1947  {
1948  SwStartNode* pSttNd = pTextFootnote->GetStartNode()->GetNode().GetStartNode();
1949  SwPaM aTemp( *pSttNd );
1950  aTemp.Move(fnMoveForward, GoInNode);
1951  SwContentNode* pContentNode = aTemp.GetContentNode();
1952  if(pContentNode && pContentNode->IsTextNode())
1953  pNd = pContentNode->GetTextNode();
1954  }
1955  }
1956  if(pNd)
1957  {
1959  SwTextFrame* pTmpFrame = aIter.First();
1960  while( pTmpFrame )
1961  {
1962  if ( !pTmpFrame->IsFollow())
1963  {
1964  bRet = pTmpFrame->IsRightToLeft();
1965  break;
1966  }
1967  pTmpFrame = aIter.Next();
1968  }
1969  }
1970  return bRet;
1971 }
1972 
1973 bool SwCursorShell::SelectText( const sal_Int32 nStart,
1974  const sal_Int32 nEnd )
1975 {
1976  SET_CURR_SHELL( this );
1977  bool bRet = false;
1978 
1979  SwCallLink aLk( *this );
1980  SwCursorSaveState aSaveState( *m_pCurrentCursor );
1981 
1982  SwPosition& rPos = *m_pCurrentCursor->GetPoint();
1984  rPos.nContent = nStart;
1986  rPos.nContent = nEnd;
1987 
1988  if( !m_pCurrentCursor->IsSelOvr() )
1989  {
1990  UpdateCursor();
1991  bRet = true;
1992  }
1993 
1994  return bRet;
1995 }
1996 
1997 bool SwCursorShell::SelectTextAttr( sal_uInt16 nWhich,
1998  bool bExpand,
1999  const SwTextAttr* pTextAttr )
2000 {
2001  SET_CURR_SHELL( this );
2002  bool bRet = false;
2003 
2004  if( !IsTableMode() )
2005  {
2006  if( !pTextAttr )
2007  {
2008  SwPosition& rPos = *m_pCurrentCursor->GetPoint();
2009  SwTextNode* pTextNd = rPos.nNode.GetNode().GetTextNode();
2010  pTextAttr = pTextNd
2011  ? pTextNd->GetTextAttrAt(rPos.nContent.GetIndex(),
2012  nWhich,
2014  : nullptr;
2015  }
2016 
2017  if( pTextAttr )
2018  {
2019  const sal_Int32* pEnd = pTextAttr->End();
2020  bRet = SelectText( pTextAttr->GetStart(), ( pEnd ? *pEnd : pTextAttr->GetStart() + 1 ) );
2021  }
2022  }
2023  return bRet;
2024 }
2025 
2027 {
2028  bool bRet = false;
2029  if( rAttr.GetpTextNode() )
2030  {
2031  SwCursor* pCursor = getShellCursor( true );
2032 
2033  SET_CURR_SHELL( this );
2034  SwCallLink aLk( *this ); // watch Cursor-Moves
2035  SwCursorSaveState aSaveState( *pCursor );
2036 
2037  pCursor->GetPoint()->nNode = *rAttr.GetpTextNode();
2038  pCursor->GetPoint()->nContent.Assign( const_cast<SwTextNode*>(rAttr.GetpTextNode()),
2039  rAttr.GetStart() );
2040  bRet = !pCursor->IsSelOvr();
2041  if( bRet )
2043  }
2044  return bRet;
2045 }
2046 
2047 const SwFormatINetFormat* SwCursorShell::FindINetAttr( const OUString& rName ) const
2048 {
2049  return mxDoc->FindINetAttr( rName );
2050 }
2051 
2052 bool SwCursorShell::GetShadowCursorPos( const Point& rPt, SwFillMode eFillMode,
2053  SwRect& rRect, sal_Int16& rOrient )
2054 {
2055 
2056  SET_CURR_SHELL( this );
2057  bool bRet = false;
2058 
2059  if (!IsTableMode() && !HasSelection()
2060  && GetDoc()->GetIDocumentUndoRedo().DoesUndo())
2061  {
2062  Point aPt( rPt );
2063  SwPosition aPos( *m_pCurrentCursor->GetPoint() );
2064 
2065  SwFillCursorPos aFPos( eFillMode );
2066  SwCursorMoveState aTmpState( &aFPos );
2067 
2068  if( GetLayout()->GetModelPositionForViewPoint( &aPos, aPt, &aTmpState ) &&
2069  !aPos.nNode.GetNode().IsProtect())
2070  {
2071  // start position in protected section?
2072  rRect = aFPos.aCursor;
2073  rOrient = aFPos.eOrient;
2074  bRet = true;
2075  }
2076  }
2077  return bRet;
2078 }
2079 
2080 bool SwCursorShell::SetShadowCursorPos( const Point& rPt, SwFillMode eFillMode )
2081 {
2082  SET_CURR_SHELL( this );
2083  bool bRet = false;
2084 
2085  if (!IsTableMode() && !HasSelection()
2086  && GetDoc()->GetIDocumentUndoRedo().DoesUndo())
2087  {
2088  Point aPt( rPt );
2089  SwPosition aPos( *m_pCurrentCursor->GetPoint() );
2090 
2091  SwFillCursorPos aFPos( eFillMode );
2092  SwCursorMoveState aTmpState( &aFPos );
2093 
2094  if( GetLayout()->GetModelPositionForViewPoint( &aPos, aPt, &aTmpState ) )
2095  {
2096  SwCallLink aLk( *this ); // watch Cursor-Moves
2097  StartAction();
2098 
2099  SwContentNode* pCNd = aPos.nNode.GetNode().GetContentNode();
2101  // If only the paragraph attributes "Adjust" or "LRSpace" are set,
2102  // then the following should not delete those again.
2103  if( 0 == aFPos.nParaCnt + aFPos.nColumnCnt &&
2104  ( SwFillMode::Indent == aFPos.eMode ||
2105  ( text::HoriOrientation::NONE != aFPos.eOrient &&
2106  0 == aFPos.nTabCnt + aFPos.nSpaceCnt )) &&
2107  pCNd && pCNd->Len() )
2108  nUndoId = SwUndoId::EMPTY;
2109 
2110  GetDoc()->GetIDocumentUndoRedo().StartUndo( nUndoId, nullptr );
2111 
2112  SwTextFormatColl* pNextFormat = nullptr;
2113  SwTextNode* pTNd = pCNd ? pCNd->GetTextNode() : nullptr;
2114  if( pTNd )
2115  pNextFormat = &pTNd->GetTextColl()->GetNextTextFormatColl();
2116 
2117  const SwSectionNode* pSectNd = pCNd ? pCNd->FindSectionNode() : nullptr;
2118  if( pSectNd && aFPos.nParaCnt )
2119  {
2120  SwNodeIndex aEnd( aPos.nNode, 1 );
2121  while( aEnd.GetNode().IsEndNode() &&
2122  &aEnd.GetNode() !=
2123  pSectNd->EndOfSectionNode() )
2124  ++aEnd;
2125 
2126  if( aEnd.GetNode().IsEndNode() &&
2127  pCNd->Len() == aPos.nContent.GetIndex() )
2128  aPos.nNode = *pSectNd->EndOfSectionNode();
2129  }
2130 
2131  for( sal_uInt16 n = 0; n < aFPos.nParaCnt + aFPos.nColumnCnt; ++n )
2132  {
2134  if( !n && pNextFormat )
2135  {
2136  *m_pCurrentCursor->GetPoint() = aPos;
2137  GetDoc()->SetTextFormatColl( *m_pCurrentCursor, pNextFormat, false );
2138  }
2139  if( n < aFPos.nColumnCnt )
2140  {
2141  *m_pCurrentCursor->GetPoint() = aPos;
2143  SvxFormatBreakItem( SvxBreak::ColumnBefore, RES_BREAK ) );
2144  }
2145  }
2146 
2147  *m_pCurrentCursor->GetPoint() = aPos;
2148  switch( aFPos.eMode )
2149  {
2150  case SwFillMode::Indent:
2151  if( nullptr != (pCNd = aPos.nNode.GetNode().GetContentNode() ))
2152  {
2153  SfxItemSet aSet(
2154  GetDoc()->GetAttrPool(),
2155  svl::Items<
2158  SvxLRSpaceItem aLR( static_cast<const SvxLRSpaceItem&>(
2159  pCNd->GetAttr( RES_LR_SPACE ) ) );
2160  aLR.SetTextLeft( aFPos.nTabCnt );
2161  aLR.SetTextFirstLineOffset( 0 );
2162  aSet.Put( aLR );
2163 
2164  const SvxAdjustItem& rAdj = static_cast<const SvxAdjustItem&>(pCNd->
2165  GetAttr( RES_PARATR_ADJUST ));
2166  if( SvxAdjust::Left != rAdj.GetAdjust() )
2167  aSet.Put( SvxAdjustItem( SvxAdjust::Left, RES_PARATR_ADJUST ) );
2168 
2170  }
2171  else {
2172  OSL_ENSURE( false, "No ContentNode" );
2173  }
2174  break;
2175 
2176  case SwFillMode::Tab:
2177  case SwFillMode::TabSpace:
2178  case SwFillMode::Space:
2179  {
2180  OUStringBuffer sInsert;
2181  if (aFPos.eMode == SwFillMode::Space)
2182  {
2183  comphelper::string::padToLength(sInsert, sInsert.getLength() + aFPos.nSpaceOnlyCnt, ' ');
2184  }
2185  else
2186  {
2187  if (aFPos.nTabCnt)
2188  comphelper::string::padToLength(sInsert, aFPos.nTabCnt, '\t');
2189  if (aFPos.nSpaceCnt)
2190  comphelper::string::padToLength(sInsert, sInsert.getLength() + aFPos.nSpaceCnt, ' ');
2191  }
2192  if (!sInsert.isEmpty())
2193  GetDoc()->getIDocumentContentOperations().InsertString( *m_pCurrentCursor, sInsert.makeStringAndClear());
2194  }
2195  [[fallthrough]]; // still need to set orientation
2196  case SwFillMode::Margin:
2197  if( text::HoriOrientation::NONE != aFPos.eOrient )
2198  {
2199  SvxAdjustItem aAdj( SvxAdjust::Left, RES_PARATR_ADJUST );
2200  switch( aFPos.eOrient )
2201  {
2202  case text::HoriOrientation::CENTER:
2203  aAdj.SetAdjust( SvxAdjust::Center );
2204  break;
2205  case text::HoriOrientation::RIGHT:
2206  aAdj.SetAdjust( SvxAdjust::Right );
2207  break;
2208  default:
2209  break;
2210  }
2212  }
2213  break;
2214  }
2215 
2216  GetDoc()->GetIDocumentUndoRedo().EndUndo( nUndoId, nullptr );
2217  EndAction();
2218 
2219  bRet = true;
2220  }
2221  }
2222  return bRet;
2223 }
2224 
2226 {
2227  const SwRangeRedline* pFnd = nullptr;
2228  if( !IsTableMode() )
2229  {
2230  SET_CURR_SHELL( this );
2231  SwCallLink aLk( *this ); // watch Cursor-Moves
2232  SwCursorSaveState aSaveState( *m_pCurrentCursor );
2233 
2234  // ensure point is at the end so alternating SelNext/SelPrev works
2235  NormalizePam(false);
2239  else
2240  pFnd = nullptr;
2241  }
2242  return pFnd;
2243 }
2244 
2246 {
2247  const SwRangeRedline* pFnd = nullptr;
2248  if( !IsTableMode() )
2249  {
2250  SET_CURR_SHELL( this );
2251  SwCallLink aLk( *this ); // watch Cursor-Moves
2252  SwCursorSaveState aSaveState( *m_pCurrentCursor );
2253 
2254  // ensure point is at the start so alternating SelNext/SelPrev works
2255  NormalizePam(true);
2259  else
2260  pFnd = nullptr;
2261  }
2262  return pFnd;
2263 }
2264 
2266 {
2267  const SwRangeRedline* pFnd = nullptr;
2268  SwCallLink aLk( *this ); // watch Cursor-Moves
2269  SwCursorSaveState aSaveState( *m_pCurrentCursor );
2270 
2271  pFnd = GetDoc()->getIDocumentRedlineAccess().GetRedlineTable()[ nArrPos ];
2272  if( pFnd )
2273  {
2274  *m_pCurrentCursor->GetPoint() = *pFnd->Start();
2275 
2277  if( !pIdx->GetNode().IsContentNode() )
2278  {
2279  SwContentNode* pCNd = GetDoc()->GetNodes().GoNextSection( pIdx,
2280  true, IsReadOnlyAvailable() );
2281  if( pCNd )
2282  {
2283  if( *pIdx <= pFnd->End()->nNode )
2284  m_pCurrentCursor->GetPoint()->nContent.Assign( pCNd, 0 );
2285  else
2286  pFnd = nullptr;
2287  }
2288  }
2289 
2290  if( pFnd && bSelect )
2291  {
2293  if( RedlineType::FmtColl == pFnd->GetType() )
2294  {
2295  SwContentNode* pCNd = pIdx->GetNode().GetContentNode();
2296  m_pCurrentCursor->GetPoint()->nContent.Assign( pCNd, pCNd->Len() );
2297  m_pCurrentCursor->GetMark()->nContent.Assign( pCNd, 0 );
2298  }
2299  else
2300  *m_pCurrentCursor->GetPoint() = *pFnd->End();
2301 
2302  pIdx = &m_pCurrentCursor->GetPoint()->nNode;
2303  if( !pIdx->GetNode().IsContentNode() )
2304  {
2305  SwContentNode* pCNd = SwNodes::GoPrevSection( pIdx,
2306  true, IsReadOnlyAvailable() );
2307  if( pCNd )
2308  {
2309  if( *pIdx >= m_pCurrentCursor->GetMark()->nNode )
2310  m_pCurrentCursor->GetPoint()->nContent.Assign( pCNd, pCNd->Len() );
2311  else
2312  pFnd = nullptr;
2313  }
2314  }
2315  }
2316 
2317  if( !pFnd )
2318  {
2321  }
2322  else if( bSelect && *m_pCurrentCursor->GetMark() == *m_pCurrentCursor->GetPoint() )
2324 
2328  else
2329  {
2330  pFnd = nullptr;
2331  if( bSelect )
2333  }
2334  }
2335  return pFnd;
2336 }
2337 
2339 {
2340  const SwRangeRedline* pFnd = nullptr;
2341  if( !IsTableMode() )
2342  {
2343  SET_CURR_SHELL( this );
2344 
2346  const SwRangeRedline* pTmp = rTable[ nArrPos ];
2347  sal_uInt16 nSeqNo = pTmp->GetSeqNo();
2348  if( nSeqNo && bSelect )
2349  {
2350  bool bCheck = false;
2351  int nLoopCnt = 2;
2352  SwRedlineTable::size_type nArrSavPos = nArrPos;
2353 
2354  do {
2355  pTmp = GotoRedline_( nArrPos, true );
2356 
2357  if( !pFnd )
2358  pFnd = pTmp;
2359 
2360  if( pTmp && bCheck )
2361  {
2362  // Check for overlaps. These can happen when FormatColl-
2363  // Redlines were stretched over a whole paragraph
2364  SwPaM* pCur = m_pCurrentCursor;
2365  SwPaM* pNextPam = pCur->GetNext();
2366  SwPosition* pCStt = pCur->Start(), *pCEnd = pCur->End();
2367  while( pCur != pNextPam )
2368  {
2369  const SwPosition *pNStt = pNextPam->Start(),
2370  *pNEnd = pNextPam->End();
2371 
2372  bool bDel = true;
2373  switch( ::ComparePosition( *pCStt, *pCEnd,
2374  *pNStt, *pNEnd ))
2375  {
2376  case SwComparePosition::Inside: // Pos1 is completely in Pos2
2377  if( !pCur->HasMark() )
2378  {
2379  pCur->SetMark();
2380  *pCur->GetMark() = *pNStt;
2381  }
2382  else
2383  *pCStt = *pNStt;
2384  *pCEnd = *pNEnd;
2385  break;
2386 
2387  case SwComparePosition::Outside: // Pos2 is completely in Pos1
2388  case SwComparePosition::Equal: // Pos1 has same size as Pos2
2389  break;
2390 
2391  case SwComparePosition::OverlapBefore: // Pos1 overlaps Pos2 at beginning
2392  if( !pCur->HasMark() )
2393  pCur->SetMark();
2394  *pCEnd = *pNEnd;
2395  break;
2396  case SwComparePosition::OverlapBehind: // Pos1 overlaps Pos2 at end
2397  if( !pCur->HasMark() )
2398  {
2399  pCur->SetMark();
2400  *pCur->GetMark() = *pNStt;
2401  }
2402  else
2403  *pCStt = *pNStt;
2404  break;
2405 
2406  default:
2407  bDel = false;
2408  }
2409 
2410  if( bDel )
2411  {
2412  // not needed anymore
2413  SwPaM* pPrevPam = pNextPam->GetPrev();
2414  delete pNextPam;
2415  pNextPam = pPrevPam;
2416  }
2417  pNextPam = pNextPam->GetNext();
2418  }
2419  }
2420 
2421  SwRedlineTable::size_type nFndPos = 2 == nLoopCnt
2422  ? rTable.FindNextOfSeqNo( nArrPos )
2423  : rTable.FindPrevOfSeqNo( nArrPos );
2424  if( SwRedlineTable::npos != nFndPos ||
2425  ( 0 != ( --nLoopCnt ) && SwRedlineTable::npos != (
2426  nFndPos = rTable.FindPrevOfSeqNo( nArrSavPos ))) )
2427  {
2428  if( pTmp )
2429  {
2430  // create new cursor
2431  CreateCursor();
2432  bCheck = true;
2433  }
2434  nArrPos = nFndPos;
2435  }
2436  else
2437  nLoopCnt = 0;
2438 
2439  } while( nLoopCnt );
2440  }
2441  else
2442  pFnd = GotoRedline_( nArrPos, bSelect );
2443  }
2444  return pFnd;
2445 }
2446 
2448 {
2449  SwNodes& rNds = GetDoc()->GetNodes();
2450  const SwNode* pBodyEndNd = &rNds.GetEndOfContent();
2451  const SwNode* pBodySttNd = pBodyEndNd->StartOfSectionNode();
2452  sal_uLong nBodySttNdIdx = pBodySttNd->GetIndex();
2453  Point aPt;
2454 
2455  SetGetExpField aCmpPos( SwPosition( bNext ? *pBodyEndNd : *pBodySttNd ) );
2456  SetGetExpField aCurPos( bNext ? *m_pCurrentCursor->End() : *m_pCurrentCursor->Start() );
2457  if( aCurPos.GetNode() < nBodySttNdIdx )
2458  {
2459  const SwContentNode* pCNd = aCurPos.GetNodeFromContent()->GetContentNode();
2460  SwContentFrame* pFrame;
2461  std::pair<Point, bool> tmp(aPt, true);
2462  if (pCNd)
2463  {
2464  pFrame = pCNd->getLayoutFrame(GetLayout(), nullptr, &tmp);
2465  if( pFrame )
2466  aCurPos.SetBodyPos( *pFrame );
2467  }
2468  }
2469 
2470  // check first all the hyperlink fields
2471  {
2472  const SwTextNode* pTextNd;
2473  const SwCharFormats* pFormats = GetDoc()->GetCharFormats();
2474  for( SwCharFormats::size_type n = pFormats->size(); 1 < n; )
2475  {
2476  SwIterator<SwTextINetFormat,SwCharFormat> aIter(*(*pFormats)[--n]);
2477 
2478  for( SwTextINetFormat* pFnd = aIter.First(); pFnd; pFnd = aIter.Next() )
2479  {
2480  pTextNd = pFnd->GetpTextNode();
2481  if( pTextNd && pTextNd->GetNodes().IsDocNodes() )
2482  {
2483  SwTextINetFormat& rAttr = *pFnd;
2484  SwPosition aTmpPos( *pTextNd );
2485  SetGetExpField aPos( aTmpPos.nNode, rAttr );
2486  SwContentFrame* pFrame;
2487  if (pTextNd->GetIndex() < nBodySttNdIdx)
2488  {
2489  std::pair<Point, bool> tmp(aPt, true);
2490  pFrame = pTextNd->getLayoutFrame(GetLayout(), nullptr, &tmp);
2491  if (pFrame)
2492  {
2493  aPos.SetBodyPos( *pFrame );
2494  }
2495  }
2496 
2497  if( bNext
2498  ? ( aPos < aCmpPos && aCurPos < aPos )
2499  : ( aCmpPos < aPos && aPos < aCurPos ))
2500  {
2501  OUString sText(pTextNd->GetExpandText(GetLayout(),
2502  rAttr.GetStart(),
2503  *rAttr.GetEnd() - rAttr.GetStart() ) );
2504 
2505  sText = sText.replaceAll("\x0a", "");
2506  sText = comphelper::string::strip(sText, ' ');
2507 
2508  if( !sText.isEmpty() )
2509  aCmpPos = aPos;
2510  }
2511  }
2512  }
2513  }
2514  }
2515 
2516  // then check all the Flys with a URL or image map
2517  {
2518  const SwFrameFormats* pFormats = GetDoc()->GetSpzFrameFormats();
2519  for( SwFrameFormats::size_type n = 0, nEnd = pFormats->size(); n < nEnd; ++n )
2520  {
2521  SwFlyFrameFormat* pFormat = static_cast<SwFlyFrameFormat*>((*pFormats)[ n ]);
2522  const SwFormatURL& rURLItem = pFormat->GetURL();
2523  if( rURLItem.GetMap() || !rURLItem.GetURL().isEmpty() )
2524  {
2525  SwFlyFrame* pFly = pFormat->GetFrame( &aPt );
2526  SwPosition aTmpPos( *pBodySttNd );
2527  if( pFly &&
2528  GetBodyTextNode( *GetDoc(), aTmpPos, *pFly->GetLower() ) )
2529  {
2530  SetGetExpField aPos( *pFormat, &aTmpPos );
2531 
2532  if( bNext
2533  ? ( aPos < aCmpPos && aCurPos < aPos )
2534  : ( aCmpPos < aPos && aPos < aCurPos ))
2535  aCmpPos = aPos;
2536  }
2537  }
2538  }
2539  }
2540 
2541  // found any URL ?
2542  bool bRet = false;
2543  const SwTextINetFormat* pFndAttr = aCmpPos.GetINetFormat();
2544  const SwFlyFrameFormat* pFndFormat = aCmpPos.GetFlyFormat();
2545  if( pFndAttr || pFndFormat )
2546  {
2547  SET_CURR_SHELL( this );
2548  SwCallLink aLk( *this );
2549 
2550  // found a text attribute ?
2551  if( pFndAttr )
2552  {
2553  SwCursorSaveState aSaveState( *m_pCurrentCursor );
2554 
2555  aCmpPos.GetPosOfContent( *m_pCurrentCursor->GetPoint() );
2558  m_pCurrentCursor->GetPoint()->nContent = *pFndAttr->End();
2559 
2561  {
2564  bRet = true;
2565  }
2566  }
2567  // found a draw object ?
2568  else if( RES_DRAWFRMFMT == pFndFormat->Which() )
2569  {
2570  const SdrObject* pSObj = pFndFormat->FindSdrObject();
2571  if (pSObj)
2572  {
2573  static_cast<SwFEShell*>(this)->SelectObj( pSObj->GetCurrentBoundRect().Center() );
2574  MakeSelVisible();
2575  bRet = true;
2576  }
2577  }
2578  else // then is it a fly
2579  {
2580  SwFlyFrame* pFly = pFndFormat->GetFrame(&aPt);
2581  if( pFly )
2582  {
2583  static_cast<SwFEShell*>(this)->SelectFlyFrame( *pFly );
2584  MakeSelVisible();
2585  bRet = true;
2586  }
2587  }
2588  }
2589  return bRet;
2590 }
2591 
2592 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
vcl::RenderContext * GetOut() const
Definition: viewsh.hxx:341
SwSectionNode * FindSectionNode()
Search section node, in which it is.
Definition: ndsect.cxx:958
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:1939
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:1181
void DeleteMark()
Definition: pam.hxx:177
bool ContainsPageDesc(const SwPageDesc *pDesc, size_t *pPos) const
Definition: docdesc.cxx:826
void KillPams()
Definition: crsrsh.cxx:1019
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:1565
SwNode & GetNode(bool bPoint=true) const
Definition: pam.hxx:223
static SwField * GetFieldAtCursor(const SwPaM *pCursor, const bool bIncludeInputFieldAtStart)
Definition: crstrvl.cxx:929
SwShellCursor * m_pCurrentCursor
current cursor
Definition: crsrsh.hxx:179
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:560
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:188
const SwTableBox * GetTableBox(const OUString &rName, const bool bPerformValidCheck=false) const
Definition: swtable.cxx:1343
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:2225
constexpr TypedWhichId< SwTableBoxValue > RES_BOXATR_VALUE(150)
check overlapping PaMs
Definition: crsrsh.hxx:158
SwNodeIndex nNode
Definition: pam.hxx:37
bool IsTableMode() const
Definition: crsrsh.hxx:647
keep Up/Down on columns
Definition: crsrsh.hxx:156
bool MoveFieldType(const SwFieldType *pFieldType, const bool bNext, const SwFieldIds nResType=SwFieldIds::Unknown, const bool bAddSetExpressionFieldsToInputFields=true)
Definition: crstrvl.cxx:726
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:3021
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:44
size_type FindPrevOfSeqNo(size_type nSttPos) const
Definition: docredln.cxx:648
const SwRect & getFramePrintArea() const
Definition: frame.hxx:178
Pos1 is as large as Pos2.
const SfxPoolItem * pAttr
Definition: crsrsh.hxx:100
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:2338
Pos1 completely contained in Pos2.
SwContentFrame * getLayoutFrame(const SwRootFrame *, const SwPosition *pPos=nullptr, std::pair< Point, bool > const *pViewPosAndCalcFrame=nullptr) const
Definition: node.cxx:1148
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:221
Definition: doc.hxx:186
static SwContentNode * GoPrevSection(SwNodeIndex *, bool bSkipHidden=true, bool bSkipProtect=true)
Definition: nodes.cxx:1952
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:3057
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:337
void Pos(const Point &rNew)
Definition: swrect.hxx:169
IDocumentMarkAccess * getIDocumentMarkAccess()
Definition: docbm.cxx:1683
IDocumentUndoRedo & GetIDocumentUndoRedo()
Definition: doc.cxx:143
virtual void Calc(vcl::RenderContext *pRenderContext) const
Definition: trvlfrm.cxx:1785
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:1721
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:420
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:1269
The root element of a Writer document layout.
Definition: rootfrm.hxx:79
const SwFrameFormats * GetSpzFrameFormats() const
Definition: doc.hxx:741
int GetAttrOutlineLevel() const
Returns outline level of this text node.
Definition: ndtxt.cxx:4024
bool HasSelection() const
Does the current cursor create a selection?
Definition: crsrsh.cxx:2500
bool MakeOutlineSel(SwOutlineNodes::size_type nSttPos, SwOutlineNodes::size_type nEndPos, bool bWithChildren, bool bKillPams=true)
Definition: crstrvl.cxx:1192
long GetUpDownX() const
Definition: crsrsh.hxx:351
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:423
const OUString & GetValue() const
Definition: fmtinfmt.hxx:75
const SfxPoolItem * NextItem()
SwWrongList * SubList(sal_uInt16 nIdx) const
Definition: wrong.hxx:346
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:1132
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:174
SwIndex nContent
Definition: pam.hxx:38
const SwRect & getFrameArea() const
Definition: frame.hxx:177
void NormalizePam(bool bPointFirst=true)
Ensure point and mark of the current PaM are in a specific order.
Definition: crsrsh.cxx:967
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:939
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
bool IsTextFrame() const
Definition: frame.hxx:1212
sal_Int32 GetStart() const
Definition: txatbase.hxx:82
const sal_uInt8 MAXLEVEL
Definition: swtypes.hxx:95
IsAttrAtPos eContentAtPos
Definition: crsrsh.hxx:105
Pos2 completely contained in Pos1.
only for debugging
OUString sStr
Definition: crsrsh.hxx:107
const SwTable & GetTable() const
Definition: node.hxx:497
SwFillMode
Definition: crstate.hxx:28
union SwContentAtPos::@24 aFnd
SwDoc * GetDoc() const
Definition: viewsh.hxx:284
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:660
void Right(const long nRight)
Definition: swrect.hxx:200
bool SelectNxtPrvHyperlink(bool bNext)
Definition: crstrvl.cxx:2447
const IDocumentRedlineAccess & getIDocumentRedlineAccess() const
Provides access to the document redline interface.
Definition: viewsh.cxx:2593
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:103
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:1169
bool HasClickHdl() const
Does the field possess an action on its ClickHandler? (e.g. INetFields, ...).
Definition: fldbas.cxx:379
SwShellCursor * GetCursor_()
Definition: crsrsh.hxx:332
bool SelectText(const sal_Int32 nStart, const sal_Int32 nEnd)
Definition: crstrvl.cxx:1973
const OUString & GetAlternativeText() const
Definition: tox.hxx:533
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:614
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:893
bool SetShadowCursorPos(const Point &rPt, SwFillMode eFillMode)
Definition: crstrvl.cxx:2080
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:2052
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:121
int i
bool GoInNode(SwPaM &rPam, SwMoveFnCollection const &fnMove)
Definition: pam.cxx:954
const SwField * pField
Definition: crsrsh.hxx:99
const SwFrame * GetLastLower() const
Definition: findfrm.cxx:1817
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:238
SwIndex & Assign(SwIndexReg *, sal_Int32)
Definition: index.cxx:206
const SwPageDesc & GetPageDesc(const size_t i) const
Definition: doc.hxx:880
SwPageFrame * FindPageFrame()
Definition: frame.hxx:660
const SwRangeRedline * SelPrevRedline()
Definition: crstrvl.cxx:2245
bool ActionPend() const
Definition: viewsh.hxx:199
TElementType * First()
Definition: calbck.hxx:343
SwPageDesc * GetPageDesc()
Definition: pagefrm.hxx:129
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:2026
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:37
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:1274
const SwFlyFrameFormat * GetFlyFormat() const
Definition: docfld.hxx:89
#define SET_CURR_SHELL(shell)
Definition: swtypes.hxx:101
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:1104
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:102
ring_container GetRingContainer()
const_iterator end() const
SwTextField * GetFieldTextAttrAt(const sal_Int32 nIndex, const bool bIncludeInputFieldAtStart=false) const
Definition: ndtxt.cxx:1765
bool SelectTextAttr(sal_uInt16 nWhich, bool bExpand, const SwTextAttr *pAttr=nullptr)
Definition: crstrvl.cxx:1997
bool empty() const
void SetAdjust(const SvxAdjust eType)
bool IsInProtectSect() const
is the node in a protected section?
Definition: crstrvl.cxx:1905
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:108
A page of the document layout.
Definition: pagefrm.hxx:40
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:2265
static sal_Int32 EndOfInputFieldAtPos(const SwPosition &rPos)
Definition: crstrvl.cxx:994
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:409
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:221
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:975
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:641
IDocumentUndoRedo const & GetIDocumentUndoRedo() const
Provides access to the document undo/redo interface.
Definition: viewsh.cxx:2603
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:478
const SwStartNode * GetSttNd() const
Definition: swtable.hxx:439
const SwTextNode * FindOutlineNodeOfLevel(sal_uInt8 nLvl, SwRootFrame const *pLayout=nullptr) const
Definition: node.cxx:763
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:3375
const SwCharFormats * GetCharFormats() const
Definition: doc.hxx:737
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:2440
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:340
static sal_Int32 StartOfInputFieldAtPos(const SwPosition &rPos)
Definition: crstrvl.cxx:986
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:95
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:405
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:970
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:1733
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:157
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:936
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:101
const SwTOXMark & GotoTOXMark(const SwTOXMark &rStart, SwTOXSearch eDir)
traveling between marks
Definition: crstrvl.cxx:637
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:350
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:695
bool m_bPosCorr
Point had to be corrected.
Definition: crstate.hxx:143
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:1900
bool GotoNxtPrvTOXMark(bool bNext=true)
jump to next/previous index marker
Definition: crstrvl.cxx:540
bool IsDocNodes() const
Is the NodesArray the regular one of Doc? (and not the UndoNds, ...) Implementation in doc...
Definition: nodes.cxx:2313
size_t size() const
void GetPosOfContent(SwPosition &rPos) const
Definition: docfld.cxx:157
make visible in spite of Readonly
Definition: crsrsh.hxx:159
SwSectionNode * GetSectionNode()
Definition: node.hxx:607
const SwTextTOXMark * GetTextTOXMark() const
Definition: tox.hxx:137
SwFrameFormatsBase::size_type size_type
bool GetContentAtPos(const Point &rPt, SwContentAtPos &rContentAtPos, bool bSetCursor=false, SwRect *pFieldRect=nullptr)
Definition: crstrvl.cxx:1281
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:171
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:168
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:1882
SwSectionFormats & GetSections()
Definition: doc.hxx:1336
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:906
bool IsTextNode() const
Definition: node.hxx:636
bool GotoOutline(const OUString &rName)
Definition: crstrvl.cxx:1019
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:1277
bool GotoFormatField(const SwFormatField &rField)
Definition: crstrvl.cxx:865
SdrObject * FindSdrObject()
Definition: frmfmt.hxx:137
const SwFormatINetFormat * FindINetAttr(const OUString &rName) const
Definition: crstrvl.cxx:2047
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:1250
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:1317
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:2273
const SwFormatINetFormat & GetINetFormat() const
Definition: txatbase.hxx:224
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:836
bool GotoNextOutline()
jump to next node with outline num.
Definition: crstrvl.cxx:1038
bool IsHeaderFrame() const
Definition: frame.hxx:1168
SwFlyFrame * GetFrame(const Point *pDocPos=nullptr) const
Definition: atrfrm.cxx:3053
bool IsProtected() const
Is the Frame or rather the Section in which it lies protected?
Definition: trvlfrm.cxx:1625
const OUString & GetURL() const
Definition: fmturl.hxx:66
static SwTextField * GetTextFieldAtPos(const SwPosition *pPos, const bool bIncludeInputFieldAtStart)
Definition: crstrvl.cxx:891
Base class of the Writer document model elements.
Definition: node.hxx:79
SwTextFormatColl * GetTextColl() const
Definition: ndtxt.hxx:830
OStringBuffer & padToLength(OStringBuffer &rBuffer, sal_Int32 nLength, char cFill= '\0')
bool CursorInsideInputField() const
Definition: crstrvl.cxx:960
typedef void(CALLTYPE *GetFuncDataPtr)(sal_uInt16 &nNo