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);
379  if(pType->FindFormatForPostItId(pIdItem->GetValue().toUInt32()))
380  {
381  auto pMgr = GetView().GetPostItMgr();
382  auto pWin = pMgr->GetAnnotationWin(pIdItem->GetValue().toUInt32());
383  if(pWin)
384  {
385  OUString sText;
386  if(const auto pTextItem = rReq.GetArg<SvxPostItTextItem>(SID_ATTR_POSTIT_TEXT))
387  sText = pTextItem->GetValue();
388  pMgr->RegisterAnswerText(sText);
389  pWin->ExecuteCommand(nSlot);
390  }
391  }
392  }
393  }
394  break;
395  case FN_POSTIT:
396  {
397  rSh.InsertPostIt(aFieldMgr, rReq);
398  }
399  break;
400  case SID_EDIT_POSTIT:
401  {
402  const SvxPostItIdItem* pIdItem = rReq.GetArg<SvxPostItIdItem>(SID_ATTR_POSTIT_ID);
403  if (pIdItem && !pIdItem->GetValue().isEmpty())
404  {
405  const SvxPostItTextItem* pTextItem = rReq.GetArg<SvxPostItTextItem>(SID_ATTR_POSTIT_TEXT);
406  OUString sText;
407  if ( pTextItem )
408  sText = pTextItem->GetValue();
409 
410  sw::annotation::SwAnnotationWin* pAnnotationWin = GetView().GetPostItMgr()->GetAnnotationWin(pIdItem->GetValue().toUInt32());
411  if (pAnnotationWin)
412  {
413  pAnnotationWin->UpdateText(sText);
414 
415  // explicit state update to get the Undo state right
416  GetView().AttrChangedNotify(nullptr);
417  }
418  }
419  }
420  break;
421  case FN_REDLINE_COMMENT:
422  {
423  /* this code can be used once we want redline comments in the margin, all other stuff can
424  then be deleted
425  String sComment;
426  const SwRangeRedline *pRedline = rSh.GetCurrRedline();
427 
428  if (pRedline)
429  {
430  sComment = pRedline->GetComment();
431  if ( !sComment.Len() )
432  GetView().GetDocShell()->Broadcast(SwRedlineHint(pRedline,SWREDLINE_INSERTED));
433  const_cast<SwRangeRedline*>(pRedline)->Broadcast(SwRedlineHint(pRedline,SWREDLINE_FOCUS,&GetView()));
434  }
435  */
436 
437  const SwRangeRedline *pRedline = rSh.GetCurrRedline();
438  SwDoc *pDoc = rSh.GetDoc();
439  // If index is specified, goto and select the appropriate redline
440  if (pArgs && pArgs->GetItemState(nSlot, false, &pItem) == SfxItemState::SET)
441  {
442  const sal_uInt32 nChangeId = static_cast<const SfxUInt32Item*>(pItem)->GetValue();
443  const SwRedlineTable& rRedlineTable = pDoc->getIDocumentRedlineAccess().GetRedlineTable();
444  for (SwRedlineTable::size_type nRedline = 0; nRedline < rRedlineTable.size(); ++nRedline)
445  {
446  if (nChangeId == rRedlineTable[nRedline]->GetId())
447  pRedline = rSh.GotoRedline(nRedline, true);
448  }
449  }
450 
451  OUString sCommentText;
452  const SfxStringItem* pTextItem = rReq.GetArg<SvxPostItTextItem>(SID_ATTR_POSTIT_TEXT);
453  if (pTextItem)
454  sCommentText = pTextItem->GetValue();
455 
456  if (pRedline)
457  {
458  // In case of LOK and comment text is already provided, skip
459  // dialog creation and just change the redline comment directly
460  if (comphelper::LibreOfficeKit::isActive() && !sCommentText.isEmpty())
461  {
462  rSh.SetRedlineComment(sCommentText);
463  GetView().AttrChangedNotify(nullptr);
464  MaybeNotifyRedlineModification(const_cast<SwRangeRedline*>(pRedline), pRedline->GetDoc());
465  break;
466  }
467 
468  OUString sComment = convertLineEnd(pRedline->GetComment(), GetSystemLineEnd());
469 
470  bool bTravel = false;
471 
473  ::DialogGetRanges fnGetRange = pFact->GetDialogGetRangesFunc();
474  SfxItemSet aSet(GetPool(), fnGetRange());
475  aSet.Put(SvxPostItTextItem(sComment, SID_ATTR_POSTIT_TEXT));
476  aSet.Put(SvxPostItAuthorItem(pRedline->GetAuthorString(), SID_ATTR_POSTIT_AUTHOR));
477 
479  pRedline->GetRedlineData().GetTimeStamp() ),
480  SID_ATTR_POSTIT_DATE ));
481 
482  // Traveling only if more than one field.
483  rSh.StartAction();
484 
485  rSh.Push();
486  const SwRangeRedline *pActRed = rSh.SelPrevRedline();
487 
488  if (pActRed == pRedline)
489  { // New cursor is at the beginning of the current redlines.
490  rSh.Pop(); // Throw old cursor away
491  rSh.Push();
492  pActRed = rSh.SelPrevRedline();
493  }
494 
495  bool bPrev = pActRed != nullptr;
497  rSh.EndAction();
498 
499  rSh.ClearMark();
500  // Select current redline.
501  pActRed = rSh.SelNextRedline();
502  if (pActRed != pRedline)
503  rSh.SelPrevRedline();
504 
505  rSh.StartAction();
506  rSh.Push();
507  pActRed = rSh.SelNextRedline();
508  bool bNext = pActRed != nullptr;
509  rSh.Pop(SwCursorShell::PopMode::DeleteCurrent); // Restore cursor position
510 
511  if( rSh.IsCursorPtAtEnd() )
512  rSh.SwapPam();
513 
514  rSh.EndAction();
515 
516  bTravel |= bNext || bPrev;
517 
519  ScopedVclPtr<AbstractSvxPostItDialog> pDlg(pFact2->CreateSvxPostItDialog(GetView().GetFrameWeld(), aSet, bTravel));
520  pDlg->HideAuthor();
521 
522  pDlg->SetText(lcl_BuildTitleWithRedline(pRedline));
523 
524  if (bTravel)
525  {
526  pDlg->EnableTravel(bNext, bPrev);
527  pDlg->SetPrevHdl(LINK(this, SwTextShell, RedlinePrevHdl));
528  pDlg->SetNextHdl(LINK(this, SwTextShell, RedlineNextHdl));
529  }
530 
531  SwViewShell::SetCareDialog(pDlg->GetDialog());
532  g_bNoInterrupt = true;
533 
534  if ( pDlg->Execute() == RET_OK )
535  {
536  const SfxItemSet* pOutSet = pDlg->GetOutputItemSet();
537  OUString sMsg(pOutSet->Get(SID_ATTR_POSTIT_TEXT).GetValue());
538 
539  // Insert or change a comment
540  rSh.SetRedlineComment(sMsg);
541  }
542 
544  pDlg.disposeAndClear();
545  g_bNoInterrupt = false;
546  rSh.ClearMark();
547  GetView().AttrChangedNotify(nullptr);
548  }
549  }
550  break;
551 
552  case FN_JAVAEDIT:
553  {
554  OUString aType, aText;
555  bool bIsUrl=false;
556  bool bNew=false;
557  bool bUpdate = false;
558  SwFieldMgr aMgr;
559  if ( pItem )
560  {
561  aText = static_cast<const SfxStringItem*>(pItem)->GetValue();
562  const SfxStringItem* pType = rReq.GetArg<SfxStringItem>(FN_PARAM_2);
563  const SfxBoolItem* pIsUrl = rReq.GetArg<SfxBoolItem>(FN_PARAM_1);
564  if ( pType )
565  aType = pType->GetValue();
566  if ( pIsUrl )
567  bIsUrl = pIsUrl->GetValue();
568 
569  SwScriptField* pField = static_cast<SwScriptField*>(aMgr.GetCurField());
570  bNew = !pField || (pField->GetTyp()->Which() != SwFieldIds::Script);
571  bUpdate = pField && ( bIsUrl != static_cast<bool>(pField->GetFormat()) || pField->GetPar2() != aType || pField->GetPar1() != aText );
572  }
573  else
574  {
577  if ( pDlg->Execute() )
578  {
579  aType = pDlg->GetScriptType();
580  aText = pDlg->GetScriptText();
581  bIsUrl = pDlg->IsUrl();
582  bNew = pDlg->IsNew();
583  bUpdate = pDlg->IsUpdate();
584  rReq.AppendItem( SfxStringItem( FN_JAVAEDIT, aText ) );
585  rReq.AppendItem( SfxStringItem( FN_PARAM_2, aType ) );
586  rReq.AppendItem( SfxBoolItem( FN_PARAM_1, bIsUrl ) );
587  }
588  }
589 
590  if( bNew )
591  {
592  SwInsertField_Data aData(SwFieldTypesEnum::Script, 0, aType, aText, bIsUrl ? 1 : 0);
593  aMgr.InsertField(aData);
594  rReq.Done();
595  }
596  else if( bUpdate )
597  {
598  aMgr.UpdateCurField( bIsUrl ? 1 : 0, aType, aText );
600  rReq.Done();
601  }
602  else
603  rReq.Ignore();
604  }
605  break;
606 
607  case FN_INSERT_FLD_DATE :
608  nInsertType = SwFieldTypesEnum::Date;
609  bIsText = false;
610  goto FIELD_INSERT;
611  case FN_INSERT_FLD_TIME :
612  nInsertType = SwFieldTypesEnum::Time;
613  bIsText = false;
614  goto FIELD_INSERT;
616  nInsertType = SwFieldTypesEnum::PageNumber;
617  nInsertFormat = SVX_NUM_PAGEDESC; // Like page template
618  bIsText = false;
619  goto FIELD_INSERT;
620  case FN_INSERT_FLD_PGCOUNT :
622  nInsertSubType = 0;
623  bIsText = false;
624  nInsertFormat = SVX_NUM_PAGEDESC;
625  goto FIELD_INSERT;
626  case FN_INSERT_FLD_TOPIC :
627  nInsertType = SwFieldTypesEnum::DocumentInfo;
628  nInsertSubType = DI_SUBJECT;
629  goto FIELD_INSERT;
630  case FN_INSERT_FLD_TITLE :
631  nInsertType = SwFieldTypesEnum::DocumentInfo;
632  nInsertSubType = DI_TITLE;
633  goto FIELD_INSERT;
634  case FN_INSERT_FLD_AUTHOR :
635  nInsertType = SwFieldTypesEnum::DocumentInfo;
636  nInsertSubType = DI_CREATE|DI_SUB_AUTHOR;
637 
638 FIELD_INSERT:
639  {
640  //format conversion should only be done for number formatter formats
641  if(!nInsertFormat)
642  nInsertFormat = aFieldMgr.GetDefaultFormat(nInsertType, bIsText, rSh.GetNumberFormatter());
643  SwInsertField_Data aData(nInsertType, nInsertSubType,
644  OUString(), OUString(), nInsertFormat);
645  aFieldMgr.InsertField(aData);
646  rReq.Done();
647  }
648  break;
649 
651  {
653 
654  SwPaM* pCursorPos = rSh.GetCursor();
655  if(pCursorPos)
656  {
657  // Insert five En Space into the text field so the field has extent
658  static const sal_Unicode vEnSpaces[ODF_FORMFIELD_DEFAULT_LENGTH] = {8194, 8194, 8194, 8194, 8194};
659  bool bSuccess = rSh.GetDoc()->getIDocumentContentOperations().InsertString(*pCursorPos, OUString(vEnSpaces, ODF_FORMFIELD_DEFAULT_LENGTH));
660  if(bSuccess)
661  {
662  IDocumentMarkAccess* pMarksAccess = rSh.GetDoc()->getIDocumentMarkAccess();
663  SwPaM aFieldPam(pCursorPos->GetPoint()->nNode, pCursorPos->GetPoint()->nContent.GetIndex() - ODF_FORMFIELD_DEFAULT_LENGTH,
664  pCursorPos->GetPoint()->nNode, pCursorPos->GetPoint()->nContent.GetIndex());
665  pMarksAccess->makeFieldBookmark(aFieldPam, OUString(), ODF_FORMTEXT,
666  aFieldPam.Start());
667  }
668  }
669 
671  rSh.GetView().GetViewFrame()->GetBindings().Invalidate( SID_UNDO );
672  }
673  break;
675  {
677 
678  SwPaM* pCursorPos = rSh.GetCursor();
679  if(pCursorPos)
680  {
681  IDocumentMarkAccess* pMarksAccess = rSh.GetDoc()->getIDocumentMarkAccess();
682  pMarksAccess->makeNoTextFieldBookmark(*pCursorPos, OUString(), ODF_FORMCHECKBOX);
683  }
684 
686  rSh.GetView().GetViewFrame()->GetBindings().Invalidate( SID_UNDO );
687  }
688  break;
690  {
692 
693  SwPaM* pCursorPos = rSh.GetCursor();
694  if(pCursorPos)
695  {
696  IDocumentMarkAccess* pMarksAccess = rSh.GetDoc()->getIDocumentMarkAccess();
697  pMarksAccess->makeNoTextFieldBookmark(*pCursorPos, OUString(), ODF_FORMDROPDOWN);
698  }
699 
701  rSh.GetView().GetViewFrame()->GetBindings().Invalidate( SID_UNDO );
702  }
703  break;
705  {
707 
708  SwPaM* pCursorPos = rSh.GetCursor();
709  if(pCursorPos)
710  {
711  // Insert five enspaces into the text field so the field has extent
712  sal_Unicode vEnSpaces[ODF_FORMFIELD_DEFAULT_LENGTH] = {8194, 8194, 8194, 8194, 8194};
713  bool bSuccess = rSh.GetDoc()->getIDocumentContentOperations().InsertString(*pCursorPos, OUString(vEnSpaces, ODF_FORMFIELD_DEFAULT_LENGTH));
714  if(bSuccess)
715  {
716  IDocumentMarkAccess* pMarksAccess = rSh.GetDoc()->getIDocumentMarkAccess();
717  SwPaM aFieldPam(pCursorPos->GetPoint()->nNode, pCursorPos->GetPoint()->nContent.GetIndex() - ODF_FORMFIELD_DEFAULT_LENGTH,
718  pCursorPos->GetPoint()->nNode, pCursorPos->GetPoint()->nContent.GetIndex());
719  sw::mark::IFieldmark* pFieldBM = pMarksAccess->makeFieldBookmark(aFieldPam, OUString(), ODF_FORMDATE,
720  aFieldPam.Start());
721 
722  // Use a default date format and language
723  sw::mark::IFieldmark::parameter_map_t* pParameters = pFieldBM->GetParameters();
724  SvNumberFormatter* pFormatter = rSh.GetDoc()->GetNumberFormatter();
725  sal_uInt32 nStandardFormat = pFormatter->GetStandardFormat(SvNumFormatType::DATE);
726  const SvNumberformat* pFormat = pFormatter->GetEntry(nStandardFormat);
727 
728  (*pParameters)[ODF_FORMDATE_DATEFORMAT] <<= pFormat->GetFormatstring();
729  (*pParameters)[ODF_FORMDATE_DATEFORMAT_LANGUAGE] <<= LanguageTag(pFormat->GetLanguage()).getBcp47();
730  }
731  }
732 
734  rSh.GetView().GetViewFrame()->GetBindings().Invalidate( SID_UNDO );
735  }
736  break;
737  default:
738  OSL_FAIL("wrong dispatcher");
739  return;
740  }
741  }
742 }
743 
745 {
746  SwWrtShell& rSh = GetShell();
747  SfxWhichIter aIter( rSet );
748  const SwField* pField = nullptr;
749  bool bGetField = false;
750  sal_uInt16 nWhich = aIter.FirstWhich();
751 
752  while (nWhich)
753  {
754  switch (nWhich)
755  {
756  case FN_DELETE_COMMENT:
758  case FN_DELETE_ALL_NOTES:
759  case FN_FORMAT_ALL_NOTES:
760  case FN_HIDE_NOTE:
761  case FN_HIDE_NOTE_AUTHOR:
762  case FN_HIDE_ALL_NOTES:
763  {
764  SwPostItMgr* pPostItMgr = GetView().GetPostItMgr();
765  if ( !pPostItMgr )
766  rSet.InvalidateItem( nWhich );
767  else if ( !pPostItMgr->HasActiveSidebarWin() )
768  {
771  }
772  }
773  break;
774 
775  case FN_EDIT_FIELD:
776  {
777  if( !bGetField )
778  {
779  pField = rSh.GetCurField();
780  bGetField = true;
781  }
782 
783  SwFieldIds nTempWhich = pField ? pField->GetTyp()->Which() : SwFieldIds::Unknown;
784  if( SwFieldIds::Unknown == nTempWhich ||
785  SwFieldIds::Postit == nTempWhich ||
786  SwFieldIds::Script == nTempWhich ||
787  SwFieldIds::TableOfAuthorities == nTempWhich )
788  rSet.DisableItem( nWhich );
789  else if( SwFieldIds::Dde == nTempWhich &&
790  !static_cast<SwDDEFieldType*>(pField->GetTyp())->GetBaseLink().IsVisible())
791  {
792  // nested links cannot be edited
793  rSet.DisableItem( nWhich );
794  }
795  }
796  break;
797 
799  {
800  if(!bGetField)
801  {
802  pField = rSh.GetCurField();
803  bGetField = true;
804  }
805  if(!pField || pField->GetTyp()->Which() != SwFieldIds::Macro)
806  rSet.DisableItem(nWhich);
807  }
808  break;
809 
810  case FN_INSERT_FIELD:
811  {
812  if ( rSh.CursorInsideInputField() )
813  {
814  rSet.DisableItem(nWhich);
815  }
816  else
817  {
818  SfxViewFrame* pVFrame = GetView().GetViewFrame();
819  //#i5788# prevent closing of the field dialog while a modal dialog ( Input field dialog ) is active
820  if(!pVFrame->IsInModalMode() &&
822  rSet.Put(SfxBoolItem( FN_INSERT_FIELD, pVFrame->HasChildWindow(nWhich)));
823  else
825  }
826  }
827  break;
828 
829  case FN_INSERT_REF_FIELD:
830  {
831  SfxViewFrame* pVFrame = GetView().GetViewFrame();
832  if ( !pVFrame->KnowsChildWindow(FN_INSERT_FIELD)
833  || rSh.CursorInsideInputField() )
834  {
836  }
837  }
838  break;
839 
841  if ( rSh.CursorInsideInputField() )
842  {
843  rSet.DisableItem(nWhich);
844  }
845  else
846  {
847  rSet.Put(SfxBoolItem( nWhich, GetView().GetViewFrame()->HasChildWindow(FN_INSERT_FIELD)));
848  }
849  break;
850 
851  case FN_REDLINE_COMMENT:
853  rSet.DisableItem(nWhich);
854  break;
855 
856  case FN_REPLY:
858  rSet.DisableItem(nWhich);
859  break;
860 
861  case FN_POSTIT :
862  case FN_JAVAEDIT :
863  {
864  bool bCurField = false;
865  pField = rSh.GetCurField();
866  if(nWhich == FN_POSTIT)
867  bCurField = pField && pField->GetTyp()->Which() == SwFieldIds::Postit;
868  else
869  bCurField = pField && pField->GetTyp()->Which() == SwFieldIds::Script;
870 
871  if( !bCurField && rSh.IsReadOnlyAvailable() && rSh.HasReadonlySel() )
872  {
873  rSet.DisableItem(nWhich);
874  }
875  else if ( rSh.CursorInsideInputField() )
876  {
877  rSet.DisableItem(nWhich);
878  }
879  // tdf#86188 Allow disabling comment insertion on footnote/endnote for better OOXML interoperability
881  {
882  rSet.DisableItem(nWhich);
883  }
884  }
885 
886  break;
887 
889  case FN_INSERT_FLD_DATE:
892  case FN_INSERT_FLD_TIME:
893  case FN_INSERT_FLD_TITLE:
894  case FN_INSERT_FLD_TOPIC:
895  case FN_INSERT_DBFIELD:
896  if ( rSh.CursorInsideInputField() )
897  {
898  rSet.DisableItem(nWhich);
899  }
900  break;
901 
906  if ( rSh.CursorInsideInputField() )
907  {
908  rSet.DisableItem(nWhich);
909  }
910  else
911  {
912  // Check whether we are in a text form field
913  SwPosition aCursorPos(*rSh.GetCursor()->GetPoint());
914  sw::mark::IFieldmark* pFieldBM = GetShell().getIDocumentMarkAccess()->getFieldmarkFor(aCursorPos);
915  if ((!pFieldBM || pFieldBM->GetFieldname() != ODF_FORMTEXT)
916  && aCursorPos.nContent.GetIndex() > 0)
917  {
918  SwPosition aPos(aCursorPos);
919  --aPos.nContent;
920  pFieldBM = GetShell().getIDocumentMarkAccess()->getFieldmarkFor(aPos);
921  }
922  if (pFieldBM && pFieldBM->GetFieldname() == ODF_FORMTEXT &&
923  (aCursorPos > pFieldBM->GetMarkStart() && aCursorPos < pFieldBM->GetMarkEnd() ))
924  {
925  rSet.DisableItem(nWhich);
926  }
927  }
928  break;
929 
930  }
931  nWhich = aIter.NextWhich();
932  }
933 }
934 
936 {
937  const OUString& rName = rHlnkItem.GetName();
938  const OUString& rURL = rHlnkItem.GetURL();
939  const OUString& rTarget = rHlnkItem.GetTargetFrame();
940  sal_uInt16 nType = static_cast<sal_uInt16>(rHlnkItem.GetInsertMode());
941  nType &= ~HLINK_HTMLMODE;
942  const SvxMacroTableDtor* pMacroTable = rHlnkItem.GetMacroTable();
943 
944  SwWrtShell& rSh = GetShell();
945 
947  {
948  rSh.StartAction();
950  rSh.GetCurAttr( aSet );
951 
952  const SfxPoolItem* pItem;
953  if(SfxItemState::SET == aSet.GetItemState(RES_TXTATR_INETFMT, false, &pItem))
954  {
955  // Select links
956  rSh.SwCursorShell::SelectTextAttr(RES_TXTATR_INETFMT, false);
957  }
958  switch (nType)
959  {
960  case HLINK_DEFAULT:
961  case HLINK_FIELD:
962  {
963  SwFormatINetFormat aINetFormat( rURL, rTarget );
964  aINetFormat.SetName(rHlnkItem.GetIntName());
965  if(pMacroTable)
966  {
967  const SvxMacro *pMacro = pMacroTable->Get( SvMacroItemId::OnMouseOver );
968  if( pMacro )
969  aINetFormat.SetMacro(SvMacroItemId::OnMouseOver, *pMacro);
970  pMacro = pMacroTable->Get( SvMacroItemId::OnClick );
971  if( pMacro )
972  aINetFormat.SetMacro(SvMacroItemId::OnClick, *pMacro);
973  pMacro = pMacroTable->Get( SvMacroItemId::OnMouseOut );
974  if( pMacro )
975  aINetFormat.SetMacro(SvMacroItemId::OnMouseOut, *pMacro);
976  }
977  rSh.SttSelect();
978  rSh.InsertURL( aINetFormat, rName, true );
979  rSh.EndSelect();
980  }
981  break;
982 
983  case HLINK_BUTTON:
984  bool bSel = rSh.HasSelection();
985  if(bSel)
986  rSh.DelRight();
987  InsertURLButton( rURL, rTarget, rName );
988  rSh.EnterStdMode();
989  break;
990  }
991  rSh.EndAction();
992  }
993 }
994 
995 IMPL_LINK( SwTextShell, RedlineNextHdl, AbstractSvxPostItDialog&, rDlg, void )
996 {
997  SwWrtShell* pSh = GetShellPtr();
998 
999  // Insert or change a comment.
1000  pSh->SetRedlineComment(rDlg.GetNote());
1001 
1002  const SwRangeRedline *pRedline = pSh->GetCurrRedline();
1003 
1004  if (!pRedline)
1005  return;
1006 
1007  // Traveling only if more than one field.
1008  if( !pSh->IsCursorPtAtEnd() )
1009  pSh->SwapPam(); // Move the cursor behind the Redline.
1010 
1011  pSh->Push();
1012  const SwRangeRedline *pActRed = pSh->SelNextRedline();
1014 
1015  bool bEnable = false;
1016 
1017  if (pActRed)
1018  {
1019  pSh->StartAction();
1020  pSh->Push();
1021  bEnable = pSh->SelNextRedline() != nullptr;
1022  pSh->Pop(SwCursorShell::PopMode::DeleteCurrent);
1023  pSh->EndAction();
1024  }
1025 
1026  rDlg.EnableTravel(bEnable, true);
1027 
1028  if( pSh->IsCursorPtAtEnd() )
1029  pSh->SwapPam();
1030 
1031  pRedline = pSh->GetCurrRedline();
1032  OUString sComment = convertLineEnd(pRedline->GetComment(), GetSystemLineEnd());
1033 
1034  rDlg.SetNote(sComment);
1035  rDlg.ShowLastAuthor( pRedline->GetAuthorString(),
1037  pRedline->GetRedlineData().GetTimeStamp() ));
1038 
1039  rDlg.SetText(lcl_BuildTitleWithRedline(pRedline));
1040 
1041 }
1042 
1043 IMPL_LINK( SwTextShell, RedlinePrevHdl, AbstractSvxPostItDialog&, rDlg, void )
1044 {
1045  SwWrtShell* pSh = GetShellPtr();
1046 
1047  // Insert or change a comment.
1048  pSh->SetRedlineComment(rDlg.GetNote());
1049 
1050  const SwRangeRedline *pRedline = pSh->GetCurrRedline();
1051 
1052  if (!pRedline)
1053  return;
1054 
1055  // Traveling only if more than one field.
1056  pSh->Push();
1057  const SwRangeRedline *pActRed = pSh->SelPrevRedline();
1059 
1060  bool bEnable = false;
1061 
1062  if (pActRed)
1063  {
1064  pSh->StartAction();
1065  pSh->Push();
1066  bEnable = pSh->SelPrevRedline() != nullptr;
1067  pSh->Pop(SwCursorShell::PopMode::DeleteCurrent);
1068  pSh->EndAction();
1069  }
1070 
1071  rDlg.EnableTravel(true, bEnable);
1072 
1073  pRedline = pSh->GetCurrRedline();
1074  OUString sComment = convertLineEnd(pRedline->GetComment(), GetSystemLineEnd());
1075 
1076  rDlg.SetNote(sComment);
1077  rDlg.ShowLastAuthor(pRedline->GetAuthorString(),
1079  pRedline->GetRedlineData().GetTimeStamp() ));
1080 
1081  rDlg.SetText(lcl_BuildTitleWithRedline(pRedline));
1082 
1083 }
1084 
1085 /* 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:744
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:255
std::map< OUString, css::uno::Any > parameter_map_t
Definition: IMark.hxx:94
TOOLS_DLLPUBLIC OString convertLineEnd(const OString &rIn, LineEnd eLineEnd)
Marks a position in the document model.
Definition: pam.hxx:35
SfxChildWindow * GetChildWindow(sal_uInt16)
SwPaM * GetCursor(bool bMakeTableCursor=true) const
Return pointer to the current shell cursor.
Definition: crsrsh.cxx:188
OUString const & GetAuthorString(sal_uInt16 nPos=0) const
Definition: docredln.cxx:1723
const char aData[]
Definition: ww8scan.hxx:47
sfx2::LinkManager & GetLinkManager()
Definition: editsh.cxx:592
sal_uInt32 GetFormat() const
Query parameters for dialog and for BASIC.
Definition: fldbas.hxx:401
std::string GetValue
SvNumberFormatter * GetNumberFormatter(bool bCreate=true)
Definition: doc.hxx:1409
const SwRangeRedline * SelNextRedline()
Definition: crstrvl.cxx:2225
#define FN_REDLINE_COMMENT
Definition: cmdid.h:123
bool IsCursorInFootnote() const
Definition: crsrsh.cxx:1148
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:257
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:726
IMPL_LINK(SwTextShell, RedlineNextHdl, AbstractSvxPostItDialog &, rDlg, void)
Definition: textfld.cxx:995
const OUString & GetTargetFrame() const
static SvxAbstractDialogFactory * Create()
Base class of all fields.
Definition: fldbas.hxx:293
FilterGroup & rTarget
bool Pop(SwCursorShell::PopMode=SwCursorShell::PopMode::DeleteStack)
Definition: wrtsh1.cxx: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:186
#define FN_INSERT_FLD_PGNUMBER
Definition: cmdid.h:254
#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
#define FN_PARAM_FIELD_FORMAT
Definition: cmdid.h:777
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:1683
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:794
void InsertHyperlink(const SvxHyperlinkItem &rHlnkItem)
Definition: textfld.cxx:935
#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:292
size_type size() const
Definition: docary.hxx:266
void SwapPam()
Definition: crsrsh.cxx:973
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:436
const SwView & GetView() const
Definition: wrtsh.hxx:428
#define FN_PARAM_FIELD_SUBTYPE
Definition: cmdid.h:776
#define FN_FORMAT_ALL_NOTES
Definition: cmdid.h:748
SwIndex nContent
Definition: pam.hxx:38
SwField * GetCurField(const bool bIncludeInputFieldAtStart=false) const
Definition: crstrvl.cxx:939
LineEnd GetSystemLineEnd()
const SwDocInfoSubType DI_SUBJECT
Definition: docufld.hxx:67
const SvxMacroTableDtor * GetMacroTable() const
HLINK_HTMLMODE
sal_uInt32 GetDefaultFormat(SwFieldTypesEnum nTypeId, bool bIsText, SvNumberFormatter *pFormatter)
Definition: fldmgr.cxx:1811
#define FN_DELETE_COMMENT
Definition: cmdid.h:746
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:1036
void ExecMacro(const SvxMacro &rMacro, OUString *pRet=nullptr, SbxArray *pArgs=nullptr)
Definition: wrtsh3.cxx:180
constexpr TypedWhichId< SwFormatINetFormat > RES_TXTATR_INETFMT(51)
const SwRedlineData & GetRedlineData(sal_uInt16 nPos=0) const
Definition: docredln.cxx:1751
#define FN_INSERT_FIELD_DATA_ONLY
Definition: cmdid.h:207
#define FN_RESOLVE_NOTE
Definition: cmdid.h:749
#define FN_INSERT_FLD_DATE
Definition: cmdid.h:252
weld::Window * GetFrameWeld(const SfxFrame *pFrame)
Definition: dialoghelp.cxx:20
bool SelectText(const sal_Int32 nStart, const sal_Int32 nEnd)
Definition: crstrvl.cxx:1973
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:747
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:283
void EndAction(const bool bIdleEnd=false, const bool DoSetPosX=false)
Definition: crsrsh.cxx:238
void ShowReferencePage()
Definition: fldwrap.cxx:89
#define FN_DELETE_NOTE_AUTHOR
Definition: cmdid.h:740
void Push()
store a copy of the current cursor on the cursor stack
Definition: crsrsh.cxx:2235
const SwRangeRedline * SelPrevRedline()
Definition: crstrvl.cxx:2245
#define FN_GOTO_NEXT_INPUTFLD
Definition: cmdid.h:100
#define FN_INSERT_TEXT_FORMFIELD
Definition: cmdid.h:282
bool InsertURL(const SwFormatINetFormat &rFormat, const OUString &rStr, bool bKeepSelection=false)
Definition: editsh.cxx:633
SfxBindings & GetBindings()
const SwDocInfoSubType DI_CREATE
Definition: docufld.hxx:70
SwFieldTypesEnum
List of FieldTypes at UI.
Definition: fldbas.hxx:93
vector_type::size_type size_type
Definition: docary.hxx:228
const OUString & GetValue() const
SwFieldIds
Definition: fldbas.hxx:44
const T * GetArg(sal_uInt16 nSlotId) const
#define FN_HIDE_NOTE_AUTHOR
Definition: cmdid.h:743
SwDoc * GetDoc() const
Definition: pam.hxx:243
SwField * GetCurField()
Definition: fldmgr.cxx:424
#define FN_INSERT_FLD_TIME
Definition: cmdid.h:253
const DateTime & GetTimeStamp() const
Definition: redline.hxx:129
virtual OUString GetPar2() const override
Text.
Definition: scrptfld.cxx:76
HLINK_FIELD
void UpdateText(const OUString &aText)
bool StartInputFieldDlg(SwField *, bool bPrevButton, bool bNextButton, weld::Widget *pParentWin, FieldDialogPressedButton *pPressedButton=nullptr)
Definition: wrtsh2.cxx:260
static SwAbstractDialogFactory * Create()
Definition: swabstdlg.cxx:36
#define FN_JAVAEDIT
Definition: cmdid.h:269
#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:199
void SttSelect()
Definition: select.cxx:384
bool HasReadonlySel() const
Definition: crsrsh.cxx:3328
#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:994
const SwPosition * Start() const
Definition: pam.hxx:212
SwFieldType * GetTyp() const
Definition: fldbas.hxx:396
SW_DLLPUBLIC bool HasActiveSidebarWin() const
Definition: PostItMgr.cxx:2305
void StartAction()
Definition: crsrsh.cxx:221
const SwDocInfoSubType DI_SUB_AUTHOR
Definition: docufld.hxx:78
virtual DialogGetRanges GetDialogGetRangesFunc()=0
const OUString & GetComment(sal_uInt16 nPos=0) const
Definition: docredln.cxx:1738
void ExecuteFormatAllDialog(SwView &rView)
Definition: PostItMgr.cxx:1606
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:202
SwFieldTypesEnum GetTypeId() const
Definition: fldbas.cxx:238
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
SwFormatField * FindFormatForPostItId(sal_uInt32 nPostItId) const
Definition: fldbas.cxx:165
#define FN_INSERT_FIELD
Definition: cmdid.h:195
const SvxMacro * Get(SvMacroItemId nEvent) const
void DisableItem(sal_uInt16 nWhich)
#define FN_INSERT_DROPDOWN_FORMFIELD
Definition: cmdid.h:284
static void SetCareDialog(const std::shared_ptr< weld::Window > &rNew)
Definition: viewsh.cxx:2492
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:986
bool IsCursorPtAtEnd() const
Definition: crsrsh.hxx:898
#define FN_PARAM_FIELD_TYPE
Definition: cmdid.h:775
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:1733
QPRO_FUNC_TYPE nType
void ClearMark()
Definition: crsrsh.cxx:936
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:744
#define FN_INSERT_FLD_AUTHOR
Definition: cmdid.h:258
#define FN_INSERT_DATE_FORMFIELD
Definition: cmdid.h:287
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:906
#define FN_INSERT_FIELD_CTRL
Definition: cmdid.h:250
#define FN_HIDE_NOTE
Definition: cmdid.h:742
STARBASIC
SwFieldIds Which() const
Definition: fldbas.hxx:272
SvNumberFormatter * GetNumberFormatter()
Query NumberFormatter from document.
Definition: editsh.cxx:744
void SetName(const OUString &rNm)
Definition: fmtinfmt.hxx:84
#define FN_POSTIT
Definition: cmdid.h:210
LanguageType GetLanguage() const
sal_uInt16 nPos
#define FN_INSERT_FLD_TOPIC
Definition: cmdid.h:256
#define ODF_FORMDROPDOWN
#define FN_DELETE_ALL_NOTES
Definition: cmdid.h:741
const OUString & GetIntName() const
bool CursorInsideInputField() const
Definition: crstrvl.cxx:960