update dev300-m58
[ooovba.git] / svx / source / toolbars / fontworkbar.cxx
blob11130e35c62a41c66182450afda1c25d43f648cf
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: fontworkbar.cxx,v $
10 * $Revision: 1.23 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_svx.hxx"
33 #include <svx/svdundo.hxx>
34 #include <sfx2/app.hxx>
35 #include <sfx2/request.hxx>
36 #include <sfx2/objface.hxx>
37 #include <sfx2/viewsh.hxx>
38 #include "unoapi.hxx"
39 #include <com/sun/star/drawing/XShape.hpp>
40 #include <com/sun/star/drawing/XEnhancedCustomShapeDefaulter.hpp>
41 #include <svx/dialmgr.hxx>
42 #include <svx/svdoashp.hxx>
43 #ifndef _SVX_DIALOGS_HRC
44 #include <svx/dialogs.hrc>
45 #endif
46 #include <svx/svdview.hxx>
47 #include <svx/sdasitm.hxx>
48 #include <svx/svdoashp.hxx>
49 #include <com/sun/star/drawing/EnhancedCustomShapeAdjustmentValue.hpp>
50 #include <sfx2/bindings.hxx>
51 #include <svx/eeitem.hxx>
52 #include <svx/charscaleitem.hxx>
53 #include <svx/kernitem.hxx>
54 #include <sdrpaintwindow.hxx>
56 #include <svx/svxids.hrc>
57 #include <svx/fontworkbar.hxx>
58 #include "fontworkgallery.hxx"
60 using ::rtl::OUString;
62 using namespace ::svx;
63 using namespace ::cppu;
64 using namespace ::com::sun::star;
65 using namespace ::com::sun::star::beans;
66 using namespace ::com::sun::star::uno;
68 void SetAlignmentState( SdrView* pSdrView, SfxItemSet& rSet )
70 const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
71 ULONG nCount = rMarkList.GetMarkCount(), i;
73 sal_Int32 nAlignment = -1;
74 for( i = 0; i < nCount; i++ )
76 SdrObject* pObj = rMarkList.GetMark( i )->GetMarkedSdrObj();
77 if( pObj->ISA(SdrObjCustomShape) )
79 sal_Int32 nOldAlignment = nAlignment;
80 SdrTextHorzAdjustItem& rTextHorzAdjustItem = (SdrTextHorzAdjustItem&)pObj->GetMergedItem( SDRATTR_TEXT_HORZADJUST );
81 SdrTextFitToSizeTypeItem& rTextFitToSizeTypeItem = (SdrTextFitToSizeTypeItem&)pObj->GetMergedItem( SDRATTR_TEXT_FITTOSIZE );
82 switch ( rTextHorzAdjustItem.GetValue() )
84 case SDRTEXTHORZADJUST_LEFT : nAlignment = 0; break;
85 case SDRTEXTHORZADJUST_CENTER : nAlignment = 1; break;
86 case SDRTEXTHORZADJUST_RIGHT : nAlignment = 2; break;
87 case SDRTEXTHORZADJUST_BLOCK :
89 if ( rTextFitToSizeTypeItem.GetValue() == SDRTEXTFIT_NONE )
90 nAlignment = 3;
91 else if ( rTextFitToSizeTypeItem.GetValue() == SDRTEXTFIT_ALLLINES )
92 nAlignment = 4;
95 if ( ( nOldAlignment != -1 ) && ( nOldAlignment != nAlignment ) )
97 nAlignment = -1;
98 break;
102 rSet.Put( SfxInt32Item( SID_FONTWORK_ALIGNMENT, nAlignment ) );
105 void SetCharacterSpacingState( SdrView* pSdrView, SfxItemSet& rSet )
107 const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
108 ULONG nCount = rMarkList.GetMarkCount(), i;
110 sal_Int32 nCharacterSpacing = -1;
111 for( i = 0; i < nCount; i++ )
113 SdrObject* pObj = rMarkList.GetMark( i )->GetMarkedSdrObj();
114 if( pObj->ISA(SdrObjCustomShape) )
116 sal_Int32 nOldCharacterSpacing = nCharacterSpacing;
117 SvxCharScaleWidthItem& rCharScaleWidthItem = (SvxCharScaleWidthItem&)pObj->GetMergedItem( EE_CHAR_FONTWIDTH );
118 nCharacterSpacing = rCharScaleWidthItem.GetValue();
119 if ( ( nOldCharacterSpacing != -1 ) && ( nOldCharacterSpacing != nCharacterSpacing ) )
121 nCharacterSpacing = -1;
122 break;
126 rSet.Put( SfxInt32Item( SID_FONTWORK_CHARACTER_SPACING, nCharacterSpacing ) );
130 void SetKernCharacterPairsState( SdrView* pSdrView, SfxItemSet& rSet )
132 const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
133 ULONG nCount = rMarkList.GetMarkCount(), i;
135 sal_Bool bChecked = sal_False;
136 for( i = 0; i < nCount; i++ )
138 SdrObject* pObj = rMarkList.GetMark( i )->GetMarkedSdrObj();
139 if( pObj->ISA(SdrObjCustomShape) )
141 SvxKerningItem& rKerningItem = (SvxKerningItem&)pObj->GetMergedItem( EE_CHAR_KERNING );
142 if ( rKerningItem.GetValue() )
143 bChecked = sal_True;
146 rSet.Put( SfxBoolItem( SID_FONTWORK_KERN_CHARACTER_PAIRS, bChecked ) );
149 void SetFontWorkShapeTypeState( SdrView* pSdrView, SfxItemSet& rSet )
151 const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
152 ULONG nCount = rMarkList.GetMarkCount(), i;
154 rtl::OUString aFontWorkShapeType;
156 for( i = 0; i < nCount; i++ )
158 SdrObject* pObj = rMarkList.GetMark( i )->GetMarkedSdrObj();
159 if( pObj->ISA( SdrObjCustomShape ) )
161 const rtl::OUString sType( RTL_CONSTASCII_USTRINGPARAM ( "Type" ) );
162 SdrCustomShapeGeometryItem aGeometryItem( (SdrCustomShapeGeometryItem&)pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
163 Any* pAny = aGeometryItem.GetPropertyValueByName( sType );
164 if( pAny )
166 rtl::OUString aType;
167 if ( *pAny >>= aType )
169 if ( aFontWorkShapeType.getLength() )
171 if ( !aFontWorkShapeType.equals( aType ) ) // different FontWorkShapeTypes selected ?
173 aFontWorkShapeType = rtl::OUString();
174 break;
177 aFontWorkShapeType = aType;
182 rSet.Put( SfxStringItem( SID_FONTWORK_SHAPE_TYPE, aFontWorkShapeType ) );
185 /*************************************************************************
187 |* Standardinterface deklarieren (Die Slotmap darf nicht leer sein, also
188 |* tragen wir etwas ein, was hier (hoffentlich) nie vorkommt).
190 \************************************************************************/
192 #define ShellClass FontworkBar
194 SFX_SLOTMAP(FontworkBar)
196 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
199 SFX_IMPL_INTERFACE(FontworkBar, SfxShell, SVX_RES(RID_SVX_FONTWORK_BAR))
201 SFX_OBJECTBAR_REGISTRATION( SFX_OBJECTBAR_OBJECT, SVX_RES(RID_SVX_FONTWORK_BAR) );
204 TYPEINIT1( FontworkBar, SfxShell );
207 /*************************************************************************
209 |* Standard-Konstruktor
211 \************************************************************************/
213 FontworkBar::FontworkBar(SfxViewShell* pViewShell )
214 : SfxShell(pViewShell)
216 DBG_ASSERT( pViewShell, "svx::FontworkBar::FontworkBar(), I need a viewshell!" );
217 if( pViewShell )
218 SetPool(&pViewShell->GetPool());
220 SetHelpId( SVX_INTERFACE_FONTWORK_BAR );
221 SetName( String( SVX_RES( RID_SVX_FONTWORK_BAR) ));
225 /*************************************************************************
227 |* Destruktor
229 \************************************************************************/
231 FontworkBar::~FontworkBar()
233 SetRepeatTarget(NULL);
236 static Window* ImpGetViewWin(SdrView* pView)
238 if( pView )
240 const sal_uInt32 nAnz(pView->PaintWindowCount());
241 for(sal_uInt32 nNum(0L); nNum < nAnz; nNum++)
243 OutputDevice* pOut = &(pView->GetPaintWindow(nNum)->GetOutputDevice());
245 if(OUTDEV_WINDOW == pOut->GetOutDevType())
247 return (Window*)pOut;
252 return 0L;
255 namespace svx {
256 bool checkForSelectedFontWork( SdrView* pSdrView, sal_uInt32& nCheckStatus )
258 if ( nCheckStatus & 2 )
259 return ( nCheckStatus & 1 ) != 0;
261 static const rtl::OUString sTextPath( RTL_CONSTASCII_USTRINGPARAM ( "TextPath" ) );
263 const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
264 ULONG nCount = rMarkList.GetMarkCount(), i;
265 sal_Bool bFound = sal_False;
266 for(i=0;(i<nCount) && !bFound ; i++)
268 SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
269 if( pObj->ISA(SdrObjCustomShape) )
271 SdrCustomShapeGeometryItem aGeometryItem( (SdrCustomShapeGeometryItem&)pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
272 Any* pAny = aGeometryItem.GetPropertyValueByName( sTextPath, sTextPath );
273 if( pAny )
274 *pAny >>= bFound;
277 if ( bFound )
278 nCheckStatus |= 1;
279 nCheckStatus |= 2;
280 return bFound;
284 static void impl_execute( SdrView*, SfxRequest& rReq, SdrCustomShapeGeometryItem& rGeometryItem, SdrObject* pObj )
286 static const rtl::OUString sTextPath( RTL_CONSTASCII_USTRINGPARAM ( "TextPath" ) );
287 static const rtl::OUString sSameLetterHeights( RTL_CONSTASCII_USTRINGPARAM ( "SameLetterHeights" ) );
289 sal_uInt16 nSID = rReq.GetSlot();
290 switch( nSID )
292 case SID_FONTWORK_SAME_LETTER_HEIGHTS:
294 com::sun::star::uno::Any* pAny = rGeometryItem.GetPropertyValueByName( sTextPath, sSameLetterHeights );
295 if( pAny )
297 sal_Bool bOn;
298 (*pAny) >>= bOn;
299 bOn = !bOn;
300 (*pAny) <<= bOn;
303 break;
305 case SID_FONTWORK_ALIGNMENT:
307 if( rReq.GetArgs() && rReq.GetArgs()->GetItemState( SID_FONTWORK_ALIGNMENT ) == SFX_ITEM_SET )
309 sal_Int32 nValue = ((const SfxInt32Item*)rReq.GetArgs()->GetItem(SID_FONTWORK_ALIGNMENT))->GetValue();
310 if ( ( nValue >= 0 ) && ( nValue < 5 ) )
312 SdrFitToSizeType eFTS = SDRTEXTFIT_NONE;
313 SdrTextHorzAdjust eHorzAdjust;
314 switch ( nValue )
316 case 4 : eFTS = SDRTEXTFIT_ALLLINES; // passthrough
317 case 3 : eHorzAdjust = SDRTEXTHORZADJUST_BLOCK; break;
318 default:
319 case 0 : eHorzAdjust = SDRTEXTHORZADJUST_LEFT; break;
320 case 1 : eHorzAdjust = SDRTEXTHORZADJUST_CENTER; break;
321 case 2 : eHorzAdjust = SDRTEXTHORZADJUST_RIGHT; break;
323 pObj->SetMergedItem( SdrTextHorzAdjustItem( eHorzAdjust ) );
324 pObj->SetMergedItem( SdrTextFitToSizeTypeItem( eFTS ) );
325 pObj->BroadcastObjectChange();
329 break;
331 case SID_FONTWORK_CHARACTER_SPACING:
333 if( rReq.GetArgs() && ( rReq.GetArgs()->GetItemState( SID_FONTWORK_CHARACTER_SPACING ) == SFX_ITEM_SET ) )
335 sal_Int32 nCharSpacing = ((const SfxInt32Item*)rReq.GetArgs()->GetItem(SID_FONTWORK_CHARACTER_SPACING))->GetValue();
336 pObj->SetMergedItem( SvxCharScaleWidthItem( (sal_uInt16)nCharSpacing, EE_CHAR_FONTWIDTH ) );
337 pObj->BroadcastObjectChange();
340 break;
342 case SID_FONTWORK_KERN_CHARACTER_PAIRS:
344 if( rReq.GetArgs() && ( rReq.GetArgs()->GetItemState( SID_FONTWORK_KERN_CHARACTER_PAIRS ) == SFX_ITEM_SET ) )
346 // sal_Bool bKernCharacterPairs = ((const SfxBoolItem*)rReq.GetArgs()->GetItem(SID_FONTWORK_KERN_CHARACTER_PAIRS))->GetValue();
347 //TODO: pObj->SetMergedItem( SvxCharScaleWidthItem( (sal_uInt16)nCharSpacing, EE_CHAR_FONTWIDTH ) );
348 pObj->BroadcastObjectChange();
351 break;
355 #include "gallery.hxx"
356 #include <svx/fmmodel.hxx>
357 #include <svx/fmpage.hxx>
358 #include <svtools/itempool.hxx>
360 void GetGeometryForCustomShape( SdrCustomShapeGeometryItem& rGeometryItem, const rtl::OUString rCustomShape )
362 const rtl::OUString sType( RTL_CONSTASCII_USTRINGPARAM ( "Type" ) );
364 com::sun::star::beans::PropertyValue aPropVal;
365 aPropVal.Name = sType;
366 aPropVal.Value <<= rCustomShape;
367 rGeometryItem.SetPropertyValue( aPropVal );
369 const rtl::OUString sAdjustmentValues( RTL_CONSTASCII_USTRINGPARAM ( "AdjustmentValues" ) );
370 const rtl::OUString sCoordinateOrigin( RTL_CONSTASCII_USTRINGPARAM ( "CoordinateOrigin" ) );
371 const rtl::OUString sCoordinateSize( RTL_CONSTASCII_USTRINGPARAM ( "CoordinateSize" ) );
372 const rtl::OUString sEquations( RTL_CONSTASCII_USTRINGPARAM ( "Equations" ) );
373 const rtl::OUString sHandles( RTL_CONSTASCII_USTRINGPARAM ( "Handles" ) );
374 const rtl::OUString sPath( RTL_CONSTASCII_USTRINGPARAM ( "Path" ) );
375 rGeometryItem.ClearPropertyValue( sAdjustmentValues );
376 rGeometryItem.ClearPropertyValue( sCoordinateOrigin );
377 rGeometryItem.ClearPropertyValue( sCoordinateSize );
378 rGeometryItem.ClearPropertyValue( sEquations );
379 rGeometryItem.ClearPropertyValue( sHandles );
380 rGeometryItem.ClearPropertyValue( sPath );
382 /* SJ: CustomShapes that are available in the gallery are having the highest
383 priority, so we will take a look there before taking the internal default */
385 if ( GalleryExplorer::GetSdrObjCount( GALLERY_THEME_POWERPOINT ) )
387 std::vector< rtl::OUString > aObjList;
388 if ( GalleryExplorer::FillObjListTitle( GALLERY_THEME_POWERPOINT, aObjList ) )
390 sal_uInt16 i;
391 for ( i = 0; i < aObjList.size(); i++ )
393 if ( aObjList[ i ].equalsIgnoreAsciiCase( rCustomShape ) )
395 FmFormModel aFormModel;
396 SfxItemPool& rPool = aFormModel.GetItemPool();
397 rPool.FreezeIdRanges();
398 if ( GalleryExplorer::GetSdrObj( GALLERY_THEME_POWERPOINT, i, &aFormModel ) )
400 const SdrObject* pSourceObj = aFormModel.GetPage( 0 )->GetObj( 0 );
401 if( pSourceObj )
403 PropertyValue aPropVal_;
404 SdrCustomShapeGeometryItem& rSourceGeometry = (SdrCustomShapeGeometryItem&)pSourceObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY );
405 com::sun::star::uno::Any* pAny = rSourceGeometry.GetPropertyValueByName( sType );
406 if ( pAny )
408 aPropVal_.Name = sType;
409 aPropVal_.Value = *pAny;
410 rGeometryItem.SetPropertyValue( aPropVal_ );
412 pAny = rSourceGeometry.GetPropertyValueByName( sAdjustmentValues );
413 if ( pAny )
415 aPropVal_.Name = sAdjustmentValues;
416 aPropVal_.Value = *pAny;
417 rGeometryItem.SetPropertyValue( aPropVal_ );
419 pAny = rSourceGeometry.GetPropertyValueByName( sCoordinateOrigin );
420 if ( pAny )
422 aPropVal_.Name = sCoordinateOrigin;
423 aPropVal_.Value = *pAny;
424 rGeometryItem.SetPropertyValue( aPropVal_ );
426 pAny = rSourceGeometry.GetPropertyValueByName( sCoordinateSize );
427 if ( pAny )
429 aPropVal_.Name = sCoordinateSize;
430 aPropVal_.Value = *pAny;
431 rGeometryItem.SetPropertyValue( aPropVal_ );
433 pAny = rSourceGeometry.GetPropertyValueByName( sEquations );
434 if ( pAny )
436 aPropVal_.Name = sEquations;
437 aPropVal_.Value = *pAny;
438 rGeometryItem.SetPropertyValue( aPropVal_ );
440 pAny = rSourceGeometry.GetPropertyValueByName( sHandles );
441 if ( pAny )
443 aPropVal_.Name = sHandles;
444 aPropVal_.Value = *pAny;
445 rGeometryItem.SetPropertyValue( aPropVal_ );
447 pAny = rSourceGeometry.GetPropertyValueByName( sPath );
448 if ( pAny )
450 aPropVal_.Name = sPath;
451 aPropVal_.Value = *pAny;
452 rGeometryItem.SetPropertyValue( aPropVal_ );
463 void FontworkBar::execute( SdrView* pSdrView, SfxRequest& rReq, SfxBindings& rBindings )
465 sal_uInt16 nStrResId = 0;
467 sal_uInt16 nSID = rReq.GetSlot();
468 switch( nSID )
470 case SID_FONTWORK_GALLERY_FLOATER:
472 FontWorkGalleryDialog aDlg( pSdrView, ImpGetViewWin(pSdrView), nSID );
473 aDlg.Execute();
475 break;
477 case SID_FONTWORK_SHAPE_TYPE:
479 rtl::OUString aCustomShape;
480 const SfxItemSet* pArgs = rReq.GetArgs();
481 if ( pArgs )
483 const SfxStringItem& rItm = (const SfxStringItem&)pArgs->Get( rReq.GetSlot() );
484 aCustomShape = rItm.GetValue();
486 if ( aCustomShape.getLength() )
488 const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
489 sal_uInt32 nCount = rMarkList.GetMarkCount(), i;
490 for( i = 0; i < nCount; i++ )
492 SdrObject* pObj = rMarkList.GetMark( i )->GetMarkedSdrObj();
493 if( pObj->ISA(SdrObjCustomShape) )
495 const bool bUndo = pSdrView->IsUndoEnabled();
497 if( bUndo )
499 String aStr( SVX_RES( RID_SVXSTR_UNDO_APPLY_FONTWORK_SHAPE ) );
500 pSdrView->BegUndo( aStr );
501 pSdrView->AddUndo( pSdrView->GetModel()->GetSdrUndoFactory().CreateUndoAttrObject( *pObj ) );
503 SdrCustomShapeGeometryItem aGeometryItem( (SdrCustomShapeGeometryItem&)pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
504 GetGeometryForCustomShape( aGeometryItem, aCustomShape );
505 pObj->SetMergedItem( aGeometryItem );
507 Reference< drawing::XShape > aXShape = GetXShapeForSdrObject( (SdrObjCustomShape*)pObj );
508 if ( aXShape.is() )
510 Reference< drawing::XEnhancedCustomShapeDefaulter > xDefaulter( aXShape, UNO_QUERY );
511 if( xDefaulter.is() )
512 xDefaulter->createCustomShapeDefaults( aCustomShape );
515 pObj->BroadcastObjectChange();
516 if( bUndo )
517 pSdrView->EndUndo();
518 pSdrView->AdjustMarkHdl(); //HMH sal_True );
519 rBindings.Invalidate( SID_FONTWORK_SHAPE_TYPE );
524 break;
526 case SID_FONTWORK_CHARACTER_SPACING_DIALOG :
528 if( rReq.GetArgs() && ( rReq.GetArgs()->GetItemState( SID_FONTWORK_CHARACTER_SPACING ) == SFX_ITEM_SET ) )
530 sal_Int32 nCharSpacing = ((const SfxInt32Item*)rReq.GetArgs()->GetItem(SID_FONTWORK_CHARACTER_SPACING))->GetValue();
531 FontworkCharacterSpacingDialog aDlg( 0L, nCharSpacing );
532 USHORT nRet = aDlg.Execute();
533 if( nRet != 0 )
535 SfxInt32Item aItem( SID_FONTWORK_CHARACTER_SPACING, aDlg.getScale() );
536 SfxPoolItem* aItems[] = { &aItem, 0 };
537 rBindings.Execute( SID_FONTWORK_CHARACTER_SPACING, (const SfxPoolItem**)aItems );
541 break;
543 case SID_FONTWORK_SHAPE:
544 case SID_FONTWORK_ALIGNMENT:
546 if ( !nStrResId )
547 nStrResId = RID_SVXSTR_UNDO_APPLY_FONTWORK_ALIGNMENT;
548 } // PASSTROUGH
549 case SID_FONTWORK_CHARACTER_SPACING:
551 if ( !nStrResId )
552 nStrResId = RID_SVXSTR_UNDO_APPLY_FONTWORK_CHARACTER_SPACING;
553 } // PASSTROUGH
554 case SID_FONTWORK_KERN_CHARACTER_PAIRS:
556 if ( !nStrResId )
557 nStrResId = RID_SVXSTR_UNDO_APPLY_FONTWORK_CHARACTER_SPACING;
558 } // PASSTROUGH
559 case SID_FONTWORK_SAME_LETTER_HEIGHTS:
561 if ( !nStrResId )
562 nStrResId = RID_SVXSTR_UNDO_APPLY_FONTWORK_SAME_LETTER_HEIGHT;
564 const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
565 ULONG nCount = rMarkList.GetMarkCount(), i;
566 for( i = 0; i < nCount; i++ )
568 SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
569 if( pObj->ISA(SdrObjCustomShape) )
571 const bool bUndo = pSdrView->IsUndoEnabled();
572 if( bUndo )
574 String aStr( SVX_RES( nStrResId ) );
575 pSdrView->BegUndo( aStr );
576 pSdrView->AddUndo( pSdrView->GetModel()->GetSdrUndoFactory().CreateUndoAttrObject( *pObj ) );
578 SdrCustomShapeGeometryItem aGeometryItem( (SdrCustomShapeGeometryItem&)pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
579 impl_execute( pSdrView, rReq, aGeometryItem, pObj );
580 pObj->SetMergedItem( aGeometryItem );
581 pObj->BroadcastObjectChange();
582 if( bUndo )
583 pSdrView->EndUndo();
587 break;
591 void FontworkBar::getState( SdrView* pSdrView, SfxItemSet& rSet )
593 sal_uInt32 nCheckStatus = 0;
596 if ( rSet.GetItemState( SID_FONTWORK_SHAPE ) != SFX_ITEM_UNKNOWN )
598 sal_Bool bBreak = sal_True;
601 if ( rSet.GetItemState( SID_FONTWORK_ALIGNMENT_FLOATER ) != SFX_ITEM_UNKNOWN )
603 if ( !checkForSelectedFontWork( pSdrView, nCheckStatus ) )
604 rSet.DisableItem( SID_FONTWORK_ALIGNMENT_FLOATER );
606 if ( rSet.GetItemState( SID_FONTWORK_ALIGNMENT ) != SFX_ITEM_UNKNOWN )
608 if ( !checkForSelectedFontWork( pSdrView, nCheckStatus ) )
609 rSet.DisableItem( SID_FONTWORK_ALIGNMENT );
610 else
611 SetAlignmentState( pSdrView, rSet );
613 if ( rSet.GetItemState( SID_FONTWORK_CHARACTER_SPACING_FLOATER ) != SFX_ITEM_UNKNOWN )
615 if ( !checkForSelectedFontWork( pSdrView, nCheckStatus ) )
616 rSet.DisableItem( SID_FONTWORK_CHARACTER_SPACING_FLOATER );
618 if ( rSet.GetItemState( SID_FONTWORK_CHARACTER_SPACING ) != SFX_ITEM_UNKNOWN )
620 if ( !checkForSelectedFontWork( pSdrView, nCheckStatus ) )
621 rSet.DisableItem( SID_FONTWORK_CHARACTER_SPACING );
622 else
623 SetCharacterSpacingState( pSdrView, rSet );
625 if ( rSet.GetItemState( SID_FONTWORK_KERN_CHARACTER_PAIRS ) != SFX_ITEM_UNKNOWN )
627 if ( !checkForSelectedFontWork( pSdrView, nCheckStatus ) )
628 rSet.DisableItem( SID_FONTWORK_KERN_CHARACTER_PAIRS );
629 else
630 SetKernCharacterPairsState( pSdrView, rSet );
632 if ( rSet.GetItemState( SID_FONTWORK_SAME_LETTER_HEIGHTS ) != SFX_ITEM_UNKNOWN )
634 if ( !checkForSelectedFontWork( pSdrView, nCheckStatus ) )
635 rSet.DisableItem( SID_FONTWORK_SAME_LETTER_HEIGHTS );
637 if ( rSet.GetItemState( SID_FONTWORK_SHAPE_TYPE ) != SFX_ITEM_UNKNOWN )
639 if ( !checkForSelectedFontWork( pSdrView, nCheckStatus ) )
640 rSet.DisableItem( SID_FONTWORK_SHAPE_TYPE );
641 else
642 SetFontWorkShapeTypeState( pSdrView, rSet );