summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorSzymon Kłos <szymon.klos@collabora.com>2019-10-28 10:19:50 +0100
committerSzymon Kłos <szymon.klos@collabora.com>2019-10-28 12:33:49 +0100
commit1144712bb99cfb699e73b473ee44351c50a35613 (patch)
tree6b34143b3a14664448c96da79cc788bb4f2afb31 /sw
parent6385e04f7e194ce6dcc82588f38355b467d0d276 (diff)
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@collabora.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/uibase/shells/basesh.cxx32
1 files changed, 30 insertions, 2 deletions
diff --git a/sw/source/uibase/shells/basesh.cxx b/sw/source/uibase/shells/basesh.cxx
index 89f4e3a00824..e8600de55c43 100644
--- a/sw/source/uibase/shells/basesh.cxx
+++ b/sw/source/uibase/shells/basesh.cxx
@@ -2339,17 +2339,45 @@ void SwBaseShell::ExecBckCol(SfxRequest& rReq)
case SID_BACKGROUND_COLOR:
case SID_TABLE_CELL_BACKGROUND_COLOR:
{
+ const SfxPoolItem* pColorStringItem = nullptr;
+ bool bIsTransparent = false;
+
aBrushItem->SetGraphicPos(GPOS_NONE);
- if(pArgs)
+ sal_uInt16 nSlotId = SID_BACKGROUND_COLOR ? SID_BACKGROUND_COLOR : SID_TABLE_CELL_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(nSlot == SID_BACKGROUND_COLOR ? SID_BACKGROUND_COLOR : SID_TABLE_CELL_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));
}