diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2017-12-28 21:12:18 +0100 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2018-01-08 00:57:17 +0100 |
commit | 38df2698123d52461679b4bedadd693b23cb4794 (patch) | |
tree | b25e3901bae18841ac4714866296bdae1cca3752 /oox/source | |
parent | d436c4eaeb86a485bcc0206a15f9166063f5fe3e (diff) |
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 <ci@libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Diffstat (limited to 'oox/source')
-rw-r--r-- | oox/source/export/chartexport.cxx | 22 | ||||
-rw-r--r-- | oox/source/export/drawingml.cxx | 10 |
2 files changed, 29 insertions, 3 deletions
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 ) |