[Libreoffice-commits] core.git: include/vcl vcl/source

Szymon Kłos (via logerrit) logerrit at kemper.freedesktop.org
Mon Oct 14 16:12:17 UTC 2019


 include/vcl/field.hxx        |    4 ++
 vcl/source/control/field.cxx |   85 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 89 insertions(+)

New commits:
commit 5b08e2023db64741dbe54e36b0fed16395adf98e
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Fri Oct 11 21:54:39 2019 +0200
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Mon Oct 14 18:11:24 2019 +0200

    jsdialogs: send units for numeric fields
    
    Change-Id: I63b984856926a613e38319d6d769cab64601c504
    Reviewed-on: https://gerrit.libreoffice.org/80692
    Tested-by: Jenkins
    Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>

diff --git a/include/vcl/field.hxx b/include/vcl/field.hxx
index 75f8240520bc..a0d6b4e5833c 100644
--- a/include/vcl/field.hxx
+++ b/include/vcl/field.hxx
@@ -453,6 +453,8 @@ public:
     virtual void            Last() override;
     virtual bool            set_property(const OString &rKey, const OUString &rValue) override;
     virtual void            dispose() override;
+
+    virtual boost::property_tree::ptree DumpAsPropertyTree() override;
 };
 
 
@@ -514,6 +516,8 @@ public:
 
     virtual bool            set_property(const OString &rKey, const OUString &rValue) override;
     virtual void            dispose() override;
+
+    virtual boost::property_tree::ptree DumpAsPropertyTree() override;
 };
 
 
diff --git a/vcl/source/control/field.cxx b/vcl/source/control/field.cxx
index ffc6956d4cf2..83644c5e5657 100644
--- a/vcl/source/control/field.cxx
+++ b/vcl/source/control/field.cxx
@@ -46,6 +46,74 @@ using namespace ::comphelper;
 namespace
 {
 
+std::string FieldUnitToString(FieldUnit unit)
+{
+    switch(unit)
+    {
+        case FieldUnit::NONE:
+            return "";
+
+        case FieldUnit::MM:
+            return "mm";
+
+        case FieldUnit::CM:
+            return "cm";
+
+        case FieldUnit::M:
+            return "m";
+
+        case FieldUnit::KM:
+            return "km";
+
+        case FieldUnit::TWIP:
+            return "twip";
+
+        case FieldUnit::POINT:
+            return "point";
+
+        case FieldUnit::PICA:
+            return "pica";
+
+        case FieldUnit::INCH:
+            return "inch";
+
+        case FieldUnit::FOOT:
+            return "foot";
+
+        case FieldUnit::MILE:
+            return "mile";
+
+        case FieldUnit::CHAR:
+            return "char";
+
+        case FieldUnit::LINE:
+            return "line";
+
+        case FieldUnit::CUSTOM:
+            return "custom";
+
+        case FieldUnit::PERCENT:
+            return "percent";
+
+        case FieldUnit::MM_100TH:
+            return "mm100th";
+
+        case FieldUnit::PIXEL:
+            return "pixel";
+
+        case FieldUnit::DEGREE:
+            return "degree";
+
+        case FieldUnit::SECOND:
+            return "second";
+
+        case FieldUnit::MILLISECOND:
+            return "millisecond";
+    }
+
+    return "";
+}
+
 sal_Int64 ImplPower10( sal_uInt16 n )
 {
     sal_uInt16  i;
@@ -807,6 +875,14 @@ void NumericField::Last()
     SpinField::Last();
 }
 
+boost::property_tree::ptree NumericField::DumpAsPropertyTree()
+{
+    boost::property_tree::ptree aTree(SpinField::DumpAsPropertyTree());
+    aTree.put("min", GetMin());
+    aTree.put("max", GetMax());
+    return aTree;
+}
+
 namespace
 {
     Size calcMinimumSize(const Edit &rSpinField, const NumericFormatter &rFormatter)
@@ -1665,6 +1741,15 @@ void MetricField::CustomConvert()
     maCustomConvertLink.Call( *this );
 }
 
+boost::property_tree::ptree MetricField::DumpAsPropertyTree()
+{
+    boost::property_tree::ptree aTree(SpinField::DumpAsPropertyTree());
+    aTree.put("min", GetMin());
+    aTree.put("max", GetMax());
+    aTree.put("unit", FieldUnitToString(GetUnit()));
+    return aTree;
+}
+
 MetricBox::MetricBox(vcl::Window* pParent, WinBits nWinStyle)
     : ComboBox(pParent, nWinStyle)
     , MetricFormatter(this)


More information about the Libreoffice-commits mailing list