diff options
author | Caolán McNamara <caolanm@redhat.com> | 2013-07-11 16:42:02 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-07-11 17:13:51 +0100 |
commit | d55c0c902838540573e32a7cf34cd8c45587adb9 (patch) | |
tree | e891603416298effbbece93f7ba3ecb00c779b21 | |
parent | 33fe41cf45efb89f9a7629c5df5a6b4d5b7c0b76 (diff) |
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
-rw-r--r-- | sw/source/ui/frmdlg/column.cxx | 43 | ||||
-rw-r--r-- | sw/source/ui/inc/column.hxx | 2 |
2 files changed, 33 insertions, 12 deletions
diff --git a/sw/source/ui/frmdlg/column.cxx b/sw/source/ui/frmdlg/column.cxx index 48bd20fc9826..99381d8f677c 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 8cb80c152e01..bab926bf647f 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(); |