diff options
author | Ingrid Halama [iha] <Ingrid.Halama@oracle.com> | 2011-02-07 14:03:29 +0100 |
---|---|---|
committer | Ingrid Halama [iha] <Ingrid.Halama@oracle.com> | 2011-02-07 14:03:29 +0100 |
commit | 5e069f674393ef2ce403f99bf3c6854991eb85e9 (patch) | |
tree | a2bc7f24501bd8b8aacc598c6002715c0ddcf34d /chart2 | |
parent | fcad23d649fa143ec292f3775efd8d28d185286b (diff) |
chart52: #i82802# bigger legend keys for lines and dashes, but not for symbols without lines
Diffstat (limited to 'chart2')
-rwxr-xr-x | chart2/source/view/charttypes/VSeriesPlotter.cxx | 44 | ||||
-rw-r--r-- | chart2/source/view/inc/VSeriesPlotter.hxx | 2 |
2 files changed, 28 insertions, 18 deletions
diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx b/chart2/source/view/charttypes/VSeriesPlotter.cxx index 83db0c67ae6c..1077591dfce8 100755 --- a/chart2/source/view/charttypes/VSeriesPlotter.cxx +++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx @@ -1907,19 +1907,24 @@ std::vector< ViewLegendEntry > VSeriesPlotter::createLegendEntries( return aAllSeries; } -bool VSeriesPlotter::HasDashedLines( const uno::Reference< beans::XPropertySet >& xProps ) +namespace { - bool bHasDashedLines = false; +bool lcl_HasVisibleLine( const uno::Reference< beans::XPropertySet >& xProps, bool& rbHasDashedLine ) +{ + bool bHasVisibleLine = false; + rbHasDashedLine = false; drawing::LineStyle aLineStyle = drawing::LineStyle_NONE; - if( xProps.is() && ( xProps->getPropertyValue( C2U("LineStyle")) >>= aLineStyle ) && - ( aLineStyle == drawing::LineStyle_DASH ) ) + if( xProps.is() && ( xProps->getPropertyValue( C2U("LineStyle")) >>= aLineStyle ) ) { - bHasDashedLines = true; + if( aLineStyle != drawing::LineStyle_NONE ) + bHasVisibleLine = true; + if( aLineStyle == drawing::LineStyle_DASH ) + rbHasDashedLine = true; } - return bHasDashedLines; + return bHasVisibleLine; } -bool VSeriesPlotter::HasRegressionCurves( const VDataSeries& rSeries, bool& rbHasDashedLines ) +bool lcl_HasRegressionCurves( const VDataSeries& rSeries, bool& rbHasDashedLine ) { bool bHasRegressionCurves = false; Reference< XRegressionCurveContainer > xRegrCont( rSeries.getModel(), uno::UNO_QUERY ); @@ -1932,14 +1937,13 @@ bool VSeriesPlotter::HasRegressionCurves( const VDataSeries& rSeries, bool& rbHa if( aCurves[i].is() ) { bHasRegressionCurves = true; - if( HasDashedLines( uno::Reference< beans::XPropertySet >( aCurves[i], uno::UNO_QUERY ) ) ) - rbHasDashedLines = true; + lcl_HasVisibleLine( uno::Reference< beans::XPropertySet >( aCurves[i], uno::UNO_QUERY ), rbHasDashedLine ); } } } return bHasRegressionCurves; } - +} LegendSymbolStyle VSeriesPlotter::getLegendSymbolStyle() { return LegendSymbolStyle_BOX; @@ -1951,8 +1955,8 @@ awt::Size VSeriesPlotter::getPreferredLegendKeyAspectRatio() if( m_nDimension==3 ) return aRet; - bool bSeriesHasLines = (getLegendSymbolStyle() == LegendSymbolStyle_LINE); - bool bHasLines = bSeriesHasLines; + bool bSeriesAllowsLines = (getLegendSymbolStyle() == LegendSymbolStyle_LINE); + bool bHasLines = false; bool bHasDashedLines = false; ::std::vector< VDataSeries* > aAllSeries( getAllSeries() ); ::std::vector< VDataSeries* >::const_iterator aSeriesIter = aAllSeries.begin(); @@ -1960,13 +1964,21 @@ awt::Size VSeriesPlotter::getPreferredLegendKeyAspectRatio() //iterate through all series for( ; aSeriesIter != aSeriesEnd; aSeriesIter++ ) { - if( bSeriesHasLines && HasDashedLines( (*aSeriesIter)->getPropertiesOfSeries() ) ) + if( bSeriesAllowsLines ) { - bHasDashedLines = true; - break; + bool bCurrentDashed = false; + if( lcl_HasVisibleLine( (*aSeriesIter)->getPropertiesOfSeries(), bCurrentDashed ) ) + { + bHasLines = true; + if( bCurrentDashed ) + { + bHasDashedLines = true; + break; + } + } } bool bRegressionHasDashedLines=false; - if( VSeriesPlotter::HasRegressionCurves( **aSeriesIter, bRegressionHasDashedLines ) ) + if( lcl_HasRegressionCurves( **aSeriesIter, bRegressionHasDashedLines ) ) { bHasLines = true; if( bRegressionHasDashedLines ) diff --git a/chart2/source/view/inc/VSeriesPlotter.hxx b/chart2/source/view/inc/VSeriesPlotter.hxx index 0360771ea606..9e427a5e2a81 100644 --- a/chart2/source/view/inc/VSeriesPlotter.hxx +++ b/chart2/source/view/inc/VSeriesPlotter.hxx @@ -252,8 +252,6 @@ public: ); ::std::vector< VDataSeries* > getAllSeries(); - static bool HasDashedLines( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xProps ); - static bool HasRegressionCurves( const VDataSeries& rSeries, bool& rbHasDashedLines ); //------------------------------------------------------------------------- //------------------------------------------------------------------------- |