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