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  if ( pPostItMgr->HasActiveSidebarWin() )
1116  pPostItMgr->GetActiveSidebarWin()->ExecuteCommand(nSlot);
1117  break;
1118 
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_DELETE_NOTE_AUTHOR:
1175  case FN_HIDE_NOTE_AUTHOR:
1176  {
1177  if( !pPostItMgr
1178  || !pPostItMgr->HasActiveAnnotationWin() )
1179  {
1180  rSet.DisableItem(nWhich);
1181  }
1182  else
1183  {
1184  OUString aText( nSlotId == FN_DELETE_NOTE_AUTHOR ?
1185  SwResId( STR_DELETE_NOTE_AUTHOR ) : SwResId( STR_HIDE_NOTE_AUTHOR ) );
1186  SwRewriter aRewriter;
1187  aRewriter.AddRule( UndoArg1, pPostItMgr->GetActiveSidebarWin()->GetAuthor() );
1188  aText = aRewriter.Apply( aText );
1189  SfxStringItem aItem( nSlotId, aText );
1190  rSet.Put( aItem );
1191  }
1192  break;
1193  }
1194  case FN_REPLY:
1195  {
1196  if ( !pPostItMgr ||
1197  !pPostItMgr->HasActiveAnnotationWin() )
1198  {
1199  rSet.DisableItem(nWhich);
1200  }
1201  else
1202  {
1203  SvtUserOptions aUserOpt;
1204  OUString sAuthor;
1205  if( (sAuthor = aUserOpt.GetFullName()).isEmpty() &&
1206  (sAuthor = aUserOpt.GetID()).isEmpty() )
1207  sAuthor = SwResId( STR_REDLINE_UNKNOWN_AUTHOR );
1208  if (sAuthor == pPostItMgr->GetActiveSidebarWin()->GetAuthor())
1209  rSet.DisableItem(nWhich);
1210  }
1211  break;
1212  }
1213  default:
1214  rSet.InvalidateItem( nWhich );
1215  break;
1216  }
1217 
1218  if (pPostItMgr && pPostItMgr->HasActiveSidebarWin())
1219  {
1220  if ( (pPostItMgr->GetActiveSidebarWin()->IsProtected()) &&
1221  ( (nSlotId==FN_DELETE_COMMENT) || (nSlotId==FN_REPLY) ) )
1222  rSet.DisableItem( nWhich );
1223  }
1224  nWhich = aIter.NextWhich();
1225  }
1226 }
1227 
1229 {
1230  SwPostItMgr* pPostItMgr = rView.GetPostItMgr();
1231  if ( !pPostItMgr || !pPostItMgr->HasActiveSidebarWin() )
1232  return;
1233 
1234  OutlinerView* pOLV = pPostItMgr->GetActiveSidebarWin()->GetOutlinerView();
1235  sal_uInt16 nSlot = rReq.GetSlot();
1236  SwWrtShell &rSh = rView.GetWrtShell();
1237  bool bRestoreSelection = false;
1238  ESelection aOldSelection;
1239 
1240  switch (nSlot)
1241  {
1242  case SID_LANGUAGE_STATUS:
1243  {
1244  aOldSelection = pOLV->GetSelection();
1245  if (!pOLV->GetEditView().HasSelection())
1246  {
1247  pOLV->GetEditView().SelectCurrentWord();
1248  }
1249 
1250  bRestoreSelection = SwLangHelper::SetLanguageStatus(pOLV,rReq,rView,rSh);
1251  break;
1252  }
1253  case SID_THES:
1254  {
1255  OUString aReplaceText;
1256  const SfxStringItem* pItem2 = rReq.GetArg<SfxStringItem>(SID_THES);
1257  if (pItem2)
1258  aReplaceText = pItem2->GetValue();
1259  if (!aReplaceText.isEmpty())
1260  ReplaceTextWithSynonym( pOLV->GetEditView(), aReplaceText );
1261  break;
1262  }
1263  case SID_THESAURUS:
1264  {
1265  pOLV->StartThesaurus();
1266  break;
1267  }
1268  case SID_HANGUL_HANJA_CONVERSION:
1270  i18n::TextConversionOption::CHARACTER_BY_CHARACTER, true, false );
1271  break;
1272 
1273  case SID_CHINESE_CONVERSION:
1274  {
1275  //open ChineseTranslationDialog
1277  ::cppu::defaultBootstrap_InitialComponentContext() ); //@todo get context from calc if that has one
1278  if(xContext.is())
1279  {
1280  Reference< lang::XMultiComponentFactory > xMCF( xContext->getServiceManager() );
1281  if(xMCF.is())
1282  {
1283  Reference< ui::dialogs::XExecutableDialog > xDialog(
1284  xMCF->createInstanceWithContext(
1285  "com.sun.star.linguistic2.ChineseTranslationDialog", xContext),
1286  UNO_QUERY);
1287  Reference< lang::XInitialization > xInit( xDialog, UNO_QUERY );
1288  if( xInit.is() )
1289  {
1290  // initialize dialog
1291  uno::Sequence<uno::Any> aSeq(comphelper::InitAnyPropertySequence(
1292  {
1293  {"ParentWindow", uno::Any(Reference<awt::XWindow>())}
1294  }));
1295  xInit->initialize( aSeq );
1296 
1297  //execute dialog
1298  sal_Int16 nDialogRet = xDialog->execute();
1299  if( RET_OK == nDialogRet )
1300  {
1301  //get some parameters from the dialog
1302  bool bToSimplified = true;
1303  bool bUseVariants = true;
1304  bool bCommonTerms = true;
1305  Reference< beans::XPropertySet > xProp( xDialog, UNO_QUERY );
1306  if( xProp.is() )
1307  {
1308  try
1309  {
1310  xProp->getPropertyValue( "IsDirectionToSimplified" ) >>= bToSimplified;
1311  xProp->getPropertyValue( "IsUseCharacterVariants" ) >>= bUseVariants;
1312  xProp->getPropertyValue( "IsTranslateCommonTerms" ) >>= bCommonTerms;
1313  }
1314  catch (const Exception&)
1315  {
1316  }
1317  }
1318 
1319  //execute translation
1322  sal_Int32 nOptions = bUseVariants ? i18n::TextConversionOption::USE_CHARACTER_VARIANTS : 0;
1323  if( !bCommonTerms )
1324  nOptions = nOptions | i18n::TextConversionOption::CHARACTER_BY_CHARACTER;
1325 
1326  vcl::Font aTargetFont = OutputDevice::GetDefaultFont( DefaultFontType::CJK_TEXT,
1327  nTargetLang, GetDefaultFontFlags::OnlyOne );
1328 
1329  pOLV->StartTextConversion( nSourceLang, nTargetLang, &aTargetFont, nOptions, false, false );
1330  }
1331  }
1332  Reference< lang::XComponent > xComponent( xDialog, UNO_QUERY );
1333  if( xComponent.is() )
1334  xComponent->dispose();
1335  }
1336  }
1337  }
1338  break;
1339  }
1340 
1341  if (bRestoreSelection)
1342  {
1343  // restore selection
1344  pOLV->GetEditView().SetSelection( aOldSelection );
1345  }
1346 }
1347 
1349 {
1350  SwPostItMgr* pPostItMgr = rView.GetPostItMgr();
1351  if ( !pPostItMgr || !pPostItMgr->HasActiveSidebarWin() )
1352  return;
1353 
1354  OutlinerView* pOLV = pPostItMgr->GetActiveSidebarWin()->GetOutlinerView();
1355 
1356  SfxWhichIter aIter(rSet);
1357  sal_uInt16 nWhich = aIter.FirstWhich();
1358  while(nWhich)
1359  {
1360  switch (nWhich)
1361  {
1362  case SID_LANGUAGE_STATUS:
1363  {
1365  break;
1366  }
1367 
1368  case SID_THES:
1369  {
1370  OUString aStatusVal;
1372  bool bIsLookUpWord = GetStatusValueForThesaurusFromContext( aStatusVal, nLang, pOLV->GetEditView() );
1373  rSet.Put( SfxStringItem( SID_THES, aStatusVal ) );
1374 
1375  // disable "Thesaurus" context menu entry if there is nothing to look up
1376  uno::Reference< linguistic2::XThesaurus > xThes( ::GetThesaurus() );
1377  if (!bIsLookUpWord ||
1378  !xThes.is() || nLang == LANGUAGE_NONE || !xThes->hasLocale( LanguageTag::convertToLocale( nLang ) ))
1379  rSet.DisableItem( SID_THES );
1380  break;
1381  }
1382 
1383  // disable "Thesaurus" if the language is not supported
1384  case SID_THESAURUS:
1385  {
1386  const SfxPoolItem &rItem = rView.GetWrtShell().GetDoc()->GetDefault(
1389  LanguageType nLang = static_cast<const SvxLanguageItem &>(
1390  rItem).GetLanguage();
1391  uno::Reference< linguistic2::XThesaurus > xThes( ::GetThesaurus() );
1392  if (!xThes.is() || nLang == LANGUAGE_NONE ||
1393  !xThes->hasLocale( LanguageTag::convertToLocale( nLang ) ))
1394  rSet.DisableItem( SID_THESAURUS );
1395  }
1396  break;
1397  case SID_HANGUL_HANJA_CONVERSION:
1398  case SID_CHINESE_CONVERSION:
1399  {
1400  if (!SvtCJKOptions().IsAnyEnabled())
1401  {
1402  rView.GetViewFrame()->GetBindings().SetVisibleState( nWhich, false );
1403  rSet.DisableItem(nWhich);
1404  }
1405  else
1406  rView.GetViewFrame()->GetBindings().SetVisibleState( nWhich, true );
1407  }
1408  break;
1409  }
1410 
1412  rSet.DisableItem( nWhich );
1413 
1414  nWhich = aIter.NextWhich();
1415  }
1416 }
1417 
1419 {
1420  SwPostItMgr* pPostItMgr = rView.GetPostItMgr();
1421  if (!pPostItMgr || !pPostItMgr->HasActiveSidebarWin())
1422  return;
1423 
1424  OutlinerView* pOLV = pPostItMgr->GetActiveSidebarWin()->GetOutlinerView();
1425 
1426  if (!pOLV)
1427  return;
1428 
1429  TransliterationFlags nMode = TransliterationFlags::NONE;
1430 
1431  switch( rReq.GetSlot() )
1432  {
1433  case SID_TRANSLITERATE_SENTENCE_CASE:
1434  nMode = TransliterationFlags::SENTENCE_CASE;
1435  break;
1436  case SID_TRANSLITERATE_TITLE_CASE:
1437  nMode = TransliterationFlags::TITLE_CASE;
1438  break;
1439  case SID_TRANSLITERATE_TOGGLE_CASE:
1440  nMode = TransliterationFlags::TOGGLE_CASE;
1441  break;
1442  case SID_TRANSLITERATE_UPPER:
1443  nMode = TransliterationFlags::LOWERCASE_UPPERCASE;
1444  break;
1445  case SID_TRANSLITERATE_LOWER:
1446  nMode = TransliterationFlags::UPPERCASE_LOWERCASE;
1447  break;
1448  case SID_TRANSLITERATE_HALFWIDTH:
1449  nMode = TransliterationFlags::FULLWIDTH_HALFWIDTH;
1450  break;
1451  case SID_TRANSLITERATE_FULLWIDTH:
1452  nMode = TransliterationFlags::HALFWIDTH_FULLWIDTH;
1453  break;
1454  case SID_TRANSLITERATE_HIRAGANA:
1455  nMode = TransliterationFlags::KATAKANA_HIRAGANA;
1456  break;
1457  case SID_TRANSLITERATE_KATAKANA:
1458  nMode = TransliterationFlags::HIRAGANA_KATAKANA;
1459  break;
1460 
1461  default:
1462  OSL_ENSURE(false, "wrong dispatcher");
1463  }
1464 
1465  if( nMode != TransliterationFlags::NONE )
1466  pOLV->TransliterateText( nMode );
1467 }
1468 
1470 {
1471  if( rReq.GetSlot() == SID_TRANSLITERATE_ROTATE_CASE )
1472  {
1473  SwPostItMgr* pPostItMgr = rView.GetPostItMgr();
1474  if (!pPostItMgr || !pPostItMgr->HasActiveSidebarWin())
1475  return;
1476 
1477  OutlinerView* pOLV = pPostItMgr->GetActiveSidebarWin()->GetOutlinerView();
1478 
1479  if (!pOLV)
1480  return;
1481 
1483  }
1484 }
1485 
1487 {
1488  const SfxItemSet* pArgs = rReq.GetArgs();
1489  SfxUndoManager* pUndoManager = GetUndoManager();
1490  SwWrtShell &rSh = rView.GetWrtShell();
1491  SwUndoId nUndoId(SwUndoId::EMPTY);
1492 
1493  long aOldHeight = rView.GetPostItMgr()->HasActiveSidebarWin()
1495  : 0;
1496 
1497  sal_uInt16 nId = rReq.GetSlot();
1498  sal_uInt16 nCnt = 1;
1499  const SfxPoolItem* pItem=nullptr;
1500  if( pArgs && SfxItemState::SET == pArgs->GetItemState( nId, false, &pItem ) )
1501  nCnt = static_cast<const SfxUInt16Item*>(pItem)->GetValue();
1502  switch( nId )
1503  {
1504  case SID_UNDO:
1505  {
1506  rSh.GetLastUndoInfo(nullptr, &nUndoId);
1507  if (nUndoId == SwUndoId::CONFLICT)
1508  {
1509  rReq.SetReturnValue( SfxUInt32Item(nId, static_cast<sal_uInt32>(SID_REPAIRPACKAGE)) );
1510  break;
1511  }
1512 
1513  if ( pUndoManager )
1514  {
1515  sal_uInt16 nCount = pUndoManager->GetUndoActionCount();
1516  sal_uInt16 nSteps = nCnt;
1517  if ( nCount < nCnt )
1518  {
1519  nCnt = nCnt - nCount;
1520  nSteps = nCount;
1521  }
1522  else
1523  nCnt = 0;
1524 
1525  while( nSteps-- )
1526  pUndoManager->Undo();
1527  }
1528 
1529  if ( nCnt )
1530  rSh.Do( SwWrtShell::UNDO, nCnt );
1531 
1532  break;
1533  }
1534 
1535  case SID_REDO:
1536  {
1537  (void)rSh.GetFirstRedoInfo(nullptr, &nUndoId);
1538  if (nUndoId == SwUndoId::CONFLICT)
1539  {
1540  rReq.SetReturnValue( SfxUInt32Item(nId, static_cast<sal_uInt32>(SID_REPAIRPACKAGE)) );
1541  break;
1542  }
1543 
1544  if ( pUndoManager )
1545  {
1546  sal_uInt16 nCount = pUndoManager->GetRedoActionCount();
1547  sal_uInt16 nSteps = nCnt;
1548  if ( nCount < nCnt )
1549  {
1550  nCnt = nCnt - nCount;
1551  nSteps = nCount;
1552  }
1553  else
1554  nCnt = 0;
1555 
1556  while( nSteps-- )
1557  pUndoManager->Redo();
1558  }
1559 
1560  if ( nCnt )
1561  rSh.Do( SwWrtShell::REDO, nCnt );
1562 
1563  break;
1564  }
1565  }
1566 
1568 
1571 }
1572 
1574 {
1575  SwPostItMgr* pPostItMgr = rView.GetPostItMgr();
1576  if ( !pPostItMgr || !pPostItMgr->HasActiveSidebarWin() )
1577  return;
1578 
1579  SfxWhichIter aIter(rSet);
1580  SwUndoId nUndoId(SwUndoId::EMPTY);
1581  sal_uInt16 nWhich = aIter.FirstWhich();
1582  SfxUndoManager* pUndoManager = GetUndoManager();
1583  SfxViewFrame *pSfxViewFrame = rView.GetViewFrame();
1584  SwWrtShell &rSh = rView.GetWrtShell();
1585 
1586  while( nWhich )
1587  {
1588  switch ( nWhich )
1589  {
1590  case SID_UNDO:
1591  {
1592  sal_uInt16 nCount = pUndoManager ? pUndoManager->GetUndoActionCount() : 0;
1593  if ( nCount )
1594  pSfxViewFrame->GetSlotState( nWhich, pSfxViewFrame->GetInterface(), &rSet );
1595  else if (rSh.GetLastUndoInfo(nullptr, &nUndoId))
1596  {
1597  rSet.Put( SfxStringItem( nWhich, rSh.GetDoString(SwWrtShell::UNDO)) );
1598  }
1599  else if (nUndoId == SwUndoId::CONFLICT)
1600  {
1601  rSet.Put( SfxUInt32Item(nWhich, static_cast<sal_uInt32>(SID_REPAIRPACKAGE)) );
1602  }
1603  else
1604  rSet.DisableItem(nWhich);
1605  break;
1606  }
1607  case SID_REDO:
1608  {
1609  sal_uInt16 nCount = pUndoManager ? pUndoManager->GetRedoActionCount() : 0;
1610  if ( nCount )
1611  pSfxViewFrame->GetSlotState( nWhich, pSfxViewFrame->GetInterface(), &rSet );
1612  else if (rSh.GetFirstRedoInfo(nullptr, &nUndoId))
1613  {
1614  rSet.Put(SfxStringItem( nWhich, rSh.GetDoString(SwWrtShell::REDO)) );
1615  }
1616  else if (nUndoId == SwUndoId::CONFLICT)
1617  {
1618  rSet.Put( SfxUInt32Item(nWhich, static_cast<sal_uInt32>(SID_REPAIRPACKAGE)) );
1619  }
1620  else
1621  rSet.DisableItem(nWhich);
1622  break;
1623  }
1624  case SID_GETUNDOSTRINGS:
1625  case SID_GETREDOSTRINGS:
1626  {
1627  if( pUndoManager )
1628  {
1629  OUString (SfxUndoManager:: *fnGetComment)( size_t, bool const ) const;
1630 
1631  sal_uInt16 nCount;
1632  if( SID_GETUNDOSTRINGS == nWhich )
1633  {
1634  nCount = pUndoManager->GetUndoActionCount();
1635  fnGetComment = &SfxUndoManager::GetUndoActionComment;
1636  }
1637  else
1638  {
1639  nCount = pUndoManager->GetRedoActionCount();
1640  fnGetComment = &SfxUndoManager::GetRedoActionComment;
1641  }
1642 
1643  OUStringBuffer sList;
1644  if( nCount )
1645  {
1646  for( sal_uInt16 n = 0; n < nCount; ++n )
1647  sList.append( (pUndoManager->*fnGetComment)( n, SfxUndoManager::TopLevel ) ).append("\n");
1648  }
1649 
1650  SfxStringListItem aItem( nWhich );
1651  if ((nWhich == SID_GETUNDOSTRINGS) &&
1652  rSh.GetLastUndoInfo(nullptr, nullptr))
1653  {
1654  rSh.GetDoStrings( SwWrtShell::UNDO, aItem );
1655  }
1656  else if ((nWhich == SID_GETREDOSTRINGS) &&
1657  (rSh.GetFirstRedoInfo(nullptr, nullptr)))
1658  {
1659  rSh.GetDoStrings( SwWrtShell::UNDO, aItem );
1660  }
1661 
1662  sList.append(aItem.GetString());
1663  aItem.SetString( sList.makeStringAndClear() );
1664  rSet.Put( aItem );
1665  }
1666  else
1667  rSet.DisableItem( nWhich );
1668  }
1669  break;
1670 
1671  default:
1672  {
1673  pSfxViewFrame->GetSlotState( nWhich, pSfxViewFrame->GetInterface(), &rSet );
1674  break;
1675  }
1676 
1677  }
1678 
1680  rSet.DisableItem( nWhich );
1681 
1682  nWhich = aIter.NextWhich();
1683  }
1684 }
1685 
1687 {
1688  SfxWhichIter aIter(rSet);
1689  sal_uInt16 nWhich = aIter.FirstWhich();
1690  while (nWhich)
1691  {
1692  rSet.DisableItem( nWhich );
1693  nWhich = aIter.NextWhich();
1694  }
1695 }
1696 
1698 {
1699  SwPostItMgr* pPostItMgr = rView.GetPostItMgr();
1700  if ( !pPostItMgr || !pPostItMgr->HasActiveSidebarWin() )
1701  return;
1702 
1703  OutlinerView* pOLV = pPostItMgr->GetActiveSidebarWin()->GetOutlinerView();
1704 
1705  const SfxItemSet *pArgs = rReq.GetArgs();
1706  const SfxPoolItem* pItem = nullptr;
1707  if( pArgs )
1708  pArgs->GetItemState(GetPool().GetWhich(SID_CHARMAP), false, &pItem);
1709 
1710  OUString sSym;
1711  OUString sFontName;
1712  if ( pItem )
1713  {
1714  sSym = static_cast<const SfxStringItem*>(pItem)->GetValue();
1715  const SfxPoolItem* pFtItem = nullptr;
1716  pArgs->GetItemState( GetPool().GetWhich(SID_ATTR_SPECIALCHAR), false, &pFtItem);
1717 
1718  if (const SfxStringItem* pFontItem = dynamic_cast<const SfxStringItem*>(pFtItem))
1719  sFontName = pFontItem->GetValue();
1720  }
1721 
1722  SfxItemSet aSet(pOLV->GetAttribs());
1723  SvtScriptType nScript = pOLV->GetSelectedScriptType();
1724  std::shared_ptr<SvxFontItem> aSetDlgFont(std::make_shared<SvxFontItem>(RES_CHRATR_FONT));
1725  {
1726  SvxScriptSetItem aSetItem( SID_ATTR_CHAR_FONT, *aSet.GetPool() );
1727  aSetItem.GetItemSet().Put( aSet, false );
1728  const SfxPoolItem* pI = aSetItem.GetItemOfScript( nScript );
1729  if( pI )
1730  {
1731  aSetDlgFont.reset(static_cast<SvxFontItem*>(pI->Clone()));
1732  }
1733  else
1734  {
1735  aSetDlgFont.reset(static_cast<SvxFontItem*>(aSet.Get( GetWhichOfScript(
1736  SID_ATTR_CHAR_FONT,
1738  }
1739 
1740  if (sFontName.isEmpty())
1741  sFontName = aSetDlgFont->GetFamilyName();
1742  }
1743 
1744  vcl::Font aFont(sFontName, Size(1,1));
1745  if( sSym.isEmpty() )
1746  {
1748 
1749  SfxAllItemSet aAllSet( GetPool() );
1750  aAllSet.Put( SfxBoolItem( FN_PARAM_1, false ) );
1751 
1753  const OUString& sSymbolFont = aOpt.GetSymbolFont();
1754  if( !sSymbolFont.isEmpty() )
1755  aAllSet.Put( SfxStringItem( SID_FONT_NAME, sSymbolFont ) );
1756  else
1757  aAllSet.Put( SfxStringItem( SID_FONT_NAME, aSetDlgFont->GetFamilyName() ) );
1758 
1759  // If character is selected then it can be shown.
1762  pDlg->Execute();
1763  return;
1764  }
1765 
1766  // do not flicker
1767  pOLV->HideCursor();
1768  Outliner * pOutliner = pOLV->GetOutliner();
1769  pOutliner->SetUpdateMode(false);
1770 
1771  SfxItemSet aOldSet( pOLV->GetAttribs() );
1772  SfxItemSet aFontSet(
1773  *aOldSet.GetPool(),
1774  svl::Items<
1775  EE_CHAR_FONTINFO, EE_CHAR_FONTINFO,
1777  aFontSet.Set( aOldSet );
1778 
1779  // Insert string
1780  pOLV->InsertText( sSym);
1781 
1782  // Attributing (set font)
1783  SfxItemSet aSetFont( *aFontSet.GetPool(), aFontSet.GetRanges() );
1784  SvxFontItem aFontItem (aFont.GetFamilyType(), aFont.GetFamilyName(),
1785  aFont.GetStyleName(), aFont.GetPitch(),
1786  aFont.GetCharSet(),
1787  EE_CHAR_FONTINFO );
1788  SvtScriptType nScriptBreak = g_pBreakIt->GetAllScriptsOfText( sSym );
1789  if( SvtScriptType::LATIN & nScriptBreak )
1790  aSetFont.Put( aFontItem );
1791  if( SvtScriptType::ASIAN & nScriptBreak )
1792  {
1793  aFontItem.SetWhich(EE_CHAR_FONTINFO_CJK);
1794  aSetFont.Put( aFontItem );
1795  }
1796  if( SvtScriptType::COMPLEX & nScriptBreak )
1797  {
1798  aFontItem.SetWhich(EE_CHAR_FONTINFO_CTL);
1799  aSetFont.Put( aFontItem );
1800  }
1801  pOLV->SetAttribs(aSetFont);
1802 
1803  // Erase selection
1804  ESelection aSel(pOLV->GetSelection());
1805  aSel.nStartPara = aSel.nEndPara;
1806  aSel.nStartPos = aSel.nEndPos;
1807  pOLV->SetSelection(aSel);
1808 
1809  // Restore old font
1810  pOLV->SetAttribs( aFontSet );
1811 
1812  // From now on show it again
1813  pOutliner->SetUpdateMode(true);
1814  pOLV->ShowCursor();
1815 
1816  rReq.AppendItem( SfxStringItem( GetPool().GetWhich(SID_CHARMAP), sSym ) );
1817  if(!aFont.GetFamilyName().isEmpty())
1818  rReq.AppendItem( SfxStringItem( SID_ATTR_SPECIALCHAR, aFont.GetFamilyName() ) );
1819  rReq.Done();
1820 
1821 }
1822 
1823 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define FN_HIDE_ALL_NOTES
Definition: cmdid.h:728
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:290
#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:1573
bool HasSelection() const
void InvalidateItem(sal_uInt16 nWhich)
SvtScriptType GetAllScriptsOfText(const OUString &rText) const
Definition: breakit.cxx:128
#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:2290
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:1228
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:58
#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:207
void SetTargetFrame(const OUString &rTarget)
SfxUndoManager & GetUndoManager()
void SetPropLineSpace(const sal_uInt16 nProp)
#define FN_FORMAT_ALL_NOTES
Definition: cmdid.h:732
LINESTYLE_NONE
void Exec(SfxRequest &)
Definition: annotsh.cxx:180
SwBreakIt * g_pBreakIt
Definition: breakit.cxx:34
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:730
#define FN_STAT_SELMODE
Definition: cmdid.h:807
SwDoc * GetDoc() const
Definition: viewsh.hxx:284
void NoteExec(SfxRequest const &)
Definition: annotsh.cxx:1103
void ExecUndo(SfxRequest &rReq)
Definition: annotsh.cxx:1486
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:287
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 EE_PARA_LRSPACE
SwAnnotationShell(SwView &)
Definition: annotsh.cxx:157
const SfxPoolItem * GetItem(sal_uInt16 nSlotId) const
#define FN_STAT_TEMPLATE
Definition: cmdid.h:805
#define FN_REPLY
Definition: cmdid.h:731
const SfxItemPool & GetAttrPool() const
Definition: viewsh.hxx:614
#define FN_SET_SUB_SCRIPT
Definition: cmdid.h:291
SvtScriptType
#define FN_NUMBERING_OUTLINE_DLG
Definition: cmdid.h:471
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:1697
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:1418
#define FN_DELETE_NOTE_AUTHOR
Definition: cmdid.h:724
#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:339
#define RES_PARATR_ORPHANS
Definition: hintids.hxx:164
const T * GetArg(sal_uInt16 nSlotId) const
#define FN_HIDE_NOTE_AUTHOR
Definition: cmdid.h:727
#define EE_CHAR_SHADOW
void SetPool(SfxItemPool *pNewPool)
OUString GetSelected() const
void ExecFormatFootnote()
Definition: view0.cxx:607
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:1659
#define FN_WORDCOUNT_DIALOG
Definition: cmdid.h:572
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:1115
const css::uno::Reference< css::frame::XFrame > & GetFrameInterface() const
const OUString & GetSymbolFont() const
Definition: viewopt.hxx:529
#define SFX_OBJECTBAR_OBJECT
#define FN_INSERT_STRING
Definition: cmdid.h:208
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:2285
OString OUStringToOString(const OUString &str, ConnectionSettings const *settings)
void ExecuteFormatAllDialog(SwView &rView)
Definition: PostItMgr.cxx:1586
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:614
#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:76
LanguageType GetAppLanguage()
Definition: init.cxx:771
RET_OK
SwPostItMgr * GetPostItMgr()
Definition: view.hxx:621
ESelection GetSelection()
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:286
void SetInsertMode(SvxLinkInsertMode eNew)
sw::annotation::SwAnnotationWin * GetActiveSidebarWin()
Definition: PostItMgr.hxx:232
bool IsVertical() const
#define FN_FORMAT_FOOTNOTE_DLG
Definition: cmdid.h:307
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:1686
SVX_DLLPUBLIC MSO_SPT Get(const OUString &)
SfxItemSet GetAttribs()
void ExecRotateTransliteration(SfxRequest const &)
Definition: annotsh.cxx:1469
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:1348
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:726
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:206
rtl_TextEncoding GetCharSet() const
Definition: view.hxx:146
void Delete(const OUString &aAuthor)
Definition: PostItMgr.cxx:1504
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:725
static bool const TopLevel
#define EE_ITEMS_END
typedef void(CALLTYPE *GetFuncDataPtr)(sal_uInt16 &nNo