From d73871584f646cbf02467871fcfc7039ad985ff3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Szymon=20K=C5=82os?= Date: Fri, 25 Oct 2019 11:46:18 +0200 Subject: [PATCH] jsdialogs: make possible to set .uno:FontColor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I5ece252d3b7e9dca7c97395c70be6ea4863d7545 Reviewed-on: https://gerrit.libreoffice.org/81498 Tested-by: Jenkins Reviewed-by: Szymon Kłos --- include/sfx2/sfxsids.hrc | 1 + sw/sdi/swriter.sdi | 1 + sw/source/uibase/shells/textsh1.cxx | 18 +++++++++++++++++- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/include/sfx2/sfxsids.hrc b/include/sfx2/sfxsids.hrc index 33da857c096f..2eb4d579838e 100644 --- a/include/sfx2/sfxsids.hrc +++ b/include/sfx2/sfxsids.hrc @@ -565,6 +565,7 @@ class SvxSearchItem; #define SID_ATTR_CHAR_COLOR_BACKGROUND (SID_SVX_START + 489) #define SID_ATTR_CHAR_COLOR_BACKGROUND_EXT (SID_SVX_START + 490) #define SID_ATTR_CHAR_COLOR2 (SID_SVX_START + 537) +#define SID_ATTR_CHAR_COLOR2_STR (SID_SVX_START + 540) #define SID_COMP_BIBLIOGRAPHY (SID_SVX_START + 880) #define SID_ADDRESS_DATA_SOURCE (SID_SVX_START + 934) #define SID_OPEN_SMARTTAGOPTIONS (SID_SVX_START + 1062) diff --git a/sw/sdi/swriter.sdi b/sw/sdi/swriter.sdi index 3f96725b5bf8..0119bd185d33 100644 --- a/sw/sdi/swriter.sdi +++ b/sw/sdi/swriter.sdi @@ -1280,6 +1280,7 @@ SfxBoolItem Fields FN_VIEW_FIELDS ] SvxColorItem FontColor SID_ATTR_CHAR_COLOR2 +(SfxStringItem Color SID_ATTR_CHAR_COLOR2_STR, SvxColorItem FontColor SID_ATTR_CHAR_COLOR2) [ AutoUpdate = TRUE, diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx index 57b37a1d7ef6..0ae64618e9a0 100644 --- a/sw/source/uibase/shells/textsh1.cxx +++ b/sw/source/uibase/shells/textsh1.cxx @@ -1174,9 +1174,25 @@ void SwTextShell::Execute(SfxRequest &rReq) case SID_ATTR_CHAR_COLOR2: { + Color aSet; + OUString sColor; + const SfxPoolItem* pColorStringItem = nullptr; + bool bHasItem = false; + if(pItem) { - Color aSet = static_cast(pItem)->GetValue(); + aSet = static_cast(pItem)->GetValue(); + bHasItem = true; + } + else if(SfxItemState::SET == pArgs->GetItemState(SID_ATTR_CHAR_COLOR2_STR, false, &pColorStringItem)) + { + sColor = static_cast(pColorStringItem)->GetValue(); + aSet = Color(sColor.toInt32(16)); + bHasItem = true; + } + + if (bHasItem) + { SwEditWin& rEditWin = GetView().GetEditWin(); rEditWin.SetWaterCanTextColor(aSet); SwApplyTemplate* pApply = rEditWin.GetApplyTemplate();