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