[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - include/vcl vcl/source

Szymon Kłos (via logerrit) logerrit at kemper.freedesktop.org
Tue Oct 15 07:53:31 UTC 2019


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

New commits:
commit a2b63f0eb04fd5df17f3384f647159c72395767c
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: Tue Oct 15 09:52:45 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>
    (cherry picked from commit 5b08e2023db64741dbe54e36b0fed16395adf98e)
    Reviewed-on: https://gerrit.libreoffice.org/80783
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>

diff --git a/include/vcl/field.hxx b/include/vcl/field.hxx
index aeb31c85664c..172c128c0f3e 100644
--- a/include/vcl/field.hxx
+++ b/include/vcl/field.hxx
@@ -454,6 +454,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;
 };
 
 
@@ -515,6 +517,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 59220ac21258..3e82d4f7d398 100644
--- a/vcl/source/control/field.cxx
+++ b/vcl/source/control/field.cxx
@@ -45,6 +45,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;
@@ -806,6 +874,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)
@@ -1626,6 +1702,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