loleaflet/debug/document/document_simple_example.html | 2 loleaflet/dist/leaflet.css | 36 +++++++++++++- loleaflet/src/control/Control.Parts.js | 44 +++++++++++++++++- loleaflet/src/control/Parts.js | 6 ++ loleaflet/src/layer/tile/TileLayer.js | 17 +++++- 5 files changed, 97 insertions(+), 8 deletions(-)
New commits: commit 70d47f8d8340ce3ba04c9c78d74db732aa4a48db Author: Mihai Varga <[email protected]> Date: Wed Jul 15 15:12:44 2015 +0300 loleaflet: spreadsheet tab control diff --git a/loleaflet/src/control/Control.Parts.js b/loleaflet/src/control/Control.Parts.js index 4278abe..9a566f6 100644 --- a/loleaflet/src/control/Control.Parts.js +++ b/loleaflet/src/control/Control.Parts.js @@ -22,6 +22,8 @@ L.Control.Parts = L.Control.extend({ partName + '-next', container, this._nextPart); this._previewInitialized = false; this._previewTiles = {}; + this._tabsInitialized = false; + this._spreadsheetTabs = {}; map.on('updateparts', this._updateDisabled, this); map.on('tilepreview', this._updatePreview, this); @@ -91,6 +93,38 @@ L.Control.Parts = L.Control.extend({ } this._previewInitialized = true; } + if (docType === 'spreadsheet') { + if (!this._tabsInitialized) { + // make room for the preview + var docContainer = L.DomUtil.get('document-container'); + L.DomUtil.setStyle(docContainer, 'bottom', '20px'); + setTimeout(L.bind(function () { + this._map.invalidateSize(); + $("#scroll-container").mCustomScrollbar('update'); + }, this), 500); + var container = L.DomUtil.get('spreadsheet-tab'); + for (var i = 0; i < parts; i++) { + var id = 'spreadsheet-tab' + i; + var tab = L.DomUtil.create('li', '', container); + tab.innerHTML = 'Sheet ' + (i + 1); + tab.id = id; + L.DomEvent + .on(tab, 'click', L.DomEvent.stopPropagation) + .on(tab, 'click', L.DomEvent.stop) + .on(tab, 'click', this._setPart, this) + .on(tab, 'click', this._refocusOnMap, this); + this._spreadsheetTabs[id] = tab; + } + this._tabsInitialized = true; + } + for (key in this._spreadsheetTabs) { + var part = parseInt(key.match(/\d+/g)[0]); + L.DomUtil.removeClass(this._spreadsheetTabs[key], "selected"); + if (part === currentPart) { + L.DomUtil.addClass(this._spreadsheetTabs[key], "selected"); + } + } + } }, _setPart: function (e) { diff --git a/loleaflet/src/control/Parts.js b/loleaflet/src/control/Parts.js index 0067894..6f8c143 100644 --- a/loleaflet/src/control/Parts.js +++ b/loleaflet/src/control/Parts.js @@ -20,7 +20,11 @@ L.Map.include({ else { return; } - this.fire('updateparts', {currentPart : docLayer._currentPart, parts : docLayer._parts}); + this.fire('updateparts', { + currentPart: docLayer._currentPart, + parts: docLayer._parts, + docType: docLayer._docType + }); docLayer._update(); docLayer._pruneTiles(); docLayer._clearSelections(); commit 70ff91775208409b1126c62b1a89db8cf3cad3b7 Author: Mihai Varga <[email protected]> Date: Wed Jul 15 15:11:39 2015 +0300 loleaflet: spreadsheet tabs html/css diff --git a/loleaflet/debug/document/document_simple_example.html b/loleaflet/debug/document/document_simple_example.html index 8ca9c6d..d5cf836 100644 --- a/loleaflet/debug/document/document_simple_example.html +++ b/loleaflet/debug/document/document_simple_example.html @@ -40,6 +40,8 @@ </div> </div> </div> + <div id="spreadsheet-tab" class="spreadsheet-tab"> + </div> <script> diff --git a/loleaflet/dist/leaflet.css b/loleaflet/dist/leaflet.css index 939d63b..a3d1ca5 100644 --- a/loleaflet/dist/leaflet.css +++ b/loleaflet/dist/leaflet.css @@ -664,7 +664,7 @@ a.leaflet-control-buttons:hover { position: absolute; top: 100px; bottom: 0px; - width: 195px; + max-width: 195px; } .preview-frame { @@ -684,3 +684,33 @@ a.leaflet-control-buttons:hover { max-width: 180px; cursor: pointer; } + +.spreadsheet-tab { + margin: 0; + padding: 0; + bottom: 0; + position: absolute; + cursor: pointer; + } + +.spreadsheet-tab li { + float: left; + list-style: none; + margin: 0; + padding: 0; + margin-left: 2px; + } + +.spreadsheet-tab li { + display: block; + border: #B9B9B9 1px solid; + background: #A8A8A8; + color: #FFFFFF; + text-decoration: none; + } + +.spreadsheet-tab li.selected { + background: #FFFFFF; + color: #7E7E7E; + border-top: #FFF 1px solid; + } commit 242d66feeab3becc9f2ef28b79bf3d0902192485 Author: Mihai Varga <[email protected]> Date: Wed Jul 15 10:23:03 2015 +0300 loleaflet: make use of 'type' parameter from the status command And only load the preview if type === 'presentation' diff --git a/loleaflet/src/control/Control.Parts.js b/loleaflet/src/control/Control.Parts.js index b4212a8..4278abe 100644 --- a/loleaflet/src/control/Control.Parts.js +++ b/loleaflet/src/control/Control.Parts.js @@ -55,6 +55,7 @@ L.Control.Parts = L.Control.extend({ var className = 'leaflet-disabled'; var parts = e.parts; var currentPart = e.currentPart; + var docType = e.docType; if (currentPart === 0) { L.DomUtil.addClass(this._prevPartButton, className); } else { @@ -65,7 +66,7 @@ L.Control.Parts = L.Control.extend({ } else { L.DomUtil.removeClass(this._nextPartButton, className); } - if (!this._previewInitialized && parts > 1) { + if (!this._previewInitialized && docType === 'presentation') { // make room for the preview var docContainer = L.DomUtil.get('document-container'); L.DomUtil.setStyle(docContainer, 'left', '200px'); diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js index 2ed3c78..c991465 100644 --- a/loleaflet/src/layer/tile/TileLayer.js +++ b/loleaflet/src/layer/tile/TileLayer.js @@ -392,11 +392,16 @@ L.TileLayer = L.GridLayer.extend({ if (command.width && command.height && this._documentInfo !== textMsg) { this._docWidthTwips = command.width; this._docHeightTwips = command.height; + this._docType = command.type; this._updateMaxBounds(true); this._documentInfo = textMsg; this._parts = command.parts; this._currentPart = command.currentPart; - this._map.fire('updateparts', {currentPart : this._currentPart, parts: this._parts}); + this._map.fire('updateparts', { + currentPart: this._currentPart, + parts: this._parts, + docType: this._docType + }); this._update(); if (!this._tilesPreFetcher) { this._tilesPreFetcher = setInterval(L.bind(this._preFetchTiles, this), 2000); @@ -435,7 +440,8 @@ L.TileLayer = L.GridLayer.extend({ id: command.id, width: command.width, height: command.height, - part: command.part + part: command.part, + docType: this._docType }); } else if (tile) { @@ -561,7 +567,12 @@ L.TileLayer = L.GridLayer.extend({ command.currentPart = parseInt(tokens[i].substring(8)); } else if (tokens[i].substring(0, 3) === 'id=') { - command.id = parseInt(tokens[i].substring(3)); + // remove newline characters + command.id = tokens[i].substring(3).replace(/(\r\n|\n|\r)/gm, ''); + } + else if (tokens[i].substring(0, 5) === 'type=') { + // remove newline characters + command.type = tokens[i].substring(5).replace(/(\r\n|\n|\r)/gm, ''); } } if (command.tileWidth && command.tileHeight) { commit 27b9e4438607baa80856d7210d2bf45a69b5d462 Author: Mihai Varga <[email protected]> Date: Wed Jul 15 09:34:37 2015 +0300 loleaflet: dynamicaly make room for the preview in the left diff --git a/loleaflet/dist/leaflet.css b/loleaflet/dist/leaflet.css index c84148d..939d63b 100644 --- a/loleaflet/dist/leaflet.css +++ b/loleaflet/dist/leaflet.css @@ -546,10 +546,10 @@ a.leaflet-control-buttons:hover { #document-container { background: #DFDFDF; position: absolute; - top: 120px; + top: 100px; bottom: 0px; right: 0px; - left: 200px; + left: 0px; } #map diff --git a/loleaflet/src/control/Control.Parts.js b/loleaflet/src/control/Control.Parts.js index 8118efd..b4212a8 100644 --- a/loleaflet/src/control/Control.Parts.js +++ b/loleaflet/src/control/Control.Parts.js @@ -66,6 +66,13 @@ L.Control.Parts = L.Control.extend({ L.DomUtil.removeClass(this._nextPartButton, className); } if (!this._previewInitialized && parts > 1) { + // make room for the preview + var docContainer = L.DomUtil.get('document-container'); + L.DomUtil.setStyle(docContainer, 'left', '200px'); + setTimeout(L.bind(function () { + this._map.invalidateSize(); + $("#scroll-container").mCustomScrollbar('update'); + }, this), 500); var container = L.DomUtil.get('parts-preview'); for (var i = 0; i < parts; i++) { var id = 'preview-tile' + i; _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
