Kaydet (Commit) 4112ecad authored tarafından Eike Rathke's avatar Eike Rathke

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
üst 7caa7ed2
......@@ -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();
}
......
......@@ -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;
......
......@@ -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;
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment