summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chart2/source/inc/DataSeries.hxx6
-rw-r--r--chart2/source/inc/DataSeriesHelper.hxx10
-rw-r--r--chart2/source/model/main/DataSeries.cxx48
-rw-r--r--chart2/source/model/template/ColumnLineChartTypeTemplate.cxx6
-rw-r--r--chart2/source/model/template/LineChartTypeTemplate.cxx6
-rw-r--r--chart2/source/model/template/NetChartTypeTemplate.cxx6
-rw-r--r--chart2/source/model/template/ScatterChartTypeTemplate.cxx6
-rw-r--r--chart2/source/tools/DataSeriesHelper.cxx55
8 files changed, 66 insertions, 77 deletions
diff --git a/chart2/source/inc/DataSeries.hxx b/chart2/source/inc/DataSeries.hxx
index 756c1949afc1..2327bf671753 100644
--- a/chart2/source/inc/DataSeries.hxx
+++ b/chart2/source/inc/DataSeries.hxx
@@ -166,6 +166,12 @@ public:
bool isAttachedToMainAxis() { return getAttachedAxisIndex() == 0; }
+ void switchSymbolsOnOrOff( bool bSymbolsOn, sal_Int32 nSeriesIndex );
+
+ void switchLinesOnOrOff( bool bLinesOn );
+
+ void makeLinesThickOrThin( bool bThick );
+
private:
// late initialization to call after copy-constructing
diff --git a/chart2/source/inc/DataSeriesHelper.hxx b/chart2/source/inc/DataSeriesHelper.hxx
index facedfb8ce79..9bc91b49f645 100644
--- a/chart2/source/inc/DataSeriesHelper.hxx
+++ b/chart2/source/inc/DataSeriesHelper.hxx
@@ -114,16 +114,6 @@ void deleteSeries(
const rtl::Reference< ::chart::DataSeries > & xSeries,
const rtl::Reference< ::chart::ChartType > & xChartType );
-void switchSymbolsOnOrOff(
- const rtl::Reference< ::chart::DataSeries > & xSeries,
- bool bSymbolsOn, sal_Int32 nSeriesIndex );
-
-void switchLinesOnOrOff(
- const rtl::Reference< ::chart::DataSeries > & xSeries,
- bool bLinesOn );
-
-void makeLinesThickOrThin( const rtl::Reference< ::chart::DataSeries > & xSeries, bool bThick );
-
void setPropertyAlsoToAllAttributedDataPoints(
const rtl::Reference< ::chart::DataSeries >& xSeries,
const OUString& rPropertyName,
diff --git a/chart2/source/model/main/DataSeries.cxx b/chart2/source/model/main/DataSeries.cxx
index 8758bbd76f63..83e3e2e9a273 100644
--- a/chart2/source/model/main/DataSeries.cxx
+++ b/chart2/source/model/main/DataSeries.cxx
@@ -27,8 +27,10 @@
#include <CloneHelper.hxx>
#include <RegressionCurveModel.hxx>
#include <ModifyListenerHelper.hxx>
+#include <com/sun/star/chart2/Symbol.hpp>
#include <com/sun/star/chart2/data/XTextualDataSequence.hpp>
#include <com/sun/star/container/NoSuchElementException.hpp>
+#include <com/sun/star/drawing/LineStyle.hpp>
#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
#include <cppuhelper/supportsservice.hxx>
#include <comphelper/diagnose_ex.hxx>
@@ -766,6 +768,52 @@ sal_Int32 DataSeries::getAttachedAxisIndex()
return nRet;
}
+void DataSeries::switchSymbolsOnOrOff( bool bSymbolsOn, sal_Int32 nSeriesIndex )
+{
+ css::chart2::Symbol aSymbProp;
+ if( getPropertyValue( u"Symbol"_ustr) >>= aSymbProp )
+ {
+ if( !bSymbolsOn )
+ aSymbProp.Style = chart2::SymbolStyle_NONE;
+ else if( aSymbProp.Style == chart2::SymbolStyle_NONE )
+ {
+ aSymbProp.Style = chart2::SymbolStyle_STANDARD;
+ aSymbProp.StandardSymbol = nSeriesIndex;
+ }
+ setPropertyValue( u"Symbol"_ustr, uno::Any( aSymbProp ));
+ }
+ //todo: check attributed data points
+}
+
+void DataSeries::switchLinesOnOrOff( bool bLinesOn )
+{
+ if( bLinesOn )
+ {
+ // keep line-styles that are not NONE
+ css::drawing::LineStyle eLineStyle;
+ if( (getPropertyValue( u"LineStyle"_ustr) >>= eLineStyle ) &&
+ eLineStyle == drawing::LineStyle_NONE )
+ {
+ setPropertyValue( u"LineStyle"_ustr, uno::Any( drawing::LineStyle_SOLID ) );
+ }
+ }
+ else
+ setPropertyValue( u"LineStyle"_ustr, uno::Any( drawing::LineStyle_NONE ) );
+}
+
+void DataSeries::makeLinesThickOrThin( bool bThick )
+{
+ sal_Int32 nNewValue = bThick ? 80 : 0;
+ sal_Int32 nOldValue = 0;
+ if( (getPropertyValue( u"LineWidth"_ustr) >>= nOldValue ) &&
+ nOldValue != nNewValue )
+ {
+ if( !(bThick && nOldValue>0))
+ setPropertyValue( u"LineWidth"_ustr, uno::Any( nNewValue ) );
+ }
+}
+
+
} // namespace chart
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
diff --git a/chart2/source/model/template/ColumnLineChartTypeTemplate.cxx b/chart2/source/model/template/ColumnLineChartTypeTemplate.cxx
index 30eb42d2ce03..1cfa6d1f258f 100644
--- a/chart2/source/model/template/ColumnLineChartTypeTemplate.cxx
+++ b/chart2/source/model/template/ColumnLineChartTypeTemplate.cxx
@@ -215,9 +215,9 @@ void ColumnLineChartTypeTemplate::applyStyle2(
}
else if( nChartTypeIndex==1 ) // lines
{
- DataSeriesHelper::switchLinesOnOrOff( xSeries, true );
- DataSeriesHelper::switchSymbolsOnOrOff( xSeries, false, nSeriesIndex );
- DataSeriesHelper::makeLinesThickOrThin( xSeries, true );
+ xSeries->switchLinesOnOrOff( true );
+ xSeries->switchSymbolsOnOrOff( false, nSeriesIndex );
+ xSeries->makeLinesThickOrThin( true );
}
}
diff --git a/chart2/source/model/template/LineChartTypeTemplate.cxx b/chart2/source/model/template/LineChartTypeTemplate.cxx
index 4f99151471e7..816ae23c4dc7 100644
--- a/chart2/source/model/template/LineChartTypeTemplate.cxx
+++ b/chart2/source/model/template/LineChartTypeTemplate.cxx
@@ -308,9 +308,9 @@ void LineChartTypeTemplate::applyStyle2(
try
{
- DataSeriesHelper::switchSymbolsOnOrOff( xSeries, m_bHasSymbols, nSeriesIndex );
- DataSeriesHelper::switchLinesOnOrOff( xSeries, m_bHasLines );
- DataSeriesHelper::makeLinesThickOrThin( xSeries, m_nDim==2 );
+ xSeries->switchSymbolsOnOrOff( m_bHasSymbols, nSeriesIndex );
+ xSeries->switchLinesOnOrOff( m_bHasLines );
+ xSeries->makeLinesThickOrThin( m_nDim==2 );
}
catch( const uno::Exception & )
{
diff --git a/chart2/source/model/template/NetChartTypeTemplate.cxx b/chart2/source/model/template/NetChartTypeTemplate.cxx
index 3be8633c329f..07537c66b1df 100644
--- a/chart2/source/model/template/NetChartTypeTemplate.cxx
+++ b/chart2/source/model/template/NetChartTypeTemplate.cxx
@@ -69,9 +69,9 @@ void NetChartTypeTemplate::applyStyle2(
try
{
- DataSeriesHelper::switchSymbolsOnOrOff( xSeries, m_bHasSymbols, nSeriesIndex );
- DataSeriesHelper::switchLinesOnOrOff( xSeries, m_bHasLines );
- DataSeriesHelper::makeLinesThickOrThin( xSeries, true );
+ xSeries->switchSymbolsOnOrOff( m_bHasSymbols, nSeriesIndex );
+ xSeries->switchLinesOnOrOff( m_bHasLines );
+ xSeries->makeLinesThickOrThin( true );
}
catch( const uno::Exception & )
{
diff --git a/chart2/source/model/template/ScatterChartTypeTemplate.cxx b/chart2/source/model/template/ScatterChartTypeTemplate.cxx
index 36fd995d9fab..80e8cc4bb924 100644
--- a/chart2/source/model/template/ScatterChartTypeTemplate.cxx
+++ b/chart2/source/model/template/ScatterChartTypeTemplate.cxx
@@ -175,9 +175,9 @@ void ScatterChartTypeTemplate::applyStyle2(
try
{
- DataSeriesHelper::switchSymbolsOnOrOff( xSeries, m_bHasSymbols, nSeriesIndex );
- DataSeriesHelper::switchLinesOnOrOff( xSeries, m_bHasLines );
- DataSeriesHelper::makeLinesThickOrThin( xSeries, m_nDim==2 );
+ xSeries->switchSymbolsOnOrOff( m_bHasSymbols, nSeriesIndex );
+ xSeries->switchLinesOnOrOff( m_bHasLines );
+ xSeries->makeLinesThickOrThin( m_nDim==2 );
if( m_nDim==3 )
DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints( xSeries, u"BorderStyle"_ustr, uno::Any( drawing::LineStyle_NONE ) );
}
diff --git a/chart2/source/tools/DataSeriesHelper.cxx b/chart2/source/tools/DataSeriesHelper.cxx
index 6de10a3a9447..80a314051dab 100644
--- a/chart2/source/tools/DataSeriesHelper.cxx
+++ b/chart2/source/tools/DataSeriesHelper.cxx
@@ -373,61 +373,6 @@ void deleteSeries(
}
}
-void switchSymbolsOnOrOff( const rtl::Reference< DataSeries > & xSeries,
- bool bSymbolsOn, sal_Int32 nSeriesIndex )
-{
- if( !xSeries )
- return;
-
- chart2::Symbol aSymbProp;
- if( xSeries->getPropertyValue( u"Symbol"_ustr) >>= aSymbProp )
- {
- if( !bSymbolsOn )
- aSymbProp.Style = chart2::SymbolStyle_NONE;
- else if( aSymbProp.Style == chart2::SymbolStyle_NONE )
- {
- aSymbProp.Style = chart2::SymbolStyle_STANDARD;
- aSymbProp.StandardSymbol = nSeriesIndex;
- }
- xSeries->setPropertyValue( u"Symbol"_ustr, uno::Any( aSymbProp ));
- }
- //todo: check attributed data points
-}
-
-void switchLinesOnOrOff( const rtl::Reference< DataSeries > & xSeries, bool bLinesOn )
-{
- if( !xSeries )
- return;
-
- if( bLinesOn )
- {
- // keep line-styles that are not NONE
- drawing::LineStyle eLineStyle;
- if( (xSeries->getPropertyValue( u"LineStyle"_ustr) >>= eLineStyle ) &&
- eLineStyle == drawing::LineStyle_NONE )
- {
- xSeries->setPropertyValue( u"LineStyle"_ustr, uno::Any( drawing::LineStyle_SOLID ) );
- }
- }
- else
- xSeries->setPropertyValue( u"LineStyle"_ustr, uno::Any( drawing::LineStyle_NONE ) );
-}
-
-void makeLinesThickOrThin( const rtl::Reference< ::chart::DataSeries > & xSeries, bool bThick )
-{
- if( !xSeries )
- return;
-
- sal_Int32 nNewValue = bThick ? 80 : 0;
- sal_Int32 nOldValue = 0;
- if( (xSeries->getPropertyValue( u"LineWidth"_ustr) >>= nOldValue ) &&
- nOldValue != nNewValue )
- {
- if( !(bThick && nOldValue>0))
- xSeries->setPropertyValue( u"LineWidth"_ustr, uno::Any( nNewValue ) );
- }
-}
-
void setPropertyAlsoToAllAttributedDataPoints( const rtl::Reference< ::chart::DataSeries >& xSeries,
const OUString& rPropertyName, const uno::Any& rPropertyValue )
{