diff options
Diffstat (limited to 'sfx2/source/toolbox/tbxitem.cxx')
-rw-r--r-- | sfx2/source/toolbox/tbxitem.cxx | 157 |
1 files changed, 78 insertions, 79 deletions
diff --git a/sfx2/source/toolbox/tbxitem.cxx b/sfx2/source/toolbox/tbxitem.cxx index 7cc25c872eb1..730926351a05 100644 --- a/sfx2/source/toolbox/tbxitem.cxx +++ b/sfx2/source/toolbox/tbxitem.cxx @@ -90,7 +90,6 @@ #include <sfx2/viewfrm.hxx> #include "arrdecl.hxx" #include "sfxtypes.hxx" -#include <sfx2/macrconf.hxx> #include <sfx2/genlink.hxx> #include "sfx2/sfxresid.hxx" #include <sfx2/sfx.hrc> @@ -125,7 +124,7 @@ using namespace ::com::sun::star::ui; //==================================================================== -SFX_IMPL_TOOLBOX_CONTROL_ARG(SfxToolBoxControl, SfxStringItem, TRUE); +SFX_IMPL_TOOLBOX_CONTROL_ARG(SfxToolBoxControl, SfxStringItem, sal_True); SFX_IMPL_TOOLBOX_CONTROL(SfxAppToolBoxControl_Impl, SfxStringItem); static Window* GetTopMostParentSystemWindow( Window* pWindow ) @@ -196,7 +195,7 @@ svt::ToolboxController* SAL_CALL SfxToolBoxControllerFactory( const Reference< X const SfxSlot* pSlot = pSlotPool->GetUnoSlot( aTargetURL.Path ); if ( pSlot ) { - USHORT nSlotId = pSlot->GetSlotId(); + sal_uInt16 nSlotId = pSlot->GetSlotId(); if ( nSlotId > 0 ) return SfxToolBoxControl::CreateControl( nSlotId, nID, pToolbox, pModule ); } @@ -207,11 +206,11 @@ svt::ToolboxController* SAL_CALL SfxToolBoxControllerFactory( const Reference< X struct SfxToolBoxControl_Impl { ToolBox* pBox; - BOOL bShowString; - USHORT nSelectModifier; + sal_Bool bShowString; + sal_uInt16 nSelectModifier; SfxTbxCtrlFactory* pFact; - USHORT nTbxId; - USHORT nSlotId; + sal_uInt16 nTbxId; + sal_uInt16 nSlotId; SfxPopupWindow* mpFloatingWindow; SfxPopupWindow* mpPopupWindow; Reference< XUIElement > mxUIElement; @@ -241,10 +240,10 @@ IMPL_LINK( SfxToolBoxControl_Impl, WindowEventListener, VclSimpleEvent*, pEvent //-------------------------------------------------------------------- SfxToolBoxControl::SfxToolBoxControl( - USHORT nSlotID, - USHORT nID, + sal_uInt16 nSlotID, + sal_uInt16 nID, ToolBox& rBox, - BOOL bShowStringItems ) + sal_Bool bShowStringItems ) : svt::ToolboxController() { pImpl = new SfxToolBoxControl_Impl; @@ -328,7 +327,7 @@ void SfxToolBoxControl::RegisterToolBoxControl( SfxModule* pMod, SfxTbxCtrlFacto SFX_APP()->RegisterToolBoxControl_Impl( pMod, pFact ); } -SfxToolBoxControl* SfxToolBoxControl::CreateControl( USHORT nSlotId, USHORT nTbxId, ToolBox *pBox, SfxModule* pMod ) +SfxToolBoxControl* SfxToolBoxControl::CreateControl( sal_uInt16 nSlotId, sal_uInt16 nTbxId, ToolBox *pBox, SfxModule* pMod ) { ::vos::OGuard aGuard( Application::GetSolarMutex() ); @@ -349,8 +348,8 @@ SfxToolBoxControl* SfxToolBoxControl::CreateControl( USHORT nSlotId, USHORT nTbx if ( pFactories ) { SfxTbxCtrlFactArr_Impl &rFactories = *pFactories; - USHORT nFactory; - const USHORT nCount = rFactories.Count(); + sal_uInt16 nFactory; + const sal_uInt16 nCount = rFactories.Count(); // search for a factory with the given slot id for( nFactory = 0; nFactory < nCount; ++nFactory ) @@ -376,8 +375,8 @@ SfxToolBoxControl* SfxToolBoxControl::CreateControl( USHORT nSlotId, USHORT nTbx } SfxTbxCtrlFactArr_Impl &rFactories = pApp->GetTbxCtrlFactories_Impl(); - USHORT nFactory; - const USHORT nCount = rFactories.Count(); + sal_uInt16 nFactory; + const sal_uInt16 nCount = rFactories.Count(); for( nFactory = 0; nFactory < nCount; ++nFactory ) if( (rFactories[nFactory]->nTypeId == aSlotType) && (rFactories[nFactory]->nSlotId == nSlotId) ) @@ -562,7 +561,7 @@ throw ( ::com::sun::star::uno::RuntimeException ) } } - USHORT nSlotId = 0; + sal_uInt16 nSlotId = 0; SfxSlotPool& rPool = SfxSlotPool::GetSlotPool( pViewFrame ); const SfxSlot* pSlot = rPool.GetUnoSlot( rEvent.FeatureURL.Path ); if ( pSlot ) @@ -670,7 +669,7 @@ void SAL_CALL SfxToolBoxControl::updateImage() throw (::com::sun::star::uno::Run void SAL_CALL SfxToolBoxControl::execute( sal_Int16 KeyModifier ) throw (::com::sun::star::uno::RuntimeException) { ::vos::OGuard aGuard( Application::GetSolarMutex() ); - Select( (USHORT)KeyModifier ); + Select( (sal_uInt16)KeyModifier ); } void SAL_CALL SfxToolBoxControl::click() throw (::com::sun::star::uno::RuntimeException) { @@ -827,7 +826,7 @@ void SfxToolBoxControl::createAndPositionSubToolBar( const ::rtl::OUString& rSub { static WeakReference< XUIElementFactory > xWeakUIElementFactory; - USHORT nItemId = pImpl->pBox->GetDownItemId(); + sal_uInt16 nItemId = pImpl->pBox->GetDownItemId(); if ( !nItemId ) return; @@ -962,7 +961,7 @@ IMPL_LINK( SfxToolBoxControl, ClosePopupWindow, SfxPopupWindow *, pWindow ) void SfxToolBoxControl::StateChanged ( - USHORT nId, + sal_uInt16 nId, SfxItemState eState, const SfxPoolItem* pState ) @@ -976,7 +975,7 @@ void SfxToolBoxControl::StateChanged // enabled/disabled-Flag pauschal korrigieren pImpl->pBox->EnableItem( GetId(), eState != SFX_ITEM_DISABLED ); - USHORT nItemBits = pImpl->pBox->GetItemBits( GetId() ); + sal_uInt16 nItemBits = pImpl->pBox->GetItemBits( GetId() ); nItemBits &= ~TIB_CHECKABLE; TriState eTri = STATE_NOCHECK; switch ( eState ) @@ -1016,15 +1015,15 @@ void SfxToolBoxControl::StateChanged //-------------------------------------------------------------------- -void SfxToolBoxControl::Select( USHORT nModifier ) +void SfxToolBoxControl::Select( sal_uInt16 nModifier ) { pImpl->nSelectModifier = nModifier; - Select( BOOL((nModifier & KEY_MOD1)!=0) ); + Select( sal_Bool((nModifier & KEY_MOD1)!=0) ); } //-------------------------------------------------------------------- -void SfxToolBoxControl::Select( BOOL /*bMod1*/ ) +void SfxToolBoxControl::Select( sal_Bool /*bMod1*/ ) { if(::comphelper::UiEventsLogger::isEnabled()) //#i88653# #i102805# { @@ -1135,7 +1134,7 @@ throw ( ::com::sun::star::uno::RuntimeException ) } } - USHORT nSlotId = 0; + sal_uInt16 nSlotId = 0; SfxSlotPool& rPool = SfxSlotPool::GetSlotPool( pViewFrame ); const SfxSlot* pSlot = rPool.GetUnoSlot( rEvent.FeatureURL.Path ); if ( pSlot ) @@ -1223,12 +1222,12 @@ throw ( ::com::sun::star::uno::RuntimeException ) //-------------------------------------------------------------------- SfxPopupWindow::SfxPopupWindow( - USHORT nId, + sal_uInt16 nId, const Reference< XFrame >& rFrame, WinBits nBits ) : FloatingWindow( SFX_APP()->GetTopWindow(), nBits ) - , m_bFloating(FALSE) - , m_bCascading( FALSE ) + , m_bFloating(sal_False) + , m_bCascading( sal_False ) , m_nId( nId ) , m_xFrame( rFrame ) , m_pStatusListener( 0 ) @@ -1243,12 +1242,12 @@ SfxPopupWindow::SfxPopupWindow( //-------------------------------------------------------------------- SfxPopupWindow::SfxPopupWindow( - USHORT nId, + sal_uInt16 nId, const Reference< XFrame >& rFrame, const ResId &rId ) : FloatingWindow( SFX_APP()->GetTopWindow(), rId ) - , m_bFloating(FALSE) - , m_bCascading( FALSE ) + , m_bFloating(sal_False) + , m_bCascading( sal_False ) , m_nId( nId ) , m_xFrame( rFrame ) , m_pStatusListener( 0 ) @@ -1263,13 +1262,13 @@ SfxPopupWindow::SfxPopupWindow( //-------------------------------------------------------------------- SfxPopupWindow::SfxPopupWindow( - USHORT nId, + sal_uInt16 nId, const Reference< XFrame >& rFrame, Window* pParentWindow, WinBits nBits ) : FloatingWindow( pParentWindow, nBits ) - , m_bFloating(FALSE) - , m_bCascading( FALSE ) + , m_bFloating(sal_False) + , m_bCascading( sal_False ) , m_nId( nId ) , m_xFrame( rFrame ) , m_pStatusListener( 0 ) @@ -1284,13 +1283,13 @@ SfxPopupWindow::SfxPopupWindow( //-------------------------------------------------------------------- SfxPopupWindow::SfxPopupWindow( - USHORT nId, + sal_uInt16 nId, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, Window* pParentWindow, const ResId &rId ) : FloatingWindow( pParentWindow, rId ) - , m_bFloating(FALSE) - , m_bCascading( FALSE ) + , m_bFloating(sal_False) + , m_bCascading( sal_False ) , m_nId( nId ) , m_xFrame( rFrame ) , m_pStatusListener( 0 ) @@ -1381,13 +1380,13 @@ void SfxPopupWindow::UpdateStatus( const rtl::OUString& rCommandURL ) //-------------------------------------------------------------------- -BOOL SfxPopupWindow::Close() +sal_Bool SfxPopupWindow::Close() { - m_bFloating = FALSE; + m_bFloating = sal_False; FloatingWindow::Close(); Delete(0); - return TRUE; + return sal_True; } //-------------------------------------------------------------------- @@ -1401,7 +1400,7 @@ void SfxPopupWindow::PopupModeEnd() { // wurde abgerissen DeleteFloatingWindow(); - m_bFloating = TRUE; + m_bFloating = sal_True; } else Close(); @@ -1422,14 +1421,14 @@ void SfxPopupWindow::DeleteFloatingWindow() void SfxPopupWindow::MouseMove( const ::MouseEvent& rMEvt ) { - if ( m_bCascading == FALSE ) + if ( m_bCascading == sal_False ) FloatingWindow::MouseMove( rMEvt ); else { // MouseMove-Event an die Children forwarden ::Point aPos = rMEvt.GetPosPixel(); ::Point aScrPos = OutputToScreenPixel( aPos ); - USHORT i = 0; + sal_uInt16 i = 0; Window* pWindow = GetChild( i ); while ( pWindow ) { @@ -1448,12 +1447,12 @@ void SfxPopupWindow::MouseMove( const ::MouseEvent& rMEvt ) void SfxPopupWindow::StartCascading() { - m_bCascading= TRUE; + m_bCascading= sal_True; } void SfxPopupWindow::EndCascading() { - m_bCascading = FALSE; + m_bCascading = sal_False; } //-------------------------------------------------------------------- @@ -1477,7 +1476,7 @@ SfxPopupWindow* SfxPopupWindow::Clone() const //-------------------------------------------------------------------- void SfxPopupWindow::StateChanged( - USHORT /*nSID*/, + sal_uInt16 /*nSID*/, SfxItemState eState, const SfxPoolItem* /*pState*/ ) /* [Bescheibung] @@ -1499,7 +1498,7 @@ void SfxPopupWindow::StateChanged( } else if ( m_bFloating ) { - Show( TRUE, SHOW_NOFOCUSCHANGE | SHOW_NOACTIVATE ); + Show( sal_True, SHOW_NOFOCUSCHANGE | SHOW_NOACTIVATE ); } } @@ -1515,9 +1514,9 @@ IMPL_LINK( SfxPopupWindow, Delete, void *, EMPTYARG ) //-------------------------------------------------------------------- -SfxAppToolBoxControl_Impl::SfxAppToolBoxControl_Impl( USHORT nSlotId, USHORT nId, ToolBox& rBox ) +SfxAppToolBoxControl_Impl::SfxAppToolBoxControl_Impl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rBox ) : SfxToolBoxControl( nSlotId, nId, rBox ) - , bBigImages( FALSE ) + , bBigImages( sal_False ) , pMenu( 0 ) { rBox.SetHelpId( nId, HID_TBXCONTROL_FILENEW ); @@ -1542,8 +1541,8 @@ SfxAppToolBoxControl_Impl::~SfxAppToolBoxControl_Impl() it return the existing state of the given URL in the popupmenu of this toolbox control. If the given URL can be located as an action command of one menu item of the - popup menu of this control, we return TRUE. Otherwhise we return FALSE. - Further we return a fallback URL, in case we have to return FALSE. Because + popup menu of this control, we return sal_True. Otherwhise we return sal_False. + Further we return a fallback URL, in case we have to return sal_False. Because the outside code must select a valid item of the popup menu everytime ... and we define it here. By the way this m ethod was written to handle error situations gracefully. E.g. it can be called during creation time @@ -1564,34 +1563,34 @@ SfxAppToolBoxControl_Impl::~SfxAppToolBoxControl_Impl() @param pImage contains the image of the menu for the URL. - @return TRUE - if URL could be located as an item of the popup menu. - FALSE - otherwhise. + @return sal_True - if URL could be located as an item of the popup menu. + sal_False - otherwhise. */ -BOOL Impl_ExistURLInMenu( const PopupMenu *pMenu , +sal_Bool Impl_ExistURLInMenu( const PopupMenu *pMenu , String &sURL , String *pFallback , Image *pImage ) { - BOOL bValidFallback = FALSE; + sal_Bool bValidFallback = sal_False; if (pMenu && sURL.Len()) { - USHORT c = pMenu->GetItemCount(); - for (USHORT p=0; p<c; ++p) + sal_uInt16 c = pMenu->GetItemCount(); + for (sal_uInt16 p=0; p<c; ++p) { - USHORT nId = pMenu->GetItemId(p); + sal_uInt16 nId = pMenu->GetItemId(p); String aCmd( pMenu->GetItemCommand(nId) ); if (!bValidFallback && aCmd.Len()) { *pFallback = aCmd; - bValidFallback = TRUE; + bValidFallback = sal_True; } if (aCmd.Search(sURL)==0)//match even if the menu command is more detailed (maybe an additional query) #i28667# { sURL = aCmd; *pImage = pMenu->GetItemImage( nId ); - return TRUE; + return sal_True; } } } @@ -1602,7 +1601,7 @@ BOOL Impl_ExistURLInMenu( const PopupMenu *pMenu , *pFallback += String(SvtModuleOptions().GetDefaultModuleName()); } - return FALSE; + return sal_False; } long Select_Impl( void* pHdl, void* pVoid ); @@ -1625,15 +1624,15 @@ SfxPopupWindow* SfxAppToolBoxControl_Impl::CreatePopupWindow() { pMenu->SetSelectHdl( Link( NULL, Select_Impl ) ); pMenu->SetActivateHdl( LINK( this, SfxAppToolBoxControl_Impl, Activate )); - rBox.SetItemDown( GetId(), TRUE ); - USHORT nSelected = pMenu->Execute( &rBox, aRect, POPUPMENU_EXECUTE_DOWN ); + rBox.SetItemDown( GetId(), sal_True ); + sal_uInt16 nSelected = pMenu->Execute( &rBox, aRect, POPUPMENU_EXECUTE_DOWN ); if ( nSelected ) { aLastURL = pMenu->GetItemCommand( nSelected ); SetImage( pMenu->GetItemCommand( nSelected ) ); } - rBox.SetItemDown( GetId(), FALSE ); + rBox.SetItemDown( GetId(), sal_False ); } return 0; @@ -1646,12 +1645,12 @@ void SfxAppToolBoxControl_Impl::SetImage( const String &rURL ) String aURL = rURL; String sFallback; Image aMenuImage; - BOOL bValid = Impl_ExistURLInMenu(pMenu,aURL,&sFallback,&aMenuImage); + sal_Bool bValid = Impl_ExistURLInMenu(pMenu,aURL,&sFallback,&aMenuImage); if (!bValid) aURL = sFallback; - BOOL bBig = SvtMiscOptions().AreCurrentSymbolsLarge(); - BOOL bHC = GetToolBox().GetSettings().GetStyleSettings().GetHighContrastMode(); + sal_Bool bBig = SvtMiscOptions().AreCurrentSymbolsLarge(); + sal_Bool bHC = GetToolBox().GetSettings().GetStyleSettings().GetHighContrastMode(); Image aImage = SvFileInformationManager::GetImageNoDefault( INetURLObject( aURL ), bBig, bHC ); if ( !aImage ) aImage = !!aMenuImage ? aMenuImage : @@ -1670,7 +1669,7 @@ void SfxAppToolBoxControl_Impl::SetImage( const String &rURL ) void SfxAppToolBoxControl_Impl::StateChanged ( - USHORT nSlotId, + sal_uInt16 nSlotId, SfxItemState eState, const SfxPoolItem* pState ) @@ -1700,7 +1699,7 @@ void SfxAppToolBoxControl_Impl::StateChanged //-------------------------------------------------------------------- -void SfxAppToolBoxControl_Impl::Select( BOOL bMod1 ) +void SfxAppToolBoxControl_Impl::Select( sal_Bool bMod1 ) { if( aLastURL.Len() ) { @@ -1793,7 +1792,7 @@ long Select_Impl( void* /*pHdl*/, void* pVoid ) Application::PostUserEvent( STATIC_LINK( 0, SfxAppToolBoxControl_Impl, ExecuteHdl_Impl), pExecuteInfo ); } - return TRUE; + return sal_True; } IMPL_LINK( SfxAppToolBoxControl_Impl, Activate, Menu *, pActMenu ) @@ -1801,9 +1800,9 @@ IMPL_LINK( SfxAppToolBoxControl_Impl, Activate, Menu *, pActMenu ) if ( pActMenu ) { const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings(); - ULONG nSymbolsStyle = rSettings.GetSymbolsStyle(); - BOOL bIsHiContrastMode = rSettings.GetHighContrastMode(); - BOOL bShowMenuImages = rSettings.GetUseImagesInMenus(); + sal_uIntPtr nSymbolsStyle = rSettings.GetSymbolsStyle(); + sal_Bool bIsHiContrastMode = rSettings.GetHighContrastMode(); + sal_Bool bShowMenuImages = rSettings.GetUseImagesInMenus(); if (( nSymbolsStyle != m_nSymbolsStyle ) || ( bIsHiContrastMode != m_bWasHiContrastMode ) || @@ -1813,10 +1812,10 @@ IMPL_LINK( SfxAppToolBoxControl_Impl, Activate, Menu *, pActMenu ) m_bWasHiContrastMode = bIsHiContrastMode; m_bShowMenuImages = bShowMenuImages; - USHORT nCount = pActMenu->GetItemCount(); - for ( USHORT nSVPos = 0; nSVPos < nCount; nSVPos++ ) + sal_uInt16 nCount = pActMenu->GetItemCount(); + for ( sal_uInt16 nSVPos = 0; nSVPos < nCount; nSVPos++ ) { - USHORT nId = pActMenu->GetItemId( nSVPos ); + sal_uInt16 nId = pActMenu->GetItemId( nSVPos ); if ( pActMenu->GetItemType( nSVPos ) != MENUITEM_SEPARATOR ) { if ( bShowMenuImages ) @@ -1832,7 +1831,7 @@ IMPL_LINK( SfxAppToolBoxControl_Impl, Activate, Menu *, pActMenu ) if ( aImageId.getLength() > 0 ) { Reference< ::com::sun::star::frame::XFrame > xFrame; - Image aImage = GetImage( xFrame, aImageId, FALSE, bIsHiContrastMode ); + Image aImage = GetImage( xFrame, aImageId, sal_False, bIsHiContrastMode ); if ( !!aImage ) { bImageSet = sal_True; @@ -1844,7 +1843,7 @@ IMPL_LINK( SfxAppToolBoxControl_Impl, Activate, Menu *, pActMenu ) if ( !bImageSet && aCmd.Len() ) { Image aImage = SvFileInformationManager::GetImage( - INetURLObject(aCmd), FALSE, bIsHiContrastMode ); + INetURLObject(aCmd), sal_False, bIsHiContrastMode ); if ( !!aImage ) pActMenu->SetItemImage( nId, aImage ); } @@ -1855,10 +1854,10 @@ IMPL_LINK( SfxAppToolBoxControl_Impl, Activate, Menu *, pActMenu ) } } - return TRUE; + return sal_True; } - return FALSE; + return sal_False; } //-------------------------------------------------------------------- |