cid#1607171 Data race condition
[LibreOffice.git] / sd / source / ui / view / drtxtob.cxx
blob3e800881960b45ba9111d3020311fc735b95dd22
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 <TextObjectBar.hxx>
22 #include <svx/svxids.hrc>
24 #include <com/sun/star/linguistic2/XThesaurus.hpp>
26 #include <editeng/eeitem.hxx>
27 #include <editeng/udlnitem.hxx>
28 #include <editeng/ulspitem.hxx>
29 #include <editeng/lspcitem.hxx>
30 #include <editeng/adjustitem.hxx>
31 #include <editeng/cmapitem.hxx>
32 #include <editeng/editview.hxx>
33 #include <editeng/outliner.hxx>
34 #include <editeng/unolingu.hxx>
35 #include <editeng/kernitem.hxx>
36 #include <editeng/editund2.hxx>
37 #include <svl/whiter.hxx>
38 #include <svl/itempool.hxx>
39 #include <svl/stritem.hxx>
40 #include <svl/style.hxx>
41 #include <svl/languageoptions.hxx>
42 #include <svl/cjkoptions.hxx>
43 #include <svl/ctloptions.hxx>
44 #include <sfx2/tplpitem.hxx>
45 #include <editeng/escapementitem.hxx>
46 #include <svx/svdoutl.hxx>
47 #include <editeng/scripttypeitem.hxx>
48 #include <editeng/writingmodeitem.hxx>
49 #include <editeng/frmdiritem.hxx>
50 #include <editeng/fhgtitem.hxx>
51 #include <o3tl/temporary.hxx>
53 #include <sfx2/objface.hxx>
55 #include <drawdoc.hxx>
56 #include <DrawDocShell.hxx>
57 #include <DrawViewShell.hxx>
58 #include <OutlineViewShell.hxx>
59 #include <NotesPanelViewShell.hxx>
60 #include <Window.hxx>
61 #include <OutlineView.hxx>
62 #include <Outliner.hxx>
64 #define ShellClass_TextObjectBar
65 using namespace sd;
66 #include <sdslots.hxx>
68 using namespace ::com::sun::star;
70 namespace sd {
72 /**
73 * Declare default interface (Slotmap must not be empty, therefore enter
74 * something that (hopefully) never occurs.
76 SFX_IMPL_INTERFACE(TextObjectBar, SfxShell)
78 void TextObjectBar::InitInterface_Impl()
83 TextObjectBar::TextObjectBar (
84 ViewShell* pSdViewSh,
85 SfxItemPool& rItemPool,
86 ::sd::View* pSdView )
87 : SfxShell(pSdViewSh->GetViewShell()),
88 mpViewShell( pSdViewSh ),
89 mpView( pSdView )
91 SetPool(&rItemPool);
93 if( mpView )
95 OutlineView* pOutlinerView = dynamic_cast< OutlineView* >( mpView );
96 if( pOutlinerView )
98 SetUndoManager(&pOutlinerView->GetOutliner().GetUndoManager());
100 else
102 DrawDocShell* pDocShell = mpView->GetDoc().GetDocSh();
103 if( pDocShell )
105 SetUndoManager(pDocShell->GetUndoManager());
106 DrawViewShell* pDrawViewShell = dynamic_cast< DrawViewShell* >( pSdViewSh );
107 if ( pDrawViewShell )
108 SetRepeatTarget(pSdView);
113 SetName( u"TextObjectBar"_ustr);
115 // SetHelpId( SD_IF_SDDRAWTEXTOBJECTBAR );
118 TextObjectBar::~TextObjectBar()
120 SetRepeatTarget(nullptr);
123 void TextObjectBar::GetCharState( SfxItemSet& rSet )
125 GetCharStateImpl(mpViewShell, mpView, rSet);
128 void TextObjectBar::GetCharStateImpl(ViewShell* mpViewShell, ::sd::View* mpView, SfxItemSet& rSet)
130 SfxItemSet aCharAttrSet( mpView->GetDoc().GetPool() );
131 mpView->GetAttributes( aCharAttrSet );
133 SfxItemSetFixed<EE_ITEMS_START,EE_ITEMS_END> aNewAttr( mpViewShell->GetPool() );
135 aNewAttr.Put(aCharAttrSet, false);
136 rSet.Put(aNewAttr, false);
138 SvxKerningItem aKern = aCharAttrSet.Get( EE_CHAR_KERNING );
139 //aKern.SetWhich(SID_ATTR_CHAR_KERNING);
140 rSet.Put(aKern);
142 SfxItemState eState = aCharAttrSet.GetItemState( EE_CHAR_KERNING );
143 if ( eState == SfxItemState::INVALID )
145 rSet.InvalidateItem(EE_CHAR_KERNING);
149 void TextObjectBar::GetAttrState( SfxItemSet& rSet )
151 GetAttrStateImpl(mpViewShell, mpView, rSet, this);
155 * Status of attribute items.
157 void TextObjectBar::GetAttrStateImpl(ViewShell* mpViewShell, ::sd::View* mpView, SfxItemSet& rSet, SfxShell* pTextObjectBar)
159 SfxWhichIter aIter( rSet );
160 sal_uInt16 nWhich = aIter.FirstWhich();
161 SfxItemSet aAttrSet( mpView->GetDoc().GetPool() );
162 bool bDisableParagraphTextDirection = !SvtCTLOptions::IsCTLFontEnabled();
163 bool bDisableVerticalText = !SvtCJKOptions::IsVerticalTextEnabled();
165 mpView->GetAttributes( aAttrSet );
167 while ( nWhich )
169 sal_uInt16 nSlotId = SfxItemPool::IsWhich(nWhich)
170 ? mpView->GetDoc().GetPool().GetSlotId(nWhich)
171 : nWhich;
173 switch ( nSlotId )
175 case SID_ATTR_CHAR_FONT:
176 case SID_ATTR_CHAR_FONTHEIGHT:
177 case SID_ATTR_CHAR_WEIGHT:
178 case SID_ATTR_CHAR_POSTURE:
179 case SID_ATTR_CHAR_SHADOWED:
180 case SID_ATTR_CHAR_STRIKEOUT:
181 case SID_ATTR_CHAR_CASEMAP:
183 double stretchY = 1.0;
184 SvxScriptSetItem aSetItem( nSlotId, mpView->GetDoc().GetPool() );
185 aSetItem.GetItemSet().Put( aAttrSet, false );
187 SvtScriptType nScriptType = mpView->GetScriptType();
189 if( (nSlotId == SID_ATTR_CHAR_FONT) || (nSlotId == SID_ATTR_CHAR_FONTHEIGHT) )
191 // input language should be preferred over
192 // current cursor position to detect script type
193 OutlinerView* pOLV = mpView->GetTextEditOutlinerView();
194 SdrOutliner *pOutliner = mpView->GetTextEditOutliner();
196 assert(mpViewShell);
198 if (OutlineView* pOView = dynamic_cast<OutlineView*>(mpView))
199 pOLV = pOView->GetViewByWindow(mpViewShell->GetActiveWindow());
201 if (pOutliner)
202 stretchY = pOutliner->getScalingParameters().fFontY;
204 if(pOLV && !pOLV->GetSelection().HasRange())
206 if (mpViewShell->GetViewShell() && mpViewShell->GetViewShell()->GetWindow())
208 LanguageType nInputLang = mpViewShell->GetViewShell()->GetWindow()->GetInputLanguage();
209 if(nInputLang != LANGUAGE_DONTKNOW && nInputLang != LANGUAGE_SYSTEM)
210 nScriptType = SvtLanguageOptions::GetScriptTypeOfLanguage( nInputLang );
215 const SfxPoolItem* pI = aSetItem.GetItemOfScript( nScriptType );
216 if( pI )
218 if( nSlotId == SID_ATTR_CHAR_FONTHEIGHT )
220 SvxFontHeightItem aFontItem = dynamic_cast<const SvxFontHeightItem&>(*pI);
221 aFontItem.SetHeight(aFontItem.GetHeight() * stretchY, 100, aFontItem.GetPropUnit());
222 aFontItem.SetWhich(nWhich);
223 aAttrSet.Put( aFontItem );
225 else
227 aAttrSet.Put( pI->CloneSetWhich(nWhich) );
230 else
232 aAttrSet.InvalidateItem( nWhich );
235 break;
237 case SID_STYLE_APPLY:
238 case SID_STYLE_FAMILY2:
240 SfxStyleSheet* pStyleSheet = mpView->GetStyleSheetFromMarked();
241 if( pStyleSheet )
242 rSet.Put( SfxTemplateItem( nWhich, pStyleSheet->GetName() ) );
243 else
245 rSet.Put( SfxTemplateItem( nWhich, OUString() ) );
248 break;
250 case SID_OUTLINE_LEFT:
251 case SID_OUTLINE_RIGHT:
252 case SID_OUTLINE_UP:
253 case SID_OUTLINE_DOWN:
255 bool bDisableLeft = true;
256 bool bDisableRight = true;
257 bool bDisableUp = true;
258 bool bDisableDown = true;
260 //fdo#78151 it doesn't make sense to promote or demote outline levels in master view.
261 const DrawViewShell* pDrawViewShell = dynamic_cast< DrawViewShell* >(mpViewShell);
262 const bool bInMasterView = pDrawViewShell && pDrawViewShell->GetEditMode() == EditMode::MasterPage;
264 if (!bInMasterView)
266 OutlinerView* pOLV = mpView->GetTextEditOutlinerView();
268 if (OutlineView* pOView = dynamic_cast<OutlineView*>(mpView))
269 pOLV = pOView->GetViewByWindow(mpViewShell->GetActiveWindow());
271 bool bOutlineViewSh = dynamic_cast< const OutlineViewShell *>( mpViewShell ) != nullptr;
273 if (pOLV)
275 // Outliner at outline-mode
276 ::Outliner* pOutl = pOLV->GetOutliner();
278 std::vector<Paragraph*> aSelList;
279 pOLV->CreateSelectionList(aSelList);
280 Paragraph* pPara = aSelList.empty() ? nullptr : *(aSelList.begin());
282 // find out if we are an OutlineView
283 bool bIsOutlineView(OutlinerMode::OutlineView == pOLV->GetOutliner()->GetOutlinerMode());
285 // This is ONLY for OutlineViews
286 if(bIsOutlineView)
288 // allow move up if position is 2 or greater OR it
289 // is a title object (and thus depth==1)
290 if(pOutl->GetAbsPos(pPara) > 1 || ( ::Outliner::HasParaFlag(pPara,ParaFlag::ISPAGE) && pOutl->GetAbsPos(pPara) > 0 ) )
292 // not at top
293 bDisableUp = false;
296 else
298 // old behaviour for OutlinerMode::OutlineObject
299 if(pOutl->GetAbsPos(pPara) > 0)
301 // not at top
302 bDisableUp = false;
306 for (const auto& rpItem : aSelList)
308 pPara = rpItem;
310 sal_Int16 nDepth = pOutl->GetDepth( pOutl->GetAbsPos( pPara ) );
312 if (nDepth > 0 || (bOutlineViewSh && (nDepth <= 0) && !::Outliner::HasParaFlag( pPara, ParaFlag::ISPAGE )) )
314 // not minimum depth
315 bDisableLeft = false;
318 if( (nDepth < pOLV->GetOutliner()->GetMaxDepth() && ( !bOutlineViewSh || pOutl->GetAbsPos(pPara) != 0 )) ||
319 (bOutlineViewSh && (nDepth <= 0) && ::Outliner::HasParaFlag( pPara, ParaFlag::ISPAGE ) && pOutl->GetAbsPos(pPara) != 0) )
321 // not maximum depth and not at top
322 bDisableRight = false;
326 if ( ( pOutl->GetAbsPos(pPara) < pOutl->GetParagraphCount() - 1 ) &&
327 ( pOutl->GetParagraphCount() > 1 || !bOutlineViewSh) )
329 // not last paragraph
330 bDisableDown = false;
333 // disable when first para and 2nd is not a title
334 pPara = aSelList.empty() ? nullptr : *(aSelList.begin());
336 if(!bDisableDown && bIsOutlineView
337 && pPara
338 && 0 == pOutl->GetAbsPos(pPara)
339 && pOutl->GetParagraphCount() > 1
340 && !::Outliner::HasParaFlag( pOutl->GetParagraph(1), ParaFlag::ISPAGE ) )
342 // Needs to be disabled
343 bDisableDown = true;
348 if (bDisableLeft)
349 rSet.DisableItem(SID_OUTLINE_LEFT);
350 if (bDisableRight)
351 rSet.DisableItem(SID_OUTLINE_RIGHT);
352 if (bDisableUp)
353 rSet.DisableItem(SID_OUTLINE_UP);
354 if (bDisableDown)
355 rSet.DisableItem(SID_OUTLINE_DOWN);
357 break;
359 case SID_TEXTDIRECTION_LEFT_TO_RIGHT:
360 case SID_TEXTDIRECTION_TOP_TO_BOTTOM:
362 if ( bDisableVerticalText )
364 rSet.DisableItem( SID_TEXTDIRECTION_LEFT_TO_RIGHT );
365 rSet.DisableItem( SID_TEXTDIRECTION_TOP_TO_BOTTOM );
367 else
369 bool bLeftToRight = true;
371 SdrOutliner* pOutl = mpView->GetTextEditOutliner();
372 if( pOutl )
374 if( pOutl->IsVertical() )
375 bLeftToRight = false;
377 else
378 bLeftToRight = aAttrSet.Get( SDRATTR_TEXTDIRECTION ).GetValue() == css::text::WritingMode_LR_TB;
380 rSet.Put( SfxBoolItem( SID_TEXTDIRECTION_LEFT_TO_RIGHT, bLeftToRight ) );
381 rSet.Put( SfxBoolItem( SID_TEXTDIRECTION_TOP_TO_BOTTOM, !bLeftToRight ) );
383 if( !bLeftToRight )
384 bDisableParagraphTextDirection = true;
387 break;
389 case SID_ULINE_VAL_NONE:
390 case SID_ULINE_VAL_SINGLE:
391 case SID_ULINE_VAL_DOUBLE:
392 case SID_ULINE_VAL_DOTTED:
394 if( aAttrSet.GetItemState( EE_CHAR_UNDERLINE ) >= SfxItemState::DEFAULT )
396 FontLineStyle eLineStyle = aAttrSet.Get(EE_CHAR_UNDERLINE).GetLineStyle();
398 switch (nSlotId)
400 case SID_ULINE_VAL_NONE:
401 rSet.Put(SfxBoolItem(nSlotId, eLineStyle == LINESTYLE_NONE));
402 break;
403 case SID_ULINE_VAL_SINGLE:
404 rSet.Put(SfxBoolItem(nSlotId, eLineStyle == LINESTYLE_SINGLE));
405 break;
406 case SID_ULINE_VAL_DOUBLE:
407 rSet.Put(SfxBoolItem(nSlotId, eLineStyle == LINESTYLE_DOUBLE));
408 break;
409 case SID_ULINE_VAL_DOTTED:
410 rSet.Put(SfxBoolItem(nSlotId, eLineStyle == LINESTYLE_DOTTED));
411 break;
415 break;
417 case SID_GROW_FONT_SIZE:
418 case SID_SHRINK_FONT_SIZE:
420 // todo
422 break;
424 case SID_THES:
426 if (mpView->GetTextEditOutlinerView())
428 EditView & rEditView = mpView->GetTextEditOutlinerView()->GetEditView();
429 OUString aStatusVal;
430 LanguageType nLang = LANGUAGE_NONE;
431 bool bIsLookUpWord = GetStatusValueForThesaurusFromContext( aStatusVal, nLang, rEditView );
432 rSet.Put( SfxStringItem( SID_THES, aStatusVal ) );
434 // disable "Thesaurus" context menu entry if there is nothing to look up
435 uno::Reference< linguistic2::XThesaurus > xThes( LinguMgr::GetThesaurus() );
436 if (!bIsLookUpWord ||
437 !xThes.is() || nLang == LANGUAGE_NONE || !xThes->hasLocale( LanguageTag( nLang). getLocale() ))
438 rSet.DisableItem( SID_THES );
440 else
442 rSet.DisableItem( SID_THES );
445 break;
447 default:
448 break;
451 nWhich = aIter.NextWhich();
454 rSet.Put( aAttrSet, false ); // <- sal_False, so DontCare-Status gets acquired
456 // these are disabled in outline-mode
457 if (!mpViewShell
458 || !(dynamic_cast<const DrawViewShell*>(mpViewShell)
459 || dynamic_cast<const NotesPanelViewShell*>(mpViewShell)))
461 rSet.DisableItem( SID_ATTR_PARA_ADJUST_LEFT );
462 rSet.DisableItem( SID_ATTR_PARA_ADJUST_RIGHT );
463 rSet.DisableItem( SID_ATTR_PARA_ADJUST_CENTER );
464 rSet.DisableItem( SID_ATTR_PARA_ADJUST_BLOCK );
465 rSet.DisableItem( SID_ATTR_PARA_LINESPACE_10 );
466 rSet.DisableItem( SID_ATTR_PARA_LINESPACE_15 );
467 rSet.DisableItem( SID_ATTR_PARA_LINESPACE_20 );
468 rSet.DisableItem( SID_DEC_INDENT );
469 rSet.DisableItem( SID_INC_INDENT );
470 rSet.DisableItem( SID_PARASPACE_INCREASE );
471 rSet.DisableItem( SID_PARASPACE_DECREASE );
472 rSet.DisableItem( SID_TEXTDIRECTION_TOP_TO_BOTTOM );
473 rSet.DisableItem( SID_TEXTDIRECTION_LEFT_TO_RIGHT );
474 rSet.DisableItem( SID_ATTR_PARA_LEFT_TO_RIGHT );
475 rSet.DisableItem( SID_ATTR_PARA_RIGHT_TO_LEFT );
477 else
479 // paragraph spacing
480 OutlinerView* pOLV = mpView->GetTextEditOutlinerView();
481 if( pOLV )
483 ESelection aSel = pOLV->GetSelection();
484 aSel.Adjust();
485 sal_Int32 nStartPara = aSel.start.nPara;
486 sal_Int32 nEndPara = aSel.end.nPara;
487 if( !aSel.HasRange() )
489 nStartPara = 0;
490 nEndPara = pOLV->GetOutliner()->GetParagraphCount() - 1;
492 ::tools::Long nUpper = 0;
494 for( sal_Int32 nPara = nStartPara; nPara <= nEndPara; nPara++ )
496 const SfxItemSet& rItems = pOLV->GetOutliner()->GetParaAttribs( nPara );
497 const SvxULSpaceItem& rItem = rItems.Get( EE_PARA_ULSPACE );
498 nUpper = std::max( nUpper, static_cast<::tools::Long>(rItem.GetUpper()) );
500 if( nUpper == 0 )
501 rSet.DisableItem( SID_PARASPACE_DECREASE );
503 else
505 // never disabled at the moment!
506 //rSet.DisableItem( SID_PARASPACE_INCREASE );
507 //rSet.DisableItem( SID_PARASPACE_DECREASE );
510 // paragraph justification
511 const SvxLRSpaceItem& aLR = aAttrSet.Get( EE_PARA_LRSPACE );
512 rSet.Put(aLR);
513 SvxAdjust eAdj = aAttrSet.Get( EE_PARA_JUST ).GetAdjust();
514 switch( eAdj )
516 case SvxAdjust::Left:
517 rSet.Put( SfxBoolItem( SID_ATTR_PARA_ADJUST_LEFT, true ) );
518 rSet.Put( SfxBoolItem( SID_ATTR_PARA_ADJUST_CENTER, false ) );
519 rSet.Put( SfxBoolItem( SID_ATTR_PARA_ADJUST_RIGHT, false ) );
520 rSet.Put( SfxBoolItem( SID_ATTR_PARA_ADJUST_BLOCK, false ) );
521 break;
522 case SvxAdjust::Center:
523 rSet.Put( SfxBoolItem( SID_ATTR_PARA_ADJUST_CENTER, true ) );
524 rSet.Put( SfxBoolItem( SID_ATTR_PARA_ADJUST_LEFT, false ) );
525 rSet.Put( SfxBoolItem( SID_ATTR_PARA_ADJUST_RIGHT, false ) );
526 rSet.Put( SfxBoolItem( SID_ATTR_PARA_ADJUST_BLOCK, false ) );
527 break;
528 case SvxAdjust::Right:
529 rSet.Put( SfxBoolItem( SID_ATTR_PARA_ADJUST_RIGHT, true ) );
530 rSet.Put( SfxBoolItem( SID_ATTR_PARA_ADJUST_CENTER, false ) );
531 rSet.Put( SfxBoolItem( SID_ATTR_PARA_ADJUST_LEFT, false ) );
532 rSet.Put( SfxBoolItem( SID_ATTR_PARA_ADJUST_BLOCK, false ) );
533 break;
534 case SvxAdjust::Block:
535 rSet.Put( SfxBoolItem( SID_ATTR_PARA_ADJUST_BLOCK, true ) );
536 rSet.Put( SfxBoolItem( SID_ATTR_PARA_ADJUST_CENTER, false ) );
537 rSet.Put( SfxBoolItem( SID_ATTR_PARA_ADJUST_RIGHT, false ) );
538 rSet.Put( SfxBoolItem( SID_ATTR_PARA_ADJUST_LEFT, false ) );
539 break;
540 default:
541 break;
544 if(pTextObjectBar)
546 pTextObjectBar->Invalidate(SID_ATTR_PARA_ADJUST_LEFT);
547 pTextObjectBar->Invalidate(SID_ATTR_PARA_ADJUST_CENTER);
548 pTextObjectBar->Invalidate(SID_ATTR_PARA_ADJUST_RIGHT);
549 pTextObjectBar->Invalidate(SID_ATTR_PARA_ADJUST_BLOCK);
550 pTextObjectBar->Invalidate(SID_ATTR_PARA_LINESPACE);
551 pTextObjectBar->Invalidate(SID_ATTR_PARA_ULSPACE);
554 // paragraph text direction
555 if( bDisableParagraphTextDirection )
557 rSet.DisableItem( SID_ATTR_PARA_LEFT_TO_RIGHT );
558 rSet.DisableItem( SID_ATTR_PARA_RIGHT_TO_LEFT );
560 else
562 switch( aAttrSet.Get( EE_PARA_WRITINGDIR ).GetValue() )
564 case SvxFrameDirection::Vertical_LR_TB:
565 case SvxFrameDirection::Vertical_RL_TB:
567 rSet.DisableItem( SID_ATTR_PARA_LEFT_TO_RIGHT );
568 rSet.DisableItem( SID_ATTR_PARA_RIGHT_TO_LEFT );
570 break;
572 case SvxFrameDirection::Horizontal_LR_TB:
573 rSet.Put( SfxBoolItem( SID_ATTR_PARA_LEFT_TO_RIGHT, true ) );
574 rSet.Put( SfxBoolItem( SID_ATTR_PARA_RIGHT_TO_LEFT, false ) );
575 break;
577 case SvxFrameDirection::Horizontal_RL_TB:
578 rSet.Put( SfxBoolItem( SID_ATTR_PARA_LEFT_TO_RIGHT, false ) );
579 rSet.Put( SfxBoolItem( SID_ATTR_PARA_RIGHT_TO_LEFT, true ) );
580 break;
582 // The case for the superordinate object is missing.
583 case SvxFrameDirection::Environment:
585 SdDrawDocument& rDoc = mpView->GetDoc();
586 css::text::WritingMode eMode = rDoc.GetDefaultWritingMode();
587 bool bIsLeftToRight(false);
589 if(css::text::WritingMode_LR_TB == eMode
590 || css::text::WritingMode_TB_RL == eMode)
592 bIsLeftToRight = true;
595 rSet.Put( SfxBoolItem( SID_ATTR_PARA_LEFT_TO_RIGHT, bIsLeftToRight ) );
596 rSet.Put( SfxBoolItem( SID_ATTR_PARA_RIGHT_TO_LEFT, !bIsLeftToRight ) );
598 break;
599 default: break;
603 SvxLRSpaceItem aLRSpace = aAttrSet.Get( EE_PARA_LRSPACE );
604 aLRSpace.SetWhich(SID_ATTR_PARA_LRSPACE);
605 rSet.Put(aLRSpace);
606 if (pTextObjectBar)
607 pTextObjectBar->Invalidate(SID_ATTR_PARA_LRSPACE);
609 //Added by xuxu
610 SfxItemState eState = aAttrSet.GetItemState( EE_PARA_LRSPACE );
611 if ( eState == SfxItemState::INVALID )
613 rSet.InvalidateItem(EE_PARA_LRSPACE);
614 rSet.InvalidateItem(SID_ATTR_PARA_LRSPACE);
616 sal_uInt16 nLineSpace = aAttrSet.Get( EE_PARA_SBL ).GetPropLineSpace();
617 switch( nLineSpace )
619 case 100:
620 rSet.Put( SfxBoolItem( SID_ATTR_PARA_LINESPACE_10, true ) );
621 rSet.Put( SfxBoolItem( SID_ATTR_PARA_LINESPACE_15, false ) );
622 rSet.Put( SfxBoolItem( SID_ATTR_PARA_LINESPACE_20, false ) );
623 break;
624 case 150:
625 rSet.Put( SfxBoolItem( SID_ATTR_PARA_LINESPACE_15, true ) );
626 rSet.Put( SfxBoolItem( SID_ATTR_PARA_LINESPACE_10, false ) );
627 rSet.Put( SfxBoolItem( SID_ATTR_PARA_LINESPACE_20, false ) );
628 break;
629 case 200:
630 rSet.Put( SfxBoolItem( SID_ATTR_PARA_LINESPACE_20, true ) );
631 rSet.Put( SfxBoolItem( SID_ATTR_PARA_LINESPACE_10, false ) );
632 rSet.Put( SfxBoolItem( SID_ATTR_PARA_LINESPACE_15, false ) );
633 break;
637 // justification (superscript, subscript) is also needed in outline-mode
638 SvxEscapement eEsc = static_cast<SvxEscapement>(aAttrSet.Get( EE_CHAR_ESCAPEMENT ).GetEnumValue());
639 rSet.Put(SfxBoolItem(SID_SET_SUPER_SCRIPT, eEsc == SvxEscapement::Superscript));
640 rSet.Put(SfxBoolItem(SID_SET_SUB_SCRIPT, eEsc == SvxEscapement::Subscript));
642 SvxCaseMap eCaseMap = aAttrSet.Get(EE_CHAR_CASEMAP).GetCaseMap();
643 rSet.Put(SfxBoolItem(SID_SET_SMALL_CAPS, eCaseMap == SvxCaseMap::SmallCaps));
646 } // end of namespace sd
648 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */