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