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