summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.com>2014-03-31 09:43:17 +0200
committerTomaž Vajngerl <tomaz.vajngerl@collabora.com>2014-03-31 09:44:45 +0200
commite75f8d8e059bc293625dfa34e15b68eb6d820ac4 (patch)
tree89fb7e2c1fd6d3c2eb1cbdd1efd3b32e5633c945 /sc
parent4f1f8b8e993b98095bf50c9e432fb0400d318b1f (diff)
sc: clean-up pivot.hxx/pivot2.cxx
Change-Id: I88ed4da8dd2ca026eeea4a3fb267f4f9954c180a
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/pivot.hxx93
-rw-r--r--sc/source/core/data/pivot2.cxx169
2 files changed, 135 insertions, 127 deletions
diff --git a/sc/inc/pivot.hxx b/sc/inc/pivot.hxx
index cd74a996e55f..37bca61af382 100644
--- a/sc/inc/pivot.hxx
+++ b/sc/inc/pivot.hxx
@@ -63,18 +63,18 @@ struct SC_DLLPUBLIC ScDPName
struct ScDPLabelData
{
- OUString maName; ///< Original name of the dimension.
- OUString maLayoutName; ///< Layout name (display name)
- OUString maSubtotalName;
- SCCOL mnCol; ///< 0-based field index (not the source column index)
- long mnOriginalDim; ///< original dimension index (>= 0 for duplicated dimension)
- sal_uInt16 mnFuncMask; ///< Page/Column/Row subtotal function.
- sal_Int32 mnUsedHier; ///< Used hierarchy.
- sal_Int32 mnFlags; ///< Flags from the DataPilotSource dimension
- sal_uInt8 mnDupCount;
- bool mbShowAll:1; ///< true = Show all (also empty) results.
- bool mbIsValue:1; ///< true = Sum or count in data field.
- bool mbDataLayout:1;
+ OUString maName; ///< Original name of the dimension.
+ OUString maLayoutName; ///< Layout name (display name)
+ OUString maSubtotalName;
+ SCCOL mnCol; ///< 0-based field index (not the source column index)
+ long mnOriginalDim; ///< original dimension index (>= 0 for duplicated dimension)
+ sal_uInt16 mnFuncMask; ///< Page/Column/Row subtotal function.
+ sal_Int32 mnUsedHier; ///< Used hierarchy.
+ sal_Int32 mnFlags; ///< Flags from the DataPilotSource dimension
+ sal_uInt8 mnDupCount;
+ bool mbShowAll:1; ///< true = Show all (also empty) results.
+ bool mbIsValue:1; ///< true = Sum or count in data field.
+ bool mbDataLayout:1;
struct Member
{
@@ -92,11 +92,11 @@ struct ScDPLabelData
*/
OUString SC_DLLPUBLIC getDisplayName() const;
};
- ::std::vector<Member> maMembers;
- ::com::sun::star::uno::Sequence< OUString > maHiers; ///< Hierarchies.
- ::com::sun::star::sheet::DataPilotFieldSortInfo maSortInfo; ///< Sorting info.
- ::com::sun::star::sheet::DataPilotFieldLayoutInfo maLayoutInfo; ///< Layout info.
- ::com::sun::star::sheet::DataPilotFieldAutoShowInfo maShowInfo; ///< AutoShow info.
+ std::vector<Member> maMembers;
+ css::uno::Sequence<OUString> maHiers; ///< Hierarchies.
+ css::sheet::DataPilotFieldSortInfo maSortInfo; ///< Sorting info.
+ css::sheet::DataPilotFieldLayoutInfo maLayoutInfo; ///< Layout info.
+ css::sheet::DataPilotFieldAutoShowInfo maShowInfo; ///< AutoShow info.
ScDPLabelData();
@@ -111,11 +111,12 @@ typedef boost::ptr_vector<ScDPLabelData> ScDPLabelDataVector;
struct ScPivotField
{
- SCCOL nCol; ///< 0-based dimension index (not source column index)
- long mnOriginalDim; ///< >= 0 for duplicated field.
- sal_uInt16 nFuncMask;
- sal_uInt8 mnDupCount;
- ::com::sun::star::sheet::DataPilotFieldReference maFieldRef;
+ SCCOL nCol; ///< 0-based dimension index (not source column index)
+ long mnOriginalDim; ///< >= 0 for duplicated field.
+ sal_uInt16 nFuncMask;
+ sal_uInt8 mnDupCount;
+
+ css::sheet::DataPilotFieldReference maFieldRef;
explicit ScPivotField( SCCOL nNewCol = 0, sal_uInt16 nNewFuncMask = PIVOT_FUNC_NONE );
ScPivotField( const ScPivotField& r );
@@ -124,44 +125,46 @@ struct ScPivotField
bool operator==( const ScPivotField& r ) const;
};
-typedef ::std::vector< ScPivotField > ScPivotFieldVector;
+typedef std::vector< ScPivotField > ScPivotFieldVector;
struct ScPivotParam
{
- SCCOL nCol; ///< Cursor Position /
- SCROW nRow; ///< or start of destination area
- SCTAB nTab;
+ SCCOL nCol; ///< Cursor Position /
+ SCROW nRow; ///< or start of destination area
+ SCTAB nTab;
+
ScDPLabelDataVector maLabelArray;
- ScPivotFieldVector maPageFields;
- ScPivotFieldVector maColFields;
- ScPivotFieldVector maRowFields;
- ScPivotFieldVector maDataFields;
- bool bIgnoreEmptyRows;
- bool bDetectCategories;
- bool bMakeTotalCol;
- bool bMakeTotalRow;
+ ScPivotFieldVector maPageFields;
+ ScPivotFieldVector maColFields;
+ ScPivotFieldVector maRowFields;
+ ScPivotFieldVector maDataFields;
+
+ bool bIgnoreEmptyRows;
+ bool bDetectCategories;
+ bool bMakeTotalCol;
+ bool bMakeTotalRow;
ScPivotParam();
ScPivotParam( const ScPivotParam& r );
~ScPivotParam();
- ScPivotParam& operator= ( const ScPivotParam& r );
- bool operator== ( const ScPivotParam& r ) const;
+ ScPivotParam& operator= ( const ScPivotParam& r );
+ bool operator== ( const ScPivotParam& r ) const;
void SetLabelData(const ScDPLabelDataVector& r);
};
struct ScPivotFuncData
{
- SCCOL mnCol;
- long mnOriginalDim;
- sal_uInt16 mnFuncMask;
- sal_uInt8 mnDupCount;
- ::com::sun::star::sheet::DataPilotFieldReference maFieldRef;
+ SCCOL mnCol;
+ long mnOriginalDim;
+ sal_uInt16 mnFuncMask;
+ sal_uInt8 mnDupCount;
+
+ css::sheet::DataPilotFieldReference maFieldRef;
explicit ScPivotFuncData( SCCOL nCol, sal_uInt16 nFuncMask );
- explicit ScPivotFuncData(
- SCCOL nCol, long nOriginalDim, sal_uInt16 nFuncMask, sal_uInt8 nDupCount,
- const ::com::sun::star::sheet::DataPilotFieldReference& rFieldRef );
+ explicit ScPivotFuncData( SCCOL nCol, long nOriginalDim, sal_uInt16 nFuncMask, sal_uInt8 nDupCount,
+ const css::sheet::DataPilotFieldReference& rFieldRef );
bool operator== (const ScPivotFuncData& r) const;
@@ -170,7 +173,7 @@ struct ScPivotFuncData
#endif
};
-typedef ::std::vector< ScPivotFuncData > ScPivotFuncDataVector;
+typedef std::vector<ScPivotFuncData> ScPivotFuncDataVector;
typedef std::vector<ScDPName> ScDPNameVec;
#endif
diff --git a/sc/source/core/data/pivot2.cxx b/sc/source/core/data/pivot2.cxx
index c740feab89be..24e46cd0a14b 100644
--- a/sc/source/core/data/pivot2.cxx
+++ b/sc/source/core/data/pivot2.cxx
@@ -43,10 +43,11 @@ using std::cout;
using std::endl;
#endif
-using ::com::sun::star::sheet::DataPilotFieldReference;
-using ::std::vector;
+using css::sheet::DataPilotFieldReference;
+using std::vector;
-namespace {
+namespace
+{
bool equals(const DataPilotFieldReference& left, const DataPilotFieldReference& right)
{
@@ -56,20 +57,23 @@ bool equals(const DataPilotFieldReference& left, const DataPilotFieldReference&
&& (left.ReferenceItemName == right.ReferenceItemName);
}
-}
+} // namespace
-ScDPName::ScDPName() : mnDupCount(0) {}
+// ScDPName
-ScDPName::ScDPName(const OUString& rName, const OUString& rLayoutName, sal_uInt8 nDupCount) :
- maName(rName), maLayoutName(rLayoutName), mnDupCount(nDupCount) {}
+ScDPName::ScDPName() : mnDupCount(0)
+{}
+ScDPName::ScDPName(const OUString& rName, const OUString& rLayoutName, sal_uInt8 nDupCount) :
+ maName(rName), maLayoutName(rLayoutName), mnDupCount(nDupCount)
+{}
+// ScDPLabelData
ScDPLabelData::Member::Member() :
mbVisible(true),
mbShowDetails(true)
-{
-}
+{}
OUString ScDPLabelData::Member::getDisplayName() const
{
@@ -89,8 +93,7 @@ ScDPLabelData::ScDPLabelData() :
mbShowAll(false),
mbIsValue(false),
mbDataLayout(false)
-{
-}
+{}
OUString ScDPLabelData::getDisplayName() const
{
@@ -100,20 +103,22 @@ OUString ScDPLabelData::getDisplayName() const
return maName;
}
+// ScPivotField
+
ScPivotField::ScPivotField(SCCOL nNewCol, sal_uInt16 nNewFuncMask) :
- nCol( nNewCol ),
+ nCol(nNewCol),
mnOriginalDim(-1),
- nFuncMask( nNewFuncMask ),
+ nFuncMask(nNewFuncMask),
mnDupCount(0)
-{
-}
+{}
-ScPivotField::ScPivotField( const ScPivotField& r ) :
- nCol(r.nCol),
- mnOriginalDim(r.mnOriginalDim),
- nFuncMask(r.nFuncMask),
- mnDupCount(r.mnDupCount),
- maFieldRef(r.maFieldRef) {}
+ScPivotField::ScPivotField( const ScPivotField& rPivotField ) :
+ nCol(rPivotField.nCol),
+ mnOriginalDim(rPivotField.mnOriginalDim),
+ nFuncMask(rPivotField.nFuncMask),
+ mnDupCount(rPivotField.mnDupCount),
+ maFieldRef(rPivotField.maFieldRef)
+{}
long ScPivotField::getOriginalDim() const
{
@@ -128,12 +133,13 @@ bool ScPivotField::operator==( const ScPivotField& r ) const
&& equals(maFieldRef, r.maFieldRef);
}
-ScPivotParam::ScPivotParam()
- : nCol(0), nRow(0), nTab(0),
- bIgnoreEmptyRows(false), bDetectCategories(false),
- bMakeTotalCol(true), bMakeTotalRow(true)
-{
-}
+// ScPivotParam
+
+ScPivotParam::ScPivotParam() :
+ nCol(0), nRow(0), nTab(0),
+ bIgnoreEmptyRows(false), bDetectCategories(false),
+ bMakeTotalCol(true), bMakeTotalRow(true)
+{}
ScPivotParam::ScPivotParam( const ScPivotParam& r )
: nCol( r.nCol ), nRow( r.nRow ), nTab( r.nTab ),
@@ -150,83 +156,84 @@ ScPivotParam::ScPivotParam( const ScPivotParam& r )
}
ScPivotParam::~ScPivotParam()
-{
-}
+{}
-void ScPivotParam::SetLabelData(const ScDPLabelDataVector& r)
+void ScPivotParam::SetLabelData(const ScDPLabelDataVector& rVector)
{
ScDPLabelDataVector aNewArray;
- aNewArray.reserve(r.size());
- for (ScDPLabelDataVector::const_iterator itr = r.begin(), itrEnd = r.end();
- itr != itrEnd; ++itr)
- aNewArray.push_back(new ScDPLabelData(*itr));
-
+ aNewArray.reserve(rVector.size());
+ ScDPLabelDataVector::const_iterator it;
+ for (it = rVector.begin(); it != rVector.end(); ++it)
+ {
+ aNewArray.push_back(new ScDPLabelData(*it));
+ }
maLabelArray.swap(aNewArray);
}
-ScPivotParam& ScPivotParam::operator=( const ScPivotParam& r )
+ScPivotParam& ScPivotParam::operator=( const ScPivotParam& rPivotParam )
{
- nCol = r.nCol;
- nRow = r.nRow;
- nTab = r.nTab;
- bIgnoreEmptyRows = r.bIgnoreEmptyRows;
- bDetectCategories = r.bDetectCategories;
- bMakeTotalCol = r.bMakeTotalCol;
- bMakeTotalRow = r.bMakeTotalRow;
-
- maPageFields = r.maPageFields;
- maColFields = r.maColFields;
- maRowFields = r.maRowFields;
- maDataFields = r.maDataFields;
- SetLabelData(r.maLabelArray);
+ nCol = rPivotParam.nCol;
+ nRow = rPivotParam.nRow;
+ nTab = rPivotParam.nTab;
+ bIgnoreEmptyRows = rPivotParam.bIgnoreEmptyRows;
+ bDetectCategories = rPivotParam.bDetectCategories;
+ bMakeTotalCol = rPivotParam.bMakeTotalCol;
+ bMakeTotalRow = rPivotParam.bMakeTotalRow;
+
+ maPageFields = rPivotParam.maPageFields;
+ maColFields = rPivotParam.maColFields;
+ maRowFields = rPivotParam.maRowFields;
+ maDataFields = rPivotParam.maDataFields;
+
+ SetLabelData(rPivotParam.maLabelArray);
return *this;
}
-bool ScPivotParam::operator==( const ScPivotParam& r ) const
-{
- bool bEqual = (nCol == r.nCol)
- && (nRow == r.nRow)
- && (nTab == r.nTab)
- && (bIgnoreEmptyRows == r.bIgnoreEmptyRows)
- && (bDetectCategories == r.bDetectCategories)
- && (bMakeTotalCol == r.bMakeTotalCol)
- && (bMakeTotalRow == r.bMakeTotalRow)
- && (maLabelArray.size() == r.maLabelArray.size())
- && maPageFields == r.maPageFields
- && maColFields == r.maColFields
- && maRowFields == r.maRowFields
- && maDataFields == r.maDataFields;
-
+bool ScPivotParam::operator==( const ScPivotParam& rPivotParam ) const
+{
+ bool bEqual = (nCol == rPivotParam.nCol &&
+ nRow == rPivotParam.nRow &&
+ nTab == rPivotParam.nTab &&
+ bIgnoreEmptyRows == rPivotParam.bIgnoreEmptyRows &&
+ bDetectCategories == rPivotParam.bDetectCategories &&
+ bMakeTotalCol == rPivotParam.bMakeTotalCol &&
+ bMakeTotalRow == rPivotParam.bMakeTotalRow &&
+ maLabelArray.size() == rPivotParam.maLabelArray.size() &&
+ maPageFields == rPivotParam.maPageFields &&
+ maColFields == rPivotParam.maColFields &&
+ maRowFields == rPivotParam.maRowFields &&
+ maDataFields == rPivotParam.maDataFields);
return bEqual;
}
-
+// ScPivotFuncData
ScPivotFuncData::ScPivotFuncData( SCCOL nCol, sal_uInt16 nFuncMask ) :
mnCol( nCol ),
mnOriginalDim(-1),
- mnFuncMask( nFuncMask ),
+ mnFuncMask(nFuncMask),
mnDupCount(0)
-{
-}
+{}
-ScPivotFuncData::ScPivotFuncData(
- SCCOL nCol, long nOriginalDim, sal_uInt16 nFuncMask, sal_uInt8 nDupCount,
- const DataPilotFieldReference& rFieldRef) :
- mnCol( nCol ),
+ScPivotFuncData::ScPivotFuncData(SCCOL nCol, long nOriginalDim, sal_uInt16 nFuncMask,
+ sal_uInt8 nDupCount, const DataPilotFieldReference& rFieldRef) :
+ mnCol(nCol),
mnOriginalDim(nOriginalDim),
- mnFuncMask( nFuncMask ),
+ mnFuncMask(nFuncMask),
mnDupCount(nDupCount),
- maFieldRef( rFieldRef )
-{
-}
+ maFieldRef(rFieldRef)
+{}
-bool ScPivotFuncData::operator== (const ScPivotFuncData& r) const
+bool ScPivotFuncData::operator== (const ScPivotFuncData& rFuncData) const
{
- if (mnCol != r.mnCol || mnOriginalDim != r.mnOriginalDim || mnFuncMask != r.mnFuncMask || mnDupCount != r.mnDupCount)
+ if (mnCol != rFuncData.mnCol ||
+ mnOriginalDim != rFuncData.mnOriginalDim ||
+ mnFuncMask != rFuncData.mnFuncMask ||
+ mnDupCount != rFuncData.mnDupCount)
+ {
return false;
-
- return equals(maFieldRef, r.maFieldRef);
+ }
+ return equals(maFieldRef, rFuncData.maFieldRef);
}
#if DEBUG_PIVOT_TABLE
@@ -238,6 +245,4 @@ void ScPivotFuncData::Dump() const
}
#endif
-
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */