[Libreoffice-commits] core.git: sc/source

Eike Rathke erack at redhat.com
Tue Aug 12 08:31:15 PDT 2014


 sc/source/filter/excel/xelink.cxx |   22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)

New commits:
commit e04a4d2d2c18134556bb4e001d497ca7d66c6828
Author: Eike Rathke <erack at redhat.com>
Date:   Tue Aug 12 17:26:29 2014 +0200

    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

diff --git a/sc/source/filter/excel/xelink.cxx b/sc/source/filter/excel/xelink.cxx
index f4c4224..ec074de 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 )


More information about the Libreoffice-commits mailing list