diff options
author | Szymon Kłos <szymon.klos@collabora.com> | 2019-11-21 13:31:35 +0100 |
---|---|---|
committer | Szymon Kłos <szymon.klos@collabora.com> | 2019-11-27 09:21:31 +0100 |
commit | aa5b9c86e20dddac55f73d241bb030b1ca51d786 (patch) | |
tree | e0ff0f32f4c03064dbcfa97c8bd243fd0f3c1257 /sc/source/ui/drawfunc/drawsh2.cxx | |
parent | 8d23959b9eb014b625e3d7a8ee8aea51cdc6abbf (diff) |
jsdialogs: send .uno:FillStyle updates in Calc
Change-Id: I51682546a3c8fd4ee6d97cf8bf79d066e571addf
Reviewed-on: https://gerrit.libreoffice.org/83386
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/83780
Tested-by: Jenkins
Diffstat (limited to 'sc/source/ui/drawfunc/drawsh2.cxx')
-rw-r--r-- | sc/source/ui/drawfunc/drawsh2.cxx | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/sc/source/ui/drawfunc/drawsh2.cxx b/sc/source/ui/drawfunc/drawsh2.cxx index a3da77fd7296..118412c24822 100644 --- a/sc/source/ui/drawfunc/drawsh2.cxx +++ b/sc/source/ui/drawfunc/drawsh2.cxx @@ -46,9 +46,68 @@ #include <drtxtob.hxx> #include <gridwin.hxx> #include <svx/svdoole2.hxx> +#include <svx/svdocapt.hxx> +#include <svx/xfillit0.hxx> +#include <comphelper/lok.hxx> +#include <LibreOfficeKit/LibreOfficeKitEnums.h> +#include <com/sun/star/drawing/FillStyle.hpp> + +using namespace com::sun::star::drawing; using namespace com::sun::star; +namespace { + OUString lcl_fillStyleEnumToString(FillStyle eStyle) + { + switch (eStyle) + { + case FillStyle_NONE: + return "NONE"; + + case FillStyle_SOLID: + return "SOLID"; + + case FillStyle_GRADIENT: + return "GRADIENT"; + + case FillStyle_HATCH: + return "HATCH"; + + case FillStyle_BITMAP: + return "BITMAP"; + + default: + return ""; + } + } + + void lcl_sendAttrUpdatesForLOK(SfxViewShell* pShell, const SfxItemSet& rSet) + { + if (!pShell) + return; + + OUString sPayload; + const SfxPoolItem* pItem = rSet.GetItem(SID_ATTR_FILL_STYLE); + + if (pItem) + { + const XFillStyleItem* pFillStyleItem = static_cast<const XFillStyleItem*>(pItem); + FillStyle eStyle; + css::uno::Any aAny; + + pFillStyleItem->QueryValue(aAny); + aAny >>= eStyle; + sPayload = ".uno:FillStyle=" + lcl_fillStyleEnumToString(eStyle); + } + + if (!sPayload.isEmpty()) + { + pShell->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED, + OUStringToOString(sPayload, RTL_TEXTENCODING_ASCII_US).getStr()); + } + } +} + ScDrawShell::ScDrawShell( ScViewData* pData ) : SfxShell(pData->GetViewShell()), pViewData( pData ), @@ -360,6 +419,10 @@ void ScDrawShell::GetDrawAttrState( SfxItemSet& rSet ) rSet.Put( SvxSizeItem( SID_ATTR_SIZE, Size( 0, 0 ) ) ); } } + + SfxViewShell* pViewShell = GetDrawView()->GetSfxViewShell(); + if (pViewShell && comphelper::LibreOfficeKit::isActive()) + lcl_sendAttrUpdatesForLOK( pViewShell, rSet ); } } |