summaryrefslogtreecommitdiff
path: root/chart2/source/controller
diff options
context:
space:
mode:
Diffstat (limited to 'chart2/source/controller')
-rw-r--r--chart2/source/controller/main/ChartController_Window.cxx15
-rw-r--r--chart2/source/controller/main/DrawCommandDispatch.cxx37
2 files changed, 51 insertions, 1 deletions
diff --git a/chart2/source/controller/main/ChartController_Window.cxx b/chart2/source/controller/main/ChartController_Window.cxx
index 62be489e086f..79067cb04eae 100644
--- a/chart2/source/controller/main/ChartController_Window.cxx
+++ b/chart2/source/controller/main/ChartController_Window.cxx
@@ -582,7 +582,15 @@ void ChartController::execute_MouseButtonDown( const MouseEvent& rMEvt )
}
if ( !pDrawViewWrapper->IsAction() )
{
- pDrawViewWrapper->BegCreateObj( aMPos);
+ if ( pDrawViewWrapper->GetCurrentObjIdentifier() == OBJ_CAPTION )
+ {
+ Size aCaptionSize( 2268, 1134 );
+ pDrawViewWrapper->BegCreateCaptionObj( aMPos, aCaptionSize );
+ }
+ else
+ {
+ pDrawViewWrapper->BegCreateObj( aMPos);
+ }
SdrObject* pObj = pDrawViewWrapper->GetCreateObj();
DrawCommandDispatch* pDrawCommandDispatch = m_aDispatchContainer.getDrawCommandDispatch();
if ( pObj && m_pDrawModelWrapper && pDrawCommandDispatch )
@@ -1644,6 +1652,11 @@ void ChartController::impl_SetMousePointer( const MouseEvent & rEvent )
ePointerStyle = POINTER_DRAW_TEXT;
}
break;
+ case OBJ_CAPTION:
+ {
+ ePointerStyle = POINTER_DRAW_CAPTION;
+ }
+ break;
default:
{
ePointerStyle = POINTER_DRAW_RECT;
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 );