LibreOffice Module sw (master) 1
wrtsh2.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 <svl/macitem.hxx>
21#include <sfx2/frame.hxx>
22#include <svl/eitem.hxx>
23#include <svl/listener.hxx>
24#include <svl/stritem.hxx>
25#include <sfx2/docfile.hxx>
26#include <sfx2/dispatch.hxx>
27#include <sfx2/linkmgr.hxx>
28#include <sfx2/viewfrm.hxx>
29#include <sot/exchange.hxx>
30#include <osl/diagnose.h>
31#include <o3tl/string_view.hxx>
32#include <fmtinfmt.hxx>
33#include <wrtsh.hxx>
34#include <docsh.hxx>
35#include <fldbas.hxx>
36#include <expfld.hxx>
37#include <docufld.hxx>
38#include <reffld.hxx>
39#include <swundo.hxx>
40#include <doc.hxx>
41#include <frmfmt.hxx>
42#include <fmtfld.hxx>
43#include <view.hxx>
44#include <swevent.hxx>
45#include <section.hxx>
46#include <navicont.hxx>
47#include <txtinet.hxx>
48#include <cmdid.h>
49#include <swabstdlg.hxx>
50#include <SwRewriter.hxx>
51#include <authfld.hxx>
52#include <ndtxt.hxx>
53
54#include <com/sun/star/document/XDocumentProperties.hpp>
55#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
56
57#include <memory>
58
59#include <LibreOfficeKit/LibreOfficeKitEnums.h>
60#include <comphelper/lok.hxx>
61#include <sfx2/event.hxx>
62#include <sal/log.hxx>
63
64bool SwWrtShell::InsertField2(SwField const& rField, SwPaM* pAnnotationRange)
65{
67 if(!CanInsert())
68 return false;
70
71 SwRewriter aRewriter;
72 aRewriter.AddRule(UndoArg1, rField.GetDescription());
73
74 StartUndo(SwUndoId::INSERT, &aRewriter);
75
76 bool bDeleted = false;
77 std::optional<SwPaM> pAnnotationTextRange;
78 if (pAnnotationRange)
79 {
80 pAnnotationTextRange.emplace(*pAnnotationRange->Start(), *pAnnotationRange->End());
81 }
82
83 if ( HasSelection() )
84 {
85 if ( rField.GetTyp()->Which() == SwFieldIds::Postit )
86 {
87 // for annotation fields:
88 // - keep the current selection in order to create a corresponding annotation mark
89 // - collapse cursor to its end
90 if ( IsTableMode() )
91 {
92 GetTableCrs()->Normalize( false );
93 const SwPosition rStartPos( *(GetTableCrs()->GetMark()->GetNode().GetContentNode()), 0 );
94 KillPams();
95 if ( !IsEndOfPara() )
96 {
97 EndPara();
98 }
99 const SwPosition rEndPos( *GetCurrentShellCursor().GetPoint() );
100 pAnnotationTextRange.emplace( rStartPos, rEndPos );
101 }
102 else
103 {
104 NormalizePam( false );
105 const SwPaM& rCurrPaM = GetCurrentShellCursor();
106 pAnnotationTextRange.emplace( *rCurrPaM.GetPoint(), *rCurrPaM.GetMark() );
107 ClearMark();
108 }
109 }
110 else
111 {
112 bDeleted = DelRight();
113 }
114 }
115
116 bool const isSuccess = SwEditShell::InsertField(rField, bDeleted);
117
118 if ( pAnnotationTextRange )
119 {
120 if ( GetDoc() != nullptr )
121 {
122 const SwPaM& rCurrPaM = GetCurrentShellCursor();
123 if (*rCurrPaM.Start() == *pAnnotationTextRange->Start()
124 && *rCurrPaM.End() == *pAnnotationTextRange->End())
125 {
126 // Annotation range was passed in externally, and inserting the postit field shifted
127 // its start/end positions right by one. Restore the original position for the range
128 // start. This allows commenting on the placeholder character of the field.
129 if (pAnnotationTextRange->Start()->GetContentIndex() > 0)
130 pAnnotationTextRange->Start()->AdjustContent(-1);
131 }
133 pMarksAccess->makeAnnotationMark( *pAnnotationTextRange, OUString() );
134 }
135 pAnnotationTextRange.reset();
136 }
137
138 EndUndo();
139 EndAllAction();
140
141 return isSuccess;
142}
143
144// Start the field update
145
147{
148 // Go through the list of fields and updating
149 std::unique_ptr<SwInputFieldList> pTmp;
150 if (!pLst)
151 {
152 pTmp.reset(new SwInputFieldList( this ));
153 pLst = pTmp.get();
154 }
155
156 const size_t nCnt = pLst->Count();
157 if(!nCnt)
158 return;
159
160 pLst->PushCursor();
161
162 bool bCancel = false;
163
164 size_t nIndex = 0;
166
167 SwField* pField = GetCurField();
168 if (pField)
169 {
170 for (size_t i = 0; i < nCnt; i++)
171 {
172 if (pField == pLst->GetField(i))
173 {
174 nIndex = i;
175 break;
176 }
177 }
178 }
179
180 while (!bCancel)
181 {
182 bool bPrev = nIndex > 0;
183 bool bNext = nIndex < nCnt - 1;
184 pLst->GotoFieldPos(nIndex);
185 pField = pLst->GetField(nIndex);
186 if (pField->GetTyp()->Which() == SwFieldIds::Dropdown)
187 {
188 bCancel = StartDropDownFieldDlg(pField, bPrev, bNext, GetView().GetFrameWeld(), &ePressedButton);
189 }
190 else
191 bCancel = StartInputFieldDlg(pField, bPrev, bNext, GetView().GetFrameWeld(), &ePressedButton);
192
193 if (!bCancel)
194 {
195 // Otherwise update error at multi-selection:
196 pLst->GetField(nIndex)->GetTyp()->UpdateFields();
197
198 if (ePressedButton == FieldDialogPressedButton::Previous && nIndex > 0)
199 nIndex--;
200 else if (ePressedButton == FieldDialogPressedButton::Next && nIndex < nCnt - 1)
201 nIndex++;
202 else
203 bCancel = true;
204 }
205 }
206
207 pLst->PopCursor();
208}
209
210namespace {
211
212// Listener class: will close InputField dialog if input field(s)
213// is(are) deleted (for instance, by an extension) after the dialog shows up.
214// Otherwise, the for loop in SwWrtShell::UpdateInputFields will crash when doing:
215// 'pTmp->GetField( i )->GetTyp()->UpdateFields();'
216// on a deleted field.
217class FieldDeletionListener : public SvtListener
218{
219 public:
220 FieldDeletionListener(AbstractFieldInputDlg* pInputFieldDlg, SwField* pField)
221 : mpInputFieldDlg(pInputFieldDlg)
222 , mpFormatField(nullptr)
223 {
224 SwInputField *const pInputField(dynamic_cast<SwInputField*>(pField));
225 SwSetExpField *const pSetExpField(dynamic_cast<SwSetExpField*>(pField));
226
227 if (pInputField && pInputField->GetFormatField())
228 {
229 mpFormatField = pInputField->GetFormatField();
230 }
231 else if (pSetExpField && pSetExpField->GetFormatField())
232 {
233 mpFormatField = pSetExpField->GetFormatField();
234 }
235
236 // Register for possible field deletion while dialog is open
237 if (mpFormatField)
238 StartListening(mpFormatField->GetNotifier());
239 }
240
241 virtual ~FieldDeletionListener() override
242 {
243 // Dialog closed, remove modification listener
245 }
246
247 virtual void Notify(const SfxHint& rHint) override
248 {
249 // Input field has been deleted: better to close the dialog
250 if(rHint.GetId() == SfxHintId::Dying)
251 {
252 mpFormatField = nullptr;
253 mpInputFieldDlg->EndDialog(RET_CANCEL);
254 }
255 }
256 private:
257 VclPtr<AbstractFieldInputDlg> mpInputFieldDlg;
258 SwFormatField* mpFormatField;
259};
260
261}
262
263// Start input dialog for a specific field
264bool SwWrtShell::StartInputFieldDlg(SwField* pField, bool bPrevButton, bool bNextButton,
265 weld::Widget* pParentWin, SwWrtShell::FieldDialogPressedButton* pPressedButton)
266{
267
269 ScopedVclPtr<AbstractFieldInputDlg> pDlg(pFact->CreateFieldInputDlg(pParentWin, *this, pField, bPrevButton, bNextButton));
270
271 bool bRet;
272
273 {
274 FieldDeletionListener aModify(pDlg.get(), pField);
275 bRet = RET_CANCEL == pDlg->Execute();
276 }
277
278 if (pPressedButton)
279 {
280 if (pDlg->PrevButtonPressed())
281 *pPressedButton = FieldDialogPressedButton::Previous;
282 else if (pDlg->NextButtonPressed())
283 *pPressedButton = FieldDialogPressedButton::Next;
284 }
285
286 pDlg.disposeAndClear();
288 return bRet;
289}
290
291bool SwWrtShell::StartDropDownFieldDlg(SwField* pField, bool bPrevButton, bool bNextButton,
292 weld::Widget* pParentWin, SwWrtShell::FieldDialogPressedButton* pPressedButton)
293{
295 ScopedVclPtr<AbstractDropDownFieldDialog> pDlg(pFact->CreateDropDownFieldDialog(pParentWin, *this, pField, bPrevButton, bNextButton));
296 const short nRet = pDlg->Execute();
297
298 if (pPressedButton)
299 {
300 if (pDlg->PrevButtonPressed())
301 *pPressedButton = FieldDialogPressedButton::Previous;
302 else if (pDlg->NextButtonPressed())
303 *pPressedButton = FieldDialogPressedButton::Next;
304 }
305
306 pDlg.disposeAndClear();
307 bool bRet = RET_CANCEL == nRet;
309 if(RET_YES == nRet)
310 {
311 GetView().GetViewFrame().GetDispatcher()->Execute(FN_EDIT_FIELD, SfxCallMode::SYNCHRON);
312 }
313 return bRet;
314}
315
316// Insert directory - remove selection
317
318void SwWrtShell::InsertTableOf(const SwTOXBase& rTOX, const SfxItemSet* pSet)
319{
320 if(!CanInsert())
321 return;
322
323 if(HasSelection())
324 DelRight();
325
326 SwEditShell::InsertTableOf(rTOX, pSet);
327}
328
329// Update directory - remove selection
330
331void SwWrtShell::UpdateTableOf(const SwTOXBase& rTOX, const SfxItemSet* pSet)
332{
333 if(CanInsert())
334 {
335 SwEditShell::UpdateTableOf(rTOX, pSet);
336 }
337}
338
339// handler for click on the field given as parameter.
340// the cursor is positioned on the field.
341
342void SwWrtShell::ClickToField(const SwField& rField, bool bExecHyperlinks)
343{
345
346 // Since the cross reference and bibliography mark move the cursor,
347 // only select the field if it's not a Ctrl+Click
348 if (!bExecHyperlinks
349 || (SwFieldIds::GetRef != rField.GetTyp()->Which()
351 {
353 Right( SwCursorSkipMode::Chars, true, 1, false ); // Select the field.
354 NormalizePam();
355 EndAllAction();
356 }
357
358 m_bIsInClickToEdit = true;
359 switch( rField.GetTyp()->Which() )
360 {
362 {
363 sal_uInt16 nSlotId = 0;
364 switch( rField.GetFormat() )
365 {
366 case JE_FMT_TABLE:
367 nSlotId = FN_INSERT_TABLE;
368 break;
369
370 case JE_FMT_FRAME:
371 nSlotId = FN_INSERT_FRAME;
372 break;
373
374 case JE_FMT_GRAPHIC: nSlotId = SID_INSERT_GRAPHIC; break;
375 case JE_FMT_OLE: nSlotId = SID_INSERT_OBJECT; break;
376
377 }
378
379 if( nSlotId )
380 {
382 //#97295# immediately select the right shell
385 SfxCallMode::SYNCHRON|SfxCallMode::RECORD );
387 }
388 }
389 break;
390
392 {
393 const SwMacroField *pField = static_cast<const SwMacroField*>(&rField);
394 const OUString sText( rField.GetPar2() );
395 OUString sRet( sText );
396 ExecMacro( pField->GetSvxMacro(), &sRet );
397
398 // return value changed?
399 if( sRet != sText )
400 {
402 const_cast<SwField&>(rField).SetPar2( sRet );
403 rField.GetTyp()->UpdateFields();
404 EndAllAction();
405 }
406 }
407 break;
408
410 {
411 if (!bExecHyperlinks)
412 break; // Since it's not a Ctrl+Click, do not jump anywhere
413
414 Point vStartPoint = GetCursor_()->GetPtPos();
415 const SwAuthorityField* pField = static_cast<const SwAuthorityField*>(&rField);
416
417 if (auto targetType = pField->GetTargetType();
418 targetType == SwAuthorityField::TargetType::UseDisplayURL
419 || targetType == SwAuthorityField::TargetType::UseTargetURL)
420 {
421 // Since the user selected target type with URL, try to use it if not empty
422 if (const OUString& rURL = pField->GetAbsoluteURL();
423 rURL.getLength() > 0)
424 ::LoadURL(*this, rURL, LoadUrlFlags::NewView, /*rTargetFrameName=*/OUString());
425 }
426 else if (targetType == SwAuthorityField::TargetType::BibliographyTableRow)
427 {
428 // Since the user selected to target Bibliography Table Row,
429 // try finding matching bibliography table line
430
431 const bool bWasViewLocked = IsViewLocked();
432 LockView(true);
433
434 // Note: This way of iterating doesn't seem to take into account TOXes
435 // that are in a frame, probably in some other cases too
436 GotoPage(1);
437 while (GotoNextTOXBase())
438 {
439 const SwTOXBase* pIteratedTOX = nullptr;
440 const SwTOXBase* pPreviousTOX = nullptr;
441 OUString vFieldText;
442 while ((pIteratedTOX = GetCurTOX()) != nullptr
443 && pIteratedTOX->GetType() == TOX_AUTHORITIES)
444 {
445 if (pIteratedTOX != pPreviousTOX)
446 vFieldText = pField->GetAuthority(GetLayout(), &pIteratedTOX->GetTOXForm());
447
448 if (const SwNode& rCurrentNode = GetCursor()->GetPoint()->GetNode();
449 rCurrentNode.GetNodeType() == SwNodeType::Text
450 && (GetCursor()->GetPoint()->GetNode().FindSectionNode()->GetSection().GetType()
451 == SectionType::ToxContent) // this checks it's not a heading
452 && static_cast<const SwTextNode*>(&rCurrentNode)->GetText() == vFieldText)
453 {
454 // Since a node has been found that is a text node, isn't a heading,
455 // and has text matching to text generated by the field, jump to it
456 LockView(bWasViewLocked);
457 ShowCursor();
458 return;
459 }
460 pPreviousTOX = pIteratedTOX;
461 FwdPara();
462 }
463 }
464 // Since a matching node has not been found, return to original position
465 SetCursor(&vStartPoint);
466 LockView(bWasViewLocked);
467 }
468 }
469 break;
470
472 if (!bExecHyperlinks)
473 break;
474
476 SwCursorShell::GotoRefMark( static_cast<const SwGetRefField&>(rField).GetSetRefName(),
477 static_cast<const SwGetRefField&>(rField).GetSubType(),
478 static_cast<const SwGetRefField&>(rField).GetSeqNo() );
479 EndAllAction();
480 break;
481
483 {
484 const SwInputField* pInputField = dynamic_cast<const SwInputField*>(&rField);
485 if ( pInputField == nullptr )
486 {
487 StartInputFieldDlg(const_cast<SwField*>(&rField), false, false, GetView().GetFrameWeld());
488 }
489 }
490 break;
491
493 if( static_cast<const SwSetExpField&>(rField).GetInputFlag() )
494 StartInputFieldDlg(const_cast<SwField*>(&rField), false, false, GetView().GetFrameWeld());
495 break;
497 StartDropDownFieldDlg(const_cast<SwField*>(&rField), false, false, GetView().GetFrameWeld());
498 break;
499 default:
500 SAL_WARN_IF(rField.IsClickable(), "sw", "unhandled clickable field!");
501 }
502
503 m_bIsInClickToEdit = false;
504}
505
507{
509
510 if( rItem.GetValue().isEmpty() )
511 return ;
512
513 m_bIsInClickToEdit = true;
514
515 // At first run the possibly set ObjectSelect Macro
516 const SvxMacro* pMac = rItem.GetMacro( SvMacroItemId::OnClick );
517 if( pMac )
518 {
519 SwCallMouseEvent aCallEvent;
520 aCallEvent.Set( &rItem );
521 GetDoc()->CallEvent( SvMacroItemId::OnClick, aCallEvent );
522 }
523
524 // So that the implementation of templates is displayed immediately
525 ::LoadURL( *this, rItem.GetValue(), nFilter, rItem.GetTargetFrame() );
526 const SwTextINetFormat* pTextAttr = rItem.GetTextINetFormat();
527 if( pTextAttr )
528 {
529 const_cast<SwTextINetFormat*>(pTextAttr)->SetVisited( true );
530 const_cast<SwTextINetFormat*>(pTextAttr)->SetVisitedValid( true );
531 }
532
533 m_bIsInClickToEdit = false;
534}
535
536bool SwWrtShell::ClickToINetGrf( const Point& rDocPt, LoadUrlFlags nFilter )
537{
538 bool bRet = false;
539 OUString sURL;
540 OUString sTargetFrameName;
541 const SwFrameFormat* pFnd = IsURLGrfAtPos( rDocPt, &sURL, &sTargetFrameName );
542 if( pFnd && !sURL.isEmpty() )
543 {
544 bRet = true;
545 // At first run the possibly set ObjectSelect Macro
546 SwCallMouseEvent aCallEvent;
547 aCallEvent.Set(EVENT_OBJECT_URLITEM, pFnd);
548 GetDoc()->CallEvent(SvMacroItemId::OnClick, aCallEvent);
549
550 ::LoadURL(*this, sURL, nFilter, sTargetFrameName);
551 }
552 return bRet;
553}
554
555void LoadURL( SwViewShell& rVSh, const OUString& rURL, LoadUrlFlags nFilter,
556 const OUString& rTargetFrameName )
557{
558 OSL_ENSURE( !rURL.isEmpty(), "what should be loaded here?" );
559 if( rURL.isEmpty() )
560 return ;
561
562 // The shell could be 0 also!!!!!
563 if ( dynamic_cast<const SwCursorShell*>( &rVSh) == nullptr )
564 return;
565
566 // We are doing tiledRendering, let the client handles the URL loading,
567 // unless we are jumping to a TOC mark.
568 if (comphelper::LibreOfficeKit::isActive() && !rURL.startsWith("#"))
569 {
570 rVSh.GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_HYPERLINK_CLICKED, rURL.toUtf8());
571 return;
572 }
573
574 //A CursorShell is always a WrtShell
575 SwWrtShell &rSh = static_cast<SwWrtShell&>(rVSh);
576
577 SwDocShell* pDShell = rSh.GetView().GetDocShell();
578 OSL_ENSURE( pDShell, "No DocShell?!");
579 OUString sTargetFrame(rTargetFrameName);
580 if (sTargetFrame.isEmpty() && pDShell)
581 {
582 using namespace ::com::sun::star;
583 uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
584 pDShell->GetModel(), uno::UNO_QUERY_THROW);
585 uno::Reference<document::XDocumentProperties> xDocProps
586 = xDPS->getDocumentProperties();
587 sTargetFrame = xDocProps->getDefaultTarget();
588 }
589
590 OUString sReferer;
591 if( pDShell && pDShell->GetMedium() )
592 sReferer = pDShell->GetMedium()->GetName();
593 SfxViewFrame& rViewFrame = rSh.GetView().GetViewFrame();
594 SfxFrameItem aView( SID_DOCFRAME, &rViewFrame );
595 SfxStringItem aName( SID_FILE_NAME, rURL );
596 SfxStringItem aTargetFrameName( SID_TARGETNAME, sTargetFrame );
597 SfxStringItem aReferer( SID_REFERER, sReferer );
598
599 SfxBoolItem aNewView( SID_OPEN_NEW_VIEW, false );
600 //#39076# Silent can be removed accordingly to SFX.
601 SfxBoolItem aBrowse( SID_BROWSE, true );
602
604 aTargetFrameName.SetValue( "_blank" );
605
606 const SfxPoolItem* aArr[] = {
607 &aName,
608 &aNewView, /*&aSilent,*/
609 &aReferer,
610 &aView, &aTargetFrameName,
611 &aBrowse,
612 nullptr
613 };
614
615 rViewFrame.GetDispatcher()->GetBindings()->Execute( SID_OPENDOC, aArr,
616 SfxCallMode::ASYNCHRON|SfxCallMode::RECORD );
617}
618
620 const sal_uInt16 nAction )
621{
622 if( EXCHG_IN_ACTION_COPY == nAction )
623 {
624 // Insert
625 OUString sURL = rBkmk.GetURL();
626 // Is this is a jump within the current Doc?
627 const SwDocShell* pDocShell = GetView().GetDocShell();
628 if(pDocShell->HasName())
629 {
630 const OUString rName = pDocShell->GetMedium()->GetURLObject().GetURLNoMark();
631
632 if (sURL.startsWith(rName))
633 {
634 if (sURL.getLength()>rName.getLength())
635 {
636 sURL = sURL.copy(rName.getLength());
637 }
638 else
639 {
640 sURL.clear();
641 }
642 }
643 }
644 SwFormatINetFormat aFormat( sURL, OUString() );
645 InsertURL( aFormat, rBkmk.GetDescription() );
646 }
647 else
648 {
650 OUString aLinkFile = o3tl::getToken(rBkmk.GetURL(), 0, '#')
651 + OUStringChar(sfx2::cTokenSeparator)
652 + OUStringChar(sfx2::cTokenSeparator)
653 + o3tl::getToken(rBkmk.GetURL(), 1, '#');
654 aSection.SetLinkFileName( aLinkFile );
655 aSection.SetProtectFlag( true );
656 const SwSection* pIns = InsertSection( aSection );
657 if( EXCHG_IN_ACTION_MOVE == nAction && pIns )
658 {
659 aSection = SwSectionData(*pIns);
660 aSection.SetLinkFileName( OUString() );
661 aSection.SetType( SectionType::Content );
662 aSection.SetProtectFlag( false );
663
664 // the update of content from linked section at time delete
665 // the undostack. Then the change of the section don't create
666 // any undoobject. - BUG 69145
667 bool bDoesUndo = DoesUndo();
668 SwUndoId nLastUndoId(SwUndoId::EMPTY);
669 if (GetLastUndoInfo(nullptr, & nLastUndoId))
670 {
671 if (SwUndoId::INSSECTION != nLastUndoId)
672 {
673 DoUndo(false);
674 }
675 }
676 UpdateSection( GetSectionFormatPos( *pIns->GetFormat() ), aSection );
677 DoUndo( bDoesUndo );
678 }
679 }
680}
681
682/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
@ UndoArg1
Definition: SwRewriter.hxx:29
void SetValue(const OUString &rTheValue)
Provides access to the marks of a document.
virtual sw::mark::IMark * makeAnnotationMark(const SwPaM &rPaM, const OUString &rName)=0
OUString GetURLNoMark(DecodeMechanism eMechanism=DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
const OUString & GetURL() const
Definition: navicont.hxx:47
const OUString & GetDescription() const
Definition: navicont.hxx:48
bool Execute(sal_uInt16 nSlot, const SfxPoolItem **pArgs=nullptr, SfxCallMode nCall=SfxCallMode::SLOT)
const SfxPoolItem * Execute(sal_uInt16 nSlot, SfxCallMode nCall=SfxCallMode::SLOT, const SfxPoolItem **pArgs=nullptr, sal_uInt16 nModi=0, const SfxPoolItem **pInternalArgs=nullptr)
SfxBindings * GetBindings() const
SfxHintId GetId() const
const INetURLObject & GetURLObject() const
const OUString & GetName() const
bool HasName() const
SfxMedium * GetMedium() const
css::uno::Reference< css::frame::XModel3 > GetModel() const
SfxDispatcher * GetDispatcher()
virtual void libreOfficeKitViewCallback(int nType, const OString &pPayload) const override
SfxViewFrame & GetViewFrame() const
void EndListeningAll()
virtual void Notify(const SfxHint &rHint)
bool StartListening(SvtBroadcaster &rBroadcaster)
virtual VclPtr< AbstractFieldInputDlg > CreateFieldInputDlg(weld::Widget *pParent, SwWrtShell &rSh, SwField *pField, bool bPrevButton, bool bNextButton)=0
virtual VclPtr< AbstractDropDownFieldDialog > CreateDropDownFieldDialog(weld::Widget *pParent, SwWrtShell &rSh, SwField *pField, bool bPrevButton, bool bNextButton)=0
static SwAbstractDialogFactory * Create()
Definition: swabstdlg.cxx:36
Represents an inserted bibliography entry, created using Insert -> Table of Contents and Index -> Bib...
Definition: authfld.hxx:161
TargetType GetTargetType() const
Returns which target should be used when the entry (the standalone field, such as '[ASDF]',...
Definition: authfld.cxx:642
OUString GetAbsoluteURL() const
Returns absolute target URL in case there is one (GetTargetType() should be checked).
Definition: authfld.cxx:647
OUString GetAuthority(const SwRootFrame *pLayout, const SwForm *pTOX=nullptr) const
Returns the line matching the source's default row in the ToX.
Definition: authfld.cxx:567
bool GotoRefMark(const OUString &rRefMark, sal_uInt16 nSubType, sal_uInt16 nSeqNo)
jump to reference marker
Definition: crstrvl.cxx:1404
const SwPaM * GetTableCrs() const
Definition: crsrsh.hxx:930
void ShowCursor()
Definition: crsrsh.cxx:2710
SwShellCursor * GetCursor_()
Definition: crsrsh.hxx:343
virtual SwCursor & GetCurrentShellCursor() override
Return the current shell cursor.
Definition: crsrsh.cxx:185
void NormalizePam(bool bPointFirst=true)
Ensure point and mark of the current PaM are in a specific order.
Definition: crsrsh.cxx:1256
SwCursor * GetCursor(bool bMakeTableCursor=true) const
Return pointer to the current shell cursor.
Definition: crsrsh.cxx:194
SwField * GetCurField(const bool bIncludeInputFieldAtStart=false) const
Definition: crstrvl.cxx:1073
void ClearMark()
Definition: crsrsh.cxx:1225
void KillPams()
Definition: crsrsh.cxx:1308
bool IsTableMode() const
Definition: crsrsh.hxx:668
sal_uInt16 CallEvent(SvMacroItemId nEvent, const SwCallMouseEvent &rCallEvent, bool bChkPtr=false)
Definition: docbasic.cxx:130
IDocumentMarkAccess * getIDocumentMarkAccess()
Definition: docbm.cxx:1890
bool InsertField(SwField const &, const bool bForceExpandHints)
add a field at the cursor position
Definition: edfld.cxx:142
const SwTOXBase * GetCurTOX() const
Get current listing before or at the Cursor.
Definition: edtox.cxx:191
void StartAllAction()
For all views of this document.
Definition: edws.cxx:86
SwSection const * InsertSection(SwSectionData &rNewData, SfxItemSet const *const =nullptr)
Definition: edsect.cxx:35
SwUndoId StartUndo(SwUndoId eUndoId=SwUndoId::EMPTY, const SwRewriter *pRewriter=nullptr)
Undo: set up Undo parenthesis, return nUndoId of this parenthesis.
Definition: edws.cxx:223
bool InsertURL(const SwFormatINetFormat &rFormat, const OUString &rStr, bool bKeepSelection=false)
Definition: editsh.cxx:633
bool GetLastUndoInfo(OUString *const o_pStr, SwUndoId *const o_pId, const SwView *pView=nullptr) const
Definition: edws.cxx:237
void InsertTableOf(const SwTOXBase &rTOX, const SfxItemSet *pSet=nullptr)
Insert content table. Renew if required.
Definition: edtox.cxx:122
void UpdateSection(size_t const nSect, SwSectionData &, SfxItemSet const *const =nullptr)
Definition: edsect.cxx:156
void UpdateTableOf(const SwTOXBase &rTOX, const SfxItemSet *pSet=nullptr)
update tables of content
Definition: edtox.cxx:150
OUString GetUniqueSectionName(const OUString *pChkStr=nullptr) const
Definition: edsect.cxx:166
bool DoesUndo() const
Definition: edws.cxx:203
SwUndoId EndUndo(SwUndoId eUndoId=SwUndoId::EMPTY, const SwRewriter *pRewriter=nullptr)
Closes parenthesis of nUndoId, not used by UI.
Definition: edws.cxx:234
size_t GetSectionFormatPos(const SwSectionFormat &) const
Definition: edsect.cxx:136
void DoUndo(bool bOn=true)
Undo.
Definition: edws.cxx:200
void EndAllAction()
Definition: edws.cxx:97
const SwFrameFormat * IsURLGrfAtPos(const Point &rPt, OUString *pURL=nullptr, OUString *pTargetFrameName=nullptr, OUString *pURLDescription=nullptr) const
Position is a graphic with URL?
Definition: fefly1.cxx:1509
virtual void UpdateFields()
Definition: fldbas.cxx:219
SwFieldIds Which() const
Definition: fldbas.hxx:276
Base class of all fields.
Definition: fldbas.hxx:296
bool IsClickable() const
Is this field clickable?
Definition: fldbas.cxx:914
sal_uInt32 GetFormat() const
Query parameters for dialog and for BASIC.
Definition: fldbas.hxx:407
virtual OUString GetDescription() const
Definition: fldbas.cxx:909
SwFieldType * GetTyp() const
Definition: fldbas.hxx:402
virtual OUString GetPar2() const
Definition: fldbas.cxx:339
const OUString & GetValue() const
Definition: fmtinfmt.hxx:75
const SvxMacro * GetMacro(SvMacroItemId nEvent) const
Definition: fmtatr2.cxx:269
const SwTextINetFormat * GetTextINetFormat() const
Definition: fmtinfmt.hxx:70
const OUString & GetTargetFrame() const
Definition: fmtinfmt.hxx:89
Style of a layout element.
Definition: frmfmt.hxx:72
void PopCursor()
get cursor
Definition: fldlst.cxx:93
SwField * GetField(size_t nId)
Definition: fldlst.cxx:78
size_t Count() const
Definition: fldlst.cxx:72
void GotoFieldPos(size_t nId)
go to position of a field
Definition: fldlst.cxx:99
void PushCursor()
save cursor
Definition: fldlst.cxx:86
SvxMacro GetSvxMacro() const
Definition: macrofld.cxx:109
Base class of the Writer document model elements.
Definition: node.hxx:98
SwNodeType GetNodeType() const
Definition: node.hxx:166
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:188
const SwPosition * GetMark() const
Definition: pam.hxx:255
void Normalize(bool bPointFirst=true)
Normalizes PaM, i.e.
Definition: pam.cxx:689
const SwPosition * End() const
Definition: pam.hxx:263
const SwPosition * GetPoint() const
Definition: pam.hxx:253
const SwPosition * Start() const
Definition: pam.hxx:258
void AddRule(SwUndoArg eWhat, const OUString &rWith)
Definition: SwRewriter.cxx:25
SAL_DLLPRIVATE void SetProtectFlag(bool const bFlag)
Definition: section.hxx:106
void SetType(SectionType const eNew)
Definition: section.hxx:96
void SetLinkFileName(OUString const &rNew)
Definition: section.hxx:118
SwSectionFormat * GetFormat()
Definition: section.hxx:341
const Point & GetPtPos() const
Definition: viscrs.hxx:165
const SwForm & GetTOXForm() const
Definition: tox.hxx:713
TOXTypes GetType() const
Definition: tox.hxx:722
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 IsViewLocked() const
Definition: viewsh.hxx:490
SwRootFrame * GetLayout() const
Definition: viewsh.cxx:2163
vcl::Window * GetWin() const
Definition: viewsh.hxx:364
SwDoc * GetDoc() const
Definition: viewsh.hxx:308
SfxViewShell * GetSfxViewShell() const
Definition: viewsh.hxx:470
void LockView(bool b)
Definition: viewsh.hxx:491
void StopShellTimer()
Definition: view.cxx:1836
SwDocShell * GetDocShell()
Definition: view.cxx:1193
Used by the UI to modify the document model.
Definition: wrtsh.hxx:97
void ClickToField(const SwField &rField, bool bExecHyperlinks)
Definition: wrtsh2.cxx:342
bool FwdPara()
Definition: wrtsh.hxx:234
bool ClickToINetGrf(const Point &rDocPt, LoadUrlFlags nFilter)
Definition: wrtsh2.cxx:536
bool Right(SwCursorSkipMode nMode, bool bSelect, sal_uInt16 nCount, bool bBasicCall, bool bVisual=false)
Definition: move.cxx:127
bool GotoNextTOXBase(const OUString *pName=nullptr)
Definition: move.cxx:722
FieldDialogPressedButton
Definition: wrtsh.hxx:380
bool StartInputFieldDlg(SwField *, bool bPrevButton, bool bNextButton, weld::Widget *pParentWin, FieldDialogPressedButton *pPressedButton=nullptr)
Definition: wrtsh2.cxx:264
void addCurrentPosition()
Definition: wrtsh1.cxx:1869
bool GotoPage(sal_uInt16 nPage, bool bRecord)
Definition: move.cxx:611
void InsertTableOf(const SwTOXBase &rTOX, const SfxItemSet *pSet=nullptr)
Definition: wrtsh2.cxx:318
SAL_DLLPRIVATE tools::Long SetCursor(const Point *, bool bProp=false)
Definition: select.cxx:313
void ResetCursorStack()
Definition: wrtsh.hxx:651
void UpdateInputFields(SwInputFieldList *pLst=nullptr)
Definition: wrtsh2.cxx:146
void EndPara(bool bSelect=false)
Definition: move.cxx:400
bool m_bIsInClickToEdit
Definition: wrtsh.hxx:604
void UpdateTableOf(const SwTOXBase &rTOX, const SfxItemSet *pSet=nullptr)
Definition: wrtsh2.cxx:331
void ExecMacro(const SvxMacro &rMacro, OUString *pRet=nullptr, SbxArray *pArgs=nullptr)
Definition: wrtsh3.cxx:319
void NavigatorPaste(const NaviContentBookmark &rBkmk, const sal_uInt16 nAction)
Definition: wrtsh2.cxx:619
bool DelRight(bool isReplaceHeuristic=false)
Definition: delete.cxx:285
bool HasSelection() const
Definition: wrtsh.hxx:147
bool InsertField2(SwField const &, SwPaM *pAnnotationRange=nullptr)
Definition: wrtsh2.cxx:64
bool IsEndOfPara() const
Definition: wrtsh.hxx:197
bool StartDropDownFieldDlg(SwField *, bool bPrevButton, bool bNextButton, weld::Widget *pParentWin, FieldDialogPressedButton *pPressedButton=nullptr)
Definition: wrtsh2.cxx:291
bool CanInsert()
Definition: wrtsh1.cxx:2058
void ClickToINetAttr(const SwFormatINetFormat &rItem, LoadUrlFlags nFilter=LoadUrlFlags::NONE)
Definition: wrtsh2.cxx:506
const SwView & GetView() const
Definition: wrtsh.hxx:443
void disposeAndClear()
reference_type * get() const
void PaintImmediately()
#define FN_INSERT_TABLE
Definition: cmdid.h:234
#define FN_INSERT_FRAME
Definition: cmdid.h:238
#define FN_EDIT_FIELD
Definition: cmdid.h:77
weld::Window * GetFrameWeld(const SfxFrame *pFrame)
Definition: dialoghelp.cxx:19
@ JE_FMT_GRAPHIC
Definition: docufld.hxx:127
@ JE_FMT_TABLE
Definition: docufld.hxx:125
@ JE_FMT_OLE
Definition: docufld.hxx:128
@ JE_FMT_FRAME
Definition: docufld.hxx:126
#define EXCHG_IN_ACTION_COPY
#define EXCHG_IN_ACTION_MOVE
@ TableOfAuthorities
static SwContentNode * GetContentNode(SwDoc &rDoc, SwPosition &rPos, bool bNext)
Definition: fltshell.cxx:54
sal_Int32 nIndex
OUString aName
#define SAL_WARN_IF(condition, area, stream)
int i
std::basic_string_view< charT, traits > getToken(std::basic_string_view< charT, traits > sv, charT delimiter, std::size_t &position)
const sal_Unicode cTokenSeparator
const SvxPageUsage aArr[]
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
void Set(SwCallEventObjectType eTyp, const SwFrameFormat *pFormat)
Definition: swevent.hxx:87
Marks a position in the document model.
Definition: pam.hxx:38
@ EVENT_OBJECT_URLITEM
Definition: swevent.hxx:50
SwUndoId
Definition: swundo.hxx:30
LoadUrlFlags
Definition: swurl.hxx:27
@ TOX_AUTHORITIES
Definition: toxe.hxx:47
RET_CANCEL
RET_YES
void LoadURL(SwViewShell &rVSh, const OUString &rURL, LoadUrlFlags nFilter, const OUString &rTargetFrameName)
Definition: wrtsh2.cxx:555