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