From 584cbb64ac1d3ed6db5531159cd8057a345cfb1e Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Sun, 17 Nov 2019 14:18:18 +0300 Subject: tdf#121186: sync itemset and supportsFullDrawingLayerFillAttributeSet MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In the bugdoc, there are three separate section styles, first of which (Sect1) has fo:background-color attribute set to #ffffff, others with no background-related attributes. The sections using the styles are nested, the outermost one using the style Sect1 with background color. When the XML is read, SwXTextSection::attach is called, which fills an item set with values stored in an SwTextSectionProperties_Impl struct, SvxBrushItem with color value of 0x00ffffff among them. The resulting set contains the SvxBrushItem item (WhichId = RES_BACKGROUND = 105). No XATTR_FILL_FIRST .. XATTR_FILL_LAST are put into the set. When later the Edit Sections dialog is opened, SectRepr objects are constructed for each section, and the brush is taken from section's format using makeBackgroundBrushItem. It checks supportsFullDrawingLayerFillAttributeSet, and if yes, uses getSvxBrushItemFromSourceSet to fill in the SvxBrushItem; the latter only considers XATTR_FILL_FIRST .. XATTR_FILL_LAST in the passed set. For the SwSectionFormat, supportsFullDrawingLayerFillAttributeSet inherited from SwFrameFormat returns true, which means that existing RES_BACKGROUND item is ignored, and default transparent color is returned. Fix by returning false from supportsFullDrawingLayerFillAttributeSet for SwSectionFormat. This makes nested sections' properties and behaviour match what was in older versions (4.0), where all three nested sections took white fill; and only setting innermost section's fill to none made it transparent (show document's background). Change-Id: Id0b4fce221cfa9c54097e69a3acfdf018a1043b5 Reviewed-on: https://gerrit.libreoffice.org/83016 Tested-by: Jenkins Reviewed-by: Mike Kaganski (cherry picked from commit 8586051f02125e7358984d2cd14c5383b26bd246) Reviewed-on: https://gerrit.libreoffice.org/83244 Reviewed-by: Xisco FaulĂ­ --- sw/inc/section.hxx | 1 + sw/source/core/docnode/section.cxx | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/sw/inc/section.hxx b/sw/inc/section.hxx index 54b3f8f86c01..0776afda4cf9 100644 --- a/sw/inc/section.hxx +++ b/sw/inc/section.hxx @@ -329,6 +329,7 @@ public: virtual bool IsInUndo() const override; virtual bool IsInContent() const override; virtual css::uno::Reference< css::rdf::XMetadatable > MakeUnoObject() override; + virtual bool supportsFullDrawingLayerFillAttributeSet() const override; void dumpAsXml(xmlTextWriterPtr pWriter) const; }; diff --git a/sw/source/core/docnode/section.cxx b/sw/source/core/docnode/section.cxx index 76dad3f7ffb1..21e4247cfc62 100644 --- a/sw/source/core/docnode/section.cxx +++ b/sw/source/core/docnode/section.cxx @@ -1061,6 +1061,11 @@ SwSectionFormat::MakeUnoObject() return xMeta; } +bool SwSectionFormat::supportsFullDrawingLayerFillAttributeSet() const +{ + return false; +} + void SwSectionFormat::dumpAsXml(xmlTextWriterPtr pWriter) const { xmlTextWriterStartElement(pWriter, BAD_CAST("SwSectionFormat")); -- cgit