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