diff options
author | Thomas Lange <tl@openoffice.org> | 2001-07-30 09:43:42 +0000 |
---|---|---|
committer | Thomas Lange <tl@openoffice.org> | 2001-07-30 09:43:42 +0000 |
commit | 492259604024e2b0e6da2efd2ec20ce9419432ed (patch) | |
tree | f01958db4035442726a7f220d11728581ef66229 /svtools/source/contnr | |
parent | 6c15fdcc6b01184946b40c4037dc2917c2de16cc (diff) |
#89209# calculation of icon column width fixed
Diffstat (limited to 'svtools/source/contnr')
-rw-r--r-- | svtools/source/contnr/templwin.cxx | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/svtools/source/contnr/templwin.cxx b/svtools/source/contnr/templwin.cxx index a713dea66954..de50ad1d714f 100644 --- a/svtools/source/contnr/templwin.cxx +++ b/svtools/source/contnr/templwin.cxx @@ -2,9 +2,9 @@ * * $RCSfile: templwin.cxx,v $ * - * $Revision: 1.22 $ + * $Revision: 1.23 $ * - * last change: $Author: mba $ $Date: 2001-07-20 17:42:55 $ + * last change: $Author: tl $ $Date: 2001-07-30 10:43:42 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -259,44 +259,51 @@ SvtIconWindow_Impl::SvtIconWindow_Impl( Window* pParent ) : // insert the categories // "New Document" + Image aImage( SvtResId( IMG_SVT_NEWDOC ) ); + nMaxTextLength = aImage.GetSizePixel().Width(); String aEntryStr = String( SvtResId( STR_SVT_NEWDOC ) ); - nMaxTextLength = GetTextWidth( aEntryStr ); SvxIconChoiceCtrlEntry* pEntry = - aIconCtrl.InsertEntry( aEntryStr, Image( SvtResId( IMG_SVT_NEWDOC ) ), ICON_POS_NEWDOC ); + aIconCtrl.InsertEntry( aEntryStr, aImage, ICON_POS_NEWDOC ); String* pURL = new String( RTL_CONSTASCII_USTRINGPARAM("private:newdoc") ); pEntry->SetUserData( pURL ); - long nTemp = 0; + DBG_ASSERT( !pEntry->GetBoundRect().IsEmpty(), "empty rectangle" ); + long nTemp = pEntry->GetBoundRect().GetSize().Width(); + if (nTemp > nMaxTextLength) + nMaxTextLength = nTemp; // "Templates" if ( aTemplateRootURL.Len() > 0 ) { aEntryStr = String( SvtResId( STR_SVT_TEMPLATES ) ); - nTemp = aIconCtrl.GetTextWidth( aEntryStr ); - if ( nTemp > nMaxTextLength ) - nMaxTextLength = nTemp; pEntry = aIconCtrl.InsertEntry( aEntryStr, Image( SvtResId( IMG_SVT_TEMPLATES ) ), ICON_POS_TEMPLATES ); pURL = new String( aTemplateRootURL ); pEntry->SetUserData( pURL ); + DBG_ASSERT( !pEntry->GetBoundRect().IsEmpty(), "empty rectangle" ); + nTemp = pEntry->GetBoundRect().GetSize().Width(); + if (nTemp > nMaxTextLength) + nMaxTextLength = nTemp; } // "My Documents" aEntryStr = String( SvtResId( STR_SVT_MYDOCS ) ); - nTemp = aIconCtrl.GetTextWidth( aEntryStr ); - if ( nTemp > nMaxTextLength ) - nMaxTextLength = nTemp; pEntry = aIconCtrl.InsertEntry( aEntryStr, Image( SvtResId( IMG_SVT_MYDOCS ) ), ICON_POS_MYDOCS ); pURL = new String( SvtPathOptions().GetWorkPath() ); pEntry->SetUserData( pURL ); + DBG_ASSERT( !pEntry->GetBoundRect().IsEmpty(), "empty rectangle" ); + nTemp = pEntry->GetBoundRect().GetSize().Width(); + if (nTemp > nMaxTextLength) + nMaxTextLength = nTemp; // "Samples" aEntryStr = String( SvtResId( STR_SVT_SAMPLES ) ); - nTemp = aIconCtrl.GetTextWidth( aEntryStr ); - if ( nTemp > nMaxTextLength ) - nMaxTextLength = nTemp; pEntry = aIconCtrl.InsertEntry( aEntryStr, Image( SvtResId( IMG_SVT_SAMPLES ) ), ICON_POS_SAMPLES ); String aPath( RTL_CONSTASCII_USTRINGPARAM("$(insturl)/share/samples/$(vlang)") ); pURL = new String( SvtPathOptions().SubstituteVariable( aPath ) ); pEntry->SetUserData( pURL ); + DBG_ASSERT( !pEntry->GetBoundRect().IsEmpty(), "empty rectangle" ); + nTemp = pEntry->GetBoundRect().GetSize().Width(); + if (nTemp > nMaxTextLength) + nMaxTextLength = nTemp; } SvtIconWindow_Impl::~SvtIconWindow_Impl() @@ -843,7 +850,7 @@ SvtTemplateWindow::SvtTemplateWindow( Window* pParent ) : // create the split items aSplitWin.SetAlign( WINDOWALIGN_LEFT ); - long nWidth = ( pIconWin->GetMaxTextLength() * 9 / 7 ); + long nWidth = pIconWin->GetMaxTextLength() * 8 / 7; aSplitWin.InsertItem( ICONWIN_ID, pIconWin, nWidth, SPLITWINDOW_APPEND, 0, SWIB_FIXED ); aSplitWin.InsertItem( FILEWIN_ID, pFileWin, 50, SPLITWINDOW_APPEND, 0, SWIB_PERCENTSIZE ); aSplitWin.InsertItem( FRAMEWIN_ID, pFrameWin, 50, SPLITWINDOW_APPEND, 0, SWIB_PERCENTSIZE ); |