[Libreoffice-commits] .: Branch 'feature/cmclayout' - cui/uiconfig vcl/inc vcl/source

Caolán McNamara caolan at kemper.freedesktop.org
Wed May 23 06:27:04 PDT 2012


 cui/uiconfig/ui/10000.ui      |    1 +
 vcl/inc/vcl/field.hxx         |    3 +++
 vcl/source/control/field.cxx  |   24 +++++++++++++++++++++++-
 vcl/source/window/builder.cxx |    2 +-
 4 files changed, 28 insertions(+), 2 deletions(-)

New commits:
commit 47beec93aaaddd83d394454490314f40406ab4dc
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed May 23 14:25:22 2012 +0100

    We'll need to customize the xml format a little for some things
    
    But we might be able to get them upstreamed to gtk and we can
    still do the pony work with glade (and/or tweak glade to retain
    alien properties)

diff --git a/cui/uiconfig/ui/10000.ui b/cui/uiconfig/ui/10000.ui
index 24a649b..2ccc3dc 100644
--- a/cui/uiconfig/ui/10000.ui
+++ b/cui/uiconfig/ui/10000.ui
@@ -186,6 +186,7 @@
                                 <property name="visible">True</property>
                                 <property name="can_focus">True</property>
                                 <property name="invisible_char">●</property>
+                                <property name="format">%</property>
                               </object>
                               <packing>
                                 <property name="expand">False</property>
diff --git a/vcl/inc/vcl/field.hxx b/vcl/inc/vcl/field.hxx
index c9d9911..0d93209 100644
--- a/vcl/inc/vcl/field.hxx
+++ b/vcl/inc/vcl/field.hxx
@@ -594,6 +594,9 @@ public:
     static double           ConvertDoubleValue( sal_Int64 nValue, sal_uInt16 nDecDigits,
                                                 MapUnit eInUnit, FieldUnit eOutUnit )
     { return ConvertDoubleValue( static_cast<double>(nValue), nDecDigits, eInUnit, eOutUnit ); }
+
+    virtual bool            set_property(const rtl::OString &rKey, const rtl::OString &rValue);
+    virtual void            take_properties(Window &rOther);
 };
 
 
diff --git a/vcl/source/control/field.cxx b/vcl/source/control/field.cxx
index f2de909..3110a96 100644
--- a/vcl/source/control/field.cxx
+++ b/vcl/source/control/field.cxx
@@ -1678,7 +1678,29 @@ MetricField::MetricField( Window* pParent, const ResId& rResId ) :
         Show();
 }
 
-// -----------------------------------------------------------------------
+bool MetricField::set_property(const rtl::OString &rKey, const rtl::OString &rValue)
+{
+    if (rKey.equalsL(RTL_CONSTASCII_STRINGPARAM("format")))
+    {
+        maCustomUnitText = rtl::OStringToOUString(rValue, RTL_TEXTENCODING_UTF8);
+        meUnit = FUNIT_CUSTOM;
+    }
+    else
+        return SpinField::set_property(rKey, rValue);
+    return true;
+}
+
+void MetricField::take_properties(Window &rOther)
+{
+    MetricField &rOtherField = static_cast<MetricField&>(rOther);
+
+    maCustomUnitText = rOtherField.maCustomUnitText;
+    maCurUnitText = rOtherField.maCurUnitText;
+    mnBaseValue = rOtherField.mnBaseValue;
+    meUnit = rOtherField.meUnit;
+
+    SpinField::take_properties(rOther);
+}
 
 void MetricField::ImplLoadRes( const ResId& rResId )
 {
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index ab2a776..98e0087 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -180,7 +180,7 @@ Window *VclBuilder::makeObject(Window *pParent, const rtl::OString &name, const
     else if (name.equalsL(RTL_CONSTASCII_STRINGPARAM("GtkCheckButton")))
         pWindow = new CheckBox(pParent, WB_CENTER|WB_VCENTER|WB_3DLOOK);
     else if (name.equalsL(RTL_CONSTASCII_STRINGPARAM("GtkSpinButton")))
-        pWindow = new NumericField(pParent, WB_RIGHT|WB_SPIN|WB_BORDER|WB_3DLOOK);
+        pWindow = new MetricField(pParent, WB_RIGHT|WB_SPIN|WB_BORDER|WB_3DLOOK);
     else if (name.equalsL(RTL_CONSTASCII_STRINGPARAM("GtkComboBox")))
         pWindow = new ListBox(pParent, WB_DROPDOWN|WB_CENTER|WB_VCENTER|WB_3DLOOK);
     else if (name.equalsL(RTL_CONSTASCII_STRINGPARAM("GtkLabel")))


More information about the Libreoffice-commits mailing list