[Libreoffice-commits] .: Branch 'libreoffice-3-6' - 2 commits - svtools/source vcl/inc vcl/source

Petr Mladek pmladek at kemper.freedesktop.org
Wed Aug 8 01:09:41 PDT 2012


 svtools/source/brwbox/ebbcontrols.cxx |   24 ++++++++++++++++++++++-
 vcl/inc/vcl/button.hxx                |   19 ++++++++++++------
 vcl/source/control/button.cxx         |   35 ++++++++++++++++++++++------------
 3 files changed, 59 insertions(+), 19 deletions(-)

New commits:
commit aea425a8cd851e6bee02247673c8996b58789484
Author: Noel Power <noel.power at novell.com>
Date:   Fri Jul 6 14:38:51 2012 +0100

    additional fix for fdo#51336 for radiobuttons
    
    Change-Id: Ib35d27962b2c63221e1967886236547b3b1047d6
    Signed-off-by: Petr Mladek <pmladek at suse.cz>

diff --git a/vcl/inc/vcl/button.hxx b/vcl/inc/vcl/button.hxx
index 90dbcd9..d2c5146 100644
--- a/vcl/inc/vcl/button.hxx
+++ b/vcl/inc/vcl/button.hxx
@@ -313,6 +313,10 @@ private:
 protected:
     using Control::ImplInitSettings;
     using Window::ImplInit;
+    // allows the behaviour of horizontal placement of the checbox image to be
+    // overridden.
+    virtual void ImplHandleHoriAlign( const Point& rPos, const Size& rSize,
+                                    const Size& rImageSize, Rectangle& rStateRect );
     SAL_DLLPRIVATE void     ImplInit( Window* pParent, WinBits nStyle );
     SAL_DLLPRIVATE void     ImplLoadRes( const ResId& rResId );
 
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index 670c9e6..99e1724 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -2124,6 +2124,14 @@ if ( bNativeOK == sal_False )
 
 // -----------------------------------------------------------------------
 
+void RadioButton:: ImplHandleHoriAlign( const Point& rPos, const Size& /*rSize*/,
+                                    const Size& /*rImageSize*/, Rectangle& rStateRect )
+{
+    // align Checkbox image left ( always )
+    rStateRect.Left() = rPos.X();
+}
+// -----------------------------------------------------------------------
+
 void RadioButton::ImplDraw( OutputDevice* pDev, sal_uLong nDrawFlags,
                             const Point& rPos, const Size& rSize,
                             const Size& rImageSize, Rectangle& rStateRect,
@@ -2188,12 +2196,9 @@ void RadioButton::ImplDraw( OutputDevice* pDev, sal_uLong nDrawFlags,
         }
         else
         {
-            if ( nWinStyle & WB_CENTER )
-                rStateRect.Left() = rPos.X()+((rSize.Width()-rImageSize.Width())/2);
-            else if ( nWinStyle & WB_RIGHT )
-                rStateRect.Left() = rPos.X()+rSize.Width()-rImageSize.Width(); //-1;
-            else
-                rStateRect.Left() = rPos.X(); //+1;
+            // allow specific handling of WB_CENTER, WB_LEFT & WB_RIGHT by
+            // by subclasses
+            ImplHandleHoriAlign( rPos, rSize, rImageSize, rStateRect );
             if ( nWinStyle & WB_VCENTER )
                 rStateRect.Top() = rPos.Y()+((rSize.Height()-rImageSize.Height())/2);
             else if ( nWinStyle & WB_BOTTOM )
commit 99cad9fd7f413adecffc527d334eff616799cc4b
Author: Noel Power <noel.power at novell.com>
Date:   Fri Jul 6 11:19:57 2012 +0100

    fdo#51336 - change vcl checkbox no-label behaviour
    
    Change-Id: I352c6041cc520dc76c302190dcf3a6945f5ac85f
    Signed-off-by: Petr Mladek <pmladek at suse.cz>

diff --git a/svtools/source/brwbox/ebbcontrols.cxx b/svtools/source/brwbox/ebbcontrols.cxx
index 1d7b025..b0ab801 100644
--- a/svtools/source/brwbox/ebbcontrols.cxx
+++ b/svtools/source/brwbox/ebbcontrols.cxx
@@ -253,6 +253,28 @@ namespace svt
     //= CheckBoxControl
     //==================================================================
     //------------------------------------------------------------------
+
+    class CBCntrlTriState : public TriStateBox
+    {
+        CBCntrlTriState( const CBCntrlTriState & );
+        CBCntrlTriState& operator= ( const CBCntrlTriState & );
+    protected:
+        virtual void ImplHandleHoriAlign( const Point& rPos, const Size& rSize,
+                                    const Size& rImageSize, Rectangle& rStateRect )
+        {
+            WinBits nWinStyle = GetStyle();
+            if ( nWinStyle & WB_CENTER )
+                rStateRect.Left() = rPos.X()+((rSize.Width()-rImageSize.Width())/2);
+            else if ( nWinStyle & WB_RIGHT )
+                rStateRect.Left() = rPos.X()+rSize.Width()-rImageSize.Width();
+            else
+                rStateRect.Left() = rPos.X();
+        }
+    public:
+        CBCntrlTriState( Window* pParent, WinBits nStyle = 0 ) : TriStateBox( pParent, nStyle ) {}
+        CBCntrlTriState( Window* pParent, const ResId& rResId ) : TriStateBox( pParent, rResId ) {}
+    };
+
     CheckBoxControl::CheckBoxControl(Window* pParent, WinBits nWinStyle)
                    :Control(pParent, nWinStyle)
     {
@@ -267,7 +289,7 @@ namespace svt
 
         EnableChildTransparentMode();
 
-        pBox = new TriStateBox(this,WB_CENTER|WB_VCENTER);
+        pBox = new CBCntrlTriState(this,WB_CENTER|WB_VCENTER);
         pBox->EnableChildTransparentMode();
         pBox->SetPaintTransparent( sal_True );
         pBox->SetClickHdl( LINK( this, CheckBoxControl, OnClick ) );
diff --git a/vcl/inc/vcl/button.hxx b/vcl/inc/vcl/button.hxx
index 89d4d8e..90dbcd9 100644
--- a/vcl/inc/vcl/button.hxx
+++ b/vcl/inc/vcl/button.hxx
@@ -401,7 +401,6 @@ public:
 
 class VCL_DLLPUBLIC CheckBox : public Button
 {
-private:
     Rectangle       maStateRect;
     Rectangle       maMouseRect;
     TriState        meState;
@@ -420,7 +419,7 @@ private:
     SAL_DLLPRIVATE void         ImplDrawCheckBox( bool bLayout = false );
     SAL_DLLPRIVATE long         ImplGetImageToTextDistance() const;
     SAL_DLLPRIVATE Size         ImplGetCheckImageSize() const;
-
+private:
     // Copy assignment is forbidden and not implemented.
     SAL_DLLPRIVATE              CheckBox(const CheckBox &);
     SAL_DLLPRIVATE              CheckBox& operator= (const CheckBox &);
@@ -428,15 +427,19 @@ private:
 protected:
     using Control::ImplInitSettings;
     using Window::ImplInit;
+    // allows the behaviour of horizontal placement of the checbox image to be
+    // overridden.
+    virtual void ImplHandleHoriAlign( const Point& rPos, const Size& rSize,
+                                    const Size& rImageSize, Rectangle& rStateRect );
     SAL_DLLPRIVATE void         ImplInit( Window* pParent, WinBits nStyle );
     SAL_DLLPRIVATE void         ImplLoadRes( const ResId& rResId );
-    SAL_DLLPRIVATE virtual void FillLayoutData() const;
-    SAL_DLLPRIVATE virtual const Font&
+                   virtual void FillLayoutData() const;
+                   virtual const Font&
                                 GetCanonicalFont( const StyleSettings& _rStyle ) const;
-    SAL_DLLPRIVATE virtual const Color&
+                   virtual const Color&
                                 GetCanonicalTextColor( const StyleSettings& _rStyle ) const;
 
-    SAL_DLLPRIVATE virtual void ImplDrawCheckBoxState();
+                   virtual void ImplDrawCheckBoxState();
     SAL_DLLPRIVATE const Rectangle& GetStateRect() const { return maStateRect; }
     SAL_DLLPRIVATE const Rectangle& GetMouseRect() const { return maMouseRect; }
 public:
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index 3e09946..670c9e6 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -3252,12 +3252,9 @@ void CheckBox::ImplDraw( OutputDevice* pDev, sal_uLong nDrawFlags,
     }
     else
     {
-        if ( nWinStyle & WB_CENTER )
-            rStateRect.Left() = rPos.X()+((rSize.Width()-rImageSize.Width())/2);
-        else if ( nWinStyle & WB_RIGHT )
-            rStateRect.Left() = rPos.X()+rSize.Width()-rImageSize.Width();
-        else
-            rStateRect.Left() = rPos.X();
+        // allow specific handling of WB_CENTER, WB_LEFT & WB_RIGHT by
+        // by subclasses
+        ImplHandleHoriAlign( rPos, rSize, rImageSize, rStateRect );
         if ( nWinStyle & WB_VCENTER )
             rStateRect.Top() = rPos.Y()+((rSize.Height()-rImageSize.Height())/2);
         else if ( nWinStyle & WB_BOTTOM )
@@ -3299,6 +3296,15 @@ void CheckBox::ImplDraw( OutputDevice* pDev, sal_uLong nDrawFlags,
 
 // -----------------------------------------------------------------------
 
+void CheckBox:: ImplHandleHoriAlign( const Point& rPos, const Size& /*rSize*/,
+                                    const Size& /*rImageSize*/, Rectangle& rStateRect )
+{
+    // align Checkbox image left ( always )
+    rStateRect.Left() = rPos.X();
+}
+
+// -----------------------------------------------------------------------
+
 void CheckBox::ImplDrawCheckBox( bool bLayout )
 {
     Size aImageSize = ImplGetCheckImageSize();


More information about the Libreoffice-commits mailing list