Kaydet (Commit) 38df2698 authored tarafından Markus Mohrhard's avatar Markus Mohrhard

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/47156Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMarkus Mohrhard <markus.mohrhard@googlemail.com>
üst d436c4ea
......@@ -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 );
......
......@@ -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 );
......
......@@ -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() )
......
......@@ -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 )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment