diff options
author | Szymon Kłos <szymon.klos@collabora.com> | 2019-11-04 17:17:58 +0100 |
---|---|---|
committer | Szymon Kłos <szymon.klos@collabora.com> | 2019-11-05 09:46:16 +0100 |
commit | 780d83771af89e6b27b3618d9c033c3fb29ba803 (patch) | |
tree | 73b1c16743bdeae4634aaf70c68139da8f348a90 /sd | |
parent | ee909ca2c02f949605f68720c3f1eef658502749 (diff) |
jsdialogs: .uno:Color with string argument
Change-Id: Ifdc95ff8c6a71340de3ed66cf58bc937e3730810
Reviewed-on: https://gerrit.libreoffice.org/82038
Tested-by: Jenkins
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/ui/view/drtxtob1.cxx | 29 |
1 files changed, 28 insertions, 1 deletions
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 <futempl.hxx> #include <DrawDocShell.hxx> #include <futext.hxx> +#include <svl/stritem.hxx> +#include <editeng/colritem.hxx> #include <memory> +namespace +{ + void lcl_convertStringArguments(std::unique_ptr<SfxItemSet>& pArgs) + { + Color aColor; + OUString sColor; + const SfxPoolItem* pColorStringItem = nullptr; + + if (SfxItemState::SET == pArgs->GetItemState(SID_ATTR_COLOR_STR, false, &pColorStringItem)) + { + sColor = static_cast<const SfxStringItem*>(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<SfxItemSet> pNewArgs = pArgs->Clone(); + lcl_convertStringArguments(pNewArgs); + mpView->SetAttributes(*pNewArgs); // invalidate entire shell because of performance and // extension reasons |