summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSzymon Kłos <szymon.klos@collabora.com>2019-11-08 17:13:05 +0100
committerSzymon Kłos <szymon.klos@collabora.com>2019-11-11 14:25:13 +0100
commita3c7a8282ddd08c7ed4a15d23089d09e418f8fae (patch)
tree00f5b11225acc1abe88bb7deeda873172d54cca9
parent572a8132e0e460b17c80c456dfb5e07f6b9a9c6a (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> Reviewed-on: https://gerrit.libreoffice.org/82317 Tested-by: Jenkins
-rw-r--r--sw/source/uibase/shells/drwtxtex.cxx48
1 files changed, 46 insertions, 2 deletions
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);