diff options
author | shubham656 <shubham656jain@gmail.com> | 2020-12-27 03:41:24 +0530 |
---|---|---|
committer | Jim Raykowski <raykowj@gmail.com> | 2021-01-14 07:32:01 +0100 |
commit | e7842148f5fa6f9af9312cb4b198a4a5340e3d9b (patch) | |
tree | e707ef50dbdcebe6e61fcae3e76b2e38328b8f22 /svx | |
parent | 9f9798f07f0b56ae474f31ded671cc8da598d244 (diff) |
tdf#138843 Show image file type inside image properties dialog
Change-Id: I77adc9c3cc9d3bd62f0f67345b7a025bcad2352a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108361
Tested-by: Jenkins
Reviewed-by: Jim Raykowski <raykowj@gmail.com>
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/core/graphichelper.cxx | 41 | ||||
-rw-r--r-- | svx/source/dialog/compressgraphicdialog.cxx | 41 |
2 files changed, 44 insertions, 38 deletions
diff --git a/svx/source/core/graphichelper.cxx b/svx/source/core/graphichelper.cxx index fb483c5bfe54..8485b0e0df3b 100644 --- a/svx/source/core/graphichelper.cxx +++ b/svx/source/core/graphichelper.cxx @@ -123,6 +123,47 @@ void GraphicHelper::GetPreferredExtension( OUString& rExtension, const Graphic& rExtension = aExtension; } +OUString GraphicHelper::GetImageType(const Graphic& rGraphic) +{ + OUString aGraphicTypeString = SvxResId(STR_IMAGE_UNKNOWN); + auto pGfxLink = rGraphic.GetSharedGfxLink(); + if (pGfxLink) + { + switch (pGfxLink->GetType()) + { + case GfxLinkType::NativeGif: + aGraphicTypeString = SvxResId(STR_IMAGE_GIF); + break; + case GfxLinkType::NativeJpg: + aGraphicTypeString = SvxResId(STR_IMAGE_JPEG); + break; + case GfxLinkType::NativePng: + aGraphicTypeString = SvxResId(STR_IMAGE_PNG); + break; + case GfxLinkType::NativeTif: + aGraphicTypeString = SvxResId(STR_IMAGE_TIFF); + break; + case GfxLinkType::NativeWmf: + aGraphicTypeString = SvxResId(STR_IMAGE_WMF); + break; + case GfxLinkType::NativeMet: + aGraphicTypeString = SvxResId(STR_IMAGE_MET); + break; + case GfxLinkType::NativePct: + aGraphicTypeString = SvxResId(STR_IMAGE_PCT); + break; + case GfxLinkType::NativeSvg: + aGraphicTypeString = SvxResId(STR_IMAGE_SVG); + break; + case GfxLinkType::NativeBmp: + aGraphicTypeString = SvxResId(STR_IMAGE_BMP); + break; + default: + break; + } + } + return aGraphicTypeString; +} namespace { diff --git a/svx/source/dialog/compressgraphicdialog.cxx b/svx/source/dialog/compressgraphicdialog.cxx index 856f7aa4e92a..4c244d8eacef 100644 --- a/svx/source/dialog/compressgraphicdialog.cxx +++ b/svx/source/dialog/compressgraphicdialog.cxx @@ -29,6 +29,7 @@ #include <svx/svdograf.hxx> #include <svx/sdgcpitm.hxx> #include <svx/dialmgr.hxx> +#include <svx/graphichelper.hxx> #include <svx/compressgraphicdialog.hxx> #include <sfx2/dispatch.hxx> #include <sfx2/module.hxx> @@ -121,45 +122,9 @@ void CompressGraphicsDialog::Initialize() void CompressGraphicsDialog::Update() { - OUString aGraphicTypeString = SvxResId(STR_IMAGE_UNKNOWN); - auto pGfxLink = m_aGraphic.GetSharedGfxLink(); - if (pGfxLink) - { - switch (pGfxLink->GetType()) - { - case GfxLinkType::NativeGif: - aGraphicTypeString = SvxResId(STR_IMAGE_GIF); - break; - case GfxLinkType::NativeJpg: - aGraphicTypeString = SvxResId(STR_IMAGE_JPEG); - break; - case GfxLinkType::NativePng: - aGraphicTypeString = SvxResId(STR_IMAGE_PNG); - break; - case GfxLinkType::NativeTif: - aGraphicTypeString = SvxResId(STR_IMAGE_TIFF); - break; - case GfxLinkType::NativeWmf: - aGraphicTypeString = SvxResId(STR_IMAGE_WMF); - break; - case GfxLinkType::NativeMet: - aGraphicTypeString = SvxResId(STR_IMAGE_MET); - break; - case GfxLinkType::NativePct: - aGraphicTypeString = SvxResId(STR_IMAGE_PCT); - break; - case GfxLinkType::NativeSvg: - aGraphicTypeString = SvxResId(STR_IMAGE_SVG); - break; - case GfxLinkType::NativeBmp: - aGraphicTypeString = SvxResId(STR_IMAGE_BMP); - break; - default: - break; - } - } - m_xLabelGraphicType->set_label(aGraphicTypeString); + + m_xLabelGraphicType->set_label(GraphicHelper::GetImageType(m_aGraphic)); const FieldUnit eFieldUnit = m_rBindings.GetDispatcher()->GetModule()->GetFieldUnit(); const LocaleDataWrapper& rLocaleWrapper( Application::GetSettings().GetLocaleDataWrapper() ); |