bump product version to 5.0.4.1
[LibreOffice.git] / sd / source / ui / view / drtxtob1.cxx
blob09a4a594be7a7523830cf6486e0c379e56dcdaf8
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 <editeng/editview.hxx>
25 #include <editeng/editeng.hxx>
26 #include <editeng/unolingu.hxx>
27 #include <editeng/outliner.hxx>
28 #include <editeng/ulspitem.hxx>
29 #include <editeng/lspcitem.hxx>
30 #include <editeng/adjustitem.hxx>
31 #include <vcl/vclenum.hxx>
32 #include <sfx2/app.hxx>
33 #include <svl/whiter.hxx>
34 #include <svl/itempool.hxx>
35 #include <svl/style.hxx>
36 #include <sfx2/tplpitem.hxx>
37 #include <sfx2/request.hxx>
38 #include <sfx2/viewfrm.hxx>
39 #include <sfx2/dispatch.hxx>
40 #include <editeng/escapementitem.hxx>
41 #include <editeng/wghtitem.hxx>
42 #include <editeng/postitem.hxx>
43 #include <editeng/udlnitem.hxx>
44 #include <editeng/crossedoutitem.hxx>
45 #include <editeng/contouritem.hxx>
46 #include <editeng/shdditem.hxx>
47 #include <svx/xtable.hxx>
48 #include <svx/svdobj.hxx>
49 #include <editeng/outlobj.hxx>
50 #include <editeng/flstitem.hxx>
51 #include <svl/intitem.hxx>
52 #include <editeng/scripttypeitem.hxx>
53 #include <svx/svdoutl.hxx>
54 #include <editeng/writingmodeitem.hxx>
55 #include <editeng/frmdiritem.hxx>
56 #include <svl/itemiter.hxx>
57 #include <editeng/cmapitem.hxx>
59 #include "app.hrc"
60 #include "glob.hrc"
61 #include "sdresid.hxx"
62 #include "prlayout.hxx"
63 #include "ViewShell.hxx"
64 #include "drawview.hxx"
65 #include "drawdoc.hxx"
66 #include "stlpool.hxx"
67 #include "stlsheet.hxx"
68 #include "OutlineView.hxx"
69 #include "Window.hxx"
70 #include "futempl.hxx"
71 #include "DrawDocShell.hxx"
72 #include "Outliner.hxx"
73 #include "futext.hxx"
75 #include <boost/scoped_ptr.hpp>
77 namespace sd {
79 /**
80 * Process SfxRequests
83 void TextObjectBar::Execute( SfxRequest &rReq )
85 const SfxItemSet* pArgs = rReq.GetArgs();
86 const SfxPoolItem* pPoolItem = NULL;
87 sal_uInt16 nSlot = rReq.GetSlot();
88 OutlinerView* pOLV = mpView->GetTextEditOutlinerView();
90 boost::scoped_ptr< OutlineViewModelChangeGuard > aGuard;
92 if (mpView->ISA(OutlineView))
94 pOLV = static_cast<OutlineView*>(mpView)
95 ->GetViewByWindow(mpViewShell->GetActiveWindow());
97 aGuard.reset( new OutlineViewModelChangeGuard( static_cast<OutlineView&>(*mpView) ) );
100 switch (nSlot)
102 case SID_STYLE_APPLY:
104 if( pArgs )
106 SdDrawDocument& rDoc = mpView->GetDoc();
107 assert(mpViewShell->GetViewShell());
108 rtl::Reference<FuPoor> xFunc( FuTemplate::Create( mpViewShell, static_cast< ::sd::Window*>( mpViewShell->GetViewShell()->GetWindow()), mpView, &rDoc, rReq ) );
110 if(xFunc.is())
112 xFunc->Activate();
113 xFunc->Deactivate();
115 if( rReq.GetSlot() == SID_STYLE_APPLY )
117 if (mpViewShell->GetViewFrame())
118 mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_STYLE_APPLY );
122 else
124 if( mpViewShell && mpViewShell->GetViewFrame() )
125 mpViewShell->GetViewFrame()->GetDispatcher()->Execute( SID_STYLE_DESIGNER, SfxCallMode::ASYNCHRON );
128 rReq.Done();
130 break;
132 case SID_PARASPACE_INCREASE:
133 case SID_PARASPACE_DECREASE:
135 if( pOLV )
137 ESelection aSel = pOLV->GetSelection();
138 aSel.Adjust();
139 sal_Int32 nStartPara = aSel.nStartPara;
140 sal_Int32 nEndPara = aSel.nEndPara;
141 if( !aSel.HasRange() )
143 nStartPara = 0;
144 nEndPara = pOLV->GetOutliner()->GetParagraphCount() - 1;
146 for( sal_Int32 nPara = nStartPara; nPara <= nEndPara; nPara++ )
148 SfxStyleSheet* pStyleSheet = NULL;
149 if (pOLV->GetOutliner() != NULL)
150 pStyleSheet = pOLV->GetOutliner()->GetStyleSheet(nPara);
151 if (pStyleSheet != NULL)
153 SfxItemSet aAttr( pStyleSheet->GetItemSet() );
154 SfxItemSet aTmpSet( pOLV->GetOutliner()->GetParaAttribs( nPara ) );
155 aAttr.Put( aTmpSet, false ); // sal_False= InvalidItems is not default, handle it as "holes"
156 const SvxULSpaceItem& rItem = static_cast<const SvxULSpaceItem&>( aAttr.Get( EE_PARA_ULSPACE ) );
157 boost::scoped_ptr<SvxULSpaceItem> pNewItem(static_cast<SvxULSpaceItem*>(rItem.Clone()));
159 long nUpper = pNewItem->GetUpper();
160 if( nSlot == SID_PARASPACE_INCREASE )
161 nUpper += 100;
162 else
164 nUpper -= 100;
165 nUpper = std::max( (long) nUpper, 0L );
167 pNewItem->SetUpper( (sal_uInt16) nUpper );
169 long nLower = pNewItem->GetLower();
170 if( nSlot == SID_PARASPACE_INCREASE )
171 nLower += 100;
172 else
174 nLower -= 100;
175 nLower = std::max( (long) nLower, 0L );
177 pNewItem->SetLower( (sal_uInt16) nLower );
179 SfxItemSet aNewAttrs( aAttr );
180 aNewAttrs.Put( *pNewItem );
181 pNewItem.reset();
182 pOLV->GetOutliner()->SetParaAttribs( nPara, aNewAttrs );
186 else
188 // the following code could be enabled, if I get a correct
189 // DontCare status from JOE.
191 // gets enabled, through it doesn't really work (see above)
192 SfxItemSet aEditAttr( mpView->GetDoc().GetPool() );
193 mpView->GetAttributes( aEditAttr );
194 if( aEditAttr.GetItemState( EE_PARA_ULSPACE ) >= SfxItemState::DEFAULT )
196 SfxItemSet aNewAttrs(*(aEditAttr.GetPool()), aEditAttr.GetRanges());
197 const SvxULSpaceItem& rItem = static_cast<const SvxULSpaceItem&>( aEditAttr.Get( EE_PARA_ULSPACE ) );
198 boost::scoped_ptr<SvxULSpaceItem> pNewItem(static_cast<SvxULSpaceItem*>( rItem.Clone() ));
199 long nUpper = pNewItem->GetUpper();
201 if( nSlot == SID_PARASPACE_INCREASE )
202 nUpper += 100;
203 else
205 nUpper -= 100;
206 nUpper = std::max( (long) nUpper, 0L );
208 pNewItem->SetUpper( (sal_uInt16) nUpper );
210 long nLower = pNewItem->GetLower();
211 if( nSlot == SID_PARASPACE_INCREASE )
212 nLower += 100;
213 else
215 nLower -= 100;
216 nLower = std::max( (long) nLower, 0L );
218 pNewItem->SetLower( (sal_uInt16) nLower );
220 aNewAttrs.Put( *pNewItem );
221 pNewItem.reset();
223 mpView->SetAttributes( aNewAttrs );
226 rReq.Done();
228 Invalidate();
229 // to refresh preview (in outline mode), slot has to be invalidated:
230 mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_PREVIEW_STATE, true, false );
232 break;
234 case SID_OUTLINE_LEFT:
236 if (pOLV)
238 pOLV->AdjustDepth( -1 );
240 // Ensure bold/italic etc. icon state updates
241 Invalidate();
242 // trigger preview refresh
243 mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_PREVIEW_STATE, true, false );
245 rReq.Done();
247 break;
249 case SID_OUTLINE_RIGHT:
251 if (pOLV)
253 pOLV->AdjustDepth( 1 );
255 // Ensure bold/italic etc. icon state updates
256 Invalidate();
257 // trigger preview refresh
258 mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_PREVIEW_STATE, true, false );
260 rReq.Done();
262 break;
264 case SID_ATTR_PARA_LRSPACE:
266 sal_uInt16 nSpaceSlot = SID_ATTR_PARA_LRSPACE;
267 SvxLRSpaceItem aLRSpace = static_cast<const SvxLRSpaceItem&>(pArgs->Get(
268 GetPool().GetWhich(nSpaceSlot)));
270 SfxItemSet aEditAttr( GetPool(), EE_PARA_LRSPACE, EE_PARA_LRSPACE );
271 aLRSpace.SetWhich( EE_PARA_LRSPACE );
273 aEditAttr.Put( aLRSpace );
274 mpView->SetAttributes( aEditAttr );
276 Invalidate(SID_ATTR_PARA_LRSPACE);
278 break;
280 case SID_OUTLINE_UP:
282 if (pOLV)
284 pOLV->AdjustHeight( -1 );
286 // trigger preview refresh
287 mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_PREVIEW_STATE, true, false );
289 rReq.Done();
291 break;
293 case SID_OUTLINE_DOWN:
295 if (pOLV)
297 pOLV->AdjustHeight( 1 );
299 // trigger preview refresh
300 mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_PREVIEW_STATE, true, false );
302 rReq.Done();
304 break;
306 case SID_TEXTDIRECTION_LEFT_TO_RIGHT:
307 case SID_TEXTDIRECTION_TOP_TO_BOTTOM:
309 mpView->SdrEndTextEdit();
310 SfxItemSet aAttr( mpView->GetDoc().GetPool(), SDRATTR_TEXTDIRECTION, SDRATTR_TEXTDIRECTION, 0 );
311 aAttr.Put( SvxWritingModeItem(
312 nSlot == SID_TEXTDIRECTION_LEFT_TO_RIGHT ?
313 com::sun::star::text::WritingMode_LR_TB : com::sun::star::text::WritingMode_TB_RL,
314 SDRATTR_TEXTDIRECTION ) );
315 rReq.Done( aAttr );
316 mpView->SetAttributes( aAttr );
317 Invalidate();
318 mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_PREVIEW_STATE, true, false );
320 break;
322 case FN_NUM_BULLET_ON:
324 if (pOLV)
326 bool bMasterPage = false;
327 SdrPageView* pPageView = mpView->GetSdrPageView();
328 if (pPageView)
330 SdPage* pPage = static_cast<SdPage*>(pPageView->GetPage());
331 bMasterPage = pPage && (pPage->GetPageKind() == PK_STANDARD) && pPage->IsMasterPage();
334 if (!bMasterPage)
335 pOLV->ToggleBullets();
336 else
338 //Resolves: fdo#78151 in master pages if we toggle bullets on
339 //and off then just disable/enable the bulleting, but do not
340 //change the *level* of the paragraph, because the paragraph is
341 //effectively a preview of the equivalent style level, and
342 //changing the level disconnects it from the style
344 ::Outliner* pOL = pOLV->GetOutliner();
345 if (pOL)
347 const SvxNumBulletItem *pItem = NULL;
348 SfxStyleSheetBasePool* pSSPool = mpView->GetDocSh()->GetStyleSheetPool();
349 OUString sStyleName(SD_RESSTR(STR_PSEUDOSHEET_OUTLINE) + " 1");
350 SfxStyleSheetBase* pFirstStyleSheet = pSSPool->Find(sStyleName, SD_STYLE_FAMILY_PSEUDO);
351 if( pFirstStyleSheet )
352 pFirstStyleSheet->GetItemSet().GetItemState(EE_PARA_NUMBULLET, false, reinterpret_cast<const SfxPoolItem**>(&pItem));
354 if (pItem )
356 SvxNumRule aNewRule(*pItem->GetNumRule());
357 ESelection aSel = pOLV->GetSelection();
358 aSel.Adjust();
359 sal_Int32 nStartPara = aSel.nStartPara;
360 sal_Int32 nEndPara = aSel.nEndPara;
361 for (sal_Int32 nPara = nStartPara; nPara <= nEndPara; ++nPara)
363 sal_uInt16 nLevel = pOL->GetDepth(nPara);
364 SvxNumberFormat aFmt(aNewRule.GetLevel(nLevel));
366 if (aFmt.GetNumberingType() == SVX_NUM_NUMBER_NONE)
368 aFmt.SetNumberingType(SVX_NUM_CHAR_SPECIAL);
369 SdStyleSheetPool::setDefaultOutlineNumberFormatBulletAndIndent(nLevel, aFmt);
371 else
373 aFmt.SetNumberingType(SVX_NUM_NUMBER_NONE);
374 aFmt.SetAbsLSpace(0);
375 aFmt.SetFirstLineOffset(0);
378 aNewRule.SetLevel(nLevel, aFmt);
381 pFirstStyleSheet->GetItemSet().Put(SvxNumBulletItem(aNewRule, EE_PARA_NUMBULLET));
383 SdStyleSheet::BroadcastSdStyleSheetChange(pFirstStyleSheet, PO_OUTLINE_1, pSSPool);
388 break;
390 case SID_GROW_FONT_SIZE:
391 case SID_SHRINK_FONT_SIZE:
393 const SvxFontListItem* pFonts = static_cast<const SvxFontListItem*>(mpViewShell->GetDocSh()->GetItem( SID_ATTR_CHAR_FONTLIST ));
394 const FontList* pFontList = pFonts ? pFonts->GetFontList(): 0;
395 if( pFontList )
397 FuText::ChangeFontSize( nSlot == SID_GROW_FONT_SIZE, pOLV, pFontList, mpView );
398 if( pOLV )
399 pOLV->SetAttribs( pOLV->GetEditView().GetEmptyItemSet() );
400 mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_ATTR_CHAR_FONTHEIGHT );
402 rReq.Done();
404 break;
406 case SID_THES:
408 OUString aReplaceText;
409 SFX_REQUEST_ARG( rReq, pItem2, SfxStringItem, SID_THES, false );
410 if (pItem2)
411 aReplaceText = pItem2->GetValue();
412 if (!aReplaceText.isEmpty())
413 ReplaceTextWithSynonym( pOLV->GetEditView(), aReplaceText );
415 break;
417 default:
419 SfxItemSet aEditAttr( mpView->GetDoc().GetPool() );
420 mpView->GetAttributes( aEditAttr );
421 SfxItemSet aNewAttr(*(aEditAttr.GetPool()), aEditAttr.GetRanges());
423 if( !pArgs )
425 //aNewAttr.InvalidateAllItems(); <- produces problems (#35465#)
427 switch ( nSlot )
429 case SID_ATTR_CHAR_WEIGHT:
431 FontWeight eFW = static_cast<const SvxWeightItem&>( aEditAttr.
432 Get( EE_CHAR_WEIGHT ) ).GetWeight();
433 aNewAttr.Put( SvxWeightItem( eFW == WEIGHT_NORMAL ?
434 WEIGHT_BOLD : WEIGHT_NORMAL,
435 EE_CHAR_WEIGHT ) );
437 break;
438 case SID_ATTR_CHAR_POSTURE:
440 FontItalic eFI = static_cast<const SvxPostureItem&>( aEditAttr.
441 Get( EE_CHAR_ITALIC ) ).GetPosture();
442 aNewAttr.Put( SvxPostureItem( eFI == ITALIC_NORMAL ?
443 ITALIC_NONE : ITALIC_NORMAL,
444 EE_CHAR_ITALIC ) );
446 break;
447 case SID_ATTR_CHAR_UNDERLINE:
449 FontUnderline eFU = static_cast<const SvxUnderlineItem&>( aEditAttr.
450 Get( EE_CHAR_UNDERLINE ) ).GetLineStyle();
451 aNewAttr.Put( SvxUnderlineItem( eFU == UNDERLINE_SINGLE ?
452 UNDERLINE_NONE : UNDERLINE_SINGLE,
453 EE_CHAR_UNDERLINE ) );
455 break;
456 case SID_ATTR_CHAR_OVERLINE:
458 FontUnderline eFO = static_cast<const SvxOverlineItem&>( aEditAttr.
459 Get( EE_CHAR_OVERLINE ) ).GetLineStyle();
460 aNewAttr.Put( SvxOverlineItem( eFO == UNDERLINE_SINGLE ?
461 UNDERLINE_NONE : UNDERLINE_SINGLE,
462 EE_CHAR_OVERLINE ) );
464 break;
465 case SID_ATTR_CHAR_CONTOUR:
467 aNewAttr.Put( SvxContourItem( !static_cast<const SvxContourItem&>( aEditAttr.
468 Get( EE_CHAR_OUTLINE ) ).GetValue(), EE_CHAR_OUTLINE ) );
470 break;
471 case SID_ATTR_CHAR_SHADOWED:
473 aNewAttr.Put( SvxShadowedItem( !static_cast<const SvxShadowedItem&>( aEditAttr.
474 Get( EE_CHAR_SHADOW ) ).GetValue(), EE_CHAR_SHADOW ) );
476 break;
477 case SID_ATTR_CHAR_CASEMAP:
479 aNewAttr.Put( SvxCaseMapItem( static_cast<const SvxCaseMapItem&>( aEditAttr.
480 Get( EE_CHAR_CASEMAP ) ) ) );
482 break;
483 case SID_ATTR_CHAR_STRIKEOUT:
485 FontStrikeout eFSO = ( static_cast<const SvxCrossedOutItem&>( aEditAttr.
486 Get( EE_CHAR_STRIKEOUT ) ).GetStrikeout() );
487 aNewAttr.Put( SvxCrossedOutItem( eFSO == STRIKEOUT_SINGLE ?
488 STRIKEOUT_NONE : STRIKEOUT_SINGLE, EE_CHAR_STRIKEOUT ) );
490 break;
492 case SID_ATTR_PARA_ADJUST_LEFT:
494 aNewAttr.Put( SvxAdjustItem( SVX_ADJUST_LEFT, EE_PARA_JUST ) );
496 break;
497 case SID_ATTR_PARA_ADJUST_CENTER:
499 aNewAttr.Put( SvxAdjustItem( SVX_ADJUST_CENTER, EE_PARA_JUST ) );
501 break;
502 case SID_ATTR_PARA_ADJUST_RIGHT:
504 aNewAttr.Put( SvxAdjustItem( SVX_ADJUST_RIGHT, EE_PARA_JUST ) );
506 break;
507 case SID_ATTR_PARA_ADJUST_BLOCK:
509 aNewAttr.Put( SvxAdjustItem( SVX_ADJUST_BLOCK, EE_PARA_JUST ) );
511 break;
512 case SID_ATTR_PARA_LINESPACE_10:
514 SvxLineSpacingItem aItem( SVX_LINESPACE_ONE_LINE, EE_PARA_SBL );
515 aItem.SetPropLineSpace( 100 );
516 aNewAttr.Put( aItem );
518 break;
519 case SID_ATTR_PARA_LINESPACE_15:
521 SvxLineSpacingItem aItem( SVX_LINESPACE_ONE_POINT_FIVE_LINES, EE_PARA_SBL );
522 aItem.SetPropLineSpace( 150 );
523 aNewAttr.Put( aItem );
525 break;
526 case SID_ATTR_PARA_LINESPACE_20:
528 SvxLineSpacingItem aItem( SVX_LINESPACE_TWO_LINES, EE_PARA_SBL );
529 aItem.SetPropLineSpace( 200 );
530 aNewAttr.Put( aItem );
532 break;
533 case SID_SET_SUPER_SCRIPT:
535 SvxEscapementItem aItem( EE_CHAR_ESCAPEMENT );
536 SvxEscapement eEsc = (SvxEscapement ) static_cast<const SvxEscapementItem&>(
537 aEditAttr.Get( EE_CHAR_ESCAPEMENT ) ).GetEnumValue();
539 if( eEsc == SVX_ESCAPEMENT_SUPERSCRIPT )
540 aItem.SetEscapement( SVX_ESCAPEMENT_OFF );
541 else
542 aItem.SetEscapement( SVX_ESCAPEMENT_SUPERSCRIPT );
543 aNewAttr.Put( aItem );
545 break;
546 case SID_SET_SUB_SCRIPT:
548 SvxEscapementItem aItem( EE_CHAR_ESCAPEMENT );
549 SvxEscapement eEsc = (SvxEscapement ) static_cast<const SvxEscapementItem&>(
550 aEditAttr.Get( EE_CHAR_ESCAPEMENT ) ).GetEnumValue();
552 if( eEsc == SVX_ESCAPEMENT_SUBSCRIPT )
553 aItem.SetEscapement( SVX_ESCAPEMENT_OFF );
554 else
555 aItem.SetEscapement( SVX_ESCAPEMENT_SUBSCRIPT );
556 aNewAttr.Put( aItem );
558 break;
560 // attributes for TextObjectBar
561 case SID_ATTR_CHAR_FONT:
562 mpViewShell->GetViewFrame()->GetDispatcher()->
563 Execute( SID_CHAR_DLG, SfxCallMode::ASYNCHRON );
564 break;
565 case SID_ATTR_CHAR_FONTHEIGHT:
566 mpViewShell->GetViewFrame()->GetDispatcher()->
567 Execute( SID_CHAR_DLG, SfxCallMode::ASYNCHRON );
568 break;
569 case SID_ATTR_CHAR_COLOR:
570 break;
571 // #i35937# removed need for FN_NUM_BULLET_ON handling
574 rReq.Done( aNewAttr );
575 pArgs = rReq.GetArgs();
577 else if ( nSlot == SID_ATTR_PARA_LEFT_TO_RIGHT ||
578 nSlot == SID_ATTR_PARA_RIGHT_TO_LEFT )
580 bool bLeftToRight = nSlot == SID_ATTR_PARA_LEFT_TO_RIGHT;
582 sal_uInt16 nAdjust = SVX_ADJUST_LEFT;
583 if( SfxItemState::SET == aEditAttr.GetItemState(EE_PARA_JUST, true, &pPoolItem ) )
584 nAdjust = static_cast<const SvxAdjustItem*>(pPoolItem)->GetEnumValue();
586 if( bLeftToRight )
588 aNewAttr.Put( SvxFrameDirectionItem( FRMDIR_HORI_LEFT_TOP, EE_PARA_WRITINGDIR ) );
589 if( nAdjust == SVX_ADJUST_RIGHT )
590 aNewAttr.Put( SvxAdjustItem( SVX_ADJUST_LEFT, EE_PARA_JUST ) );
592 else
594 aNewAttr.Put( SvxFrameDirectionItem( FRMDIR_HORI_RIGHT_TOP, EE_PARA_WRITINGDIR ) );
595 if( nAdjust == SVX_ADJUST_LEFT )
596 aNewAttr.Put( SvxAdjustItem( SVX_ADJUST_RIGHT, EE_PARA_JUST ) );
599 rReq.Done( aNewAttr );
600 pArgs = rReq.GetArgs();
602 Invalidate( SID_RULER_TEXT_RIGHT_TO_LEFT );
604 else if ( nSlot == SID_ATTR_CHAR_FONT ||
605 nSlot == SID_ATTR_CHAR_FONTHEIGHT ||
606 nSlot == SID_ATTR_CHAR_POSTURE ||
607 nSlot == SID_ATTR_CHAR_WEIGHT )
609 // #i78017 establish the same behaviour as in Writer
610 SvtScriptType nScriptType = SvtScriptType::LATIN | SvtScriptType::ASIAN | SvtScriptType::COMPLEX;
611 if (nSlot == SID_ATTR_CHAR_FONT)
612 nScriptType = mpView->GetScriptType();
614 SfxItemPool& rPool = mpView->GetDoc().GetPool();
615 SvxScriptSetItem aSvxScriptSetItem( nSlot, rPool );
616 aSvxScriptSetItem.PutItemForScriptType( nScriptType, pArgs->Get( rPool.GetWhich( nSlot ) ) );
617 aNewAttr.Put( aSvxScriptSetItem.GetItemSet() );
618 rReq.Done( aNewAttr );
619 pArgs = rReq.GetArgs();
621 else if (nSlot == SID_ATTR_PARA_ADJUST_LEFT ||
622 nSlot == SID_ATTR_PARA_ADJUST_CENTER ||
623 nSlot == SID_ATTR_PARA_ADJUST_RIGHT ||
624 nSlot == SID_ATTR_PARA_ADJUST_BLOCK)
626 switch( nSlot )
628 case SID_ATTR_PARA_ADJUST_LEFT:
630 aNewAttr.Put( SvxAdjustItem( SVX_ADJUST_LEFT, EE_PARA_JUST ) );
632 break;
633 case SID_ATTR_PARA_ADJUST_CENTER:
635 aNewAttr.Put( SvxAdjustItem( SVX_ADJUST_CENTER, EE_PARA_JUST ) );
637 break;
638 case SID_ATTR_PARA_ADJUST_RIGHT:
640 aNewAttr.Put( SvxAdjustItem( SVX_ADJUST_RIGHT, EE_PARA_JUST ) );
642 break;
643 case SID_ATTR_PARA_ADJUST_BLOCK:
645 aNewAttr.Put( SvxAdjustItem( SVX_ADJUST_BLOCK, EE_PARA_JUST ) );
647 break;
649 rReq.Done( aNewAttr );
650 pArgs = rReq.GetArgs();
652 else if(nSlot == SID_ATTR_CHAR_KERNING)
654 aNewAttr.Put(pArgs->Get(pArgs->GetPool()->GetWhich(nSlot)));
655 rReq.Done( aNewAttr );
656 pArgs = rReq.GetArgs();
658 else if(nSlot == SID_SET_SUPER_SCRIPT )
660 SvxEscapementItem aItem(EE_CHAR_ESCAPEMENT);
661 SvxEscapement eEsc = (SvxEscapement) static_cast<const SvxEscapementItem&>(
662 aEditAttr.Get( EE_CHAR_ESCAPEMENT ) ).GetEnumValue();
664 if( eEsc == SVX_ESCAPEMENT_SUPERSCRIPT )
665 aItem.SetEscapement( SVX_ESCAPEMENT_OFF );
666 else
667 aItem.SetEscapement( SVX_ESCAPEMENT_SUPERSCRIPT );
668 aNewAttr.Put( aItem );
669 rReq.Done( aNewAttr );
670 pArgs = rReq.GetArgs();
672 else if( nSlot == SID_SET_SUB_SCRIPT )
674 SvxEscapementItem aItem(EE_CHAR_ESCAPEMENT);
675 SvxEscapement eEsc = (SvxEscapement) static_cast<const SvxEscapementItem&>(
676 aEditAttr.Get( EE_CHAR_ESCAPEMENT ) ).GetEnumValue();
678 if( eEsc == SVX_ESCAPEMENT_SUBSCRIPT )
679 aItem.SetEscapement( SVX_ESCAPEMENT_OFF );
680 else
681 aItem.SetEscapement( SVX_ESCAPEMENT_SUBSCRIPT );
682 aNewAttr.Put( aItem );
683 rReq.Done( aNewAttr );
684 pArgs = rReq.GetArgs();
687 mpView->SetAttributes(*pArgs);
689 // invalidate entire shell because of performance and
690 // extension reasons
691 Invalidate();
693 // to refresh preview (in outline mode), slot has to be invalidated:
694 mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_PREVIEW_STATE, true, false );
696 break;
699 Invalidate( SID_OUTLINE_LEFT );
700 Invalidate( SID_OUTLINE_RIGHT );
701 Invalidate( SID_OUTLINE_UP );
702 Invalidate( SID_OUTLINE_DOWN );
705 } // end of namespace sd
707 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */