diff options
author | Ingrid Halama [iha] <Ingrid.Halama@oracle.com> | 2011-02-04 12:59:11 +0100 |
---|---|---|
committer | Ingrid Halama [iha] <Ingrid.Halama@oracle.com> | 2011-02-04 12:59:11 +0100 |
commit | 7bafb42bf101d13ab336221652124376661f1d05 (patch) | |
tree | 61b42287491f04e53e4b5d13b2374bc30e2e4b9b /chart2 | |
parent | c9bfd6cdebb754d1c33a7dcae0041d64dcdca792 (diff) |
chart52: cleanup unused legend entry stuff in preparation of issue #i82802#
Diffstat (limited to 'chart2')
-rwxr-xr-x | chart2/source/model/main/Legend.cxx | 48 | ||||
-rwxr-xr-x[-rw-r--r--] | chart2/source/model/main/Legend.hxx | 19 | ||||
-rwxr-xr-x | chart2/source/model/template/BubbleChartTypeTemplate.cxx | 2 | ||||
-rwxr-xr-x | chart2/source/model/template/StockChartTypeTemplate.cxx | 1 | ||||
-rw-r--r-- | chart2/source/view/charttypes/AreaChart.cxx | 4 | ||||
-rw-r--r-- | chart2/source/view/charttypes/AreaChart.hxx | 2 | ||||
-rw-r--r-- | chart2/source/view/charttypes/BubbleChart.cxx | 2 | ||||
-rw-r--r-- | chart2/source/view/charttypes/BubbleChart.hxx | 2 | ||||
-rw-r--r-- | chart2/source/view/charttypes/CandleStickChart.cxx | 2 | ||||
-rw-r--r-- | chart2/source/view/charttypes/CandleStickChart.hxx | 2 | ||||
-rw-r--r-- | chart2/source/view/charttypes/VSeriesPlotter.cxx | 33 | ||||
-rw-r--r-- | chart2/source/view/inc/LegendEntryProvider.hxx | 59 | ||||
-rw-r--r-- | chart2/source/view/inc/VLegendSymbolFactory.hxx | 4 | ||||
-rw-r--r-- | chart2/source/view/inc/VSeriesPlotter.hxx | 24 | ||||
-rw-r--r-- | chart2/source/view/main/VLegend.cxx | 13 | ||||
-rw-r--r-- | chart2/source/view/main/VLegendSymbolFactory.cxx | 140 |
16 files changed, 112 insertions, 245 deletions
diff --git a/chart2/source/model/main/Legend.cxx b/chart2/source/model/main/Legend.cxx index 64fb39f91b65..a7c2ab86f5c1 100755 --- a/chart2/source/model/main/Legend.cxx +++ b/chart2/source/model/main/Legend.cxx @@ -207,58 +207,10 @@ Legend::Legend( const Legend & rOther ) : ::property::OPropertySet( rOther, m_aMutex ), m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder()) { - CloneHelper::CloneRefVector< Reference< chart2::XLegendEntry > >( rOther.m_aLegendEntries, m_aLegendEntries ); - ModifyListenerHelper::addListenerToAllElements( m_aLegendEntries, m_xModifyEventForwarder ); } Legend::~Legend() { - try - { - ModifyListenerHelper::removeListenerFromAllElements( m_aLegendEntries, m_xModifyEventForwarder ); - } - catch( const uno::Exception & ex ) - { - ASSERT_EXCEPTION( ex ); - } -} - -// ____ XLegend ____ -void SAL_CALL Legend::registerEntry( const Reference< chart2::XLegendEntry >& xEntry ) - throw (lang::IllegalArgumentException, - uno::RuntimeException) -{ - if( ::std::find( m_aLegendEntries.begin(), - m_aLegendEntries.end(), - xEntry ) != m_aLegendEntries.end()) - throw lang::IllegalArgumentException(); - - m_aLegendEntries.push_back( xEntry ); - ModifyListenerHelper::addListener( xEntry, m_xModifyEventForwarder ); - fireModifyEvent(); -} - -void SAL_CALL Legend::revokeEntry( const Reference< chart2::XLegendEntry >& xEntry ) - throw (container::NoSuchElementException, - uno::RuntimeException) -{ - tLegendEntries::iterator aIt( - ::std::find( m_aLegendEntries.begin(), - m_aLegendEntries.end(), - xEntry )); - - if( aIt == m_aLegendEntries.end()) - throw container::NoSuchElementException(); - - m_aLegendEntries.erase( aIt ); - ModifyListenerHelper::removeListener( xEntry, m_xModifyEventForwarder ); - fireModifyEvent(); -} - -Sequence< Reference< chart2::XLegendEntry > > SAL_CALL Legend::getEntries() - throw (uno::RuntimeException) -{ - return ContainerHelper::ContainerToSequence( m_aLegendEntries ); } // ____ XCloneable ____ diff --git a/chart2/source/model/main/Legend.hxx b/chart2/source/model/main/Legend.hxx index 6b645828f4c1..56c41db2e38a 100644..100755 --- a/chart2/source/model/main/Legend.hxx +++ b/chart2/source/model/main/Legend.hxx @@ -97,20 +97,6 @@ protected: // const ::com::sun::star::uno::Any& rValue ) // throw (::com::sun::star::lang::IllegalArgumentException); - // ____ XLegend ____ - virtual void SAL_CALL registerEntry( const ::com::sun::star::uno::Reference< - ::com::sun::star::chart2::XLegendEntry >& xEntry ) - throw (::com::sun::star::lang::IllegalArgumentException, - ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL revokeEntry( const ::com::sun::star::uno::Reference< - ::com::sun::star::chart2::XLegendEntry >& xEntry ) - throw (::com::sun::star::container::NoSuchElementException, - ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< - ::com::sun::star::uno::Reference< - ::com::sun::star::chart2::XLegendEntry > > SAL_CALL getEntries() - throw (::com::sun::star::uno::RuntimeException); - // ____ XCloneable ____ virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone() throw (::com::sun::star::uno::RuntimeException); @@ -140,11 +126,6 @@ protected: void fireModifyEvent(); private: - typedef ::std::vector< - ::com::sun::star::uno::Reference< - ::com::sun::star::chart2::XLegendEntry > > tLegendEntries; - - tLegendEntries m_aLegendEntries; ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener > m_xModifyEventForwarder; }; diff --git a/chart2/source/model/template/BubbleChartTypeTemplate.cxx b/chart2/source/model/template/BubbleChartTypeTemplate.cxx index e0e37e2c825a..bb7e4ab68d98 100755 --- a/chart2/source/model/template/BubbleChartTypeTemplate.cxx +++ b/chart2/source/model/template/BubbleChartTypeTemplate.cxx @@ -36,8 +36,6 @@ #include "servicenames_charttypes.hxx" #include "ContainerHelper.hxx" #include "DataSeriesHelper.hxx" -#include <com/sun/star/chart2/SymbolStyle.hpp> -#include <com/sun/star/chart2/Symbol.hpp> #include <com/sun/star/drawing/LineStyle.hpp> #include "PropertyHelper.hxx" #include <com/sun/star/beans/PropertyAttribute.hpp> diff --git a/chart2/source/model/template/StockChartTypeTemplate.cxx b/chart2/source/model/template/StockChartTypeTemplate.cxx index b265561eca90..3f82f5b7bf68 100755 --- a/chart2/source/model/template/StockChartTypeTemplate.cxx +++ b/chart2/source/model/template/StockChartTypeTemplate.cxx @@ -39,7 +39,6 @@ #include "ContainerHelper.hxx" #include "AxisIndexDefines.hxx" #include <com/sun/star/chart2/AxisType.hpp> -#include <com/sun/star/chart2/SymbolStyle.hpp> #include <com/sun/star/chart2/data/XDataSource.hpp> #include <com/sun/star/chart2/XChartTypeContainer.hpp> #include <com/sun/star/chart2/XDataSeriesContainer.hpp> diff --git a/chart2/source/view/charttypes/AreaChart.cxx b/chart2/source/view/charttypes/AreaChart.cxx index 06e09d60fcf1..f07189615781 100644 --- a/chart2/source/view/charttypes/AreaChart.cxx +++ b/chart2/source/view/charttypes/AreaChart.cxx @@ -152,8 +152,8 @@ bool AreaChart::isSeperateStackingForDifferentSigns( sal_Int32 /*nDimensionIndex LegendSymbolStyle AreaChart::getLegendSymbolStyle() { if( m_bArea || m_nDimension == 3 ) - return chart2::LegendSymbolStyle_BOX; - return chart2::LegendSymbolStyle_LINE_WITH_SYMBOL; + return LegendSymbolStyle_BOX; + return LegendSymbolStyle_LINE_WITH_SYMBOL; } uno::Any AreaChart::getExplicitSymbol( const VDataSeries& rSeries, sal_Int32 nPointIndex ) diff --git a/chart2/source/view/charttypes/AreaChart.hxx b/chart2/source/view/charttypes/AreaChart.hxx index 4b6ff3f45251..972d97fa75ac 100644 --- a/chart2/source/view/charttypes/AreaChart.hxx +++ b/chart2/source/view/charttypes/AreaChart.hxx @@ -71,7 +71,7 @@ public: //------------------------------------------------------------------------- - virtual ::com::sun::star::chart2::LegendSymbolStyle getLegendSymbolStyle(); + virtual LegendSymbolStyle getLegendSymbolStyle(); virtual ::com::sun::star::uno::Any getExplicitSymbol( const VDataSeries& rSeries, sal_Int32 nPointIndex=-1/*-1 for series symbol*/ ); //------------------------------------------------------------------------- diff --git a/chart2/source/view/charttypes/BubbleChart.cxx b/chart2/source/view/charttypes/BubbleChart.cxx index 0cbcff33bfcd..3dbbc0eaf3e2 100644 --- a/chart2/source/view/charttypes/BubbleChart.cxx +++ b/chart2/source/view/charttypes/BubbleChart.cxx @@ -175,7 +175,7 @@ bool BubbleChart::isSeperateStackingForDifferentSigns( sal_Int32 /*nDimensionInd LegendSymbolStyle BubbleChart::getLegendSymbolStyle() { - return chart2::LegendSymbolStyle_CIRCLE; + return LegendSymbolStyle_CIRCLE; } drawing::Direction3D BubbleChart::getPreferredDiagramAspectRatio() const diff --git a/chart2/source/view/charttypes/BubbleChart.hxx b/chart2/source/view/charttypes/BubbleChart.hxx index ed3d9e051cc4..f94fe9e367e7 100644 --- a/chart2/source/view/charttypes/BubbleChart.hxx +++ b/chart2/source/view/charttypes/BubbleChart.hxx @@ -61,7 +61,7 @@ public: //------------------------------------------------------------------------- - virtual ::com::sun::star::chart2::LegendSymbolStyle getLegendSymbolStyle(); + virtual LegendSymbolStyle getLegendSymbolStyle(); //------------------------------------------------------------------------- //------------------------------------------------------------------------- diff --git a/chart2/source/view/charttypes/CandleStickChart.cxx b/chart2/source/view/charttypes/CandleStickChart.cxx index 61c49c61d4a0..3ce3cf661d5d 100644 --- a/chart2/source/view/charttypes/CandleStickChart.cxx +++ b/chart2/source/view/charttypes/CandleStickChart.cxx @@ -86,7 +86,7 @@ bool CandleStickChart::isSeperateStackingForDifferentSigns( sal_Int32 /* nDimens LegendSymbolStyle CandleStickChart::getLegendSymbolStyle() { - return chart2::LegendSymbolStyle_VERTICAL_LINE; + return LegendSymbolStyle_VERTICAL_LINE; } //----------------------------------------------------------------- diff --git a/chart2/source/view/charttypes/CandleStickChart.hxx b/chart2/source/view/charttypes/CandleStickChart.hxx index 6fbf980058e7..df9531ec71bf 100644 --- a/chart2/source/view/charttypes/CandleStickChart.hxx +++ b/chart2/source/view/charttypes/CandleStickChart.hxx @@ -59,7 +59,7 @@ public: //------------------------------------------------------------------------- - virtual ::com::sun::star::chart2::LegendSymbolStyle getLegendSymbolStyle(); + virtual LegendSymbolStyle getLegendSymbolStyle(); //------------------------------------------------------------------------- //------------------------------------------------------------------------- diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx b/chart2/source/view/charttypes/VSeriesPlotter.cxx index 6d3562b10af9..85963fc46cb4 100644 --- a/chart2/source/view/charttypes/VSeriesPlotter.cxx +++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx @@ -1818,13 +1818,13 @@ bool VSeriesPlotter::shouldSnapRectToUsedArea() return true; } -Sequence< ViewLegendEntry > SAL_CALL VSeriesPlotter::createLegendEntries( +std::vector< ViewLegendEntry > VSeriesPlotter::createLegendEntries( ::com::sun::star::chart::ChartLegendExpansion eLegendExpansion , const Reference< beans::XPropertySet >& xTextProperties , const Reference< drawing::XShapes >& xTarget , const Reference< lang::XMultiServiceFactory >& xShapeFactory , const Reference< uno::XComponentContext >& xContext - ) throw (uno::RuntimeException) + ) { std::vector< ViewLegendEntry > aResult; @@ -1880,22 +1880,15 @@ Sequence< ViewLegendEntry > SAL_CALL VSeriesPlotter::createLegendEntries( } } } - - //add charttype specific entries if any - { - std::vector< ViewLegendEntry > aChartTypeEntries( this->createLegendEntriesForChartType( - xTextProperties, xTarget, xShapeFactory, xContext ) ); - aResult.insert( aResult.end(), aChartTypeEntries.begin(), aChartTypeEntries.end() ); - } } - return ::chart::ContainerHelper::ContainerToSequence( aResult ); + return aResult; } LegendSymbolStyle VSeriesPlotter::getLegendSymbolStyle() { - return chart2::LegendSymbolStyle_BOX; + return LegendSymbolStyle_BOX; } @@ -1920,10 +1913,8 @@ Reference< drawing::XShape > VSeriesPlotter::createLegendSymbolForSeries( // legend-symbol type switch( eLegendSymbolStyle ) { - case LegendSymbolStyle_HORIZONTAL_LINE: case LegendSymbolStyle_VERTICAL_LINE: case LegendSymbolStyle_DIAGONAL_LINE: - case LegendSymbolStyle_LINE_WITH_BOX: case LegendSymbolStyle_LINE_WITH_SYMBOL: ePropType = VLegendSymbolFactory::PROP_TYPE_LINE_SERIES; break; @@ -1954,10 +1945,8 @@ Reference< drawing::XShape > VSeriesPlotter::createLegendSymbolForPoint( // legend-symbol type switch( eLegendSymbolStyle ) { - case LegendSymbolStyle_HORIZONTAL_LINE: case LegendSymbolStyle_VERTICAL_LINE: case LegendSymbolStyle_DIAGONAL_LINE: - case LegendSymbolStyle_LINE_WITH_BOX: case LegendSymbolStyle_LINE_WITH_SYMBOL: ePropType = VLegendSymbolFactory::PROP_TYPE_LINE_SERIES; break; @@ -1995,7 +1984,7 @@ Reference< drawing::XShape > VSeriesPlotter::createLegendSymbolForPoint( return xShape; } -std::vector< ViewLegendEntry > SAL_CALL VSeriesPlotter::createLegendEntriesForSeries( +std::vector< ViewLegendEntry > VSeriesPlotter::createLegendEntriesForSeries( const VDataSeries& rSeries , const Reference< beans::XPropertySet >& xTextProperties , const Reference< drawing::XShapes >& xTarget @@ -2098,7 +2087,7 @@ std::vector< ViewLegendEntry > SAL_CALL VSeriesPlotter::createLegendEntriesForSe // create the symbol Reference< drawing::XShape > xShape( VLegendSymbolFactory::createSymbol( - xSymbolGroup, chart2::LegendSymbolStyle_DIAGONAL_LINE, xShapeFactory, + xSymbolGroup, LegendSymbolStyle_DIAGONAL_LINE, xShapeFactory, Reference< beans::XPropertySet >( aCurves[i], uno::UNO_QUERY ), VLegendSymbolFactory::PROP_TYPE_LINE, uno::Any() )); @@ -2127,16 +2116,6 @@ std::vector< ViewLegendEntry > SAL_CALL VSeriesPlotter::createLegendEntriesForSe return aResult; } -std::vector< ViewLegendEntry > SAL_CALL VSeriesPlotter::createLegendEntriesForChartType( - const Reference< beans::XPropertySet >& /* xTextProperties */, - const Reference< drawing::XShapes >& /* xTarget */, - const Reference< lang::XMultiServiceFactory >& /* xShapeFactory */, - const Reference< uno::XComponentContext >& /* xContext */ - ) -{ - return std::vector< ViewLegendEntry >(); -} - VSeriesPlotter* VSeriesPlotter::createSeriesPlotter( const uno::Reference<XChartType>& xChartTypeModel , sal_Int32 nDimensionCount diff --git a/chart2/source/view/inc/LegendEntryProvider.hxx b/chart2/source/view/inc/LegendEntryProvider.hxx index ddd4226f3d59..74b731cd9e55 100644 --- a/chart2/source/view/inc/LegendEntryProvider.hxx +++ b/chart2/source/view/inc/LegendEntryProvider.hxx @@ -27,21 +27,63 @@ #ifndef CHART2_VIEW_LEGENDENTRYPROVIDER_HXX #define CHART2_VIEW_LEGENDENTRYPROVIDER_HXX +#include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/chart/ChartLegendExpansion.hpp> - -#ifndef _COM_SUN_STAR_CHART2_VIEWLEGENDENTRYP_HPP_ -#include <com/sun/star/chart2/ViewLegendEntry.hpp> -#endif +#include <com/sun/star/chart2/XFormattedString.hpp> +#include <com/sun/star/drawing/XShape.hpp> +#include <com/sun/star/drawing/XShapes.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/uno/XComponentContext.hpp> +#include <vector> + namespace chart { +enum LegendSymbolStyle +{ + /** A square box with border. + */ + LegendSymbolStyle_BOX, + + /** A line extending from the top edge to the bottom edge + */ + LegendSymbolStyle_VERTICAL_LINE, + + /** A line spanning the diagonal of the box you would get with + <member>BOX</member>. + */ + LegendSymbolStyle_DIAGONAL_LINE, + + /** A line like with a symbol. + */ + LegendSymbolStyle_LINE_WITH_SYMBOL, + + /** A bordered circle which has the same bounding-box as the + <member>BOX</member>. + */ + LegendSymbolStyle_CIRCLE +}; + +struct ViewLegendEntry +{ + /** The legend symbol that represents a data series or other + information contained in the legend + */ + ::com::sun::star::uno::Reference< + ::com::sun::star::drawing::XShape > aSymbol; + + /** The descriptive text for a legend entry. + */ + ::com::sun::star::uno::Sequence< + ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XFormattedString > > aLabel; +}; + class LegendEntryProvider { public: - virtual ::com::sun::star::uno::Sequence< - ::com::sun::star::chart2::ViewLegendEntry > SAL_CALL createLegendEntries( + virtual std::vector< ViewLegendEntry > createLegendEntries( ::com::sun::star::chart::ChartLegendExpansion eLegendExpansion, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xTextProperties, @@ -51,10 +93,7 @@ public: ::com::sun::star::lang::XMultiServiceFactory >& xShapeFactory, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext - ) - throw (::com::sun::star::uno::RuntimeException) = 0; - -private: + ) = 0; }; } // namespace chart diff --git a/chart2/source/view/inc/VLegendSymbolFactory.hxx b/chart2/source/view/inc/VLegendSymbolFactory.hxx index a568a9ef4a85..3dc42f7c207a 100644 --- a/chart2/source/view/inc/VLegendSymbolFactory.hxx +++ b/chart2/source/view/inc/VLegendSymbolFactory.hxx @@ -27,7 +27,7 @@ #ifndef CHART2_VLEGENDSYMBOLFACTORY_HXX #define CHART2_VLEGENDSYMBOLFACTORY_HXX -#include <com/sun/star/chart2/LegendSymbolStyle.hpp> +#include "LegendEntryProvider.hxx" #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/drawing/XShapes.hpp> @@ -52,7 +52,7 @@ public: createSymbol( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > xSymbolContainer, - ::com::sun::star::chart2::LegendSymbolStyle eStyle, + LegendSymbolStyle eStyle, const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & xShapeFactory, const ::com::sun::star::uno::Reference< diff --git a/chart2/source/view/inc/VSeriesPlotter.hxx b/chart2/source/view/inc/VSeriesPlotter.hxx index 232fc8663a77..cf4d5073b775 100644 --- a/chart2/source/view/inc/VSeriesPlotter.hxx +++ b/chart2/source/view/inc/VSeriesPlotter.hxx @@ -33,7 +33,6 @@ #include "MinimumAndMaximumSupplier.hxx" #include "LegendEntryProvider.hxx" #include "ExplicitCategoriesProvider.hxx" -#include <com/sun/star/chart2/LegendSymbolStyle.hpp> #include <com/sun/star/chart2/XChartType.hpp> #include <com/sun/star/drawing/Direction3D.hpp> @@ -207,8 +206,7 @@ public: //------------------------------------------------------------------------- //------------------------------------------------------------------------- - virtual ::com::sun::star::uno::Sequence< - ::com::sun::star::chart2::ViewLegendEntry > SAL_CALL createLegendEntries( + virtual std::vector< ViewLegendEntry > createLegendEntries( ::com::sun::star::chart::ChartLegendExpansion eLegendExpansion, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xTextProperties, @@ -218,11 +216,10 @@ public: ::com::sun::star::lang::XMultiServiceFactory >& xShapeFactory, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext - ) - throw (::com::sun::star::uno::RuntimeException); + ); - virtual ::com::sun::star::chart2::LegendSymbolStyle getLegendSymbolStyle(); + virtual LegendSymbolStyle getLegendSymbolStyle(); virtual ::com::sun::star::uno::Any getExplicitSymbol( const VDataSeries& rSeries, sal_Int32 nPointIndex=-1/*-1 for series symbol*/ ); ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > createLegendSymbolForSeries( @@ -236,8 +233,7 @@ public: , const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xTarget , const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xShapeFactory ); - virtual std::vector< - ::com::sun::star::chart2::ViewLegendEntry > SAL_CALL createLegendEntriesForSeries( + virtual std::vector< ViewLegendEntry > createLegendEntriesForSeries( const VDataSeries& rSeries, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xTextProperties, @@ -249,18 +245,6 @@ public: ::com::sun::star::uno::XComponentContext >& xContext ); - virtual std::vector< - ::com::sun::star::chart2::ViewLegendEntry > SAL_CALL createLegendEntriesForChartType( - const ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XPropertySet >& xTextProperties, - const ::com::sun::star::uno::Reference< - ::com::sun::star::drawing::XShapes >& xTarget, - const ::com::sun::star::uno::Reference< - ::com::sun::star::lang::XMultiServiceFactory >& xShapeFactory, - const ::com::sun::star::uno::Reference< - ::com::sun::star::uno::XComponentContext >& xContext - ); - //------------------------------------------------------------------------- //------------------------------------------------------------------------- diff --git a/chart2/source/view/main/VLegend.cxx b/chart2/source/view/main/VLegend.cxx index f78a102d50b1..4751d2ccd879 100644 --- a/chart2/source/view/main/VLegend.cxx +++ b/chart2/source/view/main/VLegend.cxx @@ -794,14 +794,6 @@ awt::Point lcl_calculatePositionAndRemainingSpace( return aResult; } -template< class T > -void lcl_appendSeqToVector( const Sequence< T > & rSource, ::std::vector< T > & rDest ) -{ - const sal_Int32 nCount = rSource.getLength(); - for( sal_Int32 i = 0; i < nCount; ++i ) - rDest.push_back( rSource[ i ] ); -} - bool lcl_shouldSymbolsBePlacedOnTheLeftSide( const Reference< beans::XPropertySet >& xLegendProp, sal_Int16 nDefaultWritingMode ) { bool bSymbolsLeftSide = true; @@ -962,9 +954,8 @@ void VLegend::createShapes( LegendEntryProvider* pLegendEntryProvider( *aIter ); if( pLegendEntryProvider ) { - lcl_appendSeqToVector< ViewLegendEntry >( - pLegendEntryProvider->createLegendEntries( eExpansion, xLegendProp, xLegendContainer, m_xShapeFactory, m_xContext ) - , aViewEntries ); + std::vector< ViewLegendEntry > aNewEntries = pLegendEntryProvider->createLegendEntries( eExpansion, xLegendProp, xLegendContainer, m_xShapeFactory, m_xContext ); + aViewEntries.insert( aViewEntries.end(), aNewEntries.begin(), aNewEntries.end() ); } } } diff --git a/chart2/source/view/main/VLegendSymbolFactory.cxx b/chart2/source/view/main/VLegendSymbolFactory.cxx index d29b28e8dbe9..633ecb768021 100644 --- a/chart2/source/view/main/VLegendSymbolFactory.cxx +++ b/chart2/source/view/main/VLegendSymbolFactory.cxx @@ -106,7 +106,7 @@ namespace chart Reference< drawing::XShape > VLegendSymbolFactory::createSymbol( const Reference< drawing::XShapes > xSymbolContainer, - chart2::LegendSymbolStyle eStyle, + LegendSymbolStyle eStyle, const Reference< lang::XMultiServiceFactory > & xShapeFactory, const Reference< beans::XPropertySet > & xLegendEntryProperties, tPropertyType ePropertyType, const uno::Any& rExplicitSymbol ) @@ -131,23 +131,17 @@ Reference< drawing::XShape > VLegendSymbolFactory::createSymbol( // add an invisible square box to maintain aspect ratio switch( eStyle ) { - case chart2::LegendSymbolStyle_BOX: - case chart2::LegendSymbolStyle_HORIZONTAL_LINE: - case chart2::LegendSymbolStyle_VERTICAL_LINE: - case chart2::LegendSymbolStyle_DIAGONAL_LINE: - case chart2::LegendSymbolStyle_LINE_WITH_BOX: - case chart2::LegendSymbolStyle_LINE_WITH_SYMBOL: - case chart2::LegendSymbolStyle_CIRCLE: + case LegendSymbolStyle_BOX: + case LegendSymbolStyle_VERTICAL_LINE: + case LegendSymbolStyle_DIAGONAL_LINE: + case LegendSymbolStyle_LINE_WITH_SYMBOL: + case LegendSymbolStyle_CIRCLE: { Reference< drawing::XShape > xBound( ShapeFactory(xShapeFactory).createInvisibleRectangle( xResultGroup, aBoundSize )); break; } - case chart2::LegendSymbolStyle_BAR: - case chart2::LegendSymbolStyle_RECTANGLE: - case chart2::LegendSymbolStyle_STRETCHED_RECTANGLE: - case chart2::LegendSymbolStyle_USER_DEFINED: default: break; } @@ -155,17 +149,14 @@ Reference< drawing::XShape > VLegendSymbolFactory::createSymbol( // create symbol switch( eStyle ) { - case chart2::LegendSymbolStyle_BOX: - case chart2::LegendSymbolStyle_BAR: - case chart2::LegendSymbolStyle_RECTANGLE: - case chart2::LegendSymbolStyle_STRETCHED_RECTANGLE: - case chart2::LegendSymbolStyle_CIRCLE: + case LegendSymbolStyle_BOX: + case LegendSymbolStyle_CIRCLE: { try { Reference< drawing::XShape > xShape; - if( eStyle == chart2::LegendSymbolStyle_CIRCLE ) + if( eStyle == LegendSymbolStyle_CIRCLE ) xShape.set( xShapeFactory->createInstance( C2U( "com.sun.star.drawing.EllipseShape" )), uno::UNO_QUERY ); else @@ -175,8 +166,8 @@ Reference< drawing::XShape > VLegendSymbolFactory::createSymbol( if( xShape.is()) { xResultGroup->add( xShape ); - if( eStyle == chart2::LegendSymbolStyle_BOX || - eStyle == chart2::LegendSymbolStyle_CIRCLE ) + if( eStyle == LegendSymbolStyle_BOX || + eStyle == LegendSymbolStyle_CIRCLE ) { xShape->setSize( awt::Size( 2000, 2000 )); xShape->setPosition( awt::Point( 500, 0 )); @@ -211,30 +202,7 @@ Reference< drawing::XShape > VLegendSymbolFactory::createSymbol( break; } - case chart2::LegendSymbolStyle_HORIZONTAL_LINE: - { - try - { - Reference< drawing::XShape > xLine( - xShapeFactory->createInstance( - C2U( "com.sun.star.drawing.LineShape" )), uno::UNO_QUERY ); - if( xLine.is()) - { - xResultGroup->add( xLine ); - xLine->setSize( awt::Size( 3000, 0 )); - xLine->setPosition( awt::Point( 0, 1000 )); - - lcl_setPropetiesToShape( xLegendEntryProperties, xLine, ePropertyType ); // PROP_TYPE_LINE_SERIES ); - } - } - catch( uno::Exception & ex ) - { - ASSERT_EXCEPTION( ex ); - } - break; - } - - case chart2::LegendSymbolStyle_VERTICAL_LINE: + case LegendSymbolStyle_VERTICAL_LINE: { try { @@ -257,7 +225,7 @@ Reference< drawing::XShape > VLegendSymbolFactory::createSymbol( break; } - case chart2::LegendSymbolStyle_DIAGONAL_LINE: + case LegendSymbolStyle_DIAGONAL_LINE: { try { @@ -280,10 +248,7 @@ Reference< drawing::XShape > VLegendSymbolFactory::createSymbol( break; } - case chart2::LegendSymbolStyle_LINE_WITH_BOX: - bUseBox = true; - // fall-through intended - case chart2::LegendSymbolStyle_LINE_WITH_SYMBOL: + case LegendSymbolStyle_LINE_WITH_SYMBOL: try { Reference< drawing::XShape > xLine( @@ -300,56 +265,38 @@ Reference< drawing::XShape > VLegendSymbolFactory::createSymbol( Reference< drawing::XShape > xSymbol; const sal_Int32 nSize = 1500; - if( bUseBox ) + chart2::Symbol aSymbol; + if( rExplicitSymbol >>= aSymbol ) { - xSymbol.set( xShapeFactory->createInstance( - C2U( "com.sun.star.drawing.RectangleShape" )), uno::UNO_QUERY ); - xResultGroup->add( xSymbol ); - - if( xSymbol.is()) + drawing::Direction3D aSymbolSize( nSize, nSize, 0 ); + drawing::Position3D aPos( 1500, 1000, 0 ); + ShapeFactory aFactory( xShapeFactory ); + if( aSymbol.Style == chart2::SymbolStyle_STANDARD ) { - xSymbol->setSize( awt::Size( nSize, nSize )); - xSymbol->setPosition( awt::Point( 1500 - nSize/2, 1000 - nSize/2 )); - - lcl_setPropetiesToShape( xLegendEntryProperties, xSymbol, ePropertyType ); + // take series color as fill color + xLegendEntryProperties->getPropertyValue( C2U("Color")) >>= aSymbol.FillColor; + // border of symbols always same as fill color + aSymbol.BorderColor = aSymbol.FillColor; + + xSymbol.set( aFactory.createSymbol2D( + xResultGroup, + aPos, + aSymbolSize, + aSymbol.StandardSymbol, + aSymbol.BorderColor, + aSymbol.FillColor )); } - } - else - { - chart2::Symbol aSymbol; - - if( rExplicitSymbol >>= aSymbol ) + else if( aSymbol.Style == chart2::SymbolStyle_GRAPHIC ) { - drawing::Direction3D aSymbolSize( nSize, nSize, 0 ); - drawing::Position3D aPos( 1500, 1000, 0 ); - ShapeFactory aFactory( xShapeFactory ); - if( aSymbol.Style == chart2::SymbolStyle_STANDARD ) - { - // take series color as fill color - xLegendEntryProperties->getPropertyValue( C2U("Color")) >>= aSymbol.FillColor; - // border of symbols always same as fill color - aSymbol.BorderColor = aSymbol.FillColor; - - xSymbol.set( aFactory.createSymbol2D( - xResultGroup, - aPos, - aSymbolSize, - aSymbol.StandardSymbol, - aSymbol.BorderColor, - aSymbol.FillColor )); - } - else if( aSymbol.Style == chart2::SymbolStyle_GRAPHIC ) - { - xSymbol.set( aFactory.createGraphic2D( - xResultGroup, - aPos, - aSymbolSize, - aSymbol.Graphic )); - } - else if( aSymbol.Style == chart2::SymbolStyle_AUTO ) - { - DBG_ERROR("the given parameter is not allowed to contain an automatic symbol style"); - } + xSymbol.set( aFactory.createGraphic2D( + xResultGroup, + aPos, + aSymbolSize, + aSymbol.Graphic )); + } + else if( aSymbol.Style == chart2::SymbolStyle_AUTO ) + { + DBG_ERROR("the given parameter is not allowed to contain an automatic symbol style"); } } } @@ -359,9 +306,6 @@ Reference< drawing::XShape > VLegendSymbolFactory::createSymbol( } break; - case chart2::LegendSymbolStyle_USER_DEFINED: - break; - default: // just to remove warning (there is an auto-generated extra label) break; |