xref: /core/sd/source/ui/view/drtxtob1.cxx (revision a7ceb335)
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 <TextObjectBar.hxx>
21 
22 #include <svx/svxids.hrc>
23 
24 #include <editeng/eeitem.hxx>
25 #include <editeng/editview.hxx>
26 #include <editeng/editeng.hxx>
27 #include <editeng/unolingu.hxx>
28 #include <editeng/outliner.hxx>
29 #include <editeng/ulspitem.hxx>
30 #include <editeng/lspcitem.hxx>
31 #include <editeng/adjustitem.hxx>
32 #include <editeng/numitem.hxx>
33 #include <vcl/vclenum.hxx>
34 #include <sfx2/app.hxx>
35 #include <svl/whiter.hxx>
36 #include <svl/itempool.hxx>
37 #include <svl/stritem.hxx>
38 #include <svl/style.hxx>
39 #include <sfx2/tplpitem.hxx>
40 #include <sfx2/request.hxx>
41 #include <sfx2/viewfrm.hxx>
42 #include <sfx2/dispatch.hxx>
43 #include <editeng/escapementitem.hxx>
44 #include <editeng/wghtitem.hxx>
45 #include <editeng/postitem.hxx>
46 #include <editeng/udlnitem.hxx>
47 #include <editeng/crossedoutitem.hxx>
48 #include <editeng/contouritem.hxx>
49 #include <editeng/shdditem.hxx>
50 #include <svx/svdpagv.hxx>
51 #include <svx/xtable.hxx>
52 #include <svx/svdobj.hxx>
53 #include <editeng/outlobj.hxx>
54 #include <editeng/flstitem.hxx>
55 #include <svl/intitem.hxx>
56 #include <editeng/scripttypeitem.hxx>
57 #include <svx/svdoutl.hxx>
58 #include <editeng/writingmodeitem.hxx>
59 #include <editeng/frmdiritem.hxx>
60 #include <svl/itemiter.hxx>
61 #include <editeng/cmapitem.hxx>
62 
63 #include <app.hrc>
64 #include <strings.hrc>
65 #include <sdresid.hxx>
66 #include <prlayout.hxx>
67 #include <ViewShell.hxx>
68 #include <drawview.hxx>
69 #include <drawdoc.hxx>
70 #include <sdpage.hxx>
71 #include <stlpool.hxx>
72 #include <stlsheet.hxx>
73 #include <OutlineView.hxx>
74 #include <Window.hxx>
75 #include <futempl.hxx>
76 #include <DrawDocShell.hxx>
77 #include <Outliner.hxx>
78 #include <futext.hxx>
79 
80 #include <memory>
81 
82 namespace sd {
83 
84 /**
85  * Process SfxRequests
86  */
87 
88 void TextObjectBar::Execute( SfxRequest &rReq )
89 {
90     const SfxItemSet* pArgs = rReq.GetArgs();
91     const SfxPoolItem* pPoolItem = nullptr;
92     sal_uInt16 nSlot = rReq.GetSlot();
93     OutlinerView* pOLV = mpView->GetTextEditOutlinerView();
94 
95     std::unique_ptr<OutlineViewModelChangeGuard, o3tl::default_delete<OutlineViewModelChangeGuard>> aGuard;
96 
97     assert(mpViewShell);
98 
99     if( dynamic_cast< const OutlineView *>( mpView ) !=  nullptr)
100     {
101         pOLV = static_cast<OutlineView*>(mpView)
102             ->GetViewByWindow(mpViewShell->GetActiveWindow());
103 
104         aGuard.reset( new OutlineViewModelChangeGuard( static_cast<OutlineView&>(*mpView) ) );
105     }
106 
107     switch (nSlot)
108     {
109         case SID_STYLE_APPLY:
110         {
111             if( pArgs )
112             {
113                 SdDrawDocument& rDoc = mpView->GetDoc();
114                 assert(mpViewShell->GetViewShell());
115                 rtl::Reference<FuPoor> xFunc( FuTemplate::Create( mpViewShell, static_cast< ::sd::Window*>( mpViewShell->GetViewShell()->GetWindow()), mpView, &rDoc, rReq ) );
116 
117                 if(xFunc.is())
118                 {
119                     xFunc->Activate();
120                     xFunc->Deactivate();
121 
122                     if( rReq.GetSlot() == SID_STYLE_APPLY )
123                     {
124                         if (mpViewShell->GetViewFrame())
125                             mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_STYLE_APPLY );
126                     }
127                 }
128             }
129             else
130             {
131                 if (mpViewShell->GetViewFrame())
132                     mpViewShell->GetViewFrame()->GetDispatcher()->Execute( SID_STYLE_DESIGNER, SfxCallMode::ASYNCHRON );
133             }
134 
135             rReq.Done();
136         }
137         break;
138 
139         case SID_INC_INDENT:
140         case SID_DEC_INDENT:
141         {
142             if( pOLV )
143             {
144                 ESelection aSel = pOLV->GetSelection();
145                 aSel.Adjust();
146                 sal_Int32 nStartPara = aSel.nStartPara;
147                 sal_Int32 nEndPara = aSel.nEndPara;
148                 if( !aSel.HasRange() )
149                 {
150                     nStartPara = 0;
151                     nEndPara = pOLV->GetOutliner()->GetParagraphCount() - 1;
152                 }
153                 for( sal_Int32 nPara = nStartPara; nPara <= nEndPara; nPara++ )
154                 {
155                     SfxStyleSheet* pStyleSheet = nullptr;
156                     if (pOLV->GetOutliner() != nullptr)
157                         pStyleSheet = pOLV->GetOutliner()->GetStyleSheet(nPara);
158                     if (pStyleSheet != nullptr)
159                     {
160                         SfxItemSet aAttr( pStyleSheet->GetItemSet() );
161                         SfxItemSet aTmpSet( pOLV->GetOutliner()->GetParaAttribs( nPara ) );
162                         aAttr.Put( aTmpSet, false );
163                         const SvxLRSpaceItem& rItem = aAttr.Get( EE_PARA_LRSPACE );
164                         std::unique_ptr<SvxLRSpaceItem> pNewItem(static_cast<SvxLRSpaceItem*>(rItem.Clone()));
165 
166                         long nLeft = pNewItem->GetLeft();
167                         if( nSlot == SID_INC_INDENT )
168                             nLeft += 1000;
169                         else
170                         {
171                             nLeft -= 1000;
172                             nLeft = std::max<long>( nLeft, 0 );
173                         }
174                         pNewItem->SetLeftValue( static_cast<sal_uInt16>(nLeft) );
175 
176                         SfxItemSet aNewAttrs( aAttr );
177                         aNewAttrs.Put( *pNewItem );
178                         pNewItem.reset();
179                         pOLV->GetOutliner()->SetParaAttribs( nPara, aNewAttrs );
180                     }
181                 }
182             }
183             rReq.Done();
184 
185             Invalidate();
186             // to refresh preview (in outline mode), slot has to be invalidated:
187             mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_PREVIEW_STATE, true );
188 
189         }
190         break;
191 
192         case SID_PARASPACE_INCREASE:
193         case SID_PARASPACE_DECREASE:
194         {
195             if( pOLV )
196             {
197                 ESelection aSel = pOLV->GetSelection();
198                 aSel.Adjust();
199                 sal_Int32 nStartPara = aSel.nStartPara;
200                 sal_Int32 nEndPara = aSel.nEndPara;
201                 if( !aSel.HasRange() )
202                 {
203                     nStartPara = 0;
204                     nEndPara = pOLV->GetOutliner()->GetParagraphCount() - 1;
205                 }
206                 for( sal_Int32 nPara = nStartPara; nPara <= nEndPara; nPara++ )
207                 {
208                     SfxStyleSheet* pStyleSheet = nullptr;
209                     if (pOLV->GetOutliner() != nullptr)
210                         pStyleSheet = pOLV->GetOutliner()->GetStyleSheet(nPara);
211                     if (pStyleSheet != nullptr)
212                     {
213                         SfxItemSet aAttr( pStyleSheet->GetItemSet() );
214                         SfxItemSet aTmpSet( pOLV->GetOutliner()->GetParaAttribs( nPara ) );
215                         aAttr.Put( aTmpSet, false ); // sal_False= InvalidItems is not default, handle it as "holes"
216                         const SvxULSpaceItem& rItem = aAttr.Get( EE_PARA_ULSPACE );
217                         std::unique_ptr<SvxULSpaceItem> pNewItem(static_cast<SvxULSpaceItem*>(rItem.Clone()));
218 
219                         long nUpper = pNewItem->GetUpper();
220                         if( nSlot == SID_PARASPACE_INCREASE )
221                             nUpper += 100;
222                         else
223                         {
224                             nUpper -= 100;
225                             nUpper = std::max<long>( nUpper, 0 );
226                         }
227                         pNewItem->SetUpper( static_cast<sal_uInt16>(nUpper) );
228 
229                         long nLower = pNewItem->GetLower();
230                         if( nSlot == SID_PARASPACE_INCREASE )
231                             nLower += 100;
232                         else
233                         {
234                             nLower -= 100;
235                             nLower = std::max<long>( nLower, 0 );
236                         }
237                         pNewItem->SetLower( static_cast<sal_uInt16>(nLower) );
238 
239                         SfxItemSet aNewAttrs( aAttr );
240                         aNewAttrs.Put( *pNewItem );
241                         pNewItem.reset();
242                         pOLV->GetOutliner()->SetParaAttribs( nPara, aNewAttrs );
243                     }
244                 }
245             }
246             else
247             {
248                 // the following code could be enabled, if I get a correct
249                 // DontCare status from JOE.
250 
251                 // gets enabled, through it doesn't really work (see above)
252                 SfxItemSet aEditAttr( mpView->GetDoc().GetPool() );
253                 mpView->GetAttributes( aEditAttr );
254                 if( aEditAttr.GetItemState( EE_PARA_ULSPACE ) >= SfxItemState::DEFAULT )
255                 {
256                     SfxItemSet aNewAttrs(*(aEditAttr.GetPool()), aEditAttr.GetRanges());
257                     const SvxULSpaceItem& rItem = aEditAttr.Get( EE_PARA_ULSPACE );
258                     std::unique_ptr<SvxULSpaceItem> pNewItem(static_cast<SvxULSpaceItem*>( rItem.Clone() ));
259                     long nUpper = pNewItem->GetUpper();
260 
261                     if( nSlot == SID_PARASPACE_INCREASE )
262                         nUpper += 100;
263                     else
264                     {
265                         nUpper -= 100;
266                         nUpper = std::max<long>( nUpper, 0 );
267                     }
268                     pNewItem->SetUpper( static_cast<sal_uInt16>(nUpper) );
269 
270                     long nLower = pNewItem->GetLower();
271                     if( nSlot == SID_PARASPACE_INCREASE )
272                         nLower += 100;
273                     else
274                     {
275                         nLower -= 100;
276                         nLower = std::max<long>( nLower, 0 );
277                     }
278                     pNewItem->SetLower( static_cast<sal_uInt16>(nLower) );
279 
280                     aNewAttrs.Put( *pNewItem );
281                     pNewItem.reset();
282 
283                     mpView->SetAttributes( aNewAttrs );
284                 }
285             }
286             rReq.Done();
287 
288             Invalidate();
289             // to refresh preview (in outline mode), slot has to be invalidated:
290             mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_PREVIEW_STATE, true );
291         }
292         break;
293 
294         case SID_OUTLINE_LEFT:
295         {
296             if (pOLV)
297             {
298                 pOLV->AdjustDepth( -1 );
299 
300                 // Ensure bold/italic etc. icon state updates
301                 Invalidate();
302                 // trigger preview refresh
303                 mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_PREVIEW_STATE, true );
304             }
305             rReq.Done();
306         }
307         break;
308 
309         case SID_OUTLINE_RIGHT:
310         {
311             if (pOLV)
312             {
313                 pOLV->AdjustDepth( 1 );
314 
315                 // Ensure bold/italic etc. icon state updates
316                 Invalidate();
317                 // trigger preview refresh
318                 mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_PREVIEW_STATE, true );
319             }
320             rReq.Done();
321         }
322         break;
323 
324         case SID_ATTR_PARA_LRSPACE:
325         {
326             SvxLRSpaceItem aLRSpace = static_cast<const SvxLRSpaceItem&>(pArgs->Get(
327                 GetPool().GetWhich(SID_ATTR_PARA_LRSPACE)));
328 
329             SfxItemSet aEditAttr( GetPool(), svl::Items<EE_PARA_LRSPACE, EE_PARA_LRSPACE>{} );
330             aLRSpace.SetWhich( EE_PARA_LRSPACE );
331 
332             aEditAttr.Put( aLRSpace );
333             mpView->SetAttributes( aEditAttr );
334 
335             Invalidate(SID_ATTR_PARA_LRSPACE);
336         }
337         break;
338 
339         case SID_HANGING_INDENT:
340         {
341             SfxItemSet aLRSpaceSet( GetPool(), svl::Items<EE_PARA_LRSPACE, EE_PARA_LRSPACE>{} );
342             mpView->GetAttributes( aLRSpaceSet );
343             SvxLRSpaceItem aParaMargin( aLRSpaceSet.Get( EE_PARA_LRSPACE ) );
344 
345             SvxLRSpaceItem aNewMargin( EE_PARA_LRSPACE );
346             aNewMargin.SetTextLeft( aParaMargin.GetTextLeft() + aParaMargin.GetTextFirstLineOfst() );
347             aNewMargin.SetRight( aParaMargin.GetRight() );
348             aNewMargin.SetTextFirstLineOfst( ( aParaMargin.GetTextFirstLineOfst() ) * -1 );
349             aLRSpaceSet.Put( aNewMargin );
350             mpView->SetAttributes( aLRSpaceSet );
351 
352             Invalidate(SID_ATTR_PARA_LRSPACE);
353         }
354         break;
355 
356         case SID_OUTLINE_UP:
357         {
358             if (pOLV)
359             {
360                 pOLV->AdjustHeight( -1 );
361 
362                 // trigger preview refresh
363                 mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_PREVIEW_STATE, true );
364             }
365             rReq.Done();
366         }
367         break;
368 
369         case SID_OUTLINE_DOWN:
370         {
371             if (pOLV)
372             {
373                 pOLV->AdjustHeight( 1 );
374 
375                 // trigger preview refresh
376                 mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_PREVIEW_STATE, true );
377             }
378             rReq.Done();
379         }
380         break;
381 
382         case SID_TEXTDIRECTION_LEFT_TO_RIGHT:
383         case SID_TEXTDIRECTION_TOP_TO_BOTTOM:
384         {
385             mpView->SdrEndTextEdit();
386             SfxItemSet aAttr( mpView->GetDoc().GetPool(), svl::Items<SDRATTR_TEXTDIRECTION, SDRATTR_TEXTDIRECTION>{} );
387             aAttr.Put( SvxWritingModeItem(
388                 nSlot == SID_TEXTDIRECTION_LEFT_TO_RIGHT ?
389                     css::text::WritingMode_LR_TB : css::text::WritingMode_TB_RL,
390                     SDRATTR_TEXTDIRECTION ) );
391             rReq.Done( aAttr );
392             mpView->SetAttributes( aAttr );
393             Invalidate();
394             mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_PREVIEW_STATE, true );
395         }
396         break;
397 
398         case FN_NUM_BULLET_ON:
399         {
400             if (pOLV)
401             {
402                 bool bMasterPage = false;
403                 SdrPageView* pPageView = mpView->GetSdrPageView();
404                 if (pPageView)
405                 {
406                     SdPage* pPage = static_cast<SdPage*>(pPageView->GetPage());
407                     bMasterPage = pPage && (pPage->GetPageKind() == PageKind::Standard) && pPage->IsMasterPage();
408                 }
409 
410                 if (!bMasterPage)
411                     pOLV->ToggleBullets();
412                 else
413                 {
414                     //Resolves: fdo#78151 in master pages if we toggle bullets on
415                     //and off then just disable/enable the bulleting, but do not
416                     //change the *level* of the paragraph, because the paragraph is
417                     //effectively a preview of the equivalent style level, and
418                     //changing the level disconnects it from the style
419 
420                     ::Outliner* pOL = pOLV->GetOutliner();
421                     if (pOL)
422                     {
423                         const SvxNumBulletItem *pItem = nullptr;
424                         SfxStyleSheetBasePool* pSSPool = mpView->GetDocSh()->GetStyleSheetPool();
425                         OUString sStyleName(SdResId(STR_PSEUDOSHEET_OUTLINE) + " 1");
426                         SfxStyleSheetBase* pFirstStyleSheet = pSSPool->Find(sStyleName, SfxStyleFamily::Pseudo);
427                         if( pFirstStyleSheet )
428                             pFirstStyleSheet->GetItemSet().GetItemState(EE_PARA_NUMBULLET, false, reinterpret_cast<const SfxPoolItem**>(&pItem));
429 
430                         if (pItem )
431                         {
432                             SvxNumRule aNewRule(*pItem->GetNumRule());
433                             ESelection aSel = pOLV->GetSelection();
434                             aSel.Adjust();
435                             sal_Int32 nStartPara = aSel.nStartPara;
436                             sal_Int32 nEndPara = aSel.nEndPara;
437                             for (sal_Int32 nPara = nStartPara; nPara <= nEndPara; ++nPara)
438                             {
439                                 sal_uInt16 nLevel = pOL->GetDepth(nPara);
440                                 SvxNumberFormat aFmt(aNewRule.GetLevel(nLevel));
441 
442                                 if (aFmt.GetNumberingType() == SVX_NUM_NUMBER_NONE)
443                                 {
444                                     aFmt.SetNumberingType(SVX_NUM_CHAR_SPECIAL);
445                                     SdStyleSheetPool::setDefaultOutlineNumberFormatBulletAndIndent(nLevel, aFmt);
446                                 }
447                                 else
448                                 {
449                                     aFmt.SetNumberingType(SVX_NUM_NUMBER_NONE);
450                                     aFmt.SetAbsLSpace(0);
451                                     aFmt.SetFirstLineOffset(0);
452                                 }
453 
454                                 aNewRule.SetLevel(nLevel, aFmt);
455                             }
456 
457                             pFirstStyleSheet->GetItemSet().Put(SvxNumBulletItem(aNewRule, EE_PARA_NUMBULLET));
458 
459                             SdStyleSheet::BroadcastSdStyleSheetChange(pFirstStyleSheet, PO_OUTLINE_1, pSSPool);
460                         }
461                     }
462                 }
463             }
464             break;
465         }
466         case SID_GROW_FONT_SIZE:
467         case SID_SHRINK_FONT_SIZE:
468         {
469             const SvxFontListItem* pFonts = static_cast<const SvxFontListItem*>(mpViewShell->GetDocSh()->GetItem( SID_ATTR_CHAR_FONTLIST ));
470             const FontList* pFontList = pFonts ? pFonts->GetFontList(): nullptr;
471             if( pFontList )
472             {
473                 FuText::ChangeFontSize( nSlot == SID_GROW_FONT_SIZE, pOLV, pFontList, mpView );
474                 if( pOLV )
475                     pOLV->SetAttribs( pOLV->GetEditView().GetEmptyItemSet() );
476                 mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_ATTR_CHAR_FONTHEIGHT );
477             }
478             rReq.Done();
479         }
480         break;
481 
482         case SID_THES:
483         {
484             OUString aReplaceText;
485             const SfxStringItem* pItem2 = rReq.GetArg<SfxStringItem>(SID_THES);
486             if (pItem2)
487                 aReplaceText = pItem2->GetValue();
488             if (!aReplaceText.isEmpty())
489                 ReplaceTextWithSynonym( pOLV->GetEditView(), aReplaceText );
490         }
491         break;
492 
493         default:
494         {
495             SfxItemSet aEditAttr( mpView->GetDoc().GetPool() );
496             mpView->GetAttributes( aEditAttr );
497             SfxItemSet aNewAttr(*(aEditAttr.GetPool()), aEditAttr.GetRanges());
498 
499             if( !pArgs )
500             {
501                 //aNewAttr.InvalidateAllItems(); <- produces problems (#35465#)
502 
503                 switch ( nSlot )
504                 {
505                     case SID_ATTR_CHAR_WEIGHT:
506                     {
507                         FontWeight eFW = aEditAttr.Get( EE_CHAR_WEIGHT ).GetWeight();
508                         aNewAttr.Put( SvxWeightItem( eFW == WEIGHT_NORMAL ?
509                                             WEIGHT_BOLD : WEIGHT_NORMAL,
510                                             EE_CHAR_WEIGHT ) );
511                     }
512                     break;
513                     case SID_ATTR_CHAR_POSTURE:
514                     {
515                         FontItalic eFI = aEditAttr.Get( EE_CHAR_ITALIC ).GetPosture();
516                         aNewAttr.Put( SvxPostureItem( eFI == ITALIC_NORMAL ?
517                                             ITALIC_NONE : ITALIC_NORMAL,
518                                             EE_CHAR_ITALIC ) );
519                     }
520                     break;
521                     case SID_ATTR_CHAR_UNDERLINE:
522                     {
523                         FontLineStyle eFU = aEditAttr.Get( EE_CHAR_UNDERLINE ).GetLineStyle();
524                         aNewAttr.Put( SvxUnderlineItem( eFU == LINESTYLE_SINGLE ?
525                                             LINESTYLE_NONE : LINESTYLE_SINGLE,
526                                             EE_CHAR_UNDERLINE ) );
527                     }
528                     break;
529                     case SID_ATTR_CHAR_OVERLINE:
530                     {
531                         FontLineStyle eFO = aEditAttr.Get( EE_CHAR_OVERLINE ).GetLineStyle();
532                         aNewAttr.Put( SvxOverlineItem( eFO == LINESTYLE_SINGLE ?
533                                             LINESTYLE_NONE : LINESTYLE_SINGLE,
534                                             EE_CHAR_OVERLINE ) );
535                     }
536                     break;
537                     case SID_ATTR_CHAR_CONTOUR:
538                     {
539                         aNewAttr.Put( SvxContourItem( !aEditAttr.Get( EE_CHAR_OUTLINE ).GetValue(), EE_CHAR_OUTLINE ) );
540                     }
541                     break;
542                     case SID_ATTR_CHAR_SHADOWED:
543                     {
544                         aNewAttr.Put( SvxShadowedItem( !aEditAttr.Get( EE_CHAR_SHADOW ).GetValue(), EE_CHAR_SHADOW ) );
545                     }
546                     break;
547                     case SID_ATTR_CHAR_CASEMAP:
548                     {
549                         aNewAttr.Put( aEditAttr.Get( EE_CHAR_CASEMAP ) );
550                     }
551                     break;
552                     case SID_ATTR_CHAR_STRIKEOUT:
553                     {
554                         FontStrikeout eFSO = aEditAttr.Get( EE_CHAR_STRIKEOUT ).GetStrikeout();
555                         aNewAttr.Put( SvxCrossedOutItem( eFSO == STRIKEOUT_SINGLE ?
556                                             STRIKEOUT_NONE : STRIKEOUT_SINGLE, EE_CHAR_STRIKEOUT ) );
557                     }
558                     break;
559 
560                     case SID_ATTR_PARA_ADJUST_LEFT:
561                     {
562                         aNewAttr.Put( SvxAdjustItem( SvxAdjust::Left, EE_PARA_JUST ) );
563                     }
564                     break;
565                     case SID_ATTR_PARA_ADJUST_CENTER:
566                     {
567                         aNewAttr.Put( SvxAdjustItem( SvxAdjust::Center, EE_PARA_JUST ) );
568                     }
569                     break;
570                     case SID_ATTR_PARA_ADJUST_RIGHT:
571                     {
572                         aNewAttr.Put( SvxAdjustItem( SvxAdjust::Right, EE_PARA_JUST ) );
573                     }
574                     break;
575                     case SID_ATTR_PARA_ADJUST_BLOCK:
576                     {
577                         aNewAttr.Put( SvxAdjustItem( SvxAdjust::Block, EE_PARA_JUST ) );
578                     }
579                     break;
580                     case SID_ATTR_PARA_LINESPACE_10:
581                     {
582                         SvxLineSpacingItem aItem( LINE_SPACE_DEFAULT_HEIGHT, EE_PARA_SBL );
583                         aItem.SetPropLineSpace( 100 );
584                         aNewAttr.Put( aItem );
585                     }
586                     break;
587                     case SID_ATTR_PARA_LINESPACE_15:
588                     {
589                         SvxLineSpacingItem aItem( LINE_SPACE_DEFAULT_HEIGHT, EE_PARA_SBL );
590                         aItem.SetPropLineSpace( 150 );
591                         aNewAttr.Put( aItem );
592                     }
593                     break;
594                     case SID_ATTR_PARA_LINESPACE_20:
595                     {
596                         SvxLineSpacingItem aItem( LINE_SPACE_DEFAULT_HEIGHT, EE_PARA_SBL );
597                         aItem.SetPropLineSpace( 200 );
598                         aNewAttr.Put( aItem );
599                     }
600                     break;
601                     case SID_SET_SUPER_SCRIPT:
602                     {
603                         SvxEscapementItem aItem( EE_CHAR_ESCAPEMENT );
604                         SvxEscapement eEsc = static_cast<SvxEscapement>(aEditAttr.Get( EE_CHAR_ESCAPEMENT ).GetEnumValue());
605 
606                         if( eEsc == SvxEscapement::Superscript )
607                             aItem.SetEscapement( SvxEscapement::Off );
608                         else
609                             aItem.SetEscapement( SvxEscapement::Superscript );
610                         aNewAttr.Put( aItem );
611                     }
612                     break;
613                     case SID_SET_SUB_SCRIPT:
614                     {
615                         SvxEscapementItem aItem( EE_CHAR_ESCAPEMENT );
616                         SvxEscapement eEsc = static_cast<SvxEscapement>(aEditAttr.Get( EE_CHAR_ESCAPEMENT ).GetEnumValue());
617 
618                         if( eEsc == SvxEscapement::Subscript )
619                             aItem.SetEscapement( SvxEscapement::Off );
620                         else
621                             aItem.SetEscapement( SvxEscapement::Subscript );
622                         aNewAttr.Put( aItem );
623                     }
624                     break;
625 
626                     // attributes for TextObjectBar
627                     case SID_ATTR_CHAR_FONT:
628                         mpViewShell->GetViewFrame()->GetDispatcher()->
629                             Execute( SID_CHAR_DLG, SfxCallMode::ASYNCHRON );
630                     break;
631                     case SID_ATTR_CHAR_FONTHEIGHT:
632                         mpViewShell->GetViewFrame()->GetDispatcher()->
633                             Execute( SID_CHAR_DLG, SfxCallMode::ASYNCHRON );
634                     break;
635                     case SID_ATTR_CHAR_COLOR:
636                     break;
637 // #i35937# removed need for FN_NUM_BULLET_ON handling
638                 }
639 
640                 rReq.Done( aNewAttr );
641                 pArgs = rReq.GetArgs();
642             }
643             else if ( nSlot == SID_ATTR_PARA_LEFT_TO_RIGHT ||
644                       nSlot == SID_ATTR_PARA_RIGHT_TO_LEFT )
645             {
646                 bool bLeftToRight = nSlot == SID_ATTR_PARA_LEFT_TO_RIGHT;
647 
648                 SvxAdjust nAdjust = SvxAdjust::Left;
649                 if( SfxItemState::SET == aEditAttr.GetItemState(EE_PARA_JUST, true, &pPoolItem ) )
650                     nAdjust = static_cast<const SvxAdjustItem*>(pPoolItem)->GetAdjust();
651 
652                 if( bLeftToRight )
653                 {
654                     aNewAttr.Put( SvxFrameDirectionItem( SvxFrameDirection::Horizontal_LR_TB, EE_PARA_WRITINGDIR ) );
655                     if( nAdjust == SvxAdjust::Right )
656                         aNewAttr.Put( SvxAdjustItem( SvxAdjust::Left, EE_PARA_JUST ) );
657                 }
658                 else
659                 {
660                     aNewAttr.Put( SvxFrameDirectionItem( SvxFrameDirection::Horizontal_RL_TB, EE_PARA_WRITINGDIR ) );
661                     if( nAdjust == SvxAdjust::Left )
662                         aNewAttr.Put( SvxAdjustItem( SvxAdjust::Right, EE_PARA_JUST ) );
663                 }
664 
665                 rReq.Done( aNewAttr );
666                 pArgs = rReq.GetArgs();
667 
668                 Invalidate( SID_RULER_TEXT_RIGHT_TO_LEFT );
669             }
670             else if ( nSlot == SID_ATTR_CHAR_FONT       ||
671                       nSlot == SID_ATTR_CHAR_FONTHEIGHT ||
672                       nSlot == SID_ATTR_CHAR_POSTURE    ||
673                       nSlot == SID_ATTR_CHAR_WEIGHT )
674             {
675                 // #i78017 establish the same behaviour as in Writer
676                 SvtScriptType nScriptType = SvtScriptType::LATIN | SvtScriptType::ASIAN | SvtScriptType::COMPLEX;
677                 if (nSlot == SID_ATTR_CHAR_FONT)
678                     nScriptType = mpView->GetScriptType();
679 
680                 SfxItemPool& rPool = mpView->GetDoc().GetPool();
681                 SvxScriptSetItem aSvxScriptSetItem( nSlot, rPool );
682                 aSvxScriptSetItem.PutItemForScriptType( nScriptType, pArgs->Get( rPool.GetWhich( nSlot ) ) );
683                 aNewAttr.Put( aSvxScriptSetItem.GetItemSet() );
684                 rReq.Done( aNewAttr );
685                 pArgs = rReq.GetArgs();
686             }
687             else if (nSlot == SID_ATTR_PARA_ADJUST_LEFT ||
688                 nSlot == SID_ATTR_PARA_ADJUST_CENTER ||
689                 nSlot == SID_ATTR_PARA_ADJUST_RIGHT ||
690                 nSlot == SID_ATTR_PARA_ADJUST_BLOCK)
691             {
692                 switch( nSlot )
693                 {
694                 case SID_ATTR_PARA_ADJUST_LEFT:
695                     {
696                         aNewAttr.Put( SvxAdjustItem( SvxAdjust::Left, EE_PARA_JUST ) );
697                     }
698                     break;
699                 case SID_ATTR_PARA_ADJUST_CENTER:
700                     {
701                         aNewAttr.Put( SvxAdjustItem( SvxAdjust::Center, EE_PARA_JUST ) );
702                     }
703                     break;
704                 case SID_ATTR_PARA_ADJUST_RIGHT:
705                     {
706                         aNewAttr.Put( SvxAdjustItem( SvxAdjust::Right, EE_PARA_JUST ) );
707                     }
708                     break;
709                 case SID_ATTR_PARA_ADJUST_BLOCK:
710                     {
711                         aNewAttr.Put( SvxAdjustItem( SvxAdjust::Block, EE_PARA_JUST ) );
712                     }
713                     break;
714                 }
715                 rReq.Done( aNewAttr );
716                 pArgs = rReq.GetArgs();
717             }
718             else if(nSlot == SID_ATTR_CHAR_KERNING)
719             {
720                 aNewAttr.Put(pArgs->Get(pArgs->GetPool()->GetWhich(nSlot)));
721                 rReq.Done( aNewAttr );
722                 pArgs = rReq.GetArgs();
723             }
724             else if(nSlot ==  SID_SET_SUPER_SCRIPT )
725             {
726                 SvxEscapementItem aItem(EE_CHAR_ESCAPEMENT);
727                 SvxEscapement eEsc = static_cast<SvxEscapement>(aEditAttr.Get( EE_CHAR_ESCAPEMENT ).GetEnumValue());
728 
729                 if( eEsc == SvxEscapement::Superscript )
730                     aItem.SetEscapement( SvxEscapement::Off );
731                 else
732                     aItem.SetEscapement( SvxEscapement::Superscript );
733                 aNewAttr.Put( aItem );
734                 rReq.Done( aNewAttr );
735                 pArgs = rReq.GetArgs();
736             }
737             else if( nSlot ==  SID_SET_SUB_SCRIPT )
738             {
739                 SvxEscapementItem aItem(EE_CHAR_ESCAPEMENT);
740                 SvxEscapement eEsc = static_cast<SvxEscapement>(aEditAttr.Get( EE_CHAR_ESCAPEMENT ).GetEnumValue());
741 
742                 if( eEsc == SvxEscapement::Subscript )
743                     aItem.SetEscapement( SvxEscapement::Off );
744                 else
745                     aItem.SetEscapement( SvxEscapement::Subscript );
746                 aNewAttr.Put( aItem );
747                 rReq.Done( aNewAttr );
748                 pArgs = rReq.GetArgs();
749             }
750 
751             mpView->SetAttributes(*pArgs);
752 
753             // invalidate entire shell because of performance and
754             // extension reasons
755             Invalidate();
756 
757             // to refresh preview (in outline mode), slot has to be invalidated:
758             mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_PREVIEW_STATE, true );
759         }
760         break;
761     }
762 
763     Invalidate( SID_OUTLINE_LEFT );
764     Invalidate( SID_OUTLINE_RIGHT );
765     Invalidate( SID_OUTLINE_UP );
766     Invalidate( SID_OUTLINE_DOWN );
767 }
768 
769 } // end of namespace sd
770 
771 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
772