diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-09-17 11:24:56 -0400 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2014-09-23 02:09:49 -0700 |
commit | d192533c4ce32cb1a9e5eb011bbe29e14acad9d5 (patch) | |
tree | 22afcd0ae5339b373a40ee181ee0ab50211e0d20 /sc | |
parent | 21297a3249aec0bda08b5b7e1c8091bb4417e255 (diff) |
bnc#592918: Display data description in pivot table.
When there are no column fields and exactly one data field.
Change-Id: I10d2af7e626f98a4d8a981e078e99e7da9207d1c
(cherry picked from commit 902564bfe52e7699cefc80b3334c2eb0a8cacdcf)
Diffstat (limited to 'sc')
-rw-r--r-- | sc/qa/unit/ucalc_pivottable.cxx | 52 | ||||
-rw-r--r-- | sc/source/core/data/dpoutput.cxx | 9 |
2 files changed, 35 insertions, 26 deletions
diff --git a/sc/qa/unit/ucalc_pivottable.cxx b/sc/qa/unit/ucalc_pivottable.cxx index 00e83b9f122c..65ed2fd2461e 100644 --- a/sc/qa/unit/ucalc_pivottable.cxx +++ b/sc/qa/unit/ucalc_pivottable.cxx @@ -1107,7 +1107,7 @@ void Test::testPivotTableNormalGrouping() { // Expected output table content. 0 = empty cell const char* aOutputCheck[][2] = { - { "Name", 0 }, + { "Name", "Sum - Value" }, { "A", "1" }, { "B", "2" }, { "C", "3" }, @@ -1155,7 +1155,7 @@ void Test::testPivotTableNormalGrouping() { // Expected output table content. 0 = empty cell const char* aOutputCheck[][3] = { - { "Name2", "Name", 0 }, + { "Name2", "Name", "Sum - Value" }, { "D", "D", "4" }, { "E", "E", "5" }, { "F", "F", "6" }, @@ -1192,7 +1192,7 @@ void Test::testPivotTableNormalGrouping() { // Expected output table content. 0 = empty cell const char* aOutputCheck[][3] = { - { "Name2", "Name", 0 }, + { "Name2", "Name", "Sum - Value" }, { "G", "G", "7" }, { "Group1", "A", "1" }, { 0, "B", "2" }, @@ -1289,7 +1289,7 @@ void Test::testPivotTableNumberGrouping() { // Expected output table content. 0 = empty cell const char* aOutputCheck[][2] = { - { "Order", 0 }, + { "Order", "Sum - Score" }, { "<30", "423" }, { "30-39", "87" }, { "40-49", "241" }, @@ -1404,7 +1404,7 @@ void Test::testPivotTableDateGrouping() { // Expected output table content. 0 = empty cell const char* aOutputCheck[][4] = { - { "Years", "Quarters", "Date", 0 }, + { "Years", "Quarters", "Date", "Sum - Value" }, { "2011", "Q1", "Jan", "1" }, { 0, 0, "Mar", "2" }, { 0, "Q3", "Sep", "7" }, @@ -1436,7 +1436,7 @@ void Test::testPivotTableDateGrouping() { // Expected output table content. 0 = empty cell const char* aOutputCheck[][4] = { - { "Years", "Quarters", "Date", 0 }, + { "Years", "Quarters", "Date", "Sum - Value" }, { "2011", "Q1", "Jan", "1" }, { 0, 0, "Mar", "2" }, { 0, "Q3", "Sep", "7" }, @@ -1460,7 +1460,7 @@ void Test::testPivotTableDateGrouping() { // Expected output table content. 0 = empty cell const char* aOutputCheck[][2] = { - { "Date", 0 }, + { "Date", "Sum - Value" }, { "2011-01-01", "1" }, { "2011-03-02", "2" }, { "2011-09-03", "7" }, @@ -1528,7 +1528,7 @@ void Test::testPivotTableEmptyRows() { // Expected output table content. 0 = empty cell const char* aOutputCheck[][2] = { - { "Name", 0 }, + { "Name", "Sum - Value" }, { "A", "1" }, { "B", "2" }, { "C", "3" }, @@ -1551,7 +1551,7 @@ void Test::testPivotTableEmptyRows() { // Expected output table content. 0 = empty cell const char* aOutputCheck[][2] = { - { "Name", 0 }, + { "Name", "Sum - Value" }, { "A", "1" }, { "B", "2" }, { "C", "3" }, @@ -1578,7 +1578,7 @@ void Test::testPivotTableEmptyRows() { // Expected output table content. 0 = empty cell const char* aOutputCheck[][2] = { - { "Name", 0 }, + { "Name", "Sum - Value" }, { "B", "3" }, { "C", "3" }, { "D", "4" }, @@ -1656,7 +1656,7 @@ void Test::testPivotTableTextNumber() { // Expected output table content. 0 = empty cell const char* aOutputCheck[][2] = { - { "Name", 0 }, + { "Name", "Sum - Value" }, { "0001", "1" }, { "0002", "2" }, { "0003", "3" }, @@ -1715,7 +1715,7 @@ void Test::testPivotTableCaseInsensitiveStrings() { // Expected output table content. 0 = empty cell const char* aOutputCheck[][2] = { - { "Name", 0 }, + { "Name", "Sum - Value" }, { "A", "3" }, { "Total Result", "3" }, }; @@ -1878,7 +1878,7 @@ void Test::testPivotTableFieldReference() { // Expected output table content. 0 = empty cell const char* aOutputCheck[][2] = { - { "Name", 0 }, + { "Name", "Sum - Value" }, { "A", "1" }, { "B", "2" }, { "C", "4" }, @@ -1905,7 +1905,7 @@ void Test::testPivotTableFieldReference() { // Expected output table content. 0 = empty cell const char* aOutputCheck[][2] = { - { "Name", 0 }, + { "Name", "Sum - Value" }, { "A", 0 }, { "B", "1" }, { "C", "3" }, @@ -1925,7 +1925,7 @@ void Test::testPivotTableFieldReference() { // Expected output table content. 0 = empty cell const char* aOutputCheck[][2] = { - { "Name", 0 }, + { "Name", "Sum - Value" }, { "A", "100.00%" }, { "B", "200.00%" }, { "C", "400.00%" }, @@ -1945,7 +1945,7 @@ void Test::testPivotTableFieldReference() { // Expected output table content. 0 = empty cell const char* aOutputCheck[][2] = { - { "Name", 0 }, + { "Name", "Sum - Value" }, { "A", 0 }, { "B", "100.00%" }, { "C", "300.00%" }, @@ -1965,7 +1965,7 @@ void Test::testPivotTableFieldReference() { // Expected output table content. 0 = empty cell const char* aOutputCheck[][2] = { - { "Name", 0 }, + { "Name", "Sum - Value" }, { "A", "1" }, { "B", "3" }, { "C", "7" }, @@ -1985,7 +1985,7 @@ void Test::testPivotTableFieldReference() { // Expected output table content. 0 = empty cell const char* aOutputCheck[][2] = { - { "Name", 0 }, + { "Name", "Sum - Value" }, { "A", "6.67%" }, { "B", "13.33%" }, { "C", "26.67%" }, @@ -2050,7 +2050,7 @@ void Test::testPivotTableDocFunc() { // Expected output table content. 0 = empty cell const char* aOutputCheck[][2] = { - { "Name", 0 }, + { "Name", "Sum - Value" }, { "Apple", "16" }, { "Microsoft", "32" }, { "Oracle", "2" }, @@ -2119,7 +2119,7 @@ void Test::testFuncGETPIVOTDATA() { // Expected output table content. 0 = empty cell const char* aOutputCheck[][2] = { - { "Name", 0 }, + { "Name", "Sum - Value" }, { "A", "6" }, { "B", "15" }, { "Total Result", "21" }, @@ -2277,12 +2277,12 @@ void Test::testFuncGETPIVOTDATALeafAccess() { // Expected output table content. 0 = empty cell const char* aOutputCheck[][3] = { - { "Type", "Member", 0 }, - { "A", "Anna", "1" }, - { 0, "Cecilia", "3" }, - { "B", "Brittany", "2" }, - { 0, "Donna", "4" }, - { "Total Result", 0, "10" }, + { "Type", "Member", "Sum - Value" }, + { "A", "Anna", "1" }, + { 0, "Cecilia", "3" }, + { "B", "Brittany", "2" }, + { 0, "Donna", "4" }, + { "Total Result", 0, "10" }, }; bSuccess = checkDPTableOutput<3>(m_pDoc, aOutRange, aOutputCheck, "Pivot table refreshed"); diff --git a/sc/source/core/data/dpoutput.cxx b/sc/source/core/data/dpoutput.cxx index c03b8ce1b427..83b4730af1c7 100644 --- a/sc/source/core/data/dpoutput.cxx +++ b/sc/source/core/data/dpoutput.cxx @@ -1129,6 +1129,15 @@ void ScDPOutput::Output() } } + if (nColCount == 1 && nRowCount > 0 && nColFieldCount == 0) + { + // the table contains excatly one data field and no column fields. + // Display data description at top right corner. + ScSetStringParam aParam; + aParam.setTextInput(); + pDoc->SetString(nDataStartCol, nDataStartRow-1, nTab, aDataDescription, &aParam); + } + // output data results: for (long nRow=0; nRow<nRowCount; nRow++) |