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 SvxFontListItem* pFontListItem = static_cast< const SvxFontListItem* >
228 ( SfxObjectShell::Current()->GetItem( SID_ATTR_CHAR_FONTLIST ) );
229 const FontList* pFontList = pFontListItem ? pFontListItem->GetFontList() : nullptr;
230 pOLV->GetEditView().ChangeFontSize( nSlot == FN_GROW_FONT_SIZE, pFontList );
231 }
232 break;
233
234 case SID_ATTR_CHAR_FONT:
235 case SID_ATTR_CHAR_FONTHEIGHT:
236 case SID_ATTR_CHAR_WEIGHT:
237 case SID_ATTR_CHAR_POSTURE:
238 {
239 SfxItemPool* pSecondPool = aEditAttr.GetPool()->GetSecondaryPool();
240 if( !pSecondPool )
241 pSecondPool = aEditAttr.GetPool();
242 SvxScriptSetItem aSetItem( nSlot, *pSecondPool );
243 aSetItem.PutItemForScriptType( pOLV->GetSelectedScriptType(), pNewAttrs->Get( nWhich ));
244 aNewAttr.Put( aSetItem.GetItemSet() );
245 rReq.Done();
246 break;
247 }
248 case SID_ATTR_CHAR_COLOR: nEEWhich = EE_CHAR_COLOR; break;
249 case SID_ATTR_CHAR_BACK_COLOR: nEEWhich = EE_CHAR_BKGCOLOR; break;
250 case SID_ATTR_CHAR_UNDERLINE:
251 {
252 if( rReq.GetArgs() )
253 {
254 const SvxUnderlineItem* pItem = rReq.GetArg<SvxUnderlineItem>(SID_ATTR_CHAR_UNDERLINE);
255 if (pItem)
256 {
257 aNewAttr.Put(*pItem);
258 }
259 else
260 {
261 FontLineStyle eFU = aEditAttr.Get( EE_CHAR_UNDERLINE ).GetLineStyle();
263 }
264 }
265 break;
266 }
267 case SID_ATTR_CHAR_OVERLINE:
268 {
269 FontLineStyle eFO = aEditAttr.Get(EE_CHAR_OVERLINE).GetLineStyle();
271 break;
272 }
273 case SID_ATTR_CHAR_CONTOUR: nEEWhich = EE_CHAR_OUTLINE; break;
274 case SID_ATTR_CHAR_SHADOWED: nEEWhich = EE_CHAR_SHADOW; break;
275 case SID_ATTR_CHAR_STRIKEOUT: nEEWhich = EE_CHAR_STRIKEOUT; break;
276 case SID_ATTR_CHAR_WORDLINEMODE: nEEWhich = EE_CHAR_WLM; break;
277 case SID_ATTR_CHAR_RELIEF : nEEWhich = EE_CHAR_RELIEF; break;
278 case SID_ATTR_CHAR_LANGUAGE : nEEWhich = EE_CHAR_LANGUAGE;break;
279 case SID_ATTR_CHAR_KERNING : nEEWhich = EE_CHAR_KERNING; break;
280 case SID_ATTR_CHAR_SCALEWIDTH: nEEWhich = EE_CHAR_FONTWIDTH; break;
281 case SID_ATTR_CHAR_AUTOKERN : nEEWhich = EE_CHAR_PAIRKERNING; break;
282 case SID_ATTR_CHAR_ESCAPEMENT: nEEWhich = EE_CHAR_ESCAPEMENT; break;
283 case SID_ATTR_PARA_ADJUST_LEFT:
284 aNewAttr.Put(SvxAdjustItem(SvxAdjust::Left, EE_PARA_JUST));
285 break;
286 case SID_ATTR_PARA_ADJUST_CENTER:
287 aNewAttr.Put(SvxAdjustItem(SvxAdjust::Center, EE_PARA_JUST));
288 break;
289 case SID_ATTR_PARA_ADJUST_RIGHT:
290 aNewAttr.Put(SvxAdjustItem(SvxAdjust::Right, EE_PARA_JUST));
291 break;
292 case SID_ATTR_PARA_ADJUST_BLOCK:
293 aNewAttr.Put(SvxAdjustItem(SvxAdjust::Block, EE_PARA_JUST));
294 break;
295
296 case SID_ATTR_PARA_LINESPACE_10:
297 {
299 aItem.SetPropLineSpace(100);
300 aNewAttr.Put(aItem);
301 }
302 break;
303 case SID_ATTR_PARA_LINESPACE_115:
304 {
306 aItem.SetPropLineSpace(115);
307 aNewAttr.Put(aItem);
308 }
309 break;
310 case SID_ATTR_PARA_LINESPACE_15:
311 {
313 aItem.SetPropLineSpace(150);
314 aNewAttr.Put(aItem);
315 }
316 break;
317 case SID_ATTR_PARA_LINESPACE_20:
318 {
320 aItem.SetPropLineSpace(200);
321 aNewAttr.Put(aItem);
322 }
323 break;
324 case SID_SELECTALL:
325 {
326 Outliner * pOutliner = pOLV->GetOutliner();
327 if(pOutliner)
328 {
329 sal_Int32 nParaCount = pOutliner->GetParagraphCount();
330 if (nParaCount > 0)
331 pOLV->SelectRange(0, nParaCount );
332 }
333 break;
334 }
335 case FN_FORMAT_RESET:
336 {
337 pPostItMgr->GetActiveSidebarWin()->ResetAttributes();
338 rReq.Done();
339 break;
340 }
342 {
344 SvxEscapement eEsc = static_cast<SvxEscapement>(aEditAttr.Get( EE_CHAR_ESCAPEMENT ).GetEnumValue());
345
346 if( eEsc == SvxEscapement::Superscript )
347 aItem.SetEscapement( SvxEscapement::Off );
348 else
349 aItem.SetEscapement( SvxEscapement::Superscript );
350 aNewAttr.Put( aItem );
351 }
352 break;
354 {
356 SvxEscapement eEsc = static_cast<SvxEscapement>(aEditAttr.Get( EE_CHAR_ESCAPEMENT ).GetEnumValue());
357
358 if( eEsc == SvxEscapement::Subscript )
359 aItem.SetEscapement( SvxEscapement::Off );
360 else
361 aItem.SetEscapement( SvxEscapement::Subscript );
362 aNewAttr.Put( aItem );
363 }
364 break;
365 case SID_HYPERLINK_SETLINK:
366 {
367 const SfxPoolItem* pItem = nullptr;
368 if(pNewAttrs)
369 pNewAttrs->GetItemState(nSlot, false, &pItem);
370
371 if(pItem)
372 {
373 const SvxHyperlinkItem& rHLinkItem = *static_cast<const SvxHyperlinkItem *>(pItem);
374 SvxURLField aField(rHLinkItem.GetURL(), rHLinkItem.GetName(), SvxURLFormat::AppDefault);
375 aField.SetTargetFrame(rHLinkItem.GetTargetFrame());
376
377 const SvxFieldItem* pFieldItem = pOLV->GetFieldAtSelection();
378
379 if (pFieldItem && dynamic_cast<const SvxURLField *>(pFieldItem->GetField()) != nullptr)
380 {
381 // Select the field so that it will be deleted during insert
382 ESelection aSel = pOLV->GetSelection();
383 aSel.nEndPos++;
384 pOLV->SetSelection(aSel);
385 }
388 }
389 break;
390 }
391 case FN_INSERT_SOFT_HYPHEN:
392 case FN_INSERT_HARDHYPHEN:
393 case FN_INSERT_HARD_SPACE:
394 case FN_INSERT_NNBSP:
395 case SID_INSERT_RLM :
396 case SID_INSERT_LRM :
397 case SID_INSERT_WJ :
398 case SID_INSERT_ZWSP:
399 {
400 sal_Unicode cIns = 0;
401 switch(rReq.GetSlot())
402 {
403 case FN_INSERT_SOFT_HYPHEN: cIns = CHAR_SOFTHYPHEN; break;
404 case FN_INSERT_HARDHYPHEN: cIns = CHAR_HARDHYPHEN; break;
405 case FN_INSERT_HARD_SPACE: cIns = CHAR_HARDBLANK; break;
406 case FN_INSERT_NNBSP: cIns = CHAR_NNBSP; break;
407 case SID_INSERT_RLM : cIns = CHAR_RLM ; break;
408 case SID_INSERT_LRM : cIns = CHAR_LRM ; break;
409 case SID_INSERT_ZWSP : cIns = CHAR_ZWSP ; break;
410 case SID_INSERT_WJ: cIns = CHAR_WJ; break;
411 }
412 pOLV->InsertText( OUString(cIns));
413 rReq.Done();
414 break;
415 }
416 case SID_CHARMAP:
417 {
419 InsertSymbol(rReq);
420 break;
421 }
422 case FN_INSERT_STRING:
423 {
424 const SfxPoolItem* pItem = nullptr;
425 if (pNewAttrs)
426 pNewAttrs->GetItemState(nSlot, false, &pItem );
427 if (pItem && pPostItMgr->GetActiveSidebarWin()->GetLayoutStatus()!=SwPostItHelper::DELETED)
428 pOLV->InsertText(static_cast<const SfxStringItem *>(pItem)->GetValue());
429 break;
430 }
432 {
434 break;
435 }
437 {
439 rReq.Done();
440 }
441 break;
442 case SID_OPEN_XML_FILTERSETTINGS:
443 {
445 }
446 break;
448 {
449 m_rView.UpdateWordCount(this, nSlot);
450 break;
451 }
452 case SID_CHAR_DLG_EFFECT:
453 case SID_CHAR_DLG_POSITION:
454 case SID_CHAR_DLG:
455 {
456 const SfxItemSet* pArgs = rReq.GetArgs();
457 const SfxStringItem* pItem = rReq.GetArg<SfxStringItem>(FN_PARAM_1);
458
459 if( !pArgs || pItem )
460 {
461 /* mod
462 SwView* pView = &GetView();
463 FieldUnit eMetric = ::GetDfltMetric(dynamic_cast<SwWebView*>( pView) != nullptr );
464 SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, eMetric));
465 */
467
468 // util::Language does not exist in the EditEngine! Therefore not included in the set.
469
470 aDlgAttr.Put( aEditAttr );
471 aDlgAttr.Put( SvxKerningItem(0, RES_CHRATR_KERNING) );
472
475 if (nSlot == SID_CHAR_DLG_EFFECT)
476 {
477 pDlg->SetCurPageId("fonteffects");
478 }
479 if (nSlot == SID_CHAR_DLG_POSITION)
480 {
481 pDlg->SetCurPageId("position");
482 }
483 else if (pItem)
484 {
485 pDlg->SetCurPageId(OUStringToOString(pItem->GetValue(), RTL_TEXTENCODING_UTF8));
486 }
487
488 sal_uInt16 nRet = pDlg->Execute();
489 if(RET_OK == nRet )
490 {
491 rReq.Done( *( pDlg->GetOutputItemSet() ) );
492 aNewAttr.Put(*pDlg->GetOutputItemSet());
493 }
494 if(RET_OK != nRet)
495 return ;
496 }
497 else
498 aNewAttr.Put(*pArgs);
499 break;
500 }
501 case SID_PARA_DLG:
502 {
503 const SfxItemSet* pArgs = rReq.GetArgs();
504
505 if (!pArgs)
506 {
507 /* mod todo ???
508 SwView* pView = &GetView();
509 FieldUnit eMetric = ::GetDfltMetric(dynamic_cast<SwWebView*>( pView) != nullptr );
510 SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, eMetric));
511 */
514 SID_ATTR_PARA_HYPHENZONE, SID_ATTR_PARA_WIDOWS>
515 aDlgAttr( GetPool() );
516
517 aDlgAttr.Put(aEditAttr);
518
519 aDlgAttr.Put( SvxHyphenZoneItem( false, RES_PARATR_HYPHENZONE) );
520 aDlgAttr.Put( SvxFormatBreakItem( SvxBreak::NONE, RES_BREAK ) );
521 aDlgAttr.Put( SvxFormatSplitItem( true, RES_PARATR_SPLIT ) );
522 aDlgAttr.Put( SvxWidowsItem( 0, RES_PARATR_WIDOWS ) );
523 aDlgAttr.Put( SvxOrphansItem( 0, RES_PARATR_ORPHANS ) );
524
527 sal_uInt16 nRet = pDlg->Execute();
528 if(RET_OK == nRet)
529 {
530 rReq.Done( *( pDlg->GetOutputItemSet() ) );
531 aNewAttr.Put(*pDlg->GetOutputItemSet());
532 }
533 if(RET_OK != nRet)
534 return;
535 }
536 else
537 aNewAttr.Put(*pArgs);
538 break;
539 }
540
541 case SID_AUTOSPELL_CHECK:
542 {
543 m_rView.ExecuteSlot(rReq);
544 break;
545 }
546 case SID_ATTR_PARA_LEFT_TO_RIGHT:
547 case SID_ATTR_PARA_RIGHT_TO_LEFT:
548 {
549 bool bLeftToRight = nSlot == SID_ATTR_PARA_LEFT_TO_RIGHT;
550
551 const SfxPoolItem* pPoolItem;
552 if( pNewAttrs && SfxItemState::SET == pNewAttrs->GetItemState( nSlot, true, &pPoolItem ) )
553 {
554 if( !static_cast<const SfxBoolItem*>(pPoolItem)->GetValue() )
555 bLeftToRight = !bLeftToRight;
556 }
560 aAttr( *aNewAttr.GetPool() );
561
562 SvxAdjust nAdjust = SvxAdjust::Left;
563 if( const SvxAdjustItem* pAdjustItem = aEditAttr.GetItemIfSet(EE_PARA_JUST ) )
564 nAdjust = pAdjustItem->GetAdjust();
565
566 if( bLeftToRight )
567 {
568 aAttr.Put( SvxFrameDirectionItem( SvxFrameDirection::Horizontal_LR_TB, EE_PARA_WRITINGDIR ) );
569 if( nAdjust == SvxAdjust::Right )
570 aAttr.Put( SvxAdjustItem( SvxAdjust::Left, EE_PARA_JUST ) );
571 }
572 else
573 {
574 aAttr.Put( SvxFrameDirectionItem( SvxFrameDirection::Horizontal_RL_TB, EE_PARA_WRITINGDIR ) );
575 if( nAdjust == SvxAdjust::Left )
576 aAttr.Put( SvxAdjustItem( SvxAdjust::Right, EE_PARA_JUST ) );
577 }
578 pOLV->SetAttribs(aAttr);
579 break;
580 }
581 }
582
583 if(nEEWhich && pNewAttrs)
584 {
585 aNewAttr.Put(pNewAttrs->Get(nWhich).CloneSetWhich(nEEWhich));
586 }
587 else if (nEEWhich == EE_CHAR_COLOR)
588 {
589 m_rView.GetViewFrame()->GetDispatcher()->Execute(SID_CHAR_DLG_EFFECT);
590 }
591 else if (nEEWhich == EE_CHAR_KERNING)
592 {
593 m_rView.GetViewFrame()->GetDispatcher()->Execute(SID_CHAR_DLG_POSITION);
594 }
595
596
597 tools::Rectangle aOutRect = pOLV->GetOutputArea();
598 if (tools::Rectangle() != aOutRect && aNewAttr.Count())
599 pOLV->SetAttribs(aNewAttr);
600
602 if ( pOLV->GetOutliner()->IsModified() )
604
605}
606
608{
609 //TODO: clean this up!!!
610 // FN_SET_SUPER_SCRIPT
611 //SID_ATTR_PARA_ADJUST
612 //SID_ATTR_PARA_ADJUST_BLOCK
613
614 SwPostItMgr* pPostItMgr = m_rView.GetPostItMgr();
615 if ( !pPostItMgr || !pPostItMgr->HasActiveSidebarWin() )
616 return;
617
618 OutlinerView* pOLV = pPostItMgr->GetActiveSidebarWin()->GetOutlinerView();
619 SfxItemSet aEditAttr(pOLV->GetAttribs());
620
621 SfxWhichIter aIter(rSet);
622 sal_uInt16 nWhich = aIter.FirstWhich();
623 while(nWhich)
624 {
625 sal_uInt16 nEEWhich = 0;
626 sal_uInt16 nSlotId = GetPool().GetSlotId( nWhich );
627 switch( nSlotId )
628 {
629 case SID_ATTR_PARA_LRSPACE:
630 case SID_ATTR_PARA_LEFTSPACE:
631 case SID_ATTR_PARA_RIGHTSPACE:
632 case SID_ATTR_PARA_FIRSTLINESPACE:
633 {
634 SfxItemState eState = aEditAttr.GetItemState( EE_PARA_LRSPACE );
635 if( eState >= SfxItemState::DEFAULT )
636 {
637 SvxLRSpaceItem aLR = aEditAttr.Get( EE_PARA_LRSPACE );
638 aLR.SetWhich(nSlotId);
639 rSet.Put(aLR);
640 }
641 else
642 rSet.InvalidateItem(nSlotId);
643 }
644 break;
645 case SID_ATTR_PARA_LINESPACE:
646 {
647 SfxItemState eState = aEditAttr.GetItemState( EE_PARA_SBL );
648 if( eState >= SfxItemState::DEFAULT )
649 {
650 const SvxLineSpacingItem& aLR = aEditAttr.Get( EE_PARA_SBL );
651 rSet.Put(aLR);
652 }
653 else
654 rSet.InvalidateItem(nSlotId);
655 }
656 break;
657 case SID_ATTR_PARA_ULSPACE:
658 case SID_ATTR_PARA_ABOVESPACE:
659 case SID_ATTR_PARA_BELOWSPACE:
660 case SID_PARASPACE_INCREASE:
661 case SID_PARASPACE_DECREASE:
662 {
663 SfxItemState eState = aEditAttr.GetItemState( EE_PARA_ULSPACE );
664 if( eState >= SfxItemState::DEFAULT )
665 {
666 SvxULSpaceItem aULSpace = aEditAttr.Get( EE_PARA_ULSPACE );
667 if ( !aULSpace.GetUpper() && !aULSpace.GetLower() )
668 rSet.DisableItem( SID_PARASPACE_DECREASE );
669 else if ( aULSpace.GetUpper() >= 5670 && aULSpace.GetLower() >= 5670 )
670 rSet.DisableItem( SID_PARASPACE_INCREASE );
671 if ( nSlotId == SID_ATTR_PARA_ULSPACE
672 || nSlotId == SID_ATTR_PARA_BELOWSPACE
673 || nSlotId == SID_ATTR_PARA_ABOVESPACE
674 )
675 {
676 aULSpace.SetWhich(nSlotId);
677 rSet.Put(aULSpace);
678 }
679 }
680 else
681 {
682 rSet.DisableItem( SID_PARASPACE_INCREASE );
683 rSet.DisableItem( SID_PARASPACE_DECREASE );
684 rSet.InvalidateItem( SID_ATTR_PARA_ULSPACE );
685 rSet.InvalidateItem( SID_ATTR_PARA_ABOVESPACE );
686 rSet.InvalidateItem( SID_ATTR_PARA_BELOWSPACE );
687 }
688 }
689 break;
690 case SID_ATTR_CHAR_FONT:
691 case SID_ATTR_CHAR_FONTHEIGHT:
692 case SID_ATTR_CHAR_WEIGHT:
693 case SID_ATTR_CHAR_POSTURE:
694 {
695 SvtScriptType nScriptType = pOLV->GetSelectedScriptType();
696 SfxItemPool* pSecondPool = aEditAttr.GetPool()->GetSecondaryPool();
697 if( !pSecondPool )
698 pSecondPool = aEditAttr.GetPool();
699 SvxScriptSetItem aSetItem( nSlotId, *pSecondPool );
700 aSetItem.GetItemSet().Put( aEditAttr, false );
701 const SfxPoolItem* pI = aSetItem.GetItemOfScript( nScriptType );
702 if( pI )
703 {
704 rSet.Put(pI->CloneSetWhich(nWhich));
705 }
706 else
707 rSet.InvalidateItem( nWhich );
708 }
709 break;
710 case SID_ATTR_CHAR_COLOR: nEEWhich = EE_CHAR_COLOR; break;
711 case SID_ATTR_CHAR_BACK_COLOR: nEEWhich = EE_CHAR_BKGCOLOR; break;
712 case SID_ATTR_CHAR_UNDERLINE: nEEWhich = EE_CHAR_UNDERLINE;break;
713 case SID_ATTR_CHAR_OVERLINE: nEEWhich = EE_CHAR_OVERLINE;break;
714 case SID_ATTR_CHAR_CONTOUR: nEEWhich = EE_CHAR_OUTLINE; break;
715 case SID_ATTR_CHAR_SHADOWED: nEEWhich = EE_CHAR_SHADOW;break;
716 case SID_ATTR_CHAR_STRIKEOUT: nEEWhich = EE_CHAR_STRIKEOUT;break;
717 case SID_ATTR_CHAR_LANGUAGE : nEEWhich = EE_CHAR_LANGUAGE;break;
718 case SID_ATTR_CHAR_ESCAPEMENT: nEEWhich = EE_CHAR_ESCAPEMENT;break;
719 case SID_ATTR_CHAR_KERNING: nEEWhich = EE_CHAR_KERNING;break;
722 {
723 SvxEscapement nEsc;
724 if (nWhich==FN_SET_SUPER_SCRIPT)
725 nEsc = SvxEscapement::Superscript;
726 else
727 nEsc = SvxEscapement::Subscript;
728
729 const SfxPoolItem *pEscItem = &aEditAttr.Get( EE_CHAR_ESCAPEMENT );
730 if( nEsc == static_cast<const SvxEscapementItem*>(pEscItem)->GetEscapement() )
731 rSet.Put( SfxBoolItem( nWhich, true ));
732 else
733 rSet.InvalidateItem( nWhich );
734 break;
735 }
736 case SID_ATTR_PARA_ADJUST_LEFT:
737 case SID_ATTR_PARA_ADJUST_RIGHT:
738 case SID_ATTR_PARA_ADJUST_CENTER:
739 case SID_ATTR_PARA_ADJUST_BLOCK:
740 {
741 SvxAdjust eAdjust = SvxAdjust::Left;
742 if (nWhich==SID_ATTR_PARA_ADJUST_LEFT)
743 eAdjust = SvxAdjust::Left;
744 else if (nWhich==SID_ATTR_PARA_ADJUST_RIGHT)
745 eAdjust = SvxAdjust::Right;
746 else if (nWhich==SID_ATTR_PARA_ADJUST_CENTER)
747 eAdjust = SvxAdjust::Center;
748 else if (nWhich==SID_ATTR_PARA_ADJUST_BLOCK)
749 eAdjust = SvxAdjust::Block;
750
751 const SvxAdjustItem *pAdjust = aEditAttr.GetItemIfSet( EE_PARA_JUST, false );
752
753 if( !pAdjust || IsInvalidItem( pAdjust ))
754 {
755 rSet.InvalidateItem( nSlotId );
756 }
757 else
758 {
759 if ( eAdjust == pAdjust->GetAdjust())
760 rSet.Put( SfxBoolItem( nWhich, true ));
761 else
762 rSet.InvalidateItem( nWhich );
763 }
764 break;
765 }
766 case SID_ATTR_PARA_LINESPACE_10:
767 case SID_ATTR_PARA_LINESPACE_115:
768 case SID_ATTR_PARA_LINESPACE_15:
769 case SID_ATTR_PARA_LINESPACE_20:
770 {
771 int nLSpace = 0;
772 if (nWhich==SID_ATTR_PARA_LINESPACE_10)
773 nLSpace = 100;
774 else if (nWhich==SID_ATTR_PARA_LINESPACE_115)
775 nLSpace = 115;
776 else if (nWhich==SID_ATTR_PARA_LINESPACE_15)
777 nLSpace = 150;
778 else if (nWhich==SID_ATTR_PARA_LINESPACE_20)
779 nLSpace = 200;
780
781 const SvxLineSpacingItem *pLSpace = aEditAttr.GetItemIfSet( EE_PARA_SBL, false );
782
783 if( !pLSpace || IsInvalidItem( pLSpace ))
784 {
785 rSet.InvalidateItem( nSlotId );
786 }
787 else
788 {
789 if( nLSpace == pLSpace->GetPropLineSpace() )
790 rSet.Put( SfxBoolItem( nWhich, true ));
791 else
792 {
793 // tdf#114631 - disable non selected line spacing
794 rSet.Put(SfxBoolItem(nWhich, false));
795 }
796 }
797 break;
798 }
799 case SID_AUTOSPELL_CHECK:
800 {
801 const SfxPoolItem* pState = m_rView.GetSlotState(nWhich);
802 if (pState)
803 rSet.Put(SfxBoolItem(nWhich, static_cast<const SfxBoolItem*>(pState)->GetValue()));
804 else
805 rSet.DisableItem( nWhich );
806 break;
807 }
808 case SID_ATTR_PARA_LEFT_TO_RIGHT:
809 case SID_ATTR_PARA_RIGHT_TO_LEFT:
810 {
811 if ( !SvtCTLOptions().IsCTLFontEnabled() )
812 rSet.DisableItem( nWhich );
813 else
814 {
815 if(pOLV->GetOutliner() && pOLV->GetOutliner()->IsVertical())
816 rSet.DisableItem( nWhich );
817 else
818 {
819 bool bFlag = false;
820 switch( aEditAttr.Get( EE_PARA_WRITINGDIR ).GetValue() )
821 {
822 case SvxFrameDirection::Horizontal_LR_TB:
823 {
824 bFlag = nWhich == SID_ATTR_PARA_LEFT_TO_RIGHT;
825 rSet.Put( SfxBoolItem( nWhich, bFlag ));
826 break;
827 }
828 case SvxFrameDirection::Horizontal_RL_TB:
829 {
830 bFlag = nWhich != SID_ATTR_PARA_LEFT_TO_RIGHT;
831 rSet.Put( SfxBoolItem( nWhich, bFlag ));
832 break;
833 }
834 default:
835 break;
836 }
837 }
838 }
839 }
840 break;
841 case SID_INSERT_RLM :
842 case SID_INSERT_LRM :
843 {
844 SvtCTLOptions aCTLOptions;
845 bool bEnabled = aCTLOptions.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()->IsProtected()) &&
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();
1524 SfxBindings& rBindings = m_rView.GetViewFrame()->GetBindings();
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 *pSfxViewFrame = 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 pSfxViewFrame->GetSlotState( nWhich, pSfxViewFrame->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 pSfxViewFrame->GetSlotState( nWhich, pSfxViewFrame->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 pSfxViewFrame->GetSlotState( nWhich, pSfxViewFrame->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 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: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:607
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: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:1521
void Hide(std::u16string_view rAuthor)
Definition: PostItMgr.cxx:1751
void ExecuteFormatAllDialog(SwView &rView)
Definition: PostItMgr.cxx:1678
bool HasActiveAnnotationWin() const
Definition: PostItMgr.cxx:2383
sw::annotation::SwAnnotationWin * GetActiveSidebarWin()
Definition: PostItMgr.hxx:235
SW_DLLPUBLIC bool HasActiveSidebarWin() const
Definition: PostItMgr.cxx:2378
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:683
const SwViewOption * GetViewOptions() const
Definition: viewsh.hxx:433
SwDoc * GetDoc() const
Definition: viewsh.hxx:290
const SfxItemPool & GetAttrPool() const
Definition: viewsh.hxx:624
Definition: view.hxx:146
SwWrtShell & GetWrtShell() const
Definition: view.hxx:416
SwPostItMgr * GetPostItMgr()
Definition: view.hxx:642
void ExecNumberingOutline(SfxItemPool &)
Definition: view0.cxx:717
virtual void ShowCursor(bool bOn=true) override
Definition: view.cxx:1622
SwEditWin & GetEditWin()
Definition: view.hxx:419
SwDocShell * GetDocShell()
Definition: view.cxx:1160
void UpdateWordCount(SfxShell *, sal_uInt16)
Definition: view1.cxx:202
void StateSearch(SfxItemSet &)
Definition: viewsrch.cxx:841
void ExecFormatFootnote()
Definition: view0.cxx:710
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:2044
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:778
#define FN_REPLY
Definition: cmdid.h:776
#define FN_DELETE_NOTE_AUTHOR
Definition: cmdid.h:769
#define FN_SET_SUPER_SCRIPT
Definition: cmdid.h:325
#define FN_HIDE_NOTE_AUTHOR
Definition: cmdid.h:772
#define FN_STAT_TEMPLATE
Definition: cmdid.h:848
#define FN_GROW_FONT_SIZE
Definition: cmdid.h:322
#define FN_POSTIT
Definition: cmdid.h:227
#define FN_SHRINK_FONT_SIZE
Definition: cmdid.h:323
#define FN_FORMAT_FOOTNOTE_DLG
Definition: cmdid.h:342
#define FN_STAT_SELMODE
Definition: cmdid.h:850
#define FN_HIDE_ALL_NOTES
Definition: cmdid.h:773
#define FN_DELETE_ALL_NOTES
Definition: cmdid.h:770
#define FN_INSERT_STRING
Definition: cmdid.h:229
#define FN_HIDE_NOTE
Definition: cmdid.h:771
#define FN_NUMBERING_OUTLINE_DLG
Definition: cmdid.h:506
#define FN_DELETE_COMMENT
Definition: cmdid.h:775
#define FN_WORDCOUNT_DIALOG
Definition: cmdid.h:610
#define FN_SET_SUB_SCRIPT
Definition: cmdid.h:326
#define FN_DELETE_COMMENT_THREAD
Definition: cmdid.h:780
#define FN_RESOLVE_NOTE_THREAD
Definition: cmdid.h:779
#define FN_FORMAT_ALL_NOTES
Definition: cmdid.h:777
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< SvxFormatBreakItem > RES_BREAK(94)
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< 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:196
SvxLinkInsertMode
HLINK_FIELD
HLINK_HTMLMODE
HTMLMODE_ON
LanguageType GetAppLanguage()
Definition: init.cxx:725
sal_Int64 n
#define LANGUAGE_CHINESE_TRADITIONAL
#define LANGUAGE_NONE
#define LANGUAGE_CHINESE_SIMPLIFIED
#define LANGUAGE_KOREAN
SvtScriptType
Sequence< sal_Int8 > aSeq
#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:390
@ 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:165
uno::Reference< linguistic2::XThesaurus > GetThesaurus()
Definition: swtypes.cxx:59
#define CHAR_HARDBLANK
Definition: swtypes.hxx:171
#define CHAR_LRM
Definition: swtypes.hxx:175
#define CHAR_SOFTHYPHEN
Definition: swtypes.hxx:173
#define CHAR_WJ
Definition: swtypes.hxx:177
#define CHAR_HARDHYPHEN
Definition: swtypes.hxx:172
#define CHAR_RLM
Definition: swtypes.hxx:174
#define CHAR_ZWSP
Definition: swtypes.hxx:176
#define CHAR_NNBSP
Definition: swtypes.hxx:178
SwUndoId
Definition: swundo.hxx:30
TransliterationFlags
sal_uInt16 sal_Unicode
RET_OK
sal_uInt16 GetHtmlMode(const SwDocShell *pShell)
Definition: viewopt.cxx:332