summaryrefslogtreecommitdiffstats
path: root/sc
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@suse.com>2012-02-17 18:02:08 -0500
committerKohei Yoshida <kohei.yoshida@suse.com>2012-02-22 14:02:04 -0500
commitf401f8ac518323e08d77507022b9c8a0703f9b14 (patch)
treec8a7dba04a718236ce1e00d2914ae5e62784fdb2 /sc
parentSeparate initialization of data field buttons. (diff)
downloadcore-f401f8ac518323e08d77507022b9c8a0703f9b14.tar.gz
core-f401f8ac518323e08d77507022b9c8a0703f9b14.zip
Correctly display layout name of data fields.
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/pivot.hxx5
-rw-r--r--sc/source/core/data/dpobject.cxx26
-rw-r--r--sc/source/core/data/pivot2.cxx9
-rw-r--r--sc/source/ui/dbgui/pvlaydlg.cxx19
4 files changed, 29 insertions, 30 deletions
diff --git a/sc/inc/pivot.hxx b/sc/inc/pivot.hxx
index 2ab04644f2b5..a73c43153261 100644
--- a/sc/inc/pivot.hxx
+++ b/sc/inc/pivot.hxx
@@ -73,12 +73,13 @@ struct ScDPLabelData;
struct PivotField
{
- SCsCOL nCol; /// 0-based dimension index (not source column index)
+ SCCOL nCol; /// 0-based dimension index (not source column index)
+ long mnOriginalDim;
sal_uInt16 nFuncMask;
sal_uInt8 mnDupCount;
::com::sun::star::sheet::DataPilotFieldReference maFieldRef;
- explicit PivotField( SCsCOL nNewCol = 0, sal_uInt16 nNewFuncMask = PIVOT_FUNC_NONE );
+ explicit PivotField( SCCOL nNewCol = 0, sal_uInt16 nNewFuncMask = PIVOT_FUNC_NONE );
PivotField( const PivotField& r );
bool operator==( const PivotField& r ) const;
diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx
index f9862fbdf60f..9ee479e89d3a 100644
--- a/sc/source/core/data/dpobject.cxx
+++ b/sc/source/core/data/dpobject.cxx
@@ -1790,25 +1790,19 @@ void lcl_FillOldFields(
xDimProp, OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNO_DP_ISDATALAYOUT)));
// is this dimension cloned?
- uno::Any aOrigAny;
+ long nDupSource = -1;
try
{
- aOrigAny = xDimProp->getPropertyValue(
- OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNO_DP_ORIGINAL)));
+ uno::Any aOrigAny = xDimProp->getPropertyValue(
+ OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNO_DP_ORIGINAL_POS)));
+ sal_Int32 nTmp;
+ if (aOrigAny >>= nTmp)
+ nDupSource = static_cast<sal_Int32>(nTmp);
}
catch(uno::Exception&)
{
}
- long nDupSource = -1;
- uno::Reference<uno::XInterface> xIntOrig = ScUnoHelpFunctions::AnyToInterface( aOrigAny );
- if ( xIntOrig.is() )
- {
- uno::Reference<container::XNamed> xNameOrig( xIntOrig, uno::UNO_QUERY );
- if ( xNameOrig.is() )
- nDupSource = lcl_FindName( xNameOrig->getName(), xDimsName );
- }
-
sal_uInt8 nDupCount = 0;
if (nDupSource >= 0)
{
@@ -1832,10 +1826,11 @@ void lcl_FillOldFields(
rField.nCol = PIVOT_DATA_FIELD;
bDataFound = true;
}
- else if (nDupSource >= 0)
- rField.nCol = static_cast<SCsCOL>(nDupSource); //! seek from name
else
- rField.nCol = static_cast<SCsCOL>(nDim); //! seek source column from name
+ {
+ rField.mnOriginalDim = nDupSource;
+ rField.nCol = static_cast<SCCOL>(nDim); //! seek source column from name
+ }
rField.nFuncMask = nMask;
rField.mnDupCount = nDupCount;
@@ -2023,6 +2018,7 @@ bool ScDPObject::FillLabelData(ScPivotParam& rParam)
continue;
bool bIsValue = true; //! check
+ aFieldName = comphelper::string::stripEnd(aFieldName, sal_Unicode('*'));
std::auto_ptr<ScDPLabelData> pNewLabel(
new ScDPLabelData(aFieldName, static_cast<SCCOL>(nDim), bIsValue));
diff --git a/sc/source/core/data/pivot2.cxx b/sc/source/core/data/pivot2.cxx
index 967952415613..685589e61d1a 100644
--- a/sc/source/core/data/pivot2.cxx
+++ b/sc/source/core/data/pivot2.cxx
@@ -112,8 +112,9 @@ OUString ScDPLabelData::getDisplayName() const
return maName;
}
-PivotField::PivotField( SCsCOL nNewCol, sal_uInt16 nNewFuncMask ) :
+PivotField::PivotField(SCCOL nNewCol, sal_uInt16 nNewFuncMask) :
nCol( nNewCol ),
+ mnOriginalDim(-1),
nFuncMask( nNewFuncMask ),
mnDupCount(0)
{
@@ -121,14 +122,16 @@ PivotField::PivotField( SCsCOL nNewCol, sal_uInt16 nNewFuncMask ) :
PivotField::PivotField( const PivotField& r ) :
nCol(r.nCol),
+ mnOriginalDim(r.mnOriginalDim),
nFuncMask(r.nFuncMask),
mnDupCount(r.mnDupCount),
maFieldRef(r.maFieldRef) {}
bool PivotField::operator==( const PivotField& r ) const
{
- return (nCol == r.nCol)
- && (nFuncMask == r.nFuncMask)
+ return (nCol == r.nCol)
+ && (mnOriginalDim == r.mnOriginalDim)
+ && (nFuncMask == r.nFuncMask)
&& equals(maFieldRef, r.maFieldRef);
}
diff --git a/sc/source/ui/dbgui/pvlaydlg.cxx b/sc/source/ui/dbgui/pvlaydlg.cxx
index 0e69a204a6b7..c16c86e12966 100644
--- a/sc/source/ui/dbgui/pvlaydlg.cxx
+++ b/sc/source/ui/dbgui/pvlaydlg.cxx
@@ -356,16 +356,15 @@ void ScDPLayoutDlg::InitWndSelect(const ScDPLabelDataVec& rLabels)
{
const ScDPLabelData& r = rLabels[i];
- if (r.mnOriginalDim >= 0)
- // Don't add duplicate dimensions.
- continue;
-
- // TODO: For dimension with duplicates, use layout name only when all
- // its duplicate dimensions use the same layout name. Otherwise use
- // the original name.
aLabelDataArr.push_back(new ScDPLabelData(r));
- aWndSelect.AddField(aLabelDataArr[i].getDisplayName(), i);
- aSelectArr.push_back(new ScDPFuncData(aLabelDataArr[i].mnCol, aLabelDataArr[i].mnFuncMask));
+ if (r.mnOriginalDim < 0)
+ {
+ // TODO: For dimension with duplicates, use layout name only when
+ // all its duplicate dimensions use the same layout name.
+ // Otherwise use the original name.
+ aWndSelect.AddField(aLabelDataArr[i].getDisplayName(), i);
+ aSelectArr.push_back(new ScDPFuncData(aLabelDataArr[i].mnCol, aLabelDataArr[i].mnFuncMask));
+ }
}
aWndSelect.ResetScrollBar();
aWndSelect.Paint(Rectangle());
@@ -414,7 +413,7 @@ void ScDPLayoutDlg::InitFieldWindow( const vector<PivotField>& rFields, ScDPFiel
if (!pInitArr || !pInitWnd)
return;
- vector<PivotField>::const_iterator it = rFields.begin(), itrEnd = rFields.end();
+ vector<PivotField>::const_iterator itr = rFields.begin(), itrEnd = rFields.end();
for (; itr != itrEnd; ++itr)
{
SCCOL nCol = itr->nCol;