sd/qa/unit/tiledrendering/data/test.ppsx |binary sd/qa/unit/tiledrendering/tiledrendering.cxx | 15 +++++++++++++++ sd/source/ui/view/ViewShellBase.cxx | 13 +++++++++++++ 3 files changed, 28 insertions(+)
New commits: commit fbd8cfb046fd0882402e01c2e0b2955e6972737f Author: Méven Car <meven....@collabora.com> AuthorDate: Tue Feb 20 12:51:39 2024 +0100 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Tue May 7 17:00:55 2024 +0200 Impress: transmit document's property StartWithPresentation This is transmitted as stateChanged event. This property is set for ppsx/pps files. Change-Id: Ic2f495cb9923b385bce7d93a2d8121d2945221ab Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163652 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Miklos Vajna <vmik...@collabora.com> (cherry picked from commit b951c57d4b723621d211b552f2cd238ae0dc246a) Change-Id: I7eedc855255a30abdfdf61c8315b4f8238c07ca9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165094 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Miklos Vajna <vmik...@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167277 Tested-by: Jenkins diff --git a/sd/qa/unit/tiledrendering/data/test.ppsx b/sd/qa/unit/tiledrendering/data/test.ppsx new file mode 100644 index 000000000000..2b955adeca97 Binary files /dev/null and b/sd/qa/unit/tiledrendering/data/test.ppsx differ diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx index b15821f1329b..7f8c4fa19338 100644 --- a/sd/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx @@ -2983,6 +2983,21 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSidebarHide) CPPUNIT_ASSERT(it != aView.m_aStateChanges.end()); } +CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testStartPresentation) +{ + SdXImpressDocument* pXImpressDocument = createDoc("test.ppsx"); + ViewCallback aView; + CPPUNIT_ASSERT(pXImpressDocument->GetDoc()->IsStartWithPresentation()); + Scheduler::ProcessEventsToIdle(); + + const auto it = aView.m_aStateChanges.find(".uno:StartWithPresentation"); + CPPUNIT_ASSERT(it != aView.m_aStateChanges.end()); + + const auto value = it->second; + CPPUNIT_ASSERT(value.get_child_optional("state").has_value()); + CPPUNIT_ASSERT_EQUAL(std::string("true"), value.get_child("state").get_value<std::string>()); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/view/ViewShellBase.cxx b/sd/source/ui/view/ViewShellBase.cxx index 8a25f0593b87..a86a448900f4 100644 --- a/sd/source/ui/view/ViewShellBase.cxx +++ b/sd/source/ui/view/ViewShellBase.cxx @@ -19,6 +19,8 @@ #include <comphelper/processfactory.hxx> +#include <boost/property_tree/json_parser.hpp> + #include <ViewShellBase.hxx> #include <algorithm> #include <EventMultiplexer.hxx> @@ -1031,6 +1033,17 @@ void ViewShellBase::afterCallbackRegistered() std::set<Color> aDocumentColors = pDocShell->GetDocColors(); svx::theme::notifyLOK(pThemeColors, aDocumentColors); } + + if (mpDocument && mpDocument->IsStartWithPresentation()) + { + // Be consistent with SidebarController, emit JSON. + boost::property_tree::ptree aTree; + aTree.put("commandName", ".uno:StartWithPresentation"); + aTree.put("state", "true"); + std::stringstream aStream; + boost::property_tree::write_json(aStream, aTree); + libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED, OString(aStream.str())); + } } void ViewShellBase::NotifyCursor(SfxViewShell* pOtherShell) const