Kaydet (Commit) 33bf2449 authored tarafından Noel Grandin's avatar Noel Grandin

sc: boost::ptr_vector->std::vector<std::unique_ptr>

Change-Id: Ib53a084c16eaf0c7a44573ec8f4fabd782684b7c
üst 6618e503
...@@ -269,14 +269,14 @@ public: ...@@ -269,14 +269,14 @@ public:
class ExtCfCondFormat class ExtCfCondFormat
{ {
public: public:
ExtCfCondFormat(const ScRangeList& aRange, boost::ptr_vector<ScFormatEntry>& rEntries); ExtCfCondFormat(const ScRangeList& aRange, std::vector< std::unique_ptr<ScFormatEntry> >& rEntries);
~ExtCfCondFormat(); ~ExtCfCondFormat();
const ScRangeList& getRange(); const ScRangeList& getRange();
const boost::ptr_vector<ScFormatEntry>& getEntries(); const std::vector< std::unique_ptr<ScFormatEntry> >& getEntries();
private: private:
boost::ptr_vector<ScFormatEntry> maEntries; std::vector< std::unique_ptr<ScFormatEntry> > maEntries;
ScRangeList maRange; ScRangeList maRange;
}; };
......
...@@ -14,7 +14,8 @@ ...@@ -14,7 +14,8 @@
#include "worksheetfragment.hxx" #include "worksheetfragment.hxx"
#include "workbookfragment.hxx" #include "workbookfragment.hxx"
#include <boost/ptr_container/ptr_vector.hpp> #include <vector>
#include <memory>
struct ScDataBarFormatData; struct ScDataBarFormatData;
class ScFormatEntry; class ScFormatEntry;
...@@ -50,7 +51,7 @@ public: ...@@ -50,7 +51,7 @@ public:
private: private:
OUString aChars; OUString aChars;
boost::ptr_vector<ScFormatEntry> maEntries; std::vector<std::unique_ptr<ScFormatEntry> > maEntries;
IconSetRule* mpCurrentRule; IconSetRule* mpCurrentRule;
}; };
......
...@@ -1159,10 +1159,10 @@ void CondFormatBuffer::finalizeImport() ...@@ -1159,10 +1159,10 @@ void CondFormatBuffer::finalizeImport()
pDoc->AddCondFormatData(rRange, nTab, nKey); pDoc->AddCondFormatData(rRange, nTab, nKey);
} }
const boost::ptr_vector<ScFormatEntry>& rEntries = itr->getEntries(); const std::vector< std::unique_ptr<ScFormatEntry> >& rEntries = itr->getEntries();
for (auto i = rEntries.begin(); i != rEntries.end(); ++i) for (auto i = rEntries.begin(); i != rEntries.end(); ++i)
{ {
pFormat->AddEntry(i->Clone(pDoc)); pFormat->AddEntry((*i)->Clone(pDoc));
} }
} }
} }
...@@ -1328,10 +1328,10 @@ void ExtCfDataBarRule::importCfvo( const AttributeList& rAttribs ) ...@@ -1328,10 +1328,10 @@ void ExtCfDataBarRule::importCfvo( const AttributeList& rAttribs )
maModel.maColorScaleType = rAttribs.getString( XML_type, OUString() ); maModel.maColorScaleType = rAttribs.getString( XML_type, OUString() );
} }
ExtCfCondFormat::ExtCfCondFormat(const ScRangeList& rRange, boost::ptr_vector<ScFormatEntry>& rEntries): ExtCfCondFormat::ExtCfCondFormat(const ScRangeList& rRange, std::vector< std::unique_ptr<ScFormatEntry> >& rEntries):
maRange(rRange) maRange(rRange)
{ {
maEntries.transfer(maEntries.begin(), rEntries.begin(), rEntries.end(), rEntries); maEntries.swap(rEntries);
} }
ExtCfCondFormat::~ExtCfCondFormat() ExtCfCondFormat::~ExtCfCondFormat()
...@@ -1343,7 +1343,7 @@ const ScRangeList& ExtCfCondFormat::getRange() ...@@ -1343,7 +1343,7 @@ const ScRangeList& ExtCfCondFormat::getRange()
return maRange; return maRange;
} }
const boost::ptr_vector<ScFormatEntry>& ExtCfCondFormat::getEntries() const std::vector< std::unique_ptr<ScFormatEntry> >& ExtCfCondFormat::getEntries()
{ {
return maEntries; return maEntries;
} }
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include "document.hxx" #include "document.hxx"
#include "rangeutl.hxx" #include "rangeutl.hxx"
#include <o3tl/make_unique.hxx>
using ::oox::core::ContextHandlerRef; using ::oox::core::ContextHandlerRef;
...@@ -79,7 +80,7 @@ ContextHandlerRef ExtConditionalFormattingContext::onCreateContext(sal_Int32 nEl ...@@ -79,7 +80,7 @@ ContextHandlerRef ExtConditionalFormattingContext::onCreateContext(sal_Int32 nEl
{ {
if (mpCurrentRule) if (mpCurrentRule)
{ {
ScFormatEntry& rFormat = *maEntries.rbegin(); ScFormatEntry& rFormat = *maEntries.rbegin()->get();
assert(rFormat.GetType() == condformat::ICONSET); assert(rFormat.GetType() == condformat::ICONSET);
ScIconSetFormat& rIconSet = static_cast<ScIconSetFormat&>(rFormat); ScIconSetFormat& rIconSet = static_cast<ScIconSetFormat&>(rFormat);
ScDocument* pDoc = &getScDocument(); ScDocument* pDoc = &getScDocument();
...@@ -111,8 +112,7 @@ ContextHandlerRef ExtConditionalFormattingContext::onCreateContext(sal_Int32 nEl ...@@ -111,8 +112,7 @@ ContextHandlerRef ExtConditionalFormattingContext::onCreateContext(sal_Int32 nEl
{ {
ScDocument* pDoc = &getScDocument(); ScDocument* pDoc = &getScDocument();
mpCurrentRule = new IconSetRule(*this); mpCurrentRule = new IconSetRule(*this);
ScIconSetFormat* pIconSet = new ScIconSetFormat(pDoc); maEntries.push_back(o3tl::make_unique<ScIconSetFormat>(pDoc));
maEntries.push_back(pIconSet);
return new IconSetContext(*this, mpCurrentRule); return new IconSetContext(*this, mpCurrentRule);
} }
else else
......
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