[Libreoffice-commits] core.git: 21 commits - sc/inc sc/source
Noel Grandin
noel at peralex.com
Fri Nov 13 00:54:47 PST 2015
sc/inc/dpcache.hxx | 24 ++----
sc/inc/dpobject.hxx | 3
sc/inc/orcusxml.hxx | 5 -
sc/inc/pivot.hxx | 9 +-
sc/inc/userlist.hxx | 10 +-
sc/source/core/data/dpcache.cxx | 95 ++++++++++++------------
sc/source/core/data/dpdimsave.cxx | 12 +--
sc/source/core/data/dpobject.cxx | 76 +++++++++----------
sc/source/core/data/dpsave.cxx | 1
sc/source/core/data/pivot2.cxx | 3
sc/source/core/tool/appoptio.cxx | 4 -
sc/source/core/tool/userlist.cxx | 21 +----
sc/source/filter/dif/difimp.cxx | 39 ++++-----
sc/source/filter/excel/excimp8.cxx | 3
sc/source/filter/excel/exctools.cxx | 34 +++-----
sc/source/filter/excel/impop.cxx | 4 -
sc/source/filter/excel/xepivotxml.cxx | 8 +-
sc/source/filter/excel/xilink.cxx | 45 +++++------
sc/source/filter/excel/xistyle.cxx | 18 ++--
sc/source/filter/ftools/fprogressbar.cxx | 5 -
sc/source/filter/html/htmlexp2.cxx | 5 -
sc/source/filter/html/htmlpars.cxx | 11 +-
sc/source/filter/inc/condformatbuffer.hxx | 13 +--
sc/source/filter/inc/dif.hxx | 6 -
sc/source/filter/inc/eeparser.hxx | 16 ++--
sc/source/filter/inc/excscen.hxx | 17 ++--
sc/source/filter/inc/extlstcontext.hxx | 5 -
sc/source/filter/inc/fprogressbar.hxx | 5 -
sc/source/filter/inc/htmlexp.hxx | 4 -
sc/source/filter/inc/imp_op.hxx | 4 -
sc/source/filter/inc/lotattr.hxx | 7 +
sc/source/filter/inc/xistyle.hxx | 7 +
sc/source/filter/lotus/lotattr.cxx | 24 +++---
sc/source/filter/oox/condformatbuffer.cxx | 14 +--
sc/source/filter/oox/extlstcontext.cxx | 10 +-
sc/source/filter/orcus/xmlcontext.cxx | 16 +---
sc/source/filter/rtf/eeimpars.cxx | 4 -
sc/source/ui/dbgui/PivotLayoutDialog.cxx | 4 -
sc/source/ui/dbgui/PivotLayoutTreeListLabel.cxx | 2
sc/source/ui/dbgui/pvfundlg.cxx | 10 +-
sc/source/ui/optdlg/tpusrlst.cxx | 2
sc/source/ui/unoobj/appluno.cxx | 4 -
42 files changed, 295 insertions(+), 314 deletions(-)
New commits:
commit f54a384f5ac16e969e8ecbf2821b89e0173c7403
Author: Noel Grandin <noel at peralex.com>
Date: Fri Nov 13 10:40:44 2015 +0200
Revert "sc: boost::ptr_vector->std::vector"
This reverts commit 9822ddf366459d31148a4ccbf0a49da4f726b3db.
something is storing a pointer to maXFIndex in XclImpXFRange
Change-Id: I2de7a311da2586351e2356b108f723c80f268245
diff --git a/sc/source/filter/excel/exctools.cxx b/sc/source/filter/excel/exctools.cxx
index ed14c51..6d98540 100644
--- a/sc/source/filter/excel/exctools.cxx
+++ b/sc/source/filter/excel/exctools.cxx
@@ -199,8 +199,6 @@ ExcScenario::ExcScenario( XclImpStream& rIn, const RootData& rR )
if( nComment )
aComment = rIn.ReadUniString();
- else
- aComment;
sal_uInt16 n = nCref;
sal_uInt16 nC, nR;
diff --git a/sc/source/filter/excel/xistyle.cxx b/sc/source/filter/excel/xistyle.cxx
index 603d294..4ff74b5 100644
--- a/sc/source/filter/excel/xistyle.cxx
+++ b/sc/source/filter/excel/xistyle.cxx
@@ -1683,6 +1683,8 @@ ScStyleSheet* XclImpXFBuffer::CreateStyleSheet( sal_uInt16 nXFIndex )
// Buffer for XF indexes in cells =============================================
+IMPL_FIXEDMEMPOOL_NEWDEL( XclImpXFRange )
+
bool XclImpXFRange::Expand( SCROW nScRow, const XclImpXFIndex& rXFIndex )
{
if( maXFIndex != rXFIndex )
@@ -1720,7 +1722,7 @@ void XclImpXFRangeColumn::SetDefaultXF( const XclImpXFIndex& rXFIndex )
OSL_ENSURE( maIndexList.empty(), "XclImpXFRangeColumn::SetDefaultXF - Setting Default Column XF is not empty" );
// insert a complete row range with one insert.
- maIndexList.push_back( XclImpXFRange( 0, MAXROW, rXFIndex ) );
+ maIndexList.push_back( new XclImpXFRange( 0, MAXROW, rXFIndex ) );
}
void XclImpXFRangeColumn::SetXF( SCROW nScRow, const XclImpXFIndex& rXFIndex )
@@ -1757,20 +1759,20 @@ void XclImpXFRangeColumn::SetXF( SCROW nScRow, const XclImpXFIndex& rXFIndex )
++(pThisRange->mnScRow1);
// try to concatenate with previous of this
if( !pPrevRange || !pPrevRange->Expand( nScRow, rXFIndex ) )
- Insert( XclImpXFRange( nScRow, rXFIndex ), nIndex );
+ Insert( new XclImpXFRange( nScRow, rXFIndex ), nIndex );
}
else if( nLastScRow == nScRow ) // replace last XF
{
--(pThisRange->mnScRow2);
if( !pNextRange || !pNextRange->Expand( nScRow, rXFIndex ) )
- Insert( XclImpXFRange( nScRow, rXFIndex ), nNextIndex );
+ Insert( new XclImpXFRange( nScRow, rXFIndex ), nNextIndex );
}
else // insert in the middle of the range
{
pThisRange->mnScRow1 = nScRow + 1;
// List::Insert() moves entries towards end of list, so insert twice at nIndex
- Insert( XclImpXFRange( nScRow, rXFIndex ), nIndex );
- Insert( XclImpXFRange( nFirstScRow, nScRow - 1, pThisRange->maXFIndex ), nIndex );
+ Insert( new XclImpXFRange( nScRow, rXFIndex ), nIndex );
+ Insert( new XclImpXFRange( nFirstScRow, nScRow - 1, pThisRange->maXFIndex ), nIndex );
}
return;
}
@@ -1786,12 +1788,12 @@ void XclImpXFRangeColumn::SetXF( SCROW nScRow, const XclImpXFIndex& rXFIndex )
return;
// create new range
- Insert( XclImpXFRange( nScRow, rXFIndex ), nNextIndex );
+ Insert( new XclImpXFRange( nScRow, rXFIndex ), nNextIndex );
}
-void XclImpXFRangeColumn::Insert(const XclImpXFRange& rXFRange, sal_uLong nIndex)
+void XclImpXFRangeColumn::Insert(XclImpXFRange* pXFRange, sal_uLong nIndex)
{
- maIndexList.insert( maIndexList.begin() + nIndex, rXFRange );
+ maIndexList.insert( maIndexList.begin() + nIndex, pXFRange );
}
void XclImpXFRangeColumn::Find(
diff --git a/sc/source/filter/inc/xistyle.hxx b/sc/source/filter/inc/xistyle.hxx
index 183d472..1fd2978 100644
--- a/sc/source/filter/inc/xistyle.hxx
+++ b/sc/source/filter/inc/xistyle.hxx
@@ -25,6 +25,7 @@
#include <vector>
#include <tools/mempool.hxx>
#include <boost/noncopyable.hpp>
+#include <boost/ptr_container/ptr_vector.hpp>
#include "rangelst.hxx"
#include "patattr.hxx"
#include "xladdress.hxx"
@@ -519,6 +520,8 @@ private:
/** Contains an (encoded) XF index for a range of rows in a single column. */
class XclImpXFRange
{
+ DECL_FIXEDMEMPOOL_NEWDEL( XclImpXFRange )
+
public:
SCROW mnScRow1; /// The first row of an equal-formatted range.
SCROW mnScRow2; /// The last row of an equal-formatted range.
@@ -559,7 +562,7 @@ inline bool XclImpXFRange::Contains( SCROW nScRow ) const
class XclImpXFRangeColumn : private boost::noncopyable
{
public:
- typedef std::vector<XclImpXFRange> IndexList;
+ typedef ::boost::ptr_vector<XclImpXFRange> IndexList;
inline explicit XclImpXFRangeColumn() {}
@@ -587,7 +590,7 @@ private:
void TryConcatPrev( sal_uLong nIndex );
/** Insert a range into the list at the specified index. */
- void Insert(const XclImpXFRange& rXFRange, sal_uLong nIndex);
+ void Insert(XclImpXFRange* pXFRange, sal_uLong nIndex);
private:
IndexList maIndexList; /// The list of XF index range.
commit 343ec4b7234f4eb9709f09d453131100d3283ddc
Author: Noel Grandin <noel at peralex.com>
Date: Fri Nov 13 10:30:16 2015 +0200
sc: boost::ptr_vector->std::vector<std::unique_ptr>
Change-Id: I21fdb9f503241c2fa38f3de059a1f674a6631c78
diff --git a/sc/inc/pivot.hxx b/sc/inc/pivot.hxx
index 35e6e60..073fab2 100644
--- a/sc/inc/pivot.hxx
+++ b/sc/inc/pivot.hxx
@@ -42,20 +42,21 @@
#include "calcmacros.hxx"
#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/sheet/DataPilotFieldReference.hpp>
#include <com/sun/star/sheet/DataPilotFieldSortInfo.hpp>
#include <com/sun/star/sheet/DataPilotFieldLayoutInfo.hpp>
#include <com/sun/star/sheet/DataPilotFieldAutoShowInfo.hpp>
+#define PIVOT_DATA_FIELD (MAXCOLCOUNT)
+
struct SC_DLLPUBLIC ScDPName
{
OUString maName; ///< Original name of the dimension.
OUString maLayoutName; ///< Layout name (display name)
- sal_uInt8 mnDupCount;
+ sal_uInt8 mnDupCount;
ScDPName();
explicit ScDPName(const OUString& rName, const OUString& rLayoutName, sal_uInt8 nDupCount);
@@ -108,7 +109,7 @@ struct ScDPLabelData
OUString SC_DLLPUBLIC getDisplayName() const;
};
-typedef boost::ptr_vector<ScDPLabelData> ScDPLabelDataVector;
+typedef std::vector< std::unique_ptr<ScDPLabelData> > ScDPLabelDataVector;
struct ScPivotField
{
diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx
index c1fcdfc..ed1c7d4 100644
--- a/sc/source/core/data/dpobject.cxx
+++ b/sc/source/core/data/dpobject.cxx
@@ -2385,9 +2385,9 @@ bool ScDPObject::FillLabelData(ScPivotParam& rParam)
for (sal_Int32 nDim = 0; nDim < nDimCount; ++nDim)
{
- std::unique_ptr<ScDPLabelData> pNewLabel(new ScDPLabelData);
+ ScDPLabelData* pNewLabel = new ScDPLabelData;
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;
@@ -2625,7 +2625,7 @@ void ScDPObject::ConvertOrientation(
pDim->RemoveSubtotalName();
if (nDimIndex < rLabels.size())
{
- const ScDPLabelData& rLabel = rLabels[nDimIndex];
+ const ScDPLabelData& rLabel = *rLabels[nDimIndex].get();
if (!rLabel.maLayoutName.isEmpty())
pDim->SetLayoutName(rLabel.maLayoutName);
if (!rLabel.maSubtotalName.isEmpty())
diff --git a/sc/source/core/data/pivot2.cxx b/sc/source/core/data/pivot2.cxx
index d0ae6cc..6b578da 100644
--- a/sc/source/core/data/pivot2.cxx
+++ b/sc/source/core/data/pivot2.cxx
@@ -37,6 +37,7 @@
#include "refupdat.hxx"
#include "stlpool.hxx"
#include "stlsheet.hxx"
+#include <o3tl/make_unique.hxx>
#if DEBUG_PIVOT_TABLE
using std::cout;
@@ -166,7 +167,7 @@ void ScPivotParam::SetLabelData(const ScDPLabelDataVector& rVector)
ScDPLabelDataVector::const_iterator 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);
}
diff --git a/sc/source/ui/dbgui/PivotLayoutDialog.cxx b/sc/source/ui/dbgui/PivotLayoutDialog.cxx
index 8ae684b..531eb49 100644
--- a/sc/source/ui/dbgui/PivotLayoutDialog.cxx
+++ b/sc/source/ui/dbgui/PivotLayoutDialog.cxx
@@ -560,7 +560,7 @@ void ScPivotLayoutDialog::ApplyLabelData(ScDPSaveData& rSaveData)
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);
ScDPSaveDimension* pSaveDimensions = rSaveData.GetExistingDimensionByName(aUnoName);
@@ -629,7 +629,7 @@ bool ScPivotLayoutDialog::IsDataElement(SCCOL nColumn)
ScDPLabelData& ScPivotLayoutDialog::GetLabelData(SCCOL nColumn)
{
- return maPivotParameters.maLabelArray[nColumn];
+ return *maPivotParameters.maLabelArray[nColumn].get();
}
void ScPivotLayoutDialog::PushDataFieldNames(std::vector<ScDPName>& rDataFieldNames)
diff --git a/sc/source/ui/dbgui/PivotLayoutTreeListLabel.cxx b/sc/source/ui/dbgui/PivotLayoutTreeListLabel.cxx
index d4f98ab..3795601 100644
--- a/sc/source/ui/dbgui/PivotLayoutTreeListLabel.cxx
+++ b/sc/source/ui/dbgui/PivotLayoutTreeListLabel.cxx
@@ -40,7 +40,7 @@ void ScPivotLayoutTreeListLabel::FillLabelFields(ScDPLabelDataVector& rLabelVect
ScDPLabelDataVector::iterator 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);
maItemValues.push_back(std::unique_ptr<ScItemValue>(pValue));
diff --git a/sc/source/ui/dbgui/pvfundlg.cxx b/sc/source/ui/dbgui/pvfundlg.cxx
index 0bcca91..c601694 100644
--- a/sc/source/ui/dbgui/pvfundlg.cxx
+++ b/sc/source/ui/dbgui/pvfundlg.cxx
@@ -282,11 +282,11 @@ void ScDPFunctionDlg::Init( const ScDPLabelData& rLabelData, const ScPivotFuncDa
OUString aSelectedEntry;
for( ScDPLabelDataVector::const_iterator aIt = mrLabelVec.begin(), aEnd = mrLabelVec.end(); aIt != aEnd; ++aIt )
{
- mpLbBaseField->InsertEntry(aIt->getDisplayName());
+ mpLbBaseField->InsertEntry((*aIt)->getDisplayName());
maBaseFieldNameMap.insert(
- NameMapType::value_type(aIt->getDisplayName(), aIt->maName));
- if (aIt->maName == rFuncData.maFieldRef.ReferenceField)
- aSelectedEntry = aIt->getDisplayName();
+ NameMapType::value_type((*aIt)->getDisplayName(), (*aIt)->maName));
+ if ((*aIt)->maName == rFuncData.maFieldRef.ReferenceField)
+ aSelectedEntry = (*aIt)->getDisplayName();
}
// base item list box
@@ -402,7 +402,7 @@ IMPL_LINK_TYPED( ScDPFunctionDlg, SelectHdl, ListBox&, rLBox, void )
size_t nBasePos = mpLbBaseField->GetSelectEntryPos();
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);
// build cache for base names.
NameMapType aMap;
commit 280553e30f4ddc932838f98a9efaac03a988a0df
Author: Noel Grandin <noel at peralex.com>
Date: Fri Nov 13 10:14:35 2015 +0200
sc: boost::ptr_vector->std::vector
Change-Id: Ia78f3596888df89b13578bd383df2615bcb854a7
diff --git a/sc/inc/orcusxml.hxx b/sc/inc/orcusxml.hxx
index cc41f3b..e16029c 100644
--- a/sc/inc/orcusxml.hxx
+++ b/sc/inc/orcusxml.hxx
@@ -15,7 +15,6 @@
#include <vcl/image.hxx>
#include <vector>
-#include <boost/ptr_container/ptr_vector.hpp>
class SvTreeListEntry;
@@ -38,7 +37,7 @@ struct ScOrcusXMLTreeParam
SC_DLLPUBLIC EntryData(EntryType eType);
};
- typedef boost::ptr_vector<EntryData> UserDataStoreType;
+ typedef std::vector<EntryData> EntryDataVec;
Image maImgElementDefault;
Image maImgElementRepeat;
@@ -48,7 +47,7 @@ struct ScOrcusXMLTreeParam
* Store all custom data instances since the tree control doesn't manage
* the life cycle of user datas.
*/
- UserDataStoreType maUserDataStore;
+ EntryDataVec 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 d0412b2..618b0ce 100644
--- a/sc/source/filter/orcus/xmlcontext.cxx
+++ b/sc/source/filter/orcus/xmlcontext.cxx
@@ -34,20 +34,13 @@ using namespace com::sun::star;
namespace {
ScOrcusXMLTreeParam::EntryData& setUserDataToEntry(
- SvTreeListEntry& rEntry, ScOrcusXMLTreeParam::UserDataStoreType& rStore, ScOrcusXMLTreeParam::EntryType eType)
+ SvTreeListEntry& rEntry, ScOrcusXMLTreeParam::EntryDataVec& rStore, ScOrcusXMLTreeParam::EntryType eType)
{
- rStore.push_back(new ScOrcusXMLTreeParam::EntryData(eType));
+ rStore.push_back(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;
@@ -75,8 +68,7 @@ void populateTree(
ScOrcusXMLTreeParam::EntryData& rEntryData = setUserDataToEntry(
*pEntry, rParam.maUserDataStore,
bRepeat ? ScOrcusXMLTreeParam::ElementRepeat : ScOrcusXMLTreeParam::ElementDefault);
-
- setEntityNameToUserData(rEntryData, rElemName, rWalker);
+ rEntryData.mnNamespaceID = rWalker.get_xmlns_index(rElemName.ns);
if (bRepeat)
{
@@ -104,7 +96,7 @@ void populateTree(
ScOrcusXMLTreeParam::EntryData& rAttrData =
setUserDataToEntry(*pAttr, rParam.maUserDataStore, ScOrcusXMLTreeParam::Attribute);
- setEntityNameToUserData(rAttrData, rAttrName, rWalker);
+ rAttrData.mnNamespaceID = rWalker.get_xmlns_index(rAttrName.ns);
rTreeCtrl.SetExpandedEntryBmp(pAttr, rParam.maImgAttribute);
rTreeCtrl.SetCollapsedEntryBmp(pAttr, rParam.maImgAttribute);
commit 601fd58cc3a4ce3a13bc0dad1cc16f0a841aa765
Author: Noel Grandin <noel at peralex.com>
Date: Fri Nov 13 10:06:28 2015 +0200
sc: boost::ptr_vector->std::vector<std::unique_ptr>
Change-Id: Ie152e03e6219495683ebc50d916406fff0e54b6d
diff --git a/sc/inc/dpobject.hxx b/sc/inc/dpobject.hxx
index 9cb6135..c31031b 100644
--- a/sc/inc/dpobject.hxx
+++ b/sc/inc/dpobject.hxx
@@ -34,7 +34,6 @@
#include <set>
#include <vector>
-#include <boost/ptr_container/ptr_vector.hpp>
#include <boost/ptr_container/ptr_map.hpp>
namespace com { namespace sun { namespace star {
@@ -421,7 +420,7 @@ private:
std::set<ScDPObject*>& rRefs) const;
private:
- typedef ::boost::ptr_vector<ScDPObject> TablesType;
+ typedef std::vector< std::unique_ptr<ScDPObject> > TablesType;
ScDocument* mpDoc;
TablesType maTables;
diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx
index 9dc7918..c1fcdfc 100644
--- a/sc/source/core/data/dpobject.cxx
+++ b/sc/source/core/data/dpobject.cxx
@@ -585,19 +585,19 @@ public:
}
};
-class FindIntersectingTable : std::unary_function<ScDPObject, bool>
+class FindIntersectingTable : std::unary_function<std::unique_ptr<ScDPObject>, bool>
{
ScRange maRange;
public:
explicit FindIntersectingTable(const ScRange& rRange) : maRange(rRange) {}
- bool operator() (const ScDPObject& rObj) const
+ bool operator() (const std::unique_ptr<ScDPObject>& rObj) const
{
- return maRange.Intersects(rObj.GetOutRange());
+ return maRange.Intersects(rObj->GetOutRange());
}
};
-class FindIntersetingTableByColumns : std::unary_function<ScDPObject, bool>
+class FindIntersetingTableByColumns : std::unary_function<std::unique_ptr<ScDPObject>, bool>
{
SCCOL mnCol1;
SCCOL mnCol2;
@@ -607,9 +607,9 @@ public:
FindIntersetingTableByColumns(SCCOL nCol1, SCCOL nCol2, SCROW nRow, SCTAB nTab) :
mnCol1(nCol1), mnCol2(nCol2), mnRow(nRow), mnTab(nTab) {}
- bool operator() (const ScDPObject& rObj) const
+ bool operator() (const std::unique_ptr<ScDPObject>& rObj) const
{
- const ScRange& rRange = rObj.GetOutRange();
+ const ScRange& rRange = rObj->GetOutRange();
if (mnTab != rRange.aStart.Tab())
// Not on this sheet.
return false;
@@ -631,7 +631,7 @@ public:
}
};
-class FindIntersectingTableByRows : std::unary_function<ScDPObject, bool>
+class FindIntersectingTableByRows : std::unary_function<std::unique_ptr<ScDPObject>, bool>
{
SCCOL mnCol;
SCROW mnRow1;
@@ -641,9 +641,9 @@ public:
FindIntersectingTableByRows(SCCOL nCol, SCROW nRow1, SCROW nRow2, SCTAB nTab) :
mnCol(nCol), mnRow1(nRow1), mnRow2(nRow2), mnTab(nTab) {}
- bool operator() (const ScDPObject& rObj) const
+ bool operator() (const std::unique_ptr<ScDPObject>& rObj) const
{
- const ScRange& rRange = rObj.GetOutRange();
+ const ScRange& rRange = rObj->GetOutRange();
if (mnTab != rRange.aStart.Tab())
// Not on this sheet.
return false;
@@ -665,7 +665,7 @@ public:
}
};
-class AccumulateOutputRanges : std::unary_function<ScDPObject, void>
+class AccumulateOutputRanges : std::unary_function<std::unique_ptr<ScDPObject>, void>
{
ScRangeList maRanges;
SCTAB mnTab;
@@ -673,9 +673,9 @@ public:
explicit AccumulateOutputRanges(SCTAB nTab) : mnTab(nTab) {}
AccumulateOutputRanges(const AccumulateOutputRanges& r) : maRanges(r.maRanges), mnTab(r.mnTab) {}
- void operator() (const ScDPObject& rObj)
+ void operator() (const std::unique_ptr<ScDPObject>& rObj)
{
- const ScRange& rRange = rObj.GetOutRange();
+ const ScRange& rRange = rObj->GetOutRange();
if (mnTab != rRange.aStart.Tab())
// Not on this sheet.
return;
@@ -3293,15 +3293,15 @@ namespace {
/**
* Unary predicate to match DP objects by the table ID.
*/
-class MatchByTable : public unary_function<ScDPObject, bool>
+class MatchByTable : public unary_function<std::unique_ptr<ScDPObject>, bool>
{
SCTAB mnTab;
public:
explicit MatchByTable(SCTAB nTab) : mnTab(nTab) {}
- bool operator() (const ScDPObject& rObj) const
+ bool operator() (const std::unique_ptr<ScDPObject>& rObj) const
{
- return rObj.GetOutRange().aStart.Tab() == mnTab;
+ return rObj->GetOutRange().aStart.Tab() == mnTab;
}
};
@@ -3461,7 +3461,7 @@ bool ScDPCollection::ReloadGroupsInCache(ScDPObject* pDPObj, std::set<ScDPObject
void ScDPCollection::DeleteOnTab( SCTAB nTab )
{
- maTables.erase_if(MatchByTable(nTab));
+ maTables.erase( std::remove_if(maTables.begin(), maTables.end(), MatchByTable(nTab)), maTables.end());
}
void ScDPCollection::UpdateReference( UpdateRefMode eUpdateRefMode,
@@ -3469,7 +3469,7 @@ void ScDPCollection::UpdateReference( UpdateRefMode eUpdateRefMode,
{
TablesType::iterator itr = maTables.begin(), itrEnd = maTables.end();
for (; itr != itrEnd; ++itr)
- itr->UpdateReference(eUpdateRefMode, r, nDx, nDy, nDz);
+ (*itr)->UpdateReference(eUpdateRefMode, r, nDx, nDy, nDz);
// Update the source ranges of the caches.
maSheetCaches.updateReference(eUpdateRefMode, r, nDx, nDy, nDz);
@@ -3481,7 +3481,7 @@ void ScDPCollection::CopyToTab( SCTAB nOld, SCTAB nNew )
TablesType::const_iterator it = maTables.begin(), itEnd = maTables.end();
for (; it != itEnd; ++it)
{
- const ScDPObject& rObj = *it;
+ const ScDPObject& rObj = *it->get();
ScRange aOutRange = rObj.GetOutRange();
if (aOutRange.aStart.Tab() != nOld)
continue;
@@ -3490,13 +3490,13 @@ void ScDPCollection::CopyToTab( SCTAB nOld, SCTAB nNew )
ScAddress& e = aOutRange.aEnd;
s.SetTab(nNew);
e.SetTab(nNew);
- std::unique_ptr<ScDPObject> pNew(new ScDPObject(rObj));
+ ScDPObject* pNew = new ScDPObject(rObj);
pNew->SetOutRange(aOutRange);
mpDoc->ApplyFlagsTab(s.Col(), s.Row(), e.Col(), e.Row(), s.Tab(), SC_MF_DP_TABLE);
- o3tl::ptr_container::push_back(aAdded, std::move(pNew));
+ aAdded.push_back(std::unique_ptr<ScDPObject>(pNew));
}
- maTables.transfer(maTables.end(), aAdded.begin(), aAdded.end(), aAdded);
+ std::move(aAdded.begin(), aAdded.end(), std::back_inserter(maTables));
}
bool ScDPCollection::RefsEqual( const ScDPCollection& r ) const
@@ -3506,7 +3506,7 @@ bool ScDPCollection::RefsEqual( const ScDPCollection& r ) const
TablesType::const_iterator itr = maTables.begin(), itr2 = r.maTables.begin(), itrEnd = maTables.end();
for (; itr != itrEnd; ++itr, ++itr2)
- if (!itr->RefsEqual(*itr2))
+ if (!(*itr)->RefsEqual(*itr2->get()))
return false;
return true;
@@ -3520,7 +3520,7 @@ void ScDPCollection::WriteRefsTo( ScDPCollection& r ) const
TablesType::const_iterator itr = maTables.begin(), itrEnd = maTables.end();
TablesType::iterator itr2 = r.maTables.begin();
for (; itr != itrEnd; ++itr, ++itr2)
- itr->WriteRefsTo(*itr2);
+ (*itr)->WriteRefsTo(*itr2->get());
}
else
{
@@ -3532,12 +3532,12 @@ void ScDPCollection::WriteRefsTo( ScDPCollection& r ) const
OSL_ENSURE( nSrcSize >= nDestSize, "WriteRefsTo: missing entries in document" );
for (size_t nSrcPos = 0; nSrcPos < nSrcSize; ++nSrcPos)
{
- const ScDPObject& rSrcObj = maTables[nSrcPos];
+ const ScDPObject& rSrcObj = *maTables[nSrcPos].get();
const OUString& aName = rSrcObj.GetName();
bool bFound = false;
for (size_t nDestPos = 0; nDestPos < nDestSize && !bFound; ++nDestPos)
{
- ScDPObject& rDestObj = r.maTables[nDestPos];
+ ScDPObject& rDestObj = *r.maTables[nDestPos].get();
if (rDestObj.GetName() == aName)
{
rSrcObj.WriteRefsTo(rDestObj); // found object, copy refs
@@ -3564,20 +3564,20 @@ size_t ScDPCollection::GetCount() const
ScDPObject& ScDPCollection::operator [](size_t nIndex)
{
- return maTables[nIndex];
+ return *maTables[nIndex].get();
}
const ScDPObject& ScDPCollection::operator [](size_t nIndex) const
{
- return maTables[nIndex];
+ return *maTables[nIndex].get();
}
const ScDPObject* ScDPCollection::GetByName(const OUString& rName) const
{
TablesType::const_iterator itr = maTables.begin(), itrEnd = maTables.end();
for (; itr != itrEnd; ++itr)
- if (itr->GetName() == rName)
- return &(*itr);
+ if ((*itr)->GetName() == rName)
+ return itr->get();
return nullptr;
}
@@ -3597,7 +3597,7 @@ OUString ScDPCollection::CreateNewName( sal_uInt16 nMin ) const
TablesType::const_iterator itr = maTables.begin(), itrEnd = maTables.end();
for (; itr != itrEnd; ++itr)
{
- if (itr->GetName() == aNewName)
+ if ((*itr)->GetName() == aNewName)
{
bFound = true;
break;
@@ -3618,7 +3618,7 @@ void ScDPCollection::FreeTable(ScDPObject* pDPObj)
TablesType::iterator itr = maTables.begin(), itrEnd = maTables.end();
for (; itr != itrEnd; ++itr)
{
- ScDPObject* p = &(*itr);
+ ScDPObject* p = itr->get();
if (p == pDPObj)
{
maTables.erase(itr);
@@ -3634,7 +3634,7 @@ bool ScDPCollection::InsertNewTable(ScDPObject* pDPObj)
const ScAddress& e = rOutRange.aEnd;
mpDoc->ApplyFlagsTab(s.Col(), s.Row(), e.Col(), e.Row(), s.Tab(), SC_MF_DP_TABLE);
- maTables.push_back(pDPObj);
+ maTables.push_back(std::unique_ptr<ScDPObject>(pDPObj));
return true;
}
@@ -3737,7 +3737,7 @@ void ScDPCollection::GetAllTables(const ScRange& rSrcRange, std::set<ScDPObject*
TablesType::const_iterator it = maTables.begin(), itEnd = maTables.end();
for (; it != itEnd; ++it)
{
- const ScDPObject& rObj = *it;
+ const ScDPObject& rObj = *it->get();
if (!rObj.IsSheetData())
// Source is not a sheet range.
continue;
@@ -3766,7 +3766,7 @@ void ScDPCollection::GetAllTables(const OUString& rSrcName, std::set<ScDPObject*
TablesType::const_iterator it = maTables.begin(), itEnd = maTables.end();
for (; it != itEnd; ++it)
{
- const ScDPObject& rObj = *it;
+ const ScDPObject& rObj = *it->get();
if (!rObj.IsSheetData())
// Source is not a sheet range.
continue;
@@ -3797,7 +3797,7 @@ void ScDPCollection::GetAllTables(
TablesType::const_iterator it = maTables.begin(), itEnd = maTables.end();
for (; it != itEnd; ++it)
{
- const ScDPObject& rObj = *it;
+ const ScDPObject& rObj = *it->get();
if (!rObj.IsImportData())
// Source data is not a database.
continue;
commit e5e2f119eff6f57ad7abc70efd4986f8f8b3fc00
Author: Noel Grandin <noel at peralex.com>
Date: Fri Nov 13 09:10:38 2015 +0200
sc: boost::ptr_vector->std::vector<std::unique_ptr>
Change-Id: I85eb08c85700a2a5e0bd0edaf46ca99fded9dbb5
diff --git a/sc/inc/dpcache.hxx b/sc/inc/dpcache.hxx
index 7226be9..9422b76 100644
--- a/sc/inc/dpcache.hxx
+++ b/sc/inc/dpcache.hxx
@@ -25,7 +25,6 @@
#include <tools/date.hxx>
#include <boost/noncopyable.hpp>
-#include <boost/ptr_container/ptr_vector.hpp>
#include <mdds/flat_segment_tree.hpp>
#include <memory>
@@ -111,7 +110,7 @@ private:
mutable ScDPObjectSet maRefObjects;
typedef std::vector< std::unique_ptr<Field> > FieldsType;
- typedef boost::ptr_vector<GroupItems> GroupFieldsType;
+ typedef std::vector< std::unique_ptr<GroupItems> > GroupFieldsType;
FieldsType maFields;
GroupFieldsType maGroupFields;
diff --git a/sc/source/core/data/dpcache.cxx b/sc/source/core/data/dpcache.cxx
index cf4a1a4..01e3326 100644
--- a/sc/source/core/data/dpcache.cxx
+++ b/sc/source/core/data/dpcache.cxx
@@ -675,7 +675,7 @@ const ScDPCache::GroupItems* ScDPCache::GetGroupItems(long nDim) const
nDim -= nSourceCount;
if (nDim < static_cast<long>(maGroupFields.size()))
- return &maGroupFields[nDim];
+ return maGroupFields[nDim].get();
return nullptr;
}
@@ -823,7 +823,7 @@ const ScDPItemData* ScDPCache::GetItemDataById(long nDim, SCROW nId) const
if (nDimPos >= maGroupFields.size())
return nullptr;
- const ScDPItemDataVec& rGI = maGroupFields[nDimPos].maItems;
+ const ScDPItemDataVec& rGI = maGroupFields[nDimPos]->maItems;
if (nItemId >= rGI.size())
return nullptr;
@@ -968,7 +968,7 @@ SCROW ScDPCache::GetIdByItemData(long nDim, const ScDPItemData& rItem) const
nDim -= mnColumnCount;
if (static_cast<size_t>(nDim) < maGroupFields.size())
{
- const ScDPItemDataVec& rGI = maGroupFields[nDim].maItems;
+ const ScDPItemDataVec& rGI = maGroupFields[nDim]->maItems;
for (size_t i = 0, n = rGI.size(); i < n; ++i)
{
if (rGI[i] == rItem)
@@ -1029,7 +1029,7 @@ OUString ScDPCache::GetFormattedString(long nDim, const ScDPItemData& rItem) con
long ScDPCache::AppendGroupField()
{
- maGroupFields.push_back(new GroupItems);
+ maGroupFields.push_back(o3tl::make_unique<GroupItems>());
return static_cast<long>(maFields.size() + maGroupFields.size() - 1);
}
@@ -1048,7 +1048,7 @@ void ScDPCache::ResetGroupItems(long nDim, const ScDPNumGroupInfo& rNumInfo, sal
nDim -= nSourceCount;
if (nDim < static_cast<long>(maGroupFields.size()))
{
- GroupItems& rGI = maGroupFields[nDim];
+ GroupItems& rGI = *maGroupFields[nDim].get();
rGI.maItems.clear();
rGI.maInfo = rNumInfo;
rGI.mnGroupType = nGroupType;
@@ -1072,7 +1072,7 @@ SCROW ScDPCache::SetGroupItem(long nDim, const ScDPItemData& rData)
nDim -= nSourceCount;
if (nDim < static_cast<long>(maGroupFields.size()))
{
- ScDPItemDataVec& rItems = maGroupFields.at(nDim).maItems;
+ ScDPItemDataVec& rItems = maGroupFields.at(nDim)->maItems;
rItems.push_back(rData);
return rItems.size()-1;
}
@@ -1102,7 +1102,7 @@ void ScDPCache::GetGroupDimMemberIds(long nDim, std::vector<SCROW>& rIds) const
nDim -= nSourceCount;
if (nDim < static_cast<long>(maGroupFields.size()))
{
- const ScDPItemDataVec& rGI = maGroupFields.at(nDim).maItems;
+ const ScDPItemDataVec& rGI = maGroupFields.at(nDim)->maItems;
for (size_t i = 0, n = rGI.size(); i < n; ++i)
rIds.push_back(static_cast<SCROW>(i));
}
@@ -1142,7 +1142,7 @@ const ScDPNumGroupInfo* ScDPCache::GetNumGroupInfo(long nDim) const
nDim -= nSourceCount;
if (nDim < static_cast<long>(maGroupFields.size()))
- return &maGroupFields.at(nDim).maInfo;
+ return &maGroupFields.at(nDim)->maInfo;
return nullptr;
}
@@ -1163,7 +1163,7 @@ sal_Int32 ScDPCache::GetGroupType(long nDim) const
nDim -= nSourceCount;
if (nDim < static_cast<long>(maGroupFields.size()))
- return maGroupFields.at(nDim).mnGroupType;
+ return maGroupFields.at(nDim)->mnGroupType;
return 0;
}
diff --git a/sc/source/core/data/dpsave.cxx b/sc/source/core/data/dpsave.cxx
index 4e01d4f..935aa9c 100644
--- a/sc/source/core/data/dpsave.cxx
+++ b/sc/source/core/data/dpsave.cxx
@@ -51,6 +51,7 @@
#include <unordered_map>
#include <unordered_set>
+#include <algorithm>
using namespace com::sun::star;
using namespace com::sun::star::sheet;
commit f3ba19b37f212a5839a91223f77d501d79e2c4b5
Author: Noel Grandin <noel at peralex.com>
Date: Fri Nov 13 09:06:37 2015 +0200
sc: boost::ptr_vector->std::vector<std::unique_ptr>
Change-Id: I7bf6fad1ed2d0f8e9a42293e0ceec7fc3b59963f
diff --git a/sc/inc/dpcache.hxx b/sc/inc/dpcache.hxx
index 155c969..7226be9 100644
--- a/sc/inc/dpcache.hxx
+++ b/sc/inc/dpcache.hxx
@@ -110,7 +110,7 @@ private:
*/
mutable ScDPObjectSet maRefObjects;
- typedef boost::ptr_vector<Field> FieldsType;
+ typedef std::vector< std::unique_ptr<Field> > FieldsType;
typedef boost::ptr_vector<GroupItems> GroupFieldsType;
FieldsType maFields;
diff --git a/sc/source/core/data/dpcache.cxx b/sc/source/core/data/dpcache.cxx
index bd04f8e..cf4a1a4 100644
--- a/sc/source/core/data/dpcache.cxx
+++ b/sc/source/core/data/dpcache.cxx
@@ -34,6 +34,7 @@
#include <unotools/textsearch.hxx>
#include <unotools/localedatawrapper.hxx>
#include <svl/zforlist.hxx>
+#include <o3tl/make_unique.hxx>
#if DEBUG_PIVOT_TABLE
#include <com/sun/star/sheet/DataPilotFieldGroupBy.hpp>
@@ -333,7 +334,7 @@ bool ScDPCache::InitFromDoc(ScDocument* pDoc, const ScRange& rRange)
maFields.reserve(mnColumnCount);
for (size_t i = 0; i < static_cast<size_t>(mnColumnCount); ++i)
- maFields.push_back(new Field);
+ maFields.push_back(o3tl::make_unique<Field>());
maLabelNames.reserve(mnColumnCount+1);
@@ -341,7 +342,7 @@ bool ScDPCache::InitFromDoc(ScDocument* pDoc, const ScRange& rRange)
for (sal_uInt16 nCol = nStartCol; nCol <= nEndCol; ++nCol)
{
AddLabel(createLabelString(pDoc, nCol, nStartRow, nDocTab));
- Field& rField = maFields[nCol-nStartCol];
+ Field& rField = *maFields[nCol-nStartCol].get();
std::vector<Bucket> aBuckets;
aBuckets.reserve(nEndRow-nStartRow); // skip the topmost label cell.
@@ -391,7 +392,7 @@ bool ScDPCache::InitFromDataBase(DBConnector& rDB)
maFields.clear();
maFields.reserve(mnColumnCount);
for (size_t i = 0; i < static_cast<size_t>(mnColumnCount); ++i)
- maFields.push_back(new Field);
+ maFields.push_back(o3tl::make_unique<Field>());
// Get column titles and types.
maLabelNames.clear();
@@ -411,7 +412,7 @@ bool ScDPCache::InitFromDataBase(DBConnector& rDB)
continue;
aBuckets.clear();
- Field& rField = maFields[nCol];
+ Field& rField = *maFields[nCol].get();
SCROW nRow = 0;
do
{
@@ -436,7 +437,7 @@ bool ScDPCache::InitFromDataBase(DBConnector& rDB)
rDB.finish();
if (!maFields.empty())
- mnRowCount = maFields[0].maData.size();
+ mnRowCount = maFields[0]->maData.size();
PostInit();
return true;
@@ -670,7 +671,7 @@ const ScDPCache::GroupItems* ScDPCache::GetGroupItems(long nDim) const
long nSourceCount = static_cast<long>(maFields.size());
if (nDim < nSourceCount)
- return maFields[nDim].mpGroup.get();
+ return maFields[nDim]->mpGroup.get();
nDim -= nSourceCount;
if (nDim < static_cast<long>(maGroupFields.size()))
@@ -717,7 +718,7 @@ void ScDPCache::PostInit()
typedef mdds::flat_segment_tree<SCROW, bool>::const_reverse_iterator itr_type;
itr_type it = maEmptyRows.rbegin();
OSL_ENSURE(it != maEmptyRows.rend(), "corrupt flat_segment_tree instance!");
- mnDataSize = maFields[0].maData.size();
+ mnDataSize = maFields[0]->maData.size();
++it; // Skip the first position.
OSL_ENSURE(it != maEmptyRows.rend(), "buggy version of flat_segment_tree is used.");
if (it->second)
@@ -770,7 +771,7 @@ SCROW ScDPCache::GetItemDataId(sal_uInt16 nDim, SCROW nRow, bool bRepeatIfEmpty)
{
OSL_ENSURE(nDim < mnColumnCount, "ScDPTableDataCache::GetItemDataId ");
- const Field& rField = maFields[nDim];
+ const Field& rField = *maFields[nDim].get();
if (static_cast<size_t>(nRow) >= rField.maData.size())
{
// nRow is in the trailing empty rows area.
@@ -802,7 +803,7 @@ const ScDPItemData* ScDPCache::GetItemDataById(long nDim, SCROW nId) const
if (nDimPos < nSourceCount)
{
// source field.
- const Field& rField = maFields[nDimPos];
+ const Field& rField = *maFields[nDimPos].get();
if (nItemId < rField.maItems.size())
return &rField.maItems[nItemId];
@@ -855,13 +856,13 @@ const ScDPCache::IndexArrayType* ScDPCache::GetFieldIndexArray( size_t nDim ) co
if (nDim >= maFields.size())
return nullptr;
- return &maFields[nDim].maData;
+ return &maFields[nDim]->maData;
}
const ScDPCache::ScDPItemDataVec& ScDPCache::GetDimMemberValues(SCCOL nDim) const
{
OSL_ENSURE( nDim>=0 && nDim < mnColumnCount ," nDim < mnColumnCount ");
- return maFields.at(nDim).maItems;
+ return maFields.at(nDim)->maItems;
}
sal_uLong ScDPCache::GetNumberFormat( long nDim ) const
@@ -871,7 +872,7 @@ sal_uLong ScDPCache::GetNumberFormat( long nDim ) const
// TODO: Find a way to determine the dominant number format in presence of
// multiple number formats in the same field.
- return maFields[nDim].mnNumFormat;
+ return maFields[nDim]->mnNumFormat;
}
bool ScDPCache::IsDateDimension( long nDim ) const
@@ -883,14 +884,14 @@ bool ScDPCache::IsDateDimension( long nDim ) const
if (!pFormatter)
return false;
- short eType = pFormatter->GetType(maFields[nDim].mnNumFormat);
+ short eType = pFormatter->GetType(maFields[nDim]->mnNumFormat);
return (eType == css::util::NumberFormat::DATE) || (eType == css::util::NumberFormat::DATETIME);
}
long ScDPCache::GetDimMemberCount(long nDim) const
{
OSL_ENSURE( nDim>=0 && nDim < mnColumnCount ," ScDPTableDataCache::GetDimMemberCount : out of bound ");
- return maFields[nDim].maItems.size();
+ return maFields[nDim]->maItems.size();
}
SCCOL ScDPCache::GetDimensionIndex(const OUString& sName) const
@@ -943,18 +944,18 @@ SCROW ScDPCache::GetIdByItemData(long nDim, const ScDPItemData& rItem) const
if (nDim < mnColumnCount)
{
// source field.
- const ScDPItemDataVec& rItems = maFields[nDim].maItems;
+ const ScDPItemDataVec& rItems = maFields[nDim]->maItems;
for (size_t i = 0, n = rItems.size(); i < n; ++i)
{
if (rItems[i] == rItem)
return i;
}
- if (!maFields[nDim].mpGroup)
+ if (!maFields[nDim]->mpGroup)
return -1;
// grouped source field.
- const ScDPItemDataVec& rGI = maFields[nDim].mpGroup->maItems;
+ const ScDPItemDataVec& rGI = maFields[nDim]->mpGroup->maItems;
for (size_t i = 0, n = rGI.size(); i < n; ++i)
{
if (rGI[i] == rItem)
@@ -1040,7 +1041,7 @@ void ScDPCache::ResetGroupItems(long nDim, const ScDPNumGroupInfo& rNumInfo, sal
long nSourceCount = static_cast<long>(maFields.size());
if (nDim < nSourceCount)
{
- maFields.at(nDim).mpGroup.reset(new GroupItems(rNumInfo, nGroupType));
+ maFields.at(nDim)->mpGroup.reset(new GroupItems(rNumInfo, nGroupType));
return;
}
@@ -1062,9 +1063,9 @@ SCROW ScDPCache::SetGroupItem(long nDim, const ScDPItemData& rData)
long nSourceCount = static_cast<long>(maFields.size());
if (nDim < nSourceCount)
{
- GroupItems& rGI = *maFields.at(nDim).mpGroup;
+ GroupItems& rGI = *maFields.at(nDim)->mpGroup;
rGI.maItems.push_back(rData);
- SCROW nId = maFields[nDim].maItems.size() + rGI.maItems.size() - 1;
+ SCROW nId = maFields[nDim]->maItems.size() + rGI.maItems.size() - 1;
return nId;
}
@@ -1087,11 +1088,11 @@ void ScDPCache::GetGroupDimMemberIds(long nDim, std::vector<SCROW>& rIds) const
long nSourceCount = static_cast<long>(maFields.size());
if (nDim < nSourceCount)
{
- if (!maFields.at(nDim).mpGroup)
+ if (!maFields.at(nDim)->mpGroup)
return;
- size_t nOffset = maFields[nDim].maItems.size();
- const ScDPItemDataVec& rGI = maFields[nDim].mpGroup->maItems;
+ size_t nOffset = maFields[nDim]->maItems.size();
+ const ScDPItemDataVec& rGI = maFields[nDim]->mpGroup->maItems;
for (size_t i = 0, n = rGI.size(); i < n; ++i)
rIds.push_back(static_cast<SCROW>(i + nOffset));
@@ -1109,11 +1110,11 @@ void ScDPCache::GetGroupDimMemberIds(long nDim, std::vector<SCROW>& rIds) const
namespace {
-struct ClearGroupItems : std::unary_function<ScDPCache::Field, void>
+struct ClearGroupItems : std::unary_function<std::unique_ptr<ScDPCache::Field>, void>
{
- void operator() (ScDPCache::Field& r) const
+ void operator() (std::unique_ptr<ScDPCache::Field>& r) const
{
- r.mpGroup.reset();
+ r->mpGroup.reset();
}
};
@@ -1133,10 +1134,10 @@ const ScDPNumGroupInfo* ScDPCache::GetNumGroupInfo(long nDim) const
long nSourceCount = static_cast<long>(maFields.size());
if (nDim < nSourceCount)
{
- if (!maFields.at(nDim).mpGroup)
+ if (!maFields.at(nDim)->mpGroup)
return nullptr;
- return &maFields[nDim].mpGroup->maInfo;
+ return &maFields[nDim]->mpGroup->maInfo;
}
nDim -= nSourceCount;
@@ -1154,10 +1155,10 @@ sal_Int32 ScDPCache::GetGroupType(long nDim) const
long nSourceCount = static_cast<long>(maFields.size());
if (nDim < nSourceCount)
{
- if (!maFields.at(nDim).mpGroup)
+ if (!maFields.at(nDim)->mpGroup)
return 0;
- return maFields[nDim].mpGroup->mnGroupType;
+ return maFields[nDim]->mpGroup->mnGroupType;
}
nDim -= nSourceCount;
commit c2defd97cb60439fc25970c903e66fbecad148e5
Author: Noel Grandin <noel at peralex.com>
Date: Fri Nov 13 08:59:29 2015 +0200
sc: inline LabelsType
Change-Id: I6035b73e170664d23c706a26c1dee953cd19c518
diff --git a/sc/inc/dpcache.hxx b/sc/inc/dpcache.hxx
index e48fe4e..155c969 100644
--- a/sc/inc/dpcache.hxx
+++ b/sc/inc/dpcache.hxx
@@ -49,7 +49,6 @@ class SC_DLLPUBLIC ScDPCache : boost::noncopyable
public:
typedef std::vector<ScDPItemData> ScDPItemDataVec;
typedef std::set<ScDPObject*> ScDPObjectSet;
- typedef std::vector<OUString> LabelsType;
typedef std::vector<SCROW> IndexArrayType;
struct GroupItems : boost::noncopyable
@@ -118,7 +117,7 @@ private:
GroupFieldsType maGroupFields;
mutable StringSetType maStringPool;
- LabelsType maLabelNames; // Stores dimension names and the data layout dimension name at position 0.
+ std::vector<OUString> maLabelNames; // Stores dimension names and the data layout dimension name at position 0.
mdds::flat_segment_tree<SCROW, bool> maEmptyRows;
SCROW mnDataSize;
SCROW mnRowCount;
@@ -174,7 +173,7 @@ public:
*/
SCROW GetDataSize() const;
SCROW GetItemDataId( sal_uInt16 nDim, SCROW nRow, bool bRepeatIfEmpty ) const;
- OUString GetDimensionName(LabelsType::size_type nDim) const;
+ OUString GetDimensionName(std::vector<OUString>::size_type nDim) const;
bool IsRowEmpty(SCROW nRow) const;
bool ValidQuery(SCROW nRow, const ScQueryParam& rQueryParam) const;
diff --git a/sc/source/core/data/dpcache.cxx b/sc/source/core/data/dpcache.cxx
index eb2bf55..bd04f8e 100644
--- a/sc/source/core/data/dpcache.cxx
+++ b/sc/source/core/data/dpcache.cxx
@@ -679,7 +679,7 @@ const ScDPCache::GroupItems* ScDPCache::GetGroupItems(long nDim) const
return nullptr;
}
-OUString ScDPCache::GetDimensionName(LabelsType::size_type nDim) const
+OUString ScDPCache::GetDimensionName(std::vector<OUString>::size_type nDim) const
{
OSL_ENSURE(nDim < maLabelNames.size()-1 , "ScDPTableDataCache::GetDimensionName");
OSL_ENSURE(maLabelNames.size() == static_cast <sal_uInt16> (mnColumnCount+1), "ScDPTableDataCache::GetDimensionName");
commit 75aaa65a8f0f145657098278c3a7a3973b2c29df
Author: Noel Grandin <noel at peralex.com>
Date: Fri Nov 13 08:57:47 2015 +0200
sc: rename ObjectSetType to ScDPObject
Change-Id: I64720c2678f702e895c9b91571d98c0059e02a27
diff --git a/sc/inc/dpcache.hxx b/sc/inc/dpcache.hxx
index bbaa220..e48fe4e 100644
--- a/sc/inc/dpcache.hxx
+++ b/sc/inc/dpcache.hxx
@@ -48,7 +48,7 @@ class SC_DLLPUBLIC ScDPCache : boost::noncopyable
public:
typedef std::vector<ScDPItemData> ScDPItemDataVec;
- typedef std::set<ScDPObject*> ObjectSetType;
+ typedef std::set<ScDPObject*> ScDPObjectSet;
typedef std::vector<OUString> LabelsType;
typedef std::vector<SCROW> IndexArrayType;
@@ -109,7 +109,7 @@ private:
/**
* All pivot table objects that references this cache.
*/
- mutable ObjectSetType maRefObjects;
+ mutable ScDPObjectSet maRefObjects;
typedef boost::ptr_vector<Field> FieldsType;
typedef boost::ptr_vector<GroupItems> GroupFieldsType;
@@ -129,7 +129,7 @@ public:
const OUString* InternString(const OUString& rStr) const;
void AddReference(ScDPObject* pObj) const;
void RemoveReference(ScDPObject* pObj) const;
- const ObjectSetType& GetAllReferences() const;
+ const ScDPObjectSet& GetAllReferences() const;
SCROW GetIdByItemData(long nDim, const ScDPItemData& rItem) const;
OUString GetFormattedString(long nDim, const ScDPItemData& rItem) const;
diff --git a/sc/source/core/data/dpcache.cxx b/sc/source/core/data/dpcache.cxx
index 3a2fbc5..eb2bf55 100644
--- a/sc/source/core/data/dpcache.cxx
+++ b/sc/source/core/data/dpcache.cxx
@@ -930,7 +930,7 @@ void ScDPCache::RemoveReference(ScDPObject* pObj) const
mpDoc->GetDPCollection()->RemoveCache(this);
}
-const ScDPCache::ObjectSetType& ScDPCache::GetAllReferences() const
+const ScDPCache::ScDPObjectSet& ScDPCache::GetAllReferences() const
{
return maRefObjects;
}
diff --git a/sc/source/filter/excel/xepivotxml.cxx b/sc/source/filter/excel/xepivotxml.cxx
index 92d79bc..23e010e 100644
--- a/sc/source/filter/excel/xepivotxml.cxx
+++ b/sc/source/filter/excel/xepivotxml.cxx
@@ -316,8 +316,8 @@ void XclExpXmlPivotTableManager::Initialize()
// Get all pivot objects that reference this cache, and set up an
// object to cache ID mapping.
- const ScDPCache::ObjectSetType& rRefs = pCache->GetAllReferences();
- ScDPCache::ObjectSetType::const_iterator it = rRefs.begin(), itEnd = rRefs.end();
+ const ScDPCache::ScDPObjectSet& rRefs = pCache->GetAllReferences();
+ ScDPCache::ScDPObjectSet::const_iterator it = rRefs.begin(), itEnd = rRefs.end();
for (; it != itEnd; ++it)
maCacheIdMap.insert(CacheIdMapType::value_type(*it, aCaches.size()+1));
commit a029ab3d480c97313dc88dc6e1fbc0f3a900fb09
Author: Noel Grandin <noel at peralex.com>
Date: Fri Nov 13 08:54:18 2015 +0200
sc:rename ItemsType to ScDPItemDataVec
Change-Id: Ib81da8bd2e934330deea6f862c6774db4df93603
diff --git a/sc/inc/dpcache.hxx b/sc/inc/dpcache.hxx
index ebddcfe..bbaa220 100644
--- a/sc/inc/dpcache.hxx
+++ b/sc/inc/dpcache.hxx
@@ -47,14 +47,14 @@ class SC_DLLPUBLIC ScDPCache : boost::noncopyable
typedef std::unordered_set<OUString, OUStringHash> StringSetType;
public:
- typedef std::vector<ScDPItemData> ItemsType;
+ typedef std::vector<ScDPItemData> ScDPItemDataVec;
typedef std::set<ScDPObject*> ObjectSetType;
typedef std::vector<OUString> LabelsType;
typedef std::vector<SCROW> IndexArrayType;
struct GroupItems : boost::noncopyable
{
- ItemsType maItems;
+ ScDPItemDataVec maItems;
ScDPNumGroupInfo maInfo;
sal_Int32 mnGroupType;
@@ -72,7 +72,7 @@ public:
/**
* Unique values in the field, stored in ascending order.
*/
- ItemsType maItems;
+ ScDPItemDataVec maItems;
/**
* Original source data represented as indices to the unique value
@@ -157,7 +157,7 @@ public:
static SCROW GetOrder( long nDim, SCROW nIndex );
const IndexArrayType* GetFieldIndexArray( size_t nDim ) const;
- const ItemsType& GetDimMemberValues( SCCOL nDim ) const;
+ const ScDPItemDataVec& GetDimMemberValues( SCCOL nDim ) const;
bool InitFromDoc(ScDocument* pDoc, const ScRange& rRange);
bool InitFromDataBase(DBConnector& rDB);
diff --git a/sc/source/core/data/dpcache.cxx b/sc/source/core/data/dpcache.cxx
index f11d880..3a2fbc5 100644
--- a/sc/source/core/data/dpcache.cxx
+++ b/sc/source/core/data/dpcache.cxx
@@ -208,9 +208,9 @@ struct EqualByOrderIndex : std::binary_function<Bucket, Bucket, bool>
class PushBackValue : std::unary_function<Bucket, void>
{
- ScDPCache::ItemsType& mrItems;
+ ScDPCache::ScDPItemDataVec& mrItems;
public:
- PushBackValue(ScDPCache::ItemsType& _items) : mrItems(_items) {}
+ PushBackValue(ScDPCache::ScDPItemDataVec& _items) : mrItems(_items) {}
void operator() (const Bucket& v)
{
mrItems.push_back(v.maValue);
@@ -810,7 +810,7 @@ const ScDPItemData* ScDPCache::GetItemDataById(long nDim, SCROW nId) const
return nullptr;
nItemId -= rField.maItems.size();
- const ItemsType& rGI = rField.mpGroup->maItems;
+ const ScDPItemDataVec& rGI = rField.mpGroup->maItems;
if (nItemId >= rGI.size())
return nullptr;
@@ -822,7 +822,7 @@ const ScDPItemData* ScDPCache::GetItemDataById(long nDim, SCROW nId) const
if (nDimPos >= maGroupFields.size())
return nullptr;
- const ItemsType& rGI = maGroupFields[nDimPos].maItems;
+ const ScDPItemDataVec& rGI = maGroupFields[nDimPos].maItems;
if (nItemId >= rGI.size())
return nullptr;
@@ -858,7 +858,7 @@ const ScDPCache::IndexArrayType* ScDPCache::GetFieldIndexArray( size_t nDim ) co
return &maFields[nDim].maData;
}
-const ScDPCache::ItemsType& ScDPCache::GetDimMemberValues(SCCOL nDim) const
+const ScDPCache::ScDPItemDataVec& ScDPCache::GetDimMemberValues(SCCOL nDim) const
{
OSL_ENSURE( nDim>=0 && nDim < mnColumnCount ," nDim < mnColumnCount ");
return maFields.at(nDim).maItems;
@@ -943,7 +943,7 @@ SCROW ScDPCache::GetIdByItemData(long nDim, const ScDPItemData& rItem) const
if (nDim < mnColumnCount)
{
// source field.
- const ItemsType& rItems = maFields[nDim].maItems;
+ const ScDPItemDataVec& rItems = maFields[nDim].maItems;
for (size_t i = 0, n = rItems.size(); i < n; ++i)
{
if (rItems[i] == rItem)
@@ -954,7 +954,7 @@ SCROW ScDPCache::GetIdByItemData(long nDim, const ScDPItemData& rItem) const
return -1;
// grouped source field.
- const ItemsType& rGI = maFields[nDim].mpGroup->maItems;
+ const ScDPItemDataVec& rGI = maFields[nDim].mpGroup->maItems;
for (size_t i = 0, n = rGI.size(); i < n; ++i)
{
if (rGI[i] == rItem)
@@ -967,7 +967,7 @@ SCROW ScDPCache::GetIdByItemData(long nDim, const ScDPItemData& rItem) const
nDim -= mnColumnCount;
if (static_cast<size_t>(nDim) < maGroupFields.size())
{
- const ItemsType& rGI = maGroupFields[nDim].maItems;
+ const ScDPItemDataVec& rGI = maGroupFields[nDim].maItems;
for (size_t i = 0, n = rGI.size(); i < n; ++i)
{
if (rGI[i] == rItem)
@@ -1071,7 +1071,7 @@ SCROW ScDPCache::SetGroupItem(long nDim, const ScDPItemData& rData)
nDim -= nSourceCount;
if (nDim < static_cast<long>(maGroupFields.size()))
{
- ItemsType& rItems = maGroupFields.at(nDim).maItems;
+ ScDPItemDataVec& rItems = maGroupFields.at(nDim).maItems;
rItems.push_back(rData);
return rItems.size()-1;
}
@@ -1091,7 +1091,7 @@ void ScDPCache::GetGroupDimMemberIds(long nDim, std::vector<SCROW>& rIds) const
return;
size_t nOffset = maFields[nDim].maItems.size();
- const ItemsType& rGI = maFields[nDim].mpGroup->maItems;
+ const ScDPItemDataVec& rGI = maFields[nDim].mpGroup->maItems;
for (size_t i = 0, n = rGI.size(); i < n; ++i)
rIds.push_back(static_cast<SCROW>(i + nOffset));
@@ -1101,7 +1101,7 @@ void ScDPCache::GetGroupDimMemberIds(long nDim, std::vector<SCROW>& rIds) const
nDim -= nSourceCount;
if (nDim < static_cast<long>(maGroupFields.size()))
{
- const ItemsType& rGI = maGroupFields.at(nDim).maItems;
+ const ScDPItemDataVec& rGI = maGroupFields.at(nDim).maItems;
for (size_t i = 0, n = rGI.size(); i < n; ++i)
rIds.push_back(static_cast<SCROW>(i));
}
@@ -1182,13 +1182,13 @@ std::ostream& operator<< (::std::ostream& os, const OUString& str)
return os << OUStringToOString(str, RTL_TEXTENCODING_UTF8).getStr();
}
-void dumpItems(const ScDPCache& rCache, long nDim, const ScDPCache::ItemsType& rItems, size_t nOffset)
+void dumpItems(const ScDPCache& rCache, long nDim, const ScDPCache::ScDPItemDataVec& rItems, size_t nOffset)
{
for (size_t i = 0; i < rItems.size(); ++i)
cout << " " << (i+nOffset) << ": " << rCache.GetFormattedString(nDim, rItems[i]) << endl;
}
-void dumpSourceData(const ScDPCache& rCache, long nDim, const ScDPCache::ItemsType& rItems, const ScDPCache::IndexArrayType& rArray)
+void dumpSourceData(const ScDPCache& rCache, long nDim, const ScDPCache::ScDPItemDataVec& rItems, const ScDPCache::IndexArrayType& rArray)
{
ScDPCache::IndexArrayType::const_iterator it = rArray.begin(), itEnd = rArray.end();
for (; it != itEnd; ++it)
diff --git a/sc/source/core/data/dpdimsave.cxx b/sc/source/core/data/dpdimsave.cxx
index 43cd1cd..bdd048b 100644
--- a/sc/source/core/data/dpdimsave.cxx
+++ b/sc/source/core/data/dpdimsave.cxx
@@ -289,8 +289,8 @@ void fillDateGroupDimension(
double fSourceMax = 0.0;
bool bFirst = true;
- const ScDPCache::ItemsType& rItems = rCache.GetDimMemberValues(nSourceDim);
- ScDPCache::ItemsType::const_iterator it = rItems.begin(), itEnd = rItems.end();
+ const ScDPCache::ScDPItemDataVec& rItems = rCache.GetDimMemberValues(nSourceDim);
+ ScDPCache::ScDPItemDataVec::const_iterator it = rItems.begin(), itEnd = rItems.end();
for (; it != itEnd; ++it)
{
const ScDPItemData& rItem = *it;
@@ -404,9 +404,9 @@ void ScDPSaveGroupDimension::AddToCache(ScDPCache& rCache) const
}
}
- const ScDPCache::ItemsType& rItems = rCache.GetDimMemberValues(nSourceDim);
+ const ScDPCache::ScDPItemDataVec& rItems = rCache.GetDimMemberValues(nSourceDim);
{
- ScDPCache::ItemsType::const_iterator it = rItems.begin(), itEnd = rItems.end();
+ ScDPCache::ScDPItemDataVec::const_iterator it = rItems.begin(), itEnd = rItems.end();
for (; it != itEnd; ++it)
{
const ScDPItemData& rItem = *it;
@@ -477,8 +477,8 @@ void ScDPSaveNumGroupDimension::AddToCache(ScDPCache& rCache) const
double fSourceMax = 0.0;
bool bFirst = true;
- const ScDPCache::ItemsType& rItems = rCache.GetDimMemberValues(nDim);
- ScDPCache::ItemsType::const_iterator it = rItems.begin(), itEnd = rItems.end();
+ const ScDPCache::ScDPItemDataVec& rItems = rCache.GetDimMemberValues(nDim);
+ ScDPCache::ScDPItemDataVec::const_iterator it = rItems.begin(), itEnd = rItems.end();
for (; it != itEnd; ++it)
{
const ScDPItemData& rItem = *it;
diff --git a/sc/source/filter/excel/xepivotxml.cxx b/sc/source/filter/excel/xepivotxml.cxx
index b03e891..92d79bc 100644
--- a/sc/source/filter/excel/xepivotxml.cxx
+++ b/sc/source/filter/excel/xepivotxml.cxx
@@ -226,9 +226,9 @@ void XclExpXmlPivotCaches::SavePivotCacheXml( XclExpXmlStream& rStrm, const Entr
XML_numFmtId, OString::number(0).getStr(),
FSEND);
- const ScDPCache::ItemsType& rFieldItems = rCache.GetDimMemberValues(i);
+ const ScDPCache::ScDPItemDataVec& rFieldItems = rCache.GetDimMemberValues(i);
- ScDPCache::ItemsType::const_iterator it = rFieldItems.begin(), itEnd = rFieldItems.end();
+ ScDPCache::ScDPItemDataVec::const_iterator it = rFieldItems.begin(), itEnd = rFieldItems.end();
std::set<ScDPItemData::Type> aDPTypes;
for (; it != itEnd; ++it)
commit 2aacf6c2cd82322b953988ff30d3bc997ae76d7b
Author: Noel Grandin <noel at peralex.com>
Date: Thu Nov 12 16:03:01 2015 +0200
sc: boost::ptr_vector->std::vector
Change-Id: Ic4af0579f31c2076fcbc4ac76266e0ae49cb2be8
diff --git a/sc/inc/userlist.hxx b/sc/inc/userlist.hxx
index 72e8e20..0ac95e1 100644
--- a/sc/inc/userlist.hxx
+++ b/sc/inc/userlist.hxx
@@ -22,7 +22,6 @@
#include "scdllapi.h"
-#include <boost/ptr_container/ptr_vector.hpp>
#include <vector>
/**
@@ -47,7 +46,6 @@ private:
public:
ScUserListData(const OUString& rStr);
ScUserListData(const ScUserListData& rData);
- ~ScUserListData();
const OUString& GetString() const { return aStr; }
void SetString(const OUString& rStr);
@@ -63,7 +61,7 @@ public:
*/
class SC_DLLPUBLIC ScUserList
{
- typedef ::boost::ptr_vector<ScUserListData> DataType;
+ typedef std::vector<ScUserListData> DataType;
DataType maData;
public:
typedef DataType::iterator iterator;
@@ -85,8 +83,9 @@ public:
iterator begin();
const_iterator begin() const;
void clear();
+ void reserve(size_t size) { maData.reserve(size); }
size_t size() const;
- void push_back(ScUserListData* p);
+ void push_back(const ScUserListData& r) { maData.push_back(r); }
void erase(iterator itr);
};
diff --git a/sc/source/core/tool/appoptio.cxx b/sc/source/core/tool/appoptio.cxx
index 3bdf429..5328f67 100644
--- a/sc/source/core/tool/appoptio.cxx
+++ b/sc/source/core/tool/appoptio.cxx
@@ -180,11 +180,11 @@ static void lcl_SetSortList( const Any& rValue )
if (!bDefault)
{
aList.clear();
+ aList.reserve(nCount);
for (long i=0; i<nCount; i++)
{
- ScUserListData* pNew = new ScUserListData( pArray[i] );
- aList.push_back(pNew);
+ aList.push_back( ScUserListData( pArray[i] ) );
}
}
diff --git a/sc/source/core/tool/userlist.cxx b/sc/source/core/tool/userlist.cxx
index dc80dd8..0299bfe 100644
--- a/sc/source/core/tool/userlist.cxx
+++ b/sc/source/core/tool/userlist.cxx
@@ -96,10 +96,6 @@ ScUserListData::ScUserListData(const ScUserListData& rData) :
InitTokens();
}
-ScUserListData::~ScUserListData()
-{
-}
-
void ScUserListData::SetString( const OUString& rStr )
{
aStr = rStr;
@@ -237,9 +233,9 @@ ScUserList::ScUserList()
OUString aDayLong = aDayLongBuf.makeStringAndClear();
if ( !HasEntry( aDayShort ) )
- maData.push_back( new ScUserListData( aDayShort ));
+ maData.push_back( ScUserListData( aDayShort ));
if ( !HasEntry( aDayLong ) )
- maData.push_back( new ScUserListData( aDayLong ));
+ maData.push_back( ScUserListData( aDayLong ));
}
xCal = xCalendars[j].Months;
@@ -262,9 +258,9 @@ ScUserList::ScUserList()
OUString aMonthLong = aMonthLongBuf.makeStringAndClear();
if ( !HasEntry( aMonthShort ) )
- maData.push_back( new ScUserListData( aMonthShort ));
+ maData.push_back( ScUserListData( aMonthShort ));
if ( !HasEntry( aMonthLong ) )
- maData.push_back( new ScUserListData( aMonthLong ));
+ maData.push_back( ScUserListData( aMonthLong ));
}
}
}
@@ -350,11 +346,6 @@ size_t ScUserList::size() const
return maData.size();
}
-void ScUserList::push_back(ScUserListData* p)
-{
- maData.push_back(p);
-}
-
void ScUserList::erase(iterator itr)
{
maData.erase(itr);
diff --git a/sc/source/ui/optdlg/tpusrlst.cxx b/sc/source/ui/optdlg/tpusrlst.cxx
index 9a4ff48..2511027 100644
--- a/sc/source/ui/optdlg/tpusrlst.cxx
+++ b/sc/source/ui/optdlg/tpusrlst.cxx
@@ -344,7 +344,7 @@ void ScTpUserLists::AddNewList( const OUString& rEntriesStr )
MakeListStr( theEntriesStr );
- pUserLists->push_back(new ScUserListData(theEntriesStr));
+ pUserLists->push_back(ScUserListData(rEntriesStr));
}
void ScTpUserLists::CopyListFromArea( const ScRefAddress& rStartPos,
diff --git a/sc/source/ui/unoobj/appluno.cxx b/sc/source/ui/unoobj/appluno.cxx
index f5036f1..c0e61a7 100644
--- a/sc/source/ui/unoobj/appluno.cxx
+++ b/sc/source/ui/unoobj/appluno.cxx
@@ -358,12 +358,12 @@ void SAL_CALL ScSpreadsheetSettings::setPropertyValue(
pUserList->clear(); // alle Eintraege raus
sal_uInt16 nCount = (sal_uInt16)aSeq.getLength();
+ pUserList->reserve(nCount);
const OUString* pAry = aSeq.getConstArray();
for (sal_uInt16 i=0; i<nCount; i++)
{
OUString aEntry = pAry[i];
- ScUserListData* pData = new ScUserListData(aEntry);
- pUserList->push_back(pData);
+ pUserList->push_back( ScUserListData(aEntry) );
}
bSaveApp = true; // Liste wird mit den App-Optionen gespeichert
}
commit ab3d557b48cacb30598c6b5ebb1cadece493fde8
Author: Noel Grandin <noel at peralex.com>
Date: Thu Nov 12 15:51:36 2015 +0200
sc: boost::ptr_vector->std::vector
Change-Id: I78fb3a7c735621565ad523ec49b04b20053ae681
diff --git a/sc/inc/userlist.hxx b/sc/inc/userlist.hxx
index 8983026..72e8e20 100644
--- a/sc/inc/userlist.hxx
+++ b/sc/inc/userlist.hxx
@@ -23,6 +23,7 @@
#include "scdllapi.h"
#include <boost/ptr_container/ptr_vector.hpp>
+#include <vector>
/**
* Stores individual user-defined sort list.
@@ -37,7 +38,7 @@ public:
SubStr(const OUString& rReal, const OUString& rUpper);
};
private:
- typedef ::boost::ptr_vector<SubStr> SubStringsType;
+ typedef std::vector<SubStr> SubStringsType;
SubStringsType maSubStrings;
OUString aStr;
diff --git a/sc/source/core/tool/userlist.cxx b/sc/source/core/tool/userlist.cxx
index 3bc65ee..dc80dd8 100644
--- a/sc/source/core/tool/userlist.cxx
+++ b/sc/source/core/tool/userlist.cxx
@@ -70,7 +70,7 @@ void ScUserListData::InitTokens()
{
OUString aSub(p0, nLen);
OUString aUpStr = ScGlobal::pCharClass->uppercase(aSub);
- maSubStrings.push_back(new SubStr(aSub, aUpStr));
+ maSubStrings.push_back(SubStr(aSub, aUpStr));
}
bFirst = true;
}
@@ -80,7 +80,7 @@ void ScUserListData::InitTokens()
{
OUString aSub(p0, nLen);
OUString aUpStr = ScGlobal::pCharClass->uppercase(aSub);
- maSubStrings.push_back(new SubStr(aSub, aUpStr));
+ maSubStrings.push_back(SubStr(aSub, aUpStr));
}
}
commit 1740d0b2bec4c899af825739a8ca996785b5b525
Author: Noel Grandin <noel at peralex.com>
Date: Thu Nov 12 14:14:17 2015 +0200
sc: boost::ptr_vector->std::vector<std::unique_ptr>
Change-Id: I2d8ffd3f11d7c5295fa3c5725edf2cd871197a26
diff --git a/sc/source/filter/excel/xilink.cxx b/sc/source/filter/excel/xilink.cxx
index ac23113..6c21237 100644
--- a/sc/source/filter/excel/xilink.cxx
+++ b/sc/source/filter/excel/xilink.cxx
@@ -30,11 +30,10 @@
#include "externalrefmgr.hxx"
#include "scmatrix.hxx"
#include <svl/sharedstringpool.hxx>
+#include <o3tl/make_unique.hxx>
#include <vector>
-#include <boost/ptr_container/ptr_vector.hpp>
-
-using ::std::vector;
+#include <memory>
// *** Helper classes ***
@@ -124,8 +123,8 @@ public:
svl::SharedStringPool& GetSharedStringPool();
private:
- typedef boost::ptr_vector< XclImpSupbookTab > XclImpSupbookTabList;
- typedef boost::ptr_vector< XclImpExtName > XclImpExtNameList;
+ typedef std::vector< std::unique_ptr<XclImpSupbookTab> > XclImpSupbookTabList;
+ typedef std::vector< std::unique_ptr<XclImpExtName> > XclImpExtNameList;
XclImpSupbookTabList maSupbTabList; /// All sheet names of the document.
XclImpExtNameList maExtNameList; /// All external names of the document.
@@ -205,8 +204,8 @@ private:
void LoadCachedValues();
private:
- typedef ::std::vector< XclImpXti > XclImpXtiVector;
- typedef boost::ptr_vector< XclImpSupbook > XclImpSupbookList;
+ typedef std::vector< XclImpXti > XclImpXtiVector;
+ typedef std::vector< std::unique_ptr<XclImpSupbook> > XclImpSupbookList;
XclImpXtiVector maXtiList; /// List of all XTI structures.
XclImpSupbookList maSupbookList; /// List of external documents.
@@ -382,7 +381,7 @@ XclImpExtName::XclImpExtName( XclImpSupbook& rSupbook, XclImpStream& rStrm, XclS
const ScTokenArray* pArray = nullptr;
sal_uInt16 nFmlaLen;
nFmlaLen = rStrm.ReaduInt16();
- vector<OUString> aTabNames;
+ std::vector<OUString> aTabNames;
sal_uInt16 nCount = rSupbook.GetTabCount();
aTabNames.reserve(nCount);
for (sal_uInt16 i = 0; i < nCount; ++i)
@@ -645,7 +644,7 @@ XclImpSupbook::XclImpSupbook( XclImpStream& rStrm ) :
if( maXclUrl.equalsIgnoreAsciiCase( "\010EUROTOOL.XLA" ) )
{
meType = EXC_SBTYPE_EUROTOOL;
- maSupbTabList.push_back( new XclImpSupbookTab( maXclUrl ) );
+ maSupbTabList.push_back( o3tl::make_unique<XclImpSupbookTab>( maXclUrl ) );
}
else if( nSBTabCnt )
{
@@ -664,14 +663,14 @@ XclImpSupbook::XclImpSupbook( XclImpStream& rStrm ) :
for( sal_uInt16 nSBTab = 0; nSBTab < nSBTabCnt; ++nSBTab )
{
OUString aTabName( rStrm.ReadUniString() );
- maSupbTabList.push_back( new XclImpSupbookTab( aTabName ) );
+ maSupbTabList.push_back( o3tl::make_unique<XclImpSupbookTab>( aTabName ) );
}
}
else
{
meType = EXC_SBTYPE_SPECIAL;
// create dummy list entry
- maSupbTabList.push_back( new XclImpSupbookTab( maXclUrl ) );
+ maSupbTabList.push_back( o3tl::make_unique<XclImpSupbookTab>( maXclUrl ) );
}
}
@@ -685,7 +684,7 @@ void XclImpSupbook::ReadCrn( XclImpStream& rStrm )
{
if (mnSBTab >= maSupbTabList.size())
return;
- XclImpSupbookTab& rSbTab = maSupbTabList[mnSBTab];
+ XclImpSupbookTab& rSbTab = *maSupbTabList[mnSBTab].get();
sal_uInt8 nXclColLast, nXclColFirst;
sal_uInt16 nXclRow;
nXclColLast = rStrm.ReaduInt8();
@@ -698,7 +697,7 @@ void XclImpSupbook::ReadCrn( XclImpStream& rStrm )
void XclImpSupbook::ReadExternname( XclImpStream& rStrm, ExcelToSc* pFormulaConv )
{
- maExtNameList.push_back( new XclImpExtName( *this, rStrm, meType, pFormulaConv ) );
+ maExtNameList.push_back( o3tl::make_unique<XclImpExtName>( *this, rStrm, meType, pFormulaConv ) );
}
const XclImpExtName* XclImpSupbook::GetExternName( sal_uInt16 nXclIndex ) const
@@ -710,7 +709,7 @@ const XclImpExtName* XclImpSupbook::GetExternName( sal_uInt16 nXclIndex ) const
}
if (meType == EXC_SBTYPE_SELF || nXclIndex > maExtNameList.size())
return nullptr;
- return &maExtNameList[nXclIndex-1];
+ return maExtNameList[nXclIndex-1].get();
}
bool XclImpSupbook::GetLinkData( OUString& rApplic, OUString& rTopic ) const
@@ -729,7 +728,7 @@ const OUString& XclImpSupbook::GetTabName( sal_uInt16 nXtiTab ) const
{
if (nXtiTab >= maSupbTabList.size())
return EMPTY_OUSTRING;
- return maSupbTabList[nXtiTab].GetTabName();
+ return maSupbTabList[nXtiTab]->GetTabName();
}
sal_uInt16 XclImpSupbook::GetTabCount() const
@@ -749,9 +748,9 @@ void XclImpSupbook::LoadCachedValues()
for (XclImpSupbookTabList::iterator itTab = maSupbTabList.begin(); itTab != maSupbTabList.end(); ++itTab)
{
- const OUString& rTabName = itTab->GetTabName();
+ const OUString& rTabName = (*itTab)->GetTabName();
ScExternalRefCache::TableTypeRef pCacheTable = pRefMgr->getCacheTable(nFileId, rTabName, true);
- itTab->LoadCachedValues(pCacheTable);
+ (*itTab)->LoadCachedValues(pCacheTable);
pCacheTable->setWholeTableCached();
}
}
@@ -789,25 +788,25 @@ void XclImpLinkManagerImpl::ReadExternsheet( XclImpStream& rStrm )
void XclImpLinkManagerImpl::ReadSupbook( XclImpStream& rStrm )
{
- maSupbookList.push_back( new XclImpSupbook( rStrm ) );
+ maSupbookList.push_back( o3tl::make_unique<XclImpSupbook>( rStrm ) );
}
void XclImpLinkManagerImpl::ReadXct( XclImpStream& rStrm )
{
if( !maSupbookList.empty() )
- maSupbookList.back().ReadXct( rStrm );
+ maSupbookList.back()->ReadXct( rStrm );
}
void XclImpLinkManagerImpl::ReadCrn( XclImpStream& rStrm )
{
if( !maSupbookList.empty() )
- maSupbookList.back().ReadCrn( rStrm );
+ maSupbookList.back()->ReadCrn( rStrm );
}
void XclImpLinkManagerImpl::ReadExternname( XclImpStream& rStrm, ExcelToSc* pFormulaConv )
{
if( !maSupbookList.empty() )
- maSupbookList.back().ReadExternname( rStrm, pFormulaConv );
+ maSupbookList.back()->ReadExternname( rStrm, pFormulaConv );
}
bool XclImpLinkManagerImpl::IsSelfRef( sal_uInt16 nXtiIndex ) const
@@ -875,7 +874,7 @@ const XclImpSupbook* XclImpLinkManagerImpl::GetSupbook( sal_uInt16 nXtiIndex ) c
const XclImpXti* pXti = GetXti( nXtiIndex );
if (!pXti || pXti->mnSupbook >= maSupbookList.size())
return nullptr;
- return &(maSupbookList.at( pXti->mnSupbook ));
+ return maSupbookList.at( pXti->mnSupbook ).get();
}
void XclImpLinkManagerImpl::LoadCachedValues()
@@ -883,7 +882,7 @@ void XclImpLinkManagerImpl::LoadCachedValues()
// Read all CRN records which can be accessed via XclImpSupbook, and store
// the cached values to the external reference manager.
for (XclImpSupbookList::iterator itSupbook = maSupbookList.begin(); itSupbook != maSupbookList.end(); ++itSupbook)
- itSupbook->LoadCachedValues();
+ (*itSupbook)->LoadCachedValues();
}
XclImpLinkManager::XclImpLinkManager( const XclImpRoot& rRoot ) :
commit 0f611e670a36d22c66d91ee309eccac1ea65e0e9
Author: Noel Grandin <noel at peralex.com>
Date: Thu Nov 12 14:04:14 2015 +0200
sc: boost::ptr_vector->std::vector<std::unique_ptr>
Change-Id: Ie5d21180d49a7d82d4cc1f5b9a71152bb86d0555
diff --git a/sc/source/filter/inc/condformatbuffer.hxx b/sc/source/filter/inc/condformatbuffer.hxx
index b2dd6c1..ccb498c 100644
--- a/sc/source/filter/inc/condformatbuffer.hxx
+++ b/sc/source/filter/inc/condformatbuffer.hxx
@@ -26,8 +26,7 @@
#include "rangelst.hxx"
#include <memory>
-
-#include <boost/ptr_container/ptr_vector.hpp>
+#include <vector>
class ScColorScaleFormat;
class ScDataBarFormat;
@@ -293,7 +292,7 @@ public:
/** Imports settings from the CONDFORMATTING record. */
CondFormatRef importCondFormatting( SequenceInputStream& rStrm );
ExtCfDataBarRuleRef createExtCfDataBarRule(ScDataBarFormatData* pTarget);
- boost::ptr_vector<ExtCfCondFormat>& importExtCondFormat();
+ std::vector< std::unique_ptr<ExtCfCondFormat> >& importExtCondFormat();
/** Converts an OOXML condition operator token to the API constant. */
static sal_Int32 convertToApiOperator( sal_Int32 nToken );
@@ -307,7 +306,7 @@ private:
typedef RefVector< ExtCfDataBarRule > ExtCfDataBarRuleVec;
CondFormatVec maCondFormats; /// All conditional formatting in a sheet.
ExtCfDataBarRuleVec maCfRules; /// All external conditional formatting rules in a sheet.
- boost::ptr_vector<ExtCfCondFormat> maExtCondFormats;
+ std::vector< std::unique_ptr<ExtCfCondFormat> > maExtCondFormats;
};
} // namespace xls
diff --git a/sc/source/filter/oox/condformatbuffer.cxx b/sc/source/filter/oox/condformatbuffer.cxx
index 87d8b97..4ab87ed 100644
--- a/sc/source/filter/oox/condformatbuffer.cxx
+++ b/sc/source/filter/oox/condformatbuffer.cxx
@@ -1147,7 +1147,7 @@ void CondFormatBuffer::finalizeImport()
{
ScDocument* pDoc = &getScDocument();
- const ScRangeList& rRange = itr->getRange();
+ const ScRangeList& rRange = (*itr)->getRange();
SCTAB nTab = rRange.front()->aStart.Tab();
ScConditionalFormat* pFormat = findFormatByRange(rRange, pDoc, nTab);
if (!pFormat)
@@ -1159,7 +1159,7 @@ void CondFormatBuffer::finalizeImport()
pDoc->AddCondFormatData(rRange, nTab, nKey);
}
- const std::vector< std::unique_ptr<ScFormatEntry> >& rEntries = itr->getEntries();
+ const std::vector< std::unique_ptr<ScFormatEntry> >& rEntries = (*itr)->getEntries();
for (auto i = rEntries.begin(); i != rEntries.end(); ++i)
{
pFormat->AddEntry((*i)->Clone(pDoc));
@@ -1181,7 +1181,7 @@ ExtCfDataBarRuleRef CondFormatBuffer::createExtCfDataBarRule(ScDataBarFormatData
return extRule;
}
-boost::ptr_vector<ExtCfCondFormat>& CondFormatBuffer::importExtCondFormat()
+std::vector< std::unique_ptr<ExtCfCondFormat> >& CondFormatBuffer::importExtCondFormat()
{
return maExtCondFormats;
}
diff --git a/sc/source/filter/oox/extlstcontext.cxx b/sc/source/filter/oox/extlstcontext.cxx
index 852ba78..1739bcb 100644
--- a/sc/source/filter/oox/extlstcontext.cxx
+++ b/sc/source/filter/oox/extlstcontext.cxx
@@ -163,8 +163,8 @@ void ExtConditionalFormattingContext::onEndElement()
aRange[i]->aEnd.SetTab(nTab);
}
- boost::ptr_vector<ExtCfCondFormat>& rExtFormats = getCondFormats().importExtCondFormat();
- rExtFormats.push_back(new ExtCfCondFormat(aRange, maEntries));
+ std::vector< std::unique_ptr<ExtCfCondFormat> >& rExtFormats = getCondFormats().importExtCondFormat();
+ rExtFormats.push_back(o3tl::make_unique<ExtCfCondFormat>(aRange, maEntries));
}
break;
case XLS14_TOKEN(cfRule):
commit 9265f9bd35ff6ef0e4ab285dd9fecebce6976e8d
Author: Noel Grandin <noel at peralex.com>
Date: Thu Nov 12 14:01:03 2015 +0200
sc: boost::ptr_vector->std::vector<std::unique_ptr>
Change-Id: I4c1d48b93ebb50aead0ee263a13e42e66eb714da
diff --git a/sc/source/filter/html/htmlpars.cxx b/sc/source/filter/html/htmlpars.cxx
index c5dad93..a59c4e3 100644
--- a/sc/source/filter/html/htmlpars.cxx
+++ b/sc/source/filter/html/htmlpars.cxx
@@ -66,6 +66,7 @@
#include <com/sun/star/document/XDocumentProperties.hpp>
#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
#include <utility>
+#include <o3tl/make_unique.hxx>
using ::editeng::SvxBorderLine;
using namespace ::com::sun::star;
@@ -1331,8 +1332,8 @@ void ScHTMLLayoutParser::TableOff( ImportInfo* pInfo )
void ScHTMLLayoutParser::Image( ImportInfo* pInfo )
{
- ScHTMLImage* pImage = new ScHTMLImage;
- pActEntry->maImageList.push_back( pImage );
+ pActEntry->maImageList.push_back( o3tl::make_unique<ScHTMLImage>() );
+ ScHTMLImage* pImage = pActEntry->maImageList.back().get();
const HTMLOptions& rOptions = static_cast<HTMLParser*>(pInfo->pParser)->GetOptions();
for (size_t i = 0, n = rOptions.size(); i < n; ++i)
{
@@ -1410,7 +1411,7 @@ void ScHTMLLayoutParser::Image( ImportInfo* pInfo )
long nWidth = 0;
for ( size_t i=0; i < pActEntry->maImageList.size(); ++i )
{
- ScHTMLImage* pI = &pActEntry->maImageList[ i ];
+ ScHTMLImage* pI = pActEntry->maImageList[ i ].get();
if ( pI->nDir & nHorizontal )
nWidth += pI->aSize.Width() + 2 * pI->aSpace.X();
else
@@ -1419,7 +1420,7 @@ void ScHTMLLayoutParser::Image( ImportInfo* pInfo )
if ( pActEntry->nWidth
&& (nWidth + pImage->aSize.Width() + 2 * pImage->aSpace.X()
>= pActEntry->nWidth) )
- pActEntry->maImageList.back().nDir = nVertical;
+ pActEntry->maImageList.back()->nDir = nVertical;
}
}
@@ -1628,7 +1629,7 @@ void ScHTMLLayoutParser::ProcToken( ImportInfo* pInfo )
case HTML_PARABREAK_OFF:
{ // We continue vertically after an image
if ( pActEntry->maImageList.size() > 0 )
- pActEntry->maImageList.back().nDir = nVertical;
+ pActEntry->maImageList.back()->nDir = nVertical;
}
break;
case HTML_ANCHOR_ON:
diff --git a/sc/source/filter/inc/eeparser.hxx b/sc/source/filter/inc/eeparser.hxx
index ec2b45b..ba25d61 100644
--- a/sc/source/filter/inc/eeparser.hxx
+++ b/sc/source/filter/inc/eeparser.hxx
@@ -25,7 +25,7 @@
#include <svl/itemset.hxx>
#include <editeng/editdata.hxx>
#include <address.hxx>
-#include <boost/ptr_container/ptr_vector.hpp>
+#include <memory>
#include <vector>
const sal_Char nHorizontal = 1;
@@ -34,10 +34,10 @@ const sal_Char nHoriVerti = nHorizontal | nVertical;
struct ScHTMLImage
{
- OUString aURL;
+ OUString aURL;
Size aSize;
Point aSpace;
- OUString aFilterName;
+ OUString aFilterName;
Graphic* pGraphic; // wird von WriteToDocument uebernommen
sal_Char nDir; // 1==hori, 2==verti, 3==beides
@@ -53,11 +53,11 @@ struct ScEEParseEntry
{
SfxItemSet aItemSet;
ESelection aSel; // Selection in EditEngine
- OUString* pValStr; // HTML evtl. SDVAL String
- OUString* pNumStr; // HTML evtl. SDNUM String
- OUString* pName; // HTML evtl. Anchor/RangeName
- OUString aAltText; // HTML IMG ALT Text
- boost::ptr_vector< ScHTMLImage > maImageList; // Grafiken in dieser Zelle
+ OUString* pValStr; // HTML evtl. SDVAL String
+ OUString* pNumStr; // HTML evtl. SDNUM String
+ OUString* pName; // HTML evtl. Anchor/RangeName
+ OUString aAltText; // HTML IMG ALT Text
+ std::vector< std::unique_ptr<ScHTMLImage> > maImageList; // Grafiken in dieser Zelle
SCCOL nCol; // relativ zum Beginn des Parse
SCROW nRow;
sal_uInt16 nTab; // HTML TableInTable
diff --git a/sc/source/filter/rtf/eeimpars.cxx b/sc/source/filter/rtf/eeimpars.cxx
index 2b91ff2..e31c215 100644
--- a/sc/source/filter/rtf/eeimpars.cxx
+++ b/sc/source/filter/rtf/eeimpars.cxx
@@ -478,7 +478,7 @@ bool ScEEImport::GraphicSize( SCCOL nCol, SCROW nRow, SCTAB /*nTab*/, ScEEParseE
sal_Char nDir = nHorizontal;
for ( size_t i = 0; i < pE->maImageList.size() ; ++i )
{
- ScHTMLImage* pI = &pE->maImageList[ i ];
+ ScHTMLImage* pI = pE->maImageList[ i ].get();
if ( pI->pGraphic )
bHasGraphics = true;
Size aSizePix = pI->aSize;
@@ -554,7 +554,7 @@ void ScEEImport::InsertGraphic( SCCOL nCol, SCROW nRow, SCTAB nTab,
sal_Char nDir = nHorizontal;
for ( size_t i = 0; i < pE->maImageList.size(); ++i )
{
- ScHTMLImage* pI = &pE->maImageList[ i ];
+ ScHTMLImage* pI = pE->maImageList[ i ].get();
if ( nDir & nHorizontal )
{ // Horizontal
aInsertPos.X() += aLogicSize.Width();
commit 83a58be116762abeab4ec3a90b8aafa076484b4a
Author: Noel Grandin <noel at peralex.com>
Date: Thu Nov 12 13:57:01 2015 +0200
sc: boost::ptr_vector->std::vector
Change-Id: If3fff7cec768be9ce4cad6064415c1739433e030
diff --git a/sc/source/filter/dif/difimp.cxx b/sc/source/filter/dif/difimp.cxx
index e9775a8..1dd10d6 100644
--- a/sc/source/filter/dif/difimp.cxx
+++ b/sc/source/filter/dif/difimp.cxx
@@ -807,7 +807,7 @@ bool DifParser::ScanFloatVal( const sal_Unicode* pStart )
}
DifColumn::DifColumn ()
- : pAkt(nullptr)
+ : mpAkt(nullptr)
{
}
@@ -815,23 +815,22 @@ void DifColumn::SetLogical( SCROW nRow )
{
OSL_ENSURE( ValidRow(nRow), "*DifColumn::SetLogical(): Row too big!" );
- if( pAkt )
+ if( mpAkt )
{
OSL_ENSURE( nRow > 0, "*DifColumn::SetLogical(): more cannot be zero!" );
nRow--;
- if( pAkt->nEnd == nRow )
- pAkt->nEnd++;
+ if( mpAkt->nEnd == nRow )
+ mpAkt->nEnd++;
else
- pAkt = nullptr;
+ mpAkt = nullptr;
}
else
{
- pAkt = new ENTRY;
- pAkt->nStart = pAkt->nEnd = nRow;
-
- aEntries.push_back(pAkt);
+ maEntries.push_back(ENTRY());
+ mpAkt = &maEntries.back();
+ mpAkt->nStart = mpAkt->nEnd = nRow;
}
}
@@ -841,15 +840,15 @@ void DifColumn::SetNumFormat( SCROW nRow, const sal_uInt32 nNumFormat )
if( nNumFormat > 0 )
{
- if(pAkt)
+ if(mpAkt)
{
OSL_ENSURE( nRow > 0,
"*DifColumn::SetNumFormat(): more cannot be zero!" );
- OSL_ENSURE( nRow > pAkt->nEnd,
+ OSL_ENSURE( nRow > mpAkt->nEnd,
"*DifColumn::SetNumFormat(): start from scratch?" );
- if( pAkt->nNumFormat == nNumFormat && pAkt->nEnd == nRow - 1 )
- pAkt->nEnd = nRow;
+ if( mpAkt->nNumFormat == nNumFormat && mpAkt->nEnd == nRow - 1 )
+ mpAkt->nEnd = nRow;
else
NewEntry( nRow, nNumFormat );
}
@@ -857,21 +856,21 @@ void DifColumn::SetNumFormat( SCROW nRow, const sal_uInt32 nNumFormat )
NewEntry(nRow,nNumFormat );
}
else
- pAkt = nullptr;
+ mpAkt = nullptr;
}
void DifColumn::NewEntry( const SCROW nPos, const sal_uInt32 nNumFormat )
{
- pAkt = new ENTRY;
- pAkt->nStart = pAkt->nEnd = nPos;
- pAkt->nNumFormat = nNumFormat;
+ maEntries.push_back(ENTRY());
+ mpAkt = &maEntries.back();
+ mpAkt->nStart = mpAkt->nEnd = nPos;
+ mpAkt->nNumFormat = nNumFormat;
- aEntries.push_back(pAkt);
}
void DifColumn::Apply( ScDocument& rDoc, const SCCOL nCol, const SCTAB nTab, const ScPatternAttr& rPattAttr )
{
- for (boost::ptr_vector<ENTRY>::const_iterator it = aEntries.begin(); it != aEntries.end(); ++it)
+ for (std::vector<ENTRY>::const_iterator it = maEntries.begin(); it != maEntries.end(); ++it)
rDoc.ApplyPatternAreaTab( nCol, it->nStart, nCol, it->nEnd, nTab, rPattAttr );
}
@@ -880,7 +879,7 @@ void DifColumn::Apply( ScDocument& rDoc, const SCCOL nCol, const SCTAB nTab )
ScPatternAttr aAttr( rDoc.GetPool() );
SfxItemSet &rItemSet = aAttr.GetItemSet();
- for (boost::ptr_vector<ENTRY>::const_iterator it = aEntries.begin(); it != aEntries.end(); ++it)
+ for (std::vector<ENTRY>::const_iterator it = maEntries.begin(); it != maEntries.end(); ++it)
{
OSL_ENSURE( it->nNumFormat > 0,
"+DifColumn::Apply(): Number format must not be 0!" );
diff --git a/sc/source/filter/inc/dif.hxx b/sc/source/filter/inc/dif.hxx
index 2963e7d..0dd1551 100644
--- a/sc/source/filter/inc/dif.hxx
+++ b/sc/source/filter/inc/dif.hxx
@@ -20,7 +20,7 @@
#ifndef INCLUDED_SC_SOURCE_FILTER_INC_DIF_HXX
#define INCLUDED_SC_SOURCE_FILTER_INC_DIF_HXX
-#include <boost/ptr_container/ptr_vector.hpp>
+#include <vector>
#include <rtl/ustring.hxx>
@@ -153,8 +153,8 @@ class DifColumn
SCROW nEnd;
};
- ENTRY *pAkt;
- boost::ptr_vector<ENTRY> aEntries;
+ ENTRY *mpAkt;
+ std::vector<ENTRY> maEntries;
DifColumn();
commit 16877ccbd2dc227ab25f19914b9d453a082e405b
Author: Noel Grandin <noel at peralex.com>
Date: Thu Nov 12 13:51:54 2015 +0200
sc: boost::ptr_vector->std::vector<std::unique_ptr>
and remove some unnecessary usage of dynamic allocation of OUString
Change-Id: I6eb49a0733928ba49ea48accd36fbaaa82b9d211
diff --git a/sc/source/filter/excel/excimp8.cxx b/sc/source/filter/excel/excimp8.cxx
index 171e076..8fcfcd3 100644
--- a/sc/source/filter/excel/excimp8.cxx
+++ b/sc/source/filter/excel/excimp8.cxx
@@ -104,6 +104,7 @@
#include <oox/ole/vbaproject.hxx>
#include <oox/ole/olestorage.hxx>
#include <unotools/streamwrap.hxx>
+#include <o3tl/make_unique.hxx>
using namespace com::sun::star;
using namespace ::comphelper;
@@ -279,7 +280,7 @@ void ImportExcel8::Scenman()
void ImportExcel8::Scenario()
{
- maScenList.aEntries.push_back( new ExcScenario( aIn, *pExcRoot ) );
+ maScenList.aEntries.push_back( o3tl::make_unique<ExcScenario>( aIn, *pExcRoot ) );
}
void ImportExcel8::Labelsst()
diff --git a/sc/source/filter/excel/exctools.cxx b/sc/source/filter/excel/exctools.cxx
index bc9d62b..ed14c51 100644
--- a/sc/source/filter/excel/exctools.cxx
+++ b/sc/source/filter/excel/exctools.cxx
@@ -188,60 +188,54 @@ ExcScenario::ExcScenario( XclImpStream& rIn, const RootData& rR )
rIn.Ignore( 1 ); // statt nUser!
if( nName )
- pName = new OUString( rIn.ReadUniString( nName ) );
+ aName = rIn.ReadUniString( nName );
else
{
- pName = new OUString( "Scenery" );
+ aName = "Scenery";
rIn.Ignore( 1 );
}
- pUserName = new OUString( rIn.ReadUniString() );
+ aUserName = rIn.ReadUniString();
if( nComment )
- pComment = new OUString( rIn.ReadUniString() );
+ aComment = rIn.ReadUniString();
else
- pComment = new OUString;
+ aComment;
sal_uInt16 n = nCref;
sal_uInt16 nC, nR;
+ aEntries.reserve(n);
while( n )
{
nR = rIn.ReaduInt16();
nC = rIn.ReaduInt16();
- aEntries.push_back(new ExcScenarioCell( nC, nR ));
+ aEntries.push_back(ExcScenarioCell( nC, nR ));
n--;
}
n = nCref;
- boost::ptr_vector<ExcScenarioCell>::iterator iter;
+ std::vector<ExcScenarioCell>::iterator iter;
for (iter = aEntries.begin(); iter != aEntries.end(); ++iter)
iter->SetValue(rIn.ReadUniString());
}
-ExcScenario::~ExcScenario()
-{
- delete pName;
- delete pComment;
- delete pUserName;
-}
-
void ExcScenario::Apply( const XclImpRoot& rRoot, const bool bLast )
{
ScDocument& r = rRoot.GetDoc();
- OUString aSzenName( *pName );
- sal_uInt16 nNewTab = nTab + 1;
+ OUString aSzenName( aName );
+ sal_uInt16 nNewTab = nTab + 1;
if( !r.InsertTab( nNewTab, aSzenName ) )
return;
r.SetScenario( nNewTab, true );
// do not show scenario frames
- r.SetScenarioData( nNewTab, *pComment, COL_LIGHTGRAY, /*SC_SCENARIO_SHOWFRAME|*/SC_SCENARIO_COPYALL|(nProtected ? SC_SCENARIO_PROTECT : 0) );
+ r.SetScenarioData( nNewTab, aComment, COL_LIGHTGRAY, /*SC_SCENARIO_SHOWFRAME|*/SC_SCENARIO_COPYALL|(nProtected ? SC_SCENARIO_PROTECT : 0) );
- boost::ptr_vector<ExcScenarioCell>::const_iterator iter;
+ std::vector<ExcScenarioCell>::const_iterator iter;
for (iter = aEntries.begin(); iter != aEntries.end(); ++iter)
{
sal_uInt16 nCol = iter->nCol;
@@ -268,11 +262,11 @@ void ExcScenarioList::Apply( const XclImpRoot& rRoot )
{
sal_uInt16 n = static_cast<sal_uInt16>(aEntries.size());
- boost::ptr_vector<ExcScenario>::reverse_iterator iter;
+ std::vector< std::unique_ptr<ExcScenario> >::reverse_iterator iter;
for (iter = aEntries.rbegin(); iter != aEntries.rend(); ++iter)
{
n--;
- iter->Apply(rRoot, n == nLastScenario);
+ (*iter)->Apply(rRoot, n == nLastScenario);
}
}
diff --git a/sc/source/filter/inc/excscen.hxx b/sc/source/filter/inc/excscen.hxx
index 667108b..6ac3256 100644
--- a/sc/source/filter/inc/excscen.hxx
+++ b/sc/source/filter/inc/excscen.hxx
@@ -20,7 +20,8 @@
#ifndef INCLUDED_SC_SOURCE_FILTER_INC_EXCSCEN_HXX
#define INCLUDED_SC_SOURCE_FILTER_INC_EXCSCEN_HXX
-#include <boost/ptr_container/ptr_vector.hpp>
+#include <vector>
+#include <memory>
#include <rtl/ustring.hxx>
struct RootData;
@@ -48,18 +49,16 @@ public:
ExcScenario( XclImpStream& rIn, const RootData& rRoot );
- ~ExcScenario();
-
void Apply( const XclImpRoot& rRoot, const bool bLast = false );
protected:
- OUString* pName;
- OUString* pComment;
- OUString* pUserName;
- sal_uInt8 nProtected;
+ OUString aName;
+ OUString aComment;
+ OUString aUserName;
+ sal_uInt8 nProtected;
const sal_uInt16 nTab;
- boost::ptr_vector<ExcScenarioCell> aEntries;
+ std::vector<ExcScenarioCell> aEntries;
};
struct ExcScenarioList
@@ -69,7 +68,7 @@ struct ExcScenarioList
void Apply( const XclImpRoot& rRoot );
sal_uInt16 nLastScenario;
- boost::ptr_vector<ExcScenario> aEntries;
+ std::vector< std::unique_ptr<ExcScenario> > aEntries;
};
#endif
commit 33bf2449730c796a41a25f9287aa40e51c2bc464
Author: Noel Grandin <noel at peralex.com>
Date: Thu Nov 12 12:57:34 2015 +0200
sc: boost::ptr_vector->std::vector<std::unique_ptr>
Change-Id: Ib53a084c16eaf0c7a44573ec8f4fabd782684b7c
diff --git a/sc/source/filter/inc/condformatbuffer.hxx b/sc/source/filter/inc/condformatbuffer.hxx
index d1b22e6..b2dd6c1 100644
--- a/sc/source/filter/inc/condformatbuffer.hxx
+++ b/sc/source/filter/inc/condformatbuffer.hxx
@@ -269,14 +269,14 @@ public:
class ExtCfCondFormat
{
public:
- ExtCfCondFormat(const ScRangeList& aRange, boost::ptr_vector<ScFormatEntry>& rEntries);
+ ExtCfCondFormat(const ScRangeList& aRange, std::vector< std::unique_ptr<ScFormatEntry> >& rEntries);
~ExtCfCondFormat();
const ScRangeList& getRange();
- const boost::ptr_vector<ScFormatEntry>& getEntries();
+ const std::vector< std::unique_ptr<ScFormatEntry> >& getEntries();
private:
- boost::ptr_vector<ScFormatEntry> maEntries;
+ std::vector< std::unique_ptr<ScFormatEntry> > maEntries;
ScRangeList maRange;
};
diff --git a/sc/source/filter/inc/extlstcontext.hxx b/sc/source/filter/inc/extlstcontext.hxx
index 51fd498..fc2e6af 100644
--- a/sc/source/filter/inc/extlstcontext.hxx
+++ b/sc/source/filter/inc/extlstcontext.hxx
@@ -14,7 +14,8 @@
#include "worksheetfragment.hxx"
#include "workbookfragment.hxx"
-#include <boost/ptr_container/ptr_vector.hpp>
+#include <vector>
+#include <memory>
struct ScDataBarFormatData;
class ScFormatEntry;
@@ -50,7 +51,7 @@ public:
private:
OUString aChars;
- boost::ptr_vector<ScFormatEntry> maEntries;
+ std::vector<std::unique_ptr<ScFormatEntry> > maEntries;
IconSetRule* mpCurrentRule;
};
diff --git a/sc/source/filter/oox/condformatbuffer.cxx b/sc/source/filter/oox/condformatbuffer.cxx
index df133a4..87d8b97 100644
--- a/sc/source/filter/oox/condformatbuffer.cxx
+++ b/sc/source/filter/oox/condformatbuffer.cxx
@@ -1159,10 +1159,10 @@ void CondFormatBuffer::finalizeImport()
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)
{
- pFormat->AddEntry(i->Clone(pDoc));
+ pFormat->AddEntry((*i)->Clone(pDoc));
}
}
}
@@ -1328,10 +1328,10 @@ void ExtCfDataBarRule::importCfvo( const AttributeList& rAttribs )
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)
{
- maEntries.transfer(maEntries.begin(), rEntries.begin(), rEntries.end(), rEntries);
+ maEntries.swap(rEntries);
}
ExtCfCondFormat::~ExtCfCondFormat()
@@ -1343,7 +1343,7 @@ const ScRangeList& ExtCfCondFormat::getRange()
return maRange;
}
-const boost::ptr_vector<ScFormatEntry>& ExtCfCondFormat::getEntries()
+const std::vector< std::unique_ptr<ScFormatEntry> >& ExtCfCondFormat::getEntries()
{
return maEntries;
}
diff --git a/sc/source/filter/oox/extlstcontext.cxx b/sc/source/filter/oox/extlstcontext.cxx
index b7ff5de..852ba78 100644
--- a/sc/source/filter/oox/extlstcontext.cxx
+++ b/sc/source/filter/oox/extlstcontext.cxx
@@ -16,6 +16,7 @@
#include "document.hxx"
#include "rangeutl.hxx"
+#include <o3tl/make_unique.hxx>
using ::oox::core::ContextHandlerRef;
@@ -79,7 +80,7 @@ ContextHandlerRef ExtConditionalFormattingContext::onCreateContext(sal_Int32 nEl
{
if (mpCurrentRule)
{
- ScFormatEntry& rFormat = *maEntries.rbegin();
+ ScFormatEntry& rFormat = *maEntries.rbegin()->get();
assert(rFormat.GetType() == condformat::ICONSET);
ScIconSetFormat& rIconSet = static_cast<ScIconSetFormat&>(rFormat);
ScDocument* pDoc = &getScDocument();
@@ -111,8 +112,7 @@ ContextHandlerRef ExtConditionalFormattingContext::onCreateContext(sal_Int32 nEl
{
ScDocument* pDoc = &getScDocument();
mpCurrentRule = new IconSetRule(*this);
- ScIconSetFormat* pIconSet = new ScIconSetFormat(pDoc);
- maEntries.push_back(pIconSet);
+ maEntries.push_back(o3tl::make_unique<ScIconSetFormat>(pDoc));
return new IconSetContext(*this, mpCurrentRule);
}
else
commit 6618e503b3f6acf282c0c97150f591e643f8db8b
Author: Noel Grandin <noel at peralex.com>
Date: Thu Nov 12 12:49:26 2015 +0200
sc: boost::ptr_vector->std::vector<std::unique_ptr>
Change-Id: I253d36fba39b7022da7b4612881fcf5758bfd820
diff --git a/sc/source/filter/ftools/fprogressbar.cxx b/sc/source/filter/ftools/fprogressbar.cxx
index 84deda9..932444f 100644
--- a/sc/source/filter/ftools/fprogressbar.cxx
+++ b/sc/source/filter/ftools/fprogressbar.cxx
@@ -21,6 +21,7 @@
#include "global.hxx"
#include "progress.hxx"
#include <osl/diagnose.h>
+#include <o3tl/make_unique.hxx>
ScfProgressBar::ScfProgressSegment::ScfProgressSegment( sal_Size nSize ) :
mnSize( nSize ),
@@ -69,7 +70,7 @@ ScfProgressBar::ScfProgressSegment* ScfProgressBar::GetSegment( sal_Int32 nSegme
{
if( nSegment < 0 )
return nullptr;
- return &(maSegments.at( nSegment ));
+ return maSegments.at( nSegment ).get();
}
void ScfProgressBar::SetCurrSegment( ScfProgressSegment* pSegment )
@@ -139,7 +140,7 @@ sal_Int32 ScfProgressBar::AddSegment( sal_Size nSize )
if( nSize == 0 )
return SCF_INV_SEGMENT;
- maSegments.push_back( new ScfProgressSegment( nSize ) );
+ maSegments.push_back( o3tl::make_unique<ScfProgressSegment>( nSize ) );
mnTotalSize += nSize;
return static_cast< sal_Int32 >( maSegments.size() - 1 );
}
diff --git a/sc/source/filter/inc/fprogressbar.hxx b/sc/source/filter/inc/fprogressbar.hxx
index 0344289..03bceec 100644
--- a/sc/source/filter/inc/fprogressbar.hxx
+++ b/sc/source/filter/inc/fprogressbar.hxx
@@ -21,7 +21,8 @@
#define INCLUDED_SC_SOURCE_FILTER_INC_FPROGRESSBAR_HXX
#include <boost/noncopyable.hpp>
-#include <boost/ptr_container/ptr_vector.hpp>
+#include <vector>
+#include <memory>
#include "globstr.hrc"
#include "ftools.hxx"
#include "scdllapi.h"
@@ -161,7 +162,7 @@ private:
};
typedef ::std::unique_ptr< ScProgress > ScProgressPtr;
- typedef boost::ptr_vector< ScfProgressSegment > ScfSegmentList;
+ typedef std::vector< std::unique_ptr<ScfProgressSegment> > ScfSegmentList;
ScfSegmentList maSegments; /// List of progress segments.
OUString maText; /// UI string for system progress.
commit 6f6668c1f28ddb42b940c56f7fa24c37fd2e1850
Author: Noel Grandin <noel at peralex.com>
Date: Thu Nov 12 12:45:48 2015 +0200
sc: boost::ptr_vector->std::vector
Change-Id: I667ffd21cd4454538a38b19a0a0a69e811c5b54b
diff --git a/sc/source/filter/html/htmlexp2.cxx b/sc/source/filter/html/htmlexp2.cxx
index aa80aa2..aab92de 100644
--- a/sc/source/filter/html/htmlexp2.cxx
+++ b/sc/source/filter/html/htmlexp2.cxx
@@ -106,9 +106,8 @@ void ScHTMLExport::FillGraphList( const SdrPage* pPage, SCTAB nTab,
aSpace.Width() /= 2;
aSpace.Height() /= 2;
}
- ScHTMLGraphEntry* pE = new ScHTMLGraphEntry( pObject,
- aR, aSize, bInCell, aSpace );
- aGraphList.push_back( pE );
+ aGraphList.push_back( ScHTMLGraphEntry( pObject,
+ aR, aSize, bInCell, aSpace ) );
}
pObject = aIter.Next();
}
diff --git a/sc/source/filter/inc/htmlexp.hxx b/sc/source/filter/inc/htmlexp.hxx
index ea56fb5..48f7203 100644
--- a/sc/source/filter/inc/htmlexp.hxx
+++ b/sc/source/filter/inc/htmlexp.hxx
@@ -24,7 +24,7 @@
#include <rtl/textenc.h>
#include <tools/gen.hxx>
#include <tools/color.hxx>
-#include <boost/ptr_container/ptr_vector.hpp>
+#include <vector>
#include <memory>
#include "expbase.hxx"
@@ -102,7 +102,7 @@ class ScHTMLExport : public ScExportBase
static const sal_Char sIndentSource[];
typedef std::unique_ptr<std::map<OUString, OUString> > FileNameMapPtr;
- typedef boost::ptr_vector<ScHTMLGraphEntry> GraphEntryList;
+ typedef std::vector<ScHTMLGraphEntry> GraphEntryList;
GraphEntryList aGraphList;
ScHTMLStyle aHTMLStyle;
commit 438a3f77e3814f90e2e3727e6d482d66e3259d36
Author: Noel Grandin <noel at peralex.com>
Date: Thu Nov 12 12:42:49 2015 +0200
sc: boost::ptr_vector->std::vector<std::unique_ptr>
Change-Id: I07e0a63261eb988ec45ba0432079978e18d7cc38
diff --git a/sc/source/filter/excel/impop.cxx b/sc/source/filter/excel/impop.cxx
index 8e34342..1d24749 100644
--- a/sc/source/filter/excel/impop.cxx
+++ b/sc/source/filter/excel/impop.cxx
@@ -1228,7 +1228,7 @@ void ImportExcel::NewTable()
InitializeTable( nTab );
XclImpOutlineDataBuffer* pNewItem = new XclImpOutlineDataBuffer( GetRoot(), nTab );
- pOutlineListBuffer->push_back( pNewItem );
+ pOutlineListBuffer->push_back( std::unique_ptr<XclImpOutlineDataBuffer>(pNewItem) );
pExcRoot->pColRowBuff = pColRowBuff = pNewItem->GetColRowBuff();
pColOutlineBuff = pNewItem->GetColOutline();
pRowOutlineBuff = pNewItem->GetRowOutline();
@@ -1259,7 +1259,7 @@ void ImportExcel::PostDocLoad()
// outlines for all sheets, sets hidden rows and columns (#i11776# after filtered ranges)
for (XclImpOutlineListBuffer::iterator itBuffer = pOutlineListBuffer->begin(); itBuffer != pOutlineListBuffer->end(); ++itBuffer)
- itBuffer->Convert();
+ (*itBuffer)->Convert();
// document view settings (before visible OLE area)
GetDocViewSettings().Finalize();
diff --git a/sc/source/filter/inc/imp_op.hxx b/sc/source/filter/inc/imp_op.hxx
index df01115..e545533 100644
--- a/sc/source/filter/inc/imp_op.hxx
+++ b/sc/source/filter/inc/imp_op.hxx
@@ -32,7 +32,7 @@
#include "excdefs.hxx"
#include <rtl/ref.hxx>
-#include <boost/ptr_container/ptr_vector.hpp>
+#include <vector>
#include <memory>
#include <unordered_map>
@@ -107,7 +107,7 @@ protected:
XclImpOutlineBuffer* pRowOutlineBuff;
XclImpColRowSettings* pColRowBuff; // Col/Row settings 1 table
- typedef boost::ptr_vector< XclImpOutlineDataBuffer > XclImpOutlineListBuffer;
+ typedef std::vector< std::unique_ptr<XclImpOutlineDataBuffer> > XclImpOutlineListBuffer;
XclImpOutlineListBuffer* pOutlineListBuffer;
LastFormulaMapType maLastFormulaCells; // Keep track of last formula cells in each column.
commit b3206e487403ab0da089010b8a56fa6b5d9edd56
Author: Noel Grandin <noel at peralex.com>
Date: Thu Nov 12 12:40:46 2015 +0200
sc: boost::ptr_vector->std::vector<std::unique_ptr>
Change-Id: I96c7ac422e4e3414654aad257077aa8a7aecf28e
diff --git a/sc/source/filter/inc/lotattr.hxx b/sc/source/filter/inc/lotattr.hxx
index 8069ce3..455a509 100644
--- a/sc/source/filter/inc/lotattr.hxx
+++ b/sc/source/filter/inc/lotattr.hxx
@@ -20,7 +20,8 @@
#ifndef INCLUDED_SC_SOURCE_FILTER_INC_LOTATTR_HXX
#define INCLUDED_SC_SOURCE_FILTER_INC_LOTATTR_HXX
-#include <boost/ptr_container/ptr_vector.hpp>
+#include <vector>
+#include <memory>
#include "address.hxx"
#include "scitems.hxx"
@@ -100,7 +101,7 @@ private:
SvxColorItem* pBlack;
SvxColorItem* pWhite;
Color* pColTab;
- boost::ptr_vector<ENTRY> aEntries;
+ std::vector< std::unique_ptr<ENTRY> > aEntries;
LOTUS_ROOT* mpLotusRoot;
};
@@ -120,7 +121,7 @@ private:
SCROW nLastRow;
};
- boost::ptr_vector<ENTRY> aEntries;
+ std::vector< std::unique_ptr<ENTRY> > aEntries;
};
class LotAttrTable
diff --git a/sc/source/filter/lotus/lotattr.cxx b/sc/source/filter/lotus/lotattr.cxx
index 9444d9c..ee33bdb 100644
--- a/sc/source/filter/lotus/lotattr.cxx
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list