[Libreoffice-commits] core.git: 4 commits - sc/source
Tor Lillqvist
tml at collabora.com
Tue Mar 7 22:46:01 UTC 2017
sc/source/filter/excel/xecontent.cxx | 19 ++++++++++++++-----
sc/source/filter/excel/xeescher.cxx | 8 +++++++-
sc/source/filter/inc/xecontent.hxx | 3 ++-
sc/source/filter/inc/xestream.hxx | 4 ++--
sc/source/filter/xcl97/xcl97rec.cxx | 21 ++++++++++++++++++++-
5 files changed, 45 insertions(+), 10 deletions(-)
New commits:
commit 7ceda09f6780c954fedc49764d5457aa2616b39a
Author: Tor Lillqvist <tml at collabora.com>
Date: Tue Mar 7 22:40:55 2017 +0200
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
diff --git a/sc/source/filter/excel/xecontent.cxx b/sc/source/filter/excel/xecontent.cxx
index 126e139..ce70978 100644
--- a/sc/source/filter/excel/xecontent.cxx
+++ b/sc/source/filter/excel/xecontent.cxx
@@ -1278,14 +1278,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 );
@@ -1305,7 +1315,7 @@ void XclExpCondfmt::WriteBody( XclExpStream& rStrm )
void XclExpCondfmt::SaveXml( XclExpXmlStream& rStrm )
{
- if( !IsValid() )
+ if( !IsValidForXml() )
return;
sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream();
@@ -1476,8 +1486,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 1b8d002..78eec28 100644
--- a/sc/source/filter/inc/xecontent.hxx
+++ b/sc/source/filter/inc/xecontent.hxx
@@ -230,7 +230,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;
commit 27e34a7dbb9aa2ce52ca529ec835d54c6a5508fc
Author: Tor Lillqvist <tml at collabora.com>
Date: Tue Mar 7 21:53:34 2017 +0200
Make sure that the 'stAuthor' field of a 'NoteSh' structure filfills the spec
Its length must be greater than or equal to 1 and less than or equal
to 54, so if the author is empty, use a single space, and otherwise
truncate to max 54 characters.
See https://msdn.microsoft.com/en-us/library/dd945371
Change-Id: I7604ae9e1d8eea336b42116ea7d305e183e6ca51
diff --git a/sc/source/filter/excel/xeescher.cxx b/sc/source/filter/excel/xeescher.cxx
index 3447acb..6571adc 100644
--- a/sc/source/filter/excel/xeescher.cxx
+++ b/sc/source/filter/excel/xeescher.cxx
@@ -1210,7 +1210,13 @@ XclExpNote::XclExpNote(const XclExpRoot& rRoot, const ScAddress& rScPos,
mbRowHidden = (rRoot.GetDoc().RowHidden(maScPos.Row(),maScPos.Tab()));
mbColHidden = (rRoot.GetDoc().ColHidden(maScPos.Col(),maScPos.Tab()));
}
- maAuthor = XclExpString( pScNote->GetAuthor() );
+ // stAuthor (variable): An XLUnicodeString that specifies the name of the comment
+ // author. String length MUST be greater than or equal to 1 and less than or equal
+ // to 54.
+ if( pScNote->GetAuthor().isEmpty() )
+ maAuthor = XclExpString( " " );
+ else
+ maAuthor = XclExpString( pScNote->GetAuthor(), EXC_STR_DEFAULT, 54 );
}
SetRecSize( 9 + maAuthor.GetSize() );
commit 20a7d4b16d600101f4073ad4ce669a7566bf14c1
Author: Tor Lillqvist <tml at collabora.com>
Date: Tue Mar 7 20:38:34 2017 +0200
Write the 'FtNts' subrecord of 'Obj' when necessary
See https://msdn.microsoft.com/en-us/library/dd952807 :
nts (26 bytes): An optional FtNts structure that specifies the
properties of this comment object. This field MUST exist if and only
if cmo.ot is equal to 0x19.
Change-Id: Ib4a007940c29a4f8eac1087601cfc7d242cfebd3
diff --git a/sc/source/filter/xcl97/xcl97rec.cxx b/sc/source/filter/xcl97/xcl97rec.cxx
index 1a7f1f9..0af2465 100644
--- a/sc/source/filter/xcl97/xcl97rec.cxx
+++ b/sc/source/filter/xcl97/xcl97rec.cxx
@@ -33,6 +33,7 @@
#include <tools/urlobj.hxx>
#include <rtl/math.hxx>
+#include <rtl/uuid.h>
#include <svl/zformat.hxx>
#include "formulacell.hxx"
#include "drwlayer.hxx"
@@ -458,8 +459,26 @@ void XclObj::Save( XclExpStream& rStrm )
SaveTextRecs( rStrm );
}
-void XclObj::WriteSubRecs( XclExpStream& /*rStrm*/ )
+void XclObj::WriteSubRecs( XclExpStream& rStrm )
{
+ if( mnObjType == EXC_OBJTYPE_NOTE )
+ {
+ // FtNts subrecord
+ AddRecSize( 26 );
+ // ft, cb
+ rStrm << EXC_ID_OBJNTS << sal_uInt16(0x0016);
+ sal_uInt8 aGUID[16];
+ rtl_createUuid( aGUID, nullptr, false );
+ // guid
+ rStrm.SetSliceSize( 16 );
+ for( int i = 0; i < 16; i++ )
+ rStrm << aGUID[i];
+ rStrm.SetSliceSize( 0 );
+ // fSharedNote
+ rStrm << sal_uInt16(0);
+ // unused
+ rStrm.WriteZeroBytes( 4 );
+ }
}
void XclObj::SaveTextRecs( XclExpStream& rStrm )
commit 93a53e0ebba62873c768d887c6aa1125967aa9e4
Author: Tor Lillqvist <tml at collabora.com>
Date: Tue Mar 7 18:20:55 2017 +0200
It's SetSliceSize, not SetSliceLen
Change-Id: Ife4449f5afa7321c18e8eb963878d9c037f6d623
diff --git a/sc/source/filter/inc/xestream.hxx b/sc/source/filter/inc/xestream.hxx
index 8c8808a..0778398 100644
--- a/sc/source/filter/inc/xestream.hxx
+++ b/sc/source/filter/inc/xestream.hxx
@@ -61,9 +61,9 @@ typedef std::shared_ptr< XclExpBiff8Encrypter > XclExpEncrypterRef;
If some data exceeds the record size limit, a CONTINUE record is started automatically
and the new data will be written to this record.
- If specific data pieces must not be splitted, use SetSliceLen(). For instance:
+ If specific data pieces must not be splitted, use SetSliceSize(). For instance:
To write a sequence of 16-bit values, where 4 values form a unit and cannot be
- split, call SetSliceLen( 8 ) first (4*2 bytes == 8).
+ split, call SetSliceSize( 8 ) first (4*2 bytes == 8).
To write unicode character arrays, call WriteUnicodeBuffer(). It creates CONTINUE
records and repeats the unicode string flag byte automatically. This function is used
More information about the Libreoffice-commits
mailing list