chart2/source/controller/main/ShapeController.cxx           |    2 
 chart2/source/controller/sidebar/ChartAreaPanel.cxx         |    5 
 chart2/source/controller/sidebar/ChartAreaPanel.hxx         |    1 
 cui/source/factory/dlgfact.cxx                              |    6 
 cui/source/factory/dlgfact.hxx                              |    3 
 cui/source/inc/cuitabarea.hxx                               |   10 
 cui/source/tabpages/tabarea.cxx                             |    8 
 cui/source/tabpages/tparea.cxx                              |   53 
 cui/uiconfig/ui/areatabpage.ui                              |   18 
 drawinglayer/source/attribute/sdrfillattribute.cxx          |   16 
 drawinglayer/source/processor2d/vclpixelprocessor2d.cxx     |   19 
 include/drawinglayer/attribute/sdrfillattribute.hxx         |    5 
 include/editeng/unoprnms.hxx                                |    1 
 include/oox/drawingml/shape.hxx                             |    5 
 include/oox/drawingml/shapepropertymap.hxx                  |    1 
 include/svx/sdr/primitive2d/svx_primitivetypes2d.hxx        |    1 
 include/svx/sidebar/AreaPropertyPanelBase.hxx               |    7 
 include/svx/strings.hrc                                     |    2 
 include/svx/svxdlg.hxx                                      |    3 
 include/svx/svxids.hrc                                      |    2 
 include/svx/unoshprp.hxx                                    |    4 
 include/svx/xdef.hxx                                        |    4 
 include/svx/xfilluseslidebackgrounditem.hxx                 |   31 
 include/svx/xflbckit.hxx                                    |    2 
 include/xmloff/xmltoken.hxx                                 |    2 
 offapi/com/sun/star/drawing/FillProperties.idl              |    7 
 oox/inc/drawingml/fillproperties.hxx                        |    1 
 oox/source/drawingml/fillproperties.cxx                     |    4 
 oox/source/drawingml/shape.cxx                              |    3 
 oox/source/drawingml/shapepropertymap.cxx                   |    1 
 oox/source/export/drawingml.cxx                             |    7 
 oox/source/ppt/pptshapegroupcontext.cxx                     |   27 
 oox/source/token/properties.txt                             |    1 
 reportdesign/source/ui/misc/UITools.cxx                     |    3 
 sc/source/ui/drawfunc/drawsh.cxx                            |    2 
 schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng |    6 
 sd/qa/unit/import-tests2.cxx                                |   49 
 sd/sdi/_drvwsh.sdi                                          |    5 
 sd/source/filter/eppt/pptx-epptooxml.cxx                    |   11 
 sd/source/ui/func/fuarea.cxx                                |    5 
 sd/source/ui/table/tableobjectbar.cxx                       |    1 
 sd/source/ui/view/drviews2.cxx                              |    2 
 sd/source/ui/view/drviewsf.cxx                              |    1 
 sd/source/ui/view/drviewsj.cxx                              |    3 
 svl/source/items/poolitem.cxx                               |    1 
 svx/sdi/svx.sdi                                             |   16 
 svx/source/sdr/primitive2d/sdrattributecreator.cxx          |   14 
 svx/source/sdr/primitive2d/sdrdecompositiontools.cxx        |  222 ++++
 svx/source/sidebar/area/AreaPropertyPanel.cxx               |    9 
 svx/source/sidebar/area/AreaPropertyPanel.hxx               |    3 
 svx/source/sidebar/area/AreaPropertyPanelBase.cxx           |  652 +++++-------
 svx/source/svdraw/svdattr.cxx                               |    1 
 svx/source/tbxctrls/itemwin.cxx                             |    1 
 svx/source/xoutdev/xattr2.cxx                               |   35 
 svx/source/xoutdev/xpool.cxx                                |    3 
 sw/qa/extras/layout/layout.cxx                              |    8 
 sw/source/uibase/shells/drawdlg.cxx                         |    3 
 sw/source/uibase/shells/frmsh.cxx                           |    1 
 xmloff/source/core/xmltoken.cxx                             |    1 
 xmloff/source/draw/sdpropls.cxx                             |    1 
 xmloff/source/token/tokens.txt                              |    1 
 61 files changed, 874 insertions(+), 448 deletions(-)

New commits:
commit c723398b879bc0733642854913470bcb6275ae17
Author:     Samuel Mehrbrodt <samuel.mehrbr...@allotropia.de>
AuthorDate: Thu Jun 9 16:03:51 2022 +0200
Commit:     Thorsten Behrens <thorsten.behr...@allotropia.de>
CommitDate: Fri Jul 8 10:38:08 2022 +0200

    tdf#128150 Fix PPTX slide background fill mode for shapes
    
    This is:
    
     Add XFillBackgroundItem::dumpAsXml
     Change-Id: I21aa5ded0c9c114199c9d503b48437ec1a6171eb
    
     tdf#128150 Add OOXML import/export for "use background fill"
     Change-Id: Ic63ba11e9d499d4a0fb22f6739587e3e25140b8f
    
     tdf#128150 Implement/add SlideBackgroundFill visualization
     Change-Id: Ie11403c0b705fc2ecdfd7eb2fa5ae1a93a21b460
    
     tdf#128150 xmloff: ODF import/export of fill-use-slide-background
     Change-Id: I05db879a8cb5018e0261f049ae91a5b9aaa760b6
    
     tdf#128150 Only show "Use background" btn in Impress & Draw
     Change-Id: I5d14f651af55b51a8a02a8a4ddbb1c0921b15d81
    
     tdf#128150 Adapt sidebar to new "use slide background" property
     Change-Id: Idce049a7498f98b0079c708236cfeff7fddd6e95
    
     tdf#128150 Disable UseSlideBackground item when setting style back to None
     Change-Id: I883330ac7323c4758ca8cbd46f4567a2ea780fc1
    
     tdf#149650 avoid potential recursion with SdrPage content hierarchy
     Change-Id: I27e064eeedfb45a2fe96892f1d31da94b9976c50
    
     tdf#128150 Properly show/hide widgets when "use slide background" is 
selected
     Change-Id: I9d866fd63ea622ac5eb706185b3277c21f40d7cb
    
     tdf#149651 Correct the MasterPageBackgroundFill mode
     Change-Id: If48666212e2f0afac4fbfab9af4908a5d2b4c047
    
     tdf#149754 correct gradient paint for outside definition range
     Change-Id: I45fc0a7a024a4288f698eb5f0abf6b0d1440edfc
    
    Change-Id: If426b6751618f657685e9aa6bc80478c6b5b9cba
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136874
    Tested-by: Jenkins
    Reviewed-by: Adolfo Jayme Barrientos <fit...@ubuntu.com>
    Reviewed-by: Thorsten Behrens <thorsten.behr...@allotropia.de>

diff --git a/chart2/source/controller/main/ShapeController.cxx 
b/chart2/source/controller/main/ShapeController.cxx
index d261a967feea..3dae73fd8573 100644
--- a/chart2/source/controller/main/ShapeController.cxx
+++ b/chart2/source/controller/main/ShapeController.cxx
@@ -289,7 +289,7 @@ void ShapeController::executeDispatch_FormatArea()
     }
     SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
     ScopedVclPtr< AbstractSvxAreaTabDialog > pDlg(
-            pFact->CreateSvxAreaTabDialog(pChartWindow, &aAttr, 
&pDrawModelWrapper->getSdrModel(), true));
+            pFact->CreateSvxAreaTabDialog(pChartWindow, &aAttr, 
&pDrawModelWrapper->getSdrModel(), true, false));
     if ( pDlg->Execute() == RET_OK )
     {
         const SfxItemSet* pOutAttr = pDlg->GetOutputItemSet();
diff --git a/chart2/source/controller/sidebar/ChartAreaPanel.cxx 
b/chart2/source/controller/sidebar/ChartAreaPanel.cxx
index b54df41ebd39..71e978e14543 100644
--- a/chart2/source/controller/sidebar/ChartAreaPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartAreaPanel.cxx
@@ -408,6 +408,11 @@ void ChartAreaPanel::setFillStyleAndBitmap(const 
XFillStyleItem* pStyleItem,
     xPropSet->setPropertyValue("FillBitmapName", aBitmap);
 }
 
+void ChartAreaPanel::setFillUseBackground(const XFillStyleItem* /*pStyleItem*/,
+                                          const XFillUseSlideBackgroundItem& 
/*rItem*/)
+{
+}
+
 void ChartAreaPanel::updateData()
 {
     if (!mbUpdate || !mbModelValid)
diff --git a/chart2/source/controller/sidebar/ChartAreaPanel.hxx 
b/chart2/source/controller/sidebar/ChartAreaPanel.hxx
index 132513412518..75caf8d0d30a 100644
--- a/chart2/source/controller/sidebar/ChartAreaPanel.hxx
+++ b/chart2/source/controller/sidebar/ChartAreaPanel.hxx
@@ -57,6 +57,7 @@ public:
     virtual void setFillStyleAndGradient(const XFillStyleItem* pStyleItem, 
const XFillGradientItem& rGradientItem) override;
     virtual void setFillStyleAndHatch(const XFillStyleItem* pStyleItem, const 
XFillHatchItem& rHatchItem) override;
     virtual void setFillStyleAndBitmap(const XFillStyleItem* pStyleItem, const 
XFillBitmapItem& rBitmapItem) override;
+    virtual void setFillUseBackground(const XFillStyleItem* pStyleItem, const 
XFillUseSlideBackgroundItem& rItem) override;
 
     virtual void updateData() override;
     virtual void modelInvalid() override;
diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx
index 28d473479ac7..fb61dafcecbb 100644
--- a/cui/source/factory/dlgfact.cxx
+++ b/cui/source/factory/dlgfact.cxx
@@ -1156,9 +1156,11 @@ VclPtr<AbstractGraphicFilterDialog> 
AbstractDialogFactory_Impl::CreateGraphicFil
 VclPtr<AbstractSvxAreaTabDialog> 
AbstractDialogFactory_Impl::CreateSvxAreaTabDialog(weld::Window* pParent,
                                                             const SfxItemSet* 
pAttr,
                                                             SdrModel* pModel,
-                                                            bool bShadow)
+                                                            bool bShadow,
+                                                            bool 
bSlideBackground)
 {
-    return 
VclPtr<AbstractSvxAreaTabDialog_Impl>::Create(std::make_shared<SvxAreaTabDialog>(pParent,
 pAttr, pModel, bShadow));
+    return VclPtr<AbstractSvxAreaTabDialog_Impl>::Create(
+        std::make_shared<SvxAreaTabDialog>(pParent, pAttr, pModel, bShadow, 
bSlideBackground));
 }
 
 VclPtr<SfxAbstractTabDialog> 
AbstractDialogFactory_Impl::CreateSvxLineTabDialog(weld::Window* pParent, const 
SfxItemSet* pAttr, //add forSvxLineTabDialog
diff --git a/cui/source/factory/dlgfact.hxx b/cui/source/factory/dlgfact.hxx
index 1b9c85f66841..079af32b444c 100644
--- a/cui/source/factory/dlgfact.hxx
+++ b/cui/source/factory/dlgfact.hxx
@@ -541,7 +541,8 @@ public:
     virtual VclPtr<AbstractSvxAreaTabDialog>       
CreateSvxAreaTabDialog(weld::Window* pParent,
                                                                           
const SfxItemSet* pAttr,
                                                                           
SdrModel* pModel,
-                                                                          bool 
bShadow) override;
+                                                                          bool 
bShadow,
+                                                                          bool 
bSlideBackground) override;
     virtual VclPtr<SfxAbstractTabDialog>           
CreateSvxLineTabDialog(weld::Window* pParent, const SfxItemSet* pAttr,
                                                                  SdrModel* 
pModel,
                                                                  const 
SdrObject* pObj,
diff --git a/cui/source/inc/cuitabarea.hxx b/cui/source/inc/cuitabarea.hxx
index aa4e07343bd2..1d2c5cb0a534 100644
--- a/cui/source/inc/cuitabarea.hxx
+++ b/cui/source/inc/cuitabarea.hxx
@@ -115,7 +115,8 @@ class SvxAreaTabDialog final : public SfxTabDialogController
     void                SavePalettes();
 
 public:
-    SvxAreaTabDialog(weld::Window* pParent, const SfxItemSet* pAttr, SdrModel* 
pModel, bool bShadow);
+    SvxAreaTabDialog(weld::Window* pParent, const SfxItemSet* pAttr, SdrModel* 
pModel, bool bShadow,
+                     bool bSlideBackground);
 
     void                SetNewColorList( XColorListRef const & pColorList )
                             { mpNewColorList = pColorList; }
@@ -241,6 +242,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);
 
@@ -260,10 +262,14 @@ private:
     DeactivateRC DeactivatePage_Impl( SfxItemSet* pSet );
 
 public:
-    SvxAreaTabPage(weld::Container* pPage, weld::DialogController* 
pController, const SfxItemSet& rInAttrs);
+    SvxAreaTabPage(weld::Container* pPage, weld::DialogController* pController,
+                   const SfxItemSet& rInAttrs, bool bSlideBackground = false);
     virtual ~SvxAreaTabPage() override;
 
     static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, 
weld::DialogController* pController, const SfxItemSet* );
+    static std::unique_ptr<SfxTabPage>
+    CreateWithSlideBackground(weld::Container* pPage, weld::DialogController* 
pController,
+                              const SfxItemSet*);
     static WhichRangesContainer GetRanges() { return pAreaRanges; }
 
     virtual bool FillItemSet( SfxItemSet* ) override;
diff --git a/cui/source/tabpages/tabarea.cxx b/cui/source/tabpages/tabarea.cxx
index a400c0207839..d03199c7b982 100644
--- a/cui/source/tabpages/tabarea.cxx
+++ b/cui/source/tabpages/tabarea.cxx
@@ -31,7 +31,8 @@ SvxAreaTabDialog::SvxAreaTabDialog
     weld::Window* pParent,
     const SfxItemSet* pAttr,
     SdrModel* pModel,
-    bool bShadow
+    bool bShadow,
+    bool bSlideBackground
 )
     : SfxTabDialogController(pParent, "cui/ui/areadialog.ui", "AreaDialog", 
pAttr)
     , mpDrawModel          ( pModel ),
@@ -52,7 +53,10 @@ SvxAreaTabDialog::SvxAreaTabDialog
     mnGradientListState ( ChangeType::NONE ),
     mnHatchingListState ( ChangeType::NONE )
 {
-    AddTabPage("RID_SVXPAGE_AREA", SvxAreaTabPage::Create, nullptr);
+    if (bSlideBackground)
+        AddTabPage("RID_SVXPAGE_AREA", 
SvxAreaTabPage::CreateWithSlideBackground, nullptr);
+    else
+        AddTabPage("RID_SVXPAGE_AREA", SvxAreaTabPage::Create, nullptr);
 
     if (bShadow)
     {
diff --git a/cui/source/tabpages/tparea.cxx b/cui/source/tabpages/tparea.cxx
index f7bbf34ef676..119d6d154076 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
 };
 
 }
@@ -70,7 +72,8 @@ void lclExtendSize(Size& rSize, const Size& rInputSize)
 |*
 \************************************************************************/
 
-SvxAreaTabPage::SvxAreaTabPage(weld::Container* pPage, weld::DialogController* 
pController, const SfxItemSet& rInAttrs)
+SvxAreaTabPage::SvxAreaTabPage(weld::Container* pPage, weld::DialogController* 
pController,
+                               const SfxItemSet& rInAttrs, bool 
bSlideBackground)
     : SfxTabPage(pPage, pController, "cui/ui/areatabpage.ui", "AreaTabPage", 
&rInAttrs)
     // local fixed not o be changed values for local pointers
     , maFixed_ChangeType(ChangeType::NONE)
@@ -89,6 +92,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 +100,7 @@ SvxAreaTabPage::SvxAreaTabPage(weld::Container* pPage, 
weld::DialogController* p
     maBox.AddButton(m_xBtnHatch.get());
     maBox.AddButton(m_xBtnBitmap.get());
     maBox.AddButton(m_xBtnPattern.get());
+
     Link<weld::Toggleable&, void> aLink = LINK(this, SvxAreaTabPage, 
SelectFillTypeHdl_Impl);
     m_xBtnNone->connect_toggled(aLink);
     m_xBtnColor->connect_toggled(aLink);
@@ -103,6 +108,13 @@ SvxAreaTabPage::SvxAreaTabPage(weld::Container* pPage, 
weld::DialogController* p
     m_xBtnHatch->connect_toggled(aLink);
     m_xBtnBitmap->connect_toggled(aLink);
     m_xBtnPattern->connect_toggled(aLink);
+    if (bSlideBackground)
+    {
+        maBox.AddButton(m_xBtnUseBackground.get());
+        m_xBtnUseBackground->connect_toggled(aLink);
+    }
+    else
+        m_xBtnUseBackground->hide();
 
     SetExchangeSupport();
 }
@@ -166,7 +178,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 +200,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 +238,8 @@ DeactivateRC SvxAreaTabPage::DeactivatePage( SfxItemSet* 
_pSet )
             {
                 XFillStyleItem aStyleItem( drawing::FillStyle_NONE );
                 _pSet->Put( aStyleItem );
+                XFillUseSlideBackgroundItem aFillBgItem( false );
+                _pSet->Put( aFillBgItem );
             }
             break;
         }
@@ -235,6 +253,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 +284,7 @@ bool SvxAreaTabPage::FillItemSet( SfxItemSet* rAttrs )
         case TRANSPARENT:
         {
             rAttrs->Put( XFillStyleItem( drawing::FillStyle_NONE ) );
+            rAttrs->Put( XFillUseSlideBackgroundItem( false ) );
             return true;
         }
         case SOLID:
@@ -277,6 +307,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;
     }
@@ -331,6 +367,14 @@ std::unique_ptr<SfxTabPage> 
SvxAreaTabPage::Create(weld::Container* pPage, weld:
     return xRet;
 }
 
+std::unique_ptr<SfxTabPage> SvxAreaTabPage::CreateWithSlideBackground(
+    weld::Container* pPage, weld::DialogController* pController, const 
SfxItemSet* rAttrs)
+{
+    auto xRet = std::make_unique<SvxAreaTabPage>(pPage, pController, *rAttrs, 
true);
+    xRet->SetOptimalSize(pController);
+    return xRet;
+}
+
 namespace {
 
 std::unique_ptr<SfxTabPage> lcl_CreateFillStyleTabPage(sal_uInt16 nId, 
weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& 
rSet)
@@ -344,6 +388,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/drawinglayer/source/attribute/sdrfillattribute.cxx 
b/drawinglayer/source/attribute/sdrfillattribute.cxx
index b582ee0a11d0..131061099715 100644
--- a/drawinglayer/source/attribute/sdrfillattribute.cxx
+++ b/drawinglayer/source/attribute/sdrfillattribute.cxx
@@ -81,6 +81,11 @@ namespace drawinglayer::attribute
                 static SdrFillAttribute::ImplType SINGLETON;
                 return SINGLETON;
             }
+            SdrFillAttribute::ImplType& slideBackgroundFillGlobalDefault()
+            {
+                static SdrFillAttribute::ImplType SINGLETON2;
+                return SINGLETON2;
+            }
         }
 
         SdrFillAttribute::SdrFillAttribute(
@@ -94,8 +99,10 @@ namespace drawinglayer::attribute
         {
         }
 
-        SdrFillAttribute::SdrFillAttribute()
-        :   mpSdrFillAttribute(theGlobalDefault())
+        SdrFillAttribute::SdrFillAttribute(bool bSlideBackgroundFill)
+        :   mpSdrFillAttribute(bSlideBackgroundFill
+                ? slideBackgroundFillGlobalDefault()
+                : theGlobalDefault())
         {
         }
 
@@ -110,6 +117,11 @@ namespace drawinglayer::attribute
             return mpSdrFillAttribute.same_object(theGlobalDefault());
         }
 
+        bool SdrFillAttribute::isSlideBackgroundFill() const
+        {
+            return 
mpSdrFillAttribute.same_object(slideBackgroundFillGlobalDefault());
+        }
+
         SdrFillAttribute& SdrFillAttribute::operator=(const SdrFillAttribute&) 
= default;
 
         SdrFillAttribute& SdrFillAttribute::operator=(SdrFillAttribute&&) = 
default;
diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx 
b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
index 362d0ddf9cab..f2bf82a9ce7b 100644
--- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
@@ -1211,6 +1211,25 @@ void VclPixelProcessor2D::processFillGradientPrimitive2D(
         return;
     }
 
+    // tdf#149754 VCL gradient draw is not capable to handle all primitive 
gradient definitions,
+    // what should be clear due to being developed to ectend/replace them in
+    // capabilities & precision.
+    // It is e.g. not capable to correctly paint if the OutputRange is not 
completely
+    // inside the DefinitionRange, thus forcing to paint gradent parts 
*outside* the
+    // DefinitionRange.
+    // This happens for Writer with Frames anchored in Frames (and was broken 
due to
+    // falling back to VCL Gradient paint here), and for the new 
SlideBackgroundFill
+    // Fill mode for objects using it that reach outside the page (which is the
+    // DefinitionRange in that case).
+    // I see no real reason to fallback here to OutputDevice::DrawGradient and 
VCL
+    // gradient paint at all (system-dependent renderers wouldn't in the 
future), but
+    // will for convenience only add that needed additional correcting case
+    if (!rPrimitive.getDefinitionRange().isInside(rPrimitive.getOutputRange()))
+    {
+        process(rPrimitive);
+        return;
+    }
+
     GradientStyle eGradientStyle = 
convertGradientStyle(rFillGradient.getStyle());
 
     Gradient aGradient(eGradientStyle, Color(rFillGradient.getStartColor()),
diff --git a/include/drawinglayer/attribute/sdrfillattribute.hxx 
b/include/drawinglayer/attribute/sdrfillattribute.hxx
index 93fc7ca8541c..6ba140065d4c 100644
--- a/include/drawinglayer/attribute/sdrfillattribute.hxx
+++ b/include/drawinglayer/attribute/sdrfillattribute.hxx
@@ -56,7 +56,7 @@ namespace drawinglayer::attribute
                 const FillGradientAttribute& rGradient,
                 const FillHatchAttribute& rHatch,
                 const SdrFillGraphicAttribute& rFillGraphic);
-            SdrFillAttribute();
+            SdrFillAttribute(bool bSlideBackgroundFill = false);
             SdrFillAttribute(const SdrFillAttribute&);
             SdrFillAttribute(SdrFillAttribute&&);
             SdrFillAttribute& operator=(const SdrFillAttribute&);
@@ -66,6 +66,9 @@ namespace drawinglayer::attribute
             // checks if the incarnation is default constructed
             bool isDefault() const;
 
+            // checks if the incarnation is slideBackgroundFill
+            bool isSlideBackgroundFill() const;
+
             // compare operator
             bool operator==(const SdrFillAttribute& rCandidate) const;
 
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/sdr/primitive2d/svx_primitivetypes2d.hxx 
b/include/svx/sdr/primitive2d/svx_primitivetypes2d.hxx
index 0af20f04d710..917d22f149da 100644
--- a/include/svx/sdr/primitive2d/svx_primitivetypes2d.hxx
+++ b/include/svx/sdr/primitive2d/svx_primitivetypes2d.hxx
@@ -49,6 +49,7 @@
 #define PRIMITIVE2D_ID_SDRCHAINEDTEXTPRIMITIVE2D        
(PRIMITIVE2D_ID_RANGE_SVX| 23)
 #define PRIMITIVE2D_ID_SDRFRAMEBORDERTPRIMITIVE2D       
(PRIMITIVE2D_ID_RANGE_SVX| 24)
 #define PRIMITIVE2D_ID_OVERLAYDIAGRAMPRIMITIVE2D        
(PRIMITIVE2D_ID_RANGE_SVX| 25)
+#define PRIMITIVE2D_ID_SLIDEBACKGROUNDFILLPRIMITIVE2D   
(PRIMITIVE2D_ID_RANGE_SVX| 26)
 
 
 #endif // INCLUDED_SVX_SDR_PRIMITIVE2D_SVX_PRIMITIVETYPES2D_HXX
diff --git a/include/svx/sidebar/AreaPropertyPanelBase.hxx 
b/include/svx/sidebar/AreaPropertyPanelBase.hxx
index 12fcebe16581..ed028d7b8698 100644
--- a/include/svx/sidebar/AreaPropertyPanelBase.hxx
+++ b/include/svx/sidebar/AreaPropertyPanelBase.hxx
@@ -24,6 +24,7 @@
 #include <sfx2/sidebar/ControllerItem.hxx>
 #include <svx/colorbox.hxx>
 #include <svx/xgrad.hxx>
+#include <svx/xfilluseslidebackgrounditem.hxx>
 #include <svx/xfillit0.hxx>
 #include <svx/xflclit.hxx>
 #include <svx/xflgrit.hxx>
@@ -35,6 +36,7 @@
 
 class ToolbarUnoDispatcher;
 class XFillFloatTransparenceItem;
+class XFillUseSlideBackgroundItem;
 class XFillTransparenceItem;
 class XFillStyleItem;
 class XFillGradientItem;
@@ -84,6 +86,7 @@ public:
     virtual void setFillStyleAndGradient(const XFillStyleItem* pStyleItem, 
const XFillGradientItem& aGradientItem) = 0;
     virtual void setFillStyleAndHatch(const XFillStyleItem* pStyleItem, const 
XFillHatchItem& aHatchItem) = 0;
     virtual void setFillStyleAndBitmap(const XFillStyleItem* pStyleItem, const 
XFillBitmapItem& aHatchItem) = 0;
+    virtual void setFillUseBackground(const XFillStyleItem* pStyleItem, const 
XFillUseSlideBackgroundItem& rItem) = 0;
 
     void updateFillTransparence(bool bDisabled, bool bDefaultOrSet, const 
SfxPoolItem* pState);
     void updateFillFloatTransparence(bool bDisabled, bool bDefaultOrSet, const 
SfxPoolItem* pState);
@@ -92,6 +95,7 @@ public:
     void updateFillHatch(bool bDisabled, bool bDefaultOrSet, const 
SfxPoolItem* pState);
     void updateFillColor(bool bDefaultOrSet, const SfxPoolItem* pState);
     void updateFillBitmap(bool BDisabled, bool bDefaultOrSet, const 
SfxPoolItem* pState);
+    void updateFillUseBackground(bool BDisabled, bool bDefaultOrSet, const 
SfxPoolItem* pState);
 
 private:
     void Initialize();
@@ -145,6 +149,7 @@ protected:
     OUString  maImgLinear;
 
     std::unique_ptr< XFillFloatTransparenceItem >   mpFloatTransparenceItem;
+    std::unique_ptr< XFillUseSlideBackgroundItem > mpUseSlideBackgroundItem;
     std::unique_ptr< SfxUInt16Item >                mpTransparenceItem;
 
     DECL_DLLPRIVATE_LINK(SelectFillTypeHdl, weld::ComboBox&, void );
@@ -157,10 +162,10 @@ protected:
     DECL_DLLPRIVATE_LINK(ClickImportBitmapHdl, weld::Button&, void);
     DECL_DLLPRIVATE_LINK(ToolbarHdl_Impl, const OString&, void);
 
-    void Update();
     void ImpUpdateTransparencies();
     void SetTransparency(sal_uInt16 nVal);
     void SelectFillAttrHdl_Impl();
+    void FillStyleChanged(bool bUpdateModel);
 };
 
 } // end of namespace svx::sidebar
diff --git a/include/svx/strings.hrc b/include/svx/strings.hrc
index f98ff0f0a3c3..747e3fdcddb1 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")
@@ -542,6 +543,7 @@
 #define RID_SVXSTR_GRADIENT                                 
NC_("RID_SVXSTR_GRADIENT", "Gradient")
 #define RID_SVXSTR_BITMAP                                   
NC_("RID_SVXSTR_BITMAP", "Bitmap")
 #define RID_SVXSTR_PATTERN                                  
NC_("RID_SVXSTR_PATTERN", "Pattern")
+#define RID_SVXSTR_USE_BACKGROUND                           
NC_("RID_SVXSTR_USE_BACKGROUND", "Use Slide Background")
 #define RID_SVXSTR_PATTERN_UNTITLED                         
NC_("RID_SVXSTR_PATTERN_UNTITLED", "Untitled Pattern")
 #define RID_SVXSTR_LINESTYLE                                
NC_("RID_SVXSTR_LINESTYLE", "Line Style")
 #define RID_SVXSTR_INVISIBLE                                
NC_("RID_SVXSTR_INVISIBLE", "None")
diff --git a/include/svx/svxdlg.hxx b/include/svx/svxdlg.hxx
index ee22082c35dc..d697da78a66c 100644
--- a/include/svx/svxdlg.hxx
+++ b/include/svx/svxdlg.hxx
@@ -405,7 +405,8 @@ public:
     virtual VclPtr<AbstractSvxAreaTabDialog>       
CreateSvxAreaTabDialog(weld::Window* pParent,
                                                                           
const SfxItemSet* pAttr,
                                                                           
SdrModel* pModel,
-                                                                          bool 
bShadow) = 0 ;
+                                                                          bool 
bShadow,
+                                                                          bool 
bSlideBackground) = 0 ;
     virtual VclPtr<SfxAbstractTabDialog>           
CreateSvxLineTabDialog(weld::Window* pParent, const SfxItemSet* pAttr, //add 
forSvxLineTabDialog
                                                                  SdrModel* 
pModel,
                                                                  const 
SdrObject* pObj,
diff --git a/include/svx/svxids.hrc b/include/svx/svxids.hrc
index d50be073c40d..96122a66bc10 100644
--- a/include/svx/svxids.hrc
+++ b/include/svx/svxids.hrc
@@ -966,7 +966,7 @@ class XFillGradientItem;
 #define SID_CELL_FORMAT_BORDER                          ( SID_SVX_START + 1132 
)
 #define SID_CHAR_DLG_EFFECT                             ( SID_SVX_START + 1133 
)
 #define SID_CHAR_DLG_POSITION                           ( SID_SVX_START + 1134 
)
-
+#define SID_ATTR_FILL_USE_SLIDE_BACKGROUND              ( SID_SVX_START + 1135 
)
 #define FN_SVX_SET_NUMBER                               ( SID_SVX_START + 1136 
)
 #define FN_SVX_SET_BULLET                               ( SID_SVX_START + 1137 
)
 #define FN_SVX_SET_OUTLINE                              ( SID_SVX_START + 1138 
)
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..86317a903ee4
--- /dev/null
+++ b/include/svx/xfilluseslidebackgrounditem.hxx
@@ -0,0 +1,31 @@
+/* -*- 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);
+
+    virtual XFillUseSlideBackgroundItem* Clone(SfxItemPool* pPool = nullptr) 
const override;
+
+    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/include/svx/xflbckit.hxx b/include/svx/xflbckit.hxx
index 4033e6796913..59d4e940e551 100644
--- a/include/svx/xflbckit.hxx
+++ b/include/svx/xflbckit.hxx
@@ -40,6 +40,8 @@ public:
                                                  MapUnit eCoreMetric,
                                                  MapUnit ePresMetric,
                                                  OUString &rText, const 
IntlWrapper& ) const override;
+
+    void dumpAsXml(xmlTextWriterPtr pWriter) const override;
 };
 
 #endif
diff --git a/include/xmloff/xmltoken.hxx b/include/xmloff/xmltoken.hxx
index 69a495687da6..58b6329ec71a 100644
--- a/include/xmloff/xmltoken.hxx
+++ b/include/xmloff/xmltoken.hxx
@@ -3501,6 +3501,8 @@ namespace xmloff::token {
         XML_DATE_FORMAT,
         XML_DATE_RFC_LANGUAGE_TAG,
 
+        XML_FILL_USE_SLIDE_BACKGROUND,
+
         XML_TOKEN_END
     };
 
diff --git a/offapi/com/sun/star/drawing/FillProperties.idl 
b/offapi/com/sun/star/drawing/FillProperties.idl
index ca64bcd5c6c6..89335baa3cf8 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 7.4
+    */
+    [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/reportdesign/source/ui/misc/UITools.cxx 
b/reportdesign/source/ui/misc/UITools.cxx
index 5593f44ef9f9..87062e35c6f6 100644
--- a/reportdesign/source/ui/misc/UITools.cxx
+++ b/reportdesign/source/ui/misc/UITools.cxx
@@ -749,7 +749,8 @@ bool openAreaDialog( const uno::Reference<report::XShape >& 
_xShape,const uno::R
 
         {   // want the dialog to be destroyed before our set
             SvxAbstractDialogFactory* pFact = 
SvxAbstractDialogFactory::Create();
-            ScopedVclPtr<AbstractSvxAreaTabDialog> 
pDialog(pFact->CreateSvxAreaTabDialog(pParent, &aDescriptor, pModel.get(), 
true));
+            ScopedVclPtr<AbstractSvxAreaTabDialog> pDialog(
+                pFact->CreateSvxAreaTabDialog(pParent, &aDescriptor, 
pModel.get(), true, false));
             if ( RET_OK == pDialog->Execute() )
             {
                 bSuccess = true;
diff --git a/sc/source/ui/drawfunc/drawsh.cxx b/sc/source/ui/drawfunc/drawsh.cxx
index a92c49b8b030..53273c77c7cc 100644
--- a/sc/source/ui/drawfunc/drawsh.cxx
+++ b/sc/source/ui/drawfunc/drawsh.cxx
@@ -552,7 +552,7 @@ void ScDrawShell::ExecuteAreaDlg( const SfxRequest& rReq )
     weld::Window* pWin = rViewData.GetDialogParent();
     VclPtr<AbstractSvxAreaTabDialog> pDlg(pFact->CreateSvxAreaTabDialog(
         pWin, &aNewAttr,
-        rViewData.GetDocument().GetDrawLayer(), true));
+        rViewData.GetDocument().GetDrawLayer(), true, false));
 
     pDlg->StartExecuteAsync([=](sal_Int32 nResult){
         if ( nResult == RET_OK )
diff --git a/schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng 
b/schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng
index 293e40d9601c..9d84b4ee2343 100644
--- a/schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng
+++ b/schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng
@@ -1757,6 +1757,12 @@ 
xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.
             </rng:choice>
           </rng:attribute>
         </rng:optional>
+        <!-- TODO no proposal for fill-use-slide-background - should perhaps 
be added as draw:fill value -->
+        <rng:optional>
+          <rng:attribute name="loext:fill-use-slide-background">
+            <rng:ref name="boolean"/>
+          </rng:attribute>
+        </rng:optional>
         <rng:optional>
           <rng:attribute name="draw:fill-color">
             <rng:ref name="color"/>
diff --git a/sd/qa/unit/import-tests2.cxx b/sd/qa/unit/import-tests2.cxx
index 6c7dfe5a5a64..33bbcca615b7 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();
 }
 
@@ -1728,20 +1737,30 @@ void SdImportTest2::testTdf127964()
 {
     sd::DrawDocShellRef xDocShRef
         = 
loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/pptx/tdf127964.pptx"), 
PPTX);
-    const SdrPage* pPage = GetPage(1, xDocShRef);
-    const SdrObject* pObj = pPage->GetObj(0);
-    auto& rFillStyleItem
-        = dynamic_cast<const 
XFillStyleItem&>(pObj->GetMergedItem(XATTR_FILLSTYLE));
-    CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID, rFillStyleItem.GetValue());
+    {
+        const SdrPage* pPage = GetPage(1, xDocShRef);
+        const SdrObject* pObj = pPage->GetObj(0);
+        auto& rFillStyleItem
+            = dynamic_cast<const 
XFillStyleItem&>(pObj->GetMergedItem(XATTR_FILLSTYLE));
+        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 = saveAndReload(xDocShRef.get(), ODP);
+
+    {
+        const SdrPage* pPage = GetPage(1, xDocShRef);
+        const SdrObject* pObj = pPage->GetObj(0);
+        auto& rFillStyleItem
+            = dynamic_cast<const 
XFillStyleItem&>(pObj->GetMergedItem(XATTR_FILLSTYLE));
+        CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_NONE, 
rFillStyleItem.GetValue());
+        auto& rFillBackgroundItem = dynamic_cast<const 
XFillUseSlideBackgroundItem&>(
+            pObj->GetMergedItem(XATTR_FILLUSESLIDEBACKGROUND));
+        CPPUNIT_ASSERT_EQUAL(true, rFillBackgroundItem.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());
     xDocShRef->DoClose();
 }
 
diff --git a/sd/sdi/_drvwsh.sdi b/sd/sdi/_drvwsh.sdi
index 73c2181d0743..978866b97637 100644
--- a/sd/sdi/_drvwsh.sdi
+++ b/sd/sdi/_drvwsh.sdi
@@ -1402,6 +1402,11 @@ interface DrawView
         ExecMethod = FuTemporary ;
         StateMethod = GetAttrState ;
     ]
+    SID_ATTR_FILL_USE_SLIDE_BACKGROUND // ole : no, status : ?
+    [
+        ExecMethod = FuTemporary ;
+        StateMethod = GetAttrState ;
+    ]
     SID_ATTR_FILL_TRANSPARENCE // ole : no, status : ?
     [
         ExecMethod = FuTemporary ;
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/sd/source/ui/func/fuarea.cxx b/sd/source/ui/func/fuarea.cxx
index 345b2c70b6dc..8dd7543e3ba0 100644
--- a/sd/source/ui/func/fuarea.cxx
+++ b/sd/source/ui/func/fuarea.cxx
@@ -55,7 +55,9 @@ void FuArea::DoExecute( SfxRequest& rReq )
     mpView->GetAttributes( aNewAttr );
 
     SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
-    VclPtr<AbstractSvxAreaTabDialog> 
pDlg(pFact->CreateSvxAreaTabDialog(mpViewShell->GetFrameWeld(), &aNewAttr, 
mpDoc, true));
+    bool bHasSlideBackground = mpViewShell->GetDoc()->GetDocumentType() == 
DocumentType::Impress;
+    VclPtr<AbstractSvxAreaTabDialog> pDlg(
+        pFact->CreateSvxAreaTabDialog(mpViewShell->GetFrameWeld(), &aNewAttr, 
mpDoc, true, bHasSlideBackground));
 
     pDlg->StartExecuteAsync([pDlg, pView = this->mpView, pViewShell = 
this->mpViewShell](sal_Int32 nResult){
         if (nResult == RET_OK)
@@ -71,6 +73,7 @@ void FuArea::DoExecute( SfxRequest& rReq )
                 SID_ATTR_FILL_BITMAP,
                 SID_ATTR_FILL_TRANSPARENCE,
                 SID_ATTR_FILL_FLOATTRANSPARENCE,
+                SID_ATTR_FILL_USE_SLIDE_BACKGROUND,
                 0 };
 
             pViewShell->GetViewFrame()->GetBindings().Invalidate( SidArray );
diff --git a/sd/source/ui/table/tableobjectbar.cxx 
b/sd/source/ui/table/tableobjectbar.cxx
index d351094eae9b..62d81d9805df 100644
--- a/sd/source/ui/table/tableobjectbar.cxx
+++ b/sd/source/ui/table/tableobjectbar.cxx
@@ -193,6 +193,7 @@ void TableObjectBar::Execute( SfxRequest& rReq )
         pBindings->Invalidate( SID_FRAME_LINECOLOR );
         pBindings->Invalidate( SID_ATTR_BORDER );
         pBindings->Invalidate( SID_ATTR_FILL_STYLE );
+        pBindings->Invalidate( SID_ATTR_FILL_USE_SLIDE_BACKGROUND );
         pBindings->Invalidate( SID_ATTR_FILL_TRANSPARENCE );
         pBindings->Invalidate( SID_ATTR_FILL_FLOATTRANSPARENCE );
         pBindings->Invalidate( SID_TABLE_MERGE_CELLS );
diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx
index 3d4e6b604aca..39f5458bfcd6 100644
--- a/sd/source/ui/view/drviews2.cxx
+++ b/sd/source/ui/view/drviews2.cxx
@@ -691,6 +691,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
         case SID_ATTR_SHADOW_BLUR:
         case SID_ATTR_SHADOW_XDISTANCE:
         case SID_ATTR_SHADOW_YDISTANCE:
+        case SID_ATTR_FILL_USE_SLIDE_BACKGROUND:
         case SID_ATTR_FILL_TRANSPARENCE:
         case SID_ATTR_FILL_FLOATTRANSPARENCE:
 
@@ -729,6 +730,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
                     case SID_ATTR_FILL_GRADIENT:
                     case SID_ATTR_FILL_HATCH:
                     case SID_ATTR_FILL_BITMAP:
+                    case SID_ATTR_FILL_USE_SLIDE_BACKGROUND:
                     case SID_ATTR_FILL_TRANSPARENCE:
                     case SID_ATTR_FILL_FLOATTRANSPARENCE:
                         GetViewFrame()->GetDispatcher()->Execute( 
SID_ATTRIBUTES_AREA, SfxCallMode::ASYNCHRON );
diff --git a/sd/source/ui/view/drviewsf.cxx b/sd/source/ui/view/drviewsf.cxx
index ae47828e8be5..8aab2c57602e 100644
--- a/sd/source/ui/view/drviewsf.cxx
+++ b/sd/source/ui/view/drviewsf.cxx
@@ -410,6 +410,7 @@ void DrawViewShell::GetAttrState( SfxItemSet& rSet )
             case SID_ATTR_SHADOW_BLUR:
             case SID_ATTR_SHADOW_XDISTANCE:
             case SID_ATTR_SHADOW_YDISTANCE:
+            case SID_ATTR_FILL_USE_SLIDE_BACKGROUND:
             case SID_ATTR_FILL_TRANSPARENCE:
             case SID_ATTR_FILL_FLOATTRANSPARENCE:
             case SID_ATTR_LINE_STYLE:
diff --git a/sd/source/ui/view/drviewsj.cxx b/sd/source/ui/view/drviewsj.cxx
index c034b98acb66..a1a7d899f4b3 100644
--- a/sd/source/ui/view/drviewsj.cxx
+++ b/sd/source/ui/view/drviewsj.cxx
@@ -65,6 +65,7 @@ void DrawViewShell::GetMenuStateSel( SfxItemSet &rSet )
             SfxItemState::DEFAULT == rSet.GetItemState( 
SID_OBJECT_TITLE_DESCRIPTION ) ||
 
             SfxItemState::DEFAULT == rSet.GetItemState( SID_ATTR_FILL_STYLE ) 
||
+            SfxItemState::DEFAULT == rSet.GetItemState( 
SID_ATTR_FILL_USE_SLIDE_BACKGROUND ) ||
             SfxItemState::DEFAULT == rSet.GetItemState( 
SID_ATTR_FILL_TRANSPARENCE ) ||
             SfxItemState::DEFAULT == rSet.GetItemState( 
SID_ATTR_FILL_FLOATTRANSPARENCE ) ||
             SfxItemState::DEFAULT == rSet.GetItemState( SID_CHANGEBEZIER ) ||
@@ -167,6 +168,7 @@ void DrawViewShell::GetMenuStateSel( SfxItemSet &rSet )
             {
                 //rSet.DisableItem( SID_ATTRIBUTES_AREA ); // remove again!
                 rSet.DisableItem( SID_ATTR_FILL_STYLE );
+                rSet.DisableItem( SID_ATTR_FILL_USE_SLIDE_BACKGROUND );
                 rSet.DisableItem( SID_ATTR_FILL_TRANSPARENCE );
                 rSet.DisableItem( SID_ATTR_FILL_FLOATTRANSPARENCE );
             }
@@ -389,6 +391,7 @@ void DrawViewShell::GetMenuStateSel( SfxItemSet &rSet )
             if( bLine && !bText && !bDrawObj &&!b3dObj)
             {
                 rSet.DisableItem( SID_ATTR_FILL_STYLE );
+                rSet.DisableItem( SID_ATTR_FILL_USE_SLIDE_BACKGROUND );
                 rSet.DisableItem( SID_ATTR_FILL_TRANSPARENCE );
                 rSet.DisableItem( SID_ATTR_FILL_FLOATTRANSPARENCE );
             }
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/sdi/svx.sdi b/svx/sdi/svx.sdi
index de7ef9914b4c..0336b6c2d101 100644
--- a/svx/sdi/svx.sdi
+++ b/svx/sdi/svx.sdi
@@ -11769,7 +11769,23 @@ SfxBoolItem PrepareMailExport SID_MAIL_PREPAREEXPORT
     GroupId = SfxGroupId::Explorer;
 ]
 
+/* TODO: SfxBoolItem or XFillUseSlideBackgroundItem ? */
+SfxBoolItem FillUseSlideBackground SID_ATTR_FILL_USE_SLIDE_BACKGROUND
+[
+    AutoUpdate = TRUE,
+    FastCall = FALSE,
+    ReadOnlyDoc = FALSE,
+    Toggle = FALSE,
+    Container = FALSE,
+    RecordAbsolute = FALSE,
+    RecordPerSet;
+
 
+    AccelConfig = FALSE,
+    MenuConfig = FALSE,
+    ToolBoxConfig = FALSE,
+    GroupId = SfxGroupId::Format;
+]
 
 SfxUInt16Item FillTransparence SID_ATTR_FILL_TRANSPARENCE
 [
diff --git a/svx/source/sdr/primitive2d/sdrattributecreator.cxx 
b/svx/source/sdr/primitive2d/sdrattributecreator.cxx
index 65245509440f..bafa96f95cd8 100644
--- a/svx/source/sdr/primitive2d/sdrattributecreator.cxx
+++ b/svx/source/sdr/primitive2d/sdrattributecreator.cxx
@@ -40,6 +40,7 @@
 #include <svx/xlnedcit.hxx>
 #include <svx/xdash.hxx>
 #include <svx/xlndsit.hxx>
+#include <svx/xfilluseslidebackgrounditem.hxx>
 #include <svx/xfltrit.hxx>
 #include <svx/xflftrit.hxx>
 #include <svx/xflclit.hxx>
@@ -418,6 +419,19 @@ namespace drawinglayer::primitive2d
                 nTransparence = 100;
             }
 
+            if(drawing::FillStyle_NONE == eStyle)
+            {
+                XFillUseSlideBackgroundItem 
aBckItem(rSet.Get(XATTR_FILLUSESLIDEBACKGROUND));
+                const bool bSlideBackgroundFill(aBckItem.GetValue());
+
+                if(bSlideBackgroundFill)
+                {
+                    // we have SlideBackgroundFill mode, create a
+                    // SdrFillAttribute accordingly
+                    return attribute::SdrFillAttribute(true);
+                }
+            }
+
             if(drawing::FillStyle_NONE != eStyle)
             {
                 if(100 != nTransparence)
diff --git a/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx 
b/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx
index 18f1a0918fed..a1838b03ff0e 100644
--- a/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx
+++ b/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx
@@ -51,6 +51,12 @@
 #include <drawinglayer/attribute/sdrglowattribute.hxx>
 #include <osl/diagnose.h>
 
+// for SlideBackgroundFillPrimitive2D
+#include <svx/sdr/primitive2d/svx_primitivetypes2d.hxx>
+#include <svx/unoapi.hxx>
+#include <svx/svdpage.hxx>
+#include <sdr/primitive2d/sdrattributecreator.hxx>
+#include <sdr/contact/viewcontactofmasterpagedescriptor.hxx>
 
 using namespace com::sun::star;
 
@@ -122,8 +128,217 @@ basegfx::B2DRange getTextAnchorRange(const 
attribute::SdrTextAttribute& rText,
     }
     return aAnchorRange;
 }
+
+drawinglayer::attribute::SdrFillAttribute getMasterPageFillAttribute(
+    const geometry::ViewInformation2D& rViewInformation,
+    basegfx::B2DVector& rPageSize)
+{
+    drawinglayer::attribute::SdrFillAttribute aRetval;
+
+    // get SdrPage
+    const SdrPage* 
pVisualizedPage(GetSdrPageFromXDrawPage(rViewInformation.getVisualizedPage()));
+
+    if(nullptr != pVisualizedPage)
+    {
+        // copy needed values for further processing
+        rPageSize.setX(pVisualizedPage->GetWidth());
+        rPageSize.setY(pVisualizedPage->GetHeight());
+
+        if(pVisualizedPage->IsMasterPage())
+        {
+            // the page is a MasterPage, so we are in MasterPage view
+            // still need #i110846#, see ViewContactOfMasterPage
+            if(pVisualizedPage->getSdrPageProperties().GetStyleSheet())
+            {
+                // create page fill attributes with correct properties
+                aRetval = drawinglayer::primitive2d::createNewSdrFillAttribute(
+                    pVisualizedPage->getSdrPageProperties().GetItemSet());
+            }
+        }
+        else
+        {
+            // the page is *no* MasterPage, we are in normal Page view, get 
the MasterPage
+            if(pVisualizedPage->TRG_HasMasterPage())
+            {
+                sdr::contact::ViewContact& 
rVC(pVisualizedPage->TRG_GetMasterPageDescriptorViewContact());
+                sdr::contact::ViewContactOfMasterPageDescriptor* pVCOMPD(
+                    
dynamic_cast<sdr::contact::ViewContactOfMasterPageDescriptor*>(&rVC));
+
+                if(nullptr != pVCOMPD)
+                {
+                    // in this case the still needed #i110846# is part of
+                    //  getCorrectSdrPageProperties, that's the main reason to 
re-use
+                    // that call/functionality here
+                    const SdrPageProperties* pCorrectProperties(
+                        
pVCOMPD->GetMasterPageDescriptor().getCorrectSdrPageProperties());
+
+                    if(pCorrectProperties)
+                    {
+                        // create page fill attributes when correct properties 
were identified
+                        aRetval = 
drawinglayer::primitive2d::createNewSdrFillAttribute(
+                            pCorrectProperties->GetItemSet());
+                    }
+                }
+            }
+        }
+    }
+
+    return aRetval;
+}
+
+// provide a Primitive2D for the SlideBackgroundFill-mode. It is capable
+// of expressing that state of fill and it's decomposition implements all
+// needed preparation of the geometry in an isolated and controllable
+// space and way.
+// It is currently simple buffered (due to being derived from
+// BufferedDecompositionPrimitive2D) and detects if FillStyle changes
+class SlideBackgroundFillPrimitive2D final : public 
BufferedDecompositionPrimitive2D
+{
+private:
+    /// the basegfx::B2DPolyPolygon geometry
+    basegfx::B2DPolyPolygon maPolyPolygon;
+
+    /// the last SdrFillAttribute the geometry was created for
+    drawinglayer::attribute::SdrFillAttribute maLastFill;
+
+protected:
+    // create decomposition data
+    virtual void create2DDecomposition(
+        Primitive2DContainer& rContainer,
+        const geometry::ViewInformation2D& rViewInformation) const override;
+
+public:
+    /// constructor
+    SlideBackgroundFillPrimitive2D(
+        const basegfx::B2DPolyPolygon& rPolyPolygon);
+
+    /// check existing decomposition data, call parent
+    virtual void get2DDecomposition(
+        Primitive2DDecompositionVisitor& rVisitor,
+        const geometry::ViewInformation2D& rViewInformation) const override;
+
+    /// data read access
+    const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return 
maPolyPolygon; }
+
+    /// compare operator
+    virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
+
+    /// get range
+    virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& 
rViewInformation) const override;
+
+    /// provide unique ID
+    virtual sal_uInt32 getPrimitive2DID() const override;
 };
 
+SlideBackgroundFillPrimitive2D::SlideBackgroundFillPrimitive2D(
+    const basegfx::B2DPolyPolygon& rPolyPolygon)
+: BufferedDecompositionPrimitive2D()
+, maPolyPolygon(rPolyPolygon)
+, maLastFill()
+{
+}
+
+void SlideBackgroundFillPrimitive2D::create2DDecomposition(
+    Primitive2DContainer& rContainer,
+    const geometry::ViewInformation2D& rViewInformation) const
+{
+    basegfx::B2DVector aPageSize;
+
+    // get fill from target Page, this will check for all needed things
+    // like MasterPage/relationships, etc. (see getMasterPageFillAttribute 
impl above)
+    drawinglayer::attribute::SdrFillAttribute aFill(
+        getMasterPageFillAttribute(rViewInformation, aPageSize));
+
+    // if fill is on default (empty), nothing will be shown, we are done
+    if(aFill.isDefault())
+        return;
+
+    // Get PolygonRange of own local geometry
+    const basegfx::B2DRange aPolygonRange(getB2DPolyPolygon().getB2DRange());
+
+    // if local geometry is empty, nothing will be shown, we are done
+    if(aPolygonRange.isEmpty())
+        return;
+
+    // Get PageRange
+    const basegfx::B2DRange aPageRange(0.0, 0.0, aPageSize.getX(), 
aPageSize.getY());
+
+    // if local geometry does not overlap with PageRange, nothing will be 
shown, we are done
+    if(!aPageRange.overlaps(aPolygonRange))
+        return;
+
+    // create FillPrimitive2D with the geometry (the PolyPolygon) and
+    // the page's definitonRange to:
+    // - on one hand limit to geometry
+    // - on the other hand allow continutation of fill outside of
+    //   MasterPage's range
+    const attribute::FillGradientAttribute aEmptyFillTransparenceGradient;
+    const Primitive2DReference aCreatedFill(
+        createPolyPolygonFillPrimitive(
+            getB2DPolyPolygon(), // geometry
+            aPageRange, // definition range
+            aFill,
+            aEmptyFillTransparenceGradient));
+
+    rContainer = Primitive2DContainer { aCreatedFill };
+}
+
+void SlideBackgroundFillPrimitive2D::get2DDecomposition(
+    Primitive2DDecompositionVisitor& rVisitor,
+    const geometry::ViewInformation2D& rViewInformation) const
+{
+    basegfx::B2DVector aPageSize;
+    drawinglayer::attribute::SdrFillAttribute aFill;
+
+    if(!getBuffered2DDecomposition().empty())
+    {
+        aFill = getMasterPageFillAttribute(rViewInformation, aPageSize);
+
+        if(!(aFill == maLastFill))
+        {
+            // conditions of last local decomposition have changed, delete
+            const_cast< SlideBackgroundFillPrimitive2D* 
>(this)->setBuffered2DDecomposition(Primitive2DContainer());
+        }
+    }
+
+    if(getBuffered2DDecomposition().empty())
+    {
+        // remember last Fill
+        const_cast< SlideBackgroundFillPrimitive2D* >(this)->maLastFill = 
aFill;
+    }
+
+    // use parent implementation
+    BufferedDecompositionPrimitive2D::get2DDecomposition(rVisitor, 
rViewInformation);
+}
+
+bool SlideBackgroundFillPrimitive2D::operator==(const BasePrimitive2D& 
rPrimitive) const
+{
+    if (BufferedDecompositionPrimitive2D::operator==(rPrimitive))
+    {
+        const SlideBackgroundFillPrimitive2D& rCompare
+            = static_cast<const SlideBackgroundFillPrimitive2D&>(rPrimitive);
+
+        return getB2DPolyPolygon() == rCompare.getB2DPolyPolygon();
+    }
+
+    return false;
+}
+
+basegfx::B2DRange SlideBackgroundFillPrimitive2D::getB2DRange(
+    const geometry::ViewInformation2D& /*rViewInformation*/) const
+{
+    // return range
+    return basegfx::utils::getRange(getB2DPolyPolygon());
+}
+
+// provide unique ID
+sal_uInt32 SlideBackgroundFillPrimitive2D::getPrimitive2DID() const
+{
+    return PRIMITIVE2D_ID_SLIDEBACKGROUNDFILLPRIMITIVE2D;
+}
+
+}; // end of anonymous namespace
+
         class TransparencePrimitive2D;
 
         Primitive2DReference createPolyPolygonFillPrimitive(
@@ -178,6 +393,13 @@ basegfx::B2DRange getTextAnchorRange(const 
attribute::SdrTextAttribute& rText,
                     rDefinitionRange,
                     
rFill.getFillGraphic().createFillGraphicAttribute(rDefinitionRange));
             }
+            else if(rFill.isSlideBackgroundFill())
+            {
+                // create needed Primitive2D representation for
+                // SlideBackgroundFill-mode
+                pNewFillPrimitive = new SlideBackgroundFillPrimitive2D(
+                    rPolyPolygon);
+            }
             else
             {
                 pNewFillPrimitive = new PolyPolygonColorPrimitive2D(
diff --git a/svx/source/sidebar/area/AreaPropertyPanel.cxx 
b/svx/source/sidebar/area/AreaPropertyPanel.cxx
index b4d22f6823ab..1bcbdac19e1e 100644
--- a/svx/source/sidebar/area/AreaPropertyPanel.cxx
+++ b/svx/source/sidebar/area/AreaPropertyPanel.cxx
@@ -46,6 +46,7 @@ AreaPropertyPanel::AreaPropertyPanel(
       maPatternListControl(SID_PATTERN_LIST, *pBindings, *this),
       maFillTransparenceController(SID_ATTR_FILL_TRANSPARENCE, *pBindings, 
*this),
       maFillFloatTransparenceController(SID_ATTR_FILL_FLOATTRANSPARENCE, 
*pBindings, *this),
+      maFillUseSlideBackgroundController(SID_ATTR_FILL_USE_SLIDE_BACKGROUND, 
*pBindings, *this),
       mpBindings(pBindings)
 {
 }
@@ -86,6 +87,14 @@ void AreaPropertyPanel::setFillTransparence(const 
XFillTransparenceItem& rItem)
             SfxCallMode::RECORD, { &rItem });
 }
 
+void AreaPropertyPanel::setFillUseBackground(const XFillStyleItem* pStyleItem,
+                                             const 
XFillUseSlideBackgroundItem& rItem)
+{
+    GetBindings()->GetDispatcher()->ExecuteList(
+        SID_ATTR_FILL_USE_SLIDE_BACKGROUND, SfxCallMode::RECORD,
+        std::initializer_list<SfxPoolItem const*>{ &rItem, pStyleItem });
+}
+
 void AreaPropertyPanel::setFillFloatTransparence(const 
XFillFloatTransparenceItem& rItem)
 {
     
GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_FILL_FLOATTRANSPARENCE,
diff --git a/svx/source/sidebar/area/AreaPropertyPanel.hxx 
b/svx/source/sidebar/area/AreaPropertyPanel.hxx
index ec7c1223d108..6c398e6ac077 100644
--- a/svx/source/sidebar/area/AreaPropertyPanel.hxx
+++ b/svx/source/sidebar/area/AreaPropertyPanel.hxx
@@ -30,6 +30,7 @@
 
 class XFillFloatTransparenceItem;
 class XFillTransparenceItem;
+class XFillUseSlideBackgroundItem;
 class XFillStyleItem;
 class XFillGradientItem;
 class XFillColorItem;
@@ -59,6 +60,7 @@ public:
     virtual ~AreaPropertyPanel() override;
 
     virtual void setFillTransparence(const XFillTransparenceItem& rItem) 
override;
+    virtual void setFillUseBackground(const XFillStyleItem* pStyleItem, const 
XFillUseSlideBackgroundItem& rItem) override;
     virtual void setFillFloatTransparence(const XFillFloatTransparenceItem& 
rItem) override;
     virtual void setFillStyle(const XFillStyleItem& rItem) override;
     virtual void setFillStyleAndColor(const XFillStyleItem* pStyleItem, const 
XFillColorItem& aColorItem) override;
@@ -78,6 +80,7 @@ private:
     ::sfx2::sidebar::ControllerItem maPatternListControl;
     ::sfx2::sidebar::ControllerItem maFillTransparenceController;
     ::sfx2::sidebar::ControllerItem maFillFloatTransparenceController;
+    ::sfx2::sidebar::ControllerItem maFillUseSlideBackgroundController;
 
     SfxBindings* mpBindings;
 };
diff --git a/svx/source/sidebar/area/AreaPropertyPanelBase.cxx 
b/svx/source/sidebar/area/AreaPropertyPanelBase.cxx
index 428d35d94d59..6dec785c4067 100644
--- a/svx/source/sidebar/area/AreaPropertyPanelBase.cxx
+++ b/svx/source/sidebar/area/AreaPropertyPanelBase.cxx
@@ -25,6 +25,7 @@
 #include <sfx2/objsh.hxx>
 #include <svx/xfltrit.hxx>
 #include <svx/xflftrit.hxx>
+#include <svx/xfilluseslidebackgrounditem.hxx>
 #include <svx/xtable.hxx>
 #include <sfx2/sidebar/Panel.hxx>
 #include <sfx2/opengrf.hxx>
@@ -49,7 +50,8 @@ enum eFillStyle
     GRADIENT,
     HATCH,
     BITMAP,
-    PATTERN
+    PATTERN,
+    USE_BACKGROUND
 };
 
 }
@@ -231,203 +233,7 @@ IMPL_LINK_NOARG(AreaPropertyPanelBase, 
ClickImportBitmapHdl, weld::Button&, void
 
 IMPL_LINK_NOARG(AreaPropertyPanelBase, SelectFillTypeHdl, weld::ComboBox&, 
void)
 {
-    sal_Int32 nPos = static_cast<eFillStyle>(mxLbFillType->get_active());
-    mxLbFillAttr->clear();
-    SfxObjectShell* pSh = SfxObjectShell::Current();
-    if(!pSh)
-        return;
-
-    // #i122676# Do no longer trigger two Execute calls, one for 
SID_ATTR_FILL_STYLE
-    // and one for setting the fill attribute itself, but add two SfxPoolItems 
to the
-    // call to get just one action at the SdrObject and to create only one 
Undo action, too.
-    // Checked that this works in all apps.
-    switch( nPos )
-    {
-        default:
-        case NONE:
-        {
-            mxLbFillAttr->show();
-            mxLbFillGradFrom->hide();
-            mxLbFillGradTo->hide();
-            mxGradientStyle->hide();
-            mxMTRAngle->hide();
-            mxToolBoxColor->hide();
-            mxBmpImport->hide();
-            mxLbFillAttr->set_sensitive(false);
-
-            // #i122676# need to call a single SID_ATTR_FILL_STYLE change
-            setFillStyle(XFillStyleItem(drawing::FillStyle_NONE));
-            break;
-        }
-        case SOLID:
-        {
-            mxLbFillAttr->hide();
-            mxLbFillGradFrom->hide();
-            mxLbFillGradTo->hide();
-            mxGradientStyle->hide();
-            mxMTRAngle->hide();
-            mxBmpImport->hide();
-            mxToolBoxColor->show();
-            const Color aColor = mpColorItem ? mpColorItem->GetColorValue() : 
COL_AUTO;
-            const XFillColorItem aXFillColorItem( "", aColor );
-
-            // #i122676# change FillStyle and Color in one call
-            XFillStyleItem aXFillStyleItem(drawing::FillStyle_SOLID);
-            setFillStyleAndColor(&aXFillStyleItem, aXFillColorItem);
-            break;
-        }
-        case GRADIENT:
-        {
-            mxLbFillAttr->hide();
-            mxLbFillGradFrom->show();
-            mxLbFillGradTo->show();
-            mxGradientStyle->show();
-            mxMTRAngle->show();
-            mxToolBoxColor->hide();
-            mxBmpImport->hide();
-
-            mxLbFillAttr->set_sensitive(true);
-            mxLbFillGradTo->set_sensitive(true);
-            mxLbFillGradFrom->set_sensitive(true);
-            mxGradientStyle->set_sensitive(true);
-            mxMTRAngle->set_sensitive(true);
-            mxLbFillAttr->clear();
-
-            const SvxGradientListItem * pItem = 
pSh->GetItem(SID_GRADIENT_LIST);
-
-            if(0 < pItem->GetGradientList()->Count())
-            {
-                const XGradient aGradient = 
pItem->GetGradientList()->GetGradient(0)->GetGradient();
-                const OUString aName = 
pItem->GetGradientList()->GetGradient(0)->GetName();
-                const XFillGradientItem aXFillGradientItem(aName, aGradient);
-
-                // #i122676# change FillStyle and Gradient in one call
-                XFillStyleItem aXFillStyleItem(drawing::FillStyle_GRADIENT);
-                setFillStyleAndGradient(&aXFillStyleItem, aXFillGradientItem);
-                mxLbFillGradFrom->SelectEntry(aGradient.GetStartColor());
-                mxLbFillGradTo->SelectEntry(aGradient.GetEndColor());
-
-                mxMTRAngle->set_value(toDegrees(aGradient.GetAngle()), 
FieldUnit::DEGREE);
-                css::awt::GradientStyle eXGS = aGradient.GetGradientStyle();
-                mxGradientStyle->set_active(sal::static_int_cast< sal_Int32 >( 
eXGS ));
-            }
-            break;
-        }
-        case HATCH:
-        {
-            mxLbFillAttr->show();
-            mxLbFillGradFrom->hide();
-            mxLbFillGradTo->hide();
-            mxMTRAngle->hide();
-            mxGradientStyle->hide();
-            mxToolBoxColor->hide();
-            mxBmpImport->hide();
-
-            const SvxHatchListItem* pItem( pSh->GetItem(SID_HATCH_LIST) );
-            if(pItem)
-            {
-                const XHatchListRef& pXHatchList(pItem->GetHatchList());
-                mxLbFillAttr->set_sensitive(true);
-                mxLbFillAttr->clear();
-                SvxFillAttrBox::Fill(*mxLbFillAttr, pXHatchList);
-
-                if (mnLastPosHatch != -1)
-                {
-                    if(mnLastPosHatch < pXHatchList->Count())
-                    {
-                        const XHatch aHatch = 
pXHatchList->GetHatch(mnLastPosHatch)->GetHatch();
-                        const OUString aName = 
pXHatchList->GetHatch(mnLastPosHatch)->GetName();
-                        const XFillHatchItem aXFillHatchItem(aName, aHatch);
-
-                        // #i122676# change FillStyle and Hatch in one call
-                        XFillStyleItem 
aXFillStyleItem(drawing::FillStyle_HATCH);
-                        setFillStyleAndHatch(&aXFillStyleItem, 
aXFillHatchItem);
-                        mxLbFillAttr->set_active(mnLastPosHatch);
-                    }
-                }
-            }
-            else
-            {
-                mxLbFillAttr->set_sensitive(false);
-            }
-            break;
-        }
-        case BITMAP:
-        case PATTERN:
-        {
-            mxLbFillAttr->show();
-            mxLbFillAttr->set_sensitive(true);
-            mxLbFillAttr->clear();
-            mxLbFillGradFrom->hide();
-            mxLbFillGradTo->hide();
-            mxMTRAngle->hide();
-            mxGradientStyle->hide();
-            mxToolBoxColor->hide();
-
-            OUString aName;
-            GraphicObject aBitmap;
-            if(nPos == static_cast< sal_Int32 >(BITMAP))
-            {
-                if (!comphelper::LibreOfficeKit::isActive())
-                    mxBmpImport->show();
-                const SvxBitmapListItem* pItem = pSh->GetItem(SID_BITMAP_LIST);
-                if(pItem)
-                {
-                    const XBitmapListRef& pXBitmapList(pItem->GetBitmapList());
-                    SvxFillAttrBox::Fill(*mxLbFillAttr, pXBitmapList);
-
-                    if (mnLastPosBitmap != -1)
-                    {
-                        if(mnLastPosBitmap < pXBitmapList->Count())
-                        {
-                            const XBitmapEntry* pXBitmapEntry = 
pXBitmapList->GetBitmap(mnLastPosBitmap);
-                            aBitmap = pXBitmapEntry->GetGraphicObject();
-                            aName = pXBitmapEntry->GetName();
-                            mxLbFillAttr->set_active(mnLastPosBitmap);
-                        }
-                    }
-                }
-                else
-                {
-                    mxLbFillAttr->hide();
-                }
-            }
-            else if(nPos == static_cast< sal_Int32 >(PATTERN))
-            {
-                mxBmpImport->hide();
-                const SvxPatternListItem* pItem = 
pSh->GetItem(SID_PATTERN_LIST);
-                if(pItem)
-                {
-                    const XPatternListRef& 
pXPatternList(pItem->GetPatternList());
-                    SvxFillAttrBox::Fill(*mxLbFillAttr, pXPatternList);
-
-                    if (mnLastPosPattern != -1)
-                    {
-                        if(mnLastPosPattern < pXPatternList->Count())
-                        {
-                            const XBitmapEntry* pXPatternEntry = 
pXPatternList->GetBitmap(mnLastPosPattern);
-                            aBitmap = pXPatternEntry->GetGraphicObject();
-                            aName = pXPatternEntry->GetName();
-                            mxLbFillAttr->set_active(mnLastPosPattern);
-                        }
-                    }
-                }
-                else
-                {
-                    mxLbFillAttr->hide();
-                }
-            }
-            const XFillBitmapItem aXFillBitmapItem( aName, aBitmap );
-            const XFillStyleItem aXFillStyleItem(drawing::FillStyle_BITMAP);
-            setFillStyleAndBitmap(&aXFillStyleItem, aXFillBitmapItem);
-            break;
-        }
-    }
-
-    meLastXFS = static_cast<sal_uInt16>(nPos);
-
-    if (m_pPanel && !comphelper::LibreOfficeKit::isActive())
-        m_pPanel->TriggerDeckLayouting();
+    FillStyleChanged(true);
 }
 
 IMPL_LINK_NOARG(AreaPropertyPanelBase, SelectFillColorHdl, ColorListBox&, void)
@@ -460,8 +266,10 @@ void AreaPropertyPanelBase::SelectFillAttrHdl_Impl()
         {
             if(bFillStyleChange)
             {
-                XFillStyleItem aXFillStyleItem(drawing::FillStyle_NONE);
-                setFillStyle(aXFillStyleItem);
+                const XFillStyleItem aXFillStyleItem(drawing::FillStyle_NONE);
+                // Need to disable the XFillUseSlideBackgroundItem
+                const XFillUseSlideBackgroundItem 
aXFillUseSlideBackgroundItem(false);
+                setFillUseBackground(&aXFillStyleItem, 
aXFillUseSlideBackgroundItem);
             }
             break;
         }
@@ -589,6 +397,237 @@ void AreaPropertyPanelBase::SelectFillAttrHdl_Impl()
         m_pPanel->TriggerDeckLayouting();
 }
 
+void AreaPropertyPanelBase::FillStyleChanged(bool bUpdateModel)
+{
+    sal_Int32 nPos = static_cast<eFillStyle>(mxLbFillType->get_active());
+    mxLbFillAttr->clear();
+    SfxObjectShell* pSh = SfxObjectShell::Current();
+    if (!pSh)
+        return;
+
+    bool bShowLbFillAttr = false;
+    bool bShowLbFillGradFrom = false;
+    bool bShowLbFillGradTo = false;
+    bool bShowGradientStyle = false;
+    bool bShowMTRAngle = false;
+    bool bShowToolBoxColor = false;
+    bool bShowBmpImport = false;
+    // Transparency widgets are shown by default
+    bool bShowLBTransType = true;
+    bool bShowTrspTextFT = true;
+    bool bShowMTRTransparent = true;
+    bool bShowSldTransparent = true;
+
+    // #i122676# Do no longer trigger two Execute calls, one for 
SID_ATTR_FILL_STYLE
+    // and one for setting the fill attribute itself, but add two SfxPoolItems 
to the
+    // call to get just one action at the SdrObject and to create only one 
Undo action, too.
+    // Checked that this works in all apps.
+    switch (nPos)
+    {
+        default:
+        case NONE:
+        {
+            if (bUpdateModel)
+            {
+                const XFillStyleItem aXFillStyleItem(drawing::FillStyle_NONE);
+                // Need to disable the XFillUseSlideBackgroundItem
+                const XFillUseSlideBackgroundItem 
aXFillUseSlideBackgroundItem(false);
+                setFillUseBackground(&aXFillStyleItem, 
aXFillUseSlideBackgroundItem);
+            }
+
+            break;
+        }
+        case SOLID:
+        {
+            bShowToolBoxColor = true;
+
+            if (bUpdateModel)
+            {
+                const Color aColor = mpColorItem ? 
mpColorItem->GetColorValue() : COL_AUTO;
+                const XFillColorItem aXFillColorItem("", aColor);
+
+                // #i122676# change FillStyle and Color in one call
+                XFillStyleItem aXFillStyleItem(drawing::FillStyle_SOLID);
+                setFillStyleAndColor(&aXFillStyleItem, aXFillColorItem);
+            }
+            break;
+        }
+        case GRADIENT:
+        {
+            bShowLbFillGradFrom = true;
+            bShowLbFillGradTo = true;
+            bShowGradientStyle = true;
+            bShowMTRAngle = true;
+
+            mxLbFillAttr->set_sensitive(true);
+            mxLbFillGradTo->set_sensitive(true);
+            mxLbFillGradFrom->set_sensitive(true);
+            mxGradientStyle->set_sensitive(true);
+            mxMTRAngle->set_sensitive(true);
+            mxLbFillAttr->clear();
+
+            const SvxGradientListItem* pItem = pSh->GetItem(SID_GRADIENT_LIST);
+
+            if (0 < pItem->GetGradientList()->Count())
+            {
+                const XGradient aGradient = 
pItem->GetGradientList()->GetGradient(0)->GetGradient();
+                const OUString aName = 
pItem->GetGradientList()->GetGradient(0)->GetName();
+                const XFillGradientItem aXFillGradientItem(aName, aGradient);
+
+                // #i122676# change FillStyle and Gradient in one call
+                if (bUpdateModel)
+                {
+                    XFillStyleItem 
aXFillStyleItem(drawing::FillStyle_GRADIENT);
+                    setFillStyleAndGradient(&aXFillStyleItem, 
aXFillGradientItem);
+                }
+                mxLbFillGradFrom->SelectEntry(aGradient.GetStartColor());
+                mxLbFillGradTo->SelectEntry(aGradient.GetEndColor());
+
+                mxMTRAngle->set_value(toDegrees(aGradient.GetAngle()), 
FieldUnit::DEGREE);
+                css::awt::GradientStyle eXGS = aGradient.GetGradientStyle();
+                
mxGradientStyle->set_active(sal::static_int_cast<sal_Int32>(eXGS));
+            }
+            break;
+        }
+        case HATCH:
+        {
+            bShowLbFillAttr = true;
+
+            const SvxHatchListItem* pItem(pSh->GetItem(SID_HATCH_LIST));
+            if (pItem)
+            {
+                const XHatchListRef& pXHatchList(pItem->GetHatchList());
+                mxLbFillAttr->set_sensitive(true);
+                mxLbFillAttr->clear();
+                SvxFillAttrBox::Fill(*mxLbFillAttr, pXHatchList);
+
+                if (mnLastPosHatch != -1)
+                {
+                    if (mnLastPosHatch < pXHatchList->Count())
+                    {
+                        const XHatch aHatch = 
pXHatchList->GetHatch(mnLastPosHatch)->GetHatch();
+                        const OUString aName = 
pXHatchList->GetHatch(mnLastPosHatch)->GetName();
+                        const XFillHatchItem aXFillHatchItem(aName, aHatch);
+
+                        // #i122676# change FillStyle and Hatch in one call
+                        if (bUpdateModel)
+                        {
+                            XFillStyleItem 
aXFillStyleItem(drawing::FillStyle_HATCH);
+                            setFillStyleAndHatch(&aXFillStyleItem, 
aXFillHatchItem);
+                        }
+                        mxLbFillAttr->set_active(mnLastPosHatch);
+                    }
+                }
+            }
+            else
+            {
+                mxLbFillAttr->set_sensitive(false);
+            }
+            break;
+        }
+        case BITMAP:
+        case PATTERN:
+        {
+            bShowLbFillAttr = true;
+            mxLbFillAttr->set_sensitive(true);
+            mxLbFillAttr->clear();
+
+            OUString aName;
+            GraphicObject aBitmap;
+            if (nPos == static_cast<sal_Int32>(BITMAP))
+            {
+                if (!comphelper::LibreOfficeKit::isActive())
+                    bShowBmpImport = true;
+                const SvxBitmapListItem* pItem = pSh->GetItem(SID_BITMAP_LIST);
+                if (pItem)
+                {
+                    const XBitmapListRef& pXBitmapList(pItem->GetBitmapList());
+                    SvxFillAttrBox::Fill(*mxLbFillAttr, pXBitmapList);
+
+                    if (mnLastPosBitmap != -1)
+                    {
+                        if (mnLastPosBitmap < pXBitmapList->Count())
+                        {
+                            const XBitmapEntry* pXBitmapEntry
+                                = pXBitmapList->GetBitmap(mnLastPosBitmap);
+                            aBitmap = pXBitmapEntry->GetGraphicObject();
+                            aName = pXBitmapEntry->GetName();
+                            mxLbFillAttr->set_active(mnLastPosBitmap);
+                        }
+                    }
+                }
+                else
+                {
+                    bShowBmpImport = false;
+                }
+            }
+            else if (nPos == static_cast<sal_Int32>(PATTERN))
+            {
+                const SvxPatternListItem* pItem = 
pSh->GetItem(SID_PATTERN_LIST);
+                if (pItem)
+                {
+                    const XPatternListRef& 
pXPatternList(pItem->GetPatternList());
+                    SvxFillAttrBox::Fill(*mxLbFillAttr, pXPatternList);
+
+                    if (mnLastPosPattern != -1)
+                    {
+                        if (mnLastPosPattern < pXPatternList->Count())
+                        {
+                            const XBitmapEntry* pXPatternEntry
+                                = pXPatternList->GetBitmap(mnLastPosPattern);
+                            aBitmap = pXPatternEntry->GetGraphicObject();
+                            aName = pXPatternEntry->GetName();
+                            mxLbFillAttr->set_active(mnLastPosPattern);
+                        }
+                    }
+                }
+                else
+                {
+                    bShowLbFillAttr = false;
+                }
+            }
+            if (bUpdateModel)
+            {
+                const XFillBitmapItem aXFillBitmapItem(aName, aBitmap);
+                const XFillStyleItem 
aXFillStyleItem(drawing::FillStyle_BITMAP);
+                setFillStyleAndBitmap(&aXFillStyleItem, aXFillBitmapItem);
+            }
+            break;
+        }
+        case USE_BACKGROUND:
+        {
+            bShowLBTransType = false;
+            bShowTrspTextFT = false;
+            bShowMTRTransparent = false;
+            bShowSldTransparent = false;
+            if (bUpdateModel)
+            {
+                const XFillStyleItem aXFillStyleItem(drawing::FillStyle_NONE);
+                const XFillUseSlideBackgroundItem 
aXFillUseSlideBackgroundItem(true);
+                setFillUseBackground(&aXFillStyleItem, 
aXFillUseSlideBackgroundItem);
+                break;
+            }
+        }
+    }
+
+    mxLbFillAttr->set_visible(bShowLbFillAttr);
+    mxLbFillGradFrom->set_visible(bShowLbFillGradFrom);
+    mxLbFillGradTo->set_visible(bShowLbFillGradTo);
+    mxGradientStyle->set_visible(bShowGradientStyle);
+    mxMTRAngle->set_visible(bShowMTRAngle);
+    mxToolBoxColor->set_visible(bShowToolBoxColor);
+    mxBmpImport->set_visible(bShowBmpImport);
+    mxLBTransType->set_visible(bShowLBTransType);
+    mxTrspTextFT->set_visible(bShowTrspTextFT);
+    mxMTRTransparent->set_visible(bShowMTRTransparent);
+    mxSldTransparent->set_visible(bShowSldTransparent);
+
+    meLastXFS = static_cast<sal_uInt16>(nPos);
+
+    if (m_pPanel && !comphelper::LibreOfficeKit::isActive())
+        m_pPanel->TriggerDeckLayouting();
+}
+
 void AreaPropertyPanelBase::ImpUpdateTransparencies()
 {
     if(mpTransparenceItem || mpFloatTransparenceItem)
@@ -802,7 +841,9 @@ void AreaPropertyPanelBase::updateFillStyle(bool bDisabled, 
bool bDefaultOrSet,
             {
                 mxLbFillAttr->set_active(-1);
                 mxLbFillAttr->set_sensitive(false);
-                nPos = NONE;
+                // "Use slide background" also uses FillStyle_NONE internally,
+                // don't switch listbox in that case (will be handled by 
updateFillUseBackground)
+                nPos = meLastXFS == USE_BACKGROUND ? USE_BACKGROUND : NONE;
                 break;
             }
             case drawing::FillStyle_SOLID:
@@ -830,7 +871,7 @@ void AreaPropertyPanelBase::updateFillStyle(bool bDisabled, 
bool bDefaultOrSet,
         }
         meLastXFS = static_cast< sal_uInt16 >(mxLbFillType->get_active());
         mxLbFillType->set_active(static_cast< sal_Int32 >(nPos));
-        Update();
+        FillStyleChanged(false);
         return;
     }
 
@@ -841,8 +882,6 @@ void AreaPropertyPanelBase::updateFillStyle(bool bDisabled, 
bool bDefaultOrSet,
     mxToolBoxColor->hide();
     meLastXFS = static_cast<sal_uInt16>(-1);
     mpStyleItem.reset();
-    if (m_pPanel && !comphelper::LibreOfficeKit::isActive())
-        m_pPanel->TriggerDeckLayouting();
 }
 
 void AreaPropertyPanelBase::updateFillGradient(bool bDisabled, bool 
bDefaultOrSet, const SfxPoolItem* pState)
@@ -865,7 +904,7 @@ void AreaPropertyPanelBase::updateFillGradient(bool 
bDisabled, bool bDefaultOrSe
         if (bDefaultOrSet)
         {
             mxLbFillType->set_active(GRADIENT);
-            Update();
+            FillStyleChanged(false);
         }
         else if(bDisabled)
         {
@@ -882,8 +921,6 @@ void AreaPropertyPanelBase::updateFillGradient(bool 
bDisabled, bool bDefaultOrSe
             mxLbFillGradTo->SetNoSelection();
         }
     }
-    if (m_pPanel && !comphelper::LibreOfficeKit::isActive())
-        m_pPanel->TriggerDeckLayouting();
 }
 
 void AreaPropertyPanelBase::updateFillHatch(bool bDisabled, bool 
bDefaultOrSet, const SfxPoolItem* pState)
@@ -903,7 +940,7 @@ void AreaPropertyPanelBase::updateFillHatch(bool bDisabled, 
bool bDefaultOrSet,
         {
             mxLbFillAttr->set_sensitive(true);
             mxLbFillType->set_active(HATCH);
-            Update();
+            FillStyleChanged(false);
         }
         else if(bDisabled)
         {
@@ -915,8 +952,7 @@ void AreaPropertyPanelBase::updateFillHatch(bool bDisabled, 
bool bDefaultOrSet,
             mxLbFillAttr->set_active(-1);
         }
     }
-    if (m_pPanel && !comphelper::LibreOfficeKit::isActive())
-        m_pPanel->TriggerDeckLayouting();
+    FillStyleChanged(false);
 }
 
 void AreaPropertyPanelBase::updateFillColor(bool bDefaultOrSet, const 
SfxPoolItem* pState)
@@ -932,10 +968,8 @@ void AreaPropertyPanelBase::updateFillColor(bool 
bDefaultOrSet, const SfxPoolIte
         mxLbFillAttr->hide();
         mxToolBoxColor->show();
         mxLbFillType->set_active(SOLID);
-        Update();
+        FillStyleChanged(false);
     }
-    if (m_pPanel && !comphelper::LibreOfficeKit::isActive())
-        m_pPanel->TriggerDeckLayouting();
 }
 
 void AreaPropertyPanelBase::updateFillBitmap(bool bDisabled, bool 
bDefaultOrSet, const SfxPoolItem* pState)
@@ -957,7 +991,7 @@ void AreaPropertyPanelBase::updateFillBitmap(bool 
bDisabled, bool bDefaultOrSet,
                 mxLbFillType->set_active(PATTERN);
             else
                 mxLbFillType->set_active(BITMAP);
-            Update();
+            FillStyleChanged(false);
         }
         else if(bDisabled)
         {
@@ -969,8 +1003,36 @@ void AreaPropertyPanelBase::updateFillBitmap(bool 
bDisabled, bool bDefaultOrSet,
             mxLbFillAttr->set_active(-1);
         }
     }
-    if (m_pPanel && !comphelper::LibreOfficeKit::isActive())
-        m_pPanel->TriggerDeckLayouting();
+}
+
+void AreaPropertyPanelBase::updateFillUseBackground(bool bDisabled, bool 
bDefaultOrSet, const SfxPoolItem* pState)
+{
+    if (bDisabled)
+    {
+        mpUseSlideBackgroundItem.reset();
+        return;
+    }
+
+    if (bDefaultOrSet)
+    {
+        if (pState)
+        {
+            const XFillUseSlideBackgroundItem* pItem = static_cast<const 
XFillUseSlideBackgroundItem*>(pState);
+            // When XFillUseSlideBackgroundItem is true, select "Use 
Background Fill". When false, select "None"
+            int nPos = pItem->GetValue() ? USE_BACKGROUND : NONE;
+            mxLbFillType->set_active(nPos);
+            mpUseSlideBackgroundItem.reset(pItem->Clone());
+            FillStyleChanged(false);
+        }
+        else
+        {
+            mpUseSlideBackgroundItem.reset();
+        }
+    }
+    else
+    {
+        mpUseSlideBackgroundItem.reset();
+    }
 }
 
 void AreaPropertyPanelBase::NotifyItemUpdate(
@@ -1005,6 +1067,9 @@ void AreaPropertyPanelBase::NotifyItemUpdate(
         case SID_ATTR_FILL_BITMAP:
             updateFillBitmap(bDisabled, bDefaultOrSet, pState);
         break;
+        case SID_ATTR_FILL_USE_SLIDE_BACKGROUND:
+            updateFillUseBackground(bDisabled, bDefaultOrSet, pState);
+        break;
         case SID_GRADIENT_LIST:
         {
             if(bDefault)
@@ -1085,160 +1150,7 @@ void AreaPropertyPanelBase::NotifyItemUpdate(
             break;
         }
     }
-}
-
-void AreaPropertyPanelBase::Update()
-{
-        const eFillStyle eXFS = 
static_cast<eFillStyle>(mxLbFillType->get_active());
-        SfxObjectShell* pSh = SfxObjectShell::Current();
-
-        switch( eXFS )
-        {
-            case eFillStyle::NONE:
-            {
-                mxLbFillAttr->show();
-                mxLbFillGradFrom->hide();
-                mxLbFillGradTo->hide();
-                mxMTRAngle->hide();
-                mxGradientStyle->hide();
-                mxToolBoxColor->hide();
-                mxBmpImport->hide();
-                break;
-            }
-            case eFillStyle::SOLID:
-            {
-                if(mpColorItem)
-                {
-                    mxLbFillAttr->hide();
-                    mxLbFillGradFrom->hide();
-                    mxLbFillGradTo->hide();
-                    mxMTRAngle->hide();
-                    mxGradientStyle->hide();
-                    mxToolBoxColor->show();
-                    mxBmpImport->hide();
-                }
-                break;
-            }
-            case eFillStyle::GRADIENT:
-            {
-                mxLbFillAttr->hide();
-                mxLbFillGradFrom->show();
-                mxLbFillGradTo->show();
-                mxMTRAngle->set_sensitive(true);
-                mxMTRAngle->show();
-                mxGradientStyle->show();
-                mxToolBoxColor->hide();
-                mxBmpImport->hide();
-
-                if(pSh && pSh->GetItem(SID_GRADIENT_LIST))
-                {
-                    mxLbFillAttr->set_sensitive(true);
-                    mxLbFillAttr->clear();
-                    SvxFillAttrBox::Fill(*mxLbFillAttr, 
pSh->GetItem(SID_GRADIENT_LIST)->GetGradientList());
-                    mxLbFillGradTo->SetNoSelection();
-                    mxLbFillGradFrom->SetNoSelection();
-                    if (mpFillGradientItem)
-                    {
-                        const OUString aString(mpFillGradientItem->GetName());
-                        mxLbFillAttr->set_active_text(aString);
-                        const XGradient aGradient = 
mpFillGradientItem->GetGradientValue();
-                        
mxLbFillGradFrom->SelectEntry(aGradient.GetStartColor());
-                        mxLbFillGradTo->SelectEntry(aGradient.GetEndColor());
-                        mxGradientStyle->set_active(sal::static_int_cast< 
sal_Int32 >( aGradient.GetGradientStyle() ));
-                        if(mxGradientStyle->get_active() == 
sal_Int32(GradientStyle::Radial))
-                            mxMTRAngle->set_sensitive(false);
-                        else
-                            
mxMTRAngle->set_value(toDegrees(aGradient.GetAngle()), FieldUnit::DEGREE);
-                    }
-                    else
-                    {
-                        mxLbFillAttr->set_active(-1);
-                    }
-                }
-                else
-                {
-                    mxLbFillAttr->set_active(-1);
-                }
-                break;
-            }
-            case eFillStyle::HATCH:
-            {
-                mxLbFillAttr->show();
-                mxLbFillGradFrom->hide();
-                mxLbFillGradTo->hide();
-                mxMTRAngle->hide();
-                mxGradientStyle->hide();
-                mxToolBoxColor->hide();
-                mxBmpImport->hide();
-                mxBmpImport->hide();
-
-                if(pSh && pSh->GetItem(SID_HATCH_LIST))
-                {
-                    mxLbFillAttr->set_sensitive(true);
-                    mxLbFillAttr->clear();
-                    SvxFillAttrBox::Fill(*mxLbFillAttr, 
pSh->GetItem(SID_HATCH_LIST)->GetHatchList());
-
-                    if(mpHatchItem)
-                    {
-                        const OUString aString(mpHatchItem->GetName());
-
-                        mxLbFillAttr->set_active_text( aString );
-                    }
-                    else
-                    {
-                        mxLbFillAttr->set_active(-1);
-                    }
-                }
-                else
-                {
-                    mxLbFillAttr->set_active(-1);
-                }
-                break;
-            }
-            case eFillStyle::BITMAP:

... etc. - the rest is truncated

Reply via email to