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