[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - sc/source

Tomaž Vajngerl quikee at gmail.com
Tue Dec 3 01:32:14 PST 2013


 sc/source/filter/excel/xechart.cxx |   11 +++++++++++
 sc/source/filter/excel/xichart.cxx |   13 ++++++++++++-
 sc/source/filter/inc/xechart.hxx   |    2 ++
 sc/source/filter/inc/xichart.hxx   |    5 ++++-
 sc/source/filter/inc/xlchart.hxx   |    1 +
 5 files changed, 30 insertions(+), 2 deletions(-)

New commits:
commit 6064e0d8a36e77f53f04aebd0b32b5ab91ba3108
Author: Tomaž Vajngerl <quikee at gmail.com>
Date:   Sun Nov 24 19:40:27 2013 +0100

    Support regression curve name in old binary XLS XP/2k/2k3 format.
    
    Change-Id: Ie6f2fd3cce70e4789805e788846d3beb64620a4b
    Reviewed-on: https://gerrit.libreoffice.org/6876
    Reviewed-by: Björn Michaelsen <bjoern.michaelsen at canonical.com>
    Reviewed-by: Thorsten Behrens <thb at documentfoundation.org>
    Tested-by: Thorsten Behrens <thb at documentfoundation.org>

diff --git a/sc/source/filter/excel/xechart.cxx b/sc/source/filter/excel/xechart.cxx
index 26deac3..f68bf67 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 060aa51..5fc5783 100644
--- a/sc/source/filter/excel/xichart.cxx
+++ b/sc/source/filter/excel/xichart.cxx
@@ -1652,6 +1652,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);
@@ -1918,9 +1919,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() )
     {
@@ -2162,7 +2171,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 78f2fef..6884ddd1 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 8ce7d03..04f48c7 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 4354b5c..408d6d9 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"


More information about the Libreoffice-commits mailing list