[Libreoffice-commits] online.git: loleaflet/dist loleaflet/src

Faruk Uzun farukuzun at collabora.com
Tue Feb 23 15:57:02 UTC 2016


 loleaflet/dist/images/sc_firstrecord.png |binary
 loleaflet/dist/images/sc_lastrecord.png  |binary
 loleaflet/dist/images/sc_nextrecord.png  |binary
 loleaflet/dist/images/sc_prevrecord.png  |binary
 loleaflet/dist/loleaflet.html            |   22 ++++++++++++++---
 loleaflet/dist/spreadsheet.css           |   15 +++++++++---
 loleaflet/dist/toolbar/toolbar.js        |   38 +++++++++++++++++++++++++++++++
 loleaflet/src/control/Control.Tabs.js    |    6 ++++
 8 files changed, 73 insertions(+), 8 deletions(-)

New commits:
commit 02f6f0d6fada3416fd948fe9834a060235c28406
Author: Faruk Uzun <farukuzun at collabora.com>
Date:   Mon Feb 22 11:36:45 2016 +0200

    loleaflet: bccu#1456 fix spreadsheet tabs
    
    Adds a custom navigation for spreadsheet-tabs
    
    Change-Id: I57d9ef1ff9466c18c9edca849519bbe2af5826ab
    Reviewed-on: https://gerrit.libreoffice.org/22610
    Reviewed-by: Andras Timar <andras.timar at collabora.com>
    Tested-by: Andras Timar <andras.timar at collabora.com>

diff --git a/loleaflet/dist/images/sc_firstrecord.png b/loleaflet/dist/images/sc_firstrecord.png
new file mode 100644
index 0000000..4871713
Binary files /dev/null and b/loleaflet/dist/images/sc_firstrecord.png differ
diff --git a/loleaflet/dist/images/sc_lastrecord.png b/loleaflet/dist/images/sc_lastrecord.png
new file mode 100644
index 0000000..e723613
Binary files /dev/null and b/loleaflet/dist/images/sc_lastrecord.png differ
diff --git a/loleaflet/dist/images/sc_nextrecord.png b/loleaflet/dist/images/sc_nextrecord.png
new file mode 100644
index 0000000..1983927
Binary files /dev/null and b/loleaflet/dist/images/sc_nextrecord.png differ
diff --git a/loleaflet/dist/images/sc_prevrecord.png b/loleaflet/dist/images/sc_prevrecord.png
new file mode 100644
index 0000000..be8ca97
Binary files /dev/null and b/loleaflet/dist/images/sc_prevrecord.png differ
diff --git a/loleaflet/dist/loleaflet.html b/loleaflet/dist/loleaflet.html
index 1fcd107..4d23a11 100644
--- a/loleaflet/dist/loleaflet.html
+++ b/loleaflet/dist/loleaflet.html
@@ -68,7 +68,7 @@
     <div id="document-container">
         <div id="map"></div>
     </div>
-
+    <div id="spreadsheet-toolbar"></div>
     <div id="toolbar-down"></div>
     <style type="text/css">
         #toolbar-up {
@@ -97,6 +97,15 @@
             display: none;
         }
 
+        #spreadsheet-toolbar {
+            left: 0;
+            text-align: center;
+            bottom: 29px;
+            padding: 0;
+            position: absolute;
+        }
+
+
         #zoomlevel {
             min-width: 36px;
             font-size: 12px;
@@ -151,12 +160,13 @@
             bottom: 49px !important;
         }
 
-	.spreadsheet-header-rows-container {
-            bottom: 49px;
+        .spreadsheet-header-rows-container {
+            bottom: 54px;
         }
 
         .spreadsheet-tab {
-            bottom: 29px;
+            left: 108px;
+            bottom: 34px;
         }
 
         /* select box */
@@ -231,6 +241,10 @@
         .w2ui-icon.zoomout{ background: url('/loleaflet/dist/images/sc_zoomout.png') no-repeat center !important; }
         .w2ui-icon.zoomreset{ background: url('/loleaflet/dist/images/sc_view100.png') no-repeat center !important; }
         .w2ui-icon.more{ background: url('/loleaflet/dist/images/sc_next.png') no-repeat center !important; }
+        .w2ui-icon.firstrecord{ background: url('/loleaflet/dist/images/sc_firstrecord.png') no-repeat center !important; }
+        .w2ui-icon.nextrecord{ background: url('/loleaflet/dist/images/sc_nextrecord.png') no-repeat center !important; }
+        .w2ui-icon.prevrecord{ background: url('/loleaflet/dist/images/sc_prevrecord.png') no-repeat center !important; }
+        .w2ui-icon.lastrecord{ background: url('/loleaflet/dist/images/sc_lastrecord.png') no-repeat center !important; }
 
 	#simplemodal-container a.modalCloseImg {
 		background:url('/loleaflet/dist/images/sc_closedoc.png') no-repeat;
diff --git a/loleaflet/dist/spreadsheet.css b/loleaflet/dist/spreadsheet.css
index 6240514..665c7fe 100644
--- a/loleaflet/dist/spreadsheet.css
+++ b/loleaflet/dist/spreadsheet.css
@@ -11,18 +11,27 @@
 	bottom: 0;
 	position: absolute;
 	cursor: pointer;
+	height: 20px;
+	width: 90%;
+	overflow-x: hidden;
+	white-space: nowrap;
+	}
+
+.spreadsheet-tab-scroll {
+	width: 90%;
+	overflow-x: auto;
 	}
 
+
 .spreadsheet-tab li {
-	float: left;
-	list-style: none;
 	margin: 0;
 	padding: 0;
 	margin-left: 2px;
 	}
 
+
 .spreadsheet-tab li {
-	display: block;
+	display: inline-block;
 	border: #B9B9B9 1px solid;
 	background: #A8A8A8;
 	color: #FFFFFF;
diff --git a/loleaflet/dist/toolbar/toolbar.js b/loleaflet/dist/toolbar/toolbar.js
index 0600a50..b77c94c 100644
--- a/loleaflet/dist/toolbar/toolbar.js
+++ b/loleaflet/dist/toolbar/toolbar.js
@@ -104,6 +104,18 @@ $(function () {
 			onClick(e.target);
 		}
 	});
+	$('#spreadsheet-toolbar').w2toolbar({
+		name: 'spreadsheet-toolbar',
+		items: [
+			{ type: 'button',  id: 'firstrecord',  img: 'firstrecord', hint: _("First Sheet") },
+			{ type: 'button',  id: 'prevrecord',  img: 'prevrecord', hint: _("Previous Sheet") },
+			{ type: 'button',  id: 'nextrecord',  img: 'nextrecord', hint: _("Next Sheet") },
+			{ type: 'button',  id: 'lastrecord',  img: 'lastrecord', hint: _("Last Sheet") }
+		],
+		onClick: function (e) {
+			onClick(e.target);
+		}
+	});
 	$('#toolbar-down').w2toolbar({
 		name: 'toolbar-down',
 		items: [
@@ -137,6 +149,7 @@ $(function () {
 			onClick(e.target);
 		}
 	});
+
 	$('#fontColorPicker').colorpicker({showOn:'none', hideButton:true});
 	$("#fontColorPicker").on("change.color", onColorPick);
 	$('#backColorPicker').colorpicker({showOn:'none', hideButton:true});
@@ -176,6 +189,10 @@ function onClick(id) {
 		toolbar = w2ui['toolbar-down'];
 		item = toolbar.get(id) ;
 	}
+	else if (w2ui['spreadsheet-toolbar'].get(id) !== null) {
+		toolbar = w2ui['spreadsheet-toolbar'];
+		item = toolbar.get(id) ;
+	}
 	else if (id.indexOf(':') >= 0) {
 		// we just handle a menu item click,
 		// like File->Download as
@@ -286,6 +303,19 @@ function onClick(id) {
 			callback: onDelete
 		});
 	}
+	else if (id === 'firstrecord') {
+		$('#spreadsheet-tab-scroll').scrollLeft(0);
+	}
+	// TODO: We should get visible tab's width instead of 60px
+	else if (id === 'nextrecord') {
+		$('#spreadsheet-tab-scroll').scrollLeft($('#spreadsheet-tab-scroll').scrollLeft()+60);
+	}
+	else if (id === 'prevrecord') {
+		$('#spreadsheet-tab-scroll').scrollLeft($('#spreadsheet-tab-scroll').scrollLeft()-60);
+	}
+	else if (id === 'lastrecord') {
+		$('#spreadsheet-tab-scroll').scrollLeft($('#spreadsheet-tab-scroll').prop("scrollWidth"));
+	}
 	else if (id.startsWith('menu:file:downloadas-')) {
 		var format = id.substring('menu:file:downloadas-'.length);
 		// try to get the filename from the url
@@ -731,6 +761,14 @@ map.on('updateparts pagenumberchanged', function (e) {
 		toolbar.hide('decrementindent');
 		toolbar.hide('incdecindent');
 	}
+
+	var toolbar = w2ui['spreadsheet-toolbar'];
+	if (e.docType !== 'spreadsheet') {
+		toolbar.hide('firstrecord');
+		toolbar.hide('nextrecord');
+		toolbar.hide('prevrecord');
+		toolbar.hide('lastrecord');
+	}
 });
 
 map.on('commandresult', function (e) {
diff --git a/loleaflet/src/control/Control.Tabs.js b/loleaflet/src/control/Control.Tabs.js
index 4a27aa2..e44e9d9 100644
--- a/loleaflet/src/control/Control.Tabs.js
+++ b/loleaflet/src/control/Control.Tabs.js
@@ -9,6 +9,7 @@ L.Control.Tabs = L.Control.extend({
 		this._spreadsheetTabs = {};
 		var docContainer = map.options.documentContainer;
 		this._tabsCont = L.DomUtil.create('div', 'spreadsheet-tab', docContainer.parentElement);
+		this._tabsCont.id = 'spreadsheet-tab';
 
 		$.contextMenu({
 			selector: '.spreadsheet-context-menu',
@@ -79,9 +80,12 @@ L.Control.Tabs = L.Control.extend({
 				while (this._tabsCont.firstChild) {
 					this._tabsCont.removeChild(this._tabsCont.firstChild);
 				}
+				var ssTabScroll = L.DomUtil.create('div', 'spreadsheet-tab-scroll', this._tabsCont);
+				ssTabScroll.id = 'spreadsheet-tab-scroll';
+
 				for (var i = 0; i < parts; i++) {
 					var id = 'spreadsheet-tab' + i;
-					var tab = L.DomUtil.create('li', 'spreadsheet-context-menu', this._tabsCont);
+					var tab = L.DomUtil.create('li', 'spreadsheet-context-menu', ssTabScroll);
 					tab.innerHTML = e.partNames[i];
 					tab.id = id;
 


More information about the Libreoffice-commits mailing list