desktop/source/lib/init.cxx | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-)
New commits: commit 65e6adeff4ebe9c25b409bf9f5ac0b7e03403908 Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Sun Mar 16 22:03:07 2025 +0000 Commit: Caolán McNamara <caolan.mcnam...@collabora.com> CommitDate: Tue Mar 18 12:55:14 2025 +0100 load sidebar etc images during preload Change-Id: Ia2ab12955932913ad0106c699118148750e2b49d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183064 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 328a3674021b..068617a45a8a 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -63,6 +63,7 @@ #include <sal/log.hxx> #include <utility> +#include <vcl/commandinfoprovider.hxx> #include <vcl/errinf.hxx> #include <vcl/lok.hxx> #include <o3tl/any.hxx> @@ -7981,11 +7982,17 @@ static void preloadData() #pragma GCC diagnostic pop #endif - static constexpr OUString preloadComponents[] = { - u"private:factory/swriter"_ustr, - u"private:factory/scalc"_ustr, - u"private:factory/simpress"_ustr, - u"private:factory/sdraw"_ustr + struct PreloadComponent + { + OUString factory; + OUString sampleImage; + }; + + static constexpr PreloadComponent preloadComponents[] = { + { u"private:factory/swriter"_ustr, u".uno:StyleApply"_ustr }, + { u"private:factory/scalc"_ustr, u".uno:NumberFormatCurrency"_ustr }, + { u"private:factory/simpress"_ustr, u".uno:MoveSlideLast"_ustr }, + { u"private:factory/sdraw"_ustr, u".uno:MovePageLast"_ustr } }; // getting the remote LibreOffice service manager uno::Reference<frame::XDesktop2> xCompLoader(frame::Desktop::create(xContext)); @@ -7994,7 +8001,21 @@ static void preloadData() uno::Sequence<css::beans::PropertyValue> szEmptyArgs(0); for (const auto& component : preloadComponents) { - auto xComp = xCompLoader->loadComponentFromURL(component, u"_blank"_ustr, 0, szEmptyArgs); + auto xComp = xCompLoader->loadComponentFromURL(component.factory, u"_blank"_ustr, 0, szEmptyArgs); + + uno::Reference<frame::XModel> xModel(xComp, uno::UNO_QUERY); + css::uno::Reference<css::frame::XController> xController(xModel ? xModel->getCurrentController() : nullptr); + css::uno::Reference<css::frame::XFrame> xFrame(xController ? xController->getFrame() : nullptr); + SAL_WARN_IF(!xFrame, "lok", "Unable to get ImageList for:" << component.factory); + if (xFrame) + { + // Query for some image specific to this module to load all the modules command images. + vcl::CommandInfoProvider::GetXGraphicForCommand(component.sampleImage, xFrame); + // Query for some image that is in the global command list of commands to populate that + // separate cache + vcl::CommandInfoProvider::GetXGraphicForCommand(u".uno:CharFontName"_ustr, xFrame); + } + xComp->dispose(); }