diff options
author | Szymon Kłos <szymon.klos@collabora.com> | 2019-10-31 07:45:40 +0100 |
---|---|---|
committer | Szymon Kłos <szymon.klos@collabora.com> | 2019-10-31 11:00:44 +0100 |
commit | 51f6b20a0c8c3b2830547e4400cf4c513e9d9c00 (patch) | |
tree | e3269da2f115d8360f90464f50919b25e2cbc44a | |
parent | 817d44fd1df048d6a09a19e77c9e7ddc1df1ffcf (diff) |
jsdialogs: .uno:XLineColor with string argument
Change-Id: Ic06aaef076d101d90bf76461e2b3a97580ad311f
Reviewed-on: https://gerrit.libreoffice.org/81821
Tested-by: Jenkins
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
-rw-r--r-- | svx/sdi/svx.sdi | 2 | ||||
-rw-r--r-- | sw/source/uibase/shells/drawdlg.cxx | 31 |
2 files changed, 31 insertions, 2 deletions
diff --git a/svx/sdi/svx.sdi b/svx/sdi/svx.sdi index acbee171bc2d..e51ca7732961 100644 --- a/svx/sdi/svx.sdi +++ b/svx/sdi/svx.sdi @@ -8860,7 +8860,7 @@ SvxWordLineModeItem WordMode SID_ATTR_CHAR_WORDLINEMODE XLineColorItem XLineColor SID_ATTR_LINE_COLOR - +(SfxStringItem Color SID_ATTR_COLOR_STR, XLineColorItem XLineColor SID_ATTR_LINE_COLOR) [ AutoUpdate = TRUE, FastCall = FALSE, diff --git a/sw/source/uibase/shells/drawdlg.cxx b/sw/source/uibase/shells/drawdlg.cxx index 6229cbd173d3..2c5a923e5983 100644 --- a/sw/source/uibase/shells/drawdlg.cxx +++ b/sw/source/uibase/shells/drawdlg.cxx @@ -34,6 +34,8 @@ #include <svx/svxdlg.hxx> #include <svx/dialogs.hrc> #include <memory> +#include <svl/stritem.hxx> +#include <svx/xlnclit.hxx> void SwDrawShell::ExecDrawDlg(SfxRequest& rReq) { @@ -200,6 +202,29 @@ void SwDrawShell::ExecDrawDlg(SfxRequest& rReq) pDoc->SetChanged(); } +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)); + + XLineColorItem aLineColorItem(OUString(), aColor); + pArgs->Put(aLineColorItem); + } + } +} + void SwDrawShell::ExecDrawAttrArgs(SfxRequest const & rReq) { SwWrtShell* pSh = &GetShell(); @@ -213,7 +238,11 @@ void SwDrawShell::ExecDrawAttrArgs(SfxRequest const & rReq) if (pArgs) { if(pView->AreObjectsMarked()) - pView->SetAttrToMarked(*rReq.GetArgs(), false); + { + std::unique_ptr<SfxItemSet> pNewArgs = pArgs->Clone(); + lcl_convertStringArguments(pNewArgs); + pView->SetAttrToMarked(*pNewArgs, false); + } else pView->SetDefaultAttr(*rReq.GetArgs(), false); } |