Kaydet (Commit) 343ec4b7 authored tarafından Noel Grandin's avatar Noel Grandin

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

Change-Id: I21fdb9f503241c2fa38f3de059a1f674a6631c78
üst 280553e3
...@@ -42,20 +42,21 @@ ...@@ -42,20 +42,21 @@
#include "calcmacros.hxx" #include "calcmacros.hxx"
#include <vector> #include <vector>
#include <boost/ptr_container/ptr_vector.hpp> #include <memory>
#define PIVOT_DATA_FIELD (MAXCOLCOUNT)
#include <com/sun/star/uno/Sequence.hxx> #include <com/sun/star/uno/Sequence.hxx>
#include <com/sun/star/sheet/DataPilotFieldReference.hpp> #include <com/sun/star/sheet/DataPilotFieldReference.hpp>
#include <com/sun/star/sheet/DataPilotFieldSortInfo.hpp> #include <com/sun/star/sheet/DataPilotFieldSortInfo.hpp>
#include <com/sun/star/sheet/DataPilotFieldLayoutInfo.hpp> #include <com/sun/star/sheet/DataPilotFieldLayoutInfo.hpp>
#include <com/sun/star/sheet/DataPilotFieldAutoShowInfo.hpp> #include <com/sun/star/sheet/DataPilotFieldAutoShowInfo.hpp>
#define PIVOT_DATA_FIELD (MAXCOLCOUNT)
struct SC_DLLPUBLIC ScDPName struct SC_DLLPUBLIC ScDPName
{ {
OUString maName; ///< Original name of the dimension. OUString maName; ///< Original name of the dimension.
OUString maLayoutName; ///< Layout name (display name) OUString maLayoutName; ///< Layout name (display name)
sal_uInt8 mnDupCount; sal_uInt8 mnDupCount;
ScDPName(); ScDPName();
explicit ScDPName(const OUString& rName, const OUString& rLayoutName, sal_uInt8 nDupCount); explicit ScDPName(const OUString& rName, const OUString& rLayoutName, sal_uInt8 nDupCount);
...@@ -108,7 +109,7 @@ struct ScDPLabelData ...@@ -108,7 +109,7 @@ struct ScDPLabelData
OUString SC_DLLPUBLIC getDisplayName() const; OUString SC_DLLPUBLIC getDisplayName() const;
}; };
typedef boost::ptr_vector<ScDPLabelData> ScDPLabelDataVector; typedef std::vector< std::unique_ptr<ScDPLabelData> > ScDPLabelDataVector;
struct ScPivotField struct ScPivotField
{ {
......
...@@ -2385,9 +2385,9 @@ bool ScDPObject::FillLabelData(ScPivotParam& rParam) ...@@ -2385,9 +2385,9 @@ bool ScDPObject::FillLabelData(ScPivotParam& rParam)
for (sal_Int32 nDim = 0; nDim < nDimCount; ++nDim) for (sal_Int32 nDim = 0; nDim < nDimCount; ++nDim)
{ {
std::unique_ptr<ScDPLabelData> pNewLabel(new ScDPLabelData); ScDPLabelData* pNewLabel = new ScDPLabelData;
FillLabelDataForDimension(xDims, nDim, *pNewLabel); FillLabelDataForDimension(xDims, nDim, *pNewLabel);
o3tl::ptr_container::push_back(rParam.maLabelArray, std::move(pNewLabel)); rParam.maLabelArray.push_back(std::unique_ptr<ScDPLabelData>(pNewLabel));
} }
return true; return true;
...@@ -2625,7 +2625,7 @@ void ScDPObject::ConvertOrientation( ...@@ -2625,7 +2625,7 @@ void ScDPObject::ConvertOrientation(
pDim->RemoveSubtotalName(); pDim->RemoveSubtotalName();
if (nDimIndex < rLabels.size()) if (nDimIndex < rLabels.size())
{ {
const ScDPLabelData& rLabel = rLabels[nDimIndex]; const ScDPLabelData& rLabel = *rLabels[nDimIndex].get();
if (!rLabel.maLayoutName.isEmpty()) if (!rLabel.maLayoutName.isEmpty())
pDim->SetLayoutName(rLabel.maLayoutName); pDim->SetLayoutName(rLabel.maLayoutName);
if (!rLabel.maSubtotalName.isEmpty()) if (!rLabel.maSubtotalName.isEmpty())
......
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#include "refupdat.hxx" #include "refupdat.hxx"
#include "stlpool.hxx" #include "stlpool.hxx"
#include "stlsheet.hxx" #include "stlsheet.hxx"
#include <o3tl/make_unique.hxx>
#if DEBUG_PIVOT_TABLE #if DEBUG_PIVOT_TABLE
using std::cout; using std::cout;
...@@ -166,7 +167,7 @@ void ScPivotParam::SetLabelData(const ScDPLabelDataVector& rVector) ...@@ -166,7 +167,7 @@ void ScPivotParam::SetLabelData(const ScDPLabelDataVector& rVector)
ScDPLabelDataVector::const_iterator it; ScDPLabelDataVector::const_iterator it;
for (it = rVector.begin(); it != rVector.end(); ++it) for (it = rVector.begin(); it != rVector.end(); ++it)
{ {
aNewArray.push_back(new ScDPLabelData(*it)); aNewArray.push_back(o3tl::make_unique<ScDPLabelData>(*it->get()));
} }
maLabelArray.swap(aNewArray); maLabelArray.swap(aNewArray);
} }
......
...@@ -560,7 +560,7 @@ void ScPivotLayoutDialog::ApplyLabelData(ScDPSaveData& rSaveData) ...@@ -560,7 +560,7 @@ void ScPivotLayoutDialog::ApplyLabelData(ScDPSaveData& rSaveData)
for (it = rLabelDataVector.begin(); it != rLabelDataVector.end(); ++it) for (it = rLabelDataVector.begin(); it != rLabelDataVector.end(); ++it)
{ {
const ScDPLabelData& pLabelData = *it; const ScDPLabelData& pLabelData = *it->get();
OUString aUnoName = ScDPUtil::createDuplicateDimensionName(pLabelData.maName, pLabelData.mnDupCount); OUString aUnoName = ScDPUtil::createDuplicateDimensionName(pLabelData.maName, pLabelData.mnDupCount);
ScDPSaveDimension* pSaveDimensions = rSaveData.GetExistingDimensionByName(aUnoName); ScDPSaveDimension* pSaveDimensions = rSaveData.GetExistingDimensionByName(aUnoName);
...@@ -629,7 +629,7 @@ bool ScPivotLayoutDialog::IsDataElement(SCCOL nColumn) ...@@ -629,7 +629,7 @@ bool ScPivotLayoutDialog::IsDataElement(SCCOL nColumn)
ScDPLabelData& ScPivotLayoutDialog::GetLabelData(SCCOL nColumn) ScDPLabelData& ScPivotLayoutDialog::GetLabelData(SCCOL nColumn)
{ {
return maPivotParameters.maLabelArray[nColumn]; return *maPivotParameters.maLabelArray[nColumn].get();
} }
void ScPivotLayoutDialog::PushDataFieldNames(std::vector<ScDPName>& rDataFieldNames) void ScPivotLayoutDialog::PushDataFieldNames(std::vector<ScDPName>& rDataFieldNames)
......
...@@ -40,7 +40,7 @@ void ScPivotLayoutTreeListLabel::FillLabelFields(ScDPLabelDataVector& rLabelVect ...@@ -40,7 +40,7 @@ void ScPivotLayoutTreeListLabel::FillLabelFields(ScDPLabelDataVector& rLabelVect
ScDPLabelDataVector::iterator it; ScDPLabelDataVector::iterator it;
for (it = rLabelVector.begin(); it != rLabelVector.end(); ++it) for (it = rLabelVector.begin(); it != rLabelVector.end(); ++it)
{ {
const ScDPLabelData& rLabelData = *it; const ScDPLabelData& rLabelData = *it->get();
ScItemValue* pValue = new ScItemValue(rLabelData.maName, rLabelData.mnCol, rLabelData.mnFuncMask); ScItemValue* pValue = new ScItemValue(rLabelData.maName, rLabelData.mnCol, rLabelData.mnFuncMask);
maItemValues.push_back(std::unique_ptr<ScItemValue>(pValue)); maItemValues.push_back(std::unique_ptr<ScItemValue>(pValue));
......
...@@ -282,11 +282,11 @@ void ScDPFunctionDlg::Init( const ScDPLabelData& rLabelData, const ScPivotFuncDa ...@@ -282,11 +282,11 @@ void ScDPFunctionDlg::Init( const ScDPLabelData& rLabelData, const ScPivotFuncDa
OUString aSelectedEntry; OUString aSelectedEntry;
for( ScDPLabelDataVector::const_iterator aIt = mrLabelVec.begin(), aEnd = mrLabelVec.end(); aIt != aEnd; ++aIt ) for( ScDPLabelDataVector::const_iterator aIt = mrLabelVec.begin(), aEnd = mrLabelVec.end(); aIt != aEnd; ++aIt )
{ {
mpLbBaseField->InsertEntry(aIt->getDisplayName()); mpLbBaseField->InsertEntry((*aIt)->getDisplayName());
maBaseFieldNameMap.insert( maBaseFieldNameMap.insert(
NameMapType::value_type(aIt->getDisplayName(), aIt->maName)); NameMapType::value_type((*aIt)->getDisplayName(), (*aIt)->maName));
if (aIt->maName == rFuncData.maFieldRef.ReferenceField) if ((*aIt)->maName == rFuncData.maFieldRef.ReferenceField)
aSelectedEntry = aIt->getDisplayName(); aSelectedEntry = (*aIt)->getDisplayName();
} }
// base item list box // base item list box
...@@ -402,7 +402,7 @@ IMPL_LINK_TYPED( ScDPFunctionDlg, SelectHdl, ListBox&, rLBox, void ) ...@@ -402,7 +402,7 @@ IMPL_LINK_TYPED( ScDPFunctionDlg, SelectHdl, ListBox&, rLBox, void )
size_t nBasePos = mpLbBaseField->GetSelectEntryPos(); size_t nBasePos = mpLbBaseField->GetSelectEntryPos();
if( nBasePos < mrLabelVec.size() ) if( nBasePos < mrLabelVec.size() )
{ {
const vector<ScDPLabelData::Member>& rMembers = mrLabelVec[nBasePos].maMembers; const vector<ScDPLabelData::Member>& rMembers = mrLabelVec[nBasePos]->maMembers;
mbEmptyItem = lclFillListBox(*mpLbBaseItem, rMembers, SC_BASEITEM_USER_POS); mbEmptyItem = lclFillListBox(*mpLbBaseItem, rMembers, SC_BASEITEM_USER_POS);
// build cache for base names. // build cache for base names.
NameMapType aMap; NameMapType aMap;
......
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