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