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