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 
83 using namespace ::com::sun::star;
84 
85 namespace
86 {
87  void lcl_convertStringArguments(sal_uInt16 nSlot, SfxItemSet& rArgs)
88  {
89  Color aColor;
90  OUString sColor;
91  const SfxStringItem* pItem = rArgs.GetItemIfSet(SID_ATTR_COLOR_STR, false);
92  if (!pItem)
93  return;
94 
95  sColor = pItem->GetValue();
96 
97  if (sColor == "transparent")
98  aColor = COL_TRANSPARENT;
99  else
100  aColor = Color(ColorTransparency, sColor.toInt32(16));
101 
102  switch (nSlot)
103  {
104  case SID_ATTR_CHAR_COLOR:
105  {
106  SvxColorItem aColorItem(aColor, EE_CHAR_COLOR);
107  rArgs.Put(aColorItem);
108  break;
109  }
110 
111  case SID_ATTR_CHAR_BACK_COLOR:
112  {
113  SvxColorItem pBackgroundItem(aColor, EE_CHAR_BKGCOLOR);
114  rArgs.Put(pBackgroundItem);
115  break;
116  }
117  }
118  }
119 }
120 
122 {
123  SwWrtShell &rSh = GetShell();
125  SfxItemSet aEditAttr(pOLV->GetAttribs());
126  SfxItemSet aNewAttr(*aEditAttr.GetPool(), aEditAttr.GetRanges());
127 
128  const sal_uInt16 nSlot = rReq.GetSlot();
129 
130  const sal_uInt16 nWhich = GetPool().GetWhich(nSlot);
131  std::optional<SfxItemSet> pNewAttrs;
132  if (rReq.GetArgs())
133  pNewAttrs.emplace(rReq.GetArgs()->CloneAsValue());
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(FN_PARAM_THES_WORD_REPLACE);
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  if (pNewAttrs)
261  {
262  SvxLineSpacingItem aLineSpace = static_cast<const SvxLineSpacingItem&>(pNewAttrs->Get(
263  GetPool().GetWhich(nSlot)));
264  aLineSpace.SetWhich( EE_PARA_SBL );
265  aNewAttr.Put( aLineSpace );
266  rReq.Done();
267  }
268  break;
269  case SID_ATTR_PARA_ULSPACE:
270  if (pNewAttrs)
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_115:
311  {
313  aItem.SetPropLineSpace(115);
314  aNewAttr.Put(aItem);
315  }
316  break;
317  case SID_ATTR_PARA_LINESPACE_15:
318  {
320  aItem.SetPropLineSpace(150);
321  aNewAttr.Put(aItem);
322  }
323  break;
324  case SID_ATTR_PARA_LINESPACE_20:
325  {
327  aItem.SetPropLineSpace(200);
328  aNewAttr.Put(aItem);
329  }
330  break;
331 
332  case FN_SET_SUPER_SCRIPT:
333  {
335  SvxEscapement eEsc = static_cast<SvxEscapement>(aEditAttr.Get( EE_CHAR_ESCAPEMENT ).GetEnumValue());
336 
337  if( eEsc == SvxEscapement::Superscript )
338  aItem.SetEscapement( SvxEscapement::Off );
339  else
340  aItem.SetEscapement( SvxEscapement::Superscript );
341  aNewAttr.Put( aItem );
342  }
343  break;
344  case FN_SET_SUB_SCRIPT:
345  {
347  SvxEscapement eEsc = static_cast<SvxEscapement>(aEditAttr.Get( EE_CHAR_ESCAPEMENT ).GetEnumValue());
348 
349  if( eEsc == SvxEscapement::Subscript )
350  aItem.SetEscapement( SvxEscapement::Off );
351  else
352  aItem.SetEscapement( SvxEscapement::Subscript );
353  aNewAttr.Put( aItem );
354  }
355  break;
356 
357  case SID_CHAR_DLG_EFFECT:
358  case SID_CHAR_DLG_POSITION:
359  case SID_CHAR_DLG:
360  case SID_CHAR_DLG_FOR_PARAGRAPH:
361  {
362  const SfxItemSet* pArgs = rReq.GetArgs();
363  const SfxStringItem* pItem = rReq.GetArg<SfxStringItem>(FN_PARAM_1);
364 
365  if( !pArgs || pItem )
366  {
367  aOldSelection = pOLV->GetSelection();
368  if (nSlot == SID_CHAR_DLG_FOR_PARAGRAPH)
369  {
370  // select current paragraph (and restore selection later on...)
371  EditView & rEditView = pOLV->GetEditView();
372  SwLangHelper::SelectPara( rEditView, rEditView.GetSelection() );
373  bRestoreSelection = true;
374  }
375 
376  SwView* pView = &GetView();
377  FieldUnit eMetric = ::GetDfltMetric(dynamic_cast<SwWebView*>( pView) != nullptr );
378  SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric)) );
380 
381  // util::Language does not exists in the EditEngine! That is why not in set.
382 
383  aDlgAttr.Put( aEditAttr );
384  aDlgAttr.Put( SvxKerningItem(0, RES_CHRATR_KERNING) );
385 
388  if (nSlot == SID_CHAR_DLG_EFFECT)
389  {
390  pDlg->SetCurPageId("fonteffects");
391  }
392  else if (nSlot == SID_CHAR_DLG_POSITION)
393  {
394  pDlg->SetCurPageId("position");
395  }
396  else if (nSlot == SID_CHAR_DLG_FOR_PARAGRAPH)
397  {
398  pDlg->SetCurPageId("font");
399  }
400  else if (pItem)
401  {
402  pDlg->SetCurPageId(OUStringToOString(pItem->GetValue(), RTL_TEXTENCODING_UTF8));
403  }
404 
405  sal_uInt16 nRet = pDlg->Execute();
406  if(RET_OK == nRet )
407  {
408  rReq.Done( *( pDlg->GetOutputItemSet() ) );
409  aNewAttr.Put(*pDlg->GetOutputItemSet());
410  }
411  if(RET_OK != nRet)
412  return ;
413  }
414  else
415  aNewAttr.Put(*pArgs);
416  }
417  break;
419  {
421  break;
422  }
424  {
426  rReq.Done();
427  }
428  break;
429  case SID_OPEN_XML_FILTERSETTINGS:
430  {
432  }
433  break;
434  case FN_WORDCOUNT_DIALOG:
435  {
436  GetView().UpdateWordCount(this, nSlot);
437  }
438  break;
439  case SID_PARA_DLG:
440  {
441  const SfxItemSet* pArgs = rReq.GetArgs();
442 
443  if (!pArgs)
444  {
445  SwView* pView = &GetView();
446  FieldUnit eMetric = ::GetDfltMetric(dynamic_cast<SwWebView*>( pView) != nullptr );
447  SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric)) );
450  SID_ATTR_PARA_HYPHENZONE, SID_ATTR_PARA_WIDOWS> aDlgAttr( GetPool() );
451 
452  aDlgAttr.Put(aEditAttr);
453 
454  aDlgAttr.Put( SvxHyphenZoneItem( false, RES_PARATR_HYPHENZONE) );
455  aDlgAttr.Put( SvxFormatBreakItem( SvxBreak::NONE, RES_BREAK ) );
456  aDlgAttr.Put( SvxFormatSplitItem( true, RES_PARATR_SPLIT ) );
457  aDlgAttr.Put( SvxWidowsItem( 0, RES_PARATR_WIDOWS ) );
458  aDlgAttr.Put( SvxOrphansItem( 0, RES_PARATR_ORPHANS ) );
459 
462  sal_uInt16 nRet = pDlg->Execute();
463  if(RET_OK == nRet)
464  {
465  rReq.Done( *( pDlg->GetOutputItemSet() ) );
466  aNewAttr.Put(*pDlg->GetOutputItemSet());
467  }
468  if(RET_OK != nRet)
469  return;
470  }
471  else
472  aNewAttr.Put(*pArgs);
473  }
474  break;
475  case SID_AUTOSPELL_CHECK:
476  {
479  SdrOutliner * pOutliner = m_pSdrView->GetTextEditOutliner();
480  EEControlBits nCtrl = pOutliner->GetControlWord();
481 
482  bool bSet = static_cast<const SfxBoolItem&>(rReq.GetArgs()->Get(
483  nSlot)).GetValue();
484  if(bSet)
485  nCtrl |= EEControlBits::ONLINESPELLING|EEControlBits::ALLOWBIGOBJS;
486  else
487  nCtrl &= ~EEControlBits::ONLINESPELLING;
488  pOutliner->SetControlWord(nCtrl);
489 
490  m_rView.ExecuteSlot(rReq);
491  }
492  break;
493  case SID_HYPERLINK_SETLINK:
494  {
495  const SfxPoolItem* pItem = nullptr;
496  if(pNewAttrs)
497  pNewAttrs->GetItemState(nSlot, false, &pItem);
498 
499  if(pItem)
500  {
501  const SvxHyperlinkItem& rHLinkItem = *static_cast<const SvxHyperlinkItem *>(pItem);
502  SvxURLField aField(rHLinkItem.GetURL(), rHLinkItem.GetName(), SvxURLFormat::AppDefault);
503  aField.SetTargetFrame(rHLinkItem.GetTargetFrame());
504 
505  const SvxFieldItem* pFieldItem = pOLV->GetFieldAtSelection();
506 
507  if (pFieldItem && dynamic_cast< const SvxURLField *>( pFieldItem->GetField() ) != nullptr )
508  {
509  // Select field so that it will be deleted during insert
510  ESelection aSel = pOLV->GetSelection();
511  aSel.nEndPos++;
512  pOLV->SetSelection(aSel);
513  }
514  pOLV->InsertField(SvxFieldItem(aField, EE_FEATURE_FIELD));
515  }
516  }
517  break;
518 
519  case SID_EDIT_HYPERLINK:
520  {
521  // Ensure the field is selected first
522  pOLV->SelectFieldAtCursor();
523  GetView().GetViewFrame()->GetDispatcher()->Execute(SID_HYPERLINK_DIALOG);
524  }
525  break;
526 
527  case SID_REMOVE_HYPERLINK:
528  {
530  }
531  break;
532 
533  case SID_OPEN_HYPERLINK:
534  {
535  const SvxFieldData* pField = pOLV->GetFieldAtCursor();
536  if (const SvxURLField* pURLField = dynamic_cast<const SvxURLField*>(pField))
537  {
538  SfxStringItem aUrl(SID_FILE_NAME, pURLField->GetURL());
539  SfxStringItem aTarget(SID_TARGETNAME, pURLField->GetTargetFrame());
540  SfxBoolItem aNewView(SID_OPEN_NEW_VIEW, false);
541  SfxBoolItem aBrowsing(SID_BROWSE, true);
543  SID_OPENDOC, SfxCallMode::SYNCHRON, { &aUrl, &aTarget, &aNewView, &aBrowsing });
544  }
545  }
546  break;
547 
548  case SID_COPY_HYPERLINK_LOCATION:
549  {
550  const SvxFieldData* pField = pOLV->GetFieldAtCursor();
551  if (const SvxURLField* pURLField = dynamic_cast<const SvxURLField*>(pField))
552  {
553  uno::Reference<datatransfer::clipboard::XClipboard> xClipboard
555  vcl::unohelper::TextDataObject::CopyStringTo(pURLField->GetURL(), xClipboard);
556  }
557  }
558  break;
559 
560  case SID_TEXTDIRECTION_LEFT_TO_RIGHT:
561  case SID_TEXTDIRECTION_TOP_TO_BOTTOM:
562  // Shell switch!
563  {
566  SdrView* pTmpView = m_pSdrView;
567 
568  m_pSdrView->SdrEndTextEdit(true);
569 
571  SDRATTR_TEXTDIRECTION> aAttr( *aNewAttr.GetPool() );
572 
573  aAttr.Put( SvxWritingModeItem(
574  nSlot == SID_TEXTDIRECTION_LEFT_TO_RIGHT ?
575  text::WritingMode_LR_TB
576  : text::WritingMode_TB_RL, SDRATTR_TEXTDIRECTION ) );
577  pTmpView->SetAttributes( aAttr );
578 
579  rSh.GetView().BeginTextEdit( pTmpObj, pTmpPV, &rSh.GetView().GetEditWin());
580  rSh.GetView().AttrChangedNotify(nullptr);
581  }
582  return;
583 
584  case SID_ATTR_PARA_LEFT_TO_RIGHT:
585  case SID_ATTR_PARA_RIGHT_TO_LEFT:
586  {
589  SdrView* pTmpView = m_pSdrView;
590 
591  m_pSdrView->SdrEndTextEdit(true);
592  bool bLeftToRight = nSlot == SID_ATTR_PARA_LEFT_TO_RIGHT;
593 
594  const SfxPoolItem* pPoolItem;
595  if( pNewAttrs && SfxItemState::SET == pNewAttrs->GetItemState( nSlot, true, &pPoolItem ) )
596  {
597  if( !static_cast<const SfxBoolItem*>(pPoolItem)->GetValue() )
598  bLeftToRight = !bLeftToRight;
599  }
601  EE_PARA_WRITINGDIR, EE_PARA_WRITINGDIR,
602  EE_PARA_JUST, EE_PARA_JUST> aAttr( *aNewAttr.GetPool() );
603 
604  SvxAdjust nAdjust = SvxAdjust::Left;
605  if( const SvxAdjustItem* pAdjustItem = aEditAttr.GetItemIfSet(EE_PARA_JUST) )
606  nAdjust = pAdjustItem->GetAdjust();
607 
608  if( bLeftToRight )
609  {
610  aAttr.Put( SvxFrameDirectionItem( SvxFrameDirection::Horizontal_LR_TB, EE_PARA_WRITINGDIR ) );
611  if( nAdjust == SvxAdjust::Right )
612  aAttr.Put( SvxAdjustItem( SvxAdjust::Left, EE_PARA_JUST ) );
613  }
614  else
615  {
616  aAttr.Put( SvxFrameDirectionItem( SvxFrameDirection::Horizontal_RL_TB, EE_PARA_WRITINGDIR ) );
617  if( nAdjust == SvxAdjust::Left )
618  aAttr.Put( SvxAdjustItem( SvxAdjust::Right, EE_PARA_JUST ) );
619  }
620  pTmpView->SetAttributes( aAttr );
621  rSh.GetView().BeginTextEdit( pTmpObj, pTmpPV, &rSh.GetView().GetEditWin() );
622  rSh.GetView().AttrChangedNotify(nullptr);
623  }
624  return;
625 
626  case FN_GROW_FONT_SIZE:
627  case FN_SHRINK_FONT_SIZE:
628  {
629  const SvxFontListItem* pFontListItem = static_cast< const SvxFontListItem* >
630  ( SfxObjectShell::Current()->GetItem( SID_ATTR_CHAR_FONTLIST ) );
631  const FontList* pFontList = pFontListItem ? pFontListItem->GetFontList() : nullptr;
632  pOLV->GetEditView().ChangeFontSize( nSlot == FN_GROW_FONT_SIZE, pFontList );
633  }
634  break;
635 
636  default:
637  assert(false && "wrong dispatcher");
638  return;
639  }
640  if (nEEWhich && pNewAttrs)
641  {
642  lcl_convertStringArguments(nSlot, *pNewAttrs);
643 
644  aNewAttr.Put(pNewAttrs->Get(nWhich).CloneSetWhich(nEEWhich));
645  }
646  else if (nEEWhich == EE_CHAR_COLOR)
647  {
648  GetView().GetViewFrame()->GetDispatcher()->Execute(SID_CHAR_DLG_EFFECT);
649  }
650  else if (nEEWhich == EE_CHAR_KERNING)
651  {
652  GetView().GetViewFrame()->GetDispatcher()->Execute(SID_CHAR_DLG_POSITION);
653  }
654 
655 
656  SetAttrToMarked(aNewAttr);
657 
659 
660  if (IsTextEdit() && pOLV->GetOutliner()->IsModified())
661  rSh.SetModified();
662 
663  if (bRestoreSelection)
664  {
665  // restore selection
666  pOLV->GetEditView().SetSelection( aOldSelection );
667  }
668 }
669 
671 {
672  if (!IsTextEdit()) // Otherwise sometimes crash!
673  return;
674 
676  SfxWhichIter aIter(rSet);
677  sal_uInt16 nWhich = aIter.FirstWhich();
678 
679  SfxItemSet aEditAttr(pOLV->GetAttribs());
680  const SvxAdjustItem *pAdjust = nullptr;
681  const SvxLineSpacingItem *pLSpace = nullptr;
682  const SfxPoolItem *pEscItem = nullptr;
683  SvxAdjust eAdjust;
684  int nLSpace;
685  SvxEscapement nEsc;
686 
687  while (nWhich)
688  {
689  sal_uInt16 nSlotId = GetPool().GetSlotId(nWhich);
690  bool bFlag = false;
691  switch (nSlotId)
692  {
693  case SID_LANGUAGE_STATUS: //20412:
694  {
696  nSlotId = 0;
697  break;
698  }
699 
700  case SID_THES:
701  {
702  OUString aStatusVal;
704  bool bIsLookUpWord
705  = GetStatusValueForThesaurusFromContext(aStatusVal, nLang, pOLV->GetEditView());
706  rSet.Put(SfxStringItem(FN_PARAM_THES_WORD_REPLACE, aStatusVal));
707 
708  // disable "Thesaurus" context menu entry if there is nothing to look up
709  uno::Reference<linguistic2::XThesaurus> xThes(::GetThesaurus());
710  if (!bIsLookUpWord || !xThes.is() || nLang == LANGUAGE_NONE
711  || !xThes->hasLocale(LanguageTag::convertToLocale(nLang)))
712  rSet.DisableItem(SID_THES);
713 
715  nSlotId = 0;
716  break;
717  }
718 
719  case SID_ATTR_PARA_ADJUST_LEFT:
720  eAdjust = SvxAdjust::Left;
721  goto ASK_ADJUST;
722  case SID_ATTR_PARA_ADJUST_RIGHT:
723  eAdjust = SvxAdjust::Right;
724  goto ASK_ADJUST;
725  case SID_ATTR_PARA_ADJUST_CENTER:
726  eAdjust = SvxAdjust::Center;
727  goto ASK_ADJUST;
728  case SID_ATTR_PARA_ADJUST_BLOCK:
729  eAdjust = SvxAdjust::Block;
730  goto ASK_ADJUST;
731  ASK_ADJUST:
732  {
733  if (!pAdjust)
734  pAdjust = aEditAttr.GetItemIfSet(EE_PARA_JUST, false);
735 
736  if (!pAdjust || IsInvalidItem(pAdjust))
737  {
738  rSet.InvalidateItem(nSlotId);
739  nSlotId = 0;
740  }
741  else
742  bFlag = eAdjust == pAdjust->GetAdjust();
743  }
744  break;
745 
746  case SID_ATTR_PARA_LRSPACE:
747  case SID_ATTR_PARA_LEFTSPACE:
748  case SID_ATTR_PARA_RIGHTSPACE:
749  case SID_ATTR_PARA_FIRSTLINESPACE:
750  {
751  SfxItemState eState = aEditAttr.GetItemState(EE_PARA_LRSPACE);
752  if (eState >= SfxItemState::DEFAULT)
753  {
754  SvxLRSpaceItem aLR = aEditAttr.Get(EE_PARA_LRSPACE);
755  aLR.SetWhich(SID_ATTR_PARA_LRSPACE);
756  rSet.Put(aLR);
757  }
758  else
759  rSet.InvalidateItem(nSlotId);
760  nSlotId = 0;
761  }
762  break;
763  case SID_ATTR_PARA_LINESPACE:
764  {
765  SfxItemState eState = aEditAttr.GetItemState(EE_PARA_SBL);
766  if (eState >= SfxItemState::DEFAULT)
767  {
768  const SvxLineSpacingItem& aLR = aEditAttr.Get(EE_PARA_SBL);
769  rSet.Put(aLR);
770  }
771  else
772  rSet.InvalidateItem(nSlotId);
773  nSlotId = 0;
774  }
775  break;
776  case SID_ATTR_PARA_ULSPACE:
777  case SID_ATTR_PARA_BELOWSPACE:
778  case SID_ATTR_PARA_ABOVESPACE:
779  case SID_PARASPACE_INCREASE:
780  case SID_PARASPACE_DECREASE:
781  {
782  SfxItemState eState = aEditAttr.GetItemState(EE_PARA_ULSPACE);
783  if (eState >= SfxItemState::DEFAULT)
784  {
785  SvxULSpaceItem aULSpace = aEditAttr.Get(EE_PARA_ULSPACE);
786  if (!aULSpace.GetUpper() && !aULSpace.GetLower())
787  rSet.DisableItem(SID_PARASPACE_DECREASE);
788  else if (aULSpace.GetUpper() >= 5670 && aULSpace.GetLower() >= 5670)
789  rSet.DisableItem(SID_PARASPACE_INCREASE);
790  if (nSlotId == SID_ATTR_PARA_ULSPACE || nSlotId == SID_ATTR_PARA_ABOVESPACE
791  || nSlotId == SID_ATTR_PARA_BELOWSPACE)
792  {
793  aULSpace.SetWhich(nSlotId);
794  rSet.Put(aULSpace);
795  }
796  }
797  else
798  {
799  rSet.DisableItem(SID_PARASPACE_INCREASE);
800  rSet.DisableItem(SID_PARASPACE_DECREASE);
801  rSet.InvalidateItem(SID_ATTR_PARA_ULSPACE);
802  rSet.InvalidateItem(SID_ATTR_PARA_ABOVESPACE);
803  rSet.InvalidateItem(SID_ATTR_PARA_BELOWSPACE);
804  }
805  nSlotId = 0;
806  }
807  break;
808 
809  case SID_ATTR_PARA_LINESPACE_10:
810  nLSpace = 100;
811  goto ASK_LINESPACE;
812  case SID_ATTR_PARA_LINESPACE_115:
813  nLSpace = 115;
814  goto ASK_LINESPACE;
815  case SID_ATTR_PARA_LINESPACE_15:
816  nLSpace = 150;
817  goto ASK_LINESPACE;
818  case SID_ATTR_PARA_LINESPACE_20:
819  nLSpace = 200;
820  goto ASK_LINESPACE;
821  ASK_LINESPACE:
822  {
823  if (!pLSpace)
824  pLSpace = aEditAttr.GetItemIfSet(EE_PARA_SBL, false);
825 
826  if (!pLSpace || IsInvalidItem(pLSpace))
827  {
828  rSet.InvalidateItem(nSlotId);
829  nSlotId = 0;
830  }
831  else if (nLSpace
832  == pLSpace->GetPropLineSpace())
833  bFlag = true;
834  else
835  {
836  // tdf#114631 - disable non selected line spacing
837  rSet.Put(SfxBoolItem(nWhich, false));
838  nSlotId = 0;
839  }
840  }
841  break;
842 
843  case FN_SET_SUPER_SCRIPT:
844  nEsc = SvxEscapement::Superscript;
845  goto ASK_ESCAPE;
846  case FN_SET_SUB_SCRIPT:
847  nEsc = SvxEscapement::Subscript;
848  goto ASK_ESCAPE;
849  ASK_ESCAPE:
850  {
851  if (!pEscItem)
852  pEscItem = &aEditAttr.Get(EE_CHAR_ESCAPEMENT);
853 
854  if (nEsc == static_cast<const SvxEscapementItem*>(pEscItem)->GetEscapement())
855  bFlag = true;
856  else
857  nSlotId = 0;
858  }
859  break;
860 
861  case SID_THESAURUS:
862  {
863  // disable "Thesaurus" if the language is not supported
867  LanguageType nLang = static_cast<const SvxLanguageItem&>(rItem).GetLanguage();
868 
869  uno::Reference<linguistic2::XThesaurus> xThes(::GetThesaurus());
870  if (!xThes.is() || nLang == LANGUAGE_NONE
871  || !xThes->hasLocale(LanguageTag::convertToLocale(nLang)))
872  rSet.DisableItem(SID_THESAURUS);
873  nSlotId = 0;
874  }
875  break;
876  case SID_HANGUL_HANJA_CONVERSION:
877  case SID_CHINESE_CONVERSION:
878  {
880  {
881  GetView().GetViewFrame()->GetBindings().SetVisibleState(nWhich, false);
882  rSet.DisableItem(nWhich);
883  }
884  else
885  GetView().GetViewFrame()->GetBindings().SetVisibleState(nWhich, true);
886  }
887  break;
888 
889  case SID_TEXTDIRECTION_LEFT_TO_RIGHT:
890  case SID_TEXTDIRECTION_TOP_TO_BOTTOM:
892  {
893  rSet.DisableItem(nSlotId);
894  nSlotId = 0;
895  }
896  else
897  {
899  if (pOutliner)
900  bFlag = pOutliner->IsVertical()
901  == (SID_TEXTDIRECTION_TOP_TO_BOTTOM == nSlotId);
902  else
903  {
904  text::WritingMode eMode = aEditAttr.Get(SDRATTR_TEXTDIRECTION).GetValue();
905 
906  if (nSlotId == SID_TEXTDIRECTION_LEFT_TO_RIGHT)
907  {
908  bFlag = eMode == text::WritingMode_LR_TB;
909  }
910  else
911  {
912  bFlag = eMode != text::WritingMode_TB_RL;
913  }
914  }
915  }
916  break;
917  case SID_ATTR_PARA_LEFT_TO_RIGHT:
918  case SID_ATTR_PARA_RIGHT_TO_LEFT:
919  {
920  if (!SvtCTLOptions().IsCTLFontEnabled())
921  {
922  rSet.DisableItem(nWhich);
923  nSlotId = 0;
924  }
925  else
926  {
928  if (pOutliner && pOutliner->IsVertical())
929  {
930  rSet.DisableItem(nWhich);
931  nSlotId = 0;
932  }
933  else
934  {
935  switch (aEditAttr.Get(EE_PARA_WRITINGDIR).GetValue())
936  {
937  case SvxFrameDirection::Horizontal_LR_TB:
938  bFlag = nWhich == SID_ATTR_PARA_LEFT_TO_RIGHT;
939  break;
940 
941  case SvxFrameDirection::Horizontal_RL_TB:
942  bFlag = nWhich != SID_ATTR_PARA_LEFT_TO_RIGHT;
943  break;
944  default:
945  break;
946  }
947  }
948  }
949  }
950  break;
951  case SID_TRANSLITERATE_HALFWIDTH:
952  case SID_TRANSLITERATE_FULLWIDTH:
953  case SID_TRANSLITERATE_HIRAGANA:
954  case SID_TRANSLITERATE_KATAKANA:
955  {
957  {
958  rSet.DisableItem(nWhich);
959  GetView().GetViewFrame()->GetBindings().SetVisibleState(nWhich, false);
960  }
961  else
962  GetView().GetViewFrame()->GetBindings().SetVisibleState(nWhich, true);
963  }
964  break;
965  case SID_INSERT_RLM:
966  case SID_INSERT_LRM:
967  {
968  SvtCTLOptions aCTLOptions;
969  bool bEnabled = aCTLOptions.IsCTLFontEnabled();
970  GetView().GetViewFrame()->GetBindings().SetVisibleState(nWhich, bEnabled);
971  if (!bEnabled)
972  rSet.DisableItem(nWhich);
973  }
974  break;
975  case SID_REMOVE_HYPERLINK:
976  case SID_EDIT_HYPERLINK:
977  case SID_OPEN_HYPERLINK:
978  case SID_COPY_HYPERLINK_LOCATION:
979  {
981  rSet.DisableItem(nWhich);
982  nSlotId = 0;
983  }
984  break;
985  default:
986  nSlotId = 0; // don't know this slot
987  break;
988  }
989 
990  if (nSlotId)
991  rSet.Put(SfxBoolItem(nWhich, bFlag));
992 
993  nWhich = aIter.NextWhich();
994  }
995 }
996 
998 {
999  if (!IsTextEdit()) // Otherwise crash!
1000  return;
1001 
1003  SfxItemSet aEditAttr(pOLV->GetAttribs());
1004 
1005  SfxWhichIter aIter(rSet);
1006  sal_uInt16 nWhich = aIter.FirstWhich();
1007  SvtScriptType nScriptType = pOLV->GetSelectedScriptType();
1008  while(nWhich)
1009  {
1010  sal_uInt16 nEEWhich = 0;
1011  sal_uInt16 nSlotId = GetPool().GetSlotId( nWhich );
1012  switch( nSlotId )
1013  {
1014  case SID_ATTR_CHAR_FONT:
1015  case SID_ATTR_CHAR_FONTHEIGHT:
1016  case SID_ATTR_CHAR_WEIGHT:
1017  case SID_ATTR_CHAR_POSTURE:
1018  {
1019  SfxItemPool* pEditPool = aEditAttr.GetPool()->GetSecondaryPool();
1020  if( !pEditPool )
1021  pEditPool = aEditAttr.GetPool();
1022  SvxScriptSetItem aSetItem( nSlotId, *pEditPool );
1023  aSetItem.GetItemSet().Put( aEditAttr, false );
1024  const SfxPoolItem* pI = aSetItem.GetItemOfScript( nScriptType );
1025  if( pI )
1026  {
1027  rSet.Put(pI->CloneSetWhich(nWhich));
1028  }
1029  else
1030  rSet.InvalidateItem( nWhich );
1031  }
1032  break;
1033  case SID_ATTR_CHAR_COLOR: nEEWhich = EE_CHAR_COLOR; break;
1034  case SID_ATTR_CHAR_BACK_COLOR: nEEWhich = EE_CHAR_BKGCOLOR; break;
1035  case SID_ATTR_CHAR_UNDERLINE: nEEWhich = EE_CHAR_UNDERLINE;break;
1036  case SID_ATTR_CHAR_OVERLINE: nEEWhich = EE_CHAR_OVERLINE;break;
1037  case SID_ATTR_CHAR_CONTOUR: nEEWhich = EE_CHAR_OUTLINE; break;
1038  case SID_ATTR_CHAR_SHADOWED: nEEWhich = EE_CHAR_SHADOW;break;
1039  case SID_ATTR_CHAR_STRIKEOUT: nEEWhich = EE_CHAR_STRIKEOUT;break;
1040  case SID_AUTOSPELL_CHECK:
1041  {
1042  const SfxPoolItem* pState = m_rView.GetSlotState(nWhich);
1043  if (pState)
1044  rSet.Put(SfxBoolItem(nWhich, static_cast<const SfxBoolItem*>(pState)->GetValue()));
1045  else
1046  rSet.DisableItem( nWhich );
1047  break;
1048  }
1049  case SID_ATTR_CHAR_WORDLINEMODE: nEEWhich = EE_CHAR_WLM; break;
1050  case SID_ATTR_CHAR_RELIEF : nEEWhich = EE_CHAR_RELIEF; break;
1051  case SID_ATTR_CHAR_LANGUAGE : nEEWhich = EE_CHAR_LANGUAGE;break;
1052  case SID_ATTR_CHAR_KERNING : nEEWhich = EE_CHAR_KERNING; break;
1053  case SID_ATTR_CHAR_SCALEWIDTH: nEEWhich = EE_CHAR_FONTWIDTH;break;
1054  case SID_ATTR_CHAR_AUTOKERN : nEEWhich = EE_CHAR_PAIRKERNING; break;
1055  case SID_ATTR_CHAR_ESCAPEMENT: nEEWhich = EE_CHAR_ESCAPEMENT; break;
1056  case FN_GROW_FONT_SIZE:
1057  case FN_SHRINK_FONT_SIZE:
1058  {
1059  SfxItemPool* pEditPool = aEditAttr.GetPool()->GetSecondaryPool();
1060  if( !pEditPool )
1061  pEditPool = aEditAttr.GetPool();
1062 
1063  SvxScriptSetItem aSetItem( SID_ATTR_CHAR_FONTHEIGHT, *pEditPool );
1064  aSetItem.GetItemSet().Put( aEditAttr, false );
1065  const SvxFontHeightItem* pSize( static_cast<const SvxFontHeightItem*>( aSetItem.GetItemOfScript( nScriptType ) ) );
1066 
1067  if( pSize )
1068  {
1069  sal_uInt32 nSize = pSize->GetHeight();
1070  if( nSize >= 19998 )
1072  else if( nSize <= 40 )
1074  }
1075  }
1076  }
1077  if(nEEWhich)
1078  {
1079  rSet.Put(aEditAttr.Get(nEEWhich).CloneSetWhich(nWhich));
1080  }
1081 
1082  nWhich = aIter.NextWhich();
1083  }
1084 }
1085 
1087 {
1088  if (!IsTextEdit()) // Otherwise crash!
1089  return;
1090 
1092 
1093  ESelection aSel(pOLV->GetSelection());
1094  const bool bCopy = (aSel.nStartPara != aSel.nEndPara) || (aSel.nStartPos != aSel.nEndPos);
1095  sal_uInt16 nId = rReq.GetSlot();
1096  switch( nId )
1097  {
1098  case SID_CUT:
1099  if (bCopy)
1100  pOLV->Cut();
1101  return;
1102 
1103  case SID_COPY:
1104  if (bCopy)
1105  pOLV->Copy();
1106  return;
1107 
1108  case SID_PASTE:
1109  pOLV->PasteSpecial();
1110  break;
1111 
1112  case SID_PASTE_UNFORMATTED:
1113  pOLV->Paste();
1114  break;
1115 
1116  case SID_PASTE_SPECIAL:
1117  {
1119  ScopedVclPtr<SfxAbstractPasteDialog> pDlg(pFact->CreatePasteDialog(GetView().GetEditWin().GetFrameWeld()));
1120 
1121  pDlg->Insert(SotClipboardFormatId::STRING, OUString());
1122  pDlg->Insert(SotClipboardFormatId::RTF, OUString());
1123  pDlg->Insert(SotClipboardFormatId::RICHTEXT, OUString());
1124 
1126  SotClipboardFormatId nFormat = pDlg->GetFormat(aDataHelper.GetTransferable());
1127 
1128  if (nFormat != SotClipboardFormatId::NONE)
1129  {
1130  if (nFormat == SotClipboardFormatId::STRING)
1131  pOLV->Paste();
1132  else
1133  pOLV->PasteSpecial();
1134  }
1135 
1136  break;
1137  }
1138 
1139  case SID_CLIPBOARD_FORMAT_ITEMS:
1140  {
1141  SotClipboardFormatId nFormat = SotClipboardFormatId::NONE;
1142  const SfxPoolItem* pItem;
1143  if (rReq.GetArgs() && rReq.GetArgs()->GetItemState(nId, true, &pItem) == SfxItemState::SET)
1144  {
1145  if (const SfxUInt32Item* pUInt32Item = dynamic_cast<const SfxUInt32Item *>(pItem))
1146  nFormat = static_cast<SotClipboardFormatId>(pUInt32Item->GetValue());
1147  }
1148 
1149  if (nFormat != SotClipboardFormatId::NONE)
1150  {
1151  if (nFormat == SotClipboardFormatId::STRING)
1152  pOLV->Paste();
1153  else
1154  pOLV->PasteSpecial();
1155  }
1156 
1157  break;
1158  }
1159 
1160  default:
1161  OSL_FAIL("wrong dispatcher");
1162  return;
1163  }
1164 }
1165 
1167 {
1168  if (!IsTextEdit()) // Otherwise crash!
1169  return;
1170 
1172  ESelection aSel(pOLV->GetSelection());
1173  const bool bCopy = (aSel.nStartPara != aSel.nEndPara) ||
1174  (aSel.nStartPos != aSel.nEndPos);
1175 
1177  const bool bPaste = aDataHelper.HasFormat( SotClipboardFormatId::STRING ) ||
1178  aDataHelper.HasFormat( SotClipboardFormatId::RTF ) ||
1179  aDataHelper.HasFormat( SotClipboardFormatId::RICHTEXT );
1180 
1181  SfxWhichIter aIter(rSet);
1182  sal_uInt16 nWhich = aIter.FirstWhich();
1183 
1184  while(nWhich)
1185  {
1186  switch(nWhich)
1187  {
1188  case SID_CUT:
1189  case SID_COPY:
1190  if( !bCopy || GetObjectShell()->isContentExtractionLocked())
1191  rSet.DisableItem( nWhich );
1192  break;
1193 
1194  case SID_PASTE:
1195  case SID_PASTE_UNFORMATTED:
1196  case SID_PASTE_SPECIAL:
1197  if( !bPaste )
1198  rSet.DisableItem( nWhich );
1199  break;
1200 
1201  case SID_CLIPBOARD_FORMAT_ITEMS:
1202  if( bPaste )
1203  {
1204  SvxClipboardFormatItem aFormats( SID_CLIPBOARD_FORMAT_ITEMS );
1205 
1206  if ( aDataHelper.HasFormat( SotClipboardFormatId::STRING ) )
1207  aFormats.AddClipbrdFormat( SotClipboardFormatId::STRING );
1208  if ( aDataHelper.HasFormat( SotClipboardFormatId::RTF ) )
1209  aFormats.AddClipbrdFormat( SotClipboardFormatId::RTF );
1210  if ( aDataHelper.HasFormat( SotClipboardFormatId::RICHTEXT ) )
1211  aFormats.AddClipbrdFormat( SotClipboardFormatId::RICHTEXT );
1212 
1213  rSet.Put( aFormats );
1214  }
1215  else
1216  rSet.DisableItem( nWhich );
1217  break;
1218  }
1219 
1220  nWhich = aIter.NextWhich();
1221  }
1222 }
1223 
1224 // Hyperlink status
1225 
1227 {
1228  if (!IsTextEdit()) // Otherwise crash!
1229  return;
1230 
1232  SfxWhichIter aIter(rSet);
1233  sal_uInt16 nWhich = aIter.FirstWhich();
1234 
1235  while(nWhich)
1236  {
1237  switch(nWhich)
1238  {
1239  case SID_HYPERLINK_GETLINK:
1240  {
1241  SvxHyperlinkItem aHLinkItem;
1242  aHLinkItem.SetInsertMode(HLINK_FIELD);
1243 
1244  const SvxFieldItem* pFieldItem = pOLV->GetFieldAtSelection();
1245 
1246  if (pFieldItem)
1247  {
1248  const SvxURLField* pURLField = dynamic_cast<const SvxURLField*>(pFieldItem->GetField());
1249 
1250  if (pURLField)
1251  {
1252  aHLinkItem.SetName(pURLField->GetRepresentation());
1253  aHLinkItem.SetURL(pURLField->GetURL());
1254  aHLinkItem.SetTargetFrame(pURLField->GetTargetFrame());
1255  }
1256  }
1257  else
1258  {
1259  OUString sSel(pOLV->GetSelected());
1260  sSel = sSel.copy(0, std::min<sal_Int32>(255, sSel.getLength()));
1261  aHLinkItem.SetName(comphelper::string::stripEnd(sSel, ' '));
1262  }
1263 
1264  sal_uInt16 nHtmlMode = ::GetHtmlMode(GetView().GetDocShell());
1265  aHLinkItem.SetInsertMode(static_cast<SvxLinkInsertMode>(aHLinkItem.GetInsertMode() |
1266  ((nHtmlMode & HTMLMODE_ON) != 0 ? HLINK_HTMLMODE : 0)));
1267 
1268  rSet.Put(aHLinkItem);
1269  }
1270  break;
1271  }
1272  nWhich = aIter.NextWhich();
1273  }
1274 }
1275 
1276 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const SfxPoolItem * ExecuteSlot(SfxRequest &rReq, const SfxInterface *pIF=nullptr)
OString stripEnd(const OString &rIn, char c)
void SetURL(const OUString &rURL)
SfxViewFrame * GetViewFrame() const
#define LANGUAGE_NONE
const SfxPoolItem * ExecuteList(sal_uInt16 nSlot, SfxCallMode nCall, std::initializer_list< SfxPoolItem const * > args, std::initializer_list< SfxPoolItem const * > internalargs=std::initializer_list< SfxPoolItem const * >())
static void CopyStringTo(const OUString &rContent, const css::uno::Reference< css::datatransfer::clipboard::XClipboard > &rxClipboard, const vcl::ILibreOfficeKitNotifier *pNotifier=nullptr)
void SetTargetFrame(const OUString &rFrm)
FieldUnit
void SetRight(const tools::Long nR, const sal_uInt16 nProp=100)
constexpr TypedWhichId< SvxAutoKernItem > EE_CHAR_PAIRKERNING(EE_CHAR_START+11)
sal_uInt16 GetPropLineSpace() const
void PasteSpecial()
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
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
SfxItemSet CloneAsValue(bool bItems=true, SfxItemPool *pToPool=nullptr) const
void SetEscapement(const SvxEscapement eNew)
#define FN_SET_SUPER_SCRIPT
Definition: cmdid.h:320
bool BeginTextEdit(SdrObject *pObj, SdrPageView *pPV=nullptr, vcl::Window *pWin=nullptr, bool bIsNewObj=false, bool bSetSelectionToStart=false)
Definition: viewdraw.cxx:507
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()
SwView & m_rView
Definition: drwtxtsh.hxx:33
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:670
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:121
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:1086
sal_Int32 nFirstLineOffset
bool IsCTLFontEnabled() const
void StateInsert(SfxItemSet &rSet)
Definition: drwtxtex.cxx:1226
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:96
void GetDrawTextCtrlState(SfxItemSet &)
Definition: drwtxtex.cxx:997
SvtScriptType
void StateClpbrd(SfxItemSet &rSet)
Definition: drwtxtex.cxx:1166
void UpdateWordCount(SfxShell *, sal_uInt16)
Definition: view1.cxx:202
void SetTargetFrame(const OUString &rTarget)
void SetTextLeft(const tools::Long nL, const sal_uInt16 nProp=100)
const SwView & GetView() const
Definition: wrtsh.hxx:437
void SetPropLineSpace(const sal_uInt16 nProp)
constexpr TypedWhichId< SvxFieldItem > EE_FEATURE_FIELD(EE_FEATURE_NOTCONV+1)
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:664
static TransferableDataHelper CreateFromSystemClipboard(vcl::Window *pWindow)
HLINK_HTMLMODE
Mode eMode
SwDoc * GetDoc() const
Definition: viewsh.hxx:282
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)
EditView & GetEditView() const
#define FN_SHRINK_FONT_SIZE
Definition: cmdid.h:318
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:321
const SdrOutliner * GetTextEditOutliner() const
#define FN_NUMBERING_OUTLINE_DLG
Definition: cmdid.h:501
constexpr TypedWhichId< SvxColorItem > EE_CHAR_BKGCOLOR(EE_CHAR_START+32)
const OUString & GetURL() const
#define SW_MOD()
Definition: swmodule.hxx:255
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
SW_DLLPUBLIC FieldUnit GetDfltMetric(bool bWeb)
Definition: uitool.cxx:755
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:679
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:193
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:605
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:50
sal_uInt16 GetSlot() const
constexpr TypedWhichId< SvxCrossedOutItem > EE_CHAR_STRIKEOUT(EE_CHAR_START+6)
SdrView * m_pSdrView
Definition: drwtxtsh.hxx:36
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:686
#define GetWhich(nSlot)
constexpr TypedWhichId< SvxEscapementItem > EE_CHAR_ESCAPEMENT(EE_CHAR_START+10)
constexpr TypedWhichId< SvxColorItem > EE_CHAR_COLOR(EE_CHAR_START+0)
LanguageType GetAppLanguage()
Definition: init.cxx:725
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:317
void SetInsertMode(SvxLinkInsertMode eNew)
SdrPageView * GetSdrPageView() const
#define FN_FORMAT_FOOTNOTE_DLG
Definition: cmdid.h:337
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
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)