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