Bug 153683 - CLI: Show the module which is used in --convert-to
Summary: CLI: Show the module which is used in --convert-to
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium enhancement
Assignee: Baole Fang
URL: https://ask.libreoffice.org/t/convert...
Whiteboard: target:7.6.0
Keywords: difficultyMedium, easyHack, skillCpp
Depends on:
Blocks:
 
Reported: 2023-02-17 06:54 UTC by Mike Kaganski
Modified: 2023-03-18 18:07 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Kaganski 2023-02-17 06:54:32 UTC
In command-line interface, --convert-to prints some diagnostics. E.g., this command:

> soffice --convert-to "txt:Text (encoded):UTF8" myfile

would produce this diagnostic:

> convert /path/to/myfile -> /path/to/myfile.txt using filter : Text (encoded):UTF8

If 'myfile' happens to be opened in a module other than Writer (say, it's a PDF or ODS), then conversion would fail like this:

> Error: Please verify input parameters... (SfxBaseModel::impl_store
> <file:///path/to/myfile.txt> failed: 0xc10(Error Area:Io Class:Write Code:16))

And there is no hint to user, what the problem was. See e.g. https://ask.libreoffice.org/t/convert-to-txt-text-encoded-utf8-fails/88123.

The proposal is to print the module that is used to import the source document, which defines which export filters are available. This could look like:

> convert /path/to/myfile -> /path/to/myfile.txt as a Draw document
> using filter : Text (encoded):UTF8

and should be done in desktop/source/app/dispatchwatcher.cxx [1] by examining the implemented service of xModel.

[1] https://opengrok.libreoffice.org/xref/core/desktop/source/app/dispatchwatcher.cxx?r=1f59cbe6&mo=29729&fi=667#667
Comment 1 Baole Fang 2023-03-15 03:17:49 UTC
Reproduced:

Version: 7.6.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 008488789092ce980ae9ba029ae375556cfca78f
CPU threads: 12; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-US (en_US.UTF-8); UI: en-US
Calc: threaded

Start working on this.
Comment 2 Commit Notification 2023-03-16 06:37:07 UTC
Baole Fang committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/80d5d2eb70fd84e98cbe19cd4363d12d50ec31f6

tdf#153683: Show the used module in --convert-to

It will be available in 7.6.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 3 Commit Notification 2023-03-17 19:52:55 UTC
Baole Fang committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/70b8adb100499178ad52f23f7c0a1b7a31129921

tdf#153683: Refactor fix

It will be available in 7.6.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.