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 <hintids.hxx>
21 #include <svl/macitem.hxx>
22 #include <sfx2/frame.hxx>
23 #include <svl/eitem.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  {
154  pLst->PushCursor();
155 
156  bool bCancel = false;
157 
158  size_t nIndex = 0;
160 
161  SwField* pField = GetCurField();
162  if (pField)
163  {
164  for (size_t i = 0; i < nCnt; i++)
165  {
166  if (pField == pLst->GetField(i))
167  {
168  nIndex = i;
169  break;
170  }
171  }
172  }
173 
174  while (!bCancel)
175  {
176  bool bPrev = nIndex > 0;
177  bool bNext = nIndex < nCnt - 1;
178  pLst->GotoFieldPos(nIndex);
179  pField = pLst->GetField(nIndex);
180  if (pField->GetTyp()->Which() == SwFieldIds::Dropdown)
181  {
182  bCancel = StartDropDownFieldDlg(pField, bPrev, bNext, GetView().GetFrameWeld(), &ePressedButton);
183  }
184  else
185  bCancel = StartInputFieldDlg(pField, bPrev, bNext, GetView().GetFrameWeld(), &ePressedButton);
186 
187  if (!bCancel)
188  {
189  // Otherwise update error at multi-selection:
190  pLst->GetField(nIndex)->GetTyp()->UpdateFields();
191 
192  if (ePressedButton == FieldDialogPressedButton::Previous && nIndex > 0)
193  nIndex--;
194  else if (ePressedButton == FieldDialogPressedButton::Next && nIndex < nCnt - 1)
195  nIndex++;
196  else
197  bCancel = true;
198  }
199  }
200 
201  pLst->PopCursor();
202  }
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 FieldDeletionModify : public SwModify
213 {
214  public:
215  FieldDeletionModify(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  mpFormatField->Add(this);
234  }
235 
236  virtual ~FieldDeletionModify() override
237  {
238  // Dialog closed, remove modification listener
239  EndListeningAll();
240  }
241 
242  void Modify( const SfxPoolItem* pOld, const SfxPoolItem *) override
243  {
244  // Input field has been deleted: better to close the dialog
245  if (pOld)
246  {
247  switch (pOld->Which())
248  {
250  case RES_OBJECTDYING:
251  mpFormatField = nullptr;
252  mpInputFieldDlg->EndDialog(RET_CANCEL);
253  break;
254  }
255  }
256  }
257  private:
258  VclPtr<AbstractFieldInputDlg> mpInputFieldDlg;
259  SwFormatField* mpFormatField;
260 };
261 
262 }
263 
264 // Start input dialog for a specific field
265 bool SwWrtShell::StartInputFieldDlg(SwField* pField, bool bPrevButton, bool bNextButton,
266  weld::Widget* pParentWin, SwWrtShell::FieldDialogPressedButton* pPressedButton)
267 {
268 
270  ScopedVclPtr<AbstractFieldInputDlg> pDlg(pFact->CreateFieldInputDlg(pParentWin, *this, pField, bPrevButton, bNextButton));
271 
272  bool bRet;
273 
274  {
275  FieldDeletionModify aModify(pDlg.get(), pField);
276  bRet = RET_CANCEL == pDlg->Execute();
277  }
278 
279  if (pPressedButton)
280  {
281  if (pDlg->PrevButtonPressed())
282  *pPressedButton = FieldDialogPressedButton::Previous;
283  else if (pDlg->NextButtonPressed())
284  *pPressedButton = FieldDialogPressedButton::Next;
285  }
286 
287  pDlg.disposeAndClear();
288  GetWin()->Update();
289  return bRet;
290 }
291 
292 bool SwWrtShell::StartDropDownFieldDlg(SwField* pField, bool bPrevButton, bool bNextButton,
293  weld::Widget* pParentWin, SwWrtShell::FieldDialogPressedButton* pPressedButton)
294 {
296  ScopedVclPtr<AbstractDropDownFieldDialog> pDlg(pFact->CreateDropDownFieldDialog(pParentWin, *this, pField, bPrevButton, bNextButton));
297  const short nRet = pDlg->Execute();
298 
299  if (pPressedButton)
300  {
301  if (pDlg->PrevButtonPressed())
302  *pPressedButton = FieldDialogPressedButton::Previous;
303  else if (pDlg->NextButtonPressed())
304  *pPressedButton = FieldDialogPressedButton::Next;
305  }
306 
307  pDlg.disposeAndClear();
308  bool bRet = RET_CANCEL == nRet;
309  GetWin()->Update();
310  if(RET_YES == nRet)
311  {
312  GetView().GetViewFrame()->GetDispatcher()->Execute(FN_EDIT_FIELD, SfxCallMode::SYNCHRON);
313  }
314  return bRet;
315 }
316 
317 // Insert directory - remove selection
318 
319 void SwWrtShell::InsertTableOf(const SwTOXBase& rTOX, const SfxItemSet* pSet)
320 {
321  if(!CanInsert())
322  return;
323 
324  if(HasSelection())
325  DelRight();
326 
327  SwEditShell::InsertTableOf(rTOX, pSet);
328 }
329 
330 // Update directory - remove selection
331 
332 void SwWrtShell::UpdateTableOf(const SwTOXBase& rTOX, const SfxItemSet* pSet)
333 {
334  if(CanInsert())
335  {
336  SwEditShell::UpdateTableOf(rTOX, pSet);
337  }
338 }
339 
340 // handler for click on the field given as parameter.
341 // the cursor is positioned on the field.
342 
343 void SwWrtShell::ClickToField( const SwField& rField )
344 {
345  // cross reference field must not be selected because it moves the cursor
346  if (SwFieldIds::GetRef != rField.GetTyp()->Which())
347  {
348  StartAllAction();
349  Right( CRSR_SKIP_CHARS, true, 1, false ); // Select the field.
350  NormalizePam();
351  EndAllAction();
352  }
353 
354  m_bIsInClickToEdit = true;
355  switch( rField.GetTyp()->Which() )
356  {
358  {
359  sal_uInt16 nSlotId = 0;
360  switch( rField.GetFormat() )
361  {
362  case JE_FMT_TABLE:
363  nSlotId = FN_INSERT_TABLE;
364  break;
365 
366  case JE_FMT_FRAME:
367  nSlotId = FN_INSERT_FRAME;
368  break;
369 
370  case JE_FMT_GRAPHIC: nSlotId = SID_INSERT_GRAPHIC; break;
371  case JE_FMT_OLE: nSlotId = SID_INSERT_OBJECT; break;
372 
373  }
374 
375  if( nSlotId )
376  {
378  //#97295# immediately select the right shell
380  GetView().GetViewFrame()->GetDispatcher()->Execute( nSlotId,
381  SfxCallMode::SYNCHRON|SfxCallMode::RECORD );
383  }
384  }
385  break;
386 
387  case SwFieldIds::Macro:
388  {
389  const SwMacroField *pField = static_cast<const SwMacroField*>(&rField);
390  const OUString sText( rField.GetPar2() );
391  OUString sRet( sText );
392  ExecMacro( pField->GetSvxMacro(), &sRet );
393 
394  // return value changed?
395  if( sRet != sText )
396  {
397  StartAllAction();
398  const_cast<SwField&>(rField).SetPar2( sRet );
399  rField.GetTyp()->UpdateFields();
400  EndAllAction();
401  }
402  }
403  break;
404 
405  case SwFieldIds::GetRef:
406  StartAllAction();
407  SwCursorShell::GotoRefMark( static_cast<const SwGetRefField&>(rField).GetSetRefName(),
408  static_cast<const SwGetRefField&>(rField).GetSubType(),
409  static_cast<const SwGetRefField&>(rField).GetSeqNo() );
410  EndAllAction();
411  break;
412 
413  case SwFieldIds::Input:
414  {
415  const SwInputField* pInputField = dynamic_cast<const SwInputField*>(&rField);
416  if ( pInputField == nullptr )
417  {
418  StartInputFieldDlg(const_cast<SwField*>(&rField), false, false, GetView().GetFrameWeld());
419  }
420  }
421  break;
422 
423  case SwFieldIds::SetExp:
424  if( static_cast<const SwSetExpField&>(rField).GetInputFlag() )
425  StartInputFieldDlg(const_cast<SwField*>(&rField), false, false, GetView().GetFrameWeld());
426  break;
427  case SwFieldIds::Dropdown :
428  StartDropDownFieldDlg(const_cast<SwField*>(&rField), false, false, GetView().GetFrameWeld());
429  break;
430  default:
431  SAL_WARN_IF(rField.IsClickable(), "sw", "unhandled clickable field!");
432  }
433 
434  m_bIsInClickToEdit = false;
435 }
436 
438 {
439  if( rItem.GetValue().isEmpty() )
440  return ;
441 
442  m_bIsInClickToEdit = true;
443 
444  // At first run the possibly set ObjectSelect Macro
445  const SvxMacro* pMac = rItem.GetMacro( SvMacroItemId::OnClick );
446  if( pMac )
447  {
448  SwCallMouseEvent aCallEvent;
449  aCallEvent.Set( &rItem );
450  GetDoc()->CallEvent( SvMacroItemId::OnClick, aCallEvent );
451  }
452 
453  // So that the implementation of templates is displayed immediately
454  ::LoadURL( *this, rItem.GetValue(), nFilter, rItem.GetTargetFrame() );
455  const SwTextINetFormat* pTextAttr = rItem.GetTextINetFormat();
456  if( pTextAttr )
457  {
458  const_cast<SwTextINetFormat*>(pTextAttr)->SetVisited( true );
459  const_cast<SwTextINetFormat*>(pTextAttr)->SetVisitedValid( true );
460  }
461 
462  m_bIsInClickToEdit = false;
463 }
464 
465 bool SwWrtShell::ClickToINetGrf( const Point& rDocPt, LoadUrlFlags nFilter )
466 {
467  bool bRet = false;
468  OUString sURL;
469  OUString sTargetFrameName;
470  const SwFrameFormat* pFnd = IsURLGrfAtPos( rDocPt, &sURL, &sTargetFrameName );
471  if( pFnd && !sURL.isEmpty() )
472  {
473  bRet = true;
474  // At first run the possibly set ObjectSelect Macro
475  SwCallMouseEvent aCallEvent;
476  aCallEvent.Set(EVENT_OBJECT_URLITEM, pFnd);
477  GetDoc()->CallEvent(SvMacroItemId::OnClick, aCallEvent);
478 
479  ::LoadURL(*this, sURL, nFilter, sTargetFrameName);
480  }
481  return bRet;
482 }
483 
484 void LoadURL( SwViewShell& rVSh, const OUString& rURL, LoadUrlFlags nFilter,
485  const OUString& rTargetFrameName )
486 {
487  OSL_ENSURE( !rURL.isEmpty(), "what should be loaded here?" );
488  if( rURL.isEmpty() )
489  return ;
490 
491  // The shell could be 0 also!!!!!
492  if ( dynamic_cast<const SwCursorShell*>( &rVSh) == nullptr )
493  return;
494 
495  // We are doing tiledRendering, let the client handles the URL loading,
496  // unless we are jumping to a TOC mark.
497  if (comphelper::LibreOfficeKit::isActive() && !rURL.startsWith("#"))
498  {
499  rVSh.GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_HYPERLINK_CLICKED, rURL.toUtf8().getStr());
500  return;
501  }
502 
503  //A CursorShell is always a WrtShell
504  SwWrtShell &rSh = static_cast<SwWrtShell&>(rVSh);
505 
506  SwDocShell* pDShell = rSh.GetView().GetDocShell();
507  OSL_ENSURE( pDShell, "No DocShell?!");
508  OUString sTargetFrame(rTargetFrameName);
509  if (sTargetFrame.isEmpty() && pDShell)
510  {
511  using namespace ::com::sun::star;
512  uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
513  pDShell->GetModel(), uno::UNO_QUERY_THROW);
514  uno::Reference<document::XDocumentProperties> xDocProps
515  = xDPS->getDocumentProperties();
516  sTargetFrame = xDocProps->getDefaultTarget();
517  }
518 
519  OUString sReferer;
520  if( pDShell && pDShell->GetMedium() )
521  sReferer = pDShell->GetMedium()->GetName();
522  SfxViewFrame* pViewFrame = rSh.GetView().GetViewFrame();
523  SfxFrameItem aView( SID_DOCFRAME, pViewFrame );
524  SfxStringItem aName( SID_FILE_NAME, rURL );
525  SfxStringItem aTargetFrameName( SID_TARGETNAME, sTargetFrame );
526  SfxStringItem aReferer( SID_REFERER, sReferer );
527 
528  SfxBoolItem aNewView( SID_OPEN_NEW_VIEW, false );
529  //#39076# Silent can be removed accordingly to SFX.
530  SfxBoolItem aBrowse( SID_BROWSE, true );
531 
533  aTargetFrameName.SetValue( "_blank" );
534 
535  const SfxPoolItem* aArr[] = {
536  &aName,
537  &aNewView, /*&aSilent,*/
538  &aReferer,
539  &aView, &aTargetFrameName,
540  &aBrowse,
541  nullptr
542  };
543 
544  pViewFrame->GetDispatcher()->GetBindings()->Execute( SID_OPENDOC, aArr,
545  SfxCallMode::ASYNCHRON|SfxCallMode::RECORD );
546 }
547 
549  const sal_uInt16 nAction )
550 {
551  if( EXCHG_IN_ACTION_COPY == nAction )
552  {
553  // Insert
554  OUString sURL = rBkmk.GetURL();
555  // Is this is a jump within the current Doc?
556  const SwDocShell* pDocShell = GetView().GetDocShell();
557  if(pDocShell->HasName())
558  {
559  const OUString rName = pDocShell->GetMedium()->GetURLObject().GetURLNoMark();
560 
561  if (sURL.startsWith(rName))
562  {
563  if (sURL.getLength()>rName.getLength())
564  {
565  sURL = sURL.copy(rName.getLength());
566  }
567  else
568  {
569  sURL.clear();
570  }
571  }
572  }
573  SwFormatINetFormat aFormat( sURL, OUString() );
574  InsertURL( aFormat, rBkmk.GetDescription() );
575  }
576  else
577  {
579  OUString aLinkFile = rBkmk.GetURL().getToken(0, '#')
580  + OUStringChar(sfx2::cTokenSeparator)
581  + OUStringChar(sfx2::cTokenSeparator)
582  + rBkmk.GetURL().getToken(1, '#');
583  aSection.SetLinkFileName( aLinkFile );
584  aSection.SetProtectFlag( true );
585  const SwSection* pIns = InsertSection( aSection );
586  if( EXCHG_IN_ACTION_MOVE == nAction && pIns )
587  {
588  aSection = SwSectionData(*pIns);
589  aSection.SetLinkFileName( OUString() );
590  aSection.SetType( SectionType::Content );
591  aSection.SetProtectFlag( false );
592 
593  // the update of content from linked section at time delete
594  // the undostack. Then the change of the section don't create
595  // any undoobject. - BUG 69145
596  bool bDoesUndo = DoesUndo();
597  SwUndoId nLastUndoId(SwUndoId::EMPTY);
598  if (GetLastUndoInfo(nullptr, & nLastUndoId))
599  {
600  if (SwUndoId::INSSECTION != nLastUndoId)
601  {
602  DoUndo(false);
603  }
604  }
605  UpdateSection( GetSectionFormatPos( *pIns->GetFormat() ), aSection );
606  DoUndo( bDoesUndo );
607  }
608  }
609 }
610 
611 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SfxViewFrame * GetViewFrame() const
void StopShellTimer()
Definition: view.cxx:1749
bool ClickToINetGrf(const Point &rDocPt, LoadUrlFlags nFilter)
Definition: wrtsh2.cxx:465
#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:123
#define EXCHG_IN_ACTION_MOVE
void KillPams()
Definition: crsrsh.cxx:1013
SwNode & GetNode(bool bPoint=true) const
Definition: pam.hxx:223
sal_Int32 nIndex
size_t GetSectionFormatPos(const SwSectionFormat &) const
Definition: edsect.cxx:135
void ResetCursorStack()
Definition: wrtsh.hxx:620
Marks a position in the document model.
Definition: pam.hxx:35
void SetType(SectionType const eNew)
Definition: section.hxx:96
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:1464
const OUString & GetURL() const
Definition: navicont.hxx:46
FieldDialogPressedButton
Definition: wrtsh.hxx:372
SAL_DLLPRIVATE void SetProtectFlag(bool const bFlag)
Definition: section.hxx:106
void SetLinkFileName(OUString const &rNew)
Definition: section.hxx:118
LoadUrlFlags
Definition: swurl.hxx:27
SwUndoId
Definition: swundo.hxx:29
sal_uInt32 GetFormat() const
Query parameters for dialog and for BASIC.
Definition: fldbas.hxx:388
SwField * GetField(size_t nId)
Definition: fldlst.cxx:92
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:647
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:47
bool GetLastUndoInfo(OUString *const o_pStr, SwUndoId *const o_pId, const SwView *pView=nullptr) const
Definition: edws.cxx:236
const SwPosition * GetMark() const
Definition: pam.hxx:209
const sal_Unicode cTokenSeparator
Base class of all fields.
Definition: fldbas.hxx:280
Provides access to the marks of a document.
void ClickToField(const SwField &rField)
Definition: wrtsh2.cxx:343
SwSection const * InsertSection(SwSectionData &rNewData, SfxItemSet const *const =nullptr)
Definition: edsect.cxx:34
SwUndoId EndUndo(SwUndoId eUndoId=SwUndoId::EMPTY, const SwRewriter *pRewriter=nullptr)
Closes parenthesis of nUndoId, not used by UI.
Definition: edws.cxx:233
void UpdateInputFields(SwInputFieldList *pLst=nullptr)
Definition: wrtsh2.cxx:141
SwSectionFormat * GetFormat()
Definition: section.hxx:337
const SvxMacro * GetMacro(SvMacroItemId nEvent) const
Definition: fmtatr2.cxx:251
void DoUndo(bool bOn=true)
Undo.
Definition: edws.cxx:199
IDocumentMarkAccess * getIDocumentMarkAccess()
Definition: docbm.cxx:1625
void NavigatorPaste(const NaviContentBookmark &rBkmk, const sal_uInt16 nAction)
Definition: wrtsh2.cxx:548
css::uno::Reference< css::frame::XModel > GetModel() const
SfxViewShell * GetSfxViewShell() const
Definition: viewsh.hxx:444
#define RES_REMOVE_UNO_OBJECT
Definition: hintids.hxx:398
void EndAllAction()
Definition: edws.cxx:96
RET_CANCEL
#define FN_EDIT_FIELD
Definition: cmdid.h:70
void PushCursor()
save cursor
Definition: fldlst.cxx:100
bool DelRight()
Definition: delete.cxx:285
const SwTextINetFormat * GetTextINetFormat() const
Definition: fmtinfmt.hxx:70
void UpdateFields() const
Definition: fldbas.hxx:272
void UpdateSection(size_t const nSect, SwSectionData &, SfxItemSet const *const =nullptr)
Definition: edsect.cxx:155
Used by the UI to modify the document model.
Definition: wrtsh.hxx:90
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:484
const OUString & GetValue() const
Definition: fmtinfmt.hxx:75
const SwView & GetView() const
Definition: wrtsh.hxx:428
RET_YES
bool m_bIsInClickToEdit
Definition: wrtsh.hxx:573
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:961
virtual sw::mark::IMark * makeAnnotationMark(const SwPaM &rPaM, const OUString &rName)=0
SwField * GetCurField(const bool bIncludeInputFieldAtStart=false) const
Definition: crstrvl.cxx:927
void libreOfficeKitViewCallback(int nType, const char *pPayload) const override
SwDoc * GetDoc() const
Definition: viewsh.hxx:284
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:332
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:532
virtual VclPtr< AbstractFieldInputDlg > CreateFieldInputDlg(weld::Widget *pParent, SwWrtShell &rSh, SwField *pField, bool bPrevButton, bool bNextButton)=0
void Update()
void EndListeningAll()
Definition: calbck.cxx:124
virtual OUString GetDescription() const
Definition: fldbas.cxx:753
void PopCursor()
get cursor
Definition: fldlst.cxx:107
weld::Window * GetFrameWeld(const SfxFrame *pFrame)
Definition: dialoghelp.cxx:20
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:136
Style of a layout element.
Definition: frmfmt.hxx:57
virtual SwPaM & GetCurrentShellCursor() override
Return the current shell cursor.
Definition: crsrsh.cxx:179
bool HasSelection() const
Definition: wrtsh.hxx:141
void GotoFieldPos(size_t nId)
go to position of a field
Definition: fldlst.cxx:113
SfxBindings * GetBindings() const
void ClickToINetAttr(const SwFormatINetFormat &rItem, LoadUrlFlags nFilter=LoadUrlFlags::NONE)
Definition: wrtsh2.cxx:437
#define FN_INSERT_TABLE
Definition: cmdid.h:209
const SwPaM * GetTableCrs() const
Definition: crsrsh.hxx:908
void Insert2(const OUString &, const bool bForceExpandHints=false)
Definition: editsh.cxx:79
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:292
bool InsertURL(const SwFormatINetFormat &rFormat, const OUString &rStr, bool bKeepSelection=false)
Definition: editsh.cxx:633
int i
void InsertTableOf(const SwTOXBase &rTOX, const SfxItemSet *pSet=nullptr)
Definition: wrtsh2.cxx:319
SwContentNode * GetContentNode()
Definition: node.hxx:615
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:222
Marks a character position inside a document model node.
Definition: index.hxx:37
void AddRule(SwUndoArg eWhat, const OUString &rWith)
Definition: SwRewriter.cxx:29
size_t Count() const
Definition: fldlst.cxx:86
bool StartInputFieldDlg(SwField *, bool bPrevButton, bool bNextButton, weld::Widget *pParentWin, FieldDialogPressedButton *pPressedButton=nullptr)
Definition: wrtsh2.cxx:265
static SwAbstractDialogFactory * Create()
Definition: swabstdlg.cxx:36
bool HasName() const
virtual OUString GetPar2() const
Definition: fldbas.cxx:268
virtual void Modify(const SfxPoolItem *pOld, const SfxPoolItem *pNew) override
Definition: calbck.hxx:183
const SwPosition * Start() const
Definition: pam.hxx:212
SwDocShell * GetDocShell()
Definition: view.cxx:1107
SvxMacro GetSvxMacro() const
Definition: macrofld.cxx:108
void Set(SwCallEventObjectType eTyp, const SwFrameFormat *pFormat)
Definition: swevent.hxx:87
SwFieldType * GetTyp() const
Definition: fldbas.hxx:383
#define FN_INSERT_FRAME
Definition: cmdid.h:212
bool IsEndOfPara() const
Definition: wrtsh.hxx:190
#define SAL_WARN_IF(condition, area, stream)
OUString GetUniqueSectionName(const OUString *pChkStr=nullptr) const
Definition: edsect.cxx:165
const OUString & GetTargetFrame() const
Definition: fmtinfmt.hxx:89
void EndPara(bool bSelect=false)
Definition: move.cxx:358
vcl::Window * GetWin() const
Definition: viewsh.hxx:340
OUString aName
sal_Int32 GetIndex() const
Definition: index.hxx:95
const SwPosition * End() const
Definition: pam.hxx:217
bool CanInsert()
Definition: wrtsh1.cxx:1719
const INetURLObject & GetURLObject() const
void ClearMark()
Definition: crsrsh.cxx:930
#define RES_OBJECTDYING
Definition: hintids.hxx:378
const sal_uInt16 CRSR_SKIP_CHARS
Definition: swcrsr.hxx:63
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:202
void StartAllAction()
For all views of this document.
Definition: edws.cxx:85
SwFieldIds Which() const
Definition: fldbas.hxx:266
bool IsClickable() const
Is this field clickable?
Definition: fldbas.cxx:758
sal_uInt16 Which() const
bool GotoRefMark(const OUString &rRefMark, sal_uInt16 nSubType, sal_uInt16 nSeqNo)
jump to reference marker
Definition: crstrvl.cxx:1237
SfxMedium * GetMedium() const