[Libreoffice-commits] .: 2 commits - sc/inc sc/source
Kohei Yoshida
kohei at kemper.freedesktop.org
Thu Mar 22 19:21:10 PDT 2012
sc/inc/dpobject.hxx | 1 +
sc/source/core/data/dpobject.cxx | 12 ++++++++++++
sc/source/core/data/dpsave.cxx | 2 +-
sc/source/ui/docshell/dbdocfun.cxx | 3 +++
sc/source/ui/view/gridwin2.cxx | 7 +++----
5 files changed, 20 insertions(+), 5 deletions(-)
New commits:
commit 1d8b583b0676f9c9eed8efd092445908ebea26d9
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Thu Mar 22 22:20:04 2012 -0400
Get correct string value for group item value.
Unlike the old version, the new version no longer stores string value
for non-string items. We need to call GetFormattedString() for that.
diff --git a/sc/source/core/data/dpsave.cxx b/sc/source/core/data/dpsave.cxx
index e112e6c..5255b72 100644
--- a/sc/source/core/data/dpsave.cxx
+++ b/sc/source/core/data/dpsave.cxx
@@ -1246,7 +1246,7 @@ void ScDPSaveData::BuildAllDimensionMembers(ScDPTableData* pData)
for (size_t j = 0; j < mMemberCount; ++j)
{
const ScDPItemData* pMemberData = pData->GetMemberById( nDimIndex, rMembers[j] );
- ::rtl::OUString aMemName = pMemberData->GetString();
+ rtl::OUString aMemName = pData->GetFormattedString(nDimIndex, *pMemberData);
if (iter->GetExistingMemberByName(aMemName))
// this member instance already exists. nothing to do.
continue;
commit 7f68157264ec5c474b2a0827d2ee35af20ff0c3d
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Thu Mar 22 22:03:55 2012 -0400
When updating pivot table with groups, we need to clear the table data.
diff --git a/sc/inc/dpobject.hxx b/sc/inc/dpobject.hxx
index 917759d..8c1ed99 100644
--- a/sc/inc/dpobject.hxx
+++ b/sc/inc/dpobject.hxx
@@ -138,6 +138,7 @@ public:
void InvalidateData();
void ClearTableData();
void ReloadGroupTableData();
+ bool HasGroups() const;
void Output( const ScAddress& rPos );
ScRange GetNewOutputRange( bool& rOverflow );
diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx
index 9da61d1..2f0e510 100644
--- a/sc/source/core/data/dpobject.cxx
+++ b/sc/source/core/data/dpobject.cxx
@@ -584,6 +584,18 @@ void ScDPObject::ReloadGroupTableData()
bSettingsChanged = true;
}
+bool ScDPObject::HasGroups() const
+{
+ if (!pSaveData)
+ return false;
+
+ const ScDPDimensionSaveData* pDimData = pSaveData->GetExistingDimensionData();
+ if (!pDimData)
+ return false;
+
+ return pDimData->HasGroupDimensions();
+}
+
void ScDPObject::ClearSource()
{
Reference< XComponent > xObjectComp( xSource, UNO_QUERY );
diff --git a/sc/source/ui/docshell/dbdocfun.cxx b/sc/source/ui/docshell/dbdocfun.cxx
index c1464b1..afb3513 100644
--- a/sc/source/ui/docshell/dbdocfun.cxx
+++ b/sc/source/ui/docshell/dbdocfun.cxx
@@ -1327,6 +1327,9 @@ bool ScDBDocFunc::DataPilotUpdate( ScDPObject* pOldObj, const ScDPObject* pNewOb
if ( pNewObj == pOldObj && pDestObj->IsImportData() )
pDestObj->ClearTableData();
+ if (pDestObj->HasGroups())
+ pDestObj->ClearTableData();
+
pDestObj->InvalidateData(); // before getting the new output area
// make sure the table has a name (not set by dialog)
diff --git a/sc/source/ui/view/gridwin2.cxx b/sc/source/ui/view/gridwin2.cxx
index 0f37c83..bf3402c 100644
--- a/sc/source/ui/view/gridwin2.cxx
+++ b/sc/source/ui/view/gridwin2.cxx
@@ -552,9 +552,8 @@ void ScGridWindow::UpdateDPFromFieldPopupMenu()
return;
ScDPObject* pDPObj = pDPData->mpDPObj;
- ScDPObject aNewDPObj(*pDPObj);
- aNewDPObj.BuildAllDimensionMembers();
- ScDPSaveData* pSaveData = aNewDPObj.GetSaveData();
+ pDPObj->BuildAllDimensionMembers();
+ ScDPSaveData* pSaveData = pDPObj->GetSaveData();
bool bIsDataLayout;
OUString aDimName = pDPObj->GetDimName(pDPData->mnDim, bIsDataLayout);
@@ -601,7 +600,7 @@ void ScGridWindow::UpdateDPFromFieldPopupMenu()
pDim->UpdateMemberVisibility(aResult);
ScDBDocFunc aFunc(*pViewData->GetDocShell());
- aFunc.DataPilotUpdate(pDPObj, &aNewDPObj, true, false);
+ aFunc.DataPilotUpdate(pDPObj, pDPObj, true, false);
}
void ScGridWindow::UpdateVisibleRange()
More information about the Libreoffice-commits
mailing list