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