loleaflet/css/toolbar.css                |    1 +
 loleaflet/images/lc_backgroundcolor.svg  |    1 +
 loleaflet/src/control/Control.Toolbar.js |   23 ++++++++++++++++++-----
 loleaflet/src/unocommands.js             |    1 +
 4 files changed, 21 insertions(+), 5 deletions(-)

New commits:
commit 6167dc9c44b783cfac0062755a1f1fc73114b538
Author:     Samuel Mehrbrodt <samuel.mehrbr...@cib.de>
AuthorDate: Wed May 22 16:39:49 2019 +0200
Commit:     Samuel Mehrbrodt <samuel.mehrbr...@cib.de>
CommitDate: Thu May 23 14:33:52 2019 +0200

    Disambiguate Highlight color vs background color
    
    Highlighting is character level while background color is paragraph/cell 
level.
    Use different uno commands/icons/texts for the two.
    
    Change-Id: I79264fcdcd968734b68278f69450a377d6607323
    Reviewed-on: https://gerrit.libreoffice.org/72786
    Reviewed-by: Samuel Mehrbrodt <samuel.mehrbr...@cib.de>
    Tested-by: Samuel Mehrbrodt <samuel.mehrbr...@cib.de>

diff --git a/loleaflet/css/toolbar.css b/loleaflet/css/toolbar.css
index 29a9aa472..5db1821ea 100644
--- a/loleaflet/css/toolbar.css
+++ b/loleaflet/css/toolbar.css
@@ -550,6 +550,7 @@ button.leaflet-control-search-next
 .w2ui-icon.strikeout{ background: url('images/lc_strikeout.svg') no-repeat 
center !important; }
 .w2ui-icon.textcolor{ background: url('images/lc_color.svg') no-repeat center 
!important; }
 .w2ui-icon.backcolor{ background: url('images/lc_backcolor.svg') no-repeat 
center !important; }
+.w2ui-icon.backgroundcolor{ background: url('images/lc_backgroundcolor.svg') 
no-repeat center !important; }
 .w2ui-icon.alignleft{ background: url('images/lc_alignleft.svg') no-repeat 
center !important; }
 .w2ui-icon.alignhorizontal{ background: 
url('images/lc_alignhorizontalcenter.svg') no-repeat center !important; }
 .w2ui-icon.alignright{ background: url('images/lc_alignright.svg') no-repeat 
center !important; }
diff --git a/loleaflet/images/lc_backgroundcolor.svg 
b/loleaflet/images/lc_backgroundcolor.svg
new file mode 100644
index 000000000..ebd7aac9d
--- /dev/null
+++ b/loleaflet/images/lc_backgroundcolor.svg
@@ -0,0 +1 @@
+<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg";><path 
d="m11.307716 20.638247 9.438078-5.638247-5.708126-10.3752563-9.9336041 
5.8220523z" fill="#fff" fill-rule="evenodd"/><ellipse cx="12" cy="19.725481" 
fill="none" rx="10" ry="2.274613"/><path d="m9 8h-5c-1 0-1 .217546-1 
2.276478v5.723522c0 1 2 1 2 0v-6z" fill="#4d82b8" fill-rule="evenodd"/><g 
fill="none" stroke="#808080"><ellipse cx="4.962672" cy="16.187546" 
rx="1.752345" ry="1.741017" stroke-linecap="round" stroke-width=".95097" 
transform="matrix(.86821741 -.49618397 .50382625 .86380502 0 0)"/><path 
d="m12.488244 9.8063594v-5.2263907c0-2.8972803 5.493132-2.8080105 
5.493132.1206297v4.9056967" stroke-linecap="round" 
stroke-width=".909468"/><path d="m5.1040639 10.446796 5.3390121 
9.387521c.410089.65506 1.069393.906864 
1.704955.572463l7.748423-4.541322c.589382-.407352.86271-1.172428.486324-1.842477l-5.34511-9.3982373z"
 stroke-width=".896453"/></g></svg>
\ No newline at end of file
diff --git a/loleaflet/src/control/Control.Toolbar.js 
b/loleaflet/src/control/Control.Toolbar.js
index 7161f800f..b8028da40 100644
--- a/loleaflet/src/control/Control.Toolbar.js
+++ b/loleaflet/src/control/Control.Toolbar.js
@@ -230,6 +230,9 @@ function onClick(e, id, item, subItem) {
        else if (id === 'backcolor' && typeof e.color !== 'undefined') {
                onColorPick(id, e.color)
        }
+       else if (id === 'backgroundcolor' && typeof e.color !== 'undefined') {
+               onColorPick(id, e.color)
+       }
        else if (id === 'sum') {
                map.sendUnoCommand('.uno:AutoSum');
        }
@@ -637,15 +640,24 @@ function onColorPick(id, color) {
                command[fontcolor].value = color;
                var uno = '.uno:' + fontcolor;
        }
+       // "backcolor" can be used in Writer and Impress and translates to 
"Highlighting" while
+       // "backgroundcolor" can be used in Writer and Calc and translates to 
"Background color".
        else if (id === 'backcolor') {
                backcolor = {'text': 'BackColor',
-                                        'spreadsheet': 'BackgroundColor',
                                         'presentation': 
'CharBackColor'}[map.getDocType()];
                command[backcolor] = {};
                command[backcolor].type = 'long';
                command[backcolor].value = color;
                uno = '.uno:' + backcolor;
        }
+       else if (id === 'backgroundcolor') {
+               backcolor = {'text': 'BackgroundColor',
+                                        'spreadsheet': 
'BackgroundColor'}[map.getDocType()];
+               command[backcolor] = {};
+               command[backcolor].type = 'long';
+               command[backcolor].value = color;
+               uno = '.uno:' + backcolor;
+       }
        map.sendUnoCommand(uno, command);
        map.focus();
 }
@@ -746,7 +758,8 @@ function initNormalToolbar() {
                {type: 'button',  id: 'strikeout', img: 'strikeout', hint: 
_UNO('.uno:Strikeout'), uno: 'Strikeout'},
                {type: 'break', id: 'breakformatting'},
                {type: 'text-color',  id: 'fontcolor', img: 'textcolor', hint: 
_UNO('.uno:FontColor')},
-               {type: 'color',  id: 'backcolor', img: 'backcolor', hint: 
_UNO('.uno:BackgroundColor')},
+               {type: 'color',  id: 'backcolor', img: 'backcolor', hint: 
_UNO('.uno:BackColor'), hidden: true},
+               {type: 'color',  id: 'backgroundcolor', img: 'backgroundcolor', 
hint: _UNO('.uno:BackgroundColor'), hidden: true},
                {type: 'break' , id: 'breakcolor', mobile:false},
                {type: 'button',  id: 'leftpara',  img: 'alignleft', hint: 
_UNO('.uno:LeftPara', '', true), uno: 'LeftPara', hidden: true, unosheet: 
'AlignLeft', disabled: true},
                {type: 'button',  id: 'centerpara',  img: 'alignhorizontal', 
hint: _UNO('.uno:CenterPara', '', true), uno: 'CenterPara', hidden: true, 
unosheet: 'AlignHorizontalCenter', disabled: true},
@@ -1395,7 +1408,7 @@ function onDocLayerInit() {
                toolbarUp.show('textalign', 'wraptext', 'breakspacing', 
'insertannotation', 'conditionalformaticonset',
                        'numberformatcurrency', 'numberformatpercent',
                        'numberformatincdecimals', 'numberformatdecdecimals', 
'break-number', 'togglemergecells', 'breakmergecells',
-                       'setborderstyle', 'sortascending', 'sortdescending', 
'breaksorting');
+                       'setborderstyle', 'sortascending', 'sortdescending', 
'breaksorting', 'backgroundcolor');
                toolbarUp.remove('styles');
 
                statusbar.remove('prev', 'next', 'prevnextbreak');
@@ -1462,7 +1475,7 @@ function onDocLayerInit() {
        case 'text':
                toolbarUp.show('leftpara', 'centerpara', 'rightpara', 
'justifypara', 'breakpara', 'linespacing',
                        'breakspacing', 'defaultbullet', 'defaultnumbering', 
'breakbullet', 'incrementindent', 'decrementindent',
-                       'breakindent', 'inserttable', 'insertannotation');
+                       'breakindent', 'inserttable', 'insertannotation', 
'backcolor');
 
                if (!_inMobileMode()) {
                        statusbar.insert('left', [
@@ -1520,7 +1533,7 @@ function onDocLayerInit() {
                // FALLTHROUGH intended
        case 'drawing':
                toolbarUp.show('leftpara', 'centerpara', 'rightpara', 
'justifypara', 'breakpara', 'linespacing',
-                       'breakspacing', 'defaultbullet', 'defaultnumbering', 
'breakbullet', 'inserttable');
+                       'breakspacing', 'defaultbullet', 'defaultnumbering', 
'breakbullet', 'inserttable', 'backcolor');
                statusbar.show('prev', 'next');
 
                $('#presentation-toolbar').show();
diff --git a/loleaflet/src/unocommands.js b/loleaflet/src/unocommands.js
index cb6c0c1d9..a0e65bffb 100644
--- a/loleaflet/src/unocommands.js
+++ b/loleaflet/src/unocommands.js
@@ -11,6 +11,7 @@ var unoCommandsArray = {
        ArrangeFrameMenu:{text:{menu:_('Arrange'),},},
        
ArrangeMenu:{global:{menu:_('A~rrange'),},presentation:{menu:_('~Arrange'),},},
        AutoFormatMenu:{text:{menu:_('AutoCorr~ect'),},},
+       BackColor:{text:{menu:_('Highlight Color'),},},
        BackgroundColor:{global:{menu:_('Background Color'),},},
        Bold:{global:{menu:_('Bold'),},},
        BringToFront:{global:{menu:_('~Bring to Front'),},},
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to