LibreOffice Module sw (master)  1
drwtxtex.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 
21 #include <com/sun/star/linguistic2/XThesaurus.hpp>
22 
23 #include <comphelper/string.hxx>
24 #include <sfx2/bindings.hxx>
25 #include <sfx2/dispatch.hxx>
26 #include <sfx2/request.hxx>
27 #include <svx/svdview.hxx>
28 #include <editeng/spltitem.hxx>
29 #include <editeng/lrspitem.hxx>
30 #include <editeng/ulspitem.hxx>
31 #include <editeng/orphitem.hxx>
33 #include <editeng/widwitem.hxx>
34 #include <editeng/kernitem.hxx>
36 #include <editeng/lspcitem.hxx>
37 #include <editeng/flstitem.hxx>
38 #include <editeng/adjustitem.hxx>
39 #include <editeng/udlnitem.hxx>
40 #include <editeng/fhgtitem.hxx>
41 #include <editeng/colritem.hxx>
42 #include <editeng/frmdiritem.hxx>
44 #include <svx/svdoutl.hxx>
45 #include <sfx2/viewfrm.hxx>
46 #include <svl/stritem.hxx>
47 #include <svl/whiter.hxx>
48 #include <svl/cjkoptions.hxx>
49 #include <svl/ctloptions.hxx>
50 #include <svl/languageoptions.hxx>
51 #include <editeng/flditem.hxx>
52 #include <editeng/editstat.hxx>
53 #include <svx/clipfmtitem.hxx>
54 #include <svx/hlnkitem.hxx>
55 #include <svx/svxdlg.hxx>
56 #include <sfx2/htmlmode.hxx>
57 #include <editeng/langitem.hxx>
60 #include <editeng/eeitem.hxx>
61 #include <editeng/editdata.hxx>
62 #include <editeng/outliner.hxx>
63 #include <editeng/editview.hxx>
64 #include <vcl/unohelp2.hxx>
66 
67 #include <cmdid.h>
68 #include <doc.hxx>
69 #include <drwtxtsh.hxx>
70 #include <edtwin.hxx>
71 #include <hintids.hxx>
72 #include <langhelper.hxx>
73 #include <chrdlgmodes.hxx>
74 #include <swmodule.hxx>
75 #include <uitool.hxx>
76 #include <viewopt.hxx>
77 #include <wrtsh.hxx>
78 #include <wview.hxx>
79 
80 #include <swabstdlg.hxx>
81 #include <memory>
82 
83 using namespace ::com::sun::star;
84 
85 namespace
86 {
87  void lcl_convertStringArguments(sal_uInt16 nSlot, const std::unique_ptr<SfxItemSet>& pArgs)
88  {
89  Color aColor;
90  OUString sColor;
91  const SfxPoolItem* pItem = nullptr;
92 
93  if (SfxItemState::SET != pArgs->GetItemState(SID_ATTR_COLOR_STR, false, &pItem))
94  return;
95 
96  sColor = static_cast<const SfxStringItem*>(pItem)->GetValue();
97 
98  if (sColor == "transparent")
99  aColor = COL_TRANSPARENT;
100  else
101  aColor = Color(sColor.toInt32(16));
102 
103  switch (nSlot)
104  {
105  case SID_ATTR_CHAR_COLOR:
106  {
107  SvxColorItem aColorItem(aColor, EE_CHAR_COLOR);
108  pArgs->Put(aColorItem);
109  break;
110  }
111 
112  case SID_ATTR_CHAR_BACK_COLOR:
113  {
114  SvxBackgroundColorItem pBackgroundItem(aColor, EE_CHAR_BKGCOLOR);
115  pArgs->Put(pBackgroundItem);
116  break;
117  }
118  }
119  }
120 }
121 
123 {
124  SwWrtShell &rSh = GetShell();
126  SfxItemSet aEditAttr(pOLV->GetAttribs());
127  SfxItemSet aNewAttr(*aEditAttr.GetPool(), aEditAttr.GetRanges());
128 
129  const sal_uInt16 nSlot = rReq.GetSlot();
130 
131  const sal_uInt16 nWhich = GetPool().GetWhich(nSlot);
132  std::unique_ptr<SfxItemSet> pNewAttrs(rReq.GetArgs() ? rReq.GetArgs()->Clone() : nullptr);
133 
134  bool bRestoreSelection = false;
135  ESelection aOldSelection;
136 
137  sal_uInt16 nEEWhich = 0;
138  switch (nSlot)
139  {
140  case SID_LANGUAGE_STATUS:
141  {
142  aOldSelection = pOLV->GetSelection();
143  if (!pOLV->GetEditView().HasSelection())
144  {
145  pOLV->GetEditView().SelectCurrentWord();
146  }
147 
148  bRestoreSelection = SwLangHelper::SetLanguageStatus(pOLV,rReq,GetView(),rSh);
149  break;
150  }
151 
152  case SID_THES:
153  {
154  OUString aReplaceText;
155  const SfxStringItem* pItem2 = rReq.GetArg<SfxStringItem>(SID_THES);
156  if (pItem2)
157  aReplaceText = pItem2->GetValue();
158  if (!aReplaceText.isEmpty())
159  ReplaceTextWithSynonym( pOLV->GetEditView(), aReplaceText );
160  break;
161  }
162 
163  case SID_ATTR_CHAR_FONT:
164  case SID_ATTR_CHAR_FONTHEIGHT:
165  case SID_ATTR_CHAR_WEIGHT:
166  case SID_ATTR_CHAR_POSTURE:
167  {
168  SfxItemPool* pPool2 = aEditAttr.GetPool()->GetSecondaryPool();
169  if( !pPool2 )
170  pPool2 = aEditAttr.GetPool();
171  SvxScriptSetItem aSetItem( nSlot, *pPool2 );
172 
173  // #i78017 establish the same behaviour as in Writer
174  SvtScriptType nScriptTypes = SvtScriptType::LATIN | SvtScriptType::ASIAN | SvtScriptType::COMPLEX;
175  if (nSlot == SID_ATTR_CHAR_FONT)
176  nScriptTypes = pOLV->GetSelectedScriptType();
177 
178  if (pNewAttrs)
179  {
180  aSetItem.PutItemForScriptType( nScriptTypes, pNewAttrs->Get( nWhich ) );
181  aNewAttr.Put( aSetItem.GetItemSet() );
182  }
183  }
184  break;
185 
186  case SID_ATTR_CHAR_COLOR: nEEWhich = EE_CHAR_COLOR; break;
187  case SID_ATTR_CHAR_BACK_COLOR: nEEWhich = EE_CHAR_BKGCOLOR; break;
188 
189  case SID_ATTR_CHAR_UNDERLINE:
190  {
191  if ( pNewAttrs )
192  {
193  const SvxTextLineItem& rTextLineItem = static_cast< const SvxTextLineItem& >( pNewAttrs->Get( pNewAttrs->GetPool()->GetWhich(nSlot) ) );
194  aNewAttr.Put( SvxUnderlineItem( rTextLineItem.GetLineStyle(), EE_CHAR_UNDERLINE ) );
195  }
196  else
197  {
198  FontLineStyle eFU = aEditAttr.Get(EE_CHAR_UNDERLINE).GetLineStyle();
200  }
201  }
202  break;
203 
204  case SID_ATTR_CHAR_OVERLINE:
205  {
206  FontLineStyle eFO = aEditAttr.Get(EE_CHAR_OVERLINE).GetLineStyle();
208  }
209  break;
210 
211  case SID_ATTR_CHAR_CONTOUR: nEEWhich = EE_CHAR_OUTLINE; break;
212  case SID_ATTR_CHAR_SHADOWED: nEEWhich = EE_CHAR_SHADOW; break;
213  case SID_ATTR_CHAR_STRIKEOUT: nEEWhich = EE_CHAR_STRIKEOUT; break;
214  case SID_ATTR_CHAR_WORDLINEMODE: nEEWhich = EE_CHAR_WLM; break;
215  case SID_ATTR_CHAR_RELIEF : nEEWhich = EE_CHAR_RELIEF; break;
216  case SID_ATTR_CHAR_LANGUAGE : nEEWhich = EE_CHAR_LANGUAGE;break;
217  case SID_ATTR_CHAR_KERNING : nEEWhich = EE_CHAR_KERNING; break;
218  case SID_ATTR_CHAR_SCALEWIDTH: nEEWhich = EE_CHAR_FONTWIDTH; break;
219  case SID_ATTR_CHAR_AUTOKERN : nEEWhich = EE_CHAR_PAIRKERNING; break;
220  case SID_ATTR_CHAR_ESCAPEMENT: nEEWhich = EE_CHAR_ESCAPEMENT; break;
221  case SID_ATTR_PARA_ADJUST_LEFT:
222  aNewAttr.Put(SvxAdjustItem(SvxAdjust::Left, EE_PARA_JUST));
223  break;
224  case SID_ATTR_PARA_ADJUST_CENTER:
225  aNewAttr.Put(SvxAdjustItem(SvxAdjust::Center, EE_PARA_JUST));
226  break;
227  case SID_ATTR_PARA_ADJUST_RIGHT:
228  aNewAttr.Put(SvxAdjustItem(SvxAdjust::Right, EE_PARA_JUST));
229  break;
230  case SID_ATTR_PARA_ADJUST_BLOCK:
231  aNewAttr.Put(SvxAdjustItem(SvxAdjust::Block, EE_PARA_JUST));
232  break;
233  case SID_ATTR_PARA_LRSPACE:
234  {
235  SvxLRSpaceItem aParaMargin(static_cast<const SvxLRSpaceItem&>(rReq.
236  GetArgs()->Get(nSlot)));
237  aParaMargin.SetWhich( EE_PARA_LRSPACE );
238  aNewAttr.Put(aParaMargin);
239  rReq.Done();
240  }
241  break;
242  case SID_HANGING_INDENT:
243  {
244  SfxItemState eState = aEditAttr.GetItemState( EE_PARA_LRSPACE );
245  if( eState >= SfxItemState::DEFAULT )
246  {
247  SvxLRSpaceItem aParaMargin = aEditAttr.Get( EE_PARA_LRSPACE );
248  aParaMargin.SetWhich( EE_PARA_LRSPACE );
249  short int nFirstLineOffset = aParaMargin.GetTextFirstLineOffset();
250  aParaMargin.SetTextLeft( aParaMargin.GetTextLeft() + nFirstLineOffset );
251  aParaMargin.SetRight( aParaMargin.GetRight() );
252  aParaMargin.SetTextFirstLineOffset( nFirstLineOffset * -1 );
253  aNewAttr.Put(aParaMargin);
254  rReq.Done();
255  }
256  }
257  break;
258  case SID_ATTR_PARA_LINESPACE:
259  {
260  SvxLineSpacingItem aLineSpace = static_cast<const SvxLineSpacingItem&>(pNewAttrs->Get(
261  GetPool().GetWhich(nSlot)));
262  aLineSpace.SetWhich( EE_PARA_SBL );
263  aNewAttr.Put( aLineSpace );
264  rReq.Done();
265  }
266  break;
267  case SID_ATTR_PARA_ULSPACE:
268  {
269  SvxULSpaceItem aULSpace = static_cast<const SvxULSpaceItem&>(pNewAttrs->Get(
270  GetPool().GetWhich(nSlot)));
271  aULSpace.SetWhich( EE_PARA_ULSPACE );
272  aNewAttr.Put( aULSpace );
273  rReq.Done();
274  }
275  break;
276  case SID_PARASPACE_INCREASE:
277  case SID_PARASPACE_DECREASE:
278  {
279  SvxULSpaceItem aULSpace( aEditAttr.Get( EE_PARA_ULSPACE ) );
280  sal_uInt16 nUpper = aULSpace.GetUpper();
281  sal_uInt16 nLower = aULSpace.GetLower();
282 
283  if ( nSlot == SID_PARASPACE_INCREASE )
284  {
285  nUpper = std::min< sal_uInt16 >( nUpper + 57, 5670 );
286  nLower = std::min< sal_uInt16 >( nLower + 57, 5670 );
287  }
288  else
289  {
290  nUpper = std::max< sal_Int16 >( nUpper - 57, 0 );
291  nLower = std::max< sal_Int16 >( nLower - 57, 0 );
292  }
293 
294  aULSpace.SetUpper( nUpper );
295  aULSpace.SetLower( nLower );
296  aNewAttr.Put( aULSpace );
297  rReq.Done();
298  }
299  break;
300  case SID_ATTR_PARA_LINESPACE_10:
301  {
303  aItem.SetPropLineSpace(100);
304  aNewAttr.Put(aItem);
305  }
306  break;
307  case SID_ATTR_PARA_LINESPACE_15:
308  {
310  aItem.SetPropLineSpace(150);
311  aNewAttr.Put(aItem);
312  }
313  break;
314  case SID_ATTR_PARA_LINESPACE_20:
315  {
317  aItem.SetPropLineSpace(200);
318  aNewAttr.Put(aItem);
319  }
320  break;
321 
322  case FN_SET_SUPER_SCRIPT:
323  {
325  SvxEscapement eEsc = static_cast<SvxEscapement>(aEditAttr.Get( EE_CHAR_ESCAPEMENT ).GetEnumValue());
326 
327  if( eEsc == SvxEscapement::Superscript )
328  aItem.SetEscapement( SvxEscapement::Off );
329  else
330  aItem.SetEscapement( SvxEscapement::Superscript );
331  aNewAttr.Put( aItem );
332  }
333  break;
334  case FN_SET_SUB_SCRIPT:
335  {
337  SvxEscapement eEsc = static_cast<SvxEscapement>(aEditAttr.Get( EE_CHAR_ESCAPEMENT ).GetEnumValue());
338 
339  if( eEsc == SvxEscapement::Subscript )
340  aItem.SetEscapement( SvxEscapement::Off );
341  else
342  aItem.SetEscapement( SvxEscapement::Subscript );
343  aNewAttr.Put( aItem );
344  }
345  break;
346 
347  case SID_CHAR_DLG_EFFECT:
348  case SID_CHAR_DLG:
349  case SID_CHAR_DLG_FOR_PARAGRAPH:
350  {
351  const SfxItemSet* pArgs = rReq.GetArgs();
352  const SfxStringItem* pItem = rReq.GetArg<SfxStringItem>(FN_PARAM_1);
353 
354  if( !pArgs || pItem )
355  {
356  aOldSelection = pOLV->GetSelection();
357  if (nSlot == SID_CHAR_DLG_FOR_PARAGRAPH)
358  {
359  // select current paragraph (and restore selection later on...)
360  EditView & rEditView = pOLV->GetEditView();
361  SwLangHelper::SelectPara( rEditView, rEditView.GetSelection() );
362  bRestoreSelection = true;
363  }
364 
365  SwView* pView = &GetView();
366  FieldUnit eMetric = ::GetDfltMetric(dynamic_cast<SwWebView*>( pView) != nullptr );
367  SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric)) );
369 
370  // util::Language does not exists in the EditEngine! That is why not in set.
371 
372  aDlgAttr.Put( aEditAttr );
373  aDlgAttr.Put( SvxKerningItem(0, RES_CHRATR_KERNING) );
374 
377  if (nSlot == SID_CHAR_DLG_EFFECT)
378  {
379  pDlg->SetCurPageId("fonteffects");
380  }
381  else if (nSlot == SID_CHAR_DLG_FOR_PARAGRAPH)
382  {
383  pDlg->SetCurPageId("font");
384  }
385  else if (pItem)
386  {
387  pDlg->SetCurPageId(OUStringToOString(pItem->GetValue(), RTL_TEXTENCODING_UTF8));
388  }
389 
390  sal_uInt16 nRet = pDlg->Execute();
391  if(RET_OK == nRet )
392  {
393  rReq.Done( *( pDlg->GetOutputItemSet() ) );
394  aNewAttr.Put(*pDlg->GetOutputItemSet());
395  }
396  if(RET_OK != nRet)
397  return ;
398  }
399  else
400  aNewAttr.Put(*pArgs);
401  }
402  break;
404  {
406  break;
407  }
409  {
411  rReq.Done();
412  }
413  break;
414  case SID_OPEN_XML_FILTERSETTINGS:
415  {
417  }
418  break;
419  case FN_WORDCOUNT_DIALOG:
420  {
421  GetView().UpdateWordCount(this, nSlot);
422  }
423  break;
424  case SID_PARA_DLG:
425  {
426  const SfxItemSet* pArgs = rReq.GetArgs();
427 
428  if (!pArgs)
429  {
430  SwView* pView = &GetView();
431  FieldUnit eMetric = ::GetDfltMetric(dynamic_cast<SwWebView*>( pView) != nullptr );
432  SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric)) );
433  SfxItemSet aDlgAttr(
434  GetPool(),
435  svl::Items<
437  SID_ATTR_PARA_HYPHENZONE, SID_ATTR_PARA_WIDOWS>{});
438 
439  aDlgAttr.Put(aEditAttr);
440 
441  aDlgAttr.Put( SvxHyphenZoneItem( false, RES_PARATR_HYPHENZONE) );
442  aDlgAttr.Put( SvxFormatBreakItem( SvxBreak::NONE, RES_BREAK ) );
443  aDlgAttr.Put( SvxFormatSplitItem( true, RES_PARATR_SPLIT ) );
444  aDlgAttr.Put( SvxWidowsItem( 0, RES_PARATR_WIDOWS ) );
445  aDlgAttr.Put( SvxOrphansItem( 0, RES_PARATR_ORPHANS ) );
446 
449  sal_uInt16 nRet = pDlg->Execute();
450  if(RET_OK == nRet)
451  {
452  rReq.Done( *( pDlg->GetOutputItemSet() ) );
453  aNewAttr.Put(*pDlg->GetOutputItemSet());
454  }
455  if(RET_OK != nRet)
456  return;
457  }
458  else
459  aNewAttr.Put(*pArgs);
460  }
461  break;
462  case SID_AUTOSPELL_CHECK:
463  {
466  SdrOutliner * pOutliner = pSdrView->GetTextEditOutliner();
467  EEControlBits nCtrl = pOutliner->GetControlWord();
468 
469  bool bSet = static_cast<const SfxBoolItem&>(rReq.GetArgs()->Get(
470  nSlot)).GetValue();
471  if(bSet)
472  nCtrl |= EEControlBits::ONLINESPELLING|EEControlBits::ALLOWBIGOBJS;
473  else
474  nCtrl &= ~EEControlBits::ONLINESPELLING;
475  pOutliner->SetControlWord(nCtrl);
476 
477  rView.ExecuteSlot(rReq);
478  }
479  break;
480  case SID_HYPERLINK_SETLINK:
481  {
482  const SfxPoolItem* pItem = nullptr;
483  if(pNewAttrs)
484  pNewAttrs->GetItemState(nSlot, false, &pItem);
485 
486  if(pItem)
487  {
488  const SvxHyperlinkItem& rHLinkItem = *static_cast<const SvxHyperlinkItem *>(pItem);
489  SvxURLField aField(rHLinkItem.GetURL(), rHLinkItem.GetName(), SvxURLFormat::AppDefault);
490  aField.SetTargetFrame(rHLinkItem.GetTargetFrame());
491 
492  const SvxFieldItem* pFieldItem = pOLV->GetFieldAtSelection();
493 
494  if (pFieldItem && dynamic_cast< const SvxURLField *>( pFieldItem->GetField() ) != nullptr )
495  {
496  // Select field so that it will be deleted during insert
497  ESelection aSel = pOLV->GetSelection();
498  aSel.nEndPos++;
499  pOLV->SetSelection(aSel);
500  }
501  pOLV->InsertField(SvxFieldItem(aField, EE_FEATURE_FIELD));
502  }
503  }
504  break;
505 
506  case SID_EDIT_HYPERLINK:
507  {
508  // Ensure the field is selected first
509  pOLV->SelectFieldAtCursor();
510  GetView().GetViewFrame()->GetDispatcher()->Execute(SID_HYPERLINK_DIALOG);
511  }
512  break;
513 
514  case SID_REMOVE_HYPERLINK:
515  {
517  }
518  break;
519 
520  case SID_OPEN_HYPERLINK:
521  {
522  const SvxFieldData* pField = pOLV->GetFieldAtCursor();
523  if (const SvxURLField* pURLField = dynamic_cast<const SvxURLField*>(pField))
524  {
525  SfxStringItem aUrl(SID_FILE_NAME, pURLField->GetURL());
526  SfxStringItem aTarget(SID_TARGETNAME, pURLField->GetTargetFrame());
527  SfxBoolItem aNewView(SID_OPEN_NEW_VIEW, false);
528  SfxBoolItem aBrowsing(SID_BROWSE, true);
530  SID_OPENDOC, SfxCallMode::SYNCHRON, { &aUrl, &aTarget, &aNewView, &aBrowsing });
531  }
532  }
533  break;
534 
535  case SID_COPY_HYPERLINK_LOCATION:
536  {
537  const SvxFieldData* pField = pOLV->GetFieldAtCursor();
538  if (const SvxURLField* pURLField = dynamic_cast<const SvxURLField*>(pField))
539  {
540  uno::Reference<datatransfer::clipboard::XClipboard> xClipboard
542  vcl::unohelper::TextDataObject::CopyStringTo(pURLField->GetURL(), xClipboard);
543  }
544  }
545  break;
546 
547  case SID_TEXTDIRECTION_LEFT_TO_RIGHT:
548  case SID_TEXTDIRECTION_TOP_TO_BOTTOM:
549  // Shell switch!
550  {
552  SdrPageView* pTmpPV = pSdrView->GetSdrPageView();
553  SdrView* pTmpView = pSdrView;
554 
555  pSdrView->SdrEndTextEdit(true);
556 
557  SfxItemSet aAttr( *aNewAttr.GetPool(),
559  SDRATTR_TEXTDIRECTION>{} );
560 
561  aAttr.Put( SvxWritingModeItem(
562  nSlot == SID_TEXTDIRECTION_LEFT_TO_RIGHT ?
563  text::WritingMode_LR_TB
564  : text::WritingMode_TB_RL, SDRATTR_TEXTDIRECTION ) );
565  pTmpView->SetAttributes( aAttr );
566 
567  rSh.GetView().BeginTextEdit( pTmpObj, pTmpPV, &rSh.GetView().GetEditWin());
568  rSh.GetView().AttrChangedNotify(nullptr);
569  }
570  return;
571 
572  case SID_ATTR_PARA_LEFT_TO_RIGHT:
573  case SID_ATTR_PARA_RIGHT_TO_LEFT:
574  {
576  SdrPageView* pTmpPV = pSdrView->GetSdrPageView();
577  SdrView* pTmpView = pSdrView;
578 
579  pSdrView->SdrEndTextEdit(true);
580  bool bLeftToRight = nSlot == SID_ATTR_PARA_LEFT_TO_RIGHT;
581 
582  const SfxPoolItem* pPoolItem;
583  if( pNewAttrs && SfxItemState::SET == pNewAttrs->GetItemState( nSlot, true, &pPoolItem ) )
584  {
585  if( !static_cast<const SfxBoolItem*>(pPoolItem)->GetValue() )
586  bLeftToRight = !bLeftToRight;
587  }
588  SfxItemSet aAttr(
589  *aNewAttr.GetPool(),
590  svl::Items<
591  EE_PARA_WRITINGDIR, EE_PARA_WRITINGDIR,
592  EE_PARA_JUST, EE_PARA_JUST>{});
593 
594  SvxAdjust nAdjust = SvxAdjust::Left;
595  if( SfxItemState::SET == aEditAttr.GetItemState(EE_PARA_JUST, true, &pPoolItem ) )
596  nAdjust = static_cast<const SvxAdjustItem*>(pPoolItem)->GetAdjust();
597 
598  if( bLeftToRight )
599  {
600  aAttr.Put( SvxFrameDirectionItem( SvxFrameDirection::Horizontal_LR_TB, EE_PARA_WRITINGDIR ) );
601  if( nAdjust == SvxAdjust::Right )
602  aAttr.Put( SvxAdjustItem( SvxAdjust::Left, EE_PARA_JUST ) );
603  }
604  else
605  {
606  aAttr.Put( SvxFrameDirectionItem( SvxFrameDirection::Horizontal_RL_TB, EE_PARA_WRITINGDIR ) );
607  if( nAdjust == SvxAdjust::Left )
608  aAttr.Put( SvxAdjustItem( SvxAdjust::Right, EE_PARA_JUST ) );
609  }
610  pTmpView->SetAttributes( aAttr );
611  rSh.GetView().BeginTextEdit( pTmpObj, pTmpPV, &rSh.GetView().GetEditWin() );
612  rSh.GetView().AttrChangedNotify(nullptr);
613  }
614  return;
615 
616  case FN_GROW_FONT_SIZE:
617  case FN_SHRINK_FONT_SIZE:
618  {
619  const SvxFontListItem* pFontListItem = static_cast< const SvxFontListItem* >
620  ( SfxObjectShell::Current()->GetItem( SID_ATTR_CHAR_FONTLIST ) );
621  const FontList* pFontList = pFontListItem ? pFontListItem->GetFontList() : nullptr;
622  pOLV->GetEditView().ChangeFontSize( nSlot == FN_GROW_FONT_SIZE, pFontList );
623  }
624  break;
625 
626  default:
627  assert(false && "wrong dispatcher");
628  return;
629  }
630  if (nEEWhich && pNewAttrs)
631  {
632  lcl_convertStringArguments(nSlot, pNewAttrs);
633 
634  aNewAttr.Put(pNewAttrs->Get(nWhich).CloneSetWhich(nEEWhich));
635  }
636 
637  SetAttrToMarked(aNewAttr);
638 
640 
641  if (IsTextEdit() && pOLV->GetOutliner()->IsModified())
642  rSh.SetModified();
643 
644  if (bRestoreSelection)
645  {
646  // restore selection
647  pOLV->GetEditView().SetSelection( aOldSelection );
648  }
649 }
650 
652 {
653  if (!IsTextEdit()) // Otherwise sometimes crash!
654  return;
655 
657  SfxWhichIter aIter(rSet);
658  sal_uInt16 nWhich = aIter.FirstWhich();
659 
660  SfxItemSet aEditAttr(pOLV->GetAttribs());
661  const SfxPoolItem *pAdjust = nullptr, *pLSpace = nullptr, *pEscItem = nullptr;
662  SvxAdjust eAdjust;
663  int nLSpace;
664  SvxEscapement nEsc;
665 
666  while (nWhich)
667  {
668  sal_uInt16 nSlotId = GetPool().GetSlotId(nWhich);
669  bool bFlag = false;
670  switch (nSlotId)
671  {
672  case SID_LANGUAGE_STATUS: //20412:
673  {
675  nSlotId = 0;
676  break;
677  }
678 
679  case SID_THES:
680  {
681  OUString aStatusVal;
683  bool bIsLookUpWord
684  = GetStatusValueForThesaurusFromContext(aStatusVal, nLang, pOLV->GetEditView());
685  rSet.Put(SfxStringItem(SID_THES, aStatusVal));
686 
687  // disable "Thesaurus" context menu entry if there is nothing to look up
688  uno::Reference<linguistic2::XThesaurus> xThes(::GetThesaurus());
689  if (!bIsLookUpWord || !xThes.is() || nLang == LANGUAGE_NONE
690  || !xThes->hasLocale(LanguageTag::convertToLocale(nLang)))
691  rSet.DisableItem(SID_THES);
692 
694  nSlotId = 0;
695  break;
696  }
697 
698  case SID_ATTR_PARA_ADJUST_LEFT:
699  eAdjust = SvxAdjust::Left;
700  goto ASK_ADJUST;
701  case SID_ATTR_PARA_ADJUST_RIGHT:
702  eAdjust = SvxAdjust::Right;
703  goto ASK_ADJUST;
704  case SID_ATTR_PARA_ADJUST_CENTER:
705  eAdjust = SvxAdjust::Center;
706  goto ASK_ADJUST;
707  case SID_ATTR_PARA_ADJUST_BLOCK:
708  eAdjust = SvxAdjust::Block;
709  goto ASK_ADJUST;
710  ASK_ADJUST:
711  {
712  if (!pAdjust)
713  aEditAttr.GetItemState(EE_PARA_JUST, false, &pAdjust);
714 
715  if (!pAdjust || IsInvalidItem(pAdjust))
716  {
717  rSet.InvalidateItem(nSlotId);
718  nSlotId = 0;
719  }
720  else
721  bFlag = eAdjust == static_cast<const SvxAdjustItem*>(pAdjust)->GetAdjust();
722  }
723  break;
724 
725  case SID_ATTR_PARA_LRSPACE:
726  case SID_ATTR_PARA_LEFTSPACE:
727  case SID_ATTR_PARA_RIGHTSPACE:
728  case SID_ATTR_PARA_FIRSTLINESPACE:
729  {
730  SfxItemState eState = aEditAttr.GetItemState(EE_PARA_LRSPACE);
731  if (eState >= SfxItemState::DEFAULT)
732  {
733  SvxLRSpaceItem aLR = aEditAttr.Get(EE_PARA_LRSPACE);
734  aLR.SetWhich(SID_ATTR_PARA_LRSPACE);
735  rSet.Put(aLR);
736  }
737  else
738  rSet.InvalidateItem(nSlotId);
739  nSlotId = 0;
740  }
741  break;
742  case SID_ATTR_PARA_LINESPACE:
743  {
744  SfxItemState eState = aEditAttr.GetItemState(EE_PARA_SBL);
745  if (eState >= SfxItemState::DEFAULT)
746  {
747  const SvxLineSpacingItem& aLR = aEditAttr.Get(EE_PARA_SBL);
748  rSet.Put(aLR);
749  }
750  else
751  rSet.InvalidateItem(nSlotId);
752  nSlotId = 0;
753  }
754  break;
755  case SID_ATTR_PARA_ULSPACE:
756  case SID_ATTR_PARA_BELOWSPACE:
757  case SID_ATTR_PARA_ABOVESPACE:
758  case SID_PARASPACE_INCREASE:
759  case SID_PARASPACE_DECREASE:
760  {
761  SfxItemState eState = aEditAttr.GetItemState(EE_PARA_ULSPACE);
762  if (eState >= SfxItemState::DEFAULT)
763  {
764  SvxULSpaceItem aULSpace = aEditAttr.Get(EE_PARA_ULSPACE);
765  if (!aULSpace.GetUpper() && !aULSpace.GetLower())
766  rSet.DisableItem(SID_PARASPACE_DECREASE);
767  else if (aULSpace.GetUpper() >= 5670 && aULSpace.GetLower() >= 5670)
768  rSet.DisableItem(SID_PARASPACE_INCREASE);
769  if (nSlotId == SID_ATTR_PARA_ULSPACE || nSlotId == SID_ATTR_PARA_ABOVESPACE
770  || nSlotId == SID_ATTR_PARA_BELOWSPACE)
771  {
772  aULSpace.SetWhich(nSlotId);
773  rSet.Put(aULSpace);
774  }
775  }
776  else
777  {
778  rSet.DisableItem(SID_PARASPACE_INCREASE);
779  rSet.DisableItem(SID_PARASPACE_DECREASE);
780  rSet.InvalidateItem(SID_ATTR_PARA_ULSPACE);
781  rSet.InvalidateItem(SID_ATTR_PARA_ABOVESPACE);
782  rSet.InvalidateItem(SID_ATTR_PARA_BELOWSPACE);
783  }
784  nSlotId = 0;
785  }
786  break;
787 
788  case SID_ATTR_PARA_LINESPACE_10:
789  nLSpace = 100;
790  goto ASK_LINESPACE;
791  case SID_ATTR_PARA_LINESPACE_15:
792  nLSpace = 150;
793  goto ASK_LINESPACE;
794  case SID_ATTR_PARA_LINESPACE_20:
795  nLSpace = 200;
796  goto ASK_LINESPACE;
797  ASK_LINESPACE:
798  {
799  if (!pLSpace)
800  aEditAttr.GetItemState(EE_PARA_SBL, false, &pLSpace);
801 
802  if (!pLSpace || IsInvalidItem(pLSpace))
803  {
804  rSet.InvalidateItem(nSlotId);
805  nSlotId = 0;
806  }
807  else if (nLSpace
808  == static_cast<const SvxLineSpacingItem*>(pLSpace)->GetPropLineSpace())
809  bFlag = true;
810  else
811  nSlotId = 0;
812  }
813  break;
814 
815  case FN_SET_SUPER_SCRIPT:
816  nEsc = SvxEscapement::Superscript;
817  goto ASK_ESCAPE;
818  case FN_SET_SUB_SCRIPT:
819  nEsc = SvxEscapement::Subscript;
820  goto ASK_ESCAPE;
821  ASK_ESCAPE:
822  {
823  if (!pEscItem)
824  pEscItem = &aEditAttr.Get(EE_CHAR_ESCAPEMENT);
825 
826  if (nEsc == static_cast<const SvxEscapementItem*>(pEscItem)->GetEscapement())
827  bFlag = true;
828  else
829  nSlotId = 0;
830  }
831  break;
832 
833  case SID_THESAURUS:
834  {
835  // disable "Thesaurus" if the language is not supported
839  LanguageType nLang = static_cast<const SvxLanguageItem&>(rItem).GetLanguage();
840 
841  uno::Reference<linguistic2::XThesaurus> xThes(::GetThesaurus());
842  if (!xThes.is() || nLang == LANGUAGE_NONE
843  || !xThes->hasLocale(LanguageTag::convertToLocale(nLang)))
844  rSet.DisableItem(SID_THESAURUS);
845  nSlotId = 0;
846  }
847  break;
848  case SID_HANGUL_HANJA_CONVERSION:
849  case SID_CHINESE_CONVERSION:
850  {
851  if (!SvtCJKOptions().IsAnyEnabled())
852  {
853  GetView().GetViewFrame()->GetBindings().SetVisibleState(nWhich, false);
854  rSet.DisableItem(nWhich);
855  }
856  else
857  GetView().GetViewFrame()->GetBindings().SetVisibleState(nWhich, true);
858  }
859  break;
860 
861  case SID_TEXTDIRECTION_LEFT_TO_RIGHT:
862  case SID_TEXTDIRECTION_TOP_TO_BOTTOM:
863  if (!SvtLanguageOptions().IsVerticalTextEnabled())
864  {
865  rSet.DisableItem(nSlotId);
866  nSlotId = 0;
867  }
868  else
869  {
870  SdrOutliner* pOutliner = pSdrView->GetTextEditOutliner();
871  if (pOutliner)
872  bFlag = pOutliner->IsVertical()
873  == (SID_TEXTDIRECTION_TOP_TO_BOTTOM == nSlotId);
874  else
875  {
876  text::WritingMode eMode = aEditAttr.Get(SDRATTR_TEXTDIRECTION).GetValue();
877 
878  if (nSlotId == SID_TEXTDIRECTION_LEFT_TO_RIGHT)
879  {
880  bFlag = eMode == text::WritingMode_LR_TB;
881  }
882  else
883  {
884  bFlag = eMode != text::WritingMode_TB_RL;
885  }
886  }
887  }
888  break;
889  case SID_ATTR_PARA_LEFT_TO_RIGHT:
890  case SID_ATTR_PARA_RIGHT_TO_LEFT:
891  {
892  if (!SvtLanguageOptions().IsCTLFontEnabled())
893  {
894  rSet.DisableItem(nWhich);
895  nSlotId = 0;
896  }
897  else
898  {
899  SdrOutliner* pOutliner = pSdrView->GetTextEditOutliner();
900  if (pOutliner && pOutliner->IsVertical())
901  {
902  rSet.DisableItem(nWhich);
903  nSlotId = 0;
904  }
905  else
906  {
907  switch (aEditAttr.Get(EE_PARA_WRITINGDIR).GetValue())
908  {
909  case SvxFrameDirection::Horizontal_LR_TB:
910  bFlag = nWhich == SID_ATTR_PARA_LEFT_TO_RIGHT;
911  break;
912 
913  case SvxFrameDirection::Horizontal_RL_TB:
914  bFlag = nWhich != SID_ATTR_PARA_LEFT_TO_RIGHT;
915  break;
916  default:
917  break;
918  }
919  }
920  }
921  }
922  break;
923  case SID_TRANSLITERATE_HALFWIDTH:
924  case SID_TRANSLITERATE_FULLWIDTH:
925  case SID_TRANSLITERATE_HIRAGANA:
926  case SID_TRANSLITERATE_KATAKANA:
927  {
928  SvtCJKOptions aCJKOptions;
929  if (!aCJKOptions.IsChangeCaseMapEnabled())
930  {
931  rSet.DisableItem(nWhich);
932  GetView().GetViewFrame()->GetBindings().SetVisibleState(nWhich, false);
933  }
934  else
935  GetView().GetViewFrame()->GetBindings().SetVisibleState(nWhich, true);
936  }
937  break;
938  case SID_INSERT_RLM:
939  case SID_INSERT_LRM:
940  {
941  SvtCTLOptions aCTLOptions;
942  bool bEnabled = aCTLOptions.IsCTLFontEnabled();
943  GetView().GetViewFrame()->GetBindings().SetVisibleState(nWhich, bEnabled);
944  if (!bEnabled)
945  rSet.DisableItem(nWhich);
946  }
947  break;
948  case SID_REMOVE_HYPERLINK:
949  case SID_EDIT_HYPERLINK:
950  case SID_OPEN_HYPERLINK:
951  case SID_COPY_HYPERLINK_LOCATION:
952  {
954  rSet.DisableItem(nWhich);
955  }
956  break;
957  default:
958  nSlotId = 0; // don't know this slot
959  break;
960  }
961 
962  if (nSlotId && bFlag)
963  rSet.Put(SfxBoolItem(nWhich, bFlag));
964 
965  nWhich = aIter.NextWhich();
966  }
967 }
968 
970 {
971  if (!IsTextEdit()) // Otherwise crash!
972  return;
973 
975  SfxItemSet aEditAttr(pOLV->GetAttribs());
976 
977  SfxWhichIter aIter(rSet);
978  sal_uInt16 nWhich = aIter.FirstWhich();
979  SvtScriptType nScriptType = pOLV->GetSelectedScriptType();
980  while(nWhich)
981  {
982  sal_uInt16 nEEWhich = 0;
983  sal_uInt16 nSlotId = GetPool().GetSlotId( nWhich );
984  switch( nSlotId )
985  {
986  case SID_ATTR_CHAR_FONT:
987  case SID_ATTR_CHAR_FONTHEIGHT:
988  case SID_ATTR_CHAR_WEIGHT:
989  case SID_ATTR_CHAR_POSTURE:
990  {
991  SfxItemPool* pEditPool = aEditAttr.GetPool()->GetSecondaryPool();
992  if( !pEditPool )
993  pEditPool = aEditAttr.GetPool();
994  SvxScriptSetItem aSetItem( nSlotId, *pEditPool );
995  aSetItem.GetItemSet().Put( aEditAttr, false );
996  const SfxPoolItem* pI = aSetItem.GetItemOfScript( nScriptType );
997  if( pI )
998  {
999  rSet.Put(pI->CloneSetWhich(nWhich));
1000  }
1001  else
1002  rSet.InvalidateItem( nWhich );
1003  }
1004  break;
1005  case SID_ATTR_CHAR_COLOR: nEEWhich = EE_CHAR_COLOR; break;
1006  case SID_ATTR_CHAR_BACK_COLOR: nEEWhich = EE_CHAR_BKGCOLOR; break;
1007  case SID_ATTR_CHAR_UNDERLINE: nEEWhich = EE_CHAR_UNDERLINE;break;
1008  case SID_ATTR_CHAR_OVERLINE: nEEWhich = EE_CHAR_OVERLINE;break;
1009  case SID_ATTR_CHAR_CONTOUR: nEEWhich = EE_CHAR_OUTLINE; break;
1010  case SID_ATTR_CHAR_SHADOWED: nEEWhich = EE_CHAR_SHADOW;break;
1011  case SID_ATTR_CHAR_STRIKEOUT: nEEWhich = EE_CHAR_STRIKEOUT;break;
1012  case SID_AUTOSPELL_CHECK:
1013  {
1014  const SfxPoolItem* pState = rView.GetSlotState(nWhich);
1015  if (pState)
1016  rSet.Put(SfxBoolItem(nWhich, static_cast<const SfxBoolItem*>(pState)->GetValue()));
1017  else
1018  rSet.DisableItem( nWhich );
1019  break;
1020  }
1021  case SID_ATTR_CHAR_WORDLINEMODE: nEEWhich = EE_CHAR_WLM; break;
1022  case SID_ATTR_CHAR_RELIEF : nEEWhich = EE_CHAR_RELIEF; break;
1023  case SID_ATTR_CHAR_LANGUAGE : nEEWhich = EE_CHAR_LANGUAGE;break;
1024  case SID_ATTR_CHAR_KERNING : nEEWhich = EE_CHAR_KERNING; break;
1025  case SID_ATTR_CHAR_SCALEWIDTH: nEEWhich = EE_CHAR_FONTWIDTH;break;
1026  case SID_ATTR_CHAR_AUTOKERN : nEEWhich = EE_CHAR_PAIRKERNING; break;
1027  case SID_ATTR_CHAR_ESCAPEMENT: nEEWhich = EE_CHAR_ESCAPEMENT; break;
1028  case FN_GROW_FONT_SIZE:
1029  case FN_SHRINK_FONT_SIZE:
1030  {
1031  SfxItemPool* pEditPool = aEditAttr.GetPool()->GetSecondaryPool();
1032  if( !pEditPool )
1033  pEditPool = aEditAttr.GetPool();
1034 
1035  SvxScriptSetItem aSetItem( SID_ATTR_CHAR_FONTHEIGHT, *pEditPool );
1036  aSetItem.GetItemSet().Put( aEditAttr, false );
1037  const SvxFontHeightItem* pSize( static_cast<const SvxFontHeightItem*>( aSetItem.GetItemOfScript( nScriptType ) ) );
1038 
1039  if( pSize )
1040  {
1041  sal_uInt32 nSize = pSize->GetHeight();
1042  if( nSize >= 19998 )
1044  else if( nSize <= 40 )
1046  }
1047  }
1048  }
1049  if(nEEWhich)
1050  {
1051  rSet.Put(aEditAttr.Get(nEEWhich).CloneSetWhich(nWhich));
1052  }
1053 
1054  nWhich = aIter.NextWhich();
1055  }
1056 }
1057 
1059 {
1060  if (!IsTextEdit()) // Otherwise crash!
1061  return;
1062 
1064 
1065  ESelection aSel(pOLV->GetSelection());
1066  const bool bCopy = (aSel.nStartPara != aSel.nEndPara) || (aSel.nStartPos != aSel.nEndPos);
1067  sal_uInt16 nId = rReq.GetSlot();
1068  switch( nId )
1069  {
1070  case SID_CUT:
1071  if (bCopy)
1072  pOLV->Cut();
1073  return;
1074 
1075  case SID_COPY:
1076  if (bCopy)
1077  pOLV->Copy();
1078  return;
1079 
1080  case SID_PASTE:
1081  pOLV->PasteSpecial();
1082  break;
1083 
1084  case SID_PASTE_UNFORMATTED:
1085  pOLV->Paste();
1086  break;
1087 
1088  case SID_PASTE_SPECIAL:
1089  {
1091  ScopedVclPtr<SfxAbstractPasteDialog> pDlg(pFact->CreatePasteDialog(GetView().GetEditWin().GetFrameWeld()));
1092 
1093  pDlg->Insert(SotClipboardFormatId::STRING, OUString());
1094  pDlg->Insert(SotClipboardFormatId::RTF, OUString());
1095  pDlg->Insert(SotClipboardFormatId::RICHTEXT, OUString());
1096 
1098  SotClipboardFormatId nFormat = pDlg->GetFormat(aDataHelper.GetTransferable());
1099 
1100  if (nFormat != SotClipboardFormatId::NONE)
1101  {
1102  if (nFormat == SotClipboardFormatId::STRING)
1103  pOLV->Paste();
1104  else
1105  pOLV->PasteSpecial();
1106  }
1107 
1108  break;
1109  }
1110 
1111  case SID_CLIPBOARD_FORMAT_ITEMS:
1112  {
1113  SotClipboardFormatId nFormat = SotClipboardFormatId::NONE;
1114  const SfxPoolItem* pItem;
1115  if (rReq.GetArgs() && rReq.GetArgs()->GetItemState(nId, true, &pItem) == SfxItemState::SET)
1116  {
1117  if (const SfxUInt32Item* pUInt32Item = dynamic_cast<const SfxUInt32Item *>(pItem))
1118  nFormat = static_cast<SotClipboardFormatId>(pUInt32Item->GetValue());
1119  }
1120 
1121  if (nFormat != SotClipboardFormatId::NONE)
1122  {
1123  if (nFormat == SotClipboardFormatId::STRING)
1124  pOLV->Paste();
1125  else
1126  pOLV->PasteSpecial();
1127  }
1128 
1129  break;
1130  }
1131 
1132  default:
1133  OSL_FAIL("wrong dispatcher");
1134  return;
1135  }
1136 }
1137 
1139 {
1140  if (!IsTextEdit()) // Otherwise crash!
1141  return;
1142 
1144  ESelection aSel(pOLV->GetSelection());
1145  const bool bCopy = (aSel.nStartPara != aSel.nEndPara) ||
1146  (aSel.nStartPos != aSel.nEndPos);
1147 
1149  const bool bPaste = aDataHelper.HasFormat( SotClipboardFormatId::STRING ) ||
1150  aDataHelper.HasFormat( SotClipboardFormatId::RTF ) ||
1151  aDataHelper.HasFormat( SotClipboardFormatId::RICHTEXT );
1152 
1153  SfxWhichIter aIter(rSet);
1154  sal_uInt16 nWhich = aIter.FirstWhich();
1155 
1156  while(nWhich)
1157  {
1158  switch(nWhich)
1159  {
1160  case SID_CUT:
1161  case SID_COPY:
1162  if( !bCopy || GetObjectShell()->isContentExtractionLocked())
1163  rSet.DisableItem( nWhich );
1164  break;
1165 
1166  case SID_PASTE:
1167  case SID_PASTE_UNFORMATTED:
1168  case SID_PASTE_SPECIAL:
1169  if( !bPaste )
1170  rSet.DisableItem( nWhich );
1171  break;
1172 
1173  case SID_CLIPBOARD_FORMAT_ITEMS:
1174  if( bPaste )
1175  {
1176  SvxClipboardFormatItem aFormats( SID_CLIPBOARD_FORMAT_ITEMS );
1177 
1178  if ( aDataHelper.HasFormat( SotClipboardFormatId::STRING ) )
1179  aFormats.AddClipbrdFormat( SotClipboardFormatId::STRING );
1180  if ( aDataHelper.HasFormat( SotClipboardFormatId::RTF ) )
1181  aFormats.AddClipbrdFormat( SotClipboardFormatId::RTF );
1182  if ( aDataHelper.HasFormat( SotClipboardFormatId::RICHTEXT ) )
1183  aFormats.AddClipbrdFormat( SotClipboardFormatId::RICHTEXT );
1184 
1185  rSet.Put( aFormats );
1186  }
1187  else
1188  rSet.DisableItem( nWhich );
1189  break;
1190  }
1191 
1192  nWhich = aIter.NextWhich();
1193  }
1194 }
1195 
1196 // Hyperlink status
1197 
1199 {
1200  if (!IsTextEdit()) // Otherwise crash!
1201  return;
1202 
1204  SfxWhichIter aIter(rSet);
1205  sal_uInt16 nWhich = aIter.FirstWhich();
1206 
1207  while(nWhich)
1208  {
1209  switch(nWhich)
1210  {
1211  case SID_HYPERLINK_GETLINK:
1212  {
1213  SvxHyperlinkItem aHLinkItem;
1214  aHLinkItem.SetInsertMode(HLINK_FIELD);
1215 
1216  const SvxFieldItem* pFieldItem = pOLV->GetFieldAtSelection();
1217 
1218  if (pFieldItem)
1219  {
1220  const SvxURLField* pURLField = dynamic_cast<const SvxURLField*>(pFieldItem->GetField());
1221 
1222  if (pURLField)
1223  {
1224  aHLinkItem.SetName(pURLField->GetRepresentation());
1225  aHLinkItem.SetURL(pURLField->GetURL());
1226  aHLinkItem.SetTargetFrame(pURLField->GetTargetFrame());
1227  }
1228  }
1229  else
1230  {
1231  OUString sSel(pOLV->GetSelected());
1232  sSel = sSel.copy(0, std::min<sal_Int32>(255, sSel.getLength()));
1233  aHLinkItem.SetName(comphelper::string::stripEnd(sSel, ' '));
1234  }
1235 
1236  sal_uInt16 nHtmlMode = ::GetHtmlMode(GetView().GetDocShell());
1237  aHLinkItem.SetInsertMode(static_cast<SvxLinkInsertMode>(aHLinkItem.GetInsertMode() |
1238  ((nHtmlMode & HTMLMODE_ON) != 0 ? HLINK_HTMLMODE : 0)));
1239 
1240  rSet.Put(aHLinkItem);
1241  }
1242  break;
1243  }
1244  nWhich = aIter.NextWhich();
1245  }
1246 }
1247 
1248 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const SfxPoolItem * ExecuteSlot(SfxRequest &rReq, const SfxInterface *pIF=nullptr)
OString stripEnd(const OString &rIn, char c)
void SetURL(const OUString &rURL)
SfxViewFrame * GetViewFrame() const
#define LANGUAGE_NONE
const SfxPoolItem * ExecuteList(sal_uInt16 nSlot, SfxCallMode nCall, std::initializer_list< SfxPoolItem const * > args, std::initializer_list< SfxPoolItem const * > internalargs=std::initializer_list< SfxPoolItem const * >())
static void CopyStringTo(const OUString &rContent, const css::uno::Reference< css::datatransfer::clipboard::XClipboard > &rxClipboard, const vcl::ILibreOfficeKitNotifier *pNotifier=nullptr)
void SetTargetFrame(const OUString &rFrm)
FieldUnit
void SetRight(const tools::Long nR, const sal_uInt16 nProp=100)
constexpr TypedWhichId< SvxAutoKernItem > EE_CHAR_PAIRKERNING(EE_CHAR_START+11)
void PasteSpecial()
virtual SdrEndTextEditKind SdrEndTextEdit(bool bDontDeleteReally=false)
constexpr TypedWhichId< SvxKerningItem > EE_CHAR_KERNING(EE_CHAR_START+12)
void PutItemForScriptType(SvtScriptType nScriptType, const SfxPoolItem &rItem)
sal_uInt16 GetLower() const
#define LINE_SPACE_DEFAULT_HEIGHT
void SetEscapement(const SvxEscapement eNew)
#define FN_SET_SUPER_SCRIPT
Definition: cmdid.h:306
bool BeginTextEdit(SdrObject *pObj, SdrPageView *pPV=nullptr, vcl::Window *pWin=nullptr, bool bIsNewObj=false, bool bSetSelectionToStart=false)
Definition: viewdraw.cxx:498
SdrView * pSdrView
Definition: drwtxtsh.hxx:35
void SelectPara(EditView &rEditView, const ESelection &rCurSel)
Definition: langhelper.cxx:560
void SelectFieldAtCursor()
virtual const SfxItemSet * GetOutputItemSet() const =0
std::string GetValue
css::uno::Reference< css::datatransfer::clipboard::XClipboard > GetClipboard()
const OUString & GetTargetFrame() const
static void HandleOpenXmlFilterSettings(SfxRequest &)
SfxDispatcher * GetDispatcher()
static SvxAbstractDialogFactory * Create()
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_LANGUAGE(10)
tools::Long GetRight() const
LanguageType GetLanguage(SfxItemSet const &aSet, sal_uInt16 nLangWhichId)
Definition: langhelper.cxx:395
void GetState(SfxItemSet &)
Definition: drwtxtex.cxx:651
bool HasSelection() const
void InvalidateItem(sal_uInt16 nWhich)
sal_Int16 nId
sal_uInt16 FirstWhich()
constexpr sal_uInt16 EE_ITEMS_END(EE_FEATURE_END)
constexpr TypedWhichId< SvxFormatBreakItem > RES_BREAK(94)
SwEditWin & GetEditWin()
Definition: view.hxx:402
void Execute(SfxRequest &)
Definition: drwtxtex.cxx:122
void Done(bool bRemove=false)
SdrMark * GetMark(size_t nNum) const
void ChangeFontSize(bool bGrow, const FontList *pList)
constexpr TypedWhichId< SvxAdjustItem > EE_PARA_JUST(EE_PARA_START+15)
static SfxObjectShell * Current()
void SetModified()
Definition: edws.cxx:70
const SfxItemSet * GetArgs() const
void SelectCurrentWord(sal_Int16 nWordType=css::i18n::WordType::ANYWORD_IGNOREWHITESPACES)
void ExecClpbrd(SfxRequest const &rReq)
Definition: drwtxtex.cxx:1058
sal_Int32 nFirstLineOffset
bool IsCTLFontEnabled() const
void StateInsert(SfxItemSet &rSet)
Definition: drwtxtex.cxx:1198
bool HasFormat(SotClipboardFormatId nFormat) const
EEControlBits
const OUString & GetTargetFrame() const
constexpr TypedWhichId< SvxLineSpacingItem > EE_PARA_SBL(EE_PARA_START+14)
constexpr TypedWhichId< SvxFrameDirectionItem > EE_PARA_WRITINGDIR(EE_PARA_START+0)
sal_uInt16 NextWhich()
static LanguageType nLang
Definition: srtdlg.cxx:51
Used by the UI to modify the document model.
Definition: wrtsh.hxx:90
void GetDrawTextCtrlState(SfxItemSet &)
Definition: drwtxtex.cxx:969
void StateClpbrd(SfxItemSet &rSet)
Definition: drwtxtex.cxx:1138
constexpr::Color COL_TRANSPARENT(0xFF, 0xFF, 0xFF, 0xFF)
void UpdateWordCount(SfxShell *, sal_uInt16)
Definition: view1.cxx:203
void SetTargetFrame(const OUString &rTarget)
void SetTextLeft(const tools::Long nL, const sal_uInt16 nProp=100)
const SwView & GetView() const
Definition: wrtsh.hxx:428
void SetPropLineSpace(const sal_uInt16 nProp)
LINESTYLE_NONE
constexpr TypedWhichId< SvxLRSpaceItem > EE_PARA_LRSPACE(EE_PARA_START+12)
constexpr TypedWhichId< SvxULSpaceItem > EE_PARA_ULSPACE(EE_PARA_START+13)
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
const SfxPoolItem & GetDefault(sal_uInt16 nFormatHint) const
Get the default attribute in this document.
Definition: docfmt.cxx:653
static TransferableDataHelper CreateFromSystemClipboard(vcl::Window *pWindow)
HLINK_HTMLMODE
Mode eMode
SwDoc * GetDoc() const
Definition: viewsh.hxx:281
SotClipboardFormatId
OString OUStringToOString(std::u16string_view str, ConnectionSettings const *settings)
sal_Int32 nEndPos
bool SetLanguageStatus(OutlinerView *pOLV, SfxRequest &rReq, SwView const &rView, SwWrtShell &rSh)
Definition: langhelper.cxx:98
constexpr TypedWhichId< SvxContourItem > EE_CHAR_OUTLINE(EE_CHAR_START+8)
SwView & rView
Definition: drwtxtsh.hxx:32
EditView & GetEditView() const
#define FN_SHRINK_FONT_SIZE
Definition: cmdid.h:304
SfxItemPool & GetPool() const
bool IsChangeCaseMapEnabled() const
constexpr TypedWhichId< SvxHyphenZoneItem > RES_PARATR_HYPHENZONE(69)
SdrObject * GetMarkedSdrObj() const
weld::Window * GetFrameWeld(const SfxFrame *pFrame)
Definition: dialoghelp.cxx:19
constexpr TypedWhichId< SvxShadowedItem > EE_CHAR_SHADOW(EE_CHAR_START+9)
const SfxPoolItem * GetItem(sal_uInt16 nSlotId) const
constexpr TypedWhichId< SvxWritingModeItem > SDRATTR_TEXTDIRECTION(SDRATTR_NOTPERSIST_FIRST+34)
tools::Long GetTextLeft() const
#define FN_SET_SUB_SCRIPT
Definition: cmdid.h:307
const SdrOutliner * GetTextEditOutliner() const
SvtScriptType
#define FN_NUMBERING_OUTLINE_DLG
Definition: cmdid.h:489
const OUString & GetURL() const
#define SW_MOD()
Definition: swmodule.hxx:255
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
SW_DLLPUBLIC FieldUnit GetDfltMetric(bool bWeb)
Definition: uitool.cxx:693
SvxAdjust
const SfxPoolItem * GetSlotState(sal_uInt16 nSlotId, const SfxInterface *pIF=nullptr, SfxItemSet *pStateSet=nullptr)
const SvxFieldItem * GetFieldAtSelection() const
constexpr TypedWhichId< SvxCharScaleWidthItem > EE_CHAR_FONTWIDTH(EE_CHAR_START+3)
constexpr TypedWhichId< SvxCharReliefItem > EE_CHAR_RELIEF(EE_CHAR_START+26)
SfxBindings & GetBindings()
const OUString & GetValue() const
const SdrMarkList & GetMarkedObjectList() const
HTMLMODE_ON
sal_uInt16 GetHtmlMode(const SwDocShell *pShell)
Definition: viewopt.cxx:355
const T * GetArg(sal_uInt16 nSlotId) const
bool SetAttributes(const SfxItemSet &rSet, bool bReplaceAll=false)
void SetTextFirstLineOffset(const short nF, const sal_uInt16 nProp=100)
OUString GetSelected() const
constexpr sal_uInt16 EE_ITEMS_START(OWN_ATTR_VALUE_END+1)
void ExecFormatFootnote()
Definition: view0.cxx:689
static sal_Int16 GetI18NScriptTypeOfLanguage(LanguageType nLang)
LINESTYLE_SINGLE
SvtScriptType GetSelectedScriptType() const
virtual void SetCurPageId(const OString &rName)=0
void GetLanguageStatus(OutlinerView *pOLV, SfxItemSet &rSet)
Definition: langhelper.cxx:58
sal_uInt16 GetWhichOfScript(sal_uInt16 nWhich, sal_uInt16 nScript)
Definition: hints.cxx:190
bool IsModified() const
short GetTextFirstLineOffset() const
void Paste(bool bUseSpecial=false)
constexpr TypedWhichId< SvxBackgroundColorItem > EE_CHAR_BKGCOLOR(EE_CHAR_START+32)
const OutlinerView * GetTextEditOutlinerView() const
HLINK_FIELD
Outliner * GetOutliner() const
static SwAbstractDialogFactory * Create()
Definition: swabstdlg.cxx:36
const OUString & GetRepresentation() const
#define FN_WORDCOUNT_DIALOG
Definition: cmdid.h:591
sal_uInt16 GetSlotId(sal_uInt16 nWhich) const
void SetName(const OUString &rName)
void InsertField(const SvxFieldItem &rFld)
std::unique_ptr< SfxPoolItem > CloneSetWhich(sal_uInt16 nNewWhich) const
static void RemoveURLField(EditView &pEditView)
const OUString & GetURL() const
ESelection GetSelection() const
uno::Reference< linguistic2::XThesaurus > GetThesaurus()
Definition: swtypes.cxx:59
FontLineStyle GetLineStyle() const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
SwView & GetView()
Definition: drwtxtsh.hxx:49
sal_uInt16 GetSlot() const
constexpr TypedWhichId< SvxCrossedOutItem > EE_CHAR_STRIKEOUT(EE_CHAR_START+6)
void SetSelection(const ESelection &)
sal_uInt32 GetHeight() const
bool EDITENG_DLLPUBLIC GetStatusValueForThesaurusFromContext(OUString &rStatusVal, LanguageType &rLang, const EditView &rEditView)
constexpr TypedWhichId< SvxOrphansItem > RES_PARATR_ORPHANS(66)
bool IsTextEdit() const
Definition: drwtxtsh.cxx:167
SfxItemState
void DisableItem(sal_uInt16 nWhich)
weld::Window * GetFrameWeld() const
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
sal_uInt16 GetWhich(sal_uInt16 nSlot, bool bDeep=true) const
constexpr TypedWhichId< SvxFormatSplitItem > RES_PARATR_SPLIT(65)
void ExecNumberingOutline(SfxItemPool &)
Definition: view0.cxx:696
#define GetWhich(nSlot)
constexpr TypedWhichId< SvxEscapementItem > EE_CHAR_ESCAPEMENT(EE_CHAR_START+10)
virtual std::unique_ptr< SfxItemSet > Clone(bool bItems=true, SfxItemPool *pToPool=nullptr) const
constexpr TypedWhichId< SvxColorItem > EE_CHAR_COLOR(EE_CHAR_START+0)
LanguageType GetAppLanguage()
Definition: init.cxx:728
RET_OK
constexpr TypedWhichId< SvxWordLineModeItem > EE_CHAR_WLM(EE_CHAR_START+13)
constexpr TypedWhichId< SvxOverlineItem > EE_CHAR_OVERLINE(EE_CHAR_START+29)
const SvxFieldData * GetFieldAtCursor() const
SwWrtShell & GetShell()
Definition: drwtxtsh.cxx:137
void SetAttrToMarked(const SfxItemSet &rAttr)
Definition: drwtxtsh.cxx:156
constexpr TypedWhichId< SvxLanguageItem > EE_CHAR_LANGUAGE(EE_CHAR_START+14)
#define FN_GROW_FONT_SIZE
Definition: cmdid.h:303
void SetInsertMode(SvxLinkInsertMode eNew)
SdrPageView * GetSdrPageView() const
#define FN_FORMAT_FOOTNOTE_DLG
Definition: cmdid.h:323
void SetSelection(const ESelection &rNewSel)
void AddClipbrdFormat(SotClipboardFormatId nId)
SvxEscapement
void SetVisibleState(sal_uInt16 nId, bool bShow)
constexpr TypedWhichId< SvxUnderlineItem > EE_CHAR_UNDERLINE(EE_CHAR_START+5)
const OUString & GetName() const
SvxLinkInsertMode GetInsertMode() const
void InvalidateAll(bool bWithMsg)
SVXCORE_DLLPUBLIC MSO_SPT Get(const OUString &)
SfxItemSet GetAttribs()
ESelection GetSelection() const
constexpr sal_uInt16 EE_FEATURE_FIELD(EE_FEATURE_NOTCONV+1)
const SfxPoolItem * Execute(sal_uInt16 nSlot, SfxCallMode nCall=SfxCallMode::SLOT, const SfxPoolItem **pArgs=nullptr, sal_uInt16 nModi=0, const SfxPoolItem **pInternalArgs=nullptr)
const FontList * GetFontList() const
virtual VclPtr< SfxAbstractTabDialog > CreateSwCharDlg(weld::Window *pParent, SwView &pVw, const SfxItemSet &rCoreSet, SwCharDlgMode nDialogMode, const OUString *pFormatStr=nullptr)=0
bool IsInvalidItem(const SfxPoolItem *pItem)
FontLineStyle
const css::uno::Reference< css::datatransfer::XTransferable > & GetTransferable() const
virtual VclPtr< SfxAbstractTabDialog > CreateSwParaDlg(weld::Window *pParent, SwView &rVw, const SfxItemSet &rCoreSet, bool bDraw, const OString &sDefPage=OString())=0
constexpr TypedWhichId< SvxKerningItem > RES_CHRATR_KERNING(9)
static bool IsCursorAtURLField(const EditView &pEditView)
const SfxPoolItem * GetItemOfScript(SvtScriptType nScript) const
virtual SfxObjectShell * GetObjectShell()
void EDITENG_DLLPUBLIC ReplaceTextWithSynonym(EditView &rEditView, const OUString &rSynonmText)
constexpr TypedWhichId< SvxWidowsItem > RES_PARATR_WIDOWS(67)
Definition: view.hxx:144
sal_uInt16 GetUpper() const
const SvxFieldData * GetField() const
static css::lang::Locale convertToLocale(LanguageType nLangID, bool bResolveSystem=true)