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