sc: eeek, a boost::ptr_vector! take it off! take it off!

Change-Id: I3fffecd295577cc8eaa521e819b3c922f8c3f56e
This commit is contained in:
Michael Stahl
2016-06-09 21:43:00 +02:00
parent 1193443b15
commit 741077bf1c
2 changed files with 10 additions and 9 deletions

View File

@@ -15,7 +15,7 @@
#include <vcl/image.hxx>
#include <vector>
#include <boost/ptr_container/ptr_vector.hpp>
#include <memory>
class SvTreeListEntry;
@@ -38,7 +38,7 @@ struct ScOrcusXMLTreeParam
SC_DLLPUBLIC EntryData(EntryType eType);
};
typedef boost::ptr_vector<EntryData> UserDataStoreType;
typedef std::vector<std::unique_ptr<EntryData>> UserDataStoreType;
Image maImgElementDefault;
Image maImgElementRepeat;
@@ -48,7 +48,7 @@ struct ScOrcusXMLTreeParam
* Store all custom data instances since the tree control doesn't manage
* the life cycle of user datas.
*/
UserDataStoreType maUserDataStore;
UserDataStoreType m_UserDataStore;
static SC_DLLPUBLIC EntryData* getUserData(SvTreeListEntry& rEntry);
static SC_DLLPUBLIC const EntryData* getUserData(const SvTreeListEntry& rEntry);

View File

@@ -15,6 +15,7 @@
#include <svtools/treelistbox.hxx>
#include <svtools/treelistentry.hxx>
#include <ucbhelper/content.hxx>
#include <o3tl/make_unique.hxx>
#include <orcus/spreadsheet/import_interface.hpp>
#include <orcus/xml_structure_tree.hpp>
@@ -36,9 +37,9 @@ namespace {
ScOrcusXMLTreeParam::EntryData& setUserDataToEntry(
SvTreeListEntry& rEntry, ScOrcusXMLTreeParam::UserDataStoreType& rStore, ScOrcusXMLTreeParam::EntryType eType)
{
rStore.push_back(new ScOrcusXMLTreeParam::EntryData(eType));
rEntry.SetUserData(&rStore.back());
return rStore.back();
rStore.push_back(o3tl::make_unique<ScOrcusXMLTreeParam::EntryData>(eType));
rEntry.SetUserData(rStore.back().get());
return *rStore.back();
}
void setEntityNameToUserData(
@@ -73,7 +74,7 @@ void populateTree(
return;
ScOrcusXMLTreeParam::EntryData& rEntryData = setUserDataToEntry(
*pEntry, rParam.maUserDataStore,
*pEntry, rParam.m_UserDataStore,
bRepeat ? ScOrcusXMLTreeParam::ElementRepeat : ScOrcusXMLTreeParam::ElementDefault);
setEntityNameToUserData(rEntryData, rElemName, rWalker);
@@ -103,7 +104,7 @@ void populateTree(
continue;
ScOrcusXMLTreeParam::EntryData& rAttrData =
setUserDataToEntry(*pAttr, rParam.maUserDataStore, ScOrcusXMLTreeParam::Attribute);
setUserDataToEntry(*pAttr, rParam.m_UserDataStore, ScOrcusXMLTreeParam::Attribute);
setEntityNameToUserData(rAttrData, rAttrName, rWalker);
rTreeCtrl.SetExpandedEntryBmp(pAttr, rParam.maImgAttribute);
@@ -180,7 +181,7 @@ ScOrcusXMLContextImpl::~ScOrcusXMLContextImpl() {}
void ScOrcusXMLContextImpl::loadXMLStructure(SvTreeListBox& rTreeCtrl, ScOrcusXMLTreeParam& rParam)
{
rParam.maUserDataStore.clear();
rParam.m_UserDataStore.clear();
std::string aStrm;
loadContentFromURL(maPath, aStrm);