sw/source/uibase/shells/drwtxtex.cxx | 48 +++++++++++++++++++++++++++++++++-- 1 file changed, 46 insertions(+), 2 deletions(-)
New commits: commit a3c7a8282ddd08c7ed4a15d23089d09e418f8fae Author: Szymon Kłos <szymon.k...@collabora.com> AuthorDate: Fri Nov 8 17:13:05 2019 +0100 Commit: Szymon Kłos <szymon.k...@collabora.com> CommitDate: Mon Nov 11 14:25:13 2019 +0100 jsdialogs: apply .uno:Color and CharBackColor to floating text frames Change-Id: I1a6b997f1a857524c7a48434321ca10d97f5e5db Reviewed-on: https://gerrit.libreoffice.org/82311 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Szymon Kłos <szymon.k...@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/82317 Tested-by: Jenkins diff --git a/sw/source/uibase/shells/drwtxtex.cxx b/sw/source/uibase/shells/drwtxtex.cxx index 702a08a3bedd..d91e90b94d25 100644 --- a/sw/source/uibase/shells/drwtxtex.cxx +++ b/sw/source/uibase/shells/drwtxtex.cxx @@ -97,12 +97,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(); @@ -614,12 +653,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) { - aNewAttr.Put(pNewAttrs->Get(nWhich).CloneSetWhich(nEEWhich)); + std::unique_ptr<SfxPoolItem> pNewItem(pNewArgs->Get(nWhich).CloneSetWhich(nEEWhich)); + pNewArgs->Put(*pNewItem); } - SetAttrToMarked(aNewAttr); + SetAttrToMarked(*pNewArgs); GetView().GetViewFrame()->GetBindings().InvalidateAll(false); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits