[Libreoffice-commits] core.git: include/svx svx/source sw/source sw/uiconfig
shubham656 (via logerrit)
logerrit at kemper.freedesktop.org
Thu Jan 14 06:32:40 UTC 2021
include/svx/graphichelper.hxx | 1
svx/source/core/graphichelper.cxx | 41 +++++++++++++++
svx/source/dialog/compressgraphicdialog.cxx | 41 +--------------
sw/source/ui/frmdlg/frmpage.cxx | 7 ++
sw/source/uibase/inc/frmpage.hxx | 2
sw/uiconfig/swriter/ui/picturepage.ui | 73 ++++++++++++++++++++++++++++
6 files changed, 127 insertions(+), 38 deletions(-)
New commits:
commit e7842148f5fa6f9af9312cb4b198a4a5340e3d9b
Author: shubham656 <shubham656jain at gmail.com>
AuthorDate: Sun Dec 27 03:41:24 2020 +0530
Commit: Jim Raykowski <raykowj at gmail.com>
CommitDate: Thu Jan 14 07:32:01 2021 +0100
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 at gmail.com>
diff --git a/include/svx/graphichelper.hxx b/include/svx/graphichelper.hxx
index b582de4a2669..2f723b830493 100644
--- a/include/svx/graphichelper.hxx
+++ b/include/svx/graphichelper.hxx
@@ -32,6 +32,7 @@ class SVXCORE_DLLPUBLIC GraphicHelper
public:
static void GetPreferredExtension( OUString& rExtension, const Graphic& rGraphic );
+ static OUString GetImageType(const Graphic& rGraphic);
static OUString ExportGraphic(weld::Window* pWin, const Graphic& rGraphic, const OUString& rGraphicName);
static void SaveShapeAsGraphic(weld::Window* pWin, const css::uno::Reference< css::drawing::XShape >& xShape);
static short HasToSaveTransformedImage(weld::Widget* pWin);
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() );
diff --git a/sw/source/ui/frmdlg/frmpage.cxx b/sw/source/ui/frmdlg/frmpage.cxx
index 2581e70eb272..5b4c8fb1f5cd 100644
--- a/sw/source/ui/frmdlg/frmpage.cxx
+++ b/sw/source/ui/frmdlg/frmpage.cxx
@@ -63,6 +63,7 @@
#include <strings.hrc>
#include <svx/strings.hrc>
#include <svx/dialmgr.hxx>
+#include <svx/graphichelper.hxx>
#include <sfx2/filedlghelper.hxx>
#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
#include <com/sun/star/ui/dialogs/XFilePicker3.hpp>
@@ -2314,6 +2315,8 @@ SwGrfExtPage::SwGrfExtPage(weld::Container* pPage, weld::DialogController* pCont
, m_xCtlAngle(new svx::DialControl)
, m_xCtlAngleWin(new weld::CustomWeld(*m_xBuilder, "CTL_ANGLE", *m_xCtlAngle))
, m_xBmpWin(new weld::CustomWeld(*m_xBuilder, "preview", m_aBmpWin))
+ // tdf#138843 place holder for the graphic type
+ , m_xLabelGraphicType(m_xBuilder->weld_label("label-graphic-type"))
{
m_aBmpWin.SetBitmapEx(BitmapEx(RID_BMP_PREVIEW_FALLBACK));
@@ -2434,7 +2437,10 @@ void SwGrfExtPage::ActivatePage(const SfxItemSet& rSet)
}
const Graphic* pGrf = rBrush.GetGraphic(referer);
if( pGrf )
+ {
m_aBmpWin.SetGraphic( *pGrf );
+ m_xLabelGraphicType->set_label(GraphicHelper::GetImageType(*pGrf));
+ }
}
m_xConnectED->save_value();
@@ -2544,6 +2550,7 @@ IMPL_LINK_NOARG(SwGrfExtPage, BrowseHdl, weld::Button&, void)
Graphic aGraphic;
(void)GraphicFilter::LoadGraphic(m_xGrfDlg->GetPath(), OUString(), aGraphic);
m_aBmpWin.SetGraphic(aGraphic);
+ m_xLabelGraphicType->set_label(GraphicHelper::GetImageType(aGraphic));
bool bEnable = GraphicType::Bitmap == aGraphic.GetType() ||
GraphicType::GdiMetafile == aGraphic.GetType();
diff --git a/sw/source/uibase/inc/frmpage.hxx b/sw/source/uibase/inc/frmpage.hxx
index 077e088b0bc2..63d6e5bf1e78 100644
--- a/sw/source/uibase/inc/frmpage.hxx
+++ b/sw/source/uibase/inc/frmpage.hxx
@@ -221,6 +221,8 @@ class SwGrfExtPage : public SfxTabPage
std::unique_ptr<weld::CustomWeld> m_xCtlAngleWin;
std::unique_ptr<weld::CustomWeld> m_xBmpWin;
+ // tdf#138843 add place holder for the graphic type
+ std::unique_ptr<weld::Label> m_xLabelGraphicType;
// handler for mirroring
DECL_LINK(MirrorHdl, weld::ToggleButton&, void);
diff --git a/sw/uiconfig/swriter/ui/picturepage.ui b/sw/uiconfig/swriter/ui/picturepage.ui
index df6c0c12e5c2..87eec3bac33d 100644
--- a/sw/uiconfig/swriter/ui/picturepage.ui
+++ b/sw/uiconfig/swriter/ui/picturepage.ui
@@ -389,6 +389,79 @@
<property name="width">2</property>
</packing>
</child>
+ <child>
+ <object class="GtkFrame" id="infoframe">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label_xalign">0</property>
+ <property name="shadow_type">none</property>
+ <child>
+ <object class="GtkAlignment" id="alignment3">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="top_padding">6</property>
+ <property name="left_padding">12</property>
+ <child>
+ <!-- n-columns=1 n-rows=1 -->
+ <object class="GtkGrid" id="grid3">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="valign">start</property>
+ <property name="row_spacing">3</property>
+ <property name="column_spacing">12</property>
+ <child>
+ <object class="GtkLabel" id="label15">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes" context="picturepage|label15">Type:</property>
+ <property name="single_line_mode">True</property>
+ <property name="xalign">0</property>
+ <accessibility>
+ <relation type="label-for" target="label-graphic-type"/>
+ </accessibility>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label-graphic-type">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="label">???</property>
+ <property name="xalign">0</property>
+ <accessibility>
+ <relation type="labelled-by" target="label15"/>
+ </accessibility>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child type="label">
+ <object class="GtkLabel" id="label16">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes" context="picturepage|label16">Image Information</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">3</property>
+ <property name="width">2</property>
+ </packing>
+ </child>
<child internal-child="accessible">
<object class="AtkObject" id="PicturePage-atkobject">
<property name="AtkObject::accessible-description" translatable="yes" context="picturepage|extended_tip|PicturePage">Specify the flip and the link options for the selected image.</property>
More information about the Libreoffice-commits
mailing list