diff options
author | Thomas Benisch <tbe@openoffice.org> | 2009-10-06 14:07:41 +0000 |
---|---|---|
committer | Thomas Benisch <tbe@openoffice.org> | 2009-10-06 14:07:41 +0000 |
commit | 2ae7f63bebe17dbcfb02d2219971aecc91a78820 (patch) | |
tree | b4372b34df99efca10a0467ef32b9d39f1744a77 /chart2/source/controller/main/DrawCommandDispatch.cxx | |
parent | 884d21f1e632388d5f72a94a8887069119ff6c97 (diff) |
#i12587# Inserting/editing arbitrary text objects in chart
Diffstat (limited to 'chart2/source/controller/main/DrawCommandDispatch.cxx')
-rw-r--r-- | chart2/source/controller/main/DrawCommandDispatch.cxx | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/chart2/source/controller/main/DrawCommandDispatch.cxx b/chart2/source/controller/main/DrawCommandDispatch.cxx index 646d5dbcacb4..e10a8b4125d4 100644 --- a/chart2/source/controller/main/DrawCommandDispatch.cxx +++ b/chart2/source/controller/main/DrawCommandDispatch.cxx @@ -42,6 +42,7 @@ #include <vcl/svapp.hxx> #include <svx/dialogs.hrc> #include <svx/dialmgr.hxx> +#include <svx/svdocapt.hxx> #include <svx/svdopath.hxx> #include <svx/svdpage.hxx> #include <svx/svxids.hrc> @@ -190,6 +191,7 @@ FeatureState DrawCommandDispatch::getState( const ::rtl::OUString& rCommand ) case SID_DRAW_RECT: case SID_DRAW_ELLIPSE: case SID_DRAW_TEXT: + case SID_DRAW_CAPTION: { aReturn.bEnabled = true; aReturn.aState <<= false; @@ -250,6 +252,12 @@ void DrawCommandDispatch::execute( const ::rtl::OUString& rCommand, const Sequen bCreate = true; } break; + case SID_DRAW_CAPTION: + { + eDrawMode = CHARTDRAW_INSERT; + eKind = OBJ_CAPTION; + } + break; default: { eDrawMode = CHARTDRAW_SELECT; @@ -311,6 +319,7 @@ void DrawCommandDispatch::describeSupportedFeatures() implDescribeSupportedFeature( ".uno:Rect", SID_DRAW_RECT, CommandGroup::INSERT ); implDescribeSupportedFeature( ".uno:Ellipse", SID_DRAW_ELLIPSE, CommandGroup::INSERT ); implDescribeSupportedFeature( ".uno:DrawText", SID_DRAW_TEXT, CommandGroup::INSERT ); + implDescribeSupportedFeature( ".uno:DrawCaption", SID_DRAW_CAPTION, CommandGroup::INSERT ); } void DrawCommandDispatch::setInsertObj( USHORT eObj, const ::rtl::OUString& rShapeType ) @@ -394,6 +403,34 @@ SdrObject* DrawCommandDispatch::createDefaultObject( const sal_uInt16 nID ) } } break; + case SID_DRAW_CAPTION: + case SID_DRAW_CAPTION_VERTICAL: + { + if ( pObj->ISA( SdrCaptionObj ) ) + { + sal_Bool bIsVertical( SID_DRAW_CAPTION_VERTICAL == nID ); + SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( pObj ); + if ( pTextObj ) + { + pTextObj->SetVerticalWriting( bIsVertical ); + } + if ( bIsVertical ) + { + SfxItemSet aSet( pObj->GetMergedItemSet() ); + aSet.Put( SdrTextVertAdjustItem( SDRTEXTVERTADJUST_CENTER ) ); + aSet.Put( SdrTextHorzAdjustItem( SDRTEXTHORZADJUST_RIGHT ) ); + pObj->SetMergedItemSet( aSet ); + } + SdrCaptionObj* pCaptionObj = dynamic_cast< SdrCaptionObj* >( pObj ); + if ( pCaptionObj ) + { + pCaptionObj->SetLogicRect( aRect ); + pCaptionObj->SetTailPos( + aRect.TopLeft() - Point( aRect.GetWidth() / 2, aRect.GetHeight() / 2 ) ); + } + } + } + break; default: { pObj->SetLogicRect( aRect ); |