diff options
author | Baole Fang <baole.fang@gmail.com> | 2023-03-15 01:51:12 -0400 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-03-16 06:36:22 +0000 |
commit | 80d5d2eb70fd84e98cbe19cd4363d12d50ec31f6 (patch) | |
tree | 254e2adc5ceda4c84e61db008a991aec6807e62d | |
parent | dcf65e4ce94840ea2072eb968a30c81ded0f21cf (diff) |
tdf#153683: Show the used module in --convert-to
Implements getName that returns the module name.
When outputs the convert-to message, module name is included.
Change-Id: Ic18d8899d160e9c1afa8801dc07120f5ef822d07
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148905
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | desktop/source/app/dispatchwatcher.cxx | 44 |
1 files changed, 43 insertions, 1 deletions
diff --git a/desktop/source/app/dispatchwatcher.cxx b/desktop/source/app/dispatchwatcher.cxx index 5b7fd944fee9..f314fcd0ff4b 100644 --- a/desktop/source/app/dispatchwatcher.cxx +++ b/desktop/source/app/dispatchwatcher.cxx @@ -284,6 +284,47 @@ void batchPrint( std::u16string_view rPrinterName, const Reference< XPrintable > xDoc->print( aPrinterArgs ); } +// Get xDoc module name +OUString getName(const Reference< XPrintable > & xDoc) +{ + OUString aDocService; + Reference< XModel > xModel( xDoc, UNO_QUERY ); + const Reference<XServiceInfo> xServiceInfo(xModel, UNO_QUERY_THROW); + if ( xModel.is() ) + { + utl::MediaDescriptor aMediaDesc( xModel->getArgs() ); + aDocService = aMediaDesc.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_DOCUMENTSERVICE, OUString() ); + } + OString aModuleId = OUStringToOString(aDocService, osl_getThreadTextEncoding()); + if (aModuleId == "com.sun.star.text.TextDocument" + || aModuleId == "com.sun.star.text.GlobalDocument") + return "Writer"; + else if (aModuleId == "com.sun.star.text.WebDocument") + return "Writer/Web"; + else if (aModuleId == "com.sun.star.drawing.DrawingDocument") + return "Draw"; + else if (aModuleId == "com.sun.star.presentation.PresentationDocument") + return "Impress"; + else if (aModuleId == "com.sun.star.sheet.SpreadsheetDocument") + return "Calc"; + else if (aModuleId == "com.sun.star.script.BasicIDE") + return "Basic"; + else if (aModuleId == "com.sun.star.formula.FormulaProperties") + return "Math"; + else if (aModuleId == "com.sun.star.sdb.RelationDesign") + return "Relation Design"; + else if (aModuleId == "com.sun.star.sdb.QueryDesign") + return "Query Design"; + else if (aModuleId == "com.sun.star.sdb.TableDesign") + return "Table Design"; + else if (aModuleId == "com.sun.star.sdb.DataSourceBrowser") + return "Data Source Browser"; + else if (aModuleId == "com.sun.star.sdb.DatabaseDocument") + return "Database"; + + return OUString(); +} + } // anonymous namespace DispatchWatcher::DispatchWatcher() @@ -661,9 +702,10 @@ bool DispatchWatcher::executeDispatchRequests( const std::vector<DispatchRequest OString aTargetURL8 = OUStringToOString(aTempName, osl_getThreadTextEncoding()); if (aDispatchRequest.aRequestType != REQUEST_CAT) { + OUString name=getName(xDoc); std::cout << "convert " << aSource8; if (!bMultiFileTarget) - std::cout << " -> " << aTargetURL8; + std::cout << " -> " << aTargetURL8 << " as a " << name <<" document"; std::cout << " using filter : " << OUStringToOString(aFilter, osl_getThreadTextEncoding()) << std::endl; if (!bMultiFileTarget && FStatHelper::IsDocument(aOutFile)) std::cout << "Overwriting: " << OUStringToOString(aTempName, osl_getThreadTextEncoding()) << std::endl ; |