sw/sdi/drwtxtsh.sdi | 7 +++++++ sw/source/uibase/shells/drwtxtex.cxx | 24 +++++++++++++++++++++++- 2 files changed, 30 insertions(+), 1 deletion(-)
New commits: commit cdae761b733e811b0a9b21b822357a676c9e2acb Author: Gülşah Köse <gulsah.k...@collabora.com> AuthorDate: Fri Jun 13 13:15:41 2025 +0300 Commit: Gülşah Köse <gulsah.k...@collabora.com> CommitDate: Wed Jun 18 11:25:23 2025 +0200 ONLINE: Fix the problem with changing text box font color. Signed-off-by: Gülşah Köse <gulsah.k...@collabora.com> Change-Id: Ia39bda929964ae55a2c032a8c386ef77342b2d0d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186454 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Szymon Kłos <szymon.k...@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186596 diff --git a/sw/sdi/drwtxtsh.sdi b/sw/sdi/drwtxtsh.sdi index 366683fbd52d..ab34cebf9007 100644 --- a/sw/sdi/drwtxtsh.sdi +++ b/sw/sdi/drwtxtsh.sdi @@ -742,6 +742,13 @@ interface TextDrawFont DisableFlags="SfxDisableFlags::SwOnProtectedCursor"; ] + SID_ATTR_CHAR_COLOR2 + [ + ExecMethod = Execute ; + StateMethod = GetDrawTextCtrlState ; + DisableFlags="SfxDisableFlags::SwOnProtectedCursor"; + ] + SID_ATTR_CHAR_BACK_COLOR // api: [ ExecMethod = Execute ; diff --git a/sw/source/uibase/shells/drwtxtex.cxx b/sw/source/uibase/shells/drwtxtex.cxx index 4d8dd6304e92..fbc012e640c0 100644 --- a/sw/source/uibase/shells/drwtxtex.cxx +++ b/sw/source/uibase/shells/drwtxtex.cxx @@ -23,6 +23,7 @@ #include <comphelper/string.hxx> #include <sfx2/bindings.hxx> #include <sfx2/dispatch.hxx> +#include <sfx2/namedcolor.hxx> #include <sfx2/request.hxx> #include <svx/svdview.hxx> #include <editeng/spltitem.hxx> @@ -147,8 +148,29 @@ void SwDrawTextShell::Execute( SfxRequest &rReq ) break; case SID_ATTR_CHAR_COLOR: nEEWhich = EE_CHAR_COLOR; break; - case SID_ATTR_CHAR_BACK_COLOR: nEEWhich = EE_CHAR_BKGCOLOR; break; + case SID_ATTR_CHAR_COLOR2: + { + if (!rReq.GetArgs()) + { + std::optional<NamedColor> oColor + = GetView().GetDocShell()->GetRecentColor(SID_ATTR_CHAR_COLOR); + if (oColor.has_value()) + { + nEEWhich = GetPool().GetWhich(SID_ATTR_CHAR_COLOR); + const model::ComplexColor& rCol = (*oColor).getComplexColor(); + aNewAttr.Put(SvxColorItem(rCol.getFinalColor(), rCol, nEEWhich)); + rReq.SetArgs(aNewAttr); + rReq.SetSlot(SID_ATTR_CHAR_COLOR); + } + } + else + { + nEEWhich = EE_CHAR_COLOR; + } + } + break; + case SID_ATTR_CHAR_BACK_COLOR: nEEWhich = EE_CHAR_BKGCOLOR; break; case SID_ATTR_CHAR_UNDERLINE: { if ( pNewAttrs )