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

Bartosz Kosiorek gang65 at poczta.onet.pl
Mon Dec 5 17:43:19 UTC 2016


 sc/qa/unit/subsequent_export-test.cxx      |    5 +++++
 sc/source/filter/excel/xetable.cxx         |   27 ++++++++++++++++++++++++---
 sc/source/filter/inc/xetable.hxx           |    6 +++++-
 sc/source/filter/oox/worksheetfragment.cxx |    5 +++++
 4 files changed, 39 insertions(+), 4 deletions(-)

New commits:
commit 517eddcbfd8dd5d6da50210a12ba917998897bbf
Author: Bartosz Kosiorek <gang65 at poczta.onet.pl>
Date:   Tue Jul 26 18:14:30 2016 +0200

    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 at redhat.com>
    Tested-by: Eike Rathke <erack at redhat.com>
    Tested-by: Jenkins <ci at libreoffice.org>

diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index eb4f61d..75ac9d3 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -584,6 +584,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 fc15a63..287024a 100644
--- a/sc/source/filter/excel/xetable.cxx
+++ b/sc/source/filter/excel/xetable.cxx
@@ -1697,7 +1697,8 @@ void XclExpColinfo::SaveXml( XclExpXmlStream& rStrm )
 XclExpColinfoBuffer::XclExpColinfoBuffer( const XclExpRoot& rRoot ) :
     XclExpRoot( rRoot ),
     maDefcolwidth( rRoot ),
-    maOutlineBfr( rRoot )
+    maOutlineBfr( rRoot ),
+    maHighestOutlineLevel( 0 )
 {
 }
 
@@ -1705,7 +1706,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 )
@@ -2122,7 +2129,8 @@ void XclExpRow::SaveXml( XclExpXmlStream& rStrm )
 XclExpRowBuffer::XclExpRowBuffer( const XclExpRoot& rRoot ) :
     XclExpRoot( rRoot ),
     maOutlineBfr( rRoot ),
-    maDimensions( rRoot )
+    maDimensions( rRoot ),
+    maHighestOutlineLevel( 0 )
 {
 }
 
@@ -2368,6 +2376,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));
             }
@@ -2652,7 +2664,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 3109b37..8a26e3d 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 7984ae6..ad9837a 100644
--- a/sc/source/filter/oox/worksheetfragment.cxx
+++ b/sc/source/filter/oox/worksheetfragment.cxx
@@ -518,6 +518,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 ),


More information about the Libreoffice-commits mailing list