From 780d83771af89e6b27b3618d9c033c3fb29ba803 Mon Sep 17 00:00:00 2001 From: Szymon Kłos Date: Mon, 4 Nov 2019 17:17:58 +0100 Subject: jsdialogs: .uno:Color with string argument MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ifdc95ff8c6a71340de3ed66cf58bc937e3730810 Reviewed-on: https://gerrit.libreoffice.org/82038 Tested-by: Jenkins Reviewed-by: Szymon Kłos --- sd/source/ui/view/drtxtob1.cxx | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'sd') diff --git a/sd/source/ui/view/drtxtob1.cxx b/sd/source/ui/view/drtxtob1.cxx index 4bdb32ecc627..d16a70e748ab 100644 --- a/sd/source/ui/view/drtxtob1.cxx +++ b/sd/source/ui/view/drtxtob1.cxx @@ -63,9 +63,34 @@ #include #include #include +#include +#include #include +namespace +{ + void lcl_convertStringArguments(std::unique_ptr& pArgs) + { + Color aColor; + OUString sColor; + const SfxPoolItem* pColorStringItem = nullptr; + + if (SfxItemState::SET == pArgs->GetItemState(SID_ATTR_COLOR_STR, false, &pColorStringItem)) + { + sColor = static_cast(pColorStringItem)->GetValue(); + + if (sColor == "transparent") + aColor = COL_TRANSPARENT; + else + aColor = Color(sColor.toInt32(16)); + + SvxColorItem aColorItem(aColor, EE_CHAR_COLOR); + pArgs->Put(aColorItem); + } + } +} + namespace sd { /** @@ -735,7 +760,9 @@ void TextObjectBar::Execute( SfxRequest &rReq ) pArgs = rReq.GetArgs(); } - mpView->SetAttributes(*pArgs); + std::unique_ptr pNewArgs = pArgs->Clone(); + lcl_convertStringArguments(pNewArgs); + mpView->SetAttributes(*pNewArgs); // invalidate entire shell because of performance and // extension reasons -- cgit v1.2.3