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