[Libreoffice-commits] core.git: svx/source
Laurent Balland-Poirier
laurent.balland-poirier at laposte.net
Tue Sep 17 05:57:59 PDT 2013
svx/source/tbxctrls/itemwin.cxx | 38 +++++++++++++++++++++++++++++++++++++-
1 file changed, 37 insertions(+), 1 deletion(-)
New commits:
commit 338ccf09e3d02dfd872464bb78c4e2d44aecf0b2
Author: Laurent Balland-Poirier <laurent.balland-poirier at laposte.net>
Date: Sat Sep 14 15:13:08 2013 +0200
fdo#64455 Handle unknown color in color line
Change-Id: Ice4205056cc64ae50bd3c8136aeae6f648adbd0b
diff --git a/svx/source/tbxctrls/itemwin.cxx b/svx/source/tbxctrls/itemwin.cxx
index 4514d42..daa035b 100644
--- a/svx/source/tbxctrls/itemwin.cxx
+++ b/svx/source/tbxctrls/itemwin.cxx
@@ -28,6 +28,9 @@
#include <svx/dialogs.hrc>
+#define TMP_STR_BEGIN '['
+#define TMP_STR_END ']'
+
#define DELAY_TIMEOUT 100
#include <svx/xlnclit.hxx>
@@ -295,7 +298,40 @@ SvxColorBox::~SvxColorBox()
void SvxColorBox::Update( const XLineColorItem* pItem )
{
if ( pItem )
- SelectEntry( pItem->GetColorValue() );
+ {
+ // fdo#64455
+ ::Color aColor = pItem->GetColorValue();
+ String aString( pItem->GetName() );
+ SelectEntry(aString);
+ if( GetSelectEntryPos() == LISTBOX_ENTRY_NOTFOUND ||
+ GetSelectEntryColor() != aColor )
+ {
+ SelectEntry( aColor );
+ }
+ // Check if the entry is not in the list
+ if( GetSelectEntryPos() == LISTBOX_ENTRY_NOTFOUND ||
+ GetSelectEntryColor() != aColor )
+ {
+ sal_uInt16 nCount = GetEntryCount();
+ String aTmpStr;
+ if( nCount > 0 )
+ {
+ // Last entry gets tested against temporary color
+ aTmpStr = GetEntry( nCount - 1 );
+ if( aTmpStr.GetChar(0) == TMP_STR_BEGIN &&
+ aTmpStr.GetChar(aTmpStr.Len()-1) == TMP_STR_END )
+ {
+ RemoveEntry( nCount - 1 );
+ }
+ }
+ aTmpStr = TMP_STR_BEGIN;
+ aTmpStr += aString;
+ aTmpStr += TMP_STR_END;
+
+ sal_uInt16 nPos = InsertEntry( aColor, aTmpStr );
+ SelectEntryPos( nPos );
+ }
+ }
else
SetNoSelection();
}
More information about the Libreoffice-commits
mailing list