xref: /aoo4110/main/sd/source/ui/view/drtxtob1.cxx (revision b1cdbd2c)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_sd.hxx"
26 
27 #include "TextObjectBar.hxx"
28 
29 
30 #include <svx/svxids.hrc>
31 
32 #include <editeng/editview.hxx>
33 #include <editeng/editeng.hxx>
34 #include <editeng/unolingu.hxx>
35 #include <editeng/outliner.hxx>
36 #include <editeng/ulspitem.hxx>
37 #include <editeng/lspcitem.hxx>
38 #include <editeng/adjitem.hxx>
39 #include <vcl/vclenum.hxx>
40 #include <sfx2/app.hxx>
41 #include <svl/whiter.hxx>
42 #include <svl/itempool.hxx>
43 #include <svl/style.hxx>
44 #include <sfx2/tplpitem.hxx>
45 #include <sfx2/request.hxx>
46 #include <sfx2/viewfrm.hxx>
47 #include <sfx2/dispatch.hxx>
48 #include <editeng/escpitem.hxx>
49 #include <editeng/wghtitem.hxx>
50 #include <editeng/postitem.hxx>
51 #include <editeng/udlnitem.hxx>
52 #include <editeng/crsditem.hxx>
53 #include <editeng/cntritem.hxx>
54 #include <editeng/shdditem.hxx>
55 #include <svx/xtable.hxx>
56 #include <svx/svdobj.hxx>
57 #include <editeng/outlobj.hxx>
58 #include <editeng/flstitem.hxx>
59 #include <editeng/editeng.hxx>
60 #include <svl/intitem.hxx>
61 #include <editeng/scripttypeitem.hxx>
62 #include <svx/svdoutl.hxx>
63 #include <editeng/writingmodeitem.hxx>
64 #include <editeng/frmdiritem.hxx>
65 #include <svl/itemiter.hxx>
66 
67 
68 #include "app.hrc"
69 
70 #include "eetext.hxx"
71 #include "ViewShell.hxx"
72 #include "drawview.hxx"
73 #include "drawdoc.hxx"
74 #include "OutlineView.hxx"
75 #include "Window.hxx"
76 #include "futempl.hxx"
77 #include "DrawDocShell.hxx"
78 #include "Outliner.hxx"
79 #include "futext.hxx"
80 
81 namespace sd {
82 
83 /*************************************************************************
84 |*
85 |* Bearbeitung der SfxRequests
86 |*
87 \************************************************************************/
88 
Execute(SfxRequest & rReq)89 void TextObjectBar::Execute( SfxRequest &rReq )
90 {
91 	const SfxItemSet* pArgs = rReq.GetArgs();
92 	const SfxPoolItem* pPoolItem = NULL;
93 	sal_uInt16 nSlot = rReq.GetSlot();
94 	sal_Bool bOutlineMode = sal_False;
95 	OutlinerView* pOLV = mpView->GetTextEditOutlinerView();
96 
97 	std::auto_ptr< OutlineViewModelChangeGuard > aGuard;
98 
99 	if (mpView->ISA(OutlineView))
100 	{
101 		bOutlineMode = sal_True;
102 		pOLV = static_cast<OutlineView*>(mpView)
103             ->GetViewByWindow(mpViewShell->GetActiveWindow());
104 
105 		aGuard.reset( new OutlineViewModelChangeGuard( static_cast<OutlineView&>(*mpView) ) );
106 	}
107 
108 	switch (nSlot)
109 	{
110 		case SID_STYLE_APPLY:
111 		{
112 			if( pArgs )
113 			{
114 				SdDrawDocument* pDoc = mpView->GetDoc();
115                 OSL_ASSERT (mpViewShell->GetViewShell()!=NULL);
116 				FunctionReference xFunc( FuTemplate::Create( mpViewShell, static_cast< ::sd::Window*>( mpViewShell->GetViewShell()->GetWindow()), mpView, pDoc, rReq ) );
117 
118 				if(xFunc.is())
119 				{
120 					xFunc->Activate();
121 					xFunc->Deactivate();
122 
123 					if( rReq.GetSlot() == SID_STYLE_APPLY )
124 					{
125 						if( mpViewShell && mpViewShell->GetViewFrame() )
126 							mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_STYLE_APPLY );
127 					}
128 				}
129 			}
130 			else
131 			{
132 				if( mpViewShell && mpViewShell->GetViewFrame() )
133 					mpViewShell->GetViewFrame()->GetDispatcher()->Execute( SID_STYLE_DESIGNER, SFX_CALLMODE_ASYNCHRON );
134 			}
135 
136 			rReq.Done();
137 		}
138 		break;
139 
140 		case SID_PARASPACE_INCREASE:
141 		case SID_PARASPACE_DECREASE:
142 		{
143 			if( pOLV )
144 			{
145 				ESelection aSel = pOLV->GetSelection();
146 				aSel.Adjust();
147 				sal_uLong nStartPara = aSel.nStartPara;
148 				sal_uLong nEndPara = aSel.nEndPara;
149 				if( !aSel.HasRange() )
150 				{
151 					nStartPara = 0;
152 					nEndPara = pOLV->GetOutliner()->GetParagraphCount() - 1;
153 				}
154 				for( sal_uLong nPara = nStartPara; nPara <= nEndPara; nPara++ )
155 				{
156                     SfxStyleSheet* pStyleSheet = NULL;
157 					if (pOLV->GetOutliner() != NULL)
158                         pStyleSheet = pOLV->GetOutliner()->GetStyleSheet(nPara);
159                     if (pStyleSheet != NULL)
160                     {
161                         SfxItemSet aAttr( pStyleSheet->GetItemSet() );
162                         SfxItemSet aTmpSet( pOLV->GetOutliner()->GetParaAttribs( (sal_uInt16) nPara ) );
163                         aAttr.Put( aTmpSet, sal_False ); // sal_False= InvalidItems nicht als Default, sondern als "Loecher" betrachten
164                         const SvxULSpaceItem& rItem = (const SvxULSpaceItem&) aAttr.Get( EE_PARA_ULSPACE );
165                         SvxULSpaceItem* pNewItem = (SvxULSpaceItem*) rItem.Clone();
166 
167                         long nUpper = pNewItem->GetUpper();
168                         if( nSlot == SID_PARASPACE_INCREASE )
169                             nUpper += 100;
170                         else
171                         {
172                             nUpper -= 100;
173                             nUpper = Max( (long) nUpper, 0L );
174                         }
175                         pNewItem->SetUpper( (sal_uInt16) nUpper );
176 
177                         long nLower = pNewItem->GetLower();
178                         if( nSlot == SID_PARASPACE_INCREASE )
179                             nLower += 100;
180                         else
181                         {
182                             nLower -= 100;
183                             nLower = Max( (long) nLower, 0L );
184                         }
185                         pNewItem->SetLower( (sal_uInt16) nLower );
186 
187                         SfxItemSet aNewAttrs( aAttr );
188                         aNewAttrs.Put( *pNewItem );
189                         delete pNewItem;
190                         pOLV->GetOutliner()->SetParaAttribs( (sal_uInt16)nPara, aNewAttrs );
191                     }
192 				}
193 			}
194 			else
195 			{
196 				// Der folgende Code kann enabled werden, wenn ich von
197 				// JOE einen richtigen Status (DontCare) bekomme;
198 
199 				// Wird enabled, obwohl es nicht richtig funktioniert (s.o.)
200 				SfxItemSet aEditAttr( mpView->GetDoc()->GetPool() );
201 				mpView->GetAttributes( aEditAttr );
202                 if( aEditAttr.GetItemState( EE_PARA_ULSPACE ) >= SFX_ITEM_AVAILABLE )
203 				{
204 					SfxItemSet aNewAttrs(*(aEditAttr.GetPool()), aEditAttr.GetRanges());
205                     const SvxULSpaceItem& rItem = (const SvxULSpaceItem&) aEditAttr.Get( EE_PARA_ULSPACE );
206 					SvxULSpaceItem* pNewItem = (SvxULSpaceItem*) rItem.Clone();
207 					long nUpper = pNewItem->GetUpper();
208 
209 					if( nSlot == SID_PARASPACE_INCREASE )
210 						nUpper += 100;
211 					else
212 					{
213 						nUpper -= 100;
214 						nUpper = Max( (long) nUpper, 0L );
215 					}
216 					pNewItem->SetUpper( (sal_uInt16) nUpper );
217 
218 					long nLower = pNewItem->GetLower();
219 					if( nSlot == SID_PARASPACE_INCREASE )
220 						nLower += 100;
221 					else
222 					{
223 						nLower -= 100;
224 						nLower = Max( (long) nLower, 0L );
225 					}
226 					pNewItem->SetLower( (sal_uInt16) nLower );
227 
228 					aNewAttrs.Put( *pNewItem );
229 					delete pNewItem;
230 
231 					mpView->SetAttributes( aNewAttrs );
232 				}
233 			}
234 			rReq.Done();
235 
236 			Invalidate();
237 			// Um die Preview (im Gliederungsmodus) zu aktualisieren muss
238 			// der Slot invalidiert werden:
239 			mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_PREVIEW_STATE, sal_True, sal_False );
240 		}
241 		break;
242 
243 		case SID_OUTLINE_LEFT:
244 		{
245 			if (pOLV)
246 			{
247 				pOLV->AdjustDepth( -1 );
248 
249                 // Ensure bold/italic etc. icon state updates
250 				Invalidate();
251 				// #96551# trigger preview refresh
252 				mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_PREVIEW_STATE, sal_True, sal_False );
253 			}
254 			rReq.Done();
255 		}
256 		break;
257 
258 		case SID_OUTLINE_RIGHT:
259 		{
260 			if (pOLV)
261 			{
262 				pOLV->AdjustDepth( 1 );
263 
264                 // Ensure bold/italic etc. icon state updates
265 				Invalidate();
266 				// #96551# trigger preview refresh
267 				mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_PREVIEW_STATE, sal_True, sal_False );
268 			}
269 			rReq.Done();
270 		}
271 		break;
272 
273 		case SID_ATTR_PARA_LRSPACE:
274 		{
275 			sal_uInt16 nSlot = SID_ATTR_PARA_LRSPACE;
276 			SvxLRSpaceItem aLRSpace = (const SvxLRSpaceItem&)pArgs->Get(
277 				GetPool().GetWhich(nSlot));
278 
279 			SfxItemSet aEditAttr( GetPool(), EE_PARA_LRSPACE, EE_PARA_LRSPACE );
280 			aLRSpace.SetWhich( EE_PARA_LRSPACE );
281 
282 			aEditAttr.Put( aLRSpace );
283 			mpView->SetAttributes( aEditAttr );
284 
285 			Invalidate(SID_ATTR_PARA_LRSPACE);
286 		}
287 		break;
288 
289 		case SID_OUTLINE_UP:
290 		{
291 			if (pOLV)
292 			{
293 				pOLV->AdjustHeight( -1 );
294 
295 				// #96551# trigger preview refresh
296 				mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_PREVIEW_STATE, sal_True, sal_False );
297 			}
298 			rReq.Done();
299 		}
300 		break;
301 
302 		case SID_OUTLINE_DOWN:
303 		{
304 			if (pOLV)
305 			{
306 				pOLV->AdjustHeight( 1 );
307 
308 				// #96551# trigger preview refresh
309 				mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_PREVIEW_STATE, sal_True, sal_False );
310 			}
311 			rReq.Done();
312 		}
313 		break;
314 
315 		case SID_TEXTDIRECTION_LEFT_TO_RIGHT:
316 		case SID_TEXTDIRECTION_TOP_TO_BOTTOM:
317 		{
318 			mpView->SdrEndTextEdit();
319 			SfxItemSet aAttr( mpView->GetDoc()->GetPool(), SDRATTR_TEXTDIRECTION, SDRATTR_TEXTDIRECTION, 0 );
320             aAttr.Put( SvxWritingModeItem(
321                 nSlot == SID_TEXTDIRECTION_LEFT_TO_RIGHT ?
322                     com::sun::star::text::WritingMode_LR_TB : com::sun::star::text::WritingMode_TB_RL,
323                     SDRATTR_TEXTDIRECTION ) );
324 			rReq.Done( aAttr );
325 			mpView->SetAttributes( aAttr );
326 			Invalidate();
327 			mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_PREVIEW_STATE, sal_True, sal_False );
328 		}
329 		break;
330 
331         case FN_NUM_BULLET_ON:
332             if( pOLV )
333                 pOLV->ToggleBullets();
334             break;
335 
336         case SID_GROW_FONT_SIZE:
337         case SID_SHRINK_FONT_SIZE:
338         {
339             const SvxFontListItem* pFonts =	(const SvxFontListItem*)mpViewShell->GetDocSh()->GetItem( SID_ATTR_CHAR_FONTLIST );
340             const FontList* pFontList = pFonts ? pFonts->GetFontList(): 0;
341             if( pFontList )
342             {
343                 FuText::ChangeFontSize( nSlot == SID_GROW_FONT_SIZE, pOLV, pFontList, mpView );
344                 mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_ATTR_CHAR_FONTHEIGHT );
345             }
346             rReq.Done();
347         }
348         break;
349 
350         case SID_THES:
351         {
352             String aReplaceText;
353             SFX_REQUEST_ARG( rReq, pItem2, SfxStringItem, SID_THES, sal_False );
354             if (pItem2)
355                 aReplaceText = pItem2->GetValue();
356             if (aReplaceText.Len() > 0)
357                 ReplaceTextWithSynonym( pOLV->GetEditView(), aReplaceText );
358         }
359         break;
360 
361 		default:
362 		{
363 			SfxItemSet aEditAttr( mpView->GetDoc()->GetPool() );
364 			mpView->GetAttributes( aEditAttr );
365 			SfxItemSet aNewAttr(*(aEditAttr.GetPool()), aEditAttr.GetRanges());
366 
367 			if( !pArgs )
368 			{
369 				//aNewAttr.InvalidateAllItems(); <- Macht Probleme (#35465#)
370 
371 				switch ( nSlot )
372 				{
373 					case SID_ATTR_CHAR_WEIGHT:
374 					{
375 						FontWeight eFW = ( (const SvxWeightItem&) aEditAttr.
376                                         Get( EE_CHAR_WEIGHT ) ).GetWeight();
377 						aNewAttr.Put( SvxWeightItem( eFW == WEIGHT_NORMAL ?
378                                             WEIGHT_BOLD : WEIGHT_NORMAL,
379                                             EE_CHAR_WEIGHT ) );
380 					}
381 					break;
382 					case SID_ATTR_CHAR_POSTURE:
383 					{
384 						FontItalic eFI = ( (const SvxPostureItem&) aEditAttr.
385                                         Get( EE_CHAR_ITALIC ) ).GetPosture();
386 						aNewAttr.Put( SvxPostureItem( eFI == ITALIC_NORMAL ?
387                                             ITALIC_NONE : ITALIC_NORMAL,
388                                             EE_CHAR_ITALIC ) );
389 					}
390 					break;
391 					case SID_ATTR_CHAR_UNDERLINE:
392 					{
393 						FontUnderline eFU = ( (const SvxUnderlineItem&) aEditAttr.
394                                         Get( EE_CHAR_UNDERLINE ) ).GetLineStyle();
395 						aNewAttr.Put( SvxUnderlineItem( eFU == UNDERLINE_SINGLE ?
396                                             UNDERLINE_NONE : UNDERLINE_SINGLE,
397                                             EE_CHAR_UNDERLINE ) );
398 					}
399 					break;
400 					case SID_ATTR_CHAR_OVERLINE:
401 					{
402 						FontUnderline eFO = ( (const SvxOverlineItem&) aEditAttr.
403                                         Get( EE_CHAR_OVERLINE ) ).GetLineStyle();
404 						aNewAttr.Put( SvxOverlineItem( eFO == UNDERLINE_SINGLE ?
405                                             UNDERLINE_NONE : UNDERLINE_SINGLE,
406                                             EE_CHAR_OVERLINE ) );
407 					}
408 					break;
409 					case SID_ATTR_CHAR_CONTOUR:
410 					{
411 						aNewAttr.Put( SvxContourItem( !( (const SvxContourItem&) aEditAttr.
412                                         Get( EE_CHAR_OUTLINE ) ).GetValue(), EE_CHAR_OUTLINE ) );
413 					}
414 					break;
415 					case SID_ATTR_CHAR_SHADOWED:
416 					{
417 						aNewAttr.Put( SvxShadowedItem( !( (const SvxShadowedItem&) aEditAttr.
418                                         Get( EE_CHAR_SHADOW ) ).GetValue(), EE_CHAR_SHADOW ) );
419 					}
420 					break;
421 					case SID_ATTR_CHAR_STRIKEOUT:
422 					{
423 						FontStrikeout eFSO = ( ( (const SvxCrossedOutItem&) aEditAttr.
424                                         Get( EE_CHAR_STRIKEOUT ) ).GetStrikeout() );
425 						aNewAttr.Put( SvxCrossedOutItem( eFSO == STRIKEOUT_SINGLE ?
426                                             STRIKEOUT_NONE : STRIKEOUT_SINGLE, EE_CHAR_STRIKEOUT ) );
427 					}
428 					break;
429 
430 					case SID_ATTR_PARA_ADJUST_LEFT:
431 					{
432                         aNewAttr.Put( SvxAdjustItem( SVX_ADJUST_LEFT, EE_PARA_JUST ) );
433 					}
434 					break;
435 					case SID_ATTR_PARA_ADJUST_CENTER:
436 					{
437                         aNewAttr.Put( SvxAdjustItem( SVX_ADJUST_CENTER, EE_PARA_JUST ) );
438 					}
439 					break;
440 					case SID_ATTR_PARA_ADJUST_RIGHT:
441 					{
442                         aNewAttr.Put( SvxAdjustItem( SVX_ADJUST_RIGHT, EE_PARA_JUST ) );
443 					}
444 					break;
445 					case SID_ATTR_PARA_ADJUST_BLOCK:
446 					{
447                         aNewAttr.Put( SvxAdjustItem( SVX_ADJUST_BLOCK, EE_PARA_JUST ) );
448 					}
449 					break;
450 					case SID_ATTR_PARA_LINESPACE_10:
451 					{
452                         SvxLineSpacingItem aItem( SVX_LINESPACE_ONE_LINE, EE_PARA_SBL );
453 						aItem.SetPropLineSpace( 100 );
454 						aNewAttr.Put( aItem );
455 					}
456 					break;
457 					case SID_ATTR_PARA_LINESPACE_15:
458 					{
459                         SvxLineSpacingItem aItem( SVX_LINESPACE_ONE_POINT_FIVE_LINES, EE_PARA_SBL );
460 						aItem.SetPropLineSpace( 150 );
461 						aNewAttr.Put( aItem );
462 					}
463 					break;
464 					case SID_ATTR_PARA_LINESPACE_20:
465 					{
466                         SvxLineSpacingItem aItem( SVX_LINESPACE_TWO_LINES, EE_PARA_SBL );
467 						aItem.SetPropLineSpace( 200 );
468 						aNewAttr.Put( aItem );
469 					}
470     				break;
471 					case SID_SET_SUPER_SCRIPT:
472 					{
473                         SvxEscapementItem aItem( EE_CHAR_ESCAPEMENT );
474 						SvxEscapement eEsc = (SvxEscapement ) ( (const SvxEscapementItem&)
475                                         aEditAttr.Get( EE_CHAR_ESCAPEMENT ) ).GetEnumValue();
476 
477 						if( eEsc == SVX_ESCAPEMENT_SUPERSCRIPT )
478 							aItem.SetEscapement( SVX_ESCAPEMENT_OFF );
479 						else
480 							aItem.SetEscapement( SVX_ESCAPEMENT_SUPERSCRIPT );
481 						aNewAttr.Put( aItem );
482 					}
483 					break;
484 					case SID_SET_SUB_SCRIPT:
485 					{
486                         SvxEscapementItem aItem( EE_CHAR_ESCAPEMENT );
487 						SvxEscapement eEsc = (SvxEscapement ) ( (const SvxEscapementItem&)
488                                         aEditAttr.Get( EE_CHAR_ESCAPEMENT ) ).GetEnumValue();
489 
490 						if( eEsc == SVX_ESCAPEMENT_SUBSCRIPT )
491 							aItem.SetEscapement( SVX_ESCAPEMENT_OFF );
492 						else
493 							aItem.SetEscapement( SVX_ESCAPEMENT_SUBSCRIPT );
494 						aNewAttr.Put( aItem );
495 					}
496 					break;
497 
498 					// Attribute fuer die TextObjectBar
499 					case SID_ATTR_CHAR_FONT:
500 					{
501 						if( pArgs )
502 						{
503                             if( SFX_ITEM_SET == pArgs->GetItemState( EE_CHAR_FONTINFO, sal_True, &pPoolItem ) )
504 								aNewAttr.Put( *pPoolItem );
505 						}
506 						else
507 							mpViewShell->GetViewFrame()->GetDispatcher()->
508 							Execute( SID_CHAR_DLG, SFX_CALLMODE_ASYNCHRON );
509 					}
510 					break;
511 					case SID_ATTR_CHAR_FONTHEIGHT:
512 					{
513 						if( pArgs )
514 						{
515                             if( SFX_ITEM_SET == pArgs->GetItemState( EE_CHAR_FONTHEIGHT, sal_True, &pPoolItem ) )
516 								aNewAttr.Put( *pPoolItem );
517 						}
518 						else
519 							mpViewShell->GetViewFrame()->GetDispatcher()->
520 							Execute( SID_CHAR_DLG, SFX_CALLMODE_ASYNCHRON );
521 					}
522 					break;
523 					case SID_ATTR_CHAR_COLOR:
524 					{
525                         if( pArgs && SFX_ITEM_SET == pArgs->GetItemState( EE_CHAR_COLOR, sal_True, &pPoolItem ) )
526 							aNewAttr.Put( *pPoolItem );
527 					}
528 					break;
529 /* #i35937#
530 					case FN_NUM_BULLET_ON:
531 					{
532 						if (aEditAttr.GetItemState(EE_PARA_BULLETSTATE) == SFX_ITEM_ON)
533 						{
534 							SfxUInt16Item aBulletState((const SfxUInt16Item&) aEditAttr.Get(EE_PARA_BULLETSTATE));
535 
536 							if (aBulletState.GetValue() != 0)
537 							{
538 								// Ausschalten
539 								aNewAttr.Put(SfxUInt16Item(EE_PARA_BULLETSTATE, 0));
540 							}
541 							else
542 							{
543 								// Einschalten
544 								aNewAttr.Put(SfxUInt16Item(EE_PARA_BULLETSTATE, 1));
545 							}
546 						}
547 						else
548 						{
549 							// Einschalten
550 							aNewAttr.Put(SfxUInt16Item(EE_PARA_BULLETSTATE, 1));
551 						}
552 					}
553 					break;
554 */
555 				}
556 
557 				rReq.Done( aNewAttr );
558 				pArgs = rReq.GetArgs();
559 			}
560 			else if ( nSlot == SID_ATTR_PARA_LEFT_TO_RIGHT ||
561 					  nSlot == SID_ATTR_PARA_RIGHT_TO_LEFT )
562 			{
563 				sal_Bool bLeftToRight = nSlot == SID_ATTR_PARA_LEFT_TO_RIGHT;
564 
565 				sal_uInt16 nAdjust = SVX_ADJUST_LEFT;
566                 if( SFX_ITEM_ON == aEditAttr.GetItemState(EE_PARA_JUST, sal_True, &pPoolItem ) )
567 					nAdjust = ( (SvxAdjustItem*)pPoolItem)->GetEnumValue();
568 
569 				if( bLeftToRight )
570 				{
571 					aNewAttr.Put( SvxFrameDirectionItem( FRMDIR_HORI_LEFT_TOP, EE_PARA_WRITINGDIR ) );
572 					if( nAdjust == SVX_ADJUST_RIGHT )
573                         aNewAttr.Put( SvxAdjustItem( SVX_ADJUST_LEFT, EE_PARA_JUST ) );
574 				}
575 				else
576 				{
577 					aNewAttr.Put( SvxFrameDirectionItem( FRMDIR_HORI_RIGHT_TOP, EE_PARA_WRITINGDIR ) );
578 					if( nAdjust == SVX_ADJUST_LEFT )
579                         aNewAttr.Put( SvxAdjustItem( SVX_ADJUST_RIGHT, EE_PARA_JUST ) );
580 				}
581 
582 				rReq.Done( aNewAttr );
583 				pArgs = rReq.GetArgs();
584 
585 				Invalidate( SID_RULER_TEXT_RIGHT_TO_LEFT );
586 			}
587 			else if ( nSlot == SID_ATTR_CHAR_FONT       ||
588                 	  nSlot == SID_ATTR_CHAR_FONTHEIGHT ||
589                 	  nSlot == SID_ATTR_CHAR_POSTURE    ||
590                 	  nSlot == SID_ATTR_CHAR_WEIGHT )
591             {
592 				// #i78017 establish the same behaviour as in Writer
593 				sal_uInt16 nScriptType = SCRIPTTYPE_LATIN | SCRIPTTYPE_ASIAN | SCRIPTTYPE_COMPLEX;
594 				if (nSlot == SID_ATTR_CHAR_FONT)
595 					nScriptType = mpView->GetScriptType();
596 
597 				SfxItemPool& rPool = mpView->GetDoc()->GetPool();
598                 SvxScriptSetItem aSvxScriptSetItem( nSlot, rPool );
599                 aSvxScriptSetItem.PutItemForScriptType( nScriptType, pArgs->Get( rPool.GetWhich( nSlot ) ) );
600 				aNewAttr.Put( aSvxScriptSetItem.GetItemSet() );
601 				rReq.Done( aNewAttr );
602 				pArgs = rReq.GetArgs();
603 			}
604 			else if (nSlot == SID_ATTR_PARA_ADJUST_LEFT ||
605 				nSlot == SID_ATTR_PARA_ADJUST_CENTER ||
606 				nSlot == SID_ATTR_PARA_ADJUST_RIGHT ||
607 				nSlot == SID_ATTR_PARA_ADJUST_BLOCK)
608 			{
609 				switch( nSlot )
610 				{
611 				case SID_ATTR_PARA_ADJUST_LEFT:
612 					{
613 						aNewAttr.Put( SvxAdjustItem( SVX_ADJUST_LEFT, EE_PARA_JUST ) );
614 					}
615 					break;
616 				case SID_ATTR_PARA_ADJUST_CENTER:
617 					{
618 						aNewAttr.Put( SvxAdjustItem( SVX_ADJUST_CENTER, EE_PARA_JUST ) );
619 					}
620 					break;
621 				case SID_ATTR_PARA_ADJUST_RIGHT:
622 					{
623 						aNewAttr.Put( SvxAdjustItem( SVX_ADJUST_RIGHT, EE_PARA_JUST ) );
624 					}
625 					break;
626 				case SID_ATTR_PARA_ADJUST_BLOCK:
627 					{
628 						aNewAttr.Put( SvxAdjustItem( SVX_ADJUST_BLOCK, EE_PARA_JUST ) );
629 					}
630 					break;
631 				}
632 				rReq.Done( aNewAttr );
633 				pArgs = rReq.GetArgs();
634 			}
635 			else if(nSlot == SID_ATTR_CHAR_KERNING)
636 			{
637 				aNewAttr.Put(pArgs->Get(pArgs->GetPool()->GetWhich(nSlot)));
638 				rReq.Done( aNewAttr );
639 				pArgs = rReq.GetArgs();
640 			}
641 			else if(nSlot ==  SID_SET_SUPER_SCRIPT )
642 			{
643 				SvxEscapementItem aItem(EE_CHAR_ESCAPEMENT);
644 				SvxEscapement eEsc = (SvxEscapement) ( (const SvxEscapementItem&)
645 								aEditAttr.Get( EE_CHAR_ESCAPEMENT ) ).GetEnumValue();
646 
647 				if( eEsc == SVX_ESCAPEMENT_SUPERSCRIPT )
648 					aItem.SetEscapement( SVX_ESCAPEMENT_OFF );
649 				else
650 					aItem.SetEscapement( SVX_ESCAPEMENT_SUPERSCRIPT );
651 				aNewAttr.Put( aItem );
652 				rReq.Done( aNewAttr );
653 				pArgs = rReq.GetArgs();
654 			}
655 			else if( nSlot ==  SID_SET_SUB_SCRIPT )
656 			{
657 				SvxEscapementItem aItem(EE_CHAR_ESCAPEMENT);
658 				SvxEscapement eEsc = (SvxEscapement) ( (const SvxEscapementItem&)
659 								aEditAttr.Get( EE_CHAR_ESCAPEMENT ) ).GetEnumValue();
660 
661 				if( eEsc == SVX_ESCAPEMENT_SUBSCRIPT )
662 					aItem.SetEscapement( SVX_ESCAPEMENT_OFF );
663 				else
664 					aItem.SetEscapement( SVX_ESCAPEMENT_SUBSCRIPT );
665 				aNewAttr.Put( aItem );
666 				rReq.Done( aNewAttr );
667 				pArgs = rReq.GetArgs();
668 			}
669 
670 			mpView->SetAttributes(*pArgs);
671 
672 			// Aus Performance- und Erweiterungsgruenden wird
673 			// jetzt die komplette Shell invalidiert
674 			Invalidate();
675 
676 			// Um die Preview (im Gliederungsmodus) zu aktualisieren muss
677 			// der Slot invalidiert werden:
678 			mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_PREVIEW_STATE, sal_True, sal_False );
679 		}
680 		break;
681 	}
682 
683 	Invalidate( SID_OUTLINE_LEFT );
684 	Invalidate( SID_OUTLINE_RIGHT );
685 	Invalidate( SID_OUTLINE_UP );
686 	Invalidate( SID_OUTLINE_DOWN );
687 }
688 
689 } // end of namespace sd
690