diff options
author | Szymon Kłos <szymon.klos@collabora.com> | 2019-11-08 17:13:05 +0100 |
---|---|---|
committer | Szymon Kłos <szymon.klos@collabora.com> | 2019-11-08 17:55:06 +0100 |
commit | 9a1525f93dfce425a8416f83ca7361cb5783d36b (patch) | |
tree | ff855d069101ffa1575d883dcea0e3be415bedd7 /sw/source/uibase/shells | |
parent | c28ea22c5198c1162fc5a535d35b407762b8a865 (diff) |
jsdialogs: apply .uno:Color and CharBackColor to floating text frames
Change-Id: I1a6b997f1a857524c7a48434321ca10d97f5e5db
Reviewed-on: https://gerrit.libreoffice.org/82311
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
Diffstat (limited to 'sw/source/uibase/shells')
-rw-r--r-- | sw/source/uibase/shells/drwtxtex.cxx | 49 |
1 files changed, 46 insertions, 3 deletions
diff --git a/sw/source/uibase/shells/drwtxtex.cxx b/sw/source/uibase/shells/drwtxtex.cxx index 7e0a8c0ead75..e1073389879c 100644 --- a/sw/source/uibase/shells/drwtxtex.cxx +++ b/sw/source/uibase/shells/drwtxtex.cxx @@ -92,12 +92,51 @@ #include <viewopt.hxx> #include <wrtsh.hxx> #include <wview.hxx> +#include <svl/stritem.hxx> +#include <svx/chrtitem.hxx> #include <swabstdlg.hxx> #include <memory> using namespace ::com::sun::star; +namespace +{ + void lcl_convertStringArguments(sal_uInt16 nSlot, std::unique_ptr<SfxItemSet>& pArgs) + { + Color aColor; + OUString sColor; + const SfxPoolItem* pItem = nullptr; + + if (SfxItemState::SET == pArgs->GetItemState(SID_ATTR_COLOR_STR, false, &pItem)) + { + sColor = static_cast<const SfxStringItem*>(pItem)->GetValue(); + + if (sColor == "transparent") + aColor = COL_TRANSPARENT; + else + aColor = Color(sColor.toInt32(16)); + + switch (nSlot) + { + case SID_ATTR_CHAR_COLOR: + { + SvxColorItem aColorItem(aColor, EE_CHAR_COLOR); + pArgs->Put(aColorItem); + break; + } + + case SID_ATTR_CHAR_BACK_COLOR: + { + SvxBackgroundColorItem pBackgroundItem(aColor, EE_CHAR_BKGCOLOR); + pArgs->Put(pBackgroundItem); + break; + } + } + } + } +} + void SwDrawTextShell::Execute( SfxRequest &rReq ) { SwWrtShell &rSh = GetShell(); @@ -565,13 +604,17 @@ void SwDrawTextShell::Execute( SfxRequest &rReq ) assert(false && "wrong dispatcher"); return; } + + std::unique_ptr<SfxItemSet> pNewArgs = pNewAttrs->Clone(); + lcl_convertStringArguments(nSlot, pNewArgs); + if(nEEWhich && pNewAttrs) { - std::unique_ptr<SfxPoolItem> pNewItem(pNewAttrs->Get(nWhich).CloneSetWhich(nEEWhich)); - aNewAttr.Put(*pNewItem); + std::unique_ptr<SfxPoolItem> pNewItem(pNewArgs->Get(nWhich).CloneSetWhich(nEEWhich)); + pNewArgs->Put(*pNewItem); } - SetAttrToMarked(aNewAttr); + SetAttrToMarked(*pNewArgs); GetView().GetViewFrame()->GetBindings().InvalidateAll(false); |