diff options
author | Méven Car <meven.car@collabora.com> | 2024-02-20 12:51:39 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2024-05-07 17:00:55 +0200 |
commit | fbd8cfb046fd0882402e01c2e0b2955e6972737f (patch) | |
tree | adadbeb51bf3731faba98830530c553668502554 /sd | |
parent | 9f078ed7b625e86182d64d5ccfbb410cdd38081c (diff) |
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 <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
(cherry picked from commit b951c57d4b723621d211b552f2cd238ae0dc246a)
Change-Id: I7eedc855255a30abdfdf61c8315b4f8238c07ca9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165094
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167277
Tested-by: Jenkins
Diffstat (limited to 'sd')
-rw-r--r-- | sd/qa/unit/tiledrendering/data/test.ppsx | bin | 0 -> 32452 bytes | |||
-rw-r--r-- | sd/qa/unit/tiledrendering/tiledrendering.cxx | 15 | ||||
-rw-r--r-- | sd/source/ui/view/ViewShellBase.cxx | 13 |
3 files changed, 28 insertions, 0 deletions
diff --git a/sd/qa/unit/tiledrendering/data/test.ppsx b/sd/qa/unit/tiledrendering/data/test.ppsx Binary files differnew file mode 100644 index 000000000000..2b955adeca97 --- /dev/null +++ b/sd/qa/unit/tiledrendering/data/test.ppsx 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 |