20#include <rtl/ustring.hxx>
29 OUString getMimeTypeForURL(std::u16string_view rString)
34 OString aExtension =
OUStringToOString(rString.substr(rString.rfind(
'.') + 1), RTL_TEXTENCODING_ASCII_US);
40 sal_uInt32 getQualityIndex(std::u16string_view rMimeType)
43 if (rMimeType == u
"image/bmp")
47 if (rMimeType == u
"image/gif")
51 if (rMimeType == u
"image/jpeg")
55 if (rMimeType == u
"image/png")
61 if (rMimeType == u
"image/x-vclgraphic")
65 if (rMimeType == u
"image/x-svm")
69 if (rMimeType == u
"image/x-wmf")
73 if (rMimeType == u
"image/x-emf")
77 if (rMimeType == u
"image/x-eps")
81 if (rMimeType == u
"application/pdf")
85 if (rMimeType == u
"image/svg+xml")
95: mbSupportsMultipleContents(false)
110 std::vector<SvXMLImportContextRef>::size_type nIndexOfPreferred(
maImplContextVector.size());
111 sal_uInt32 nBestQuality(0);
121 if (!aStreamURL.isEmpty())
123 sMimeType = getMimeTypeForURL(aStreamURL);
132 sal_uInt32 nNewQuality = getQualityIndex(sMimeType);
133 if (nNewQuality > nBestQuality)
135 nBestQuality = nNewQuality;
136 nIndexOfPreferred =
a;
147 const std::vector< SvXMLImportContextRef >::iterator aRemove(
maImplContextVector.begin() + nIndexOfPreferred);
virtual void removeGraphicFromImportContext(const SvXMLImportContext &rContext)=0
helper to get the created xShape instance, override this
std::vector< SvXMLImportContextRef > maImplContextVector
virtual OUString getGraphicPackageURLFromImportContext(const SvXMLImportContext &rContext) const =0
virtual ~MultiImageImportHelper()
virtual css::uno::Reference< css::graphic::XGraphic > getGraphicFromImportContext(const SvXMLImportContext &rContext) const =0
SvXMLImportContextRef solveMultipleImages()
solve multiple imported images.
void addContent(const SvXMLImportContext &rSvXMLImportContext)
add a content to the remembered image import contexts
This class deliberately does not support XWeak, to improve performance when loading large documents.
static OUString GetMimeTypeForXGraphic(const css::uno::Reference< css::graphic::XGraphic > &xGraphic)
static OUString GetMimeTypeForExtension(std::string_view rExt)
constexpr bool starts_with(std::basic_string_view< charT, traits > sv, std::basic_string_view< charT, traits > x) noexcept
OString OUStringToOString(std::u16string_view str, ConnectionSettings const *settings)