summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomaž Vajngerl <quikee@gmail.com>2013-11-24 19:40:27 +0100
committerTomaž Vajngerl <quikee@gmail.com>2013-11-24 19:43:18 +0100
commit288719571eb617613ba9724f394a257a17d43a81 (patch)
treeba2026c63faad00fae968b6f6596488c30132014
parentfdb6711835ceab636222d8ec5264d008c2621748 (diff)
Support regression curve name in old binary XLS XP/2k/2k3 format.
Change-Id: Ie6f2fd3cce70e4789805e788846d3beb64620a4b
-rw-r--r--sc/source/filter/excel/xechart.cxx11
-rw-r--r--sc/source/filter/excel/xichart.cxx13
-rw-r--r--sc/source/filter/inc/xechart.hxx2
-rw-r--r--sc/source/filter/inc/xichart.hxx5
-rw-r--r--sc/source/filter/inc/xlchart.hxx1
5 files changed, 30 insertions, 2 deletions
diff --git a/sc/source/filter/excel/xechart.cxx b/sc/source/filter/excel/xechart.cxx
index 26deac38d176..f68bf67ec112 100644
--- a/sc/source/filter/excel/xechart.cxx
+++ b/sc/source/filter/excel/xechart.cxx
@@ -972,6 +972,11 @@ sal_uInt16 XclExpChSourceLink::ConvertDataSequence( Reference< XDataSequence > x
return ulimit_cast< sal_uInt16 >( nValueCount, EXC_CHDATAFORMAT_MAXPOINTCOUNT );
}
+void XclExpChSourceLink::ConvertString( OUString aString )
+{
+ mxString = XclExpStringHelper::CreateString( GetRoot(), aString, EXC_STR_FORCEUNICODE | EXC_STR_8BITLENGTH | EXC_STR_SEPARATEFORMATS );
+}
+
sal_uInt16 XclExpChSourceLink::ConvertStringSequence( const Sequence< Reference< XFormattedString > >& rStringSeq )
{
mxString.reset();
@@ -2049,10 +2054,16 @@ bool XclExpChSeries::ConvertStockSeries( XDataSeriesRef xDataSeries,
bool XclExpChSeries::ConvertTrendLine( const XclExpChSeries& rParent, Reference< XRegressionCurve > xRegCurve )
{
InitFromParent( rParent );
+
mxTrendLine.reset( new XclExpChSerTrendLine( GetChRoot() ) );
bool bOk = mxTrendLine->Convert( xRegCurve, mnSeriesIdx );
if( bOk )
{
+ OUString aName;
+ ScfPropertySet aProperties( xRegCurve );
+ aProperties.GetProperty(aName, EXC_CHPROP_CURVENAME);
+ mxTitleLink->ConvertString(aName);
+
mxSeriesFmt = mxTrendLine->GetDataFormat();
GetChartData().SetDataLabel( mxTrendLine->GetDataLabel() );
}
diff --git a/sc/source/filter/excel/xichart.cxx b/sc/source/filter/excel/xichart.cxx
index d99c12c7d30d..a7103a2b9079 100644
--- a/sc/source/filter/excel/xichart.cxx
+++ b/sc/source/filter/excel/xichart.cxx
@@ -1645,6 +1645,7 @@ Reference< XRegressionCurve > XclImpChSerTrendLine::CreateRegressionCurve() cons
ScfPropertySet aPropSet( xRegCurve );
mxDataFmt->ConvertLine( aPropSet, EXC_CHOBJTYPE_TRENDLINE );
+ aPropSet.SetProperty(EXC_CHPROP_CURVENAME, maTrendLineName);
aPropSet.SetProperty(EXC_CHPROP_POLYNOMIAL_DEGREE, static_cast<sal_Int32> (maData.mnOrder) );
aPropSet.SetProperty(EXC_CHPROP_MOVING_AVERAGE_PERIOD, static_cast<sal_Int32> (maData.mnOrder) );
aPropSet.SetProperty(EXC_CHPROP_EXTRAPOLATE_FORWARD, maData.mfForecastFor);
@@ -1911,9 +1912,17 @@ void XclImpChSeries::FinalizeDataFormats()
// copy series formatting to child objects
for( XclImpChSerTrendLineList::iterator aLIt = maTrendLines.begin(), aLEnd = maTrendLines.end(); aLIt != aLEnd; ++aLIt )
- (*aLIt)->SetDataFormat( mxSeriesFmt );
+ {
+ (*aLIt)->SetDataFormat(mxSeriesFmt);
+ if (mxTitleLink->HasString())
+ {
+ (*aLIt)->SetTrendlineName(mxTitleLink->GetString());
+ }
+ }
for( XclImpChSerErrorBarMap::iterator aMIt = maErrorBars.begin(), aMEnd = maErrorBars.end(); aMIt != aMEnd; ++aMIt )
+ {
aMIt->second->SetSeriesData( mxValueLink, mxSeriesFmt );
+ }
}
else if( XclImpChTypeGroup* pTypeGroup = GetChartData().GetTypeGroup( mnGroupIdx ).get() )
{
@@ -2155,7 +2164,9 @@ void XclImpChSeries::ConvertTrendLines( Reference< XDataSeries > xDataSeries ) c
{
Reference< XRegressionCurve > xRegCurve = (*aIt)->CreateRegressionCurve();
if( xRegCurve.is() )
+ {
xRegCurveCont->addRegressionCurve( xRegCurve );
+ }
}
catch( Exception& )
{
diff --git a/sc/source/filter/inc/xechart.hxx b/sc/source/filter/inc/xechart.hxx
index 78f2fef0f00b..6884ddd1b6e7 100644
--- a/sc/source/filter/inc/xechart.hxx
+++ b/sc/source/filter/inc/xechart.hxx
@@ -406,6 +406,8 @@ public:
public:
explicit XclExpChSourceLink( const XclExpChRoot& rRoot, sal_uInt8 nDestType );
+
+ void ConvertString( OUString aString );
/** Converts the passed source link, returns the number of linked values. */
sal_uInt16 ConvertDataSequence( XDataSequenceRef xDataSeq, bool bSplitToColumns, sal_uInt16 nDefCount = 0 );
/** Converts the passed sequence of formatted string objects, returns leading font index. */
diff --git a/sc/source/filter/inc/xichart.hxx b/sc/source/filter/inc/xichart.hxx
index 8ce7d03e7079..04f48c77614a 100644
--- a/sc/source/filter/inc/xichart.hxx
+++ b/sc/source/filter/inc/xichart.hxx
@@ -736,11 +736,14 @@ public:
/** Sets formatting information for the trend line. */
inline void SetDataFormat( XclImpChDataFormatRef xDataFmt ) { mxDataFmt = xDataFmt; }
+ inline void SetTrendlineName( OUString aTrendlineName) { maTrendLineName = aTrendlineName; }
+
/** Creates an API object representing this trend line. */
XRegressionCurveRef CreateRegressionCurve() const;
private:
- XclChSerTrendLine maData; /// Contents of the CHSERTRENDLINE record.
+ OUString maTrendLineName;
+ XclChSerTrendLine maData; /// Contents of the CHSERTRENDLINE record.
XclImpChDataFormatRef mxDataFmt; /// Formatting settings of the trend line.
};
diff --git a/sc/source/filter/inc/xlchart.hxx b/sc/source/filter/inc/xlchart.hxx
index 4354b5ce4373..408d6d97cb67 100644
--- a/sc/source/filter/inc/xlchart.hxx
+++ b/sc/source/filter/inc/xlchart.hxx
@@ -68,6 +68,7 @@ class XclRoot;
#define EXC_CHPROP_CROSSOVERPOSITION "CrossoverPosition"
#define EXC_CHPROP_CROSSOVERVALUE "CrossoverValue"
#define EXC_CHPROP_CURVESTYLE "CurveStyle"
+#define EXC_CHPROP_CURVENAME "CurveName"
#define EXC_CHPROP_D3DCAMERAGEOMETRY "D3DCameraGeometry"
#define EXC_CHPROP_D3DSCENEAMBIENTCOLOR "D3DSceneAmbientColor"
#define EXC_CHPROP_D3DSCENELIGHTON1 "D3DSceneLightOn1"