diff options
author | Thomas Benisch <tbe@openoffice.org> | 2009-06-05 17:50:16 +0000 |
---|---|---|
committer | Thomas Benisch <tbe@openoffice.org> | 2009-06-05 17:50:16 +0000 |
commit | 13791e4a6ab502a88d9ac0eb856c03d30e4db7bf (patch) | |
tree | ac3338d60f0e9ed2ff497901c4994f0b9f3e987a /chart2/source | |
parent | 8646438124f0fce7656d4c84ed78ff917e6baa9d (diff) |
#i12587# Inserting/editing arbitrary text objects in chart
Diffstat (limited to 'chart2/source')
-rw-r--r-- | chart2/source/controller/inc/SchSlotIds.hxx | 1 | ||||
-rw-r--r-- | chart2/source/controller/main/ShapeController.cxx | 45 | ||||
-rw-r--r-- | chart2/source/controller/main/ShapeController.hxx | 1 | ||||
-rw-r--r-- | chart2/source/controller/menus/ShapeContextMenu.src | 7 |
4 files changed, 54 insertions, 0 deletions
diff --git a/chart2/source/controller/inc/SchSlotIds.hxx b/chart2/source/controller/inc/SchSlotIds.hxx index f65b2f9badcb..df4ba2e66398 100644 --- a/chart2/source/controller/inc/SchSlotIds.hxx +++ b/chart2/source/controller/inc/SchSlotIds.hxx @@ -38,6 +38,7 @@ //#define SID_COPYFORMAT SID_OBJ1_START //not used as slot in old chart //#define SID_PASTEFORMAT (SID_OBJ1_START + 1) +#define SID_ATTRIBUTES_TEXT (SID_OBJ1_START + 1) //still used as help id #define SID_DIAGRAM_DATA (SID_OBJ1_START + 2) diff --git a/chart2/source/controller/main/ShapeController.cxx b/chart2/source/controller/main/ShapeController.cxx index fe150d5a2d76..4d83446fb176 100644 --- a/chart2/source/controller/main/ShapeController.cxx +++ b/chart2/source/controller/main/ShapeController.cxx @@ -37,6 +37,7 @@ #include "ViewElementListProvider.hxx" #include "dlg_ShapeFont.hxx" #include "chartview/DrawModelWrapper.hxx" +#include "SchSlotIds.hxx" #include <vos/mutex.hxx> #include <vcl/msgbox.hxx> @@ -97,6 +98,7 @@ FeatureState ShapeController::getState( const ::rtl::OUString& rCommand ) const { case SID_ATTRIBUTES_LINE: case SID_ATTRIBUTES_AREA: + case SID_ATTRIBUTES_TEXT: case SID_ATTR_TRANSFORM: case SID_CHAR_DLG: { @@ -133,6 +135,11 @@ void ShapeController::execute( const ::rtl::OUString& rCommand, const Sequence< executeDispatch_FormatArea(); } break; + case SID_ATTRIBUTES_TEXT: + { + executeDispatch_TextAttributes(); + } + break; case SID_ATTR_TRANSFORM: { executeDispatch_TransformDialog(); @@ -154,6 +161,7 @@ void ShapeController::describeSupportedFeatures() { implDescribeSupportedFeature( ".uno:FormatLine", SID_ATTRIBUTES_LINE, CommandGroup::FORMAT ); implDescribeSupportedFeature( ".uno:FormatArea", SID_ATTRIBUTES_AREA, CommandGroup::FORMAT ); + implDescribeSupportedFeature( ".uno:TextAttributes", SID_ATTRIBUTES_TEXT, CommandGroup::FORMAT ); implDescribeSupportedFeature( ".uno:TransformDialog", SID_ATTR_TRANSFORM, CommandGroup::FORMAT ); implDescribeSupportedFeature( ".uno:FontDialog", SID_CHAR_DLG, CommandGroup::EDIT ); } @@ -247,6 +255,43 @@ void ShapeController::executeDispatch_FormatArea() } } +void ShapeController::executeDispatch_TextAttributes() +{ + if ( m_pChartController ) + { + Window* pParent = dynamic_cast< Window* >( m_pChartController->m_pChartWindow ); + DrawViewWrapper* pDrawViewWrapper = m_pChartController->GetDrawViewWrapper(); + if ( pParent && pDrawViewWrapper ) + { + SfxItemSet aAttr( pDrawViewWrapper->GetDefaultAttr() ); + BOOL bHasMarked = pDrawViewWrapper->AreObjectsMarked(); + if ( bHasMarked ) + { + pDrawViewWrapper->MergeAttrFromMarked( aAttr, FALSE ); + } + ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); + if ( pFact ) + { + ::boost::scoped_ptr< SfxAbstractTabDialog > pDlg( + pFact->CreateTextTabDialog( pParent, &aAttr, RID_SVXDLG_TEXT, pDrawViewWrapper ) ); + if ( pDlg.get() && ( pDlg->Execute() == RET_OK ) ) + { + const SfxItemSet* pOutAttr = pDlg->GetOutputItemSet(); + if ( bHasMarked ) + { + pDrawViewWrapper->SetAttributes( *pOutAttr ); + } + else + { + pDrawViewWrapper->SetDefaultAttr( *pOutAttr, FALSE ); + } + } + } + } + } +} + void ShapeController::executeDispatch_TransformDialog() { if ( m_pChartController ) diff --git a/chart2/source/controller/main/ShapeController.hxx b/chart2/source/controller/main/ShapeController.hxx index bd495e465b9a..76b4285a7dbf 100644 --- a/chart2/source/controller/main/ShapeController.hxx +++ b/chart2/source/controller/main/ShapeController.hxx @@ -71,6 +71,7 @@ protected: private: void executeDispatch_FormatLine(); void executeDispatch_FormatArea(); + void executeDispatch_TextAttributes(); void executeDispatch_TransformDialog(); void executeDispatch_FontDialog(); diff --git a/chart2/source/controller/menus/ShapeContextMenu.src b/chart2/source/controller/menus/ShapeContextMenu.src index 1b292bd93cf6..d5afaeb52b1b 100644 --- a/chart2/source/controller/menus/ShapeContextMenu.src +++ b/chart2/source/controller/menus/ShapeContextMenu.src @@ -28,6 +28,7 @@ * ************************************************************************/ #include "MenuResIds.hrc" +#include "SchSlotIds.hxx" #include <svx/globlmn.hrc> #include <svx/svxids.hrc> @@ -50,6 +51,12 @@ Menu RID_CONTEXTMENU_SHAPE }; MenuItem { + Identifier = SID_ATTRIBUTES_TEXT; + HelpId = SID_ATTRIBUTES_TEXT; + Command = ".uno:TextAttributes"; + }; + MenuItem + { Identifier = SID_ATTR_TRANSFORM; HelpId = SID_ATTR_TRANSFORM; Command = ".uno:TransformDialog"; |