From 5176d58940ff7238ad71172fd4752803222e9a14 Mon Sep 17 00:00:00 2001 From: "Elena.Subbotina" Date: Wed, 31 Aug 2022 20:47:31 +0300 Subject: [PATCH] fix bug #58815 --- .../Logic/SummaryInformationStream/CodePageOle.cpp | 4 ++++ .../Logic/SummaryInformationStream/CodePageOle.h | 1 + .../Logic/SummaryInformationStream/Property.h | 2 ++ .../SummaryInformationStream/PropertySetStream.cpp | 12 ++++++------ 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/SummaryInformationStream/CodePageOle.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/SummaryInformationStream/CodePageOle.cpp index 2bb73740c5..e05af2419f 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/SummaryInformationStream/CodePageOle.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/SummaryInformationStream/CodePageOle.cpp @@ -85,6 +85,10 @@ std::wstring PropertyString::toString() { return value; } +bool PropertyString::IsEmpty() +{ + return value.empty(); +} //------------------------------------------------------------------- bool PropertyWString::Read(XLS::CFStreamPtr stream) { diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/SummaryInformationStream/CodePageOle.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/SummaryInformationStream/CodePageOle.h index cb11baa370..c221a8462d 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/SummaryInformationStream/CodePageOle.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/SummaryInformationStream/CodePageOle.h @@ -63,6 +63,7 @@ public: virtual bool Read(XLS::CFStreamPtr stream); virtual std::wstring toString(); + bool IsEmpty(); std::wstring value; unsigned short code_page; diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/SummaryInformationStream/Property.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/SummaryInformationStream/Property.h index 1cde76d3f4..bc7a0805b4 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/SummaryInformationStream/Property.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/SummaryInformationStream/Property.h @@ -98,6 +98,8 @@ namespace OLEPS virtual bool Read(XLS::CFStreamPtr stream) = 0; virtual std::wstring toString() = 0; + virtual bool IsEmpty() { return false; } + unsigned int prop_type; unsigned short value_type; diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/SummaryInformationStream/PropertySetStream.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/SummaryInformationStream/PropertySetStream.cpp index 891be9701b..1a4f420242 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/SummaryInformationStream/PropertySetStream.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/SummaryInformationStream/PropertySetStream.cpp @@ -120,7 +120,7 @@ namespace OLEPS CP_XML_ATTR(L"xmlns:vt", L"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"); prop = GetProperty(TEMPLATE); - if (prop) + if ((prop) && (false == prop->IsEmpty())) { CP_XML_NODE(L"Template") { @@ -128,7 +128,7 @@ namespace OLEPS } } prop = GetProperty(MANAGER); - if (prop) + if ((prop) && (false == prop->IsEmpty())) { CP_XML_NODE(L"Manager") { @@ -136,7 +136,7 @@ namespace OLEPS } } prop = GetProperty(COMPANY); - if (prop) + if ((prop) && (false == prop->IsEmpty())) { CP_XML_NODE(L"Company") { @@ -176,7 +176,7 @@ namespace OLEPS } } prop = GetProperty(PRESFORMAT); - if (prop) + if ((prop) && (false == prop->IsEmpty())) { CP_XML_NODE(L"PresentationFormat") { @@ -304,7 +304,7 @@ namespace OLEPS sApplication = NSSystemUtils::gc_EnvApplicationNameDefault; prop = GetProperty(APPNAME); - if (prop) + if ((prop) && (false == prop->IsEmpty())) { CP_XML_STREAM() << (prop->toString() + L"/" + sApplication); } @@ -318,7 +318,7 @@ namespace OLEPS } } prop = GetProperty(DOCVERSION); - if (prop) + if ((prop) && (false == prop->IsEmpty())) { CP_XML_NODE(L"AppVersion") {