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