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 #include <osl/diagnose.h>
67 
68 #include <cmdid.h>
69 #include <doc.hxx>
70 #include <drwtxtsh.hxx>
71 #include <edtwin.hxx>
72 #include <hintids.hxx>
73 #include <langhelper.hxx>
74 #include <chrdlgmodes.hxx>
75 #include <swmodule.hxx>
76 #include <uitool.hxx>
77 #include <viewopt.hxx>
78 #include <wrtsh.hxx>
79 #include <wview.hxx>
80 
81 #include <swabstdlg.hxx>
82 #include <memory>
83 
84 using namespace ::com::sun::star;
85 
86 namespace
87 {
88  void lcl_convertStringArguments(sal_uInt16 nSlot, const std::unique_ptr<SfxItemSet>& pArgs)
89  {
90  Color aColor;
91  OUString sColor;
92  const SfxPoolItem* pItem = nullptr;
93 
94  if (SfxItemState::SET != pArgs->GetItemState(SID_ATTR_COLOR_STR, false, &pItem))
95  return;
96 
97  sColor = static_cast<const SfxStringItem*>(pItem)->GetValue();
98 
99  if (sColor == "transparent")
100  aColor = COL_TRANSPARENT;
101  else
102  aColor = Color(ColorTransparency, sColor.toInt32(16));
103 
104  switch (nSlot)
105  {
106  case SID_ATTR_CHAR_COLOR:
107  {
108  SvxColorItem aColorItem(aColor, EE_CHAR_COLOR);
109  pArgs->Put(aColorItem);
110  break;
111  }
112 
113  case SID_ATTR_CHAR_BACK_COLOR:
114  {
115  SvxColorItem pBackgroundItem(aColor, EE_CHAR_BKGCOLOR);
116  pArgs->Put(pBackgroundItem);
117  break;
118  }
119  }
120  }
121 }
122 
124 {
125  SwWrtShell &rSh = GetShell();
127  SfxItemSet aEditAttr(pOLV->GetAttribs());
128  SfxItemSet aNewAttr(*aEditAttr.GetPool(), aEditAttr.GetRanges());
129 
130  const sal_uInt16 nSlot = rReq.GetSlot();
131 
132  const sal_uInt16 nWhich = GetPool().GetWhich(nSlot);
133  std::unique_ptr<SfxItemSet> pNewAttrs(rReq.GetArgs() ? rReq.GetArgs()->Clone() : nullptr);
134 
135  bool bRestoreSelection = false;
136  ESelection aOldSelection;
137 
138  sal_uInt16 nEEWhich = 0;
139  switch (nSlot)
140  {
141  case SID_LANGUAGE_STATUS:
142  {
143  aOldSelection = pOLV->GetSelection();
144  if (!pOLV->GetEditView().HasSelection())
145  {
146  pOLV->GetEditView().SelectCurrentWord();
147  }
148 
149  bRestoreSelection = SwLangHelper::SetLanguageStatus(pOLV,rReq,GetView(),rSh);
150  break;
151  }
152 
153  case SID_THES:
154  {
155  OUString aReplaceText;
156  const SfxStringItem* pItem2 = rReq.GetArg<SfxStringItem>(SID_THES);
157  if (pItem2)
158  aReplaceText = pItem2->GetValue();
159  if (!aReplaceText.isEmpty())
160  ReplaceTextWithSynonym( pOLV->GetEditView(), aReplaceText );
161  break;
162  }
163 
164  case SID_ATTR_CHAR_FONT:
165  case SID_ATTR_CHAR_FONTHEIGHT:
166  case SID_ATTR_CHAR_WEIGHT:
167  case SID_ATTR_CHAR_POSTURE:
168  {
169  SfxItemPool* pPool2 = aEditAttr.GetPool()->GetSecondaryPool();
170  if( !pPool2 )
171  pPool2 = aEditAttr.GetPool();
172  SvxScriptSetItem aSetItem( nSlot, *pPool2 );
173 
174  // #i78017 establish the same behaviour as in Writer
175  SvtScriptType nScriptTypes = SvtScriptType::LATIN | SvtScriptType::ASIAN | SvtScriptType::COMPLEX;
176  if (nSlot == SID_ATTR_CHAR_FONT)
177  nScriptTypes = pOLV->GetSelectedScriptType();
178 
179  if (pNewAttrs)
180  {
181  aSetItem.PutItemForScriptType( nScriptTypes, pNewAttrs->Get( nWhich ) );
182  aNewAttr.Put( aSetItem.GetItemSet() );
183  }
184  }
185  break;
186 
187  case SID_ATTR_CHAR_COLOR: nEEWhich = EE_CHAR_COLOR; break;
188  case SID_ATTR_CHAR_BACK_COLOR: nEEWhich = EE_CHAR_BKGCOLOR; break;
189 
190  case SID_ATTR_CHAR_UNDERLINE:
191  {
192  if ( pNewAttrs )
193  {
194  const SvxTextLineItem& rTextLineItem = static_cast< const SvxTextLineItem& >( pNewAttrs->Get( pNewAttrs->GetPool()->GetWhich(nSlot) ) );
195  aNewAttr.Put( SvxUnderlineItem( rTextLineItem.GetLineStyle(), EE_CHAR_UNDERLINE ) );
196  }
197  else
198  {
199  FontLineStyle eFU = aEditAttr.Get(EE_CHAR_UNDERLINE).GetLineStyle();
201  }
202  }
203  break;
204 
205  case SID_ATTR_CHAR_OVERLINE:
206  {
207  FontLineStyle eFO = aEditAttr.Get(EE_CHAR_OVERLINE).GetLineStyle();
209  }
210  break;
211 
212  case SID_ATTR_CHAR_CONTOUR: nEEWhich = EE_CHAR_OUTLINE; break;
213  case SID_ATTR_CHAR_SHADOWED: nEEWhich = EE_CHAR_SHADOW; break;
214  case SID_ATTR_CHAR_STRIKEOUT: nEEWhich = EE_CHAR_STRIKEOUT; break;
215  case SID_ATTR_CHAR_WORDLINEMODE: nEEWhich = EE_CHAR_WLM; break;
216  case SID_ATTR_CHAR_RELIEF : nEEWhich = EE_CHAR_RELIEF; break;
217  case SID_ATTR_CHAR_LANGUAGE : nEEWhich = EE_CHAR_LANGUAGE;break;
218  case SID_ATTR_CHAR_KERNING : nEEWhich = EE_CHAR_KERNING; break;
219  case SID_ATTR_CHAR_SCALEWIDTH: nEEWhich = EE_CHAR_FONTWIDTH; break;
220  case SID_ATTR_CHAR_AUTOKERN : nEEWhich = EE_CHAR_PAIRKERNING; break;
221  case SID_ATTR_CHAR_ESCAPEMENT: nEEWhich = EE_CHAR_ESCAPEMENT; break;
222  case SID_ATTR_PARA_ADJUST_LEFT:
223  aNewAttr.Put(SvxAdjustItem(SvxAdjust::Left, EE_PARA_JUST));
224  break;
225  case SID_ATTR_PARA_ADJUST_CENTER:
226  aNewAttr.Put(SvxAdjustItem(SvxAdjust::Center, EE_PARA_JUST));
227  break;
228  case SID_ATTR_PARA_ADJUST_RIGHT:
229  aNewAttr.Put(SvxAdjustItem(SvxAdjust::Right, EE_PARA_JUST));
230  break;
231  case SID_ATTR_PARA_ADJUST_BLOCK:
232  aNewAttr.Put(SvxAdjustItem(SvxAdjust::Block, EE_PARA_JUST));
233  break;
234  case SID_ATTR_PARA_LRSPACE:
235  {
236  SvxLRSpaceItem aParaMargin(static_cast<const SvxLRSpaceItem&>(rReq.
237  GetArgs()->Get(nSlot)));
238  aParaMargin.SetWhich( EE_PARA_LRSPACE );
239  aNewAttr.Put(aParaMargin);
240  rReq.Done();
241  }
242  break;
243  case SID_HANGING_INDENT:
244  {
245  SfxItemState eState = aEditAttr.GetItemState( EE_PARA_LRSPACE );
246  if( eState >= SfxItemState::DEFAULT )
247  {
248  SvxLRSpaceItem aParaMargin = aEditAttr.Get( EE_PARA_LRSPACE );
249  aParaMargin.SetWhich( EE_PARA_LRSPACE );
250  short int nFirstLineOffset = aParaMargin.GetTextFirstLineOffset();
251  aParaMargin.SetTextLeft( aParaMargin.GetTextLeft() + nFirstLineOffset );
252  aParaMargin.SetRight( aParaMargin.GetRight() );
253  aParaMargin.SetTextFirstLineOffset( nFirstLineOffset * -1 );
254  aNewAttr.Put(aParaMargin);
255  rReq.Done();
256  }
257  }
258  break;
259  case SID_ATTR_PARA_LINESPACE:
260  {
261  SvxLineSpacingItem aLineSpace = static_cast<const SvxLineSpacingItem&>(pNewAttrs->Get(
262  GetPool().GetWhich(nSlot)));
263  aLineSpace.SetWhich( EE_PARA_SBL );
264  aNewAttr.Put( aLineSpace );
265  rReq.Done();
266  }
267  break;
268  case SID_ATTR_PARA_ULSPACE:
269  {
270  SvxULSpaceItem aULSpace = static_cast<const SvxULSpaceItem&>(pNewAttrs->Get(
271  GetPool().GetWhich(nSlot)));
272  aULSpace.SetWhich( EE_PARA_ULSPACE );
273  aNewAttr.Put( aULSpace );
274  rReq.Done();
275  }
276  break;
277  case SID_PARASPACE_INCREASE:
278  case SID_PARASPACE_DECREASE:
279  {
280  SvxULSpaceItem aULSpace( aEditAttr.Get( EE_PARA_ULSPACE ) );
281  sal_uInt16 nUpper = aULSpace.GetUpper();
282  sal_uInt16 nLower = aULSpace.GetLower();
283 
284  if ( nSlot == SID_PARASPACE_INCREASE )
285  {
286  nUpper = std::min< sal_uInt16 >( nUpper + 57, 5670 );
287  nLower = std::min< sal_uInt16 >( nLower + 57, 5670 );
288  }
289  else
290  {
291  nUpper = std::max< sal_Int16 >( nUpper - 57, 0 );
292  nLower = std::max< sal_Int16 >( nLower - 57, 0 );
293  }
294 
295  aULSpace.SetUpper( nUpper );
296  aULSpace.SetLower( nLower );
297  aNewAttr.Put( aULSpace );
298  rReq.Done();
299  }
300  break;
301  case SID_ATTR_PARA_LINESPACE_10:
302  {
304  aItem.SetPropLineSpace(100);
305  aNewAttr.Put(aItem);
306  }
307  break;
308  case SID_ATTR_PARA_LINESPACE_15:
309  {
311  aItem.SetPropLineSpace(150);
312  aNewAttr.Put(aItem);
313  }
314  break;
315  case SID_ATTR_PARA_LINESPACE_20:
316  {
318  aItem.SetPropLineSpace(200);
319  aNewAttr.Put(aItem);
320  }
321  break;
322 
323  case FN_SET_SUPER_SCRIPT:
324  {
326  SvxEscapement eEsc = static_cast<SvxEscapement>(aEditAttr.Get( EE_CHAR_ESCAPEMENT ).GetEnumValue());
327 
328  if( eEsc == SvxEscapement::Superscript )
329  aItem.SetEscapement( SvxEscapement::Off );
330  else
331  aItem.SetEscapement( SvxEscapement::Superscript );
332  aNewAttr.Put( aItem );
333  }
334  break;
335  case FN_SET_SUB_SCRIPT:
336  {
338  SvxEscapement eEsc = static_cast<SvxEscapement>(aEditAttr.Get( EE_CHAR_ESCAPEMENT ).GetEnumValue());
339 
340  if( eEsc == SvxEscapement::Subscript )
341  aItem.SetEscapement( SvxEscapement::Off );
342  else
343  aItem.SetEscapement( SvxEscapement::Subscript );
344  aNewAttr.Put( aItem );
345  }
346  break;
347 
348  case SID_CHAR_DLG_EFFECT:
349  case SID_CHAR_DLG:
350  case SID_CHAR_DLG_FOR_PARAGRAPH:
351  {
352  const SfxItemSet* pArgs = rReq.GetArgs();
353  const SfxStringItem* pItem = rReq.GetArg<SfxStringItem>(FN_PARAM_1);
354 
355  if( !pArgs || pItem )
356  {
357  aOldSelection = pOLV->GetSelection();
358  if (nSlot == SID_CHAR_DLG_FOR_PARAGRAPH)
359  {
360  // select current paragraph (and restore selection later on...)
361  EditView & rEditView = pOLV->GetEditView();
362  SwLangHelper::SelectPara( rEditView, rEditView.GetSelection() );
363  bRestoreSelection = true;
364  }
365 
366  SwView* pView = &GetView();
367  FieldUnit eMetric = ::GetDfltMetric(dynamic_cast<SwWebView*>( pView) != nullptr );
368  SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric)) );
369  SfxItemSet aDlgAttr(GetPool(), svl::Items<XATTR_FILLSTYLE, XATTR_FILLCOLOR, EE_ITEMS_START, EE_ITEMS_END>);
370 
371  // util::Language does not exists in the EditEngine! That is why not in set.
372 
373  aDlgAttr.Put( aEditAttr );
374  aDlgAttr.Put( SvxKerningItem(0, RES_CHRATR_KERNING) );
375 
378  if (nSlot == SID_CHAR_DLG_EFFECT)
379  {
380  pDlg->SetCurPageId("fonteffects");
381  }
382  else if (nSlot == SID_CHAR_DLG_FOR_PARAGRAPH)
383  {
384  pDlg->SetCurPageId("font");
385  }
386  else if (pItem)
387  {
388  pDlg->SetCurPageId(OUStringToOString(pItem->GetValue(), RTL_TEXTENCODING_UTF8));
389  }
390 
391  sal_uInt16 nRet = pDlg->Execute();
392  if(RET_OK == nRet )
393  {
394  rReq.Done( *( pDlg->GetOutputItemSet() ) );
395  aNewAttr.Put(*pDlg->GetOutputItemSet());
396  }
397  if(RET_OK != nRet)
398  return ;
399  }
400  else
401  aNewAttr.Put(*pArgs);
402  }
403  break;
405  {
407  break;
408  }
410  {
412  rReq.Done();
413  }
414  break;
415  case SID_OPEN_XML_FILTERSETTINGS:
416  {
418  }
419  break;
420  case FN_WORDCOUNT_DIALOG:
421  {
422  GetView().UpdateWordCount(this, nSlot);
423  }
424  break;
425  case SID_PARA_DLG:
426  {
427  const SfxItemSet* pArgs = rReq.GetArgs();
428 
429  if (!pArgs)
430  {
431  SwView* pView = &GetView();
432  FieldUnit eMetric = ::GetDfltMetric(dynamic_cast<SwWebView*>( pView) != nullptr );
433  SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric)) );
434  SfxItemSet aDlgAttr(
435  GetPool(),
436  svl::Items<
438  SID_ATTR_PARA_HYPHENZONE, SID_ATTR_PARA_WIDOWS>);
439 
440  aDlgAttr.Put(aEditAttr);
441 
442  aDlgAttr.Put( SvxHyphenZoneItem( false, RES_PARATR_HYPHENZONE) );
443  aDlgAttr.Put( SvxFormatBreakItem( SvxBreak::NONE, RES_BREAK ) );
444  aDlgAttr.Put( SvxFormatSplitItem( true, RES_PARATR_SPLIT ) );
445  aDlgAttr.Put( SvxWidowsItem( 0, RES_PARATR_WIDOWS ) );
446  aDlgAttr.Put( SvxOrphansItem( 0, RES_PARATR_ORPHANS ) );
447 
450  sal_uInt16 nRet = pDlg->Execute();
451  if(RET_OK == nRet)
452  {
453  rReq.Done( *( pDlg->GetOutputItemSet() ) );
454  aNewAttr.Put(*pDlg->GetOutputItemSet());
455  }
456  if(RET_OK != nRet)
457  return;
458  }
459  else
460  aNewAttr.Put(*pArgs);
461  }
462  break;
463  case SID_AUTOSPELL_CHECK:
464  {
467  SdrOutliner * pOutliner = pSdrView->GetTextEditOutliner();
468  EEControlBits nCtrl = pOutliner->GetControlWord();
469 
470  bool bSet = static_cast<const SfxBoolItem&>(rReq.GetArgs()->Get(
471  nSlot)).GetValue();
472  if(bSet)
473  nCtrl |= EEControlBits::ONLINESPELLING|EEControlBits::ALLOWBIGOBJS;
474  else
475  nCtrl &= ~EEControlBits::ONLINESPELLING;
476  pOutliner->SetControlWord(nCtrl);
477 
478  rView.ExecuteSlot(rReq);
479  }
480  break;
481  case SID_HYPERLINK_SETLINK:
482  {
483  const SfxPoolItem* pItem = nullptr;
484  if(pNewAttrs)
485  pNewAttrs->GetItemState(nSlot, false, &pItem);
486 
487  if(pItem)
488  {
489  const SvxHyperlinkItem& rHLinkItem = *static_cast<const SvxHyperlinkItem *>(pItem);
490  SvxURLField aField(rHLinkItem.GetURL(), rHLinkItem.GetName(), SvxURLFormat::AppDefault);
491  aField.SetTargetFrame(rHLinkItem.GetTargetFrame());
492 
493  const SvxFieldItem* pFieldItem = pOLV->GetFieldAtSelection();
494 
495  if (pFieldItem && dynamic_cast< const SvxURLField *>( pFieldItem->GetField() ) != nullptr )
496  {
497  // Select field so that it will be deleted during insert
498  ESelection aSel = pOLV->GetSelection();
499  aSel.nEndPos++;
500  pOLV->SetSelection(aSel);
501  }
502  pOLV->InsertField(SvxFieldItem(aField, EE_FEATURE_FIELD));
503  }
504  }
505  break;
506 
507  case SID_EDIT_HYPERLINK:
508  {
509  // Ensure the field is selected first
510  pOLV->SelectFieldAtCursor();
511  GetView().GetViewFrame()->GetDispatcher()->Execute(SID_HYPERLINK_DIALOG);
512  }
513  break;
514 
515  case SID_REMOVE_HYPERLINK:
516  {
518  }
519  break;
520 
521  case SID_OPEN_HYPERLINK:
522  {
523  const SvxFieldData* pField = pOLV->GetFieldAtCursor();
524  if (const SvxURLField* pURLField = dynamic_cast<const SvxURLField*>(pField))
525  {
526  SfxStringItem aUrl(SID_FILE_NAME, pURLField->GetURL());
527  SfxStringItem aTarget(SID_TARGETNAME, pURLField->GetTargetFrame());
528  SfxBoolItem aNewView(SID_OPEN_NEW_VIEW, false);
529  SfxBoolItem aBrowsing(SID_BROWSE, true);
531  SID_OPENDOC, SfxCallMode::SYNCHRON, { &aUrl, &aTarget, &aNewView, &aBrowsing });
532  }
533  }
534  break;
535 
536  case SID_COPY_HYPERLINK_LOCATION:
537  {
538  const SvxFieldData* pField = pOLV->GetFieldAtCursor();
539  if (const SvxURLField* pURLField = dynamic_cast<const SvxURLField*>(pField))
540  {
541  uno::Reference<datatransfer::clipboard::XClipboard> xClipboard
543  vcl::unohelper::TextDataObject::CopyStringTo(pURLField->GetURL(), xClipboard);
544  }
545  }
546  break;
547 
548  case SID_TEXTDIRECTION_LEFT_TO_RIGHT:
549  case SID_TEXTDIRECTION_TOP_TO_BOTTOM:
550  // Shell switch!
551  {
553  SdrPageView* pTmpPV = pSdrView->GetSdrPageView();
554  SdrView* pTmpView = pSdrView;
555 
556  pSdrView->SdrEndTextEdit(true);
557 
558  SfxItemSet aAttr( *aNewAttr.GetPool(),
560  SDRATTR_TEXTDIRECTION> );
561 
562  aAttr.Put( SvxWritingModeItem(
563  nSlot == SID_TEXTDIRECTION_LEFT_TO_RIGHT ?
564  text::WritingMode_LR_TB
565  : text::WritingMode_TB_RL, SDRATTR_TEXTDIRECTION ) );
566  pTmpView->SetAttributes( aAttr );
567 
568  rSh.GetView().BeginTextEdit( pTmpObj, pTmpPV, &rSh.GetView().GetEditWin());
569  rSh.GetView().AttrChangedNotify(nullptr);
570  }
571  return;
572 
573  case SID_ATTR_PARA_LEFT_TO_RIGHT:
574  case SID_ATTR_PARA_RIGHT_TO_LEFT:
575  {
577  SdrPageView* pTmpPV = pSdrView->GetSdrPageView();
578  SdrView* pTmpView = pSdrView;
579 
580  pSdrView->SdrEndTextEdit(true);
581  bool bLeftToRight = nSlot == SID_ATTR_PARA_LEFT_TO_RIGHT;
582 
583  const SfxPoolItem* pPoolItem;
584  if( pNewAttrs && SfxItemState::SET == pNewAttrs->GetItemState( nSlot, true, &pPoolItem ) )
585  {
586  if( !static_cast<const SfxBoolItem*>(pPoolItem)->GetValue() )
587  bLeftToRight = !bLeftToRight;
588  }
589  SfxItemSet aAttr(
590  *aNewAttr.GetPool(),
591  svl::Items<
592  EE_PARA_WRITINGDIR, EE_PARA_WRITINGDIR,
593  EE_PARA_JUST, EE_PARA_JUST>);
594 
595  SvxAdjust nAdjust = SvxAdjust::Left;
596  if( SfxItemState::SET == aEditAttr.GetItemState(EE_PARA_JUST, true, &pPoolItem ) )
597  nAdjust = static_cast<const SvxAdjustItem*>(pPoolItem)->GetAdjust();
598 
599  if( bLeftToRight )
600  {
601  aAttr.Put( SvxFrameDirectionItem( SvxFrameDirection::Horizontal_LR_TB, EE_PARA_WRITINGDIR ) );
602  if( nAdjust == SvxAdjust::Right )
603  aAttr.Put( SvxAdjustItem( SvxAdjust::Left, EE_PARA_JUST ) );
604  }
605  else
606  {
607  aAttr.Put( SvxFrameDirectionItem( SvxFrameDirection::Horizontal_RL_TB, EE_PARA_WRITINGDIR ) );
608  if( nAdjust == SvxAdjust::Left )
609  aAttr.Put( SvxAdjustItem( SvxAdjust::Right, EE_PARA_JUST ) );
610  }
611  pTmpView->SetAttributes( aAttr );
612  rSh.GetView().BeginTextEdit( pTmpObj, pTmpPV, &rSh.GetView().GetEditWin() );
613  rSh.GetView().AttrChangedNotify(nullptr);
614  }
615  return;
616 
617  case FN_GROW_FONT_SIZE:
618  case FN_SHRINK_FONT_SIZE:
619  {
620  const SvxFontListItem* pFontListItem = static_cast< const SvxFontListItem* >
621  ( SfxObjectShell::Current()->GetItem( SID_ATTR_CHAR_FONTLIST ) );
622  const FontList* pFontList = pFontListItem ? pFontListItem->GetFontList() : nullptr;
623  pOLV->GetEditView().ChangeFontSize( nSlot == FN_GROW_FONT_SIZE, pFontList );
624  }
625  break;
626 
627  default:
628  assert(false && "wrong dispatcher");
629  return;
630  }
631  if (nEEWhich && pNewAttrs)
632  {
633  lcl_convertStringArguments(nSlot, pNewAttrs);
634 
635  aNewAttr.Put(pNewAttrs->Get(nWhich).CloneSetWhich(nEEWhich));
636  }
637 
638  SetAttrToMarked(aNewAttr);
639 
641 
642  if (IsTextEdit() && pOLV->GetOutliner()->IsModified())
643  rSh.SetModified();
644 
645  if (bRestoreSelection)
646  {
647  // restore selection
648  pOLV->GetEditView().SetSelection( aOldSelection );
649  }
650 }
651 
653 {
654  if (!IsTextEdit()) // Otherwise sometimes crash!
655  return;
656 
658  SfxWhichIter aIter(rSet);
659  sal_uInt16 nWhich = aIter.FirstWhich();
660 
661  SfxItemSet aEditAttr(pOLV->GetAttribs());
662  const SfxPoolItem *pAdjust = nullptr, *pLSpace = nullptr, *pEscItem = nullptr;
663  SvxAdjust eAdjust;
664  int nLSpace;
665  SvxEscapement nEsc;
666 
667  while (nWhich)
668  {
669  sal_uInt16 nSlotId = GetPool().GetSlotId(nWhich);
670  bool bFlag = false;
671  switch (nSlotId)
672  {
673  case SID_LANGUAGE_STATUS: //20412:
674  {
676  nSlotId = 0;
677  break;
678  }
679 
680  case SID_THES:
681  {
682  OUString aStatusVal;
684  bool bIsLookUpWord
685  = GetStatusValueForThesaurusFromContext(aStatusVal, nLang, pOLV->GetEditView());
686  rSet.Put(SfxStringItem(SID_THES, aStatusVal));
687 
688  // disable "Thesaurus" context menu entry if there is nothing to look up
689  uno::Reference<linguistic2::XThesaurus> xThes(::GetThesaurus());
690  if (!bIsLookUpWord || !xThes.is() || nLang == LANGUAGE_NONE
691  || !xThes->hasLocale(LanguageTag::convertToLocale(nLang)))
692  rSet.DisableItem(SID_THES);
693 
695  nSlotId = 0;
696  break;
697  }
698 
699  case SID_ATTR_PARA_ADJUST_LEFT:
700  eAdjust = SvxAdjust::Left;
701  goto ASK_ADJUST;
702  case SID_ATTR_PARA_ADJUST_RIGHT:
703  eAdjust = SvxAdjust::Right;
704  goto ASK_ADJUST;
705  case SID_ATTR_PARA_ADJUST_CENTER:
706  eAdjust = SvxAdjust::Center;
707  goto ASK_ADJUST;
708  case SID_ATTR_PARA_ADJUST_BLOCK:
709  eAdjust = SvxAdjust::Block;
710  goto ASK_ADJUST;
711  ASK_ADJUST:
712  {
713  if (!pAdjust)
714  aEditAttr.GetItemState(EE_PARA_JUST, false, &pAdjust);
715 
716  if (!pAdjust || IsInvalidItem(pAdjust))
717  {
718  rSet.InvalidateItem(nSlotId);
719  nSlotId = 0;
720  }
721  else
722  bFlag = eAdjust == static_cast<const SvxAdjustItem*>(pAdjust)->GetAdjust();
723  }
724  break;
725 
726  case SID_ATTR_PARA_LRSPACE:
727  case SID_ATTR_PARA_LEFTSPACE:
728  case SID_ATTR_PARA_RIGHTSPACE:
729  case SID_ATTR_PARA_FIRSTLINESPACE:
730  {
731  SfxItemState eState = aEditAttr.GetItemState(EE_PARA_LRSPACE);
732  if (eState >= SfxItemState::DEFAULT)
733  {
734  SvxLRSpaceItem aLR = aEditAttr.Get(EE_PARA_LRSPACE);
735  aLR.SetWhich(SID_ATTR_PARA_LRSPACE);
736  rSet.Put(aLR);
737  }
738  else
739  rSet.InvalidateItem(nSlotId);
740  nSlotId = 0;
741  }
742  break;
743  case SID_ATTR_PARA_LINESPACE:
744  {
745  SfxItemState eState = aEditAttr.GetItemState(EE_PARA_SBL);
746  if (eState >= SfxItemState::DEFAULT)
747  {
748  const SvxLineSpacingItem& aLR = aEditAttr.Get(EE_PARA_SBL);
749  rSet.Put(aLR);
750  }
751  else
752  rSet.InvalidateItem(nSlotId);
753  nSlotId = 0;
754  }
755  break;
756  case SID_ATTR_PARA_ULSPACE:
757  case SID_ATTR_PARA_BELOWSPACE:
758  case SID_ATTR_PARA_ABOVESPACE:
759  case SID_PARASPACE_INCREASE:
760  case SID_PARASPACE_DECREASE:
761  {
762  SfxItemState eState = aEditAttr.GetItemState(EE_PARA_ULSPACE);
763  if (eState >= SfxItemState::DEFAULT)
764  {
765  SvxULSpaceItem aULSpace = aEditAttr.Get(EE_PARA_ULSPACE);
766  if (!aULSpace.GetUpper() && !aULSpace.GetLower())
767  rSet.DisableItem(SID_PARASPACE_DECREASE);
768  else if (aULSpace.GetUpper() >= 5670 && aULSpace.GetLower() >= 5670)
769  rSet.DisableItem(SID_PARASPACE_INCREASE);
770  if (nSlotId == SID_ATTR_PARA_ULSPACE || nSlotId == SID_ATTR_PARA_ABOVESPACE
771  || nSlotId == SID_ATTR_PARA_BELOWSPACE)
772  {
773  aULSpace.SetWhich(nSlotId);
774  rSet.Put(aULSpace);
775  }
776  }
777  else
778  {
779  rSet.DisableItem(SID_PARASPACE_INCREASE);
780  rSet.DisableItem(SID_PARASPACE_DECREASE);
781  rSet.InvalidateItem(SID_ATTR_PARA_ULSPACE);
782  rSet.InvalidateItem(SID_ATTR_PARA_ABOVESPACE);
783  rSet.InvalidateItem(SID_ATTR_PARA_BELOWSPACE);
784  }
785  nSlotId = 0;
786  }
787  break;
788 
789  case SID_ATTR_PARA_LINESPACE_10:
790  nLSpace = 100;
791  goto ASK_LINESPACE;
792  case SID_ATTR_PARA_LINESPACE_15:
793  nLSpace = 150;
794  goto ASK_LINESPACE;
795  case SID_ATTR_PARA_LINESPACE_20:
796  nLSpace = 200;
797  goto ASK_LINESPACE;
798  ASK_LINESPACE:
799  {
800  if (!pLSpace)
801  aEditAttr.GetItemState(EE_PARA_SBL, false, &pLSpace);
802 
803  if (!pLSpace || IsInvalidItem(pLSpace))
804  {
805  rSet.InvalidateItem(nSlotId);
806  nSlotId = 0;
807  }
808  else if (nLSpace
809  == static_cast<const SvxLineSpacingItem*>(pLSpace)->GetPropLineSpace())
810  bFlag = true;
811  else
812  nSlotId = 0;
813  }
814  break;
815 
816  case FN_SET_SUPER_SCRIPT:
817  nEsc = SvxEscapement::Superscript;
818  goto ASK_ESCAPE;
819  case FN_SET_SUB_SCRIPT:
820  nEsc = SvxEscapement::Subscript;
821  goto ASK_ESCAPE;
822  ASK_ESCAPE:
823  {
824  if (!pEscItem)
825  pEscItem = &aEditAttr.Get(EE_CHAR_ESCAPEMENT);
826 
827  if (nEsc == static_cast<const SvxEscapementItem*>(pEscItem)->GetEscapement())
828  bFlag = true;
829  else
830  nSlotId = 0;
831  }
832  break;
833 
834  case SID_THESAURUS:
835  {
836  // disable "Thesaurus" if the language is not supported
840  LanguageType nLang = static_cast<const SvxLanguageItem&>(rItem).GetLanguage();
841 
842  uno::Reference<linguistic2::XThesaurus> xThes(::GetThesaurus());
843  if (!xThes.is() || nLang == LANGUAGE_NONE
844  || !xThes->hasLocale(LanguageTag::convertToLocale(nLang)))
845  rSet.DisableItem(SID_THESAURUS);
846  nSlotId = 0;
847  }
848  break;
849  case SID_HANGUL_HANJA_CONVERSION:
850  case SID_CHINESE_CONVERSION:
851  {
853  {
854  GetView().GetViewFrame()->GetBindings().SetVisibleState(nWhich, false);
855  rSet.DisableItem(nWhich);
856  }
857  else
858  GetView().GetViewFrame()->GetBindings().SetVisibleState(nWhich, true);
859  }
860  break;
861 
862  case SID_TEXTDIRECTION_LEFT_TO_RIGHT:
863  case SID_TEXTDIRECTION_TOP_TO_BOTTOM:
865  {
866  rSet.DisableItem(nSlotId);
867  nSlotId = 0;
868  }
869  else
870  {
871  SdrOutliner* pOutliner = pSdrView->GetTextEditOutliner();
872  if (pOutliner)
873  bFlag = pOutliner->IsVertical()
874  == (SID_TEXTDIRECTION_TOP_TO_BOTTOM == nSlotId);
875  else
876  {
877  text::WritingMode eMode = aEditAttr.Get(SDRATTR_TEXTDIRECTION).GetValue();
878 
879  if (nSlotId == SID_TEXTDIRECTION_LEFT_TO_RIGHT)
880  {
881  bFlag = eMode == text::WritingMode_LR_TB;
882  }
883  else
884  {
885  bFlag = eMode != text::WritingMode_TB_RL;
886  }
887  }
888  }
889  break;
890  case SID_ATTR_PARA_LEFT_TO_RIGHT:
891  case SID_ATTR_PARA_RIGHT_TO_LEFT:
892  {
893  if (!SvtCTLOptions().IsCTLFontEnabled())
894  {
895  rSet.DisableItem(nWhich);
896  nSlotId = 0;
897  }
898  else
899  {
900  SdrOutliner* pOutliner = pSdrView->GetTextEditOutliner();
901  if (pOutliner && pOutliner->IsVertical())
902  {
903  rSet.DisableItem(nWhich);
904  nSlotId = 0;
905  }
906  else
907  {
908  switch (aEditAttr.Get(EE_PARA_WRITINGDIR).GetValue())
909  {
910  case SvxFrameDirection::Horizontal_LR_TB:
911  bFlag = nWhich == SID_ATTR_PARA_LEFT_TO_RIGHT;
912  break;
913 
914  case SvxFrameDirection::Horizontal_RL_TB:
915  bFlag = nWhich != SID_ATTR_PARA_LEFT_TO_RIGHT;
916  break;
917  default:
918  break;
919  }
920  }
921  }
922  }
923  break;
924  case SID_TRANSLITERATE_HALFWIDTH:
925  case SID_TRANSLITERATE_FULLWIDTH:
926  case SID_TRANSLITERATE_HIRAGANA:
927  case SID_TRANSLITERATE_KATAKANA:
928  {
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)
void SetURL(const OUString &rURL)
SfxViewFrame * GetViewFrame() const
OString stripEnd(std::string_view rIn, char c)
#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:308
bool BeginTextEdit(SdrObject *pObj, SdrPageView *pPV=nullptr, vcl::Window *pWin=nullptr, bool bIsNewObj=false, bool bSetSelectionToStart=false)
Definition: viewdraw.cxx:507
SdrView * pSdrView
Definition: drwtxtsh.hxx:35
static constexpr auto Items
void SelectPara(EditView &rEditView, const ESelection &rCurSel)
Definition: langhelper.cxx:555
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
constexpr::Color COL_TRANSPARENT(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
LanguageType GetLanguage(SfxItemSet const &aSet, sal_uInt16 nLangWhichId)
Definition: langhelper.cxx:390
void GetState(SfxItemSet &)
Definition: drwtxtex.cxx:652
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:416
void Execute(SfxRequest &)
Definition: drwtxtex.cxx:123
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:93
void GetDrawTextCtrlState(SfxItemSet &)
Definition: drwtxtex.cxx:969
void StateClpbrd(SfxItemSet &rSet)
Definition: drwtxtex.cxx:1138
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:431
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 SfxPoolItem & GetDefault(sal_uInt16 nFormatHint) const
Get the default attribute in this document.
Definition: docfmt.cxx:667
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:93
sal_Int16 GetI18NScriptTypeOfLanguage(LanguageType nLang)
const OUStringLiteral sColor
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:306
SfxItemPool & GetPool() 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:309
const SdrOutliner * GetTextEditOutliner() const
SvtScriptType
#define FN_NUMBERING_OUTLINE_DLG
Definition: cmdid.h:489
constexpr TypedWhichId< SvxColorItem > EE_CHAR_BKGCOLOR(EE_CHAR_START+32)
const OUString & GetURL() const
#define SW_MOD()
Definition: swmodule.hxx:256
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
SW_DLLPUBLIC FieldUnit GetDfltMetric(bool bWeb)
Definition: uitool.cxx:766
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:354
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:677
LINESTYLE_SINGLE
SvtScriptType GetSelectedScriptType() const
virtual void SetCurPageId(const OString &rName)=0
void GetLanguageStatus(OutlinerView *pOLV, SfxItemSet &rSet)
Definition: langhelper.cxx:57
sal_uInt16 GetWhichOfScript(sal_uInt16 nWhich, sal_uInt16 nScript)
Definition: hints.cxx:190
bool IsModified() const
short GetTextFirstLineOffset() const
void Paste(bool bUseSpecial=false)
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:593
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:168
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:684
#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:723
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:138
void SetAttrToMarked(const SfxItemSet &rAttr)
Definition: drwtxtsh.cxx:157
constexpr TypedWhichId< SvxLanguageItem > EE_CHAR_LANGUAGE(EE_CHAR_START+14)
#define FN_GROW_FONT_SIZE
Definition: cmdid.h:305
void SetInsertMode(SvxLinkInsertMode eNew)
SdrPageView * GetSdrPageView() const
#define FN_FORMAT_FOOTNOTE_DLG
Definition: cmdid.h:325
void SetSelection(const ESelection &rNewSel)
void AddClipbrdFormat(SotClipboardFormatId nId)
bool IsVerticalTextEnabled()
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
bool IsAnyEnabled()
bool IsChangeCaseMapEnabled()
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)