[Libreoffice-commits] online.git: 3 commits - loleaflet/src
Andrzej Hunt
andrzej.hunt at collabora.com
Wed Nov 11 12:40:55 PST 2015
loleaflet/src/control/Control.Styles.js | 58 +++++++++++++++++++++++++++-----
loleaflet/src/control/Toolbar.js | 6 +++
2 files changed, 55 insertions(+), 9 deletions(-)
New commits:
commit 4d03af151745c7e9b3114b4424f03e722f943b75
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date: Wed Nov 11 21:17:45 2015 +0100
loleaflet: show calc cell styles in selector too
diff --git a/loleaflet/src/control/Control.Styles.js b/loleaflet/src/control/Control.Styles.js
index d15c061..31b0dac 100644
--- a/loleaflet/src/control/Control.Styles.js
+++ b/loleaflet/src/control/Control.Styles.js
@@ -49,6 +49,9 @@ L.Control.Styles = L.Control.extend({
this._map.getDocType() === 'drawing') {
styles = e.commandValues['Default'];
}
+ else if (this._map.getDocType() === 'spreadsheet' ) {
+ styles = e.commandValues['CellStyles'];
+ }
this._addSeparator();
if (e.commandValues['ClearStyle']) {
commit e484716ac3bc46b3c3a2e9cf57b924efd6223cf0
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date: Wed Nov 11 21:17:27 2015 +0100
loleaflet: separate the top UI styles
The topStyles are equivalent to the default styles shown
in the writer styles selector. The remainder of the list
is the full list of available styles (shown under "more"
in the desktop style selector), however this probably
too overwhelming, hence instead we just show a small selection
of styles.
diff --git a/loleaflet/src/control/Control.Styles.js b/loleaflet/src/control/Control.Styles.js
index b8d24ea..d15c061 100644
--- a/loleaflet/src/control/Control.Styles.js
+++ b/loleaflet/src/control/Control.Styles.js
@@ -35,15 +35,20 @@ L.Control.Styles = L.Control.extend({
var container = this._container;
var first = L.DomUtil.create('option', '', container);
first.innerHTML = this.options.info;
+
+ var styles = [];
+ var topStyles = [];
if (this._map.getDocType() === 'text') {
- var styles = e.commandValues['ParagraphStyles'].slice(0, 12);
+ // The list contains a total of 100+ styles, the first 7 are
+ // the default styles (as shown on desktop writer), we then
+ // also show a selection of 12 more styles.
+ styles = e.commandValues['ParagraphStyles'].slice(7, 19);
+ topStyles = e.commandValues['ParagraphStyles'].slice(0, 7);
}
- else if (this._map.getDocType() === 'presentation') {
+ else if (this._map.getDocType() === 'presentation' ||
+ this._map.getDocType() === 'drawing') {
styles = e.commandValues['Default'];
}
- else {
- styles = [];
- }
this._addSeparator();
if (e.commandValues['ClearStyle']) {
@@ -51,11 +56,26 @@ L.Control.Styles = L.Control.extend({
item.value = 'ClearStyle';
item.innerHTML = e.commandValues['ClearStyle'];
}
- styles.forEach(function (style) {
- var item = L.DomUtil.create('option', '', container);
- item.value = style;
- item.innerHTML = style;
- });
+
+ if (topStyles.length > 0) {
+ this._addSeparator();
+
+ topStyles.forEach(function (style) {
+ var item = L.DomUtil.create('option', '', container);
+ item.value = style;
+ item.innerHTML = style;
+ });
+ }
+
+ if (styles.length > 0) {
+ this._addSeparator();
+
+ styles.forEach(function (style) {
+ var item = L.DomUtil.create('option', '', container);
+ item.value = style;
+ item.innerHTML = style;
+ });
+ }
}
},
commit c560a04e06e1d617428e36ce527387a82adb49fa
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date: Wed Nov 11 21:15:26 2015 +0100
loleaflet: add "Clear formatting" to style selector
This is a direct equivalent to the Clear formatting
functionality on desktop.
diff --git a/loleaflet/src/control/Control.Styles.js b/loleaflet/src/control/Control.Styles.js
index fc2bc8b..b8d24ea 100644
--- a/loleaflet/src/control/Control.Styles.js
+++ b/loleaflet/src/control/Control.Styles.js
@@ -23,6 +23,13 @@ L.Control.Styles = L.Control.extend({
map.off('updatepermission', this._searchResultFound, this);
},
+ _addSeparator: function () {
+ var item = L.DomUtil.create('option', '', this._container);
+ item.disabled = true;
+ item.value = 'separator';
+ item.innerHTML = '────────────';
+ },
+
_initList: function (e) {
if (e.commandName === '.uno:StyleApply') {
var container = this._container;
@@ -37,6 +44,13 @@ L.Control.Styles = L.Control.extend({
else {
styles = [];
}
+
+ this._addSeparator();
+ if (e.commandValues['ClearStyle']) {
+ var item = L.DomUtil.create('option', '', container);
+ item.value = 'ClearStyle';
+ item.innerHTML = e.commandValues['ClearStyle'];
+ }
styles.forEach(function (style) {
var item = L.DomUtil.create('option', '', container);
item.value = style;
@@ -59,7 +73,10 @@ L.Control.Styles = L.Control.extend({
if (style === this.options.info) {
return;
}
- if (this._map.getDocType() === 'text') {
+ if (style === 'ClearStyle') {
+ this._map.clearStyle();
+ }
+ else if (this._map.getDocType() === 'text') {
this._map.applyStyle(style, 'ParagraphStyles');
}
else if (this._map.getDocType() === 'presentation') {
diff --git a/loleaflet/src/control/Toolbar.js b/loleaflet/src/control/Toolbar.js
index 2b85406..52d7f7a 100644
--- a/loleaflet/src/control/Toolbar.js
+++ b/loleaflet/src/control/Toolbar.js
@@ -77,6 +77,12 @@ L.Map.include({
}
},
+ clearStyle: function () {
+ if (this._docLayer._permission === 'edit') {
+ L.Socket.sendMessage('uno .uno:ResetAttributes');
+ }
+ },
+
toggleCommandState: function (unoState) {
if (this._docLayer._permission === 'edit') {
if (!unoState.startsWith('.uno:')) {
More information about the Libreoffice-commits
mailing list