[Libreoffice-commits] core.git: 2 commits - include/svtools sw/source

Caolán McNamara caolanm at redhat.com
Thu Jul 11 09:14:16 PDT 2013


 include/svtools/ctrlbox.hxx    |    8 +-----
 sw/source/ui/frmdlg/column.cxx |   52 +++++++++++++++++++++++++++++------------
 sw/source/ui/inc/column.hxx    |    2 +
 3 files changed, 42 insertions(+), 20 deletions(-)

New commits:
commit 22347f6180cec13c2f1101300e4f0b45b6d1ae39
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Jul 11 16:51:54 2013 +0100

    Resolves: fdo#66815 avoid resetting the selection when values are unchanged
    
    Change-Id: I88534e0b0e8302630193f77d2d85c4029a5a8f52

diff --git a/include/svtools/ctrlbox.hxx b/include/svtools/ctrlbox.hxx
index ac3e206..c83a94e 100644
--- a/include/svtools/ctrlbox.hxx
+++ b/include/svtools/ctrlbox.hxx
@@ -325,6 +325,7 @@ public:
 
     /** Set the width in Twips */
     void            SetWidth( long nWidth );
+    long            GetWidth() const { return m_nWidth; }
     void            SetNone( const XubString& sNone );
 
     using ListBox::InsertEntry;
@@ -356,7 +357,7 @@ public:
     inline FieldUnit    GetSourceUnit() const { return eSourceUnit; }
 
     void            SetColor( const Color& rColor );
-    inline Color    GetColor( void ) const;
+    Color           GetColor() const { return aColor; }
 
 protected:
 
@@ -389,11 +390,6 @@ inline void LineListBox::SetColor( const Color& rColor )
     UpdateEntries( m_nWidth );
 }
 
-inline Color LineListBox::GetColor( void ) const
-{
-    return aColor;
-}
-
 const Color& LineListBox::GetPaintColor( void ) const
 {
     return maPaintCol;
diff --git a/sw/source/ui/frmdlg/column.cxx b/sw/source/ui/frmdlg/column.cxx
index 99381d8..aa75d0b 100644
--- a/sw/source/ui/frmdlg/column.cxx
+++ b/sw/source/ui/frmdlg/column.cxx
@@ -731,8 +731,13 @@ IMPL_LINK( SwColumnPage, UpdateColMgr, void *, /*pField*/ )
         m_pLinePosLbl->Enable( bEnable );
         m_pLinePosDLB->Enable( bEnable );
 
-        m_pLineTypeDLB->SetWidth( nLineWidth );
-        m_pLineTypeDLB->SetColor( m_pLineColorDLB->GetSelectEntryColor( ) );
+        //fdo#66815 if the values are going to be the same, don't update
+        //them to avoid the listbox selection resetting
+        if (nLineWidth != m_pLineTypeDLB->GetWidth())
+            m_pLineTypeDLB->SetWidth(nLineWidth);
+        Color aColor(m_pLineColorDLB->GetSelectEntryColor());
+        if (aColor != m_pLineTypeDLB->GetColor())
+            m_pLineTypeDLB->SetColor(aColor);
     }
     else
     {
commit d55c0c902838540573e32a7cf34cd8c45587adb9
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Jul 11 16:42:02 2013 +0100

    Related: fdo#66815 fix the column dialog's 'enable' dependencies of widgets
    
    a) entire block at the bottom depends on > 1 column
    b) everything in that block, except the line style widgets themselves, depend
       on line style not "none".
    b) additionally then line position has an extra dependency on line height !=
       100%
    
    Change-Id: Ia3c904c7beaa2a3f7b9157d2ec8ab51813601873

diff --git a/sw/source/ui/frmdlg/column.cxx b/sw/source/ui/frmdlg/column.cxx
index 48bd20f..99381d8 100644
--- a/sw/source/ui/frmdlg/column.cxx
+++ b/sw/source/ui/frmdlg/column.cxx
@@ -703,18 +703,21 @@ IMPL_LINK( SwColumnPage, UpdateColMgr, void *, /*pField*/ )
 
         }
 
-            // nothing is turned off
-        const sal_uInt16 nPos = m_pLineTypeDLB->GetSelectEntryPos();
-        sal_Bool bEnable = 0 != nPos;
+        bool bEnable = isLineNotNone();
         m_pLineHeightEdit->Enable( bEnable );
         m_pLineHeightLbl->Enable( bEnable );
+        m_pLineWidthLbl->Enable( bEnable );
+        m_pLineWidthEdit->Enable( bEnable );
+        m_pLineColorDLB->Enable( bEnable );
+        m_pLineColorLbl->Enable( bEnable );
+
         long nLineWidth = static_cast<long>(MetricField::ConvertDoubleValue(
                 m_pLineWidthEdit->GetValue( ),
                 m_pLineWidthEdit->GetDecimalDigits( ),
                 m_pLineWidthEdit->GetUnit(), MAP_TWIP ));
         if( !bEnable )
             pColMgr->SetNoLine();
-        else if( LISTBOX_ENTRY_NOTFOUND != nPos )
+        else
         {
             pColMgr->SetLineWidthAndColor(
                     ::editeng::SvxBorderStyle( m_pLineTypeDLB->GetSelectEntryStyle( ) ),
@@ -824,6 +827,13 @@ void SwColumnPage::Init()
         std::min(long(nMaxCols), long( pColMgr->GetActualSize() / nMinWidth) )));
 }
 
+bool SwColumnPage::isLineNotNone() const
+{
+    // nothing is turned off
+    const sal_uInt16 nPos = m_pLineTypeDLB->GetSelectEntryPos();
+    return nPos != LISTBOX_ENTRY_NOTFOUND && nPos != 0;
+}
+
 /*------------------------------------------------------------------------
  Description:   The number of columns has changed -- here the controls for
                 editing of the columns are en- or disabled according to the
@@ -855,7 +865,9 @@ void SwColumnPage::UpdateCols()
         }
     }
     aEd1.Enable( bEnable12 );
-    aDistEd1.Enable(nCols > 1);
+    bool bEnable = nCols > 1;
+    aDistEd1.Enable(bEnable);
+    m_pAutoWidthBox->Enable( bEnable && !bHtmlMode );
     aEd2.Enable( bEnable12 );
     aDistEd2.Enable(bEnable3);
     aEd3.Enable( bEnable3  );
@@ -865,21 +877,28 @@ void SwColumnPage::UpdateCols()
     m_pBtnBack->Enable( bEnableBtns );
     m_pBtnNext->Enable( bEnableBtns );
 
-    const sal_Bool bEnable = nCols > 1;
-    if( !bEnable )
+    m_pLineTypeDLB->Enable( bEnable );
+    m_pLineTypeLbl->Enable( bEnable );
+
+    if (bEnable)
     {
-        m_pLinePosDLB->Enable( sal_False );
-        m_pLinePosLbl->Enable( sal_False );
+        bEnable = isLineNotNone();
     }
+
+    //all these depend on > 1 column and line style != none
     m_pLineHeightEdit->Enable( bEnable );
     m_pLineHeightLbl->Enable( bEnable );
-    m_pLineTypeDLB->Enable( bEnable );
-    m_pLineTypeLbl->Enable( bEnable );
     m_pLineWidthLbl->Enable( bEnable );
     m_pLineWidthEdit->Enable( bEnable );
     m_pLineColorDLB->Enable( bEnable );
     m_pLineColorLbl->Enable( bEnable );
-    m_pAutoWidthBox->Enable( bEnable && !bHtmlMode );
+
+    if (bEnable)
+        bEnable = pColMgr->GetLineHeightPercent() != 100;
+
+    //and these additionally depend on line height != 100%
+    m_pLinePosDLB->Enable( bEnable );
+    m_pLinePosLbl->Enable( bEnable );
 }
 
 void SwColumnPage::SetLabels( sal_uInt16 nVis )
diff --git a/sw/source/ui/inc/column.hxx b/sw/source/ui/inc/column.hxx
index 8cb80c1..bab926b 100644
--- a/sw/source/ui/inc/column.hxx
+++ b/sw/source/ui/inc/column.hxx
@@ -171,6 +171,8 @@ class SwColumnPage : public SfxTabPage
 
     void connectPercentFieldWrapper(PercentFieldWrap &rWrap, const OString &rName);
 
+    bool isLineNotNone() const;
+
 public:
     virtual ~SwColumnPage();
 


More information about the Libreoffice-commits mailing list