From 474873531dfce207cd28233ac22e6fb952af2e02 Mon Sep 17 00:00:00 2001 From: ElenaSubbotina Date: Tue, 2 Oct 2018 14:47:38 +0300 Subject: [PATCH] OdfFormatReader - fix bug #39192 --- .../DocDocxConverter/FileInformationBlock.h | 10 +++++----- ASCOfficeDocFile/DocDocxConverter/OfficeArtContent.h | 2 +- ASCOfficeOdfFile/src/odf/paragraph_elements.h | 2 +- ASCOfficeOdfFile/src/odf/table.cpp | 9 +++++---- ASCOfficeOdfFile/src/odf/table.h | 4 ++-- ASCOfficeOdfFile/src/odf/table_xlsx.cpp | 2 +- 6 files changed, 15 insertions(+), 14 deletions(-) diff --git a/ASCOfficeDocFile/DocDocxConverter/FileInformationBlock.h b/ASCOfficeDocFile/DocDocxConverter/FileInformationBlock.h index 47586851e4..7a9d432f45 100644 --- a/ASCOfficeDocFile/DocDocxConverter/FileInformationBlock.h +++ b/ASCOfficeDocFile/DocDocxConverter/FileInformationBlock.h @@ -110,7 +110,7 @@ namespace DocFileFormat typedef struct FibWord2 { unsigned int Spare = 0; - unsigned char rgwSpare0[3]; + unsigned short rgwSpare0[3]; unsigned int fcPlcMcr = 0; unsigned int lcbPlcMcr = 0; @@ -1312,10 +1312,10 @@ namespace DocFileFormat flag16 = reader.ReadUInt16(); //10 - m_FibBase.fDot = (flag16 & 0x0001) >> 2; - m_FibBase.fGlsy = (flag16 & 0x0002) >> 1; - m_FibBase.fComplex = (flag16 & 0x0004) >> 2; - m_FibBase.fHasPic = (flag16 & 0x0008) >> 3; + m_FibBase.fDot = ((flag16 & 0x0001) >> 2) != 0; + m_FibBase.fGlsy = ((flag16 & 0x0002) >> 1) != 0; + m_FibBase.fComplex = ((flag16 & 0x0004) >> 2) != 0; + m_FibBase.fHasPic = ((flag16 & 0x0008) >> 3) != 0; m_FibBase.cQuickSaves = (WORD)(((int)flag16 & 0x00F0) >> 4); m_FibBase.fEncrypted = FormatUtils::BitmaskToBool((int)flag16, 0x0100); m_FibBase.fWhichTblStm = FormatUtils::BitmaskToBool((int)flag16, 0x0200); diff --git a/ASCOfficeDocFile/DocDocxConverter/OfficeArtContent.h b/ASCOfficeDocFile/DocDocxConverter/OfficeArtContent.h index a51a8cf6f9..49262c499a 100644 --- a/ASCOfficeDocFile/DocDocxConverter/OfficeArtContent.h +++ b/ASCOfficeDocFile/DocDocxConverter/OfficeArtContent.h @@ -97,7 +97,7 @@ namespace DocFileFormat ShapeContainer* shape = static_cast(groupChild); if (shape) { - shape->m_nIndex = i; + shape->m_nIndex = (int)i; if (shape->m_bBackground) { m_pBackgroud = shape; diff --git a/ASCOfficeOdfFile/src/odf/paragraph_elements.h b/ASCOfficeOdfFile/src/odf/paragraph_elements.h index 28d6a29bb1..f40c60f4b0 100644 --- a/ASCOfficeOdfFile/src/odf/paragraph_elements.h +++ b/ASCOfficeOdfFile/src/odf/paragraph_elements.h @@ -110,7 +110,7 @@ public: virtual void docx_convert(oox::docx_conversion_context & Context); virtual void xlsx_convert(oox::xlsx_conversion_context & Context); - virtual void pptx_convert(oox::pptx_conversion_context & Context) ; + virtual void pptx_convert(oox::pptx_conversion_context & Context); virtual std::wostream & text_to_stream(std::wostream & _Wostream) const; diff --git a/ASCOfficeOdfFile/src/odf/table.cpp b/ASCOfficeOdfFile/src/odf/table.cpp index 42c39b733f..efe60e81ff 100644 --- a/ASCOfficeOdfFile/src/odf/table.cpp +++ b/ASCOfficeOdfFile/src/odf/table.cpp @@ -381,11 +381,12 @@ void table_table_cell::add_child_element( xml::sax * Reader, const std::wstring void table_table_cell::add_text(const std::wstring & Text) { } -bool table_table_cell::empty() +bool table_table_cell::empty(bool bWithStyle) { if (!content_.elements_.empty()) return false; if (attlist_.table_formula_) return false; - if (attlist_.table_style_name_) return false; + + if (bWithStyle && attlist_.table_style_name_) return false; if (attlist_extra_.table_number_columns_spanned_ > 1) return false; if (attlist_extra_.table_number_rows_spanned_ > 1) return false; @@ -454,7 +455,7 @@ bool table_table_row::empty() return false; } -bool table_table_row::empty_content_cells() +bool table_table_row::empty_content_cells(bool bWithCellStyle) { bool res = true; @@ -467,7 +468,7 @@ bool table_table_row::empty_content_cells() res = false; break; } - if (cell && cell->empty() == false) + if (cell && cell->empty(bWithCellStyle) == false) { res = false; break; diff --git a/ASCOfficeOdfFile/src/odf/table.h b/ASCOfficeOdfFile/src/odf/table.h index bb9ea7ebda..1225b73a05 100644 --- a/ASCOfficeOdfFile/src/odf/table.h +++ b/ASCOfficeOdfFile/src/odf/table.h @@ -362,7 +362,7 @@ private: public: bool empty(); - bool empty_content_cells(); + bool empty_content_cells(bool bWithCellStyle = true); table_table_row_attlist attlist_; office_element_ptr_array content_; // table-table-cell or table-covered-table-cell @@ -411,7 +411,7 @@ private: public: bool last_cell_; - bool empty(); + bool empty(bool bWithStyle = true); table_table_cell_attlist attlist_; table_table_cell_attlist_extra attlist_extra_; diff --git a/ASCOfficeOdfFile/src/odf/table_xlsx.cpp b/ASCOfficeOdfFile/src/odf/table_xlsx.cpp index bf0e4dc818..cb6623fc85 100644 --- a/ASCOfficeOdfFile/src/odf/table_xlsx.cpp +++ b/ASCOfficeOdfFile/src/odf/table_xlsx.cpp @@ -84,7 +84,7 @@ void table_table_row::xlsx_convert(oox::xlsx_conversion_context & Context) Context.get_table_context().state()->add_empty_row(attlist_.table_number_rows_repeated_); return; } - if (attlist_.table_number_rows_repeated_ > 0x0f00 && empty_content_cells() || bEndTable)//0xf000 - conv_KDZO3J3xLIbZ5fC0HR0__xlsx.ods + if (attlist_.table_number_rows_repeated_ > 0x0f00 && empty_content_cells(false) || bEndTable)//0xf000 - conv_KDZO3J3xLIbZ5fC0HR0__xlsx.ods { Context.get_table_context().state()->set_end_table(); Context.get_table_context().state()->add_empty_row(attlist_.table_number_rows_repeated_);