summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2014-08-12 17:26:29 +0200
committerEike Rathke <erack@redhat.com>2014-08-12 17:30:50 +0200
commite04a4d2d2c18134556bb4e001d497ca7d66c6828 (patch)
tree324bc0c47ea50d368ae1c5409a2195b1e50da567 /sc
parentb818256d1c0f467d1064a0ebc1b17d079e74f38a (diff)
really do not write empty externalReferences element, fdo#45286 follow-up
Xti records exist also for internal sheet references in BIFF. It is not enough to check for their presence, at least one EXC_SBTYPE_EXTERN must be present as SUPBOOK. Change-Id: I5553a28412465d83fd965b09908261141c51ea35
Diffstat (limited to 'sc')
-rw-r--r--sc/source/filter/excel/xelink.cxx22
1 files changed, 19 insertions, 3 deletions
diff --git a/sc/source/filter/excel/xelink.cxx b/sc/source/filter/excel/xelink.cxx
index f4c4224cc776..ec074de98c15 100644
--- a/sc/source/filter/excel/xelink.cxx
+++ b/sc/source/filter/excel/xelink.cxx
@@ -433,6 +433,9 @@ public:
/** Writes all externalBook elements with their child elements to OOXML. */
virtual void SaveXml( XclExpXmlStream& rStrm ) SAL_OVERRIDE;
+ /** Whether we need to write externalReferences or not. */
+ bool HasExternalReferences() const;
+
struct XclExpSBIndex
{
sal_uInt16 mnSupbook; /// SUPBOOK index for an Excel sheet.
@@ -2086,6 +2089,16 @@ void XclExpSupbookBuffer::SaveXml( XclExpXmlStream& rStrm )
}
}
+bool XclExpSupbookBuffer::HasExternalReferences() const
+{
+ for (size_t nPos = 0, nSize = maSupbookList.GetSize(); nPos < nSize; ++nPos)
+ {
+ if (maSupbookList.GetRecord( nPos)->GetType() == EXC_SBTYPE_EXTERN)
+ return true;
+ }
+ return false;
+}
+
bool XclExpSupbookBuffer::GetSupbookUrl(
XclExpSupbookRef& rxSupbook, sal_uInt16& rnIndex, const OUString& rUrl ) const
{
@@ -2452,7 +2465,7 @@ void XclExpLinkManagerImpl8::Save( XclExpStream& rStrm )
void XclExpLinkManagerImpl8::SaveXml( XclExpXmlStream& rStrm )
{
- if( !maXtiVec.empty() )
+ if (maSBBuffer.HasExternalReferences())
{
sax_fastparser::FSHelperPtr pWorkbook = rStrm.GetCurrentStream();
pWorkbook->startElement( XML_externalReferences, FSEND);
@@ -2461,13 +2474,16 @@ void XclExpLinkManagerImpl8::SaveXml( XclExpXmlStream& rStrm )
maSBBuffer.SaveXml( rStrm );
pWorkbook->endElement( XML_externalReferences);
+ }
- // TODO: equivalent for EXTERNSHEET in OOXML?
+ // TODO: equivalent for EXTERNSHEET in OOXML?
#if 0
+ if( !maXtiVec.empty() )
+ {
for( XclExpXtiVec::const_iterator aIt = maXtiVec.begin(), aEnd = maXtiVec.end(); aIt != aEnd; ++aIt )
aIt->SaveXml( rStrm );
-#endif
}
+#endif
}
sal_uInt16 XclExpLinkManagerImpl8::InsertXti( const XclExpXti& rXti )