From 79aa50d7123dfd8d0482247d58bcfe131ca598c9 Mon Sep 17 00:00:00 2001 From: Sergey Konovalov Date: Mon, 25 Mar 2019 19:56:24 +0300 Subject: [PATCH] [x2t] Add OutlineLevelCol, OutlineLevelRow to Editor.bin --- .../Common/BinReaderWriterDefines.h | 10 ++++--- XlsxSerializerCom/Reader/BinaryWriter.cpp | 26 +++++++++++++++++++ XlsxSerializerCom/Writer/BinaryReader.cpp | 20 ++++++++++++++ 3 files changed, 53 insertions(+), 3 deletions(-) diff --git a/XlsxSerializerCom/Common/BinReaderWriterDefines.h b/XlsxSerializerCom/Common/BinReaderWriterDefines.h index 7d1c943430..4936ba27eb 100755 --- a/XlsxSerializerCom/Common/BinReaderWriterDefines.h +++ b/XlsxSerializerCom/Common/BinReaderWriterDefines.h @@ -301,7 +301,8 @@ namespace BinXlsxRW Style = 4, Width = 5, CustomWidth = 6, - OutLevel = 7 + OutLevel = 7, + Collapsed = 8 };} namespace c_oSerHyperlinkTypes{enum c_oSerWorksheetColTypes { @@ -317,7 +318,9 @@ namespace BinXlsxRW DefaultRowHeight = 1, BaseColWidth = 2, CustomHeight = 3, - ZeroHeight = 4 + ZeroHeight = 4, + OutlineLevelCol = 5, + OutlineLevelRow = 6 };} namespace c_oSerRowTypes{enum c_oSerRowTypes { @@ -328,7 +331,8 @@ namespace BinXlsxRW Cells = 4, Cell = 5, CustomHeight = 6, - OutLevel = 7 + OutLevel = 7, + Collapsed = 8 };} namespace c_oSerCellTypes{enum c_oSerCellTypes { diff --git a/XlsxSerializerCom/Reader/BinaryWriter.cpp b/XlsxSerializerCom/Reader/BinaryWriter.cpp index fe80cedb57..f7cd69fb0f 100644 --- a/XlsxSerializerCom/Reader/BinaryWriter.cpp +++ b/XlsxSerializerCom/Reader/BinaryWriter.cpp @@ -2478,6 +2478,12 @@ void BinaryWorksheetTableWriter::WriteCol(const OOX::Spreadsheet::CCol& oCol) m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long); m_oBcw.m_oStream.WriteLONG(oCol.m_oOutlineLevel->GetValue()); } + if(oCol.m_oCollapsed.IsInit()) + { + m_oBcw.m_oStream.WriteBYTE(c_oSerWorksheetColTypes::Collapsed); + m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte); + m_oBcw.m_oStream.WriteBOOL(oCol.m_oCollapsed->ToBool()); + } } void BinaryWorksheetTableWriter::WriteSheetViews(const OOX::Spreadsheet::CSheetViews& oSheetViews) @@ -2726,6 +2732,20 @@ void BinaryWorksheetTableWriter::WriteSheetFormatPr(const OOX::Spreadsheet::CShe m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte); m_oBcw.m_oStream.WriteBYTE(oSheetFormatPr.m_oZeroHeight->ToBool()); } + //OutlineLevelCol + if(oSheetFormatPr.m_oOutlineLevelCol.IsInit()) + { + m_oBcw.m_oStream.WriteBYTE(c_oSerSheetFormatPrTypes::OutlineLevelCol); + m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long); + m_oBcw.m_oStream.WriteLONG(oSheetFormatPr.m_oOutlineLevelCol->GetValue()); + } + //OutlineLevelRow + if(oSheetFormatPr.m_oOutlineLevelRow.IsInit()) + { + m_oBcw.m_oStream.WriteBYTE(c_oSerSheetFormatPrTypes::OutlineLevelRow); + m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long); + m_oBcw.m_oStream.WriteLONG(oSheetFormatPr.m_oOutlineLevelRow->GetValue()); + } } void BinaryWorksheetTableWriter::WritePageMargins(const OOX::Spreadsheet::CPageMargins& oPageMargins) { @@ -2939,6 +2959,12 @@ void BinaryWorksheetTableWriter::WriteRow(const OOX::Spreadsheet::CRow& oRows) m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long); m_oBcw.m_oStream.WriteLONG(oRows.m_oOutlineLevel->GetValue()); } + if(oRows.m_oCollapsed.IsInit()) + { + m_oBcw.m_oStream.WriteBYTE(c_oSerRowTypes::Collapsed); + m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte); + m_oBcw.m_oStream.WriteBOOL(oRows.m_oCollapsed->ToBool()); + } if(oRows.m_arrItems.size() > 0) { m_oBcw.m_oStream.WriteBYTE(c_oSerRowTypes::Cells); diff --git a/XlsxSerializerCom/Writer/BinaryReader.cpp b/XlsxSerializerCom/Writer/BinaryReader.cpp index c4d6d584d4..0fee46ad4e 100644 --- a/XlsxSerializerCom/Writer/BinaryReader.cpp +++ b/XlsxSerializerCom/Writer/BinaryReader.cpp @@ -3033,6 +3033,11 @@ int BinaryWorksheetsTableReader::ReadWorksheetCol(BYTE type, long length, void* pCol->m_oOutlineLevel.Init(); pCol->m_oOutlineLevel->SetValue( m_oBufferedStream.GetLong()); } + else if(c_oSerWorksheetColTypes::Collapsed == type) + { + pCol->m_oCollapsed.Init(); + pCol->m_oCollapsed->FromBool(m_oBufferedStream.GetBool()); + } else res = c_oSerConstants::ReadUnknown; return res; @@ -3318,6 +3323,16 @@ int BinaryWorksheetsTableReader::ReadSheetFormatPr(BYTE type, long length, void* pSheetFormatPr->m_oZeroHeight.Init(); pSheetFormatPr->m_oZeroHeight->FromBool(m_oBufferedStream.GetBool()); } + else if (c_oSerSheetFormatPrTypes::OutlineLevelCol == type) + { + pSheetFormatPr->m_oOutlineLevelCol.Init(); + pSheetFormatPr->m_oOutlineLevelCol->SetValue(m_oBufferedStream.GetLong()); + } + else if (c_oSerSheetFormatPrTypes::OutlineLevelRow == type) + { + pSheetFormatPr->m_oOutlineLevelRow.Init(); + pSheetFormatPr->m_oOutlineLevelRow->SetValue(m_oBufferedStream.GetLong()); + } else res = c_oSerConstants::ReadUnknown; return res; @@ -4064,6 +4079,11 @@ int BinaryWorksheetsTableReader::ReadRow(BYTE type, long length, void* poResult) pRow->m_oOutlineLevel.Init(); pRow->m_oOutlineLevel->SetValue(m_oBufferedStream.GetLong()); } + else if(c_oSerRowTypes::Collapsed == type) + { + pRow->m_oCollapsed.Init(); + pRow->m_oCollapsed->FromBool(m_oBufferedStream.GetBool()); + } else if(c_oSerRowTypes::Cells == type) { if (NULL == m_oSaveParams.pCSVWriter)