[Libreoffice-commits] core.git: 3 commits - oox/source sc/source

2014-02-17 Thread Markus Mohrhard
 oox/source/export/vmlexport.cxx |5 +
 sc/source/filter/excel/xeescher.cxx |5 -
 sc/source/filter/excel/xepivot.cxx  |   11 ++-
 sc/source/filter/inc/xepivot.hxx|3 ++-
 4 files changed, 17 insertions(+), 7 deletions(-)

New commits:
commit cd03b4ac54076b5471bf8b3154ecb6b4e7cc
Author: Markus Mohrhard markus.mohrh...@collabora.co.uk
Date:   Mon Feb 17 05:39:07 2014 +0100

fix invalid string access, related #i83611#

Change-Id: I5954f78e10d99a064f83e96282c28c086c7f07f1

diff --git a/sc/source/filter/excel/xeescher.cxx 
b/sc/source/filter/excel/xeescher.cxx
index 4a9fb82..67ac325 100644
--- a/sc/source/filter/excel/xeescher.cxx
+++ b/sc/source/filter/excel/xeescher.cxx
@@ -691,7 +691,10 @@ XclExpTbxControlObj::XclExpTbxControlObj( 
XclExpObjectManager rRoot, Reference
 //Export description as alt text
 if( SdrObject* pSdrObj = SdrObject::getSdrObjectFromXShape( xShape ) )
 {
-OUString  aAltTxt = pSdrObj-GetDescription().copy( 0, 
MSPROP_DESCRIPTION_MAX_LEN );
+OUString aAltTxt;
+OUString aDescrText = pSdrObj-GetDescription();
+if(!aDescrText.isEmpty())
+aAltTxt = aDescrText.copy( 0, 
std::minsal_Int32(MSPROP_DESCRIPTION_MAX_LEN, aDescrText.getLength()) );
 aPropOpt.AddOpt( ESCHER_Prop_wzDescription, aAltTxt );
 }
 
commit 8a5c8c251fe42f639b029f72244326cdc1b3bb7b
Author: Markus Mohrhard markus.mohrh...@collabora.co.uk
Date:   Sun Feb 16 22:07:20 2014 +0100

multiple pivot tables on same sheet OOXML fix (part1), related #i83250#

This just fixes the generation of the pivot table file and the
relationship. It crashed in a dbgutil build because we tried to
overwrite the same stream for each pivot table on one sheet.

Change-Id: If2c9541e38b483ead75fff32d5f6d9e16970e702

diff --git a/sc/source/filter/excel/xepivot.cxx 
b/sc/source/filter/excel/xepivot.cxx
index e03cbf1..a0a00d6 100644
--- a/sc/source/filter/excel/xepivot.cxx
+++ b/sc/source/filter/excel/xepivot.cxx
@@ -1243,13 +1243,14 @@ void XclExpPTField::WriteSxvdex( XclExpStream rStrm ) 
const
 
 // 
 
-XclExpPivotTable::XclExpPivotTable( const XclExpRoot rRoot, const ScDPObject 
rDPObj, const XclExpPivotCache rPCache ) :
+XclExpPivotTable::XclExpPivotTable( const XclExpRoot rRoot, const ScDPObject 
rDPObj, const XclExpPivotCache rPCache, size_t nId ) :
 XclExpRoot( rRoot ),
 mrPCache( rPCache ),
 maDataOrientField( *this, EXC_SXIVD_DATA ),
 mnOutScTab( 0 ),
 mbValid( false ),
-mbFilterBtn( false )
+mbFilterBtn( false ),
+mnId( nId )
 {
 const ScRange rOutScRange = rDPObj.GetOutRange();
 if( GetAddressConverter().ConvertRange( maPTInfo.maOutXclRange, 
rOutScRange, true ) )
@@ -1352,8 +1353,8 @@ void XclExpPivotTable::SaveXml( XclExpXmlStream rStrm )
 if( !mbValid )
 return;
 sax_fastparser::FSHelperPtr aPivotTableDefinition = 
rStrm.CreateOutputStream(
-XclXmlUtils::GetStreamName( xl/, pivotTables/pivotTable, 
mnOutScTab+1),
-XclXmlUtils::GetStreamName( ../, pivotTables/pivotTable, 
mnOutScTab+1),
+XclXmlUtils::GetStreamName( xl/, pivotTables/pivotTable, mnId 
+ 1),
+XclXmlUtils::GetStreamName( ../, pivotTables/pivotTable, mnId 
+ 1),
 rStrm.GetCurrentStream()-getOutputStream(),
 
application/vnd.openxmlformats-officedocument.spreadsheetml.pivotTable+xml,
 
http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotTable;);
@@ -1849,7 +1850,7 @@ void XclExpPivotTableManager::CreatePivotTables()
 for( size_t nDPObj = 0, nCount = pDPColl-GetCount(); nDPObj  nCount; 
++nDPObj )
 if( ScDPObject* pDPObj = (*pDPColl)[ nDPObj ] )
 if( const XclExpPivotCache* pPCache = CreatePivotCache( 
*pDPObj ) )
-maPTableList.AppendNewRecord( new XclExpPivotTable( 
GetRoot(), *pDPObj, *pPCache ) );
+maPTableList.AppendNewRecord( new XclExpPivotTable( 
GetRoot(), *pDPObj, *pPCache, nDPObj ) );
 }
 
 XclExpRecordRef XclExpPivotTableManager::CreatePivotCachesRecord()
diff --git a/sc/source/filter/inc/xepivot.hxx b/sc/source/filter/inc/xepivot.hxx
index efcbbab..6f5a9a4 100644
--- a/sc/source/filter/inc/xepivot.hxx
+++ b/sc/source/filter/inc/xepivot.hxx
@@ -344,7 +344,7 @@ class XclExpPivotTable : public XclExpRecordBase, protected 
XclExpRoot
 {
 public:
 explicitXclExpPivotTable( const XclExpRoot rRoot,
-const ScDPObject rDPObj, const XclExpPivotCache 
rPCache );
+const ScDPObject rDPObj, const XclExpPivotCache 
rPCache, size_t nId );
 
 /** Returns a pivot cache field. */
 const XclExpPCField* GetCacheField( sal_uInt16 nCacheIdx ) const;
@@ -422,6 +422,7 @@ private:
 SCTAB   mnOutScTab; /// Sheet index of the output 
range.
 bool 

[Libreoffice-commits] core.git: 3 commits - oox/source sc/source

2014-02-17 Thread Markus Mohrhard
 oox/source/export/chartexport.cxx   |   63 +---
 sc/source/filter/excel/xestream.cxx |2 -
 2 files changed, 38 insertions(+), 27 deletions(-)

New commits:
commit b57bad8422c0efee8a42660806765f36746bb2fe
Author: Markus Mohrhard markus.mohrh...@collabora.co.uk
Date:   Tue Feb 18 02:23:59 2014 +0100

the string is UTF8 and not Ascii

Change-Id: Ibf9a837ca5689ceae91eff2a081da3b7fe0b9244

diff --git a/sc/source/filter/excel/xestream.cxx 
b/sc/source/filter/excel/xestream.cxx
index 77c6295..30d774f 100644
--- a/sc/source/filter/excel/xestream.cxx
+++ b/sc/source/filter/excel/xestream.cxx
@@ -1016,7 +1016,7 @@ sax_fastparser::FSHelperPtr 
XclExpXmlStream::WriteAttributesInternal( sal_Int32
 rStream-write(   )
 -writeId( nAttribute )
 -write( =\ )
--writeEscaped( pValue )
+-writeEscaped( OUString(pValue, std::strlen(pValue), 
RTL_TEXTENCODING_UTF8) )
 -write( \ );
 }
 
commit 53146f93ad0697a7af8b312bfbe424c1066207a1
Author: Markus Mohrhard markus.mohrh...@collabora.co.uk
Date:   Tue Feb 18 02:22:07 2014 +0100

prevent invalid OOXML files with trendlines, related #i88825#

Change-Id: I503b24233060400cf4bbb40701bec0a3e101512a

diff --git a/oox/source/export/chartexport.cxx 
b/oox/source/export/chartexport.cxx
index b427868..7fea8e3 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -2801,6 +2801,21 @@ void ChartExport::exportTrendlines( Reference 
chart2::XDataSeries  xSeries )
 
 Reference XPropertySet  xProperties( xRegCurve , uno::UNO_QUERY 
);
 
+OUString aService;
+Reference lang::XServiceName  xServiceName( xProperties, 
UNO_QUERY );
+if( !xServiceName.is() )
+continue;
+
+aService = xServiceName-getServiceName();
+
+if(aService != com.sun.star.chart2.LinearRegressionCurve 
+aService != 
com.sun.star.chart2.ExponentialRegressionCurve 
+aService != 
com.sun.star.chart2.LogarithmicRegressionCurve 
+aService != com.sun.star.chart2.PotentialRegressionCurve 

+aService != 
com.sun.star.chart2.PolynomialRegressionCurve 
+aService != 
com.sun.star.chart2.MovingAverageRegressionCurve)
+continue;
+
 pFS-startElement( FSNS( XML_c, XML_trendline ), FSEND );
 
 OUString aName;
@@ -2814,12 +2829,6 @@ void ChartExport::exportTrendlines( Reference 
chart2::XDataSeries  xSeries )
 
 exportShapeProps( xProperties );
 
-OUString aService;
-Reference lang::XServiceName  xServiceName( xProperties, 
UNO_QUERY );
-if( !xServiceName.is() )
-continue;
-aService = xServiceName-getServiceName();
-
 if( aService == com.sun.star.chart2.LinearRegressionCurve )
 {
 pFS-singleElement( FSNS( XML_c, XML_trendlineType ),
@@ -2871,7 +2880,9 @@ void ChartExport::exportTrendlines( Reference 
chart2::XDataSeries  xSeries )
 }
 else
 {
-continue;
+// should never happen
+// This would produce invalid OOXML files so we check earlier 
for the type
+assert(false);
 }
 
 double aExtrapolateForward = 0.0;
commit dd0c9e64835b825771d961b7a8f21f4d6c077fc7
Author: Markus Mohrhard markus.mohrh...@collabora.co.uk
Date:   Mon Feb 17 23:19:49 2014 +0100

fix indentation

Change-Id: I36be2de793d3d32433530bf71632cb73a676bb9a

diff --git a/oox/source/export/chartexport.cxx 
b/oox/source/export/chartexport.cxx
index 337d510..b427868 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -1851,36 +1851,36 @@ void ChartExport::exportCandleStickSeries(
 {
 Reference chart2::data::XDataSequence  xLabelSeq( 
xLabeledSeq-getLabel());
 Reference chart2::data::XDataSequence  xValueSeq( 
xLabeledSeq-getValues());
-{
-FSHelperPtr pFS = GetFS();
-pFS-startElement( FSNS( XML_c, XML_ser ),
+{
+FSHelperPtr pFS = GetFS();
+pFS-startElement( FSNS( XML_c, XML_ser ),
 FSEND );
 
-// TODO: idx and order
-// idx attribute should start from 1 and not from 
0.
-pFS-singleElement( FSNS( XML_c, XML_idx ),
+// TODO: idx and order
+// idx attribute should start from 1 and not from 0.
+pFS-singleElement( FSNS( XML_c, XML_idx ),
 XML_val, I32S(idx+1),