include/svx/sidebar/AreaPropertyPanelBase.hxx     |    6 ++++
 include/vcl/EnumContext.hxx                       |    1 
 svx/source/sidebar/area/AreaPropertyPanelBase.cxx |   27 ++++++++++++++++++++++
 vcl/source/window/EnumContext.cxx                 |    5 ++++
 4 files changed, 39 insertions(+)
New commits:
commit d4cebb60c7757086fd737e7a2134326209bd4190
Author:     Samuel Mehrbrodt <samuel.mehrbr...@allotropia.de>
AuthorDate: Mon Sep 4 13:17:15 2023 +0200
Commit:     Samuel Mehrbrodt <samuel.mehrbr...@allotropia.de>
CommitDate: Mon Sep 4 16:10:41 2023 +0200

    tdf#154875 "Use slide background" is only for Impress
    
    Change-Id: I078437a1cff58b868f4db4b482ad2aff335dc965
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156514
    Tested-by: Jenkins
    Reviewed-by: Samuel Mehrbrodt <samuel.mehrbr...@allotropia.de>

diff --git a/include/svx/sidebar/AreaPropertyPanelBase.hxx 
b/include/svx/sidebar/AreaPropertyPanelBase.hxx
index c2c967a8333b..07a5873acf53 100644
--- a/include/svx/sidebar/AreaPropertyPanelBase.hxx
+++ b/include/svx/sidebar/AreaPropertyPanelBase.hxx
@@ -20,6 +20,7 @@
 #define INCLUDED_SVX_SOURCE_SIDEBAR_AREA_AREAPROPERTYPANELBASE_HXX
 
 #include <memory>
+#include <sfx2/sidebar/IContextChangeReceiver.hxx>
 #include <svx/sidebar/AreaTransparencyGradientPopup.hxx>
 #include <sfx2/sidebar/ControllerItem.hxx>
 #include <svx/colorbox.hxx>
@@ -33,6 +34,7 @@
 #include <sfx2/sidebar/PanelLayout.hxx>
 #include <svl/intitem.hxx>
 #include <svx/svxdllapi.h>
+#include <vcl/EnumContext.hxx>
 
 class ToolbarUnoDispatcher;
 class XFillFloatTransparenceItem;
@@ -48,6 +50,7 @@ namespace svx::sidebar {
 
 class SVX_DLLPUBLIC AreaPropertyPanelBase
 :   public PanelLayout,
+    public ::sfx2::sidebar::IContextChangeReceiver,
     public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
 {
 public:
@@ -99,9 +102,11 @@ public:
 
 private:
     void Initialize();
+    virtual void HandleContextChange(const vcl::EnumContext& rContext) 
override;
 
 protected:
     const css::uno::Reference<css::frame::XFrame>&      mxFrame;
+    vcl::EnumContext                                    maContext;
 
     sal_uInt16                                          meLastXFS;
 
@@ -109,6 +114,7 @@ protected:
     sal_Int32                                           mnLastPosBitmap;
     sal_Int32                                           mnLastPosPattern;
     sal_uInt16                                          mnLastTransSolid;
+    OUString                                            msUseBackgroundText;
 
     basegfx::BGradient                                  maGradientLinear;
     basegfx::BGradient                                  maGradientAxial;
diff --git a/include/vcl/EnumContext.hxx b/include/vcl/EnumContext.hxx
index 9d82e72adc9d..b8e02efd1f68 100644
--- a/include/vcl/EnumContext.hxx
+++ b/include/vcl/EnumContext.hxx
@@ -128,6 +128,7 @@ public:
     */
     sal_Int32 GetCombinedContext_DI() const;
 
+    Application GetApplication() const;
     Application GetApplication_DI() const;
 
     bool operator == (const EnumContext& rOther) const;
diff --git a/svx/source/sidebar/area/AreaPropertyPanelBase.cxx 
b/svx/source/sidebar/area/AreaPropertyPanelBase.cxx
index 9adff2c65dfd..05f4c100d71c 100644
--- a/svx/source/sidebar/area/AreaPropertyPanelBase.cxx
+++ b/svx/source/sidebar/area/AreaPropertyPanelBase.cxx
@@ -1392,6 +1392,33 @@ basegfx::BColorStops 
AreaPropertyPanelBase::createColorStops()
     return aColorStops;
 }
 
+void AreaPropertyPanelBase::HandleContextChange(
+    const vcl::EnumContext& rContext)
+{
+    if (maContext.GetApplication() == rContext.GetApplication())
+        return;
+
+    maContext = rContext;
+
+    switch (maContext.GetApplication())
+    {
+        case vcl::EnumContext::Application::Impress:
+            if (!msUseBackgroundText.isEmpty())
+            {
+                mxLbFillType->insert_text(USE_BACKGROUND, msUseBackgroundText);
+                msUseBackgroundText = OUString();
+            }
+        break;
+        default:
+            if (msUseBackgroundText.isEmpty())
+            {
+                msUseBackgroundText = mxLbFillType->get_text(USE_BACKGROUND);
+                mxLbFillType->remove(USE_BACKGROUND);
+            }
+        break;
+    }
+}
+
 } // end of namespace svx::sidebar
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/window/EnumContext.cxx 
b/vcl/source/window/EnumContext.cxx
index 6ca075eb6943..ffe065568282 100644
--- a/vcl/source/window/EnumContext.cxx
+++ b/vcl/source/window/EnumContext.cxx
@@ -60,6 +60,11 @@ sal_Int32 EnumContext::GetCombinedContext_DI() const
     return CombinedEnumContext(GetApplication_DI(), meContext);
 }
 
+EnumContext::Application EnumContext::GetApplication() const
+{
+     return meApplication;
+}
+
 EnumContext::Application EnumContext::GetApplication_DI() const
 {
      switch (meApplication)

Reply via email to