ooo-build r15573 - in trunk: . patches/dev300



Author: kyoshida
Date: Thu Mar 19 03:53:17 2009
New Revision: 15573
URL: http://svn.gnome.org/viewvc/ooo-build?rev=15573&view=rev

Log:
2009-03-18  Kohei Yoshida  <kyoshida novell com>

	* patches/dev300/calc-dp-custom-names-sc.diff: fixed a bug where Calc 
	was not allowing custom name to be assigned to field members when the 
	datapilot table was originally created in Calc. (n#484157)


Modified:
   trunk/ChangeLog
   trunk/patches/dev300/calc-dp-custom-names-sc.diff

Modified: trunk/patches/dev300/calc-dp-custom-names-sc.diff
==============================================================================
--- trunk/patches/dev300/calc-dp-custom-names-sc.diff	(original)
+++ trunk/patches/dev300/calc-dp-custom-names-sc.diff	Thu Mar 19 03:53:17 2009
@@ -1,5 +1,5 @@
 diff --git sc/inc/dpobject.hxx sc/inc/dpobject.hxx
-index 2eff673..99df24f 100644
+index 2eff673..854e1da 100644
 --- sc/inc/dpobject.hxx
 +++ sc/inc/dpobject.hxx
 @@ -38,6 +38,8 @@
@@ -11,7 +11,31 @@
  //------------------------------------------------------------------
  
  namespace com { namespace sun { namespace star { namespace sheet {
-@@ -167,7 +169,16 @@ public:
+@@ -66,6 +68,7 @@ class ScStrCollection;
+ class TypedScStrCollection;
+ struct PivotField;
+ class ScDPCacheTable;
++class ScDPTableData;
+ 
+ struct ScDPServiceDesc
+ {
+@@ -101,6 +104,7 @@ private:
+ 	ScSheetSourceDesc*		pSheetDesc;		//	for sheet data
+ 	ScImportSourceDesc* 	pImpDesc;		//	for database data
+ 	ScDPServiceDesc*		pServDesc;		//	for external service
++    ::std::auto_ptr<ScDPTableData>  mpTableData;
+ 											// cached data
+ 	com::sun::star::uno::Reference<com::sun::star::sheet::XDimensionsSupplier> xSource;
+ 	ScDPOutput*				pOutput;
+@@ -113,6 +117,7 @@ private:
+     bool                    bHeaderLayout;  // TRUE : grid, FALSE : standard
+ 
+ 
++    SC_DLLPRIVATE ScDPTableData*    GetTableData();
+ 	SC_DLLPRIVATE void				CreateObjects();
+ 	SC_DLLPRIVATE void				CreateOutput();
+ 
+@@ -167,7 +172,16 @@ public:
  	void				SetTag(const String& rNew);
  	const String&		GetTag() const					{ return aTableTag; }
  
@@ -29,8 +53,17 @@
  	String				GetDimName( long nDim, BOOL& rIsDataLayout );
      BOOL                IsDuplicated( long nDim );
      long                GetDimCount();
+@@ -231,6 +245,8 @@ public:
+ 	// (button attribute must be present)
+ 	void				RefreshAfterLoad();
+ 
++    void                BuildAllDimensionMembers();
++
+ 	static BOOL			HasRegisteredSources();
+ 	static com::sun::star::uno::Sequence<rtl::OUString> GetRegisteredSources();
+ 	static com::sun::star::uno::Reference<com::sun::star::sheet::XDimensionsSupplier>
 diff --git sc/inc/dpsave.hxx sc/inc/dpsave.hxx
-index ead2c05..dbc57f0 100644
+index ead2c05..cb381fb 100644
 --- sc/inc/dpsave.hxx
 +++ sc/inc/dpsave.hxx
 @@ -34,9 +34,11 @@
@@ -45,7 +78,15 @@
  
  namespace com { namespace sun { namespace star { namespace sheet {
      struct DataPilotFieldReference;
-@@ -57,6 +59,7 @@ class ScDPSaveMember
+@@ -46,6 +48,7 @@ namespace com { namespace sun { namespace star { namespace sheet {
+ } } } }
+ 
+ class ScDPDimensionSaveData;
++class ScDPTableData;
+ 
+ // --------------------------------------------------------------------
+ //
+@@ -57,6 +60,7 @@ class ScDPSaveMember
  {
  private:
  	String		aName;
@@ -53,7 +94,7 @@
  	USHORT		nVisibleMode;
  	USHORT		nShowDetailsMode;
  
-@@ -77,18 +80,23 @@ public:
+@@ -77,18 +81,23 @@ public:
  
      void                    SetName( const String& rNew );  // used if the source member was renamed (groups)
  
@@ -79,7 +120,7 @@
  	BOOL		bIsDataLayout;
  	BOOL		bDupFlag;
  	USHORT		nOrientation;
-@@ -127,39 +135,44 @@ public:
+@@ -127,39 +136,44 @@ public:
  
      void                    SetName( const String& rNew );  // used if the source dim was renamed (groups)
  
@@ -139,16 +180,20 @@
  
      void                    SetMemberPosition( const String& rName, sal_Int32 nNewPos );
  
-@@ -180,6 +193,8 @@ private:
+@@ -180,6 +194,12 @@ private:
      BOOL        bFilterButton;      // not passed to DataPilotSource
      BOOL        bDrillDown;         // not passed to DataPilotSource
  
++    /** if true, all dimensions already have all of their member instances
++     *  created. */
++    bool        mbDimensionMembersBuilt; 
++
 +    ::std::auto_ptr<rtl::OUString> mpGrandTotalName;
 +
  public:
      SC_DLLPUBLIC						ScDPSaveData();
  							ScDPSaveData(const ScDPSaveData& r);
-@@ -189,11 +204,15 @@ public:
+@@ -189,11 +209,15 @@ public:
  
  	BOOL		 			operator== ( const ScDPSaveData& r ) const;
  
@@ -164,7 +209,7 @@
  
  	ScDPSaveDimension*		DuplicateDimension(const String& rName);
      SC_DLLPUBLIC ScDPSaveDimension&      DuplicateDimension(const ScDPSaveDimension& rDim);
-@@ -204,6 +223,7 @@ public:
+@@ -204,6 +228,7 @@ public:
      void                    RemoveDimensionByName(const String& rName);
  
      ScDPSaveDimension*      GetInnermostDimension(USHORT nOrientation);
@@ -172,6 +217,14 @@
      long                    GetDataDimensionCount() const;
  
  
+@@ -230,6 +255,7 @@ public:
+     const ScDPDimensionSaveData* GetExistingDimensionData() const   { return pDimensionData; }
+     SC_DLLPUBLIC ScDPDimensionSaveData*  GetDimensionData();     // create if not there
+     void                    SetDimensionData( const ScDPDimensionSaveData* pNew );      // copied
++    void                    BuildAllDimensionMembers(ScDPTableData* pData);
+ };
+ 
+ 
 diff --git sc/inc/dptabres.hxx sc/inc/dptabres.hxx
 index 3fb5ef8..60ad93e 100644
 --- sc/inc/dptabres.hxx
@@ -203,7 +256,7 @@
  
  
 diff --git sc/inc/dptabsrc.hxx sc/inc/dptabsrc.hxx
-index f7ae03b..f10ae2d 100644
+index f7ae03b..9d6e8e4 100644
 --- sc/inc/dptabsrc.hxx
 +++ sc/inc/dptabsrc.hxx
 @@ -33,6 +33,7 @@
@@ -214,6 +267,15 @@
  #include <tools/string.hxx>
  #include <tools/list.hxx>
  #include "global.hxx"		// enum ScSubTotalFunc
+@@ -108,7 +109,7 @@ class ScDPSource : public cppu::WeakImplHelper6<
+ 							com::sun::star::lang::XServiceInfo >
+ {
+ private:
+-	ScDPTableData*			pData;				// data source
++	ScDPTableData*			pData;				// data source (ScDPObject manages its life time)
+ 	ScDPDimensions*			pDimensions;		// api objects
+ 												// settings:
+ 	long					nColDims[SC_DAPI_MAXFIELDS];
 @@ -136,6 +137,8 @@ private:
  	List					aRowLevelList;
  	BOOL					bResultOverflow;
@@ -276,10 +338,10 @@
      sal_Int32               Compare( const ScDPMember& rOther ) const;      // visible order
  
 diff --git sc/inc/unonames.hxx sc/inc/unonames.hxx
-index 8635af1..a348e69 100644
+index abfcf3a..6afb1a3 100644
 --- sc/inc/unonames.hxx
 +++ sc/inc/unonames.hxx
-@@ -562,6 +562,9 @@
+@@ -563,6 +563,9 @@
  #define SC_UNO_ROWFIELDCOUNT        "RowFieldCount"
  #define SC_UNO_COLUMNFIELDCOUNT     "ColumnFieldCount"
  #define SC_UNO_DATAFIELDCOUNT       "DataFieldCount"
@@ -290,10 +352,34 @@
  //  (preliminary:)
  #define SC_UNO_REFVALUE				"ReferenceValue"
 diff --git sc/source/core/data/dpobject.cxx sc/source/core/data/dpobject.cxx
-index d7c9a6c..fbf9c78 100644
+index d7c9a6c..afa90e9 100644
 --- sc/source/core/data/dpobject.cxx
 +++ sc/source/core/data/dpobject.cxx
-@@ -342,6 +342,31 @@ void ScDPObject::SetTag(const String& rNew)
+@@ -78,6 +78,7 @@
+ 
+ using namespace com::sun::star;
+ using ::std::vector;
++using ::std::auto_ptr;
+ using ::com::sun::star::uno::Sequence;
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::uno::UNO_QUERY;
+@@ -162,6 +163,7 @@ ScDPObject::ScDPObject( ScDocument* pD ) :
+ 	pSheetDesc( NULL ),
+ 	pImpDesc( NULL ),
+ 	pServDesc( NULL ),
++    mpTableData(NULL),
+ 	pOutput( NULL ),
+ 	nAutoFormatIndex( 65535 ),
+ 	bSettingsChanged( FALSE ),
+@@ -184,6 +186,7 @@ ScDPObject::ScDPObject(const ScDPObject& r) :
+ 	pSheetDesc( NULL ),
+ 	pImpDesc( NULL ),
+ 	pServDesc( NULL ),
++    mpTableData(NULL), 
+ 	pOutput( NULL ),
+ 	bSettingsChanged( FALSE ),
+ 	bAlive( FALSE ),
+@@ -342,6 +345,31 @@ void ScDPObject::SetTag(const String& rNew)
  	aTableTag = rNew;
  }
  
@@ -325,17 +411,98 @@
  uno::Reference<sheet::XDimensionsSupplier> ScDPObject::GetSource()
  {
  	CreateObjects();
-@@ -432,7 +457,8 @@ void ScDPObject::CreateObjects()
- 			    pData = pGroupData;
- 			}
+@@ -384,6 +412,38 @@ void ScDPObject::CreateOutput()
+ 	}
+ }
  
++ScDPTableData* ScDPObject::GetTableData()
++{
++    if (!mpTableData.get())
++    {
++        if ( pImpDesc )
++        {
++            // database data
++            mpTableData.reset(new ScDatabaseDPData(pDoc, *pImpDesc));
++        }
++        else
++        {
++            // cell data
++            if (!pSheetDesc)
++            {
++                DBG_ERROR("no source descriptor");
++                pSheetDesc = new ScSheetSourceDesc;     // dummy defaults
++            }
++            mpTableData.reset(new ScSheetDPData(pDoc, *pSheetDesc));
++        }
++
++        // grouping (for cell or database data)
++        if ( pSaveData && pSaveData->GetExistingDimensionData() )
++        {
++            auto_ptr<ScDPGroupTableData> pGroupData(new ScDPGroupTableData(mpTableData.release(), pDoc));
++            pSaveData->GetExistingDimensionData()->WriteToData(*pGroupData);
++            mpTableData = pGroupData;
++        }
++    }
++
++    return mpTableData.get();
++}
++
+ void ScDPObject::CreateObjects()
+ {
+     // if groups are involved, create a new source with the ScDPGroupTableData
+@@ -406,33 +466,9 @@ void ScDPObject::CreateObjects()
+ 		if ( !xSource.is() )	// database or sheet data, or error in CreateSource
+ 		{
+ 			DBG_ASSERT( !pServDesc, "DPSource could not be created" );
+-
+-			ScDPTableData* pData = NULL;
+-			if ( pImpDesc )
+-			{
+-			    // database data
+-                pData = new ScDatabaseDPData( pDoc, *pImpDesc );
+-			}
+-			else
+-			{
+-			    // cell data
+-    			if (!pSheetDesc)
+-    			{
+-    				DBG_ERROR("no source descriptor");
+-    				pSheetDesc = new ScSheetSourceDesc;		// dummy defaults
+-    			}
+-    			pData = new ScSheetDPData( pDoc, *pSheetDesc );
+-			}
+-
+-			// grouping (for cell or database data)
+-			if ( pSaveData && pSaveData->GetExistingDimensionData() )
+-			{
+-			    ScDPGroupTableData* pGroupData = new ScDPGroupTableData( pData, pDoc );
+-			    pSaveData->GetExistingDimensionData()->WriteToData( *pGroupData );
+-			    pData = pGroupData;
+-			}
+-
 -			xSource = new ScDPSource( pData );
++            ScDPTableData* pData = GetTableData();
 +            ScDPSource* pSource = new ScDPSource( pData );
 +            xSource = pSource;
  		}
  
  		if (pSaveData)
-@@ -676,23 +702,33 @@ void ScDPObject::GetDrillDownData(const ScAddress& rPos, Sequence< Sequence<Any>
+@@ -554,6 +590,14 @@ void ScDPObject::RefreshAfterLoad()
+ 	bInfoValid = TRUE;
+ }
+ 
++void ScDPObject::BuildAllDimensionMembers()
++{
++    if (!pSaveData)
++        return;
++    
++    pSaveData->BuildAllDimensionMembers(GetTableData());
++}
++
+ void ScDPObject::UpdateReference( UpdateRefMode eUpdateRefMode,
+ 									 const ScRange& rRange, SCsCOL nDx, SCsROW nDy, SCsTAB nDz )
+ {
+@@ -676,23 +720,33 @@ void ScDPObject::GetDrillDownData(const ScAddress& rPos, Sequence< Sequence<Any>
      rTableData = xDrillDownData->getDrillDownData(filters);
  }
  
@@ -520,18 +687,23 @@
  
  bool lcl_IsCondition( const sheet::MemberResult& rResultEntry, const ScDPGetPivotDataField& rFilter )
 diff --git sc/source/core/data/dpsave.cxx sc/source/core/data/dpsave.cxx
-index 130e7a8..3072232 100644
+index 130e7a8..f41ea2c 100644
 --- sc/source/core/data/dpsave.cxx
 +++ sc/source/core/data/dpsave.cxx
-@@ -59,6 +59,7 @@
+@@ -58,7 +58,12 @@
+ #include <com/sun/star/container/XNamed.hpp>
  #include <com/sun/star/util/XCloneable.hpp>
  
++#include <hash_map>
++
  using namespace com::sun::star;
 +using ::rtl::OUString;
++using ::std::hash_map;
++using ::std::auto_ptr;
  
  // -----------------------------------------------------------------------
  
-@@ -113,6 +114,7 @@ void lcl_SkipExtra( SvStream& rStream )
+@@ -113,6 +118,7 @@ void lcl_SkipExtra( SvStream& rStream )
  
  ScDPSaveMember::ScDPSaveMember(const String& rName) :
  	aName( rName ),
@@ -539,7 +711,7 @@
  	nVisibleMode( SC_DPSAVEMODE_DONTKNOW ),
  	nShowDetailsMode( SC_DPSAVEMODE_DONTKNOW )
  {
-@@ -120,9 +122,12 @@ ScDPSaveMember::ScDPSaveMember(const String& rName) :
+@@ -120,9 +126,12 @@ ScDPSaveMember::ScDPSaveMember(const String& rName) :
  
  ScDPSaveMember::ScDPSaveMember(const ScDPSaveMember& r) :
  	aName( r.aName ),
@@ -552,7 +724,7 @@
  }
  
  ScDPSaveMember::~ScDPSaveMember()
-@@ -167,6 +172,21 @@ void ScDPSaveMember::SetName( const String& rNew )
+@@ -167,6 +176,21 @@ void ScDPSaveMember::SetName( const String& rNew )
      aName = rNew;
  }
  
@@ -574,7 +746,7 @@
  void ScDPSaveMember::WriteToSource( const uno::Reference<uno::XInterface>& xMember, sal_Int32 nPosition )
  {
  	//	nothing to do?
-@@ -187,6 +207,18 @@ void ScDPSaveMember::WriteToSource( const uno::Reference<uno::XInterface>& xMemb
+@@ -187,6 +211,18 @@ void ScDPSaveMember::WriteToSource( const uno::Reference<uno::XInterface>& xMemb
  			lcl_SetBoolProperty( xMembProp,
  					rtl::OUString::createFromAscii(DP_PROP_SHOWDETAILS), (BOOL)nShowDetailsMode );
  
@@ -593,7 +765,7 @@
          if ( nPosition >= 0 )
          {
              try
-@@ -205,8 +237,9 @@ void ScDPSaveMember::WriteToSource( const uno::Reference<uno::XInterface>& xMemb
+@@ -205,8 +241,9 @@ void ScDPSaveMember::WriteToSource( const uno::Reference<uno::XInterface>& xMemb
  
  ScDPSaveDimension::ScDPSaveDimension(const String& rName, BOOL bDataLayout) :
  	aName( rName ),
@@ -604,7 +776,7 @@
  	bIsDataLayout( bDataLayout ),
  	bDupFlag( FALSE ),
  	nOrientation( sheet::DataPilotFieldOrientation_HIDDEN ),
-@@ -225,6 +258,8 @@ ScDPSaveDimension::ScDPSaveDimension(const String& rName, BOOL bDataLayout) :
+@@ -225,6 +262,8 @@ ScDPSaveDimension::ScDPSaveDimension(const String& rName, BOOL bDataLayout) :
  
  ScDPSaveDimension::ScDPSaveDimension(const ScDPSaveDimension& r) :
  	aName( r.aName ),
@@ -613,7 +785,7 @@
  	bIsDataLayout( r.bIsDataLayout ),
  	bDupFlag( r.bDupFlag ),
  	nOrientation( r.nOrientation ),
-@@ -265,14 +300,14 @@ ScDPSaveDimension::ScDPSaveDimension(const ScDPSaveDimension& r) :
+@@ -265,14 +304,14 @@ ScDPSaveDimension::ScDPSaveDimension(const ScDPSaveDimension& r) :
          pLayoutInfo = new sheet::DataPilotFieldLayoutInfo( *(r.pLayoutInfo) );
      else
          pLayoutInfo = NULL;
@@ -632,7 +804,7 @@
  }
  
  ScDPSaveDimension::~ScDPSaveDimension()
-@@ -283,7 +318,6 @@ ScDPSaveDimension::~ScDPSaveDimension()
+@@ -283,7 +322,6 @@ ScDPSaveDimension::~ScDPSaveDimension()
      delete pSortInfo;
      delete pAutoShowInfo;
      delete pLayoutInfo;
@@ -640,7 +812,7 @@
  	delete pSelectedPage;
      delete [] pSubTotalFuncs;
  }
-@@ -395,25 +429,45 @@ void ScDPSaveDimension::SetUsedHierarchy(long nNew)
+@@ -395,25 +433,45 @@ void ScDPSaveDimension::SetUsedHierarchy(long nNew)
  	nUsedHierarchy = nNew;
  }
  
@@ -698,7 +870,7 @@
  }
  
  void ScDPSaveDimension::SetReferenceValue(const sheet::DataPilotFieldReference* pNew)
-@@ -549,6 +603,19 @@ void ScDPSaveDimension::WriteToSource( const uno::Reference<uno::XInterface>& xD
+@@ -549,6 +607,19 @@ void ScDPSaveDimension::WriteToSource( const uno::Reference<uno::XInterface>& xD
  		{
  			aAny <<= aFilter;
  			xDimProp->setPropertyValue( rtl::OUString::createFromAscii(DP_PROP_FILTER), aAny );
@@ -718,27 +890,29 @@
  		}
  		catch ( beans::UnknownPropertyException& )
  		{
-@@ -691,7 +758,8 @@ ScDPSaveData::ScDPSaveData() :
+@@ -691,7 +762,9 @@ ScDPSaveData::ScDPSaveData() :
  	nIgnoreEmptyMode( SC_DPSAVEMODE_DONTKNOW ),
      nRepeatEmptyMode( SC_DPSAVEMODE_DONTKNOW ),
      bFilterButton( TRUE ),
 -    bDrillDown( TRUE )
 +    bDrillDown( TRUE ),
++    mbDimensionMembersBuilt(false),
 +    mpGrandTotalName(NULL)
  {
  }
  
-@@ -701,7 +769,8 @@ ScDPSaveData::ScDPSaveData(const ScDPSaveData& r) :
+@@ -701,7 +774,9 @@ ScDPSaveData::ScDPSaveData(const ScDPSaveData& r) :
  	nIgnoreEmptyMode( r.nIgnoreEmptyMode ),
  	nRepeatEmptyMode( r.nRepeatEmptyMode ),
      bFilterButton( r.bFilterButton ),
 -    bDrillDown( r.bDrillDown )
 +    bDrillDown( r.bDrillDown ),
++    mbDimensionMembersBuilt(r.mbDimensionMembersBuilt),
 +    mpGrandTotalName(NULL)
  {
      if ( r.pDimensionData )
          pDimensionData = new ScDPDimensionSaveData( *r.pDimensionData );
-@@ -714,6 +783,9 @@ ScDPSaveData::ScDPSaveData(const ScDPSaveData& r) :
+@@ -714,6 +789,9 @@ ScDPSaveData::ScDPSaveData(const ScDPSaveData& r) :
  		ScDPSaveDimension* pNew = new ScDPSaveDimension( *(ScDPSaveDimension*)r.aDimList.GetObject(i) );
  		aDimList.Insert( pNew, LIST_APPEND );
  	}
@@ -748,7 +922,15 @@
  }
  
  ScDPSaveData& ScDPSaveData::operator= ( const ScDPSaveData& r )
-@@ -750,6 +822,9 @@ ScDPSaveData& ScDPSaveData::operator= ( const ScDPSaveData& r )
+@@ -732,6 +810,7 @@ ScDPSaveData& ScDPSaveData::operator= ( const ScDPSaveData& r )
+ 		nRepeatEmptyMode = r.nRepeatEmptyMode;
+         bFilterButton    = r.bFilterButton;
+         bDrillDown       = r.bDrillDown;
++        mbDimensionMembersBuilt = r.mbDimensionMembersBuilt;
+ 
+ 		//	remove old dimensions
+ 
+@@ -750,6 +829,9 @@ ScDPSaveData& ScDPSaveData::operator= ( const ScDPSaveData& r )
  				new ScDPSaveDimension( *(ScDPSaveDimension*)r.aDimList.GetObject(i) );
  			aDimList.Insert( pNew, LIST_APPEND );
  		}
@@ -758,7 +940,17 @@
  	}
  	return *this;
  }
-@@ -777,6 +852,16 @@ BOOL ScDPSaveData::operator== ( const ScDPSaveData& r ) const
+@@ -761,7 +843,8 @@ BOOL ScDPSaveData::operator== ( const ScDPSaveData& r ) const
+ 		 nIgnoreEmptyMode != r.nIgnoreEmptyMode ||
+ 		 nRepeatEmptyMode != r.nRepeatEmptyMode ||
+          bFilterButton    != r.bFilterButton    ||
+-         bDrillDown       != r.bDrillDown )
++         bDrillDown       != r.bDrillDown ||
++         mbDimensionMembersBuilt != r.mbDimensionMembersBuilt)
+ 		return FALSE;
+ 
+     if ( pDimensionData || r.pDimensionData )
+@@ -777,6 +860,16 @@ BOOL ScDPSaveData::operator== ( const ScDPSaveData& r ) const
  				*(ScDPSaveDimension*)r.aDimList.GetObject(i) ) )
  			return FALSE;
  
@@ -775,7 +967,7 @@
  	return TRUE;
  }
  
-@@ -790,6 +875,16 @@ ScDPSaveData::~ScDPSaveData()
+@@ -790,6 +883,16 @@ ScDPSaveData::~ScDPSaveData()
      delete pDimensionData;
  }
  
@@ -792,7 +984,7 @@
  ScDPSaveDimension* ScDPSaveData::GetDimensionByName(const String& rName)
  {
  	long nCount = aDimList.Count();
-@@ -832,6 +927,17 @@ ScDPSaveDimension* ScDPSaveData::GetNewDimensionByName(const String& rName)
+@@ -832,6 +935,17 @@ ScDPSaveDimension* ScDPSaveData::GetNewDimensionByName(const String& rName)
  
  ScDPSaveDimension* ScDPSaveData::GetDataLayoutDimension()
  {
@@ -810,7 +1002,7 @@
  	long nCount = aDimList.Count();
  	for (long i=0; i<nCount; i++)
  	{
-@@ -839,9 +945,7 @@ ScDPSaveDimension* ScDPSaveData::GetDataLayoutDimension()
+@@ -839,9 +953,7 @@ ScDPSaveDimension* ScDPSaveData::GetDataLayoutDimension()
  		if ( pDim->IsDataLayout() )
  			return pDim;
  	}
@@ -821,7 +1013,7 @@
  }
  
  ScDPSaveDimension* ScDPSaveData::DuplicateDimension(const String& rName)
-@@ -895,6 +999,18 @@ ScDPSaveDimension* ScDPSaveData::GetInnermostDimension(USHORT nOrientation)
+@@ -895,6 +1007,18 @@ ScDPSaveDimension* ScDPSaveData::GetInnermostDimension(USHORT nOrientation)
      return pInner;      // the last matching one
  }
  
@@ -840,7 +1032,7 @@
  long ScDPSaveData::GetDataDimensionCount() const
  {
      long nDataCount = 0;
-@@ -1002,6 +1118,14 @@ void ScDPSaveData::WriteToSource( const uno::Reference<sheet::XDimensionsSupplie
+@@ -1002,6 +1126,14 @@ void ScDPSaveData::WriteToSource( const uno::Reference<sheet::XDimensionsSupplie
  			if ( nRepeatEmptyMode != SC_DPSAVEMODE_DONTKNOW )
  				lcl_SetBoolProperty( xSourceProp,
  					rtl::OUString::createFromAscii(DP_PROP_REPEATIFEMPTY), (BOOL)nRepeatEmptyMode );
@@ -855,6 +1047,57 @@
  		}
  		catch(uno::Exception&)
  		{
+@@ -1125,3 +1257,50 @@ void ScDPSaveData::SetDimensionData( const ScDPDimensionSaveData* pNew )
+         pDimensionData = NULL;
+ }
+ 
++void ScDPSaveData::BuildAllDimensionMembers(ScDPTableData* pData)
++{
++    if (mbDimensionMembersBuilt)
++        return;
++
++    // First, build a dimension name-to-index map.
++    typedef hash_map<OUString, long, ::rtl::OUStringHash> NameIndexMap;
++    NameIndexMap aMap;
++    long nColCount = pData->GetColumnCount();
++    for (long i = 0; i < nColCount; ++i)
++        aMap.insert( NameIndexMap::value_type(pData->getDimensionName(i), i));
++
++    NameIndexMap::const_iterator itrEnd = aMap.end();
++
++    sal_uInt32 n = aDimList.Count();
++    for (sal_uInt32 i = 0; i < n; ++i)
++    {
++        ScDPSaveDimension* pDim = static_cast<ScDPSaveDimension*>(aDimList.GetObject(i));
++        const String& rDimName = pDim->GetName();
++        if (!rDimName.Len())
++            // empty dimension name.  It must be data layout.
++            continue;
++
++        NameIndexMap::const_iterator itr = aMap.find(rDimName);
++        if (itr == itrEnd)
++            // dimension name not in the data.  This should never happen!
++            continue;
++
++        long nDimIndex = itr->second;
++        const TypedScStrCollection& rMembers = pData->GetColumnEntries(nDimIndex);
++        sal_uInt16 nMemberCount = rMembers.GetCount();
++        for (sal_uInt16 j = 0; j < nMemberCount; ++j)
++        {
++            const String& rMemName = rMembers[j]->GetString();
++            if (pDim->GetExistingMemberByName(rMemName))
++                // this member instance already exists.  nothing to do.
++                continue;
++
++            auto_ptr<ScDPSaveMember> pNewMember(new ScDPSaveMember(rMemName));
++            pNewMember->SetIsVisible(true);
++            pDim->AddMember(pNewMember.release());
++        }
++    }
++
++    mbDimensionMembersBuilt = true;
++}
++
 diff --git sc/source/core/data/dptabres.cxx sc/source/core/data/dptabres.cxx
 index d8f6454..e53ecb9 100644
 --- sc/source/core/data/dptabres.cxx
@@ -1017,7 +1260,7 @@
  		}
  		else if ( pMember->IsVisible() )
 diff --git sc/source/core/data/dptabsrc.cxx sc/source/core/data/dptabsrc.cxx
-index 499309f..2c045d6 100644
+index 499309f..04e75ba 100644
 --- sc/source/core/data/dptabsrc.cxx
 +++ sc/source/core/data/dptabsrc.cxx
 @@ -85,6 +85,7 @@ using ::com::sun::star::uno::Reference;
@@ -1028,7 +1271,7 @@
  
  // -----------------------------------------------------------------------
  
-@@ -141,7 +142,8 @@ ScDPSource::ScDPSource( ScDPTableData* pD ) :
+@@ -141,15 +142,14 @@ ScDPSource::ScDPSource( ScDPTableData* pD ) :
  	pRowResRoot( NULL ),
  	pColResults( NULL ),
  	pRowResults( NULL ),
@@ -1038,7 +1281,15 @@
  {
  	pData->SetEmptyFlags( bIgnoreEmptyRows, bRepeatIfEmpty );
  }
-@@ -163,6 +165,16 @@ ScDPSource::~ScDPSource()
+ 
+ ScDPSource::~ScDPSource()
+ {
+-	delete pData;			// ScDPTableData is not ref-counted
+-
+ 	if (pDimensions)
+ 		pDimensions->release();		// ref-counted
+ 
+@@ -163,6 +163,16 @@ ScDPSource::~ScDPSource()
  	delete pResData;
  }
  
@@ -1055,7 +1306,7 @@
  USHORT ScDPSource::GetOrientation(long nColumn)
  {
  	long i;
-@@ -186,16 +198,21 @@ long ScDPSource::GetDataDimensionCount()
+@@ -186,16 +196,21 @@ long ScDPSource::GetDataDimensionCount()
  	return nDataDimCount;
  }
  
@@ -1084,7 +1335,7 @@
  	return aRet;
  }
  
-@@ -484,7 +501,10 @@ String ScDPSource::getDataDescription()
+@@ -484,7 +499,10 @@ String ScDPSource::getDataDescription()
  
  	String aRet;
  	if ( pResData->GetMeasureCount() == 1 )
@@ -1096,7 +1347,7 @@
  
  	//	empty for more than one measure
  
-@@ -1128,6 +1148,7 @@ uno::Reference<beans::XPropertySetInfo> SAL_CALL ScDPSource::getPropertySetInfo(
+@@ -1128,6 +1146,7 @@ uno::Reference<beans::XPropertySetInfo> SAL_CALL ScDPSource::getPropertySetInfo(
  														throw(uno::RuntimeException)
  {
  	ScUnoGuard aGuard;
@@ -1104,7 +1355,7 @@
  
  	static SfxItemPropertyMap aDPSourceMap_Impl[] =
  	{
-@@ -1136,6 +1157,10 @@ uno::Reference<beans::XPropertySetInfo> SAL_CALL ScDPSource::getPropertySetInfo(
+@@ -1136,6 +1155,10 @@ uno::Reference<beans::XPropertySetInfo> SAL_CALL ScDPSource::getPropertySetInfo(
  		{MAP_CHAR_LEN(SC_UNO_IGNOREEM),	0,	&getBooleanCppuType(),				0, 0 },		// for sheet data only
  		{MAP_CHAR_LEN(SC_UNO_REPEATIF),	0,	&getBooleanCppuType(),				0, 0 },		// for sheet data only
  		{MAP_CHAR_LEN(SC_UNO_ROWGRAND),	0,	&getBooleanCppuType(),				0, 0 },
@@ -1115,7 +1366,7 @@
          {0,0,0,0,0,0}
  	};
  	static uno::Reference<beans::XPropertySetInfo> aRef =
-@@ -1157,6 +1182,12 @@ void SAL_CALL ScDPSource::setPropertyValue( const rtl::OUString& aPropertyName,
+@@ -1157,6 +1180,12 @@ void SAL_CALL ScDPSource::setPropertyValue( const rtl::OUString& aPropertyName,
  		setIgnoreEmptyRows( lcl_GetBoolFromAny( aValue ) );
  	else if ( aNameStr.EqualsAscii( SC_UNO_REPEATIF ) )
  		setRepeatIfEmpty( lcl_GetBoolFromAny( aValue ) );
@@ -1128,7 +1379,7 @@
  	else
  	{
  		DBG_ERROR("unknown property");
-@@ -1186,6 +1217,11 @@ uno::Any SAL_CALL ScDPSource::getPropertyValue( const rtl::OUString& aPropertyNa
+@@ -1186,6 +1215,11 @@ uno::Any SAL_CALL ScDPSource::getPropertyValue( const rtl::OUString& aPropertyNa
          aRet <<= static_cast<sal_Int32>(nColDimCount);
      else if ( aNameStr.EqualsAscii( SC_UNO_DATAFIELDCOUNT ) )       // read-only
          aRet <<= static_cast<sal_Int32>(nDataDimCount);
@@ -1140,7 +1391,7 @@
  	else
  	{
  		DBG_ERROR("unknown property");
-@@ -1333,6 +1369,8 @@ ScDPDimension::ScDPDimension( ScDPSource* pSrc, long nD ) :
+@@ -1333,6 +1367,8 @@ ScDPDimension::ScDPDimension( ScDPSource* pSrc, long nD ) :
  	pHierarchies( NULL ),
  	nUsedHier( 0 ),
  	nFunction( SUBTOTAL_FUNC_SUM ),		// sum is default
@@ -1149,7 +1400,7 @@
  	nSourceDim( -1 ),
  	bHasSelectedPage( FALSE ),
  	pSelectedData( NULL )
-@@ -1360,6 +1398,16 @@ ScDPHierarchies* ScDPDimension::GetHierarchiesObject()
+@@ -1360,6 +1396,16 @@ ScDPHierarchies* ScDPDimension::GetHierarchiesObject()
  	return pHierarchies;
  }
  
@@ -1166,7 +1417,7 @@
  uno::Reference<container::XNameAccess> SAL_CALL ScDPDimension::getHierarchies()
  													throw(uno::RuntimeException)
  {
-@@ -1519,6 +1567,8 @@ uno::Reference<beans::XPropertySetInfo> SAL_CALL ScDPDimension::getPropertySetIn
+@@ -1519,6 +1565,8 @@ uno::Reference<beans::XPropertySetInfo> SAL_CALL ScDPDimension::getPropertySetIn
  		{MAP_CHAR_LEN(SC_UNO_POSITION),	0,	&getCppuType((sal_Int32*)0),				0, 0 },
  		{MAP_CHAR_LEN(SC_UNO_REFVALUE),	0,	&getCppuType((sheet::DataPilotFieldReference*)0), 0, 0 },
  		{MAP_CHAR_LEN(SC_UNO_USEDHIER),	0,	&getCppuType((sal_Int32*)0),				0, 0 },
@@ -1175,7 +1426,7 @@
          {0,0,0,0,0,0}
  	};
  	static uno::Reference<beans::XPropertySetInfo> aRef =
-@@ -1589,6 +1639,18 @@ void SAL_CALL ScDPDimension::setPropertyValue( const rtl::OUString& aPropertyNam
+@@ -1589,6 +1637,18 @@ void SAL_CALL ScDPDimension::setPropertyValue( const rtl::OUString& aPropertyNam
  		}
  		DELETEZ( pSelectedData );		// invalid after changing aSelectedPage
  	}
@@ -1194,7 +1445,7 @@
  	else
  	{
  		DBG_ERROR("unknown property");
-@@ -1648,6 +1710,10 @@ uno::Any SAL_CALL ScDPDimension::getPropertyValue( const rtl::OUString& aPropert
+@@ -1648,6 +1708,10 @@ uno::Any SAL_CALL ScDPDimension::getPropertyValue( const rtl::OUString& aPropert
  		else
  			aRet <<= uno::Sequence<sheet::TableFilterField>(0);
  	}
@@ -1205,7 +1456,7 @@
  	else
  	{
  		DBG_ERROR("unknown property");
-@@ -2148,7 +2214,11 @@ uno::Sequence<sheet::MemberResult> SAL_CALL ScDPLevel::getResults() throw(uno::R
+@@ -2148,7 +2212,11 @@ uno::Sequence<sheet::MemberResult> SAL_CALL ScDPLevel::getResults() throw(uno::R
  			return aRet;
  	}
  
@@ -1218,7 +1469,7 @@
  }
  
  void SAL_CALL ScDPLevel::setName( const ::rtl::OUString& /* rNewName */ ) throw(uno::RuntimeException)
-@@ -2251,6 +2321,20 @@ uno::Any SAL_CALL ScDPLevel::getPropertyValue( const rtl::OUString& aPropertyNam
+@@ -2251,6 +2319,20 @@ uno::Any SAL_CALL ScDPLevel::getPropertyValue( const rtl::OUString& aPropertyNam
  	    aRet <<= aAutoShowInfo;
  	else if ( aNameStr.EqualsAscii( SC_UNO_LAYOUT ) )
  	    aRet <<= aLayoutInfo;
@@ -1239,7 +1490,7 @@
  	else
  	{
  		DBG_ERROR("unknown property");
-@@ -2543,6 +2627,7 @@ ScDPMember::ScDPMember( ScDPSource* pSrc, long nD, long nH, long nL,
+@@ -2543,6 +2625,7 @@ ScDPMember::ScDPMember( ScDPSource* pSrc, long nD, long nH, long nL,
  	nHier( nH ),
  	nLev( nL ),
  	maData( rN, fV, bHV ),
@@ -1247,7 +1498,7 @@
      nPosition( -1 ),
  	bVisible( TRUE ),
  	bShowDet( TRUE )
-@@ -2603,6 +2688,11 @@ void ScDPMember::FillItemData( ScDPItemData& rData ) const
+@@ -2603,6 +2686,11 @@ void ScDPMember::FillItemData( ScDPItemData& rData ) const
  	rData = maData;
  }
  
@@ -1259,7 +1510,7 @@
  String ScDPMember::GetNameStr() const
  {
  	return maData.aString;
-@@ -2662,6 +2752,7 @@ uno::Reference<beans::XPropertySetInfo> SAL_CALL ScDPMember::getPropertySetInfo(
+@@ -2662,6 +2750,7 @@ uno::Reference<beans::XPropertySetInfo> SAL_CALL ScDPMember::getPropertySetInfo(
  		{MAP_CHAR_LEN(SC_UNO_ISVISIBL),	0,	&getBooleanCppuType(),				0, 0 },
          {MAP_CHAR_LEN(SC_UNO_POSITION), 0,  &getCppuType((sal_Int32*)0),        0, 0 },
  		{MAP_CHAR_LEN(SC_UNO_SHOWDETA),	0,	&getBooleanCppuType(),				0, 0 },
@@ -1267,7 +1518,7 @@
          {0,0,0,0,0,0}
  	};
  	static uno::Reference<beans::XPropertySetInfo> aRef =
-@@ -2685,6 +2776,12 @@ void SAL_CALL ScDPMember::setPropertyValue( const rtl::OUString& aPropertyName,
+@@ -2685,6 +2774,12 @@ void SAL_CALL ScDPMember::setPropertyValue( const rtl::OUString& aPropertyName,
          if (aValue >>= nInt)
              setPosition( nInt );
  	}
@@ -1280,7 +1531,7 @@
  	else
  	{
  		DBG_ERROR("unknown property");
-@@ -2704,6 +2801,8 @@ uno::Any SAL_CALL ScDPMember::getPropertyValue( const rtl::OUString& aPropertyNa
+@@ -2704,6 +2799,8 @@ uno::Any SAL_CALL ScDPMember::getPropertyValue( const rtl::OUString& aPropertyNa
  		lcl_SetBoolInAny( aRet, getShowDetails() );
      else if ( aNameStr.EqualsAscii( SC_UNO_POSITION ) )
          aRet <<= (sal_Int32) getPosition();
@@ -2081,7 +2332,7 @@
  
  IMPL_LINK( ScDPShowDetailDlg, DblClickHdl, ListBox*, pLBox )
 diff --git sc/source/ui/dbgui/pvlaydlg.cxx sc/source/ui/dbgui/pvlaydlg.cxx
-index 09f2156..155f3e0 100644
+index bedf6c3..4dee615 100644
 --- sc/source/ui/dbgui/pvlaydlg.cxx
 +++ sc/source/ui/dbgui/pvlaydlg.cxx
 @@ -63,6 +63,7 @@
@@ -2092,7 +2343,7 @@
  
  //----------------------------------------------------------------------------
  
-@@ -1484,6 +1485,8 @@ IMPL_LINK( ScDPLayoutDlg, OkHdl, OKButton *, EMPTYARG )
+@@ -1506,6 +1507,8 @@ IMPL_LINK( ScDPLayoutDlg, OkHdl, OKButton *, EMPTYARG )
                                      nPageCount,    nColCount,    nRowCount,    nDataCount );
          if ( bFit )
  		{
@@ -2101,7 +2352,7 @@
  			ScRange aOutRange( aAdrDest );		// bToNewTable is passed separately
  
  			ScDPSaveData aSaveData;
-@@ -1515,6 +1518,22 @@ IMPL_LINK( ScDPLayoutDlg, OkHdl, OKButton *, EMPTYARG )
+@@ -1537,6 +1540,22 @@ IMPL_LINK( ScDPLayoutDlg, OkHdl, OKButton *, EMPTYARG )
                      pDim->SetSortInfo( &aIt->maSortInfo );
                      pDim->SetLayoutInfo( &aIt->maLayoutInfo );
                      pDim->SetAutoShowInfo( &aIt->maShowInfo );
@@ -2124,7 +2375,7 @@
  
                      bool bManualSort = ( aIt->maSortInfo.Mode == sheet::DataPilotFieldSortMode::MANUAL );
  
-@@ -1535,11 +1554,33 @@ IMPL_LINK( ScDPLayoutDlg, OkHdl, OKButton *, EMPTYARG )
+@@ -1557,11 +1576,33 @@ IMPL_LINK( ScDPLayoutDlg, OkHdl, OKButton *, EMPTYARG )
                                  ScDPSaveMember* pMember = pDim->GetMemberByName( *pItem );
                                  pMember->SetIsVisible( bIsVisible );
                                  pMember->SetShowDetails( bShowDetails );
@@ -2223,7 +2474,7 @@
              }
          }
 diff --git sc/source/ui/view/dbfunc3.cxx sc/source/ui/view/dbfunc3.cxx
-index 3e5a627..d66ac37 100644
+index 3e5a627..df92a5e 100644
 --- sc/source/ui/view/dbfunc3.cxx
 +++ sc/source/ui/view/dbfunc3.cxx
 @@ -91,6 +91,10 @@ using ::com::sun::star::uno::Sequence;
@@ -2237,7 +2488,7 @@
  using ::std::auto_ptr;
  
  // STATIC DATA -----------------------------------------------------------
-@@ -1377,123 +1381,303 @@ void ScDBFunc::UngroupDataPilot()
+@@ -1377,123 +1381,304 @@ void ScDBFunc::UngroupDataPilot()
      }
  }
  
@@ -2300,6 +2551,7 @@
 -        if ( aOldText == rString )
 +    USHORT nErrorId = 0;
 +
++    pDPObj->BuildAllDimensionMembers();
 +    ScDPSaveData aData( *pDPObj->GetSaveData() );
 +    BOOL bChange = FALSE;
 +



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]