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