diff options
author | Szymon Kłos <szymon.klos@collabora.com> | 2024-06-27 11:11:13 +0200 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2024-06-28 09:57:26 +0200 |
commit | 12ff4396d973e7aae4dd68b742d9790f8c88ea53 (patch) | |
tree | a2550ce4e0de0ab136bcca4f942760e3483cfb1a /svx/source | |
parent | 5779dc944c5427d84c23a3a9c466a0caafb46689 (diff) |
jsdialog: support on demand rendering for icon view
- rename action: rendered_combobox_entry -> rendered_entry
- change generic get json property callback to more specialized
image getter as it wasn't used anywhere apart of that and we need
image enceded as base64 only not JSON
- add to the full update of icon view "ondemand" property to the entries
with images so LOK client will know it has to download the render
- it will be possible to support HiDPI renders in the future: added TODO
Signed-off-by: Szymon Kłos <szymon.klos@collabora.com>
Change-Id: I83a6e91133f8f9cb03e0bc794b51e1947435fa90
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169622
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'svx/source')
-rw-r--r-- | svx/source/inc/StylesPreviewWindow.hxx | 2 | ||||
-rw-r--r-- | svx/source/tbxctrls/StylesPreviewWindow.cxx | 14 |
2 files changed, 6 insertions, 10 deletions
diff --git a/svx/source/inc/StylesPreviewWindow.hxx b/svx/source/inc/StylesPreviewWindow.hxx index 76b385c084d2..471b32f946cf 100644 --- a/svx/source/inc/StylesPreviewWindow.hxx +++ b/svx/source/inc/StylesPreviewWindow.hxx @@ -113,7 +113,7 @@ protected: DECL_LINK(Selected, weld::IconView&, void); DECL_LINK(DoubleClick, weld::IconView&, bool); DECL_LINK(DoCommand, const CommandEvent&, bool); - DECL_LINK(DoJsonProperty, const weld::json_prop_query&, bool); + DECL_LINK(GetPreviewImage, const weld::encoded_image_query&, bool); public: StylesPreviewWindow_Base(weld::Builder& xBuilder, diff --git a/svx/source/tbxctrls/StylesPreviewWindow.cxx b/svx/source/tbxctrls/StylesPreviewWindow.cxx index da560feb0e15..15a7382e06da 100644 --- a/svx/source/tbxctrls/StylesPreviewWindow.cxx +++ b/svx/source/tbxctrls/StylesPreviewWindow.cxx @@ -455,8 +455,7 @@ StylesPreviewWindow_Base::StylesPreviewWindow_Base( m_xStylesView->connect_selection_changed(LINK(this, StylesPreviewWindow_Base, Selected)); m_xStylesView->connect_item_activated(LINK(this, StylesPreviewWindow_Base, DoubleClick)); m_xStylesView->connect_command(LINK(this, StylesPreviewWindow_Base, DoCommand)); - m_xStylesView->connect_get_property_tree_elem( - LINK(this, StylesPreviewWindow_Base, DoJsonProperty)); + m_xStylesView->connect_get_image(LINK(this, StylesPreviewWindow_Base, GetPreviewImage)); const css::uno::Reference<css::frame::XDispatchProvider> xProvider(m_xFrame, css::uno::UNO_QUERY); @@ -567,12 +566,9 @@ static OString extractPngString(const BitmapEx& rBitmap) return ""_ostr; } -// 0: json writer, 1: TreeIter, 2: property. returns true if supported -IMPL_LINK(StylesPreviewWindow_Base, DoJsonProperty, const weld::json_prop_query&, rQuery, bool) +// 0: OUString, 1: TreeIter, returns true if supported +IMPL_LINK(StylesPreviewWindow_Base, GetPreviewImage, const weld::encoded_image_query&, rQuery, bool) { - if (std::get<2>(rQuery) != "image") - return false; - const weld::TreeIter& rIter = std::get<1>(rQuery); OUString sStyleId(m_xStylesView->get_id(rIter)); OUString sStyleName(m_xStylesView->get_text(rIter)); @@ -580,8 +576,8 @@ IMPL_LINK(StylesPreviewWindow_Base, DoJsonProperty, const weld::json_prop_query& if (sBase64Png.isEmpty()) return false; - tools::JsonWriter& rJsonWriter = std::get<0>(rQuery); - rJsonWriter.put("image", sBase64Png); + OUString& rResult = std::get<0>(rQuery); + rResult = OStringToOUString(sBase64Png, RTL_TEXTENCODING_ASCII_US); return true; } |