[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - svx/sdi sw/source

Szymon Kłos (via logerrit) logerrit at kemper.freedesktop.org
Thu Oct 31 20:24:19 UTC 2019


 svx/sdi/svx.sdi                    |    1 +
 sw/source/uibase/shells/basesh.cxx |   32 ++++++++++++++++++++++++++++++--
 2 files changed, 31 insertions(+), 2 deletions(-)

New commits:
commit 7757641884f8cad1eff9ffef77275aff8984126e
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Mon Oct 28 10:19:50 2019 +0100
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Thu Oct 31 21:23:40 2019 +0100

    jsdialogs: make possible to set .uno:BackgroundColor in Writer
    
    Change-Id: Ifd6a63683ddf36a3c1e8babd9c030ae5f051ed00
    Reviewed-on: https://gerrit.libreoffice.org/81596
    Tested-by: Jenkins
    Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/81665
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>

diff --git a/svx/sdi/svx.sdi b/svx/sdi/svx.sdi
index 628f48232bb2..489ae6af30e9 100644
--- a/svx/sdi/svx.sdi
+++ b/svx/sdi/svx.sdi
@@ -408,6 +408,7 @@ SfxVoidItem TableDesign SID_TABLEDESIGN
 ]
 
 SvxColorItem BackgroundColor SID_BACKGROUND_COLOR
+(SfxStringItem Color SID_ATTR_COLOR_STR, SvxColorItem BackgroundColor SID_BACKGROUND_COLOR)
 
 [
     AutoUpdate = TRUE,
diff --git a/sw/source/uibase/shells/basesh.cxx b/sw/source/uibase/shells/basesh.cxx
index dac43d83adc9..4d155f6ba039 100644
--- a/sw/source/uibase/shells/basesh.cxx
+++ b/sw/source/uibase/shells/basesh.cxx
@@ -2329,17 +2329,45 @@ void SwBaseShell::ExecBckCol(SfxRequest& rReq)
     {
         case SID_BACKGROUND_COLOR:
         {
+            const SfxPoolItem* pColorStringItem = nullptr;
+            bool bIsTransparent = false;
+
             aBrushItem.SetGraphicPos(GPOS_NONE);
 
-            if(pArgs)
+            sal_uInt16 nSlotId = SID_BACKGROUND_COLOR;
+            if (SfxItemState::SET == pArgs->GetItemState(SID_ATTR_COLOR_STR, false, &pColorStringItem))
+            {
+                OUString sColor = static_cast<const SfxStringItem*>(pColorStringItem)->GetValue();
+                if (sColor == "transparent")
+                {
+                    bIsTransparent = true;
+                }
+                else
+                {
+                    Color aColor(sColor.toInt32(16));
+
+                    aBrushItem.SetColor(aColor);
+
+                    SvxColorItem aNewColorItem(nSlotId);
+                    aNewColorItem.SetValue(aColor);
+
+                    GetView().GetViewFrame()->GetBindings().SetState(aNewColorItem);
+                }
+            }
+            else if(pArgs)
             {
-                const SvxColorItem& rNewColorItem = pArgs->Get(SID_BACKGROUND_COLOR);
+                const SvxColorItem& rNewColorItem = static_cast<const SvxColorItem&>(pArgs->Get(nSlotId));
                 const Color& rNewColor = rNewColorItem.GetValue();
                 aBrushItem.SetColor(rNewColor);
                 GetView().GetViewFrame()->GetBindings().SetState(rNewColorItem);
             }
             else
             {
+                bIsTransparent = true;
+            }
+
+            if (bIsTransparent)
+            {
                 aBrushItem.SetColor(COL_TRANSPARENT);
                 rReq.AppendItem(SvxColorItem(COL_TRANSPARENT,nSlot));
             }


More information about the Libreoffice-commits mailing list