LibreOffice Module sw (master) 1
editsh.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 <hintids.hxx>
21#include <osl/diagnose.h>
22#include <vcl/commandevent.hxx>
25#include <comphelper/string.hxx>
27#include <fmtsrnd.hxx>
28#include <fmtinfmt.hxx>
29#include <txtinet.hxx>
30#include <frmfmt.hxx>
31#include <charfmt.hxx>
32#include <doc.hxx>
33#include <IDocumentUndoRedo.hxx>
38#include <IDocumentState.hxx>
39#include <editsh.hxx>
40#include <frame.hxx>
41#include <cntfrm.hxx>
42#include <pam.hxx>
43#include <ndtxt.hxx>
44#include <flyfrm.hxx>
45#include <swundo.hxx>
46#include <calc.hxx>
47#include <ndgrf.hxx>
48#include <ndole.hxx>
49#include <txtfrm.hxx>
50#include <rootfrm.hxx>
51#include <extinput.hxx>
52#include <scriptinfo.hxx>
53#include <unocrsrhelper.hxx>
54#include <section.hxx>
55#include <numrule.hxx>
56#include <SwNodeNum.hxx>
57#include <unocrsr.hxx>
58#include <calbck.hxx>
59
60using namespace com::sun::star;
61
62void SwEditShell::Insert( sal_Unicode c, bool bOnlyCurrCursor )
63{
65 for(SwPaM& rPaM : GetCursor()->GetRingContainer())
66 {
67 const bool bSuccess = GetDoc()->getIDocumentContentOperations().InsertString(rPaM, OUString(c));
68 OSL_ENSURE( bSuccess, "Doc->Insert() failed." );
69
70 SaveTableBoxContent( rPaM.GetPoint() );
71 if( bOnlyCurrCursor )
72 break;
73
74 }
75
77}
78
79void SwEditShell::Insert2(const OUString &rStr, const bool bForceExpandHints )
80{
82 {
83 const SwInsertFlags nInsertFlags =
84 bForceExpandHints
87
88 for(SwPaM& rCurrentCursor : getShellCursor( true )->GetRingContainer())
89 {
90 //OPT: GetSystemCharSet
92 const bool bSuccess =
93 GetDoc()->getIDocumentContentOperations().InsertString(rCurrentCursor, rStr, nInsertFlags);
94 OSL_ENSURE( bSuccess, "Doc->Insert() failed." );
95
96 if (bSuccess)
97 {
98 GetDoc()->UpdateRsid( rCurrentCursor, rStr.getLength() );
99
100 // Set paragraph rsid if beginning of paragraph
101 SwTextNode *const pTextNode =
102 rCurrentCursor.GetPoint()->GetNode().GetTextNode();
103 if( pTextNode && pTextNode->Len() == 1)
104 GetDoc()->UpdateParRsid( pTextNode );
105 }
106
107 SaveTableBoxContent( rCurrentCursor.GetPoint() );
108
109 }
110 }
111
112 // calculate cursor bidi level
113 SwCursor* pTmpCursor = GetCursor_();
114 const bool bDoNotSetBidiLevel = ! pTmpCursor ||
115 ( dynamic_cast<SwUnoCursor*>(pTmpCursor) != nullptr );
116
117 if ( ! bDoNotSetBidiLevel )
118 {
119 SwNode& rNode = pTmpCursor->GetPoint()->GetNode();
120 if ( rNode.IsTextNode() )
121 {
122 sal_Int32 nPrevPos = pTmpCursor->GetPoint()->GetContentIndex();
123 if ( nPrevPos )
124 --nPrevPos;
125
126 SwTextFrame const* pFrame;
128 static_cast<SwTextNode&>(rNode), &pFrame, true);
129
130 sal_uInt8 nLevel = 0;
131 if ( ! pSI )
132 {
133 // seems to be an empty paragraph.
134 Point aPt;
135 std::pair<Point, bool> const tmp(aPt, false);
136 pFrame = static_cast<SwTextFrame*>(
137 static_cast<SwTextNode&>(rNode).getLayoutFrame(
138 GetLayout(), pTmpCursor->GetPoint(), &tmp));
139
140 SwScriptInfo aScriptInfo;
141 aScriptInfo.InitScriptInfo(static_cast<SwTextNode&>(rNode),
142 pFrame->GetMergedPara(), pFrame->IsRightToLeft());
143 TextFrameIndex const iPrevPos(pFrame->MapModelToView(
144 &static_cast<SwTextNode&>(rNode), nPrevPos));
145 nLevel = aScriptInfo.DirType( iPrevPos );
146 }
147 else
148 {
150 {
151 // mystery why this doesn't use the other overload?
152 pSI->InitScriptInfo(static_cast<SwTextNode&>(rNode), pFrame->GetMergedPara());
153 }
154 TextFrameIndex const iPrevPos(pFrame->MapModelToView(
155 &static_cast<SwTextNode&>(rNode), nPrevPos));
156 nLevel = pSI->DirType(iPrevPos);
157 }
158
159 pTmpCursor->SetCursorBidiLevel( nLevel );
160 }
161 }
162
163 SetInFrontOfLabel( false ); // #i27615#
165 EndAllAction();
166}
167
168void SwEditShell::Overwrite(const OUString &rStr)
169{
171 for(SwPaM& rPaM : GetCursor()->GetRingContainer())
172 {
173 if( !GetDoc()->getIDocumentContentOperations().Overwrite(rPaM, rStr ) )
174 {
175 OSL_FAIL( "Doc->getIDocumentContentOperations().Overwrite(Str) failed." );
176 }
177 SaveTableBoxContent( rPaM.GetPoint() );
178 }
179 EndAllAction();
180}
181
182void SwEditShell::SplitNode( bool bAutoFormat, bool bCheckTableStart )
183{
185 GetDoc()->GetIDocumentUndoRedo().StartUndo(SwUndoId::EMPTY, nullptr);
186
187 for(SwPaM& rPaM : GetCursor()->GetRingContainer())
188 {
189 // Here, a table cell becomes a normal text cell.
190 GetDoc()->ClearBoxNumAttrs( rPaM.GetPoint()->GetNode() );
191 GetDoc()->getIDocumentContentOperations().SplitNode( *rPaM.GetPoint(), bCheckTableStart );
192 }
193
194 GetDoc()->GetIDocumentUndoRedo().EndUndo(SwUndoId::EMPTY, nullptr);
195
196 if( bAutoFormat )
198
200
201 EndAllAction();
202}
203
205{
206 bool bRet = false;
208 GetDoc()->GetIDocumentUndoRedo().StartUndo(SwUndoId::EMPTY, nullptr);
209
210 for(SwPaM& rPaM : GetCursor()->GetRingContainer())
211 {
212 GetDoc()->ClearBoxNumAttrs( rPaM.GetPoint()->GetNode() );
213 bRet = GetDoc()->getIDocumentContentOperations().AppendTextNode( *rPaM.GetPoint()) || bRet;
214 }
215
216 GetDoc()->GetIDocumentUndoRedo().EndUndo(SwUndoId::EMPTY, nullptr);
217
219
220 EndAllAction();
221 return bRet;
222}
223
224// the returned SwGrfNode pointer is used in GetGraphic() and GetGraphicSize()
226{
227 SwGrfNode *pGrfNode = nullptr;
228 SwPaM* pCursor = GetCursor();
229 if( !pCursor->HasMark() ||
230 pCursor->GetPoint()->GetNode() == pCursor->GetMark()->GetNode() )
231 pGrfNode = pCursor->GetPoint()->GetNode().GetGrfNode();
232
233 return pGrfNode;
234}
235
236// returns a Graphic pointer if CurrentCursor->GetPoint() points to a SwGrfNode and
237// GetMark is not set or points to the same Graphic
238const Graphic* SwEditShell::GetGraphic( bool bWait ) const
239{
240 SwGrfNode* pGrfNode = GetGrfNode_();
241 const Graphic* pGrf( nullptr );
242 if ( pGrfNode )
243 {
244 pGrf = &(pGrfNode->GetGrf(bWait && GraphicType::Default == pGrfNode->GetGrf().GetType()));
245 }
246 return pGrf;
247}
248
250{
251 SwGrfNode *pGrfNode = GetGrfNode_();
252 return pGrfNode &&
253 pGrfNode->IsLinkedFile() &&
254 GraphicType::Default == pGrfNode->GetGrfObj().GetType();
255}
256
258{
259 SwGrfNode* pGrfNode = GetGrfNode_();
260 return pGrfNode ? &(pGrfNode->GetGrfObj()) : nullptr;
261}
262
264{
265 SwGrfNode* pGrfNode = GetGrfNode_();
266 const SwFrame* pFrame = GetCurrFrame(false);
267 return pGrfNode ? &(pGrfNode->GetGraphicAttr( rGA, pFrame )) : nullptr;
268}
269
271{
272 SwGrfNode *pGrfNode = GetGrfNode_();
273 return pGrfNode ? pGrfNode->GetGrfObj().GetType() : GraphicType::NONE;
274}
275
276// returns the size of a graphic in <rSz> if CurrentCursor->GetPoint() points to a SwGrfNode and
277// GetMark is not set or points to the same graphic
279{
280 SwNoTextNode* pNoTextNd;
281 SwPaM* pCurrentCursor = GetCursor();
282 if( ( !pCurrentCursor->HasMark()
283 || pCurrentCursor->GetPoint()->GetNode() == pCurrentCursor->GetMark()->GetNode() )
284 && nullptr != ( pNoTextNd = pCurrentCursor->GetPointNode().GetNoTextNode() ) )
285 {
286 rSz = pNoTextNd->GetTwipSize();
287 return true;
288 }
289 return false;
290
291}
292
294void SwEditShell::ReRead( const OUString& rGrfName, const OUString& rFltName,
295 const Graphic* pGraphic )
296{
298 mxDoc->getIDocumentContentOperations().ReRead( *GetCursor(), rGrfName, rFltName, pGraphic );
299 EndAllAction();
300}
301
304void SwEditShell::GetGrfNms( OUString* pGrfName, OUString* pFltName,
305 const SwFlyFrameFormat* pFormat ) const
306{
307 OSL_ENSURE( pGrfName || pFltName, "No parameters" );
308 if( pFormat )
309 SwDoc::GetGrfNms( *pFormat, pGrfName, pFltName );
310 else
311 {
312 SwGrfNode *pGrfNode = GetGrfNode_();
313 if( pGrfNode && pGrfNode->IsLinkedFile() )
314 pGrfNode->GetFileFilterNms( pGrfName, pFltName );
315 }
316}
317
319{
321 return pNd->HasContour();
322}
323
325{
328 pNd->SetContour( pPoly );
329 SwFlyFrame *pFly = static_cast<SwFlyFrame*>(pNd->getLayoutFrame(GetLayout())->GetUpper());
330 const SwFormatSurround &rSur = pFly->GetFormat()->GetSurround();
331 pFly->GetFormat()->CallSwClientNotify(sw::LegacyModifyHint(&rSur, &rSur));
333 EndAllAction();
334}
335
337{
339 OSL_ENSURE( pNd, "is no NoTextNode!" );
340 if( pNd->HasAutomaticContour() )
341 {
343 pNd->SetContour( nullptr );
344 SwFlyFrame *pFly = static_cast<SwFlyFrame*>(pNd->getLayoutFrame(GetLayout())->GetUpper());
345 const SwFormatSurround &rSur = pFly->GetFormat()->GetSurround();
346 pFly->GetFormat()->CallSwClientNotify(sw::LegacyModifyHint(&rSur, &rSur));
348 EndAllAction();
349 }
350}
351
359{
360 OSL_ENSURE( CNT_OLE == GetCntType(), "GetOLEObj: no OLENode." );
361 OSL_ENSURE( !GetCursor()->HasMark() ||
362 (GetCursor()->HasMark() &&
363 GetCursor()->GetPoint()->GetNode() == GetCursor()->GetMark()->GetNode()),
364 "GetOLEObj: no OLENode." );
365
366 SwOLENode *pOLENode = GetCursor()->GetPointNode().GetOLENode();
367 OSL_ENSURE( pOLENode, "GetOLEObj: no OLENode." );
368 SwOLEObj& rOObj = pOLENode->GetOLEObj();
369 return rOObj.GetObject();
370}
371
372bool SwEditShell::HasOLEObj( std::u16string_view rName ) const
373{
374 SwStartNode *pStNd;
375 SwNodeIndex aIdx( *GetNodes().GetEndOfAutotext().StartOfSectionNode(), 1 );
376 while ( nullptr != (pStNd = aIdx.GetNode().GetStartNode()) )
377 {
378 ++aIdx;
379 SwNode& rNd = aIdx.GetNode();
380 if( rNd.IsOLENode() &&
381 rName == static_cast<SwOLENode&>(rNd).GetChartTableName() &&
382 static_cast<SwOLENode&>(rNd).getLayoutFrame( GetLayout() ) )
383 return true;
384
385 aIdx.Assign( *pStNd->EndOfSectionNode(), + 1 );
386 }
387 return false;
388}
389
390void SwEditShell::SetChartName( const OUString &rName )
391{
393 OSL_ENSURE( pONd, "ChartNode not found" );
394 pONd->SetChartTableName( rName );
395}
396
397void SwEditShell::UpdateCharts( const OUString& rName )
398{
399 GetDoc()->UpdateCharts( rName );
400}
401
403void SwEditShell::SetTableName( SwFrameFormat& rTableFormat, const OUString &rNewName )
404{
405 GetDoc()->SetTableName( rTableFormat, rNewName );
406}
407
410{
411 const SwPaM& rPaM = *GetCursor();
412 const SwTextNode* pNd = rPaM.GetPointNode().GetTextNode();
413 if (!pNd)
414 {
415 return OUString();
416 }
417 SwTextFrame const*const pFrame(static_cast<SwTextFrame*>(pNd->getLayoutFrame(GetLayout())));
418 if (pFrame)
419 {
420 return pFrame->GetCurWord(*rPaM.GetPoint());
421 }
422 return OUString();
423}
424
426{
428 GetDoc()->getIDocumentStatistics().UpdateDocStat( false, true );
429 EndAllAction();
430}
431
433{
435 const SwDocStat &rRet = GetDoc()->getIDocumentStatistics().GetUpdatedDocStat( false, true );
436 EndAllAction();
437 return rRet;
438}
439
441const SwFormatRefMark* SwEditShell::GetRefMark( std::u16string_view rName ) const
442{
443 return GetDoc()->GetRefMark( rName );
444}
445
447sal_uInt16 SwEditShell::GetRefMarks( std::vector<OUString>* pStrings ) const
448{
449 return GetDoc()->GetRefMarks( pStrings );
450}
451
452OUString SwEditShell::GetDropText( const sal_Int32 nChars ) const
453{
454 /*
455 * pb: made changes for #i74939#
456 *
457 * always return a string even though there is a selection
458 */
459
460 OUString aText;
461 SwPaM* pCursor = GetCursor();
462 if ( IsMultiSelection() )
463 {
464 // if a multi selection exists, search for the first line
465 // -> it is the cursor with the lowest index
466 SwNodeOffset nIndex = pCursor->GetMark()->GetNodeIndex();
467 bool bPrev = true;
468 SwPaM* pLast = pCursor;
469 SwPaM* pTemp = pCursor;
470 while ( bPrev )
471 {
472 SwPaM* pPrev2 = pTemp->GetPrev();
473 bPrev = ( pPrev2 && pPrev2 != pLast );
474 if ( bPrev )
475 {
476 pTemp = pPrev2;
477 SwNodeOffset nTemp = pPrev2->GetMark()->GetNodeIndex();
478 if ( nTemp < nIndex )
479 {
480 nIndex = nTemp;
481 pCursor = pPrev2;
482 }
483 }
484 }
485 }
486
487 SwTextNode const*const pTextNd = pCursor->GetMarkNode().GetTextNode();
488 if( pTextNd )
489 {
490 SwTextFrame const*const pTextFrame(static_cast<SwTextFrame const*>(
491 pTextNd->getLayoutFrame(GetLayout())));
492 SAL_WARN_IF(!pTextFrame, "sw.core", "GetDropText cursor has no frame?");
493 if (pTextFrame)
494 {
495 TextFrameIndex const nDropLen(pTextFrame->GetDropLen(TextFrameIndex(nChars)));
496 aText = pTextFrame->GetText().copy(0, sal_Int32(nDropLen));
497 }
498 }
499
500 return aText;
501}
502
503void SwEditShell::ReplaceDropText( const OUString &rStr, SwPaM* pPaM )
504{
505 SwPaM* pCursor = pPaM ? pPaM : GetCursor();
506 if( !(pCursor->GetPoint()->GetNode() == pCursor->GetMark()->GetNode() &&
507 pCursor->GetPointNode().GetTextNode()->IsTextNode()) )
508 return;
509
511
512 const SwNode& rNd = pCursor->GetPoint()->GetNode();
513 SwPaM aPam( rNd, rStr.getLength(), rNd, 0 );
514 SwTextFrame const*const pTextFrame(static_cast<SwTextFrame const*>(
516 if (pTextFrame)
517 {
518 *aPam.GetPoint() = pTextFrame->MapViewToModelPos(TextFrameIndex(0));
519 *aPam.GetMark() = pTextFrame->MapViewToModelPos(TextFrameIndex(
520 std::min(rStr.getLength(), pTextFrame->GetText().getLength())));
521 }
522 if( !GetDoc()->getIDocumentContentOperations().Overwrite( aPam, rStr ) )
523 {
524 OSL_FAIL( "Doc->getIDocumentContentOperations().Overwrite(Str) failed." );
525 }
526
527 EndAllAction();
528}
529
531{
532 OUStringBuffer aFormel; // the final formula
533 SwCalc aCalc( *GetDoc() );
534 const CharClass& rCC = GetAppCharClass();
535
536 for(SwPaM& rCurrentPaM : GetCursor()->GetNext()->GetRingContainer())
537 {
538 SwTextNode* pTextNd = rCurrentPaM.GetPointNode().GetTextNode();
539 if(pTextNd)
540 {
541 const SwPosition *pStart = rCurrentPaM.Start(), *pEnd = rCurrentPaM.End();
542 const sal_Int32 nStt = pStart->GetContentIndex();
543 OUString aStr = pTextNd->GetExpandText(GetLayout(),
544 nStt, pEnd->GetContentIndex() - nStt);
545
546 aStr = rCC.lowercase( aStr );
547
548 bool bValidFields = false;
549 sal_Int32 nPos = 0;
550
551 while( nPos < aStr.getLength() )
552 {
553 sal_Unicode ch = aStr[ nPos++ ];
554 if( rCC.isLetter( aStr, nPos-1 ) || ch == '_' )
555 {
556 sal_Int32 nTmpStt = nPos-1;
557 while( nPos < aStr.getLength() &&
558 0 != ( ch = aStr[ nPos++ ]) &&
559 (rCC.isLetterNumeric( aStr, nPos - 1 ) ||
560 ch == '_'|| ch == '.' ))
561 ;
562
563 if( nPos < aStr.getLength() )
564 --nPos;
565
566 OUString sVar = aStr.copy( nTmpStt, nPos - nTmpStt );
567 if( !::FindOperator( sVar ) &&
568 (aCalc.GetVarTable().Find(sVar) ||
569 aCalc.VarLook( sVar )) )
570 {
571 if( !bValidFields )
572 {
574 pStart->GetNodeIndex(),
575 pStart->GetContentIndex() );
576 bValidFields = true;
577 }
578 aFormel.append("(" + aCalc.GetStrResult( aCalc.VarLook( sVar )->nValue ) + ")");
579 }
580 else
581 aFormel.append(sVar);
582 }
583 else
584 aFormel.append(ch);
585 }
586 }
587 }
588
589 return aCalc.GetStrResult( aCalc.Calculate(aFormel.makeStringAndClear()) );
590}
591
593{
594 return mxDoc->getIDocumentLinksAdministration().GetLinkManager();
595}
596
598{
599 // The node on which the cursor points should be sufficient as a unique identifier
600 return static_cast<void*>(&(GetCursor()->GetPointNode()));
601}
602
603// #i73788#
605{
606 // returns always a graphic if the cursor is in a Fly
607 CurrShell aCurr( const_cast<SwEditShell*>(this) );
608 Graphic aRet;
609 SwPaM* pCursor = GetCursor();
610 if ( !pCursor->HasMark() )
611 {
612 SwNode& rNd =pCursor->GetPointNode();
613 if( rNd.IsGrfNode() )
614 {
615 SwGrfNode & rGrfNode(static_cast<SwGrfNode&>(rNd));
616 aRet = rGrfNode.GetGrf(GraphicType::Default == rGrfNode.GetGrf().GetType());
617 }
618 else if ( rNd.IsOLENode() )
619 {
620 if (const Graphic* pGraphic = static_cast<SwOLENode&>(rNd).GetGraphic())
621 aRet = *pGraphic;
622 }
623 else
624 {
626 if(pFlyFrame)
627 aRet = pFlyFrame->GetFormat()->MakeGraphic();
628 }
629 }
630 return aRet;
631}
632
633bool SwEditShell::InsertURL( const SwFormatINetFormat& rFormat, const OUString& rStr, bool bKeepSelection )
634{
635 // URL and hint text (directly or via selection) necessary
636 if( rFormat.GetValue().isEmpty() || ( rStr.isEmpty() && !HasSelection() ) )
637 return false;
640 bool bInsText = true;
641
642 if( !rStr.isEmpty() )
643 {
644 SwPaM* pCursor = GetCursor();
645 if( pCursor->HasMark() && *pCursor->GetPoint() != *pCursor->GetMark() )
646 {
647 // Selection existent, multi selection?
648 bool bDelText = true;
649 if( !pCursor->IsMultiSelection() )
650 {
651 // simple selection -> check the text
652 const OUString sText(comphelper::string::stripEnd(GetSelText(), ' '));
653 if( sText == rStr )
654 bDelText = bInsText = false;
655 }
656 else if( rFormat.GetValue() == rStr ) // Are Name and URL equal?
657 bDelText = bInsText = false;
658
659 if( bDelText )
660 Delete(true);
661 }
662 else if( pCursor->IsMultiSelection() && rFormat.GetValue() == rStr )
663 bInsText = false;
664
665 if( bInsText )
666 {
667 Insert2( rStr );
668 SetMark();
669 ExtendSelection( false, rStr.getLength() );
670 }
671 }
672 else
673 bInsText = false;
674
675 SetAttrItem( rFormat );
676 if (bInsText && !IsCursorPtAtEnd())
677 SwapPam();
678 if(!bKeepSelection)
679 ClearMark();
680 if( bInsText )
683 EndAllAction();
684 return true;
685}
686
687void SwEditShell::GetINetAttrs(SwGetINetAttrs& rArr, bool bIncludeInToxContent)
688{
689 rArr.clear();
690
691 const SwCharFormats* pFormats = GetDoc()->GetCharFormats();
692 for( auto n = pFormats->size(); 1 < n; )
693 {
694 SwIterator<SwTextINetFormat,SwCharFormat> aIter(*(*pFormats)[--n]);
695 for( SwTextINetFormat* pFnd = aIter.First(); pFnd; pFnd = aIter.Next() )
696 {
697 SwTextNode const*const pTextNd(pFnd->GetpTextNode());
698 SwTextFrame const*const pFrame(pTextNd
699 ? static_cast<SwTextFrame const*>(pTextNd->getLayoutFrame(GetLayout()))
700 : nullptr);
701 if (nullptr != pTextNd && nullptr != pFrame
702 && pTextNd->GetNodes().IsDocNodes()
703 // check it's not fully deleted
704 && pFrame->MapModelToView(pTextNd, pFnd->GetStart())
705 != pFrame->MapModelToView(pTextNd, *pFnd->GetEnd()))
706 {
707 // tdf#52113, tdf#148312 Don't include table of contents hyperlinks in the
708 // Navigator content tree Hyperlinks entries
709 if (!bIncludeInToxContent)
710 {
711 if(const SwSectionNode* pSectNd = pTextNd->FindSectionNode())
712 {
713 SectionType eType = pSectNd->GetSection().GetType();
715 continue;
716 }
717 }
718
719 SwTextINetFormat& rAttr = *pFnd;
720 OUString sText( pTextNd->GetExpandText(GetLayout(),
721 rAttr.GetStart(), *rAttr.GetEnd() - rAttr.GetStart()) );
722
723 sText = sText.replaceAll("\x0a", "");
724 sText = comphelper::string::strip(sText, ' ');
725
726 if( !sText.isEmpty() )
727 {
728 rArr.emplace_back(sText, rAttr);
729 }
730 }
731 }
732 }
733}
734
738{
739 bool bRet = SelectTextAttr( RES_TXTATR_INETFMT, false );
740 if( bRet )
741 DeleteSel(*GetCursor(), true);
742}
743
746{
747 bool bRet = false;
748 if( !IsTableMode() && GetDoc()->DontExpandFormat( *GetCursor()->GetPoint() ))
749 {
750 bRet = true;
751 CallChgLnk();
752 }
753 return bRet;
754}
755
757{
758 return GetDoc()->GetNumberFormatter();
759}
760
762{
764 bool bRet = GetDoc()->ConvertFieldsToText(*GetLayout());
765 EndAllAction();
766 return bRet;
767}
768
770{
772 Push();
773 // iterate over all text contents - body, frames, header, footer, footnote text
774 SwPaM* pCursor = GetCursor();
775 for(int i = 0; i < 2; i++)
776 {
777 if(!i)
779 else
781 SwPosition* pSttPos = pCursor->Start(), *pEndPos = pCursor->End();
782 SwNodeOffset nCurrNd = pSttPos->GetNodeIndex();
783 SwNodeOffset nEndNd = pEndPos->GetNodeIndex();
784 if( nCurrNd <= nEndNd )
785 {
786 SwContentFrame* pContentFrame;
787 bool bGoOn = true;
788 // iterate over all paragraphs
789 while( bGoOn )
790 {
791 SwNode* pNd = GetDoc()->GetNodes()[ nCurrNd ];
792 switch( pNd->GetNodeType() )
793 {
794 case SwNodeType::Text:
795 pContentFrame = static_cast<SwTextNode*>(pNd)->getLayoutFrame( GetLayout() );
796 if( nullptr != pContentFrame )
797 {
798 // skip hidden frames - ignore protection!
799 if( !static_cast<SwTextFrame*>(pContentFrame)->IsHiddenNow() )
800 {
801 // if the node is numbered and the starting value of the numbering equals the
802 // start value of the numbering rule then set this value as hard starting value
803
804 // get the node num
805 // OD 2005-11-09
806 SwTextNode* pTextNd( pNd->GetTextNode() );
807 SwNumRule* pNumRule( pTextNd->GetNumRule() );
808
809 // sw_redlinehide: not sure what this should do, only called from mail-merge
810 bool bIsNodeNum =
811 ( pNumRule && pTextNd->GetNum() &&
812 ( pTextNd->HasNumber() || pTextNd->HasBullet() ) &&
813 pTextNd->IsCountedInList() &&
814 !pTextNd->IsListRestart() );
815 if (bIsNodeNum)
816 {
817 int nListLevel = pTextNd->GetActualListLevel();
818
819 if (nListLevel < 0)
820 nListLevel = 0;
821
822 if (nListLevel >= MAXLEVEL)
823 nListLevel = MAXLEVEL - 1;
824
825 bIsNodeNum = pTextNd->GetNum()->GetNumber() ==
826 pNumRule->Get( o3tl::narrowing<sal_uInt16>(nListLevel) ).GetStart();
827 }
828 if (bIsNodeNum)
829 {
830 // now set the start value as attribute
831 SwPosition aCurrentNode(*pNd);
832 GetDoc()->SetNumRuleStart( aCurrentNode );
833 }
834 }
835 }
836 break;
838 // skip hidden sections - ignore protection!
839 if(static_cast<SwSectionNode*>(pNd)->GetSection().IsHidden() )
840 nCurrNd = pNd->EndOfSectionIndex();
841 break;
842 default: break;
843 }
844
845 bGoOn = nCurrNd < nEndNd;
846 ++nCurrNd;
847 }
848 }
849 }
850
852 EndAllAction();
853}
854
856{
857 sal_Int32 nRet = 0;
858 CalcLayout();
859 SwPaM* pPam = GetCursor();
860 SwNodeIndex aStart( pPam->GetPoint()->GetNode() );
861 SwContentNode* pCNd;
862 SwContentFrame *pContentFrame = nullptr;
863
864 aStart = SwNodeOffset(0);
865
866 while( nullptr != ( pCNd = GetDoc()->GetNodes().GoNextSection(
867 &aStart, true, false )) )
868 {
869 if( nullptr != ( pContentFrame = pCNd->getLayoutFrame( GetLayout() ) ) && pContentFrame->IsTextFrame() )
870 {
871 SwTextFrame *const pFrame(static_cast<SwTextFrame*>(pContentFrame));
872 nRet = nRet + pFrame->GetLineCount(TextFrameIndex(COMPLETE_STRING));
873 if (GetLayout()->HasMergedParas())
874 {
875 if (auto const*const pMerged = pFrame->GetMergedPara())
876 {
877 aStart = *pMerged->pLastNode;
878 }
879 }
880 }
881 }
882 return nRet;
883}
884
886{
888 tools::Long nRet = GetDoc()->CompareDoc( rDoc );
889 EndAllAction();
890 return nRet;
891}
892
894{
896 tools::Long nRet = GetDoc()->MergeDoc( rDoc );
897 EndAllAction();
898 return nRet;
899}
900
902{
903 return GetDoc()->GetFootnoteInfo();
904}
905
907{
909 CurrShell aCurr( this );
910 GetDoc()->SetFootnoteInfo(rInfo);
911 CallChgLnk();
912 EndAllAction();
913}
914
916{
917 return GetDoc()->GetEndNoteInfo();
918}
919
921{
923 CurrShell aCurr( this );
924 GetDoc()->SetEndNoteInfo(rInfo);
925 EndAllAction();
926}
927
929{
930 return GetDoc()->GetLineNumberInfo();
931}
932
934{
936 CurrShell aCurr( this );
937 GetDoc()->SetLineNumberInfo(rInfo);
938 AddPaintRect( GetLayout()->getFrameArea() );
939 EndAllAction();
940}
941
943{
945}
946
947void SwEditShell::SetLinkUpdMode( sal_uInt16 nMode )
948{
950}
951
952// Interface for TextInputData - (for text input of japanese/chinese characters)
954{
956 pRet->SetLanguage(eInputLanguage);
958}
959
960OUString SwEditShell::DeleteExtTextInput( bool bInsText )
961{
962 const SwPosition& rPos = *GetCursor()->GetPoint();
963 SwExtTextInput* pDel = GetDoc()->GetExtTextInput( rPos.GetNode(),
964 rPos.GetContentIndex() );
965 if( !pDel )
966 {
967 //JP 25.10.2001: under UNIX the cursor is moved before the Input-
968 // Engine event comes in. So take any - normally there
969 // exist only one at the time. -- Task 92016
970 pDel = GetDoc()->GetExtTextInput();
971 }
972 OUString sRet;
973 if( pDel )
974 {
975 OUString sTmp;
977 sRet = sTmp;
978 CurrShell aCurr( this );
980 pDel->SetInsText( bInsText );
982 const SwPosition aPos( *pDel->GetPoint() );
983 GetDoc()->DeleteExtTextInput( pDel );
984
985 // In this case, the "replace" function did not set the cursor
986 // to the original position. Therefore we have to do this manually.
987 if ( ! bInsText && IsOverwriteCursor() )
988 *GetCursor()->GetPoint() = aPos;
989
990 EndAllAction();
991 }
992 return sRet;
993}
994
996{
997 SwPaM* pCurrentCursor = GetCursor();
998 const SwPosition& rPos = *pCurrentCursor->GetPoint();
999 SwExtTextInput* pInput = GetDoc()->GetExtTextInput( rPos.GetNode() );
1000 if( !pInput )
1001 return;
1002
1004 CurrShell aCurr( this );
1005
1006 if( !rData.IsOnlyCursorChanged() )
1007 pInput->SetInputData( rData );
1008 // position cursor
1009 const SwPosition& rStt = *pInput->Start();
1010 const sal_Int32 nNewCursorPos = rStt.GetContentIndex() + rData.GetCursorPos();
1011
1012 // ugly but works
1013 ShowCursor();
1014 const sal_Int32 nDiff = nNewCursorPos - rPos.GetContentIndex();
1015 if( nDiff != 0)
1016 {
1017 bool bLeft = nDiff < 0;
1018 sal_Int32 nMaxGuard = std::abs(nDiff);
1019 while (true)
1020 {
1021 auto nOldPos = pCurrentCursor->GetPoint()->GetContentIndex();
1022 if (bLeft)
1024 else
1026 auto nNewPos = pCurrentCursor->GetPoint()->GetContentIndex();
1027
1028 // expected success
1029 if (nNewPos == nNewCursorPos)
1030 break;
1031
1032 if (nNewPos == nOldPos)
1033 {
1034 // if there was no movement, we have failed for some reason
1035 SAL_WARN("sw.core", "IM cursor move failed");
1036 break;
1037 }
1038
1039 if (--nMaxGuard == 0)
1040 {
1041 // if it takes more cursor moves than there are utf-16 chars to move past
1042 // something has probably gone wrong
1043 SAL_WARN("sw.core", "IM abandoning cursor positioning");
1044 break;
1045 }
1046 }
1047 }
1048
1050
1051 EndAllAction();
1052
1053 if( !rData.IsCursorVisible() ) // must be called after the EndAction
1054 HideCursor();
1055
1056}
1057
1059{
1060 utl::TransliterationWrapper aTrans( ::comphelper::getProcessComponentContext(), nType );
1062 CurrShell aCurr( this );
1063
1064 SwPaM* pCursor = GetCursor();
1065 if( pCursor->GetNext() != pCursor )
1066 {
1067 GetDoc()->GetIDocumentUndoRedo().StartUndo(SwUndoId::EMPTY, nullptr);
1068 for(const SwPaM& rPaM : GetCursor()->GetRingContainer())
1069 {
1070 if( rPaM.HasMark() )
1072 }
1073 GetDoc()->GetIDocumentUndoRedo().EndUndo(SwUndoId::EMPTY, nullptr);
1074 }
1075 else
1077
1078 EndAllAction();
1079}
1080
1082{
1083 for(const SwPaM& rPaM : GetCursor()->GetRingContainer())
1084 {
1085 if( rPaM.HasMark() )
1086 SwDoc::CountWords( rPaM, rStat );
1087
1088 }
1089}
1090
1092{
1096}
1097
1098/* 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...
CalcOp * FindOperator(const OUString &rSrch)
Definition: calc.cxx:185
OUString lowercase(const OUString &rStr, sal_Int32 nPos, sal_Int32 nCount) const
bool isLetter(const OUString &rStr, sal_Int32 nPos) const
bool isLetterNumeric(const OUString &rStr, sal_Int32 nPos) const
sal_Int32 GetCursorPos() const
bool IsOnlyCursorChanged() const
bool IsCursorOverwrite() const
bool IsCursorVisible() const
GraphicType GetType() const
GraphicType GetType() const
virtual bool AppendTextNode(SwPosition &rPos)=0
virtual bool SplitNode(const SwPosition &rPos, bool bChkTableStart)=0
Split a node at rPos (implemented only for TextNode).
virtual void TransliterateText(const SwPaM &rPaM, utl::TransliterationWrapper &)=0
change text to Upper/Lower/Hiragana/Katakana/...
virtual void SetIME(bool bIME)=0
States that the last inserted string came from IME.
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 void FieldsToCalc(SwCalc &rCalc, SwNodeOffset nLastNd, sal_Int32 nLastCnt)=0
virtual sal_uInt16 getLinkUpdateMode(bool bGlobalSettings) const =0
Get the current link update mode.
virtual void setLinkUpdateMode(sal_uInt16 nMode)=0
Set the current link update mode.
virtual void SetModified()=0
Must be called manually at changes of format.
virtual void UpdateDocStat(bool bCompleteAsync, bool bFields)=0
Updates the internal document's statistics.
virtual const SwDocStat & GetUpdatedDocStat(bool bCompleteAsync, bool bFields)=0
Updates the document statistics if the document has been modified and returns a reference to the resu...
Definition: calc.hxx:200
OUString GetStrResult(const SwSbxValue &rValue)
Definition: calc.cxx:391
SwHashTable< SwCalcExp > & GetVarTable()
Definition: calc.hxx:248
SwSbxValue Calculate(const OUString &rStr)
Definition: calc.cxx:363
SwCalcExp * VarLook(const OUString &rStr, bool bIns=false)
Definition: calc.cxx:429
size_t size() const
Definition: charformats.hxx:71
SwContentFrame is the layout for content nodes: a common base class for text (paragraph) and non-text...
Definition: cntfrm.hxx:59
SwContentFrame * getLayoutFrame(const SwRootFrame *, const SwPosition *pPos=nullptr, std::pair< Point, bool > const *pViewPosAndCalcFrame=nullptr) const
Definition: node.cxx:1223
bool Pop(PopMode, ::std::optional< SwCallLink > &roLink)
void Push()
store a copy of the current cursor on the cursor stack
Definition: crsrsh.cxx:2550
void ShowCursor()
Definition: crsrsh.cxx:2710
void SetOverwriteCursor(bool bFlag)
Definition: crsrsh.hxx:476
void ClearTableBoxContent()
Definition: trvltbl.cxx:906
void StartAction()
Definition: crsrsh.cxx:226
SwShellCursor * GetCursor_()
Definition: crsrsh.hxx:343
void SwapPam()
Definition: crsrsh.cxx:1262
void HideCursor()
Definition: crsrsh.cxx:2731
bool HasSelection() const
Does the current cursor create a selection?
Definition: crsrsh.cxx:2838
bool IsMultiSelection() const
Definition: crsrsh.hxx:915
SwCursor * GetCursor(bool bMakeTableCursor=true) const
Return pointer to the current shell cursor.
Definition: crsrsh.cxx:194
OUString GetSelText() const
get selected text of a node at current cursor
Definition: crsrsh.cxx:2862
bool ExtendSelection(bool bEnd=true, sal_Int32 nCount=1)
extend current SSelection by n characters
Definition: crsrsh.cxx:2944
bool SelectTextAttr(sal_uInt16 nWhich, bool bExpand, const SwTextAttr *pAttr=nullptr)
Definition: crstrvl.cxx:2258
SwMoveFnCollection const & MakeFindRange(SwDocPositions, SwDocPositions, SwPaM *) const
Definition: crsrsh.hxx:898
bool HasMark() const
Definition: crsrsh.hxx:908
void EndAction(const bool bIdleEnd=false)
Definition: crsrsh.cxx:243
bool Right(sal_uInt16 nCnt, SwCursorSkipMode nMode, bool bAllowVisual=false)
Definition: crsrsh.hxx:366
SwContentFrame * GetCurrFrame(const bool bCalcFrame=true) const
Get current frame in which the cursor is positioned.
Definition: crsrsh.cxx:2771
void ClearMark()
Definition: crsrsh.cxx:1225
void SetMark()
Definition: crsrsh.hxx:906
bool SetInFrontOfLabel(bool bNew)
Definition: crsrsh.cxx:1462
bool IsOverwriteCursor() const
Definition: crsrsh.hxx:475
void CallChgLnk()
Definition: crsrsh.cxx:2847
SwShellCursor * getShellCursor(bool bBlock)
Delivers the current shell cursor.
Definition: crsrsh.cxx:3356
bool Left(sal_uInt16 nCnt, SwCursorSkipMode nMode, bool bAllowVisual=false)
Definition: crsrsh.hxx:364
bool IsCursorPtAtEnd() const
Definition: crsrsh.hxx:920
bool IsTableMode() const
Definition: crsrsh.hxx:668
void SaveTableBoxContent(const SwPosition *pPos=nullptr)
Definition: trvltbl.cxx:867
void SetCursorBidiLevel(sal_uInt8 nNewLevel)
Definition: swcrsr.hxx:212
Definition: doc.hxx:197
tools::Long CompareDoc(const SwDoc &rDoc)
Definition: doccomp.cxx:1832
void UpdateCharts(const OUString &rName) const
Definition: docchart.cxx:139
const SwFootnoteInfo & GetFootnoteInfo() const
Definition: doc.hxx:645
static void CountWords(const SwPaM &rPaM, SwDocStat &rStat)
Definition: docedt.cxx:826
IDocumentState const & getIDocumentState() const
Definition: doc.cxx:408
void SetTableName(SwFrameFormat &rTableFormat, const OUString &rNewName)
Definition: docchart.cxx:151
void UpdateRsid(const SwPaM &rRg, sal_Int32 nLen)
Set the rsid of the next nLen symbols of rRg to the current session number.
Definition: docfmt.cxx:411
SwExtTextInput * GetExtTextInput(const SwNode &rNd, sal_Int32 nContentPos=-1) const
Definition: extinput.cxx:275
const SwCharFormats * GetCharFormats() const
Definition: doc.hxx:755
sal_uInt16 GetRefMarks(std::vector< OUString > *=nullptr) const
Definition: doc.cxx:1104
void DeleteExtTextInput(SwExtTextInput *pDel)
Definition: extinput.cxx:263
const SwLineNumberInfo & GetLineNumberInfo() const
Definition: lineinfo.cxx:49
void SetFootnoteInfo(const SwFootnoteInfo &rInfo)
Definition: docftn.cxx:294
IDocumentContentOperations const & getIDocumentContentOperations() const
Definition: doc.cxx:329
IDocumentUndoRedo & GetIDocumentUndoRedo()
Definition: doc.cxx:158
SwNodes & GetNodes()
Definition: doc.hxx:422
IDocumentFieldsAccess const & getIDocumentFieldsAccess() const
Definition: doc.cxx:371
void SetNumRuleStart(const SwPosition &rPos, bool bFlag=true)
Definition: docnum.cxx:1011
static void GetGrfNms(const SwFlyFrameFormat &rFormat, OUString *pGrfName, OUString *pFltName)
Definition: docfly.cxx:707
const SwEndNoteInfo & GetEndNoteInfo() const
Definition: doc.hxx:647
void SetEndNoteInfo(const SwEndNoteInfo &rInfo)
Definition: docftn.cxx:365
bool ConvertFieldsToText(SwRootFrame const &rLayout)
Definition: doc.cxx:1611
const SwFormatRefMark * GetRefMark(std::u16string_view rName) const
Definition: doc.cxx:1060
bool UpdateParRsid(SwTextNode *pTextNode, sal_uInt32 nVal=0)
Definition: docfmt.cxx:442
void SetLineNumberInfo(const SwLineNumberInfo &rInfo)
Definition: lineinfo.cxx:30
void ClearBoxNumAttrs(SwNode &rNode)
Definition: ndtbl.cxx:4237
SwExtTextInput * CreateExtTextInput(const SwPaM &rPam)
Definition: extinput.cxx:254
SvNumberFormatter * GetNumberFormatter(bool bCreate=true)
Definition: doc.hxx:1429
IDocumentStatistics const & getIDocumentStatistics() const
Definition: doc.cxx:387
tools::Long MergeDoc(const SwDoc &rDoc)
Merge two documents.
Definition: doccomp.cxx:2075
void CountWords(SwDocStat &rStat) const
Count words in current selection.
Definition: editsh.cxx:1081
sal_uInt16 GetCntType() const
Determine form of content. Return Type at CurrentCursor->SPoint.
Definition: edws.cxx:126
void GetINetAttrs(SwGetINetAttrs &rArr, bool bIncludeInToxContent=true)
Definition: editsh.cxx:687
virtual void CalcLayout() override
To enable set up of StartActions and EndActions.
Definition: edws.cxx:108
OUString DeleteExtTextInput(bool bInsText=true)
Definition: editsh.cxx:960
void SetChartName(const OUString &rName)
Definition: editsh.cxx:390
void StartAllAction()
For all views of this document.
Definition: edws.cxx:86
void SplitNode(bool bAutoFormat=false, bool bCheckTableStart=true)
Definition: editsh.cxx:182
void SetLineNumberInfo(const SwLineNumberInfo &rInfo)
Definition: editsh.cxx:933
bool HasOLEObj(std::u16string_view rName) const
Is there an OLEObject with this name (SwFormat)?
Definition: editsh.cxx:372
virtual void ApplyViewOptions(const SwViewOption &rOpt) override
Apply ViewOptions with Start-/EndAction.
Definition: editsh.cxx:1091
SAL_DLLPRIVATE void DeleteSel(SwPaM &rPam, bool isArtificialSelection, bool *pUndo=nullptr)
Definition: eddel.cxx:36
tools::Long MergeDoc(const SwDoc &rDoc)
Merge two documents.
Definition: editsh.cxx:893
GraphicType GetGraphicType() const
Definition: editsh.cxx:270
void DelINetAttrWithText()
If cursor is in an INetAttribute it will be deleted completely including the descriptive text (needed...
Definition: editsh.cxx:737
void GetGrfNms(OUString *pGrfName, OUString *pFltName, const SwFlyFrameFormat *=nullptr) const
Returns the name and the filter name of a graphic if the pointer is on a graphic.
Definition: editsh.cxx:304
void SetLinkUpdMode(sal_uInt16 nMode)
Definition: editsh.cxx:947
void SetExtTextInputData(const CommandExtTextInputData &)
Definition: editsh.cxx:995
bool Delete(bool isArtificialSelection=false)
Delete content of all ranges.
Definition: eddel.cxx:134
void AutoFormatBySplitNode()
Definition: autofmt.cxx:2752
void UpdateDocStat()
Document - Statistics.
Definition: editsh.cxx:425
bool GetGrfSize(Size &) const
Definition: editsh.cxx:278
void SetAttrItem(const SfxPoolItem &, SetAttrMode nFlags=SetAttrMode::DEFAULT, const bool bParagraphSetting=false)
Definition: edatmisc.cxx:98
OUString Calculate()
Calculates selection.
Definition: editsh.cxx:530
SvNumberFormatter * GetNumberFormatter()
Query NumberFormatter from document.
Definition: editsh.cxx:756
const SwFootnoteInfo & GetFootnoteInfo() const
Footnote attributes global to document.
Definition: editsh.cxx:901
const SwEndNoteInfo & GetEndNoteInfo() const
Definition: editsh.cxx:915
sal_Int32 GetLineCount()
Definition: editsh.cxx:855
void SetEndNoteInfo(const SwEndNoteInfo &rInfo)
Definition: editsh.cxx:920
void CreateExtTextInput(LanguageType eInputLanguage)
Interface for TextInputData - (for input of Japanese/Chinese chars.)
Definition: editsh.cxx:953
void Overwrite(const OUString &)
Definition: editsh.cxx:168
bool InsertURL(const SwFormatINetFormat &rFormat, const OUString &rStr, bool bKeepSelection=false)
Definition: editsh.cxx:633
tools::Long CompareDoc(const SwDoc &rDoc)
Compare two documents.
Definition: editsh.cxx:885
Graphic GetIMapGraphic() const
Remove default parameter, because method always called this default value.
Definition: editsh.cxx:604
svt::EmbeddedObjectRef & GetOLEObject() const
Get OLE object at pointer.
Definition: editsh.cxx:358
void Insert2(const OUString &, const bool bForceExpandHints=false)
Definition: editsh.cxx:79
void ClearAutomaticContour()
If there's an automatic, not manipulated polygon at the selected notxtnode, it has to be deleted,...
Definition: editsh.cxx:336
void Insert(sal_Unicode, bool bOnlyCurrCursor=false)
Edit (all selected ranges).
Definition: editsh.cxx:62
const SwDocStat & GetUpdatedDocStat()
Definition: editsh.cxx:432
bool IsLinkedGrfSwapOut() const
Definition: editsh.cxx:249
bool DontExpandFormat()
If Cursor is at the end of a character style in which the DontExpand-flag is not yet set,...
Definition: editsh.cxx:745
OUString GetDropText(const sal_Int32 nChars) const
Definition: editsh.cxx:452
SAL_DLLPRIVATE SwGrfNode * GetGrfNode_() const
Returns pointer to a SwGrfNode that will be used by GetGraphic() and GetGraphicSize().
Definition: editsh.cxx:225
bool ConvertFieldsToText()
Replace fields by text - mailmerge support.
Definition: editsh.cxx:761
bool AppendTextNode()
Definition: editsh.cxx:204
sal_uInt16 GetRefMarks(std::vector< OUString > *=nullptr) const
get the names of all references in a Doc
Definition: editsh.cxx:447
void UpdateCharts(const OUString &rName)
Update content of all charts for table with given name.
Definition: editsh.cxx:397
void SetNumberingRestart()
Set all numbering start points to a fixed value - mailmerge support.
Definition: editsh.cxx:769
const GraphicAttr * GetGraphicAttr(GraphicAttr &rGA) const
Definition: editsh.cxx:263
void SetGraphicPolygon(const tools::PolyPolygon *pPoly)
Definition: editsh.cxx:324
void SetFootnoteInfo(const SwFootnoteInfo &rInfo)
Definition: editsh.cxx:906
void SetTableName(SwFrameFormat &rTableFormat, const OUString &rNewName)
change table name
Definition: editsh.cxx:403
void ReplaceDropText(const OUString &rStr, SwPaM *pPaM=nullptr)
Definition: editsh.cxx:503
const GraphicObject * GetGraphicObj() const
Definition: editsh.cxx:257
sfx2::LinkManager & GetLinkManager()
Definition: editsh.cxx:592
const SwLineNumberInfo & GetLineNumberInfo() const
Definition: editsh.cxx:928
const Graphic * GetGraphic(bool bWait=true) const
Definition: editsh.cxx:238
void * GetIMapInventor() const
Unique identification of object (for ImageMapDlg).
Definition: editsh.cxx:597
OUString GetCurWord() const
request current word
Definition: editsh.cxx:409
const tools::PolyPolygon * GetGraphicPolygon() const
Definition: editsh.cxx:318
void EndAllAction()
Definition: edws.cxx:97
void TransliterateText(TransliterationFlags nType)
Change text to Upper/Lower/Hiragana/Katakana/...
Definition: editsh.cxx:1058
void ReRead(const OUString &rGrfName, const OUString &rFltName, const Graphic *pGraphic=nullptr)
Re-read if graphic is not ok. Current graphic is replaced by the new one.
Definition: editsh.cxx:294
sal_uInt16 GetLinkUpdMode() const
Embeds all local links (ranges/graphics).
Definition: editsh.cxx:942
const SwFormatRefMark * GetRefMark(std::u16string_view rName) const
get the reference of a given name in the Doc
Definition: editsh.cxx:441
void SetLanguage(LanguageType eSet)
Definition: extinput.hxx:43
bool IsOverwriteCursor() const
Definition: extinput.hxx:41
void SetInputData(const CommandExtTextInputData &rData)
Definition: extinput.cxx:151
void SetOverwriteCursor(bool bFlag)
Definition: extinput.cxx:221
void SetInsText(bool bFlag)
Definition: extinput.hxx:40
virtual Graphic MakeGraphic(ImageMap *pMap=nullptr, const sal_uInt32 nMaximumQuadraticPixels=500000, const std::optional< Size > &rTargetDPI=std::nullopt) override
Definition: paintfrm.cxx:7823
general base class for all free-flowing frames
Definition: flyfrm.hxx:79
virtual const SwFlyFrameFormat * GetFormat() const override
Definition: fly.cxx:3119
const OUString & GetValue() const
Definition: fmtinfmt.hxx:75
const SwFormatSurround & GetSurround(bool=true) const
Definition: fmtsrnd.hxx:66
Style of a layout element.
Definition: frmfmt.hxx:72
Base class of the Writer layout elements.
Definition: frame.hxx:315
bool IsTextFrame() const
Definition: frame.hxx:1240
SwFlyFrame * FindFlyFrame()
Definition: frame.hxx:1117
bool IsRightToLeft() const
Definition: frame.hxx:993
SwLayoutFrame * GetUpper()
Definition: frame.hxx:684
bool IsLinkedFile() const
Definition: ndgrf.hxx:160
GraphicAttr & GetGraphicAttr(GraphicAttr &, const SwFrame *pFrame) const
Returns the with our graphic attributes filled Graphic-Attr-Structure.
Definition: ndgrf.cxx:709
const GraphicObject & GetGrfObj(bool bWait=false) const
Definition: ndgrf.cxx:364
const Graphic & GetGrf(bool bWait=false) const
Definition: ndgrf.cxx:358
bool GetFileFilterNms(OUString *pFileNm, OUString *pFilterNm) const
Definition: ndgrf.cxx:470
T * Find(std::u16string_view aStr, sal_uInt32 *pPos=nullptr) const
Definition: calc.hxx:166
TElementType * Next()
Definition: calbck.hxx:380
TElementType * First()
Definition: calbck.hxx:372
< purpose of derivation from SwClient: character style for displaying the numbers.
Definition: lineinfo.hxx:39
Layout frame for SwNoTextNode, i.e. graphics and OLE nodes (including charts).
Definition: ndnotxt.hxx:30
void SetContour(const tools::PolyPolygon *pPoly, bool bAutomatic=false)
Definition: ndnotxt.cxx:85
bool HasAutomaticContour() const
Definition: ndnotxt.hxx:77
const tools::PolyPolygon * HasContour() const
Definition: ndnotxt.cxx:105
virtual Size GetTwipSize() const =0
Marks a node in the document model.
Definition: ndindex.hxx:31
SwNode & GetNode() const
Definition: ndindex.hxx:123
SwNodeIndex & Assign(SwNodes const &rNds, SwNodeOffset nIdx)
Definition: ndindex.hxx:114
Base class of the Writer document model elements.
Definition: node.hxx:98
bool IsGrfNode() const
Definition: node.hxx:195
SwStartNode * GetStartNode()
Definition: node.hxx:642
SwGrfNode * GetGrfNode()
Definition: ndgrf.hxx:150
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:901
SwNodes & GetNodes()
Node is in which nodes-array/doc?
Definition: node.hxx:706
bool IsTextNode() const
Definition: node.hxx:190
SwSectionNode * FindSectionNode()
Search section node, in which it is.
Definition: ndsect.cxx:968
SwOLENode * GetOLENode()
Inline methods from Node.hxx.
Definition: ndole.hxx:165
SwNodeOffset EndOfSectionIndex() const
Definition: node.hxx:691
SwContentNode * GetContentNode()
Definition: node.hxx:666
SwNoTextNode * GetNoTextNode()
Definition: ndnotxt.hxx:95
SwNodeType GetNodeType() const
Definition: node.hxx:166
bool IsOLENode() const
Definition: node.hxx:193
const SwEndNode * EndOfSectionNode() const
Definition: node.hxx:695
bool IsDocNodes() const
Is the NodesArray the regular one of Doc? (and not the UndoNds, ...) Implementation in doc....
Definition: nodes.cxx:2555
const SwNumFormat & Get(sal_uInt16 i) const
Definition: number.cxx:87
SwNumberTree::tSwNumTreeNumber GetNumber(bool bValidate=true) const
Returns number of this node.
const SwOLEObj & GetOLEObj() const
Definition: ndole.hxx:116
void SetChartTableName(const OUString &rNm)
Definition: ndole.hxx:157
const OUString & GetChartTableName() const
Definition: ndole.hxx:156
svt::EmbeddedObjectRef & GetObject()
Definition: ndole.cxx:1063
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:188
const SwPosition * GetMark() const
Definition: pam.hxx:255
SwNode & GetPointNode() const
Definition: pam.hxx:275
SwPaM * GetPrev()
Definition: pam.hxx:318
bool IsMultiSelection() const
Definition: pam.hxx:322
const SwPosition * End() const
Definition: pam.hxx:263
SwPaM * GetNext()
Definition: pam.hxx:314
SwNode & GetMarkNode() const
Definition: pam.hxx:276
const SwPosition * GetPoint() const
Definition: pam.hxx:253
const SwPosition * Start() const
Definition: pam.hxx:258
bool HasMark() const
A PaM marks a selection if Point and Mark are distinct positions.
Definition: pam.hxx:251
sal_uInt8 DirType(const TextFrameIndex nPos) const
Definition: porlay.cxx:1899
TextFrameIndex GetInvalidityA() const
Definition: scriptinfo.hxx:119
static SwScriptInfo * GetScriptInfo(const SwTextNode &rNode, SwTextFrame const **o_pFrame=nullptr, bool bAllowInvalid=false)
return a frame for the node, ScriptInfo is its member... (many clients need both frame and SI,...
Definition: porlay.cxx:2608
void InitScriptInfo(const SwTextNode &rNode, sw::MergedPara const *pMerged, bool bRTL)
Definition: porlay.cxx:1127
A section node represents the start of a section on the UI, i.e.
Definition: node.hxx:575
Starts a section of nodes in the document model.
Definition: node.hxx:348
virtual const sal_Int32 * GetEnd() const override
end position
Definition: txatbase.cxx:77
sal_Int32 GetStart() const
Definition: txatbase.hxx:88
Represents the visualization of a paragraph.
Definition: txtfrm.hxx:168
TextFrameIndex GetDropLen(TextFrameIndex nWishLen) const
nWishLen = 0 indicates that we want a whole word
Definition: txtdrop.cxx:172
SwPosition MapViewToModelPos(TextFrameIndex nIndex) const
Definition: txtfrm.cxx:1333
sw::MergedPara * GetMergedPara()
Definition: txtfrm.hxx:465
TextFrameIndex MapModelToView(SwTextNode const *pNode, sal_Int32 nIndex) const
Definition: txtfrm.cxx:1339
bool IsHiddenNow() const
Hidden.
Definition: txtfrm.cxx:1447
sal_Int32 GetLineCount(TextFrameIndex nPos)
Determines the line count.
Definition: txtfrm.cxx:3908
const OUString & GetText() const
Returns the text portion we want to edit (for inline see underneath)
Definition: txtfrm.cxx:1380
OUString GetCurWord(SwPosition const &) const
Definition: txtedt.cxx:688
SwTextAttr subclass that tracks the location of the wrapped SwFormatURL.
Definition: txtinet.hxx:30
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:112
bool HasBullet() const
Returns if this text node has a bullet.
Definition: ndtxt.cxx:3229
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:3505
virtual sal_Int32 Len() const override
Definition: ndtxt.cxx:291
const SwNodeNum * GetNum(SwRootFrame const *pLayout=nullptr, SwListRedlineType eRedline=SwListRedlineType::SHOW) const
Definition: ndtxt.cxx:4095
bool IsCountedInList() const
Definition: ndtxt.cxx:4393
SwNumRule * GetNumRule(bool bInParent=true) const
Returns numbering rule of this text node.
Definition: ndtxt.cxx:2921
bool HasNumber(SwRootFrame const *pLayout=nullptr) const
Returns if this text node has a number.
Definition: ndtxt.cxx:3213
int GetActualListLevel(SwListRedlineType eRedline=SwListRedlineType::SHOW) const
Returns the actual list level of this text node, when it is a list item.
Definition: ndtxt.cxx:4248
bool IsListRestart() const
Definition: ndtxt.cxx:4273
const IDocumentSettingAccess & getIDocumentSettingAccess() const
Provides access to the document setting interface.
Definition: viewsh.cxx:2817
const SwNodes & GetNodes() const
Definition: viewsh.cxx:2181
virtual void ApplyViewOptions(const SwViewOption &rOpt)
Definition: viewsh.cxx:2205
bool AddPaintRect(const SwRect &rRect)
Definition: viewsh.cxx:552
IDocumentContentOperations & getIDocumentContentOperations()
Provides access to the content operations interface.
Definition: viewsh.cxx:2829
rtl::Reference< SwDoc > mxDoc
The document; never 0.
Definition: viewsh.hxx:199
SwRootFrame * GetLayout() const
Definition: viewsh.cxx:2163
SwDoc * GetDoc() const
Definition: viewsh.hxx:308
ring_container GetRingContainer()
Definition: ring.hxx:240
#define CNT_OLE
Definition: editsh.hxx:133
std::vector< SwGetINetAttr > SwGetINetAttrs
Definition: editsh.hxx:128
constexpr OUStringLiteral IsHidden(u"IsHidden")
DocumentType eType
GraphicType
constexpr TypedWhichId< SwFormatINetFormat > RES_TXTATR_INETFMT(51)
CharClass & GetAppCharClass()
Definition: init.cxx:721
sal_Int32 nIndex
sal_Int64 n
sal_uInt16 nPos
#define SAL_WARN_IF(condition, area, stream)
#define SAL_WARN(area, stream)
aStr
void GetTextFromPam(SwPaM &rPam, OUString &rBuffer, SwRootFrame const *pLayout=nullptr)
Definition: unoobj.cxx:135
OString strip(const OString &rIn, char c)
OString stripEnd(const OString &rIn, char c)
int i
long Long
@ Section
SwSectionNode is derived from SwStartNode.
o3tl::strong_int< sal_Int32, struct Tag_SwNodeOffset > SwNodeOffset
Definition: nodeoffset.hxx:16
SwNodeOffset min(const SwNodeOffset &a, const SwNodeOffset &b)
Definition: nodeoffset.hxx:35
SwNodeOffset abs(const SwNodeOffset &a)
Definition: nodeoffset.hxx:34
SwContentNode * GetNode(SwPaM &rPam, bool &rbFirst, SwMoveFnCollection const &fnMove, bool const bInReadOnly, SwRootFrame const *const i_pLayout)
This function returns the next node in direction of search.
Definition: pam.cxx:1043
QPRO_FUNC_TYPE nType
SectionType
Definition: section.hxx:46
SwSbxValue nValue
Definition: calc.hxx:145
Marks a position in the document model.
Definition: pam.hxx:38
SwNode & GetNode() const
Definition: pam.hxx:81
SwNodeOffset GetNodeIndex() const
Definition: pam.hxx:78
sal_Int32 GetContentIndex() const
Definition: pam.hxx:85
constexpr sal_Int32 COMPLETE_STRING
Definition: swtypes.hxx:57
constexpr sal_uInt8 MAXLEVEL
Definition: swtypes.hxx:92
@ UI_INSERT_URLTXT
TransliterationFlags
unsigned char sal_uInt8
sal_uInt16 sal_Unicode