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