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 
53 #include <com/sun/star/document/XDocumentProperties.hpp>
54 #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
55 
56 #include <memory>
57 
58 #include <LibreOfficeKit/LibreOfficeKitEnums.h>
59 #include <comphelper/lok.hxx>
60 #include <sfx2/event.hxx>
61 #include <sal/log.hxx>
62 
63 bool SwWrtShell::InsertField2(SwField const& rField, SwPaM* pAnnotationRange)
64 {
66  if(!CanInsert())
67  return false;
69 
70  SwRewriter aRewriter;
71  aRewriter.AddRule(UndoArg1, rField.GetDescription());
72 
73  StartUndo(SwUndoId::INSERT, &aRewriter);
74 
75  bool bDeleted = false;
76  std::optional<SwPaM> pAnnotationTextRange;
77  if (pAnnotationRange)
78  {
79  pAnnotationTextRange.emplace(*pAnnotationRange->Start(), *pAnnotationRange->End());
80  }
81 
82  if ( HasSelection() )
83  {
84  if ( rField.GetTyp()->Which() == SwFieldIds::Postit )
85  {
86  // for annotation fields:
87  // - keep the current selection in order to create a corresponding annotation mark
88  // - collapse cursor to its end
89  if ( IsTableMode() )
90  {
91  GetTableCrs()->Normalize( false );
92  const SwPosition rStartPos( *(GetTableCrs()->GetMark()->nNode.GetNode().GetContentNode()), 0 );
93  KillPams();
94  if ( !IsEndOfPara() )
95  {
96  EndPara();
97  }
98  const SwPosition rEndPos( *GetCurrentShellCursor().GetPoint() );
99  pAnnotationTextRange.emplace( rStartPos, rEndPos );
100  }
101  else
102  {
103  NormalizePam( false );
104  const SwPaM& rCurrPaM = GetCurrentShellCursor();
105  pAnnotationTextRange.emplace( *rCurrPaM.GetPoint(), *rCurrPaM.GetMark() );
106  ClearMark();
107  }
108  }
109  else
110  {
111  bDeleted = DelRight();
112  }
113  }
114 
115  bool const isSuccess = SwEditShell::InsertField(rField, bDeleted);
116 
117  if ( pAnnotationTextRange )
118  {
119  if ( GetDoc() != nullptr )
120  {
121  const SwPaM& rCurrPaM = GetCurrentShellCursor();
122  if (*rCurrPaM.Start() == *pAnnotationTextRange->Start()
123  && *rCurrPaM.End() == *pAnnotationTextRange->End())
124  {
125  // Annotation range was passed in externally, and inserting the postit field shifted
126  // its start/end positions right by one. Restore the original position for the range
127  // start. This allows commenting on the placeholder character of the field.
128  SwIndex& rRangeStart = pAnnotationTextRange->Start()->nContent;
129  if (rRangeStart.GetIndex() > 0)
130  --rRangeStart;
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 
210 namespace {
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.
217 class 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
244  EndListeningAll();
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
264 bool 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 
291 bool 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 
318 void 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 
331 void 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 
342 void SwWrtShell::ClickToField(const SwField& rField, bool bExecHyperlinks)
343 {
345 
346  // cross reference field must not be selected because it moves the cursor
347  if (SwFieldIds::GetRef != rField.GetTyp()->Which())
348  {
349  StartAllAction();
350  Right( CRSR_SKIP_CHARS, true, 1, false ); // Select the field.
351  NormalizePam();
352  EndAllAction();
353  }
354 
355  m_bIsInClickToEdit = true;
356  switch( rField.GetTyp()->Which() )
357  {
359  {
360  sal_uInt16 nSlotId = 0;
361  switch( rField.GetFormat() )
362  {
363  case JE_FMT_TABLE:
364  nSlotId = FN_INSERT_TABLE;
365  break;
366 
367  case JE_FMT_FRAME:
368  nSlotId = FN_INSERT_FRAME;
369  break;
370 
371  case JE_FMT_GRAPHIC: nSlotId = SID_INSERT_GRAPHIC; break;
372  case JE_FMT_OLE: nSlotId = SID_INSERT_OBJECT; break;
373 
374  }
375 
376  if( nSlotId )
377  {
379  //#97295# immediately select the right shell
381  GetView().GetViewFrame()->GetDispatcher()->Execute( nSlotId,
382  SfxCallMode::SYNCHRON|SfxCallMode::RECORD );
384  }
385  }
386  break;
387 
388  case SwFieldIds::Macro:
389  {
390  const SwMacroField *pField = static_cast<const SwMacroField*>(&rField);
391  const OUString sText( rField.GetPar2() );
392  OUString sRet( sText );
393  ExecMacro( pField->GetSvxMacro(), &sRet );
394 
395  // return value changed?
396  if( sRet != sText )
397  {
398  StartAllAction();
399  const_cast<SwField&>(rField).SetPar2( sRet );
400  rField.GetTyp()->UpdateFields();
401  EndAllAction();
402  }
403  }
404  break;
405 
407  {
408  if (!bExecHyperlinks)
409  {
410  break;
411  }
412 
413  auto pField = static_cast<const SwAuthorityField*>(&rField);
414  if (!pField->HasURL())
415  {
416  break;
417  }
418 
419  const OUString& rURL = pField->GetAbsoluteURL();
420  ::LoadURL(*this, rURL, LoadUrlFlags::NewView, /*rTargetFrameName=*/OUString());
421  }
422  break;
423 
424  case SwFieldIds::GetRef:
425  StartAllAction();
426  SwCursorShell::GotoRefMark( static_cast<const SwGetRefField&>(rField).GetSetRefName(),
427  static_cast<const SwGetRefField&>(rField).GetSubType(),
428  static_cast<const SwGetRefField&>(rField).GetSeqNo() );
429  EndAllAction();
430  break;
431 
432  case SwFieldIds::Input:
433  {
434  const SwInputField* pInputField = dynamic_cast<const SwInputField*>(&rField);
435  if ( pInputField == nullptr )
436  {
437  StartInputFieldDlg(const_cast<SwField*>(&rField), false, false, GetView().GetFrameWeld());
438  }
439  }
440  break;
441 
442  case SwFieldIds::SetExp:
443  if( static_cast<const SwSetExpField&>(rField).GetInputFlag() )
444  StartInputFieldDlg(const_cast<SwField*>(&rField), false, false, GetView().GetFrameWeld());
445  break;
446  case SwFieldIds::Dropdown :
447  StartDropDownFieldDlg(const_cast<SwField*>(&rField), false, false, GetView().GetFrameWeld());
448  break;
449  default:
450  SAL_WARN_IF(rField.IsClickable(), "sw", "unhandled clickable field!");
451  }
452 
453  m_bIsInClickToEdit = false;
454 }
455 
457 {
459 
460  if( rItem.GetValue().isEmpty() )
461  return ;
462 
463  m_bIsInClickToEdit = true;
464 
465  // At first run the possibly set ObjectSelect Macro
466  const SvxMacro* pMac = rItem.GetMacro( SvMacroItemId::OnClick );
467  if( pMac )
468  {
469  SwCallMouseEvent aCallEvent;
470  aCallEvent.Set( &rItem );
471  GetDoc()->CallEvent( SvMacroItemId::OnClick, aCallEvent );
472  }
473 
474  // So that the implementation of templates is displayed immediately
475  ::LoadURL( *this, rItem.GetValue(), nFilter, rItem.GetTargetFrame() );
476  const SwTextINetFormat* pTextAttr = rItem.GetTextINetFormat();
477  if( pTextAttr )
478  {
479  const_cast<SwTextINetFormat*>(pTextAttr)->SetVisited( true );
480  const_cast<SwTextINetFormat*>(pTextAttr)->SetVisitedValid( true );
481  }
482 
483  m_bIsInClickToEdit = false;
484 }
485 
486 bool SwWrtShell::ClickToINetGrf( const Point& rDocPt, LoadUrlFlags nFilter )
487 {
488  bool bRet = false;
489  OUString sURL;
490  OUString sTargetFrameName;
491  const SwFrameFormat* pFnd = IsURLGrfAtPos( rDocPt, &sURL, &sTargetFrameName );
492  if( pFnd && !sURL.isEmpty() )
493  {
494  bRet = true;
495  // At first run the possibly set ObjectSelect Macro
496  SwCallMouseEvent aCallEvent;
497  aCallEvent.Set(EVENT_OBJECT_URLITEM, pFnd);
498  GetDoc()->CallEvent(SvMacroItemId::OnClick, aCallEvent);
499 
500  ::LoadURL(*this, sURL, nFilter, sTargetFrameName);
501  }
502  return bRet;
503 }
504 
505 void LoadURL( SwViewShell& rVSh, const OUString& rURL, LoadUrlFlags nFilter,
506  const OUString& rTargetFrameName )
507 {
508  OSL_ENSURE( !rURL.isEmpty(), "what should be loaded here?" );
509  if( rURL.isEmpty() )
510  return ;
511 
512  // The shell could be 0 also!!!!!
513  if ( dynamic_cast<const SwCursorShell*>( &rVSh) == nullptr )
514  return;
515 
516  // We are doing tiledRendering, let the client handles the URL loading,
517  // unless we are jumping to a TOC mark.
518  if (comphelper::LibreOfficeKit::isActive() && !rURL.startsWith("#"))
519  {
520  rVSh.GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_HYPERLINK_CLICKED, rURL.toUtf8().getStr());
521  return;
522  }
523 
524  //A CursorShell is always a WrtShell
525  SwWrtShell &rSh = static_cast<SwWrtShell&>(rVSh);
526 
527  SwDocShell* pDShell = rSh.GetView().GetDocShell();
528  OSL_ENSURE( pDShell, "No DocShell?!");
529  OUString sTargetFrame(rTargetFrameName);
530  if (sTargetFrame.isEmpty() && pDShell)
531  {
532  using namespace ::com::sun::star;
533  uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
534  pDShell->GetModel(), uno::UNO_QUERY_THROW);
535  uno::Reference<document::XDocumentProperties> xDocProps
536  = xDPS->getDocumentProperties();
537  sTargetFrame = xDocProps->getDefaultTarget();
538  }
539 
540  OUString sReferer;
541  if( pDShell && pDShell->GetMedium() )
542  sReferer = pDShell->GetMedium()->GetName();
543  SfxViewFrame* pViewFrame = rSh.GetView().GetViewFrame();
544  SfxFrameItem aView( SID_DOCFRAME, pViewFrame );
545  SfxStringItem aName( SID_FILE_NAME, rURL );
546  SfxStringItem aTargetFrameName( SID_TARGETNAME, sTargetFrame );
547  SfxStringItem aReferer( SID_REFERER, sReferer );
548 
549  SfxBoolItem aNewView( SID_OPEN_NEW_VIEW, false );
550  //#39076# Silent can be removed accordingly to SFX.
551  SfxBoolItem aBrowse( SID_BROWSE, true );
552 
554  aTargetFrameName.SetValue( "_blank" );
555 
556  const SfxPoolItem* aArr[] = {
557  &aName,
558  &aNewView, /*&aSilent,*/
559  &aReferer,
560  &aView, &aTargetFrameName,
561  &aBrowse,
562  nullptr
563  };
564 
565  pViewFrame->GetDispatcher()->GetBindings()->Execute( SID_OPENDOC, aArr,
566  SfxCallMode::ASYNCHRON|SfxCallMode::RECORD );
567 }
568 
570  const sal_uInt16 nAction )
571 {
572  if( EXCHG_IN_ACTION_COPY == nAction )
573  {
574  // Insert
575  OUString sURL = rBkmk.GetURL();
576  // Is this is a jump within the current Doc?
577  const SwDocShell* pDocShell = GetView().GetDocShell();
578  if(pDocShell->HasName())
579  {
580  const OUString rName = pDocShell->GetMedium()->GetURLObject().GetURLNoMark();
581 
582  if (sURL.startsWith(rName))
583  {
584  if (sURL.getLength()>rName.getLength())
585  {
586  sURL = sURL.copy(rName.getLength());
587  }
588  else
589  {
590  sURL.clear();
591  }
592  }
593  }
594  SwFormatINetFormat aFormat( sURL, OUString() );
595  InsertURL( aFormat, rBkmk.GetDescription() );
596  }
597  else
598  {
600  OUString aLinkFile = o3tl::getToken(rBkmk.GetURL(), 0, '#')
601  + OUStringChar(sfx2::cTokenSeparator)
602  + OUStringChar(sfx2::cTokenSeparator)
603  + o3tl::getToken(rBkmk.GetURL(), 1, '#');
604  aSection.SetLinkFileName( aLinkFile );
605  aSection.SetProtectFlag( true );
606  const SwSection* pIns = InsertSection( aSection );
607  if( EXCHG_IN_ACTION_MOVE == nAction && pIns )
608  {
609  aSection = SwSectionData(*pIns);
610  aSection.SetLinkFileName( OUString() );
611  aSection.SetType( SectionType::Content );
612  aSection.SetProtectFlag( false );
613 
614  // the update of content from linked section at time delete
615  // the undostack. Then the change of the section don't create
616  // any undoobject. - BUG 69145
617  bool bDoesUndo = DoesUndo();
618  SwUndoId nLastUndoId(SwUndoId::EMPTY);
619  if (GetLastUndoInfo(nullptr, & nLastUndoId))
620  {
621  if (SwUndoId::INSSECTION != nLastUndoId)
622  {
623  DoUndo(false);
624  }
625  }
626  UpdateSection( GetSectionFormatPos( *pIns->GetFormat() ), aSection );
627  DoUndo( bDoesUndo );
628  }
629  }
630 }
631 
632 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SfxViewFrame * GetViewFrame() const
bool InsertField2(SwField const &, SwPaM *pAnnotationRange=nullptr)
Definition: wrtsh2.cxx:63
void StopShellTimer()
Definition: view.cxx:1811
bool ClickToINetGrf(const Point &rDocPt, LoadUrlFlags nFilter)
Definition: wrtsh2.cxx:486
#define EXCHG_IN_ACTION_COPY
virtual VclPtr< AbstractDropDownFieldDialog > CreateDropDownFieldDialog(weld::Widget *pParent, SwWrtShell &rSh, SwField *pField, bool bPrevButton, bool bNextButton)=0
bool Right(sal_uInt16 nMode, bool bSelect, sal_uInt16 nCount, bool bBasicCall, bool bVisual=false)
Definition: move.cxx:127
#define EXCHG_IN_ACTION_MOVE
void KillPams()
Definition: crsrsh.cxx:1022
SwNode & GetNode(bool bPoint=true) const
Definition: pam.hxx:224
sal_Int32 nIndex
size_t GetSectionFormatPos(const SwSectionFormat &) const
Definition: edsect.cxx:136
void ResetCursorStack()
Definition: wrtsh.hxx:638
Marks a position in the document model.
Definition: pam.hxx:36
void SetType(SectionType const eNew)
Definition: section.hxx:94
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
const OUString & GetURL() const
Definition: navicont.hxx:47
FieldDialogPressedButton
Definition: wrtsh.hxx:379
SAL_DLLPRIVATE void SetProtectFlag(bool const bFlag)
Definition: section.hxx:104
void SetLinkFileName(OUString const &rNew)
Definition: section.hxx:116
LoadUrlFlags
Definition: swurl.hxx:27
SwUndoId
Definition: swundo.hxx:29
sal_uInt32 GetFormat() const
Query parameters for dialog and for BASIC.
Definition: fldbas.hxx:403
SwField * GetField(size_t nId)
Definition: fldlst.cxx:79
void InsertTableOf(const SwTOXBase &rTOX, const SfxItemSet *pSet=nullptr)
Insert content table. Renew if required.
Definition: edtox.cxx:123
bool IsTableMode() const
Definition: crsrsh.hxx:648
SfxDispatcher * GetDispatcher()
void UpdateTableOf(const SwTOXBase &rTOX, const SfxItemSet *pSet=nullptr)
update tables of content
Definition: edtox.cxx:151
const OUString & GetName() const
const OUString & GetDescription() const
Definition: navicont.hxx:48
bool GetLastUndoInfo(OUString *const o_pStr, SwUndoId *const o_pId, const SwView *pView=nullptr) const
Definition: edws.cxx:237
const SwPosition * GetMark() const
Definition: pam.hxx:210
const sal_Unicode cTokenSeparator
Base class of all fields.
Definition: fldbas.hxx:291
Provides access to the marks of a document.
css::uno::Reference< css::frame::XModel3 > GetModel() const
SwSection const * InsertSection(SwSectionData &rNewData, SfxItemSet const *const =nullptr)
Definition: edsect.cxx:35
SwUndoId EndUndo(SwUndoId eUndoId=SwUndoId::EMPTY, const SwRewriter *pRewriter=nullptr)
Closes parenthesis of nUndoId, not used by UI.
Definition: edws.cxx:234
std::basic_string_view< charT, traits > getToken(std::basic_string_view< charT, traits > sv, charT delimiter, std::size_t &position)
void UpdateInputFields(SwInputFieldList *pLst=nullptr)
Definition: wrtsh2.cxx:146
SwSectionFormat * GetFormat()
Definition: section.hxx:336
const SvxMacro * GetMacro(SvMacroItemId nEvent) const
Definition: fmtatr2.cxx:257
void DoUndo(bool bOn=true)
Undo.
Definition: edws.cxx:200
IDocumentMarkAccess * getIDocumentMarkAccess()
Definition: docbm.cxx:1792
void NavigatorPaste(const NaviContentBookmark &rBkmk, const sal_uInt16 nAction)
Definition: wrtsh2.cxx:569
SfxViewShell * GetSfxViewShell() const
Definition: viewsh.hxx:446
void PaintImmediately()
void EndAllAction()
Definition: edws.cxx:97
RET_CANCEL
#define FN_EDIT_FIELD
Definition: cmdid.h:77
SfxHintId GetId() const
void PushCursor()
save cursor
Definition: fldlst.cxx:87
bool DelRight()
Definition: delete.cxx:294
const SwTextINetFormat * GetTextINetFormat() const
Definition: fmtinfmt.hxx:70
void UpdateSection(size_t const nSect, SwSectionData &, SfxItemSet const *const =nullptr)
Definition: edsect.cxx:156
Used by the UI to modify the document model.
Definition: wrtsh.hxx:96
sal_uInt16 CallEvent(SvMacroItemId nEvent, const SwCallMouseEvent &rCallEvent, bool bChkPtr=false)
Definition: docbasic.cxx:130
void LoadURL(SwViewShell &rVSh, const OUString &rURL, LoadUrlFlags nFilter, const OUString &rTargetFrameName)
Definition: wrtsh2.cxx:505
const OUString & GetValue() const
Definition: fmtinfmt.hxx:75
const SwView & GetView() const
Definition: wrtsh.hxx:437
RET_YES
bool m_bIsInClickToEdit
Definition: wrtsh.hxx:591
void SetValue(const OUString &rTheValue)
invariant for SwAuthorityField is that it is always registered at its SwAuthorityFieldType via AddFie...
Definition: authfld.hxx:154
void NormalizePam(bool bPointFirst=true)
Ensure point and mark of the current PaM are in a specific order.
Definition: crsrsh.cxx:970
virtual sw::mark::IMark * makeAnnotationMark(const SwPaM &rPaM, const OUString &rName)=0
SwField * GetCurField(const bool bIncludeInputFieldAtStart=false) const
Definition: crstrvl.cxx:974
virtual void libreOfficeKitViewCallback(int nType, const char *pPayload) const override
SwDoc * GetDoc() const
Definition: viewsh.hxx:282
bool Execute(sal_uInt16 nSlot, const SfxPoolItem **pArgs=nullptr, SfxCallMode nCall=SfxCallMode::SLOT)
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:262
void Normalize(bool bPointFirst=true)
Normalizes PaM, i.e.
Definition: pam.cxx:539
virtual VclPtr< AbstractFieldInputDlg > CreateFieldInputDlg(weld::Widget *pParent, SwWrtShell &rSh, SwField *pField, bool bPrevButton, bool bNextButton)=0
virtual OUString GetDescription() const
Definition: fldbas.cxx:831
void PopCursor()
get cursor
Definition: fldlst.cxx:94
weld::Window * GetFrameWeld(const SfxFrame *pFrame)
Definition: dialoghelp.cxx:19
void EndListeningAll()
virtual void UpdateFields()
Definition: fldbas.cxx:213
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:137
Style of a layout element.
Definition: frmfmt.hxx:59
bool HasSelection() const
Definition: wrtsh.hxx:147
void GotoFieldPos(size_t nId)
go to position of a field
Definition: fldlst.cxx:100
SfxBindings * GetBindings() const
void ClickToINetAttr(const SwFormatINetFormat &rItem, LoadUrlFlags nFilter=LoadUrlFlags::NONE)
Definition: wrtsh2.cxx:456
int i
#define FN_INSERT_TABLE
Definition: cmdid.h:227
const SwPaM * GetTableCrs() const
Definition: crsrsh.hxx:913
const SwPosition * GetPoint() const
Definition: pam.hxx:208
OUString GetURLNoMark(DecodeMechanism eMechanism=DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
bool StartDropDownFieldDlg(SwField *, bool bPrevButton, bool bNextButton, weld::Widget *pParentWin, FieldDialogPressedButton *pPressedButton=nullptr)
Definition: wrtsh2.cxx:291
bool InsertURL(const SwFormatINetFormat &rFormat, const OUString &rStr, bool bKeepSelection=false)
Definition: editsh.cxx:634
void InsertTableOf(const SwTOXBase &rTOX, const SfxItemSet *pSet=nullptr)
Definition: wrtsh2.cxx:318
SwContentNode * GetContentNode()
Definition: node.hxx:625
const SvxPageUsage aArr[]
virtual SwCursor & GetCurrentShellCursor() override
Return the current shell cursor.
Definition: crsrsh.cxx:186
SwUndoId StartUndo(SwUndoId eUndoId=SwUndoId::EMPTY, const SwRewriter *pRewriter=nullptr)
Undo: set up Undo parenthesis, return nUndoId of this parenthesis.
Definition: edws.cxx:223
Marks a character position inside a document model node.
Definition: index.hxx:33
void AddRule(SwUndoArg eWhat, const OUString &rWith)
Definition: SwRewriter.cxx:25
size_t Count() const
Definition: fldlst.cxx:73
bool StartInputFieldDlg(SwField *, bool bPrevButton, bool bNextButton, weld::Widget *pParentWin, FieldDialogPressedButton *pPressedButton=nullptr)
Definition: wrtsh2.cxx:264
static SwAbstractDialogFactory * Create()
Definition: swabstdlg.cxx:36
bool HasName() const
virtual OUString GetPar2() const
Definition: fldbas.cxx:326
bool StartListening(SvtBroadcaster &rBroadcaster)
const SwPosition * Start() const
Definition: pam.hxx:213
SwDocShell * GetDocShell()
Definition: view.cxx:1132
SvxMacro GetSvxMacro() const
Definition: macrofld.cxx:108
void Set(SwCallEventObjectType eTyp, const SwFrameFormat *pFormat)
Definition: swevent.hxx:87
SwFieldType * GetTyp() const
Definition: fldbas.hxx:398
#define FN_INSERT_FRAME
Definition: cmdid.h:230
void addCurrentPosition()
Definition: wrtsh1.cxx:1777
bool IsEndOfPara() const
Definition: wrtsh.hxx:196
#define SAL_WARN_IF(condition, area, stream)
OUString GetUniqueSectionName(const OUString *pChkStr=nullptr) const
Definition: edsect.cxx:166
const OUString & GetTargetFrame() const
Definition: fmtinfmt.hxx:89
void EndPara(bool bSelect=false)
Definition: move.cxx:362
vcl::Window * GetWin() const
Definition: viewsh.hxx:338
virtual void Notify(const SfxHint &rHint)
OUString aName
sal_Int32 GetIndex() const
Definition: index.hxx:91
const SwPosition * End() const
Definition: pam.hxx:218
bool InsertField(SwField const &, const bool bForceExpandHints)
add a field at the cursor position
Definition: edfld.cxx:142
bool CanInsert()
Definition: wrtsh1.cxx:1963
const INetURLObject & GetURLObject() const
void ClickToField(const SwField &rField, bool bExecHyperlinks)
Definition: wrtsh2.cxx:342
void ClearMark()
Definition: crsrsh.cxx:939
const sal_uInt16 CRSR_SKIP_CHARS
Definition: swcrsr.hxx:65
const SfxPoolItem * Execute(sal_uInt16 nSlot, SfxCallMode nCall=SfxCallMode::SLOT, const SfxPoolItem **pArgs=nullptr, sal_uInt16 nModi=0, const SfxPoolItem **pInternalArgs=nullptr)
bool DoesUndo() const
Definition: edws.cxx:203
void StartAllAction()
For all views of this document.
Definition: edws.cxx:86
SwFieldIds Which() const
Definition: fldbas.hxx:273
bool IsClickable() const
Is this field clickable?
Definition: fldbas.cxx:836
bool GotoRefMark(const OUString &rRefMark, sal_uInt16 nSubType, sal_uInt16 nSeqNo)
jump to reference marker
Definition: crstrvl.cxx:1311
SfxMedium * GetMedium() const