diff options
Diffstat (limited to 'chart2/source/controller/dialogs/res_LegendPosition.cxx')
-rw-r--r-- | chart2/source/controller/dialogs/res_LegendPosition.cxx | 93 |
1 files changed, 52 insertions, 41 deletions
diff --git a/chart2/source/controller/dialogs/res_LegendPosition.cxx b/chart2/source/controller/dialogs/res_LegendPosition.cxx index 0bbfcb7eee68..4093cf34894f 100644 --- a/chart2/source/controller/dialogs/res_LegendPosition.cxx +++ b/chart2/source/controller/dialogs/res_LegendPosition.cxx @@ -41,13 +41,12 @@ #include <svtools/controldims.hrc> #endif #include <com/sun/star/chart2/LegendPosition.hpp> -#include <com/sun/star/chart2/LegendExpansion.hpp> +#include <com/sun/star/chart/ChartLegendExpansion.hpp> //itemset stuff #include "chartview/ChartSfxItemIds.hxx" -#include <svx/chrtitem.hxx> -// header for class SfxItemPool -#include <svl/itempool.hxx> +#include <svl/intitem.hxx> +#include <svl/eitem.hxx> //............................................................................. namespace chart @@ -61,8 +60,8 @@ LegendPositionResources::LegendPositionResources( Window* pWindow ) : m_xCC() //unused in this scenario , m_aCbxShow( pWindow ) //unused in this scenario , m_aRbtLeft( pWindow, SchResId(RBT_LEFT) ) - , m_aRbtTop( pWindow, SchResId(RBT_TOP) ) , m_aRbtRight( pWindow, SchResId(RBT_RIGHT) ) + , m_aRbtTop( pWindow, SchResId(RBT_TOP) ) , m_aRbtBottom( pWindow, SchResId(RBT_BOTTOM) ) { m_aCbxShow.Check();//legend is assumed to be visible in this scenario @@ -73,12 +72,17 @@ LegendPositionResources::LegendPositionResources( Window* pWindow, const uno::Re : m_xCC( xCC ) , m_aCbxShow( pWindow, SchResId(CBX_SHOWLEGEND) ) , m_aRbtLeft( pWindow, SchResId(RBT_LEFT) ) - , m_aRbtTop( pWindow, SchResId(RBT_TOP) ) , m_aRbtRight( pWindow, SchResId(RBT_RIGHT) ) + , m_aRbtTop( pWindow, SchResId(RBT_TOP) ) , m_aRbtBottom( pWindow, SchResId(RBT_BOTTOM) ) { m_aCbxShow.SetToggleHdl( LINK( this, LegendPositionResources, PositionEnableHdl ) ); impl_setRadioButtonToggleHdl(); + m_aCbxShow.SetAccessibleRelationMemberOf(&m_aCbxShow); + m_aRbtLeft.SetAccessibleRelationMemberOf(&m_aCbxShow); + m_aRbtRight.SetAccessibleRelationMemberOf(&m_aCbxShow); + m_aRbtTop.SetAccessibleRelationMemberOf(&m_aCbxShow); + m_aRbtBottom.SetAccessibleRelationMemberOf(&m_aCbxShow); } void LegendPositionResources::impl_setRadioButtonToggleHdl() @@ -151,7 +155,7 @@ void LegendPositionResources::writeToModel( const ::com::sun::star::uno::Referen //position chart2::LegendPosition eNewPos; - chart2::LegendExpansion eExp = chart2::LegendExpansion_HIGH; + ::com::sun::star::chart::ChartLegendExpansion eExp = ::com::sun::star::chart::ChartLegendExpansion_HIGH; if( m_aRbtLeft.IsChecked() ) eNewPos = chart2::LegendPosition_LINE_START; @@ -162,12 +166,12 @@ void LegendPositionResources::writeToModel( const ::com::sun::star::uno::Referen else if( m_aRbtTop.IsChecked() ) { eNewPos = chart2::LegendPosition_PAGE_START; - eExp = chart2::LegendExpansion_WIDE; + eExp = ::com::sun::star::chart::ChartLegendExpansion_WIDE; } else if( m_aRbtBottom.IsChecked() ) { eNewPos = chart2::LegendPosition_PAGE_END; - eExp = chart2::LegendExpansion_WIDE; + eExp = ::com::sun::star::chart::ChartLegendExpansion_WIDE; } xProp->setPropertyValue( C2U( "AnchorPosition" ), uno::makeAny( eNewPos )); @@ -197,51 +201,50 @@ IMPL_LINK( LegendPositionResources, PositionEnableHdl, void*, EMPTYARG ) void LegendPositionResources::initFromItemSet( const SfxItemSet& rInAttrs ) { - SvxChartLegendPos ePos = CHLEGEND_NONE; - const SfxPoolItem* pPoolItem = NULL; - if( rInAttrs.GetItemState( SCHATTR_LEGEND_POS, - sal_True, &pPoolItem ) != SFX_ITEM_SET ) - pPoolItem = &(rInAttrs.GetPool()->GetDefaultItem( SCHATTR_LEGEND_POS )); - - if( pPoolItem ) - ePos = ((const SvxChartLegendPosItem*)pPoolItem)->GetValue(); + if( rInAttrs.GetItemState( SCHATTR_LEGEND_POS, sal_True, &pPoolItem ) == SFX_ITEM_SET ) + { + sal_Int32 nLegendPosition = ((const SfxInt32Item*)pPoolItem)->GetValue(); + switch( nLegendPosition ) + { + case chart2::LegendPosition_LINE_START: + m_aRbtLeft.Check(sal_True); + break; + case chart2::LegendPosition_PAGE_START: + m_aRbtTop.Check(sal_True); + break; + case chart2::LegendPosition_LINE_END: + m_aRbtRight.Check(sal_True); + break; + case chart2::LegendPosition_PAGE_END: + m_aRbtBottom.Check(sal_True); + break; + default: + break; + } + } - switch( ePos ) + if( rInAttrs.GetItemState( SCHATTR_LEGEND_SHOW, sal_True, &pPoolItem ) == SFX_ITEM_SET ) { - case CHLEGEND_LEFT: - m_aRbtLeft.Check(sal_True); - break; - case CHLEGEND_TOP: - m_aRbtTop.Check(sal_True); - break; - case CHLEGEND_RIGHT: - m_aRbtRight.Check(sal_True); - break; - case CHLEGEND_BOTTOM: - m_aRbtBottom.Check(sal_True); - break; - default: - break; + bool bShow = static_cast< const SfxBoolItem * >( pPoolItem )->GetValue(); + m_aCbxShow.Check(bShow); } } void LegendPositionResources::writeToItemSet( SfxItemSet& rOutAttrs ) const { - SvxChartLegendPos ePos; - + sal_Int32 nLegendPosition = chart2::LegendPosition_CUSTOM; if( m_aRbtLeft.IsChecked() ) - ePos = CHLEGEND_LEFT; + nLegendPosition = chart2::LegendPosition_LINE_START; else if( m_aRbtTop.IsChecked() ) - ePos = CHLEGEND_TOP; + nLegendPosition = chart2::LegendPosition_PAGE_START; else if( m_aRbtRight.IsChecked() ) - ePos = CHLEGEND_RIGHT; + nLegendPosition = chart2::LegendPosition_LINE_END; else if( m_aRbtBottom.IsChecked() ) - ePos = CHLEGEND_BOTTOM; - else - ePos = CHLEGEND_NONE; + nLegendPosition = chart2::LegendPosition_PAGE_END; + rOutAttrs.Put(SfxInt32Item(SCHATTR_LEGEND_POS, nLegendPosition )); - rOutAttrs.Put(SvxChartLegendPosItem( ePos, SCHATTR_LEGEND_POS )); + rOutAttrs.Put( SfxBoolItem(SCHATTR_LEGEND_SHOW, m_aCbxShow.IsChecked()) ); } IMPL_LINK( LegendPositionResources, PositionChangeHdl, RadioButton*, pRadio ) @@ -259,6 +262,14 @@ void LegendPositionResources::SetChangeHdl( const Link& rLink ) m_aChangeLink = rLink; } +void LegendPositionResources::SetAccessibleRelationMemberOf(Window* pMemberOf) +{ + m_aRbtLeft.SetAccessibleRelationMemberOf(pMemberOf); + m_aRbtRight.SetAccessibleRelationMemberOf(pMemberOf); + m_aRbtTop.SetAccessibleRelationMemberOf(pMemberOf); + m_aRbtBottom.SetAccessibleRelationMemberOf(pMemberOf); +} + //............................................................................. } //namespace chart //............................................................................. |