[Libreoffice-commits] .: Branch 'feature/dp-named-range-source' - sc/inc sc/source
Kohei Yoshida
kohei at kemper.freedesktop.org
Fri Jan 21 21:03:52 PST 2011
sc/inc/dpshttab.hxx | 2 +-
sc/source/filter/excel/xepivot.cxx | 19 +++++++++++++++++--
sc/source/filter/inc/xepivot.hxx | 2 ++
3 files changed, 20 insertions(+), 3 deletions(-)
New commits:
commit 5d6de3aaa7650ed0bfe8040f680eb57899d94414
Author: Kohei Yoshida <kyoshida at novell.com>
Date: Sat Jan 22 00:02:26 2011 -0500
Export range name data source back to xls document.
diff --git a/sc/inc/dpshttab.hxx b/sc/inc/dpshttab.hxx
index d08984f..8125a04 100644
--- a/sc/inc/dpshttab.hxx
+++ b/sc/inc/dpshttab.hxx
@@ -71,7 +71,7 @@ public:
*/
SC_DLLPUBLIC const ScRange& GetSourceRange() const;
SC_DLLPUBLIC void SetRangeName(const ::rtl::OUString& rName);
- const ::rtl::OUString& GetRangeName() const;
+ SC_DLLPUBLIC const ::rtl::OUString& GetRangeName() const;
bool HasRangeName() const;
void SetQueryParam(const ScQueryParam& rParam);
const ScQueryParam& GetQueryParam() const;
diff --git a/sc/source/filter/excel/xepivot.cxx b/sc/source/filter/excel/xepivot.cxx
index 11e679f..3244a45 100644
--- a/sc/source/filter/excel/xepivot.cxx
+++ b/sc/source/filter/excel/xepivot.cxx
@@ -641,6 +641,7 @@ XclExpPivotCache::XclExpPivotCache( const XclExpRoot& rRoot, const ScDPObject& r
This range may be shorter than maExpSrcRange to improve export
performance (#i22541#). */
maOrigSrcRange = maExpSrcRange = maDocSrcRange = pSrcDesc->GetSourceRange();
+ maSrcRangeName = pSrcDesc->GetRangeName();
// internal sheet data only
SCTAB nScTab = maExpSrcRange.aStart.Tab();
@@ -728,8 +729,14 @@ void XclExpPivotCache::Save( XclExpStream& rStrm )
XclExpUInt16Record( EXC_ID_SXIDSTM, maPCInfo.mnStrmId ).Save( rStrm );
// SXVS
XclExpUInt16Record( EXC_ID_SXVS, EXC_SXVS_SHEET ).Save( rStrm );
- // DCONREF
- WriteDconref( rStrm );
+
+ if (maSrcRangeName.getLength())
+ // DCONNAME
+ WriteDConName(rStrm);
+ else
+ // DCONREF
+ WriteDconref(rStrm);
+
// create the pivot cache storage stream
WriteCacheStream();
}
@@ -855,6 +862,14 @@ void XclExpPivotCache::WriteDconref( XclExpStream& rStrm ) const
rStrm.EndRecord();
}
+void XclExpPivotCache::WriteDConName( XclExpStream& rStrm ) const
+{
+ XclExpString aName(maSrcRangeName);
+ rStrm.StartRecord(EXC_ID_DCONNAME, aName.GetSize() + 2);
+ rStrm << aName << sal_uInt16(0);
+ rStrm.EndRecord();
+}
+
void XclExpPivotCache::WriteCacheStream()
{
SotStorageRef xSvStrg = OpenStorage( EXC_STORAGE_PTCACHE );
diff --git a/sc/source/filter/inc/xepivot.hxx b/sc/source/filter/inc/xepivot.hxx
index 97df866..281bd16 100644
--- a/sc/source/filter/inc/xepivot.hxx
+++ b/sc/source/filter/inc/xepivot.hxx
@@ -224,6 +224,7 @@ private:
/** Writes the DCONREF record containing the source range. */
void WriteDconref( XclExpStream& rStrm ) const;
+ void WriteDConName( XclExpStream& rStrm ) const;
/** Creates the pivot cache storage stream and writes the cache. */
void WriteCacheStream();
@@ -241,6 +242,7 @@ private:
XclPCInfo maPCInfo; /// Pivot cache settings (SXDB record).
XclExpPCFieldList maFieldList; /// List of all pivot cache fields.
String maTabName; /// Name of source data sheet.
+ ::rtl::OUString maSrcRangeName; /// Range name for source data.
ScRange maOrigSrcRange; /// The original sheet source range.
ScRange maExpSrcRange; /// The exported sheet source range.
ScRange maDocSrcRange; /// The range used to build the cache fields and items.
More information about the Libreoffice-commits
mailing list