[Libreoffice-commits] core.git: Branch 'libreoffice-4-4' - include/xmloff sc/qa

Miklos Vajna vmiklos at collabora.co.uk
Mon Aug 31 03:39:38 PDT 2015


 include/xmloff/PageMasterStyleMap.hxx |   12 ++++++------
 sc/qa/unit/data/ods/header-image.ods  |binary
 sc/qa/unit/subsequent_export-test.cxx |   16 ++++++++++++++++
 3 files changed, 22 insertions(+), 6 deletions(-)

New commits:
commit ff27d358cd9a3c9ae8eb7153e00d1b6dde07b850
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Mon Aug 31 09:05:59 2015 +0200

    tdf#89245 xmloff: fix Calc header background image saving
    
    Regression from commit 7d9bb549d498d6beed2c4050c402d09643febdfa
    (Related: #i124638# Second step of DrawingLayer FillAttributes...,
    2014-06-02), the problem was that the new
    CTF_PM_REPEAT_OFFSET_X..CTF_PM_FILLTRANSNAME range's values overlapped with the
    existing CTF_PM_HEADERHEIGHT..CTF_PM_HEADERGRAPHICURL range's values, so
    when the new code in XMLPageMasterExportPropMapper::ContextFilter()
    tried to tweak header repeat offset properties, it actually disabled
    HeaderBackGraphicURL instead.
    
    (cherry picked from commit 3b40329f9a64b93b1e1230b1bff74ed8cda8cd70)
    
    Conflicts:
    	sc/qa/unit/subsequent_export-test.cxx
    
    Change-Id: I9c2700fa71a4ef2a813ec671049ee9d98171b57e
    Reviewed-on: https://gerrit.libreoffice.org/18162
    Reviewed-by: Andras Timar <andras.timar at collabora.com>
    Tested-by: Andras Timar <andras.timar at collabora.com>

diff --git a/include/xmloff/PageMasterStyleMap.hxx b/include/xmloff/PageMasterStyleMap.hxx
index a4007bd..859f3e0 100644
--- a/include/xmloff/PageMasterStyleMap.hxx
+++ b/include/xmloff/PageMasterStyleMap.hxx
@@ -90,12 +90,12 @@
 // at export time using CTF_PM_FLAGMASK and XML_PM_CTF_START as detector
 // to find the first entry for header/footer (!), see
 // SvXMLAutoStylePoolP_Impl::exportXML, look for XML_STYLE_FAMILY_PAGE_MASTER
-#define CTF_PM_REPEAT_OFFSET_X          (XML_PM_CTF_START + 0x0035)
-#define CTF_PM_REPEAT_OFFSET_Y          (XML_PM_CTF_START + 0x0036)
-#define CTF_PM_FILLGRADIENTNAME         (XML_PM_CTF_START + 0x0037)
-#define CTF_PM_FILLHATCHNAME            (XML_PM_CTF_START + 0x0038)
-#define CTF_PM_FILLBITMAPNAME           (XML_PM_CTF_START + 0x0039)
-#define CTF_PM_FILLTRANSNAME            (XML_PM_CTF_START + 0x0040)
+#define CTF_PM_REPEAT_OFFSET_X          (XML_PM_CTF_START + 0x0037)
+#define CTF_PM_REPEAT_OFFSET_Y          (XML_PM_CTF_START + 0x0038)
+#define CTF_PM_FILLGRADIENTNAME         (XML_PM_CTF_START + 0x0039)
+#define CTF_PM_FILLHATCHNAME            (XML_PM_CTF_START + 0x0040)
+#define CTF_PM_FILLBITMAPNAME           (XML_PM_CTF_START + 0x0041)
+#define CTF_PM_FILLTRANSNAME            (XML_PM_CTF_START + 0x0042)
 
 #define CTF_PM_SCALETO                  (XML_PM_CTF_START + 0x0051) // calc specific
 #define CTF_PM_SCALETOPAGES             (XML_PM_CTF_START + 0x0052)
diff --git a/sc/qa/unit/data/ods/header-image.ods b/sc/qa/unit/data/ods/header-image.ods
new file mode 100644
index 0000000..c19b902
Binary files /dev/null and b/sc/qa/unit/data/ods/header-image.ods differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index 33312e4..a6f273b 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -135,6 +135,7 @@ public:
     void testLinkedGraphicRT();
 
     void testSupBookVirtualPath();
+    void testHeaderImage();
 
     CPPUNIT_TEST_SUITE(ScExportTest);
     CPPUNIT_TEST(test);
@@ -180,6 +181,7 @@ public:
 #endif
     CPPUNIT_TEST(testSwappedOutImageExport);
     CPPUNIT_TEST(testLinkedGraphicRT);
+    CPPUNIT_TEST(testHeaderImage);
 
     CPPUNIT_TEST_SUITE_END();
 
@@ -2417,6 +2419,20 @@ void ScExportTest::testLinkedGraphicRT()
     }
 }
 
+void ScExportTest::testHeaderImage()
+{
+    // Graphic as header background was lost on export.
+    ScDocShellRef xShell = loadDoc("header-image.", ODS);
+    ScDocShellRef xDocSh = saveAndReload(&(*xShell), ODS);
+    uno::Reference<style::XStyleFamiliesSupplier> xStyleFamiliesSupplier(xDocSh->GetModel(), uno::UNO_QUERY);
+    uno::Reference<container::XNameAccess> xStyleFamilies = xStyleFamiliesSupplier->getStyleFamilies();
+    uno::Reference<container::XNameAccess> xPageStyles(xStyleFamilies->getByName("PageStyles"), uno::UNO_QUERY);
+    uno::Reference<beans::XPropertySet> xStyle(xPageStyles->getByName("Default"), uno::UNO_QUERY);
+    OUString aURL;
+    xStyle->getPropertyValue("HeaderBackGraphicURL") >>= aURL;
+    CPPUNIT_ASSERT(aURL.startsWith("vnd.sun.star.GraphicObject:"));
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();


More information about the Libreoffice-commits mailing list