sd/source/ui/view/drviewsf.cxx | 53 +++++++++--------------------------- sw/source/uibase/shells/drawdlg.cxx | 53 +++++++++--------------------------- 2 files changed, 28 insertions(+), 78 deletions(-)
New commits: commit c1f2ffa3e3abcb3b5709197a1e0ee0a5d3f2b1cf Author: Szymon Kłos <[email protected]> AuthorDate: Mon Nov 25 17:10:41 2019 +0100 Commit: Szymon Kłos <[email protected]> CommitDate: Wed Nov 27 19:58:02 2019 +0100 jsdialog: send generic fill items also in writer and impress Change-Id: I656ee47fff4e43f77caef62c071a5aa3b867f444 Reviewed-on: https://gerrit.libreoffice.org/83747 Tested-by: Jenkins CollaboraOffice <[email protected]> Reviewed-by: Szymon Kłos <[email protected]> diff --git a/sd/source/ui/view/drviewsf.cxx b/sd/source/ui/view/drviewsf.cxx index 07ba0a76df72..fea9c35e5a20 100644 --- a/sd/source/ui/view/drviewsf.cxx +++ b/sd/source/ui/view/drviewsf.cxx @@ -74,54 +74,29 @@ using namespace svx::sidebar; 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); + 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()); } } diff --git a/sw/source/uibase/shells/drawdlg.cxx b/sw/source/uibase/shells/drawdlg.cxx index aa0218193456..4e31cf1097f4 100644 --- a/sw/source/uibase/shells/drawdlg.cxx +++ b/sw/source/uibase/shells/drawdlg.cxx @@ -255,54 +255,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()); } } _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
