1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <hintids.hxx>
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>
30 #include <i18nutil/transliteration.hxx>
31 #include <sfx2/namedcolor.hxx>
32 #include <sfx2/objface.hxx>
33 #include <sfx2/viewfrm.hxx>
34 #include <sfx2/bindings.hxx>
35 #include <sfx2/dispatch.hxx>
36 #include <sfx2/request.hxx>
37 #include <editeng/colritem.hxx>
38 #include <editeng/editund2.hxx>
39 #include <editeng/eeitem.hxx>
40 #include <editeng/flstitem.hxx>
41 #include <editeng/spltitem.hxx>
42 #include <editeng/lrspitem.hxx>
43 #include <editeng/ulspitem.hxx>
44 #include <editeng/orphitem.hxx>
45 #include <editeng/formatbreakitem.hxx>
46 #include <editeng/widwitem.hxx>
47 #include <editeng/kernitem.hxx>
48 #include <editeng/escapementitem.hxx>
49 #include <editeng/lspcitem.hxx>
50 #include <editeng/adjustitem.hxx>
51 #include <editeng/hyphenzoneitem.hxx>
52 #include <editeng/udlnitem.hxx>
53 #include <editeng/fontitem.hxx>
54 #include <svx/clipfmtitem.hxx>
55 #include <svl/stritem.hxx>
56 #include <svl/slstitm.hxx>
57 #include <editeng/frmdiritem.hxx>
58 #include <svl/whiter.hxx>
59 #include <svl/cjkoptions.hxx>
60 #include <svl/ctloptions.hxx>
61 #include <unotools/useroptions.hxx>
62 #include <editeng/flditem.hxx>
63 #include <svx/hlnkitem.hxx>
64 #include <sfx2/htmlmode.hxx>
65 #include <editeng/langitem.hxx>
66 #include <editeng/scripttypeitem.hxx>
69 #include <viewopt.hxx>
71 #include <chrdlgmodes.hxx>
73 #include <SwRewriter.hxx>
76 #include <strings.hrc>
77 #include <breakit.hxx>
78 #include <annotsh.hxx>
80 #include <PostItMgr.hxx>
81 #include <AnnotationWin.hxx>
83 #include <swtypes.hxx>
85 #include <svx/svxdlg.hxx>
87 #include <vcl/EnumContext.hxx>
88 #include <svl/itempool.hxx>
89 #include <editeng/outliner.hxx>
90 #include <editeng/editview.hxx>
91 #include <osl/diagnose.h>
93 #include <svl/languageoptions.hxx>
95 #include <svl/undo.hxx>
96 #include <swabstdlg.hxx>
98 #include <comphelper/string.hxx>
99 #include <comphelper/propertysequence.hxx>
100 #include <cppuhelper/bootstrap.hxx>
102 #include <langhelper.hxx>
106 using namespace ::com::sun::star
;
107 using namespace ::com::sun::star::uno
;
108 using namespace ::com::sun::star::beans
;
109 using namespace ::com::sun::star::i18n
;
111 #define ShellClass_SwAnnotationShell
113 #include <sfx2/msg.hxx>
114 #include <swslots.hxx>
116 SFX_IMPL_INTERFACE(SwAnnotationShell
, SfxShell
)
118 void SwAnnotationShell::InitInterface_Impl()
120 GetStaticInterface()->RegisterObjectBar(SFX_OBJECTBAR_OBJECT
, SfxVisibilityFlags::Invisible
, ToolbarId::Text_Toolbox_Sw
);
122 GetStaticInterface()->RegisterPopupMenu(u
"annotation"_ustr
);
126 SfxItemPool
* SwAnnotationShell::GetAnnotationPool(SwView
const & rV
)
128 SwWrtShell
&rSh
= rV
.GetWrtShell();
129 return rSh
.GetAttrPool().GetSecondaryPool();
132 SwAnnotationShell::SwAnnotationShell( SwView
& r
)
135 SetPool(SwAnnotationShell::GetAnnotationPool(m_rView
));
136 SfxShell::SetContextName(vcl::EnumContext::GetContextName(vcl::EnumContext::Context::Annotation
));
139 SwAnnotationShell::~SwAnnotationShell()
141 if (m_rView
.GetWrtShell().CanInsert())
142 m_rView
.ShowCursor(true);
145 SfxUndoManager
* SwAnnotationShell::GetUndoManager()
147 SwPostItMgr
* pPostItMgr
= m_rView
.GetPostItMgr();
149 !pPostItMgr
->HasActiveSidebarWin() )
151 OSL_ENSURE(pPostItMgr
,"PostItMgr::Layout(): We are looping forever");
154 return &pPostItMgr
->GetActiveSidebarWin()->GetOutlinerView()->GetOutliner()->GetUndoManager();
157 void SwAnnotationShell::Exec( SfxRequest
&rReq
)
159 //TODO: clean this up!!!!
160 SwPostItMgr
* pPostItMgr
= m_rView
.GetPostItMgr();
161 if ( !pPostItMgr
|| !pPostItMgr
->HasActiveSidebarWin() )
164 OutlinerView
* pOLV
= pPostItMgr
->GetActiveSidebarWin()->GetOutlinerView();
165 SfxItemSet
aEditAttr(pOLV
->GetAttribs());
166 SfxItemSet
aNewAttr(*aEditAttr
.GetPool(), aEditAttr
.GetRanges());
168 const sal_uInt16 nSlot
= rReq
.GetSlot();
169 const sal_uInt16 nWhich
= GetPool().GetWhichIDFromSlotID(nSlot
);
170 const SfxItemSet
*pNewAttrs
= rReq
.GetArgs();
171 sal_uInt16 nEEWhich
= 0;
174 case SID_PARASPACE_INCREASE
:
175 case SID_PARASPACE_DECREASE
:
177 SvxULSpaceItem
aULSpace( aEditAttr
.Get( EE_PARA_ULSPACE
) );
178 sal_uInt16 nUpper
= aULSpace
.GetUpper();
179 sal_uInt16 nLower
= aULSpace
.GetLower();
181 if ( nSlot
== SID_PARASPACE_INCREASE
)
183 nUpper
= std::min
< sal_uInt16
>( nUpper
+ 57, 5670 );
184 nLower
= std::min
< sal_uInt16
>( nLower
+ 57, 5670 );
188 nUpper
= std::max
< sal_Int16
>( nUpper
- 57, 0 );
189 nLower
= std::max
< sal_Int16
>( nLower
- 57, 0 );
192 aULSpace
.SetUpper( nUpper
);
193 aULSpace
.SetLower( nLower
);
194 aNewAttr
.Put( aULSpace
);
198 case SID_ATTR_PARA_LRSPACE
:
200 SvxLRSpaceItem
aParaMargin(static_cast<const SvxLRSpaceItem
&>(rReq
.
201 GetArgs()->Get(nSlot
)));
202 aParaMargin
.SetWhich( EE_PARA_LRSPACE
);
204 aNewAttr
.Put(aParaMargin
);
208 case SID_ATTR_PARA_LINESPACE
:
210 SvxLineSpacingItem aParaMargin
= static_cast<const SvxLineSpacingItem
&>(pNewAttrs
->Get(
211 GetPool().GetWhichIDFromSlotID(nSlot
)));
212 aParaMargin
.SetWhich( EE_PARA_SBL
);
214 aNewAttr
.Put(aParaMargin
);
218 case SID_ATTR_PARA_ULSPACE
:
220 SvxULSpaceItem aULSpace
= static_cast<const SvxULSpaceItem
&>(pNewAttrs
->Get(
221 GetPool().GetWhichIDFromSlotID(nSlot
)));
222 aULSpace
.SetWhich( EE_PARA_ULSPACE
);
223 aNewAttr
.Put( aULSpace
);
227 case FN_GROW_FONT_SIZE
:
228 case FN_SHRINK_FONT_SIZE
:
230 const SfxObjectShell
* pObjSh
= SfxObjectShell::Current();
231 const SvxFontListItem
* pFontListItem
= static_cast<const SvxFontListItem
*>
232 (pObjSh
? pObjSh
->GetItem(SID_ATTR_CHAR_FONTLIST
) : nullptr);
233 const FontList
* pFontList
= pFontListItem
? pFontListItem
->GetFontList() : nullptr;
234 pOLV
->GetEditView().ChangeFontSize( nSlot
== FN_GROW_FONT_SIZE
, pFontList
);
238 case SID_ATTR_CHAR_FONT
:
239 case SID_ATTR_CHAR_FONTHEIGHT
:
240 case SID_ATTR_CHAR_WEIGHT
:
241 case SID_ATTR_CHAR_POSTURE
:
243 SfxItemPool
* pSecondPool
= aEditAttr
.GetPool()->GetSecondaryPool();
245 pSecondPool
= aEditAttr
.GetPool();
246 SvxScriptSetItem
aSetItem( nSlot
, *pSecondPool
);
247 aSetItem
.PutItemForScriptType( pOLV
->GetSelectedScriptType(), pNewAttrs
->Get( nWhich
));
248 aNewAttr
.Put( aSetItem
.GetItemSet() );
252 case SID_ATTR_CHAR_COLOR
: nEEWhich
= EE_CHAR_COLOR
; break;
254 case SID_ATTR_CHAR_COLOR2
:
258 const std::optional
<NamedColor
> oColor
259 = m_rView
.GetDocShell()->GetRecentColor(SID_ATTR_CHAR_COLOR
);
260 if (oColor
.has_value())
262 nEEWhich
= GetPool().GetWhichIDFromSlotID(SID_ATTR_CHAR_COLOR
);
263 const model::ComplexColor aCol
= (*oColor
).getComplexColor();
264 aNewAttr
.Put(SvxColorItem(aCol
.getFinalColor(), aCol
, nEEWhich
));
265 rReq
.SetArgs(aNewAttr
);
266 rReq
.SetSlot(SID_ATTR_CHAR_COLOR
);
271 case SID_ATTR_CHAR_BACK_COLOR
:
273 nEEWhich
= GetPool().GetWhichIDFromSlotID(nSlot
);
276 const std::optional
<NamedColor
> oColor
277 = m_rView
.GetDocShell()->GetRecentColor(nSlot
);
278 if (oColor
.has_value())
280 const model::ComplexColor aCol
= (*oColor
).getComplexColor();
281 aNewAttr
.Put(SvxColorItem(aCol
.getFinalColor(), aCol
, nEEWhich
));
286 case SID_ATTR_CHAR_UNDERLINE
:
290 const SvxUnderlineItem
* pItem
= rReq
.GetArg
<SvxUnderlineItem
>(SID_ATTR_CHAR_UNDERLINE
);
293 aNewAttr
.Put(*pItem
);
297 FontLineStyle eFU
= aEditAttr
.Get( EE_CHAR_UNDERLINE
).GetLineStyle();
298 aNewAttr
.Put( SvxUnderlineItem( eFU
!= LINESTYLE_NONE
?LINESTYLE_NONE
: LINESTYLE_SINGLE
, EE_CHAR_UNDERLINE
) );
303 case SID_ATTR_CHAR_OVERLINE
:
305 FontLineStyle eFO
= aEditAttr
.Get(EE_CHAR_OVERLINE
).GetLineStyle();
306 aNewAttr
.Put(SvxOverlineItem(eFO
== LINESTYLE_SINGLE
? LINESTYLE_NONE
: LINESTYLE_SINGLE
, EE_CHAR_OVERLINE
));
309 case SID_ATTR_CHAR_CONTOUR
: nEEWhich
= EE_CHAR_OUTLINE
; break;
310 case SID_ATTR_CHAR_SHADOWED
: nEEWhich
= EE_CHAR_SHADOW
; break;
311 case SID_ATTR_CHAR_STRIKEOUT
: nEEWhich
= EE_CHAR_STRIKEOUT
; break;
312 case SID_ATTR_CHAR_WORDLINEMODE
: nEEWhich
= EE_CHAR_WLM
; break;
313 case SID_ATTR_CHAR_RELIEF
: nEEWhich
= EE_CHAR_RELIEF
; break;
314 case SID_ATTR_CHAR_LANGUAGE
: nEEWhich
= EE_CHAR_LANGUAGE
;break;
315 case SID_ATTR_CHAR_KERNING
: nEEWhich
= EE_CHAR_KERNING
; break;
316 case SID_ATTR_CHAR_SCALEWIDTH
: nEEWhich
= EE_CHAR_FONTWIDTH
; break;
317 case SID_ATTR_CHAR_AUTOKERN
: nEEWhich
= EE_CHAR_PAIRKERNING
; break;
318 case SID_ATTR_CHAR_ESCAPEMENT
: nEEWhich
= EE_CHAR_ESCAPEMENT
; break;
319 case SID_ATTR_PARA_ADJUST_LEFT
:
320 aNewAttr
.Put(SvxAdjustItem(SvxAdjust::Left
, EE_PARA_JUST
));
322 case SID_ATTR_PARA_ADJUST_CENTER
:
323 aNewAttr
.Put(SvxAdjustItem(SvxAdjust::Center
, EE_PARA_JUST
));
325 case SID_ATTR_PARA_ADJUST_RIGHT
:
326 aNewAttr
.Put(SvxAdjustItem(SvxAdjust::Right
, EE_PARA_JUST
));
328 case SID_ATTR_PARA_ADJUST_BLOCK
:
329 aNewAttr
.Put(SvxAdjustItem(SvxAdjust::Block
, EE_PARA_JUST
));
332 case SID_ATTR_PARA_LINESPACE_10
:
334 SvxLineSpacingItem
aItem(LINE_SPACE_DEFAULT_HEIGHT
, EE_PARA_SBL
);
335 aItem
.SetPropLineSpace(100);
339 case SID_ATTR_PARA_LINESPACE_115
:
341 SvxLineSpacingItem
aItem(LINE_SPACE_DEFAULT_HEIGHT
, EE_PARA_SBL
);
342 aItem
.SetPropLineSpace(115);
346 case SID_ATTR_PARA_LINESPACE_15
:
348 SvxLineSpacingItem
aItem(LINE_SPACE_DEFAULT_HEIGHT
, EE_PARA_SBL
);
349 aItem
.SetPropLineSpace(150);
353 case SID_ATTR_PARA_LINESPACE_20
:
355 SvxLineSpacingItem
aItem(LINE_SPACE_DEFAULT_HEIGHT
, EE_PARA_SBL
);
356 aItem
.SetPropLineSpace(200);
362 Outliner
* pOutliner
= pOLV
->GetOutliner();
365 sal_Int32 nParaCount
= pOutliner
->GetParagraphCount();
367 pOLV
->SelectRange(0, nParaCount
);
371 case FN_FORMAT_RESET
:
373 pPostItMgr
->GetActiveSidebarWin()->ResetAttributes();
377 case FN_SET_SUPER_SCRIPT
:
379 SvxEscapementItem
aItem(EE_CHAR_ESCAPEMENT
);
380 SvxEscapement eEsc
= static_cast<SvxEscapement
>(aEditAttr
.Get( EE_CHAR_ESCAPEMENT
).GetEnumValue());
382 if( eEsc
== SvxEscapement::Superscript
)
383 aItem
.SetEscapement( SvxEscapement::Off
);
385 aItem
.SetEscapement( SvxEscapement::Superscript
);
386 aNewAttr
.Put( aItem
);
389 case FN_SET_SUB_SCRIPT
:
391 SvxEscapementItem
aItem(EE_CHAR_ESCAPEMENT
);
392 SvxEscapement eEsc
= static_cast<SvxEscapement
>(aEditAttr
.Get( EE_CHAR_ESCAPEMENT
).GetEnumValue());
394 if( eEsc
== SvxEscapement::Subscript
)
395 aItem
.SetEscapement( SvxEscapement::Off
);
397 aItem
.SetEscapement( SvxEscapement::Subscript
);
398 aNewAttr
.Put( aItem
);
401 case SID_HYPERLINK_SETLINK
:
403 const SfxPoolItem
* pItem
= nullptr;
405 pNewAttrs
->GetItemState(nSlot
, false, &pItem
);
409 const SvxHyperlinkItem
& rHLinkItem
= *static_cast<const SvxHyperlinkItem
*>(pItem
);
410 SvxURLField
aField(rHLinkItem
.GetURL(), rHLinkItem
.GetName(), SvxURLFormat::AppDefault
);
411 aField
.SetTargetFrame(rHLinkItem
.GetTargetFrame());
413 const SvxFieldItem
* pFieldItem
= pOLV
->GetFieldAtSelection();
415 if (pFieldItem
&& dynamic_cast<const SvxURLField
*>(pFieldItem
->GetField()) != nullptr)
417 // Select the field so that it will be deleted during insert
418 ESelection aSel
= pOLV
->GetSelection();
420 pOLV
->SetSelection(aSel
);
422 if (pPostItMgr
->GetActiveSidebarWin()->GetLayoutStatus()!=SwPostItHelper::DELETED
)
423 pOLV
->InsertField(SvxFieldItem(aField
, EE_FEATURE_FIELD
));
427 case FN_INSERT_SOFT_HYPHEN
:
428 case FN_INSERT_HARDHYPHEN
:
429 case FN_INSERT_HARD_SPACE
:
430 case FN_INSERT_NNBSP
:
431 case SID_INSERT_RLM
:
432 case SID_INSERT_LRM
:
434 case SID_INSERT_ZWSP
:
436 sal_Unicode cIns
= 0;
437 switch(rReq
.GetSlot())
439 case FN_INSERT_SOFT_HYPHEN
: cIns
= CHAR_SOFTHYPHEN
; break;
440 case FN_INSERT_HARDHYPHEN
: cIns
= CHAR_HARDHYPHEN
; break;
441 case FN_INSERT_HARD_SPACE
: cIns
= CHAR_HARDBLANK
; break;
442 case FN_INSERT_NNBSP
: cIns
= CHAR_NNBSP
; break;
443 case SID_INSERT_RLM
: cIns
= CHAR_RLM
; break;
444 case SID_INSERT_LRM
: cIns
= CHAR_LRM
; break;
445 case SID_INSERT_ZWSP
: cIns
= CHAR_ZWSP
; break;
446 case SID_INSERT_WJ
: cIns
= CHAR_WJ
; break;
448 pOLV
->InsertText( OUString(cIns
));
454 if (pPostItMgr
->GetActiveSidebarWin()->GetLayoutStatus()!=SwPostItHelper::DELETED
)
458 case FN_INSERT_STRING
:
460 const SfxPoolItem
* pItem
= nullptr;
462 pNewAttrs
->GetItemState(nSlot
, false, &pItem
);
463 if (pItem
&& pPostItMgr
->GetActiveSidebarWin()->GetLayoutStatus()!=SwPostItHelper::DELETED
)
464 pOLV
->InsertText(static_cast<const SfxStringItem
*>(pItem
)->GetValue());
467 case FN_FORMAT_FOOTNOTE_DLG
:
469 m_rView
.ExecFormatFootnote();
472 case FN_NUMBERING_OUTLINE_DLG
:
474 m_rView
.ExecNumberingOutline(GetPool());
478 case SID_OPEN_XML_FILTERSETTINGS
:
480 HandleOpenXmlFilterSettings(rReq
);
483 case FN_WORDCOUNT_DIALOG
:
485 m_rView
.UpdateWordCount(this, nSlot
);
488 case SID_CHAR_DLG_EFFECT
:
489 case SID_CHAR_DLG_POSITION
:
492 const SfxItemSet
* pArgs
= rReq
.GetArgs();
493 const SfxStringItem
* pItem
= rReq
.GetArg
<SfxStringItem
>(FN_PARAM_1
);
495 if( !pArgs
|| pItem
)
498 SwView* pView = &GetView();
499 FieldUnit eMetric = ::GetDfltMetric(dynamic_cast<SwWebView*>( pView) != nullptr );
500 SwModule::get()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, eMetric));
502 SfxItemSet
aDlgAttr(SfxItemSet::makeFixedSfxItemSet
<XATTR_FILLSTYLE
, XATTR_FILLCOLOR
, EE_ITEMS_START
, EE_ITEMS_END
>(GetPool()));
504 // util::Language does not exist in the EditEngine! Therefore not included in the set.
506 aDlgAttr
.Put( aEditAttr
);
507 aDlgAttr
.Put( SvxKerningItem(0, RES_CHRATR_KERNING
) );
509 SwAbstractDialogFactory
* pFact
= SwAbstractDialogFactory::Create();
510 VclPtr
<SfxAbstractTabDialog
> pDlg(pFact
->CreateSwCharDlg(m_rView
.GetFrameWeld(), m_rView
, aDlgAttr
, SwCharDlgMode::Ann
));
511 if (nSlot
== SID_CHAR_DLG_EFFECT
)
513 pDlg
->SetCurPageId(u
"fonteffects"_ustr
);
515 if (nSlot
== SID_CHAR_DLG_POSITION
)
517 pDlg
->SetCurPageId(u
"position"_ustr
);
521 pDlg
->SetCurPageId(pItem
->GetValue());
524 auto xRequest
= std::make_shared
<SfxRequest
>(rReq
);
525 rReq
.Ignore(); // the 'old' request is not relevant any more
526 pDlg
->StartExecuteAsync(
527 [this, pDlg
, xRequest
=std::move(xRequest
), nEEWhich
, aNewAttr2
=aNewAttr
, pOLV
] (sal_Int32 nResult
) mutable ->void
529 if (nResult
== RET_OK
)
531 xRequest
->Done( *( pDlg
->GetOutputItemSet() ) );
532 aNewAttr2
.Put(*pDlg
->GetOutputItemSet());
533 ExecPost(*xRequest
, nEEWhich
, aNewAttr2
, pOLV
);
541 aNewAttr
.Put(*pArgs
);
546 const SfxItemSet
* pArgs
= rReq
.GetArgs();
551 SwView* pView = &GetView();
552 FieldUnit eMetric = ::GetDfltMetric(dynamic_cast<SwWebView*>( pView) != nullptr );
553 SwModule::get()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, eMetric));
555 SfxItemSet
aDlgAttr(SfxItemSet::makeFixedSfxItemSet
<
556 EE_ITEMS_START
, EE_ITEMS_END
,
557 SID_ATTR_PARA_HYPHENZONE
, SID_ATTR_PARA_WIDOWS
>(GetPool()));
559 aDlgAttr
.Put(aEditAttr
);
561 aDlgAttr
.Put( SvxHyphenZoneItem( false, RES_PARATR_HYPHENZONE
) );
562 aDlgAttr
.Put( SvxFormatBreakItem( SvxBreak::NONE
, RES_BREAK
) );
563 aDlgAttr
.Put( SvxFormatSplitItem( true, RES_PARATR_SPLIT
) );
564 aDlgAttr
.Put( SvxWidowsItem( 0, RES_PARATR_WIDOWS
) );
565 aDlgAttr
.Put( SvxOrphansItem( 0, RES_PARATR_ORPHANS
) );
567 SwAbstractDialogFactory
* pFact
= SwAbstractDialogFactory::Create();
568 ScopedVclPtr
<SfxAbstractTabDialog
> pDlg(pFact
->CreateSwParaDlg(m_rView
.GetFrameWeld(), m_rView
, aDlgAttr
, true));
569 sal_uInt16 nRet
= pDlg
->Execute();
572 rReq
.Done( *( pDlg
->GetOutputItemSet() ) );
573 aNewAttr
.Put(*pDlg
->GetOutputItemSet());
579 aNewAttr
.Put(*pArgs
);
583 case SID_AUTOSPELL_CHECK
:
585 m_rView
.ExecuteSlot(rReq
);
588 case SID_ATTR_PARA_LEFT_TO_RIGHT
:
589 case SID_ATTR_PARA_RIGHT_TO_LEFT
:
591 bool bLeftToRight
= nSlot
== SID_ATTR_PARA_LEFT_TO_RIGHT
;
593 const SfxPoolItem
* pPoolItem
;
594 if( pNewAttrs
&& SfxItemState::SET
== pNewAttrs
->GetItemState( nSlot
, true, &pPoolItem
) )
596 if( !static_cast<const SfxBoolItem
*>(pPoolItem
)->GetValue() )
597 bLeftToRight
= !bLeftToRight
;
599 SfxItemSet
aAttr(SfxItemSet::makeFixedSfxItemSet
<
600 EE_PARA_WRITINGDIR
, EE_PARA_WRITINGDIR
,
601 EE_PARA_JUST
, EE_PARA_JUST
>(*aNewAttr
.GetPool()));
603 SvxAdjust nAdjust
= SvxAdjust::Left
;
604 if( const SvxAdjustItem
* pAdjustItem
= aEditAttr
.GetItemIfSet(EE_PARA_JUST
) )
605 nAdjust
= pAdjustItem
->GetAdjust();
609 aAttr
.Put( SvxFrameDirectionItem( SvxFrameDirection::Horizontal_LR_TB
, EE_PARA_WRITINGDIR
) );
610 if( nAdjust
== SvxAdjust::Right
)
611 aAttr
.Put( SvxAdjustItem( SvxAdjust::Left
, EE_PARA_JUST
) );
615 aAttr
.Put( SvxFrameDirectionItem( SvxFrameDirection::Horizontal_RL_TB
, EE_PARA_WRITINGDIR
) );
616 if( nAdjust
== SvxAdjust::Left
)
617 aAttr
.Put( SvxAdjustItem( SvxAdjust::Right
, EE_PARA_JUST
) );
619 pOLV
->SetAttribs(aAttr
);
624 ExecPost(rReq
, nEEWhich
, aNewAttr
, pOLV
);
627 void SwAnnotationShell::ExecPost( SfxRequest
& rReq
, sal_uInt16 nEEWhich
, SfxItemSet
& rNewAttr
, OutlinerView
* pOLV
)
629 const SfxItemSet
*pNewAttrs
= rReq
.GetArgs();
630 const sal_uInt16 nSlot
= rReq
.GetSlot();
631 const sal_uInt16 nWhich
= GetPool().GetWhichIDFromSlotID(nSlot
);
633 if(nEEWhich
&& pNewAttrs
)
635 rNewAttr
.Put(pNewAttrs
->Get(nWhich
).CloneSetWhich(nEEWhich
));
637 else if (nEEWhich
== EE_CHAR_COLOR
)
639 m_rView
.GetViewFrame().GetDispatcher()->Execute(SID_CHAR_DLG_EFFECT
);
641 else if (nEEWhich
== EE_CHAR_KERNING
)
643 m_rView
.GetViewFrame().GetDispatcher()->Execute(SID_CHAR_DLG_POSITION
);
647 tools::Rectangle aOutRect
= pOLV
->GetOutputArea();
648 if (tools::Rectangle() != aOutRect
&& rNewAttr
.Count())
649 pOLV
->SetAttribs(rNewAttr
);
651 m_rView
.GetViewFrame().GetBindings().InvalidateAll(false);
652 if ( pOLV
->GetOutliner()->IsModified() )
653 m_rView
.GetWrtShell().SetModified();
656 void SwAnnotationShell::GetState(SfxItemSet
& rSet
)
658 //TODO: clean this up!!!
659 // FN_SET_SUPER_SCRIPT
660 //SID_ATTR_PARA_ADJUST
661 //SID_ATTR_PARA_ADJUST_BLOCK
663 SwPostItMgr
* pPostItMgr
= m_rView
.GetPostItMgr();
664 if ( !pPostItMgr
|| !pPostItMgr
->HasActiveSidebarWin() )
667 OutlinerView
* pOLV
= pPostItMgr
->GetActiveSidebarWin()->GetOutlinerView();
668 SfxItemSet
aEditAttr(pOLV
->GetAttribs());
670 SfxWhichIter
aIter(rSet
);
671 sal_uInt16 nWhich
= aIter
.FirstWhich();
674 sal_uInt16 nEEWhich
= 0;
675 sal_uInt16 nSlotId
= GetPool().GetSlotId( nWhich
);
678 case SID_ATTR_PARA_LRSPACE
:
679 case SID_ATTR_PARA_LEFTSPACE
:
680 case SID_ATTR_PARA_RIGHTSPACE
:
681 case SID_ATTR_PARA_FIRSTLINESPACE
:
683 SfxItemState eState
= aEditAttr
.GetItemState( EE_PARA_LRSPACE
);
684 if( eState
>= SfxItemState::DEFAULT
)
686 SvxLRSpaceItem aLR
= aEditAttr
.Get( EE_PARA_LRSPACE
);
687 aLR
.SetWhich(nSlotId
);
691 rSet
.InvalidateItem(nSlotId
);
694 case SID_ATTR_PARA_LINESPACE
:
696 SfxItemState eState
= aEditAttr
.GetItemState( EE_PARA_SBL
);
697 if( eState
>= SfxItemState::DEFAULT
)
699 const SvxLineSpacingItem
& aLR
= aEditAttr
.Get( EE_PARA_SBL
);
703 rSet
.InvalidateItem(nSlotId
);
706 case SID_ATTR_PARA_ULSPACE
:
707 case SID_ATTR_PARA_ABOVESPACE
:
708 case SID_ATTR_PARA_BELOWSPACE
:
709 case SID_PARASPACE_INCREASE
:
710 case SID_PARASPACE_DECREASE
:
712 SfxItemState eState
= aEditAttr
.GetItemState( EE_PARA_ULSPACE
);
713 if( eState
>= SfxItemState::DEFAULT
)
715 SvxULSpaceItem aULSpace
= aEditAttr
.Get( EE_PARA_ULSPACE
);
716 if ( !aULSpace
.GetUpper() && !aULSpace
.GetLower() )
717 rSet
.DisableItem( SID_PARASPACE_DECREASE
);
718 else if ( aULSpace
.GetUpper() >= 5670 && aULSpace
.GetLower() >= 5670 )
719 rSet
.DisableItem( SID_PARASPACE_INCREASE
);
720 if ( nSlotId
== SID_ATTR_PARA_ULSPACE
721 || nSlotId
== SID_ATTR_PARA_BELOWSPACE
722 || nSlotId
== SID_ATTR_PARA_ABOVESPACE
725 aULSpace
.SetWhich(nSlotId
);
731 rSet
.DisableItem( SID_PARASPACE_INCREASE
);
732 rSet
.DisableItem( SID_PARASPACE_DECREASE
);
733 rSet
.InvalidateItem( SID_ATTR_PARA_ULSPACE
);
734 rSet
.InvalidateItem( SID_ATTR_PARA_ABOVESPACE
);
735 rSet
.InvalidateItem( SID_ATTR_PARA_BELOWSPACE
);
739 case SID_ATTR_CHAR_FONT
:
740 case SID_ATTR_CHAR_FONTHEIGHT
:
741 case SID_ATTR_CHAR_WEIGHT
:
742 case SID_ATTR_CHAR_POSTURE
:
744 SvtScriptType nScriptType
= pOLV
->GetSelectedScriptType();
745 SfxItemPool
* pSecondPool
= aEditAttr
.GetPool()->GetSecondaryPool();
747 pSecondPool
= aEditAttr
.GetPool();
748 SvxScriptSetItem
aSetItem( nSlotId
, *pSecondPool
);
749 aSetItem
.GetItemSet().Put( aEditAttr
, false );
750 const SfxPoolItem
* pI
= aSetItem
.GetItemOfScript( nScriptType
);
753 rSet
.Put(pI
->CloneSetWhich(nWhich
));
756 rSet
.InvalidateItem( nWhich
);
759 case SID_ATTR_CHAR_COLOR2
:
760 case SID_ATTR_CHAR_COLOR
: nEEWhich
= EE_CHAR_COLOR
; break;
761 case SID_ATTR_CHAR_BACK_COLOR
: nEEWhich
= EE_CHAR_BKGCOLOR
; break;
762 case SID_ATTR_CHAR_UNDERLINE
: nEEWhich
= EE_CHAR_UNDERLINE
;break;
763 case SID_ATTR_CHAR_OVERLINE
: nEEWhich
= EE_CHAR_OVERLINE
;break;
764 case SID_ATTR_CHAR_CONTOUR
: nEEWhich
= EE_CHAR_OUTLINE
; break;
765 case SID_ATTR_CHAR_SHADOWED
: nEEWhich
= EE_CHAR_SHADOW
;break;
766 case SID_ATTR_CHAR_STRIKEOUT
: nEEWhich
= EE_CHAR_STRIKEOUT
;break;
767 case SID_ATTR_CHAR_LANGUAGE
: nEEWhich
= EE_CHAR_LANGUAGE
;break;
768 case SID_ATTR_CHAR_ESCAPEMENT
: nEEWhich
= EE_CHAR_ESCAPEMENT
;break;
769 case SID_ATTR_CHAR_KERNING
: nEEWhich
= EE_CHAR_KERNING
;break;
770 case FN_SET_SUPER_SCRIPT
:
771 case FN_SET_SUB_SCRIPT
:
774 if (nWhich
==FN_SET_SUPER_SCRIPT
)
775 nEsc
= SvxEscapement::Superscript
;
777 nEsc
= SvxEscapement::Subscript
;
779 const SfxPoolItem
*pEscItem
= &aEditAttr
.Get( EE_CHAR_ESCAPEMENT
);
780 if( nEsc
== static_cast<const SvxEscapementItem
*>(pEscItem
)->GetEscapement() )
781 rSet
.Put( SfxBoolItem( nWhich
, true ));
783 rSet
.InvalidateItem( nWhich
);
786 case SID_ATTR_PARA_ADJUST_LEFT
:
787 case SID_ATTR_PARA_ADJUST_RIGHT
:
788 case SID_ATTR_PARA_ADJUST_CENTER
:
789 case SID_ATTR_PARA_ADJUST_BLOCK
:
791 SvxAdjust eAdjust
= SvxAdjust::Left
;
792 if (nWhich
==SID_ATTR_PARA_ADJUST_LEFT
)
793 eAdjust
= SvxAdjust::Left
;
794 else if (nWhich
==SID_ATTR_PARA_ADJUST_RIGHT
)
795 eAdjust
= SvxAdjust::Right
;
796 else if (nWhich
==SID_ATTR_PARA_ADJUST_CENTER
)
797 eAdjust
= SvxAdjust::Center
;
798 else if (nWhich
==SID_ATTR_PARA_ADJUST_BLOCK
)
799 eAdjust
= SvxAdjust::Block
;
801 const SvxAdjustItem
*pAdjust
= aEditAttr
.GetItemIfSet( EE_PARA_JUST
, false );
803 if( !pAdjust
|| IsInvalidItem( pAdjust
))
805 rSet
.InvalidateItem( nSlotId
);
809 if ( eAdjust
== pAdjust
->GetAdjust())
810 rSet
.Put( SfxBoolItem( nWhich
, true ));
812 rSet
.InvalidateItem( nWhich
);
816 case SID_ATTR_PARA_LINESPACE_10
:
817 case SID_ATTR_PARA_LINESPACE_115
:
818 case SID_ATTR_PARA_LINESPACE_15
:
819 case SID_ATTR_PARA_LINESPACE_20
:
822 if (nWhich
==SID_ATTR_PARA_LINESPACE_10
)
824 else if (nWhich
==SID_ATTR_PARA_LINESPACE_115
)
826 else if (nWhich
==SID_ATTR_PARA_LINESPACE_15
)
828 else if (nWhich
==SID_ATTR_PARA_LINESPACE_20
)
831 const SvxLineSpacingItem
*pLSpace
= aEditAttr
.GetItemIfSet( EE_PARA_SBL
, false );
833 if( !pLSpace
|| IsInvalidItem( pLSpace
))
835 rSet
.InvalidateItem( nSlotId
);
839 if( nLSpace
== pLSpace
->GetPropLineSpace() )
840 rSet
.Put( SfxBoolItem( nWhich
, true ));
843 // tdf#114631 - disable non selected line spacing
844 rSet
.Put(SfxBoolItem(nWhich
, false));
849 case SID_AUTOSPELL_CHECK
:
851 const SfxPoolItemHolder
aResult(m_rView
.GetSlotState(nWhich
));
853 rSet
.Put(SfxBoolItem(nWhich
, static_cast<const SfxBoolItem
*>(aResult
.getItem())->GetValue()));
855 rSet
.DisableItem( nWhich
);
858 case SID_ATTR_PARA_LEFT_TO_RIGHT
:
859 case SID_ATTR_PARA_RIGHT_TO_LEFT
:
861 if ( !SvtCTLOptions::IsCTLFontEnabled() )
862 rSet
.DisableItem( nWhich
);
865 if(pOLV
->GetOutliner() && pOLV
->GetOutliner()->IsVertical())
866 rSet
.DisableItem( nWhich
);
870 switch( aEditAttr
.Get( EE_PARA_WRITINGDIR
).GetValue() )
872 case SvxFrameDirection::Horizontal_LR_TB
:
874 bFlag
= nWhich
== SID_ATTR_PARA_LEFT_TO_RIGHT
;
875 rSet
.Put( SfxBoolItem( nWhich
, bFlag
));
878 case SvxFrameDirection::Horizontal_RL_TB
:
880 bFlag
= nWhich
!= SID_ATTR_PARA_LEFT_TO_RIGHT
;
881 rSet
.Put( SfxBoolItem( nWhich
, bFlag
));
891 case SID_INSERT_RLM
:
892 case SID_INSERT_LRM
:
894 bool bEnabled
= SvtCTLOptions::IsCTLFontEnabled();
895 m_rView
.GetViewFrame().GetBindings().SetVisibleState( nWhich
, bEnabled
);
897 rSet
.DisableItem(nWhich
);
901 rSet
.InvalidateItem( nWhich
);
907 rSet
.Put(aEditAttr
.Get(nEEWhich
).CloneSetWhich(nWhich
));
908 if(nEEWhich
== EE_CHAR_KERNING
)
910 SfxItemState eState
= aEditAttr
.GetItemState( EE_CHAR_KERNING
);
911 if ( eState
== SfxItemState::INVALID
)
913 rSet
.InvalidateItem(EE_CHAR_KERNING
);
918 if (pPostItMgr
->GetActiveSidebarWin()->GetLayoutStatus()==SwPostItHelper::DELETED
)
919 rSet
.DisableItem( nWhich
);
921 nWhich
= aIter
.NextWhich();
925 void SwAnnotationShell::ExecSearch(SfxRequest
& rReq
)
927 m_rView
.ExecSearch(rReq
);
930 void SwAnnotationShell::StateSearch(SfxItemSet
&rSet
)
932 m_rView
.StateSearch(rSet
);
935 void SwAnnotationShell::ExecClpbrd(SfxRequest
const &rReq
)
937 SwPostItMgr
* pPostItMgr
= m_rView
.GetPostItMgr();
938 if ( !pPostItMgr
|| !pPostItMgr
->HasActiveSidebarWin() )
941 OutlinerView
* pOLV
= pPostItMgr
->GetActiveSidebarWin()->GetOutlinerView();
943 tools::Long aOldHeight
= pPostItMgr
->GetActiveSidebarWin()->GetPostItTextHeight();
944 sal_uInt16 nSlot
= rReq
.GetSlot();
948 if ( (pPostItMgr
->GetActiveSidebarWin()->GetLayoutStatus()!=SwPostItHelper::DELETED
) && pOLV
->HasSelection() )
952 if( pOLV
->HasSelection() )
956 if (pPostItMgr
->GetActiveSidebarWin()->GetLayoutStatus()!=SwPostItHelper::DELETED
)
957 pOLV
->PasteSpecial();
959 case SID_PASTE_UNFORMATTED
:
960 if (pPostItMgr
->GetActiveSidebarWin()->GetLayoutStatus()!=SwPostItHelper::DELETED
)
963 case SID_PASTE_SPECIAL
:
965 if (pPostItMgr
->GetActiveSidebarWin()->GetLayoutStatus()!=SwPostItHelper::DELETED
)
967 SvxAbstractDialogFactory
* pFact
= SvxAbstractDialogFactory::Create();
968 ScopedVclPtr
<SfxAbstractPasteDialog
> pDlg(pFact
->CreatePasteDialog(m_rView
.GetEditWin().GetFrameWeld()));
970 pDlg
->Insert( SotClipboardFormatId::STRING
, OUString() );
971 pDlg
->Insert( SotClipboardFormatId::RTF
, OUString() );
972 pDlg
->Insert( SotClipboardFormatId::RICHTEXT
, OUString() );
974 TransferableDataHelper
aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( &m_rView
.GetEditWin() ) );
976 SotClipboardFormatId nFormat
= pDlg
->GetFormat( aDataHelper
.GetTransferable() );
978 if (nFormat
!= SotClipboardFormatId::NONE
)
980 if (nFormat
== SotClipboardFormatId::STRING
)
983 pOLV
->PasteSpecial();
988 case SID_CLIPBOARD_FORMAT_ITEMS
:
990 SotClipboardFormatId nFormat
= SotClipboardFormatId::NONE
;
991 const SfxPoolItem
* pItem
;
992 if (rReq
.GetArgs() && rReq
.GetArgs()->GetItemState(nSlot
, true, &pItem
) == SfxItemState::SET
)
994 if (const SfxUInt32Item
* pUInt32Item
= dynamic_cast<const SfxUInt32Item
*>(pItem
))
995 nFormat
= static_cast<SotClipboardFormatId
>(pUInt32Item
->GetValue());
998 if ( nFormat
!= SotClipboardFormatId::NONE
)
1000 if (SotClipboardFormatId::STRING
== nFormat
)
1003 pOLV
->PasteSpecial();
1008 pPostItMgr
->GetActiveSidebarWin()->ResizeIfNecessary(aOldHeight
,pPostItMgr
->GetActiveSidebarWin()->GetPostItTextHeight());
1011 void SwAnnotationShell::StateClpbrd(SfxItemSet
&rSet
)
1013 SwPostItMgr
* pPostItMgr
= m_rView
.GetPostItMgr();
1014 if ( !pPostItMgr
|| !pPostItMgr
->HasActiveSidebarWin() )
1016 OutlinerView
* pOLV
= pPostItMgr
->GetActiveSidebarWin()->GetOutlinerView();
1018 TransferableDataHelper
aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( &m_rView
.GetEditWin() ) );
1019 bool bPastePossible
= ( aDataHelper
.HasFormat( SotClipboardFormatId::STRING
) || aDataHelper
.HasFormat( SotClipboardFormatId::RTF
)
1020 || aDataHelper
.HasFormat( SotClipboardFormatId::RICHTEXT
));
1021 bPastePossible
= bPastePossible
&& (pPostItMgr
->GetActiveSidebarWin()->GetLayoutStatus()!=SwPostItHelper::DELETED
);
1023 SfxWhichIter
aIter(rSet
);
1024 sal_uInt16 nWhich
= aIter
.FirstWhich();
1032 if (pPostItMgr
->GetActiveSidebarWin()->GetLayoutStatus() == SwPostItHelper::DELETED
)
1033 rSet
.DisableItem( nWhich
);
1038 SfxObjectShell
* pObjectShell
= GetObjectShell();
1039 if (!pOLV
->HasSelection() || (pObjectShell
&& pObjectShell
->isContentExtractionLocked()) )
1040 rSet
.DisableItem( nWhich
);
1044 case SID_PASTE_UNFORMATTED
:
1045 case SID_PASTE_SPECIAL
:
1047 if( !bPastePossible
)
1048 rSet
.DisableItem( nWhich
);
1051 case SID_CLIPBOARD_FORMAT_ITEMS
:
1053 if ( bPastePossible
)
1055 SvxClipboardFormatItem
aFormats( SID_CLIPBOARD_FORMAT_ITEMS
);
1056 if ( aDataHelper
.HasFormat( SotClipboardFormatId::RTF
) )
1057 aFormats
.AddClipbrdFormat( SotClipboardFormatId::RTF
);
1058 if ( aDataHelper
.HasFormat( SotClipboardFormatId::RICHTEXT
) )
1059 aFormats
.AddClipbrdFormat( SotClipboardFormatId::RICHTEXT
);
1060 aFormats
.AddClipbrdFormat( SotClipboardFormatId::STRING
);
1061 rSet
.Put( aFormats
);
1064 rSet
.DisableItem( nWhich
);
1068 nWhich
= aIter
.NextWhich();
1072 void SwAnnotationShell::StateStatusLine(SfxItemSet
&rSet
)
1074 SfxWhichIter
aIter( rSet
);
1075 sal_uInt16 nWhich
= aIter
.FirstWhich();
1081 case FN_STAT_SELMODE
:
1083 rSet
.Put(SfxUInt16Item(FN_STAT_SELMODE
, 0));
1084 rSet
.DisableItem( nWhich
);
1087 case FN_STAT_TEMPLATE
:
1089 rSet
.DisableItem( nWhich
);
1093 nWhich
= aIter
.NextWhich();
1097 void SwAnnotationShell::StateInsert(SfxItemSet
&rSet
)
1099 SwPostItMgr
* pPostItMgr
= m_rView
.GetPostItMgr();
1100 if ( !pPostItMgr
|| !pPostItMgr
->HasActiveSidebarWin() )
1103 OutlinerView
* pOLV
= pPostItMgr
->GetActiveSidebarWin()->GetOutlinerView();
1104 SfxWhichIter
aIter(rSet
);
1105 sal_uInt16 nWhich
= aIter
.FirstWhich();
1111 case SID_HYPERLINK_GETLINK
:
1113 SvxHyperlinkItem aHLinkItem
;
1114 aHLinkItem
.SetInsertMode(HLINK_FIELD
);
1116 const SvxFieldItem
* pFieldItem
= pOLV
->GetFieldAtSelection();
1120 if (const SvxURLField
* pURLField
= dynamic_cast<const SvxURLField
*>(pFieldItem
->GetField()))
1122 aHLinkItem
.SetName(pURLField
->GetRepresentation());
1123 aHLinkItem
.SetURL(pURLField
->GetURL());
1124 aHLinkItem
.SetTargetFrame(pURLField
->GetTargetFrame());
1129 OUString
sSel(pOLV
->GetSelected());
1130 sSel
= sSel
.copy(0, std::min
<sal_Int32
>(255, sSel
.getLength()));
1131 aHLinkItem
.SetName(comphelper::string::stripEnd(sSel
, ' '));
1134 sal_uInt16 nHtmlMode
= ::GetHtmlMode(m_rView
.GetDocShell());
1135 aHLinkItem
.SetInsertMode(static_cast<SvxLinkInsertMode
>(aHLinkItem
.GetInsertMode() |
1136 ((nHtmlMode
& HTMLMODE_ON
) != 0 ? HLINK_HTMLMODE
: 0)));
1138 rSet
.Put(aHLinkItem
);
1143 if (pPostItMgr
->GetActiveSidebarWin()->GetLayoutStatus()==SwPostItHelper::DELETED
)
1144 rSet
.DisableItem( nWhich
);
1146 nWhich
= aIter
.NextWhich();
1150 void SwAnnotationShell::NoteExec(SfxRequest
const &rReq
)
1152 SwPostItMgr
* pPostItMgr
= m_rView
.GetPostItMgr();
1156 sal_uInt16 nSlot
= rReq
.GetSlot();
1161 case FN_DELETE_COMMENT
:
1162 case FN_DELETE_COMMENT_THREAD
:
1163 case FN_RESOLVE_NOTE
:
1164 case FN_RESOLVE_NOTE_THREAD
:
1165 case FN_PROMOTE_COMMENT
:
1166 if ( pPostItMgr
->HasActiveSidebarWin() )
1167 pPostItMgr
->GetActiveSidebarWin()->ExecuteCommand(nSlot
);
1169 case FN_DELETE_ALL_NOTES
:
1170 pPostItMgr
->Delete();
1172 case FN_FORMAT_ALL_NOTES
:
1173 pPostItMgr
->ExecuteFormatAllDialog(m_rView
);
1175 case FN_DELETE_NOTE_AUTHOR
:
1177 const SfxStringItem
* pItem
= rReq
.GetArg
<SfxStringItem
>(nSlot
);
1179 pPostItMgr
->Delete( pItem
->GetValue() );
1180 else if ( pPostItMgr
->HasActiveSidebarWin() )
1181 pPostItMgr
->Delete( pPostItMgr
->GetActiveSidebarWin()->GetAuthor() );
1186 case FN_HIDE_ALL_NOTES
:
1189 case FN_HIDE_NOTE_AUTHOR
:
1191 const SfxStringItem
* pItem
= rReq
.GetArg
<SfxStringItem
>(nSlot
);
1193 pPostItMgr
->Hide( pItem
->GetValue() );
1194 else if ( pPostItMgr
->HasActiveSidebarWin() )
1195 pPostItMgr
->Hide( pPostItMgr
->GetActiveSidebarWin()->GetAuthor() );
1200 void SwAnnotationShell::GetNoteState(SfxItemSet
&rSet
)
1202 SwPostItMgr
* pPostItMgr
= m_rView
.GetPostItMgr();
1203 SfxWhichIter
aIter(rSet
);
1204 sal_uInt16 nWhich
= aIter
.FirstWhich();
1207 sal_uInt16 nSlotId
= GetPool().GetSlotId( nWhich
);
1211 case FN_DELETE_ALL_NOTES
:
1212 case FN_FORMAT_ALL_NOTES
:
1214 case FN_HIDE_ALL_NOTES
:
1215 case FN_DELETE_COMMENT
:
1216 case FN_DELETE_COMMENT_THREAD
:
1219 || !pPostItMgr
->HasActiveAnnotationWin() )
1221 rSet
.DisableItem(nWhich
);
1225 case FN_RESOLVE_NOTE
:
1228 || !pPostItMgr
->HasActiveAnnotationWin() )
1230 rSet
.DisableItem(nWhich
);
1234 SfxBoolItem
aBool(nWhich
, pPostItMgr
->GetActiveSidebarWin()->IsResolved());
1239 case FN_RESOLVE_NOTE_THREAD
:
1242 || !pPostItMgr
->HasActiveAnnotationWin() )
1244 rSet
.DisableItem(nWhich
);
1248 SfxBoolItem
aBool(nWhich
, pPostItMgr
->GetActiveSidebarWin()->IsThreadResolved());
1253 case FN_DELETE_NOTE_AUTHOR
:
1254 case FN_HIDE_NOTE_AUTHOR
:
1257 || !pPostItMgr
->HasActiveAnnotationWin() )
1259 rSet
.DisableItem(nWhich
);
1263 OUString
aText( nSlotId
== FN_DELETE_NOTE_AUTHOR
?
1264 SwResId( STR_DELETE_NOTE_AUTHOR
) : SwResId( STR_HIDE_NOTE_AUTHOR
) );
1265 SwRewriter aRewriter
;
1266 aRewriter
.AddRule( UndoArg1
, pPostItMgr
->GetActiveSidebarWin()->GetAuthor() );
1267 aText
= aRewriter
.Apply( aText
);
1268 SfxStringItem
aItem( nSlotId
, aText
);
1276 !pPostItMgr
->HasActiveAnnotationWin() )
1278 rSet
.DisableItem(nWhich
);
1282 SvtUserOptions aUserOpt
;
1284 if( (sAuthor
= aUserOpt
.GetFullName()).isEmpty() &&
1285 (sAuthor
= aUserOpt
.GetID()).isEmpty() )
1286 sAuthor
= SwResId( STR_REDLINE_UNKNOWN_AUTHOR
);
1287 if (sAuthor
== pPostItMgr
->GetActiveSidebarWin()->GetAuthor())
1288 rSet
.DisableItem(nWhich
);
1292 case FN_PROMOTE_COMMENT
:
1294 if (!pPostItMgr
|| !pPostItMgr
->HasActiveAnnotationWin()
1295 || pPostItMgr
->GetActiveSidebarWin()->IsRootNote())
1297 rSet
.DisableItem(nWhich
);
1302 rSet
.InvalidateItem( nWhich
);
1306 if (pPostItMgr
&& pPostItMgr
->HasActiveSidebarWin())
1308 if ( (pPostItMgr
->GetActiveSidebarWin()->IsReadOnlyOrProtected()) &&
1309 ( (nSlotId
==FN_DELETE_COMMENT
) || (nSlotId
==FN_REPLY
) ) )
1310 rSet
.DisableItem( nWhich
);
1312 nWhich
= aIter
.NextWhich();
1316 void SwAnnotationShell::ExecLingu(SfxRequest
&rReq
)
1318 SwPostItMgr
* pPostItMgr
= m_rView
.GetPostItMgr();
1319 if ( !pPostItMgr
|| !pPostItMgr
->HasActiveSidebarWin() )
1322 OutlinerView
* pOLV
= pPostItMgr
->GetActiveSidebarWin()->GetOutlinerView();
1323 sal_uInt16 nSlot
= rReq
.GetSlot();
1324 SwWrtShell
&rSh
= m_rView
.GetWrtShell();
1325 bool bRestoreSelection
= false;
1326 ESelection aOldSelection
;
1330 case SID_LANGUAGE_STATUS
:
1332 aOldSelection
= pOLV
->GetSelection();
1333 if (!pOLV
->GetEditView().HasSelection())
1335 pOLV
->GetEditView().SelectCurrentWord();
1338 bRestoreSelection
= SwLangHelper::SetLanguageStatus(pOLV
,rReq
,m_rView
,rSh
);
1343 OUString aReplaceText
;
1344 const SfxStringItem
* pItem2
= rReq
.GetArg(FN_PARAM_THES_WORD_REPLACE
);
1346 aReplaceText
= pItem2
->GetValue();
1347 if (!aReplaceText
.isEmpty())
1348 ReplaceTextWithSynonym( pOLV
->GetEditView(), aReplaceText
);
1353 pOLV
->StartThesaurus(rReq
.GetFrameWeld());
1356 case SID_HANGUL_HANJA_CONVERSION
:
1357 pOLV
->StartTextConversion(rReq
.GetFrameWeld(), LANGUAGE_KOREAN
, LANGUAGE_KOREAN
, nullptr,
1358 i18n::TextConversionOption::CHARACTER_BY_CHARACTER
, true, false);
1361 case SID_CHINESE_CONVERSION
:
1363 //open ChineseTranslationDialog
1364 Reference
< XComponentContext
> xContext(
1365 ::cppu::defaultBootstrap_InitialComponentContext() ); //@todo get context from calc if that has one
1368 Reference
< lang::XMultiComponentFactory
> xMCF( xContext
->getServiceManager() );
1371 Reference
< ui::dialogs::XExecutableDialog
> xDialog(
1372 xMCF
->createInstanceWithContext(
1373 u
"com.sun.star.linguistic2.ChineseTranslationDialog"_ustr
, xContext
),
1375 Reference
< lang::XInitialization
> xInit( xDialog
, UNO_QUERY
);
1378 // initialize dialog
1379 uno::Sequence
<uno::Any
> aSeq(comphelper::InitAnyPropertySequence(
1381 {"ParentWindow", uno::Any(Reference
<awt::XWindow
>())}
1383 xInit
->initialize( aSeq
);
1386 sal_Int16 nDialogRet
= xDialog
->execute();
1387 if( RET_OK
== nDialogRet
)
1389 //get some parameters from the dialog
1390 bool bToSimplified
= true;
1391 bool bUseVariants
= true;
1392 bool bCommonTerms
= true;
1393 Reference
< beans::XPropertySet
> xProp( xDialog
, UNO_QUERY
);
1398 xProp
->getPropertyValue( u
"IsDirectionToSimplified"_ustr
) >>= bToSimplified
;
1399 xProp
->getPropertyValue( u
"IsUseCharacterVariants"_ustr
) >>= bUseVariants
;
1400 xProp
->getPropertyValue( u
"IsTranslateCommonTerms"_ustr
) >>= bCommonTerms
;
1402 catch (const Exception
&)
1407 //execute translation
1408 LanguageType nSourceLang
= bToSimplified
? LANGUAGE_CHINESE_TRADITIONAL
: LANGUAGE_CHINESE_SIMPLIFIED
;
1409 LanguageType nTargetLang
= bToSimplified
? LANGUAGE_CHINESE_SIMPLIFIED
: LANGUAGE_CHINESE_TRADITIONAL
;
1410 sal_Int32 nOptions
= bUseVariants
? i18n::TextConversionOption::USE_CHARACTER_VARIANTS
: 0;
1412 nOptions
= nOptions
| i18n::TextConversionOption::CHARACTER_BY_CHARACTER
;
1414 vcl::Font aTargetFont
= OutputDevice::GetDefaultFont( DefaultFontType::CJK_TEXT
,
1415 nTargetLang
, GetDefaultFontFlags::OnlyOne
);
1417 pOLV
->StartTextConversion(rReq
.GetFrameWeld(), nSourceLang
, nTargetLang
, &aTargetFont
, nOptions
, false, false);
1420 Reference
< lang::XComponent
> xComponent( xDialog
, UNO_QUERY
);
1421 if( xComponent
.is() )
1422 xComponent
->dispose();
1429 if (bRestoreSelection
)
1431 // restore selection
1432 pOLV
->GetEditView().SetSelection( aOldSelection
);
1436 void SwAnnotationShell::GetLinguState(SfxItemSet
&rSet
)
1438 SwPostItMgr
* pPostItMgr
= m_rView
.GetPostItMgr();
1439 if ( !pPostItMgr
|| !pPostItMgr
->HasActiveSidebarWin() )
1442 OutlinerView
* pOLV
= pPostItMgr
->GetActiveSidebarWin()->GetOutlinerView();
1444 SfxWhichIter
aIter(rSet
);
1445 sal_uInt16 nWhich
= aIter
.FirstWhich();
1450 case SID_LANGUAGE_STATUS
:
1452 SwLangHelper::GetLanguageStatus(pOLV
,rSet
);
1458 OUString aStatusVal
;
1459 LanguageType nLang
= LANGUAGE_NONE
;
1460 bool bIsLookUpWord
= GetStatusValueForThesaurusFromContext( aStatusVal
, nLang
, pOLV
->GetEditView() );
1461 rSet
.Put( SfxStringItem( SID_THES
, aStatusVal
) );
1463 // disable "Thesaurus" context menu entry if there is nothing to look up
1464 uno::Reference
< linguistic2::XThesaurus
> xThes( ::GetThesaurus() );
1465 if (!bIsLookUpWord
||
1466 !xThes
.is() || nLang
== LANGUAGE_NONE
|| !xThes
->hasLocale( LanguageTag::convertToLocale( nLang
) ))
1467 rSet
.DisableItem( SID_THES
);
1471 // disable "Thesaurus" if the language is not supported
1474 TypedWhichId
<SvxLanguageItem
> nLangWhich
= GetWhichOfScript( RES_CHRATR_LANGUAGE
,
1475 SvtLanguageOptions::GetI18NScriptTypeOfLanguage( GetAppLanguage() ) );
1476 const SvxLanguageItem
&rItem
= m_rView
.GetWrtShell().GetDoc()->GetDefault(nLangWhich
);
1477 LanguageType nLang
= rItem
.GetLanguage();
1478 uno::Reference
< linguistic2::XThesaurus
> xThes( ::GetThesaurus() );
1479 if (!xThes
.is() || nLang
== LANGUAGE_NONE
||
1480 !xThes
->hasLocale( LanguageTag::convertToLocale( nLang
) ))
1481 rSet
.DisableItem( SID_THESAURUS
);
1484 case SID_HANGUL_HANJA_CONVERSION
:
1485 case SID_CHINESE_CONVERSION
:
1487 if (!SvtCJKOptions::IsAnyEnabled())
1489 m_rView
.GetViewFrame().GetBindings().SetVisibleState( nWhich
, false );
1490 rSet
.DisableItem(nWhich
);
1493 m_rView
.GetViewFrame().GetBindings().SetVisibleState( nWhich
, true );
1498 if (pPostItMgr
->GetActiveSidebarWin()->GetLayoutStatus()==SwPostItHelper::DELETED
)
1499 rSet
.DisableItem( nWhich
);
1501 nWhich
= aIter
.NextWhich();
1505 void SwAnnotationShell::ExecTransliteration(SfxRequest
const &rReq
)
1507 SwPostItMgr
* pPostItMgr
= m_rView
.GetPostItMgr();
1508 if (!pPostItMgr
|| !pPostItMgr
->HasActiveSidebarWin())
1511 OutlinerView
* pOLV
= pPostItMgr
->GetActiveSidebarWin()->GetOutlinerView();
1516 TransliterationFlags nMode
= TransliterationFlags::NONE
;
1518 switch( rReq
.GetSlot() )
1520 case SID_TRANSLITERATE_SENTENCE_CASE
:
1521 nMode
= TransliterationFlags::SENTENCE_CASE
;
1523 case SID_TRANSLITERATE_TITLE_CASE
:
1524 nMode
= TransliterationFlags::TITLE_CASE
;
1526 case SID_TRANSLITERATE_TOGGLE_CASE
:
1527 nMode
= TransliterationFlags::TOGGLE_CASE
;
1529 case SID_TRANSLITERATE_UPPER
:
1530 nMode
= TransliterationFlags::LOWERCASE_UPPERCASE
;
1532 case SID_TRANSLITERATE_LOWER
:
1533 nMode
= TransliterationFlags::UPPERCASE_LOWERCASE
;
1535 case SID_TRANSLITERATE_HALFWIDTH
:
1536 nMode
= TransliterationFlags::FULLWIDTH_HALFWIDTH
;
1538 case SID_TRANSLITERATE_FULLWIDTH
:
1539 nMode
= TransliterationFlags::HALFWIDTH_FULLWIDTH
;
1541 case SID_TRANSLITERATE_HIRAGANA
:
1542 nMode
= TransliterationFlags::KATAKANA_HIRAGANA
;
1544 case SID_TRANSLITERATE_KATAKANA
:
1545 nMode
= TransliterationFlags::HIRAGANA_KATAKANA
;
1549 OSL_ENSURE(false, "wrong dispatcher");
1552 if( nMode
!= TransliterationFlags::NONE
)
1553 pOLV
->TransliterateText( nMode
);
1556 void SwAnnotationShell::ExecRotateTransliteration( SfxRequest
const & rReq
)
1558 if( rReq
.GetSlot() != SID_TRANSLITERATE_ROTATE_CASE
)
1561 SwPostItMgr
* pPostItMgr
= m_rView
.GetPostItMgr();
1562 if (!pPostItMgr
|| !pPostItMgr
->HasActiveSidebarWin())
1565 OutlinerView
* pOLV
= pPostItMgr
->GetActiveSidebarWin()->GetOutlinerView();
1570 pOLV
->TransliterateText(m_aRotateCase
.getNextMode());
1573 void SwAnnotationShell::ExecUndo(SfxRequest
&rReq
)
1575 const SfxItemSet
* pArgs
= rReq
.GetArgs();
1576 SfxUndoManager
* pUndoManager
= GetUndoManager();
1577 SwWrtShell
&rSh
= m_rView
.GetWrtShell();
1578 SwUndoId
nUndoId(SwUndoId::EMPTY
);
1580 // tdf#147928 get these before "undo" which may delete this SwAnnotationShell
1581 SwPostItMgr
* pPostItMgr
= m_rView
.GetPostItMgr();
1582 SfxBindings
& rBindings
= m_rView
.GetViewFrame().GetBindings();
1584 tools::Long aOldHeight
= pPostItMgr
->HasActiveSidebarWin()
1585 ? pPostItMgr
->GetActiveSidebarWin()->GetPostItTextHeight()
1588 sal_uInt16 nId
= rReq
.GetSlot();
1589 sal_uInt16 nCnt
= 1;
1590 const SfxPoolItem
* pItem
=nullptr;
1591 if( pArgs
&& SfxItemState::SET
== pArgs
->GetItemState( nId
, false, &pItem
) )
1592 nCnt
= static_cast<const SfxUInt16Item
*>(pItem
)->GetValue();
1597 rSh
.GetLastUndoInfo(nullptr, &nUndoId
);
1598 if (nUndoId
== SwUndoId::CONFLICT
)
1600 rReq
.SetReturnValue( SfxUInt32Item(nId
, static_cast<sal_uInt32
>(SID_REPAIRPACKAGE
)) );
1606 sal_uInt16 nCount
= pUndoManager
->GetUndoActionCount();
1607 sal_uInt16 nSteps
= nCnt
;
1608 if ( nCount
< nCnt
)
1610 nCnt
= nCnt
- nCount
;
1617 pUndoManager
->Undo();
1621 rSh
.Do( SwWrtShell::UNDO
, nCnt
);
1628 (void)rSh
.GetFirstRedoInfo(nullptr, &nUndoId
);
1629 if (nUndoId
== SwUndoId::CONFLICT
)
1631 rReq
.SetReturnValue( SfxUInt32Item(nId
, static_cast<sal_uInt32
>(SID_REPAIRPACKAGE
)) );
1637 sal_uInt16 nCount
= pUndoManager
->GetRedoActionCount();
1638 sal_uInt16 nSteps
= nCnt
;
1639 if ( nCount
< nCnt
)
1641 nCnt
= nCnt
- nCount
;
1648 pUndoManager
->Redo();
1652 rSh
.Do( SwWrtShell::REDO
, nCnt
);
1658 rBindings
.InvalidateAll(false);
1660 if (pPostItMgr
->HasActiveSidebarWin())
1661 pPostItMgr
->GetActiveSidebarWin()->ResizeIfNecessary(aOldHeight
, pPostItMgr
->GetActiveSidebarWin()->GetPostItTextHeight());
1664 void SwAnnotationShell::StateUndo(SfxItemSet
&rSet
)
1666 SwPostItMgr
* pPostItMgr
= m_rView
.GetPostItMgr();
1667 if ( !pPostItMgr
|| !pPostItMgr
->HasActiveSidebarWin() )
1670 SfxWhichIter
aIter(rSet
);
1671 SwUndoId
nUndoId(SwUndoId::EMPTY
);
1672 sal_uInt16 nWhich
= aIter
.FirstWhich();
1673 SfxUndoManager
* pUndoManager
= GetUndoManager();
1674 SfxViewFrame
& rSfxViewFrame
= m_rView
.GetViewFrame();
1675 SwWrtShell
&rSh
= m_rView
.GetWrtShell();
1683 sal_uInt16 nCount
= pUndoManager
? pUndoManager
->GetUndoActionCount() : 0;
1685 rSfxViewFrame
.GetSlotState( nWhich
, rSfxViewFrame
.GetInterface(), &rSet
);
1686 else if (rSh
.GetLastUndoInfo(nullptr, &nUndoId
))
1688 rSet
.Put( SfxStringItem( nWhich
, rSh
.GetDoString(SwWrtShell::UNDO
)) );
1690 else if (nUndoId
== SwUndoId::CONFLICT
)
1692 rSet
.Put( SfxUInt32Item(nWhich
, static_cast<sal_uInt32
>(SID_REPAIRPACKAGE
)) );
1695 rSet
.DisableItem(nWhich
);
1700 sal_uInt16 nCount
= pUndoManager
? pUndoManager
->GetRedoActionCount() : 0;
1702 rSfxViewFrame
.GetSlotState( nWhich
, rSfxViewFrame
.GetInterface(), &rSet
);
1703 else if (rSh
.GetFirstRedoInfo(nullptr, &nUndoId
))
1705 rSet
.Put(SfxStringItem( nWhich
, rSh
.GetDoString(SwWrtShell::REDO
)) );
1707 else if (nUndoId
== SwUndoId::CONFLICT
)
1709 rSet
.Put( SfxUInt32Item(nWhich
, static_cast<sal_uInt32
>(SID_REPAIRPACKAGE
)) );
1712 rSet
.DisableItem(nWhich
);
1715 case SID_GETUNDOSTRINGS
:
1716 case SID_GETREDOSTRINGS
:
1720 OUString (SfxUndoManager::*fnGetComment
)( size_t, bool const ) const;
1723 if( SID_GETUNDOSTRINGS
== nWhich
)
1725 nCount
= pUndoManager
->GetUndoActionCount();
1726 fnGetComment
= &SfxUndoManager::GetUndoActionComment
;
1730 nCount
= pUndoManager
->GetRedoActionCount();
1731 fnGetComment
= &SfxUndoManager::GetRedoActionComment
;
1734 OUStringBuffer sList
;
1737 for( sal_uInt16 n
= 0; n
< nCount
; ++n
)
1738 sList
.append( (pUndoManager
->*fnGetComment
)( n
, SfxUndoManager::TopLevel
) + "\n");
1741 SfxStringListItem
aItem( nWhich
);
1742 if ((nWhich
== SID_GETUNDOSTRINGS
) &&
1743 rSh
.GetLastUndoInfo(nullptr, nullptr))
1745 rSh
.GetDoStrings( SwWrtShell::UNDO
, aItem
);
1747 else if ((nWhich
== SID_GETREDOSTRINGS
) &&
1748 (rSh
.GetFirstRedoInfo(nullptr, nullptr)))
1750 rSh
.GetDoStrings( SwWrtShell::REDO
, aItem
);
1753 sList
.append(aItem
.GetString());
1754 aItem
.SetString( sList
.makeStringAndClear() );
1758 rSet
.DisableItem( nWhich
);
1764 rSfxViewFrame
.GetSlotState( nWhich
, rSfxViewFrame
.GetInterface(), &rSet
);
1770 if (pPostItMgr
->GetActiveSidebarWin()->GetLayoutStatus()==SwPostItHelper::DELETED
)
1771 rSet
.DisableItem( nWhich
);
1773 nWhich
= aIter
.NextWhich();
1777 void SwAnnotationShell::StateDisableItems( SfxItemSet
&rSet
)
1779 SfxWhichIter
aIter(rSet
);
1780 sal_uInt16 nWhich
= aIter
.FirstWhich();
1783 rSet
.DisableItem( nWhich
);
1784 nWhich
= aIter
.NextWhich();
1788 void SwAnnotationShell::InsertSymbol(SfxRequest
& rReq
)
1790 SwPostItMgr
* pPostItMgr
= m_rView
.GetPostItMgr();
1791 if ( !pPostItMgr
|| !pPostItMgr
->HasActiveSidebarWin() )
1794 OutlinerView
* pOLV
= pPostItMgr
->GetActiveSidebarWin()->GetOutlinerView();
1796 const SfxItemSet
*pArgs
= rReq
.GetArgs();
1797 const SfxStringItem
* pCharMapItem
= nullptr;
1799 pCharMapItem
= pArgs
->GetItemIfSet(SID_CHARMAP
, false);
1805 sSym
= pCharMapItem
->GetValue();
1806 const SfxStringItem
* pFontItem
= pArgs
->GetItemIfSet( SID_ATTR_SPECIALCHAR
, false);
1808 sFontName
= pFontItem
->GetValue();
1811 SfxItemSet
aSet(pOLV
->GetAttribs());
1812 SvtScriptType nScript
= pOLV
->GetSelectedScriptType();
1813 std::shared_ptr
<SvxFontItem
> aSetDlgFont(std::make_shared
<SvxFontItem
>(RES_CHRATR_FONT
));
1815 SvxScriptSetItem
aSetItem( SID_ATTR_CHAR_FONT
, *aSet
.GetPool() );
1816 aSetItem
.GetItemSet().Put( aSet
, false );
1817 const SfxPoolItem
* pI
= aSetItem
.GetItemOfScript( nScript
);
1820 aSetDlgFont
.reset(static_cast<SvxFontItem
*>(pI
->Clone()));
1824 TypedWhichId
<SvxFontItem
> nFontWhich
=
1827 SvtLanguageOptions::GetI18NScriptTypeOfLanguage( GetAppLanguage() ) );
1828 aSetDlgFont
.reset(aSet
.Get(nFontWhich
).Clone());
1831 if (sFontName
.isEmpty())
1832 sFontName
= aSetDlgFont
->GetFamilyName();
1835 vcl::Font
aFont(sFontName
, Size(1,1));
1836 if( sSym
.isEmpty() )
1838 SvxAbstractDialogFactory
* pFact
= SvxAbstractDialogFactory::Create();
1840 SfxAllItemSet
aAllSet( GetPool() );
1841 aAllSet
.Put( SfxBoolItem( FN_PARAM_1
, false ) );
1843 SwViewOption
aOpt(*m_rView
.GetWrtShell().GetViewOptions());
1844 const OUString
& sSymbolFont
= aOpt
.GetSymbolFont();
1845 if( !sSymbolFont
.isEmpty() )
1846 aAllSet
.Put( SfxStringItem( SID_FONT_NAME
, sSymbolFont
) );
1848 aAllSet
.Put( SfxStringItem( SID_FONT_NAME
, aSetDlgFont
->GetFamilyName() ) );
1850 // If character is selected then it can be shown.
1851 auto xFrame
= m_rView
.GetViewFrame().GetFrame().GetFrameInterface();
1852 VclPtr
<SfxAbstractDialog
> pDlg(pFact
->CreateCharMapDialog(m_rView
.GetFrameWeld(), aAllSet
, xFrame
));
1853 pDlg
->StartExecuteAsync(
1854 [pDlg
] (sal_Int32
/*nResult*/)->void
1856 pDlg
->disposeOnce();
1864 Outliner
* pOutliner
= pOLV
->GetOutliner();
1865 pOutliner
->SetUpdateLayout(false);
1867 SfxItemSet
aOldSet( pOLV
->GetAttribs() );
1868 SfxItemSet
aFontSet(SfxItemSet::makeFixedSfxItemSet
<
1869 EE_CHAR_FONTINFO
, EE_CHAR_FONTINFO
, EE_CHAR_FONTINFO_CJK
,
1870 EE_CHAR_FONTINFO_CTL
>(*aOldSet
.GetPool()));
1871 aFontSet
.Set( aOldSet
);
1874 pOLV
->InsertText( sSym
);
1876 // Attributing (set font)
1877 SfxItemSet
aSetFont( *aFontSet
.GetPool(), aFontSet
.GetRanges() );
1878 SvxFontItem
aFontItem (aFont
.GetFamilyType(), aFont
.GetFamilyName(),
1879 aFont
.GetStyleName(), aFont
.GetPitch(),
1882 SvtScriptType nScriptBreak
= g_pBreakIt
->GetAllScriptsOfText( sSym
);
1883 if( SvtScriptType::LATIN
& nScriptBreak
)
1884 aSetFont
.Put( aFontItem
);
1885 if( SvtScriptType::ASIAN
& nScriptBreak
)
1887 aFontItem
.SetWhich(EE_CHAR_FONTINFO_CJK
);
1888 aSetFont
.Put( aFontItem
);
1890 if( SvtScriptType::COMPLEX
& nScriptBreak
)
1892 aFontItem
.SetWhich(EE_CHAR_FONTINFO_CTL
);
1893 aSetFont
.Put( aFontItem
);
1895 pOLV
->SetAttribs(aSetFont
);
1898 ESelection
aSel(pOLV
->GetSelection());
1899 aSel
.CollapseToEnd();
1900 pOLV
->SetSelection(aSel
);
1903 pOLV
->SetAttribs( aFontSet
);
1905 // From now on show it again
1906 pOutliner
->SetUpdateLayout(true);
1909 rReq
.AppendItem( SfxStringItem( SID_CHARMAP
, sSym
) );
1910 if(!aFont
.GetFamilyName().isEmpty())
1911 rReq
.AppendItem( SfxStringItem( SID_ATTR_SPECIALCHAR
, aFont
.GetFamilyName() ) );
1916 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */