From f697d7aa5c26f9fcfd717b76a4827a5bcb38325e Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Wed, 14 Mar 2012 20:40:38 -0400 Subject: Fix the UNO API for creating a new group dimension. --- sc/inc/dapiuno.hxx | 1 + sc/source/ui/unoobj/dapiuno.cxx | 24 ++++++++++++++---------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/sc/inc/dapiuno.hxx b/sc/inc/dapiuno.hxx index fd3ec8d65fed..98bdca08b8a7 100644 --- a/sc/inc/dapiuno.hxx +++ b/sc/inc/dapiuno.hxx @@ -422,6 +422,7 @@ protected: ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > GetMembers() const; + ScDocShell* GetDocShell() const; protected: ScDataPilotDescriptorBase& mrParent; ScFieldIdentifier maFieldId; diff --git a/sc/source/ui/unoobj/dapiuno.cxx b/sc/source/ui/unoobj/dapiuno.cxx index d1d7d962ad73..45a88e7a32ac 100644 --- a/sc/source/ui/unoobj/dapiuno.cxx +++ b/sc/source/ui/unoobj/dapiuno.cxx @@ -1193,7 +1193,7 @@ void ScDataPilotTableObj::SetDPObject( ScDPObject* pDPObject ) if ( pDPObj && pDocSh ) { ScDBDocFunc aFunc(*pDocSh); - aFunc.DataPilotUpdate( pDPObj, pDPObject, sal_True, sal_True ); + aFunc.DataPilotUpdate( pDPObj, pDPObject, true, true ); } } @@ -1565,6 +1565,11 @@ Reference< XNameAccess > ScDataPilotChildObjBase::GetMembers() const return xMembersNA; } +ScDocShell* ScDataPilotChildObjBase::GetDocShell() const +{ + return mrParent.GetDocShell(); +} + // ============================================================================ ScDataPilotFieldsObj::ScDataPilotFieldsObj( ScDataPilotDescriptorBase& rParent ) : @@ -2569,13 +2574,13 @@ Reference< XDataPilotField > SAL_CALL ScDataPilotFieldObj::createNameGroup( cons ScDPObject* pDPObj = 0; if( ScDPSaveDimension* pDim = GetDPDimension( &pDPObj ) ) { - String aDimName = pDim->GetName(); + rtl::OUString aDimName = pDim->GetName(); ScDPSaveData aSaveData = *pDPObj->GetSaveData(); ScDPDimensionSaveData* pDimData = aSaveData.GetDimensionData(); // created if not there // find original base - String aBaseDimName( aDimName ); + rtl::OUString aBaseDimName( aDimName ); const ScDPSaveGroupDimension* pBaseGroupDim = pDimData->GetNamedGroupDim( aDimName ); if ( pBaseGroupDim ) { @@ -2595,7 +2600,7 @@ Reference< XDataPilotField > SAL_CALL ScDataPilotFieldObj::createNameGroup( cons { for (nEntry=0; nEntry SAL_CALL ScDataPilotFieldObj::createNameGroup( cons if ( !pGroupDimension ) { // create a new group dimension - String aGroupDimName = pDimData->CreateGroupDimName( aBaseDimName, *pDPObj, false, NULL ); - pNewGroupDim = new ScDPSaveGroupDimension( aBaseDimName, aGroupDimName ); - sNewDim = aGroupDimName; + sNewDim = pDimData->CreateGroupDimName( aBaseDimName, *pDPObj, false, NULL ); + pNewGroupDim = new ScDPSaveGroupDimension( aBaseDimName, sNewDim ); pGroupDimension = pNewGroupDim; // make changes to the new dim if none existed @@ -2645,10 +2649,10 @@ Reference< XDataPilotField > SAL_CALL ScDataPilotFieldObj::createNameGroup( cons } } } - String aGroupDimName = pGroupDimension->GetGroupDimName(); + rtl::OUString aGroupDimName = pGroupDimension->GetGroupDimName(); //! localized prefix string - String aGroupName = pGroupDimension->CreateGroupName( String( RTL_CONSTASCII_USTRINGPARAM( "Group" ) ) ); + rtl::OUString aGroupName = pGroupDimension->CreateGroupName( String( RTL_CONSTASCII_USTRINGPARAM( "Group" ) ) ); ScDPSaveGroupItem aGroup( aGroupName ); Reference< XNameAccess > xMembers = GetMembers(); if (!xMembers.is()) @@ -2702,7 +2706,7 @@ Reference< XDataPilotField > SAL_CALL ScDataPilotFieldObj::createNameGroup( cons // apply changes pDPObj->SetSaveData( aSaveData ); - SetDPObject( pDPObj ); + ScDBDocFunc(*GetDocShell()).RefreshPivotTableGroups(pDPObj); } // if new grouping field has been created (on first group), return it -- cgit v1.2.3