notebookbar: sidebar decks in Math

Math is activated in-place, so we need to replace current elements with
Math-specific ones temporarily, on context switch. Application ID is
required for that.

Having previous context in the event itself would allow to drop storing
it in Control.Notebookbar eventually.

For now, only have Elements deck exposed for Math, because Options deck
needs either re-implementation to host everything in itself, or JS-weld
of Math dialogs.

lc_sidebar.svg images were used for .uno:SidebarDeck.ElementsDeck as a
temporary icon, until there's a dedicated image. See also tdf#149144.

Signed-off-by: Mike Kaganski <mike.kaganski@collabora.com>
Change-Id: I37dcda962a2a6ff60e301182033384c56615a24e
private/timar/cacert
Mike Kaganski 2022-08-26 13:02:58 +03:00 committed by Mike Kaganski
parent 106cb9b158
commit f018beefa7
5 changed files with 28 additions and 4 deletions

View File

@ -0,0 +1 @@
<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="m2 3v1 3 13c0 .554.446 1 1 1h18c.554 0 1-.446 1-1v-13-3-1h-1c-6 0-12 0-18 0zm1 4h18v13c-6.00882.0041-11.9902693 0-18 0z" fill="#fafafa"/><path d="m16 7v6.996094l1.486328.002c.420169-.0059.867656.182805 1.138672.484375s.382812.666177.382812 1.015625c.000001.349447-.111796.712102-.382812 1.013672s-.718503.492228-1.138672.486328l-1.486328-.002v4.003906h6v-14z" fill="#1e8bcd"/><path d="m17 7v6.998047h.486328c.420169-.005942.867656.182805 1.138672.484375s.382812.666177.382812 1.015625c.000002.349447-.111796.712102-.382812 1.013672s-.718503.492228-1.138672.486328h-.486328v3.001953h4v-13z" fill="#0063b1"/><path d="m10.00006 15.480118a.50005.50005 0 0 1 .203125-.394531l2.951171-2.947266a.50063788.50063788 0 1 1 .707032.708984l-2.146485 2.142579 5.785157.0078a.50005.50005 0 1 1 0 1l-5.785157-.0078 2.146485 2.15039a.50005.50005 0 1 1 -.708985.705078l-2.957031-2.960937a.50005.50005 0 0 1 -.195312-.404297z" fill="#1e8bcd" fill-rule="evenodd"/><path d="m21 7v13h-5v1h5c.554 0 1-.446 1-1v-13z" fill="#83beec"/><path d="m3 4h18v2h-18z" fill="#797774"/></svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -0,0 +1 @@
<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="m3 4v16h18v-16z" fill="#fff"/><path d="m7 14.5a.5.5 0 0 1 .2-.4l3-3a.5.5 0 1 1 .7.7l-2.1 2.1h5.8a.5.5 0 1 1 0 1h-5.8l2.1 2.1a.5.5 0 1 1 -.7.7l-3-2.8a.5.5 0 0 1 -.2-.4z" fill="#1e8bcd"/><path d="m3 3c-.554 0-1 .446-1 1v16c0 .554.446 1 1 1h18c.554 0 1-.446 1-1v-16c0-.554-.446-1-1-1zm0 1h18v16h-18z" fill="#3a3a38"/><path d="m17 3c-.554 0-1 .446-1 1v16c0 .554.446 1 1 1h4c.554 0 1-.446 1-1v-16c0-.554-.446-1-1-1zm0 1h4v16h-4z" fill="#0063b1"/><path d="m17 4v16h4v-16z" fill="#83beec"/></svg>

After

Width:  |  Height:  |  Size: 558 B

View File

@ -407,6 +407,24 @@ L.Control.Notebookbar = L.Control.extend({
},
onContextChange: function(event) {
if (event.appId !== event.oldAppId) {
var childrenArray = undefined; // Use buttons provided by specific Control.Notebookbar implementation by default
if (event.appId === 'com.sun.star.formula.FormulaProperties') {
childrenArray = [
{
'type': 'toolitem',
'text': _UNO('.uno:SidebarDeck.ElementsDeck', '', true),
'command': '.uno:SidebarDeck.ElementsDeck'
},
{
'type': 'toolitem',
// dummy node to avoid creating labels
}
];
}
this.createOptionsSection(childrenArray);
}
if (event.context === this.lastContext)
return;
@ -489,7 +507,7 @@ L.Control.Notebookbar = L.Control.extend({
]);
},
createOptionsSection: function() {
createOptionsSection: function(childrenArray) {
$('.notebookbar-options-section').remove();
var optionsSection = L.DomUtil.create('div', 'notebookbar-options-section');
@ -502,6 +520,8 @@ L.Control.Notebookbar = L.Control.extend({
};
var builder = new L.control.notebookbarBuilder(builderOptions);
builder.build(optionsSection, this.getOptionsSectionData());
if (childrenArray === undefined)
childrenArray = this.getOptionsSectionData();
builder.build(optionsSection, childrenArray);
},
});

View File

@ -1716,8 +1716,9 @@ L.CanvasTileLayer = L.Layer.extend({
var message = textMsg.substring('context:'.length + 1);
message = message.split(' ');
if (message.length > 1) {
this._map.context = {context: message[1]};
this._map.fire('contextchange', {context: message[1]});
var old = this._map.context || {};
this._map.context = {appId: message[0], context: message[1]};
this._map.fire('contextchange', {appId: message[0], context: message[1], oldAppId: old.appId, oldContext: old.context});
}
}
else if (textMsg.startsWith('formfieldbutton:')) {

View File

@ -426,6 +426,7 @@ var unoCommandsArray = {
'ShowTrackedChanges':{text:{context:_('Show Track Changes'),menu:_('~Show'),},},
'Shrink':{global:{context:_('Decrease Font Size'),menu:_('Decrease Size'),},},
'Sidebar':{global:{menu:_('Sidebar'),},},
'SidebarDeck.ElementsDeck':{global:{menu:_('Open the Elements Deck'),},},
'SlideChangeWindow':{presentation:{menu:_('Slide Transition'),},},
'SlideMasterPage':{presentation:{menu:_('~Master Slide'),},},
'SlideMenu':{presentation:{menu:_('S~lide'),},},