summaryrefslogtreecommitdiff
path: root/sw/source/filter/ww8/docxattributeoutput.cxx
diff options
context:
space:
mode:
authorMichael Stahl <Michael.Stahl@cib.de>2020-08-26 17:08:00 +0200
committerMichael Stahl <michael.stahl@cib.de>2020-08-26 20:44:07 +0200
commitd84e590486e2c26212931de80a84181d7aca7bbe (patch)
treeb0e1448db85e72ba5e480ca9ab3fa0573e048821 /sw/source/filter/ww8/docxattributeoutput.cxx
parent8280491bec32fea5bbdad23f000538d000ed2f24 (diff)
sw: DOCX export: don't export text frames as transparent
Writer paints text frames without fill still as opaque but nothing is written in the DOCX file and Word by default treats DrawingML text frame as transparent (the VML fallback is opaque though). Change-Id: I0ce539ac8084c5047b4732abc5c199589ee369ee Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101411 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@cib.de>
Diffstat (limited to 'sw/source/filter/ww8/docxattributeoutput.cxx')
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx24
1 files changed, 24 insertions, 0 deletions
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 83527d26c470..6e39cf528ed0 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -89,8 +89,10 @@
#include <editeng/editobj.hxx>
#include <editeng/keepitem.hxx>
#include <svx/xfillit0.hxx>
+#include <svx/xflclit.hxx>
#include <svx/xflgrit.hxx>
#include <svx/svdouno.hxx>
+#include <svx/unobrushitemhelper.hxx>
#include <svl/grabbagitem.hxx>
#include <sfx2/sfxbasemodel.hxx>
#include <tools/datetimeutils.hxx>
@@ -6003,6 +6005,27 @@ oox::drawingml::DrawingML& DocxAttributeOutput::GetDrawingML()
return m_rDrawingML;
}
+void DocxAttributeOutput::MaybeOutputBrushItem(SfxItemSet const& rSet)
+{
+ const XFillStyleItem* pXFillStyleItem(rSet.GetItem<XFillStyleItem>(XATTR_FILLSTYLE));
+
+ if ((pXFillStyleItem && pXFillStyleItem->GetValue() != drawing::FillStyle_NONE)
+ || !m_rExport.SdrExporter().getDMLTextFrameSyntax())
+ {
+ return;
+ }
+
+ // sw text frames are opaque by default, even with fill none!
+ std::unique_ptr<SfxItemSet> const pClone(rSet.Clone());
+ XFillColorItem const aColor(OUString(), COL_WHITE);
+ pClone->Put(aColor);
+ // call getSvxBrushItemForSolid - this also takes XFillTransparenceItem into account
+ XFillStyleItem const aSolid(drawing::FillStyle_SOLID);
+ pClone->Put(aSolid);
+ std::unique_ptr<SvxBrushItem> const pBrush(getSvxBrushItemFromSourceSet(*pClone, RES_BACKGROUND));
+ FormatBackground(*pBrush);
+}
+
namespace {
/// Functor to do case-insensitive ordering of OUString instances.
@@ -8843,6 +8866,7 @@ void DocxAttributeOutput::FormatBox( const SvxBoxItem& rBox )
{
if (m_rExport.SdrExporter().getDMLTextFrameSyntax())
{
+ // ugh, exporting fill here is quite some hack... this OutputItemSet abstraction is quite leaky
// <a:gradFill> should be before <a:ln>.
const SfxPoolItem* pItem = GetExport().HasItem(XATTR_FILLSTYLE);
if (pItem)