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

New commits:
commit 1a4639dd8024484971859bcce31470584bc6b973
Author:     Justin Luth <justin.l...@collabora.com>
AuthorDate: Wed Feb 14 10:48:08 2024 -0500
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Fri Feb 23 10:57:11 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>

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
index d2bd3440a90b..2e6c10c99031 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
@@ -10,6 +10,7 @@
 #include <swmodeltestbase.hxx>
 
 #include <com/sun/star/awt/FontSlant.hpp>
+#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>
@@ -384,6 +385,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 c2b7ea47d395..787908091589 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -9627,8 +9627,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()));
@@ -9650,17 +9648,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