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