tdf#134546 Implement presentation from current page

Change-Id: Idad5bbc33e9382148aa5fe04ca475fb4989ed75d
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/97786
Tested-by: Jenkins
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Tested-by: Marco Cecchetti <marco.cecchetti@collabora.com>
Reviewed-by: Marco Cecchetti <marco.cecchetti@collabora.com>
diff --git a/loleaflet/src/control/Control.Menubar.js b/loleaflet/src/control/Control.Menubar.js
index bbe8e31..b33039b 100644
--- a/loleaflet/src/control/Control.Menubar.js
+++ b/loleaflet/src/control/Control.Menubar.js
@@ -350,7 +350,8 @@ L.Control.Menubar = L.Control.extend({
				{name: _UNO('.uno:DuplicateSlide', 'presentation'), id: 'duplicatepage', type: 'action'},
				{name: _UNO('.uno:DeleteSlide', 'presentation'), id: 'deletepage', type: 'action'},
				{type: 'separator', id: 'fullscreen-presentation-separator'},
				{name: _('Fullscreen presentation'), id: 'fullscreen-presentation', type: 'action'}]
				{name: _('Fullscreen presentation'), id: 'fullscreen-presentation', type: 'action'},
				{name: _('Present current slide'), id: 'presentation-currentslide', type: 'action'}]
			},
			{name: _UNO('.uno:ToolsMenu', 'presentation'), id: 'tools', type: 'menu', menu: [
				{uno: '.uno:SpellDialog'},
@@ -1189,6 +1190,8 @@ L.Control.Menubar = L.Control.extend({
			this._map.uiManager.toggleRuler();
		} else if (id === 'fullscreen-presentation' && this._map.getDocType() === 'presentation') {
			this._map.fire('fullscreen');
		} else if (id === 'presentation-currentslide' && this._map.getDocType() === 'presentation') {
			this._map.fire('fullscreen', {startSlideNumber: this._map.getCurrentPartNumber()});
		} else if (id === 'insertpage') {
			this._map.insertPage();
		} else if (id === 'insertshape') {
diff --git a/loleaflet/src/map/handler/Map.SlideShow.js b/loleaflet/src/map/handler/Map.SlideShow.js
index 0a19877..f9b361a 100644
--- a/loleaflet/src/map/handler/Map.SlideShow.js
+++ b/loleaflet/src/map/handler/Map.SlideShow.js
@@ -9,6 +9,8 @@ L.Map.mergeOptions({

L.Map.SlideShow = L.Handler.extend({

	_slideURL: '', // store the URL for svg

	initialize: function (map) {
		this._map = map;
	},
@@ -23,7 +25,7 @@ L.Map.SlideShow = L.Handler.extend({
		this._map.off('slidedownloadready', this._onSlideDownloadReady, this);
	},

	_onFullScreen: function () {
	_onFullScreen: function (e) {
		if (window.ThisIsTheiOSApp || window.ThisIsTheAndroidApp) {
			window.postMobileMessage('SLIDESHOW');
			return;
@@ -48,6 +50,10 @@ L.Map.SlideShow = L.Handler.extend({
				this._onFullScreenChange, this);
		}

		this._startSlideNumber = 0; // Default: start from page 0
		if (e.startSlideNumber !== undefined) {
			this._startSlideNumber = e.startSlideNumber;
		}
		this.fullscreen = true;
		this._map.downloadAs('slideshow.svg', 'svg', null, 'slideshow');
	},
@@ -67,7 +73,13 @@ L.Map.SlideShow = L.Handler.extend({
	},

	_onSlideDownloadReady: function (e) {
		this._slideShow.src = e.url;
		this._slideURL = e.url;
		console.debug('slide file url : ', this._slideURL);
		this._startPlaying();
	},

	_startPlaying: function() {
		this._slideShow.src = this._slideURL + '?StartSlideNumber=' + this._startSlideNumber;
		this._slideShow.contentWindow.focus();
	}
});