diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-09-17 11:24:56 -0400 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2014-09-17 17:16:46 +0000 |
commit | 800884a0b9ce12924b8ed225571c01e7b0fb0ec7 (patch) | |
tree | 98f058a06258cc69c9d6c2c82b796e5c1a3ec258 /sc | |
parent | 7493c458780cce40f1b564b719c4445b8920f259 (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)
Reviewed-on: https://gerrit.libreoffice.org/11491
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Eike Rathke <erack@redhat.com>
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 5f742a1f98c0..2dd42b402c27 100644 --- a/sc/qa/unit/ucalc_pivottable.cxx +++ b/sc/qa/unit/ucalc_pivottable.cxx @@ -1076,7 +1076,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" }, @@ -1124,7 +1124,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" }, @@ -1161,7 +1161,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" }, @@ -1258,7 +1258,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" }, @@ -1373,7 +1373,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" }, @@ -1405,7 +1405,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" }, @@ -1429,7 +1429,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" }, @@ -1497,7 +1497,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" }, @@ -1520,7 +1520,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" }, @@ -1547,7 +1547,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" }, @@ -1625,7 +1625,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" }, @@ -1709,7 +1709,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" }, }; @@ -1872,7 +1872,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" }, @@ -1899,7 +1899,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" }, @@ -1919,7 +1919,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%" }, @@ -1939,7 +1939,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%" }, @@ -1959,7 +1959,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" }, @@ -1979,7 +1979,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%" }, @@ -2044,7 +2044,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" }, @@ -2113,7 +2113,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" }, @@ -2271,12 +2271,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 21e958f555d9..1185319dc728 100644 --- a/sc/source/core/data/dpoutput.cxx +++ b/sc/source/core/data/dpoutput.cxx @@ -1130,6 +1130,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++) |