Add new "download as" PDF option - part 2

refs commit 2572f011da
Added functionality:
 - for draw, calc and impress with "download
   group" toolbar buttom
 - for all the applications with single
   download toolbar buttons
 - for all the applications in compact
   mode (menu)

This is a port from 22.05 + with conflicts solved and the removal of
legacy hasSigning and related

Change-Id: Ibab9d831f1da07cbf38db29a26eeb5b712c4842c
Signed-off-by: luigiiucci <luigi.iucci@collabora.com>
Signed-off-by: Pedro Pinto Silva <pedro.silva@collabora.com>
pull/6828/head
luigiiucci 2023-06-26 17:14:21 +02:00 committed by pedropintosilva
parent 63b4847562
commit 5626268f9b
7 changed files with 125 additions and 62 deletions

View File

@ -0,0 +1 @@
<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="m5 4v17h5.976562c2.120023-1.87144 3.016527-3.398892 3.425782-4.792969.205243-.699148.278814-1.390169.300781-2.123047-.065036-.590668-.088834-1.223783-.042969-1.910156-.010596-.238464-.010586-.447996-.019531-.625a1.0001 1.0001 0 0 1 .011719-.216797c.000098-.0018-.000108-.002106 0-.003906.0016-.02652-.0039-.028431 0-.056641a1.0001 1.0001 0 0 0 0-.001953c.00262-.01862.02209-.028485.02539-.046875a1.0001 1.0001 0 0 1 .216797-.390625c.25633-.473221.684094-.841701 1.244141-.832031h.001953c.763264.015055 1.403137.633939 1.443359 1.396484a1.0001 1.0001 0 0 0 0 .001954c.04397.871902.073859 1.800796.042969 2.761718.157681.939743.444178 1.626648.835938 2.03711.145831.152793.332658.292536.537109.425781v-8.8945314l-4-3.7285156zm13.777344 16.119141c-.35636.023745-.71519.076194-1.082032.162109-.593735.139055-1.21825.370652-1.876953.71875h3.181641v-.878906c-.074218.002507-.148252-.006911-.222656-.001953z" fill="#fafafa"/><path d="m5 3c-.554 0-1 .446-1 1v17c0 .554.446 1 1 1h5.183594a1.0001 1.0001 0 0 1 .228515-.488281c.002996-.00322.000907-.008519.003907-.011719a1.0001 1.0001 0 0 1 .007812-.007812c.07109-.07214.018231-.018055.019531-.017579a1.0001 1.0001 0 0 1 .085938-.080078c.161162-.134758.298577-.263277.447265-.394531h-5.976562v-17h9v4c0 .554.446 1 1 1h4v7.623047c.281406.183398.615707.347736 1 .494141v-8.867188-.2089844c0-.4506799.098038-.4254121-.605469-1.0664062l-3.30664-3.2382813c-.709525-.7368575-.710169-.7363281-1.09375-.7363281h-.332032-.662109zm14 17.121094v.878906h-3.181641c-.490395.259154-1.00132.591845-1.535156 1h5.716797v-.753906-.246094-.830078c-.050688-.01448-.105973-.026329-.15625-.041016-.281796-.022592-.5625-.017315-.84375-.007812z" fill="#3a3a38"/><path d="m15 8h4l-4-4z" fill="#fafafa" fill-rule="evenodd"/><path d="m11.473603 22.526341c5.226938-4.370563 4.807709-7.688322 4.637891-11.052586-.748906 5.401898 2.038932 7.334389 6.414603 7.709274-3.299738-1.04046-6.796542-.976274-11.052494 3.343312z" fill="none" stroke="#ed3d3b" stroke-linecap="round" stroke-linejoin="round" stroke-width=".948529"/></svg>

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@ -76,7 +76,8 @@ L.Control.Menubar = L.Control.extend({
{name: _('Share...'), id:'shareas', type: 'action'},
{name: _('See revision history'), id: 'rev-history', type: 'action'},
{name: !window.ThisIsAMobileApp ? _('Download as') : _('Export as'), id: 'downloadas', type: 'menu', menu: [
{name: _('PDF Document (.pdf)'), id: !window.ThisIsAMobileApp ? 'exportpdf' : 'downloadas-pdf', type: 'action'},
{name: _('PDF Document (.pdf)'), id: !window.ThisIsAMobileApp ? 'exportdirectpdf' : 'downloadas-direct-pdf', type: 'action'},
{name: _('PDF Document (.pdf) - Expert'), id: !window.ThisIsAMobileApp ? 'exportpdf' : 'downloadas-pdf', type: 'action'},
{name: _('ODF text document (.odt)'), id: 'downloadas-odt', type: 'action'},
{name: _('Word 2003 Document (.doc)'), id: 'downloadas-doc', type: 'action'},
{name: _('Word Document (.docx)'), id: 'downloadas-docx', type: 'action'},
@ -377,7 +378,8 @@ L.Control.Menubar = L.Control.extend({
{name: _('Share...'), id:'shareas', type: 'action'},
{name: _('See revision history'), id: 'rev-history', type: 'action'},
{name: !window.ThisIsAMobileApp ? _('Download as') : _('Export as'), id: 'downloadas', type: 'menu', menu: [
{name: _('PDF Document (.pdf)'), id: !window.ThisIsAMobileApp ? 'exportpdf' : 'downloadas-pdf', type: 'action'},
{name: _('PDF Document (.pdf)'), id: !window.ThisIsAMobileApp ? 'exportdirectpdf' : 'downloadas-direct-pdf', type: 'action'},
{name: _('PDF Document (.pdf) - Expert'), id: !window.ThisIsAMobileApp ? 'exportpdf' : 'downloadas-pdf', type: 'action'},
{name: _('ODF presentation (.odp)'), id: 'downloadas-odp', type: 'action'},
{name: _('PowerPoint 2003 Presentation (.ppt)'), id: 'downloadas-ppt', type: 'action'},
{name: _('PowerPoint Presentation (.pptx)'), id: 'downloadas-pptx', type: 'action'},
@ -524,7 +526,8 @@ L.Control.Menubar = L.Control.extend({
{name: _UNO('.uno:Print', 'presentation'), id: 'print', type: 'action'},
{name: _('See revision history'), id: 'rev-history', type: 'action'},
{name: !window.ThisIsAMobileApp ? _('Download as') : _('Export as'), id: 'downloadas', type: 'menu', menu: [
{name: _('PDF Document (.pdf)'), id: !window.ThisIsAMobileApp ? 'exportpdf' : 'downloadas-pdf', type: 'action'},
{name: _('PDF Document (.pdf)'), id: !window.ThisIsAMobileApp ? 'exportdirectpdf' : 'downloadas-direct-pdf', type: 'action'},
{name: _('PDF Document (.pdf) - Expert'), id: !window.ThisIsAMobileApp ? 'exportpdf' : 'downloadas-pdf', type: 'action'},
{name: _('ODF Drawing (.odg)'), id: 'downloadas-odg', type: 'action'}
]},
{name: _UNO('.uno:SetDocumentProperties', 'presentation'), uno: '.uno:SetDocumentProperties', id: 'properties'},
@ -650,7 +653,8 @@ L.Control.Menubar = L.Control.extend({
{name: _('Share...'), id:'shareas', type: 'action'},
{name: _('See revision history'), id: 'rev-history', type: 'action'},
{name: !window.ThisIsAMobileApp ? _('Download as') : _('Export as'), id:'downloadas', type: 'menu', menu: [
{name: _('PDF Document (.pdf)'), id: !window.ThisIsAMobileApp ? 'exportpdf' : 'downloadas-pdf', type: 'action'},
{name: _('PDF Document (.pdf)'), id: !window.ThisIsAMobileApp ? 'exportdirectpdf' : 'downloadas-direct-pdf', type: 'action'},
{name: _('PDF Document (.pdf) - Expert'), id: !window.ThisIsAMobileApp ? 'exportpdf' : 'downloadas-pdf', type: 'action'},
{name: _('ODF spreadsheet (.ods)'), id: 'downloadas-ods', type: 'action'},
{name: _('Excel 2003 Spreadsheet (.xls)'), id: 'downloadas-xls', type: 'action'},
{name: _('Excel Spreadsheet (.xlsx)'), id: 'downloadas-xlsx', type: 'action'},
@ -903,7 +907,8 @@ L.Control.Menubar = L.Control.extend({
]},
{name: !window.ThisIsAMobileApp ? _('Download as') : _('Export as'), id: 'downloadas', type: 'menu', menu: [
{name: _('PDF Document (.pdf)'), id: !window.ThisIsAMobileApp ? 'exportpdf' : 'downloadas-pdf', type: 'action'},
{name: _('PDF Document (.pdf)'), id: !window.ThisIsAMobileApp ? 'exportdirectpdf' : 'downloadas-direct-pdf', type: 'action'},
{name: _('PDF Document (.pdf) - Expert'), id: !window.ThisIsAMobileApp ? 'exportpdf' : 'downloadas-pdf', type: 'action'},
{name: _('ODF text document (.odt)'), id: 'downloadas-odt', type: 'action'},
{name: _('Word 2003 Document (.doc)'), id: 'downloadas-doc', type: 'action'},
{name: _('Word Document (.docx)'), id: 'downloadas-docx', type: 'action'},
@ -964,7 +969,8 @@ L.Control.Menubar = L.Control.extend({
{name: _UNO('.uno:SetDocumentProperties', 'presentation'), uno: '.uno:SetDocumentProperties', id: 'properties'}
]},
{name: !window.ThisIsAMobileApp ? _('Download as') : _('Export as'), id:'downloadas', type: 'menu', menu: [
{name: _('PDF Document (.pdf)'), id: !window.ThisIsAMobileApp ? 'exportpdf' : 'downloadas-pdf', type: 'action'},
{name: _('PDF Document (.pdf)'), id: !window.ThisIsAMobileApp ? 'exportdirectpdf' : 'downloadas-direct-pdf', type: 'action'},
{name: _('PDF Document (.pdf) - Expert'), id: !window.ThisIsAMobileApp ? 'exportpdf' : 'downloadas-pdf', type: 'action'},
{name: _('ODF presentation (.odp)'), id: 'downloadas-odp', type: 'action'},
{name: _('PowerPoint 2003 Presentation (.ppt)'), id: 'downloadas-ppt', type: 'action'},
{name: _('PowerPoint Presentation (.pptx)'), id: 'downloadas-pptx', type: 'action'},
@ -1023,7 +1029,8 @@ L.Control.Menubar = L.Control.extend({
{name: _UNO('.uno:SetDocumentProperties', 'presentation'), uno: '.uno:SetDocumentProperties', id: 'properties'}
]},
{name: !window.ThisIsAMobileApp ? _('Download as') : _('Export as'), id:'downloadas', type: 'menu', menu: [
{name: _('PDF Document (.pdf)'), id: !window.ThisIsAMobileApp ? 'exportpdf' : 'downloadas-pdf', type: 'action'},
{name: _('PDF Document (.pdf)'), id: !window.ThisIsAMobileApp ? 'exportdirectpdf' : 'downloadas-direct-pdf', type: 'action'},
{name: _('PDF Document (.pdf) - Expert'), id: !window.ThisIsAMobileApp ? 'exportpdf' : 'downloadas-pdf', type: 'action'},
{name: _('ODF Drawing (.odg)'), id: 'downloadas-odg', type: 'action'}
]},
{name: _UNO('.uno:EditMenu', 'presentation'), id: 'editmenu', type: 'menu', menu: [
@ -1076,7 +1083,8 @@ L.Control.Menubar = L.Control.extend({
{name: _UNO('.uno:SetDocumentProperties', 'spreadsheet'), uno: '.uno:SetDocumentProperties', id: 'properties'}
]},
{name: !window.ThisIsAMobileApp ? _('Download as') : _('Export as'), id:'downloadas', type: 'menu', menu: [
{name: _('PDF Document (.pdf)'), id: !window.ThisIsAMobileApp ? 'exportpdf' : 'downloadas-pdf', type: 'action'},
{name: _('PDF Document (.pdf)'), id: !window.ThisIsAMobileApp ? 'exportdirectpdf' : 'downloadas-direct-pdf', type: 'action'},
{name: _('PDF Document (.pdf) - Expert'), id: !window.ThisIsAMobileApp ? 'exportpdf' : 'downloadas-pdf', type: 'action'},
{name: _('ODF spreadsheet (.ods)'), id: 'downloadas-ods', type: 'action'},
{name: _('Excel 2003 Spreadsheet (.xls)'), id: 'downloadas-xls', type: 'action'},
{name: _('Excel Spreadsheet (.xlsx)'), id: 'downloadas-xlsx', type: 'action'}
@ -1250,7 +1258,8 @@ L.Control.Menubar = L.Control.extend({
allowedViewModeActions: [
'savecomments', 'shareas', 'print', // file menu
'downloadas-odt', 'downloadas-doc', 'downloadas-docx', 'downloadas-rtf', // file menu
'downloadas-odp', 'downloadas-ppt', 'downloadas-pptx', 'downloadas-odg', !window.ThisIsAMobileApp ? 'exportpdf' : 'downloadas-pdf', !window.ThisIsAMobileApp ? 'exportepub' : 'downloadas-epub', // file menu
'downloadas-odp', 'downloadas-ppt', 'downloadas-pptx', 'downloadas-odg', !window.ThisIsAMobileApp ? 'exportpdf' : 'downloadas-pdf', // file menu
!window.ThisIsAMobileApp ? 'exportdirectpdf' : 'downloadas-direct-pdf', !window.ThisIsAMobileApp ? 'exportepub' : 'downloadas-epub', // file menu
'downloadas-ods', 'downloadas-xls', 'downloadas-xlsx', 'downloadas-csv', 'closedocument', // file menu
'fullscreen', 'zoomin', 'zoomout', 'zoomreset', 'showstatusbar', 'showresolved', 'toggledarktheme', // view menu
'about', 'keyboard-shortcuts', 'latestupdates', 'feedback', 'online-help', 'report-an-issue', // help menu

View File

@ -599,8 +599,13 @@ L.Control.NotebookbarBuilder = L.Control.JSDialogBuilder.extend({
'text': _('CSV File (.csv)')
},
{
'id': !window.ThisIsAMobileApp ? 'exportpdf' : 'downloadas-pdf',
'id': !window.ThisIsAMobileApp ? 'exportdirectpdf' : 'downloadas-direct-pdf',
'text': _('PDF Document (.pdf)'),
'command': !window.ThisIsAMobileApp ? 'exportdirectpdf' : 'downloadas-direct-pdf'
},
{
'id': !window.ThisIsAMobileApp ? 'exportpdf' : 'downloadas-pdf',
'text': _('PDF Document (.pdf) - Expert'),
'command': !window.ThisIsAMobileApp ? 'exportpdf' : 'downloadas-pdf'
}
];
@ -623,8 +628,13 @@ L.Control.NotebookbarBuilder = L.Control.JSDialogBuilder.extend({
'text': _('PowerPoint 2003 Presentation (.ppt)')
},
{
'id': !window.ThisIsAMobileApp ? 'exportpdf' : 'downloadas-pdf',
'id': !window.ThisIsAMobileApp ? 'exportdirectpdf' : 'downloadas-direct-pdf',
'text': _('PDF Document (.pdf)'),
'command': !window.ThisIsAMobileApp ? 'exportdirectpdf' : 'downloadas-direct-pdf'
},
{
'id': !window.ThisIsAMobileApp ? 'exportpdf' : 'downloadas-pdf',
'text': _('PDF Document (.pdf) - Expert'),
'command': !window.ThisIsAMobileApp ? 'exportpdf' : 'downloadas-pdf'
}
];

View File

@ -182,21 +182,6 @@ L.Control.NotebookbarCalc = L.Control.NotebookbarWriter.extend({
'type': 'bigmenubartoolitem',
'text': _('Download')
});
if (hasRepair) {
content.push({
'type': 'container',
'children': [
{
'id': 'repair',
'type': 'bigmenubartoolitem',
'text': _('Repair'),
'command': _('Repair')
}
],
'vertical': 'true'
});
}
} else if (!hideDownload) {
content = content.concat([
{
@ -242,23 +227,26 @@ L.Control.NotebookbarCalc = L.Control.NotebookbarWriter.extend({
'type': 'container',
'children': [
{
'id': !window.ThisIsAMobileApp ? 'exportpdf' : 'downloadas-pdf',
'id': !window.ThisIsAMobileApp ? 'exportdirectpdf' : 'downloadas-direct-pdf',
'type': 'customtoolitem',
'text': _('PDF Document (.pdf)'),
'command': !window.ThisIsAMobileApp ? 'exportdirectpdf' : 'downloadas-direct-pdf',
'inlineLabel': true
},
{
'id': !window.ThisIsAMobileApp ? 'exportpdf' : 'downloadas-pdf',
'type': 'customtoolitem',
'text': _('PDF Document (.pdf) - Expert'),
'command': !window.ThisIsAMobileApp ? 'exportpdf' : 'downloadas-pdf',
'inlineLabel': true
},
hasRepair? {
'id': 'repair',
'type': 'menubartoolitem',
'text': _('Repair'),
'command': _('Repair')
} : {}
],
'vertical': 'true'
}
]);
} else if (hasRepair) {
}
if (hasRepair) {
content.push({
'type': 'container',
'children': [

View File

@ -206,23 +206,39 @@ L.Control.NotebookbarDraw = L.Control.NotebookbarImpress.extend({
'type': 'container',
'children': [
{
'id': !window.ThisIsAMobileApp ? 'exportpdf' : 'downloadas-pdf',
'id': !window.ThisIsAMobileApp ? 'exportdirectpdf' : 'downloadas-direct-pdf',
'type': 'customtoolitem',
'text': _('PDF Document (.pdf)'),
'command': !window.ThisIsAMobileApp ? 'exportdirectpdf' : 'downloadas-direct-pdf',
'inlineLabel': true
},
{
'id': !window.ThisIsAMobileApp ? 'exportpdf' : 'downloadas-pdf',
'type': 'customtoolitem',
'text': _('PDF Document (.pdf) - Expert'),
'command': !window.ThisIsAMobileApp ? 'exportpdf' : 'downloadas-pdf',
'inlineLabel': true
},
hasRepair? {
'id': 'repair',
'type': 'menubartoolitem',
'text': _('Repair'),
'command': _('Repair')
} : {}
],
'vertical': 'true'
}
];
if (hasRepair) {
content.push({
'type': 'container',
'children': [
{
'id': 'repair',
'type': 'bigtoolitem',
'text': _('Repair'),
'command': _('Repair')
}
]
});
}
content.push({
'type': 'container',
'children': [

View File

@ -295,26 +295,41 @@ L.Control.NotebookbarImpress = L.Control.NotebookbarWriter.extend({
'vertical': 'true'
},
{
'id': 'file-exportpdf',
'id': 'file-exportdirectpdf',
'type': 'container',
'children': [
{
'id': !window.ThisIsAMobileApp ? 'exportpdf' : 'downloadas-pdf',
'id': !window.ThisIsAMobileApp ? 'exportdirectpdf' : 'downloadas-direct-pdf',
'type': 'customtoolitem',
'text': _('PDF Document (.pdf)'),
'command': !window.ThisIsAMobileApp ? 'exportdirectpdf' : 'downloadas-direct-pdf',
'inlineLabel': true
},
{
'id': !window.ThisIsAMobileApp ? 'exportpdf' : 'downloadas-pdf',
'type': 'customtoolitem',
'text': _('PDF Document (.pdf) - Expert'),
'command': !window.ThisIsAMobileApp ? 'exportpdf' : 'downloadas-pdf',
'inlineLabel': true
},
hasRepair? {
'id': 'repair',
'type': 'menubartoolitem',
'text': _('Repair'),
'command': _('Repair')
} : {}
],
'vertical': 'true'
}
]);
if (hasRepair) {
content.push({
'type': 'container',
'children': [
{
'id': 'repair',
'type': 'bigmenubartoolitem',
'text': _('Repair'),
'command': _('Repair')
}
],
'vertical': 'true'
});
}
} else if (hasRepair) {
content.push({
'type': 'container',

View File

@ -105,6 +105,9 @@ L.Control.NotebookbarWriter = L.Control.Notebookbar.extend({
var hasSave = !this._map['wopi'].HideSaveOption;
var content = [];
var addRepairToDownloads = hasRepair && !hideDownload;
var addRepairToColumn = hasRepair && (hideDownload || hasGroupedDownloadAs);
if (hasSave) {
content.push({
'type': 'toolbox',
@ -236,12 +239,25 @@ L.Control.NotebookbarWriter = L.Control.Notebookbar.extend({
'type': 'container',
'children': [
{
'id': !window.ThisIsAMobileApp ? 'exportpdf' : 'downloadas-pdf',
'id': !window.ThisIsAMobileApp ? 'exportdirectpdf' : 'downloadas-direct-pdf',
'type': 'customtoolitem',
'text': _('PDF Document (.pdf)'),
'command': !window.ThisIsAMobileApp ? 'exportdirectpdf' : 'downloadas-direct-pdf',
'inlineLabel': true
},
{
'id': !window.ThisIsAMobileApp ? 'exportpdf' : 'downloadas-pdf',
'type': 'customtoolitem',
'text': _('PDF Document (.pdf) - Expert'),
'command': !window.ThisIsAMobileApp ? 'exportpdf' : 'downloadas-pdf',
'inlineLabel': true
},
],
'vertical': 'true'
},
{
'type': 'container',
'children': [
{
'id': !window.ThisIsAMobileApp ? 'exportepub' : 'downloadas-epub',
'type': 'customtoolitem',
@ -249,24 +265,32 @@ L.Control.NotebookbarWriter = L.Control.Notebookbar.extend({
'command': !window.ThisIsAMobileApp ? 'exportepub' : 'downloadas-epub',
'inlineLabel': true
},
addRepairToDownloads? {
'id': 'repair',
'type': 'menubartoolitem',
'text': _('Repair'),
'command': _('Repair')
} : {}
],
'vertical': 'true'
}
]);
}
content.push({
'type': 'container',
'children': [
hasRepair? {
'id': 'repair',
'type': 'bigmenubartoolitem',
'text': _('Repair'),
'command': _('Repair')
} : {},
],
'vertical': 'true'
});
if (addRepairToColumn) {
content.push({
'type': 'container',
'children': [
{
'id': 'repair',
'type': 'bigmenubartoolitem',
'text': _('Repair'),
'command': _('Repair')
}
],
'vertical': 'true'
});
}
content.push({
'type': 'container',