[Libreoffice-commits] online.git: loleaflet/src
Henry Castro
hcastro at collabora.com
Fri Dec 8 17:12:38 UTC 2017
loleaflet/src/control/Control.Menubar.js | 27 +++++++++++++++++++++++++--
1 file changed, 25 insertions(+), 2 deletions(-)
New commits:
commit c635fce623a2015ce31cda96810a536665dc0242
Author: Henry Castro <hcastro at collabora.com>
Date: Tue Jul 11 17:48:41 2017 -0400
loleaflet: add Header/Footer menu
Change-Id: I2a2a8702e9b038292915d859009376463bef5838
Reviewed-on: https://gerrit.libreoffice.org/39841
Reviewed-by: pranavk <pranavk at collabora.co.uk>
Tested-by: Henry Castro <hcastro at collabora.com>
diff --git a/loleaflet/src/control/Control.Menubar.js b/loleaflet/src/control/Control.Menubar.js
index 5a77aea5..da17cf6a 100644
--- a/loleaflet/src/control/Control.Menubar.js
+++ b/loleaflet/src/control/Control.Menubar.js
@@ -63,6 +63,9 @@ L.Control.Menubar = L.Control.extend({
{name: _('Image'), id: 'insertgraphic', type: 'action'},
{name: _('Comment...'), id: 'insertcomment', type: 'action'},
{type: 'separator'},
+ {name: _('Header and Footer'), type: 'menu', menu: [
+ {name: _('Header'), type: 'unocommand', uno: '.uno:InsertPageHeader'},
+ {name: _('Footer'), type: 'unocommand', uno: '.uno:InsertPageFooter'}]},
{name: _('Footnote'), type: 'unocommand', uno: '.uno:InsertFootnote'},
{name: _('Endnote'), type: 'unocommand', uno: '.uno:InsertEndnote'},
{type: 'separator'},
@@ -668,6 +671,27 @@ L.Control.Menubar = L.Control.extend({
}
},
+ _sendCommand: function (item) {
+ var unoCommand = $(item).data('uno');
+ if (unoCommand == '.uno:InsertPageHeader' || unoCommand == '.uno:InsertPageFooter') {
+ if (map['stateChangeHandler'].getItemValue(unoCommand) === 'true') {
+ vex.dialog.confirm({
+ message: (unoCommand.endsWith('Header') ? _('Are you sure you want to delete the header?') :
+ _('Are you sure you want to delete the footer?')),
+ callback: function(value) {
+ if (value) {
+ map.sendUnoCommand(unoCommand + '?On:bool=false');
+ }
+ }
+ });
+ } else {
+ map.sendUnoCommand(unoCommand + '?On:bool=true');
+ }
+ } else {
+ map.sendUnoCommand(unoCommand);
+ }
+ },
+
_onDeleteSlide: function(e) {
if (e) {
map.deletePage();
@@ -678,8 +702,7 @@ L.Control.Menubar = L.Control.extend({
var self = e.data.self;
var type = $(item).data('type');
if (type === 'unocommand') {
- var unoCommand = $(item).data('uno');
- map.sendUnoCommand(unoCommand);
+ self._sendCommand(item);
} else if (type === 'action') {
self._executeAction(item);
}
More information about the Libreoffice-commits
mailing list