[Libreoffice-commits] core.git: sc/qa sc/source

Tamás Zolnai tamas.zolnai at collabora.com
Thu Oct 19 17:31:36 UTC 2017


 sc/qa/unit/data/ods/pivottable_no_columns_layout.ods |binary
 sc/qa/unit/subsequent_filters-test.cxx               |   30 +++++++++++++++++++
 sc/source/core/data/dpoutputgeometry.cxx             |    2 -
 sc/source/filter/xml/xmldpimp.cxx                    |    1 
 4 files changed, 32 insertions(+), 1 deletion(-)

New commits:
commit 291874c09c4bcde61f2c6808f2df6079f38d74e0
Author: Tamás Zolnai <tamas.zolnai at collabora.com>
Date:   Thu Oct 19 15:11:41 2017 +0200

    tdf#113268: Pivot table: Missing popup button after opening a ODS
    
    Wrong row number was calculated here. This ++nCurRow is usefull
    only when headerlayout flag is set. It's a MSO compatibility flag
    so it's not there by default in LO created tables.
    
    Change-Id: Id7989d898f2647f1ba45ed95e0aa615e3b4fa311
    Reviewed-on: https://gerrit.libreoffice.org/43552
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Tamás Zolnai <tamas.zolnai at collabora.com>

diff --git a/sc/qa/unit/data/ods/pivottable_no_columns_layout.ods b/sc/qa/unit/data/ods/pivottable_no_columns_layout.ods
new file mode 100755
index 000000000000..e6ddca7299fc
Binary files /dev/null and b/sc/qa/unit/data/ods/pivottable_no_columns_layout.ods differ
diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index 459a85d4377b..12363205ed41 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -247,6 +247,7 @@ public:
     void testPageScalingXLSX();
     void testActiveXCheckboxXLSX();
     void testTdf112501();
+    void testPivotTableNoColumnsLayout();
 #ifdef UNX
     void testUnicodeFileNameGnumeric();
 #endif
@@ -378,6 +379,7 @@ public:
     CPPUNIT_TEST(testPageScalingXLSX);
     CPPUNIT_TEST(testActiveXCheckboxXLSX);
     CPPUNIT_TEST(testTdf112501);
+    CPPUNIT_TEST(testPivotTableNoColumnsLayout);
 #ifdef UNX
     CPPUNIT_TEST(testUnicodeFileNameGnumeric);
 #endif
@@ -4116,6 +4118,34 @@ void ScFiltersTest::testTdf112501()
     }
 }
 
+void ScFiltersTest::testPivotTableNoColumnsLayout()
+{
+    // tdf#113268 - Pivot table: Missing popup button after opening a pivot table from ODS
+    ScDocShellRef xDocSh = loadDoc("pivottable_no_columns_layout.", FORMAT_ODS);
+    CPPUNIT_ASSERT_MESSAGE("Failed to load file", xDocSh.is());
+    ScDocument& rDoc = xDocSh->GetDocument();
+
+    // There should be exactly 2 pivot tables
+    ScDPCollection* pDPs = rDoc.GetDPCollection();
+    CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(2), pDPs->GetCount());
+
+    // Check first pivot table's popup button (headerlayout flag)
+    {
+        const ScPatternAttr* pPattern = rDoc.GetPattern(0, 1, 1);
+        const SfxPoolItem& rPoolItem = pPattern->GetItem(ATTR_MERGE_FLAG);
+        const ScMergeFlagAttr& rMergeFlag = static_cast<const ScMergeFlagAttr&>(rPoolItem);
+        CPPUNIT_ASSERT(rMergeFlag.GetValue() & ScMF::ButtonPopup);
+    }
+
+    // Check second pivot table's popup button
+    {
+        const ScPatternAttr* pPattern = rDoc.GetPattern(3, 0, 1);
+        const SfxPoolItem& rPoolItem = pPattern->GetItem(ATTR_MERGE_FLAG);
+        const ScMergeFlagAttr& rMergeFlag = static_cast<const ScMergeFlagAttr&>(rPoolItem);
+        CPPUNIT_ASSERT(rMergeFlag.GetValue() & ScMF::ButtonPopup);
+    }
+}
+
 
 ScFiltersTest::ScFiltersTest()
       : ScBootstrapFixture( "sc/qa/unit/data" )
diff --git a/sc/source/core/data/dpoutputgeometry.cxx b/sc/source/core/data/dpoutputgeometry.cxx
index 8d3ec1c09589..c4878f5127a4 100644
--- a/sc/source/core/data/dpoutputgeometry.cxx
+++ b/sc/source/core/data/dpoutputgeometry.cxx
@@ -239,7 +239,7 @@ ScDPOutputGeometry::getFieldButtonType(const ScAddress& rPos) const
 
         nCurRow += static_cast<SCROW>(nColumnFields);
     }
-    else
+    else if (mbHeaderLayout)
         ++nCurRow;
 
     if (nRowFields)
diff --git a/sc/source/filter/xml/xmldpimp.cxx b/sc/source/filter/xml/xmldpimp.cxx
index 73108271cc95..d4186f8a0c5d 100644
--- a/sc/source/filter/xml/xmldpimp.cxx
+++ b/sc/source/filter/xml/xmldpimp.cxx
@@ -330,6 +330,7 @@ void ScXMLDataPilotTableContext::SetButtons()
     aGeometry.setPageFieldCount(mnPageFieldCount);
     aGeometry.setDataFieldCount(mnDataFieldCount);
     aGeometry.setDataLayoutType(toFieldType(mnDataLayoutType));
+    aGeometry.setHeaderLayout(bHeaderGridLayout);
 
     std::vector<const ScDPSaveDimension*> aRowDims, aColDims, aPageDims;
     pDPSave->GetAllDimensionsByOrientation(sheet::DataPilotFieldOrientation_ROW, aRowDims);


More information about the Libreoffice-commits mailing list