summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>2022-06-13 08:53:22 +0200
committerThorsten Behrens <thorsten.behrens@allotropia.de>2022-07-06 16:48:19 +0200
commit1e6f9bd1fb110a2a03343f2330bdd38194cd77c8 (patch)
tree0f16b65e54032acced87f4a37030a8b3303bd8c0
parentAdd XFillBackgroundItem::dumpAsXml (diff)
downloadcore-1e6f9bd1fb110a2a03343f2330bdd38194cd77c8.tar.gz
core-1e6f9bd1fb110a2a03343f2330bdd38194cd77c8.zip
tdf#128150 Add OOXML import/export for "use background fill"
and allow editing this fill property in area dlg Change-Id: Ic63ba11e9d499d4a0fb22f6739587e3e25140b8f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134406 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>
-rw-r--r--cui/source/inc/cuitabarea.hxx1
-rw-r--r--cui/source/tabpages/tparea.cxx36
-rw-r--r--cui/uiconfig/ui/areatabpage.ui18
-rw-r--r--include/editeng/unoprnms.hxx1
-rw-r--r--include/oox/drawingml/shape.hxx5
-rw-r--r--include/oox/drawingml/shapepropertymap.hxx1
-rw-r--r--include/svx/strings.hrc1
-rw-r--r--include/svx/unoshprp.hxx4
-rw-r--r--include/svx/xdef.hxx4
-rw-r--r--include/svx/xfilluseslidebackgrounditem.hxx32
-rw-r--r--offapi/com/sun/star/drawing/FillProperties.idl7
-rw-r--r--oox/inc/drawingml/fillproperties.hxx1
-rw-r--r--oox/source/drawingml/fillproperties.cxx4
-rw-r--r--oox/source/drawingml/shape.cxx3
-rw-r--r--oox/source/drawingml/shapepropertymap.cxx1
-rw-r--r--oox/source/export/drawingml.cxx7
-rw-r--r--oox/source/ppt/pptshapegroupcontext.cxx27
-rw-r--r--oox/source/token/properties.txt1
-rw-r--r--sd/qa/unit/import-tests2.cxx27
-rw-r--r--sd/source/filter/eppt/pptx-epptooxml.cxx11
-rw-r--r--svl/source/items/poolitem.cxx1
-rw-r--r--svx/source/svdraw/svdattr.cxx1
-rw-r--r--svx/source/xoutdev/xattr2.cxx27
-rw-r--r--svx/source/xoutdev/xpool.cxx2
-rw-r--r--sw/qa/extras/layout/layout.cxx8
25 files changed, 175 insertions, 56 deletions
diff --git a/cui/source/inc/cuitabarea.hxx b/cui/source/inc/cuitabarea.hxx
index aa4e07343bd2..fa22f56e040f 100644
--- a/cui/source/inc/cuitabarea.hxx
+++ b/cui/source/inc/cuitabarea.hxx
@@ -241,6 +241,7 @@ protected:
std::unique_ptr<weld::Toggleable> m_xBtnHatch;
std::unique_ptr<weld::Toggleable> m_xBtnBitmap;
std::unique_ptr<weld::Toggleable> m_xBtnPattern;
+ std::unique_ptr<weld::Toggleable> m_xBtnUseBackground;
void SetOptimalSize(weld::DialogController* pController);
diff --git a/cui/source/tabpages/tparea.cxx b/cui/source/tabpages/tparea.cxx
index f7bbf34ef676..5a94566d83c5 100644
--- a/cui/source/tabpages/tparea.cxx
+++ b/cui/source/tabpages/tparea.cxx
@@ -19,6 +19,7 @@
#include <svx/svxids.hrc>
#include <svx/xfillit0.hxx>
+#include <svx/xfilluseslidebackgrounditem.hxx>
#include <svx/xflbckit.hxx>
#include <svx/drawitem.hxx>
#include <svx/xflclit.hxx>
@@ -41,7 +42,8 @@ enum FillType
GRADIENT,
HATCH,
BITMAP,
- PATTERN
+ PATTERN,
+ USE_BACKGROUND_FILL
};
}
@@ -89,6 +91,7 @@ SvxAreaTabPage::SvxAreaTabPage(weld::Container* pPage, weld::DialogController* p
, m_xBtnHatch(m_xBuilder->weld_toggle_button("btnhatch"))
, m_xBtnBitmap(m_xBuilder->weld_toggle_button("btnbitmap"))
, m_xBtnPattern(m_xBuilder->weld_toggle_button("btnpattern"))
+ , m_xBtnUseBackground(m_xBuilder->weld_toggle_button("btnusebackground"))
{
maBox.AddButton(m_xBtnNone.get());
maBox.AddButton(m_xBtnColor.get());
@@ -96,6 +99,7 @@ SvxAreaTabPage::SvxAreaTabPage(weld::Container* pPage, weld::DialogController* p
maBox.AddButton(m_xBtnHatch.get());
maBox.AddButton(m_xBtnBitmap.get());
maBox.AddButton(m_xBtnPattern.get());
+ maBox.AddButton(m_xBtnUseBackground.get());
Link<weld::Toggleable&, void> aLink = LINK(this, SvxAreaTabPage, SelectFillTypeHdl_Impl);
m_xBtnNone->connect_toggled(aLink);
m_xBtnColor->connect_toggled(aLink);
@@ -103,6 +107,7 @@ SvxAreaTabPage::SvxAreaTabPage(weld::Container* pPage, weld::DialogController* p
m_xBtnHatch->connect_toggled(aLink);
m_xBtnBitmap->connect_toggled(aLink);
m_xBtnPattern->connect_toggled(aLink);
+ m_xBtnUseBackground->connect_toggled(aLink);
SetExchangeSupport();
}
@@ -166,7 +171,11 @@ void SvxAreaTabPage::ActivatePage( const SfxItemSet& rSet )
default:
case drawing::FillStyle_NONE:
{
- SelectFillType(*m_xBtnNone);
+ XFillUseSlideBackgroundItem aBckItem( rSet.Get(XATTR_FILLUSESLIDEBACKGROUND));
+ if (aBckItem.GetValue())
+ SelectFillType(*m_xBtnUseBackground);
+ else
+ SelectFillType(*m_xBtnNone);
break;
}
case drawing::FillStyle_SOLID:
@@ -184,7 +193,7 @@ void SvxAreaTabPage::ActivatePage( const SfxItemSet& rSet )
case drawing::FillStyle_HATCH:
{
m_rXFSet.Put( rSet.Get(XATTR_FILLHATCH) );
- m_rXFSet.Put( rSet.Get(XATTR_FILLBACKGROUND) );
+ m_rXFSet.Put( rSet.Get(XATTR_FILLUSESLIDEBACKGROUND) );
m_rXFSet.Put( rSet.Get(XATTR_FILLCOLOR) );
SelectFillType(*m_xBtnHatch);
break;
@@ -222,6 +231,8 @@ DeactivateRC SvxAreaTabPage::DeactivatePage( SfxItemSet* _pSet )
{
XFillStyleItem aStyleItem( drawing::FillStyle_NONE );
_pSet->Put( aStyleItem );
+ XFillUseSlideBackgroundItem aFillBgItem( false );
+ _pSet->Put( aFillBgItem );
}
break;
}
@@ -235,6 +246,17 @@ DeactivateRC SvxAreaTabPage::DeactivatePage( SfxItemSet* _pSet )
return DeactivatePage_Impl<SvxBitmapTabPage&>(_pSet);
case PATTERN:
return DeactivatePage_Impl<SvxPatternTabPage>(_pSet);
+ case USE_BACKGROUND_FILL:
+ {
+ if ( m_bBtnClicked )
+ {
+ XFillStyleItem aStyleItem( drawing::FillStyle_NONE );
+ _pSet->Put( aStyleItem );
+ XFillUseSlideBackgroundItem aFillBgItem( true );
+ _pSet->Put( aFillBgItem );
+ }
+ break;
+ }
default:
break;
}
@@ -255,6 +277,7 @@ bool SvxAreaTabPage::FillItemSet( SfxItemSet* rAttrs )
case TRANSPARENT:
{
rAttrs->Put( XFillStyleItem( drawing::FillStyle_NONE ) );
+ rAttrs->Put( XFillUseSlideBackgroundItem( false ) );
return true;
}
case SOLID:
@@ -277,6 +300,12 @@ bool SvxAreaTabPage::FillItemSet( SfxItemSet* rAttrs )
{
return FillItemSet_Impl<SvxPatternTabPage>( rAttrs );
}
+ case USE_BACKGROUND_FILL:
+ {
+ rAttrs->Put( XFillStyleItem( drawing::FillStyle_NONE ) );
+ rAttrs->Put( XFillUseSlideBackgroundItem( true ) );
+ return true;
+ }
default:
return false;
}
@@ -344,6 +373,7 @@ std::unique_ptr<SfxTabPage> lcl_CreateFillStyleTabPage(sal_uInt16 nId, weld::Con
case HATCH: fnCreate = &SvxHatchTabPage::Create; break;
case BITMAP: fnCreate = &SvxBitmapTabPage::Create; break;
case PATTERN: fnCreate = &SvxPatternTabPage::Create; break;
+ case USE_BACKGROUND_FILL: fnCreate = nullptr; break;
}
return fnCreate ? (*fnCreate)( pPage, pController, &rSet ) : nullptr;
}
diff --git a/cui/uiconfig/ui/areatabpage.ui b/cui/uiconfig/ui/areatabpage.ui
index f1c671b804bc..4555c0df0207 100644
--- a/cui/uiconfig/ui/areatabpage.ui
+++ b/cui/uiconfig/ui/areatabpage.ui
@@ -155,6 +155,24 @@
<property name="position">6</property>
</packing>
</child>
+ <child>
+ <object class="GtkToggleButton" id="btnusebackground">
+ <property name="label" translatable="yes" context="areatabpage|btnusebackground">Use Background</property>
+ <property name="visible">True</property>
+ <property name="can-focus">True</property>
+ <property name="receives-default">True</property>
+ <child internal-child="accessible">
+ <object class="AtkObject" id="btnusebackground-atkobject">
+ <property name="AtkObject::accessible-description" translatable="yes" context="areatabpage|extended_tip|btnusebackground">Displays the underlying slide background.</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">7</property>
+ </packing>
+ </child>
</object>
<packing>
<property name="expand">False</property>
diff --git a/include/editeng/unoprnms.hxx b/include/editeng/unoprnms.hxx
index 8d02798ea4e2..8569a3370464 100644
--- a/include/editeng/unoprnms.hxx
+++ b/include/editeng/unoprnms.hxx
@@ -43,6 +43,7 @@ inline constexpr OUStringLiteral UNO_NAME_FILLBITMAPURL = u"FillBitmapURL";
inline constexpr OUStringLiteral UNO_NAME_FILLBITMAPNAME = u"FillBitmapName";
inline constexpr OUStringLiteral UNO_NAME_FILLGRADIENTSTEPCOUNT = u"FillGradientStepCount";
inline constexpr OUStringLiteral UNO_NAME_FILLBACKGROUND = u"FillBackground";
+inline constexpr OUStringLiteral UNO_NAME_FILLUSESLIDEBACKGROUND = u"FillUseSlideBackground";
inline constexpr OUStringLiteral UNO_NAME_FILLCOLOR_2 = u"FillColor2";
inline constexpr OUStringLiteral UNO_NAME_EDGEKIND = u"EdgeKind";
diff --git a/include/oox/drawingml/shape.hxx b/include/oox/drawingml/shape.hxx
index e845b399f5f8..5f4173c9de87 100644
--- a/include/oox/drawingml/shape.hxx
+++ b/include/oox/drawingml/shape.hxx
@@ -255,8 +255,6 @@ public:
void setVerticalShapesCount(sal_Int32 nVerticalShapesCount) { mnVerticalShapesCount = nVerticalShapesCount; }
sal_Int32 getVerticalShapesCount() const { return mnVerticalShapesCount; }
- void setUseBgFill(bool bUseBgFill) { mbUseBgFill = bUseBgFill; }
-
/// Changes reference semantics to value semantics for fill properties.
void cloneFillProperties();
@@ -407,9 +405,6 @@ private:
/// Number of child shapes to be layouted vertically inside org chart in-diagram shape.
sal_Int32 mnVerticalShapesCount = 0;
- /// The shape fill should be set to that of the slide background surface.
- bool mbUseBgFill = false;
-
// Is this a connector shape?
bool mbConnector = false;
diff --git a/include/oox/drawingml/shapepropertymap.hxx b/include/oox/drawingml/shapepropertymap.hxx
index 11670c02edf4..7870ddee304b 100644
--- a/include/oox/drawingml/shapepropertymap.hxx
+++ b/include/oox/drawingml/shapepropertymap.hxx
@@ -70,6 +70,7 @@ enum class ShapeProperty
FillBitmapRectanglePoint,
FillHatch, ///< Explicit fill hatch or name of a fill hatch stored in a global container.
FillBackground,
+ FillUseSlideBackground,
FillBitmapName,
ShadowXDistance,
ShadowSizeX,
diff --git a/include/svx/strings.hrc b/include/svx/strings.hrc
index f98ff0f0a3c3..ff492462fd49 100644
--- a/include/svx/strings.hrc
+++ b/include/svx/strings.hrc
@@ -347,6 +347,7 @@
#define SIP_XA_FILLBMP_POSOFFSETX NC_("SIP_XA_FILLBMP_POSOFFSETX", "Tile position X in %")
#define SIP_XA_FILLBMP_POSOFFSETY NC_("SIP_XA_FILLBMP_POSOFFSETY", "Tile position Y in %")
#define SIP_XA_FILLBACKGROUND NC_("SIP_XA_FILLBACKGROUND", "Background fill")
+#define SIP_XA_FILLUSESLIDEBACKGROUND NC_("SIP_XA_FILLUSESLIDEBACKGROUND", "Use slide background fill")
#define SIP_XATTRSET_FILL NC_("SIP_XATTRSET_FILL", "Area attributes")
#define SIP_XA_FORMTXTSTYLE NC_("SIP_XA_FORMTXTSTYLE", "Fontwork style")
#define SIP_XA_FORMTXTADJUST NC_("SIP_XA_FORMTXTADJUST", "Fontwork alignment")
diff --git a/include/svx/unoshprp.hxx b/include/svx/unoshprp.hxx
index bd08927d5039..b32b8672c77c 100644
--- a/include/svx/unoshprp.hxx
+++ b/include/svx/unoshprp.hxx
@@ -292,7 +292,9 @@
{ UNO_NAME_FILLCOLOR_THEME, XATTR_FILLCOLOR, ::cppu::UnoType<sal_Int16>::get(), 0, MID_COLOR_THEME_INDEX}, \
{ UNO_NAME_FILLCOLOR_LUM_MOD, XATTR_FILLCOLOR, ::cppu::UnoType<sal_Int16>::get(), 0, MID_COLOR_LUM_MOD}, \
{ UNO_NAME_FILLCOLOR_LUM_OFF, XATTR_FILLCOLOR, ::cppu::UnoType<sal_Int16>::get(), 0, MID_COLOR_LUM_OFF}, \
- { UNO_NAME_GRAPHIC_GRAPHICCROP, SDRATTR_GRAFCROP , ::cppu::UnoType<css::text::GraphicCrop>::get(), 0, 0 },
+ { UNO_NAME_GRAPHIC_GRAPHICCROP, SDRATTR_GRAFCROP , ::cppu::UnoType<css::text::GraphicCrop>::get(), 0, 0 }, \
+ { UNO_NAME_FILLUSESLIDEBACKGROUND, XATTR_FILLUSESLIDEBACKGROUND, cppu::UnoType<bool>::get(), 0, 0},
+
#define EDGERADIUS_PROPERTIES \
{ UNO_NAME_EDGERADIUS, SDRATTR_CORNER_RADIUS , ::cppu::UnoType<sal_Int32>::get() , 0, 0, PropertyMoreFlags::METRIC_ITEM},
diff --git a/include/svx/xdef.hxx b/include/svx/xdef.hxx
index e7740ee15ddc..906b566caa78 100644
--- a/include/svx/xdef.hxx
+++ b/include/svx/xdef.hxx
@@ -49,6 +49,7 @@ class XFillGradientItem;
class XFillHatchItem;
class XFillStyleItem;
class XFillTransparenceItem;
+class XFillUseSlideBackgroundItem;
class XFormTextAdjustItem;
class XFormTextDistanceItem;
class XFormTextHideFormItem;
@@ -124,7 +125,8 @@ constexpr TypedWhichId<XFillBmpStretchItem> XATTR_FILLBMP_STRETCH (
constexpr TypedWhichId<XFillBmpPosOffsetXItem> XATTR_FILLBMP_POSOFFSETX (XATTR_FILL_FIRST + 17); /* V3: 1041 */
constexpr TypedWhichId<XFillBmpPosOffsetYItem> XATTR_FILLBMP_POSOFFSETY (XATTR_FILL_FIRST + 18); /* V3: 1042 */
constexpr TypedWhichId<XFillBackgroundItem> XATTR_FILLBACKGROUND (XATTR_FILL_FIRST + 19); /* V3: 1043 */
-constexpr sal_uInt16 XATTR_FILL_LAST (XATTR_FILLBACKGROUND);
+constexpr TypedWhichId<XFillUseSlideBackgroundItem> XATTR_FILLUSESLIDEBACKGROUND (XATTR_FILL_FIRST + 20);
+constexpr sal_uInt16 XATTR_FILL_LAST (XATTR_FILLUSESLIDEBACKGROUND);
constexpr TypedWhichId<XFillAttrSetItem> XATTRSET_FILL (XATTR_FILL_LAST + 1); /* V3: 1047 V2: 1030 */
constexpr sal_uInt16 XATTR_TEXT_FIRST (XATTRSET_FILL + 1);
diff --git a/include/svx/xfilluseslidebackgrounditem.hxx b/include/svx/xfilluseslidebackgrounditem.hxx
new file mode 100644
index 000000000000..5a5cba891554
--- /dev/null
+++ b/include/svx/xfilluseslidebackgrounditem.hxx
@@ -0,0 +1,32 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include <svl/eitem.hxx>
+#include <svx/svxdllapi.h>
+
+/** Item to enable slide background for filled objects */
+
+class SVXCORE_DLLPUBLIC XFillUseSlideBackgroundItem final : public SfxBoolItem
+{
+public:
+ XFillUseSlideBackgroundItem(bool bFill = false);
+
+ SVX_DLLPRIVATE virtual XFillUseSlideBackgroundItem* Clone(SfxItemPool* pPool
+ = nullptr) const override;
+
+ SVX_DLLPRIVATE virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric,
+ MapUnit ePresMetric, OUString& rText,
+ const IntlWrapper&) const override;
+
+ void dumpAsXml(xmlTextWriterPtr pWriter) const override;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/offapi/com/sun/star/drawing/FillProperties.idl b/offapi/com/sun/star/drawing/FillProperties.idl
index ca64bcd5c6c6..86c0d9ef01b4 100644
--- a/offapi/com/sun/star/drawing/FillProperties.idl
+++ b/offapi/com/sun/star/drawing/FillProperties.idl
@@ -227,6 +227,13 @@ published service FillProperties
*/
[optional, property] com::sun::star::text::GraphicCrop GraphicCrop;
+ /** If this is `TRUE`, and FillStyle is FillStyle::NONE:
+ The area displays the slide background
+
+ @since LibreOffice 8.0
+ */
+ [optional, property] boolean FillUseSlideBackground;
+
};
diff --git a/oox/inc/drawingml/fillproperties.hxx b/oox/inc/drawingml/fillproperties.hxx
index 532cb0ec3975..b4f3d00fabc6 100644
--- a/oox/inc/drawingml/fillproperties.hxx
+++ b/oox/inc/drawingml/fillproperties.hxx
@@ -128,6 +128,7 @@ struct FillProperties
{
OptValue< sal_Int32 > moFillType; /// Fill type (OOXML token).
Color maFillColor; /// Solid fill color and transparence.
+ OptValue< bool > moUseBgFill; /// Whether the background is used as fill type
GradientFillProperties maGradientProps; /// Properties for gradient fills.
PatternFillProperties maPatternProps; /// Properties for pattern fills.
BlipFillProperties maBlipProps; /// Properties for bitmap fills.
diff --git a/oox/source/drawingml/fillproperties.cxx b/oox/source/drawingml/fillproperties.cxx
index 36f14066a082..a5dbc84fb377 100644
--- a/oox/source/drawingml/fillproperties.cxx
+++ b/oox/source/drawingml/fillproperties.cxx
@@ -340,6 +340,7 @@ void FillProperties::assignUsed( const FillProperties& rSourceProps )
{
moFillType.assignIfUsed( rSourceProps.moFillType );
maFillColor.assignIfUsed( rSourceProps.maFillColor );
+ moUseBgFill.assignIfUsed( rSourceProps.moUseBgFill );
maGradientProps.assignUsed( rSourceProps.maGradientProps );
maPatternProps.assignUsed( rSourceProps.maPatternProps );
maBlipProps.assignUsed( rSourceProps.maBlipProps );
@@ -382,7 +383,10 @@ void FillProperties::pushToPropMap( ShapePropertyMap& rPropMap,
switch( moFillType.get() )
{
case XML_noFill:
+ {
eFillStyle = FillStyle_NONE;
+ rPropMap.setProperty(ShapeProperty::FillUseSlideBackground, moUseBgFill.get(false));
+ }
break;
case XML_solidFill:
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index 8ef86298fd8b..cff9a5018c6a 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -191,7 +191,6 @@ Shape::Shape( const ShapePtr& pSourceShape )
, mnZOrderOff(pSourceShape->mnZOrderOff)
, mnDataNodeType(pSourceShape->mnDataNodeType)
, mfAspectRatio(pSourceShape->mfAspectRatio)
-, mbUseBgFill(pSourceShape->mbUseBgFill)
, mpDiagramHelper( nullptr )
, msDiagramDataModelID(pSourceShape->msDiagramDataModelID)
{}
@@ -1197,7 +1196,7 @@ Reference< XShape > const & Shape::createAndInsert(
}
if( const ShapeStyleRef* pFillRef = getShapeStyleRef( XML_fillRef ) )
{
- if (!mbUseBgFill)
+ if (!getFillProperties().moUseBgFill.get(false))
{
nFillPhClr = pFillRef->maPhClr.getColor(rGraphicHelper);
nFillPhClrTheme = pFillRef->maPhClr.getSchemeColorIndex();
diff --git a/oox/source/drawingml/shapepropertymap.cxx b/oox/source/drawingml/shapepropertymap.cxx
index 59413ba1dc98..57014b4780a6 100644
--- a/oox/source/drawingml/shapepropertymap.cxx
+++ b/oox/source/drawingml/shapepropertymap.cxx
@@ -47,6 +47,7 @@ const ShapePropertyIds spnDefaultShapeIds =
PROP_FillBitmapPositionOffsetX, PROP_FillBitmapPositionOffsetY, PROP_FillBitmapRectanglePoint,
PROP_FillHatch,
PROP_FillBackground,
+ PROP_FillUseSlideBackground,
PROP_FillBitmapName,
PROP_ShadowXDistance,
PROP_ShadowSizeX,
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 77363ab4b201..fe6635dc23f2 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -4772,6 +4772,10 @@ void DrawingML::WriteFill( const Reference< XPropertySet >& xPropSet )
aFillStyle = FillStyle_NONE;
}
+ bool bUseBackground(false);
+ if (GetProperty(xPropSet, "FillUseSlideBackground"))
+ xPropSet->getPropertyValue("FillUseSlideBackground") >>= bUseBackground;
+
switch( aFillStyle )
{
case FillStyle_SOLID :
@@ -4787,7 +4791,8 @@ void DrawingML::WriteFill( const Reference< XPropertySet >& xPropSet )
WritePattFill( xPropSet );
break;
case FillStyle_NONE:
- mpFS->singleElementNS(XML_a, XML_noFill);
+ if (!bUseBackground) // attribute `useBgFill` will be written at parent p:sp shape
+ mpFS->singleElementNS(XML_a, XML_noFill);
break;
default:
;
diff --git a/oox/source/ppt/pptshapegroupcontext.cxx b/oox/source/ppt/pptshapegroupcontext.cxx
index 4ca58a383af8..17d3e6c5815e 100644
--- a/oox/source/ppt/pptshapegroupcontext.cxx
+++ b/oox/source/ppt/pptshapegroupcontext.cxx
@@ -101,33 +101,10 @@ ContextHandlerRef PPTShapeGroupContext::onCreateContext( sal_Int32 aElementToken
{
auto pShape = std::make_shared<PPTShape>( meShapeLocation, "com.sun.star.drawing.CustomShape" );
bool bUseBgFill = rAttribs.getBool(XML_useBgFill, false);
- pShape->setUseBgFill(bUseBgFill);
if (bUseBgFill)
{
- oox::drawingml::FillPropertiesPtr pBackgroundPropertiesPtr = mpSlidePersistPtr->getBackgroundProperties();
- if (!pBackgroundPropertiesPtr)
- {
- // The shape wants a background, but the slide doesn't have one.
- SlidePersistPtr pMaster = mpSlidePersistPtr->getMasterPersist();
- if (pMaster)
- {
- oox::drawingml::FillPropertiesPtr pMasterBackground
- = pMaster->getBackgroundProperties();
- if (pMasterBackground)
- {
- if (pMasterBackground->moFillType.has()
- && pMasterBackground->moFillType.get() == XML_solidFill)
- {
- // Master has a solid background, use that.
- pBackgroundPropertiesPtr = pMasterBackground;
- }
- }
- }
- }
- if (pBackgroundPropertiesPtr)
- {
- pShape->getFillProperties().assignUsed(*pBackgroundPropertiesPtr);
- }
+ pShape->getFillProperties().moFillType = XML_noFill;
+ pShape->getFillProperties().moUseBgFill = true;
}
pShape->setModelId(rAttribs.getString( XML_modelId ).get());
return new PPTShapeContext( *this, mpSlidePersistPtr, mpGroupShapePtr, pShape );
diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt
index 8467d3683875..8f17d34dbe49 100644
--- a/oox/source/token/properties.txt
+++ b/oox/source/token/properties.txt
@@ -187,6 +187,7 @@ FillStyle
FillTransparence
FillTransparenceGradient
FillTransparenceGradientName
+FillUseSlideBackground
Filter
FilterCriteriaSource
FilterOptions
diff --git a/sd/qa/unit/import-tests2.cxx b/sd/qa/unit/import-tests2.cxx
index 6c7dfe5a5a64..7f4cd9180ce9 100644
--- a/sd/qa/unit/import-tests2.cxx
+++ b/sd/qa/unit/import-tests2.cxx
@@ -18,7 +18,9 @@
#include <svx/svdotable.hxx>
#include <svx/xfillit0.hxx>
+#include <svx/xfilluseslidebackgrounditem.hxx>
#include <svx/xflclit.hxx>
+#include <svx/xflbckit.hxx>
#include <svx/xlineit0.hxx>
#include <svx/xlnclit.hxx>
#include <svx/sdooitm.hxx>
@@ -225,10 +227,14 @@ void SdImportTest2::testTdf93868()
drawing::FillStyle_SOLID,
dynamic_cast<const XFillStyleItem&>(pPage->GetObj(0)->GetMergedItem(XATTR_FILLSTYLE))
.GetValue());
+
CPPUNIT_ASSERT_EQUAL(
- drawing::FillStyle_GRADIENT,
+ drawing::FillStyle_NONE,
dynamic_cast<const XFillStyleItem&>(pPage->GetObj(1)->GetMergedItem(XATTR_FILLSTYLE))
.GetValue());
+ CPPUNIT_ASSERT_EQUAL(true, dynamic_cast<const XFillUseSlideBackgroundItem&>(
+ pPage->GetObj(1)->GetMergedItem(XATTR_FILLUSESLIDEBACKGROUND))
+ .GetValue());
xDocShRef->DoClose();
}
@@ -746,7 +752,10 @@ void SdImportTest2::testTdf105150()
= dynamic_cast<const XFillStyleItem&>(pObj->GetMergedItem(XATTR_FILLSTYLE));
// This was drawing::FillStyle_NONE, <p:sp useBgFill="1"> was ignored when
// the slide didn't have an explicit background fill.
- CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID, rFillStyleItem.GetValue());
+ CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_NONE, rFillStyleItem.GetValue());
+ auto& rFillBackgroundItem = dynamic_cast<const XFillUseSlideBackgroundItem&>(
+ pObj->GetMergedItem(XATTR_FILLUSESLIDEBACKGROUND));
+ CPPUNIT_ASSERT_EQUAL(true, rFillBackgroundItem.GetValue());
xDocShRef->DoClose();
}
@@ -1732,16 +1741,10 @@ void SdImportTest2::testTdf127964()
const SdrObject* pObj = pPage->GetObj(0);
auto& rFillStyleItem
= dynamic_cast<const XFillStyleItem&>(pObj->GetMergedItem(XATTR_FILLSTYLE));
- CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID, rFillStyleItem.GetValue());
-
- auto& rFillColorItem
- = dynamic_cast<const XFillColorItem&>(pObj->GetMergedItem(XATTR_FILLCOLOR));
- // Without the accompanying fix in place, this test would have failed with:
- // - Expected: 4294967295
- // - Actual : 5210557
- // i.e. instead of transparent (which then got rendered as white), the shape fill color was
- // blue.
- CPPUNIT_ASSERT_EQUAL(COL_TRANSPARENT, rFillColorItem.GetColorValue());
+ CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_NONE, rFillStyleItem.GetValue());
+ auto& rFillBackgroundItem = dynamic_cast<const XFillUseSlideBackgroundItem&>(
+ pObj->GetMergedItem(XATTR_FILLUSESLIDEBACKGROUND));
+ CPPUNIT_ASSERT_EQUAL(true, rFillBackgroundItem.GetValue());
xDocShRef->DoClose();
}
diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx b/sd/source/filter/eppt/pptx-epptooxml.cxx
index 444c765a8914..d6ece36a5380 100644
--- a/sd/source/filter/eppt/pptx-epptooxml.cxx
+++ b/sd/source/filter/eppt/pptx-epptooxml.cxx
@@ -1696,7 +1696,15 @@ bool PowerPointShapeExport::WritePlaceholder(const Reference< XShape >& xShape,
ShapeExport& PowerPointShapeExport::WritePlaceholderShape(const Reference< XShape >& xShape, PlaceholderType ePlaceholder)
{
- mpFS->startElementNS(XML_p, XML_sp);
+ Reference<XPropertySet> xProps(xShape, UNO_QUERY);
+ bool bUseBackground(false);
+ if (xProps.is() && xProps->getPropertySetInfo()->hasPropertyByName("FillUseSlideBackground"))
+ xProps->getPropertyValue("FillUseSlideBackground") >>= bUseBackground;
+
+ if (bUseBackground)
+ mpFS->startElementNS(XML_p, XML_sp, XML_useBgFill, "1");
+ else
+ mpFS->startElementNS(XML_p, XML_sp);
// non visual shape properties
mpFS->startElementNS(XML_p, XML_nvSpPr);
@@ -1734,7 +1742,6 @@ ShapeExport& PowerPointShapeExport::WritePlaceholderShape(const Reference< XShap
mpFS->startElementNS(XML_p, XML_spPr);
WriteShapeTransformation(xShape, XML_a);
WritePresetShape("rect");
- Reference< XPropertySet > xProps(xShape, UNO_QUERY);
if (xProps.is())
{
WriteBlipFill(xProps, "Graphic");
diff --git a/svl/source/items/poolitem.cxx b/svl/source/items/poolitem.cxx
index a0c971c0c878..205f75b89bcd 100644
--- a/svl/source/items/poolitem.cxx
+++ b/svl/source/items/poolitem.cxx
@@ -289,6 +289,7 @@
// class Svx3DCloseFrontItem : public SfxBoolItem
// class Svx3DCloseBackItem : public SfxBoolItem
// class XFillBackgroundItem : public SfxBoolItem
+// class XFillUseSlideBackgroundItem : public SfxBoolItem
// class XFillBmpSizeLogItem : public SfxBoolItem
// class XFillBmpTileItem : public SfxBoolItem
// class XFillBmpStretchItem : public SfxBoolItem
diff --git a/svx/source/svdraw/svdattr.cxx b/svx/source/svdraw/svdattr.cxx
index 920b38882024..c0057b6aee70 100644
--- a/svx/source/svdraw/svdattr.cxx
+++ b/svx/source/svdraw/svdattr.cxx
@@ -441,6 +441,7 @@ OUString SdrItemPool::GetItemName(sal_uInt16 nWhich)
case XATTR_FILLBMP_POSOFFSETX : pResId = SIP_XA_FILLBMP_POSOFFSETX;break;
case XATTR_FILLBMP_POSOFFSETY : pResId = SIP_XA_FILLBMP_POSOFFSETY;break;
case XATTR_FILLBACKGROUND : pResId = SIP_XA_FILLBACKGROUND;break;
+ case XATTR_FILLUSESLIDEBACKGROUND: pResId = SIP_XA_FILLUSESLIDEBACKGROUND;break;
case XATTRSET_FILL : pResId = SIP_XATTRSET_FILL;break;
diff --git a/svx/source/xoutdev/xattr2.cxx b/svx/source/xoutdev/xattr2.cxx
index e4136c9280ab..ad1b3b2959e5 100644
--- a/svx/source/xoutdev/xattr2.cxx
+++ b/svx/source/xoutdev/xattr2.cxx
@@ -39,6 +39,7 @@
#include <svx/xflbstit.hxx>
#include <svx/xflboxy.hxx>
#include <svx/xflbckit.hxx>
+#include <svx/xfilluseslidebackgrounditem.hxx>
#include <svx/dialmgr.hxx>
#include <svx/xdef.hxx>
#include <AffineMatrixItem.hxx>
@@ -701,4 +702,30 @@ void XFillBackgroundItem::dumpAsXml(xmlTextWriterPtr pWriter) const
(void)xmlTextWriterEndElement(pWriter);
}
+XFillUseSlideBackgroundItem::XFillUseSlideBackgroundItem( bool bFill ) :
+ SfxBoolItem( XATTR_FILLUSESLIDEBACKGROUND, bFill )
+{
+}
+
+XFillUseSlideBackgroundItem* XFillUseSlideBackgroundItem::Clone( SfxItemPool* /*pPool*/) const
+{
+ return new XFillUseSlideBackgroundItem( *this );
+}
+
+bool XFillUseSlideBackgroundItem::GetPresentation( SfxItemPresentation /*ePres*/, MapUnit /*eCoreUnit*/,
+ MapUnit /*ePresUnit*/, OUString& rText, const IntlWrapper&) const
+{
+ rText.clear();
+ return true;
+}
+
+void XFillUseSlideBackgroundItem::dumpAsXml(xmlTextWriterPtr pWriter) const
+{
+ (void)xmlTextWriterStartElement(pWriter, BAD_CAST("XFillUseSlideBackgroundItem"));
+ (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST(OString::number(Which()).getStr()));
+ (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"), BAD_CAST(OString::boolean(GetValue()).getStr()));
+ (void)xmlTextWriterEndElement(pWriter);
+}
+
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/xoutdev/xpool.cxx b/svx/source/xoutdev/xpool.cxx
index 804aed87ca5e..771b79ac4991 100644
--- a/svx/source/xoutdev/xpool.cxx
+++ b/svx/source/xoutdev/xpool.cxx
@@ -42,6 +42,7 @@
#include <svx/xlinjoit.hxx>
#include <svx/xlncapit.hxx>
#include <svx/xfillit0.hxx>
+#include <svx/xfilluseslidebackgrounditem.hxx>
#include <svx/xtextit0.hxx>
#include <svx/xlnasit.hxx>
#include <svx/xlndsit.hxx>
@@ -126,6 +127,7 @@ XOutdevItemPool::XOutdevItemPool(SfxItemPool* _pMaster)
rPoolDefaults[XATTR_FILLFLOATTRANSPARENCE -XATTR_START] = new XFillFloatTransparenceItem( XGradient(COL_BLACK, COL_BLACK), false );
rPoolDefaults[XATTR_SECONDARYFILLCOLOR -XATTR_START] = new XSecondaryFillColorItem(aNullStr, aNullFillCol);
rPoolDefaults[XATTR_FILLBACKGROUND -XATTR_START] = new XFillBackgroundItem;
+ rPoolDefaults[XATTR_FILLUSESLIDEBACKGROUND -XATTR_START] = new XFillUseSlideBackgroundItem;
rPoolDefaults[XATTR_FORMTXTSTYLE -XATTR_START] = new XFormTextStyleItem;
rPoolDefaults[XATTR_FORMTXTADJUST -XATTR_START] = new XFormTextAdjustItem;
rPoolDefaults[XATTR_FORMTXTDISTANCE -XATTR_START] = new XFormTextDistanceItem;
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index e598f7785747..0ca6f1368253 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -1198,22 +1198,22 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestTdf137025)
// SDRATTR_TEXT_LEFTDIST
assertXPath(pXmlDoc,
"/root/page/body/txt/anchored/SwAnchoredDrawObject/SdrObject"
- "/DefaultProperties/SfxItemSet/SdrMetricItem/SfxInt32Item[@whichId='1071']",
+ "/DefaultProperties/SfxItemSet/SdrMetricItem/SfxInt32Item[@whichId='1072']",
"value", "567");
// SDRATTR_TEXT_RIGHTDIST
assertXPath(pXmlDoc,
"/root/page/body/txt/anchored/SwAnchoredDrawObject/SdrObject"
- "/DefaultProperties/SfxItemSet/SdrMetricItem/SfxInt32Item[@whichId='1072']",
+ "/DefaultProperties/SfxItemSet/SdrMetricItem/SfxInt32Item[@whichId='1073']",
"value", "1134");
// SDRATTR_TEXT_UPPERDIST
assertXPath(pXmlDoc,
"/root/page/body/txt/anchored/SwAnchoredDrawObject/SdrObject"
- "/DefaultProperties/SfxItemSet/SdrMetricItem/SfxInt32Item[@whichId='1073']",
+ "/DefaultProperties/SfxItemSet/SdrMetricItem/SfxInt32Item[@whichId='1074']",
"value", "1701");
// SDRATTR_TEXT_LOWERDIST
assertXPath(pXmlDoc,
"/root/page/body/txt/anchored/SwAnchoredDrawObject/SdrObject"
- "/DefaultProperties/SfxItemSet/SdrMetricItem/SfxInt32Item[@whichId='1074']",
+ "/DefaultProperties/SfxItemSet/SdrMetricItem/SfxInt32Item[@whichId='1075']",
"value", "2268");
// Check the textbox-shape import too