diff options
author | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2018-01-12 17:32:41 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2018-01-16 13:42:29 +0100 |
commit | 94f02cf29aedcf3187f04accfa7be87988a80cb0 (patch) | |
tree | 31c90a70ae67025f7d5aa2e6e9b7233165b9c101 /xmloff | |
parent | 462113d4f712c5acf18ecfb0be6a86aa891d7b97 (diff) |
tdf#114488 Rank multiple images also for flat odf
Only the file extension was considered before
which is not available in flat odf.
Now both internal and external URLs are resolved to their respective mimetype.
Change-Id: Id7e290cd9a441a1a6c2ce5e8d764391c50495bea
Reviewed-on: https://gerrit.libreoffice.org/47824
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
(cherry picked from commit 3da86d8987db6223b0acc5d8a1b56f7e0c54bbef)
Reviewed-on: https://gerrit.libreoffice.org/47900
Reviewed-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/source/core/xmlmultiimagehelper.cxx | 37 |
1 files changed, 28 insertions, 9 deletions
diff --git a/xmloff/source/core/xmlmultiimagehelper.cxx b/xmloff/source/core/xmlmultiimagehelper.cxx index 3a5ad69d4c65..3d7725a3b24f 100644 --- a/xmloff/source/core/xmlmultiimagehelper.cxx +++ b/xmloff/source/core/xmlmultiimagehelper.cxx @@ -20,48 +20,67 @@ #include <rtl/ustring.hxx> #include <xmlmultiimagehelper.hxx> +#include <comphelper/graphicmimetype.hxx> + using namespace ::com::sun::star; namespace { sal_uInt32 getQualityIndex(const OUString& rString) { + OUString sMimeType; + if (rString.startsWith("vnd.sun.star.GraphicObject")) + { + sMimeType = comphelper::GraphicMimeTypeHelper::GetMimeTypeForImageUrl(rString); + } + else if (rString.startsWith("vnd.sun.star.Package")) + { + sMimeType + = comphelper::GraphicMimeTypeHelper::GetMimeTypeForExtension(OUStringToOString( + rString.copy(rString.lastIndexOf(".") + 1), RTL_TEXTENCODING_ASCII_US)); + } + else + { + SAL_WARN("xmloff", "Unknown image source: " << rString); + return 0; + } + // pixel formats first - if(rString.endsWith(".bmp")) + if(sMimeType == "image/bmp") { return 10; } - if(rString.endsWith(".gif")) + if(sMimeType == "image/gif") { return 20; } - if(rString.endsWith(".jpg")) + if(sMimeType == "image/jpeg") { return 30; } - if(rString.endsWith(".png")) + if(sMimeType == "image/png") { return 40; } // vector formats, prefer always - if(rString.endsWith(".svm")) + if(sMimeType == "image/x-svm") { return 1000; } - if(rString.endsWith(".wmf")) + if(sMimeType == "image/x-wmf") { return 1010; } - if(rString.endsWith(".emf")) + if(sMimeType == "image/x-emf") { return 1020; } - if(rString.endsWith(".pdf")) + if(sMimeType == "application/pdf") { return 1030; } - if(rString.endsWith(".svg")) + if(sMimeType == "image/svg+xml") { return 1040; } |