From d6a6f587a852ba5c993c658b6b6432a65207f5b7 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 9 Jun 2016 14:46:17 +0200 Subject: tdf#100257 - Data : XML Source does not work Revert "sc: boost::ptr_vector->std::vector" This reverts commit 280553e30f4ddc932838f98a9efaac03a988a0df. Change-Id: Ia50c9cf7902e2e830c6e7f7a13c8f04341556e6c Reviewed-on: https://gerrit.libreoffice.org/26106 Tested-by: Jenkins Reviewed-by: Noel Grandin --- sc/inc/orcusxml.hxx | 5 +++-- sc/source/filter/orcus/xmlcontext.cxx | 16 ++++++++++++---- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/sc/inc/orcusxml.hxx b/sc/inc/orcusxml.hxx index e16029cf815c..cc41f3b6c3e0 100644 --- a/sc/inc/orcusxml.hxx +++ b/sc/inc/orcusxml.hxx @@ -15,6 +15,7 @@ #include #include +#include class SvTreeListEntry; @@ -37,7 +38,7 @@ struct ScOrcusXMLTreeParam SC_DLLPUBLIC EntryData(EntryType eType); }; - typedef std::vector EntryDataVec; + typedef boost::ptr_vector UserDataStoreType; Image maImgElementDefault; Image maImgElementRepeat; @@ -47,7 +48,7 @@ struct ScOrcusXMLTreeParam * Store all custom data instances since the tree control doesn't manage * the life cycle of user datas. */ - EntryDataVec maUserDataStore; + UserDataStoreType maUserDataStore; static SC_DLLPUBLIC EntryData* getUserData(SvTreeListEntry& rEntry); static SC_DLLPUBLIC const EntryData* getUserData(const SvTreeListEntry& rEntry); diff --git a/sc/source/filter/orcus/xmlcontext.cxx b/sc/source/filter/orcus/xmlcontext.cxx index 083972067468..873e2ef8ce4d 100644 --- a/sc/source/filter/orcus/xmlcontext.cxx +++ b/sc/source/filter/orcus/xmlcontext.cxx @@ -34,13 +34,20 @@ using namespace com::sun::star; namespace { ScOrcusXMLTreeParam::EntryData& setUserDataToEntry( - SvTreeListEntry& rEntry, ScOrcusXMLTreeParam::EntryDataVec& rStore, ScOrcusXMLTreeParam::EntryType eType) + SvTreeListEntry& rEntry, ScOrcusXMLTreeParam::UserDataStoreType& rStore, ScOrcusXMLTreeParam::EntryType eType) { - rStore.push_back(ScOrcusXMLTreeParam::EntryData(eType)); + rStore.push_back(new ScOrcusXMLTreeParam::EntryData(eType)); rEntry.SetUserData(&rStore.back()); return rStore.back(); } +void setEntityNameToUserData( + ScOrcusXMLTreeParam::EntryData& rEntryData, + const orcus::xml_structure_tree::entity_name& entity, const orcus::xml_structure_tree::walker& walker) +{ + rEntryData.mnNamespaceID = walker.get_xmlns_index(entity.ns); +} + OUString toString(const orcus::xml_structure_tree::entity_name& entity, const orcus::xml_structure_tree::walker& walker) { OUStringBuffer aBuf; @@ -68,7 +75,8 @@ void populateTree( ScOrcusXMLTreeParam::EntryData& rEntryData = setUserDataToEntry( *pEntry, rParam.maUserDataStore, bRepeat ? ScOrcusXMLTreeParam::ElementRepeat : ScOrcusXMLTreeParam::ElementDefault); - rEntryData.mnNamespaceID = rWalker.get_xmlns_index(rElemName.ns); + + setEntityNameToUserData(rEntryData, rElemName, rWalker); if (bRepeat) { @@ -96,7 +104,7 @@ void populateTree( ScOrcusXMLTreeParam::EntryData& rAttrData = setUserDataToEntry(*pAttr, rParam.maUserDataStore, ScOrcusXMLTreeParam::Attribute); - rAttrData.mnNamespaceID = rWalker.get_xmlns_index(rAttrName.ns); + setEntityNameToUserData(rAttrData, rAttrName, rWalker); rTreeCtrl.SetExpandedEntryBmp(pAttr, rParam.maImgAttribute); rTreeCtrl.SetCollapsedEntryBmp(pAttr, rParam.maImgAttribute); -- cgit