sw/qa/extras/ooxmlexport/ooxmlexport21.cxx   |    4 ++++
 sw/source/filter/ww8/docxattributeoutput.cxx |   18 +++++++++++-------
 2 files changed, 15 insertions(+), 7 deletions(-)

New commits:
commit 7ee5904a12b55eb3abbdf5d0d46f57ffdb7158c7
Author:     Justin Luth <justin.l...@collabora.com>
AuthorDate: Wed Feb 14 10:48:08 2024 -0500
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Mon Feb 26 08:59:03 2024 +0100

    related tdf#126533 DOCX: vml export gradientRadial instead of gradient
    
    ... for everything except the linear gradients (linear/axial)
    
    Interestingly, there was nothing in make sw.check that hit this.
    
    make CppunitTest_sw_ooxmlexport21 \
        CPPUNIT_TEST_NAME=testTdf126533_pageGradient
    
    Change-Id: Id58ed8b312ec29a10ce461ff0e032838b745b11b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163470
    Reviewed-by: Justin Luth <jl...@mail.com>
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163867
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
index b9b04eafb0f1..fcdd26b22924 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
@@ -9,6 +9,7 @@
 
 #include <swmodeltestbase.hxx>
 
+#include <com/sun/star/awt/Gradient2.hpp>
 #include <com/sun/star/beans/XPropertyState.hpp>
 #include <com/sun/star/drawing/FillStyle.hpp>
 #include <com/sun/star/text/XDocumentIndex.hpp>
@@ -80,6 +81,9 @@ DECLARE_OOXMLEXPORT_TEST(testTdf126533_pageGradient, 
"fill.docx")
                                                    uno::UNO_QUERY);
     CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_GRADIENT,
                          getProperty<drawing::FillStyle>(xPageStyle, 
"FillStyle"));
+
+    awt::Gradient2 aGradient = getProperty<awt::Gradient2>(xPageStyle, 
"FillGradient");
+    CPPUNIT_ASSERT_EQUAL(awt::GradientStyle_RECT, aGradient.Style);
 }
 
 DECLARE_OOXMLEXPORT_TEST(testTdf126533_pageBitmap, "tdf126533_pageBitmap.docx")
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 03ada68bcb2d..c04a86ab4e55 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -9632,8 +9632,6 @@ void DocxAttributeOutput::FormatFillGradient( const 
XFillGradientItem& rFillGrad
 {
     if (m_oFillStyle && *m_oFillStyle == drawing::FillStyle_GRADIENT && 
!m_rExport.SdrExporter().getDMLTextFrameSyntax())
     {
-        AddToAttrList( m_rExport.SdrExporter().getFlyFillAttrList(), XML_type, 
"gradient" );
-
         const basegfx::BGradient& rGradient = rFillGradient.GetGradientValue();
         OString sStartColor = 
msfilter::util::ConvertColor(Color(rGradient.GetColorStops().front().getStopColor()));
         OString sEndColor = 
msfilter::util::ConvertColor(Color(rGradient.GetColorStops().back().getStopColor()));
@@ -9655,17 +9653,23 @@ void DocxAttributeOutput::FormatFillGradient( const 
XFillGradientItem& rFillGrad
         switch (rGradient.GetGradientStyle())
         {
             case css::awt::GradientStyle_AXIAL:
+                AddToAttrList(m_rExport.SdrExporter().getFlyFillAttrList(), 
XML_type, "gradient");
                 AddToAttrList( m_rExport.SdrExporter().getFlyFillAttrList(), 
XML_focus, "50%" );
                 // If it is an 'axial' gradient - swap the colors
                 // (because in the import process they were imported swapped)
                 sColor1 = sEndColor;
                 sColor2 = sStartColor;
                 break;
-            case css::awt::GradientStyle_LINEAR: break;
-            case css::awt::GradientStyle_RADIAL: break;
-            case css::awt::GradientStyle_ELLIPTICAL: break;
-            case css::awt::GradientStyle_SQUARE: break;
-            case css::awt::GradientStyle_RECT: break;
+            case css::awt::GradientStyle_LINEAR:
+                AddToAttrList(m_rExport.SdrExporter().getFlyFillAttrList(), 
XML_type, "gradient");
+                break;
+            case css::awt::GradientStyle_RADIAL:
+            case css::awt::GradientStyle_ELLIPTICAL:
+            case css::awt::GradientStyle_SQUARE:
+            case css::awt::GradientStyle_RECT:
+                AddToAttrList(m_rExport.SdrExporter().getFlyFillAttrList(), 
XML_type,
+                              "gradientRadial");
+                break;
             default:
                 break;
         }

Reply via email to