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(pItem->GetValue());
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 {
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 bool bEnabled = SvtCTLOptions::IsCTLFontEnabled();
846 m_rView.GetViewFrame().GetBindings().SetVisibleState( nWhich, bEnabled );
847 if(!bEnabled)
848 rSet.DisableItem(nWhich);
849 }
850 break;
851 default:
852 rSet.InvalidateItem( nWhich );
853 break;
854 }
855
856 if(nEEWhich)
857 {
858 rSet.Put(aEditAttr.Get(nEEWhich).CloneSetWhich(nWhich));
859 if(nEEWhich == EE_CHAR_KERNING)
860 {
861 SfxItemState eState = aEditAttr.GetItemState( EE_CHAR_KERNING );
862 if ( eState == SfxItemState::DONTCARE )
863 {
865 }
866 }
867 }
868
870 rSet.DisableItem( nWhich );
871
872 nWhich = aIter.NextWhich();
873 }
874}
875
877{
878 m_rView.ExecSearch(rReq);
879}
880
882{
884}
885
887{
888 SwPostItMgr* pPostItMgr = m_rView.GetPostItMgr();
889 if ( !pPostItMgr || !pPostItMgr->HasActiveSidebarWin() )
890 return;
891
892 OutlinerView* pOLV = pPostItMgr->GetActiveSidebarWin()->GetOutlinerView();
893
894 tools::Long aOldHeight = pPostItMgr->GetActiveSidebarWin()->GetPostItTextHeight();
895 sal_uInt16 nSlot = rReq.GetSlot();
896 switch (nSlot)
897 {
898 case SID_CUT:
899 if ( (pPostItMgr->GetActiveSidebarWin()->GetLayoutStatus()!=SwPostItHelper::DELETED) && pOLV->HasSelection() )
900 pOLV->Cut();
901 break;
902 case SID_COPY:
903 if( pOLV->HasSelection() )
904 pOLV->Copy();
905 break;
906 case SID_PASTE:
908 pOLV->PasteSpecial();
909 break;
910 case SID_PASTE_UNFORMATTED:
912 pOLV->Paste();
913 break;
914 case SID_PASTE_SPECIAL:
915 {
917 {
919 ScopedVclPtr<SfxAbstractPasteDialog> pDlg(pFact->CreatePasteDialog(m_rView.GetEditWin().GetFrameWeld()));
920
921 pDlg->Insert( SotClipboardFormatId::STRING, OUString() );
922 pDlg->Insert( SotClipboardFormatId::RTF, OUString() );
923 pDlg->Insert( SotClipboardFormatId::RICHTEXT, OUString() );
924
926
927 SotClipboardFormatId nFormat = pDlg->GetFormat( aDataHelper.GetTransferable() );
928
929 if (nFormat != SotClipboardFormatId::NONE)
930 {
931 if (nFormat == SotClipboardFormatId::STRING)
932 pOLV->Paste();
933 else
934 pOLV->PasteSpecial();
935 }
936 }
937 break;
938 }
939 case SID_CLIPBOARD_FORMAT_ITEMS:
940 {
941 SotClipboardFormatId nFormat = SotClipboardFormatId::NONE;
942 const SfxPoolItem* pItem;
943 if (rReq.GetArgs() && rReq.GetArgs()->GetItemState(nSlot, true, &pItem) == SfxItemState::SET)
944 {
945 if (const SfxUInt32Item* pUInt32Item = dynamic_cast<const SfxUInt32Item *>(pItem))
946 nFormat = static_cast<SotClipboardFormatId>(pUInt32Item->GetValue());
947 }
948
949 if ( nFormat != SotClipboardFormatId::NONE )
950 {
951 if (SotClipboardFormatId::STRING == nFormat)
952 pOLV->Paste();
953 else
954 pOLV->PasteSpecial();
955 }
956 break;
957 }
958 }
959 pPostItMgr->GetActiveSidebarWin()->ResizeIfNecessary(aOldHeight,pPostItMgr->GetActiveSidebarWin()->GetPostItTextHeight());
960}
961
963{
964 SwPostItMgr* pPostItMgr = m_rView.GetPostItMgr();
965 if ( !pPostItMgr || !pPostItMgr->HasActiveSidebarWin() )
966 return;
967 OutlinerView* pOLV = pPostItMgr->GetActiveSidebarWin()->GetOutlinerView();
968
970 bool bPastePossible = ( aDataHelper.HasFormat( SotClipboardFormatId::STRING ) || aDataHelper.HasFormat( SotClipboardFormatId::RTF )
971 || aDataHelper.HasFormat( SotClipboardFormatId::RICHTEXT ));
972 bPastePossible = bPastePossible && (pPostItMgr->GetActiveSidebarWin()->GetLayoutStatus()!=SwPostItHelper::DELETED);
973
974 SfxWhichIter aIter(rSet);
975 sal_uInt16 nWhich = aIter.FirstWhich();
976
977 while(nWhich)
978 {
979 switch(nWhich)
980 {
981 case SID_CUT:
982 {
984 rSet.DisableItem( nWhich );
985 [[fallthrough]];
986 }
987 case SID_COPY:
988 {
989 SfxObjectShell* pObjectShell = GetObjectShell();
990 if (!pOLV->HasSelection() || (pObjectShell && pObjectShell->isContentExtractionLocked()) )
991 rSet.DisableItem( nWhich );
992 break;
993 }
994 case SID_PASTE:
995 case SID_PASTE_UNFORMATTED:
996 case SID_PASTE_SPECIAL:
997 {
998 if( !bPastePossible )
999 rSet.DisableItem( nWhich );
1000 break;
1001 }
1002 case SID_CLIPBOARD_FORMAT_ITEMS:
1003 {
1004 if ( bPastePossible )
1005 {
1006 SvxClipboardFormatItem aFormats( SID_CLIPBOARD_FORMAT_ITEMS );
1007 if ( aDataHelper.HasFormat( SotClipboardFormatId::RTF ) )
1008 aFormats.AddClipbrdFormat( SotClipboardFormatId::RTF );
1009 if ( aDataHelper.HasFormat( SotClipboardFormatId::RICHTEXT ) )
1010 aFormats.AddClipbrdFormat( SotClipboardFormatId::RICHTEXT );
1011 aFormats.AddClipbrdFormat( SotClipboardFormatId::STRING );
1012 rSet.Put( aFormats );
1013 }
1014 else
1015 rSet.DisableItem( nWhich );
1016 break;
1017 }
1018 }
1019 nWhich = aIter.NextWhich();
1020 }
1021}
1022
1024{
1025 SfxWhichIter aIter( rSet );
1026 sal_uInt16 nWhich = aIter.FirstWhich();
1027
1028 while( nWhich )
1029 {
1030 switch( nWhich )
1031 {
1032 case FN_STAT_SELMODE:
1033 {
1035 rSet.DisableItem( nWhich );
1036 break;
1037 }
1038 case FN_STAT_TEMPLATE:
1039 {
1040 rSet.DisableItem( nWhich );
1041 break;
1042 }
1043 }
1044 nWhich = aIter.NextWhich();
1045 }
1046}
1047
1049{
1050 SwPostItMgr* pPostItMgr = m_rView.GetPostItMgr();
1051 if ( !pPostItMgr || !pPostItMgr->HasActiveSidebarWin() )
1052 return;
1053
1054 OutlinerView* pOLV = pPostItMgr->GetActiveSidebarWin()->GetOutlinerView();
1055 SfxWhichIter aIter(rSet);
1056 sal_uInt16 nWhich = aIter.FirstWhich();
1057
1058 while(nWhich)
1059 {
1060 switch(nWhich)
1061 {
1062 case SID_HYPERLINK_GETLINK:
1063 {
1064 SvxHyperlinkItem aHLinkItem;
1065 aHLinkItem.SetInsertMode(HLINK_FIELD);
1066
1067 const SvxFieldItem* pFieldItem = pOLV->GetFieldAtSelection();
1068
1069 if (pFieldItem)
1070 {
1071 if (const SvxURLField* pURLField = dynamic_cast<const SvxURLField *>(pFieldItem->GetField()))
1072 {
1073 aHLinkItem.SetName(pURLField->GetRepresentation());
1074 aHLinkItem.SetURL(pURLField->GetURL());
1075 aHLinkItem.SetTargetFrame(pURLField->GetTargetFrame());
1076 }
1077 }
1078 else
1079 {
1080 OUString sSel(pOLV->GetSelected());
1081 sSel = sSel.copy(0, std::min<sal_Int32>(255, sSel.getLength()));
1082 aHLinkItem.SetName(comphelper::string::stripEnd(sSel, ' '));
1083 }
1084
1085 sal_uInt16 nHtmlMode = ::GetHtmlMode(m_rView.GetDocShell());
1086 aHLinkItem.SetInsertMode(static_cast<SvxLinkInsertMode>(aHLinkItem.GetInsertMode() |
1087 ((nHtmlMode & HTMLMODE_ON) != 0 ? HLINK_HTMLMODE : 0)));
1088
1089 rSet.Put(aHLinkItem);
1090 }
1091 break;
1092 }
1093
1095 rSet.DisableItem( nWhich );
1096
1097 nWhich = aIter.NextWhich();
1098 }
1099}
1100
1102{
1103 SwPostItMgr* pPostItMgr = m_rView.GetPostItMgr();
1104 if ( !pPostItMgr )
1105 return;
1106
1107 sal_uInt16 nSlot = rReq.GetSlot();
1108 switch (nSlot)
1109 {
1110 case FN_REPLY:
1111 case FN_POSTIT:
1112 case FN_DELETE_COMMENT:
1114 case FN_RESOLVE_NOTE:
1116 if ( pPostItMgr->HasActiveSidebarWin() )
1117 pPostItMgr->GetActiveSidebarWin()->ExecuteCommand(nSlot);
1118 break;
1120 pPostItMgr->Delete();
1121 break;
1123 pPostItMgr->ExecuteFormatAllDialog(m_rView);
1124 break;
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;
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 = m_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:
1163 case FN_HIDE_NOTE:
1164 case FN_HIDE_ALL_NOTES:
1165 case FN_DELETE_COMMENT:
1167 {
1168 if( !pPostItMgr
1169 || !pPostItMgr->HasActiveAnnotationWin() )
1170 {
1171 rSet.DisableItem(nWhich);
1172 }
1173 break;
1174 }
1175 case FN_RESOLVE_NOTE:
1176 {
1177 if( !pPostItMgr
1178 || !pPostItMgr->HasActiveAnnotationWin() )
1179 {
1180 rSet.DisableItem(nWhich);
1181 }
1182 else
1183 {
1184 SfxBoolItem aBool(nWhich, pPostItMgr->GetActiveSidebarWin()->IsResolved());
1185 rSet.Put( aBool );
1186 }
1187 break;
1188 }
1190 {
1191 if( !pPostItMgr
1192 || !pPostItMgr->HasActiveAnnotationWin() )
1193 {
1194 rSet.DisableItem(nWhich);
1195 }
1196 else
1197 {
1198 SfxBoolItem aBool(nWhich, pPostItMgr->GetActiveSidebarWin()->IsThreadResolved());
1199 rSet.Put( aBool );
1200 }
1201 break;
1202 }
1205 {
1206 if( !pPostItMgr
1207 || !pPostItMgr->HasActiveAnnotationWin() )
1208 {
1209 rSet.DisableItem(nWhich);
1210 }
1211 else
1212 {
1213 OUString aText( nSlotId == FN_DELETE_NOTE_AUTHOR ?
1214 SwResId( STR_DELETE_NOTE_AUTHOR ) : SwResId( STR_HIDE_NOTE_AUTHOR ) );
1215 SwRewriter aRewriter;
1216 aRewriter.AddRule( UndoArg1, pPostItMgr->GetActiveSidebarWin()->GetAuthor() );
1217 aText = aRewriter.Apply( aText );
1218 SfxStringItem aItem( nSlotId, aText );
1219 rSet.Put( aItem );
1220 }
1221 break;
1222 }
1223 case FN_REPLY:
1224 {
1225 if ( !pPostItMgr ||
1226 !pPostItMgr->HasActiveAnnotationWin() )
1227 {
1228 rSet.DisableItem(nWhich);
1229 }
1230 else
1231 {
1232 SvtUserOptions aUserOpt;
1233 OUString sAuthor;
1234 if( (sAuthor = aUserOpt.GetFullName()).isEmpty() &&
1235 (sAuthor = aUserOpt.GetID()).isEmpty() )
1236 sAuthor = SwResId( STR_REDLINE_UNKNOWN_AUTHOR );
1237 if (sAuthor == pPostItMgr->GetActiveSidebarWin()->GetAuthor())
1238 rSet.DisableItem(nWhich);
1239 }
1240 break;
1241 }
1242 default:
1243 rSet.InvalidateItem( nWhich );
1244 break;
1245 }
1246
1247 if (pPostItMgr && pPostItMgr->HasActiveSidebarWin())
1248 {
1249 if ( (pPostItMgr->GetActiveSidebarWin()->IsReadOnlyOrProtected()) &&
1250 ( (nSlotId==FN_DELETE_COMMENT) || (nSlotId==FN_REPLY) ) )
1251 rSet.DisableItem( nWhich );
1252 }
1253 nWhich = aIter.NextWhich();
1254 }
1255}
1256
1258{
1259 SwPostItMgr* pPostItMgr = m_rView.GetPostItMgr();
1260 if ( !pPostItMgr || !pPostItMgr->HasActiveSidebarWin() )
1261 return;
1262
1263 OutlinerView* pOLV = pPostItMgr->GetActiveSidebarWin()->GetOutlinerView();
1264 sal_uInt16 nSlot = rReq.GetSlot();
1266 bool bRestoreSelection = false;
1267 ESelection aOldSelection;
1268
1269 switch (nSlot)
1270 {
1271 case SID_LANGUAGE_STATUS:
1272 {
1273 aOldSelection = pOLV->GetSelection();
1274 if (!pOLV->GetEditView().HasSelection())
1275 {
1277 }
1278
1279 bRestoreSelection = SwLangHelper::SetLanguageStatus(pOLV,rReq,m_rView,rSh);
1280 break;
1281 }
1282 case SID_THES:
1283 {
1284 OUString aReplaceText;
1285 const SfxStringItem* pItem2 = rReq.GetArg(FN_PARAM_THES_WORD_REPLACE);
1286 if (pItem2)
1287 aReplaceText = pItem2->GetValue();
1288 if (!aReplaceText.isEmpty())
1289 ReplaceTextWithSynonym( pOLV->GetEditView(), aReplaceText );
1290 break;
1291 }
1292 case SID_THESAURUS:
1293 {
1294 pOLV->StartThesaurus(rReq.GetFrameWeld());
1295 break;
1296 }
1297 case SID_HANGUL_HANJA_CONVERSION:
1299 i18n::TextConversionOption::CHARACTER_BY_CHARACTER, true, false);
1300 break;
1301
1302 case SID_CHINESE_CONVERSION:
1303 {
1304 //open ChineseTranslationDialog
1305 Reference< XComponentContext > xContext(
1306 ::cppu::defaultBootstrap_InitialComponentContext() ); //@todo get context from calc if that has one
1307 if(xContext.is())
1308 {
1309 Reference< lang::XMultiComponentFactory > xMCF( xContext->getServiceManager() );
1310 if(xMCF.is())
1311 {
1312 Reference< ui::dialogs::XExecutableDialog > xDialog(
1313 xMCF->createInstanceWithContext(
1314 "com.sun.star.linguistic2.ChineseTranslationDialog", xContext),
1315 UNO_QUERY);
1316 Reference< lang::XInitialization > xInit( xDialog, UNO_QUERY );
1317 if( xInit.is() )
1318 {
1319 // initialize dialog
1320 uno::Sequence<uno::Any> aSeq(comphelper::InitAnyPropertySequence(
1321 {
1322 {"ParentWindow", uno::Any(Reference<awt::XWindow>())}
1323 }));
1324 xInit->initialize( aSeq );
1325
1326 //execute dialog
1327 sal_Int16 nDialogRet = xDialog->execute();
1328 if( RET_OK == nDialogRet )
1329 {
1330 //get some parameters from the dialog
1331 bool bToSimplified = true;
1332 bool bUseVariants = true;
1333 bool bCommonTerms = true;
1334 Reference< beans::XPropertySet > xProp( xDialog, UNO_QUERY );
1335 if( xProp.is() )
1336 {
1337 try
1338 {
1339 xProp->getPropertyValue( "IsDirectionToSimplified" ) >>= bToSimplified;
1340 xProp->getPropertyValue( "IsUseCharacterVariants" ) >>= bUseVariants;
1341 xProp->getPropertyValue( "IsTranslateCommonTerms" ) >>= bCommonTerms;
1342 }
1343 catch (const Exception&)
1344 {
1345 }
1346 }
1347
1348 //execute translation
1351 sal_Int32 nOptions = bUseVariants ? i18n::TextConversionOption::USE_CHARACTER_VARIANTS : 0;
1352 if( !bCommonTerms )
1353 nOptions = nOptions | i18n::TextConversionOption::CHARACTER_BY_CHARACTER;
1354
1355 vcl::Font aTargetFont = OutputDevice::GetDefaultFont( DefaultFontType::CJK_TEXT,
1356 nTargetLang, GetDefaultFontFlags::OnlyOne );
1357
1358 pOLV->StartTextConversion(rReq.GetFrameWeld(), nSourceLang, nTargetLang, &aTargetFont, nOptions, false, false);
1359 }
1360 }
1361 Reference< lang::XComponent > xComponent( xDialog, UNO_QUERY );
1362 if( xComponent.is() )
1363 xComponent->dispose();
1364 }
1365 }
1366 }
1367 break;
1368 }
1369
1370 if (bRestoreSelection)
1371 {
1372 // restore selection
1373 pOLV->GetEditView().SetSelection( aOldSelection );
1374 }
1375}
1376
1378{
1379 SwPostItMgr* pPostItMgr = m_rView.GetPostItMgr();
1380 if ( !pPostItMgr || !pPostItMgr->HasActiveSidebarWin() )
1381 return;
1382
1383 OutlinerView* pOLV = pPostItMgr->GetActiveSidebarWin()->GetOutlinerView();
1384
1385 SfxWhichIter aIter(rSet);
1386 sal_uInt16 nWhich = aIter.FirstWhich();
1387 while(nWhich)
1388 {
1389 switch (nWhich)
1390 {
1391 case SID_LANGUAGE_STATUS:
1392 {
1394 break;
1395 }
1396
1397 case SID_THES:
1398 {
1399 OUString aStatusVal;
1401 bool bIsLookUpWord = GetStatusValueForThesaurusFromContext( aStatusVal, nLang, pOLV->GetEditView() );
1402 rSet.Put( SfxStringItem( SID_THES, aStatusVal ) );
1403
1404 // disable "Thesaurus" context menu entry if there is nothing to look up
1405 uno::Reference< linguistic2::XThesaurus > xThes( ::GetThesaurus() );
1406 if (!bIsLookUpWord ||
1407 !xThes.is() || nLang == LANGUAGE_NONE || !xThes->hasLocale( LanguageTag::convertToLocale( nLang ) ))
1408 rSet.DisableItem( SID_THES );
1409 break;
1410 }
1411
1412 // disable "Thesaurus" if the language is not supported
1413 case SID_THESAURUS:
1414 {
1415 const SfxPoolItem &rItem = m_rView.GetWrtShell().GetDoc()->GetDefault(
1418 LanguageType nLang = static_cast<const SvxLanguageItem &>(
1419 rItem).GetLanguage();
1420 uno::Reference< linguistic2::XThesaurus > xThes( ::GetThesaurus() );
1421 if (!xThes.is() || nLang == LANGUAGE_NONE ||
1422 !xThes->hasLocale( LanguageTag::convertToLocale( nLang ) ))
1423 rSet.DisableItem( SID_THESAURUS );
1424 }
1425 break;
1426 case SID_HANGUL_HANJA_CONVERSION:
1427 case SID_CHINESE_CONVERSION:
1428 {
1430 {
1431 m_rView.GetViewFrame().GetBindings().SetVisibleState( nWhich, false );
1432 rSet.DisableItem(nWhich);
1433 }
1434 else
1435 m_rView.GetViewFrame().GetBindings().SetVisibleState( nWhich, true );
1436 }
1437 break;
1438 }
1439
1441 rSet.DisableItem( nWhich );
1442
1443 nWhich = aIter.NextWhich();
1444 }
1445}
1446
1448{
1449 SwPostItMgr* pPostItMgr = m_rView.GetPostItMgr();
1450 if (!pPostItMgr || !pPostItMgr->HasActiveSidebarWin())
1451 return;
1452
1453 OutlinerView* pOLV = pPostItMgr->GetActiveSidebarWin()->GetOutlinerView();
1454
1455 if (!pOLV)
1456 return;
1457
1458 TransliterationFlags nMode = TransliterationFlags::NONE;
1459
1460 switch( rReq.GetSlot() )
1461 {
1462 case SID_TRANSLITERATE_SENTENCE_CASE:
1463 nMode = TransliterationFlags::SENTENCE_CASE;
1464 break;
1465 case SID_TRANSLITERATE_TITLE_CASE:
1466 nMode = TransliterationFlags::TITLE_CASE;
1467 break;
1468 case SID_TRANSLITERATE_TOGGLE_CASE:
1469 nMode = TransliterationFlags::TOGGLE_CASE;
1470 break;
1471 case SID_TRANSLITERATE_UPPER:
1472 nMode = TransliterationFlags::LOWERCASE_UPPERCASE;
1473 break;
1474 case SID_TRANSLITERATE_LOWER:
1475 nMode = TransliterationFlags::UPPERCASE_LOWERCASE;
1476 break;
1477 case SID_TRANSLITERATE_HALFWIDTH:
1478 nMode = TransliterationFlags::FULLWIDTH_HALFWIDTH;
1479 break;
1480 case SID_TRANSLITERATE_FULLWIDTH:
1481 nMode = TransliterationFlags::HALFWIDTH_FULLWIDTH;
1482 break;
1483 case SID_TRANSLITERATE_HIRAGANA:
1484 nMode = TransliterationFlags::KATAKANA_HIRAGANA;
1485 break;
1486 case SID_TRANSLITERATE_KATAKANA:
1487 nMode = TransliterationFlags::HIRAGANA_KATAKANA;
1488 break;
1489
1490 default:
1491 OSL_ENSURE(false, "wrong dispatcher");
1492 }
1493
1494 if( nMode != TransliterationFlags::NONE )
1495 pOLV->TransliterateText( nMode );
1496}
1497
1499{
1500 if( rReq.GetSlot() != SID_TRANSLITERATE_ROTATE_CASE )
1501 return;
1502
1503 SwPostItMgr* pPostItMgr = m_rView.GetPostItMgr();
1504 if (!pPostItMgr || !pPostItMgr->HasActiveSidebarWin())
1505 return;
1506
1507 OutlinerView* pOLV = pPostItMgr->GetActiveSidebarWin()->GetOutlinerView();
1508
1509 if (!pOLV)
1510 return;
1511
1513}
1514
1516{
1517 const SfxItemSet* pArgs = rReq.GetArgs();
1518 SfxUndoManager* pUndoManager = GetUndoManager();
1520 SwUndoId nUndoId(SwUndoId::EMPTY);
1521
1522 // tdf#147928 get these before "undo" which may delete this SwAnnotationShell
1523 SwPostItMgr* pPostItMgr = m_rView.GetPostItMgr();
1525
1526 tools::Long aOldHeight = pPostItMgr->HasActiveSidebarWin()
1527 ? pPostItMgr->GetActiveSidebarWin()->GetPostItTextHeight()
1528 : 0;
1529
1530 sal_uInt16 nId = rReq.GetSlot();
1531 sal_uInt16 nCnt = 1;
1532 const SfxPoolItem* pItem=nullptr;
1533 if( pArgs && SfxItemState::SET == pArgs->GetItemState( nId, false, &pItem ) )
1534 nCnt = static_cast<const SfxUInt16Item*>(pItem)->GetValue();
1535 switch( nId )
1536 {
1537 case SID_UNDO:
1538 {
1539 rSh.GetLastUndoInfo(nullptr, &nUndoId);
1540 if (nUndoId == SwUndoId::CONFLICT)
1541 {
1542 rReq.SetReturnValue( SfxUInt32Item(nId, static_cast<sal_uInt32>(SID_REPAIRPACKAGE)) );
1543 break;
1544 }
1545
1546 if ( pUndoManager )
1547 {
1548 sal_uInt16 nCount = pUndoManager->GetUndoActionCount();
1549 sal_uInt16 nSteps = nCnt;
1550 if ( nCount < nCnt )
1551 {
1552 nCnt = nCnt - nCount;
1553 nSteps = nCount;
1554 }
1555 else
1556 nCnt = 0;
1557
1558 while( nSteps-- )
1559 pUndoManager->Undo();
1560 }
1561
1562 if ( nCnt )
1563 rSh.Do( SwWrtShell::UNDO, nCnt );
1564
1565 break;
1566 }
1567
1568 case SID_REDO:
1569 {
1570 (void)rSh.GetFirstRedoInfo(nullptr, &nUndoId);
1571 if (nUndoId == SwUndoId::CONFLICT)
1572 {
1573 rReq.SetReturnValue( SfxUInt32Item(nId, static_cast<sal_uInt32>(SID_REPAIRPACKAGE)) );
1574 break;
1575 }
1576
1577 if ( pUndoManager )
1578 {
1579 sal_uInt16 nCount = pUndoManager->GetRedoActionCount();
1580 sal_uInt16 nSteps = nCnt;
1581 if ( nCount < nCnt )
1582 {
1583 nCnt = nCnt - nCount;
1584 nSteps = nCount;
1585 }
1586 else
1587 nCnt = 0;
1588
1589 while( nSteps-- )
1590 pUndoManager->Redo();
1591 }
1592
1593 if ( nCnt )
1594 rSh.Do( SwWrtShell::REDO, nCnt );
1595
1596 break;
1597 }
1598 }
1599
1600 rBindings.InvalidateAll(false);
1601
1602 if (pPostItMgr->HasActiveSidebarWin())
1603 pPostItMgr->GetActiveSidebarWin()->ResizeIfNecessary(aOldHeight, pPostItMgr->GetActiveSidebarWin()->GetPostItTextHeight());
1604}
1605
1607{
1608 SwPostItMgr* pPostItMgr = m_rView.GetPostItMgr();
1609 if ( !pPostItMgr || !pPostItMgr->HasActiveSidebarWin() )
1610 return;
1611
1612 SfxWhichIter aIter(rSet);
1613 SwUndoId nUndoId(SwUndoId::EMPTY);
1614 sal_uInt16 nWhich = aIter.FirstWhich();
1615 SfxUndoManager* pUndoManager = GetUndoManager();
1616 SfxViewFrame& rSfxViewFrame = m_rView.GetViewFrame();
1618
1619 while( nWhich )
1620 {
1621 switch ( nWhich )
1622 {
1623 case SID_UNDO:
1624 {
1625 sal_uInt16 nCount = pUndoManager ? pUndoManager->GetUndoActionCount() : 0;
1626 if ( nCount )
1627 rSfxViewFrame.GetSlotState( nWhich, rSfxViewFrame.GetInterface(), &rSet );
1628 else if (rSh.GetLastUndoInfo(nullptr, &nUndoId))
1629 {
1631 }
1632 else if (nUndoId == SwUndoId::CONFLICT)
1633 {
1634 rSet.Put( SfxUInt32Item(nWhich, static_cast<sal_uInt32>(SID_REPAIRPACKAGE)) );
1635 }
1636 else
1637 rSet.DisableItem(nWhich);
1638 break;
1639 }
1640 case SID_REDO:
1641 {
1642 sal_uInt16 nCount = pUndoManager ? pUndoManager->GetRedoActionCount() : 0;
1643 if ( nCount )
1644 rSfxViewFrame.GetSlotState( nWhich, rSfxViewFrame.GetInterface(), &rSet );
1645 else if (rSh.GetFirstRedoInfo(nullptr, &nUndoId))
1646 {
1648 }
1649 else if (nUndoId == SwUndoId::CONFLICT)
1650 {
1651 rSet.Put( SfxUInt32Item(nWhich, static_cast<sal_uInt32>(SID_REPAIRPACKAGE)) );
1652 }
1653 else
1654 rSet.DisableItem(nWhich);
1655 break;
1656 }
1657 case SID_GETUNDOSTRINGS:
1658 case SID_GETREDOSTRINGS:
1659 {
1660 if( pUndoManager )
1661 {
1662 OUString (SfxUndoManager::*fnGetComment)( size_t, bool const ) const;
1663
1664 sal_uInt16 nCount;
1665 if( SID_GETUNDOSTRINGS == nWhich )
1666 {
1667 nCount = pUndoManager->GetUndoActionCount();
1669 }
1670 else
1671 {
1672 nCount = pUndoManager->GetRedoActionCount();
1674 }
1675
1676 OUStringBuffer sList;
1677 if( nCount )
1678 {
1679 for( sal_uInt16 n = 0; n < nCount; ++n )
1680 sList.append( (pUndoManager->*fnGetComment)( n, SfxUndoManager::TopLevel ) + "\n");
1681 }
1682
1683 SfxStringListItem aItem( nWhich );
1684 if ((nWhich == SID_GETUNDOSTRINGS) &&
1685 rSh.GetLastUndoInfo(nullptr, nullptr))
1686 {
1687 rSh.GetDoStrings( SwWrtShell::UNDO, aItem );
1688 }
1689 else if ((nWhich == SID_GETREDOSTRINGS) &&
1690 (rSh.GetFirstRedoInfo(nullptr, nullptr)))
1691 {
1692 rSh.GetDoStrings( SwWrtShell::REDO, aItem );
1693 }
1694
1695 sList.append(aItem.GetString());
1696 aItem.SetString( sList.makeStringAndClear() );
1697 rSet.Put( aItem );
1698 }
1699 else
1700 rSet.DisableItem( nWhich );
1701 }
1702 break;
1703
1704 default:
1705 {
1706 rSfxViewFrame.GetSlotState( nWhich, rSfxViewFrame.GetInterface(), &rSet );
1707 break;
1708 }
1709
1710 }
1711
1713 rSet.DisableItem( nWhich );
1714
1715 nWhich = aIter.NextWhich();
1716 }
1717}
1718
1720{
1721 SfxWhichIter aIter(rSet);
1722 sal_uInt16 nWhich = aIter.FirstWhich();
1723 while (nWhich)
1724 {
1725 rSet.DisableItem( nWhich );
1726 nWhich = aIter.NextWhich();
1727 }
1728}
1729
1731{
1732 SwPostItMgr* pPostItMgr = m_rView.GetPostItMgr();
1733 if ( !pPostItMgr || !pPostItMgr->HasActiveSidebarWin() )
1734 return;
1735
1736 OutlinerView* pOLV = pPostItMgr->GetActiveSidebarWin()->GetOutlinerView();
1737
1738 const SfxItemSet *pArgs = rReq.GetArgs();
1739 const SfxStringItem* pCharMapItem = nullptr;
1740 if( pArgs )
1741 pCharMapItem = pArgs->GetItemIfSet(SID_CHARMAP, false);
1742
1743 OUString sSym;
1744 OUString sFontName;
1745 if ( pCharMapItem )
1746 {
1747 sSym = pCharMapItem->GetValue();
1748 const SfxStringItem* pFontItem = pArgs->GetItemIfSet( SID_ATTR_SPECIALCHAR, false);
1749 if (pFontItem)
1750 sFontName = pFontItem->GetValue();
1751 }
1752
1753 SfxItemSet aSet(pOLV->GetAttribs());
1754 SvtScriptType nScript = pOLV->GetSelectedScriptType();
1755 std::shared_ptr<SvxFontItem> aSetDlgFont(std::make_shared<SvxFontItem>(RES_CHRATR_FONT));
1756 {
1757 SvxScriptSetItem aSetItem( SID_ATTR_CHAR_FONT, *aSet.GetPool() );
1758 aSetItem.GetItemSet().Put( aSet, false );
1759 const SfxPoolItem* pI = aSetItem.GetItemOfScript( nScript );
1760 if( pI )
1761 {
1762 aSetDlgFont.reset(static_cast<SvxFontItem*>(pI->Clone()));
1763 }
1764 else
1765 {
1766 TypedWhichId<SvxFontItem> nFontWhich =
1768 SID_ATTR_CHAR_FONT,
1770 aSetDlgFont.reset(aSet.Get(nFontWhich).Clone());
1771 }
1772
1773 if (sFontName.isEmpty())
1774 sFontName = aSetDlgFont->GetFamilyName();
1775 }
1776
1777 vcl::Font aFont(sFontName, Size(1,1));
1778 if( sSym.isEmpty() )
1779 {
1781
1782 SfxAllItemSet aAllSet( GetPool() );
1783 aAllSet.Put( SfxBoolItem( FN_PARAM_1, false ) );
1784
1786 const OUString& sSymbolFont = aOpt.GetSymbolFont();
1787 if( !sSymbolFont.isEmpty() )
1788 aAllSet.Put( SfxStringItem( SID_FONT_NAME, sSymbolFont ) );
1789 else
1790 aAllSet.Put( SfxStringItem( SID_FONT_NAME, aSetDlgFont->GetFamilyName() ) );
1791
1792 // If character is selected then it can be shown.
1795 pDlg->Execute();
1796 return;
1797 }
1798
1799 // do not flicker
1800 pOLV->HideCursor();
1801 Outliner * pOutliner = pOLV->GetOutliner();
1802 pOutliner->SetUpdateLayout(false);
1803
1804 SfxItemSet aOldSet( pOLV->GetAttribs() );
1808 aFontSet( *aOldSet.GetPool() );
1809 aFontSet.Set( aOldSet );
1810
1811 // Insert string
1812 pOLV->InsertText( sSym);
1813
1814 // Attributing (set font)
1815 SfxItemSet aSetFont( *aFontSet.GetPool(), aFontSet.GetRanges() );
1816 SvxFontItem aFontItem (aFont.GetFamilyType(), aFont.GetFamilyName(),
1817 aFont.GetStyleName(), aFont.GetPitch(),
1818 aFont.GetCharSet(),
1820 SvtScriptType nScriptBreak = g_pBreakIt->GetAllScriptsOfText( sSym );
1821 if( SvtScriptType::LATIN & nScriptBreak )
1822 aSetFont.Put( aFontItem );
1823 if( SvtScriptType::ASIAN & nScriptBreak )
1824 {
1825 aFontItem.SetWhich(EE_CHAR_FONTINFO_CJK);
1826 aSetFont.Put( aFontItem );
1827 }
1828 if( SvtScriptType::COMPLEX & nScriptBreak )
1829 {
1830 aFontItem.SetWhich(EE_CHAR_FONTINFO_CTL);
1831 aSetFont.Put( aFontItem );
1832 }
1833 pOLV->SetAttribs(aSetFont);
1834
1835 // Erase selection
1836 ESelection aSel(pOLV->GetSelection());
1837 aSel.nStartPara = aSel.nEndPara;
1838 aSel.nStartPos = aSel.nEndPos;
1839 pOLV->SetSelection(aSel);
1840
1841 // Restore old font
1842 pOLV->SetAttribs( aFontSet );
1843
1844 // From now on show it again
1845 pOutliner->SetUpdateLayout(true);
1846 pOLV->ShowCursor();
1847
1848 rReq.AppendItem( SfxStringItem( SID_CHARMAP, sSym ) );
1849 if(!aFont.GetFamilyName().isEmpty())
1850 rReq.AppendItem( SfxStringItem( SID_ATTR_SPECIALCHAR, aFont.GetFamilyName() ) );
1851 rReq.Done();
1852
1853}
1854
1855/* 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()
static bool IsCTLFontEnabled()
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 > CreateSwParaDlg(weld::Window *pParent, SwView &rVw, const SfxItemSet &rCoreSet, bool bDraw, const OUString &sDefPage={})=0
virtual VclPtr< SfxAbstractTabDialog > CreateSwCharDlg(weld::Window *pParent, SwView &pVw, const SfxItemSet &rCoreSet, SwCharDlgMode nDialogMode, const OUString *pFormatStr=nullptr)=0
static SwAbstractDialogFactory * Create()
Definition: swabstdlg.cxx:36
static SfxItemPool * GetAnnotationPool(SwView const &rV)
Definition: annotsh.cxx:123
void GetLinguState(SfxItemSet &)
Definition: annotsh.cxx:1377
void GetNoteState(SfxItemSet &)
Definition: annotsh.cxx:1150
SwView & m_rView
Definition: annotsh.hxx:30
void ExecTransliteration(SfxRequest const &)
Definition: annotsh.cxx:1447
void ExecUndo(SfxRequest &rReq)
Definition: annotsh.cxx:1515
void ExecClpbrd(SfxRequest const &rReq)
Definition: annotsh.cxx:886
void ExecLingu(SfxRequest &rReq)
Definition: annotsh.cxx:1257
void ExecRotateTransliteration(SfxRequest const &)
Definition: annotsh.cxx:1498
void InsertSymbol(SfxRequest &rReq)
Definition: annotsh.cxx:1730
RotateTransliteration m_aRotateCase
Definition: annotsh.hxx:31
virtual ~SwAnnotationShell() override
Definition: annotsh.cxx:136
void StateClpbrd(SfxItemSet &rSet)
Definition: annotsh.cxx:962
void StateInsert(SfxItemSet &rSet)
Definition: annotsh.cxx:1048
virtual SfxUndoManager * GetUndoManager() override
Definition: annotsh.cxx:142
static void StateDisableItems(SfxItemSet &)
Definition: annotsh.cxx:1719
void ExecSearch(SfxRequest &)
Definition: annotsh.cxx:876
void StateUndo(SfxItemSet &rSet)
Definition: annotsh.cxx:1606
void StateSearch(SfxItemSet &)
Definition: annotsh.cxx:881
void GetState(SfxItemSet &)
Definition: annotsh.cxx:608
SwAnnotationShell(SwView &)
Definition: annotsh.cxx:129
void NoteExec(SfxRequest const &)
Definition: annotsh.cxx:1101
static void StateStatusLine(SfxItemSet &rSet)
Definition: annotsh.cxx:1023
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:672
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:1510
void Hide(std::u16string_view rAuthor)
Definition: PostItMgr.cxx:1740
void ExecuteFormatAllDialog(SwView &rView)
Definition: PostItMgr.cxx:1667
bool HasActiveAnnotationWin() const
Definition: PostItMgr.cxx:2377
sw::annotation::SwAnnotationWin * GetActiveSidebarWin()
Definition: PostItMgr.hxx:237
SW_DLLPUBLIC bool HasActiveSidebarWin() const
Definition: PostItMgr.cxx:2372
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:739
const SwViewOption * GetViewOptions() const
Definition: viewsh.hxx:452
SwDoc * GetDoc() const
Definition: viewsh.hxx:308
const SfxItemPool & GetAttrPool() const
Definition: viewsh.hxx:648
Definition: view.hxx:146
SwWrtShell & GetWrtShell() const
Definition: view.hxx:423
SwPostItMgr * GetPostItMgr()
Definition: view.hxx:650
void ExecNumberingOutline(SfxItemPool &)
Definition: view0.cxx:734
virtual void ShowCursor(bool bOn=true) override
Definition: view.cxx:1639
SwEditWin & GetEditWin()
Definition: view.hxx:426
SwDocShell * GetDocShell()
Definition: view.cxx:1193
void UpdateWordCount(SfxShell *, sal_uInt16)
Definition: view1.cxx:202
void StateSearch(SfxItemSet &)
Definition: viewsrch.cxx:846
void ExecFormatFootnote()
Definition: view0.cxx:727
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:2058
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:795
#define FN_REPLY
Definition: cmdid.h:793
#define FN_DELETE_NOTE_AUTHOR
Definition: cmdid.h:786
#define FN_SET_SUPER_SCRIPT
Definition: cmdid.h:341
#define FN_HIDE_NOTE_AUTHOR
Definition: cmdid.h:789
#define FN_STAT_TEMPLATE
Definition: cmdid.h:865
#define FN_GROW_FONT_SIZE
Definition: cmdid.h:338
#define FN_POSTIT
Definition: cmdid.h:233
#define FN_SHRINK_FONT_SIZE
Definition: cmdid.h:339
#define FN_FORMAT_FOOTNOTE_DLG
Definition: cmdid.h:358
#define FN_STAT_SELMODE
Definition: cmdid.h:867
#define FN_HIDE_ALL_NOTES
Definition: cmdid.h:790
#define FN_DELETE_ALL_NOTES
Definition: cmdid.h:787
#define FN_INSERT_STRING
Definition: cmdid.h:235
#define FN_HIDE_NOTE
Definition: cmdid.h:788
#define FN_NUMBERING_OUTLINE_DLG
Definition: cmdid.h:522
#define FN_DELETE_COMMENT
Definition: cmdid.h:792
#define FN_WORDCOUNT_DIALOG
Definition: cmdid.h:627
#define FN_SET_SUB_SCRIPT
Definition: cmdid.h:342
#define FN_DELETE_COMMENT_THREAD
Definition: cmdid.h:797
#define FN_RESOLVE_NOTE_THREAD
Definition: cmdid.h:796
#define FN_FORMAT_ALL_NOTES
Definition: cmdid.h:794
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:741
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:365
@ 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)
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