cui/source/tabpages/tpcolor.cxx |   18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

New commits:
commit 64bc2eff89f3214aa0c90a0becc39c6ac11879b1
Author: Rishabh Kumar <kris.kr...@gmail.com>
Date:   Thu Jun 9 11:50:12 2016 +0530

    Minor bugfix for the Color tab
    
    Bugs fixed:
    1. Allow resizing of SvxColorValueSet on Addition and deletion of colors.
    2. Refresh color in SvxColorValueSet on modifying the color.
    3. Select the second last color on deleting the last color.
    
    Change-Id: Id01a1347683ea183dfb9fbc5c14a4e101eeef9aa
    Reviewed-on: https://gerrit.libreoffice.org/26084
    Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: Katarina Behrens <katarina.behr...@cib.de>

diff --git a/cui/source/tabpages/tpcolor.cxx b/cui/source/tabpages/tpcolor.cxx
index ae40b60..ddb2644 100644
--- a/cui/source/tabpages/tpcolor.cxx
+++ b/cui/source/tabpages/tpcolor.cxx
@@ -787,6 +787,7 @@ IMPL_LINK_NOARG_TYPED(SvxColorTabPage, ClickAddHdl_Impl, 
Button*, void)
 
         m_pLbColor->Append( *pEntry );
         m_pValSetColorList->InsertItem( m_pValSetColorList->GetItemCount() + 
1, pEntry->GetColor(), pEntry->GetName() );
+        m_pValSetColorList->Resize();
         ImpColorCountChanged();
 
         m_pLbColor->SelectEntryPos( m_pLbColor->GetEntryCount() - 1 );
@@ -855,8 +856,9 @@ IMPL_LINK_NOARG_TYPED(SvxColorTabPage, ClickModifyHdl_Impl, 
Button*, void)
             m_pLbColor->Modify( *pEntry, nPos );
             m_pLbColor->SelectEntryPos( nPos );
 
-            m_pValSetColorList->SetItemColor( nPos + 1, pEntry->GetColor() );
-            m_pValSetColorList->SetItemText( nPos + 1, pEntry->GetName() );
+            m_pValSetColorList->Clear();
+            m_pValSetColorList->addEntriesForXColorList( *pColorList );
+            m_pValSetColorList->SelectItem( nPos + 1 );
             m_pEdtName->SetText( aName );
 
             m_pCtlPreviewOld->Invalidate();
@@ -907,11 +909,21 @@ IMPL_LINK_NOARG_TYPED(SvxColorTabPage, 
ClickDeleteHdl_Impl, Button*, void)
             m_pLbColor->RemoveEntry( nPos );
             m_pValSetColorList->Clear();
             m_pValSetColorList->addEntriesForXColorList(*pColorList);
+            m_pValSetColorList->Resize();
             ImpColorCountChanged();
             //FillValueSet_Impl(*m_pValSetColorList);
 
             // positioning
-            m_pLbColor->SelectEntryPos( nPos );
+            long nColorCount = pColorList->Count();
+            if( nColorCount != 0 )
+            {
+                if( nPos >= nColorCount  )
+                    nPos = nColorCount - 1;
+                m_pLbColor->SelectEntryPos( nPos );
+            }
+            else
+                m_pLbColor->SetNoSelection();
+
             SelectColorLBHdl_Impl( *m_pLbColor );
 
             m_pCtlPreviewOld->Invalidate();
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to