diff options
author | Vladimir Glazounov <vg@openoffice.org> | 2007-05-22 17:50:23 +0000 |
---|---|---|
committer | Vladimir Glazounov <vg@openoffice.org> | 2007-05-22 17:50:23 +0000 |
commit | a334c881df558cec88fb521f934e544987366226 (patch) | |
tree | bfd409471ccfa300dab08a801ef45b200ad5d329 /chart2 | |
parent | 565ca8191a68580334d9b6db3e4a0d6a8b6d2897 (diff) |
INTEGRATION: CWS chart2mst3 (1.3.4); FILE MERGED
2007/03/26 14:17:52 iha 1.3.4.28: #i75590# copy some aspects from old charttype during creation of new
2007/02/23 18:09:51 iha 1.3.4.27: #i74655# symbols lost when switching smooth lines
2006/10/18 17:14:29 bm 1.3.4.26: RESYNC: (1.4-1.5); FILE MERGED
2006/05/18 14:17:35 bm 1.3.4.25: #i65525# template detection corrected
2006/04/10 12:25:13 iha 1.3.4.24: api restructure axis, grids, scales and increments
2005/12/20 14:13:26 dr 1.3.4.23: API struct member names without prefixes
2005/10/07 12:04:23 bm 1.3.4.22: RESYNC: (1.3-1.4); FILE MERGED
2005/08/05 14:19:58 bm 1.3.4.21: getStackMode: per chart type (open: percent stacking works per coordinate system, how can this be synched)
2005/08/04 11:53:42 bm 1.3.4.20: set stack mode at new series. Percent stacking is now set in adaptScales
2005/08/03 16:36:24 bm 1.3.4.19: algohelper.hxx split up into CommonFunctors.hxx ContainerHelper.hxx CloneHelper.hxx
2005/04/14 16:30:09 iha 1.3.4.18: removed wrong previous changes
2005/04/14 16:28:17 iha 1.3.4.17: defines for servicenames for charttypes (fixed apply to 2nd axis again)
2005/04/11 09:40:09 iha 1.3.4.16: defines for servicenames for charttypes (fixed apply to 2nd axis again)
2004/09/16 15:24:26 bm 1.3.4.15: API simplification
2004/09/16 13:24:50 bm 1.3.4.14: API simplification
2004/09/16 12:27:28 bm 1.3.4.13: API simplification
2004/09/15 17:32:06 bm 1.3.4.12: API simplification
2004/06/29 12:26:34 bm 1.3.4.11: XChartTypeTemplate changes
2004/05/27 17:27:12 bm 1.3.4.10: +getChartTypeForNewSeries at XChartTypeTemplate
2004/05/07 15:34:35 bm 1.3.4.9: applyStyle works for single series now
2004/04/21 20:45:54 iha 1.3.4.8: #i20344# net subtypes changed
2004/04/01 10:53:11 bm 1.3.4.7: XChartType: may return a coordinate system now
2004/03/24 19:05:25 bm 1.3.4.6: XChartTypeTemplate changed: matchesTemplate may modify the
template s properties if bAdaptProperties is true
2004/03/22 15:23:50 iha 1.3.4.5: added parameter SwapXAndYAxis for horizontal bar chart to method createCoordinateSystems
2004/03/19 14:32:58 bm 1.3.4.4: XDataSource now contains XLabeledDataSources
2004/03/02 16:40:43 bm 1.3.4.3: allow creating more than one coordinate system
2004/02/20 17:43:56 iha 1.3.4.2: integrate categories at ScaleData
2004/02/13 16:51:43 bm 1.3.4.1: join from changes on branch bm_post_chart01
Diffstat (limited to 'chart2')
-rw-r--r-- | chart2/source/model/template/NetChartTypeTemplate.cxx | 160 |
1 files changed, 75 insertions, 85 deletions
diff --git a/chart2/source/model/template/NetChartTypeTemplate.cxx b/chart2/source/model/template/NetChartTypeTemplate.cxx index 0c207bfc4a04..cf37e63dcd21 100644 --- a/chart2/source/model/template/NetChartTypeTemplate.cxx +++ b/chart2/source/model/template/NetChartTypeTemplate.cxx @@ -4,9 +4,9 @@ * * $RCSfile: NetChartTypeTemplate.cxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: obo $ $Date: 2006-09-17 13:19:40 $ + * last change: $Author: vg $ $Date: 2007-05-22 18:50:23 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -36,14 +36,12 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_chart2.hxx" #include "NetChartTypeTemplate.hxx" -#include "NetChartType.hxx" #include "macros.hxx" -#include "algohelper.hxx" -#include "DataSeriesTreeHelper.hxx" #include "PolarCoordinateSystem.hxx" -#include "BoundedCoordinateSystem.hxx" #include "Scaling.hxx" -#include "Scale.hxx" +#include "DiagramHelper.hxx" +#include "servicenames_charttypes.hxx" +#include "DataSeriesHelper.hxx" #ifndef _COM_SUN_STAR_CHART2_SYMBOLSTYLE_HPP_ #include <com/sun/star/chart2/SymbolStyle.hpp> @@ -77,122 +75,88 @@ namespace chart NetChartTypeTemplate::NetChartTypeTemplate( Reference< uno::XComponentContext > const & xContext, const ::rtl::OUString & rServiceName, - chart2::StackMode eStackMode, - bool bSymbols ) : + StackMode eStackMode, + bool bSymbols, + bool bHasLines ) : ChartTypeTemplate( xContext, rServiceName ), m_eStackMode( eStackMode ), - m_bHasSymbols( bSymbols ) + m_bHasSymbols( bSymbols ), + m_bHasLines( bHasLines ) {} NetChartTypeTemplate::~NetChartTypeTemplate() {} -chart2::StackMode NetChartTypeTemplate::getYStackMode() const +StackMode NetChartTypeTemplate::getStackMode( sal_Int32 nChartTypeIndex ) const { return m_eStackMode; } -Reference< chart2::XBoundedCoordinateSystem > NetChartTypeTemplate::createCoordinateSystem( - const Reference< chart2::XBoundedCoordinateSystemContainer > & xCoordSysCnt ) +void SAL_CALL NetChartTypeTemplate::applyStyle( + const Reference< chart2::XDataSeries >& xSeries, + ::sal_Int32 nChartTypeIndex, + ::sal_Int32 nSeriesIndex, + ::sal_Int32 nSeriesCount ) + throw (uno::RuntimeException) { - Reference< chart2::XCoordinateSystem > xCoordSys( - new PolarCoordinateSystem( getDimension() )); - Reference< chart2::XBoundedCoordinateSystem > xResult( - new BoundedCoordinateSystem( xCoordSys )); - - chart2::ScaleData aScale; - aScale.Scaling = new LinearScaling( 1.0, 0.0 ); - - aScale.Orientation = chart2::AxisOrientation_REVERSE; - xResult->setScaleByDimension( - 0, Reference< chart2::XScale >( new Scale( GetComponentContext(), aScale ) )); - aScale.Orientation = chart2::AxisOrientation_MATHEMATICAL; - xResult->setScaleByDimension( - 1, Reference< chart2::XScale >( new Scale( GetComponentContext(), aScale ) )); + ChartTypeTemplate::applyStyle( xSeries, nChartTypeIndex, nSeriesIndex, nSeriesCount ); try { - if( xCoordSys.is()) - xCoordSysCnt->addCoordinateSystem( xResult ); + Reference< beans::XPropertySet > xProp( xSeries, uno::UNO_QUERY_THROW ); + + DataSeriesHelper::switchSymbolsOnOrOff( xProp, m_bHasSymbols, nSeriesIndex ); + DataSeriesHelper::switchLinesOnOrOff( xProp, m_bHasLines ); } - catch( lang::IllegalArgumentException ex ) + catch( uno::Exception & ex ) { ASSERT_EXCEPTION( ex ); } - - return xResult; -} - -Reference< chart2::XChartType > NetChartTypeTemplate::getDefaultChartType() - throw (uno::RuntimeException) -{ - return new NetChartType(); } // ____ XChartTypeTemplate ____ -Reference< chart2::XDiagram > SAL_CALL - NetChartTypeTemplate::createDiagram( - const uno::Sequence< Reference< chart2::XDataSeries > >& aSeriesSeq ) - throw (uno::RuntimeException) -{ - // set symbol type at data series - chart2::SymbolStyle eStyle = m_bHasSymbols - ? chart2::SymbolStyle_STANDARD - : chart2::SymbolStyle_NONE; - - for( sal_Int32 i = 0; i < aSeriesSeq.getLength(); ++i ) - { - try - { - chart2::Symbol aSymbProp; - Reference< beans::XPropertySet > xProp( aSeriesSeq[i], uno::UNO_QUERY_THROW ); - if( (xProp->getPropertyValue( C2U( "Symbol" )) >>= aSymbProp ) ) - { - aSymbProp.aStyle = eStyle; - if( m_bHasSymbols ) - aSymbProp.nStandardSymbol = i; - xProp->setPropertyValue( C2U( "Symbol" ), uno::makeAny( aSymbProp )); - } - } - catch( uno::Exception & ex ) - { - ASSERT_EXCEPTION( ex ); - } - } - - // todo: set symbol type at data points - - return ChartTypeTemplate::createDiagram( aSeriesSeq ); -} - sal_Bool SAL_CALL NetChartTypeTemplate::matchesTemplate( - const Reference< chart2::XDiagram >& xDiagram ) + const Reference< chart2::XDiagram >& xDiagram, + sal_Bool bAdaptProperties ) throw (uno::RuntimeException) { - sal_Bool bResult = ChartTypeTemplate::matchesTemplate( xDiagram ); + sal_Bool bResult = ChartTypeTemplate::matchesTemplate( xDiagram, bAdaptProperties ); // check symbol-style + // for a template with symbols it is ok, if there is at least one series + // with symbols, otherwise an unknown template is too easy to achieve + bool bSymbolsFound = false; if( bResult ) { - uno::Sequence< Reference< chart2::XDataSeries > > aSeriesSeq( - helper::DataSeriesTreeHelper::getDataSeriesFromDiagram( xDiagram )); + ::std::vector< Reference< chart2::XDataSeries > > aSeriesVec( + DiagramHelper::getDataSeriesFromDiagram( xDiagram )); chart2::SymbolStyle eStyle = m_bHasSymbols ? chart2::SymbolStyle_STANDARD : chart2::SymbolStyle_NONE; - for( sal_Int32 i = 0; i < aSeriesSeq.getLength(); ++i ) + for( ::std::vector< Reference< chart2::XDataSeries > >::const_iterator aIt = + aSeriesVec.begin(); aIt != aSeriesVec.end(); ++aIt ) { try { chart2::Symbol aSymbProp; - Reference< beans::XPropertySet > xProp( aSeriesSeq[i], uno::UNO_QUERY_THROW ); - if( (xProp->getPropertyValue( C2U( "Symbol" )) >>= aSymbProp ) ) + drawing::LineStyle eLineStyle; + Reference< beans::XPropertySet > xProp( *aIt, uno::UNO_QUERY_THROW ); + if( (xProp->getPropertyValue( C2U( "Symbol" )) >>= aSymbProp) && + (aSymbProp.Style != chart2::SymbolStyle_NONE ) && + (! m_bHasSymbols) ) { - if( aSymbProp.aStyle != eStyle ) - { - bResult = false; - break; - } + bResult = false; + break; + } + if( m_bHasSymbols ) + bSymbolsFound = bSymbolsFound || (aSymbProp.Style != chart2::SymbolStyle_NONE); + + if( (xProp->getPropertyValue( C2U( "LineStyle" )) >>= eLineStyle) && + (m_bHasLines != ( eLineStyle != drawing::LineStyle_NONE )) ) + { + bResult = false; + break; } } catch( uno::Exception & ex ) @@ -200,11 +164,37 @@ sal_Bool SAL_CALL NetChartTypeTemplate::matchesTemplate( ASSERT_EXCEPTION( ex ); } } + + if( m_bHasSymbols ) + bResult = bResult && bSymbolsFound; } return bResult; } +Reference< chart2::XChartType > SAL_CALL NetChartTypeTemplate::getChartTypeForNewSeries( + const uno::Sequence< Reference< chart2::XChartType > >& aFormerlyUsedChartTypes ) + throw (uno::RuntimeException) +{ + Reference< chart2::XChartType > xResult; + + try + { + Reference< lang::XMultiServiceFactory > xFact( + GetComponentContext()->getServiceManager(), uno::UNO_QUERY_THROW ); + xResult.set( xFact->createInstance( + CHART2_SERVICE_NAME_CHARTTYPE_NET ), uno::UNO_QUERY_THROW ); + ChartTypeTemplate::copyPropertiesFromOldToNewCoordianteSystem( aFormerlyUsedChartTypes, xResult ); + } + catch( uno::Exception & ex ) + { + ASSERT_EXCEPTION( ex ); + } + + return xResult; + +} + // ---------------------------------------- Sequence< OUString > NetChartTypeTemplate::getSupportedServiceNames_Static() |