summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2017-03-07 22:40:55 +0200
committerTor Lillqvist <tml@collabora.com>2017-03-08 14:31:15 +0200
commita0ce73f4ebfa4fae1f229b417d9595f1124f34ba (patch)
tree9ecfd4b4465e5b35ece37a1a39e5c9e257db61da /sc
parentd94a8044445d57f05f7e927f9046f479d676f4ea (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
Diffstat (limited to 'sc')
-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 1f5418d4552c..e691de7e7d3c 100644
--- a/sc/source/filter/excel/xecontent.cxx
+++ b/sc/source/filter/excel/xecontent.cxx
@@ -1246,14 +1246,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 );
@@ -1273,7 +1283,7 @@ void XclExpCondfmt::WriteBody( XclExpStream& rStrm )
void XclExpCondfmt::SaveXml( XclExpXmlStream& rStrm )
{
- if( !IsValid() )
+ if( !IsValidForXml() )
return;
sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream();
@@ -1444,8 +1454,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 ba1ff9500e77..f283787a4a87 100644
--- a/sc/source/filter/inc/xecontent.hxx
+++ b/sc/source/filter/inc/xecontent.hxx
@@ -232,7 +232,8 @@ public:
virtual ~XclExpCondfmt();
/** 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;