diff options
author | Ingrid Halama [iha] <Ingrid.Halama@oracle.com> | 2011-01-25 18:24:23 +0100 |
---|---|---|
committer | Ingrid Halama [iha] <Ingrid.Halama@oracle.com> | 2011-01-25 18:24:23 +0100 |
commit | a5da1bb72dbda9806855e926b59f9e541c95d8b5 (patch) | |
tree | a21593d1eb962e048ffbfb3b71e8ce85c173f162 | |
parent | 6f68642b7b2310b902264849a5ffc5dca6c15510 (diff) | |
parent | 5c86cbeb5891e8f4b03718b2ec4fc845f39b48a1 (diff) |
chart52: merge with DEV300_m98
-rwxr-xr-x | chart2/source/controller/chartapiwrapper/LegendWrapper.cxx | 21 | ||||
-rw-r--r-- | chart2/source/controller/dialogs/res_LegendPosition.cxx | 8 | ||||
-rw-r--r-- | chart2/source/controller/itemsetwrapper/LegendItemConverter.cxx | 8 | ||||
-rw-r--r-- | chart2/source/controller/main/ChartController_Position.cxx | 15 | ||||
-rw-r--r-- | chart2/source/controller/main/ChartController_Tools.cxx | 4 | ||||
-rw-r--r-- | chart2/source/controller/main/ChartController_Window.cxx | 16 | ||||
-rw-r--r-- | chart2/source/controller/main/PositionAndSizeHelper.cxx | 59 | ||||
-rw-r--r-- | chart2/source/controller/main/SelectionHelper.cxx | 1 | ||||
-rwxr-xr-x | chart2/source/model/main/Legend.cxx | 23 | ||||
-rwxr-xr-x | chart2/source/tools/LegendHelper.cxx | 8 | ||||
-rw-r--r-- | chart2/source/view/charttypes/VSeriesPlotter.cxx | 4 | ||||
-rw-r--r-- | chart2/source/view/inc/LegendEntryProvider.hxx | 4 | ||||
-rw-r--r-- | chart2/source/view/inc/VSeriesPlotter.hxx | 2 | ||||
-rw-r--r-- | chart2/source/view/main/VLegend.cxx | 207 | ||||
-rw-r--r-- | sc/source/filter/excel/xechart.cxx | 6 | ||||
-rw-r--r--[-rwxr-xr-x] | sc/source/filter/excel/xichart.cxx | 22 |
16 files changed, 261 insertions, 147 deletions
diff --git a/chart2/source/controller/chartapiwrapper/LegendWrapper.cxx b/chart2/source/controller/chartapiwrapper/LegendWrapper.cxx index 5b71c7d3e768..05848422f885 100755 --- a/chart2/source/controller/chartapiwrapper/LegendWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/LegendWrapper.cxx @@ -37,7 +37,7 @@ #include <com/sun/star/chart2/XTitled.hpp> #include <com/sun/star/chart/ChartLegendPosition.hpp> #include <com/sun/star/chart2/LegendPosition.hpp> -#include <com/sun/star/chart2/LegendExpansion.hpp> +#include <com/sun/star/chart/ChartLegendExpansion.hpp> #include <com/sun/star/chart2/RelativePosition.hpp> #include <com/sun/star/drawing/FillStyle.hpp> @@ -139,13 +139,13 @@ void WrappedLegendAlignmentProperty::setPropertyValue( const Any& rOuterValue, c chart2::LegendPosition eNewInnerPos(chart2::LegendPosition_LINE_END); if( aInnerValue >>= eNewInnerPos ) { - chart2::LegendExpansion eNewExpansion = + ::com::sun::star::chart::ChartLegendExpansion eNewExpansion = ( eNewInnerPos == chart2::LegendPosition_LINE_END || eNewInnerPos == chart2::LegendPosition_LINE_START ) - ? chart2::LegendExpansion_HIGH - : chart2::LegendExpansion_WIDE; + ? ::com::sun::star::chart::ChartLegendExpansion_HIGH + : ::com::sun::star::chart::ChartLegendExpansion_WIDE; - chart2::LegendExpansion eOldExpansion( chart2::LegendExpansion_HIGH ); + ::com::sun::star::chart::ChartLegendExpansion eOldExpansion( ::com::sun::star::chart::ChartLegendExpansion_HIGH ); bool bExpansionWasSet( xInnerPropertySet->getPropertyValue( C2U( "Expansion" ) ) >>= eOldExpansion ); @@ -232,7 +232,8 @@ static const ::rtl::OUString lcl_aServiceName( enum { - PROP_LEGEND_ALIGNMENT + PROP_LEGEND_ALIGNMENT, + PROP_LEGEND_EXPANSION }; void lcl_AddPropertiesToVector( @@ -244,6 +245,13 @@ void lcl_AddPropertiesToVector( ::getCppuType( reinterpret_cast< const ::com::sun::star::chart::ChartLegendPosition * >(0)), //#i111967# no PropertyChangeEvent is fired on change so far beans::PropertyAttribute::MAYBEDEFAULT )); + + rOutProperties.push_back( + Property( C2U( "Expansion" ), + PROP_LEGEND_EXPANSION, + ::getCppuType( reinterpret_cast< const ::com::sun::star::chart::ChartLegendExpansion * >(0)), + //#i111967# no PropertyChangeEvent is fired on change so far + beans::PropertyAttribute::MAYBEDEFAULT )); } struct StaticLegendWrapperPropertyArray_Initializer @@ -429,6 +437,7 @@ const std::vector< WrappedProperty* > LegendWrapper::createWrappedProperties() ::std::vector< ::chart::WrappedProperty* > aWrappedProperties; aWrappedProperties.push_back( new WrappedLegendAlignmentProperty() ); + aWrappedProperties.push_back( new WrappedProperty( C2U("Expansion"), C2U("Expansion") )); WrappedCharacterHeightProperty::addWrappedProperties( aWrappedProperties, this ); //same problem as for wall: thje defaults ion the old chart are different for different charttypes, so we need to export explicitly aWrappedProperties.push_back( new WrappedDirectStateProperty( C2U("FillStyle"), C2U("FillStyle") ) ); diff --git a/chart2/source/controller/dialogs/res_LegendPosition.cxx b/chart2/source/controller/dialogs/res_LegendPosition.cxx index c9206a5428df..4d6c7509052c 100644 --- a/chart2/source/controller/dialogs/res_LegendPosition.cxx +++ b/chart2/source/controller/dialogs/res_LegendPosition.cxx @@ -41,7 +41,7 @@ #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" @@ -151,7 +151,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 +162,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 )); diff --git a/chart2/source/controller/itemsetwrapper/LegendItemConverter.cxx b/chart2/source/controller/itemsetwrapper/LegendItemConverter.cxx index 3af6d9342f33..c02df4aa4bfc 100644 --- a/chart2/source/controller/itemsetwrapper/LegendItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/LegendItemConverter.cxx @@ -36,7 +36,7 @@ #include <svx/chrtitem.hxx> #include <com/sun/star/chart2/XLegend.hpp> #include <com/sun/star/chart2/LegendPosition.hpp> -#include <com/sun/star/chart2/LegendExpansion.hpp> +#include <com/sun/star/chart/ChartLegendExpansion.hpp> #include <functional> #include <algorithm> @@ -164,9 +164,9 @@ bool LegendItemConverter::ApplySpecialItem( ( eOldPos != eNewPos )) { GetPropertySet()->setPropertyValue( C2U( "AnchorPosition" ), uno::makeAny( eNewPos )); - chart2::LegendExpansion eExp = bIsWide - ? chart2::LegendExpansion_WIDE - : chart2::LegendExpansion_HIGH; + ::com::sun::star::chart::ChartLegendExpansion eExp = bIsWide + ? ::com::sun::star::chart::ChartLegendExpansion_WIDE + : ::com::sun::star::chart::ChartLegendExpansion_HIGH; GetPropertySet()->setPropertyValue( C2U( "Expansion" ), uno::makeAny( eExp )); GetPropertySet()->setPropertyValue( C2U( "RelativePosition" ), uno::Any()); bChanged = true; diff --git a/chart2/source/controller/main/ChartController_Position.cxx b/chart2/source/controller/main/ChartController_Position.cxx index 619d308ffad2..5b7fa68dcea1 100644 --- a/chart2/source/controller/main/ChartController_Position.cxx +++ b/chart2/source/controller/main/ChartController_Position.cxx @@ -37,6 +37,7 @@ #include "UndoGuard.hxx" #include "Strings.hrc" #include "ObjectNameProvider.hxx" +#include "DiagramHelper.hxx" #include "chartview/ExplicitValueProvider.hxx" #include "CommonConverters.hxx" #include <svx/ActionDescriptionProvider.hxx> @@ -135,10 +136,12 @@ void SAL_CALL ChartController::executeDispatch_PositionAndSize() if( pProvider ) aSelectedSize = ToSize( ( pProvider->getRectangleOfObject( aCID ) ) ); + ObjectType eObjectType = ObjectIdentifier::getObjectType( aCID ); + UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::POS_SIZE, - ObjectNameProvider::getName( ObjectIdentifier::getObjectType( aCID ))), + ObjectNameProvider::getName( eObjectType)), m_xUndoManager, getModel() ); SfxAbstractTabDialog * pDlg = NULL; @@ -169,11 +172,15 @@ void SAL_CALL ChartController::executeDispatch_PositionAndSize() awt::Size aPageSize( ChartModelHelper::getPageSize( getModel() ) ); Rectangle aPageRect( 0,0,aPageSize.Width,aPageSize.Height ); - bool bChanged = PositionAndSizeHelper::moveObject( m_aSelection.getSelectedCID() - , getModel() + bool bChanged = false; + if ( eObjectType == OBJECTTYPE_LEGEND ) + bChanged = DiagramHelper::switchDiagramPositioningToExcludingPositioning( getModel(), false , true ); + + bool bMoved = PositionAndSizeHelper::moveObject( m_aSelection.getSelectedCID(), getModel() , awt::Rectangle(aObjectRect.getX(),aObjectRect.getY(),aObjectRect.getWidth(),aObjectRect.getHeight()) , awt::Rectangle(aPageRect.getX(),aPageRect.getY(),aPageRect.getWidth(),aPageRect.getHeight()) ); - if( bChanged ) + + if( bMoved || bChanged ) aUndoGuard.commitAction(); } } diff --git a/chart2/source/controller/main/ChartController_Tools.cxx b/chart2/source/controller/main/ChartController_Tools.cxx index 735cb9634671..ba6c4446f6af 100644 --- a/chart2/source/controller/main/ChartController_Tools.cxx +++ b/chart2/source/controller/main/ChartController_Tools.cxx @@ -251,7 +251,11 @@ void ChartController::executeDispatch_NewArrangement() // legend Reference< beans::XPropertyState > xLegendState( xDiagram->getLegend(), uno::UNO_QUERY ); if( xLegendState.is()) + { xLegendState->setPropertyToDefault( C2U("RelativePosition")); + xLegendState->setPropertyToDefault( C2U("RelativeSize")); + xLegendState->setPropertyToDefault( C2U("AnchorPosition")); + } // titles for( sal_Int32 eType = TitleHelper::TITLE_BEGIN; diff --git a/chart2/source/controller/main/ChartController_Window.cxx b/chart2/source/controller/main/ChartController_Window.cxx index 885e37126dc2..bd711dde35ed 100644 --- a/chart2/source/controller/main/ChartController_Window.cxx +++ b/chart2/source/controller/main/ChartController_Window.cxx @@ -867,16 +867,22 @@ void ChartController::execute_MouseButtonUp( const MouseEvent& rMEvt ) if( !bIsMoveOnly && m_aSelection.isResizeableObjectSelected() ) eActionType = ActionDescriptionProvider::RESIZE; + ObjectType eObjectType = ObjectIdentifier::getObjectType( m_aSelection.getSelectedCID() ); + UndoGuard aUndoGuard( - ActionDescriptionProvider::createDescription( - eActionType, - ObjectNameProvider::getName( ObjectIdentifier::getObjectType( m_aSelection.getSelectedCID() ))), + ActionDescriptionProvider::createDescription( eActionType, ObjectNameProvider::getName( eObjectType)), m_xUndoManager, getModel() ); - bool bChanged = PositionAndSizeHelper::moveObject( m_aSelection.getSelectedCID() + + bool bChanged = false; + if ( eObjectType == OBJECTTYPE_LEGEND ) + bChanged = DiagramHelper::switchDiagramPositioningToExcludingPositioning( getModel(), false , true ); + + bool bMoved = PositionAndSizeHelper::moveObject( m_aSelection.getSelectedCID() , getModel() , awt::Rectangle(aObjectRect.getX(),aObjectRect.getY(),aObjectRect.getWidth(),aObjectRect.getHeight()) , awt::Rectangle(aPageRect.getX(),aPageRect.getY(),aPageRect.getWidth(),aPageRect.getHeight()) ); - if( bChanged ) + + if( bMoved || bChanged ) { bDraggingDone = true; aUndoGuard.commitAction(); diff --git a/chart2/source/controller/main/PositionAndSizeHelper.cxx b/chart2/source/controller/main/PositionAndSizeHelper.cxx index f0ce3eaaa04e..bdee4a14f66b 100644 --- a/chart2/source/controller/main/PositionAndSizeHelper.cxx +++ b/chart2/source/controller/main/PositionAndSizeHelper.cxx @@ -33,6 +33,7 @@ #include "ChartModelHelper.hxx" #include "ControllerLockGuard.hxx" #include <com/sun/star/chart2/LegendPosition.hpp> +#include <com/sun/star/chart/ChartLegendExpansion.hpp> #include <com/sun/star/chart2/RelativePosition.hpp> #include <com/sun/star/chart2/RelativeSize.hpp> #include "chartview/ExplicitValueProvider.hxx" @@ -83,51 +84,12 @@ bool PositionAndSizeHelper::moveObject( ObjectType eObjectType } else if(OBJECTTYPE_LEGEND==eObjectType) { - LegendPosition ePos = LegendPosition_LINE_END; - xObjectProp->getPropertyValue( C2U( "AnchorPosition" )) >>= ePos; + xObjectProp->setPropertyValue( C2U( "AnchorPosition" ), uno::makeAny(LegendPosition(LegendPosition_CUSTOM))); + xObjectProp->setPropertyValue( C2U( "Expansion" ), uno::makeAny(::com::sun::star::chart::ChartLegendExpansion_CUSTOM)); chart2::RelativePosition aRelativePosition; + chart2::RelativeSize aRelativeSize; Point aAnchor = aObjectRect.TopLeft(); - switch( ePos ) - { - case LegendPosition_LINE_START: - { - //@todo language dependent positions ... - aRelativePosition.Anchor = drawing::Alignment_LEFT; - aAnchor = aObjectRect.LeftCenter(); - } - break; - case LegendPosition_LINE_END: - { - //@todo language dependent positions ... - aRelativePosition.Anchor = drawing::Alignment_RIGHT; - aAnchor = aObjectRect.RightCenter(); - } - break; - case LegendPosition_PAGE_START: - { - //@todo language dependent positions ... - aRelativePosition.Anchor = drawing::Alignment_TOP; - aAnchor = aObjectRect.TopCenter(); - } - break; - case LegendPosition_PAGE_END: - //@todo language dependent positions ... - { - aRelativePosition.Anchor = drawing::Alignment_BOTTOM; - aAnchor = aObjectRect.BottomCenter(); - } - break; - case LegendPosition_CUSTOM: - { - //@todo language dependent positions ... - aRelativePosition.Anchor = drawing::Alignment_TOP_LEFT; - } - break; - case LegendPosition_MAKE_FIXED_SIZE: - OSL_ASSERT( false ); - break; - } aRelativePosition.Primary = static_cast< double >( aAnchor.X()) / static_cast< double >( aPageRect.getWidth() ); @@ -136,6 +98,19 @@ bool PositionAndSizeHelper::moveObject( ObjectType eObjectType static_cast< double >( aPageRect.getHeight()); xObjectProp->setPropertyValue( C2U( "RelativePosition" ), uno::makeAny(aRelativePosition) ); + + aRelativeSize.Primary = + static_cast< double >( aObjectRect.getWidth()) / + static_cast< double >( aPageRect.getWidth() ); + if (aRelativeSize.Primary > 1.0) + aRelativeSize.Primary = 1.0; + aRelativeSize.Secondary = + static_cast< double >( aObjectRect.getHeight()) / + static_cast< double >( aPageRect.getHeight()); + if (aRelativeSize.Secondary > 1.0) + aRelativeSize.Secondary = 1.0; + + xObjectProp->setPropertyValue( C2U( "RelativeSize" ), uno::makeAny(aRelativeSize) ); } else if(OBJECTTYPE_DIAGRAM==eObjectType || OBJECTTYPE_DIAGRAM_WALL==eObjectType || OBJECTTYPE_DIAGRAM_FLOOR==eObjectType) { diff --git a/chart2/source/controller/main/SelectionHelper.cxx b/chart2/source/controller/main/SelectionHelper.cxx index cd51adc7842e..d5b9784aa95a 100644 --- a/chart2/source/controller/main/SelectionHelper.cxx +++ b/chart2/source/controller/main/SelectionHelper.cxx @@ -309,6 +309,7 @@ bool Selection::isResizeableObjectSelected() case OBJECTTYPE_DIAGRAM: case OBJECTTYPE_DIAGRAM_WALL: case OBJECTTYPE_SHAPE: + case OBJECTTYPE_LEGEND: return true; default: return false; diff --git a/chart2/source/model/main/Legend.cxx b/chart2/source/model/main/Legend.cxx index e9f5f5324365..d7360b64fef7 100755 --- a/chart2/source/model/main/Legend.cxx +++ b/chart2/source/model/main/Legend.cxx @@ -40,8 +40,9 @@ #include <com/sun/star/beans/PropertyAttribute.hpp> #include <com/sun/star/awt/Size.hpp> #include <com/sun/star/chart2/LegendPosition.hpp> -#include <com/sun/star/chart2/LegendExpansion.hpp> +#include <com/sun/star/chart/ChartLegendExpansion.hpp> #include <com/sun/star/chart2/RelativePosition.hpp> +#include <com/sun/star/chart2/RelativeSize.hpp> #include <algorithm> @@ -63,10 +64,11 @@ static const OUString lcl_aServiceName( enum { PROP_LEGEND_ANCHOR_POSITION, - PROP_LEGEND_PREFERRED_EXPANSION, + PROP_LEGEND_EXPANSION, PROP_LEGEND_SHOW, PROP_LEGEND_REF_PAGE_SIZE, - PROP_LEGEND_REL_POS + PROP_LEGEND_REL_POS, + PROP_LEGEND_REL_SIZE }; void lcl_AddPropertiesToVector( @@ -81,8 +83,8 @@ void lcl_AddPropertiesToVector( rOutProperties.push_back( Property( C2U( "Expansion" ), - PROP_LEGEND_PREFERRED_EXPANSION, - ::getCppuType( reinterpret_cast< const chart2::LegendExpansion * >(0)), + PROP_LEGEND_EXPANSION, + ::getCppuType( reinterpret_cast< const ::com::sun::star::chart::ChartLegendExpansion * >(0)), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::MAYBEDEFAULT )); @@ -105,6 +107,15 @@ void lcl_AddPropertiesToVector( ::getCppuType( reinterpret_cast< const chart2::RelativePosition * >(0)), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::MAYBEVOID )); + + + rOutProperties.push_back( + Property( C2U( "RelativeSize" ), + PROP_LEGEND_REL_SIZE, + ::getCppuType( reinterpret_cast< const chart2::RelativeSize * >(0)), + beans::PropertyAttribute::BOUND + | beans::PropertyAttribute::MAYBEVOID )); + } struct StaticLegendDefaults_Initializer @@ -123,7 +134,7 @@ private: ::chart::CharacterProperties::AddDefaultsToMap( rOutMap ); ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_LEGEND_ANCHOR_POSITION, chart2::LegendPosition_LINE_END ); - ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_LEGEND_PREFERRED_EXPANSION, chart2::LegendExpansion_HIGH ); + ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_LEGEND_EXPANSION, chart2::LegendExpansion_HIGH ); ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_LEGEND_SHOW, true ); float fDefaultCharHeight = 10.0; diff --git a/chart2/source/tools/LegendHelper.cxx b/chart2/source/tools/LegendHelper.cxx index af170e971a5b..aceb033b7919 100755 --- a/chart2/source/tools/LegendHelper.cxx +++ b/chart2/source/tools/LegendHelper.cxx @@ -29,7 +29,7 @@ #include "precompiled_chart2.hxx" #include "LegendHelper.hxx" #include "macros.hxx" -#include <com/sun/star/chart2/LegendExpansion.hpp> +#include <com/sun/star/chart/ChartLegendExpansion.hpp> #include <com/sun/star/chart2/LegendPosition.hpp> #include <com/sun/star/chart2/RelativePosition.hpp> #include <com/sun/star/chart2/XChartDocument.hpp> @@ -62,11 +62,11 @@ Reference< chart2::XLegend > LegendHelper::showLegend( const Reference< frame::X if( !(xProp->getPropertyValue( C2U( "AnchorPosition" )) >>= ePos ) ) xProp->setPropertyValue( C2U( "AnchorPosition" ), uno::makeAny( ePos )); - chart2::LegendExpansion eExpansion = + ::com::sun::star::chart::ChartLegendExpansion eExpansion = ( ePos == chart2::LegendPosition_LINE_END || ePos == chart2::LegendPosition_LINE_START ) - ? chart2::LegendExpansion_HIGH - : chart2::LegendExpansion_WIDE; + ? ::com::sun::star::chart::ChartLegendExpansion_HIGH + : ::com::sun::star::chart::ChartLegendExpansion_WIDE; if( !(xProp->getPropertyValue( C2U( "Expansion" )) >>= eExpansion ) ) xProp->setPropertyValue( C2U( "Expansion" ), uno::makeAny( eExpansion )); diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx b/chart2/source/view/charttypes/VSeriesPlotter.cxx index 4150fade8834..232349f7c175 100644 --- a/chart2/source/view/charttypes/VSeriesPlotter.cxx +++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx @@ -1752,7 +1752,7 @@ bool VSeriesPlotter::shouldSnapRectToUsedArea() } Sequence< ViewLegendEntry > SAL_CALL VSeriesPlotter::createLegendEntries( - LegendExpansion eLegendExpansion + ::com::sun::star::chart::ChartLegendExpansion eLegendExpansion , const Reference< beans::XPropertySet >& xTextProperties , const Reference< drawing::XShapes >& xTarget , const Reference< lang::XMultiServiceFactory >& xShapeFactory @@ -1798,7 +1798,7 @@ Sequence< ViewLegendEntry > SAL_CALL VSeriesPlotter::createLegendEntries( // If the legend is wide and we have a stacked bar-chart the normal order // is the correct one bool bReverse = false; - if( eLegendExpansion != LegendExpansion_WIDE ) + if( eLegendExpansion != ::com::sun::star::chart::ChartLegendExpansion_WIDE ) { StackingDirection eStackingDirection( pSeries->getStackingDirection() ); bReverse = ( eStackingDirection == StackingDirection_Y_STACKING ); diff --git a/chart2/source/view/inc/LegendEntryProvider.hxx b/chart2/source/view/inc/LegendEntryProvider.hxx index 14b6cda47870..ddd4226f3d59 100644 --- a/chart2/source/view/inc/LegendEntryProvider.hxx +++ b/chart2/source/view/inc/LegendEntryProvider.hxx @@ -27,7 +27,7 @@ #ifndef CHART2_VIEW_LEGENDENTRYPROVIDER_HXX #define CHART2_VIEW_LEGENDENTRYPROVIDER_HXX -#include <com/sun/star/chart2/LegendExpansion.hpp> +#include <com/sun/star/chart/ChartLegendExpansion.hpp> #ifndef _COM_SUN_STAR_CHART2_VIEWLEGENDENTRYP_HPP_ #include <com/sun/star/chart2/ViewLegendEntry.hpp> @@ -42,7 +42,7 @@ class LegendEntryProvider public: virtual ::com::sun::star::uno::Sequence< ::com::sun::star::chart2::ViewLegendEntry > SAL_CALL createLegendEntries( - ::com::sun::star::chart2::LegendExpansion eLegendExpansion, + ::com::sun::star::chart::ChartLegendExpansion eLegendExpansion, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xTextProperties, const ::com::sun::star::uno::Reference< diff --git a/chart2/source/view/inc/VSeriesPlotter.hxx b/chart2/source/view/inc/VSeriesPlotter.hxx index 6b6b06437542..c9d827452fe2 100644 --- a/chart2/source/view/inc/VSeriesPlotter.hxx +++ b/chart2/source/view/inc/VSeriesPlotter.hxx @@ -207,7 +207,7 @@ public: virtual ::com::sun::star::uno::Sequence< ::com::sun::star::chart2::ViewLegendEntry > SAL_CALL createLegendEntries( - ::com::sun::star::chart2::LegendExpansion eLegendExpansion, + ::com::sun::star::chart::ChartLegendExpansion eLegendExpansion, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xTextProperties, const ::com::sun::star::uno::Reference< diff --git a/chart2/source/view/main/VLegend.cxx b/chart2/source/view/main/VLegend.cxx index 9a011498991b..59444ad05894 100644 --- a/chart2/source/view/main/VLegend.cxx +++ b/chart2/source/view/main/VLegend.cxx @@ -42,7 +42,7 @@ #include <com/sun/star/beans/XPropertyState.hpp> #include <com/sun/star/drawing/TextHorizontalAdjust.hpp> #include <com/sun/star/drawing/LineJoint.hpp> -#include <com/sun/star/chart2/LegendExpansion.hpp> +#include <com/sun/star/chart/ChartLegendExpansion.hpp> #include <com/sun/star/chart2/LegendPosition.hpp> #include <com/sun/star/chart2/RelativePosition.hpp> #include <rtl/ustrbuf.hxx> @@ -123,7 +123,6 @@ void lcl_getProperties( const Reference< beans::XPropertySet > & xLegendProp, tPropertyValues & rOutLineFillProperties, tPropertyValues & rOutTextProperties, - sal_Int32 nMaxLabelWidth, const awt::Size & rReferenceSize ) { // Get Line- and FillProperties from model legend @@ -146,7 +145,7 @@ void lcl_getProperties( aTextValueMap[ C2U("TextAutoGrowHeight") ] = uno::makeAny( sal_True ); aTextValueMap[ C2U("TextAutoGrowWidth") ] = uno::makeAny( sal_True ); aTextValueMap[ C2U("TextHorizontalAdjust") ] = uno::makeAny( eHorizAdjust ); - aTextValueMap[ C2U("TextMaximumFrameWidth") ] = uno::makeAny( nMaxLabelWidth ); + aTextValueMap[ C2U("TextMaximumFrameWidth") ] = uno::makeAny( rReferenceSize.Width ); //needs to be overwritten by actual available space in the legend // recalculate font size awt::Size aPropRefSize; @@ -241,20 +240,23 @@ awt::Size lcl_createTextShapes( return aResult; } - -void lcl_placeLegendEntries( +//returns resulting legend size +awt::Size lcl_placeLegendEntries( const tViewLegendEntryContainer & rEntries, - LegendExpansion eExpansion, + ::com::sun::star::chart::ChartLegendExpansion eExpansion, bool bSymbolsLeftSide, const Reference< beans::XPropertySet > & xProperties, tPropertyValues & rTextProperties, const Reference< drawing::XShapes > & xTarget, const Reference< lang::XMultiServiceFactory > & xShapeFactory, - const Reference< uno::XComponentContext > & /* xContext */, const awt::Size & rAvailableSpace, - const awt::Size & rPageSize, - awt::Size & rOutLegendSize ) + const awt::Size & rPageSize ) { + bool bIsCustomSize = (eExpansion == ::com::sun::star::chart::ChartLegendExpansion_CUSTOM); + awt::Size aResultingLegendSize(0,0); + if( bIsCustomSize ) + aResultingLegendSize = rAvailableSpace; + //todo double fViewFontSize = lcl_CalcViewFontSize( xProperties, rPageSize ); // padding as percentage of the font height @@ -269,16 +271,29 @@ void lcl_placeLegendEntries( const sal_Int32 nXOffset = static_cast< sal_Int32 >( fViewFontSize * fXOffset ); const sal_Int32 nYOffset = static_cast< sal_Int32 >( fViewFontSize * fYOffset ); - ::std::vector< Reference< drawing::XShape > > aTextShapes; - awt::Size aMaxEntryExtent = lcl_createTextShapes( - rEntries, xShapeFactory, xTarget, aTextShapes, rTextProperties ); - OSL_ASSERT( aTextShapes.size() == rEntries.size()); - // #i109336# Improve auto positioning in chart double fSymbolSizeFraction = 0.8; awt::Size aMaxSymbolExtent( static_cast< sal_Int32 >( fViewFontSize * fSymbolSizeFraction * 3.0 / 2.0 ), static_cast< sal_Int32 >( fViewFontSize * fSymbolSizeFraction ) ); + sal_Int32 nMaxTextWidth = rAvailableSpace.Width - (2 * nXOffset) - aMaxSymbolExtent.Width; + rtl::OUString aPropNameTextMaximumFrameWidth( C2U("TextMaximumFrameWidth") ); + uno::Any* pFrameWidthAny = PropertyMapper::getValuePointer( rTextProperties.second, rTextProperties.first, aPropNameTextMaximumFrameWidth); + if(pFrameWidthAny) + { + if( eExpansion == ::com::sun::star::chart::ChartLegendExpansion_HIGH ) + { + // limit the width of texts to 30% of the total available width + // #i109336# Improve auto positioning in chart + nMaxTextWidth = rAvailableSpace.Width * 3 / 10; + } + *pFrameWidthAny = uno::makeAny(nMaxTextWidth); + } + + ::std::vector< Reference< drawing::XShape > > aTextShapes; + awt::Size aMaxEntryExtent = lcl_createTextShapes( rEntries, xShapeFactory, xTarget, aTextShapes, rTextProperties ); + OSL_ASSERT( aTextShapes.size() == rEntries.size()); + sal_Int32 nCurrentXPos = nXPadding; sal_Int32 nCurrentYPos = nYPadding; sal_Int32 nMaxEntryWidth = 2 * nXOffset + aMaxSymbolExtent.Width + aMaxEntryExtent.Width; @@ -289,9 +304,80 @@ void lcl_placeLegendEntries( nCurrentXPos = -nXPadding; sal_Int32 nNumberOfColumns = 0, nNumberOfRows = 0; + std::vector< sal_Int32 > aColumnWidths; // determine layout depending on LegendExpansion - if( eExpansion == LegendExpansion_HIGH ) + if( eExpansion == ::com::sun::star::chart::ChartLegendExpansion_CUSTOM ) + { + sal_Int32 nCurrentRow=0; + sal_Int32 nCurrentColumn=-1; + sal_Int32 nColumnCount=0; + sal_Int32 nMaxColumnCount=-1; + for( sal_Int32 nN=0; nN<aTextShapes.size(); nN++) + { + Reference< drawing::XShape > xShape( aTextShapes[nN] ); + if( !xShape.is() ) + continue; + awt::Size aSize( xShape->getSize() ); + sal_Int32 nNewWidth = aSize.Width + aMaxSymbolExtent.Width + nXOffset; + sal_Int32 nCurrentColumnCount = aColumnWidths.size(); + + //are we allowed to add a new column? + if( nMaxColumnCount==-1 || (nCurrentColumn+1) < nMaxColumnCount ) + { + //try add a new column + nCurrentColumn++; + if( nCurrentColumn < nCurrentColumnCount ) + { + //check wether the current column width is sufficient for the new entry + if( aColumnWidths[nCurrentColumn]>=nNewWidth ) + { + //all good proceed with next entry + continue; + } + } + if( nCurrentColumn < nCurrentColumnCount ) + aColumnWidths[nCurrentColumn] = std::max( nNewWidth, aColumnWidths[nCurrentColumn] ); + else + aColumnWidths.push_back(nNewWidth); + + //do the columns still fit into the given size? + nCurrentColumnCount = aColumnWidths.size();//update count + sal_Int32 nSumWidth = 0; + for( sal_Int32 nC=0; nC<nCurrentColumnCount; nC++ ) + nSumWidth += aColumnWidths[nC]; + if( nCurrentColumnCount > 1) + nSumWidth += nXOffset*(nCurrentColumnCount-1); + + if( nSumWidth <= rAvailableSpace.Width || nCurrentColumnCount==1 ) + { + //all good proceed with next entry + continue; + } + else + { + //not enough space for the current amount of columns + //try again with less columns + nMaxColumnCount = nCurrentColumnCount-1; + nN=-1; + nCurrentRow=0; + nCurrentColumn=-1; + nColumnCount=0; + aColumnWidths.clear(); + } + } + else + { + //add a new row and try the same entry again + nCurrentRow++; + nCurrentColumn=-1; + nN--; + } + } + nNumberOfColumns = aColumnWidths.size(); + nNumberOfRows = nCurrentRow+1; + } + else if( eExpansion == ::com::sun::star::chart::ChartLegendExpansion_HIGH ) { sal_Int32 nMaxNumberOfRows = nMaxEntryHeight ? (rAvailableSpace.Height - 2*nYPadding ) / nMaxEntryHeight @@ -308,7 +394,7 @@ void lcl_placeLegendEntries( static_cast< double >( nNumberOfColumns ) )) : 0; } - else if( eExpansion == LegendExpansion_WIDE ) + else if( eExpansion == ::com::sun::star::chart::ChartLegendExpansion_WIDE ) { sal_Int32 nMaxNumberOfColumns = nMaxEntryWidth ? (rAvailableSpace.Width - 2*nXPadding ) / nMaxEntryWidth @@ -325,7 +411,7 @@ void lcl_placeLegendEntries( static_cast< double >( nNumberOfRows ) )) : 0; } - else // LegendExpansion_BALANCED + else // ::com::sun::star::chart::ChartLegendExpansion_BALANCED { double fAspect = nMaxEntryHeight ? static_cast< double >( nMaxEntryWidth ) / static_cast< double >( nMaxEntryHeight ) @@ -341,7 +427,7 @@ void lcl_placeLegendEntries( } if(nNumberOfRows<=0) - return; + return aResultingLegendSize; // calculate maximum height for current row std::vector< sal_Int32 > nMaxHeights( nNumberOfRows ); @@ -352,13 +438,23 @@ void lcl_placeLegendEntries( sal_Int32 nMaxHeight = 0; for( nColumn = 0; nColumn < nNumberOfColumns; ++nColumn ) { - sal_Int32 nEntry = ( eExpansion == LegendExpansion_WIDE ) - ? (nColumn + nRow * nNumberOfColumns) - // HIGH or BALANCED - : (nRow + nColumn * nNumberOfRows); + sal_Int32 nEntry = (nColumn + nRow * nNumberOfColumns); if( nEntry < nNumberOfEntries ) + { + awt::Size aTextSize( aTextShapes[ nEntry ]->getSize() ); nMaxHeight = ::std::max( - nMaxHeight, nYOffset + aTextShapes[ nEntry ]->getSize().Height ); + nMaxHeight, nYOffset + aTextSize.Height ); + if( eExpansion != ::com::sun::star::chart::ChartLegendExpansion_CUSTOM ) + { + sal_Int32 nWidth = nXOffset + aMaxSymbolExtent.Width + aTextSize.Width; + if( nColumn>0 ) + nWidth += nXOffset; + if( nRow==0 ) + aColumnWidths.push_back( nWidth ); + else + aColumnWidths[nColumn] = ::std::max( nWidth, aColumnWidths[nColumn] ); + } + } } nMaxHeights[ nRow ] = nMaxHeight; } @@ -367,15 +463,11 @@ void lcl_placeLegendEntries( sal_Int32 nMaxYPos = 0; for( nColumn = 0; nColumn < nNumberOfColumns; ++nColumn ) { - sal_Int32 nMaxWidth = 0; nCurrentYPos = nYPadding; for( nRow = 0; nRow < nNumberOfRows; ++nRow ) { - sal_Int32 nEntry = ( eExpansion == LegendExpansion_WIDE ) - ? (nColumn + nRow * nNumberOfColumns) - // HIGH or BALANCED - : (nRow + nColumn * nNumberOfRows); + sal_Int32 nEntry = (nColumn + nRow * nNumberOfColumns); if( nEntry >= nNumberOfEntries ) break; @@ -406,7 +498,6 @@ void lcl_placeLegendEntries( // position text shape awt::Size aTextSize( aTextShapes[ nEntry ]->getSize()); - nMaxWidth = ::std::max( nMaxWidth, 2 * nXOffset + aMaxSymbolExtent.Width + aTextSize.Width ); sal_Int32 nTextXPos = nCurrentXPos + aMaxSymbolExtent.Width; if( !bSymbolsLeftSide ) nTextXPos = nCurrentXPos - aMaxSymbolExtent.Width - aTextSize.Width; @@ -416,18 +507,26 @@ void lcl_placeLegendEntries( nMaxYPos = ::std::max( nMaxYPos, nCurrentYPos ); } if( bSymbolsLeftSide ) - nCurrentXPos += nMaxWidth; + nCurrentXPos += aColumnWidths[nColumn]; else - nCurrentXPos -= nMaxWidth; + nCurrentXPos -= aColumnWidths[nColumn]; } - if( bSymbolsLeftSide ) - rOutLegendSize.Width = nCurrentXPos + nXPadding; - else + if( !bIsCustomSize ) { - sal_Int32 nLegendWidth = -(nCurrentXPos-nXPadding); - rOutLegendSize.Width = nLegendWidth; + if( bSymbolsLeftSide ) + aResultingLegendSize.Width = nCurrentXPos + nXPadding; + else + { + sal_Int32 nLegendWidth = -(nCurrentXPos-nXPadding); + aResultingLegendSize.Width = nLegendWidth; + } + aResultingLegendSize.Height = nMaxYPos + nYPadding; + } + if( !bSymbolsLeftSide ) + { + sal_Int32 nLegendWidth = aResultingLegendSize.Width; awt::Point aPos(0,0); for( sal_Int32 nEntry=0; nEntry<nNumberOfEntries; nEntry++ ) { @@ -441,7 +540,8 @@ void lcl_placeLegendEntries( xText->setPosition( aPos ); } } - rOutLegendSize.Height = nMaxYPos + nYPadding; + + return aResultingLegendSize; } // #i109336# Improve auto positioning in chart @@ -706,23 +806,26 @@ void VLegend::createShapes( tPropertyValues aLineFillProperties; tPropertyValues aTextProperties; - // limit the width of texts to 30% of the total available width - // #i109336# Improve auto positioning in chart - sal_Int32 nMaxLabelWidth = rAvailableSpace.Width * 3 / 10; Reference< beans::XPropertySet > xLegendProp( m_xLegend, uno::UNO_QUERY ); - LegendExpansion eExpansion = LegendExpansion_HIGH; + ::com::sun::star::chart::ChartLegendExpansion eExpansion = ::com::sun::star::chart::ChartLegendExpansion_HIGH; + awt::Size aLegendSize( rAvailableSpace ); + if( xLegendProp.is()) { // get Expansion property xLegendProp->getPropertyValue( C2U( "Expansion" )) >>= eExpansion; - if( eExpansion == LegendExpansion_WIDE ) + if( eExpansion == ::com::sun::star::chart::ChartLegendExpansion_CUSTOM ) { - //#i80377# - nMaxLabelWidth = (rAvailableSpace.Width * 5) / 6;//completely correct would be available width minus symbol size minus distances to page ... + RelativeSize aRelativeSize; + if ((xLegendProp->getPropertyValue( C2U( "RelativeSize" )) >>= aRelativeSize)) + { + aLegendSize.Width = aRelativeSize.Primary * rPageSize.Width; + aLegendSize.Height = aRelativeSize.Secondary * rPageSize.Height; + } + else + eExpansion = ::com::sun::star::chart::ChartLegendExpansion_HIGH; } - - lcl_getProperties( xLegendProp, aLineFillProperties, aTextProperties, nMaxLabelWidth, - rPageSize ); + lcl_getProperties( xLegendProp, aLineFillProperties, aTextProperties, rPageSize ); } if( xBorder.is()) @@ -758,13 +861,11 @@ void VLegend::createShapes( bool bSymbolsLeftSide = lcl_shouldSymbolsBePlacedOnTheLeftSide( xLegendProp, m_nDefaultWritingMode ); // place entries - awt::Size aLegendSize; - lcl_placeLegendEntries( aViewEntries, eExpansion, bSymbolsLeftSide - , xLegendProp, aTextProperties - , xLegendContainer, m_xShapeFactory, m_xContext - , rAvailableSpace, rPageSize, aLegendSize ); + aLegendSize = lcl_placeLegendEntries( aViewEntries, eExpansion, bSymbolsLeftSide + , xLegendProp, aTextProperties, xLegendContainer, m_xShapeFactory + , aLegendSize, rPageSize ); - if( xBorder.is()) + if( xBorder.is() ) xBorder->setSize( aLegendSize ); } } diff --git a/sc/source/filter/excel/xechart.cxx b/sc/source/filter/excel/xechart.cxx index b6b136da4b1e..2e2714afadf1 100644 --- a/sc/source/filter/excel/xechart.cxx +++ b/sc/source/filter/excel/xechart.cxx @@ -36,6 +36,7 @@ #include <com/sun/star/drawing/XShapes.hpp> #include <com/sun/star/chart/ChartAxisLabelPosition.hpp> #include <com/sun/star/chart/ChartAxisPosition.hpp> +#include <com/sun/star/chart/ChartLegendExpansion.hpp> #include <com/sun/star/chart/DataLabelPlacement.hpp> #include <com/sun/star/chart/ErrorBarStyle.hpp> #include <com/sun/star/chart/MissingValueTreatment.hpp> @@ -54,7 +55,6 @@ #include <com/sun/star/chart2/CurveStyle.hpp> #include <com/sun/star/chart2/DataPointGeometry3D.hpp> #include <com/sun/star/chart2/DataPointLabel.hpp> -#include <com/sun/star/chart2/LegendExpansion.hpp> #include <com/sun/star/chart2/LegendPosition.hpp> #include <com/sun/star/chart2/RelativePosition.hpp> #include <com/sun/star/chart2/StackingDirection.hpp> @@ -2280,9 +2280,9 @@ void XclExpChLegend::Convert( const ScfPropertySet& rPropSet ) } // legend expansion - cssc2::LegendExpansion eApiExpand = cssc2::LegendExpansion_BALANCED; + cssc::ChartLegendExpansion eApiExpand = cssc::ChartLegendExpansion_BALANCED; rPropSet.GetProperty( eApiExpand, EXC_CHPROP_EXPANSION ); - ::set_flag( maData.mnFlags, EXC_CHLEGEND_STACKED, eApiExpand != cssc2::LegendExpansion_WIDE ); + ::set_flag( maData.mnFlags, EXC_CHLEGEND_STACKED, eApiExpand != cssc::ChartLegendExpansion_WIDE ); // other flags ::set_flag( maData.mnFlags, EXC_CHLEGEND_AUTOSERIES ); diff --git a/sc/source/filter/excel/xichart.cxx b/sc/source/filter/excel/xichart.cxx index 7cbd74a836d2..4eb91fc5ff09 100755..100644 --- a/sc/source/filter/excel/xichart.cxx +++ b/sc/source/filter/excel/xichart.cxx @@ -43,6 +43,7 @@ #include <com/sun/star/chart/ChartAxisLabelPosition.hpp> #include <com/sun/star/chart/ChartAxisMarkPosition.hpp> #include <com/sun/star/chart/ChartAxisPosition.hpp> +#include <com/sun/star/chart/ChartLegendExpansion.hpp> #include <com/sun/star/chart/XChartDocument.hpp> #include <com/sun/star/chart/XDiagramPositioning.hpp> #include <com/sun/star/chart2/XChartDocument.hpp> @@ -59,7 +60,6 @@ #include <com/sun/star/chart2/CurveStyle.hpp> #include <com/sun/star/chart2/DataPointGeometry3D.hpp> #include <com/sun/star/chart2/DataPointLabel.hpp> -#include <com/sun/star/chart2/LegendExpansion.hpp> #include <com/sun/star/chart2/LegendPosition.hpp> #include <com/sun/star/chart2/StackingDirection.hpp> #include <com/sun/star/chart2/TickmarkStyle.hpp> @@ -2423,15 +2423,15 @@ Reference< XLegend > XclImpChLegend::CreateLegend() const manual mode, if the legend is moved or resized). With manual plot areas, Excel ignores the value in maData.mnDockMode completely. */ cssc2::LegendPosition eApiPos = cssc2::LegendPosition_CUSTOM; - cssc2::LegendExpansion eApiExpand = cssc2::LegendExpansion_BALANCED; + cssc::ChartLegendExpansion eApiExpand = cssc::ChartLegendExpansion_BALANCED; if( !GetChartData().IsManualPlotArea() ) switch( maData.mnDockMode ) { - case EXC_CHLEGEND_LEFT: eApiPos = cssc2::LegendPosition_LINE_START; eApiExpand = cssc2::LegendExpansion_HIGH; break; - case EXC_CHLEGEND_RIGHT: eApiPos = cssc2::LegendPosition_LINE_END; eApiExpand = cssc2::LegendExpansion_HIGH; break; - case EXC_CHLEGEND_TOP: eApiPos = cssc2::LegendPosition_PAGE_START; eApiExpand = cssc2::LegendExpansion_WIDE; break; - case EXC_CHLEGEND_BOTTOM: eApiPos = cssc2::LegendPosition_PAGE_END; eApiExpand = cssc2::LegendExpansion_WIDE; break; + case EXC_CHLEGEND_LEFT: eApiPos = cssc2::LegendPosition_LINE_START; eApiExpand = cssc::ChartLegendExpansion_HIGH; break; + case EXC_CHLEGEND_RIGHT: eApiPos = cssc2::LegendPosition_LINE_END; eApiExpand = cssc::ChartLegendExpansion_HIGH; break; + case EXC_CHLEGEND_TOP: eApiPos = cssc2::LegendPosition_PAGE_START; eApiExpand = cssc::ChartLegendExpansion_WIDE; break; + case EXC_CHLEGEND_BOTTOM: eApiPos = cssc2::LegendPosition_PAGE_END; eApiExpand = cssc::ChartLegendExpansion_WIDE; break; // top-right not supported - case EXC_CHLEGEND_CORNER: eApiPos = cssc2::LegendPosition_LINE_END; eApiExpand = cssc2::LegendExpansion_HIGH; break; + case EXC_CHLEGEND_CORNER: eApiPos = cssc2::LegendPosition_LINE_END; eApiExpand = cssc::ChartLegendExpansion_HIGH; break; } // no automatic position: try to find the correct position and size @@ -2464,18 +2464,18 @@ Reference< XLegend > XclImpChLegend::CreateLegend() const { // automatic size: determine entry direction from flags eApiExpand = ::get_flagvalue( maData.mnFlags, EXC_CHLEGEND_STACKED, - cssc2::LegendExpansion_HIGH, cssc2::LegendExpansion_WIDE ); + cssc::ChartLegendExpansion_HIGH, cssc::ChartLegendExpansion_WIDE ); } else { // legend size is given in points, not in chart units double fRatio = static_cast< double >( pFramePos->maRect.mnWidth ) / pFramePos->maRect.mnHeight; if( fRatio > 1.5 ) - eApiExpand = cssc2::LegendExpansion_WIDE; + eApiExpand = cssc::ChartLegendExpansion_WIDE; else if( fRatio < 0.75 ) - eApiExpand = cssc2::LegendExpansion_HIGH; + eApiExpand = cssc::ChartLegendExpansion_HIGH; else - eApiExpand = cssc2::LegendExpansion_BALANCED; + eApiExpand = cssc::ChartLegendExpansion_BALANCED; } } aLegendProp.SetProperty( EXC_CHPROP_ANCHORPOSITION, eApiPos ); |