summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorBartosz Kosiorek <gang65@poczta.onet.pl>2016-07-26 18:14:30 +0200
committerAndras Timar <andras.timar@collabora.com>2017-02-08 11:56:05 +0100
commitad42a293ffa04d1bc18b96dc011458332f751b18 (patch)
treedd7517bf01282e8376f03fd630757a40963351cc /sc
parent7166648f4d9e03df3edfca4c8adc79e23e3d0953 (diff)
tdf#101135 FILESAVE .xlsx Save XML_outlineLevelRow, XML_outlineLevelCol keys
In .xlsx, the XML_outlineLevelRow and XML_outlineLevelCol keys are required for Microsoft Office365 application to properly displaying Outline values. Change-Id: If4184ddc4fbfaa409732ddb0fb4ca85b4a27b024 (cherry picked from commit ad121df71ad463bed8caf147d27f020b548f0862) Reviewed-on: https://gerrit.libreoffice.org/31644 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins <ci@libreoffice.org> (cherry picked from commit 517eddcbfd8dd5d6da50210a12ba917998897bbf)
Diffstat (limited to 'sc')
-rw-r--r--sc/qa/unit/subsequent_export-test.cxx5
-rw-r--r--sc/source/filter/excel/xetable.cxx27
-rw-r--r--sc/source/filter/inc/xetable.hxx6
-rw-r--r--sc/source/filter/oox/worksheetfragment.cxx5
4 files changed, 39 insertions, 4 deletions
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index 24208115b2a2..11b592a8b3be 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -568,6 +568,11 @@ void ScExportTest::testOutlineExportXLSX()
xmlDocPtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml");
CPPUNIT_ASSERT(pSheet);
+ // Maximum Outline Row is 4 for this document
+ assertXPath(pSheet, "/x:worksheet/x:sheetFormatPr", "outlineLevelRow", "4");
+ // Maximum Outline Column is 4 for this document
+ assertXPath(pSheet, "/x:worksheet/x:sheetFormatPr", "outlineLevelCol", "4");
+
// First XML node, creates two columns (from min=1 to max=2)
assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "hidden", "false");
assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "outlineLevel", "1");
diff --git a/sc/source/filter/excel/xetable.cxx b/sc/source/filter/excel/xetable.cxx
index d5b1b6fe61a3..cd6eda4d4859 100644
--- a/sc/source/filter/excel/xetable.cxx
+++ b/sc/source/filter/excel/xetable.cxx
@@ -1695,7 +1695,8 @@ void XclExpColinfo::SaveXml( XclExpXmlStream& rStrm )
XclExpColinfoBuffer::XclExpColinfoBuffer( const XclExpRoot& rRoot ) :
XclExpRoot( rRoot ),
maDefcolwidth( rRoot ),
- maOutlineBfr( rRoot )
+ maOutlineBfr( rRoot ),
+ maHighestOutlineLevel( 0 )
{
}
@@ -1703,7 +1704,13 @@ void XclExpColinfoBuffer::Initialize( SCROW nLastScRow )
{
for( sal_uInt16 nScCol = 0, nLastScCol = GetMaxPos().Col(); nScCol <= nLastScCol; ++nScCol )
+ {
maColInfos.AppendNewRecord( new XclExpColinfo( GetRoot(), nScCol, nLastScRow, maOutlineBfr ) );
+ if( maOutlineBfr.GetLevel() > maHighestOutlineLevel )
+ {
+ maHighestOutlineLevel = maOutlineBfr.GetLevel();
+ }
+ }
}
void XclExpColinfoBuffer::Finalize( ScfUInt16Vec& rXFIndexes )
@@ -2120,7 +2127,8 @@ void XclExpRow::SaveXml( XclExpXmlStream& rStrm )
XclExpRowBuffer::XclExpRowBuffer( const XclExpRoot& rRoot ) :
XclExpRoot( rRoot ),
maOutlineBfr( rRoot ),
- maDimensions( rRoot )
+ maDimensions( rRoot ),
+ maHighestOutlineLevel( 0 )
{
}
@@ -2366,6 +2374,10 @@ XclExpRow& XclExpRowBuffer::GetOrCreateRow( sal_uInt32 nXclRow, bool bRowAlwaysE
( maOutlineBfr.GetLevel() != 0 ) ||
( rDoc.RowHidden(nFrom, nScTab) ) )
{
+ if( maOutlineBfr.GetLevel() > maHighestOutlineLevel )
+ {
+ maHighestOutlineLevel = maOutlineBfr.GetLevel();
+ }
RowRef p(new XclExpRow(GetRoot(), nFrom, maOutlineBfr, bRowAlwaysEmpty));
maRowMap.insert(RowMap::value_type(nFrom, p));
}
@@ -2651,7 +2663,16 @@ void XclExpCellTable::SaveXml( XclExpXmlStream& rStrm )
XclExpDefaultRowData& rDefData = mxDefrowheight->GetDefaultData();
sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream();
rWorksheet->startElement( XML_sheetFormatPr,
- XML_defaultRowHeight, OString::number( (double) rDefData.mnHeight / 20.0 ).getStr(), FSEND );
+ // OOXTODO: XML_baseColWidth
+ // OOXTODO: XML_defaultColWidth
+ // OOXTODO: XML_customHeight
+ // OOXTODO: XML_zeroHeight
+ // OOXTODO: XML_thickTop
+ // OOXTODO: XML_thickBottom
+ XML_defaultRowHeight, OString::number( static_cast< double> ( rDefData.mnHeight ) / 20.0 ).getStr(),
+ XML_outlineLevelRow, OString::number( maRowBfr.GetHighestOutlineLevel() ).getStr(),
+ XML_outlineLevelCol, OString::number( maColInfoBfr.GetHighestOutlineLevel() ).getStr(),
+ FSEND );
rWorksheet->endElement( XML_sheetFormatPr );
maColInfoBfr.SaveXml( rStrm );
diff --git a/sc/source/filter/inc/xetable.hxx b/sc/source/filter/inc/xetable.hxx
index 6224c82b1ebf..d1aad379ae99 100644
--- a/sc/source/filter/inc/xetable.hxx
+++ b/sc/source/filter/inc/xetable.hxx
@@ -774,6 +774,7 @@ public:
/** Writes all COLINFO records of this buffer. */
virtual void Save( XclExpStream& rStrm ) override;
virtual void SaveXml( XclExpXmlStream& rStrm ) override;
+ sal_uInt8 GetHighestOutlineLevel() { return maHighestOutlineLevel; }
private:
typedef XclExpRecordList< XclExpColinfo > XclExpColinfoList;
@@ -782,6 +783,7 @@ private:
XclExpColinfoList maColInfos; /// List of COLINFO records.
XclExpDefcolwidth maDefcolwidth; /// The DEFCOLWIDTH record.
XclExpColOutlineBuffer maOutlineBfr; /// Buffer for column outline groups.
+ sal_uInt8 maHighestOutlineLevel; /// Highest number of outline levels for columns in sheet.
};
class XclExpRow;
@@ -932,7 +934,8 @@ public:
virtual void Save( XclExpStream& rStrm ) override;
virtual void SaveXml( XclExpXmlStream& rStrm ) override;
- XclExpDimensions& GetDimensions() { return maDimensions;}
+ XclExpDimensions& GetDimensions() { return maDimensions; }
+ sal_uInt8 GetHighestOutlineLevel() { return maHighestOutlineLevel; }
private:
/** Returns access to the specified ROW record. Inserts preceding missing ROW records.
@@ -947,6 +950,7 @@ private:
RowMap maRowMap;
XclExpRowOutlineBuffer maOutlineBfr; /// Buffer for row outline groups.
XclExpDimensions maDimensions; /// DIMENSIONS record for used area.
+ sal_uInt8 maHighestOutlineLevel; /// Highest number of outline levels for rows in sheet.
};
// Cell Table
diff --git a/sc/source/filter/oox/worksheetfragment.cxx b/sc/source/filter/oox/worksheetfragment.cxx
index 660d3ad16571..5bf13b961089 100644
--- a/sc/source/filter/oox/worksheetfragment.cxx
+++ b/sc/source/filter/oox/worksheetfragment.cxx
@@ -664,6 +664,11 @@ void WorksheetFragment::importSheetFormatPr( const AttributeList& rAttribs )
setBaseColumnWidth( rAttribs.getInteger( XML_baseColWidth, 8 ) );
setDefaultColumnWidth( rAttribs.getDouble( XML_defaultColWidth, 0.0 ) );
// default row settings
+
+ // We don't need to import:
+ // XML_outlineLevelRow
+ // XML_outlineLevelCol
+ // as it will be updated during export to OOXML
setDefaultRowSettings(
rAttribs.getDouble( XML_defaultRowHeight, 0.0 ),
rAttribs.getBool( XML_customHeight, false ),