diff options
author | Eike Rathke <erack@redhat.com> | 2015-11-26 11:30:18 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2015-11-26 11:40:06 +0100 |
commit | 4112ecadd53f7ae48e007dd5024f077aca305062 (patch) | |
tree | 7e0e6d6a3fbea4a3df43679ea2c3946d7b008810 /sc | |
parent | 7caa7ed28356490cd00eb12832509758300da8fd (diff) |
TableRef: write <tableParts> before <extLst>, resolves tdf#96049
Excel expects this order, so let XclExpTables be managed as
XclExpRecordBase in the sheet's XclExpRecordList.
Change-Id: If2cefc255c74688661e861a26218564117b1e3ce
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/filter/excel/excdoc.cxx | 7 | ||||
-rw-r--r-- | sc/source/filter/excel/xedbdata.cxx | 19 | ||||
-rw-r--r-- | sc/source/filter/inc/xedbdata.hxx | 7 |
3 files changed, 18 insertions, 15 deletions
diff --git a/sc/source/filter/excel/excdoc.cxx b/sc/source/filter/excel/excdoc.cxx index f5d539307767..75a767740359 100644 --- a/sc/source/filter/excel/excdoc.cxx +++ b/sc/source/filter/excel/excdoc.cxx @@ -678,6 +678,9 @@ void ExcTable::FillAsTableXml() if (pImgData) aRecList.AppendRecord(std::shared_ptr<XclExpRecordBase>(pImgData)); + // <tableParts> after <drawing> and before <extLst> + aRecList.AppendRecord( GetTablesManager().GetTablesBySheet( mnScTab)); + aRecList.AppendRecord( xExtLst ); } @@ -744,10 +747,6 @@ void ExcTable::WriteXml( XclExpXmlStream& rStrm ) if (pPT) pPT->SaveXml(rStrm); - XclExpTables* pTables = GetTablesManager().GetTablesBySheet(mnScTab); - if (pTables) - pTables->SaveXml(rStrm); - rStrm.GetCurrentStream()->endElement( XML_worksheet ); rStrm.PopStream(); } diff --git a/sc/source/filter/excel/xedbdata.cxx b/sc/source/filter/excel/xedbdata.cxx index 6613c37c13d9..5be286d1090b 100644 --- a/sc/source/filter/excel/xedbdata.cxx +++ b/sc/source/filter/excel/xedbdata.cxx @@ -133,27 +133,32 @@ void XclExpTablesManager::Initialize() TablesMapType::iterator it = maTablesMap.find( nTab); if (it == maTablesMap.end()) { - XclExpTables* pNew; + ::std::shared_ptr< XclExpTables > pNew; switch( GetBiff() ) { case EXC_BIFF5: - pNew = new XclExpTablesImpl5( GetRoot()); + pNew.reset( new XclExpTablesImpl5( GetRoot())); break; case EXC_BIFF8: - pNew = new XclExpTablesImpl8( GetRoot()); + pNew.reset( new XclExpTablesImpl8( GetRoot())); break; default: assert(!"Unknown BIFF type!"); continue; // for } - it = maTablesMap.insert( nTab, pNew).first; + ::std::pair< TablesMapType::iterator, bool > ins( maTablesMap.insert( ::std::make_pair( nTab, pNew))); + if (!ins.second) + { + assert(!"XclExpTablesManager::Initialize - XclExpTables insert failed"); + continue; // for + } + it = ins.first; } - XclExpTables* p = it->second; - p->AppendTable( pDBData, ++nTableId); + it->second->AppendTable( pDBData, ++nTableId); } } -XclExpTables* XclExpTablesManager::GetTablesBySheet( SCTAB nTab ) +::std::shared_ptr< XclExpTables > XclExpTablesManager::GetTablesBySheet( SCTAB nTab ) { TablesMapType::iterator it = maTablesMap.find(nTab); return it == maTablesMap.end() ? nullptr : it->second; diff --git a/sc/source/filter/inc/xedbdata.hxx b/sc/source/filter/inc/xedbdata.hxx index f5dd980116a2..4b31ffeedda8 100644 --- a/sc/source/filter/inc/xedbdata.hxx +++ b/sc/source/filter/inc/xedbdata.hxx @@ -22,7 +22,6 @@ #include "xeroot.hxx" #include "xerecord.hxx" -#include <boost/ptr_container/ptr_map.hpp> class ScDBData; class XclExpTablesManagerImpl; @@ -44,7 +43,7 @@ protected: Entry( const ScDBData* pData, sal_Int32 nTableId ); }; - typedef std::vector<Entry> TablesType; + typedef ::std::vector<Entry> TablesType; TablesType maTables; static void SaveTableXml( XclExpXmlStream& rStrm, const Entry& rEntry ); @@ -59,10 +58,10 @@ public: virtual ~XclExpTablesManager(); void Initialize(); - XclExpTables* GetTablesBySheet( SCTAB nTab ); + ::std::shared_ptr< XclExpTables > GetTablesBySheet( SCTAB nTab ); private: - typedef boost::ptr_map< SCTAB, XclExpTables > TablesMapType; + typedef ::std::map< SCTAB, ::std::shared_ptr< XclExpTables > > TablesMapType; TablesMapType maTablesMap; }; |