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