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

Caolán McNamara caolan at kemper.freedesktop.org
Tue May 22 14:26:55 PDT 2012


 vcl/inc/vcl/button.hxx        |    7 +++++--
 vcl/inc/vcl/window.hxx        |   10 +++++-----
 vcl/source/control/button.cxx |   25 +++++++++++++++++++++++++
 3 files changed, 35 insertions(+), 7 deletions(-)

New commits:
commit c1c3236b6f85645157f8050a3235f5ff2af3395d
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue May 22 22:26:27 2012 +0100

    steal radiobutton guts

diff --git a/vcl/inc/vcl/button.hxx b/vcl/inc/vcl/button.hxx
index c775240..ecfa0f1 100644
--- a/vcl/inc/vcl/button.hxx
+++ b/vcl/inc/vcl/button.hxx
@@ -284,6 +284,7 @@ public:
 class VCL_DLLPUBLIC RadioButton : public Button
 {
 private:
+    boost::shared_ptr< std::set<RadioButton*> > m_xGroup;
     Rectangle       maStateRect;
     Rectangle       maMouseRect;
     Image           maImage;
@@ -312,13 +313,13 @@ private:
     SAL_DLLPRIVATE          RadioButton& operator= (const RadioButton &);
 
 protected:
-    boost::shared_ptr< std::set<RadioButton*> > m_xGroup;
-
     using Control::ImplInitSettings;
     using Window::ImplInit;
     SAL_DLLPRIVATE void     ImplInit( Window* pParent, WinBits nStyle );
     SAL_DLLPRIVATE void     ImplLoadRes( const ResId& rResId );
 
+    virtual void take_properties(Window &rOther);
+
 public:
     SAL_DLLPRIVATE void     ImplCallClick( sal_Bool bGrabFocus = sal_False, sal_uInt16 nFocusFlags = 0 );
     SAL_DLLPRIVATE void     ImplSetMinimumNWFSize();
@@ -449,6 +450,8 @@ protected:
     SAL_DLLPRIVATE virtual void ImplDrawCheckBoxState();
     SAL_DLLPRIVATE const Rectangle& GetStateRect() const { return maStateRect; }
     SAL_DLLPRIVATE const Rectangle& GetMouseRect() const { return maMouseRect; }
+
+    virtual void take_properties(Window &rOther);
 public:
     SAL_DLLPRIVATE void         ImplCheck();
     SAL_DLLPRIVATE void         ImplSetMinimumNWFSize();
diff --git a/vcl/inc/vcl/window.hxx b/vcl/inc/vcl/window.hxx
index 3bd7816..6ee1d61 100644
--- a/vcl/inc/vcl/window.hxx
+++ b/vcl/inc/vcl/window.hxx
@@ -597,6 +597,11 @@ protected:
      */
     SAL_DLLPRIVATE void queue_resize();
 
+    /*
+     * Takes ownership of the rOther properties
+     */
+    virtual void take_properties(Window &rOther);
+
     // FIXME: this is a hack to workaround missing layout functionality
     SAL_DLLPRIVATE void ImplAdjustNWFSizes();
 public:
@@ -1102,11 +1107,6 @@ public:
      */
     virtual bool set_property(const rtl::OString &rKey, const rtl::OString &rValue);
 
-    /*
-     * Takes ownership of the rOther properties
-     */
-    void take_properties(Window &rOther);
-
     virtual void setChildAnyProperty(const rtl::OString &rString, const ::com::sun::star::uno::Any &rValue);
     virtual ::com::sun::star::uno::Any getWidgetAnyProperty(const rtl::OString &rString) const;
 
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index 827e961..97a9da6 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -2831,6 +2831,22 @@ void RadioButton::SetState( sal_Bool bCheck )
     }
 }
 
+void RadioButton::take_properties(Window &rOther)
+{
+    RadioButton &rOtherRadio = static_cast<RadioButton&>(rOther);
+    if (rOtherRadio.m_xGroup.get())
+    {
+        rOtherRadio.m_xGroup->erase(&rOtherRadio);
+        rOtherRadio.m_xGroup->insert(this);
+    }
+    std::swap(m_xGroup, rOtherRadio.m_xGroup);
+    mbChecked = rOtherRadio.mbChecked;
+    mbSaveValue = rOtherRadio.mbSaveValue;
+    mbRadioCheck = rOtherRadio.mbRadioCheck;
+    mbStateChanged = rOtherRadio.mbStateChanged;
+    Button::take_properties(rOther);
+}
+
 bool RadioButton::set_property(const rtl::OString &rKey, const rtl::OString &rValue)
 {
     if (rKey.equalsL(RTL_CONSTASCII_STRINGPARAM("active")))
@@ -3787,6 +3803,15 @@ void CheckBox::SetState( TriState eState )
     }
 }
 
+void CheckBox::take_properties(Window &rOther)
+{
+    CheckBox &rOtherCheck = static_cast<CheckBox&>(rOther);
+    meState = rOtherCheck.meState;
+    meSaveValue = rOtherCheck.meSaveValue;
+    mbTriState = rOtherCheck.mbTriState;
+    Button::take_properties(rOther);
+}
+
 bool CheckBox::set_property(const rtl::OString &rKey, const rtl::OString &rValue)
 {
     if (rKey.equalsL(RTL_CONSTASCII_STRINGPARAM("active")))


More information about the Libreoffice-commits mailing list