diff options
Diffstat (limited to 'vcl/source/window/toolbox2.cxx')
-rw-r--r-- | vcl/source/window/toolbox2.cxx | 571 |
1 files changed, 287 insertions, 284 deletions
diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx index f17c7d0ef87e..37650232fd7f 100644 --- a/vcl/source/window/toolbox2.cxx +++ b/vcl/source/window/toolbox2.cxx @@ -72,17 +72,17 @@ ImplToolBoxPrivateData::ImplToolBoxPrivateData() : mnMenuButtonWidth = TB_MENUBUTTON_SIZE; - mbIsLocked = FALSE; - mbNativeButtons = FALSE; - mbIsPaintLocked = FALSE; - mbAssumeDocked = FALSE; - mbAssumePopupMode = FALSE; - mbAssumeFloating = FALSE; - mbKeyInputDisabled = FALSE; - mbMenubuttonSelected = FALSE; - mbPageScroll = FALSE; - mbWillUsePopupMode = FALSE; - mbDropDownByKeyboard = FALSE; + mbIsLocked = sal_False; + mbNativeButtons = sal_False; + mbIsPaintLocked = sal_False; + mbAssumeDocked = sal_False; + mbAssumePopupMode = sal_False; + mbAssumeFloating = sal_False; + mbKeyInputDisabled = sal_False; + mbMenubuttonSelected = sal_False; + mbPageScroll = sal_False; + mbWillUsePopupMode = sal_False; + mbDropDownByKeyboard = sal_False; } ImplToolBoxPrivateData::~ImplToolBoxPrivateData() @@ -98,40 +98,38 @@ ImplToolItem::ImplToolItem() mnId = 0; mpWindow = NULL; mpUserData = NULL; - mnHelpId = 0; meType = TOOLBOXITEM_BUTTON; mnBits = 0; meState = STATE_NOCHECK; - mbEnabled = TRUE; - mbVisible = TRUE; - mbEmptyBtn = TRUE; - mbShowWindow = FALSE; - mbBreak = FALSE; + mbEnabled = sal_True; + mbVisible = sal_True; + mbEmptyBtn = sal_True; + mbShowWindow = sal_False; + mbBreak = sal_False; mnSepSize = TB_SEP_SIZE; mnDropDownArrowWidth = TB_DROPDOWNARROWWIDTH; mnImageAngle = 0; - mbMirrorMode = FALSE; - mbVisibleText = FALSE; + mbMirrorMode = sal_False; + mbVisibleText = sal_False; } // ----------------------------------------------------------------------- -ImplToolItem::ImplToolItem( USHORT nItemId, const Image& rImage, +ImplToolItem::ImplToolItem( sal_uInt16 nItemId, const Image& rImage, ToolBoxItemBits nItemBits ) : maImage( rImage ) { mnId = nItemId; mpWindow = NULL; mpUserData = NULL; - mnHelpId = 0; meType = TOOLBOXITEM_BUTTON; mnBits = nItemBits; meState = STATE_NOCHECK; - mbEnabled = TRUE; - mbVisible = TRUE; - mbEmptyBtn = FALSE; - mbShowWindow = FALSE; - mbBreak = FALSE; + mbEnabled = sal_True; + mbVisible = sal_True; + mbEmptyBtn = sal_False; + mbShowWindow = sal_False; + mbBreak = sal_False; mnSepSize = TB_SEP_SIZE; mnDropDownArrowWidth = TB_DROPDOWNARROWWIDTH; mnImageAngle = 0; @@ -141,22 +139,21 @@ ImplToolItem::ImplToolItem( USHORT nItemId, const Image& rImage, // ----------------------------------------------------------------------- -ImplToolItem::ImplToolItem( USHORT nItemId, const XubString& rText, +ImplToolItem::ImplToolItem( sal_uInt16 nItemId, const XubString& rText, ToolBoxItemBits nItemBits ) : maText( rText ) { mnId = nItemId; mpWindow = NULL; mpUserData = NULL; - mnHelpId = 0; meType = TOOLBOXITEM_BUTTON; mnBits = nItemBits; meState = STATE_NOCHECK; - mbEnabled = TRUE; - mbVisible = TRUE; - mbEmptyBtn = FALSE; - mbShowWindow = FALSE; - mbBreak = FALSE; + mbEnabled = sal_True; + mbVisible = sal_True; + mbEmptyBtn = sal_False; + mbShowWindow = sal_False; + mbBreak = sal_False; mnSepSize = TB_SEP_SIZE; mnDropDownArrowWidth = TB_DROPDOWNARROWWIDTH; mnImageAngle = 0; @@ -166,7 +163,7 @@ ImplToolItem::ImplToolItem( USHORT nItemId, const XubString& rText, // ----------------------------------------------------------------------- -ImplToolItem::ImplToolItem( USHORT nItemId, const Image& rImage, +ImplToolItem::ImplToolItem( sal_uInt16 nItemId, const Image& rImage, const XubString& rText, ToolBoxItemBits nItemBits ) : maImage( rImage ), maText( rText ) @@ -174,15 +171,14 @@ ImplToolItem::ImplToolItem( USHORT nItemId, const Image& rImage, mnId = nItemId; mpWindow = NULL; mpUserData = NULL; - mnHelpId = 0; meType = TOOLBOXITEM_BUTTON; mnBits = nItemBits; meState = STATE_NOCHECK; - mbEnabled = TRUE; - mbVisible = TRUE; - mbEmptyBtn = FALSE; - mbShowWindow = FALSE; - mbBreak = FALSE; + mbEnabled = sal_True; + mbVisible = sal_True; + mbEmptyBtn = sal_False; + mbShowWindow = sal_False; + mbBreak = sal_False; mnSepSize = TB_SEP_SIZE; mnDropDownArrowWidth = TB_DROPDOWNARROWWIDTH; mnImageAngle = 0; @@ -203,7 +199,7 @@ ImplToolItem::ImplToolItem( const ImplToolItem& rItem ) : maQuickHelpText ( rItem.maQuickHelpText ), maHelpText ( rItem.maHelpText ), maCommandStr ( rItem.maCommandStr ), - mnHelpId ( rItem.mnHelpId ), + maHelpId ( rItem.maHelpId ), maRect ( rItem.maRect ), maCalcRect ( rItem.maCalcRect ), maItemSize ( rItem.maItemSize ), @@ -242,7 +238,7 @@ ImplToolItem& ImplToolItem::operator=( const ImplToolItem& rItem ) maQuickHelpText = rItem.maQuickHelpText; maHelpText = rItem.maHelpText; maCommandStr = rItem.maCommandStr; - mnHelpId = rItem.mnHelpId; + maHelpId = rItem.maHelpId; maRect = rItem.maRect; maCalcRect = rItem.maCalcRect; mnSepSize = rItem.mnSepSize; @@ -263,7 +259,7 @@ ImplToolItem& ImplToolItem::operator=( const ImplToolItem& rItem ) // ----------------------------------------------------------------------- -Size ImplToolItem::GetSize( BOOL bHorz, BOOL bCheckMaxWidth, long maxWidth, const Size& rDefaultSize ) +Size ImplToolItem::GetSize( sal_Bool bHorz, sal_Bool bCheckMaxWidth, long maxWidth, const Size& rDefaultSize ) { Size aSize( rDefaultSize ); // the size of 'standard' toolbox items // non-standard items are eg windows or buttons with text @@ -275,13 +271,13 @@ Size ImplToolItem::GetSize( BOOL bHorz, BOOL bCheckMaxWidth, long maxWidth, cons if ( mpWindow && bHorz ) { // get size of item window and check if it fits - // no windows in vertical toolbars (the default is mbShowWindow=FALSE) + // no windows in vertical toolbars (the default is mbShowWindow=sal_False) Size aWinSize = mpWindow->GetSizePixel(); if ( !bCheckMaxWidth || (aWinSize.Width() <= maxWidth) ) { aSize.Width() = aWinSize.Width(); aSize.Height() = aWinSize.Height(); - mbShowWindow = TRUE; + mbShowWindow = sal_True; } else { @@ -317,27 +313,27 @@ Size ImplToolItem::GetSize( BOOL bHorz, BOOL bCheckMaxWidth, long maxWidth, cons // ----------------------------------------------------------------------- -void ImplToolItem::DetermineButtonDrawStyle( ButtonType eButtonType, BOOL& rbImage, BOOL& rbText ) const +void ImplToolItem::DetermineButtonDrawStyle( ButtonType eButtonType, sal_Bool& rbImage, sal_Bool& rbText ) const { if ( meType != TOOLBOXITEM_BUTTON ) { // no button -> draw nothing - rbImage = rbText = FALSE; + rbImage = rbText = sal_False; return; } - BOOL bHasImage; - BOOL bHasText; + sal_Bool bHasImage; + sal_Bool bHasText; // check for image and/or text if ( !(maImage) ) - bHasImage = FALSE; + bHasImage = sal_False; else - bHasImage = TRUE; + bHasImage = sal_True; if ( !maText.Len() ) - bHasText = FALSE; + bHasText = sal_False; else - bHasText = TRUE; + bHasText = sal_True; // prefer images if symbolonly buttons are drawn // prefer texts if textonly buttons are dreawn @@ -346,38 +342,38 @@ void ImplToolItem::DetermineButtonDrawStyle( ButtonType eButtonType, BOOL& rbIma { if( bHasImage || !bHasText ) { - rbImage = TRUE; - rbText = FALSE; + rbImage = sal_True; + rbText = sal_False; } else { - rbImage = FALSE; - rbText = TRUE; + rbImage = sal_False; + rbText = sal_True; } } else if ( eButtonType == BUTTON_TEXT ) // drawing text only { if( bHasText || !bHasImage ) { - rbImage = FALSE; - rbText = TRUE; + rbImage = sal_False; + rbText = sal_True; } else { - rbImage = TRUE; - rbText = FALSE; + rbImage = sal_True; + rbText = sal_False; } } else // drawing icons and text both { - rbImage = TRUE; - rbText = TRUE; + rbImage = sal_True; + rbText = sal_True; } } // ----------------------------------------------------------------------- -Rectangle ImplToolItem::GetDropDownRect( BOOL bHorz ) const +Rectangle ImplToolItem::GetDropDownRect( sal_Bool bHorz ) const { Rectangle aRect; if( (mnBits & TIB_DROPDOWN) && !maRect.IsEmpty() ) @@ -395,7 +391,7 @@ Rectangle ImplToolItem::GetDropDownRect( BOOL bHorz ) const // ----------------------------------------------------------------------- -BOOL ImplToolItem::IsClipped() const +sal_Bool ImplToolItem::IsClipped() const { return ( meType == TOOLBOXITEM_BUTTON && mbVisible && maRect.IsEmpty() ); } @@ -414,16 +410,16 @@ const XubString& ToolBox::ImplConvertMenuString( const XubString& rStr ) // ----------------------------------------------------------------------- -void ToolBox::ImplInvalidate( BOOL bNewCalc, BOOL bFullPaint ) +void ToolBox::ImplInvalidate( sal_Bool bNewCalc, sal_Bool bFullPaint ) { ImplUpdateInputEnable(); if ( bNewCalc ) - mbCalc = TRUE; + mbCalc = sal_True; if ( bFullPaint ) { - mbFormat = TRUE; + mbFormat = sal_True; // Muss ueberhaupt eine neue Ausgabe erfolgen if ( IsReallyVisible() && IsUpdateMode() ) @@ -437,7 +433,7 @@ void ToolBox::ImplInvalidate( BOOL bNewCalc, BOOL bFullPaint ) { if ( !mbFormat ) { - mbFormat = TRUE; + mbFormat = sal_True; // Muss ueberhaupt eine neue Ausgabe erfolgen if ( IsReallyVisible() && IsUpdateMode() ) @@ -451,7 +447,7 @@ void ToolBox::ImplInvalidate( BOOL bNewCalc, BOOL bFullPaint ) // ----------------------------------------------------------------------- -void ToolBox::ImplUpdateItem( USHORT nIndex ) +void ToolBox::ImplUpdateItem( sal_uInt16 nIndex ) { // Muss ueberhaupt eine neue Ausgabe erfolgen if ( IsReallyVisible() && IsUpdateMode() ) @@ -558,10 +554,10 @@ void ToolBox::UserDraw( const UserDrawEvent& ) // ----------------------------------------------------------------------- -void ToolBox::InsertItem( const ResId& rResId, USHORT nPos ) +void ToolBox::InsertItem( const ResId& rResId, sal_uInt16 nPos ) { - ULONG nObjMask; - BOOL bImage = FALSE; // Wurde Image gesetzt + sal_uLong nObjMask; + sal_Bool bImage = sal_False; // Wurde Image gesetzt // Item anlegen ImplToolItem aItem; @@ -570,7 +566,7 @@ void ToolBox::InsertItem( const ResId& rResId, USHORT nPos ) nObjMask = ReadLongRes(); if ( nObjMask & RSC_TOOLBOXITEM_ID ) - aItem.mnId = sal::static_int_cast<USHORT>(ReadLongRes()); + aItem.mnId = sal::static_int_cast<sal_uInt16>(ReadLongRes()); else aItem.mnId = 1; @@ -581,7 +577,7 @@ void ToolBox::InsertItem( const ResId& rResId, USHORT nPos ) aItem.mnBits = (ToolBoxItemBits)ReadLongRes(); if( nObjMask & RSC_TOOLBOXITEM_HELPID ) - aItem.mnHelpId = ReadLongRes(); + aItem.maHelpId = ReadByteStringRes(); if ( nObjMask & RSC_TOOLBOXITEM_TEXT ) { @@ -596,22 +592,22 @@ void ToolBox::InsertItem( const ResId& rResId, USHORT nPos ) Bitmap aBmp = Bitmap( ResId( (RSHEADER_TYPE*)GetClassRes(), *rResId.GetResMgr() ) ); IncrementRes( GetObjSizeRes( (RSHEADER_TYPE*)GetClassRes() ) ); aItem.maImage = Image( aBmp, IMAGE_STDBTN_COLOR ); - bImage = TRUE; + bImage = sal_True; } if ( nObjMask & RSC_TOOLBOXITEM_IMAGE ) { aItem.maImage = Image( ResId( (RSHEADER_TYPE*)GetClassRes(), *rResId.GetResMgr() ) ); IncrementRes( GetObjSizeRes( (RSHEADER_TYPE*)GetClassRes() ) ); - bImage = TRUE; + bImage = sal_True; } if ( nObjMask & RSC_TOOLBOXITEM_DISABLE ) - aItem.mbEnabled = !(BOOL)ReadShortRes(); + aItem.mbEnabled = !(sal_Bool)ReadShortRes(); if ( nObjMask & RSC_TOOLBOXITEM_STATE ) aItem.meState = (TriState)ReadLongRes(); if ( nObjMask & RSC_TOOLBOXITEM_HIDE ) - aItem.mbVisible = !((BOOL)ReadShortRes()); + aItem.mbVisible = !((sal_Bool)ReadShortRes()); if ( nObjMask & RSC_TOOLBOXITEM_COMMAND ) aItem.maCommandStr = ReadStringRes(); @@ -622,15 +618,15 @@ void ToolBox::InsertItem( const ResId& rResId, USHORT nPos ) aItem.maImage = maImageList.GetImage( aItem.mnId ); // Wenn es sich um ein ButtonItem handelt, die ID ueberpruefen - BOOL bNewCalc; + sal_Bool bNewCalc; if ( aItem.meType != TOOLBOXITEM_BUTTON ) { - bNewCalc = FALSE; + bNewCalc = sal_False; aItem.mnId = 0; } else { - bNewCalc = TRUE; + bNewCalc = sal_True; DBG_ASSERT( aItem.mnId, "ToolBox::InsertItem(): ItemId == 0" ); DBG_ASSERT( GetItemPos( aItem.mnId ) == TOOLBOX_ITEM_NOTFOUND, @@ -645,14 +641,14 @@ void ToolBox::InsertItem( const ResId& rResId, USHORT nPos ) ImplInvalidate( bNewCalc ); // Notify - USHORT nNewPos = sal::static_int_cast<USHORT>(( nPos == TOOLBOX_APPEND ) ? ( mpData->m_aItems.size() - 1 ) : nPos); + sal_uInt16 nNewPos = sal::static_int_cast<sal_uInt16>(( nPos == TOOLBOX_APPEND ) ? ( mpData->m_aItems.size() - 1 ) : nPos); ImplCallEventListeners( VCLEVENT_TOOLBOX_ITEMADDED, reinterpret_cast< void* >( nNewPos ) ); } // ----------------------------------------------------------------------- -void ToolBox::InsertItem( USHORT nItemId, const Image& rImage, - ToolBoxItemBits nBits, USHORT nPos ) +void ToolBox::InsertItem( sal_uInt16 nItemId, const Image& rImage, + ToolBoxItemBits nBits, sal_uInt16 nPos ) { DBG_ASSERT( nItemId, "ToolBox::InsertItem(): ItemId == 0" ); DBG_ASSERT( GetItemPos( nItemId ) == TOOLBOX_ITEM_NOTFOUND, @@ -662,18 +658,18 @@ void ToolBox::InsertItem( USHORT nItemId, const Image& rImage, mpData->m_aItems.insert( (nPos < mpData->m_aItems.size()) ? mpData->m_aItems.begin()+nPos : mpData->m_aItems.end(), ImplToolItem( nItemId, rImage, nBits ) ); mpData->ImplClearLayoutData(); - ImplInvalidate( TRUE ); + ImplInvalidate( sal_True ); // Notify - USHORT nNewPos = sal::static_int_cast<USHORT>(( nPos == TOOLBOX_APPEND ) ? ( mpData->m_aItems.size() - 1 ) : nPos); + sal_uInt16 nNewPos = sal::static_int_cast<sal_uInt16>(( nPos == TOOLBOX_APPEND ) ? ( mpData->m_aItems.size() - 1 ) : nPos); ImplCallEventListeners( VCLEVENT_TOOLBOX_ITEMADDED, reinterpret_cast< void* >(nNewPos ) ); } // ----------------------------------------------------------------------- -void ToolBox::InsertItem( USHORT nItemId, const Image& rImage, +void ToolBox::InsertItem( sal_uInt16 nItemId, const Image& rImage, const XubString& rText, - ToolBoxItemBits nBits, USHORT nPos ) + ToolBoxItemBits nBits, sal_uInt16 nPos ) { DBG_ASSERT( nItemId, "ToolBox::InsertItem(): ItemId == 0" ); DBG_ASSERT( GetItemPos( nItemId ) == TOOLBOX_ITEM_NOTFOUND, @@ -683,17 +679,17 @@ void ToolBox::InsertItem( USHORT nItemId, const Image& rImage, mpData->m_aItems.insert( (nPos < mpData->m_aItems.size()) ? mpData->m_aItems.begin()+nPos : mpData->m_aItems.end(), ImplToolItem( nItemId, rImage, ImplConvertMenuString( rText ), nBits ) ); mpData->ImplClearLayoutData(); - ImplInvalidate( TRUE ); + ImplInvalidate( sal_True ); // Notify - USHORT nNewPos = sal::static_int_cast<USHORT>(( nPos == TOOLBOX_APPEND ) ? ( mpData->m_aItems.size() - 1 ) : nPos); + sal_uInt16 nNewPos = sal::static_int_cast<sal_uInt16>(( nPos == TOOLBOX_APPEND ) ? ( mpData->m_aItems.size() - 1 ) : nPos); ImplCallEventListeners( VCLEVENT_TOOLBOX_ITEMADDED, reinterpret_cast< void* >( nNewPos ) ); } // ----------------------------------------------------------------------- -void ToolBox::InsertItem( USHORT nItemId, const XubString& rText, - ToolBoxItemBits nBits, USHORT nPos ) +void ToolBox::InsertItem( sal_uInt16 nItemId, const XubString& rText, + ToolBoxItemBits nBits, sal_uInt16 nPos ) { DBG_ASSERT( nItemId, "ToolBox::InsertItem(): ItemId == 0" ); DBG_ASSERT( GetItemPos( nItemId ) == TOOLBOX_ITEM_NOTFOUND, @@ -703,17 +699,17 @@ void ToolBox::InsertItem( USHORT nItemId, const XubString& rText, mpData->m_aItems.insert( (nPos < mpData->m_aItems.size()) ? mpData->m_aItems.begin()+nPos : mpData->m_aItems.end(), ImplToolItem( nItemId, ImplConvertMenuString( rText ), nBits ) ); mpData->ImplClearLayoutData(); - ImplInvalidate( TRUE ); + ImplInvalidate( sal_True ); // Notify - USHORT nNewPos = sal::static_int_cast<USHORT>(( nPos == TOOLBOX_APPEND ) ? ( mpData->m_aItems.size() - 1 ) : nPos); + sal_uInt16 nNewPos = sal::static_int_cast<sal_uInt16>(( nPos == TOOLBOX_APPEND ) ? ( mpData->m_aItems.size() - 1 ) : nPos); ImplCallEventListeners( VCLEVENT_TOOLBOX_ITEMADDED, reinterpret_cast< void* >( nNewPos ) ); } // ----------------------------------------------------------------------- -void ToolBox::InsertWindow( USHORT nItemId, Window* pWindow, - ToolBoxItemBits nBits, USHORT nPos ) +void ToolBox::InsertWindow( sal_uInt16 nItemId, Window* pWindow, + ToolBoxItemBits nBits, sal_uInt16 nPos ) { DBG_ASSERT( nItemId, "ToolBox::InsertWindow(): ItemId == 0" ); DBG_ASSERT( GetItemPos( nItemId ) == TOOLBOX_ITEM_NOTFOUND, @@ -731,80 +727,80 @@ void ToolBox::InsertWindow( USHORT nItemId, Window* pWindow, if ( pWindow ) pWindow->Hide(); - ImplInvalidate( TRUE ); + ImplInvalidate( sal_True ); // Notify - USHORT nNewPos = sal::static_int_cast<USHORT>(( nPos == TOOLBOX_APPEND ) ? ( mpData->m_aItems.size() - 1 ) : nPos); + sal_uInt16 nNewPos = sal::static_int_cast<sal_uInt16>(( nPos == TOOLBOX_APPEND ) ? ( mpData->m_aItems.size() - 1 ) : nPos); ImplCallEventListeners( VCLEVENT_TOOLBOX_ITEMADDED, reinterpret_cast< void* >( nNewPos ) ); } // ----------------------------------------------------------------------- -void ToolBox::InsertSpace( USHORT nPos ) +void ToolBox::InsertSpace( sal_uInt16 nPos ) { // Item anlegen und in die Liste einfuegen ImplToolItem aItem; aItem.meType = TOOLBOXITEM_SPACE; - aItem.mbEnabled = FALSE; + aItem.mbEnabled = sal_False; mpData->m_aItems.insert( (nPos < mpData->m_aItems.size()) ? mpData->m_aItems.begin()+nPos : mpData->m_aItems.end(), aItem ); mpData->ImplClearLayoutData(); - ImplInvalidate( FALSE ); + ImplInvalidate( sal_False ); // Notify - USHORT nNewPos = sal::static_int_cast<USHORT>(( nPos == TOOLBOX_APPEND ) ? ( mpData->m_aItems.size() - 1 ) : nPos); + sal_uInt16 nNewPos = sal::static_int_cast<sal_uInt16>(( nPos == TOOLBOX_APPEND ) ? ( mpData->m_aItems.size() - 1 ) : nPos); ImplCallEventListeners( VCLEVENT_TOOLBOX_ITEMADDED, reinterpret_cast< void* >( nNewPos ) ); } // ----------------------------------------------------------------------- -void ToolBox::InsertSeparator( USHORT nPos, USHORT nPixSize ) +void ToolBox::InsertSeparator( sal_uInt16 nPos, sal_uInt16 nPixSize ) { // Item anlegen und in die Liste einfuegen ImplToolItem aItem; aItem.meType = TOOLBOXITEM_SEPARATOR; - aItem.mbEnabled = FALSE; + aItem.mbEnabled = sal_False; if ( nPixSize ) aItem.mnSepSize = nPixSize; mpData->m_aItems.insert( (nPos < mpData->m_aItems.size()) ? mpData->m_aItems.begin()+nPos : mpData->m_aItems.end(), aItem ); mpData->ImplClearLayoutData(); - ImplInvalidate( FALSE ); + ImplInvalidate( sal_False ); // Notify - USHORT nNewPos = sal::static_int_cast<USHORT>(( nPos == TOOLBOX_APPEND ) ? ( mpData->m_aItems.size() - 1 ) : nPos); + sal_uInt16 nNewPos = sal::static_int_cast<sal_uInt16>(( nPos == TOOLBOX_APPEND ) ? ( mpData->m_aItems.size() - 1 ) : nPos); ImplCallEventListeners( VCLEVENT_TOOLBOX_ITEMADDED, reinterpret_cast< void* >( nNewPos ) ); } // ----------------------------------------------------------------------- -void ToolBox::InsertBreak( USHORT nPos ) +void ToolBox::InsertBreak( sal_uInt16 nPos ) { // Item anlegen und in die Liste einfuegen ImplToolItem aItem; aItem.meType = TOOLBOXITEM_BREAK; - aItem.mbEnabled = FALSE; + aItem.mbEnabled = sal_False; mpData->m_aItems.insert( (nPos < mpData->m_aItems.size()) ? mpData->m_aItems.begin()+nPos : mpData->m_aItems.end(), aItem ); mpData->ImplClearLayoutData(); - ImplInvalidate( FALSE ); + ImplInvalidate( sal_False ); // Notify - USHORT nNewPos = sal::static_int_cast<USHORT>(( nPos == TOOLBOX_APPEND ) ? ( mpData->m_aItems.size() - 1 ) : nPos); + sal_uInt16 nNewPos = sal::static_int_cast<sal_uInt16>(( nPos == TOOLBOX_APPEND ) ? ( mpData->m_aItems.size() - 1 ) : nPos); ImplCallEventListeners( VCLEVENT_TOOLBOX_ITEMADDED, reinterpret_cast< void* >( nNewPos ) ); } // ----------------------------------------------------------------------- -void ToolBox::RemoveItem( USHORT nPos ) +void ToolBox::RemoveItem( sal_uInt16 nPos ) { if( nPos < mpData->m_aItems.size() ) { - BOOL bMustCalc; + sal_Bool bMustCalc; if ( mpData->m_aItems[nPos].meType == TOOLBOXITEM_BUTTON ) - bMustCalc = TRUE; + bMustCalc = sal_True; else - bMustCalc = FALSE; + bMustCalc = sal_False; if ( mpData->m_aItems[nPos].mpWindow ) mpData->m_aItems[nPos].mpWindow->Hide(); @@ -830,9 +826,9 @@ void ToolBox::RemoveItem( USHORT nPos ) // ----------------------------------------------------------------------- -void ToolBox::MoveItem( USHORT nItemId, USHORT nNewPos ) +void ToolBox::MoveItem( sal_uInt16 nItemId, sal_uInt16 nNewPos ) { - USHORT nPos = GetItemPos( nItemId ); + sal_uInt16 nPos = GetItemPos( nItemId ); if ( nPos == nNewPos ) return; @@ -850,14 +846,14 @@ void ToolBox::MoveItem( USHORT nItemId, USHORT nNewPos ) mpData->ImplClearLayoutData(); // ToolBox neu ausgeben - ImplInvalidate( FALSE ); + ImplInvalidate( sal_False ); // Notify if( nPos < nNewPos ) // only send one event, all indices above this item are invalid anyway ImplCallEventListeners( VCLEVENT_TOOLBOX_ITEMREMOVED, reinterpret_cast< void* >( nPos ) ); else { - USHORT nNewPos2 = sal::static_int_cast<USHORT>(( nNewPos == TOOLBOX_APPEND ) ? ( mpData->m_aItems.size() - 1 ) : nNewPos); + sal_uInt16 nNewPos2 = sal::static_int_cast<sal_uInt16>(( nNewPos == TOOLBOX_APPEND ) ? ( mpData->m_aItems.size() - 1 ) : nNewPos); ImplCallEventListeners( VCLEVENT_TOOLBOX_ITEMADDED, reinterpret_cast< void* >( nNewPos2 ) ); } } @@ -865,13 +861,13 @@ void ToolBox::MoveItem( USHORT nItemId, USHORT nNewPos ) // ----------------------------------------------------------------------- -void ToolBox::CopyItem( const ToolBox& rToolBox, USHORT nItemId, - USHORT nNewPos ) +void ToolBox::CopyItem( const ToolBox& rToolBox, sal_uInt16 nItemId, + sal_uInt16 nNewPos ) { DBG_ASSERT( GetItemPos( nItemId ) == TOOLBOX_ITEM_NOTFOUND, "ToolBox::CopyItem(): ItemId already exists" ); - USHORT nPos = rToolBox.GetItemPos( nItemId ); + sal_uInt16 nPos = rToolBox.GetItemPos( nItemId ); // Existiert Item if ( nPos != TOOLBOX_ITEM_NOTFOUND ) @@ -880,15 +876,15 @@ void ToolBox::CopyItem( const ToolBox& rToolBox, USHORT nItemId, ImplToolItem aNewItem = rToolBox.mpData->m_aItems[nPos]; // Bestimme Daten zuruecksetzen aNewItem.mpWindow = NULL; - aNewItem.mbShowWindow = FALSE; + aNewItem.mbShowWindow = sal_False; mpData->m_aItems.insert( (nNewPos < mpData->m_aItems.size()) ? mpData->m_aItems.begin()+nNewPos : mpData->m_aItems.end(), aNewItem ); mpData->ImplClearLayoutData(); // ToolBox neu ausgeben - ImplInvalidate( FALSE ); + ImplInvalidate( sal_False ); // Notify - USHORT nNewPos2 = sal::static_int_cast<USHORT>(( nNewPos == TOOLBOX_APPEND ) ? ( mpData->m_aItems.size() - 1 ) : nNewPos); + sal_uInt16 nNewPos2 = sal::static_int_cast<sal_uInt16>(( nNewPos == TOOLBOX_APPEND ) ? ( mpData->m_aItems.size() - 1 ) : nNewPos); ImplCallEventListeners( VCLEVENT_TOOLBOX_ITEMADDED, reinterpret_cast< void* >( nNewPos2 ) ); } } @@ -907,10 +903,10 @@ void ToolBox::CopyItems( const ToolBox& rToolBox ) it != mpData->m_aItems.end(); ++it ) { it->mpWindow = NULL; - it->mbShowWindow = FALSE; + it->mbShowWindow = sal_False; } - ImplInvalidate( TRUE, TRUE ); + ImplInvalidate( sal_True, sal_True ); // Notify ImplCallEventListeners( VCLEVENT_TOOLBOX_ALLITEMSCHANGED ); @@ -927,7 +923,7 @@ void ToolBox::Clear() mnCurItemId = 0; mnHighItemId = 0; - ImplInvalidate( TRUE, TRUE ); + ImplInvalidate( sal_True, sal_True ); // Notify ImplCallEventListeners( VCLEVENT_TOOLBOX_ALLITEMSCHANGED ); @@ -943,7 +939,7 @@ void ToolBox::SetButtonType( ButtonType eNewType ) // Hier besser alles neu ausgeben, da es ansonsten zu Problemen // mit den per CopyBits kopierten Bereichen geben kann - ImplInvalidate( TRUE ); + ImplInvalidate( sal_True ); } } @@ -954,8 +950,8 @@ void ToolBox::SetToolboxButtonSize( ToolBoxButtonSize eSize ) if( mpData->meButtonSize != eSize ) { mpData->meButtonSize = eSize; - mbCalc = TRUE; - mbFormat = TRUE; + mbCalc = sal_True; + mbFormat = sal_True; } } @@ -970,10 +966,10 @@ const Size& ToolBox::GetDefaultImageSize() const { static Size aSmallButtonSize( TB_SMALLIMAGESIZE, TB_SMALLIMAGESIZE ); - static ULONG s_nSymbolsStyle = STYLE_SYMBOLS_DEFAULT; + static sal_uLong s_nSymbolsStyle = STYLE_SYMBOLS_DEFAULT; static Size aLargeButtonSize( TB_LARGEIMAGESIZE, TB_LARGEIMAGESIZE ); - ULONG nSymbolsStyle = Application::GetSettings().GetStyleSettings().GetCurrentSymbolsStyle(); + sal_uLong nSymbolsStyle = Application::GetSettings().GetStyleSettings().GetCurrentSymbolsStyle(); if ( s_nSymbolsStyle != nSymbolsStyle ) { s_nSymbolsStyle = nSymbolsStyle; @@ -1008,13 +1004,13 @@ void ToolBox::SetAlign( WindowAlign eNewAlign ) { // Setzen, ob Items horizontal oder vertikal angeordnet werden sollen if ( (eNewAlign == WINDOWALIGN_LEFT) || (eNewAlign == WINDOWALIGN_RIGHT) ) - mbHorz = FALSE; + mbHorz = sal_False; else - mbHorz = TRUE; + mbHorz = sal_True; // Hier alles neu ausgeben, da sich Border auch aendert - mbCalc = TRUE; - mbFormat = TRUE; + mbCalc = sal_True; + mbFormat = sal_True; if ( IsReallyVisible() && IsUpdateMode() ) Invalidate(); } @@ -1023,7 +1019,7 @@ void ToolBox::SetAlign( WindowAlign eNewAlign ) // ----------------------------------------------------------------------- -void ToolBox::SetLineCount( USHORT nNewLines ) +void ToolBox::SetLineCount( sal_uInt16 nNewLines ) { if ( !nNewLines ) nNewLines = 1; @@ -1034,18 +1030,18 @@ void ToolBox::SetLineCount( USHORT nNewLines ) // Hier besser alles neu ausgeben, da es ansonsten zu Problemen // mit den per CopyBits kopierten Bereichen geben kann - ImplInvalidate( FALSE ); + ImplInvalidate( sal_False ); } } // ----------------------------------------------------------------------- -void ToolBox::SetPageScroll( BOOL b ) +void ToolBox::SetPageScroll( sal_Bool b ) { mpData->mbPageScroll = b; } -BOOL ToolBox::GetPageScroll() +sal_Bool ToolBox::GetPageScroll() { return mpData->mbPageScroll; } @@ -1054,45 +1050,45 @@ BOOL ToolBox::GetPageScroll() void ToolBox::SetNextToolBox( const XubString& rStr ) { - BOOL bCalcNew = (!maNextToolBoxStr.Len() != !rStr.Len()); + sal_Bool bCalcNew = (!maNextToolBoxStr.Len() != !rStr.Len()); maNextToolBoxStr = rStr; if ( bCalcNew ) - ImplInvalidate( TRUE, FALSE ); + ImplInvalidate( sal_True, sal_False ); } // ----------------------------------------------------------------------- -USHORT ToolBox::GetItemCount() const +sal_uInt16 ToolBox::GetItemCount() const { - return (USHORT)mpData->m_aItems.size(); + return (sal_uInt16)mpData->m_aItems.size(); } // ----------------------------------------------------------------------- -ToolBoxItemType ToolBox::GetItemType( USHORT nPos ) const +ToolBoxItemType ToolBox::GetItemType( sal_uInt16 nPos ) const { return (nPos < mpData->m_aItems.size()) ? mpData->m_aItems[nPos].meType : TOOLBOXITEM_DONTKNOW; } // ----------------------------------------------------------------------- -USHORT ToolBox::GetItemPos( USHORT nItemId ) const +sal_uInt16 ToolBox::GetItemPos( sal_uInt16 nItemId ) const { int nCount = mpData->m_aItems.size(); for( int nPos = 0; nPos < nCount; nPos++ ) if( mpData->m_aItems[nPos].mnId == nItemId ) - return (USHORT)nPos; + return (sal_uInt16)nPos; return TOOLBOX_ITEM_NOTFOUND; } // ----------------------------------------------------------------------- -USHORT ToolBox::GetItemPos( const Point& rPos ) const +sal_uInt16 ToolBox::GetItemPos( const Point& rPos ) const { // search the item position on the given point - USHORT nRet = TOOLBOX_ITEM_NOTFOUND; - USHORT nPos = 0; + sal_uInt16 nRet = TOOLBOX_ITEM_NOTFOUND; + sal_uInt16 nPos = 0; std::vector< ImplToolItem >::const_iterator it = mpData->m_aItems.begin(); while( it != mpData->m_aItems.end() ) { @@ -1112,14 +1108,14 @@ USHORT ToolBox::GetItemPos( const Point& rPos ) const // ----------------------------------------------------------------------- -USHORT ToolBox::GetItemId( USHORT nPos ) const +sal_uInt16 ToolBox::GetItemId( sal_uInt16 nPos ) const { return (nPos < mpData->m_aItems.size()) ? mpData->m_aItems[nPos].mnId : 0; } // ----------------------------------------------------------------------- -USHORT ToolBox::GetItemId( const Point& rPos ) const +sal_uInt16 ToolBox::GetItemId( const Point& rPos ) const { // Item suchen, das geklickt wurde std::vector< ImplToolItem >::const_iterator it = mpData->m_aItems.begin(); @@ -1197,25 +1193,25 @@ Point ToolBox::ImplGetPopupPosition( const Rectangle& rRect, const Size& rSize ) } -Point ToolBox::GetItemPopupPosition( USHORT nItemId, const Size& rSize ) const +Point ToolBox::GetItemPopupPosition( sal_uInt16 nItemId, const Size& rSize ) const { return ImplGetPopupPosition( GetItemRect( nItemId ), rSize ); } // ----------------------------------------------------------------------- -Rectangle ToolBox::GetItemRect( USHORT nItemId ) const +Rectangle ToolBox::GetItemRect( sal_uInt16 nItemId ) const { if ( mbCalc || mbFormat ) ((ToolBox*)this)->ImplFormat(); - USHORT nPos = GetItemPos( nItemId ); + sal_uInt16 nPos = GetItemPos( nItemId ); return GetItemPosRect( nPos ); } // ----------------------------------------------------------------------- -Rectangle ToolBox::GetItemPosRect( USHORT nPos ) const +Rectangle ToolBox::GetItemPosRect( sal_uInt16 nPos ) const { if ( mbCalc || mbFormat ) ((ToolBox*)this)->ImplFormat(); @@ -1227,18 +1223,18 @@ Rectangle ToolBox::GetItemPosRect( USHORT nPos ) const } // ----------------------------------------------------------------------- -Rectangle ToolBox::GetItemDropDownRect( USHORT nItemId ) const +Rectangle ToolBox::GetItemDropDownRect( sal_uInt16 nItemId ) const { if ( mbCalc || mbFormat ) ((ToolBox*)this)->ImplFormat(); - USHORT nPos = GetItemPos( nItemId ); + sal_uInt16 nPos = GetItemPos( nItemId ); return GetItemPosDropDownRect( nPos ); } // ----------------------------------------------------------------------- -Rectangle ToolBox::GetItemPosDropDownRect( USHORT nPos ) const +Rectangle ToolBox::GetItemPosDropDownRect( sal_uInt16 nPos ) const { if ( mbCalc || mbFormat ) ((ToolBox*)this)->ImplFormat(); @@ -1256,24 +1252,24 @@ Rectangle ToolBox::GetMenubuttonRect() const return mpData->maMenubuttonItem.maRect; } -BOOL ToolBox::ImplHasExternalMenubutton() +sal_Bool ToolBox::ImplHasExternalMenubutton() { // check if the borderwindow (i.e. the decoration) provides the menu button - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; if( ImplIsFloatingMode() ) { // custom menu is placed in the decoration ImplBorderWindow *pBorderWin = dynamic_cast<ImplBorderWindow*>( GetWindow( WINDOW_BORDER ) ); if( pBorderWin && !pBorderWin->GetMenuRect().IsEmpty() ) - bRet = TRUE; + bRet = sal_True; } return bRet; } // ----------------------------------------------------------------------- -void ToolBox::SetItemBits( USHORT nItemId, ToolBoxItemBits nBits ) +void ToolBox::SetItemBits( sal_uInt16 nItemId, ToolBoxItemBits nBits ) { - USHORT nPos = GetItemPos( nItemId ); + sal_uInt16 nPos = GetItemPos( nItemId ); if ( nPos < mpData->m_aItems.size() ) { @@ -1282,15 +1278,15 @@ void ToolBox::SetItemBits( USHORT nItemId, ToolBoxItemBits nBits ) nBits &= TIB_LEFT | TIB_AUTOSIZE | TIB_DROPDOWN; nOldBits &= TIB_LEFT | TIB_AUTOSIZE | TIB_DROPDOWN; // trigger reformat when the item width has changed (dropdown arrow) - BOOL bFormat = (nBits & TIB_DROPDOWN) != (nOldBits & TIB_DROPDOWN); + sal_Bool bFormat = (nBits & TIB_DROPDOWN) != (nOldBits & TIB_DROPDOWN); if ( nBits != nOldBits ) - ImplInvalidate( TRUE, bFormat ); + ImplInvalidate( sal_True, bFormat ); } } // ----------------------------------------------------------------------- -ToolBoxItemBits ToolBox::GetItemBits( USHORT nItemId ) const +ToolBoxItemBits ToolBox::GetItemBits( sal_uInt16 nItemId ) const { ImplToolItem* pItem = ImplGetItem( nItemId ); @@ -1302,9 +1298,9 @@ ToolBoxItemBits ToolBox::GetItemBits( USHORT nItemId ) const // ----------------------------------------------------------------------- -void ToolBox::SetItemData( USHORT nItemId, void* pNewData ) +void ToolBox::SetItemData( sal_uInt16 nItemId, void* pNewData ) { - USHORT nPos = GetItemPos( nItemId ); + sal_uInt16 nPos = GetItemPos( nItemId ); if ( nPos < mpData->m_aItems.size() ) { @@ -1315,7 +1311,7 @@ void ToolBox::SetItemData( USHORT nItemId, void* pNewData ) // ----------------------------------------------------------------------- -void* ToolBox::GetItemData( USHORT nItemId ) const +void* ToolBox::GetItemData( sal_uInt16 nItemId ) const { ImplToolItem* pItem = ImplGetItem( nItemId ); @@ -1327,9 +1323,9 @@ void* ToolBox::GetItemData( USHORT nItemId ) const // ----------------------------------------------------------------------- -void ToolBox::SetItemImage( USHORT nItemId, const Image& rImage ) +void ToolBox::SetItemImage( sal_uInt16 nItemId, const Image& rImage ) { - USHORT nPos = GetItemPos( nItemId ); + sal_uInt16 nPos = GetItemPos( nItemId ); if ( nPos != TOOLBOX_ITEM_NOTFOUND ) { @@ -1340,7 +1336,7 @@ void ToolBox::SetItemImage( USHORT nItemId, const Image& rImage ) Size aOldSize = pItem->maImage.GetSizePixel(); pItem->maImage = rImage; if ( aOldSize != pItem->maImage.GetSizePixel() ) - ImplInvalidate( TRUE ); + ImplInvalidate( sal_True ); else ImplUpdateItem( nPos ); } @@ -1355,8 +1351,8 @@ void ToolBox::SetImageList( const ImageList& rImageList ) { maImageList = rImageList; - USHORT nCount = (USHORT)mpData->m_aItems.size(); - for( USHORT i = 0; i < nCount; i++ ) + sal_uInt16 nCount = (sal_uInt16)mpData->m_aItems.size(); + for( sal_uInt16 i = 0; i < nCount; i++ ) { Image aImage; if ( mpData->m_aItems[i].mnId ) @@ -1378,9 +1374,9 @@ static Image ImplRotImage( const Image& rImage, long nAngle10 ) return Image( aRotBitmapEx ); } -void ToolBox::SetItemImageAngle( USHORT nItemId, long nAngle10 ) +void ToolBox::SetItemImageAngle( sal_uInt16 nItemId, long nAngle10 ) { - USHORT nPos = GetItemPos( nItemId ); + sal_uInt16 nPos = GetItemPos( nItemId ); if ( nPos != TOOLBOX_ITEM_NOTFOUND ) { @@ -1402,7 +1398,7 @@ void ToolBox::SetItemImageAngle( USHORT nItemId, long nAngle10 ) if ( !mbCalc ) { if ( aOldSize != pItem->maImage.GetSizePixel() ) - ImplInvalidate( TRUE ); + ImplInvalidate( sal_True ); else ImplUpdateItem( nPos ); } @@ -1421,9 +1417,9 @@ static Image ImplMirrorImage( const Image& rImage ) return Image( aMirrBitmapEx ); } -void ToolBox::SetItemImageMirrorMode( USHORT nItemId, BOOL bMirror ) +void ToolBox::SetItemImageMirrorMode( sal_uInt16 nItemId, sal_Bool bMirror ) { - USHORT nPos = GetItemPos( nItemId ); + sal_uInt16 nPos = GetItemPos( nItemId ); if ( nPos != TOOLBOX_ITEM_NOTFOUND ) { @@ -1449,7 +1445,7 @@ void ToolBox::SetItemImageMirrorMode( USHORT nItemId, BOOL bMirror ) // ----------------------------------------------------------------------- -Image ToolBox::GetItemImage( USHORT nItemId ) const +Image ToolBox::GetItemImage( sal_uInt16 nItemId ) const { ImplToolItem* pItem = ImplGetItem( nItemId ); @@ -1461,7 +1457,7 @@ Image ToolBox::GetItemImage( USHORT nItemId ) const // ----------------------------------------------------------------------- -long ToolBox::GetItemImageAngle( USHORT nItemId ) const +long ToolBox::GetItemImageAngle( sal_uInt16 nItemId ) const { ImplToolItem* pItem = ImplGetItem( nItemId ); @@ -1473,32 +1469,32 @@ long ToolBox::GetItemImageAngle( USHORT nItemId ) const // ----------------------------------------------------------------------- -BOOL ToolBox::GetItemImageMirrorMode( USHORT nItemId ) const +sal_Bool ToolBox::GetItemImageMirrorMode( sal_uInt16 nItemId ) const { ImplToolItem* pItem = ImplGetItem( nItemId ); if ( pItem ) return pItem->mbMirrorMode; else - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- -void ToolBox::SetItemHighImage( USHORT nItemId, const Image& rImage ) +void ToolBox::SetItemHighImage( sal_uInt16 nItemId, const Image& rImage ) { ImplToolItem* pItem = ImplGetItem( nItemId ); if ( pItem ) { DBG_ASSERT( (pItem->maImage.GetSizePixel() == rImage.GetSizePixel()) || - ((!rImage) == TRUE), "ToolBox::SetItemHighImage() - ImageSize != HighImageSize" ); + ((!rImage) == sal_True), "ToolBox::SetItemHighImage() - ImageSize != HighImageSize" ); pItem->maHighImage = rImage; } } // ----------------------------------------------------------------------- -Image ToolBox::GetItemHighImage( USHORT nItemId ) const +Image ToolBox::GetItemHighImage( sal_uInt16 nItemId ) const { ImplToolItem* pItem = ImplGetItem( nItemId ); @@ -1510,9 +1506,9 @@ Image ToolBox::GetItemHighImage( USHORT nItemId ) const // ----------------------------------------------------------------------- -void ToolBox::SetItemText( USHORT nItemId, const XubString& rText ) +void ToolBox::SetItemText( sal_uInt16 nItemId, const XubString& rText ) { - USHORT nPos = GetItemPos( nItemId ); + sal_uInt16 nPos = GetItemPos( nItemId ); if ( nPos != TOOLBOX_ITEM_NOTFOUND ) { @@ -1525,7 +1521,7 @@ void ToolBox::SetItemText( USHORT nItemId, const XubString& rText ) pItem->maText = ImplConvertMenuString( rText ); mpData->ImplClearLayoutData(); if ( nOldWidth != GetCtrlTextWidth( pItem->maText ) ) - ImplInvalidate( TRUE ); + ImplInvalidate( sal_True ); else ImplUpdateItem( nPos ); } @@ -1542,7 +1538,7 @@ void ToolBox::SetItemText( USHORT nItemId, const XubString& rText ) // ----------------------------------------------------------------------- -const XubString& ToolBox::GetItemText( USHORT nItemId ) const +const XubString& ToolBox::GetItemText( sal_uInt16 nItemId ) const { ImplToolItem* pItem = ImplGetItem( nItemId ); @@ -1554,9 +1550,9 @@ const XubString& ToolBox::GetItemText( USHORT nItemId ) const // ----------------------------------------------------------------------- -void ToolBox::SetItemWindow( USHORT nItemId, Window* pNewWindow ) +void ToolBox::SetItemWindow( sal_uInt16 nItemId, Window* pNewWindow ) { - USHORT nPos = GetItemPos( nItemId ); + sal_uInt16 nPos = GetItemPos( nItemId ); if ( nPos != TOOLBOX_ITEM_NOTFOUND ) { @@ -1564,14 +1560,14 @@ void ToolBox::SetItemWindow( USHORT nItemId, Window* pNewWindow ) pItem->mpWindow = pNewWindow; if ( pNewWindow ) pNewWindow->Hide(); - ImplInvalidate( TRUE ); + ImplInvalidate( sal_True ); ImplCallEventListeners( VCLEVENT_TOOLBOX_ITEMWINDOWCHANGED, reinterpret_cast< void* >( nPos ) ); } } // ----------------------------------------------------------------------- -Window* ToolBox::GetItemWindow( USHORT nItemId ) const +Window* ToolBox::GetItemWindow( sal_uInt16 nItemId ) const { ImplToolItem* pItem = ImplGetItem( nItemId ); @@ -1590,7 +1586,7 @@ void ToolBox::StartSelection() if ( !mbSelection ) { - mbSelection = TRUE; + mbSelection = sal_True; mnCurPos = TOOLBOX_ITEM_NOTFOUND; mnCurItemId = 0; Activate(); @@ -1601,13 +1597,13 @@ void ToolBox::StartSelection() void ToolBox::EndSelection() { - mbCommandDrag = FALSE; + mbCommandDrag = sal_False; if ( mbDrag || mbSelection ) { // Daten zuruecksetzen - mbDrag = FALSE; - mbSelection = FALSE; + mbDrag = sal_False; + mbSelection = sal_False; if ( mnCurPos != TOOLBOX_ITEM_NOTFOUND ) ImplDrawItem( mnCurPos ); EndTracking(); @@ -1624,9 +1620,9 @@ void ToolBox::EndSelection() // ----------------------------------------------------------------------- -void ToolBox::SetItemDown( USHORT nItemId, BOOL bDown, BOOL bRelease ) +void ToolBox::SetItemDown( sal_uInt16 nItemId, sal_Bool bDown, sal_Bool bRelease ) { - USHORT nPos = GetItemPos( nItemId ); + sal_uInt16 nPos = GetItemPos( nItemId ); if ( nPos != TOOLBOX_ITEM_NOTFOUND ) { @@ -1635,7 +1631,7 @@ void ToolBox::SetItemDown( USHORT nItemId, BOOL bDown, BOOL bRelease ) if ( nPos != mnCurPos ) { mnCurPos = nPos; - ImplDrawItem( mnCurPos, TRUE ); + ImplDrawItem( mnCurPos, sal_True ); Flush(); } } @@ -1643,7 +1639,7 @@ void ToolBox::SetItemDown( USHORT nItemId, BOOL bDown, BOOL bRelease ) { if ( nPos == mnCurPos ) { - ImplDrawItem( mnCurPos, FALSE ); + ImplDrawItem( mnCurPos, sal_False ); Flush(); mnCurPos = TOOLBOX_ITEM_NOTFOUND; } @@ -1653,8 +1649,8 @@ void ToolBox::SetItemDown( USHORT nItemId, BOOL bDown, BOOL bRelease ) { if ( mbDrag || mbSelection ) { - mbDrag = FALSE; - mbSelection = FALSE; + mbDrag = sal_False; + mbSelection = sal_False; EndTracking(); ReleaseMouse(); Deactivate(); @@ -1670,21 +1666,21 @@ void ToolBox::SetItemDown( USHORT nItemId, BOOL bDown, BOOL bRelease ) // ----------------------------------------------------------------------- -BOOL ToolBox::IsItemDown( USHORT nItemId ) const +sal_Bool ToolBox::IsItemDown( sal_uInt16 nItemId ) const { - USHORT nPos = GetItemPos( nItemId ); + sal_uInt16 nPos = GetItemPos( nItemId ); if ( nPos != TOOLBOX_ITEM_NOTFOUND ) return (nPos == mnCurPos); else - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- -void ToolBox::SetItemState( USHORT nItemId, TriState eState ) +void ToolBox::SetItemState( sal_uInt16 nItemId, TriState eState ) { - USHORT nPos = GetItemPos( nItemId ); + sal_uInt16 nPos = GetItemPos( nItemId ); if ( nPos != TOOLBOX_ITEM_NOTFOUND ) { @@ -1698,8 +1694,8 @@ void ToolBox::SetItemState( USHORT nItemId, TriState eState ) (pItem->mnBits & TIB_RADIOCHECK) ) { ImplToolItem* pGroupItem; - USHORT nGroupPos; - USHORT nItemCount = GetItemCount(); + sal_uInt16 nGroupPos; + sal_uInt16 nItemCount = GetItemCount(); nGroupPos = nPos; while ( nGroupPos ) @@ -1744,7 +1740,7 @@ void ToolBox::SetItemState( USHORT nItemId, TriState eState ) // ----------------------------------------------------------------------- -TriState ToolBox::GetItemState( USHORT nItemId ) const +TriState ToolBox::GetItemState( sal_uInt16 nItemId ) const { ImplToolItem* pItem = ImplGetItem( nItemId ); @@ -1756,15 +1752,15 @@ TriState ToolBox::GetItemState( USHORT nItemId ) const // ----------------------------------------------------------------------- -void ToolBox::EnableItem( USHORT nItemId, BOOL bEnable ) +void ToolBox::EnableItem( sal_uInt16 nItemId, sal_Bool bEnable ) { - USHORT nPos = GetItemPos( nItemId ); + sal_uInt16 nPos = GetItemPos( nItemId ); if ( nPos != TOOLBOX_ITEM_NOTFOUND ) { ImplToolItem* pItem = &mpData->m_aItems[nPos]; if ( bEnable ) - bEnable = TRUE; + bEnable = sal_True; if ( pItem->mbEnabled != bEnable ) { pItem->mbEnabled = bEnable; @@ -1788,21 +1784,21 @@ void ToolBox::EnableItem( USHORT nItemId, BOOL bEnable ) // ----------------------------------------------------------------------- -BOOL ToolBox::IsItemEnabled( USHORT nItemId ) const +sal_Bool ToolBox::IsItemEnabled( sal_uInt16 nItemId ) const { ImplToolItem* pItem = ImplGetItem( nItemId ); if ( pItem ) return pItem->mbEnabled; else - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- -void ToolBox::ShowItem( USHORT nItemId, BOOL bVisible ) +void ToolBox::ShowItem( sal_uInt16 nItemId, sal_Bool bVisible ) { - USHORT nPos = GetItemPos( nItemId ); + sal_uInt16 nPos = GetItemPos( nItemId ); mpData->ImplClearLayoutData(); if ( nPos != TOOLBOX_ITEM_NOTFOUND ) @@ -1811,36 +1807,36 @@ void ToolBox::ShowItem( USHORT nItemId, BOOL bVisible ) if ( pItem->mbVisible != bVisible ) { pItem->mbVisible = bVisible; - ImplInvalidate( FALSE ); + ImplInvalidate( sal_False ); } } } // ----------------------------------------------------------------------- -BOOL ToolBox::IsItemVisible( USHORT nItemId ) const +sal_Bool ToolBox::IsItemVisible( sal_uInt16 nItemId ) const { ImplToolItem* pItem = ImplGetItem( nItemId ); if ( pItem ) return pItem->mbVisible; else - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- -BOOL ToolBox::IsItemReallyVisible( USHORT nItemId ) const +sal_Bool ToolBox::IsItemReallyVisible( sal_uInt16 nItemId ) const { // is the item on the visible area of the toolbox? - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; Rectangle aRect( mnLeftBorder, mnTopBorder, mnDX-mnRightBorder, mnDY-mnBottomBorder ); ImplToolItem* pItem = ImplGetItem( nItemId ); if ( pItem && pItem->mbVisible && !pItem->maRect.IsEmpty() && aRect.IsOver( pItem->maRect ) ) { - bRet = TRUE; + bRet = sal_True; } return bRet; @@ -1848,7 +1844,7 @@ BOOL ToolBox::IsItemReallyVisible( USHORT nItemId ) const // ----------------------------------------------------------------------- -void ToolBox::SetItemCommand( USHORT nItemId, const XubString& rCommand ) +void ToolBox::SetItemCommand( sal_uInt16 nItemId, const XubString& rCommand ) { ImplToolItem* pItem = ImplGetItem( nItemId ); @@ -1858,7 +1854,7 @@ void ToolBox::SetItemCommand( USHORT nItemId, const XubString& rCommand ) // ----------------------------------------------------------------------- -const XubString& ToolBox::GetItemCommand( USHORT nItemId ) const +const XubString& ToolBox::GetItemCommand( sal_uInt16 nItemId ) const { ImplToolItem* pItem = ImplGetItem( nItemId ); @@ -1870,7 +1866,7 @@ const XubString& ToolBox::GetItemCommand( USHORT nItemId ) const // ----------------------------------------------------------------------- -void ToolBox::SetQuickHelpText( USHORT nItemId, const XubString& rText ) +void ToolBox::SetQuickHelpText( sal_uInt16 nItemId, const XubString& rText ) { ImplToolItem* pItem = ImplGetItem( nItemId ); @@ -1880,7 +1876,7 @@ void ToolBox::SetQuickHelpText( USHORT nItemId, const XubString& rText ) // ----------------------------------------------------------------------- -const XubString& ToolBox::GetQuickHelpText( USHORT nItemId ) const +const XubString& ToolBox::GetQuickHelpText( sal_uInt16 nItemId ) const { ImplToolItem* pItem = ImplGetItem( nItemId ); @@ -1892,7 +1888,7 @@ const XubString& ToolBox::GetQuickHelpText( USHORT nItemId ) const // ----------------------------------------------------------------------- -void ToolBox::SetHelpText( USHORT nItemId, const XubString& rText ) +void ToolBox::SetHelpText( sal_uInt16 nItemId, const XubString& rText ) { ImplToolItem* pItem = ImplGetItem( nItemId ); @@ -1902,31 +1898,38 @@ void ToolBox::SetHelpText( USHORT nItemId, const XubString& rText ) // ----------------------------------------------------------------------- -const XubString& ToolBox::GetHelpText( USHORT nItemId ) const +const XubString& ToolBox::GetHelpText( sal_uInt16 nItemId ) const { return ImplGetHelpText( nItemId ); } // ----------------------------------------------------------------------- -void ToolBox::SetHelpId( USHORT nItemId, ULONG nHelpId ) +void ToolBox::SetHelpId( sal_uInt16 nItemId, const rtl::OString& rHelpId ) { ImplToolItem* pItem = ImplGetItem( nItemId ); if ( pItem ) - pItem->mnHelpId = nHelpId; + pItem->maHelpId = rHelpId; } // ----------------------------------------------------------------------- -ULONG ToolBox::GetHelpId( USHORT nItemId ) const +rtl::OString ToolBox::GetHelpId( sal_uInt16 nItemId ) const { + rtl::OString aRet; + ImplToolItem* pItem = ImplGetItem( nItemId ); if ( pItem ) - return pItem->mnHelpId; - else - return 0; + { + if ( pItem->maHelpId.getLength() ) + aRet = pItem->maHelpId; + else + aRet = ::rtl::OUStringToOString( pItem->maCommandStr, RTL_TEXTENCODING_UTF8 ); + } + + return aRet; } // ----------------------------------------------------------------------- @@ -1936,12 +1939,12 @@ void ToolBox::SetBorder( long nX, long nY ) mnBorderX = nX; mnBorderY = nY; - ImplInvalidate( TRUE, TRUE ); + ImplInvalidate( sal_True, sal_True ); } // ----------------------------------------------------------------------- -void ToolBox::SetOutStyle( USHORT nNewStyle ) +void ToolBox::SetOutStyle( sal_uInt16 nNewStyle ) { // always force flat looking toolbars since NWF nNewStyle |= TOOLBOX_STYLE_FLAT; @@ -1958,7 +1961,7 @@ void ToolBox::SetOutStyle( USHORT nNewStyle ) mnMaxItemHeight = 1; } - ImplInvalidate( TRUE, TRUE ); + ImplInvalidate( sal_True, sal_True ); } } @@ -1966,7 +1969,7 @@ void ToolBox::SetOutStyle( USHORT nNewStyle ) void ToolBox::RecalcItems() { - ImplInvalidate( TRUE ); + ImplInvalidate( sal_True ); } // ----------------------------------------------------------------------- @@ -1981,11 +1984,11 @@ void ToolBox::ImplUpdateInputEnable() if( it->mbEnabled ) { // at least one useful entry - mpData->mbKeyInputDisabled = FALSE; + mpData->mbKeyInputDisabled = sal_False; return; } } - mpData->mbKeyInputDisabled = TRUE; + mpData->mbKeyInputDisabled = sal_True; } // ----------------------------------------------------------------------- @@ -1994,14 +1997,14 @@ void ToolBox::ImplFillLayoutData() const { mpData->m_pLayoutData = new ToolBoxLayoutData(); - USHORT nCount = (USHORT)mpData->m_aItems.size(); - for( USHORT i = 0; i < nCount; i++ ) + sal_uInt16 nCount = (sal_uInt16)mpData->m_aItems.size(); + for( sal_uInt16 i = 0; i < nCount; i++ ) { ImplToolItem* pItem = &mpData->m_aItems[i]; // Nur malen, wenn Rechteck im PaintRectangle liegt if ( !pItem->maRect.IsEmpty() ) - const_cast<ToolBox*>(this)->ImplDrawItem( i, FALSE, FALSE, TRUE ); + const_cast<ToolBox*>(this)->ImplDrawItem( i, sal_False, sal_False, sal_True ); } } @@ -2016,14 +2019,14 @@ String ToolBox::GetDisplayText() const // ----------------------------------------------------------------------- -Rectangle ToolBox::GetCharacterBounds( USHORT nItemID, long nIndex ) const +Rectangle ToolBox::GetCharacterBounds( sal_uInt16 nItemID, long nIndex ) const { long nItemIndex = -1; if( ! mpData->m_pLayoutData ) ImplFillLayoutData(); if( mpData->m_pLayoutData ) { - for( ULONG i = 0; i < mpData->m_pLayoutData->m_aLineItemIds.size(); i++ ) + for( sal_uLong i = 0; i < mpData->m_pLayoutData->m_aLineItemIds.size(); i++ ) { if( mpData->m_pLayoutData->m_aLineItemIds[i] == nItemID ) { @@ -2037,7 +2040,7 @@ Rectangle ToolBox::GetCharacterBounds( USHORT nItemID, long nIndex ) const // ----------------------------------------------------------------------- -long ToolBox::GetIndexForPoint( const Point& rPoint, USHORT& rItemID ) const +long ToolBox::GetIndexForPoint( const Point& rPoint, sal_uInt16& rItemID ) const { long nIndex = -1; rItemID = 0; @@ -2046,7 +2049,7 @@ long ToolBox::GetIndexForPoint( const Point& rPoint, USHORT& rItemID ) const if( mpData->m_pLayoutData ) { nIndex = mpData->m_pLayoutData->GetIndexForPoint( rPoint ); - for( ULONG i = 0; i < mpData->m_pLayoutData->m_aLineIndices.size(); i++ ) + for( sal_uLong i = 0; i < mpData->m_pLayoutData->m_aLineIndices.size(); i++ ) { if( mpData->m_pLayoutData->m_aLineIndices[i] <= nIndex && (i == mpData->m_pLayoutData->m_aLineIndices.size()-1 || mpData->m_pLayoutData->m_aLineIndices[i+1] > nIndex) ) @@ -2079,12 +2082,12 @@ Pair ToolBox::GetTextStartEnd( long nText ) const // ----------------------------------------------------------------------- -USHORT ToolBox::GetDisplayItemId( long nText ) const +sal_uInt16 ToolBox::GetDisplayItemId( long nText ) const { - USHORT nItemId = 0; + sal_uInt16 nItemId = 0; if( ! mpData->m_pLayoutData ) ImplFillLayoutData(); - if( mpData->m_pLayoutData && nText >= 0 && (ULONG)nText < mpData->m_pLayoutData->m_aLineItemIds.size() ) + if( mpData->m_pLayoutData && nText >= 0 && (sal_uLong)nText < mpData->m_pLayoutData->m_aLineItemIds.size() ) nItemId = mpData->m_pLayoutData->m_aLineItemIds[nText]; return nItemId; } @@ -2104,7 +2107,7 @@ const Link& ToolBox::GetDropdownClickHdl() const // ----------------------------------------------------------------------- -void ToolBox::SetMenuType( USHORT aType ) +void ToolBox::SetMenuType( sal_uInt16 aType ) { if( aType != mpData->maMenuType ) { @@ -2114,9 +2117,9 @@ void ToolBox::SetMenuType( USHORT aType ) // the menu button may have to be moved into the decoration which changes the layout ImplDockingWindowWrapper *pWrapper = ImplGetDockingManager()->GetDockingWindowWrapper( this ); if( pWrapper ) - pWrapper->ShowTitleButton( TITLE_BUTTON_MENU, ( aType & TOOLBOX_MENUTYPE_CUSTOMIZE) ? TRUE : FALSE ); + pWrapper->ShowTitleButton( TITLE_BUTTON_MENU, ( aType & TOOLBOX_MENUTYPE_CUSTOMIZE) ? sal_True : sal_False ); - mbFormat = TRUE; + mbFormat = sal_True; ImplFormat(); ImplSetMinMaxFloatSize( this ); } @@ -2129,12 +2132,12 @@ void ToolBox::SetMenuType( USHORT aType ) } } -USHORT ToolBox::GetMenuType() const +sal_uInt16 ToolBox::GetMenuType() const { return mpData->maMenuType; } -BOOL ToolBox::IsMenuEnabled() const +sal_Bool ToolBox::IsMenuEnabled() const { return mpData->maMenuType != TOOLBOX_MENUTYPE_NONE; } @@ -2156,7 +2159,7 @@ const Link& ToolBox::GetMenuButtonHdl() const // ----------------------------------------------------------------------- -BOOL ToolBox::ImplHasClippedItems() +sal_Bool ToolBox::ImplHasClippedItems() { // are any items currently clipped ? ImplFormat(); @@ -2164,10 +2167,10 @@ BOOL ToolBox::ImplHasClippedItems() while ( it != mpData->m_aItems.end() ) { if( it->IsClipped() ) - return TRUE; + return sal_True; ++it; } - return FALSE; + return sal_False; } void ToolBox::ImplUpdateCustomMenu() @@ -2178,7 +2181,7 @@ void ToolBox::ImplUpdateCustomMenu() PopupMenu *pMenu = GetMenu(); - USHORT i = 0; + sal_uInt16 i = 0; // remove old entries while( i < pMenu->GetItemCount() ) { @@ -2199,7 +2202,7 @@ void ToolBox::ImplUpdateCustomMenu() { if( it->IsClipped() ) { - USHORT id = it->mnId + TOOLBOX_MENUITEM_START; + sal_uInt16 id = it->mnId + TOOLBOX_MENUITEM_START; pMenu->InsertItem( id, it->maText, it->maImage, 0, 0 ); pMenu->EnableItem( id, it->mbEnabled ); pMenu->CheckItem( id, it->meState == STATE_CHECK ); @@ -2212,9 +2215,9 @@ IMPL_LINK( ToolBox, ImplCustomMenuListener, VclMenuEvent*, pEvent ) { if( pEvent->GetMenu() == GetMenu() && pEvent->GetId() == VCLEVENT_MENU_SELECT ) { - USHORT id = GetMenu()->GetItemId( pEvent->GetItemPos() ); + sal_uInt16 id = GetMenu()->GetItemId( pEvent->GetItemPos() ); if( id >= TOOLBOX_MENUITEM_START ) - TriggerItem( id - TOOLBOX_MENUITEM_START, FALSE, FALSE ); + TriggerItem( id - TOOLBOX_MENUITEM_START, sal_False, sal_False ); } return 0; } @@ -2262,7 +2265,7 @@ void ToolBox::ImplExecuteCustomMenu() } } - USHORT uId = GetMenu()->Execute( pWin, Rectangle( ImplGetPopupPosition( aMenuRect, Size() ), Size() ), + sal_uInt16 uId = GetMenu()->Execute( pWin, Rectangle( ImplGetPopupPosition( aMenuRect, Size() ), Size() ), POPUPMENU_EXECUTE_DOWN | POPUPMENU_NOMOUSEUPCLOSE ); if ( aDelData.IsDelete() ) @@ -2299,24 +2302,24 @@ void ToolBox::ExecuteCustomMenu() // ----------------------------------------------------------------------- // checks override first, useful during calculation of sizes -BOOL ToolBox::ImplIsFloatingMode() const +sal_Bool ToolBox::ImplIsFloatingMode() const { DBG_ASSERT( !(mpData->mbAssumeDocked && mpData->mbAssumeFloating), "ToolBox::ImplIsFloatingMode(): cannot assume docked and floating" ); if( mpData->mbAssumeDocked ) - return FALSE; + return sal_False; else if( mpData->mbAssumeFloating ) - return TRUE; + return sal_True; else return IsFloatingMode(); } // checks override first, useful during calculation of sizes -BOOL ToolBox::ImplIsInPopupMode() const +sal_Bool ToolBox::ImplIsInPopupMode() const { if( mpData->mbAssumePopupMode ) - return TRUE; + return sal_True; else { ImplDockingWindowWrapper *pWrapper = ImplGetDockingManager()->GetDockingWindowWrapper( this ); @@ -2326,7 +2329,7 @@ BOOL ToolBox::ImplIsInPopupMode() const // ----------------------------------------------------------------------- -void ToolBox::Lock( BOOL bLock ) +void ToolBox::Lock( sal_Bool bLock ) { ImplDockingWindowWrapper *pWrapper = ImplGetDockingManager()->GetDockingWindowWrapper( this ); if( !pWrapper ) @@ -2336,8 +2339,8 @@ void ToolBox::Lock( BOOL bLock ) mpData->mbIsLocked = bLock; if( !ImplIsFloatingMode() ) { - mbCalc = TRUE; - mbFormat = TRUE; + mbCalc = sal_True; + mbFormat = sal_True; SetSizePixel( CalcWindowSizePixel(1) ); Invalidate(); } @@ -2346,7 +2349,7 @@ void ToolBox::Lock( BOOL bLock ) // ----------------------------------------------------------------------- -BOOL ToolBox::AlwaysLocked() +sal_Bool ToolBox::AlwaysLocked() { // read config item to determine toolbox behaviour, used for subtoolbars @@ -2362,35 +2365,35 @@ BOOL ToolBox::AlwaysLocked() if ( aNode.isValid() ) { // feature enabled ? - BOOL bStatesEnabled = BOOL(); + sal_Bool bStatesEnabled = sal_Bool(); ::com::sun::star::uno::Any aValue = aNode.getNodeValue( OUString(RTL_CONSTASCII_USTRINGPARAM("StatesEnabled")) ); if( aValue >>= bStatesEnabled ) { - if( bStatesEnabled == TRUE ) + if( bStatesEnabled == sal_True ) { // now read the locking state utl::OConfigurationNode aNode2 = utl::OConfigurationTreeRoot::tryCreateWithServiceFactory( vcl::unohelper::GetMultiServiceFactory(), OUString(RTL_CONSTASCII_USTRINGPARAM("/org.openoffice.Office.UI.GlobalSettings/Toolbars/States")) ); // note: case sensisitive ! - BOOL bLocked = BOOL(); + sal_Bool bLocked = sal_Bool(); ::com::sun::star::uno::Any aValue2 = aNode2.getNodeValue( OUString(RTL_CONSTASCII_USTRINGPARAM("Locked")) ); if( aValue2 >>= bLocked ) - nAlwaysLocked = (bLocked == TRUE) ? 1 : 0; + nAlwaysLocked = (bLocked == sal_True) ? 1 : 0; } } } } - return nAlwaysLocked == 1 ? TRUE : FALSE; + return nAlwaysLocked == 1 ? sal_True : sal_False; } -BOOL ToolBox::WillUsePopupMode() const +sal_Bool ToolBox::WillUsePopupMode() const { return mpData->mbWillUsePopupMode; } -void ToolBox::WillUsePopupMode( BOOL b ) +void ToolBox::WillUsePopupMode( sal_Bool b ) { mpData->mbWillUsePopupMode = b; } |