diff options
author | Szymon Kłos <szymon.klos@collabora.com> | 2019-11-25 17:10:41 +0100 |
---|---|---|
committer | Szymon Kłos <szymon.klos@collabora.com> | 2019-11-27 22:37:05 +0100 |
commit | e0b70b1491143adb47990b746fe0b2e52b1ee7cb (patch) | |
tree | 395bd09cb46f70ff2c452478c18ddc8f7a716b0d /sw | |
parent | f9f421b7beaf117968c0dbfd84a2dad3dc85136a (diff) |
jsdialog: send generic fill items also in writer and impress
Change-Id: I656ee47fff4e43f77caef62c071a5aa3b867f444
Reviewed-on: https://gerrit.libreoffice.org/83945
Tested-by: Jenkins
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/uibase/shells/drawdlg.cxx | 53 |
1 files changed, 14 insertions, 39 deletions
diff --git a/sw/source/uibase/shells/drawdlg.cxx b/sw/source/uibase/shells/drawdlg.cxx index c465c04618b9..558942f9d437 100644 --- a/sw/source/uibase/shells/drawdlg.cxx +++ b/sw/source/uibase/shells/drawdlg.cxx @@ -258,54 +258,29 @@ 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); + boost::property_tree::ptree aTree; + boost::property_tree::ptree anArray; - if (pItem) + for(int i = 0; i < rSet.Count(); i++) { - 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); + sal_uInt16 nWhich = rSet.GetWhichByPos(i); + if (rSet.HasItem(nWhich) && SfxItemState::SET >= rSet.GetItemState(nWhich)) + { + boost::property_tree::ptree aItem = rSet.Get(nWhich).dumpAsJSON(); + if (!aItem.empty()) + anArray.push_back(std::make_pair("", aItem)); + } } + aTree.add_child("items", anArray); - if (!sPayload.isEmpty()) - { - pShell->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED, - OUStringToOString(sPayload, RTL_TEXTENCODING_ASCII_US).getStr()); - } + std::stringstream aStream; + boost::property_tree::write_json(aStream, aTree); + pShell->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED, aStream.str().c_str()); } } |