LibreOffice Module sw (master)  1
textsh1.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 <com/sun/star/i18n/WordType.hpp>
21 #include <com/sun/star/linguistic2/XThesaurus.hpp>
22 
23 #include <hintids.hxx>
24 #include <cmdid.h>
25 #include <helpids.h>
26 #include <comphelper/lok.hxx>
27 
28 #include <i18nutil/unicode.hxx>
30 #include <svl/languageoptions.hxx>
31 #include <editeng/langitem.hxx>
32 #include <svtools/langtab.hxx>
33 #include <svl/slstitm.hxx>
34 #include <svl/grabbagitem.hxx>
35 #include <string.h>
36 #include <svl/stritem.hxx>
37 #include <sfx2/htmlmode.hxx>
38 #include <svl/whiter.hxx>
39 #include <sfx2/bindings.hxx>
40 #include <sfx2/dispatch.hxx>
41 #include <sfx2/objitem.hxx>
42 #include <sfx2/viewfrm.hxx>
43 #include <vcl/unohelp2.hxx>
44 #include <vcl/weld.hxx>
45 #include <sfx2/request.hxx>
46 #include <svl/eitem.hxx>
47 #include <svl/macitem.hxx>
48 #include <editeng/lrspitem.hxx>
49 #include <editeng/colritem.hxx>
50 #include <editeng/tstpitem.hxx>
51 #include <editeng/brushitem.hxx>
52 #include <editeng/svxacorr.hxx>
53 #include <svl/cjkoptions.hxx>
54 #include <svl/ctloptions.hxx>
57 #include <charfmt.hxx>
58 #include <editeng/fontitem.hxx>
59 #include <svx/SmartTagItem.hxx>
60 #include <fmtinfmt.hxx>
61 #include <swwait.hxx>
62 #include <wrtsh.hxx>
63 #include <wview.hxx>
64 #include <swmodule.hxx>
65 #include <viewopt.hxx>
66 #include <uitool.hxx>
67 #include <swevent.hxx>
68 #include <pagedesc.hxx>
69 #include <textsh.hxx>
70 #include <IMark.hxx>
71 #include <swdtflvr.hxx>
72 #include <docstat.hxx>
73 #include <outline.hxx>
74 #include <tablemgr.hxx>
75 #include <swundo.hxx>
76 #include <reffld.hxx>
77 #include <docsh.hxx>
78 #include <mdiexp.hxx>
79 #include <inputwin.hxx>
80 #include <chrdlgmodes.hxx>
81 #include <pardlg.hxx>
82 #include <frmatr.hxx>
83 #include <fmtcol.hxx>
84 #include <cellatr.hxx>
85 #include <edtwin.hxx>
86 #include <redlndlg.hxx>
87 #include <fldmgr.hxx>
88 #include <globals.hrc>
89 #include <strings.hrc>
90 #include <app.hrc>
91 #include <paratr.hxx>
92 #include <vcl/svapp.hxx>
93 #include <sfx2/app.hxx>
94 #include <breakit.hxx>
95 #include <SwSmartTagMgr.hxx>
96 #include <editeng/acorrcfg.hxx>
97 #include <swabstdlg.hxx>
98 #include <IDocumentStatistics.hxx>
99 #include <sfx2/sfxdlg.hxx>
100 #include <unotools/lingucfg.hxx>
101 #include <com/sun/star/container/XNameContainer.hpp>
102 #include <com/sun/star/beans/XPropertySet.hpp>
103 #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
104 #include <com/sun/star/util/XChangesBatch.hpp>
105 #include <com/sun/star/uno/Any.hxx>
106 #include <editeng/unolingu.hxx>
108 #include <doc.hxx>
109 #include <drawdoc.hxx>
110 #include <view.hxx>
111 #include <ndtxt.hxx>
112 #include <pam.hxx>
113 #include <sfx2/objface.hxx>
114 #include <langhelper.hxx>
115 #include <uiitems.hxx>
116 #include <tools/diagnose_ex.h>
117 #include <svx/nbdtmgfact.hxx>
118 #include <svx/nbdtmg.hxx>
119 #include <SwRewriter.hxx>
120 #include <svx/svdmodel.hxx>
121 #include <svx/drawitem.hxx>
122 #include <svx/svxids.hrc>
123 #include <numrule.hxx>
124 #include <memory>
125 #include <xmloff/odffields.hxx>
126 #include <bookmrk.hxx>
127 
128 using namespace ::com::sun::star;
129 using namespace com::sun::star::beans;
130 using namespace ::com::sun::star::container;
131 using namespace com::sun::star::style;
132 using namespace svx::sidebar;
133 
134 static void sw_CharDialogResult(const SfxItemSet* pSet, SwWrtShell &rWrtSh, std::shared_ptr<SfxItemSet> const & pCoreSet, bool bSel, bool bSelectionPut, SfxRequest *pReq);
135 
136 void sw_CharDialog(SwWrtShell &rWrtSh, bool bUseDialog, sal_uInt16 nSlot, const SfxItemSet *pArgs, SfxRequest *pReq )
137 {
138  FieldUnit eMetric = ::GetDfltMetric(dynamic_cast<SwWebView*>( &rWrtSh.GetView()) != nullptr );
139  SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric)));
140  std::shared_ptr<SfxItemSet> pCoreSet(new SfxItemSet(
141  rWrtSh.GetView().GetPool(),
142  svl::Items<
147  SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER,
148  SID_HTML_MODE, SID_HTML_MODE,
149  SID_ATTR_CHAR_WIDTH_FIT_TO_LINE, SID_ATTR_CHAR_WIDTH_FIT_TO_LINE,
150  FN_PARAM_SELECTION, FN_PARAM_SELECTION>{}));
151  rWrtSh.GetCurAttr(*pCoreSet);
152 
153  bool bSel = rWrtSh.HasSelection();
154  bool bSelectionPut = false;
155  if(bSel || rWrtSh.IsInWord())
156  {
157  if(!bSel)
158  {
159  rWrtSh.StartAction();
160  rWrtSh.Push();
161  if(!rWrtSh.SelectTextAttr( RES_TXTATR_INETFMT ))
162  rWrtSh.SelWrd();
163  }
164  pCoreSet->Put(SfxStringItem(FN_PARAM_SELECTION, rWrtSh.GetSelText()));
165  bSelectionPut = true;
166  if(!bSel)
167  {
169  rWrtSh.EndAction();
170  }
171  }
172  pCoreSet->Put(SfxUInt16Item(SID_ATTR_CHAR_WIDTH_FIT_TO_LINE, rWrtSh.GetScalingOfSelectedText()));
173 
174  ::ConvertAttrCharToGen(*pCoreSet);
175 
176  // Setting the BoxInfo
177  ::PrepareBoxInfo(*pCoreSet, rWrtSh);
178 
179  pCoreSet->Put(SfxUInt16Item(SID_HTML_MODE, ::GetHtmlMode(rWrtSh.GetView().GetDocShell())));
181  if ( bUseDialog && GetActiveView() )
182  {
184  pDlg.reset(pFact->CreateSwCharDlg(rWrtSh.GetView().GetFrameWeld(), rWrtSh.GetView(), *pCoreSet, SwCharDlgMode::Std));
185 
186  if (nSlot == FN_INSERT_HYPERLINK)
187  pDlg->SetCurPageId("hyperlink");
188  else if (nSlot == SID_CHAR_DLG_EFFECT)
189  pDlg->SetCurPageId("fonteffects");
190  else if (nSlot == SID_ATTR_CHAR_FONT || nSlot == SID_CHAR_DLG_FOR_PARAGRAPH)
191  pDlg->SetCurPageId("font");
192  else if (pReq)
193  {
194  const SfxStringItem* pItem = (*pReq).GetArg<SfxStringItem>(FN_PARAM_1);
195  if (pItem)
196  pDlg->SetCurPageId(OUStringToOString(pItem->GetValue(), RTL_TEXTENCODING_UTF8));
197  }
198  }
199 
200  if (bUseDialog)
201  {
202  std::shared_ptr<SfxRequest> pRequest;
203  if (pReq)
204  {
205  pRequest.reset(new SfxRequest(*pReq));
206  pReq->Ignore(); // the 'old' request is not relevant any more
207  }
208  pDlg->StartExecuteAsync([pDlg, &rWrtSh, pCoreSet, bSel, bSelectionPut, pRequest](sal_Int32 nResult){
209  if (nResult == RET_OK)
210  {
211  sw_CharDialogResult(pDlg->GetOutputItemSet(), rWrtSh, pCoreSet, bSel, bSelectionPut, pRequest.get());
212  }
213  pDlg->disposeOnce();
214  });
215  }
216  else if (pArgs)
217  {
218  sw_CharDialogResult(pArgs, rWrtSh, pCoreSet, bSel, bSelectionPut, pReq);
219  }
220 }
221 
222 static void sw_CharDialogResult(const SfxItemSet* pSet, SwWrtShell &rWrtSh, std::shared_ptr<SfxItemSet> const & pCoreSet, bool bSel, bool bSelectionPut, SfxRequest *pReq)
223 {
224  SfxItemSet aTmpSet( *pSet );
225  ::ConvertAttrGenToChar(aTmpSet, *pCoreSet);
226 
227  const SfxPoolItem* pSelectionItem;
228  bool bInsert = false;
229  sal_Int32 nInsert = 0;
230 
231  // The old item is for unknown reasons back in the set again.
232  if( !bSelectionPut && SfxItemState::SET == aTmpSet.GetItemState(FN_PARAM_SELECTION, false, &pSelectionItem) )
233  {
234  OUString sInsert = static_cast<const SfxStringItem*>(pSelectionItem)->GetValue();
235  bInsert = !sInsert.isEmpty();
236  if(bInsert)
237  {
238  nInsert = sInsert.getLength();
239  rWrtSh.StartAction();
240  rWrtSh.Insert( sInsert );
241  rWrtSh.SetMark();
242  rWrtSh.ExtendSelection(false, sInsert.getLength());
243  SfxRequest aReq( rWrtSh.GetView().GetViewFrame(), FN_INSERT_STRING );
244  aReq.AppendItem( SfxStringItem( FN_INSERT_STRING, sInsert ) );
245  aReq.Done();
246  SfxRequest aReq1( rWrtSh.GetView().GetViewFrame(), FN_CHAR_LEFT );
247  aReq1.AppendItem( SfxInt32Item(FN_PARAM_MOVE_COUNT, nInsert) );
248  aReq1.AppendItem( SfxBoolItem(FN_PARAM_MOVE_SELECTION, true) );
249  aReq1.Done();
250  }
251  }
252  aTmpSet.ClearItem(FN_PARAM_SELECTION);
253 
254  SwTextFormatColl* pColl = rWrtSh.GetCurTextFormatColl();
255  if(bSel && rWrtSh.IsSelFullPara() && pColl && pColl->IsAutoUpdateFormat())
256  {
257  rWrtSh.AutoUpdatePara(pColl, aTmpSet);
258  }
259  else
260  rWrtSh.SetAttrSet( aTmpSet );
261  if (pReq)
262  pReq->Done(aTmpSet);
263  if(bInsert)
264  {
265  SfxRequest aReq1( rWrtSh.GetView().GetViewFrame(), FN_CHAR_RIGHT );
266  aReq1.AppendItem( SfxInt32Item(FN_PARAM_MOVE_COUNT, nInsert) );
267  aReq1.AppendItem( SfxBoolItem(FN_PARAM_MOVE_SELECTION, false) );
268  aReq1.Done();
269  rWrtSh.SwapPam();
270  rWrtSh.ClearMark();
271  rWrtSh.DontExpandFormat();
272  rWrtSh.EndAction();
273  }
274 
275 }
276 
278 {
279  std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(pWin, "modules/swriter/ui/queryredlinedialog.ui"));
280  std::unique_ptr<weld::MessageDialog> xQBox(xBuilder->weld_message_dialog("QueryRedlineDialog"));
281  return xQBox->run();
282 }
283 
284 static void sw_ParagraphDialogResult(SfxItemSet* pSet, SwWrtShell &rWrtSh, SfxRequest& rReq, SwPaM* pPaM)
285 {
286  if (!pSet)
287  return;
288 
289  rReq.Done( *pSet );
290  ::SfxToSwPageDescAttr( rWrtSh, *pSet );
291  // #i56253#
292  // enclose all undos.
293  // Thus, check conditions, if actions will be performed.
294  const bool bUndoNeeded( pSet->Count() ||
295  SfxItemState::SET == pSet->GetItemState(FN_NUMBER_NEWSTART) ||
296  SfxItemState::SET == pSet->GetItemState(FN_NUMBER_NEWSTART_AT) );
297  if ( bUndoNeeded )
298  {
299  rWrtSh.StartUndo( SwUndoId::INSATTR );
300  }
301  if( pSet->Count() )
302  {
303  rWrtSh.StartAction();
304  const SfxPoolItem* pItem = nullptr;
305  if ( SfxItemState::SET == pSet->GetItemState(FN_DROP_TEXT, false, &pItem) )
306  {
307  if ( !static_cast<const SfxStringItem*>(pItem)->GetValue().isEmpty() )
308  rWrtSh.ReplaceDropText(static_cast<const SfxStringItem*>(pItem)->GetValue(), pPaM);
309  }
310  rWrtSh.SetAttrSet(*pSet, SetAttrMode::DEFAULT, pPaM);
311  rWrtSh.EndAction();
312  SwTextFormatColl* pColl = rWrtSh.GetPaMTextFormatColl(pPaM);
313  if(pColl && pColl->IsAutoUpdateFormat())
314  {
315  rWrtSh.AutoUpdatePara(pColl, *pSet, pPaM);
316  }
317  }
318 
319  if( SfxItemState::SET == pSet->GetItemState(FN_NUMBER_NEWSTART) )
320  {
321  //SetNumRuleStart(true) restarts the numbering at the value
322  //that is defined at the starting point of the numbering level
323  //otherwise the SetNodeNumStart() value determines the start
324  //if it's set to something different than USHRT_MAX
325 
326  bool bStart = static_cast<const SfxBoolItem&>(pSet->Get(FN_NUMBER_NEWSTART)).GetValue();
327 
328  // Default value for restart value has to be USHRT_MAX
329  // in order to indicate that the restart value of the list
330  // style has to be used on restart.
331  sal_uInt16 nNumStart = USHRT_MAX;
332  if( SfxItemState::SET == pSet->GetItemState(FN_NUMBER_NEWSTART_AT) )
333  {
334  nNumStart = static_cast<const SfxUInt16Item&>(pSet->Get(FN_NUMBER_NEWSTART_AT)).GetValue();
335  }
336  rWrtSh.SetNumRuleStart(bStart, pPaM);
337  rWrtSh.SetNodeNumStart(nNumStart);
338  }
339  else if( SfxItemState::SET == pSet->GetItemState(FN_NUMBER_NEWSTART_AT) )
340  {
341  rWrtSh.SetNodeNumStart(static_cast<const SfxUInt16Item&>(pSet->Get(FN_NUMBER_NEWSTART_AT)).GetValue());
342  rWrtSh.SetNumRuleStart(false, pPaM);
343  }
344  // #i56253#
345  if ( bUndoNeeded )
346  {
347  rWrtSh.EndUndo( SwUndoId::INSATTR );
348  }
349 }
350 
352 {
353  bool bUseDialog = true;
354  const SfxItemSet *pArgs = rReq.GetArgs();
355  SwWrtShell& rWrtSh = GetShell();
356  const SfxPoolItem* pItem = nullptr;
357  const sal_uInt16 nSlot = rReq.GetSlot();
358  if(pArgs)
359  pArgs->GetItemState(GetPool().GetWhich(nSlot), false, &pItem);
360  switch( nSlot )
361  {
362  case SID_UNICODE_NOTATION_TOGGLE:
363  {
364  long nMaxUnits = 256;
365  sal_Int32 nSelLength = rWrtSh.GetSelText().getLength();
366  if( rWrtSh.IsSelection() && !rWrtSh.IsMultiSelection() && (nSelLength < nMaxUnits) )
367  nMaxUnits = nSelLength;
368 
369  long index = 0;
370  ToggleUnicodeCodepoint aToggle;
371  while( nMaxUnits-- && aToggle.AllowMoreInput(rWrtSh.GetChar(true, index-1)) )
372  --index;
373 
374  OUString sReplacement = aToggle.ReplacementString();
375  if( !sReplacement.isEmpty() )
376  {
377  if (rWrtSh.HasReadonlySel() && !rWrtSh.CursorInsideInputField())
378  {
379  // Only break if there's something to do; don't nag with the dialog otherwise
380  auto xInfo(std::make_unique<weld::GenericDialogController>(
381  rWrtSh.GetView().GetFrameWeld(), "modules/swriter/ui/inforeadonlydialog.ui",
382  "InfoReadonlyDialog"));
383  xInfo->run();
384  break;
385  }
386  SwRewriter aRewriter;
387  aRewriter.AddRule( UndoArg1, aToggle.StringToReplace() );
388  aRewriter.AddRule( UndoArg2, SwResId(STR_YIELDS) );
389  aRewriter.AddRule( UndoArg3, sReplacement );
390  rWrtSh.StartUndo(SwUndoId::REPLACE, &aRewriter);
391  rWrtSh.GetCursor()->Normalize(false);
392  rWrtSh.ClearMark();
393  for( sal_uInt32 i=aToggle.CharsToDelete(); i > 0; --i )
394  rWrtSh.DelLeft();
395  rWrtSh.Insert2( sReplacement );
396  rWrtSh.EndUndo(SwUndoId::REPLACE, &aRewriter);
397  }
398  }
399  break;
400 
401  case SID_LANGUAGE_STATUS:
402  {
403  // get the language
404  OUString aNewLangText;
405  const SfxStringItem* pItem2 = rReq.GetArg<SfxStringItem>(SID_LANGUAGE_STATUS);
406  if (pItem2)
407  aNewLangText = pItem2->GetValue();
408 
412  SfxViewFrame *pViewFrame = GetView().GetViewFrame();
413 
414  if (aNewLangText == "*")
415  {
416  // open the dialog "Tools/Options/Language Settings - Language"
417  // to set the documents default language
419  ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateVclDialog(GetView().GetFrameWeld(), SID_LANGUAGE_OPTIONS));
420  pDlg->Execute();
421  }
422  else
423  {
427  rWrtSh.StartAction();
428  // prevent view from jumping because of (temporary) selection changes
429  rWrtSh.LockView( true );
430 
431  // setting the new language...
432  if (!aNewLangText.isEmpty())
433  {
434  const OUString aSelectionLangPrefix("Current_");
435  const OUString aParagraphLangPrefix("Paragraph_");
436  const OUString aDocumentLangPrefix("Default_");
437  const OUString aStrNone("LANGUAGE_NONE");
438  const OUString aStrResetLangs("RESET_LANGUAGES");
439 
440  SfxItemSet aCoreSet( GetPool(),
444 
445  sal_Int32 nPos = 0;
446  bool bForSelection = true;
447  bool bForParagraph = false;
448  if (-1 != (nPos = aNewLangText.indexOf( aSelectionLangPrefix )))
449  {
450  // ... for the current selection
451  aNewLangText = aNewLangText.replaceAt(nPos, aSelectionLangPrefix.getLength(), "");
452  bForSelection = true;
453  }
454  else if (-1 != (nPos = aNewLangText.indexOf(aParagraphLangPrefix)))
455  {
456  // ... for the current paragraph language
457  aNewLangText = aNewLangText.replaceAt(nPos, aParagraphLangPrefix.getLength(), "");
458  bForSelection = true;
459  bForParagraph = true;
460  }
461  else if (-1 != (nPos = aNewLangText.indexOf(aDocumentLangPrefix)))
462  {
463  // ... as default document language
464  aNewLangText = aNewLangText.replaceAt(nPos, aDocumentLangPrefix.getLength(), "");
465  bForSelection = false;
466  }
467 
468  if (bForParagraph || !bForSelection)
469  {
470  rWrtSh.Push(); // save selection for later restoration
471  rWrtSh.ClearMark(); // fdo#67796: invalidate table crsr
472  }
473 
474  if (bForParagraph)
476 
477  if (!bForSelection) // document language to be changed...
478  {
479  rWrtSh.SelAll();
480  rWrtSh.ExtendedSelectAll();
481  }
482 
483  rWrtSh.StartUndo( ( !bForParagraph && !bForSelection ) ? SwUndoId::SETDEFTATTR : SwUndoId::EMPTY );
484  if (aNewLangText == aStrNone)
485  SwLangHelper::SetLanguage_None( rWrtSh, bForSelection, aCoreSet );
486  else if (aNewLangText == aStrResetLangs)
488  else
489  SwLangHelper::SetLanguage( rWrtSh, aNewLangText, bForSelection, aCoreSet );
490  rWrtSh.EndUndo();
491 
492  if (bForParagraph || !bForSelection)
493  {
494  rWrtSh.Pop(SwCursorShell::PopMode::DeleteCurrent); // restore selection...
495  }
496  }
497 
498  rWrtSh.LockView( false );
499  rWrtSh.EndAction();
500  }
501 
502  // invalidate slot to get the new language displayed
503  pViewFrame->GetBindings().Invalidate( nSlot );
504 
505  rReq.Done();
506  break;
507  }
508 
509  case SID_THES:
510  {
511  // replace word/selection with text from selected sub menu entry
512  OUString aReplaceText;
513  const SfxStringItem* pItem2 = rReq.GetArg<SfxStringItem>(SID_THES);
514  if (pItem2)
515  aReplaceText = pItem2->GetValue();
516  if (!aReplaceText.isEmpty())
517  {
518  SwView &rView2 = rWrtSh.GetView();
519  const bool bSelection = rWrtSh.HasSelection();
520  const OUString aLookUpText = rView2.GetThesaurusLookUpText( bSelection );
521  rView2.InsertThesaurusSynonym( aReplaceText, aLookUpText, bSelection );
522  }
523  }
524  break;
525 
526  case SID_CHARMAP:
527  {
528  InsertSymbol( rReq );
529  }
530  break;
531  case FN_INSERT_FOOTNOTE:
532  case FN_INSERT_ENDNOTE:
533  {
534  OUString aStr;
535  const SfxStringItem* pFont = rReq.GetArg<SfxStringItem>(FN_PARAM_1);
536  const SfxStringItem* pNameItem = rReq.GetArg<SfxStringItem>(nSlot);
537  if ( pNameItem )
538  aStr = pNameItem->GetValue();
539  bool bFont = pFont && !pFont->GetValue().isEmpty();
541  rWrtSh.InsertFootnote( aStr, nSlot == FN_INSERT_ENDNOTE, !bFont );
542  if ( bFont )
543  {
544  rWrtSh.Left( CRSR_SKIP_CHARS, true, 1, false );
546  rWrtSh.GetCurAttr( aSet );
547  rWrtSh.SetAttrSet( aSet, SetAttrMode::DONTEXPAND );
548  rWrtSh.ResetSelect(nullptr, false);
549  rWrtSh.EndSelect();
550  rWrtSh.GotoFootnoteText();
551  }
553  rReq.Done();
554  }
555  break;
557  {
560  GetView().GetFrameWeld(), rWrtSh));
561  pDlg->SetHelpId(GetStaticInterface()->GetSlot(nSlot)->GetCommand());
562  if ( pDlg->Execute() == RET_OK )
563  {
564  const sal_uInt16 nId = pDlg->IsEndNote() ? FN_INSERT_ENDNOTE : FN_INSERT_FOOTNOTE;
565  SfxRequest aReq( GetView().GetViewFrame(), nId );
566  if ( !pDlg->GetStr().isEmpty() )
567  aReq.AppendItem( SfxStringItem( nId, pDlg->GetStr() ) );
568  if ( !pDlg->GetFontName().isEmpty() )
569  aReq.AppendItem( SfxStringItem( FN_PARAM_1, pDlg->GetFontName() ) );
570  ExecuteSlot( aReq );
571  }
572 
573  rReq.Ignore();
574  }
575  break;
578  {
579  GetView().ExecFormatFootnote();
580  break;
581  }
582  case SID_INSERTDOC:
583  {
584  GetView().ExecuteInsertDoc( rReq, pItem );
585  break;
586  }
587  case FN_FORMAT_RESET:
588  {
589  // #i78856, reset all attributes but not the language attributes
590  // (for this build an array of all relevant attributes and
591  // remove the languages from that)
592  std::set<sal_uInt16> aAttribs;
593 
594  sal_uInt16 aResetableSetRange[] = {
597  RES_CHRATR_LANGUAGE + 1, RES_CHRATR_CJK_LANGUAGE - 1,
598  RES_CHRATR_CJK_LANGUAGE + 1, RES_CHRATR_CTL_LANGUAGE - 1,
599  RES_CHRATR_CTL_LANGUAGE + 1, RES_CHRATR_END-1,
603  0
604  };
605  const sal_uInt16 *pUShorts = aResetableSetRange;
606  while (*pUShorts)
607  {
608  for (sal_uInt16 i = pUShorts[0]; i <= pUShorts[1]; ++i)
609  aAttribs.insert( aAttribs.end(), i );
610  pUShorts += 2;
611  }
612  // we don't want to change writing direction.
613  aAttribs.erase( RES_FRAMEDIR );
614  rWrtSh.ResetAttr( aAttribs );
615 
616  // also clear the direct formatting flag inside SwTableBox(es)
617  GetView().GetDocShell()->GetFEShell()->UpdateTableStyleFormatting(nullptr, true);
618 
619  rReq.Done();
620  break;
621  }
622  case FN_INSERT_BREAK_DLG:
623  {
624  sal_uInt16 nKind=0;
625  ::boost::optional<sal_uInt16> oPageNumber;
626  OUString aTemplateName;
627  if ( pItem )
628  {
629  nKind = static_cast<const SfxInt16Item*>(pItem)->GetValue();
630  const SfxStringItem* pTemplate = rReq.GetArg<SfxStringItem>(FN_PARAM_1);
631  const SfxUInt16Item* pNumber = rReq.GetArg<SfxUInt16Item>(FN_PARAM_2);
632  const SfxBoolItem* pIsNumberFilled = rReq.GetArg<SfxBoolItem>(FN_PARAM_3);
633  if ( pTemplate )
634  aTemplateName = pTemplate->GetValue();
635  if ( pNumber && pIsNumberFilled && pIsNumberFilled->GetValue() )
636  oPageNumber = pNumber->GetValue();
637  }
638  else
639  {
641  ScopedVclPtr<AbstractSwBreakDlg> pDlg(pFact->CreateSwBreakDlg(GetView().GetFrameWeld(), rWrtSh));
642  if ( pDlg->Execute() == RET_OK )
643  {
644  nKind = pDlg->GetKind();
645  aTemplateName = pDlg->GetTemplateName();
646  oPageNumber = pDlg->GetPageNumber();
647 
648  bool bIsNumberFilled = false;
649  sal_uInt16 nPageNumber = 0;
650 
651  if (oPageNumber)
652  {
653  bIsNumberFilled = true;
654  nPageNumber = oPageNumber.get();
655  }
656 
657  rReq.AppendItem( SfxInt16Item ( FN_INSERT_BREAK_DLG, nKind ) );
658  rReq.AppendItem( SfxStringItem( FN_PARAM_1, aTemplateName ) );
659  rReq.AppendItem( SfxUInt16Item( FN_PARAM_2, nPageNumber ) );
660  rReq.AppendItem( SfxBoolItem ( FN_PARAM_3, bIsNumberFilled ) );
661  rReq.Done();
662  }
663  else
664  rReq.Ignore();
665  }
666 
667  switch ( nKind )
668  {
669  case 1 :
670  rWrtSh.InsertLineBreak(); break;
671  case 2 :
672  rWrtSh.InsertColumnBreak(); break;
673  case 3 :
674  {
675  rWrtSh.StartAllAction();
676  if( !aTemplateName.isEmpty() )
677  rWrtSh.InsertPageBreak( &aTemplateName, oPageNumber );
678  else
679  rWrtSh.InsertPageBreak();
680  rWrtSh.EndAllAction();
681  }
682  }
683 
684  break;
685  }
686  case FN_INSERT_BOOKMARK:
687  {
688  if ( pItem )
689  {
690  OUString sName = static_cast<const SfxStringItem*>(pItem)->GetValue();
691  rWrtSh.SetBookmark( vcl::KeyCode(), sName );
692  }
693  else
694  {
696  ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateSwInsertBookmarkDlg(GetView().GetFrameWeld(), rWrtSh, rReq));
697  pDlg->Execute();
698  }
699 
700  break;
701  }
702  case FN_DELETE_BOOKMARK:
703  {
704  if ( pItem )
705  {
706  IDocumentMarkAccess* const pMarkAccess = rWrtSh.getIDocumentMarkAccess();
707  pMarkAccess->deleteMark( pMarkAccess->findMark(static_cast<const SfxStringItem*>(pItem)->GetValue()) );
708  }
709  break;
710  }
712  {
713  SvxSwAutoFormatFlags aFlags(SvxAutoCorrCfg::Get().GetAutoCorrect()->GetSwFlags());
714  // This must always be false for the postprocessing.
715  aFlags.bAFormatByInput = false;
716  aFlags.bWithRedlining = true;
717  rWrtSh.AutoFormat( &aFlags );
718  aFlags.bWithRedlining = false;
719 
720  SfxViewFrame* pVFrame = GetView().GetViewFrame();
721  if (pVFrame->HasChildWindow(FN_REDLINE_ACCEPT))
723 
726 
727  switch (lcl_AskRedlineFlags(GetView().GetFrameWeld()))
728  {
729  case RET_OK:
730  {
731  xDlg->AcceptAll(true);
732  SfxRequest aReq( pVFrame, FN_AUTOFORMAT_APPLY );
733  aReq.Done();
734  rReq.Ignore();
735  break;
736  }
737 
738  case RET_CANCEL:
739  xDlg->AcceptAll(false);
740  rReq.Ignore();
741  break;
742 
743  case 102:
744  xDlg->Execute();
745  rReq.Done();
746  break;
747  }
748  }
749  break;
750 
751  case FN_AUTOFORMAT_APPLY:
752  {
753  SvxSwAutoFormatFlags aFlags(SvxAutoCorrCfg::Get().GetAutoCorrect()->GetSwFlags());
754  // This must always be false for the postprocessing.
755  aFlags.bAFormatByInput = false;
756  rWrtSh.AutoFormat( &aFlags );
757  rReq.Done();
758  }
759  break;
760  case FN_AUTOFORMAT_AUTO:
761  {
763  bool bSet = pItem ? static_cast<const SfxBoolItem*>(pItem)->GetValue() : !rACfg.IsAutoFormatByInput();
764  if( bSet != rACfg.IsAutoFormatByInput() )
765  {
766  rACfg.SetAutoFormatByInput( bSet );
767  rACfg.Commit();
768  GetView().GetViewFrame()->GetBindings().Invalidate( nSlot );
769  if ( !pItem )
770  rReq.AppendItem( SfxBoolItem( GetPool().GetWhich(nSlot), bSet ) );
771  rReq.Done();
772  }
773  }
774  break;
775  case FN_AUTO_CORRECT:
776  {
777  // At first set to blank as default.
778  rWrtSh.AutoCorrect( *SvxAutoCorrCfg::Get().GetAutoCorrect(), ' ' );
779  rReq.Done();
780  }
781  break;
783  case FN_SORTING_DLG:
784  {
786  ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateSwSortingDialog(GetView().GetFrameWeld(), rWrtSh));
787  pDlg->Execute();
788  rReq.Done();
789  }
790  break;
792  {
793  GetView().ExecNumberingOutline(GetPool());
794  rReq.Done();
795  }
796  break;
797  case FN_CALCULATE:
798  {
799  rtl::Reference<SwTransferable> pTransfer = new SwTransferable( rWrtSh );
800  pTransfer->CalculateAndCopy();
801  rReq.Done();
802  }
803  break;
804  case FN_GOTO_REFERENCE:
805  {
806  SwField *pField = rWrtSh.GetCurField();
807  if(pField && pField->GetTypeId() == SwFieldTypesEnum::GetRef)
808  {
809  rWrtSh.StartAllAction();
810  rWrtSh.SwCursorShell::GotoRefMark( static_cast<SwGetRefField*>(pField)->GetSetRefName(),
811  static_cast<SwGetRefField*>(pField)->GetSubType(),
812  static_cast<SwGetRefField*>(pField)->GetSeqNo() );
813  rWrtSh.EndAllAction();
814  rReq.Done();
815  }
816  }
817  break;
818  case FN_EDIT_FORMULA:
819  {
820  const sal_uInt16 nId = SwInputChild::GetChildWindowId();
821  SfxViewFrame* pVFrame = GetView().GetViewFrame();
822  if(pItem)
823  {
824  //if the ChildWindow is active it has to be removed
825  if( pVFrame->HasChildWindow( nId ) )
826  {
827  pVFrame->ToggleChildWindow( nId );
828  pVFrame->GetBindings().InvalidateAll( true );
829  }
830 
831  OUString sFormula(static_cast<const SfxStringItem*>(pItem)->GetValue());
832  SwFieldMgr aFieldMgr;
833  rWrtSh.StartAllAction();
834  bool bDelSel = rWrtSh.HasSelection();
835  if( bDelSel )
836  {
837  rWrtSh.StartUndo( SwUndoId::START );
838  rWrtSh.DelRight();
839  }
840  else
841  {
842  rWrtSh.EnterStdMode();
843  }
844 
845  if( !bDelSel && aFieldMgr.GetCurField() && SwFieldTypesEnum::Formel == aFieldMgr.GetCurTypeId() )
846  aFieldMgr.UpdateCurField( aFieldMgr.GetCurField()->GetFormat(), OUString(), sFormula );
847  else if( !sFormula.isEmpty() )
848  {
849  if( rWrtSh.IsCursorInTable() )
850  {
852  aSet.Put( SwTableBoxFormula( sFormula ));
853  rWrtSh.SetTableBoxFormulaAttrs( aSet );
854  rWrtSh.UpdateTable();
855  }
856  else
857  {
858  SvNumberFormatter* pFormatter = rWrtSh.GetNumberFormatter();
859  const sal_uInt32 nSysNumFormat = pFormatter->GetFormatIndex( NF_NUMBER_STANDARD, LANGUAGE_SYSTEM);
861  aFieldMgr.InsertField(aData);
862  }
863  }
864 
865  if( bDelSel )
866  rWrtSh.EndUndo( SwUndoId::END );
867  rWrtSh.EndAllAction();
868  rReq.Done();
869  }
870  else
871  {
872  rWrtSh.EndAllTableBoxEdit();
873  pVFrame->ToggleChildWindow( nId );
874  if( !pVFrame->HasChildWindow( nId ) )
875  pVFrame->GetBindings().InvalidateAll( true );
876  rReq.Ignore();
877  }
878  }
879 
880  break;
882  {
883  rWrtSh.UnProtectTables();
884  }
885  break;
886  case SID_EDIT_HYPERLINK:
887  GetView().GetViewFrame()->SetChildWindow(SID_HYPERLINK_DIALOG, true);
888  break;
889  case SID_REMOVE_HYPERLINK:
890  {
891  bool bSel = rWrtSh.HasSelection();
892  if(!bSel)
893  {
894  rWrtSh.StartAction();
895  rWrtSh.Push();
896  if(!rWrtSh.SelectTextAttr( RES_TXTATR_INETFMT ))
897  rWrtSh.SelWrd();
898  }
899  //now remove the attribute
900  std::set<sal_uInt16> aAttribs;
901  aAttribs.insert( RES_TXTATR_INETFMT );
902  rWrtSh.ResetAttr( aAttribs );
903  if(!bSel)
904  {
906  rWrtSh.EndAction();
907  }
908  }
909  break;
910  case SID_ATTR_BRUSH_CHAR :
911  case SID_ATTR_CHAR_SCALEWIDTH :
912  case SID_ATTR_CHAR_ROTATED :
913  case FN_TXTATR_INET :
914  case FN_INSERT_HYPERLINK:
915  {
916  const sal_uInt16 nWhich = GetPool().GetWhich( nSlot );
917  if ( pArgs && pArgs->GetItemState( nWhich ) == SfxItemState::SET )
918  bUseDialog = false;
919  [[fallthrough]];
920  }
921  case SID_CHAR_DLG:
922  case SID_CHAR_DLG_EFFECT:
923  {
924  sw_CharDialog( rWrtSh, bUseDialog, nSlot, pArgs, &rReq );
925  }
926  break;
927  case SID_CHAR_DLG_FOR_PARAGRAPH:
928  {
929  rWrtSh.Push(); //save current cursor
931  sw_CharDialog( rWrtSh, bUseDialog, nSlot, pArgs, &rReq );
932  rWrtSh.Pop(SwCursorShell::PopMode::DeleteCurrent); // restore old cursor
933  }
934  break;
935  case SID_ATTR_LRSPACE :
936  case SID_ATTR_ULSPACE :
937  case SID_ATTR_BRUSH :
938  case SID_PARA_VERTALIGN :
939  case SID_ATTR_PARA_NUMRULE :
940  case SID_ATTR_PARA_REGISTER :
941  case SID_ATTR_PARA_PAGENUM :
942  case FN_FORMAT_LINENUMBER :
943  case FN_NUMBER_NEWSTART :
944  case FN_NUMBER_NEWSTART_AT :
945  case FN_FORMAT_DROPCAPS :
946  case FN_DROP_TEXT:
947  case SID_ATTR_PARA_LRSPACE:
948  {
949  const sal_uInt16 nWhich = GetPool().GetWhich( nSlot );
950  if ( pArgs && pArgs->GetItemState( nWhich ) == SfxItemState::SET )
951  bUseDialog = false;
952  [[fallthrough]];
953  }
954  case SID_PARA_DLG:
955  {
956  SwPaM* pPaM = nullptr;
957 
958  if ( pArgs )
959  {
960  const SfxPoolItem* pPaMItem = nullptr;
961  pArgs->GetItemState( GetPool().GetWhich( FN_PARAM_PAM ), false, &pPaMItem );
962  if ( pPaMItem )
963  pPaM = static_cast< const SwPaMItem* >( pPaMItem )->GetValue( );
964  }
965 
966  if ( !pPaM )
967  pPaM = rWrtSh.GetCursor();
968 
969  FieldUnit eMetric = ::GetDfltMetric( dynamic_cast<SwWebView*>( &GetView()) != nullptr );
970  SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric)));
971 
972  bool bApplyCharUnit = ::HasCharUnit( dynamic_cast<SwWebView*>( &GetView()) != nullptr );
973  SW_MOD()->PutItem(SfxBoolItem(SID_ATTR_APPLYCHARUNIT, bApplyCharUnit));
974 
975  SfxItemSet aCoreSet(
976  GetPool(),
977  svl::Items<
979  // FillAttribute support:
981  // Includes SID_ATTR_TABSTOP_POS:
982  SID_ATTR_TABSTOP_DEFAULTS, SID_ATTR_TABSTOP_OFFSET,
983  SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER,
984  SID_ATTR_PARA_MODEL, SID_ATTR_PARA_KEEP,
985  // Items to hand over XPropertyList things like XColorList,
986  // XHatchList, XGradientList, and XBitmapList to the Area
987  // TabPage:
988  SID_COLOR_TABLE, SID_PATTERN_LIST,
989  SID_HTML_MODE, SID_HTML_MODE,
990  SID_ATTR_PARA_PAGENUM, SID_ATTR_PARA_PAGENUM,
991  FN_PARAM_1, FN_PARAM_1,
994 
995  // get also the list level indent values merged as LR-SPACE item, if needed.
996  rWrtSh.GetPaMAttr( pPaM, aCoreSet, true );
997 
998  // create needed items for XPropertyList entries from the DrawModel so that
999  // the Area TabPage can access them
1000  // Do this after GetCurAttr, this resets the ItemSet content again
1001  const SwDrawModel* pDrawModel = GetView().GetDocShell()->GetDoc()->getIDocumentDrawModelAccess().GetDrawModel();
1002 
1003  aCoreSet.Put(SvxColorListItem(pDrawModel->GetColorList(), SID_COLOR_TABLE));
1004  aCoreSet.Put(SvxGradientListItem(pDrawModel->GetGradientList(), SID_GRADIENT_LIST));
1005  aCoreSet.Put(SvxHatchListItem(pDrawModel->GetHatchList(), SID_HATCH_LIST));
1006  aCoreSet.Put(SvxBitmapListItem(pDrawModel->GetBitmapList(), SID_BITMAP_LIST));
1007  aCoreSet.Put(SvxPatternListItem(pDrawModel->GetPatternList(), SID_PATTERN_LIST));
1008  aCoreSet.Put(SfxUInt16Item(SID_HTML_MODE,
1009  ::GetHtmlMode(GetView().GetDocShell())));
1010 
1011  // Tabulators: Put DefaultTabs into ItemSet
1012  const SvxTabStopItem& rDefTabs =
1013  GetPool().GetDefaultItem(RES_PARATR_TABSTOP);
1014 
1015  const sal_uInt16 nDefDist = static_cast<sal_uInt16>(::GetTabDist( rDefTabs ));
1016  SfxUInt16Item aDefDistItem( SID_ATTR_TABSTOP_DEFAULTS, nDefDist );
1017  aCoreSet.Put( aDefDistItem );
1018 
1019  // Current tabulator
1020  SfxUInt16Item aTabPos( SID_ATTR_TABSTOP_POS, 0 );
1021  aCoreSet.Put( aTabPos );
1022 
1023  // Left border as offset
1024  //#i24363# tab stops relative to indent
1026  aCoreSet.Get( RES_LR_SPACE ).GetTextLeft() : 0;
1027  SfxInt32Item aOff( SID_ATTR_TABSTOP_OFFSET, nOff );
1028  aCoreSet.Put( aOff );
1029 
1030  // Setting the BoxInfo
1031  ::PrepareBoxInfo( aCoreSet, rWrtSh );
1032 
1033  // Current page format
1034  ::SwToSfxPageDescAttr( aCoreSet );
1035 
1036  // Properties of numbering
1037  if (rWrtSh.GetNumRuleAtCurrCursorPos())
1038  {
1039  SfxBoolItem aStart( FN_NUMBER_NEWSTART, rWrtSh.IsNumRuleStart( pPaM ) );
1040  aCoreSet.Put(aStart);
1042  rWrtSh.GetNodeNumStart( pPaM ) );
1043  aCoreSet.Put(aStartAt);
1044  }
1046 
1047  if ( bUseDialog && GetActiveView() )
1048  {
1049  OString sDefPage;
1050  if (pItem)
1051  sDefPage = OUStringToOString(static_cast<const SfxStringItem*>(pItem)->GetValue(), RTL_TEXTENCODING_UTF8);
1052 
1054  pDlg.reset(pFact->CreateSwParaDlg(GetView().GetFrameWeld(), GetView(), aCoreSet, false, sDefPage));
1055  }
1056 
1057  if ( !bUseDialog )
1058  {
1059  if ( nSlot == SID_ATTR_PARA_LRSPACE)
1060  {
1061  SvxLRSpaceItem aParaMargin(static_cast<const SvxLRSpaceItem&>(pArgs->Get(nSlot)));
1062  aParaMargin.SetWhich( RES_LR_SPACE);
1063  aCoreSet.Put(aParaMargin);
1064 
1065  sw_ParagraphDialogResult(&aCoreSet, rWrtSh, rReq, pPaM);
1066  }
1067  else
1068  sw_ParagraphDialogResult(const_cast<SfxItemSet*>(pArgs), rWrtSh, rReq, pPaM);
1069  }
1070  else if (pDlg)
1071  {
1072  std::shared_ptr<SfxRequest> pRequest(new SfxRequest(rReq));
1073  rReq.Ignore(); // the 'old' request is not relevant any more
1074 
1075  pDlg->StartExecuteAsync([pDlg, &rWrtSh, pRequest, nDefDist](sal_Int32 nResult){
1076  if (nResult == RET_OK)
1077  {
1078  // Apply defaults if necessary.
1079  SfxItemSet* pSet = const_cast<SfxItemSet*>(pDlg->GetOutputItemSet());
1080  sal_uInt16 nNewDist;
1081  const SfxPoolItem* pItem2 = nullptr;
1082  if (SfxItemState::SET == pSet->GetItemState(SID_ATTR_TABSTOP_DEFAULTS, false, &pItem2) &&
1083  nDefDist != (nNewDist = static_cast<const SfxUInt16Item*>(pItem2)->GetValue()) )
1084  {
1085  SvxTabStopItem aDefTabs( 0, 0, SvxTabAdjust::Default, RES_PARATR_TABSTOP );
1086  MakeDefTabs( nNewDist, aDefTabs );
1087  rWrtSh.SetDefault( aDefTabs );
1088  pSet->ClearItem( SID_ATTR_TABSTOP_DEFAULTS );
1089  }
1090 
1091  if (SfxItemState::SET == pSet->GetItemState(FN_PARAM_1, false, &pItem2))
1092  {
1093  pSet->Put(SfxStringItem(FN_DROP_TEXT, static_cast<const SfxStringItem*>(pItem2)->GetValue()));
1094  pSet->ClearItem(FN_PARAM_1);
1095  }
1096 
1097  if (SfxItemState::SET == pSet->GetItemState(RES_PARATR_DROP, false, &pItem2))
1098  {
1099  OUString sCharStyleName;
1100  if (static_cast<const SwFormatDrop*>(pItem2)->GetCharFormat())
1101  sCharStyleName = static_cast<const SwFormatDrop*>(pItem2)->GetCharFormat()->GetName();
1102  pSet->Put(SfxStringItem(FN_DROP_CHAR_STYLE_NAME, sCharStyleName));
1103  }
1104 
1105  sw_ParagraphDialogResult(pSet, rWrtSh, *pRequest, rWrtSh.GetCursor());
1106  }
1107  pDlg->disposeOnce();
1108  });
1109  }
1110  }
1111  break;
1112  case FN_NUM_CONTINUE:
1113  {
1114  OUString sContinuedListId;
1115  const SwNumRule* pRule =
1116  rWrtSh.SearchNumRule( true, sContinuedListId );
1117  // #i86492#
1118  // Search also for bullet list
1119  if ( !pRule )
1120  {
1121  pRule = rWrtSh.SearchNumRule( false, sContinuedListId );
1122  }
1123  if ( pRule )
1124  {
1125  rWrtSh.SetCurNumRule( *pRule, false, sContinuedListId );
1126  }
1127  }
1128  break;
1129 
1130  case FN_SELECT_PARA:
1131  {
1132  if ( !rWrtSh.IsSttOfPara() )
1133  rWrtSh.SttPara();
1134  else
1135  rWrtSh.EnterStdMode();
1136  rWrtSh.EndPara( true );
1137  }
1138  break;
1139 
1140  case SID_DEC_INDENT:
1141  case SID_INC_INDENT:
1142  //According to the requirement, modified the behavior when user
1143  //using the indent button on the toolbar. Now if we increase/decrease indent for a
1144  //paragraph which has bullet style it will increase/decrease the bullet level.
1145  {
1146  //If the current paragraph has bullet call the function to
1147  //increase or decrease the bullet level.
1148  //Why could I know whether a paragraph has bullet or not by checking the below conditions?
1149  //Please refer to the "case KEY_TAB:" section in SwEditWin::KeyInput(..) :
1150  // if( rSh.GetCurNumRule() && rSh.IsSttOfPara() &&
1151  // !rSh.HasReadonlySel() )
1152  // eKeyState = KS_NumDown;
1153  //Above code demonstrates that when the cursor is at the start of a paragraph which has bullet,
1154  //press TAB will increase the bullet level.
1155  //So I copied from that ^^
1156  if ( rWrtSh.GetNumRuleAtCurrCursorPos() && !rWrtSh.HasReadonlySel() )
1157  {
1158  rWrtSh.NumUpDown( SID_INC_INDENT == nSlot );
1159  }
1160  else //execute the original processing functions
1161  {
1162  //below is copied of the old codes
1163  rWrtSh.MoveLeftMargin( SID_INC_INDENT == nSlot, rReq.GetModifier() != KEY_MOD1 );
1164  }
1165  }
1166  rReq.Done();
1167  break;
1168 
1169  case FN_DEC_INDENT_OFFSET:
1170  case FN_INC_INDENT_OFFSET:
1171  rWrtSh.MoveLeftMargin( FN_INC_INDENT_OFFSET == nSlot, rReq.GetModifier() == KEY_MOD1 );
1172  rReq.Done();
1173  break;
1174 
1175  case SID_ATTR_CHAR_COLOR2:
1176  {
1177  Color aSet;
1178  OUString sColor;
1179  const SfxPoolItem* pColorStringItem = nullptr;
1180  bool bHasItem = false;
1181 
1182  if(pItem)
1183  {
1184  aSet = static_cast<const SvxColorItem*>(pItem)->GetValue();
1185  bHasItem = true;
1186  }
1187  else if (pArgs && SfxItemState::SET == pArgs->GetItemState(SID_ATTR_COLOR_STR, false, &pColorStringItem))
1188  {
1189  sColor = static_cast<const SfxStringItem*>(pColorStringItem)->GetValue();
1190  aSet = Color(sColor.toInt32(16));
1191  bHasItem = true;
1192  }
1193 
1194  if (bHasItem)
1195  {
1196  SwEditWin& rEditWin = GetView().GetEditWin();
1197  rEditWin.SetWaterCanTextColor(aSet);
1198  SwApplyTemplate* pApply = rEditWin.GetApplyTemplate();
1199 
1200  // If there is a selection, then set the color on it
1201  // otherwise, it'll be the color for the next text to be typed
1202  if(!pApply || pApply->nColor != SID_ATTR_CHAR_COLOR_EXT)
1203  {
1204  rWrtSh.SetAttrItem(SvxColorItem (aSet, RES_CHRATR_COLOR));
1205  }
1206 
1207  rReq.Done();
1208  }
1209  }
1210  break;
1211  case SID_ATTR_CHAR_COLOR_BACKGROUND:
1212  case SID_ATTR_CHAR_COLOR_BACKGROUND_EXT:
1213  case SID_ATTR_CHAR_COLOR_EXT:
1214  {
1215  Color aSet;
1216  OUString sColor;
1217  const SfxPoolItem* pColorStringItem = nullptr;
1218 
1219  if (pArgs && SfxItemState::SET == pArgs->GetItemState(SID_ATTR_COLOR_STR, false, &pColorStringItem))
1220  {
1221  sColor = static_cast<const SfxStringItem*>(pColorStringItem)->GetValue();
1222  if (sColor == "transparent")
1223  aSet = COL_TRANSPARENT;
1224  else
1225  aSet = Color(sColor.toInt32(16));
1226  }
1227  else if (pItem)
1228  aSet = static_cast<const SvxColorItem*>(pItem)->GetValue();
1229  else
1230  aSet = COL_TRANSPARENT;
1231 
1232  SwEditWin& rEdtWin = GetView().GetEditWin();
1233  if (nSlot != SID_ATTR_CHAR_COLOR_EXT)
1234  rEdtWin.SetWaterCanTextBackColor(aSet);
1235  else if (pItem)
1236  rEdtWin.SetWaterCanTextColor(aSet);
1237 
1238  SwApplyTemplate* pApply = rEdtWin.GetApplyTemplate();
1239  SwApplyTemplate aTempl;
1240  if (!pApply && (rWrtSh.HasSelection() || rReq.IsAPI()))
1241  {
1242  if (nSlot != SID_ATTR_CHAR_COLOR_EXT)
1243  {
1244  SfxItemSet aCoreSet( rWrtSh.GetView().GetPool(), svl::Items<
1245  RES_CHRATR_BACKGROUND, RES_CHRATR_BACKGROUND>{} );
1246 
1247  rWrtSh.GetCurAttr( aCoreSet );
1248 
1249  // Remove highlight if already set of the same color
1250  const SvxBrushItem& rBrushItem = aCoreSet.Get(RES_CHRATR_BACKGROUND);
1251  if ( aSet == rBrushItem.GetColor() )
1252  aSet = COL_TRANSPARENT;
1253 
1254  ApplyCharBackground(aSet, rWrtSh);
1255  }
1256  else
1257  rWrtSh.SetAttrItem(
1258  SvxColorItem(aSet, RES_CHRATR_COLOR) );
1259  }
1260  else if (nSlot == SID_ATTR_CHAR_COLOR_BACKGROUND)
1261  {
1262  if (!pApply || pApply->nColor != SID_ATTR_CHAR_COLOR_BACKGROUND_EXT)
1263  {
1264  aTempl.nColor = SID_ATTR_CHAR_COLOR_BACKGROUND_EXT;
1265  rEdtWin.SetApplyTemplate(aTempl);
1266  }
1267  }
1268  else
1269  {
1270  if(!pApply || pApply->nColor != nSlot)
1271  aTempl.nColor = nSlot;
1272  rEdtWin.SetApplyTemplate(aTempl);
1273  }
1274 
1275  rReq.Done();
1276  }
1277  break;
1278 
1280  if (!rWrtSh.IsAddMode())
1281  rWrtSh.MoveParagraph();
1282  rReq.Done();
1283  break;
1284 
1285  case FN_NUM_BULLET_MOVEUP:
1286  if (!rWrtSh.IsAddMode())
1287  rWrtSh.MoveParagraph(-1);
1288  rReq.Done();
1289  break;
1290  case SID_RUBY_DIALOG:
1291  case SID_HYPERLINK_DIALOG:
1292  {
1293  SfxRequest aReq(nSlot, SfxCallMode::SLOT, SfxGetpApp()->GetPool());
1294  GetView().GetViewFrame()->ExecuteSlot( aReq);
1295  rReq.Ignore();
1296  }
1297  break;
1298  case FN_INSERT_PAGEHEADER:
1299  case FN_INSERT_PAGEFOOTER:
1300  if(pArgs && pArgs->Count())
1301  {
1302  OUString sStyleName;
1303  if(pItem)
1304  sStyleName = static_cast<const SfxStringItem*>(pItem)->GetValue();
1305  bool bOn = true;
1306  if( SfxItemState::SET == pArgs->GetItemState(FN_PARAM_1, false, &pItem))
1307  bOn = static_cast<const SfxBoolItem*>(pItem)->GetValue();
1308  rWrtSh.ChangeHeaderOrFooter(sStyleName, FN_INSERT_PAGEHEADER == nSlot, bOn, !rReq.IsAPI());
1309  rReq.Done();
1310  }
1311  break;
1313  if(GetView().GetDocShell()->IsReadOnly())
1314  {
1316  !rWrtSh.GetViewOptions()->IsSelectionInReadonly());
1317  rWrtSh.ShowCursor();
1318  }
1319  break;
1322  {
1323  bool bSetBlockMode = !rWrtSh.IsBlockMode();
1324  if( pArgs && SfxItemState::SET == pArgs->GetItemState(nSlot, false, &pItem))
1325  bSetBlockMode = static_cast<const SfxBoolItem*>(pItem)->GetValue();
1326  if( ( nSlot == FN_SELECTION_MODE_DEFAULT ) != bSetBlockMode )
1327  rWrtSh.EnterBlockMode();
1328  else
1329  rWrtSh.EnterStdMode();
1330  SfxBindings &rBnd = GetView().GetViewFrame()->GetBindings();
1332  rBnd.Update(FN_STAT_SELMODE);
1333  }
1334  break;
1335  case SID_OPEN_HYPERLINK:
1336  case SID_COPY_HYPERLINK_LOCATION:
1337  {
1338  SfxItemSet aSet(GetPool(),
1340  RES_TXTATR_INETFMT>{});
1341  rWrtSh.GetCurAttr(aSet);
1342  if(SfxItemState::SET <= aSet.GetItemState( RES_TXTATR_INETFMT ))
1343  {
1344  const SwFormatINetFormat& rINetFormat = dynamic_cast<const SwFormatINetFormat&>( aSet.Get(RES_TXTATR_INETFMT) );
1345  if( nSlot == SID_COPY_HYPERLINK_LOCATION )
1346  {
1347  ::uno::Reference< datatransfer::clipboard::XClipboard > xClipboard = GetView().GetEditWin().GetClipboard();
1349  rINetFormat.GetValue(),
1350  xClipboard );
1351  }
1352  else
1353  rWrtSh.ClickToINetAttr(rINetFormat);
1354  }
1355  }
1356  break;
1357  case SID_OPEN_XML_FILTERSETTINGS:
1358  {
1359  HandleOpenXmlFilterSettings(rReq);
1360  }
1361  break;
1362  case FN_FORMAT_APPLY_HEAD1:
1363  {
1364  }
1365  break;
1366  case FN_FORMAT_APPLY_HEAD2:
1367  {
1368  }
1369  break;
1370  case FN_FORMAT_APPLY_HEAD3:
1371  {
1372  }
1373  break;
1375  {
1376  }
1377  break;
1379  {
1380  }
1381  break;
1382  case FN_WORDCOUNT_DIALOG:
1383  {
1384  GetView().UpdateWordCount(this, nSlot);
1385  }
1386  break;
1387  case SID_FM_CTL_PROPERTIES:
1388  {
1389  SwPosition aPos(*GetShell().GetCursor()->GetPoint());
1390  sw::mark::IFieldmark* pFieldBM = GetShell().getIDocumentMarkAccess()->getFieldmarkFor(aPos);
1391  if ( !pFieldBM )
1392  {
1393  --aPos.nContent;
1394  pFieldBM = GetShell().getIDocumentMarkAccess()->getFieldmarkFor(aPos);
1395  }
1396 
1397  if ( pFieldBM && pFieldBM->GetFieldname() == ODF_FORMDROPDOWN )
1398  {
1401  if (pDlg->Execute() == RET_OK)
1402  {
1403  pFieldBM->Invalidate();
1404  rWrtSh.InvalidateWindows( rWrtSh.GetView().GetVisArea() );
1405  rWrtSh.UpdateCursor(); // cursor position might be invalid
1406  // Hide the button here and make it visible later, to make transparent background work with SAL_USE_VCLPLUGIN=gen
1407  dynamic_cast<::sw::mark::DropDownFieldmark&>(*pFieldBM).HideButton();
1408  }
1409  }
1410  else if ( pFieldBM && pFieldBM->GetFieldname() == ODF_FORMDATE )
1411  {
1413  sw::mark::DateFieldmark& rDateField = dynamic_cast<sw::mark::DateFieldmark&>(*pFieldBM);
1414  ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateDateFormFieldDialog(rWrtSh.GetView().GetFrameWeld(), &rDateField, GetView().GetDocShell()->GetDoc()));
1415  if (pDlg->Execute() == RET_OK)
1416  {
1417  rDateField.Invalidate();
1418  rWrtSh.InvalidateWindows( rWrtSh.GetView().GetVisArea() );
1419  rWrtSh.UpdateCursor(); // cursor position might be invalid
1420  // Hide the button here and make it visible later, to make transparent background work with SAL_USE_VCLPLUGIN=gen
1421  rDateField.HideButton();
1422  }
1423  }
1424  else
1425  {
1426  SfxRequest aReq( GetView().GetViewFrame(), SID_FM_CTL_PROPERTIES );
1427  aReq.AppendItem( SfxBoolItem( SID_FM_CTL_PROPERTIES, true ) );
1428  rWrtSh.GetView().GetFormShell()->Execute( aReq );
1429  }
1430  }
1431  break;
1432  default:
1433  OSL_ENSURE(false, "wrong dispatcher");
1434  return;
1435  }
1436 }
1437 
1439 {
1440  SwWrtShell &rSh = GetShell();
1441  SfxWhichIter aIter( rSet );
1442  sal_uInt16 nWhich = aIter.FirstWhich();
1443  while ( nWhich )
1444  {
1445  switch ( nWhich )
1446  {
1448  if( !rSh.IsCursorInFootnote() )
1449  rSet.DisableItem( nWhich );
1450  break;
1451 
1452  case SID_LANGUAGE_STATUS:
1453  {
1454  // the value of used script types
1455  OUString aScriptTypesInUse( OUString::number( static_cast<int>(rSh.GetScriptType()) ) );
1456 
1457  // get keyboard language
1458  OUString aKeyboardLang;
1459  SwEditWin& rEditWin = GetView().GetEditWin();
1460  LanguageType nLang = rEditWin.GetInputLanguage();
1461  if (nLang != LANGUAGE_DONTKNOW && nLang != LANGUAGE_SYSTEM)
1462  aKeyboardLang = SvtLanguageTable::GetLanguageString( nLang );
1463 
1464  // get the language that is in use
1465  OUString aCurrentLang = "*";
1466  nLang = SwLangHelper::GetCurrentLanguage( rSh );
1467  if (nLang != LANGUAGE_DONTKNOW)
1468  {
1469  aCurrentLang = SvtLanguageTable::GetLanguageString( nLang );
1471  {
1472  if (nLang == LANGUAGE_NONE)
1473  {
1474  aCurrentLang += ";-";
1475  }
1476  else
1477  {
1478  aCurrentLang += ";" + LanguageTag(nLang).getBcp47(false);
1479  }
1480  }
1481  }
1482 
1483  // build sequence for status value
1484  uno::Sequence< OUString > aSeq( 4 );
1485  aSeq[0] = aCurrentLang;
1486  aSeq[1] = aScriptTypesInUse;
1487  aSeq[2] = aKeyboardLang;
1489 
1490  // set sequence as status value
1491  SfxStringListItem aItem( SID_LANGUAGE_STATUS );
1492  aItem.SetStringList( aSeq );
1493  rSet.Put( aItem );
1494  }
1495  break;
1496 
1497  case SID_THES:
1498  {
1499  // is there a valid selection to get text from?
1500  OUString aText;
1501  bool bValid = !rSh.HasSelection() ||
1502  (rSh.IsSelOnePara() && !rSh.IsMultiSelection());
1503  // prevent context menu from showing when cursor is not in or at the end of a word
1504  // (GetCurWord will return the next word if there is none at the current position...)
1505  const sal_Int16 nWordType = ::i18n::WordType::DICTIONARY_WORD;
1506  bool bWord = rSh.IsInWord( nWordType ) || rSh.IsStartWord( nWordType ) || rSh.IsEndWord( nWordType );
1507  if (bValid && bWord)
1508  aText = rSh.HasSelection()? rSh.GetSelText() : rSh.GetCurWord();
1509 
1510  LanguageType nLang = rSh.GetCurLang();
1511  LanguageTag aLanguageTag( nLang);
1512  const lang::Locale& aLocale( aLanguageTag.getLocale());
1513 
1514  // disable "Thesaurus" context menu entry if there is nothing to look up
1515  uno::Reference< linguistic2::XThesaurus > xThes( ::GetThesaurus() );
1516  if (aText.isEmpty() ||
1517  !xThes.is() || nLang == LANGUAGE_NONE || !xThes->hasLocale( aLocale ))
1518  rSet.DisableItem( SID_THES );
1519  else
1520  {
1521  // set word and locale to look up as status value
1522  OUString aStatusVal = aText + "#" + aLanguageTag.getBcp47();
1523  rSet.Put( SfxStringItem( SID_THES, aStatusVal ) );
1524  }
1525  }
1526  break;
1527 
1528  case FN_NUMBER_NEWSTART :
1529  if(!rSh.GetNumRuleAtCurrCursorPos())
1530  rSet.DisableItem(nWhich);
1531  else
1533  rSh.IsNumRuleStart()));
1534  break;
1535 
1536  case FN_EDIT_FORMULA:
1537  case SID_CHARMAP:
1538  case SID_EMOJI_CONTROL:
1539  case SID_CHARMAP_CONTROL:
1540  {
1541  const SelectionType nType = rSh.GetSelectionType();
1542  if (!(nType & SelectionType::Text) &&
1543  !(nType & SelectionType::Table) &&
1544  !(nType & SelectionType::NumberList))
1545  {
1546  rSet.DisableItem(nWhich);
1547  }
1548  else if ( nWhich == FN_EDIT_FORMULA
1549  && rSh.CursorInsideInputField() )
1550  {
1551  rSet.DisableItem( nWhich );
1552  }
1553  }
1554  break;
1555 
1556  case FN_INSERT_ENDNOTE:
1557  case FN_INSERT_FOOTNOTE:
1559  {
1560  const FrameTypeFlags nNoType =
1562  if ( rSh.GetFrameType(nullptr,true) & nNoType )
1563  rSet.DisableItem(nWhich);
1564 
1565  if ( rSh.CursorInsideInputField() )
1566  {
1567  rSet.DisableItem( nWhich );
1568  }
1569  }
1570  break;
1571 
1572  case FN_INSERT_HYPERLINK:
1573  case SID_INSERTDOC:
1574  case FN_INSERT_GLOSSARY:
1575  case FN_EXPAND_GLOSSARY:
1576  if ( rSh.CursorInsideInputField() )
1577  {
1578  rSet.DisableItem( nWhich );
1579  }
1580  break;
1581 
1582  case FN_INSERT_TABLE:
1583  if ( rSh.CursorInsideInputField()
1584  || rSh.GetTableFormat()
1585  || (rSh.GetFrameType(nullptr,true) & FrameTypeFlags::FOOTNOTE) )
1586  {
1587  rSet.DisableItem( nWhich );
1588  }
1589  break;
1590 
1591  case FN_CALCULATE:
1592  if ( !rSh.IsSelection() )
1593  rSet.DisableItem(nWhich);
1594  break;
1595  case FN_GOTO_REFERENCE:
1596  {
1597  SwField *pField = rSh.GetCurField();
1598  if ( !pField || (pField->GetTypeId() != SwFieldTypesEnum::GetRef) )
1599  rSet.DisableItem(nWhich);
1600  }
1601  break;
1602  case FN_AUTOFORMAT_AUTO:
1603  {
1604  rSet.Put( SfxBoolItem( nWhich, SvxAutoCorrCfg::Get().IsAutoFormatByInput() ));
1605  }
1606  break;
1607 
1608  case SID_DEC_INDENT:
1609  case SID_INC_INDENT:
1610  {
1611  //if the paragraph has bullet we'll do the following things:
1612  //1: if the bullet level is the first level, disable the decrease-indent button
1613  //2: if the bullet level is the last level, disable the increase-indent button
1614  if ( rSh.GetNumRuleAtCurrCursorPos() && !rSh.HasReadonlySel() )
1615  {
1616  const sal_uInt8 nLevel = rSh.GetNumLevel();
1617  if ( ( nLevel == ( MAXLEVEL - 1 ) && nWhich == SID_INC_INDENT )
1618  || ( nLevel == 0 && nWhich == SID_DEC_INDENT ) )
1619  {
1620  rSet.DisableItem( nWhich );
1621  }
1622  }
1623  else
1624  {
1625  sal_uInt16 nHtmlMode = ::GetHtmlMode( GetView().GetDocShell() );
1626  nHtmlMode &= HTMLMODE_ON | HTMLMODE_SOME_STYLES;
1627  if ( ( nHtmlMode == HTMLMODE_ON )
1628  || !rSh.IsMoveLeftMargin( SID_INC_INDENT == nWhich ) )
1629  {
1630  rSet.DisableItem( nWhich );
1631  }
1632  }
1633  }
1634  break;
1635 
1636  case FN_DEC_INDENT_OFFSET:
1637  case FN_INC_INDENT_OFFSET:
1638  {
1639  sal_uInt16 nHtmlMode = ::GetHtmlMode(GetView().GetDocShell());
1640  nHtmlMode &= HTMLMODE_ON|HTMLMODE_SOME_STYLES;
1641  if( (nHtmlMode == HTMLMODE_ON) ||
1642  !rSh.IsMoveLeftMargin( FN_INC_INDENT_OFFSET == nWhich,
1643  false ))
1644  rSet.DisableItem( nWhich );
1645  }
1646  break;
1647 
1648  case SID_ATTR_CHAR_COLOR2:
1649  {
1650  SfxItemSet aSet( GetPool() );
1651  rSh.GetCurAttr( aSet );
1652  const SvxColorItem& aColorItem = aSet.Get(RES_CHRATR_COLOR);
1653  rSet.Put( aColorItem.CloneSetWhich(SID_ATTR_CHAR_COLOR2) );
1654  }
1655  break;
1656  case SID_ATTR_CHAR_COLOR_BACKGROUND:
1657  {
1658  // Always use the visible background
1659  SfxItemSet aSet( GetPool() );
1660  rSh.GetCurAttr( aSet );
1661  const SvxBrushItem& aBrushItem = aSet.Get(RES_CHRATR_HIGHLIGHT);
1662  if( aBrushItem.GetColor() != COL_TRANSPARENT )
1663  {
1664  rSet.Put( SvxColorItem(aBrushItem.GetColor(), nWhich) );
1665  }
1666  else
1667  {
1668  const SvxBrushItem& aBrushItem2 = aSet.Get(RES_CHRATR_BACKGROUND);
1669  rSet.Put( SvxColorItem(aBrushItem2.GetColor(), nWhich) );
1670  }
1671  }
1672  break;
1673  case SID_ATTR_CHAR_COLOR_BACKGROUND_EXT:
1674  case SID_ATTR_CHAR_COLOR_EXT:
1675  {
1676  SwEditWin& rEdtWin = GetView().GetEditWin();
1677  SwApplyTemplate* pApply = rEdtWin.GetApplyTemplate();
1678  rSet.Put(SfxBoolItem(nWhich, pApply && pApply->nColor == nWhich));
1679  }
1680  break;
1681 
1682  case FN_INSERT_BOOKMARK:
1683  if( rSh.IsTableMode()
1684  || rSh.CursorInsideInputField() )
1685  {
1686  rSet.DisableItem( nWhich );
1687  }
1688  break;
1689 
1690  case FN_INSERT_BREAK:
1691  if ( rSh.HasReadonlySel()
1692  && !rSh.CursorInsideInputField() )
1693  {
1694  rSet.DisableItem( nWhich );
1695  }
1696  break;
1697 
1698  case FN_INSERT_BREAK_DLG:
1700  case FN_INSERT_PAGEBREAK:
1701  if( rSh.CursorInsideInputField() )
1702  {
1703  rSet.DisableItem( nWhich );
1704  }
1705  break;
1706 
1707  case FN_INSERT_PAGEHEADER:
1708  case FN_INSERT_PAGEFOOTER:
1710  {
1711  bool bState = false;
1712  bool bAllState = true;
1713  bool bIsPhysical = false;
1714 
1715  OUString aStyleName;
1716  std::vector<OUString> aList;
1717  const OUString sPhysical("IsPhysical");
1718  const OUString sDisplay("DisplayName");
1719  const OUString sHeaderOn(nWhich == FN_INSERT_PAGEHEADER ? OUString("HeaderIsOn") : OUString("FooterIsOn"));
1720 
1721  uno::Reference< XStyleFamiliesSupplier > xSupplier(GetView().GetDocShell()->GetBaseModel(), uno::UNO_QUERY);
1722  if (xSupplier.is())
1723  {
1724  uno::Reference< XNameContainer > xContainer;
1725  uno::Reference< XNameAccess > xFamilies = xSupplier->getStyleFamilies();
1726  if (xFamilies->getByName("PageStyles") >>= xContainer)
1727  {
1728  const uno::Sequence< OUString > aSeqNames = xContainer->getElementNames();
1729  for (const auto& rName : aSeqNames)
1730  {
1731  aStyleName = rName;
1732  uno::Reference<XPropertySet> xPropSet(xContainer->getByName(aStyleName), uno::UNO_QUERY);
1733  if (xPropSet.is() && (xPropSet->getPropertyValue(sPhysical) >>= bIsPhysical) && bIsPhysical)
1734  {
1735  xPropSet->getPropertyValue(sDisplay) >>= aStyleName;
1736  if ((xPropSet->getPropertyValue(sHeaderOn)>>= bState) && bState)
1737  aList.push_back(aStyleName);
1738  else
1739  bState = false;
1740 
1741  // Check if all entries have the same state
1742  bAllState &= bState;
1743  }
1744  else
1745  bIsPhysical = false;
1746  }
1747  }
1748  }
1749 
1750  if (bAllState && aList.size() > 1)
1751  aList.push_back("_ALL_");
1752 
1753  rSet.Put(SfxStringListItem(nWhich, &aList));
1754  }
1755  else
1756  {
1757  rSet.Put( SfxObjectShellItem( nWhich, GetView().GetDocShell() ));
1758  }
1759  break;
1760  case FN_TABLE_SORT_DIALOG:
1761  case FN_SORTING_DLG:
1762  if(!rSh.HasSelection() ||
1763  (FN_TABLE_SORT_DIALOG == nWhich && !rSh.GetTableFormat()))
1764  rSet.DisableItem( nWhich );
1765  break;
1766 
1767  case SID_RUBY_DIALOG:
1768  {
1769  SvtCJKOptions aCJKOptions;
1770  if( !aCJKOptions.IsRubyEnabled()
1771  || rSh.CursorInsideInputField() )
1772  {
1773  GetView().GetViewFrame()->GetBindings().SetVisibleState( nWhich, false );
1774  rSet.DisableItem(nWhich);
1775  }
1776  else
1777  GetView().GetViewFrame()->GetBindings().SetVisibleState( nWhich, true );
1778  }
1779  break;
1780 
1781  case SID_HYPERLINK_DIALOG:
1782  if( GetView().GetDocShell()->IsReadOnly()
1783  || ( !GetView().GetViewFrame()->HasChildWindow(nWhich)
1784  && rSh.HasReadonlySel() )
1785  || rSh.CursorInsideInputField() )
1786  {
1787  rSet.DisableItem(nWhich);
1788  }
1789  else
1790  {
1791  rSet.Put(SfxBoolItem( nWhich, nullptr != GetView().GetViewFrame()->GetChildWindow( nWhich ) ));
1792  }
1793  break;
1794 
1795  case SID_EDIT_HYPERLINK:
1796  case SID_COPY_HYPERLINK_LOCATION:
1797  {
1798  SfxItemSet aSet(GetPool(),
1800  RES_TXTATR_INETFMT>{});
1801  rSh.GetCurAttr(aSet);
1802  if(SfxItemState::SET > aSet.GetItemState( RES_TXTATR_INETFMT ) || rSh.HasReadonlySel())
1803  {
1804  rSet.DisableItem(nWhich);
1805  }
1806  }
1807  break;
1808  case SID_REMOVE_HYPERLINK:
1809  {
1810  SfxItemSet aSet(GetPool(),
1812  RES_TXTATR_INETFMT>{});
1813  rSh.GetCurAttr(aSet);
1814 
1815  // If a hyperlink is selected, either alone or along with other text...
1816  if ((aSet.GetItemState(RES_TXTATR_INETFMT) < SfxItemState::SET &&
1817  aSet.GetItemState(RES_TXTATR_INETFMT) != SfxItemState::DONTCARE) ||
1818  rSh.HasReadonlySel())
1819  {
1820  rSet.DisableItem(nWhich);
1821  }
1822  }
1823  break;
1824  case SID_TRANSLITERATE_HALFWIDTH:
1825  case SID_TRANSLITERATE_FULLWIDTH:
1826  case SID_TRANSLITERATE_HIRAGANA:
1827  case SID_TRANSLITERATE_KATAKANA:
1828  {
1829  SvtCJKOptions aCJKOptions;
1830  if(!aCJKOptions.IsChangeCaseMapEnabled())
1831  {
1832  GetView().GetViewFrame()->GetBindings().SetVisibleState( nWhich, false );
1833  rSet.DisableItem(nWhich);
1834  }
1835  else
1836  GetView().GetViewFrame()->GetBindings().SetVisibleState( nWhich, true );
1837  }
1838  break;
1840  if(!GetView().GetDocShell()->IsReadOnly())
1841  rSet.DisableItem( nWhich );
1842  else
1843  {
1844  rSet.Put(SfxBoolItem(nWhich, rSh.GetViewOptions()->IsSelectionInReadonly()));
1845  }
1846  break;
1849  rSet.Put(SfxBoolItem(nWhich, (nWhich == FN_SELECTION_MODE_DEFAULT) != rSh.IsBlockMode()));
1850  break;
1851  case SID_OPEN_HYPERLINK:
1852  {
1853  SfxItemSet aSet(GetPool(),
1855  RES_TXTATR_INETFMT>{});
1856  rSh.GetCurAttr(aSet);
1857  if(SfxItemState::SET > aSet.GetItemState( RES_TXTATR_INETFMT, false ))
1858  rSet.DisableItem(nWhich);
1859  }
1860  break;
1861  case SID_OPEN_SMARTTAGMENU:
1862  {
1863  std::vector< OUString > aSmartTagTypes;
1864  uno::Sequence< uno::Reference< container::XStringKeyMap > > aStringKeyMaps;
1865  uno::Reference<text::XTextRange> xRange;
1866 
1867  rSh.GetSmartTagTerm( aSmartTagTypes, aStringKeyMaps, xRange );
1868 
1869  if ( xRange.is() && !aSmartTagTypes.empty() )
1870  {
1871  uno::Sequence < uno::Sequence< uno::Reference< smarttags::XSmartTagAction > > > aActionComponentsSequence;
1872  uno::Sequence < uno::Sequence< sal_Int32 > > aActionIndicesSequence;
1873 
1874  const SmartTagMgr& rSmartTagMgr = SwSmartTagMgr::Get();
1875  rSmartTagMgr.GetActionSequences( aSmartTagTypes,
1876  aActionComponentsSequence,
1877  aActionIndicesSequence );
1878 
1879  uno::Reference <frame::XController> xController = GetView().GetController();
1880  const lang::Locale aLocale( SW_BREAKITER()->GetLocale( GetAppLanguageTag() ) );
1881  const OUString& aApplicationName( rSmartTagMgr.GetApplicationName() );
1882  const OUString aRangeText = xRange->getString();
1883 
1884  const SvxSmartTagItem aItem( nWhich,
1885  aActionComponentsSequence,
1886  aActionIndicesSequence,
1887  aStringKeyMaps,
1888  xRange,
1889  xController,
1890  aLocale,
1891  aApplicationName,
1892  aRangeText );
1893 
1894  rSet.Put( aItem );
1895  }
1896  else
1897  rSet.DisableItem(nWhich);
1898  }
1899  break;
1900 
1901  case FN_NUM_NUMBERING_ON:
1902  rSet.Put(SfxBoolItem(FN_NUM_NUMBERING_ON,rSh.SelectionHasNumber()));
1903  break;
1904 
1905  case FN_NUM_BULLET_ON:
1906  rSet.Put(SfxBoolItem(FN_NUM_BULLET_ON,rSh.SelectionHasBullet()));
1907  break;
1908 
1909  case FN_BUL_NUM_RULE_INDEX:
1910  case FN_NUM_NUM_RULE_INDEX:
1911  case FN_OUTLINE_RULE_INDEX:
1912  {
1913  SwNumRule* pCurRule = const_cast<SwNumRule*>(GetShell().GetNumRuleAtCurrCursorPos());
1914  sal_uInt16 nActNumLvl = USHRT_MAX;
1915  if( pCurRule )
1916  {
1917  nActNumLvl = GetShell().GetNumLevel();
1918  if( nActNumLvl < MAXLEVEL )
1919  {
1920  nActNumLvl = 1<<nActNumLvl;
1921  }
1922  SvxNumRule aSvxRule = pCurRule->MakeSvxNumRule();
1923  if ( GetShell().HasBullet())
1924  {
1925  rSet.Put(SfxUInt16Item(FN_BUL_NUM_RULE_INDEX, USHRT_MAX));
1926  rSet.Put(SfxUInt16Item(FN_NUM_NUM_RULE_INDEX, USHRT_MAX));
1927  NBOTypeMgrBase* pBullets = NBOutlineTypeMgrFact::CreateInstance(NBOType::Bullets);
1928  if ( pBullets )
1929  {
1930  const sal_uInt16 nBulIndex = pBullets->GetNBOIndexForNumRule(aSvxRule,nActNumLvl);
1931  rSet.Put(SfxUInt16Item(FN_BUL_NUM_RULE_INDEX,nBulIndex));
1932  }
1933  }else if ( GetShell().HasNumber() )
1934  {
1935  rSet.Put(SfxUInt16Item(FN_BUL_NUM_RULE_INDEX, USHRT_MAX));
1936  rSet.Put(SfxUInt16Item(FN_NUM_NUM_RULE_INDEX, USHRT_MAX));
1937  NBOTypeMgrBase* pNumbering = NBOutlineTypeMgrFact::CreateInstance(NBOType::Numbering);
1938  if ( pNumbering )
1939  {
1940  const sal_uInt16 nBulIndex = pNumbering->GetNBOIndexForNumRule(aSvxRule,nActNumLvl);
1941  rSet.Put(SfxUInt16Item(FN_NUM_NUM_RULE_INDEX,nBulIndex));
1942  }
1943  }
1944 
1945  if ( nWhich == FN_OUTLINE_RULE_INDEX )
1946  {
1947  rSet.Put(SfxUInt16Item(FN_OUTLINE_RULE_INDEX, USHRT_MAX));
1948  NBOTypeMgrBase* pOutline = NBOutlineTypeMgrFact::CreateInstance(NBOType::Outline);
1949  if ( pOutline )
1950  {
1951  const sal_uInt16 nIndex = pOutline->GetNBOIndexForNumRule(aSvxRule,nActNumLvl);
1952  rSet.Put(SfxUInt16Item(FN_OUTLINE_RULE_INDEX,nIndex));
1953  }
1954  }
1955  }
1956  }
1957  break;
1958  case FN_NUM_CONTINUE:
1959  {
1960  // #i86492#
1961  // Search also for bullet list
1962  OUString aDummy;
1963  const SwNumRule* pRule =
1964  rSh.SearchNumRule( true, aDummy );
1965  if ( !pRule )
1966  {
1967  pRule = rSh.SearchNumRule( false, aDummy );
1968  }
1969  if ( !pRule )
1970  rSet.DisableItem(nWhich);
1971  }
1972  break;
1973  case SID_INSERT_RLM :
1974  case SID_INSERT_LRM :
1975  {
1976  SvtCTLOptions aCTLOptions;
1977  bool bEnabled = aCTLOptions.IsCTLFontEnabled();
1978  GetView().GetViewFrame()->GetBindings().SetVisibleState( nWhich, bEnabled );
1979  if(!bEnabled)
1980  rSet.DisableItem(nWhich);
1981  }
1982  break;
1983  case SID_FM_CTL_PROPERTIES:
1984  {
1985  bool bDisable = false;
1986 
1987  // First get the state from the form shell
1989  aSet.Put(SfxBoolItem( SID_FM_CTL_PROPERTIES, true ));
1990  GetShell().GetView().GetFormShell()->GetState( aSet );
1991 
1992  if(SfxItemState::DISABLED == aSet.GetItemState(SID_FM_CTL_PROPERTIES))
1993  {
1994  bDisable = true;
1995  }
1996 
1997  // Enable it if we have a valid object other than what form shell knows
1998  SwPosition aPos(*GetShell().GetCursor()->GetPoint());
1999  sw::mark::IFieldmark* pFieldBM = GetShell().getIDocumentMarkAccess()->getFieldmarkFor(aPos);
2000  if ( !pFieldBM && aPos.nContent.GetIndex() > 0)
2001  {
2002  --aPos.nContent;
2003  pFieldBM = GetShell().getIDocumentMarkAccess()->getFieldmarkFor(aPos);
2004  }
2005  if ( pFieldBM && (pFieldBM->GetFieldname() == ODF_FORMDROPDOWN || pFieldBM->GetFieldname() == ODF_FORMDATE) )
2006  {
2007  bDisable = false;
2008  }
2009 
2010  if(bDisable)
2011  rSet.DisableItem(nWhich);
2012  }
2013  break;
2014  case SID_COPY:
2015  case SID_CUT:
2016  {
2017  if (GetShell().GetView().isContentExtractionLocked())
2018  rSet.DisableItem(nWhich);
2019  break;
2020  }
2021  }
2022  nWhich = aIter.NextWhich();
2023  }
2024 }
2025 
2026 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void InsertLineBreak()
Definition: wrtsh1.cxx:923
void SetDefault(const SfxPoolItem &)
Set attribute as new default attribute in document.
Definition: edatmisc.cxx:84
bool IsNumRuleStart(SwPaM *pPaM=nullptr) const
Definition: ednumber.cxx:859
SfxViewFrame * GetViewFrame() const
#define FN_NUM_CONTINUE
Definition: cmdid.h:135
Fieldmark representing a date form field.
Definition: bookmrk.hxx:306
#define LANGUAGE_NONE
#define FN_INSERT_FOOTNOTE_DLG
Definition: cmdid.h:197
#define FN_FORMAT_CURRENT_FOOTNOTE_DLG
Definition: cmdid.h:308
#define FN_NUM_BULLET_MOVEDOWN
Definition: cmdid.h:85
void EnterBlockMode()
Definition: select.cxx:655
bool SttPara(bool bSelect=false)
Definition: move.cxx:348
FieldUnit
SAL_DLLPRIVATE void UpdateCursor(sal_uInt16 eFlags=SwCursorShell::SCROLLWIN|SwCursorShell::CHKRANGE, bool bIdleEnd=false)
Definition: crsrsh.cxx:1551
SwTextFormatColl * GetCurTextFormatColl() const
Get the named paragraph format of the current selection.
Definition: edattr.cxx:245
#define FN_READONLY_SELECTION_MODE
Definition: cmdid.h:703
Represents the style of a paragraph.
Definition: fmtcol.hxx:55
static SvxAutoCorrCfg & Get()
Marks a position in the document model.
Definition: pam.hxx:35
#define FN_FORMAT_LINENUMBER
Definition: cmdid.h:449
#define RES_CHRATR_CJK_LANGUAGE
Definition: hintids.hxx:93
void SwToSfxPageDescAttr(SfxItemSet &rSet)
Definition: uitool.cxx:670
SwPaM * GetCursor(bool bMakeTableCursor=true) const
Return pointer to the current shell cursor.
Definition: crsrsh.cxx:184
void SetWaterCanTextBackColor(const Color &rCol)
Definition: edtwin.hxx:237
void InsertPageBreak(const OUString *pPageDesc=nullptr, const ::boost::optional< sal_uInt16 > &rPgNum=boost::none)
Definition: wrtsh1.cxx:888
static SfxAbstractDialogFactory * Create()
#define RES_CHRATR_LANGUAGE
Definition: hintids.hxx:79
SwView * GetActiveView()
Definition: swmodul1.cxx:123
#define FN_SELECTION_MODE_BLOCK
Definition: cmdid.h:705
void SetAutoFormatByInput(bool bSet)
SW_DLLPUBLIC void ConvertAttrCharToGen(SfxItemSet &rSet)
Convert character specific attributes to general ones used by tab pages.
Definition: uitool.cxx:127
static void sw_CharDialogResult(const SfxItemSet *pSet, SwWrtShell &rWrtSh, std::shared_ptr< SfxItemSet > const &pCoreSet, bool bSel, bool bSelectionPut, SfxRequest *pReq)
Definition: textsh1.cxx:222
sal_uInt32 GetFormat() const
Query parameters for dialog and for BASIC.
Definition: fldbas.hxx:388
virtual VclPtr< VclAbstractDialog > CreateSwSortingDialog(weld::Window *pParent, SwWrtShell &rSh)=0
virtual const SfxItemSet * GetOutputItemSet() const =0
std::string GetValue
const SwNumRule * GetNumRuleAtCurrCursorPos() const
Definition: ednumber.cxx:725
virtual VclPtr< VclAbstractDialog > CreateDropDownFormFieldDialog(weld::Widget *pParent, sw::mark::IFieldmark *pDropDownField)=0
sal_Unicode GetChar(bool bEnd=true, long nOffset=0)
get the nth character of the current SSelection
Definition: crsrsh.cxx:2563
sal_uInt32 GetFormatIndex(NfIndexTableOffset, LanguageType eLnge=LANGUAGE_DONTKNOW)
bool IsCursorInFootnote() const
Definition: crsrsh.cxx:1138
virtual sal_uInt16 GetNBOIndexForNumRule(SvxNumRule &aNum, sal_uInt16 mLevel, sal_uInt16 nFromIndex=0)=0
bool IsTableMode() const
Definition: crsrsh.hxx:647
void ChangeHeaderOrFooter(const OUString &rStyleName, bool bHeader, bool bOn, bool bShowWarning)
Definition: wrtsh1.cxx:1817
#define FN_AUTOFORMAT_REDLINE_APPLY
Definition: cmdid.h:289
#define RES_SHADOW
Definition: hintids.hxx:214
bool IsReadOnly(const OUString &rURL, bool *pbExist)
bool IsEndWord(sal_Int16 nWordType=css::i18n::WordType::ANYWORD_IGNOREWHITESPACES) const
Definition: crstrvl1.cxx:31
#define RES_FRAMEDIR
Definition: hintids.hxx:227
Base class of all fields.
Definition: fldbas.hxx:280
#define FN_TABLE_UNSET_READ_ONLY
Definition: cmdid.h:382
void SetAttrSet(const SfxItemSet &, SetAttrMode nFlags=SetAttrMode::DEFAULT, SwPaM *pCursor=nullptr, const bool bParagraphSetting=false)
Definition: edatmisc.cxx:151
bool Pop(SwCursorShell::PopMode=SwCursorShell::PopMode::DeleteStack)
Definition: wrtsh1.cxx:1726
#define FN_INSERT_ENDNOTE
Definition: cmdid.h:270
void GetState(SfxItemSet &)
Definition: textsh1.cxx:1438
OUString ReplacementString()
void SetWaterCanTextColor(const Color &rCol)
Definition: edtwin.hxx:235
#define RES_FRMATR_END
Definition: hintids.hxx:238
Provides access to the marks of a document.
const OUString & getBcp47(bool bResolveSystem=true) const
void UpdateCurField(sal_uInt32 nFormat, const OUString &rPar1, const OUString &rPar2, std::unique_ptr< SwField > _pField=nullptr)
Definition: fldmgr.cxx:1532
#define KEY_MOD1
#define RES_TXTATR_UNKNOWN_CONTAINER
Definition: hintids.hxx:145
sal_Int16 nId
sal_uInt16 FirstWhich()
SwUndoId EndUndo(SwUndoId eUndoId=SwUndoId::EMPTY, const SwRewriter *pRewriter=nullptr)
Closes parenthesis of nUndoId, not used by UI.
Definition: edws.cxx:233
const IDocumentSettingAccess & getIDocumentSettingAccess() const
Provides access to the document setting interface.
Definition: viewsh.cxx:2591
bool SelectionHasNumber() const
Definition: ednumber.cxx:149
SW_DLLPUBLIC SwTwips GetTabDist(const SvxTabStopItem &rTabs)
Definition: uitool.cxx:604
#define SW_BREAKITER()
Definition: breakit.hxx:121
void EnterStdMode()
Definition: select.cxx:555
bool IsSelFullPara() const
Definition: crsrsh.cxx:3340
void Done(bool bRemove=false)
void ExtendedSelectAll(bool bFootnotes=true)
Definition: crsrsh.cxx:583
#define FN_INSERT_COLUMN_BREAK
Definition: cmdid.h:191
#define FN_EDIT_FORMULA
Definition: cmdid.h:76
virtual VclPtr< AbstractSwModalRedlineAcceptDlg > CreateSwModalRedlineAcceptDlg(weld::Window *pParent)=0
void AutoUpdatePara(SwTextFormatColl *pColl, const SfxItemSet &rStyleSet, SwPaM *pPaM=nullptr)
Definition: wrtsh1.cxx:1591
const SfxItemSet * GetArgs() const
void Invalidate(sal_uInt16 nId)
const SwDoc & GetDoc() const
Definition: drawdoc.hxx:35
void SfxToSwPageDescAttr(const SwWrtShell &rShell, SfxItemSet &rSet)
Definition: uitool.cxx:610
bool IsCTLFontEnabled() const
bool InsertField(const SwInsertField_Data &rData)
Definition: fldmgr.cxx:898
virtual short Execute()=0
void EndAllAction()
Definition: edws.cxx:96
static short lcl_AskRedlineFlags(weld::Window *pWin)
Definition: textsh1.cxx:277
#define FN_AUTOFORMAT_AUTO
Definition: cmdid.h:286
RET_CANCEL
sal_uInt8 GetNumLevel() const
Definition: ednumber.cxx:700
void SetApplyTemplate(const SwApplyTemplate &)
Apply template.
Definition: edtwin.cxx:4936
const css::lang::Locale & getLocale(bool bResolveSystem=true) const
SwFieldTypesEnum GetCurTypeId() const
Definition: fldmgr.cxx:892
#define XATTR_FILLCOLOR
sal_uInt16 NextWhich()
bool DelRight()
Definition: delete.cxx:285
XPatternListRef GetPatternList() const
bool HasCharUnit(bool bWeb)
Definition: uitool.cxx:828
static LanguageType nLang
Definition: srtdlg.cxx:60
IDocumentDrawModelAccess const & getIDocumentDrawModelAccess() const
Definition: doc.cxx:154
SfxApplication * SfxGetpApp()
virtual VclPtr< VclAbstractDialog > CreateSwInsertBookmarkDlg(weld::Window *pParent, SwWrtShell &rSh, SfxRequest &rReq)=0
void ApplyCharBackground(const Color &rBackgroundColor, SwWrtShell &rShell)
Apply character background on the shell.
Definition: uitool.cxx:202
void SwapPam()
Definition: crsrsh.cxx:963
void SetCurNumRule(const SwNumRule &, const bool bCreateNewList, const OUString &sContinuedListId=OUString(), const bool bResetIndentAttrs=false)
Optional parameter (default value false).
Definition: ednumber.cxx:769
LanguageType GetCurLang() const
Definition: edattr.cxx:808
Used by the UI to modify the document model.
Definition: wrtsh.hxx:90
void ToggleChildWindow(sal_uInt16)
virtual VclPtr< AbstractSwBreakDlg > CreateSwBreakDlg(weld::Window *pParent, SwWrtShell &rSh)=0
#define FN_CALCULATE
Definition: cmdid.h:475
void SetNodeNumStart(sal_uInt16 nStt)
Definition: ednumber.cxx:866
NF_NUMBER_STANDARD
constexpr::Color COL_TRANSPARENT(0xFF, 0xFF, 0xFF, 0xFF)
const OUString & GetValue() const
Definition: fmtinfmt.hxx:75
#define RES_CHRATR_END
Definition: hintids.hxx:115
#define FN_TABLE_SORT_DIALOG
Definition: cmdid.h:358
const SwView & GetView() const
Definition: wrtsh.hxx:428
Reference< XController > xController
virtual const_iterator_t findMark(const OUString &rMark) const =0
Finds a mark by name.
sal_uInt32 CharsToDelete()
#define XATTR_FILL_LAST
SwIndex nContent
Definition: pam.hxx:38
void GetActionSequences(std::vector< OUString > &rSmartTagTypes, css::uno::Sequence< css::uno::Sequence< css::uno::Reference< css::smarttags::XSmartTagAction > > > &rActionComponentsSequence, css::uno::Sequence< css::uno::Sequence< sal_Int32 > > &rActionIndicesSequence) const
#define FN_INSERT_BOOKMARK
Definition: cmdid.h:188
#define XATTR_FILL_FIRST
bool IsAutoFormatByInput() const
virtual void Invalidate()=0
bool GotoFootnoteText()
jump from content to footnote
Definition: trvlfnfl.cxx:83
#define RES_PARATR_TABSTOP
Definition: hintids.hxx:167
SwField * GetCurField(const bool bIncludeInputFieldAtStart=false) const
Definition: crstrvl.cxx:927
const sal_uInt8 MAXLEVEL
Definition: swtypes.hxx:95
void Execute(SfxRequest &)
Definition: textsh1.cxx:351
#define FN_EXPAND_GLOSSARY
Definition: cmdid.h:478
#define FN_SORTING_DLG
Definition: cmdid.h:474
#define FN_STAT_SELMODE
Definition: cmdid.h:811
#define FN_AUTOFORMAT_APPLY
Definition: cmdid.h:285
bool IsBlockMode() const
Definition: wrtsh.hxx:161
#define FN_GOTO_REFERENCE
Definition: cmdid.h:108
const IDocumentMarkAccess * getIDocumentMarkAccess() const
Provides access to the document bookmark interface.
Definition: viewsh.cxx:2595
#define RES_PARATR_BEGIN
Definition: hintids.hxx:161
sal_uInt16 GetNodeNumStart(SwPaM *pPaM) const
Definition: ednumber.cxx:892
void Insert(SwField const &, SwPaM *pAnnotationRange=nullptr)
Definition: wrtsh2.cxx:71
void Normalize(bool bPointFirst=true)
Normalizes PaM, i.e.
Definition: pam.cxx:522
SfxItemPool & GetPool() const
bool IsChangeCaseMapEnabled() const
SvxNumRule MakeSvxNumRule() const
Definition: number.cxx:839
void SetTableBoxFormulaAttrs(const SfxItemSet &rSet)
Definition: edtab.cxx:343
#define RES_BACKGROUND
Definition: hintids.hxx:212
virtual std::unique_ptr< ILazyDeleter > deleteMark(const IDocumentMarkAccess::const_iterator_t &ppMark)=0
Deletes a mark.
#define FN_INSERT_GLOSSARY
Definition: cmdid.h:567
const Color & GetColor() const
weld::Window * GetFrameWeld(const SfxFrame *pFrame)
Definition: dialoghelp.cxx:20
#define RES_CHRATR_COLOR
Definition: hintids.hxx:72
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:136
#define FN_DROP_TEXT
Definition: cmdid.h:793
void EndSelect()
Definition: select.cxx:429
const SfxItemPool & GetAttrPool() const
Definition: viewsh.hxx:614
bool IsSelection() const
Definition: crsrsh.hxx:883
#define FN_INSERT_HYPERLINK
Definition: cmdid.h:201
virtual FmFormShell * GetFormShell() override
Definition: view.hxx:565
const SwTableNode * IsCursorInTable() const
Definition: crsrsh.hxx:893
sal_uInt16 ClearItem(sal_uInt16 nWhich=0)
#define FN_CHAR_LEFT
Definition: cmdid.h:621
#define FN_NUMBERING_OUTLINE_DLG
Definition: cmdid.h:473
SwApplyTemplate * GetApplyTemplate() const
Definition: edtwin.hxx:230
SvtScriptType GetScriptType() const
returns the script type of the selection
Definition: edattr.cxx:666
bool HasSelection() const
Definition: wrtsh.hxx:141
#define SW_MOD()
Definition: swmodule.hxx:256
bool SelWrd(const Point *=nullptr)
Definition: select.cxx:77
void sw_CharDialog(SwWrtShell &rWrtSh, bool bUseDialog, sal_uInt16 nSlot, const SfxItemSet *pArgs, SfxRequest *pReq)
Definition: textsh1.cxx:136
void AutoFormat(const SvxSwAutoFormatFlags *pAFlags)
Set our styles according to the respective rules.
Definition: autofmt.cxx:2677
#define RES_CHRATR_BACKGROUND
Definition: hintids.hxx:90
Shell * GetShell()
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
SW_DLLPUBLIC FieldUnit GetDfltMetric(bool bWeb)
Definition: uitool.cxx:709
void ClickToINetAttr(const SwFormatINetFormat &rItem, LoadUrlFlags nFilter=LoadUrlFlags::NONE)
Definition: wrtsh2.cxx:444
#define FN_INSERT_TABLE
Definition: cmdid.h:208
void Insert2(const OUString &, const bool bForceExpandHints=false)
Definition: editsh.cxx:79
OUString StringToReplace()
void EndAction(const bool bIdleEnd=false, const bool DoSetPosX=false)
Definition: crsrsh.cxx:228
sal_uInt16 GetModifier() const
bool EndAllTableBoxEdit()
Definition: trvltbl.cxx:914
Window class for the Writer edit area, this is the one handling mouse and keyboard events and doing t...
Definition: edtwin.hxx:58
static SwSmartTagMgr & Get()
#define LANGUAGE_SYSTEM
virtual VclPtr< VclAbstractDialog > CreateDateFormFieldDialog(weld::Widget *pParent, sw::mark::IDateFieldmark *pDateField, SwDoc *pDoc)=0
void Push()
store a copy of the current cursor on the cursor stack
Definition: crsrsh.cxx:2221
OUString sName
SfxBindings & GetBindings()
int i
void SetAttrItem(const SfxPoolItem &, SetAttrMode nFlags=SetAttrMode::DEFAULT, const bool bParagraphSetting=false)
Definition: edatmisc.cxx:112
QPRO_FUNC_TYPE const nType
void ResetLanguages(SwWrtShell &rWrtSh, OutlinerView const *pOLV=nullptr)
Definition: langhelper.cxx:365
::sw::mark::IMark * SetBookmark(const vcl::KeyCode &, const OUString &rName, IDocumentMarkAccess::MarkType eMark=IDocumentMarkAccess::MarkType::BOOKMARK)
Definition: crbm.cxx:80
const OUString & GetValue() const
sal_uInt16 Count() const
HTMLMODE_ON
FrameTypeFlags
values can be combined via logical or
Definition: fesh.hxx:62
sal_uInt16 GetHtmlMode(const SwDocShell *pShell)
Definition: viewopt.cxx:340
const T * GetArg(sal_uInt16 nSlotId) const
void SetReadonlySelectionOption(bool bSet)
Definition: viewsh.cxx:2347
bool SelectTextAttr(sal_uInt16 nWhich, const SwTextAttr *pAttr=nullptr)
Definition: move.cxx:675
void MoveLeftMargin(bool bRight, bool bModulus=true)
Definition: edattr.cxx:550
virtual const SwDrawModel * GetDrawModel() const =0
Draw Model and id accessors.
SwUndoId StartUndo(SwUndoId eUndoId=SwUndoId::EMPTY, const SwRewriter *pRewriter=nullptr)
Undo: set up Undo parenthesis, return nUndoId of this parenthesis.
Definition: edws.cxx:222
bool DontExpandFormat()
If Cursor is at the end of a character style in which the DontExpand-flag is not yet set...
Definition: editsh.cxx:733
#define FN_FORMAT_APPLY_HEAD3
Definition: cmdid.h:463
#define FN_INSERT_BREAK_DLG
Definition: cmdid.h:190
XGradientListRef GetGradientList() const
SwField * GetCurField()
Definition: fldmgr.cxx:433
bool MoveParagraph(long nOffset=1)
Definition: ednumber.cxx:395
void AddRule(SwUndoArg eWhat, const OUString &rWith)
Definition: SwRewriter.cxx:29
#define RES_CHRATR_BEGIN
Definition: hintids.hxx:69
virtual void SetCurPageId(const OString &rName)=0
bool IsInWord(sal_Int16 nWordType=css::i18n::WordType::ANYWORD_IGNOREWHITESPACES) const
Definition: crstrvl1.cxx:36
#define FN_INSERT_PAGEHEADER
Definition: cmdid.h:267
#define LANGUAGE_DONTKNOW
void SetLanguage_None(SwWrtShell &rWrtSh, bool bIsForSelection, SfxItemSet &rCoreSet)
Definition: langhelper.cxx:305
void InsertThesaurusSynonym(const OUString &rSynonmText, const OUString &rLookUpText, bool bValidSelection)
Definition: viewling.cxx:496
void SetMark()
Definition: crsrsh.hxx:879
static SwAbstractDialogFactory * Create()
Definition: swabstdlg.cxx:36
void SelectCurrentPara(SwWrtShell &rWrtSh)
Definition: langhelper.cxx:573
long ResetSelect(const Point *, bool)
Definition: select.cxx:337
#define FN_WORDCOUNT_DIALOG
Definition: cmdid.h:575
#define RES_UNKNOWNATR_BEGIN
Definition: hintids.hxx:268
bool IsSttOfPara() const
Definition: wrtsh.hxx:189
GUIDCNamePair const aData
#define FN_FORMAT_APPLY_HEAD1
Definition: cmdid.h:461
OUString SwResId(const char *pId)
Definition: swmodule.cxx:190
bool DelLeft()
Definition: delete.cxx:129
tuple index
#define XATTR_FILLSTYLE
bool IsAutoUpdateFormat() const
Query / set bAutoUpdateFormat-flag.
Definition: format.hxx:168
OUString GetThesaurusLookUpText(bool bSelection) const
Definition: viewling.cxx:491
bool HasReadonlySel() const
Definition: crsrsh.cxx:3312
void SelAll()
Definition: select.cxx:127
void UnProtectTables()
Unprotect all tables in selection.
Definition: fetab.cxx:943
SW_DLLPUBLIC void MakeDefTabs(SwTwips nDefDist, SvxTabStopItem &rTabs)
Definition: uitool.cxx:592
#define FN_INSERT_PAGEFOOTER
Definition: cmdid.h:268
#define RES_TXTATR_INETFMT
Definition: hintids.hxx:142
void UpdateTable()
update fields of a listing
Definition: edtab.cxx:256
#define FN_SELECT_PARA
Definition: cmdid.h:117
void InvalidateWindows(const SwRect &rRect)
Definition: viewsh.cxx:552
static void CopyStringTo(const OUString &rContent, const css::uno::Reference< css::datatransfer::clipboard::XClipboard > &rxClipboard)
SwDocShell * GetDocShell()
Definition: view.cxx:1128
#define FN_FORMAT_APPLY_TEXTBODY
Definition: cmdid.h:465
SwFrameFormat * GetTableFormat()
Definition: edws.cxx:182
void SetStringList(const css::uno::Sequence< OUString > &rList)
#define FN_SELECTION_MODE_DEFAULT
Definition: cmdid.h:704
#define FN_INSERT_STRING
Definition: cmdid.h:209
bool SelectionHasBullet() const
Definition: ednumber.cxx:198
bool GetPaMAttr(SwPaM *pPaM, SfxItemSet &, const bool bMergeIndentValuesOfNumRule=false) const
Apply / remove attributes.
Definition: edattr.cxx:58
#define FN_INSERT_FOOTNOTE
Definition: cmdid.h:256
#define FN_INC_INDENT_OFFSET
Definition: cmdid.h:455
#define FN_DEC_INDENT_OFFSET
Definition: cmdid.h:456
#define RES_LR_SPACE
Definition: hintids.hxx:198
bool IsRubyEnabled() const
#define FN_DROP_CHAR_STYLE_NAME
Definition: cmdid.h:794
void reset(reference_type *pBody)
void StartAction()
Definition: crsrsh.cxx:211
bool IsStartWord(sal_Int16 nWordType=css::i18n::WordType::ANYWORD_IGNOREWHITESPACES) const
Definition: crstrvl1.cxx:27
SelectionType
Definition: wrtsh.hxx:58
OString OUStringToOString(const OUString &str, ConnectionSettings const *settings)
const LanguageTag & GetAppLanguageTag()
Definition: init.cxx:736
void Update(sal_uInt16 nId)
OUString GetCurWord() const
request current word
Definition: editsh.cxx:409
const OUString & GetApplicationName() const
void InsertFootnote(const OUString &, bool bEndNote=false, bool bEdit=true)
Definition: wrtsh1.cxx:966
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
SwFieldTypesEnum GetTypeId() const
Definition: fldbas.cxx:199
sal_uInt16 GetSlot() const
bool IsMultiSelection() const
Definition: crsrsh.hxx:888
bool HasChildWindow(sal_uInt16)
#define FN_PARAM_SELECTION
Definition: cmdid.h:776
XHatchListRef GetHatchList() const
void DisableItem(sal_uInt16 nWhich)
weld::Window * GetFrameWeld() const
bool IsMoveLeftMargin(bool bRight, bool bModulus=true) const
Adjust left margin via object bar (similar to adjustment of numerations).
Definition: edattr.cxx:501
#define FN_NUMBER_NEWSTART
Definition: cmdid.h:440
bool Left(sal_uInt16 nMode, bool bSelect, sal_uInt16 nCount, bool bBasicCall, bool bVisual=false)
Definition: move.cxx:102
bool AllowMoreInput(sal_Unicode uChar)
HTMLMODE_SOME_STYLES
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
#define FN_CHAR_RIGHT
Definition: cmdid.h:622
#define RES_CHRATR_CTL_LANGUAGE
Definition: hintids.hxx:98
unsigned char sal_uInt8
void EndPara(bool bSelect=false)
Definition: move.cxx:354
void GetSmartTagTerm(std::vector< OUString > &rSmartTagTypes, css::uno::Sequence< css::uno::Reference< css::container::XStringKeyMap > > &rStringKeyMaps, css::uno::Reference< css::text::XTextRange > &rRange) const
Definition: crsrsh.cxx:3673
void LockView(bool b)
Definition: viewsh.hxx:465
#define GetWhich(nSlot)
const SwViewOption * GetViewOptions() const
Definition: viewsh.hxx:426
bool ExtendSelection(bool bEnd=true, sal_Int32 nCount=1)
extend current SSelection by n characters
Definition: crsrsh.cxx:2589
const o3tl::enumarray< SvxAdjust, unsigned short > aSvxToUnoAdjust USHRT_MAX
Definition: unosett.cxx:261
OUString GetSelText() const
get selected text of a node at current cursor
Definition: crsrsh.cxx:2507
#define FN_FORMAT_APPLY_HEAD2
Definition: cmdid.h:462
sal_Int32 GetIndex() const
Definition: index.hxx:95
uno::Reference< linguistic2::XThesaurus > GetThesaurus()
Definition: swtypes.cxx:55
RET_OK
#define FN_PARAM_PAM
Definition: cmdid.h:802
void SetNumRuleStart(bool bFlag, SwPaM *pCursor)
Set (and query if) a numbering with StartFlag starts at current PointPos.
Definition: ednumber.cxx:834
void ShowCursor()
Definition: crsrsh.cxx:2371
#define RES_CHRATR_HIGHLIGHT
Definition: hintids.hxx:111
void NumUpDown(bool bDown=true)
Definition: ednumber.cxx:307
const SwGetSetExpType GSE_FORMULA
Formula.
Definition: fldbas.hxx:199
#define FN_PARAM_MOVE_COUNT
Definition: cmdid.h:739
#define FN_INSERT_PAGEBREAK
Definition: cmdid.h:206
LanguageType GetCurrentLanguage(SfxItemSet const &aSet, SvtScriptType nScriptType)
Definition: langhelper.cxx:481
virtual bool get(DocumentSettingId id) const =0
Return the specified document setting.
void ClearMark()
Definition: crsrsh.cxx:926
void InsertColumnBreak()
Definition: wrtsh1.cxx:943
bool GetCurAttr(SfxItemSet &, const bool bMergeIndentValuesOfNumRule=false) const
Definition: edattr.cxx:176
void SetLanguage(SwWrtShell &rWrtSh, const OUString &rLangText, bool bIsForSelection, SfxItemSet &rCoreSet)
Definition: langhelper.cxx:223
#define FN_TXTATR_INET
Definition: cmdid.h:712
SwTextFormatColl * GetPaMTextFormatColl(SwPaM *pPaM) const
Get the named paragraph format of the selection(s) described by a SwPaM.
Definition: edattr.cxx:250
static OUString GetLanguageString(const LanguageType eType)
const tools::Rectangle & GetVisArea() const
Definition: view.hxx:413
void Execute(SfxRequest &)
const SwNumRule * SearchNumRule(const bool bNum, OUString &sListId)
Searches for a text node with a numbering rule.
Definition: ednumber.cxx:906
#define FN_FORMAT_FOOTNOTE_DLG
Definition: cmdid.h:307
XBitmapListRef GetBitmapList() const
#define ODF_FORMDATE
void AutoCorrect(SvxAutoCorrect &rACorr, sal_Unicode cChar)
Definition: wrtsh1.cxx:1640
SW_DLLPUBLIC void PrepareBoxInfo(SfxItemSet &rSet, const SwWrtShell &rSh)
Definition: uitool.cxx:102
const sal_uInt16 CRSR_SKIP_CHARS
Definition: swcrsr.hxx:63
static weld::Builder * CreateBuilder(weld::Widget *pParent, const OUString &rUIFile)
virtual OUString GetFieldname() const =0
void InvalidateAll(bool bWithMsg)
void AppendItem(const SfxPoolItem &)
static void sw_ParagraphDialogResult(SfxItemSet *pSet, SwWrtShell &rWrtSh, SfxRequest &rReq, SwPaM *pPaM)
Definition: textsh1.cxx:284
#define RES_PARATR_DROP
Definition: hintids.hxx:169
bool IsAPI() const
bool IsAddMode() const
Definition: wrtsh.hxx:156
#define FN_AUTO_CORRECT
Definition: cmdid.h:485
void ResetAttr(const std::set< sal_uInt16 > &attrs=std::set< sal_uInt16 >(), SwPaM *pCursor=nullptr)
Definition: edatmisc.cxx:32
#define RES_UNKNOWNATR_END
Definition: hintids.hxx:270
XColorListRef GetColorList() const
#define FN_NUM_BULLET_MOVEUP
Definition: cmdid.h:84
virtual VclPtr< SfxAbstractTabDialog > CreateSwCharDlg(weld::Window *pParent, SwView &pVw, const SfxItemSet &rCoreSet, SwCharDlgMode nDialogMode, const OUString *pFormatStr=nullptr)=0
LanguageType GetInputLanguage() const
SelectionType GetSelectionType() const
Definition: wrtsh1.cxx:1406
void StartAllAction()
For all views of this document.
Definition: edws.cxx:85
#define FN_NUMBER_NEWSTART_AT
Definition: cmdid.h:441
sal_uInt16 GetScalingOfSelectedText() const
Definition: edattr.cxx:828
bool IsSelOnePara() const
Definition: crsrsh.cxx:1063
OUString GetTextForLanguageGuessing(EditEngine const *rEditEngine, const ESelection &rDocSelection)
Definition: langhelper.cxx:547
sal_Int32 nPos
void Ignore()
virtual VclPtr< SfxAbstractTabDialog > CreateSwParaDlg(weld::Window *pParent, SwView &rVw, const SfxItemSet &rCoreSet, bool bDraw, const OString &sDefPage=OString())=0
#define RES_FRMATR_BEGIN
Definition: hintids.hxx:194
void ReplaceDropText(const OUString &rStr, SwPaM *pPaM=nullptr)
Definition: editsh.cxx:503
SvNumberFormatter * GetNumberFormatter()
Query NumberFormatter from document.
Definition: editsh.cxx:744
SW_DLLPUBLIC void ConvertAttrGenToChar(SfxItemSet &rSet, const SfxItemSet &rOrigSet)
Convert general attributes to the corresponding character attributes.
Definition: uitool.cxx:161
#define FN_REDLINE_ACCEPT
Definition: cmdid.h:129
aStr
Fieldmark representing a drop-down form field.
Definition: bookmrk.hxx:289
virtual VclPtr< AbstractInsFootNoteDlg > CreateInsFootNoteDlg(weld::Window *pParent, SwWrtShell &rSh, bool bEd=false)=0
FrameTypeFlags GetFrameType(const Point *pPt, bool bStopAtFly) const
For return values see above FrameType.
Definition: fews.cxx:236
sal_uInt16 nColor
Definition: view.hxx:119
Definition: view.hxx:146
#define FN_PARAM_MOVE_SELECTION
Definition: cmdid.h:740
#define ODF_FORMDROPDOWN
#define FN_FORMAT_DROPCAPS
Definition: cmdid.h:301
#define RES_PARATR_END
Definition: hintids.hxx:181
bool IsSelectionInReadonly() const
Definition: viewopt.hxx:427
#define FN_FORMAT_APPLY_DEFAULT
Definition: cmdid.h:464
bool CursorInsideInputField() const
Definition: crstrvl.cxx:948