ooo-build r14512 - in trunk: . patches/test
- From: kyoshida svn gnome org
- To: svn-commits-list gnome org
- Subject: ooo-build r14512 - in trunk: . patches/test
- Date: Sat, 15 Nov 2008 06:40:10 +0000 (UTC)
Author: kyoshida
Date: Sat Nov 15 06:40:10 2008
New Revision: 14512
URL: http://svn.gnome.org/viewvc/ooo-build?rev=14512&view=rev
Log:
2008-11-15 Kohei Yoshida <kyoshida novell com>
* patches/test/calc-dp-custom-names.diff: today's progress. Import and
export with xls pretty much works, but the UI to change custom names is
not there yet.
Modified:
trunk/ChangeLog
trunk/patches/test/calc-dp-custom-names.diff
Modified: trunk/patches/test/calc-dp-custom-names.diff
==============================================================================
--- trunk/patches/test/calc-dp-custom-names.diff (original)
+++ trunk/patches/test/calc-dp-custom-names.diff Sat Nov 15 06:40:10 2008
@@ -30,7 +30,7 @@
BOOL IsDimNameInUse( const String& rName ) const;
String GetDimName( long nDim, BOOL& rIsDataLayout );
diff --git sc/inc/dpsave.hxx sc/inc/dpsave.hxx
-index 8a42ead..bc49095 100644
+index 8a42ead..f979268 100644
--- sc/inc/dpsave.hxx
+++ sc/inc/dpsave.hxx
@@ -37,6 +37,7 @@
@@ -45,7 +45,7 @@
{
private:
String aName;
-+ ::std::auto_ptr<String> mpLayoutName; // custom name to be displayed in the table.
++ ::std::auto_ptr<rtl::OUString> mpLayoutName; // custom name to be displayed in the table.
USHORT nVisibleMode;
USHORT nShowDetailsMode;
@@ -53,13 +53,18 @@
void SetName( const String& rNew ); // used if the source member was renamed (groups)
-+ void SetLayoutName( const String& rName );
-+ const String* GetLayoutName() const;
++ void SetLayoutName( const ::rtl::OUString& rName );
++ const ::rtl::OUString* GetLayoutName() const;
+
void WriteToSource( const com::sun::star::uno::Reference<
com::sun::star::uno::XInterface>& xMember,
sal_Int32 nPosition );
-@@ -91,8 +96,9 @@ class ScDPSaveDimension
+@@ -87,12 +92,13 @@ public:
+ };
+
+
+-class ScDPSaveDimension
++class SC_DLLPUBLIC ScDPSaveDimension
{
private:
String aName;
@@ -70,7 +75,21 @@
BOOL bIsDataLayout;
BOOL bDupFlag;
USHORT nOrientation;
-@@ -143,9 +149,11 @@ public:
+@@ -113,10 +119,12 @@ public:
+ private:
+ MemberHash maMemberHash;
+ MemberList maMemberList;
++
++ ScDPSaveDimension(); // disabled
+ public:
+ ScDPSaveDimension(const String& rName, BOOL bDataLayout);
+ ScDPSaveDimension(const ScDPSaveDimension& r);
+- ScDPSaveDimension(SvStream& rStream);
++ ScDPSaveDimension(SvStream& rStream);
+ ~ScDPSaveDimension();
+
+ BOOL operator== ( const ScDPSaveDimension& r ) const;
+@@ -143,9 +151,11 @@ public:
USHORT GetFunction() const { return nFunction; }
void SetUsedHierarchy(long nNew);
long GetUsedHierarchy() const { return nUsedHierarchy; }
@@ -85,7 +104,7 @@
const ::com::sun::star::sheet::DataPilotFieldReference* GetReferenceValue() const { return pReferenceValue; }
void SetReferenceValue(const ::com::sun::star::sheet::DataPilotFieldReference* pNew);
-@@ -186,6 +194,7 @@ private:
+@@ -186,6 +196,7 @@ private:
USHORT nRepeatEmptyMode;
BOOL bFilterButton; // not passed to DataPilotSource
BOOL bDrillDown; // not passed to DataPilotSource
@@ -93,7 +112,16 @@
public:
ScDPSaveData();
-@@ -213,6 +222,8 @@ public:
+@@ -197,7 +208,7 @@ public:
+ BOOL operator== ( const ScDPSaveData& r ) const;
+
+ const List& GetDimensions() const { return aDimList; }
+- void AddDimension(ScDPSaveDimension* pDim) { aDimList.Insert(pDim, LIST_APPEND); }
++ void AddDimension(ScDPSaveDimension* pDim) { aDimList.Insert(pDim, LIST_APPEND); }
+
+ ScDPSaveDimension* GetDimensionByName(const String& rName);
+ ScDPSaveDimension* GetDataLayoutDimension();
+@@ -213,6 +224,8 @@ public:
ScDPSaveDimension* GetInnermostDimension(USHORT nOrientation);
long GetDataDimensionCount() const;
@@ -102,6 +130,15 @@
void SetPosition( ScDPSaveDimension* pDim, long nNew );
void SetColumnGrand( BOOL bSet );
+@@ -237,6 +250,8 @@ public:
+ const ScDPDimensionSaveData* GetExistingDimensionData() const { return pDimensionData; }
+ ScDPDimensionSaveData* GetDimensionData(); // create if not there
+ void SetDimensionData( const ScDPDimensionSaveData* pNew ); // copied
++
++ void test();
+ };
+
+
diff --git sc/inc/dptabres.hxx sc/inc/dptabres.hxx
index 3fb5ef8..f4a60f9 100644
--- sc/inc/dptabres.hxx
@@ -245,10 +282,18 @@
// (preliminary:)
#define SC_UNO_REFVALUE "ReferenceValue"
diff --git sc/source/core/data/dpobject.cxx sc/source/core/data/dpobject.cxx
-index 4f49665..1c8257a 100644
+index 4f49665..db28f1d 100644
--- sc/source/core/data/dpobject.cxx
+++ sc/source/core/data/dpobject.cxx
-@@ -156,6 +156,7 @@ USHORT lcl_GetDataGetOrientation( const uno::Reference<sheet::XDimensionsSupplie
+@@ -83,6 +83,7 @@ using ::com::sun::star::uno::UNO_QUERY;
+ using ::com::sun::star::uno::Any;
+ using ::com::sun::star::sheet::DataPilotTableHeaderData;
+ using ::com::sun::star::sheet::DataPilotTablePositionData;
++using ::rtl::OUString;
+
+ // -----------------------------------------------------------------------
+
+@@ -156,6 +157,7 @@ USHORT lcl_GetDataGetOrientation( const uno::Reference<sheet::XDimensionsSupplie
ScDPObject::ScDPObject( ScDocument* pD ) :
pDoc( pD ),
pSaveData( NULL ),
@@ -256,7 +301,7 @@
pSheetDesc( NULL ),
pImpDesc( NULL ),
pServDesc( NULL ),
-@@ -174,6 +175,7 @@ ScDPObject::ScDPObject(const ScDPObject& r) :
+@@ -174,6 +176,7 @@ ScDPObject::ScDPObject(const ScDPObject& r) :
DataObject(),
pDoc( r.pDoc ),
pSaveData( NULL ),
@@ -264,7 +309,7 @@
aTableName( r.aTableName ),
aTableTag( r.aTableTag ),
aOutRange( r.aOutRange ),
-@@ -191,6 +193,8 @@ ScDPObject::ScDPObject(const ScDPObject& r) :
+@@ -191,6 +194,8 @@ ScDPObject::ScDPObject(const ScDPObject& r) :
{
if (r.pSaveData)
pSaveData = new ScDPSaveData(*r.pSaveData);
@@ -273,7 +318,7 @@
if (r.pSheetDesc)
pSheetDesc = new ScSheetSourceDesc(*r.pSheetDesc);
if (r.pImpDesc)
-@@ -339,6 +343,16 @@ void ScDPObject::SetTag(const String& rNew)
+@@ -339,6 +344,16 @@ void ScDPObject::SetTag(const String& rNew)
aTableTag = rNew;
}
@@ -290,7 +335,7 @@
uno::Reference<sheet::XDimensionsSupplier> ScDPObject::GetSource()
{
CreateObjects();
-@@ -429,7 +443,11 @@ void ScDPObject::CreateObjects()
+@@ -429,7 +444,11 @@ void ScDPObject::CreateObjects()
pData = pGroupData;
}
@@ -421,7 +466,7 @@
rOrient = sheet::DataPilotFieldOrientation_ROW;
long nField = nCol - nTabStartCol;
diff --git sc/source/core/data/dpsave.cxx sc/source/core/data/dpsave.cxx
-index dbcfe30..7fd8d98 100644
+index dbcfe30..9563f85 100644
--- sc/source/core/data/dpsave.cxx
+++ sc/source/core/data/dpsave.cxx
@@ -60,6 +60,7 @@
@@ -449,7 +494,7 @@
nShowDetailsMode( r.nShowDetailsMode )
{
+ if (r.mpLayoutName.get())
-+ mpLayoutName.reset(new String(*r.mpLayoutName));
++ mpLayoutName.reset(new OUString(*r.mpLayoutName));
}
ScDPSaveMember::ScDPSaveMember(SvStream& rStream)
@@ -457,12 +502,12 @@
aName = rNew;
}
-+void ScDPSaveMember::SetLayoutName( const String& rName )
++void ScDPSaveMember::SetLayoutName( const OUString& rName )
+{
-+ mpLayoutName.reset(new String(rName));
++ mpLayoutName.reset(new OUString(rName));
+}
+
-+const String* ScDPSaveMember::GetLayoutName() const
++const OUString* ScDPSaveMember::GetLayoutName() const
+{
+ return mpLayoutName.get();
+}
@@ -500,15 +545,16 @@
bIsDataLayout( bDataLayout ),
bDupFlag( FALSE ),
nOrientation( sheet::DataPilotFieldOrientation_HIDDEN ),
-@@ -244,6 +272,7 @@ ScDPSaveDimension::ScDPSaveDimension(const String& rName, BOOL bDataLayout) :
+@@ -244,6 +272,8 @@ ScDPSaveDimension::ScDPSaveDimension(const String& rName, BOOL bDataLayout) :
ScDPSaveDimension::ScDPSaveDimension(const ScDPSaveDimension& r) :
aName( r.aName ),
++ mpLayoutName(NULL),
+ mpSubtotalName(NULL),
bIsDataLayout( r.bIsDataLayout ),
bDupFlag( r.bDupFlag ),
nOrientation( r.nOrientation ),
-@@ -284,14 +313,14 @@ ScDPSaveDimension::ScDPSaveDimension(const ScDPSaveDimension& r) :
+@@ -284,14 +314,14 @@ ScDPSaveDimension::ScDPSaveDimension(const ScDPSaveDimension& r) :
pLayoutInfo = new sheet::DataPilotFieldLayoutInfo( *(r.pLayoutInfo) );
else
pLayoutInfo = NULL;
@@ -521,13 +567,13 @@
else
pSelectedPage = NULL;
+ if (r.mpLayoutName.get())
-+ mpLayoutName.reset(new OUString(*r.mpLayoutName));
++ mpLayoutName.reset(new OUString(*r.mpLayoutName));
+ if (r.mpSubtotalName.get())
+ mpSubtotalName.reset(new OUString(*r.mpSubtotalName));
}
ScDPSaveDimension::ScDPSaveDimension(SvStream& rStream)
-@@ -334,7 +363,6 @@ ScDPSaveDimension::ScDPSaveDimension(SvStream& rStream)
+@@ -334,7 +364,6 @@ ScDPSaveDimension::ScDPSaveDimension(SvStream& rStream)
pSortInfo = NULL;
pAutoShowInfo = NULL;
pLayoutInfo = NULL;
@@ -535,7 +581,7 @@
pSelectedPage = NULL;
}
-@@ -376,7 +404,6 @@ ScDPSaveDimension::~ScDPSaveDimension()
+@@ -376,7 +405,6 @@ ScDPSaveDimension::~ScDPSaveDimension()
delete pSortInfo;
delete pAutoShowInfo;
delete pLayoutInfo;
@@ -543,7 +589,7 @@
delete pSelectedPage;
delete [] pSubTotalFuncs;
}
-@@ -488,25 +515,24 @@ void ScDPSaveDimension::SetUsedHierarchy(long nNew)
+@@ -488,25 +516,24 @@ void ScDPSaveDimension::SetUsedHierarchy(long nNew)
nUsedHierarchy = nNew;
}
@@ -580,13 +626,13 @@
}
void ScDPSaveDimension::SetReferenceValue(const sheet::DataPilotFieldReference* pNew)
-@@ -642,6 +668,19 @@ void ScDPSaveDimension::WriteToSource( const uno::Reference<uno::XInterface>& xD
+@@ -642,6 +669,19 @@ void ScDPSaveDimension::WriteToSource( const uno::Reference<uno::XInterface>& xD
{
aAny <<= aFilter;
xDimProp->setPropertyValue( rtl::OUString::createFromAscii(DP_PROP_FILTER), aAny );
+ if (mpLayoutName.get())
+ {
-+ aAny <<= rtl::OUString(*mpLayoutName);
++ aAny <<= *mpLayoutName;
+ xDimProp->setPropertyValue(rtl::OUString::createFromAscii(SC_UNO_LAYOUTNAME), aAny);
+ }
+
@@ -600,7 +646,7 @@
}
catch ( beans::UnknownPropertyException& )
{
-@@ -784,7 +823,8 @@ ScDPSaveData::ScDPSaveData() :
+@@ -784,7 +824,8 @@ ScDPSaveData::ScDPSaveData() :
nIgnoreEmptyMode( SC_DPSAVEMODE_DONTKNOW ),
nRepeatEmptyMode( SC_DPSAVEMODE_DONTKNOW ),
bFilterButton( TRUE ),
@@ -610,7 +656,7 @@
{
}
-@@ -794,13 +834,17 @@ ScDPSaveData::ScDPSaveData(const ScDPSaveData& r) :
+@@ -794,13 +835,17 @@ ScDPSaveData::ScDPSaveData(const ScDPSaveData& r) :
nIgnoreEmptyMode( r.nIgnoreEmptyMode ),
nRepeatEmptyMode( r.nRepeatEmptyMode ),
bFilterButton( r.bFilterButton ),
@@ -629,7 +675,7 @@
long nCount = r.aDimList.Count();
for (long i=0; i<nCount; i++)
{
-@@ -819,6 +863,9 @@ ScDPSaveData& ScDPSaveData::operator= ( const ScDPSaveData& r )
+@@ -819,6 +864,9 @@ ScDPSaveData& ScDPSaveData::operator= ( const ScDPSaveData& r )
else
pDimensionData = NULL;
@@ -639,7 +685,7 @@
nColumnGrandMode = r.nColumnGrandMode;
nRowGrandMode = r.nRowGrandMode;
nIgnoreEmptyMode = r.nIgnoreEmptyMode;
-@@ -861,6 +908,16 @@ BOOL ScDPSaveData::operator== ( const ScDPSaveData& r ) const
+@@ -861,6 +909,16 @@ BOOL ScDPSaveData::operator== ( const ScDPSaveData& r ) const
if ( !pDimensionData || !r.pDimensionData || !( *pDimensionData == *r.pDimensionData ) )
return FALSE;
@@ -656,7 +702,7 @@
ULONG nCount = aDimList.Count();
if ( nCount != r.aDimList.Count() )
return FALSE;
-@@ -1003,6 +1060,16 @@ long ScDPSaveData::GetDataDimensionCount() const
+@@ -1003,6 +1061,16 @@ long ScDPSaveData::GetDataDimensionCount() const
return nDataCount;
}
@@ -674,7 +720,7 @@
{
// position (nNew) is counted within dimensions of the same orientation
diff --git sc/source/core/data/dptabres.cxx sc/source/core/data/dptabres.cxx
-index c52139c..dab5547 100644
+index c52139c..23da8b8 100644
--- sc/source/core/data/dptabres.cxx
+++ sc/source/core/data/dptabres.cxx
@@ -67,6 +67,7 @@ using ::std::vector;
@@ -750,8 +796,9 @@
if (bHasChild)
eForce = lcl_GetForceFunc( pParentLevel, nUserPos );
+- String aSubStr = aName; //! caption?
+ bool bTotalResult = false;
- String aSubStr = aName; //! caption?
++ String aSubStr = aCaption;
aSubStr += ' ';
- aSubStr += pResultData->GetMeasureString(nMemberMeasure, FALSE, eForce);
+ aSubStr += pResultData->GetMeasureString(nMemberMeasure, FALSE, eForce, bTotalResult);
@@ -769,7 +816,7 @@
+ if (nPos != STRING_NOTFOUND)
+ {
+ String aNew = aSubStr.Copy(0, nPos);
-+ aNew += aName;
++ aNew += aCaption;
+ if (nPos+1 < aSubStr.Len())
+ aNew += aSubStr.Copy(nPos+1);
+ aSubStr = aNew;
@@ -1142,7 +1189,7 @@
return eLastErr;
diff --git sc/source/filter/excel/xepivot.cxx sc/source/filter/excel/xepivot.cxx
-index 2a4994a..91d7d7f 100644
+index 2a4994a..1a65747 100644
--- sc/source/filter/excel/xepivot.cxx
+++ sc/source/filter/excel/xepivot.cxx
@@ -64,6 +64,7 @@ using ::com::sun::star::sheet::DataPilotFieldSortInfo;
@@ -1159,8 +1206,8 @@
::set_flag( maItemInfo.mnFlags, EXC_SXVI_HIDEDETAIL, !rSaveMem.GetShowDetails() );
+
+ // visible name
-+ const String* pVisName = rSaveMem.GetLayoutName();
-+ if (pVisName && *pVisName != GetItemName())
++ const OUString* pVisName = rSaveMem.GetLayoutName();
++ if (pVisName && !pVisName->equals(GetItemName()))
+ maItemInfo.SetVisName(*pVisName);
}
@@ -1206,7 +1253,20 @@
if( const ScDPSaveData* pSaveData = rDPObj.GetSaveData() )
{
-@@ -1306,6 +1320,11 @@ void XclExpPivotTable::SetPropertiesFromDP( const ScDPSaveData& rSaveData )
+@@ -1271,8 +1285,10 @@ void XclExpPivotTable::Save( XclExpStream& rStrm )
+ WriteSxli( rStrm, maPTInfo.mnDataCols, maPTInfo.mnColFields );
+ // SXEX
+ WriteSxex( rStrm );
+- // SX_AUTOFORMAT
+- WriteSxAutoformat( rStrm );
++ // QSISXTAG
++ WriteQsiSxTag( rStrm );
++ // SXVIEWEX9
++ WriteSxViewEx9( rStrm );
+ }
+ }
+
+@@ -1306,6 +1322,11 @@ void XclExpPivotTable::SetPropertiesFromDP( const ScDPSaveData& rSaveData )
::set_flag( maPTInfo.mnFlags, EXC_SXVIEW_COLGRAND, rSaveData.GetColumnGrand() );
::set_flag( maPTExtInfo.mnFlags, EXC_SXEX_DRILLDOWN, rSaveData.GetDrillDown() );
mbFilterBtn = rSaveData.GetFilterButton();
@@ -1218,7 +1278,7 @@
}
void XclExpPivotTable::SetFieldPropertiesFromDim( const ScDPSaveDimension& rSaveDim )
-@@ -1413,17 +1432,21 @@ void XclExpPivotTable::Finalize()
+@@ -1413,17 +1434,21 @@ void XclExpPivotTable::Finalize()
rnDataXclRow = rnXclRow1 + maPTInfo.mnColFields + 1;
if( maDataFields.empty() )
++rnDataXclRow;
@@ -1244,7 +1304,66 @@
}
// records ----------------------------------------------------------------
-@@ -1503,10 +1526,10 @@ void XclExpPivotTable::WriteSxAutoformat( XclExpStream& rStrm ) const
+@@ -1499,14 +1524,68 @@ void XclExpPivotTable::WriteSxex( XclExpStream& rStrm ) const
+ rStrm.EndRecord();
+ }
+
+-void XclExpPivotTable::WriteSxAutoformat( XclExpStream& rStrm ) const
++void XclExpPivotTable::WriteQsiSxTag( XclExpStream& rStrm ) const
++{
++ rStrm.StartRecord( 0x0802, 32 );
++
++ sal_uInt16 nRecordType = 0x0802;
++ sal_uInt16 nDummyFlags = 0x0000;
++ sal_uInt16 nTableType = 1; // 0 = query table : 1 = pivot table
++
++ rStrm << nRecordType << nDummyFlags << nTableType;
++
++ // General flags
++ bool bEnableRefresh = true;
++ bool bPCacheInvalid = false;
++ bool bOlapPTReport = false;
++
++ sal_uInt16 nFlags = 0x0000;
++ if (bEnableRefresh) nFlags |= 0x0001;
++ if (bPCacheInvalid) nFlags |= 0x0002;
++ if (bOlapPTReport) nFlags |= 0x0004;
++ rStrm << nFlags;
++
++ // Feature-specific options. The value differs depending on the table
++ // type, but we assume the table type is always pivot table.
++ sal_uInt32 nOptions = 0x00000000;
++ bool bNoStencil = false;
++ bool bHideTotal = false;
++ bool bEmptyRows = false;
++ bool bEmptyCols = false;
++ if (bNoStencil) nOptions |= 0x00000001;
++ if (bHideTotal) nOptions |= 0x00000002;
++ if (bEmptyRows) nOptions |= 0x00000008;
++ if (bEmptyCols) nOptions |= 0x00000010;
++ rStrm << nOptions;
++
++ enum ExcelVersion
++ {
++ Excel2000 = 0,
++ ExcelXP = 1,
++ Excel2003 = 2,
++ Excel2007 = 3
++ };
++ ExcelVersion eXclVer = Excel2000;
++ sal_uInt8 nOffsetBytes = 16;
++ rStrm << static_cast<sal_uInt8>(eXclVer) // version table last refreshed
++ << static_cast<sal_uInt8>(eXclVer) // minimum version to refresh
++ << nOffsetBytes
++ << static_cast<sal_uInt8>(eXclVer); // first version created
++
++ rStrm << XclExpString(maPTInfo.maTableName);
++ rStrm << static_cast<sal_uInt16>(0x0001); // no idea what this is for.
++
++ rStrm.EndRecord();
++}
++
++void XclExpPivotTable::WriteSxViewEx9( XclExpStream& rStrm ) const
{
// Until we sync the autoformat ids only export if using grid header layout
// That could only have been set via xls import so far.
@@ -1280,7 +1399,7 @@
SetStrLen( nCurrLen );
diff --git sc/source/filter/excel/xipivot.cxx sc/source/filter/excel/xipivot.cxx
-index 6c7c378..b4d9d84 100644
+index 6c7c378..49d35d1 100644
--- sc/source/filter/excel/xipivot.cxx
+++ sc/source/filter/excel/xipivot.cxx
@@ -848,6 +848,11 @@ void XclImpPivotCache::ReadPivotCacheStream( XclImpStream& rStrm )
@@ -1352,7 +1471,22 @@
}
// ----------------------------------------------------------------------------
-@@ -1365,12 +1377,32 @@ void XclImpPivotTable::Convert()
+@@ -1337,11 +1349,14 @@ void XclImpPivotTable::Convert()
+ if( const XclImpPTField* pField = GetField( *aIt ) )
+ pField->ConvertPageField( aSaveData );
+
++#if 0 // Why do we do this ???
++
+ // hidden fields
+ for( sal_uInt16 nField = 0, nCount = GetFieldCount(); nField < nCount; ++nField )
+ if( const XclImpPTField* pField = GetField( nField ) )
+ if( (pField->GetAxes() & EXC_SXVD_AXIS_ROWCOLPAGE) == 0 )
+ pField->ConvertHiddenField( aSaveData );
++#endif
+
+ // data fields
+ for( aIt = maFiltDataFields.begin(), aEnd = maFiltDataFields.end(); aIt != aEnd; ++aIt )
+@@ -1365,12 +1380,32 @@ void XclImpPivotTable::Convert()
// create the DataPilot
ScDPObject* pDPObj = new ScDPObject( GetDocPtr() );
pDPObj->SetName( maPTInfo.maTableName );
@@ -1386,7 +1520,7 @@
}
// ============================================================================
-@@ -1485,85 +1517,10 @@ void XclImpPivotTableManager::ConvertPivotTables()
+@@ -1485,85 +1520,10 @@ void XclImpPivotTableManager::ConvertPivotTables()
(*aIt)->Convert();
}
@@ -1638,10 +1772,22 @@
#include <map>
#include <math.h>
diff --git sc/source/filter/inc/xepivot.hxx sc/source/filter/inc/xepivot.hxx
-index 62a19b5..89224d4 100644
+index 62a19b5..41e0907 100644
--- sc/source/filter/inc/xepivot.hxx
+++ sc/source/filter/inc/xepivot.hxx
-@@ -423,7 +423,7 @@ private:
+@@ -411,8 +411,10 @@ private:
+ void WriteSxli( XclExpStream& rStrm, sal_uInt16 nLineCount, sal_uInt16 nIndexCount ) const;
+ /** Writes the SXEX records containing additional pivot table info. */
+ void WriteSxex( XclExpStream& rStrm ) const;
++
++ void WriteQsiSxTag( XclExpStream& rStrm ) const;
+ /** Writes the SX_AUTOFORMAT records with the autoformat id and header layout */
+- void WriteSxAutoformat( XclExpStream& rStrm ) const;
++ void WriteSxViewEx9( XclExpStream& rStrm ) const;
+
+ // ------------------------------------------------------------------------
+ private:
+@@ -423,7 +425,7 @@ private:
const XclExpPivotCache& mrPCache; /// The pivot cache this pivot table bases on.
XclPTInfo maPTInfo; /// Info about the pivot table (SXVIEW record).
XclPTExtInfo maPTExtInfo; /// Extended info about the pivot table (SXEX record).
@@ -1770,6 +1916,168 @@
// ----------------------------------------------------------------------------
+diff --git sc/source/ui/dbgui/pvfundlg.cxx sc/source/ui/dbgui/pvfundlg.cxx
+index b7a089f..10e67ce 100644
+--- sc/source/ui/dbgui/pvfundlg.cxx
++++ sc/source/ui/dbgui/pvfundlg.cxx
+@@ -708,7 +708,9 @@ ScDPShowDetailDlg::ScDPShowDetailDlg( Window* pParent, ScDPObject& rDPObj, USHOR
+ maLbDims ( this, ScResId( LB_DIMS ) ),
+ maBtnOk ( this, ScResId( BTN_OK ) ),
+ maBtnCancel ( this, ScResId( BTN_CANCEL ) ),
+- maBtnHelp ( this, ScResId( BTN_HELP ) )
++ maBtnHelp ( this, ScResId( BTN_HELP ) ),
++
++ mrDPObj(rDPObj)
+ {
+ FreeResource();
+
+@@ -722,7 +724,13 @@ ScDPShowDetailDlg::ScDPShowDetailDlg( Window* pParent, ScDPObject& rDPObj, USHOR
+ {
+ const ScDPSaveDimension* pDimension = pSaveData ? pSaveData->GetExistingDimensionByName(aName) : 0;
+ if ( !pDimension || (pDimension->GetOrientation() != nOrient) )
++ {
++ const OUString* pLayoutName = pDimension->GetLayoutName();
++ if (pLayoutName)
++ aName = *pLayoutName;
+ maLbDims.InsertEntry( aName );
++ maNameIndexMap.insert(DimNameIndexMap::value_type(aName, nDim));
++ }
+ }
+ }
+ if( maLbDims.GetEntryCount() )
+@@ -738,7 +746,17 @@ short ScDPShowDetailDlg::Execute()
+
+ String ScDPShowDetailDlg::GetDimensionName() const
+ {
+- return maLbDims.GetSelectEntry();
++ // Look up the internal dimension name which may be different from the
++ // displayed field name.
++ String aSelectedName = maLbDims.GetSelectEntry();
++ DimNameIndexMap::const_iterator itr = maNameIndexMap.find(aSelectedName);
++ if (itr == maNameIndexMap.end())
++ // This should never happen!
++ return aSelectedName;
++
++ long nDim = itr->second;
++ BOOL bIsDataLayout = false;
++ return mrDPObj.GetDimName(nDim, bIsDataLayout);
+ }
+
+ IMPL_LINK( ScDPShowDetailDlg, DblClickHdl, ListBox*, pLBox )
+diff --git sc/source/ui/dbgui/pvlaydlg.cxx sc/source/ui/dbgui/pvlaydlg.cxx
+index 0c0bdd5..fb60d32 100644
+--- sc/source/ui/dbgui/pvlaydlg.cxx
++++ sc/source/ui/dbgui/pvlaydlg.cxx
+@@ -63,6 +63,7 @@
+ #include "sc.hrc" //CHINA001
+ #include "scabstdlg.hxx" //CHINA001
+ using namespace com::sun::star;
++using ::rtl::OUString;
+
+ //----------------------------------------------------------------------------
+
+@@ -1494,6 +1495,8 @@ IMPL_LINK( ScDPLayoutDlg, OkHdl, OKButton *, EMPTYARG )
+ nPageCount, nColCount, nRowCount, nDataCount );
+ if ( bFit )
+ {
++ ScDPSaveData* pOldSaveData = xDlgDPObject->GetSaveData();
++
+ ScRange aOutRange( aAdrDest ); // bToNewTable is passed separately
+
+ ScDPSaveData aSaveData;
+@@ -1525,6 +1528,22 @@ IMPL_LINK( ScDPLayoutDlg, OkHdl, OKButton *, EMPTYARG )
+ pDim->SetSortInfo( &aIt->maSortInfo );
+ pDim->SetLayoutInfo( &aIt->maLayoutInfo );
+ pDim->SetAutoShowInfo( &aIt->maShowInfo );
++ ScDPSaveDimension* pOldDim = NULL;
++ if (pOldSaveData)
++ {
++ // Transfer the existing layout names to new dimension instance.
++ pOldDim = pOldSaveData->GetExistingDimensionByName(aIt->maName);
++ if (pOldDim)
++ {
++ const OUString* pLayoutName = pOldDim->GetLayoutName();
++ if (pLayoutName)
++ pDim->SetLayoutName(*pLayoutName);
++
++ const OUString* pSubtotalName = pOldDim->GetSubtotalName();
++ if (pSubtotalName)
++ pDim->SetSubtotalName(*pSubtotalName);
++ }
++ }
+
+ bool bManualSort = ( aIt->maSortInfo.Mode == sheet::DataPilotFieldSortMode::MANUAL );
+
+@@ -1545,11 +1564,33 @@ IMPL_LINK( ScDPLayoutDlg, OkHdl, OKButton *, EMPTYARG )
+ ScDPSaveMember* pMember = pDim->GetMemberByName( *pItem );
+ pMember->SetIsVisible( bIsVisible );
+ pMember->SetShowDetails( bShowDetails );
++ if (pOldDim)
++ {
++ // Transfer the existing layout name.
++ ScDPSaveMember* pOldMember = pOldDim->GetMemberByName(*pItem);
++ if (pOldMember)
++ {
++ const OUString* pLayoutName = pOldMember->GetLayoutName();
++ if (pLayoutName)
++ pMember->SetLayoutName(*pLayoutName);
++ }
++ }
+ }
+ }
+ }
+ }
+ }
++ ScDPSaveDimension* pDim = aSaveData.GetDataLayoutDimension();
++ if (pDim && pOldSaveData)
++ {
++ ScDPSaveDimension* pOldDim = pOldSaveData->GetDataLayoutDimension();
++ if (pOldDim)
++ {
++ const OUString* pLayoutName = pOldDim->GetLayoutName();
++ if (pLayoutName)
++ pDim->SetLayoutName(*pLayoutName);
++ }
++ }
+
+ USHORT nWhichPivot = SC_MOD()->GetPool().GetWhich( SID_PIVOT_TABLE );
+ ScPivotItem aOutItem( nWhichPivot, &aSaveData, &aOutRange, bToNewTable );
+diff --git sc/source/ui/inc/pvfundlg.hxx sc/source/ui/inc/pvfundlg.hxx
+index 989051c..2d07d7f 100644
+--- sc/source/ui/inc/pvfundlg.hxx
++++ sc/source/ui/inc/pvfundlg.hxx
+@@ -55,6 +55,8 @@
+ #include <sfx2/itemconnect.hxx>
+ #include "pivot.hxx"
+
++#include <hash_map>
++
+ // ============================================================================
+
+ typedef sfx::ListBoxWrapper< sal_Int32 > ScDPListBoxWrapper;
+@@ -217,6 +219,11 @@ public:
+
+ virtual short Execute();
+
++ /**
++ * @return String internal name of the selected field. Note that this may
++ * be different from the name displayed in the dialog if the field
++ * has a layout name.
++ */
+ String GetDimensionName() const;
+
+ private:
+@@ -228,6 +235,10 @@ private:
+ OKButton maBtnOk;
+ CancelButton maBtnCancel;
+ HelpButton maBtnHelp;
++
++ typedef ::std::hash_map<String, long, ScStringHashCode> DimNameIndexMap;
++ DimNameIndexMap maNameIndexMap;
++ ScDPObject& mrDPObj;
+ };
+
+ // ============================================================================
diff --git sc/source/ui/unoobj/dapiuno.cxx sc/source/ui/unoobj/dapiuno.cxx
index 61715d8..5874bdd 100644
--- sc/source/ui/unoobj/dapiuno.cxx
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]