include/oox/export/chartexport.hxx |    1 +
 include/oox/export/drawingml.hxx   |    3 +++
 oox/source/export/chartexport.cxx  |   22 ++++++++++++++++++++++
 oox/source/export/drawingml.cxx    |   10 +++++++---
 4 files changed, 33 insertions(+), 3 deletions(-)

New commits:
commit 38df2698123d52461679b4bedadd693b23cb4794
Author: Markus Mohrhard <markus.mohrh...@googlemail.com>
Date:   Thu Dec 28 21:12:18 2017 +0100

    support exporting of hatch for chart background, tdf#114180
    
    It seems that the hatch properties can not easily be exported. MSO
    just knows some hard-coded patterns.
    
    Change-Id: Ib1d0bbe503d77bfeb90faf90367bd5fdb477af64
    Reviewed-on: https://gerrit.libreoffice.org/47156
    Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: Markus Mohrhard <markus.mohrh...@googlemail.com>

diff --git a/include/oox/export/chartexport.hxx 
b/include/oox/export/chartexport.hxx
index 4ac5ee10bb2b..6d336f9a863b 100644
--- a/include/oox/export/chartexport.hxx
+++ b/include/oox/export/chartexport.hxx
@@ -139,6 +139,7 @@ private:
     void exportFill( const css::uno::Reference< css::beans::XPropertySet >& 
xPropSet );
     void exportGradientFill( const css::uno::Reference< 
css::beans::XPropertySet >& xPropSet );
     void exportBitmapFill( const css::uno::Reference< css::beans::XPropertySet 
>& xPropSet );
+    void exportHatch(const css::uno::Reference<css::beans::XPropertySet>& 
xPropSet);
     void exportDataTable( );
 
     void exportAreaChart( const css::uno::Reference< css::chart2::XChartType 
>& xChartType );
diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx
index 14bd8eae4664..c8faa08001fd 100644
--- a/include/oox/export/drawingml.hxx
+++ b/include/oox/export/drawingml.hxx
@@ -27,6 +27,7 @@
 #include <com/sun/star/uno/Reference.hxx>
 #include <com/sun/star/uno/Sequence.hxx>
 #include <com/sun/star/style/ParagraphAdjust.hpp>
+#include <com/sun/star/drawing/Hatch.hpp>
 #include <oox/dllapi.h>
 #include <oox/drawingml/drawingmltypes.hxx>
 #include <oox/token/tokens.hxx>
@@ -187,6 +188,8 @@ public:
     void WriteBlipFill( const css::uno::Reference< css::beans::XPropertySet >& 
rXPropSet,
                          const OUString& sURLPropName, sal_Int32 nXmlNamespace 
);
     void WritePattFill( const css::uno::Reference< css::beans::XPropertySet >& 
rXPropSet );
+    void WritePattFill(const css::uno::Reference<css::beans::XPropertySet>& 
rXPropSet,
+            const css::drawing::Hatch& rHatch);
     void WriteSrcRect( const css::uno::Reference< css::beans::XPropertySet >&, 
const OUString& );
     void WriteOutline( const css::uno::Reference< css::beans::XPropertySet >& 
rXPropSet );
     void WriteStretch( const css::uno::Reference< css::beans::XPropertySet >& 
rXPropSet, const OUString& rURL );
diff --git a/oox/source/export/chartexport.cxx 
b/oox/source/export/chartexport.cxx
index 83b96fb0f518..23a6b1a95d3a 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -1244,11 +1244,33 @@ void ChartExport::exportFill( const Reference< 
XPropertySet >& xPropSet )
         case FillStyle_BITMAP :
             exportBitmapFill( xPropSet );
             break;
+        case FillStyle_HATCH:
+            exportHatch(xPropSet);
+        break;
         default:
             WriteFill( xPropSet );
     }
 }
 
+void ChartExport::exportHatch( const Reference< XPropertySet >& xPropSet )
+{
+    if (!xPropSet.is())
+        return;
+
+    if (GetProperty(xPropSet, "FillHatchName"))
+    {
+        OUString aHatchName;
+        mAny >>= aHatchName;
+        uno::Reference< lang::XMultiServiceFactory > xFact( getModel(), 
uno::UNO_QUERY );
+        uno::Reference< container::XNameAccess > xHatchTable( 
xFact->createInstance("com.sun.star.drawing.HatchTable"), uno::UNO_QUERY );
+        uno::Any rValue = xHatchTable->getByName(aHatchName);
+        css::drawing::Hatch aHatch;
+        rValue >>= aHatch;
+        WritePattFill(xPropSet, aHatch);
+    }
+
+}
+
 void ChartExport::exportBitmapFill( const Reference< XPropertySet >& xPropSet )
 {
     if( xPropSet.is() )
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index bb60a5697c57..34dabd7802c9 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -1185,11 +1185,16 @@ void DrawingML::WritePattFill( const Reference< 
XPropertySet >& rXPropSet )
     {
         drawing::Hatch aHatch;
         mAny >>= aHatch;
+        WritePattFill(rXPropSet, aHatch);
+    }
+}
 
-        mpFS->startElementNS( XML_a , XML_pattFill, XML_prst, 
GetHatchPattern(aHatch), FSEND );
+void DrawingML::WritePattFill(const Reference<XPropertySet>& rXPropSet, const 
css::drawing::Hatch& rHatch)
+{
+        mpFS->startElementNS( XML_a , XML_pattFill, XML_prst, 
GetHatchPattern(rHatch), FSEND );
 
         mpFS->startElementNS( XML_a , XML_fgClr, FSEND );
-        WriteColor(aHatch.Color);
+        WriteColor(rHatch.Color);
         mpFS->endElementNS( XML_a , XML_fgClr );
 
         sal_uInt32 nColor = COL_WHITE;
@@ -1215,7 +1220,6 @@ void DrawingML::WritePattFill( const Reference< 
XPropertySet >& rXPropSet )
         mpFS->endElementNS( XML_a , XML_bgClr );
 
         mpFS->endElementNS( XML_a , XML_pattFill );
-    }
 }
 
 void DrawingML::WriteSrcRect( const Reference< XPropertySet >& rXPropSet, 
const OUString& rURL )
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to