[Libreoffice-commits] core.git: include/svx svx/source sw/source sw/uiconfig

2021-01-13 Thread shubham656 (via logerrit)
 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 
AuthorDate: Sun Dec 27 03:41:24 2020 +0530
Commit: Jim Raykowski 
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 

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 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -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;
- 

[Libreoffice-commits] core.git: include/svx svx/source sw/source sw/uiconfig

2020-01-17 Thread Caolán McNamara (via logerrit)
 include/svx/dlgctrl.hxx|5 +++
 svx/source/dialog/dlgctrl.cxx  |   14 +
 svx/source/sidebar/paragraph/ParaPropertyPanel.cxx |   31 -
 sw/source/uibase/sidebar/TableEditPanel.cxx|5 +++
 sw/uiconfig/swriter/ui/sidebartableedit.ui |2 -
 5 files changed, 30 insertions(+), 27 deletions(-)

New commits:
commit 16bbfcd1902e63823f6f1a491442b82024def2bc
Author: Caolán McNamara 
AuthorDate: Fri Jan 17 13:44:19 2020 +
Commit: Caolán McNamara 
CommitDate: Fri Jan 17 22:06:22 2020 +0100

limit table spinbuttons width for sidebar

to the same width as the paragraph sidebar spinbuttons

Change-Id: I980545b4186b25cb5ada473095ece8c77f99420a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86992
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/include/svx/dlgctrl.hxx b/include/svx/dlgctrl.hxx
index eb7f19c79f91..eaa31a5d0e3f 100644
--- a/include/svx/dlgctrl.hxx
+++ b/include/svx/dlgctrl.hxx
@@ -413,6 +413,11 @@ public:
 virtual void Paint( vcl::RenderContext& rRenderContext, const 
tools::Rectangle& rRect ) override;
 };
 
+class RelativeField;
+
+SVX_DLLPUBLIC void limitWidthForSidebar(weld::SpinButton& rSpinButton);
+SVX_DLLPUBLIC void limitWidthForSidebar(RelativeField& rMetricSpinButton);
+
 #endif // INCLUDED_SVX_DLGCTRL_HXX
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/dialog/dlgctrl.cxx b/svx/source/dialog/dlgctrl.cxx
index d69a3cceb2f4..b23970a82b61 100644
--- a/svx/source/dialog/dlgctrl.cxx
+++ b/svx/source/dialog/dlgctrl.cxx
@@ -22,6 +22,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1451,4 +1452,17 @@ void SvxXRectPreview::Paint(vcl::RenderContext& 
rRenderContext, const tools::Rec
 rRenderContext.Pop();
 }
 
+void limitWidthForSidebar(weld::SpinButton& rSpinButton)
+{
+// space is limited in the sidebar, so limit MetricSpinButtons to a width 
of 4 digits
+const int nMaxDigits = 4;
+rSpinButton.set_width_chars(std::min(rSpinButton.get_width_chars(), 
nMaxDigits));
+}
+
+void limitWidthForSidebar(RelativeField& rMetricSpinButton)
+{
+weld::SpinButton& rSpinButton = rMetricSpinButton.get_widget();
+limitWidthForSidebar(rSpinButton);
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx 
b/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx
index e22cd4bbda27..0a01b42a8654 100644
--- a/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx
+++ b/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx
@@ -26,6 +26,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -401,18 +402,6 @@ FieldUnit ParaPropertyPanel::GetCurrentUnit( SfxItemState 
eState, const SfxPoolI
 return eUnit;
 }
 
-namespace
-{
-void limitWidth(RelativeField& rMetricSpinButton)
-{
-// space is limited in the sidebar, so limit MetricSpinButtons to a 
width of 4 digits
-const int nMaxDigits = 4;
-
-weld::SpinButton& rSpinButton = rMetricSpinButton.get_widget();
-rSpinButton.set_width_chars(std::min(rSpinButton.get_width_chars(), 
nMaxDigits));
-}
-}
-
 ParaPropertyPanel::ParaPropertyPanel(vcl::Window* pParent,
 const css::uno::Reference& rxFrame,
 SfxBindings* pBindings,
@@ -456,25 +445,17 @@ ParaPropertyPanel::ParaPropertyPanel(vcl::Window* pParent,
   mpBindings(pBindings),
   mxSidebar(rxSidebar)
 {
-#if 0
-mxTopDist->set_size_request(mxTopDist->get_preferred_size().Width(), -1);
-mxBottomDist->set_size_request(mxBottomDist->get_preferred_size().Width(), 
-1);
-mxLeftIndent->set_size_request(mxLeftIndent->get_preferred_size().Width(), 
-1);
-
mxRightIndent->set_size_request(mxRightIndent->get_preferred_size().Width(), 
-1);
-
mxFLineIndent->set_size_request(mxFLineIndent->get_preferred_size().Width(), 
-1);
-#endif
-
 initial();
 m_aMetricCtl.RequestUpdate();
 }
 
 void ParaPropertyPanel::limitMetricWidths()
 {
-limitWidth(*mxTopDist);
-limitWidth(*mxBottomDist);
-limitWidth(*mxLeftIndent);
-limitWidth(*mxRightIndent);
-limitWidth(*mxFLineIndent);
+limitWidthForSidebar(*mxTopDist);
+limitWidthForSidebar(*mxBottomDist);
+limitWidthForSidebar(*mxLeftIndent);
+limitWidthForSidebar(*mxRightIndent);
+limitWidthForSidebar(*mxFLineIndent);
 }
 
 ParaPropertyPanel::~ParaPropertyPanel()
diff --git a/sw/source/uibase/sidebar/TableEditPanel.cxx 
b/sw/source/uibase/sidebar/TableEditPanel.cxx
index 4d09aa4c0794..dcca792db112 100644
--- a/sw/source/uibase/sidebar/TableEditPanel.cxx
+++ b/sw/source/uibase/sidebar/TableEditPanel.cxx
@@ -16,6 +16,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -146,6 +147,8 @@ void TableEditPanel::InitRowHeightToolitem()
 
 m_xRowHeightEdit->set_min(MINLAY, FieldUnit::TWIP);
 

[Libreoffice-commits] core.git: include/svx svx/source sw/source sw/uiconfig

2019-12-19 Thread Caolán McNamara (via logerrit)
 include/svx/samecontentlistbox.hxx   |4 -
 include/svx/spacinglistbox.hxx   |2 
 svx/source/dialog/samecontentlistbox.cxx |   13 +++
 svx/source/dialog/spacinglistbox.cxx |   46 +++
 sw/source/uibase/sidebar/PageFooterPanel.cxx |  107 ++-
 sw/source/uibase/sidebar/PageFooterPanel.hxx |   19 ++--
 sw/uiconfig/swriter/ui/pagefooterpanel.ui|6 -
 7 files changed, 133 insertions(+), 64 deletions(-)

New commits:
commit 0a2b871ccdc5a76f793982bae45cb251c71e4b94
Author: Caolán McNamara 
AuthorDate: Thu Dec 19 13:41:16 2019 +
Commit: Caolán McNamara 
CommitDate: Thu Dec 19 22:08:44 2019 +0100

weld PageFooterPanel

Change-Id: Ice9e7c5ab9c1085021ebb3561cfb2bd0a6727066
Reviewed-on: https://gerrit.libreoffice.org/85526
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/include/svx/samecontentlistbox.hxx 
b/include/svx/samecontentlistbox.hxx
index 842063125d2e..73946e2a3f35 100644
--- a/include/svx/samecontentlistbox.hxx
+++ b/include/svx/samecontentlistbox.hxx
@@ -22,14 +22,16 @@
 
 #include 
 #include 
+#include 
 
 /// Custom Widget ListBox to hold entries for SameContent setting of 
Header/Footer
 class SVX_DLLPUBLIC SameContentListBox final : public ListBox
 {
 public:
 SameContentListBox( vcl::Window* pParent );
+static void Fill(weld::ComboBox& rComboBox);
 Size GetOptimalSize() const override;
 };
 
 #endif
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/spacinglistbox.hxx b/include/svx/spacinglistbox.hxx
index 91e7fa18d777..df8b8c043e19 100644
--- a/include/svx/spacinglistbox.hxx
+++ b/include/svx/spacinglistbox.hxx
@@ -22,6 +22,7 @@
 
 #include 
 #include 
+#include 
 
 enum class SpacingType { SPACING_INCH, MARGINS_INCH, SPACING_CM, MARGINS_CM };
 
@@ -31,6 +32,7 @@ class SVX_DLLPUBLIC SpacingListBox final : public ListBox
 public:
 SpacingListBox( vcl::Window* pParent );
 void Init(SpacingType eType);
+static void Fill(SpacingType eType, weld::ComboBox&);
 Size GetOptimalSize() const override;
 };
 
diff --git a/svx/source/dialog/samecontentlistbox.cxx 
b/svx/source/dialog/samecontentlistbox.cxx
index 29e72df42e73..e1bd38c05669 100644
--- a/svx/source/dialog/samecontentlistbox.cxx
+++ b/svx/source/dialog/samecontentlistbox.cxx
@@ -36,6 +36,19 @@ SameContentListBox::SameContentListBox(vcl::Window* pParent)
 SelectEntryPos(0);
 }
 
+void SameContentListBox::Fill(weld::ComboBox& rComboBox)
+{
+rComboBox.clear();
+for (size_t i = 0; i < SAL_N_ELEMENTS(RID_SVXSTRARY_SAMECONTENT); ++i)
+{
+OUString aStr = SvxResId(RID_SVXSTRARY_SAMECONTENT[i].first);
+sal_uInt32 nData = RID_SVXSTRARY_SAMECONTENT[i].second;
+rComboBox.append(OUString::number(nData), aStr);
+}
+rComboBox.set_active(0);
+rComboBox.set_size_request(150, -1);
+}
+
 VCL_BUILDER_FACTORY(SameContentListBox);
 
 Size SameContentListBox::GetOptimalSize() const
diff --git a/svx/source/dialog/spacinglistbox.cxx 
b/svx/source/dialog/spacinglistbox.cxx
index 90654618f994..ac31393b3a2f 100644
--- a/svx/source/dialog/spacinglistbox.cxx
+++ b/svx/source/dialog/spacinglistbox.cxx
@@ -78,6 +78,52 @@ void SpacingListBox::Init(SpacingType eType)
 SelectEntryPos(nSelected);
 }
 
+void SpacingListBox::Fill(SpacingType eType, weld::ComboBox& rComboBox)
+{
+auto nSelected = rComboBox.get_active();
+if (nSelected == -1)
+nSelected = 0;
+rComboBox.clear();
+
+const LocaleDataWrapper& rLocaleData = 
Application::GetSettings().GetLocaleDataWrapper();
+OUString sSuffix;
+
+const measurement* pResources;
+switch (eType)
+{
+case SpacingType::SPACING_INCH:
+pResources = RID_SVXSTRARY_SPACING_INCH;
+sSuffix = weld::MetricSpinButton::MetricToString(FieldUnit::INCH);
+break;
+case SpacingType::MARGINS_INCH:
+pResources = RID_SVXSTRARY_MARGINS_INCH;
+sSuffix = weld::MetricSpinButton::MetricToString(FieldUnit::INCH);
+break;
+case SpacingType::SPACING_CM:
+pResources = RID_SVXSTRARY_SPACING_CM;
+sSuffix = " " + 
weld::MetricSpinButton::MetricToString(FieldUnit::CM);
+break;
+default:
+case SpacingType::MARGINS_CM:
+sSuffix = " " + 
weld::MetricSpinButton::MetricToString(FieldUnit::CM);
+pResources = RID_SVXSTRARY_MARGINS_CM;
+break;
+}
+
+while (pResources->key)
+{
+OUString sMeasurement = rLocaleData.getNum(pResources->human, 2, true, 
false) + sSuffix;
+OUString aStr = SvxResId(pResources->key).replaceFirst("%1", 
sMeasurement);
+sal_uInt32 nData = pResources->twips;
+rComboBox.append(OUString::number(nData), aStr);
+++pResources;
+}
+
+