diff options
author | Frank Schoenheit [fs] <frank.schoenheit@sun.com> | 2010-05-18 13:26:39 +0200 |
---|---|---|
committer | Frank Schoenheit [fs] <frank.schoenheit@sun.com> | 2010-05-18 13:26:39 +0200 |
commit | f9425a94186c33c2571bdc32b689c3706251f416 (patch) | |
tree | e9c3e883f7367f34e2f63eba39c70acae1187317 /svtools/source/contnr | |
parent | 8ebf72567ae89f7112f88d1ef15520d3d5fd9105 (diff) |
unoawt: call UpdateContextBmpWidthVector in the LISTACTION_INSERTED notification. This way, we'll also handle cases where somebody creates and inserts SvLBoxEntry bypassing InsertEntry (and using the base classes Insert)
Diffstat (limited to 'svtools/source/contnr')
-rw-r--r-- | svtools/source/contnr/svtreebx.cxx | 42 |
1 files changed, 20 insertions, 22 deletions
diff --git a/svtools/source/contnr/svtreebx.cxx b/svtools/source/contnr/svtreebx.cxx index 9f599cbdb22e..bf6e41f93f36 100644 --- a/svtools/source/contnr/svtreebx.cxx +++ b/svtools/source/contnr/svtreebx.cxx @@ -40,6 +40,7 @@ class TabBar; #include <svtools/svlbox.hxx> #include <svtools/svlbitm.hxx> #include <svtools/svtreebx.hxx> +#include <tools/diagnose_ex.h> #include <svimpbox.hxx> #include <unotools/accessiblestatesethelper.hxx> #include <com/sun/star/accessibility/AccessibleStateType.hpp> @@ -427,17 +428,6 @@ SvLBoxEntry* SvTreeListBox::InsertEntry( const XubString& aText,SvLBoxEntry* pPa else SvLBox::Insert( pEntry, pParent, nPos ); - short nExpWidth = (short)rDefExpBmp.GetSizePixel().Width(); - short nColWidth = (short)rDefColBmp.GetSizePixel().Width(); - short nMax = Max(nExpWidth, nColWidth); - // #97680# ---------------- - nMax = pImp->UpdateContextBmpWidthVector( pEntry, nMax ); - if( nMax > nContextBmpWidthMax ) - { - nContextBmpWidthMax = nMax; - SetTabs(); - } - aPrevInsertedExpBmp = rDefExpBmp; aPrevInsertedColBmp = rDefColBmp; @@ -468,17 +458,6 @@ SvLBoxEntry* SvTreeListBox::InsertEntry( const XubString& aText, else SvLBox::Insert( pEntry, pParent, nPos ); - short nExpWidth = (short)aExpEntryBmp.GetSizePixel().Width(); - short nColWidth = (short)aCollEntryBmp.GetSizePixel().Width(); - short nMax = Max(nExpWidth, nColWidth); - // #97680# ---------------- - nMax = pImp->UpdateContextBmpWidthVector( pEntry, nMax ); - if( nMax > nContextBmpWidthMax ) - { - nContextBmpWidthMax = nMax; - SetTabs(); - } - aPrevInsertedExpBmp = aExpEntryBmp; aPrevInsertedColBmp = aCollEntryBmp; @@ -2347,6 +2326,25 @@ void SvTreeListBox::ModelNotification( USHORT nActionId, SvListEntry* pEntry1, SvLBox::ModelNotification( nActionId, pEntry1, pEntry2, nPos ); switch( nActionId ) { + case LISTACTION_INSERTED: + { + SvLBoxEntry* pEntry( dynamic_cast< SvLBoxEntry* >( pEntry1 ) ); + ENSURE_OR_BREAK( pEntry, "SvTreeListBox::ModelNotification: invalid entry!" ); + SvLBoxContextBmp* pBmpItem = static_cast< SvLBoxContextBmp* >( pEntry->GetFirstItem( SV_ITEM_ID_LBOXCONTEXTBMP ) ); + if ( !pBmpItem ) + break; + const Image& rBitmap1( pBmpItem->GetBitmap1() ); + const Image& rBitmap2( pBmpItem->GetBitmap2() ); + short nMaxWidth = short( Max( rBitmap1.GetSizePixel().Width(), rBitmap2.GetSizePixel().Width() ) ); + nMaxWidth = pImp->UpdateContextBmpWidthVector( pEntry, nMaxWidth ); + if( nMaxWidth > nContextBmpWidthMax ) + { + nContextBmpWidthMax = nMaxWidth; + SetTabs(); + } + } + break; + case LISTACTION_RESORTING: SetUpdateMode( FALSE ); break; |