summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2017-03-07 22:40:55 +0200
committerAndras Timar <andras.timar@collabora.com>2017-03-26 21:35:29 +0200
commit0dd6c9160f49faf352eff9abf5b64fb57a44ac1c (patch)
treef7b6acff65eb09a953246db58cf9ff211e32478b
parentfb4ab759650e08089c2753a80d8e6ba8266d7970 (diff)
A 'CondFmt' record can have a maximum of three CF records following (eek)
What an odd restriction. Oh well. Don't export the conditional formats for the cell(s) in that case then. See https://msdn.microsoft.com/en-us/library/03AE6098-BDC2-475B-BA2C-B8AEF7882174 Change-Id: I4eeec8d33f9fbc572a02f727f38564d6c43b4f10 (cherry picked from commit 7ceda09f6780c954fedc49764d5457aa2616b39a)
-rw-r--r--sc/source/filter/excel/xecontent.cxx19
-rw-r--r--sc/source/filter/inc/xecontent.hxx3
2 files changed, 16 insertions, 6 deletions
diff --git a/sc/source/filter/excel/xecontent.cxx b/sc/source/filter/excel/xecontent.cxx
index 7771e92203c6..8d8fb874ca70 100644
--- a/sc/source/filter/excel/xecontent.cxx
+++ b/sc/source/filter/excel/xecontent.cxx
@@ -1277,14 +1277,24 @@ XclExpCondfmt::~XclExpCondfmt()
{
}
-bool XclExpCondfmt::IsValid() const
+bool XclExpCondfmt::IsValidForBinary() const
+{
+ // ccf (2 bytes): An unsigned integer that specifies the count of CF records that follow this
+ // record. MUST be greater than or equal to 0x0001, and less than or equal to 0x0003.
+
+ SAL_WARN_IF( maCFList.GetSize() > 3, "sc.filter", "More than 3 conditional filters for cell(s), won't export");
+
+ return !maCFList.IsEmpty() && maCFList.GetSize() <= 3 && !maXclRanges.empty();
+}
+
+bool XclExpCondfmt::IsValidForXml() const
{
return !maCFList.IsEmpty() && !maXclRanges.empty();
}
void XclExpCondfmt::Save( XclExpStream& rStrm )
{
- if( IsValid() )
+ if( IsValidForBinary() )
{
XclExpRecord::Save( rStrm );
maCFList.Save( rStrm );
@@ -1304,7 +1314,7 @@ void XclExpCondfmt::WriteBody( XclExpStream& rStrm )
void XclExpCondfmt::SaveXml( XclExpXmlStream& rStrm )
{
- if( !IsValid() )
+ if( !IsValidForXml() )
return;
sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream();
@@ -1475,8 +1485,7 @@ XclExpCondFormatBuffer::XclExpCondFormatBuffer( const XclExpRoot& rRoot, XclExtL
itr != pCondFmtList->end(); ++itr)
{
XclExpCondfmtList::RecordRefType xCondfmtRec( new XclExpCondfmt( GetRoot(), **itr, xExtLst, nIndex ));
- if( xCondfmtRec->IsValid() )
- maCondfmtList.AppendRecord( xCondfmtRec );
+ maCondfmtList.AppendRecord( xCondfmtRec );
}
}
}
diff --git a/sc/source/filter/inc/xecontent.hxx b/sc/source/filter/inc/xecontent.hxx
index d8e9de5fd0c5..cbf41a377290 100644
--- a/sc/source/filter/inc/xecontent.hxx
+++ b/sc/source/filter/inc/xecontent.hxx
@@ -231,7 +231,8 @@ public:
virtual ~XclExpCondfmt() override;
/** Returns true, if this conditional format contains at least one cell range and CF record. */
- bool IsValid() const;
+ bool IsValidForBinary() const;
+ bool IsValidForXml() const;
/** Writes the CONDFMT record with following CF records, if there is valid data. */
virtual void Save( XclExpStream& rStrm ) override;