From 64a708cba9b954afe3331f63c58218eb53b3d0ce Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Sat, 5 Nov 2016 20:28:27 +0000 Subject: Revert "Reverts a commit series that cripple windows ci." MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit with addition of... - svxlo-SvxColorListBox + svxcorelo-SvxColorListBox This reverts commit db380aab1063e8a5e40111c40ee9f7921aa82601. Change-Id: I3af7aa0abb1a430bce64188244404fcbd480b128 Reviewed-on: https://gerrit.libreoffice.org/30598 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- cui/source/tabpages/tphatch.cxx | 55 +++++++++-------------------------------- 1 file changed, 12 insertions(+), 43 deletions(-) (limited to 'cui/source/tabpages/tphatch.cxx') diff --git a/cui/source/tabpages/tphatch.cxx b/cui/source/tabpages/tphatch.cxx index 1f4fa526d9da..31efad7ad521 100644 --- a/cui/source/tabpages/tphatch.cxx +++ b/cui/source/tabpages/tphatch.cxx @@ -29,6 +29,7 @@ #include #include "helpid.hrc" +#include #include "svx/xattr.hxx" #include #include @@ -118,7 +119,8 @@ SvxHatchTabPage::SvxHatchTabPage m_pMtrAngle->SetModifyHdl( aLink ); m_pSliderAngle->SetSlideHdl( LINK( this, SvxHatchTabPage, ModifiedSliderHdl_Impl ) ); m_pLbLineType->SetSelectHdl( aLink2 ); - m_pLbLineColor->SetSelectHdl( aLink2 ); + Link aLink3 = LINK( this, SvxHatchTabPage, ModifiedColorListBoxHdl_Impl ); + m_pLbLineColor->SetSelectHdl( aLink3 ); m_pCbBackgroundColor->SetToggleHdl( LINK( this, SvxHatchTabPage, ToggleHatchBackgroundColor_Impl ) ); m_pLbBackgroundColor->SetSelectHdl( LINK( this, SvxHatchTabPage, ModifiedBackgroundHdl_Impl ) ); @@ -150,20 +152,13 @@ void SvxHatchTabPage::dispose() SvxTabPage::dispose(); } - void SvxHatchTabPage::Construct() { - m_pLbLineColor->Fill( m_pColorList ); - m_pLbBackgroundColor->Fill( m_pColorList ); m_pHatchLB->FillPresetListBox(*m_pHatchingList); } - void SvxHatchTabPage::ActivatePage( const SfxItemSet& rSet ) { - sal_Int32 nPos; - sal_Int32 nCount; - if( m_pColorList.is() ) { // ColorList @@ -175,18 +170,6 @@ void SvxHatchTabPage::ActivatePage( const SfxItemSet& rSet ) if (pArea) m_pColorList = pArea->GetNewColorList(); - // LbLineColor - nPos = m_pLbLineColor->GetSelectEntryPos(); - m_pLbLineColor->Clear(); - m_pLbLineColor->Fill( m_pColorList ); - nCount = m_pLbLineColor->GetEntryCount(); - if( nCount == 0 ) - ; // this case should not occur - else if( nCount <= nPos ) - m_pLbLineColor->SelectEntryPos( 0 ); - else - m_pLbLineColor->SelectEntryPos( nPos ); - ModifiedHdl_Impl( this ); } @@ -228,12 +211,6 @@ void SvxHatchTabPage::ActivatePage( const SfxItemSet& rSet ) Color aColor(aColorItem.GetColorValue()); m_pLbBackgroundColor->Enable(); m_pLbBackgroundColor->SelectEntry(aColor); - - if( m_pLbBackgroundColor->GetSelectEntryCount() == 0 ) - { - m_pLbBackgroundColor->InsertEntry( aColor , OUString() ); - m_pLbBackgroundColor->SelectEntry( aColor ); - } m_rXFSet.Put( aColorItem ); } else @@ -295,15 +272,10 @@ bool SvxHatchTabPage::FillItemSet( SfxItemSet* rSet ) rSet->Put( XFillStyleItem( drawing::FillStyle_HATCH ) ); rSet->Put( XFillHatchItem( aString, *pXHatch ) ); rSet->Put( XFillBackgroundItem( m_pCbBackgroundColor->IsChecked() ) ); - if(m_pCbBackgroundColor->IsChecked()) + if (m_pCbBackgroundColor->IsChecked()) { - sal_uInt32 nPosBckColor = m_pLbBackgroundColor->GetSelectEntryPos(); - OUString aBckColorString; - if( nPosBckColor != LISTBOX_ENTRY_NOTFOUND ) - aBckColorString = m_pLbBackgroundColor->GetSelectEntry(); - else - aBckColorString = OUString(); - rSet->Put( XFillColorItem( aBckColorString, m_pLbBackgroundColor->GetSelectEntryColor() ) ); + NamedColor aColor = m_pLbBackgroundColor->GetSelectEntry(); + rSet->Put(XFillColorItem(aColor.second, aColor.first)); } return true; } @@ -335,12 +307,16 @@ VclPtr SvxHatchTabPage::Create( vcl::Window* pWindow, return VclPtr::Create( pWindow, *rSet ); } - IMPL_LINK( SvxHatchTabPage, ModifiedListBoxHdl_Impl, ListBox&, rListBox, void ) { ModifiedHdl_Impl(&rListBox); } +IMPL_LINK( SvxHatchTabPage, ModifiedColorListBoxHdl_Impl, SvxColorListBox&, rListBox, void ) +{ + ModifiedHdl_Impl(&rListBox); +} + IMPL_LINK_NOARG( SvxHatchTabPage, ToggleHatchBackgroundColor_Impl, CheckBox&, void ) { if(m_pCbBackgroundColor->IsChecked()) @@ -351,7 +327,7 @@ IMPL_LINK_NOARG( SvxHatchTabPage, ToggleHatchBackgroundColor_Impl, CheckBox&, vo ModifiedBackgroundHdl_Impl(*m_pLbBackgroundColor); } -IMPL_LINK_NOARG( SvxHatchTabPage, ModifiedBackgroundHdl_Impl, ListBox&, void ) +IMPL_LINK_NOARG( SvxHatchTabPage, ModifiedBackgroundHdl_Impl, SvxColorListBox&, void ) { Color aColor(COL_TRANSPARENT); if(m_pCbBackgroundColor->IsChecked()) @@ -429,15 +405,8 @@ void SvxHatchTabPage::ChangeHatchHdl_Impl() { m_pLbLineType->SelectEntryPos( sal::static_int_cast< sal_Int32 >( pHatch->GetHatchStyle() ) ); - // if the entry is not in the listbox - // the color is added temporarily m_pLbLineColor->SetNoSelection(); m_pLbLineColor->SelectEntry( pHatch->GetColor() ); - if( m_pLbLineColor->GetSelectEntryCount() == 0 ) - { - m_pLbLineColor->InsertEntry( pHatch->GetColor(), OUString() ); - m_pLbLineColor->SelectEntry( pHatch->GetColor() ); - } SetMetricValue( *m_pMtrDistance, pHatch->GetDistance(), m_ePoolUnit ); long mHatchAngle = pHatch->GetAngle() / 10; m_pMtrAngle->SetValue( mHatchAngle ); -- cgit