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.k...@collabora.com> AuthorDate: Fri Oct 11 21:54:39 2019 +0200 Commit: Szymon Kłos <szymon.k...@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.k...@collabora.com> (cherry picked from commit 5b08e2023db64741dbe54e36b0fed16395adf98e) Reviewed-on: https://gerrit.libreoffice.org/80783 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@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) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits