LibreOffice Module sw (master)  1
annotsh.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #include <hintids.hxx>
21 
22 #include <com/sun/star/i18n/TextConversionOption.hpp>
23 #include <com/sun/star/lang/XInitialization.hpp>
24 #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
25 #include <com/sun/star/awt/XWindow.hpp>
26 #include <com/sun/star/uno/XComponentContext.hpp>
27 #include <com/sun/star/beans/XPropertySet.hpp>
28 #include <com/sun/star/linguistic2/XThesaurus.hpp>
29 
31 #include <sfx2/objface.hxx>
32 #include <sfx2/viewfrm.hxx>
33 #include <sfx2/bindings.hxx>
34 #include <sfx2/request.hxx>
35 #include <editeng/eeitem.hxx>
36 #include <editeng/flstitem.hxx>
37 #include <editeng/spltitem.hxx>
38 #include <editeng/lrspitem.hxx>
39 #include <editeng/ulspitem.hxx>
40 #include <editeng/orphitem.hxx>
42 #include <editeng/widwitem.hxx>
43 #include <editeng/kernitem.hxx>
45 #include <editeng/lspcitem.hxx>
46 #include <editeng/adjustitem.hxx>
48 #include <editeng/udlnitem.hxx>
49 #include <editeng/fontitem.hxx>
50 #include <svx/clipfmtitem.hxx>
51 #include <svl/stritem.hxx>
52 #include <svl/slstitm.hxx>
53 #include <editeng/frmdiritem.hxx>
54 #include <svl/whiter.hxx>
55 #include <svl/cjkoptions.hxx>
56 #include <svl/ctloptions.hxx>
57 #include <unotools/useroptions.hxx>
58 #include <editeng/flditem.hxx>
59 #include <svx/hlnkitem.hxx>
60 #include <sfx2/htmlmode.hxx>
61 #include <editeng/langitem.hxx>
63 #include <swundo.hxx>
64 #include <doc.hxx>
65 #include <viewopt.hxx>
66 #include <wrtsh.hxx>
67 #include <chrdlgmodes.hxx>
68 #include <edtwin.hxx>
69 #include <SwRewriter.hxx>
70 
71 #include <cmdid.h>
72 #include <strings.hrc>
73 #include <breakit.hxx>
74 #include <annotsh.hxx>
75 #include <view.hxx>
76 #include <PostItMgr.hxx>
77 #include <AnnotationWin.hxx>
78 
79 #include <swtypes.hxx>
80 
81 #include <svx/svxdlg.hxx>
82 
83 #include <vcl/EnumContext.hxx>
84 #include <svl/itempool.hxx>
85 #include <editeng/outliner.hxx>
86 #include <editeng/editview.hxx>
87 #include <osl/diagnose.h>
88 
89 #include <svl/languageoptions.hxx>
90 
91 #include <svl/undo.hxx>
92 #include <swabstdlg.hxx>
93 
94 #include <comphelper/string.hxx>
96 #include <cppuhelper/bootstrap.hxx>
97 
98 #include <langhelper.hxx>
99 
100 #include <memory>
101 
102 using namespace ::com::sun::star;
103 using namespace ::com::sun::star::uno;
104 using namespace ::com::sun::star::beans;
105 using namespace ::com::sun::star::i18n;
106 
107 #define ShellClass_SwAnnotationShell
108 
109 #include <sfx2/msg.hxx>
110 #include <swslots.hxx>
111 
113 
114 void SwAnnotationShell::InitInterface_Impl()
115 {
116  GetStaticInterface()->RegisterObjectBar(SFX_OBJECTBAR_OBJECT, SfxVisibilityFlags::Invisible, ToolbarId::Text_Toolbox_Sw);
117 
118  GetStaticInterface()->RegisterPopupMenu("annotation");
119 }
120 
121 
123 {
124  SwWrtShell &rSh = rV.GetWrtShell();
125  return rSh.GetAttrPool().GetSecondaryPool();
126 }
127 
129  : rView(r)
130 {
133 }
134 
136 {
137 }
138 
140 {
141  SwPostItMgr* pPostItMgr = rView.GetPostItMgr();
142  if ( !pPostItMgr ||
143  !pPostItMgr->HasActiveSidebarWin() )
144  {
145  OSL_ENSURE(pPostItMgr,"PostItMgr::Layout(): We are looping forever");
146  return nullptr;
147  }
148  return &pPostItMgr->GetActiveSidebarWin()->GetOutlinerView()->GetOutliner()->GetUndoManager();
149 }
150 
152 {
153  //TODO: clean this up!!!!
154  SwPostItMgr* pPostItMgr = rView.GetPostItMgr();
155  if ( !pPostItMgr || !pPostItMgr->HasActiveSidebarWin() )
156  return;
157 
158  OutlinerView* pOLV = pPostItMgr->GetActiveSidebarWin()->GetOutlinerView();
159  SfxItemSet aEditAttr(pOLV->GetAttribs());
160  SfxItemSet aNewAttr(*aEditAttr.GetPool(), aEditAttr.GetRanges());
161 
162  sal_uInt16 nSlot = rReq.GetSlot();
163  sal_uInt16 nWhich = GetPool().GetWhich(nSlot);
164  const SfxItemSet *pNewAttrs = rReq.GetArgs();
165  sal_uInt16 nEEWhich = 0;
166  switch (nSlot)
167  {
168  case SID_PARASPACE_INCREASE:
169  case SID_PARASPACE_DECREASE:
170  {
171  SvxULSpaceItem aULSpace( aEditAttr.Get( EE_PARA_ULSPACE ) );
172  sal_uInt16 nUpper = aULSpace.GetUpper();
173  sal_uInt16 nLower = aULSpace.GetLower();
174 
175  if ( nSlot == SID_PARASPACE_INCREASE )
176  {
177  nUpper = std::min< sal_uInt16 >( nUpper + 57, 5670 );
178  nLower = std::min< sal_uInt16 >( nLower + 57, 5670 );
179  }
180  else
181  {
182  nUpper = std::max< sal_Int16 >( nUpper - 57, 0 );
183  nLower = std::max< sal_Int16 >( nLower - 57, 0 );
184  }
185 
186  aULSpace.SetUpper( nUpper );
187  aULSpace.SetLower( nLower );
188  aNewAttr.Put( aULSpace );
189  rReq.Done();
190  }
191  break;
192  case SID_ATTR_PARA_LRSPACE:
193  {
194  SvxLRSpaceItem aParaMargin(static_cast<const SvxLRSpaceItem&>(rReq.
195  GetArgs()->Get(nSlot)));
196  aParaMargin.SetWhich( EE_PARA_LRSPACE );
197 
198  aNewAttr.Put(aParaMargin);
199  rReq.Done();
200  break;
201  }
202  case SID_ATTR_PARA_LINESPACE:
203  {
204  SvxLineSpacingItem aParaMargin = static_cast<const SvxLineSpacingItem&>(pNewAttrs->Get(
205  GetPool().GetWhich(nSlot)));
206  aParaMargin.SetWhich( EE_PARA_SBL );
207 
208  aNewAttr.Put(aParaMargin);
209  rReq.Done();
210  break;
211  }
212  case SID_ATTR_PARA_ULSPACE:
213  {
214  SvxULSpaceItem aULSpace = static_cast<const SvxULSpaceItem&>(pNewAttrs->Get(
215  GetPool().GetWhich(nSlot)));
216  aULSpace.SetWhich( EE_PARA_ULSPACE );
217  aNewAttr.Put( aULSpace );
218  rReq.Done();
219  }
220  break;
221  case FN_GROW_FONT_SIZE:
222  case FN_SHRINK_FONT_SIZE:
223  {
224  const SvxFontListItem* pFontListItem = static_cast< const SvxFontListItem* >
225  ( SfxObjectShell::Current()->GetItem( SID_ATTR_CHAR_FONTLIST ) );
226  const FontList* pFontList = pFontListItem ? pFontListItem->GetFontList() : nullptr;
227  pOLV->GetEditView().ChangeFontSize( nSlot == FN_GROW_FONT_SIZE, pFontList );
228  }
229  break;
230 
231  case SID_ATTR_CHAR_FONT:
232  case SID_ATTR_CHAR_FONTHEIGHT:
233  case SID_ATTR_CHAR_WEIGHT:
234  case SID_ATTR_CHAR_POSTURE:
235  {
236  SfxItemPool* pSecondPool = aEditAttr.GetPool()->GetSecondaryPool();
237  if( !pSecondPool )
238  pSecondPool = aEditAttr.GetPool();
239  SvxScriptSetItem aSetItem( nSlot, *pSecondPool );
240  aSetItem.PutItemForScriptType( pOLV->GetSelectedScriptType(), pNewAttrs->Get( nWhich ));
241  aNewAttr.Put( aSetItem.GetItemSet() );
242  rReq.Done();
243  break;
244  }
245  case SID_ATTR_CHAR_COLOR: nEEWhich = EE_CHAR_COLOR; break;
246  case SID_ATTR_CHAR_BACK_COLOR: nEEWhich = EE_CHAR_BKGCOLOR; break;
247  case SID_ATTR_CHAR_UNDERLINE:
248  {
249  if( rReq.GetArgs() )
250  {
251  const SvxUnderlineItem* pItem = rReq.GetArg<SvxUnderlineItem>(SID_ATTR_CHAR_UNDERLINE);
252  if (pItem)
253  {
254  aNewAttr.Put(*pItem);
255  }
256  else
257  {
258  FontLineStyle eFU = aEditAttr.Get( EE_CHAR_UNDERLINE ).GetLineStyle();
260  }
261  }
262  break;
263  }
264  case SID_ATTR_CHAR_OVERLINE:
265  {
266  FontLineStyle eFO = aEditAttr.Get(EE_CHAR_OVERLINE).GetLineStyle();
268  break;
269  }
270  case SID_ATTR_CHAR_CONTOUR: nEEWhich = EE_CHAR_OUTLINE; break;
271  case SID_ATTR_CHAR_SHADOWED: nEEWhich = EE_CHAR_SHADOW; break;
272  case SID_ATTR_CHAR_STRIKEOUT: nEEWhich = EE_CHAR_STRIKEOUT; break;
273  case SID_ATTR_CHAR_WORDLINEMODE: nEEWhich = EE_CHAR_WLM; break;
274  case SID_ATTR_CHAR_RELIEF : nEEWhich = EE_CHAR_RELIEF; break;
275  case SID_ATTR_CHAR_LANGUAGE : nEEWhich = EE_CHAR_LANGUAGE;break;
276  case SID_ATTR_CHAR_KERNING : nEEWhich = EE_CHAR_KERNING; break;
277  case SID_ATTR_CHAR_SCALEWIDTH: nEEWhich = EE_CHAR_FONTWIDTH; break;
278  case SID_ATTR_CHAR_AUTOKERN : nEEWhich = EE_CHAR_PAIRKERNING; break;
279  case SID_ATTR_CHAR_ESCAPEMENT: nEEWhich = EE_CHAR_ESCAPEMENT; break;
280  case SID_ATTR_PARA_ADJUST_LEFT:
281  aNewAttr.Put(SvxAdjustItem(SvxAdjust::Left, EE_PARA_JUST));
282  break;
283  case SID_ATTR_PARA_ADJUST_CENTER:
284  aNewAttr.Put(SvxAdjustItem(SvxAdjust::Center, EE_PARA_JUST));
285  break;
286  case SID_ATTR_PARA_ADJUST_RIGHT:
287  aNewAttr.Put(SvxAdjustItem(SvxAdjust::Right, EE_PARA_JUST));
288  break;
289  case SID_ATTR_PARA_ADJUST_BLOCK:
290  aNewAttr.Put(SvxAdjustItem(SvxAdjust::Block, EE_PARA_JUST));
291  break;
292 
293  case SID_ATTR_PARA_LINESPACE_10:
294  {
296  aItem.SetPropLineSpace(100);
297  aNewAttr.Put(aItem);
298  }
299  break;
300  case SID_ATTR_PARA_LINESPACE_15:
301  {
303  aItem.SetPropLineSpace(150);
304  aNewAttr.Put(aItem);
305  }
306  break;
307  case SID_ATTR_PARA_LINESPACE_20:
308  {
310  aItem.SetPropLineSpace(200);
311  aNewAttr.Put(aItem);
312  }
313  break;
314  case SID_SELECTALL:
315  {
316  Outliner * pOutliner = pOLV->GetOutliner();
317  if(pOutliner)
318  {
319  sal_Int32 nParaCount = pOutliner->GetParagraphCount();
320  if (nParaCount > 0)
321  pOLV->SelectRange(0, nParaCount );
322  }
323  break;
324  }
325  case FN_FORMAT_RESET:
326  {
327  pPostItMgr->GetActiveSidebarWin()->ResetAttributes();
328  rReq.Done();
329  break;
330  }
331  case FN_SET_SUPER_SCRIPT:
332  {
334  SvxEscapement eEsc = static_cast<SvxEscapement>(aEditAttr.Get( EE_CHAR_ESCAPEMENT ).GetEnumValue());
335 
336  if( eEsc == SvxEscapement::Superscript )
337  aItem.SetEscapement( SvxEscapement::Off );
338  else
339  aItem.SetEscapement( SvxEscapement::Superscript );
340  aNewAttr.Put( aItem );
341  }
342  break;
343  case FN_SET_SUB_SCRIPT:
344  {
346  SvxEscapement eEsc = static_cast<SvxEscapement>(aEditAttr.Get( EE_CHAR_ESCAPEMENT ).GetEnumValue());
347 
348  if( eEsc == SvxEscapement::Subscript )
349  aItem.SetEscapement( SvxEscapement::Off );
350  else
351  aItem.SetEscapement( SvxEscapement::Subscript );
352  aNewAttr.Put( aItem );
353  }
354  break;
355  case SID_HYPERLINK_SETLINK:
356  {
357  const SfxPoolItem* pItem = nullptr;
358  if(pNewAttrs)
359  pNewAttrs->GetItemState(nSlot, false, &pItem);
360 
361  if(pItem)
362  {
363  const SvxHyperlinkItem& rHLinkItem = *static_cast<const SvxHyperlinkItem *>(pItem);
364  SvxURLField aField(rHLinkItem.GetURL(), rHLinkItem.GetName(), SvxURLFormat::AppDefault);
365  aField.SetTargetFrame(rHLinkItem.GetTargetFrame());
366 
367  const SvxFieldItem* pFieldItem = pOLV->GetFieldAtSelection();
368 
369  if (pFieldItem && dynamic_cast<const SvxURLField *>(pFieldItem->GetField()) != nullptr)
370  {
371  // Select the field so that it will be deleted during insert
372  ESelection aSel = pOLV->GetSelection();
373  aSel.nEndPos++;
374  pOLV->SetSelection(aSel);
375  }
377  pOLV->InsertField(SvxFieldItem(aField, EE_FEATURE_FIELD));
378  }
379  break;
380  }
381  case FN_INSERT_SOFT_HYPHEN:
382  case FN_INSERT_HARDHYPHEN:
383  case FN_INSERT_HARD_SPACE:
384  case FN_INSERT_NNBSP:
385  case SID_INSERT_RLM :
386  case SID_INSERT_LRM :
387  case SID_INSERT_WJ :
388  case SID_INSERT_ZWSP:
389  {
390  sal_Unicode cIns = 0;
391  switch(rReq.GetSlot())
392  {
393  case FN_INSERT_SOFT_HYPHEN: cIns = CHAR_SOFTHYPHEN; break;
394  case FN_INSERT_HARDHYPHEN: cIns = CHAR_HARDHYPHEN; break;
395  case FN_INSERT_HARD_SPACE: cIns = CHAR_HARDBLANK; break;
396  case FN_INSERT_NNBSP: cIns = CHAR_NNBSP; break;
397  case SID_INSERT_RLM : cIns = CHAR_RLM ; break;
398  case SID_INSERT_LRM : cIns = CHAR_LRM ; break;
399  case SID_INSERT_ZWSP : cIns = CHAR_ZWSP ; break;
400  case SID_INSERT_WJ: cIns = CHAR_WJ; break;
401  }
402  pOLV->InsertText( OUString(cIns));
403  rReq.Done();
404  break;
405  }
406  case SID_CHARMAP:
407  {
409  InsertSymbol(rReq);
410  break;
411  }
412  case FN_INSERT_STRING:
413  {
414  const SfxPoolItem* pItem = nullptr;
415  if (pNewAttrs)
416  pNewAttrs->GetItemState(nSlot, false, &pItem );
418  pOLV->InsertText(static_cast<const SfxStringItem *>(pItem)->GetValue());
419  break;
420  }
422  {
424  break;
425  }
427  {
429  rReq.Done();
430  }
431  break;
432  case SID_OPEN_XML_FILTERSETTINGS:
433  {
435  }
436  break;
437  case FN_WORDCOUNT_DIALOG:
438  {
439  rView.UpdateWordCount(this, nSlot);
440  break;
441  }
442  case SID_CHAR_DLG_EFFECT:
443  case SID_CHAR_DLG:
444  {
445  const SfxItemSet* pArgs = rReq.GetArgs();
446  const SfxStringItem* pItem = rReq.GetArg<SfxStringItem>(FN_PARAM_1);
447 
448  if( !pArgs || pItem )
449  {
450  /* mod
451  SwView* pView = &GetView();
452  FieldUnit eMetric = ::GetDfltMetric(dynamic_cast<SwWebView*>( pView) != nullptr );
453  SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, eMetric));
454  */
456 
457  // util::Language does not exist in the EditEngine! Therefore not included in the set.
458 
459  aDlgAttr.Put( aEditAttr );
460  aDlgAttr.Put( SvxKerningItem(0, RES_CHRATR_KERNING) );
461 
464  if (nSlot == SID_CHAR_DLG_EFFECT)
465  {
466  pDlg->SetCurPageId("fonteffects");
467  }
468  else if (pItem)
469  {
470  pDlg->SetCurPageId(OUStringToOString(pItem->GetValue(), RTL_TEXTENCODING_UTF8));
471  }
472 
473  sal_uInt16 nRet = pDlg->Execute();
474  if(RET_OK == nRet )
475  {
476  rReq.Done( *( pDlg->GetOutputItemSet() ) );
477  aNewAttr.Put(*pDlg->GetOutputItemSet());
478  }
479  if(RET_OK != nRet)
480  return ;
481  }
482  else
483  aNewAttr.Put(*pArgs);
484  break;
485  }
486  case SID_PARA_DLG:
487  {
488  const SfxItemSet* pArgs = rReq.GetArgs();
489 
490  if (!pArgs)
491  {
492  /* mod todo ???
493  SwView* pView = &GetView();
494  FieldUnit eMetric = ::GetDfltMetric(dynamic_cast<SwWebView*>( pView) != nullptr );
495  SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, eMetric));
496  */
497  SfxItemSet aDlgAttr(
498  GetPool(),
499  svl::Items<
501  SID_ATTR_PARA_HYPHENZONE, SID_ATTR_PARA_WIDOWS>{});
502 
503  aDlgAttr.Put(aEditAttr);
504 
505  aDlgAttr.Put( SvxHyphenZoneItem( false, RES_PARATR_HYPHENZONE) );
506  aDlgAttr.Put( SvxFormatBreakItem( SvxBreak::NONE, RES_BREAK ) );
507  aDlgAttr.Put( SvxFormatSplitItem( true, RES_PARATR_SPLIT ) );
508  aDlgAttr.Put( SvxWidowsItem( 0, RES_PARATR_WIDOWS ) );
509  aDlgAttr.Put( SvxOrphansItem( 0, RES_PARATR_ORPHANS ) );
510 
513  sal_uInt16 nRet = pDlg->Execute();
514  if(RET_OK == nRet)
515  {
516  rReq.Done( *( pDlg->GetOutputItemSet() ) );
517  aNewAttr.Put(*pDlg->GetOutputItemSet());
518  }
519  if(RET_OK != nRet)
520  return;
521  }
522  else
523  aNewAttr.Put(*pArgs);
524  break;
525  }
526 
527  case SID_AUTOSPELL_CHECK:
528  {
529  rView.ExecuteSlot(rReq);
530  break;
531  }
532  case SID_ATTR_PARA_LEFT_TO_RIGHT:
533  case SID_ATTR_PARA_RIGHT_TO_LEFT:
534  {
535  bool bLeftToRight = nSlot == SID_ATTR_PARA_LEFT_TO_RIGHT;
536 
537  const SfxPoolItem* pPoolItem;
538  if( pNewAttrs && SfxItemState::SET == pNewAttrs->GetItemState( nSlot, true, &pPoolItem ) )
539  {
540  if( !static_cast<const SfxBoolItem*>(pPoolItem)->GetValue() )
541  bLeftToRight = !bLeftToRight;
542  }
543  SfxItemSet aAttr(
544  *aNewAttr.GetPool(),
545  svl::Items<
546  EE_PARA_WRITINGDIR, EE_PARA_WRITINGDIR,
547  EE_PARA_JUST, EE_PARA_JUST>{});
548 
549  SvxAdjust nAdjust = SvxAdjust::Left;
550  if( SfxItemState::SET == aEditAttr.GetItemState(EE_PARA_JUST, true, &pPoolItem ) )
551  nAdjust = static_cast<const SvxAdjustItem*>(pPoolItem)->GetAdjust();
552 
553  if( bLeftToRight )
554  {
555  aAttr.Put( SvxFrameDirectionItem( SvxFrameDirection::Horizontal_LR_TB, EE_PARA_WRITINGDIR ) );
556  if( nAdjust == SvxAdjust::Right )
557  aAttr.Put( SvxAdjustItem( SvxAdjust::Left, EE_PARA_JUST ) );
558  }
559  else
560  {
561  aAttr.Put( SvxFrameDirectionItem( SvxFrameDirection::Horizontal_RL_TB, EE_PARA_WRITINGDIR ) );
562  if( nAdjust == SvxAdjust::Left )
563  aAttr.Put( SvxAdjustItem( SvxAdjust::Right, EE_PARA_JUST ) );
564  }
565  pOLV->SetAttribs(aAttr);
566  break;
567  }
568  }
569 
570  if(nEEWhich && pNewAttrs)
571  {
572  aNewAttr.Put(pNewAttrs->Get(nWhich).CloneSetWhich(nEEWhich));
573  }
574 
575  tools::Rectangle aOutRect = pOLV->GetOutputArea();
576  if (tools::Rectangle() != aOutRect && aNewAttr.Count())
577  pOLV->SetAttribs(aNewAttr);
578 
580  if ( pOLV->GetOutliner()->IsModified() )
582 
583 }
584 
586 {
587  //TODO: clean this up!!!
588  // FN_SET_SUPER_SCRIPT
589  //SID_ATTR_PARA_ADJUST
590  //SID_ATTR_PARA_ADJUST_BLOCK
591 
592  SwPostItMgr* pPostItMgr = rView.GetPostItMgr();
593  if ( !pPostItMgr || !pPostItMgr->HasActiveSidebarWin() )
594  return;
595 
596  OutlinerView* pOLV = pPostItMgr->GetActiveSidebarWin()->GetOutlinerView();
597  SfxItemSet aEditAttr(pOLV->GetAttribs());
598 
599  SfxWhichIter aIter(rSet);
600  sal_uInt16 nWhich = aIter.FirstWhich();
601  while(nWhich)
602  {
603  sal_uInt16 nEEWhich = 0;
604  sal_uInt16 nSlotId = GetPool().GetSlotId( nWhich );
605  switch( nSlotId )
606  {
607  case SID_ATTR_PARA_LRSPACE:
608  case SID_ATTR_PARA_LEFTSPACE:
609  case SID_ATTR_PARA_RIGHTSPACE:
610  case SID_ATTR_PARA_FIRSTLINESPACE:
611  {
612  SfxItemState eState = aEditAttr.GetItemState( EE_PARA_LRSPACE );
613  if( eState >= SfxItemState::DEFAULT )
614  {
615  SvxLRSpaceItem aLR = aEditAttr.Get( EE_PARA_LRSPACE );
616  aLR.SetWhich(nSlotId);
617  rSet.Put(aLR);
618  }
619  else
620  rSet.InvalidateItem(nSlotId);
621  }
622  break;
623  case SID_ATTR_PARA_LINESPACE:
624  {
625  SfxItemState eState = aEditAttr.GetItemState( EE_PARA_SBL );
626  if( eState >= SfxItemState::DEFAULT )
627  {
628  const SvxLineSpacingItem& aLR = aEditAttr.Get( EE_PARA_SBL );
629  rSet.Put(aLR);
630  }
631  else
632  rSet.InvalidateItem(nSlotId);
633  }
634  break;
635  case SID_ATTR_PARA_ULSPACE:
636  case SID_ATTR_PARA_ABOVESPACE:
637  case SID_ATTR_PARA_BELOWSPACE:
638  case SID_PARASPACE_INCREASE:
639  case SID_PARASPACE_DECREASE:
640  {
641  SfxItemState eState = aEditAttr.GetItemState( EE_PARA_ULSPACE );
642  if( eState >= SfxItemState::DEFAULT )
643  {
644  SvxULSpaceItem aULSpace = aEditAttr.Get( EE_PARA_ULSPACE );
645  if ( !aULSpace.GetUpper() && !aULSpace.GetLower() )
646  rSet.DisableItem( SID_PARASPACE_DECREASE );
647  else if ( aULSpace.GetUpper() >= 5670 && aULSpace.GetLower() >= 5670 )
648  rSet.DisableItem( SID_PARASPACE_INCREASE );
649  if ( nSlotId == SID_ATTR_PARA_ULSPACE
650  || nSlotId == SID_ATTR_PARA_BELOWSPACE
651  || nSlotId == SID_ATTR_PARA_ABOVESPACE
652  )
653  {
654  aULSpace.SetWhich(nSlotId);
655  rSet.Put(aULSpace);
656  }
657  }
658  else
659  {
660  rSet.DisableItem( SID_PARASPACE_INCREASE );
661  rSet.DisableItem( SID_PARASPACE_DECREASE );
662  rSet.InvalidateItem( SID_ATTR_PARA_ULSPACE );
663  rSet.InvalidateItem( SID_ATTR_PARA_ABOVESPACE );
664  rSet.InvalidateItem( SID_ATTR_PARA_BELOWSPACE );
665  }
666  }
667  break;
668  case SID_ATTR_CHAR_FONT:
669  case SID_ATTR_CHAR_FONTHEIGHT:
670  case SID_ATTR_CHAR_WEIGHT:
671  case SID_ATTR_CHAR_POSTURE:
672  {
673  SvtScriptType nScriptType = pOLV->GetSelectedScriptType();
674  SfxItemPool* pSecondPool = aEditAttr.GetPool()->GetSecondaryPool();
675  if( !pSecondPool )
676  pSecondPool = aEditAttr.GetPool();
677  SvxScriptSetItem aSetItem( nSlotId, *pSecondPool );
678  aSetItem.GetItemSet().Put( aEditAttr, false );
679  const SfxPoolItem* pI = aSetItem.GetItemOfScript( nScriptType );
680  if( pI )
681  {
682  rSet.Put(pI->CloneSetWhich(nWhich));
683  }
684  else
685  rSet.InvalidateItem( nWhich );
686  }
687  break;
688  case SID_ATTR_CHAR_COLOR: nEEWhich = EE_CHAR_COLOR; break;
689  case SID_ATTR_CHAR_BACK_COLOR: nEEWhich = EE_CHAR_BKGCOLOR; break;
690  case SID_ATTR_CHAR_UNDERLINE: nEEWhich = EE_CHAR_UNDERLINE;break;
691  case SID_ATTR_CHAR_OVERLINE: nEEWhich = EE_CHAR_OVERLINE;break;
692  case SID_ATTR_CHAR_CONTOUR: nEEWhich = EE_CHAR_OUTLINE; break;
693  case SID_ATTR_CHAR_SHADOWED: nEEWhich = EE_CHAR_SHADOW;break;
694  case SID_ATTR_CHAR_STRIKEOUT: nEEWhich = EE_CHAR_STRIKEOUT;break;
695  case SID_ATTR_CHAR_LANGUAGE : nEEWhich = EE_CHAR_LANGUAGE;break;
696  case SID_ATTR_CHAR_ESCAPEMENT: nEEWhich = EE_CHAR_ESCAPEMENT;break;
697  case SID_ATTR_CHAR_KERNING: nEEWhich = EE_CHAR_KERNING;break;
698  case FN_SET_SUPER_SCRIPT:
699  case FN_SET_SUB_SCRIPT:
700  {
701  SvxEscapement nEsc;
702  if (nWhich==FN_SET_SUPER_SCRIPT)
703  nEsc = SvxEscapement::Superscript;
704  else
705  nEsc = SvxEscapement::Subscript;
706 
707  const SfxPoolItem *pEscItem = &aEditAttr.Get( EE_CHAR_ESCAPEMENT );
708  if( nEsc == static_cast<const SvxEscapementItem*>(pEscItem)->GetEscapement() )
709  rSet.Put( SfxBoolItem( nWhich, true ));
710  else
711  rSet.InvalidateItem( nWhich );
712  break;
713  }
714  case SID_ATTR_PARA_ADJUST_LEFT:
715  case SID_ATTR_PARA_ADJUST_RIGHT:
716  case SID_ATTR_PARA_ADJUST_CENTER:
717  case SID_ATTR_PARA_ADJUST_BLOCK:
718  {
719  SvxAdjust eAdjust = SvxAdjust::Left;
720  if (nWhich==SID_ATTR_PARA_ADJUST_LEFT)
721  eAdjust = SvxAdjust::Left;
722  else if (nWhich==SID_ATTR_PARA_ADJUST_RIGHT)
723  eAdjust = SvxAdjust::Right;
724  else if (nWhich==SID_ATTR_PARA_ADJUST_CENTER)
725  eAdjust = SvxAdjust::Center;
726  else if (nWhich==SID_ATTR_PARA_ADJUST_BLOCK)
727  eAdjust = SvxAdjust::Block;
728 
729  const SfxPoolItem *pAdjust = nullptr;
730  aEditAttr.GetItemState( EE_PARA_JUST, false, &pAdjust);
731 
732  if( !pAdjust || IsInvalidItem( pAdjust ))
733  {
734  rSet.InvalidateItem( nSlotId );
735  }
736  else
737  {
738  if ( eAdjust == static_cast<const SvxAdjustItem*>(pAdjust)->GetAdjust())
739  rSet.Put( SfxBoolItem( nWhich, true ));
740  else
741  rSet.InvalidateItem( nWhich );
742  }
743  break;
744  }
745  case SID_ATTR_PARA_LINESPACE_10:
746  case SID_ATTR_PARA_LINESPACE_15:
747  case SID_ATTR_PARA_LINESPACE_20:
748  {
749  int nLSpace = 0;
750  if (nWhich==SID_ATTR_PARA_LINESPACE_10)
751  nLSpace = 100;
752  else if (nWhich==SID_ATTR_PARA_LINESPACE_15)
753  nLSpace = 150;
754  else if (nWhich==SID_ATTR_PARA_LINESPACE_20)
755  nLSpace = 200;
756 
757  const SfxPoolItem *pLSpace = nullptr;
758  aEditAttr.GetItemState( EE_PARA_SBL, false, &pLSpace );
759 
760  if( !pLSpace || IsInvalidItem( pLSpace ))
761  {
762  rSet.InvalidateItem( nSlotId );
763  }
764  else
765  {
766  if( nLSpace == static_cast<const SvxLineSpacingItem*>(pLSpace)->GetPropLineSpace() )
767  rSet.Put( SfxBoolItem( nWhich, true ));
768  else
769  rSet.InvalidateItem( nWhich );
770  }
771  break;
772  }
773  case SID_AUTOSPELL_CHECK:
774  {
775  const SfxPoolItem* pState = rView.GetSlotState(nWhich);
776  if (pState)
777  rSet.Put(SfxBoolItem(nWhich, static_cast<const SfxBoolItem*>(pState)->GetValue()));
778  else
779  rSet.DisableItem( nWhich );
780  break;
781  }
782  case SID_ATTR_PARA_LEFT_TO_RIGHT:
783  case SID_ATTR_PARA_RIGHT_TO_LEFT:
784  {
785  if ( !SvtLanguageOptions().IsCTLFontEnabled() )
786  rSet.DisableItem( nWhich );
787  else
788  {
789  if(pOLV->GetOutliner() && pOLV->GetOutliner()->IsVertical())
790  rSet.DisableItem( nWhich );
791  else
792  {
793  bool bFlag = false;
794  switch( aEditAttr.Get( EE_PARA_WRITINGDIR ).GetValue() )
795  {
796  case SvxFrameDirection::Horizontal_LR_TB:
797  {
798  bFlag = nWhich == SID_ATTR_PARA_LEFT_TO_RIGHT;
799  rSet.Put( SfxBoolItem( nWhich, bFlag ));
800  break;
801  }
802  case SvxFrameDirection::Horizontal_RL_TB:
803  {
804  bFlag = nWhich != SID_ATTR_PARA_LEFT_TO_RIGHT;
805  rSet.Put( SfxBoolItem( nWhich, bFlag ));
806  break;
807  }
808  default:
809  break;
810  }
811  }
812  }
813  }
814  break;
815  case SID_INSERT_RLM :
816  case SID_INSERT_LRM :
817  {
818  SvtCTLOptions aCTLOptions;
819  bool bEnabled = aCTLOptions.IsCTLFontEnabled();
820  rView.GetViewFrame()->GetBindings().SetVisibleState( nWhich, bEnabled );
821  if(!bEnabled)
822  rSet.DisableItem(nWhich);
823  }
824  break;
825  default:
826  rSet.InvalidateItem( nWhich );
827  break;
828  }
829 
830  if(nEEWhich)
831  {
832  rSet.Put(aEditAttr.Get(nEEWhich).CloneSetWhich(nWhich));
833  if(nEEWhich == EE_CHAR_KERNING)
834  {
835  SfxItemState eState = aEditAttr.GetItemState( EE_CHAR_KERNING );
836  if ( eState == SfxItemState::DONTCARE )
837  {
839  }
840  }
841  }
842 
844  rSet.DisableItem( nWhich );
845 
846  nWhich = aIter.NextWhich();
847  }
848 }
849 
851 {
852  rView.ExecSearch(rReq);
853 }
854 
856 {
857  rView.StateSearch(rSet);
858 }
859 
861 {
862  SwPostItMgr* pPostItMgr = rView.GetPostItMgr();
863  if ( !pPostItMgr || !pPostItMgr->HasActiveSidebarWin() )
864  return;
865 
866  OutlinerView* pOLV = pPostItMgr->GetActiveSidebarWin()->GetOutlinerView();
867 
868  tools::Long aOldHeight = pPostItMgr->GetActiveSidebarWin()->GetPostItTextHeight();
869  sal_uInt16 nSlot = rReq.GetSlot();
870  switch (nSlot)
871  {
872  case SID_CUT:
873  if ( (pPostItMgr->GetActiveSidebarWin()->GetLayoutStatus()!=SwPostItHelper::DELETED) && pOLV->HasSelection() )
874  pOLV->Cut();
875  break;
876  case SID_COPY:
877  if( pOLV->HasSelection() )
878  pOLV->Copy();
879  break;
880  case SID_PASTE:
882  pOLV->PasteSpecial();
883  break;
884  case SID_PASTE_UNFORMATTED:
886  pOLV->Paste();
887  break;
888  case SID_PASTE_SPECIAL:
889  {
891  {
893  ScopedVclPtr<SfxAbstractPasteDialog> pDlg(pFact->CreatePasteDialog(rView.GetEditWin().GetFrameWeld()));
894 
895  pDlg->Insert( SotClipboardFormatId::STRING, OUString() );
896  pDlg->Insert( SotClipboardFormatId::RTF, OUString() );
897  pDlg->Insert( SotClipboardFormatId::RICHTEXT, OUString() );
898 
900 
901  SotClipboardFormatId nFormat = pDlg->GetFormat( aDataHelper.GetTransferable() );
902 
903  if (nFormat != SotClipboardFormatId::NONE)
904  {
905  if (nFormat == SotClipboardFormatId::STRING)
906  pOLV->Paste();
907  else
908  pOLV->PasteSpecial();
909  }
910  }
911  break;
912  }
913  case SID_CLIPBOARD_FORMAT_ITEMS:
914  {
915  SotClipboardFormatId nFormat = SotClipboardFormatId::NONE;
916  const SfxPoolItem* pItem;
917  if (rReq.GetArgs() && rReq.GetArgs()->GetItemState(nSlot, true, &pItem) == SfxItemState::SET)
918  {
919  if (const SfxUInt32Item* pUInt32Item = dynamic_cast<const SfxUInt32Item *>(pItem))
920  nFormat = static_cast<SotClipboardFormatId>(pUInt32Item->GetValue());
921  }
922 
923  if ( nFormat != SotClipboardFormatId::NONE )
924  {
925  if (SotClipboardFormatId::STRING == nFormat)
926  pOLV->Paste();
927  else
928  pOLV->PasteSpecial();
929  }
930  break;
931  }
932  }
933  pPostItMgr->GetActiveSidebarWin()->ResizeIfNecessary(aOldHeight,pPostItMgr->GetActiveSidebarWin()->GetPostItTextHeight());
934 }
935 
937 {
938  SwPostItMgr* pPostItMgr = rView.GetPostItMgr();
939  if ( !pPostItMgr || !pPostItMgr->HasActiveSidebarWin() )
940  return;
941  OutlinerView* pOLV = pPostItMgr->GetActiveSidebarWin()->GetOutlinerView();
942 
944  bool bPastePossible = ( aDataHelper.HasFormat( SotClipboardFormatId::STRING ) || aDataHelper.HasFormat( SotClipboardFormatId::RTF )
945  || aDataHelper.HasFormat( SotClipboardFormatId::RICHTEXT ));
946  bPastePossible = bPastePossible && (pPostItMgr->GetActiveSidebarWin()->GetLayoutStatus()!=SwPostItHelper::DELETED);
947 
948  SfxWhichIter aIter(rSet);
949  sal_uInt16 nWhich = aIter.FirstWhich();
950 
951  while(nWhich)
952  {
953  switch(nWhich)
954  {
955  case SID_CUT:
956  {
958  rSet.DisableItem( nWhich );
959  [[fallthrough]];
960  }
961  case SID_COPY:
962  {
963  SfxObjectShell* pObjectShell = GetObjectShell();
964  if (!pOLV->HasSelection() || (pObjectShell && pObjectShell->isContentExtractionLocked()) )
965  rSet.DisableItem( nWhich );
966  break;
967  }
968  case SID_PASTE:
969  case SID_PASTE_UNFORMATTED:
970  case SID_PASTE_SPECIAL:
971  {
972  if( !bPastePossible )
973  rSet.DisableItem( nWhich );
974  break;
975  }
976  case SID_CLIPBOARD_FORMAT_ITEMS:
977  {
978  if ( bPastePossible )
979  {
980  SvxClipboardFormatItem aFormats( SID_CLIPBOARD_FORMAT_ITEMS );
981  if ( aDataHelper.HasFormat( SotClipboardFormatId::RTF ) )
982  aFormats.AddClipbrdFormat( SotClipboardFormatId::RTF );
983  if ( aDataHelper.HasFormat( SotClipboardFormatId::RICHTEXT ) )
984  aFormats.AddClipbrdFormat( SotClipboardFormatId::RICHTEXT );
985  aFormats.AddClipbrdFormat( SotClipboardFormatId::STRING );
986  rSet.Put( aFormats );
987  }
988  else
989  rSet.DisableItem( nWhich );
990  break;
991  }
992  }
993  nWhich = aIter.NextWhich();
994  }
995 }
996 
998 {
999  SfxWhichIter aIter( rSet );
1000  sal_uInt16 nWhich = aIter.FirstWhich();
1001 
1002  while( nWhich )
1003  {
1004  switch( nWhich )
1005  {
1006  case FN_STAT_SELMODE:
1007  {
1008  rSet.Put(SfxUInt16Item(FN_STAT_SELMODE, 0));
1009  rSet.DisableItem( nWhich );
1010  break;
1011  }
1012  case FN_STAT_TEMPLATE:
1013  {
1014  rSet.DisableItem( nWhich );
1015  break;
1016  }
1017  }
1018  nWhich = aIter.NextWhich();
1019  }
1020 }
1021 
1023 {
1024  SwPostItMgr* pPostItMgr = rView.GetPostItMgr();
1025  if ( !pPostItMgr || !pPostItMgr->HasActiveSidebarWin() )
1026  return;
1027 
1028  OutlinerView* pOLV = pPostItMgr->GetActiveSidebarWin()->GetOutlinerView();
1029  SfxWhichIter aIter(rSet);
1030  sal_uInt16 nWhich = aIter.FirstWhich();
1031 
1032  while(nWhich)
1033  {
1034  switch(nWhich)
1035  {
1036  case SID_HYPERLINK_GETLINK:
1037  {
1038  SvxHyperlinkItem aHLinkItem;
1039  aHLinkItem.SetInsertMode(HLINK_FIELD);
1040 
1041  const SvxFieldItem* pFieldItem = pOLV->GetFieldAtSelection();
1042 
1043  if (pFieldItem)
1044  {
1045  if (const SvxURLField* pURLField = dynamic_cast<const SvxURLField *>(pFieldItem->GetField()))
1046  {
1047  aHLinkItem.SetName(pURLField->GetRepresentation());
1048  aHLinkItem.SetURL(pURLField->GetURL());
1049  aHLinkItem.SetTargetFrame(pURLField->GetTargetFrame());
1050  }
1051  }
1052  else
1053  {
1054  OUString sSel(pOLV->GetSelected());
1055  sSel = sSel.copy(0, std::min<sal_Int32>(255, sSel.getLength()));
1056  aHLinkItem.SetName(comphelper::string::stripEnd(sSel, ' '));
1057  }
1058 
1059  sal_uInt16 nHtmlMode = ::GetHtmlMode(rView.GetDocShell());
1060  aHLinkItem.SetInsertMode(static_cast<SvxLinkInsertMode>(aHLinkItem.GetInsertMode() |
1061  ((nHtmlMode & HTMLMODE_ON) != 0 ? HLINK_HTMLMODE : 0)));
1062 
1063  rSet.Put(aHLinkItem);
1064  }
1065  break;
1066  }
1067 
1069  rSet.DisableItem( nWhich );
1070 
1071  nWhich = aIter.NextWhich();
1072  }
1073 }
1074 
1076 {
1077  SwPostItMgr* pPostItMgr = rView.GetPostItMgr();
1078  if ( !pPostItMgr )
1079  return;
1080 
1081  sal_uInt16 nSlot = rReq.GetSlot();
1082  switch (nSlot)
1083  {
1084  case FN_REPLY:
1085  case FN_POSTIT:
1086  case FN_DELETE_COMMENT:
1088  case FN_RESOLVE_NOTE:
1090  if ( pPostItMgr->HasActiveSidebarWin() )
1091  pPostItMgr->GetActiveSidebarWin()->ExecuteCommand(nSlot);
1092  break;
1093  case FN_DELETE_ALL_NOTES:
1094  pPostItMgr->Delete();
1095  break;
1096  case FN_FORMAT_ALL_NOTES:
1097  pPostItMgr->ExecuteFormatAllDialog(rView);
1098  break;
1099  case FN_DELETE_NOTE_AUTHOR:
1100  {
1101  const SfxStringItem* pItem = rReq.GetArg<SfxStringItem>(nSlot);
1102  if ( pItem )
1103  pPostItMgr->Delete( pItem->GetValue() );
1104  else if ( pPostItMgr->HasActiveSidebarWin() )
1105  pPostItMgr->Delete( pPostItMgr->GetActiveSidebarWin()->GetAuthor() );
1106  break;
1107  }
1108  case FN_HIDE_NOTE:
1109  break;
1110  case FN_HIDE_ALL_NOTES:
1111  pPostItMgr->Hide();
1112  break;
1113  case FN_HIDE_NOTE_AUTHOR:
1114  {
1115  const SfxStringItem* pItem = rReq.GetArg<SfxStringItem>(nSlot);
1116  if ( pItem )
1117  pPostItMgr->Hide( pItem->GetValue() );
1118  else if ( pPostItMgr->HasActiveSidebarWin() )
1119  pPostItMgr->Hide( pPostItMgr->GetActiveSidebarWin()->GetAuthor() );
1120  }
1121  }
1122 }
1123 
1125 {
1126  SwPostItMgr* pPostItMgr = rView.GetPostItMgr();
1127  SfxWhichIter aIter(rSet);
1128  sal_uInt16 nWhich = aIter.FirstWhich();
1129  while(nWhich)
1130  {
1131  sal_uInt16 nSlotId = GetPool().GetSlotId( nWhich );
1132  switch( nSlotId )
1133  {
1134  case FN_POSTIT:
1135  case FN_DELETE_ALL_NOTES:
1136  case FN_FORMAT_ALL_NOTES:
1137  case FN_HIDE_NOTE:
1138  case FN_HIDE_ALL_NOTES:
1139  case FN_DELETE_COMMENT:
1141  {
1142  if( !pPostItMgr
1143  || !pPostItMgr->HasActiveAnnotationWin() )
1144  {
1145  rSet.DisableItem(nWhich);
1146  }
1147  break;
1148  }
1149  case FN_RESOLVE_NOTE:
1150  {
1151  if( !pPostItMgr
1152  || !pPostItMgr->HasActiveAnnotationWin() )
1153  {
1154  rSet.DisableItem(nWhich);
1155  }
1156  else
1157  {
1158  SfxBoolItem aBool(nWhich, pPostItMgr->GetActiveSidebarWin()->IsResolved());
1159  rSet.Put( aBool );
1160  }
1161  break;
1162  }
1164  {
1165  if( !pPostItMgr
1166  || !pPostItMgr->HasActiveAnnotationWin() )
1167  {
1168  rSet.DisableItem(nWhich);
1169  }
1170  else
1171  {
1172  SfxBoolItem aBool(nWhich, pPostItMgr->GetActiveSidebarWin()->IsThreadResolved());
1173  rSet.Put( aBool );
1174  }
1175  break;
1176  }
1177  case FN_DELETE_NOTE_AUTHOR:
1178  case FN_HIDE_NOTE_AUTHOR:
1179  {
1180  if( !pPostItMgr
1181  || !pPostItMgr->HasActiveAnnotationWin() )
1182  {
1183  rSet.DisableItem(nWhich);
1184  }
1185  else
1186  {
1187  OUString aText( nSlotId == FN_DELETE_NOTE_AUTHOR ?
1188  SwResId( STR_DELETE_NOTE_AUTHOR ) : SwResId( STR_HIDE_NOTE_AUTHOR ) );
1189  SwRewriter aRewriter;
1190  aRewriter.AddRule( UndoArg1, pPostItMgr->GetActiveSidebarWin()->GetAuthor() );
1191  aText = aRewriter.Apply( aText );
1192  SfxStringItem aItem( nSlotId, aText );
1193  rSet.Put( aItem );
1194  }
1195  break;
1196  }
1197  case FN_REPLY:
1198  {
1199  if ( !pPostItMgr ||
1200  !pPostItMgr->HasActiveAnnotationWin() )
1201  {
1202  rSet.DisableItem(nWhich);
1203  }
1204  else
1205  {
1206  SvtUserOptions aUserOpt;
1207  OUString sAuthor;
1208  if( (sAuthor = aUserOpt.GetFullName()).isEmpty() &&
1209  (sAuthor = aUserOpt.GetID()).isEmpty() )
1210  sAuthor = SwResId( STR_REDLINE_UNKNOWN_AUTHOR );
1211  if (sAuthor == pPostItMgr->GetActiveSidebarWin()->GetAuthor())
1212  rSet.DisableItem(nWhich);
1213  }
1214  break;
1215  }
1216  default:
1217  rSet.InvalidateItem( nWhich );
1218  break;
1219  }
1220 
1221  if (pPostItMgr && pPostItMgr->HasActiveSidebarWin())
1222  {
1223  if ( (pPostItMgr->GetActiveSidebarWin()->IsProtected()) &&
1224  ( (nSlotId==FN_DELETE_COMMENT) || (nSlotId==FN_REPLY) ) )
1225  rSet.DisableItem( nWhich );
1226  }
1227  nWhich = aIter.NextWhich();
1228  }
1229 }
1230 
1232 {
1233  SwPostItMgr* pPostItMgr = rView.GetPostItMgr();
1234  if ( !pPostItMgr || !pPostItMgr->HasActiveSidebarWin() )
1235  return;
1236 
1237  OutlinerView* pOLV = pPostItMgr->GetActiveSidebarWin()->GetOutlinerView();
1238  sal_uInt16 nSlot = rReq.GetSlot();
1239  SwWrtShell &rSh = rView.GetWrtShell();
1240  bool bRestoreSelection = false;
1241  ESelection aOldSelection;
1242 
1243  switch (nSlot)
1244  {
1245  case SID_LANGUAGE_STATUS:
1246  {
1247  aOldSelection = pOLV->GetSelection();
1248  if (!pOLV->GetEditView().HasSelection())
1249  {
1250  pOLV->GetEditView().SelectCurrentWord();
1251  }
1252 
1253  bRestoreSelection = SwLangHelper::SetLanguageStatus(pOLV,rReq,rView,rSh);
1254  break;
1255  }
1256  case SID_THES:
1257  {
1258  OUString aReplaceText;
1259  const SfxStringItem* pItem2 = rReq.GetArg<SfxStringItem>(SID_THES);
1260  if (pItem2)
1261  aReplaceText = pItem2->GetValue();
1262  if (!aReplaceText.isEmpty())
1263  ReplaceTextWithSynonym( pOLV->GetEditView(), aReplaceText );
1264  break;
1265  }
1266  case SID_THESAURUS:
1267  {
1268  pOLV->StartThesaurus(rReq.GetFrameWeld());
1269  break;
1270  }
1271  case SID_HANGUL_HANJA_CONVERSION:
1273  i18n::TextConversionOption::CHARACTER_BY_CHARACTER, true, false);
1274  break;
1275 
1276  case SID_CHINESE_CONVERSION:
1277  {
1278  //open ChineseTranslationDialog
1280  ::cppu::defaultBootstrap_InitialComponentContext() ); //@todo get context from calc if that has one
1281  if(xContext.is())
1282  {
1283  Reference< lang::XMultiComponentFactory > xMCF( xContext->getServiceManager() );
1284  if(xMCF.is())
1285  {
1286  Reference< ui::dialogs::XExecutableDialog > xDialog(
1287  xMCF->createInstanceWithContext(
1288  "com.sun.star.linguistic2.ChineseTranslationDialog", xContext),
1289  UNO_QUERY);
1290  Reference< lang::XInitialization > xInit( xDialog, UNO_QUERY );
1291  if( xInit.is() )
1292  {
1293  // initialize dialog
1294  uno::Sequence<uno::Any> aSeq(comphelper::InitAnyPropertySequence(
1295  {
1296  {"ParentWindow", uno::Any(Reference<awt::XWindow>())}
1297  }));
1298  xInit->initialize( aSeq );
1299 
1300  //execute dialog
1301  sal_Int16 nDialogRet = xDialog->execute();
1302  if( RET_OK == nDialogRet )
1303  {
1304  //get some parameters from the dialog
1305  bool bToSimplified = true;
1306  bool bUseVariants = true;
1307  bool bCommonTerms = true;
1308  Reference< beans::XPropertySet > xProp( xDialog, UNO_QUERY );
1309  if( xProp.is() )
1310  {
1311  try
1312  {
1313  xProp->getPropertyValue( "IsDirectionToSimplified" ) >>= bToSimplified;
1314  xProp->getPropertyValue( "IsUseCharacterVariants" ) >>= bUseVariants;
1315  xProp->getPropertyValue( "IsTranslateCommonTerms" ) >>= bCommonTerms;
1316  }
1317  catch (const Exception&)
1318  {
1319  }
1320  }
1321 
1322  //execute translation
1325  sal_Int32 nOptions = bUseVariants ? i18n::TextConversionOption::USE_CHARACTER_VARIANTS : 0;
1326  if( !bCommonTerms )
1327  nOptions = nOptions | i18n::TextConversionOption::CHARACTER_BY_CHARACTER;
1328 
1329  vcl::Font aTargetFont = OutputDevice::GetDefaultFont( DefaultFontType::CJK_TEXT,
1330  nTargetLang, GetDefaultFontFlags::OnlyOne );
1331 
1332  pOLV->StartTextConversion(rReq.GetFrameWeld(), nSourceLang, nTargetLang, &aTargetFont, nOptions, false, false);
1333  }
1334  }
1335  Reference< lang::XComponent > xComponent( xDialog, UNO_QUERY );
1336  if( xComponent.is() )
1337  xComponent->dispose();
1338  }
1339  }
1340  }
1341  break;
1342  }
1343 
1344  if (bRestoreSelection)
1345  {
1346  // restore selection
1347  pOLV->GetEditView().SetSelection( aOldSelection );
1348  }
1349 }
1350 
1352 {
1353  SwPostItMgr* pPostItMgr = rView.GetPostItMgr();
1354  if ( !pPostItMgr || !pPostItMgr->HasActiveSidebarWin() )
1355  return;
1356 
1357  OutlinerView* pOLV = pPostItMgr->GetActiveSidebarWin()->GetOutlinerView();
1358 
1359  SfxWhichIter aIter(rSet);
1360  sal_uInt16 nWhich = aIter.FirstWhich();
1361  while(nWhich)
1362  {
1363  switch (nWhich)
1364  {
1365  case SID_LANGUAGE_STATUS:
1366  {
1368  break;
1369  }
1370 
1371  case SID_THES:
1372  {
1373  OUString aStatusVal;
1375  bool bIsLookUpWord = GetStatusValueForThesaurusFromContext( aStatusVal, nLang, pOLV->GetEditView() );
1376  rSet.Put( SfxStringItem( SID_THES, aStatusVal ) );
1377 
1378  // disable "Thesaurus" context menu entry if there is nothing to look up
1379  uno::Reference< linguistic2::XThesaurus > xThes( ::GetThesaurus() );
1380  if (!bIsLookUpWord ||
1381  !xThes.is() || nLang == LANGUAGE_NONE || !xThes->hasLocale( LanguageTag::convertToLocale( nLang ) ))
1382  rSet.DisableItem( SID_THES );
1383  break;
1384  }
1385 
1386  // disable "Thesaurus" if the language is not supported
1387  case SID_THESAURUS:
1388  {
1389  const SfxPoolItem &rItem = rView.GetWrtShell().GetDoc()->GetDefault(
1392  LanguageType nLang = static_cast<const SvxLanguageItem &>(
1393  rItem).GetLanguage();
1394  uno::Reference< linguistic2::XThesaurus > xThes( ::GetThesaurus() );
1395  if (!xThes.is() || nLang == LANGUAGE_NONE ||
1396  !xThes->hasLocale( LanguageTag::convertToLocale( nLang ) ))
1397  rSet.DisableItem( SID_THESAURUS );
1398  }
1399  break;
1400  case SID_HANGUL_HANJA_CONVERSION:
1401  case SID_CHINESE_CONVERSION:
1402  {
1403  if (!SvtCJKOptions().IsAnyEnabled())
1404  {
1405  rView.GetViewFrame()->GetBindings().SetVisibleState( nWhich, false );
1406  rSet.DisableItem(nWhich);
1407  }
1408  else
1409  rView.GetViewFrame()->GetBindings().SetVisibleState( nWhich, true );
1410  }
1411  break;
1412  }
1413 
1415  rSet.DisableItem( nWhich );
1416 
1417  nWhich = aIter.NextWhich();
1418  }
1419 }
1420 
1422 {
1423  SwPostItMgr* pPostItMgr = rView.GetPostItMgr();
1424  if (!pPostItMgr || !pPostItMgr->HasActiveSidebarWin())
1425  return;
1426 
1427  OutlinerView* pOLV = pPostItMgr->GetActiveSidebarWin()->GetOutlinerView();
1428 
1429  if (!pOLV)
1430  return;
1431 
1432  TransliterationFlags nMode = TransliterationFlags::NONE;
1433 
1434  switch( rReq.GetSlot() )
1435  {
1436  case SID_TRANSLITERATE_SENTENCE_CASE:
1437  nMode = TransliterationFlags::SENTENCE_CASE;
1438  break;
1439  case SID_TRANSLITERATE_TITLE_CASE:
1440  nMode = TransliterationFlags::TITLE_CASE;
1441  break;
1442  case SID_TRANSLITERATE_TOGGLE_CASE:
1443  nMode = TransliterationFlags::TOGGLE_CASE;
1444  break;
1445  case SID_TRANSLITERATE_UPPER:
1446  nMode = TransliterationFlags::LOWERCASE_UPPERCASE;
1447  break;
1448  case SID_TRANSLITERATE_LOWER:
1449  nMode = TransliterationFlags::UPPERCASE_LOWERCASE;
1450  break;
1451  case SID_TRANSLITERATE_HALFWIDTH:
1452  nMode = TransliterationFlags::FULLWIDTH_HALFWIDTH;
1453  break;
1454  case SID_TRANSLITERATE_FULLWIDTH:
1455  nMode = TransliterationFlags::HALFWIDTH_FULLWIDTH;
1456  break;
1457  case SID_TRANSLITERATE_HIRAGANA:
1458  nMode = TransliterationFlags::KATAKANA_HIRAGANA;
1459  break;
1460  case SID_TRANSLITERATE_KATAKANA:
1461  nMode = TransliterationFlags::HIRAGANA_KATAKANA;
1462  break;
1463 
1464  default:
1465  OSL_ENSURE(false, "wrong dispatcher");
1466  }
1467 
1468  if( nMode != TransliterationFlags::NONE )
1469  pOLV->TransliterateText( nMode );
1470 }
1471 
1473 {
1474  if( rReq.GetSlot() != SID_TRANSLITERATE_ROTATE_CASE )
1475  return;
1476 
1477  SwPostItMgr* pPostItMgr = rView.GetPostItMgr();
1478  if (!pPostItMgr || !pPostItMgr->HasActiveSidebarWin())
1479  return;
1480 
1481  OutlinerView* pOLV = pPostItMgr->GetActiveSidebarWin()->GetOutlinerView();
1482 
1483  if (!pOLV)
1484  return;
1485 
1487 }
1488 
1490 {
1491  const SfxItemSet* pArgs = rReq.GetArgs();
1492  SfxUndoManager* pUndoManager = GetUndoManager();
1493  SwWrtShell &rSh = rView.GetWrtShell();
1494  SwUndoId nUndoId(SwUndoId::EMPTY);
1495 
1498  : 0;
1499 
1500  sal_uInt16 nId = rReq.GetSlot();
1501  sal_uInt16 nCnt = 1;
1502  const SfxPoolItem* pItem=nullptr;
1503  if( pArgs && SfxItemState::SET == pArgs->GetItemState( nId, false, &pItem ) )
1504  nCnt = static_cast<const SfxUInt16Item*>(pItem)->GetValue();
1505  switch( nId )
1506  {
1507  case SID_UNDO:
1508  {
1509  rSh.GetLastUndoInfo(nullptr, &nUndoId);
1510  if (nUndoId == SwUndoId::CONFLICT)
1511  {
1512  rReq.SetReturnValue( SfxUInt32Item(nId, static_cast<sal_uInt32>(SID_REPAIRPACKAGE)) );
1513  break;
1514  }
1515 
1516  if ( pUndoManager )
1517  {
1518  sal_uInt16 nCount = pUndoManager->GetUndoActionCount();
1519  sal_uInt16 nSteps = nCnt;
1520  if ( nCount < nCnt )
1521  {
1522  nCnt = nCnt - nCount;
1523  nSteps = nCount;
1524  }
1525  else
1526  nCnt = 0;
1527 
1528  while( nSteps-- )
1529  pUndoManager->Undo();
1530  }
1531 
1532  if ( nCnt )
1533  rSh.Do( SwWrtShell::UNDO, nCnt );
1534 
1535  break;
1536  }
1537 
1538  case SID_REDO:
1539  {
1540  (void)rSh.GetFirstRedoInfo(nullptr, &nUndoId);
1541  if (nUndoId == SwUndoId::CONFLICT)
1542  {
1543  rReq.SetReturnValue( SfxUInt32Item(nId, static_cast<sal_uInt32>(SID_REPAIRPACKAGE)) );
1544  break;
1545  }
1546 
1547  if ( pUndoManager )
1548  {
1549  sal_uInt16 nCount = pUndoManager->GetRedoActionCount();
1550  sal_uInt16 nSteps = nCnt;
1551  if ( nCount < nCnt )
1552  {
1553  nCnt = nCnt - nCount;
1554  nSteps = nCount;
1555  }
1556  else
1557  nCnt = 0;
1558 
1559  while( nSteps-- )
1560  pUndoManager->Redo();
1561  }
1562 
1563  if ( nCnt )
1564  rSh.Do( SwWrtShell::REDO, nCnt );
1565 
1566  break;
1567  }
1568  }
1569 
1571 
1574 }
1575 
1577 {
1578  SwPostItMgr* pPostItMgr = rView.GetPostItMgr();
1579  if ( !pPostItMgr || !pPostItMgr->HasActiveSidebarWin() )
1580  return;
1581 
1582  SfxWhichIter aIter(rSet);
1583  SwUndoId nUndoId(SwUndoId::EMPTY);
1584  sal_uInt16 nWhich = aIter.FirstWhich();
1585  SfxUndoManager* pUndoManager = GetUndoManager();
1586  SfxViewFrame *pSfxViewFrame = rView.GetViewFrame();
1587  SwWrtShell &rSh = rView.GetWrtShell();
1588 
1589  while( nWhich )
1590  {
1591  switch ( nWhich )
1592  {
1593  case SID_UNDO:
1594  {
1595  sal_uInt16 nCount = pUndoManager ? pUndoManager->GetUndoActionCount() : 0;
1596  if ( nCount )
1597  pSfxViewFrame->GetSlotState( nWhich, pSfxViewFrame->GetInterface(), &rSet );
1598  else if (rSh.GetLastUndoInfo(nullptr, &nUndoId))
1599  {
1600  rSet.Put( SfxStringItem( nWhich, rSh.GetDoString(SwWrtShell::UNDO)) );
1601  }
1602  else if (nUndoId == SwUndoId::CONFLICT)
1603  {
1604  rSet.Put( SfxUInt32Item(nWhich, static_cast<sal_uInt32>(SID_REPAIRPACKAGE)) );
1605  }
1606  else
1607  rSet.DisableItem(nWhich);
1608  break;
1609  }
1610  case SID_REDO:
1611  {
1612  sal_uInt16 nCount = pUndoManager ? pUndoManager->GetRedoActionCount() : 0;
1613  if ( nCount )
1614  pSfxViewFrame->GetSlotState( nWhich, pSfxViewFrame->GetInterface(), &rSet );
1615  else if (rSh.GetFirstRedoInfo(nullptr, &nUndoId))
1616  {
1617  rSet.Put(SfxStringItem( nWhich, rSh.GetDoString(SwWrtShell::REDO)) );
1618  }
1619  else if (nUndoId == SwUndoId::CONFLICT)
1620  {
1621  rSet.Put( SfxUInt32Item(nWhich, static_cast<sal_uInt32>(SID_REPAIRPACKAGE)) );
1622  }
1623  else
1624  rSet.DisableItem(nWhich);
1625  break;
1626  }
1627  case SID_GETUNDOSTRINGS:
1628  case SID_GETREDOSTRINGS:
1629  {
1630  if( pUndoManager )
1631  {
1632  OUString (SfxUndoManager::*fnGetComment)( size_t, bool const ) const;
1633 
1634  sal_uInt16 nCount;
1635  if( SID_GETUNDOSTRINGS == nWhich )
1636  {
1637  nCount = pUndoManager->GetUndoActionCount();
1638  fnGetComment = &SfxUndoManager::GetUndoActionComment;
1639  }
1640  else
1641  {
1642  nCount = pUndoManager->GetRedoActionCount();
1643  fnGetComment = &SfxUndoManager::GetRedoActionComment;
1644  }
1645 
1646  OUStringBuffer sList;
1647  if( nCount )
1648  {
1649  for( sal_uInt16 n = 0; n < nCount; ++n )
1650  sList.append( (pUndoManager->*fnGetComment)( n, SfxUndoManager::TopLevel ) + "\n");
1651  }
1652 
1653  SfxStringListItem aItem( nWhich );
1654  if ((nWhich == SID_GETUNDOSTRINGS) &&
1655  rSh.GetLastUndoInfo(nullptr, nullptr))
1656  {
1657  rSh.GetDoStrings( SwWrtShell::UNDO, aItem );
1658  }
1659  else if ((nWhich == SID_GETREDOSTRINGS) &&
1660  (rSh.GetFirstRedoInfo(nullptr, nullptr)))
1661  {
1662  rSh.GetDoStrings( SwWrtShell::REDO, aItem );
1663  }
1664 
1665  sList.append(aItem.GetString());
1666  aItem.SetString( sList.makeStringAndClear() );
1667  rSet.Put( aItem );
1668  }
1669  else
1670  rSet.DisableItem( nWhich );
1671  }
1672  break;
1673 
1674  default:
1675  {
1676  pSfxViewFrame->GetSlotState( nWhich, pSfxViewFrame->GetInterface(), &rSet );
1677  break;
1678  }
1679 
1680  }
1681 
1683  rSet.DisableItem( nWhich );
1684 
1685  nWhich = aIter.NextWhich();
1686  }
1687 }
1688 
1690 {
1691  SfxWhichIter aIter(rSet);
1692  sal_uInt16 nWhich = aIter.FirstWhich();
1693  while (nWhich)
1694  {
1695  rSet.DisableItem( nWhich );
1696  nWhich = aIter.NextWhich();
1697  }
1698 }
1699 
1701 {
1702  SwPostItMgr* pPostItMgr = rView.GetPostItMgr();
1703  if ( !pPostItMgr || !pPostItMgr->HasActiveSidebarWin() )
1704  return;
1705 
1706  OutlinerView* pOLV = pPostItMgr->GetActiveSidebarWin()->GetOutlinerView();
1707 
1708  const SfxItemSet *pArgs = rReq.GetArgs();
1709  const SfxPoolItem* pItem = nullptr;
1710  if( pArgs )
1711  pArgs->GetItemState(GetPool().GetWhich(SID_CHARMAP), false, &pItem);
1712 
1713  OUString sSym;
1714  OUString sFontName;
1715  if ( pItem )
1716  {
1717  sSym = static_cast<const SfxStringItem*>(pItem)->GetValue();
1718  const SfxPoolItem* pFtItem = nullptr;
1719  pArgs->GetItemState( GetPool().GetWhich(SID_ATTR_SPECIALCHAR), false, &pFtItem);
1720 
1721  if (const SfxStringItem* pFontItem = dynamic_cast<const SfxStringItem*>(pFtItem))
1722  sFontName = pFontItem->GetValue();
1723  }
1724 
1725  SfxItemSet aSet(pOLV->GetAttribs());
1726  SvtScriptType nScript = pOLV->GetSelectedScriptType();
1727  std::shared_ptr<SvxFontItem> aSetDlgFont(std::make_shared<SvxFontItem>(RES_CHRATR_FONT));
1728  {
1729  SvxScriptSetItem aSetItem( SID_ATTR_CHAR_FONT, *aSet.GetPool() );
1730  aSetItem.GetItemSet().Put( aSet, false );
1731  const SfxPoolItem* pI = aSetItem.GetItemOfScript( nScript );
1732  if( pI )
1733  {
1734  aSetDlgFont.reset(static_cast<SvxFontItem*>(pI->Clone()));
1735  }
1736  else
1737  {
1738  aSetDlgFont.reset(static_cast<SvxFontItem*>(aSet.Get( GetWhichOfScript(
1739  SID_ATTR_CHAR_FONT,
1741  }
1742 
1743  if (sFontName.isEmpty())
1744  sFontName = aSetDlgFont->GetFamilyName();
1745  }
1746 
1747  vcl::Font aFont(sFontName, Size(1,1));
1748  if( sSym.isEmpty() )
1749  {
1751 
1752  SfxAllItemSet aAllSet( GetPool() );
1753  aAllSet.Put( SfxBoolItem( FN_PARAM_1, false ) );
1754 
1756  const OUString& sSymbolFont = aOpt.GetSymbolFont();
1757  if( !sSymbolFont.isEmpty() )
1758  aAllSet.Put( SfxStringItem( SID_FONT_NAME, sSymbolFont ) );
1759  else
1760  aAllSet.Put( SfxStringItem( SID_FONT_NAME, aSetDlgFont->GetFamilyName() ) );
1761 
1762  // If character is selected then it can be shown.
1765  pDlg->Execute();
1766  return;
1767  }
1768 
1769  // do not flicker
1770  pOLV->HideCursor();
1771  Outliner * pOutliner = pOLV->GetOutliner();
1772  pOutliner->SetUpdateMode(false);
1773 
1774  SfxItemSet aOldSet( pOLV->GetAttribs() );
1775  SfxItemSet aFontSet(
1776  *aOldSet.GetPool(),
1777  svl::Items<
1778  EE_CHAR_FONTINFO, EE_CHAR_FONTINFO,
1780  aFontSet.Set( aOldSet );
1781 
1782  // Insert string
1783  pOLV->InsertText( sSym);
1784 
1785  // Attributing (set font)
1786  SfxItemSet aSetFont( *aFontSet.GetPool(), aFontSet.GetRanges() );
1787  SvxFontItem aFontItem (aFont.GetFamilyType(), aFont.GetFamilyName(),
1788  aFont.GetStyleName(), aFont.GetPitch(),
1789  aFont.GetCharSet(),
1790  EE_CHAR_FONTINFO );
1791  SvtScriptType nScriptBreak = g_pBreakIt->GetAllScriptsOfText( sSym );
1792  if( SvtScriptType::LATIN & nScriptBreak )
1793  aSetFont.Put( aFontItem );
1794  if( SvtScriptType::ASIAN & nScriptBreak )
1795  {
1796  aFontItem.SetWhich(EE_CHAR_FONTINFO_CJK);
1797  aSetFont.Put( aFontItem );
1798  }
1799  if( SvtScriptType::COMPLEX & nScriptBreak )
1800  {
1801  aFontItem.SetWhich(EE_CHAR_FONTINFO_CTL);
1802  aSetFont.Put( aFontItem );
1803  }
1804  pOLV->SetAttribs(aSetFont);
1805 
1806  // Erase selection
1807  ESelection aSel(pOLV->GetSelection());
1808  aSel.nStartPara = aSel.nEndPara;
1809  aSel.nStartPos = aSel.nEndPos;
1810  pOLV->SetSelection(aSel);
1811 
1812  // Restore old font
1813  pOLV->SetAttribs( aFontSet );
1814 
1815  // From now on show it again
1816  pOutliner->SetUpdateMode(true);
1817  pOLV->ShowCursor();
1818 
1819  rReq.AppendItem( SfxStringItem( GetPool().GetWhich(SID_CHARMAP), sSym ) );
1820  if(!aFont.GetFamilyName().isEmpty())
1821  rReq.AppendItem( SfxStringItem( SID_ATTR_SPECIALCHAR, aFont.GetFamilyName() ) );
1822  rReq.Done();
1823 
1824 }
1825 
1826 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define FN_HIDE_ALL_NOTES
Definition: cmdid.h:751
const SfxPoolItem * ExecuteSlot(SfxRequest &rReq, const SfxInterface *pIF=nullptr)
void SetURL(const OUString &rURL)
SfxViewFrame * GetViewFrame() const
#define CHAR_WJ
Definition: swtypes.hxx:172
OString stripEnd(std::string_view rIn, char c)
#define LANGUAGE_NONE
static vcl::Font GetDefaultFont(DefaultFontType nType, LanguageType eLang, GetDefaultFontFlags nFlags, const OutputDevice *pOutDev=nullptr)
constexpr TypedWhichId< SvxFontItem > EE_CHAR_FONTINFO_CJK(EE_CHAR_START+17)
void SetTargetFrame(const OUString &rFrm)
sal_Int32 nStartPara
constexpr TypedWhichId< SvxAutoKernItem > EE_CHAR_PAIRKERNING(EE_CHAR_START+11)
void PasteSpecial()
constexpr TypedWhichId< SvxKerningItem > EE_CHAR_KERNING(EE_CHAR_START+12)
const OUString & GetFamilyName() const
bool isContentExtractionLocked() const
void PutItemForScriptType(SvtScriptType nScriptType, const SfxPoolItem &rItem)
#define SFX_IMPL_INTERFACE(Class, SuperClass)
virtual SfxUndoManager * GetUndoManager() override
Definition: annotsh.cxx:139
void InsertText(const OUString &rNew, bool bSelect=false)
SwView & rView
Definition: annotsh.hxx:30
sal_uInt16 GetLower() const
#define LINE_SPACE_DEFAULT_HEIGHT
void SetEscapement(const SvxEscapement eNew)
#define FN_SET_SUPER_SCRIPT
Definition: cmdid.h:308
#define CHAR_NNBSP
Definition: swtypes.hxx:173
SwPostItHelper::SwLayoutStatus GetLayoutStatus() const
SwUndoId
Definition: swundo.hxx:29
virtual const SfxItemSet * GetOutputItemSet() const =0
std::string GetValue
const OUString & GetStyleName() const
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const =0
const OUString & GetTargetFrame() const
static void HandleOpenXmlFilterSettings(SfxRequest &)
tools::Rectangle const & GetOutputArea() const
void ShowCursor(bool bGotoCursor=true, bool bActivate=false)
static SvxAbstractDialogFactory * Create()
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_LANGUAGE(10)
long Long
Reference< XFrame > xFrame
bool GetLastUndoInfo(OUString *const o_pStr, SwUndoId *const o_pId, const SwView *pView=nullptr) const
Definition: edws.cxx:237
LanguageType GetLanguage(SfxItemSet const &aSet, sal_uInt16 nLangWhichId)
Definition: langhelper.cxx:390
#define LANGUAGE_KOREAN
sal_Int64 n
void GetState(SfxItemSet &)
Definition: annotsh.cxx:585
void StateUndo(SfxItemSet &rSet)
Definition: annotsh.cxx:1576
bool HasSelection() const
void InvalidateItem(sal_uInt16 nWhich)
SvtScriptType GetAllScriptsOfText(const OUString &rText) const
Definition: breakit.cxx:127
sal_Int16 nId
sal_uInt16 FirstWhich()
#define CHAR_HARDBLANK
Definition: swtypes.hxx:166
void TransliterateText(TransliterationFlags nTransliterationMode)
constexpr sal_uInt16 EE_ITEMS_END(EE_FEATURE_END)
constexpr TypedWhichId< SvxFormatBreakItem > RES_BREAK(94)
void GetDoStrings(DoType eDoType, SfxStringListItem &rStrLstItem) const
Definition: wrtundo.cxx:115
SwEditWin & GetEditWin()
Definition: view.hxx:416
void Done(bool bRemove=false)
sal_Int32 GetParagraphCount() const
void ChangeFontSize(bool bGrow, const FontList *pList)
constexpr TypedWhichId< SvxAdjustItem > EE_PARA_JUST(EE_PARA_START+15)
static SfxObjectShell * Current()
bool HasActiveAnnotationWin() const
Definition: PostItMgr.cxx:2357
void SetModified()
Definition: edws.cxx:70
void StateSearch(SfxItemSet &)
Definition: viewsrch.cxx:827
const SfxItemSet * GetArgs() const
void SelectCurrentWord(sal_Int16 nWordType=css::i18n::WordType::ANYWORD_IGNOREWHITESPACES)
bool IsCTLFontEnabled() const
bool HasFormat(SotClipboardFormatId nFormat) const
void ExecLingu(SfxRequest &rReq)
Definition: annotsh.cxx:1231
constexpr TypedWhichId< SvxFontItem > RES_CHRATR_FONT(7)
virtual bool Undo()
constexpr TypedWhichId< SvxLineSpacingItem > EE_PARA_SBL(EE_PARA_START+14)
#define CHAR_RLM
Definition: swtypes.hxx:169
void ExecSearch(SfxRequest &)
Definition: annotsh.cxx:850
constexpr TypedWhichId< SvxFrameDirectionItem > EE_PARA_WRITINGDIR(EE_PARA_START+0)
FontFamily GetFamilyType()
sal_uInt16 NextWhich()
SwWrtShell & GetWrtShell() const
Definition: view.hxx:413
static LanguageType nLang
Definition: srtdlg.cxx:51
#define CHAR_SOFTHYPHEN
Definition: swtypes.hxx:168
virtual bool Redo()
void ExecClpbrd(SfxRequest const &rReq)
Definition: annotsh.cxx:860
Used by the UI to modify the document model.
Definition: wrtsh.hxx:91
weld::Window * GetFrameWeld() const
void StateSearch(SfxItemSet &)
Definition: annotsh.cxx:855
sal_uInt16 sal_Unicode
void UpdateWordCount(SfxShell *, sal_uInt16)
Definition: view1.cxx:203
void SetTargetFrame(const OUString &rTarget)
SfxUndoManager & GetUndoManager()
void SetPropLineSpace(const sal_uInt16 nProp)
#define FN_FORMAT_ALL_NOTES
Definition: cmdid.h:755
LINESTYLE_NONE
constexpr TypedWhichId< SvxLRSpaceItem > EE_PARA_LRSPACE(EE_PARA_START+12)
void StartTextConversion(weld::Widget *pDialogParent, LanguageType nSrcLang, LanguageType nDestLang, const vcl::Font *pDestFont, sal_Int32 nOptions, bool bIsInteractive, bool bMultipleDoc)
constexpr TypedWhichId< SvxULSpaceItem > EE_PARA_ULSPACE(EE_PARA_START+13)
constexpr TypedWhichId< SvxFontItem > EE_CHAR_FONTINFO_CTL(EE_CHAR_START+18)
void Exec(SfxRequest &)
Definition: annotsh.cxx:151
SwBreakIt * g_pBreakIt
Definition: breakit.cxx:33
const SfxPoolItem & GetDefault(sal_uInt16 nFormatHint) const
Get the default attribute in this document.
Definition: docfmt.cxx:653
SfxFrame & GetFrame() const
int nCount
void SelectRange(sal_Int32 nFirst, sal_Int32 nCount)
static TransferableDataHelper CreateFromSystemClipboard(vcl::Window *pWindow)
void ExecuteCommand(sal_uInt16 nSlot)
HLINK_HTMLMODE
#define FN_DELETE_COMMENT
Definition: cmdid.h:753
#define FN_STAT_SELMODE
Definition: cmdid.h:833
SwDoc * GetDoc() const
Definition: viewsh.hxx:281
void NoteExec(SfxRequest const &)
Definition: annotsh.cxx:1075
void ExecUndo(SfxRequest &rReq)
Definition: annotsh.cxx:1489
void GetNoteState(SfxItemSet &)
Definition: annotsh.cxx:1124
SotClipboardFormatId
OString OUStringToOString(std::u16string_view str, ConnectionSettings const *settings)
sal_Int32 nEndPos
bool HasSelection() const
virtual size_t GetRedoActionCount(bool const i_currentLevel=CurrentLevel) const
OUString GetDoString(DoType eDoType) const
Definition: wrtundo.cxx:95
bool SetLanguageStatus(OutlinerView *pOLV, SfxRequest &rReq, SwView const &rView, SwWrtShell &rSh)
Definition: langhelper.cxx:93
constexpr TypedWhichId< SvxContourItem > EE_CHAR_OUTLINE(EE_CHAR_START+8)
TransliterationFlags
EditView & GetEditView() const
#define FN_SHRINK_FONT_SIZE
Definition: cmdid.h:306
SfxItemPool & GetPool() const
RotateTransliteration m_aRotateCase
Definition: annotsh.hxx:31
constexpr TypedWhichId< SvxHyphenZoneItem > RES_PARATR_HYPHENZONE(69)
void StateClpbrd(SfxItemSet &rSet)
Definition: annotsh.cxx:936
#define FN_RESOLVE_NOTE
Definition: cmdid.h:756
constexpr TypedWhichId< SvxShadowedItem > EE_CHAR_SHADOW(EE_CHAR_START+9)
SwAnnotationShell(SwView &)
Definition: annotsh.cxx:128
const SfxPoolItem * GetItem(sal_uInt16 nSlotId) const
#define FN_STAT_TEMPLATE
Definition: cmdid.h:831
#define FN_REPLY
Definition: cmdid.h:754
const SfxItemPool & GetAttrPool() const
Definition: viewsh.hxx:612
#define FN_SET_SUB_SCRIPT
Definition: cmdid.h:309
SvtScriptType
#define FN_NUMBERING_OUTLINE_DLG
Definition: cmdid.h:489
const OUString & GetURL() const
FontPitch GetPitch()
void SetAttribs(const SfxItemSet &)
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
SvxAdjust
const SfxPoolItem * GetSlotState(sal_uInt16 nSlotId, const SfxInterface *pIF=nullptr, SfxItemSet *pStateSet=nullptr)
const SvxFieldItem * GetFieldAtSelection() const
void InsertSymbol(SfxRequest &rReq)
Definition: annotsh.cxx:1700
css::uno::Sequence< css::uno::Any > InitAnyPropertySequence(::std::initializer_list< ::std::pair< OUString, css::uno::Any > > vInit)
OUString Apply(const OUString &rStr) const
Definition: SwRewriter.cxx:41
void ExecTransliteration(SfxRequest const &)
Definition: annotsh.cxx:1421
#define FN_DELETE_NOTE_AUTHOR
Definition: cmdid.h:747
constexpr TypedWhichId< SvxCharScaleWidthItem > EE_CHAR_FONTWIDTH(EE_CHAR_START+3)
void Hide(std::u16string_view rAuthor)
Definition: PostItMgr.cxx:1726
constexpr TypedWhichId< SvxCharReliefItem > EE_CHAR_RELIEF(EE_CHAR_START+26)
SfxBindings & GetBindings()
const OUString & GetValue() const
HTMLMODE_ON
sal_uInt16 GetHtmlMode(const SwDocShell *pShell)
Definition: viewopt.cxx:354
const T * GetArg(sal_uInt16 nSlotId) const
#define FN_HIDE_NOTE_AUTHOR
Definition: cmdid.h:750
void SetPool(SfxItemPool *pNewPool)
OUString GetSelected() const
constexpr sal_uInt16 EE_ITEMS_START(OWN_ATTR_VALUE_END+1)
void ExecFormatFootnote()
Definition: view0.cxx:690
static sal_Int16 GetI18NScriptTypeOfLanguage(LanguageType nLang)
LINESTYLE_SINGLE
SvtScriptType GetSelectedScriptType() const
void AddRule(SwUndoArg eWhat, const OUString &rWith)
Definition: SwRewriter.cxx:27
virtual void SetCurPageId(const OString &rName)=0
void GetLanguageStatus(OutlinerView *pOLV, SfxItemSet &rSet)
Definition: langhelper.cxx:57
sal_uInt16 GetWhichOfScript(sal_uInt16 nWhich, sal_uInt16 nScript)
Definition: hints.cxx:190
bool IsModified() const
TransliterationFlags getNextMode()
virtual SotClipboardFormatId GetFormat(const TransferableDataHelper &aHelper)=0
void Paste(bool bUseSpecial=false)
constexpr TypedWhichId< SvxBackgroundColorItem > EE_CHAR_BKGCOLOR(EE_CHAR_START+32)
#define LANGUAGE_CHINESE_SIMPLIFIED
HLINK_FIELD
CPPUHELPER_DLLPUBLIC css::uno::Reference< css::uno::XComponentContext > SAL_CALL defaultBootstrap_InitialComponentContext()
void SetString(const OUString &)
#define FN_DELETE_COMMENT_THREAD
Definition: cmdid.h:758
#define CHAR_ZWSP
Definition: swtypes.hxx:171
static SwAbstractDialogFactory * Create()
Definition: swabstdlg.cxx:36
Outliner * GetOutliner() const
#define FN_WORDCOUNT_DIALOG
Definition: cmdid.h:591
virtual VclPtr< SfxAbstractDialog > CreateCharMapDialog(weld::Window *pParent, const SfxItemSet &rAttr, const css::uno::Reference< css::frame::XFrame > &rFrame)=0
sal_uInt16 GetSlotId(sal_uInt16 nWhich) const
OUString SwResId(const char *pId)
Definition: swmodule.cxx:165
EESpellState StartThesaurus(weld::Widget *pDialogParent)
OUString GetID() const
void StateInsert(SfxItemSet &rSet)
Definition: annotsh.cxx:1022
void SetName(const OUString &rName)
void HideCursor(bool bDeactivate=false)
virtual size_t GetUndoActionCount(bool const i_currentLevel=CurrentLevel) const
void InsertField(const SvxFieldItem &rFld)
void ResizeIfNecessary(tools::Long aOldHeight, tools::Long aNewHeight)
std::unique_ptr< SfxPoolItem > CloneSetWhich(sal_uInt16 nNewWhich) const
SwDocShell * GetDocShell()
Definition: view.cxx:1126
const css::uno::Reference< css::frame::XFrame > & GetFrameInterface() const
const OUString & GetSymbolFont() const
Definition: viewopt.hxx:575
#define SFX_OBJECTBAR_OBJECT
#define FN_INSERT_STRING
Definition: cmdid.h:217
virtual void Insert(SotClipboardFormatId nFormat, const OUString &rFormatName)=0
SW_DLLPUBLIC bool HasActiveSidebarWin() const
Definition: PostItMgr.cxx:2352
ESelection GetSelection() const
void ExecuteFormatAllDialog(SwView &rView)
Definition: PostItMgr.cxx:1653
void SetReturnValue(const SfxPoolItem &)
uno::Reference< linguistic2::XThesaurus > GetThesaurus()
Definition: swtypes.cxx:59
SfxItemPool * GetSecondaryPool() const
weld::Window * GetFrameWeld() const
FontLineStyle GetLineStyle() const
virtual ~SwAnnotationShell() override
Definition: annotsh.cxx:135
#define CHAR_LRM
Definition: swtypes.hxx:170
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
OUString GetUndoActionComment(size_t nNo=0, bool const i_currentLevel=CurrentLevel) const
sal_uInt16 GetSlot() const
static const OUString & GetContextName(const Context eContext)
constexpr TypedWhichId< SvxCrossedOutItem > EE_CHAR_STRIKEOUT(EE_CHAR_START+6)
#define CHAR_HARDHYPHEN
Definition: swtypes.hxx:167
void SetSelection(const ESelection &)
bool EDITENG_DLLPUBLIC GetStatusValueForThesaurusFromContext(OUString &rStatusVal, LanguageType &rLang, const EditView &rEditView)
constexpr TypedWhichId< SvxOrphansItem > RES_PARATR_ORPHANS(66)
SfxItemState
void DisableItem(sal_uInt16 nWhich)
weld::Window * GetFrameWeld() const
OUString GetRedoActionComment(size_t nNo=0, bool const i_currentLevel=CurrentLevel) 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:697
#define GetWhich(nSlot)
const SwViewOption * GetViewOptions() const
Definition: viewsh.hxx:423
constexpr TypedWhichId< SvxEscapementItem > EE_CHAR_ESCAPEMENT(EE_CHAR_START+10)
void Do(DoType eDoType, sal_uInt16 nCnt=1)
Definition: wrtundo.cxx:33
void ExecSearch(SfxRequest &)
Definition: viewsrch.cxx:125
constexpr TypedWhichId< SvxColorItem > EE_CHAR_COLOR(EE_CHAR_START+0)
LanguageType GetAppLanguage()
Definition: init.cxx:732
RET_OK
constexpr TypedWhichId< SvxWordLineModeItem > EE_CHAR_WLM(EE_CHAR_START+13)
SwPostItMgr * GetPostItMgr()
Definition: view.hxx:642
constexpr TypedWhichId< SvxOverlineItem > EE_CHAR_OVERLINE(EE_CHAR_START+29)
Sequence< sal_Int8 > aSeq
constexpr TypedWhichId< SvxLanguageItem > EE_CHAR_LANGUAGE(EE_CHAR_START+14)
constexpr TypedWhichId< SvxFontItem > EE_CHAR_FONTINFO(EE_CHAR_START+1)
void SetUpdateMode(bool bUpdate)
bool GetFirstRedoInfo(OUString *const o_pStr, SwUndoId *const o_pId, const SwView *pView=nullptr) const
Definition: edws.cxx:244
#define FN_GROW_FONT_SIZE
Definition: cmdid.h:305
void SetInsertMode(SvxLinkInsertMode eNew)
sw::annotation::SwAnnotationWin * GetActiveSidebarWin()
Definition: PostItMgr.hxx:233
bool IsVertical() const
#define FN_FORMAT_FOOTNOTE_DLG
Definition: cmdid.h:325
void SetSelection(const ESelection &rNewSel)
virtual SfxInterface * GetInterface() const
void AddClipbrdFormat(SotClipboardFormatId nId)
SvxEscapement
void SetVisibleState(sal_uInt16 nId, bool bShow)
constexpr TypedWhichId< SvxUnderlineItem > EE_CHAR_UNDERLINE(EE_CHAR_START+5)
const OUString & GetName() const
SvxLinkInsertMode GetInsertMode() const
void InvalidateAll(bool bWithMsg)
void AppendItem(const SfxPoolItem &)
OUString GetFullName() const
#define LANGUAGE_CHINESE_TRADITIONAL
static void StateDisableItems(SfxItemSet &)
Definition: annotsh.cxx:1689
SVXCORE_DLLPUBLIC MSO_SPT Get(const OUString &)
SfxItemSet GetAttribs()
constexpr sal_uInt16 EE_FEATURE_FIELD(EE_FEATURE_NOTCONV+1)
void ExecRotateTransliteration(SfxRequest const &)
Definition: annotsh.cxx:1472
static void StateStatusLine(SfxItemSet &rSet)
Definition: annotsh.cxx:997
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)
OUString GetString()
FontLineStyle
void GetLinguState(SfxItemSet &)
Definition: annotsh.cxx:1351
const css::uno::Reference< css::datatransfer::XTransferable > & GetTransferable() const
static SfxItemPool * GetAnnotationPool(SwView const &rV)
Definition: annotsh.cxx:122
#define FN_HIDE_NOTE
Definition: cmdid.h:749
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)
void SetContextName(const OUString &rsContextName)
const SfxPoolItem * GetItemOfScript(SvtScriptType nScript) const
virtual SfxObjectShell * GetObjectShell()
void EDITENG_DLLPUBLIC ReplaceTextWithSynonym(EditView &rEditView, const OUString &rSynonmText)
#define FN_POSTIT
Definition: cmdid.h:215
constexpr TypedWhichId< SvxWidowsItem > RES_PARATR_WIDOWS(67)
rtl_TextEncoding GetCharSet() const
Definition: view.hxx:144
void Delete(const OUString &aAuthor)
Definition: PostItMgr.cxx:1496
sal_uInt16 GetUpper() const
const SvxFieldData * GetField() const
static css::lang::Locale convertToLocale(LanguageType nLangID, bool bResolveSystem=true)
#define FN_RESOLVE_NOTE_THREAD
Definition: cmdid.h:757
#define FN_DELETE_ALL_NOTES
Definition: cmdid.h:748
static bool const TopLevel
typedef void(CALLTYPE *GetFuncDataPtr)(sal_uInt16 &nNo