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 <fmtinfmt.hxx>
31 #include <wrtsh.hxx>
32 #include <docsh.hxx>
33 #include <fldbas.hxx>
34 #include <expfld.hxx>
35 #include <docufld.hxx>
36 #include <reffld.hxx>
37 #include <swundo.hxx>
38 #include <doc.hxx>
39 #include <frmfmt.hxx>
40 #include <fmtfld.hxx>
41 #include <view.hxx>
42 #include <swevent.hxx>
43 #include <section.hxx>
44 #include <navicont.hxx>
45 #include <txtinet.hxx>
46 #include <cmdid.h>
47 #include <swabstdlg.hxx>
48 #include <SwRewriter.hxx>
49 
50 #include <com/sun/star/document/XDocumentProperties.hpp>
51 #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
52 
53 #include <memory>
54 
55 #include <LibreOfficeKit/LibreOfficeKitEnums.h>
56 #include <comphelper/lok.hxx>
57 #include <sfx2/event.hxx>
58 #include <sal/log.hxx>
59 
60 void SwWrtShell::Insert(SwField const& rField, SwPaM* pAnnotationRange)
61 {
63  if(!CanInsert())
64  return;
66 
67  SwRewriter aRewriter;
68  aRewriter.AddRule(UndoArg1, rField.GetDescription());
69 
70  StartUndo(SwUndoId::INSERT, &aRewriter);
71 
72  bool bDeleted = false;
73  std::unique_ptr<SwPaM> pAnnotationTextRange;
74  if (pAnnotationRange)
75  {
76  pAnnotationTextRange.reset(new SwPaM(*pAnnotationRange->Start(), *pAnnotationRange->End()));
77  }
78 
79  if ( HasSelection() )
80  {
81  if ( rField.GetTyp()->Which() == SwFieldIds::Postit )
82  {
83  // for annotation fields:
84  // - keep the current selection in order to create a corresponding annotation mark
85  // - collapse cursor to its end
86  if ( IsTableMode() )
87  {
88  GetTableCrs()->Normalize( false );
89  const SwPosition rStartPos( *(GetTableCrs()->GetMark()->nNode.GetNode().GetContentNode()), 0 );
90  KillPams();
91  if ( !IsEndOfPara() )
92  {
93  EndPara();
94  }
95  const SwPosition rEndPos( *GetCurrentShellCursor().GetPoint() );
96  pAnnotationTextRange.reset(new SwPaM( rStartPos, rEndPos ));
97  }
98  else
99  {
100  NormalizePam( false );
101  const SwPaM& rCurrPaM = GetCurrentShellCursor();
102  pAnnotationTextRange.reset(new SwPaM( *rCurrPaM.GetPoint(), *rCurrPaM.GetMark() ));
103  ClearMark();
104  }
105  }
106  else
107  {
108  bDeleted = DelRight();
109  }
110  }
111 
112  SwEditShell::Insert2(rField, bDeleted);
113 
114  if ( pAnnotationTextRange )
115  {
116  if ( GetDoc() != nullptr )
117  {
118  const SwPaM& rCurrPaM = GetCurrentShellCursor();
119  if (*rCurrPaM.Start() == *pAnnotationTextRange->Start()
120  && *rCurrPaM.End() == *pAnnotationTextRange->End())
121  {
122  // Annotation range was passed in externally, and inserting the postit field shifted
123  // its start/end positions right by one. Restore the original position for the range
124  // start. This allows commenting on the placeholder character of the field.
125  SwIndex& rRangeStart = pAnnotationTextRange->Start()->nContent;
126  if (rRangeStart.GetIndex() > 0)
127  --rRangeStart;
128  }
130  pMarksAccess->makeAnnotationMark( *pAnnotationTextRange, OUString() );
131  }
132  pAnnotationTextRange.reset();
133  }
134 
135  EndUndo();
136  EndAllAction();
137 }
138 
139 // Start the field update
140 
142 {
143  // Go through the list of fields and updating
144  std::unique_ptr<SwInputFieldList> pTmp;
145  if (!pLst)
146  {
147  pTmp.reset(new SwInputFieldList( this ));
148  pLst = pTmp.get();
149  }
150 
151  const size_t nCnt = pLst->Count();
152  if(!nCnt)
153  return;
154 
155  pLst->PushCursor();
156 
157  bool bCancel = false;
158 
159  size_t nIndex = 0;
161 
162  SwField* pField = GetCurField();
163  if (pField)
164  {
165  for (size_t i = 0; i < nCnt; i++)
166  {
167  if (pField == pLst->GetField(i))
168  {
169  nIndex = i;
170  break;
171  }
172  }
173  }
174 
175  while (!bCancel)
176  {
177  bool bPrev = nIndex > 0;
178  bool bNext = nIndex < nCnt - 1;
179  pLst->GotoFieldPos(nIndex);
180  pField = pLst->GetField(nIndex);
181  if (pField->GetTyp()->Which() == SwFieldIds::Dropdown)
182  {
183  bCancel = StartDropDownFieldDlg(pField, bPrev, bNext, GetView().GetFrameWeld(), &ePressedButton);
184  }
185  else
186  bCancel = StartInputFieldDlg(pField, bPrev, bNext, GetView().GetFrameWeld(), &ePressedButton);
187 
188  if (!bCancel)
189  {
190  // Otherwise update error at multi-selection:
191  pLst->GetField(nIndex)->GetTyp()->UpdateFields();
192 
193  if (ePressedButton == FieldDialogPressedButton::Previous && nIndex > 0)
194  nIndex--;
195  else if (ePressedButton == FieldDialogPressedButton::Next && nIndex < nCnt - 1)
196  nIndex++;
197  else
198  bCancel = true;
199  }
200  }
201 
202  pLst->PopCursor();
203 }
204 
205 namespace {
206 
207 // Listener class: will close InputField dialog if input field(s)
208 // is(are) deleted (for instance, by an extension) after the dialog shows up.
209 // Otherwise, the for loop in SwWrtShell::UpdateInputFields will crash when doing:
210 // 'pTmp->GetField( i )->GetTyp()->UpdateFields();'
211 // on a deleted field.
212 class FieldDeletionListener : public SvtListener
213 {
214  public:
215  FieldDeletionListener(AbstractFieldInputDlg* pInputFieldDlg, SwField* pField)
216  : mpInputFieldDlg(pInputFieldDlg)
217  , mpFormatField(nullptr)
218  {
219  SwInputField *const pInputField(dynamic_cast<SwInputField*>(pField));
220  SwSetExpField *const pSetExpField(dynamic_cast<SwSetExpField*>(pField));
221 
222  if (pInputField && pInputField->GetFormatField())
223  {
224  mpFormatField = pInputField->GetFormatField();
225  }
226  else if (pSetExpField && pSetExpField->GetFormatField())
227  {
228  mpFormatField = pSetExpField->GetFormatField();
229  }
230 
231  // Register for possible field deletion while dialog is open
232  if (mpFormatField)
233  StartListening(mpFormatField->GetNotifier());
234  }
235 
236  virtual ~FieldDeletionListener() override
237  {
238  // Dialog closed, remove modification listener
239  EndListeningAll();
240  }
241 
242  virtual void Notify(const SfxHint& rHint) override
243  {
244  // Input field has been deleted: better to close the dialog
245  if(rHint.GetId() == SfxHintId::Dying)
246  {
247  mpFormatField = nullptr;
248  mpInputFieldDlg->EndDialog(RET_CANCEL);
249  }
250  }
251  private:
252  VclPtr<AbstractFieldInputDlg> mpInputFieldDlg;
253  SwFormatField* mpFormatField;
254 };
255 
256 }
257 
258 // Start input dialog for a specific field
259 bool SwWrtShell::StartInputFieldDlg(SwField* pField, bool bPrevButton, bool bNextButton,
260  weld::Widget* pParentWin, SwWrtShell::FieldDialogPressedButton* pPressedButton)
261 {
262 
264  ScopedVclPtr<AbstractFieldInputDlg> pDlg(pFact->CreateFieldInputDlg(pParentWin, *this, pField, bPrevButton, bNextButton));
265 
266  bool bRet;
267 
268  {
269  FieldDeletionListener aModify(pDlg.get(), pField);
270  bRet = RET_CANCEL == pDlg->Execute();
271  }
272 
273  if (pPressedButton)
274  {
275  if (pDlg->PrevButtonPressed())
276  *pPressedButton = FieldDialogPressedButton::Previous;
277  else if (pDlg->NextButtonPressed())
278  *pPressedButton = FieldDialogPressedButton::Next;
279  }
280 
281  pDlg.disposeAndClear();
283  return bRet;
284 }
285 
286 bool SwWrtShell::StartDropDownFieldDlg(SwField* pField, bool bPrevButton, bool bNextButton,
287  weld::Widget* pParentWin, SwWrtShell::FieldDialogPressedButton* pPressedButton)
288 {
290  ScopedVclPtr<AbstractDropDownFieldDialog> pDlg(pFact->CreateDropDownFieldDialog(pParentWin, *this, pField, bPrevButton, bNextButton));
291  const short nRet = pDlg->Execute();
292 
293  if (pPressedButton)
294  {
295  if (pDlg->PrevButtonPressed())
296  *pPressedButton = FieldDialogPressedButton::Previous;
297  else if (pDlg->NextButtonPressed())
298  *pPressedButton = FieldDialogPressedButton::Next;
299  }
300 
301  pDlg.disposeAndClear();
302  bool bRet = RET_CANCEL == nRet;
304  if(RET_YES == nRet)
305  {
306  GetView().GetViewFrame()->GetDispatcher()->Execute(FN_EDIT_FIELD, SfxCallMode::SYNCHRON);
307  }
308  return bRet;
309 }
310 
311 // Insert directory - remove selection
312 
313 void SwWrtShell::InsertTableOf(const SwTOXBase& rTOX, const SfxItemSet* pSet)
314 {
315  if(!CanInsert())
316  return;
317 
318  if(HasSelection())
319  DelRight();
320 
321  SwEditShell::InsertTableOf(rTOX, pSet);
322 }
323 
324 // Update directory - remove selection
325 
326 void SwWrtShell::UpdateTableOf(const SwTOXBase& rTOX, const SfxItemSet* pSet)
327 {
328  if(CanInsert())
329  {
330  SwEditShell::UpdateTableOf(rTOX, pSet);
331  }
332 }
333 
334 // handler for click on the field given as parameter.
335 // the cursor is positioned on the field.
336 
337 void SwWrtShell::ClickToField( const SwField& rField )
338 {
339  // cross reference field must not be selected because it moves the cursor
340  if (SwFieldIds::GetRef != rField.GetTyp()->Which())
341  {
342  StartAllAction();
343  Right( CRSR_SKIP_CHARS, true, 1, false ); // Select the field.
344  NormalizePam();
345  EndAllAction();
346  }
347 
348  m_bIsInClickToEdit = true;
349  switch( rField.GetTyp()->Which() )
350  {
352  {
353  sal_uInt16 nSlotId = 0;
354  switch( rField.GetFormat() )
355  {
356  case JE_FMT_TABLE:
357  nSlotId = FN_INSERT_TABLE;
358  break;
359 
360  case JE_FMT_FRAME:
361  nSlotId = FN_INSERT_FRAME;
362  break;
363 
364  case JE_FMT_GRAPHIC: nSlotId = SID_INSERT_GRAPHIC; break;
365  case JE_FMT_OLE: nSlotId = SID_INSERT_OBJECT; break;
366 
367  }
368 
369  if( nSlotId )
370  {
372  //#97295# immediately select the right shell
374  GetView().GetViewFrame()->GetDispatcher()->Execute( nSlotId,
375  SfxCallMode::SYNCHRON|SfxCallMode::RECORD );
377  }
378  }
379  break;
380 
381  case SwFieldIds::Macro:
382  {
383  const SwMacroField *pField = static_cast<const SwMacroField*>(&rField);
384  const OUString sText( rField.GetPar2() );
385  OUString sRet( sText );
386  ExecMacro( pField->GetSvxMacro(), &sRet );
387 
388  // return value changed?
389  if( sRet != sText )
390  {
391  StartAllAction();
392  const_cast<SwField&>(rField).SetPar2( sRet );
393  rField.GetTyp()->UpdateFields();
394  EndAllAction();
395  }
396  }
397  break;
398 
399  case SwFieldIds::GetRef:
400  StartAllAction();
401  SwCursorShell::GotoRefMark( static_cast<const SwGetRefField&>(rField).GetSetRefName(),
402  static_cast<const SwGetRefField&>(rField).GetSubType(),
403  static_cast<const SwGetRefField&>(rField).GetSeqNo() );
404  EndAllAction();
405  break;
406 
407  case SwFieldIds::Input:
408  {
409  const SwInputField* pInputField = dynamic_cast<const SwInputField*>(&rField);
410  if ( pInputField == nullptr )
411  {
412  StartInputFieldDlg(const_cast<SwField*>(&rField), false, false, GetView().GetFrameWeld());
413  }
414  }
415  break;
416 
417  case SwFieldIds::SetExp:
418  if( static_cast<const SwSetExpField&>(rField).GetInputFlag() )
419  StartInputFieldDlg(const_cast<SwField*>(&rField), false, false, GetView().GetFrameWeld());
420  break;
421  case SwFieldIds::Dropdown :
422  StartDropDownFieldDlg(const_cast<SwField*>(&rField), false, false, GetView().GetFrameWeld());
423  break;
424  default:
425  SAL_WARN_IF(rField.IsClickable(), "sw", "unhandled clickable field!");
426  }
427 
428  m_bIsInClickToEdit = false;
429 }
430 
432 {
433  if( rItem.GetValue().isEmpty() )
434  return ;
435 
436  m_bIsInClickToEdit = true;
437 
438  // At first run the possibly set ObjectSelect Macro
439  const SvxMacro* pMac = rItem.GetMacro( SvMacroItemId::OnClick );
440  if( pMac )
441  {
442  SwCallMouseEvent aCallEvent;
443  aCallEvent.Set( &rItem );
444  GetDoc()->CallEvent( SvMacroItemId::OnClick, aCallEvent );
445  }
446 
447  // So that the implementation of templates is displayed immediately
448  ::LoadURL( *this, rItem.GetValue(), nFilter, rItem.GetTargetFrame() );
449  const SwTextINetFormat* pTextAttr = rItem.GetTextINetFormat();
450  if( pTextAttr )
451  {
452  const_cast<SwTextINetFormat*>(pTextAttr)->SetVisited( true );
453  const_cast<SwTextINetFormat*>(pTextAttr)->SetVisitedValid( true );
454  }
455 
456  m_bIsInClickToEdit = false;
457 }
458 
459 bool SwWrtShell::ClickToINetGrf( const Point& rDocPt, LoadUrlFlags nFilter )
460 {
461  bool bRet = false;
462  OUString sURL;
463  OUString sTargetFrameName;
464  const SwFrameFormat* pFnd = IsURLGrfAtPos( rDocPt, &sURL, &sTargetFrameName );
465  if( pFnd && !sURL.isEmpty() )
466  {
467  bRet = true;
468  // At first run the possibly set ObjectSelect Macro
469  SwCallMouseEvent aCallEvent;
470  aCallEvent.Set(EVENT_OBJECT_URLITEM, pFnd);
471  GetDoc()->CallEvent(SvMacroItemId::OnClick, aCallEvent);
472 
473  ::LoadURL(*this, sURL, nFilter, sTargetFrameName);
474  }
475  return bRet;
476 }
477 
478 void LoadURL( SwViewShell& rVSh, const OUString& rURL, LoadUrlFlags nFilter,
479  const OUString& rTargetFrameName )
480 {
481  OSL_ENSURE( !rURL.isEmpty(), "what should be loaded here?" );
482  if( rURL.isEmpty() )
483  return ;
484 
485  // The shell could be 0 also!!!!!
486  if ( dynamic_cast<const SwCursorShell*>( &rVSh) == nullptr )
487  return;
488 
489  // We are doing tiledRendering, let the client handles the URL loading,
490  // unless we are jumping to a TOC mark.
491  if (comphelper::LibreOfficeKit::isActive() && !rURL.startsWith("#"))
492  {
493  rVSh.GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_HYPERLINK_CLICKED, rURL.toUtf8().getStr());
494  return;
495  }
496 
497  //A CursorShell is always a WrtShell
498  SwWrtShell &rSh = static_cast<SwWrtShell&>(rVSh);
499 
500  SwDocShell* pDShell = rSh.GetView().GetDocShell();
501  OSL_ENSURE( pDShell, "No DocShell?!");
502  OUString sTargetFrame(rTargetFrameName);
503  if (sTargetFrame.isEmpty() && pDShell)
504  {
505  using namespace ::com::sun::star;
506  uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
507  pDShell->GetModel(), uno::UNO_QUERY_THROW);
508  uno::Reference<document::XDocumentProperties> xDocProps
509  = xDPS->getDocumentProperties();
510  sTargetFrame = xDocProps->getDefaultTarget();
511  }
512 
513  OUString sReferer;
514  if( pDShell && pDShell->GetMedium() )
515  sReferer = pDShell->GetMedium()->GetName();
516  SfxViewFrame* pViewFrame = rSh.GetView().GetViewFrame();
517  SfxFrameItem aView( SID_DOCFRAME, pViewFrame );
518  SfxStringItem aName( SID_FILE_NAME, rURL );
519  SfxStringItem aTargetFrameName( SID_TARGETNAME, sTargetFrame );
520  SfxStringItem aReferer( SID_REFERER, sReferer );
521 
522  SfxBoolItem aNewView( SID_OPEN_NEW_VIEW, false );
523  //#39076# Silent can be removed accordingly to SFX.
524  SfxBoolItem aBrowse( SID_BROWSE, true );
525 
527  aTargetFrameName.SetValue( "_blank" );
528 
529  const SfxPoolItem* aArr[] = {
530  &aName,
531  &aNewView, /*&aSilent,*/
532  &aReferer,
533  &aView, &aTargetFrameName,
534  &aBrowse,
535  nullptr
536  };
537 
538  pViewFrame->GetDispatcher()->GetBindings()->Execute( SID_OPENDOC, aArr,
539  SfxCallMode::ASYNCHRON|SfxCallMode::RECORD );
540 }
541 
543  const sal_uInt16 nAction )
544 {
545  if( EXCHG_IN_ACTION_COPY == nAction )
546  {
547  // Insert
548  OUString sURL = rBkmk.GetURL();
549  // Is this is a jump within the current Doc?
550  const SwDocShell* pDocShell = GetView().GetDocShell();
551  if(pDocShell->HasName())
552  {
553  const OUString rName = pDocShell->GetMedium()->GetURLObject().GetURLNoMark();
554 
555  if (sURL.startsWith(rName))
556  {
557  if (sURL.getLength()>rName.getLength())
558  {
559  sURL = sURL.copy(rName.getLength());
560  }
561  else
562  {
563  sURL.clear();
564  }
565  }
566  }
567  SwFormatINetFormat aFormat( sURL, OUString() );
568  InsertURL( aFormat, rBkmk.GetDescription() );
569  }
570  else
571  {
573  OUString aLinkFile = rBkmk.GetURL().getToken(0, '#')
574  + OUStringChar(sfx2::cTokenSeparator)
575  + OUStringChar(sfx2::cTokenSeparator)
576  + rBkmk.GetURL().getToken(1, '#');
577  aSection.SetLinkFileName( aLinkFile );
578  aSection.SetProtectFlag( true );
579  const SwSection* pIns = InsertSection( aSection );
580  if( EXCHG_IN_ACTION_MOVE == nAction && pIns )
581  {
582  aSection = SwSectionData(*pIns);
583  aSection.SetLinkFileName( OUString() );
584  aSection.SetType( SectionType::Content );
585  aSection.SetProtectFlag( false );
586 
587  // the update of content from linked section at time delete
588  // the undostack. Then the change of the section don't create
589  // any undoobject. - BUG 69145
590  bool bDoesUndo = DoesUndo();
591  SwUndoId nLastUndoId(SwUndoId::EMPTY);
592  if (GetLastUndoInfo(nullptr, & nLastUndoId))
593  {
594  if (SwUndoId::INSSECTION != nLastUndoId)
595  {
596  DoUndo(false);
597  }
598  }
599  UpdateSection( GetSectionFormatPos( *pIns->GetFormat() ), aSection );
600  DoUndo( bDoesUndo );
601  }
602  }
603 }
604 
605 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SfxViewFrame * GetViewFrame() const
void StopShellTimer()
Definition: view.cxx:1752
bool ClickToINetGrf(const Point &rDocPt, LoadUrlFlags nFilter)
Definition: wrtsh2.cxx:459
#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:1025
SwNode & GetNode(bool bPoint=true) const
Definition: pam.hxx:223
sal_Int32 nIndex
size_t GetSectionFormatPos(const SwSectionFormat &) const
Definition: edsect.cxx:136
void ResetCursorStack()
Definition: wrtsh.hxx:626
Marks a position in the document model.
Definition: pam.hxx:35
void SetType(SectionType const eNew)
Definition: section.hxx:95
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:1486
const OUString & GetURL() const
Definition: navicont.hxx:47
FieldDialogPressedButton
Definition: wrtsh.hxx:373
SAL_DLLPRIVATE void SetProtectFlag(bool const bFlag)
Definition: section.hxx:105
void SetLinkFileName(OUString const &rNew)
Definition: section.hxx:117
LoadUrlFlags
Definition: swurl.hxx:27
SwUndoId
Definition: swundo.hxx:29
sal_uInt32 GetFormat() const
Query parameters for dialog and for BASIC.
Definition: fldbas.hxx:397
SwField * GetField(size_t nId)
Definition: fldlst.cxx:80
void InsertTableOf(const SwTOXBase &rTOX, const SfxItemSet *pSet=nullptr)
Insert content table. Renew if required.
Definition: edtox.cxx:121
bool IsTableMode() const
Definition: crsrsh.hxx:643
SfxDispatcher * GetDispatcher()
void UpdateTableOf(const SwTOXBase &rTOX, const SfxItemSet *pSet=nullptr)
update tables of content
Definition: edtox.cxx:149
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:209
const sal_Unicode cTokenSeparator
Base class of all fields.
Definition: fldbas.hxx:289
Provides access to the marks of a document.
void ClickToField(const SwField &rField)
Definition: wrtsh2.cxx:337
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
void UpdateInputFields(SwInputFieldList *pLst=nullptr)
Definition: wrtsh2.cxx:141
SwSectionFormat * GetFormat()
Definition: section.hxx:336
const SvxMacro * GetMacro(SvMacroItemId nEvent) const
Definition: fmtatr2.cxx:252
void DoUndo(bool bOn=true)
Undo.
Definition: edws.cxx:200
IDocumentMarkAccess * getIDocumentMarkAccess()
Definition: docbm.cxx:1741
void NavigatorPaste(const NaviContentBookmark &rBkmk, const sal_uInt16 nAction)
Definition: wrtsh2.cxx:542
css::uno::Reference< css::frame::XModel > GetModel() const
SfxViewShell * GetSfxViewShell() const
Definition: viewsh.hxx:441
void PaintImmediately()
void EndAllAction()
Definition: edws.cxx:97
RET_CANCEL
#define FN_EDIT_FIELD
Definition: cmdid.h:70
SfxHintId GetId() const
void PushCursor()
save cursor
Definition: fldlst.cxx:88
bool DelRight()
Definition: delete.cxx:291
const SwTextINetFormat * GetTextINetFormat() const
Definition: fmtinfmt.hxx:70
void UpdateFields() const
Definition: fldbas.cxx:148
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:91
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:478
const OUString & GetValue() const
Definition: fmtinfmt.hxx:75
const SwView & GetView() const
Definition: wrtsh.hxx:429
RET_YES
bool m_bIsInClickToEdit
Definition: wrtsh.hxx:579
void SetValue(const OUString &rTheValue)
void NormalizePam(bool bPointFirst=true)
Ensure point and mark of the current PaM are in a specific order.
Definition: crsrsh.cxx:973
virtual sw::mark::IMark * makeAnnotationMark(const SwPaM &rPaM, const OUString &rName)=0
SwField * GetCurField(const bool bIncludeInputFieldAtStart=false) const
Definition: crstrvl.cxx:904
void libreOfficeKitViewCallback(int nType, const char *pPayload) const override
SwDoc * GetDoc() const
Definition: viewsh.hxx:281
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:326
void Insert(SwField const &, SwPaM *pAnnotationRange=nullptr)
Definition: wrtsh2.cxx:60
void ExecMacro(const SvxMacro &rMacro, OUString *pRet=nullptr, SbxArray *pArgs=nullptr)
Definition: wrtsh3.cxx:180
void Normalize(bool bPointFirst=true)
Normalizes PaM, i.e.
Definition: pam.cxx:541
virtual VclPtr< AbstractFieldInputDlg > CreateFieldInputDlg(weld::Widget *pParent, SwWrtShell &rSh, SwField *pField, bool bPrevButton, bool bNextButton)=0
virtual OUString GetDescription() const
Definition: fldbas.cxx:802
void PopCursor()
get cursor
Definition: fldlst.cxx:95
weld::Window * GetFrameWeld(const SfxFrame *pFrame)
Definition: dialoghelp.cxx:19
void EndListeningAll()
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:136
Style of a layout element.
Definition: frmfmt.hxx:58
virtual SwPaM & GetCurrentShellCursor() override
Return the current shell cursor.
Definition: crsrsh.cxx:185
bool HasSelection() const
Definition: wrtsh.hxx:142
void GotoFieldPos(size_t nId)
go to position of a field
Definition: fldlst.cxx:101
SfxBindings * GetBindings() const
void ClickToINetAttr(const SwFormatINetFormat &rItem, LoadUrlFlags nFilter=LoadUrlFlags::NONE)
Definition: wrtsh2.cxx:431
int i
#define FN_INSERT_TABLE
Definition: cmdid.h:216
const SwPaM * GetTableCrs() const
Definition: crsrsh.hxx:904
void Insert2(const OUString &, const bool bForceExpandHints=false)
Definition: editsh.cxx:80
const SwPosition * GetPoint() const
Definition: pam.hxx:207
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:286
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:313
SwContentNode * GetContentNode()
Definition: node.hxx:619
const SvxPageUsage aArr[]
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:27
size_t Count() const
Definition: fldlst.cxx:74
bool StartInputFieldDlg(SwField *, bool bPrevButton, bool bNextButton, weld::Widget *pParentWin, FieldDialogPressedButton *pPressedButton=nullptr)
Definition: wrtsh2.cxx:259
static SwAbstractDialogFactory * Create()
Definition: swabstdlg.cxx:36
bool HasName() const
virtual OUString GetPar2() const
Definition: fldbas.cxx:319
bool StartListening(SvtBroadcaster &rBroadcaster)
const SwPosition * Start() const
Definition: pam.hxx:212
SwDocShell * GetDocShell()
Definition: view.cxx:1110
SvxMacro GetSvxMacro() const
Definition: macrofld.cxx:108
void Set(SwCallEventObjectType eTyp, const SwFrameFormat *pFormat)
Definition: swevent.hxx:87
SwFieldType * GetTyp() const
Definition: fldbas.hxx:392
#define FN_INSERT_FRAME
Definition: cmdid.h:219
bool IsEndOfPara() const
Definition: wrtsh.hxx:191
#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:337
virtual void Notify(const SfxHint &rHint)
OUString aName
sal_Int32 GetIndex() const
Definition: index.hxx:91
const SwPosition * End() const
Definition: pam.hxx:217
bool CanInsert()
Definition: wrtsh1.cxx:1725
const INetURLObject & GetURLObject() const
void ClearMark()
Definition: crsrsh.cxx:942
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:272
bool IsClickable() const
Is this field clickable?
Definition: fldbas.cxx:807
bool GotoRefMark(const OUString &rRefMark, sal_uInt16 nSubType, sal_uInt16 nSeqNo)
jump to reference marker
Definition: crstrvl.cxx:1221
SfxMedium * GetMedium() const