LibreOffice Module sw (master)  1
textfld.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 <AnnotationWin.hxx>
21 #include <comphelper/lok.hxx>
22 #include <chrdlgmodes.hxx>
23 #include <hintids.hxx>
25 #include <editeng/eeitem.hxx>
26 #include <editeng/kernitem.hxx>
27 #include <editeng/outliner.hxx>
28 #include <sfx2/lnkbase.hxx>
29 #include <fmtfld.hxx>
30 #include <txtfld.hxx>
31 #include <svl/itempool.hxx>
32 #include <tools/lineend.hxx>
33 #include <unotools/useroptions.hxx>
34 #include <svl/whiter.hxx>
35 #include <svl/eitem.hxx>
36 #include <svl/macitem.hxx>
37 #include <sfx2/viewfrm.hxx>
38 #include <sfx2/request.hxx>
39 #include <svx/postattr.hxx>
40 #include <svx/hlnkitem.hxx>
41 #include <svx/svxdlg.hxx>
42 #include <svx/svxids.hrc>
43 #include <sfx2/linkmgr.hxx>
45 #include <sfx2/dispatch.hxx>
46 #include <fmtinfmt.hxx>
47 #include <fldwrap.hxx>
48 #include <redline.hxx>
49 #include <view.hxx>
50 #include <viewopt.hxx>
51 #include <wrtsh.hxx>
52 #include <basesh.hxx>
53 #include <flddat.hxx>
54 #include <numrule.hxx>
55 #include <textsh.hxx>
56 #include <docsh.hxx>
57 #include <docufld.hxx>
58 #include <usrfld.hxx>
59 #include <ddefld.hxx>
60 #include <expfld.hxx>
61 #include <fldmgr.hxx>
62 #include <uitool.hxx>
63 #include <cmdid.h>
64 #include <strings.hrc>
65 #include <sfx2/app.hxx>
66 #include <svx/dialogs.hrc>
67 #include <sfx2/event.hxx>
68 #include <swabstdlg.hxx>
69 #include <doc.hxx>
70 #include <app.hrc>
71 #include <edtwin.hxx>
72 #include <PostItMgr.hxx>
73 #include <cstddef>
74 #include <memory>
75 #include <swmodule.hxx>
76 #include <MarkManager.hxx>
77 #include <xmloff/odffields.hxx>
79 #include <IDocumentUndoRedo.hxx>
80 #include <svx/numfmtsh.hxx>
81 #include <svl/zforlist.hxx>
82 #include <svl/zformat.hxx>
83 #include <IMark.hxx>
84 #include <officecfg/Office/Compatibility.hxx>
85 
86 
87 using namespace nsSwDocInfoSubType;
88 
89 static OUString lcl_BuildTitleWithRedline( const SwRangeRedline *pRedline )
90 {
91  const OUString sTitle(SwResId(STR_REDLINE_COMMENT));
92 
93  const char* pResId = nullptr;
94  switch( pRedline->GetType() )
95  {
97  pResId = STR_REDLINE_INSERTED;
98  break;
100  pResId = STR_REDLINE_DELETED;
101  break;
102  case RedlineType::Format:
104  pResId = STR_REDLINE_FORMATTED;
105  break;
106  case RedlineType::Table:
107  pResId = STR_REDLINE_TABLECHG;
108  break;
110  pResId = STR_REDLINE_FMTCOLLSET;
111  break;
112  default:
113  return sTitle;
114  }
115 
116  return sTitle + SwResId(pResId);
117 }
118 
120 {
121  SwWrtShell& rSh = GetShell();
122  const SfxPoolItem* pItem = nullptr;
123 
124  sal_uInt16 nSlot = rReq.GetSlot();
125  const SfxItemSet* pArgs = rReq.GetArgs();
126  if(pArgs)
127  pArgs->GetItemState(GetPool().GetWhich(nSlot), false, &pItem);
128 
129  bool bMore = false;
130  bool bIsText = true;
132  sal_uInt16 nInsertSubType = 0;
133  sal_uInt32 nInsertFormat = 0;
134 
135  switch(nSlot)
136  {
137  case FN_EDIT_FIELD:
138  {
139  SwField* pField = rSh.GetCurField();
140  if( pField )
141  {
142  switch ( pField->GetTypeId() )
143  {
145  {
146  ::sfx2::SvBaseLink& rLink = static_cast<SwDDEFieldType*>(pField->GetTyp())->
147  GetBaseLink();
148  if(rLink.IsVisible())
149  {
151  ScopedVclPtr<SfxAbstractLinksDialog> pDlg(pFact->CreateLinksDialog(GetView().GetFrameWeld(), &rSh.GetLinkManager(), false, &rLink));
152  pDlg->Execute();
153  }
154  break;
155  }
156  default:
157  {
159  ScopedVclPtr<SfxAbstractDialog> pDlg(pFact->CreateSwFieldEditDlg( GetView() ));
160  pDlg->Execute();
161  }
162  }
163  }
164  break;
165  }
167  {
168  SwField* pField = rSh.GetCurField();
169  if(pField && pField->GetTyp()->Which() == SwFieldIds::Macro)
170  {
171 
172  const OUString& rMacro = static_cast<SwMacroField*>(pField)->GetMacro();
173  sal_Int32 nPos = rMacro.indexOf('.');
174  if(nPos != -1)
175  {
176  SvxMacro aMacro( rMacro.copy(nPos + 1), rMacro.copy(0,nPos), STARBASIC );
177  rSh.ExecMacro(aMacro);
178  }
179  }
180  }
181  break;
182 
185  {
186  bool bRet = false;
187  SwFieldType* pField = rSh.GetFieldType( 0, SwFieldIds::Input );
188  const bool bAddSetExpressionFields = !( rSh.GetViewOptions()->IsReadonly() );
189  if ( pField != nullptr
190  && rSh.MoveFieldType(
191  pField,
192  FN_GOTO_NEXT_INPUTFLD == nSlot,
194  bAddSetExpressionFields ) )
195  {
196  rSh.ClearMark();
197  if (!rSh.IsMultiSelection()
198  && (nullptr != dynamic_cast<const SwTextInputField*>(
200  {
201  rSh.SttSelect();
202  rSh.SelectText(
205  }
206  else
207  {
208  rSh.StartInputFieldDlg(rSh.GetCurField(true), false, false, GetView().GetFrameWeld());
209  }
210  bRet = true;
211  }
212 
213  rReq.SetReturnValue( SfxBoolItem( nSlot, bRet ));
214  }
215  break;
216 
217  default:
218  bMore = true;
219  }
220  if(bMore)
221  {
222  // Here come the slots with FieldMgr.
223  SwFieldMgr aFieldMgr(GetShellPtr());
224  switch(nSlot)
225  {
226  case FN_INSERT_DBFIELD:
227  {
228  bool bRes = false;
229  if( pItem )
230  {
231  sal_uInt32 nFormat = 0;
233  OUString aPar1 = static_cast<const SfxStringItem *>(pItem)->GetValue();
234  OUString aPar2;
235  sal_Int32 nCommand = 0;
236 
237  if( SfxItemState::SET == pArgs->GetItemState( FN_PARAM_FIELD_TYPE,
238  false, &pItem ))
239  nType = static_cast<SwFieldTypesEnum>(static_cast<const SfxUInt16Item *>(pItem)->GetValue());
240  aPar1 += OUStringChar(DB_DELIM);
241  if( SfxItemState::SET == pArgs->GetItemState(
242  FN_PARAM_1, false, &pItem ))
243  {
244  aPar1 += static_cast<const SfxStringItem *>(pItem)->GetValue();
245  }
246  if( SfxItemState::SET == pArgs->GetItemState(
247  FN_PARAM_3, false, &pItem ))
248  nCommand = static_cast<const SfxInt32Item*>(pItem)->GetValue();
249  aPar1 += OUStringChar(DB_DELIM)
250  + OUString::number(nCommand)
251  + OUStringChar(DB_DELIM);
252  if( SfxItemState::SET == pArgs->GetItemState(
253  FN_PARAM_2, false, &pItem ))
254  {
255  aPar1 += static_cast<const SfxStringItem *>(pItem)->GetValue();
256  }
257  if( SfxItemState::SET == pArgs->GetItemState(
258  FN_PARAM_FIELD_CONTENT, false, &pItem ))
259  aPar2 = static_cast<const SfxStringItem *>(pItem)->GetValue();
260  if( SfxItemState::SET == pArgs->GetItemState(
261  FN_PARAM_FIELD_FORMAT, false, &pItem ))
262  nFormat = static_cast<const SfxUInt32Item *>(pItem)->GetValue();
263  OSL_FAIL("Command is not yet used");
264  SwInsertField_Data aData(nType, 0, aPar1, aPar2, nFormat, GetShellPtr(), ' '/*separator*/ );
265  bRes = aFieldMgr.InsertField(aData);
266  }
267  rReq.SetReturnValue(SfxBoolItem( nSlot, bRes ));
268  }
269  break;
271  case FN_INSERT_FIELD:
272  {
273  bool bRes = false;
274  if( pItem && nSlot != FN_INSERT_FIELD_CTRL)
275  {
276  sal_uInt32 nFormat = 0;
278  sal_uInt16 nSubType = 0;
279  OUString aPar1 = static_cast<const SfxStringItem *>(pItem)->GetValue();
280  OUString aPar2;
281  sal_Unicode cSeparator = ' ';
282 
283  if( SfxItemState::SET == pArgs->GetItemState( FN_PARAM_FIELD_TYPE,
284  false, &pItem ))
285  nType = static_cast<SwFieldTypesEnum>(static_cast<const SfxUInt16Item *>(pItem)->GetValue());
286  if( SfxItemState::SET == pArgs->GetItemState( FN_PARAM_FIELD_SUBTYPE,
287  false, &pItem ))
288  nSubType = static_cast<const SfxUInt16Item *>(pItem)->GetValue();
289  if( SfxItemState::SET == pArgs->GetItemState(
290  FN_PARAM_FIELD_CONTENT, false, &pItem ))
291  aPar2 = static_cast<const SfxStringItem *>(pItem)->GetValue();
292  if( SfxItemState::SET == pArgs->GetItemState(
293  FN_PARAM_FIELD_FORMAT, false, &pItem ))
294  nFormat = static_cast<const SfxUInt32Item *>(pItem)->GetValue();
295  if( SfxItemState::SET == pArgs->GetItemState(
296  FN_PARAM_3, false, &pItem ))
297  {
298  OUString sTmp = static_cast<const SfxStringItem *>(pItem)->GetValue();
299  if(!sTmp.isEmpty())
300  cSeparator = sTmp[0];
301  }
302  SwInsertField_Data aData(nType, nSubType, aPar1, aPar2, nFormat, GetShellPtr(), cSeparator );
303  bRes = aFieldMgr.InsertField( aData );
304  }
305  else
306  {
307  //#i5788# prevent closing of the field dialog while a modal dialog ( Input field dialog ) is active
308  if(!GetView().GetViewFrame()->IsInModalMode())
309  {
310  SfxViewFrame* pVFrame = GetView().GetViewFrame();
312  bRes = pVFrame->GetChildWindow( nSlot ) != nullptr;
313  Invalidate(rReq.GetSlot());
314  Invalidate(FN_INSERT_FIELD_CTRL);
315  rReq.Ignore();
316  }
317  }
318  rReq.SetReturnValue(SfxBoolItem( nSlot, bRes ));
319  }
320  break;
321 
322  case FN_INSERT_REF_FIELD:
323  {
324  SfxViewFrame* pVFrame = GetView().GetViewFrame();
325  if (!pVFrame->HasChildWindow(FN_INSERT_FIELD))
326  pVFrame->ToggleChildWindow(FN_INSERT_FIELD); // Show dialog
327 
328  // Switch Fielddlg at a new TabPage
329  sal_uInt16 nId = SwFieldDlgWrapper::GetChildWindowId();
330  SwFieldDlgWrapper *pWrp = static_cast<SwFieldDlgWrapper*>(pVFrame->GetChildWindow(nId));
331  if (pWrp)
332  pWrp->ShowReferencePage();
333  rReq.Ignore();
334  }
335  break;
336  case FN_DELETE_COMMENT:
337  {
338  const SvxPostItIdItem* pIdItem = rReq.GetArg<SvxPostItIdItem>(SID_ATTR_POSTIT_ID);
339  if (pIdItem && !pIdItem->GetValue().isEmpty() && GetView().GetPostItMgr())
340  {
341  GetView().GetPostItMgr()->Delete(pIdItem->GetValue().toUInt32());
342  }
343  else if ( GetView().GetPostItMgr() &&
344  GetView().GetPostItMgr()->HasActiveSidebarWin() )
345  {
346  GetView().GetPostItMgr()->DeleteActiveSidebarWin();
347  }
348  }
349  break;
350  case FN_RESOLVE_NOTE:
351  {
352  const SvxPostItIdItem* pIdItem = rReq.GetArg<SvxPostItIdItem>(SID_ATTR_POSTIT_ID);
353  if (pIdItem && !pIdItem->GetValue().isEmpty() && GetView().GetPostItMgr())
354  {
355  GetView().GetPostItMgr()->ToggleResolvedForThread(pIdItem->GetValue().toUInt32());
356  }
357  }
358  break;
359  case FN_DELETE_ALL_NOTES:
360  if ( GetView().GetPostItMgr() )
361  GetView().GetPostItMgr()->Delete();
362  break;
363  case FN_FORMAT_ALL_NOTES:
364  {
365  SwPostItMgr* pPostItMgr = GetView().GetPostItMgr();
366  if (pPostItMgr)
367  pPostItMgr->ExecuteFormatAllDialog(GetView());
368  }
369  break;
371  {
372  const SfxStringItem* pNoteItem = rReq.GetArg<SfxStringItem>(nSlot);
373  if ( pNoteItem && GetView().GetPostItMgr() )
374  GetView().GetPostItMgr()->Delete( pNoteItem->GetValue() );
375  }
376  break;
377  case FN_HIDE_NOTE:
378  if ( GetView().GetPostItMgr() &&
379  GetView().GetPostItMgr()->HasActiveSidebarWin() )
380  {
381  GetView().GetPostItMgr()->HideActiveSidebarWin();
382  }
383  break;
384  case FN_HIDE_ALL_NOTES:
385  if ( GetView().GetPostItMgr() )
386  GetView().GetPostItMgr()->Hide();
387  break;
388  case FN_HIDE_NOTE_AUTHOR:
389  {
390  const SfxStringItem* pNoteItem = rReq.GetArg<SfxStringItem>(nSlot);
391  if ( pNoteItem && GetView().GetPostItMgr() )
392  GetView().GetPostItMgr()->Hide( pNoteItem->GetValue() );
393  }
394  break;
395  case FN_REPLY:
396  {
397  const SvxPostItIdItem* pIdItem = rReq.GetArg<SvxPostItIdItem>(SID_ATTR_POSTIT_ID);
398  if (pIdItem && !pIdItem->GetValue().isEmpty())
399  {
400  SwFieldType* pType = rSh.GetDoc()->getIDocumentFieldsAccess().GetFieldType(SwFieldIds::Postit, OUString(), false);
402  SwFormatField* pSwFormatField = aIter.First();
403  while( pSwFormatField )
404  {
405  if ( static_cast<SwPostItField*>(pSwFormatField->GetField())->GetPostItId() == pIdItem->GetValue().toUInt32() )
406  {
407  sw::annotation::SwAnnotationWin* pWin = GetView().GetPostItMgr()->GetAnnotationWin(pIdItem->GetValue().toUInt32());
408  if (pWin)
409  {
410  const SvxPostItTextItem* pTextItem = rReq.GetArg<SvxPostItTextItem>(SID_ATTR_POSTIT_TEXT);
411  OUString sText;
412  if ( pTextItem )
413  sText = pTextItem->GetValue();
414 
415  GetView().GetPostItMgr()->RegisterAnswerText(sText);
416  pWin->ExecuteCommand(nSlot);
417  }
418 
419  break;
420  }
421  pSwFormatField = aIter.Next();
422  }
423  }
424  }
425  break;
426  case FN_POSTIT:
427  {
428  rSh.InsertPostIt(aFieldMgr, rReq);
429  }
430  break;
431  case SID_EDIT_POSTIT:
432  {
433  const SvxPostItIdItem* pIdItem = rReq.GetArg<SvxPostItIdItem>(SID_ATTR_POSTIT_ID);
434  if (pIdItem && !pIdItem->GetValue().isEmpty())
435  {
436  const SvxPostItTextItem* pTextItem = rReq.GetArg<SvxPostItTextItem>(SID_ATTR_POSTIT_TEXT);
437  OUString sText;
438  if ( pTextItem )
439  sText = pTextItem->GetValue();
440 
441  sw::annotation::SwAnnotationWin* pAnnotationWin = GetView().GetPostItMgr()->GetAnnotationWin(pIdItem->GetValue().toUInt32());
442  if (pAnnotationWin)
443  {
444  pAnnotationWin->UpdateText(sText);
445 
446  // explicit state update to get the Undo state right
447  GetView().AttrChangedNotify(nullptr);
448  }
449  }
450  }
451  break;
452  case FN_REDLINE_COMMENT:
453  {
454  /* this code can be used once we want redline comments in the margin, all other stuff can
455  then be deleted
456  String sComment;
457  const SwRangeRedline *pRedline = rSh.GetCurrRedline();
458 
459  if (pRedline)
460  {
461  sComment = pRedline->GetComment();
462  if ( !sComment.Len() )
463  GetView().GetDocShell()->Broadcast(SwRedlineHint(pRedline,SWREDLINE_INSERTED));
464  const_cast<SwRangeRedline*>(pRedline)->Broadcast(SwRedlineHint(pRedline,SWREDLINE_FOCUS,&GetView()));
465  }
466  */
467 
468  const SwRangeRedline *pRedline = rSh.GetCurrRedline();
469  SwDoc *pDoc = rSh.GetDoc();
470  // If index is specified, goto and select the appropriate redline
471  if (pArgs && pArgs->GetItemState(nSlot, false, &pItem) == SfxItemState::SET)
472  {
473  const sal_uInt32 nChangeId = static_cast<const SfxUInt32Item*>(pItem)->GetValue();
474  const SwRedlineTable& rRedlineTable = pDoc->getIDocumentRedlineAccess().GetRedlineTable();
475  for (SwRedlineTable::size_type nRedline = 0; nRedline < rRedlineTable.size(); ++nRedline)
476  {
477  if (nChangeId == rRedlineTable[nRedline]->GetId())
478  pRedline = rSh.GotoRedline(nRedline, true);
479  }
480  }
481 
482  OUString sCommentText;
483  const SfxStringItem* pTextItem = rReq.GetArg<SvxPostItTextItem>(SID_ATTR_POSTIT_TEXT);
484  if (pTextItem)
485  sCommentText = pTextItem->GetValue();
486 
487  if (pRedline)
488  {
489  // In case of LOK and comment text is already provided, skip
490  // dialog creation and just change the redline comment directly
491  if (comphelper::LibreOfficeKit::isActive() && !sCommentText.isEmpty())
492  {
493  rSh.SetRedlineComment(sCommentText);
494  GetView().AttrChangedNotify(nullptr);
495  MaybeNotifyRedlineModification(const_cast<SwRangeRedline*>(pRedline), pRedline->GetDoc());
496  break;
497  }
498 
499  OUString sComment = convertLineEnd(pRedline->GetComment(), GetSystemLineEnd());
500 
501  bool bTravel = false;
502 
504  ::DialogGetRanges fnGetRange = pFact->GetDialogGetRangesFunc();
505  SfxItemSet aSet(GetPool(), fnGetRange());
506  aSet.Put(SvxPostItTextItem(sComment, SID_ATTR_POSTIT_TEXT));
507  aSet.Put(SvxPostItAuthorItem(pRedline->GetAuthorString(), SID_ATTR_POSTIT_AUTHOR));
508 
510  pRedline->GetRedlineData().GetTimeStamp() ),
511  SID_ATTR_POSTIT_DATE ));
512 
513  // Traveling only if more than one field.
514  rSh.StartAction();
515 
516  rSh.Push();
517  const SwRangeRedline *pActRed = rSh.SelPrevRedline();
518 
519  if (pActRed == pRedline)
520  { // New cursor is at the beginning of the current redlines.
521  rSh.Pop(); // Throw old cursor away
522  rSh.Push();
523  pActRed = rSh.SelPrevRedline();
524  }
525 
526  bool bPrev = pActRed != nullptr;
528  rSh.EndAction();
529 
530  rSh.ClearMark();
531  // Select current redline.
532  pActRed = rSh.SelNextRedline();
533  if (pActRed != pRedline)
534  rSh.SelPrevRedline();
535 
536  rSh.StartAction();
537  rSh.Push();
538  pActRed = rSh.SelNextRedline();
539  bool bNext = pActRed != nullptr;
540  rSh.Pop(SwCursorShell::PopMode::DeleteCurrent); // Restore cursor position
541 
542  if( rSh.IsCursorPtAtEnd() )
543  rSh.SwapPam();
544 
545  rSh.EndAction();
546 
547  bTravel |= bNext || bPrev;
548 
550  ScopedVclPtr<AbstractSvxPostItDialog> pDlg(pFact2->CreateSvxPostItDialog(GetView().GetFrameWeld(), aSet, bTravel));
551  pDlg->HideAuthor();
552 
553  pDlg->SetText(lcl_BuildTitleWithRedline(pRedline));
554 
555  if (bTravel)
556  {
557  pDlg->EnableTravel(bNext, bPrev);
558  pDlg->SetPrevHdl(LINK(this, SwTextShell, RedlinePrevHdl));
559  pDlg->SetNextHdl(LINK(this, SwTextShell, RedlineNextHdl));
560  }
561 
562  SwViewShell::SetCareDialog(pDlg->GetDialog());
563  g_bNoInterrupt = true;
564 
565  if ( pDlg->Execute() == RET_OK )
566  {
567  const SfxItemSet* pOutSet = pDlg->GetOutputItemSet();
568  OUString sMsg(pOutSet->Get(SID_ATTR_POSTIT_TEXT).GetValue());
569 
570  // Insert or change a comment
571  rSh.SetRedlineComment(sMsg);
572  }
573 
575  pDlg.disposeAndClear();
576  g_bNoInterrupt = false;
577  rSh.ClearMark();
578  GetView().AttrChangedNotify(nullptr);
579  }
580  }
581  break;
582 
583  case FN_JAVAEDIT:
584  {
585  OUString aType, aText;
586  bool bIsUrl=false;
587  bool bNew=false;
588  bool bUpdate = false;
589  SwFieldMgr aMgr;
590  if ( pItem )
591  {
592  aText = static_cast<const SfxStringItem*>(pItem)->GetValue();
593  const SfxStringItem* pType = rReq.GetArg<SfxStringItem>(FN_PARAM_2);
594  const SfxBoolItem* pIsUrl = rReq.GetArg<SfxBoolItem>(FN_PARAM_1);
595  if ( pType )
596  aType = pType->GetValue();
597  if ( pIsUrl )
598  bIsUrl = pIsUrl->GetValue();
599 
600  SwScriptField* pField = static_cast<SwScriptField*>(aMgr.GetCurField());
601  bNew = !pField || (pField->GetTyp()->Which() != SwFieldIds::Script);
602  bUpdate = pField && ( bIsUrl != static_cast<bool>(pField->GetFormat()) || pField->GetPar2() != aType || pField->GetPar1() != aText );
603  }
604  else
605  {
608  if ( pDlg->Execute() )
609  {
610  aType = pDlg->GetScriptType();
611  aText = pDlg->GetScriptText();
612  bIsUrl = pDlg->IsUrl();
613  bNew = pDlg->IsNew();
614  bUpdate = pDlg->IsUpdate();
615  rReq.AppendItem( SfxStringItem( FN_JAVAEDIT, aText ) );
616  rReq.AppendItem( SfxStringItem( FN_PARAM_2, aType ) );
617  rReq.AppendItem( SfxBoolItem( FN_PARAM_1, bIsUrl ) );
618  }
619  }
620 
621  if( bNew )
622  {
623  SwInsertField_Data aData(SwFieldTypesEnum::Script, 0, aType, aText, bIsUrl ? 1 : 0);
624  aMgr.InsertField(aData);
625  rReq.Done();
626  }
627  else if( bUpdate )
628  {
629  aMgr.UpdateCurField( bIsUrl ? 1 : 0, aType, aText );
631  rReq.Done();
632  }
633  else
634  rReq.Ignore();
635  }
636  break;
637 
638  case FN_INSERT_FLD_DATE :
639  nInsertType = SwFieldTypesEnum::Date;
640  bIsText = false;
641  goto FIELD_INSERT;
642  case FN_INSERT_FLD_TIME :
643  nInsertType = SwFieldTypesEnum::Time;
644  bIsText = false;
645  goto FIELD_INSERT;
647  nInsertType = SwFieldTypesEnum::PageNumber;
648  nInsertFormat = SVX_NUM_PAGEDESC; // Like page template
649  bIsText = false;
650  goto FIELD_INSERT;
651  case FN_INSERT_FLD_PGCOUNT :
653  nInsertSubType = 0;
654  bIsText = false;
655  nInsertFormat = SVX_NUM_PAGEDESC;
656  goto FIELD_INSERT;
657  case FN_INSERT_FLD_TOPIC :
658  nInsertType = SwFieldTypesEnum::DocumentInfo;
659  nInsertSubType = DI_THEMA;
660  goto FIELD_INSERT;
661  case FN_INSERT_FLD_TITLE :
662  nInsertType = SwFieldTypesEnum::DocumentInfo;
663  nInsertSubType = DI_TITLE;
664  goto FIELD_INSERT;
665  case FN_INSERT_FLD_AUTHOR :
666  nInsertType = SwFieldTypesEnum::DocumentInfo;
667  nInsertSubType = DI_CREATE|DI_SUB_AUTHOR;
668 
669 FIELD_INSERT:
670  {
671  //format conversion should only be done for number formatter formats
672  if(!nInsertFormat)
673  nInsertFormat = aFieldMgr.GetDefaultFormat(nInsertType, bIsText, rSh.GetNumberFormatter());
674  SwInsertField_Data aData(nInsertType, nInsertSubType,
675  OUString(), OUString(), nInsertFormat);
676  aFieldMgr.InsertField(aData);
677  rReq.Done();
678  }
679  break;
680 
682  {
684 
685  SwPaM* pCursorPos = rSh.GetCursor();
686  if(pCursorPos)
687  {
688  // Insert five En Space into the text field so the field has extent
689  static const sal_Unicode vEnSpaces[ODF_FORMFIELD_DEFAULT_LENGTH] = {8194, 8194, 8194, 8194, 8194};
690  bool bSuccess = rSh.GetDoc()->getIDocumentContentOperations().InsertString(*pCursorPos, OUString(vEnSpaces, ODF_FORMFIELD_DEFAULT_LENGTH));
691  if(bSuccess)
692  {
693  IDocumentMarkAccess* pMarksAccess = rSh.GetDoc()->getIDocumentMarkAccess();
694  SwPaM aFieldPam(pCursorPos->GetPoint()->nNode, pCursorPos->GetPoint()->nContent.GetIndex() - ODF_FORMFIELD_DEFAULT_LENGTH,
695  pCursorPos->GetPoint()->nNode, pCursorPos->GetPoint()->nContent.GetIndex());
696  pMarksAccess->makeFieldBookmark(aFieldPam, OUString(), ODF_FORMTEXT,
697  aFieldPam.Start());
698  }
699  }
700 
702  rSh.GetView().GetViewFrame()->GetBindings().Invalidate( SID_UNDO );
703  }
704  break;
706  {
708 
709  SwPaM* pCursorPos = rSh.GetCursor();
710  if(pCursorPos)
711  {
712  IDocumentMarkAccess* pMarksAccess = rSh.GetDoc()->getIDocumentMarkAccess();
713  pMarksAccess->makeNoTextFieldBookmark(*pCursorPos, OUString(), ODF_FORMCHECKBOX);
714  }
715 
717  rSh.GetView().GetViewFrame()->GetBindings().Invalidate( SID_UNDO );
718  }
719  break;
721  {
723 
724  SwPaM* pCursorPos = rSh.GetCursor();
725  if(pCursorPos)
726  {
727  IDocumentMarkAccess* pMarksAccess = rSh.GetDoc()->getIDocumentMarkAccess();
728  pMarksAccess->makeNoTextFieldBookmark(*pCursorPos, OUString(), ODF_FORMDROPDOWN);
729  }
730 
732  rSh.GetView().GetViewFrame()->GetBindings().Invalidate( SID_UNDO );
733  }
734  break;
736  {
738 
739  SwPaM* pCursorPos = rSh.GetCursor();
740  if(pCursorPos)
741  {
742  // Insert five enspaces into the text field so the field has extent
743  sal_Unicode vEnSpaces[ODF_FORMFIELD_DEFAULT_LENGTH] = {8194, 8194, 8194, 8194, 8194};
744  bool bSuccess = rSh.GetDoc()->getIDocumentContentOperations().InsertString(*pCursorPos, OUString(vEnSpaces, ODF_FORMFIELD_DEFAULT_LENGTH));
745  if(bSuccess)
746  {
747  IDocumentMarkAccess* pMarksAccess = rSh.GetDoc()->getIDocumentMarkAccess();
748  SwPaM aFieldPam(pCursorPos->GetPoint()->nNode, pCursorPos->GetPoint()->nContent.GetIndex() - ODF_FORMFIELD_DEFAULT_LENGTH,
749  pCursorPos->GetPoint()->nNode, pCursorPos->GetPoint()->nContent.GetIndex());
750  sw::mark::IFieldmark* pFieldBM = pMarksAccess->makeFieldBookmark(aFieldPam, OUString(), ODF_FORMDATE,
751  aFieldPam.Start());
752 
753  // Use a default date format and language
754  sw::mark::IFieldmark::parameter_map_t* pParameters = pFieldBM->GetParameters();
755  SvNumberFormatter* pFormatter = rSh.GetDoc()->GetNumberFormatter();
756  sal_uInt32 nStandardFormat = pFormatter->GetStandardFormat(SvNumFormatType::DATE);
757  const SvNumberformat* pFormat = pFormatter->GetEntry(nStandardFormat);
758 
759  (*pParameters)[ODF_FORMDATE_DATEFORMAT] <<= pFormat->GetFormatstring();
760  (*pParameters)[ODF_FORMDATE_DATEFORMAT_LANGUAGE] <<= LanguageTag(pFormat->GetLanguage()).getBcp47();
761  }
762  }
763 
765  rSh.GetView().GetViewFrame()->GetBindings().Invalidate( SID_UNDO );
766  }
767  break;
768  default:
769  OSL_FAIL("wrong dispatcher");
770  return;
771  }
772  }
773 }
774 
776 {
777  SwWrtShell& rSh = GetShell();
778  SfxWhichIter aIter( rSet );
779  const SwField* pField = nullptr;
780  bool bGetField = false;
781  sal_uInt16 nWhich = aIter.FirstWhich();
782 
783  while (nWhich)
784  {
785  switch (nWhich)
786  {
787  case FN_DELETE_COMMENT:
789  case FN_DELETE_ALL_NOTES:
790  case FN_FORMAT_ALL_NOTES:
791  case FN_HIDE_NOTE:
792  case FN_HIDE_NOTE_AUTHOR:
793  case FN_HIDE_ALL_NOTES:
794  {
795  SwPostItMgr* pPostItMgr = GetView().GetPostItMgr();
796  if ( !pPostItMgr )
797  rSet.InvalidateItem( nWhich );
798  else if ( !pPostItMgr->HasActiveSidebarWin() )
799  {
802  }
803  }
804  break;
805 
806  case FN_EDIT_FIELD:
807  {
808  if( !bGetField )
809  {
810  pField = rSh.GetCurField();
811  bGetField = true;
812  }
813 
814  SwFieldIds nTempWhich = pField ? pField->GetTyp()->Which() : SwFieldIds::Unknown;
815  if( SwFieldIds::Unknown == nTempWhich ||
816  SwFieldIds::Postit == nTempWhich ||
817  SwFieldIds::Script == nTempWhich ||
818  SwFieldIds::TableOfAuthorities == nTempWhich )
819  rSet.DisableItem( nWhich );
820  else if( SwFieldIds::Dde == nTempWhich &&
821  !static_cast<SwDDEFieldType*>(pField->GetTyp())->GetBaseLink().IsVisible())
822  {
823  // nested links cannot be edited
824  rSet.DisableItem( nWhich );
825  }
826  }
827  break;
828 
830  {
831  if(!bGetField)
832  {
833  pField = rSh.GetCurField();
834  bGetField = true;
835  }
836  if(!pField || pField->GetTyp()->Which() != SwFieldIds::Macro)
837  rSet.DisableItem(nWhich);
838  }
839  break;
840 
841  case FN_INSERT_FIELD:
842  {
843  if ( rSh.CursorInsideInputField() )
844  {
845  rSet.DisableItem(nWhich);
846  }
847  else
848  {
849  SfxViewFrame* pVFrame = GetView().GetViewFrame();
850  //#i5788# prevent closing of the field dialog while a modal dialog ( Input field dialog ) is active
851  if(!pVFrame->IsInModalMode() &&
853  rSet.Put(SfxBoolItem( FN_INSERT_FIELD, pVFrame->HasChildWindow(nWhich)));
854  else
856  }
857  }
858  break;
859 
860  case FN_INSERT_REF_FIELD:
861  {
862  SfxViewFrame* pVFrame = GetView().GetViewFrame();
863  if ( !pVFrame->KnowsChildWindow(FN_INSERT_FIELD)
864  || rSh.CursorInsideInputField() )
865  {
867  }
868  }
869  break;
870 
872  if ( rSh.CursorInsideInputField() )
873  {
874  rSet.DisableItem(nWhich);
875  }
876  else
877  {
878  rSet.Put(SfxBoolItem( nWhich, GetView().GetViewFrame()->HasChildWindow(FN_INSERT_FIELD)));
879  }
880  break;
881 
882  case FN_REDLINE_COMMENT:
884  rSet.DisableItem(nWhich);
885  break;
886 
887  case FN_REPLY:
889  rSet.DisableItem(nWhich);
890  break;
891 
892  case FN_POSTIT :
893  case FN_JAVAEDIT :
894  {
895  bool bCurField = false;
896  pField = rSh.GetCurField();
897  if(nWhich == FN_POSTIT)
898  bCurField = pField && pField->GetTyp()->Which() == SwFieldIds::Postit;
899  else
900  bCurField = pField && pField->GetTyp()->Which() == SwFieldIds::Script;
901 
902  if( !bCurField && rSh.IsReadOnlyAvailable() && rSh.HasReadonlySel() )
903  {
904  rSet.DisableItem(nWhich);
905  }
906  else if ( rSh.CursorInsideInputField() )
907  {
908  rSet.DisableItem(nWhich);
909  }
910  // tdf#86188 Allow disabling comment insertion on footnote/endnote for better OOXML interoperability
912  {
913  rSet.DisableItem(nWhich);
914  }
915  }
916 
917  break;
918 
920  case FN_INSERT_FLD_DATE:
923  case FN_INSERT_FLD_TIME:
924  case FN_INSERT_FLD_TITLE:
925  case FN_INSERT_FLD_TOPIC:
926  case FN_INSERT_DBFIELD:
927  if ( rSh.CursorInsideInputField() )
928  {
929  rSet.DisableItem(nWhich);
930  }
931  break;
932 
937  if ( rSh.CursorInsideInputField() )
938  {
939  rSet.DisableItem(nWhich);
940  }
941  else
942  {
943  // Check whether we are in a text form field
944  SwPosition aCursorPos(*rSh.GetCursor()->GetPoint());
945  sw::mark::IFieldmark* pFieldBM = GetShell().getIDocumentMarkAccess()->getFieldmarkFor(aCursorPos);
946  if ((!pFieldBM || pFieldBM->GetFieldname() != ODF_FORMTEXT)
947  && aCursorPos.nContent.GetIndex() > 0)
948  {
949  SwPosition aPos(aCursorPos);
950  --aPos.nContent;
951  pFieldBM = GetShell().getIDocumentMarkAccess()->getFieldmarkFor(aPos);
952  }
953  if (pFieldBM && pFieldBM->GetFieldname() == ODF_FORMTEXT &&
954  (aCursorPos > pFieldBM->GetMarkStart() && aCursorPos < pFieldBM->GetMarkEnd() ))
955  {
956  rSet.DisableItem(nWhich);
957  }
958  }
959  break;
960 
961  }
962  nWhich = aIter.NextWhich();
963  }
964 }
965 
967 {
968  const OUString& rName = rHlnkItem.GetName();
969  const OUString& rURL = rHlnkItem.GetURL();
970  const OUString& rTarget = rHlnkItem.GetTargetFrame();
971  sal_uInt16 nType = static_cast<sal_uInt16>(rHlnkItem.GetInsertMode());
972  nType &= ~HLINK_HTMLMODE;
973  const SvxMacroTableDtor* pMacroTable = rHlnkItem.GetMacroTable();
974 
975  SwWrtShell& rSh = GetShell();
976 
978  {
979  rSh.StartAction();
981  rSh.GetCurAttr( aSet );
982 
983  const SfxPoolItem* pItem;
984  if(SfxItemState::SET == aSet.GetItemState(RES_TXTATR_INETFMT, false, &pItem))
985  {
986  // Select links
987  rSh.SwCursorShell::SelectTextAttr(RES_TXTATR_INETFMT, false);
988  }
989  switch (nType)
990  {
991  case HLINK_DEFAULT:
992  case HLINK_FIELD:
993  {
994  SwFormatINetFormat aINetFormat( rURL, rTarget );
995  aINetFormat.SetName(rHlnkItem.GetIntName());
996  if(pMacroTable)
997  {
998  const SvxMacro *pMacro = pMacroTable->Get( SvMacroItemId::OnMouseOver );
999  if( pMacro )
1000  aINetFormat.SetMacro(SvMacroItemId::OnMouseOver, *pMacro);
1001  pMacro = pMacroTable->Get( SvMacroItemId::OnClick );
1002  if( pMacro )
1003  aINetFormat.SetMacro(SvMacroItemId::OnClick, *pMacro);
1004  pMacro = pMacroTable->Get( SvMacroItemId::OnMouseOut );
1005  if( pMacro )
1006  aINetFormat.SetMacro(SvMacroItemId::OnMouseOut, *pMacro);
1007  }
1008  rSh.SttSelect();
1009  rSh.InsertURL( aINetFormat, rName, true );
1010  rSh.EndSelect();
1011  }
1012  break;
1013 
1014  case HLINK_BUTTON:
1015  bool bSel = rSh.HasSelection();
1016  if(bSel)
1017  rSh.DelRight();
1018  InsertURLButton( rURL, rTarget, rName );
1019  rSh.EnterStdMode();
1020  break;
1021  }
1022  rSh.EndAction();
1023  }
1024 }
1025 
1026 IMPL_LINK( SwTextShell, RedlineNextHdl, AbstractSvxPostItDialog&, rDlg, void )
1027 {
1028  SwWrtShell* pSh = GetShellPtr();
1029 
1030  // Insert or change a comment.
1031  pSh->SetRedlineComment(rDlg.GetNote());
1032 
1033  const SwRangeRedline *pRedline = pSh->GetCurrRedline();
1034 
1035  if (!pRedline)
1036  return;
1037 
1038  // Traveling only if more than one field.
1039  if( !pSh->IsCursorPtAtEnd() )
1040  pSh->SwapPam(); // Move the cursor behind the Redline.
1041 
1042  pSh->Push();
1043  const SwRangeRedline *pActRed = pSh->SelNextRedline();
1045 
1046  bool bEnable = false;
1047 
1048  if (pActRed)
1049  {
1050  pSh->StartAction();
1051  pSh->Push();
1052  bEnable = pSh->SelNextRedline() != nullptr;
1053  pSh->Pop(SwCursorShell::PopMode::DeleteCurrent);
1054  pSh->EndAction();
1055  }
1056 
1057  rDlg.EnableTravel(bEnable, true);
1058 
1059  if( pSh->IsCursorPtAtEnd() )
1060  pSh->SwapPam();
1061 
1062  pRedline = pSh->GetCurrRedline();
1063  OUString sComment = convertLineEnd(pRedline->GetComment(), GetSystemLineEnd());
1064 
1065  rDlg.SetNote(sComment);
1066  rDlg.ShowLastAuthor( pRedline->GetAuthorString(),
1068  pRedline->GetRedlineData().GetTimeStamp() ));
1069 
1070  rDlg.SetText(lcl_BuildTitleWithRedline(pRedline));
1071 
1072 }
1073 
1074 IMPL_LINK( SwTextShell, RedlinePrevHdl, AbstractSvxPostItDialog&, rDlg, void )
1075 {
1076  SwWrtShell* pSh = GetShellPtr();
1077 
1078  // Insert or change a comment.
1079  pSh->SetRedlineComment(rDlg.GetNote());
1080 
1081  const SwRangeRedline *pRedline = pSh->GetCurrRedline();
1082 
1083  if (!pRedline)
1084  return;
1085 
1086  // Traveling only if more than one field.
1087  pSh->Push();
1088  const SwRangeRedline *pActRed = pSh->SelPrevRedline();
1090 
1091  bool bEnable = false;
1092 
1093  if (pActRed)
1094  {
1095  pSh->StartAction();
1096  pSh->Push();
1097  bEnable = pSh->SelPrevRedline() != nullptr;
1098  pSh->Pop(SwCursorShell::PopMode::DeleteCurrent);
1099  pSh->EndAction();
1100  }
1101 
1102  rDlg.EnableTravel(true, bEnable);
1103 
1104  pRedline = pSh->GetCurrRedline();
1105  OUString sComment = convertLineEnd(pRedline->GetComment(), GetSystemLineEnd());
1106 
1107  rDlg.SetNote(sComment);
1108  rDlg.ShowLastAuthor(pRedline->GetAuthorString(),
1110  pRedline->GetRedlineData().GetTimeStamp() ));
1111 
1112  rDlg.SetText(lcl_BuildTitleWithRedline(pRedline));
1113 
1114 }
1115 
1116 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SwFieldType * GetFieldType(size_t nField, SwFieldIds nResId=SwFieldIds::Unknown) const
get field types with a ResId, if 0 get all
Definition: edfld.cxx:64
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
#define FN_HIDE_ALL_NOTES
Definition: cmdid.h:731
bool IsInModalMode() const
SfxViewFrame * GetViewFrame() const
Instances of SwFields and those derived from it occur 0 to n times.
Definition: fldbas.hxx:234
#define FN_INSERT_FLD_PGCOUNT
Definition: cmdid.h:252
std::map< OUString, css::uno::Any > parameter_map_t
Definition: IMark.hxx:94
TOOLS_DLLPUBLIC OString convertLineEnd(const OString &rIn, LineEnd eLineEnd)
Marks a position in the document model.
Definition: pam.hxx:35
SfxChildWindow * GetChildWindow(sal_uInt16)
const SwField * GetField() const
Definition: fmtfld.hxx:70
SwPaM * GetCursor(bool bMakeTableCursor=true) const
Return pointer to the current shell cursor.
Definition: crsrsh.cxx:184
OUString const & GetAuthorString(sal_uInt16 nPos=0) const
Definition: docredln.cxx:1718
sfx2::LinkManager & GetLinkManager()
Definition: editsh.cxx:592
sal_uInt32 GetFormat() const
Query parameters for dialog and for BASIC.
Definition: fldbas.hxx:388
std::string GetValue
SvNumberFormatter * GetNumberFormatter(bool bCreate=true)
Definition: doc.hxx:1401
const SwRangeRedline * SelNextRedline()
Definition: crstrvl.cxx:2185
#define FN_REDLINE_COMMENT
Definition: cmdid.h:122
bool IsCursorInFootnote() const
Definition: crsrsh.cxx:1138
virtual SwFieldType * GetFieldType(SwFieldIds nResId, const OUString &rName, bool bDbFieldMatching) const =0
void SetUndoNoResetModified()
Definition: edws.cxx:79
#define FN_INSERT_FLD_TITLE
Definition: cmdid.h:254
SwNodeIndex nNode
Definition: pam.hxx:37
bool MoveFieldType(const SwFieldType *pFieldType, const bool bNext, const SwFieldIds nResType=SwFieldIds::Unknown, const bool bAddSetExpressionFieldsToInputFields=true)
Definition: crstrvl.cxx:714
IMPL_LINK(SwTextShell, RedlineNextHdl, AbstractSvxPostItDialog &, rDlg, void)
Definition: textfld.cxx:1026
const OUString & GetTargetFrame() const
static SvxAbstractDialogFactory * Create()
Base class of all fields.
Definition: fldbas.hxx:280
bool Pop(SwCursorShell::PopMode=SwCursorShell::PopMode::DeleteStack)
Definition: wrtsh1.cxx:1726
virtual SwUndoId EndUndo(SwUndoId const eUndoId, SwRewriter const *const pRewriter)=0
Closes undo block.
Provides access to the marks of a document.
void UpdateCurField(sal_uInt32 nFormat, const OUString &rPar1, const OUString &rPar2, std::unique_ptr< SwField > _pField=nullptr)
Definition: fldmgr.cxx:1532
Definition: doc.hxx:185
#define FN_INSERT_FLD_PGNUMBER
Definition: cmdid.h:251
#define ODF_FORMCHECKBOX
#define ODF_FORMDATE_DATEFORMAT_LANGUAGE
TElementType * Next()
Definition: calbck.hxx:373
void InvalidateItem(sal_uInt16 nWhich)
sal_Int16 nId
sal_uInt16 FirstWhich()
virtual VclPtr< SfxAbstractDialog > CreateSwFieldEditDlg(SwView &rVw)=0
#define FN_PARAM_FIELD_FORMAT
Definition: cmdid.h:764
const SwRangeRedline * GotoRedline(SwRedlineTable::size_type nArrPos, bool bSelect)
Definition: move.cxx:667
void EnterStdMode()
Definition: select.cxx:555
void Done(bool bRemove=false)
IDocumentMarkAccess * getIDocumentMarkAccess()
Definition: docbm.cxx:1602
IDocumentUndoRedo & GetIDocumentUndoRedo()
Definition: doc.cxx:143
const SfxItemSet * GetArgs() const
void Invalidate(sal_uInt16 nId)
virtual VclPtr< AbstractSvxPostItDialog > CreateSvxPostItDialog(weld::Widget *pParent, const SfxItemSet &rCoreSet, bool bPrevNext=false)=0
virtual OUString GetPar1() const override
Type.
Definition: scrptfld.cxx:65
bool InsertField(const SwInsertField_Data &rData)
Definition: fldmgr.cxx:898
IDocumentContentOperations const & getIDocumentContentOperations() const
Definition: doc.cxx:314
OUString GetAppLangDateTimeString(const DateTime &)
Definition: uitool.cxx:818
void InsertHyperlink(const SvxHyperlinkItem &rHlnkItem)
Definition: textfld.cxx:966
#define FN_EDIT_FIELD
Definition: cmdid.h:69
const OUString & GetFormatstring() const
void InsertPostIt(SwFieldMgr &rFieldMgr, const SfxRequest &rReq)
Inserts a new annotation/comment at the current cursor position / selection.
Definition: wrtsh1.cxx:1903
sal_uInt16 NextWhich()
bool DelRight()
Definition: delete.cxx:285
size_type size() const
Definition: docary.hxx:368
void SwapPam()
Definition: crsrsh.cxx:963
Used by the UI to modify the document model.
Definition: wrtsh.hxx:90
void ToggleChildWindow(sal_uInt16)
IDocumentFieldsAccess const & getIDocumentFieldsAccess() const
Definition: doc.cxx:356
sal_uInt16 sal_Unicode
bool IsReadonly() const
Definition: viewopt.hxx:424
const SwView & GetView() const
Definition: wrtsh.hxx:428
#define FN_PARAM_FIELD_SUBTYPE
Definition: cmdid.h:763
#define FN_FORMAT_ALL_NOTES
Definition: cmdid.h:735
SwIndex nContent
Definition: pam.hxx:38
SwField * GetCurField(const bool bIncludeInputFieldAtStart=false) const
Definition: crstrvl.cxx:927
LineEnd GetSystemLineEnd()
const SvxMacroTableDtor * GetMacroTable() const
void ExecuteCommand(sal_uInt16 nSlot)
HLINK_HTMLMODE
sal_uInt32 GetDefaultFormat(SwFieldTypesEnum nTypeId, bool bIsText, SvNumberFormatter *pFormatter)
Definition: fldmgr.cxx:1820
#define FN_DELETE_COMMENT
Definition: cmdid.h:733
virtual parameter_map_t * GetParameters()=0
#define FN_GOTO_PREV_INPUTFLD
Definition: cmdid.h:100
SwDoc * GetDoc() const
Definition: viewsh.hxx:284
void MaybeNotifyRedlineModification(SwRangeRedline *pRedline, SwDoc *pDoc)
Definition: docredln.cxx:1031
void ExecMacro(const SvxMacro &rMacro, OUString *pRet=nullptr, SbxArray *pArgs=nullptr)
Definition: wrtsh3.cxx:185
const SwRedlineData & GetRedlineData(sal_uInt16 nPos=0) const
Definition: docredln.cxx:1746
#define FN_INSERT_FIELD_DATA_ONLY
Definition: cmdid.h:204
#define FN_RESOLVE_NOTE
Definition: cmdid.h:736
#define FN_INSERT_FLD_DATE
Definition: cmdid.h:249
weld::Window * GetFrameWeld(const SfxFrame *pFrame)
Definition: dialoghelp.cxx:20
bool SelectText(const sal_Int32 nStart, const sal_Int32 nEnd)
Definition: crstrvl.cxx:1933
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:136
void ExecField(SfxRequest &rReq)
Definition: textfld.cxx:119
void EndSelect()
Definition: select.cxx:429
#define FN_REPLY
Definition: cmdid.h:734
virtual bool InsertString(const SwPaM &rRg, const OUString &, const SwInsertFlags nInsertMode=SwInsertFlags::EMPTYEXPAND)=0
Insert string into existing text node at position rRg.Point().
virtual VclPtr< AbstractJavaEditDialog > CreateJavaEditDialog(weld::Window *pParent, SwWrtShell *pWrtSh)=0
const OUString & GetURL() const
bool HasSelection() const
Definition: wrtsh.hxx:141
virtual SwUndoId StartUndo(SwUndoId const eUndoId, SwRewriter const *const pRewriter)=0
Opens undo block.
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
Shell * GetShell()
static OUString lcl_BuildTitleWithRedline(const SwRangeRedline *pRedline)
Definition: textfld.cxx:89
bool SetRedlineComment(const OUString &rS)
Set comment to Redline at position.
Definition: edredln.cxx:107
HLINK_BUTTON
const SwPosition * GetPoint() const
Definition: pam.hxx:207
#define FN_INSERT_CHECKBOX_FORMFIELD
Definition: cmdid.h:278
void EndAction(const bool bIdleEnd=false, const bool DoSetPosX=false)
Definition: crsrsh.cxx:228
void ShowReferencePage()
Definition: fldwrap.cxx:97
#define FN_DELETE_NOTE_AUTHOR
Definition: cmdid.h:727
void Push()
store a copy of the current cursor on the cursor stack
Definition: crsrsh.cxx:2221
const SwRangeRedline * SelPrevRedline()
Definition: crstrvl.cxx:2205
#define FN_GOTO_NEXT_INPUTFLD
Definition: cmdid.h:99
#define FN_INSERT_TEXT_FORMFIELD
Definition: cmdid.h:277
bool InsertURL(const SwFormatINetFormat &rFormat, const OUString &rStr, bool bKeepSelection=false)
Definition: editsh.cxx:633
SfxBindings & GetBindings()
TElementType * First()
Definition: calbck.hxx:342
QPRO_FUNC_TYPE const nType
const SwDocInfoSubType DI_CREATE
Definition: docufld.hxx:70
SwFieldTypesEnum
List of FieldTypes at UI.
Definition: fldbas.hxx:87
vector_type::size_type size_type
Definition: docary.hxx:330
const OUString & GetValue() const
SwFieldIds
Definition: fldbas.hxx:38
const T * GetArg(sal_uInt16 nSlotId) const
#define FN_HIDE_NOTE_AUTHOR
Definition: cmdid.h:730
SwDoc * GetDoc() const
Definition: pam.hxx:243
SwField * GetCurField()
Definition: fldmgr.cxx:433
#define FN_INSERT_FLD_TIME
Definition: cmdid.h:250
const DateTime & GetTimeStamp() const
Definition: redline.hxx:129
virtual OUString GetPar2() const override
Text.
Definition: scrptfld.cxx:76
HLINK_FIELD
void UpdateText(const OUString &aText)
bool StartInputFieldDlg(SwField *, bool bPrevButton, bool bNextButton, weld::Widget *pParentWin, FieldDialogPressedButton *pPressedButton=nullptr)
Definition: wrtsh2.cxx:272
static SwAbstractDialogFactory * Create()
Definition: swabstdlg.cxx:36
#define FN_JAVAEDIT
Definition: cmdid.h:264
#define FN_EXECUTE_MACROFIELD
Definition: cmdid.h:75
virtual sw::mark::IFieldmark * makeFieldBookmark(const SwPaM &rPaM, const OUString &rName, const OUString &rType, SwPosition const *pSepPos=nullptr)=0
GUIDCNamePair const aData
#define ODF_FORMDATE_DATEFORMAT
OUString SwResId(const char *pId)
Definition: swmodule.cxx:190
#define FN_INSERT_DBFIELD
Definition: cmdid.h:196
void SttSelect()
Definition: select.cxx:389
bool HasReadonlySel() const
Definition: crsrsh.cxx:3312
#define RES_TXTATR_INETFMT
Definition: hintids.hxx:142
#define ODF_FORMFIELD_DEFAULT_LENGTH
virtual sw::mark::IFieldmark * makeNoTextFieldBookmark(const SwPaM &rPaM, const OUString &rName, const OUString &rType)=0
#define DB_DELIM
Definition: swtypes.hxx:141
static sal_Int32 EndOfInputFieldAtPos(const SwPosition &rPos)
Definition: crstrvl.cxx:982
const SwPosition * Start() const
Definition: pam.hxx:212
SwFieldType * GetTyp() const
Definition: fldbas.hxx:383
SW_DLLPUBLIC bool HasActiveSidebarWin() const
Definition: PostItMgr.cxx:2323
void StartAction()
Definition: crsrsh.cxx:211
const SwDocInfoSubType DI_SUB_AUTHOR
Definition: docufld.hxx:78
virtual DialogGetRanges GetDialogGetRangesFunc()=0
const OUString & GetComment(sal_uInt16 nPos=0) const
Definition: docredln.cxx:1733
void ExecuteFormatAllDialog(SwView &rView)
Definition: PostItMgr.cxx:1624
void SetReturnValue(const SfxPoolItem &)
const SwRangeRedline * GetCurrRedline() const
Definition: edredln.cxx:118
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
#define FN_INSERT_REF_FIELD
Definition: cmdid.h:199
SwFieldTypesEnum GetTypeId() const
Definition: fldbas.cxx:199
sal_uInt16 GetSlot() const
SVX_NUM_PAGEDESC
bool IsMultiSelection() const
Definition: crsrsh.hxx:888
bool HasChildWindow(sal_uInt16)
HLINK_DEFAULT
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
Definition: doc.cxx:334
bool IsReadOnlyAvailable() const
Definition: crsrsh.hxx:478
#define FN_INSERT_FIELD
Definition: cmdid.h:192
const SvxMacro * Get(SvMacroItemId nEvent) const
void DisableItem(sal_uInt16 nWhich)
#define FN_INSERT_DROPDOWN_FORMFIELD
Definition: cmdid.h:279
static void SetCareDialog(const std::shared_ptr< weld::Window > &rNew)
Definition: viewsh.cxx:2498
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
void SetMacro(SvMacroItemId nEvent, const SvxMacro &rMacro)
Macro getter and setter.
Definition: fmtatr2.cxx:248
const SvNumberformat * GetEntry(sal_uInt32 nKey) const
#define GetWhich(nSlot)
const SwViewOption * GetViewOptions() const
Definition: viewsh.hxx:426
static sal_Int32 StartOfInputFieldAtPos(const SwPosition &rPos)
Definition: crstrvl.cxx:974
bool IsCursorPtAtEnd() const
Definition: crsrsh.hxx:898
#define FN_PARAM_FIELD_TYPE
Definition: cmdid.h:762
sal_Int32 GetIndex() const
Definition: index.hxx:95
sal_uInt32 GetStandardFormat(SvNumFormatType eType, LanguageType eLnge=LANGUAGE_DONTKNOW)
#define ODF_FORMTEXT
RET_OK
bool KnowsChildWindow(sal_uInt16)
RedlineType GetType(sal_uInt16 nPos=0) const
Definition: docredln.cxx:1728
void ClearMark()
Definition: crsrsh.cxx:926
bool GetCurAttr(SfxItemSet &, const bool bMergeIndentValuesOfNumRule=false) const
Definition: edattr.cxx:176
#define ODF_FORMDATE
const OUString & GetName() const
SvxLinkInsertMode GetInsertMode() const
bool g_bNoInterrupt
Definition: swmodule.cxx:137
void AppendItem(const SfxPoolItem &)
void StateField(SfxItemSet &)
Definition: textfld.cxx:775
#define FN_INSERT_FLD_AUTHOR
Definition: cmdid.h:255
#define FN_INSERT_DATE_FORMFIELD
Definition: cmdid.h:282
const SwDocInfoSubType DI_THEMA
Definition: docufld.hxx:67
virtual const SwRedlineTable & GetRedlineTable() const =0
const SwDocInfoSubType DI_TITLE
Definition: docufld.hxx:66
SelectionType GetSelectionType() const
Definition: wrtsh1.cxx:1406
sal_Int32 nPos
void Ignore()
static SwTextField * GetTextFieldAtCursor(const SwPaM *pCursor, const bool bIncludeInputFieldAtStart)
Definition: crstrvl.cxx:894
#define FN_INSERT_FIELD_CTRL
Definition: cmdid.h:247
#define FN_HIDE_NOTE
Definition: cmdid.h:729
STARBASIC
SwFieldIds Which() const
Definition: fldbas.hxx:266
SvNumberFormatter * GetNumberFormatter()
Query NumberFormatter from document.
Definition: editsh.cxx:744
void SetName(const OUString &rNm)
Definition: fmtinfmt.hxx:84
#define FN_POSTIT
Definition: cmdid.h:207
LanguageType GetLanguage() const
#define FN_INSERT_FLD_TOPIC
Definition: cmdid.h:253
#define ODF_FORMDROPDOWN
#define FN_DELETE_ALL_NOTES
Definition: cmdid.h:728
const OUString & GetIntName() const
bool CursorInsideInputField() const
Definition: crstrvl.cxx:948