diff options
author | Noel <noel.grandin@collabora.co.uk> | 2021-03-08 21:37:43 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-03-11 14:10:30 +0100 |
commit | 1692998399eecb79e7b59456cff805bcb77aece4 (patch) | |
tree | 8cc22c633e88f19c39f5736e87a0934f041729de | |
parent | 665a2b477dd4f412b42ffb58a183f7a702cd7645 (diff) |
use strong_int for item ids in vcl::ToolBox
(*) fix bug in SfxToolBoxControl::StateChanged where it was using the slot id
instead of the toolbox item id
(*) I left the logic in SbaTableQueryBrowser alone, but it looks suspicious,
casting slot ids to toolbox ids
Change-Id: Ied229164c27fb4456b0515c6fdcbd1682766a1a9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112186
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
124 files changed, 631 insertions, 618 deletions
diff --git a/accessibility/inc/standard/vclxaccessibletoolboxitem.hxx b/accessibility/inc/standard/vclxaccessibletoolboxitem.hxx index 544be177044b..cbfb8162f677 100644 --- a/accessibility/inc/standard/vclxaccessibletoolboxitem.hxx +++ b/accessibility/inc/standard/vclxaccessibletoolboxitem.hxx @@ -45,7 +45,7 @@ private: VclPtr<ToolBox> m_pToolBox; sal_Int32 m_nIndexInParent; sal_Int16 m_nRole; - sal_uInt16 m_nItemId; + ToolBoxItemId m_nItemId; bool m_bHasFocus; bool m_bIsChecked; bool m_bIndeterminate; diff --git a/accessibility/source/standard/vclxaccessibletoolbox.cxx b/accessibility/source/standard/vclxaccessibletoolbox.cxx index a04685730c85..cf3bf77169e7 100644 --- a/accessibility/source/standard/vclxaccessibletoolbox.cxx +++ b/accessibility/source/standard/vclxaccessibletoolbox.cxx @@ -200,11 +200,11 @@ void VCLXAccessibleToolBox::UpdateFocus_Impl() if ( !bHasFocus ) return; - sal_uInt16 nHighlightItemId = pToolBox->GetHighlightItemId(); + ToolBoxItemId nHighlightItemId = pToolBox->GetHighlightItemId(); sal_uInt16 nFocusCount = 0; for ( const auto& [rPos, rxChild] : m_aAccessibleChildren ) { - sal_uInt16 nItemId = pToolBox->GetItemId( rPos ); + ToolBoxItemId nItemId = pToolBox->GetItemId( rPos ); if ( rxChild.is() ) { @@ -252,12 +252,12 @@ void VCLXAccessibleToolBox::UpdateChecked_Impl( ToolBox::ImplToolItems::size_typ if ( !pToolBox ) return; - sal_uInt16 nFocusId = pToolBox->GetItemId( _nPos ); + ToolBoxItemId nFocusId = pToolBox->GetItemId( _nPos ); VCLXAccessibleToolBoxItem* pFocusItem = nullptr; for ( const auto& [rPos, rxChild] : m_aAccessibleChildren ) { - sal_uInt16 nItemId = pToolBox->GetItemId( rPos ); + ToolBoxItemId nItemId = pToolBox->GetItemId( rPos ); VCLXAccessibleToolBoxItem* pItem = static_cast< VCLXAccessibleToolBoxItem* >( rxChild.get() ); @@ -276,7 +276,7 @@ void VCLXAccessibleToolBox::UpdateIndeterminate_Impl( ToolBox::ImplToolItems::si if ( !pToolBox ) return; - sal_uInt16 nItemId = pToolBox->GetItemId( _nPos ); + ToolBoxItemId nItemId = pToolBox->GetItemId( _nPos ); ToolBoxItemsMap::iterator aIter = m_aAccessibleChildren.find( _nPos ); //TODO: ToolBox::ImplToolItems::size_type -> sal_Int32! @@ -392,7 +392,7 @@ void VCLXAccessibleToolBox::UpdateCustomPopupItemp_Impl( vcl::Window* pWindow, b if( !(pWindow && pToolBox) ) return; - const sal_uInt16 nDownItem = pToolBox->GetDownItemId(); + const ToolBoxItemId nDownItem = pToolBox->GetDownItemId(); if ( !nDownItem ) // No item is currently in down state. // Moreover, calling GetItemPos with 0 will find a separator if there is any. @@ -434,7 +434,7 @@ void VCLXAccessibleToolBox::HandleSubToolBarEvent( const VclWindowEvent& rVclWin && pChildWindow->GetType() == WindowType::TOOLBOX) ) return; - const sal_uInt16 nCurItemId( pToolBox->GetCurItemId() ); + const ToolBoxItemId nCurItemId( pToolBox->GetCurItemId() ); if ( !nCurItemId ) // No item is currently active (might happen when opening the overflow popup). // Moreover, calling GetItemPos with 0 will find a separator if there is any. @@ -698,8 +698,8 @@ Reference< XAccessible > SAL_CALL VCLXAccessibleToolBox::getAccessibleChild( sal ToolBoxItemsMap::iterator aIter = m_aAccessibleChildren.find(i); if ( m_aAccessibleChildren.end() == aIter ) { - sal_uInt16 nItemId = pToolBox->GetItemId( i ); - sal_uInt16 nHighlightItemId = pToolBox->GetHighlightItemId(); + ToolBoxItemId nItemId = pToolBox->GetItemId( i ); + ToolBoxItemId nHighlightItemId = pToolBox->GetHighlightItemId(); vcl::Window* pItemWindow = pToolBox->GetItemWindow( nItemId ); // not found -> create a new child rtl::Reference<VCLXAccessibleToolBoxItem> pChild = new VCLXAccessibleToolBoxItem( pToolBox, i ); @@ -711,7 +711,7 @@ Reference< XAccessible > SAL_CALL VCLXAccessibleToolBox::getAccessibleChild( sal pChild->SetChild( xChild ); } xChild = pChild; - if ( nHighlightItemId > 0 && nItemId == nHighlightItemId ) + if ( nHighlightItemId > ToolBoxItemId(0) && nItemId == nHighlightItemId ) pChild->SetFocus( true ); if ( pToolBox->IsItemChecked( nItemId ) ) pChild->SetChecked( true ); @@ -754,7 +754,7 @@ Reference< XAccessible > VCLXAccessibleToolBox::GetItemWindowAccessible( const V ToolBox::ImplToolItems::size_type nCount = pToolBox->GetItemCount(); for (ToolBox::ImplToolItems::size_type i = 0 ; i < nCount && !xReturn.is() ; ++i) { - sal_uInt16 nItemId = pToolBox->GetItemId( i ); + ToolBoxItemId nItemId = pToolBox->GetItemId( i ); vcl::Window* pItemWindow = pToolBox->GetItemWindow( nItemId ); if ( pItemWindow == pChildWindow ) xReturn = getAccessibleChild(i); @@ -819,7 +819,7 @@ sal_Int32 VCLXAccessibleToolBox::getSelectedAccessibleChildCount( ) VclPtr< ToolBox > pToolBox = GetAs< ToolBox >(); if (pToolBox) { - sal_uInt16 nHighlightItemId = pToolBox->GetHighlightItemId(); + ToolBoxItemId nHighlightItemId = pToolBox->GetHighlightItemId(); for ( size_t i = 0, nCount = pToolBox->GetItemCount(); i < nCount; i++ ) { if ( nHighlightItemId == pToolBox->GetItemId( i ) ) @@ -843,7 +843,7 @@ Reference< XAccessible > VCLXAccessibleToolBox::getSelectedAccessibleChild( sal_ VclPtr< ToolBox > pToolBox = GetAs< ToolBox >(); if (pToolBox) { - sal_uInt16 nHighlightItemId = pToolBox->GetHighlightItemId(); + ToolBoxItemId nHighlightItemId = pToolBox->GetHighlightItemId(); for ( sal_Int32 i = 0, nCount = pToolBox->GetItemCount(); i < nCount; i++ ) { if ( nHighlightItemId == pToolBox->GetItemId( i ) ) diff --git a/accessibility/source/standard/vclxaccessibletoolboxitem.cxx b/accessibility/source/standard/vclxaccessibletoolboxitem.cxx index cc613bbe4ec3..211547a7e206 100644 --- a/accessibility/source/standard/vclxaccessibletoolboxitem.cxx +++ b/accessibility/source/standard/vclxaccessibletoolboxitem.cxx @@ -118,7 +118,7 @@ OUString VCLXAccessibleToolBoxItem::GetText() { OUString sRet; // no text for separators and spaces - if ( m_pToolBox && m_nItemId > 0 ) + if ( m_pToolBox && m_nItemId > ToolBoxItemId(0) ) { sRet = m_pToolBox->GetItemText( m_nItemId ); if (sRet.isEmpty()) @@ -498,7 +498,7 @@ sal_Int32 SAL_CALL VCLXAccessibleToolBoxItem::getIndexAtPoint( const awt::Point& sal_Int32 nIndex = -1; if ( m_pToolBox && m_pToolBox->GetButtonType() != ButtonType::SYMBOLONLY ) // symbol buttons have no character bounds { - sal_uInt16 nItemId = 0; + ToolBoxItemId nItemId; tools::Rectangle aItemRect = m_pToolBox->GetItemRect( m_nItemId ); Point aPnt( VCLPoint( aPoint ) ); aPnt += aItemRect.TopLeft(); diff --git a/avmedia/source/framework/mediatoolbox.cxx b/avmedia/source/framework/mediatoolbox.cxx index 5cdde7399afe..74049cf9bf7e 100644 --- a/avmedia/source/framework/mediatoolbox.cxx +++ b/avmedia/source/framework/mediatoolbox.cxx @@ -68,7 +68,7 @@ void MediaToolBoxControl_Impl::execute( const MediaItem& rItem ) SFX_IMPL_TOOLBOX_CONTROL( MediaToolBoxControl, ::avmedia::MediaItem ); -MediaToolBoxControl::MediaToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) : +MediaToolBoxControl::MediaToolBoxControl( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx ) : SfxToolBoxControl( nSlotId, nId, rTbx ) { rTbx.Invalidate(); diff --git a/basctl/source/basicide/IDEComboBox.cxx b/basctl/source/basicide/IDEComboBox.cxx index 5063eb4f45a9..cff0e58a206e 100644 --- a/basctl/source/basicide/IDEComboBox.cxx +++ b/basctl/source/basicide/IDEComboBox.cxx @@ -59,7 +59,7 @@ using namespace ::com::sun::star::uno; */ SFX_IMPL_TOOLBOX_CONTROL(LibBoxControl, SfxStringItem); -LibBoxControl::LibBoxControl(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx) +LibBoxControl::LibBoxControl(sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx) : SfxToolBoxControl(nSlotId, nId, rTbx) { } @@ -359,7 +359,7 @@ void LibBox::ClearBox() */ SFX_IMPL_TOOLBOX_CONTROL(LanguageBoxControl, SfxStringItem); -LanguageBoxControl::LanguageBoxControl(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx) +LanguageBoxControl::LanguageBoxControl(sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx) : SfxToolBoxControl(nSlotId, nId, rTbx) { } diff --git a/basctl/source/inc/IDEComboBox.hxx b/basctl/source/inc/IDEComboBox.hxx index 76d73cdf8eec..1420feecd2d5 100644 --- a/basctl/source/inc/IDEComboBox.hxx +++ b/basctl/source/inc/IDEComboBox.hxx @@ -52,7 +52,7 @@ public: * @param nId -- this item's unique id in ToolBox * @param rTbx -- the ToolBox which contains this ComboBox */ - LibBoxControl(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx); + LibBoxControl(sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx); /*! * Triggered if state was changed @@ -198,7 +198,7 @@ public: * @param nId -- this item's unique id in ToolBox * @param rTbx -- the ToolBox which contains this ComboBox */ - LanguageBoxControl(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx); + LanguageBoxControl(sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx); /*! * Triggered if state was changed diff --git a/dbaccess/source/ui/browser/unodatbr.cxx b/dbaccess/source/ui/browser/unodatbr.cxx index 3e934309c2e9..be857da0de9c 100644 --- a/dbaccess/source/ui/browser/unodatbr.cxx +++ b/dbaccess/source/ui/browser/unodatbr.cxx @@ -1290,8 +1290,8 @@ void SbaTableQueryBrowser::implCheckExternalSlot( sal_uInt16 _nId ) if ( pToolbox ) { bool bHaveDispatcher = m_aExternalFeatures[ _nId ].xDispatcher.is(); - if ( bHaveDispatcher != pToolbox->IsItemVisible( _nId ) ) - bHaveDispatcher ? pToolbox->ShowItem( _nId ) : pToolbox->HideItem( _nId ); + if ( bHaveDispatcher != pToolbox->IsItemVisible( ToolBoxItemId(_nId) ) ) + bHaveDispatcher ? pToolbox->ShowItem( ToolBoxItemId(_nId) ) : pToolbox->HideItem( ToolBoxItemId(_nId) ); } // and invalidate this feature in general diff --git a/extensions/source/bibliography/toolbar.cxx b/extensions/source/bibliography/toolbar.cxx index 5ef3a8d5030c..8aafe10954da 100644 --- a/extensions/source/bibliography/toolbar.cxx +++ b/extensions/source/bibliography/toolbar.cxx @@ -49,7 +49,7 @@ using namespace ::com::sun::star::beans; // Constants -------------------------------------------------------------- -BibToolBarListener::BibToolBarListener(BibToolBar *pTB, const OUString& aStr, sal_uInt16 nId): +BibToolBarListener::BibToolBarListener(BibToolBar *pTB, const OUString& aStr, ToolBoxItemId nId): nIndex(nId), aCommand(aStr), pToolBar(pTB) @@ -77,7 +77,7 @@ void BibToolBarListener::statusChanged(const css::frame::FeatureStateEvent& rEvt }; -BibTBListBoxListener::BibTBListBoxListener(BibToolBar *pTB, const OUString& aStr, sal_uInt16 nId): +BibTBListBoxListener::BibTBListBoxListener(BibToolBar *pTB, const OUString& aStr, ToolBoxItemId nId): BibToolBarListener(pTB,aStr,nId) { } @@ -115,7 +115,7 @@ void BibTBListBoxListener::statusChanged(const css::frame::FeatureStateEvent& rE pToolBar->SelectSourceEntry(rEvt.FeatureDescriptor); }; -BibTBQueryMenuListener::BibTBQueryMenuListener(BibToolBar *pTB, const OUString& aStr, sal_uInt16 nId): +BibTBQueryMenuListener::BibTBQueryMenuListener(BibToolBar *pTB, const OUString& aStr, ToolBoxItemId nId): BibToolBarListener(pTB,aStr,nId) { } @@ -152,7 +152,7 @@ void BibTBQueryMenuListener::statusChanged(const frame::FeatureStateEvent& rEvt) } }; -BibTBEditListener::BibTBEditListener(BibToolBar *pTB, const OUString& aStr, sal_uInt16 nId): +BibTBEditListener::BibTBEditListener(BibToolBar *pTB, const OUString& aStr, ToolBoxItemId nId): BibToolBarListener(pTB,aStr,nId) { } @@ -302,7 +302,7 @@ void BibToolBar::InitListener() for(ToolBox::ImplToolItems::size_type nPos=0;nPos<nCount;nPos++) { - sal_uInt16 nId=GetItemId(nPos); + ToolBoxItemId nId=GetItemId(nPos); if (!nId) continue; @@ -341,7 +341,7 @@ void BibToolBar::SetXController(const uno::Reference< frame::XController > & xCt void BibToolBar::Select() { - sal_uInt16 nId=GetCurItemId(); + ToolBoxItemId nId=GetCurItemId(); if (nId != nTBC_BT_AUTOFILTER) { @@ -361,7 +361,7 @@ void BibToolBar::Select() } } -void BibToolBar::SendDispatch(sal_uInt16 nId, const Sequence< PropertyValue >& rArgs) +void BibToolBar::SendDispatch(ToolBoxItemId nId, const Sequence< PropertyValue >& rArgs) { OUString aCommand = GetItemCommand(nId); @@ -389,7 +389,7 @@ void BibToolBar::SendDispatch(sal_uInt16 nId, const Sequence< PropertyValue >& r void BibToolBar::Click() { - sal_uInt16 nId = GetCurItemId(); + ToolBoxItemId nId = GetCurItemId(); vcl::Window* pWin = GetParent(); @@ -516,7 +516,7 @@ IMPL_LINK_NOARG( BibToolBar, SendSelHdl, Timer*, void ) IMPL_LINK_NOARG(BibToolBar, MenuHdl, ToolBox*, void) { - sal_uInt16 nId = GetCurItemId(); + ToolBoxItemId nId = GetCurItemId(); if (nId != nTBC_BT_AUTOFILTER) return; diff --git a/extensions/source/bibliography/toolbar.hxx b/extensions/source/bibliography/toolbar.hxx index ee4b58274e9e..a9b618479947 100644 --- a/extensions/source/bibliography/toolbar.hxx +++ b/extensions/source/bibliography/toolbar.hxx @@ -36,7 +36,7 @@ class BibToolBarListener: public cppu::WeakImplHelper < css::frame::XStatusListe { private: - sal_uInt16 nIndex; + ToolBoxItemId nIndex; OUString aCommand; protected: @@ -45,7 +45,7 @@ protected: public: - BibToolBarListener(BibToolBar *pTB, const OUString& aStr, sal_uInt16 nId); + BibToolBarListener(BibToolBar *pTB, const OUString& aStr, ToolBoxItemId nId); virtual ~BibToolBarListener() override; const OUString& GetCommand() const { return aCommand;} @@ -63,7 +63,7 @@ class BibTBListBoxListener: public BibToolBarListener { public: - BibTBListBoxListener(BibToolBar *pTB, const OUString& aStr, sal_uInt16 nId); + BibTBListBoxListener(BibToolBar *pTB, const OUString& aStr, ToolBoxItemId nId); virtual ~BibTBListBoxListener() override; virtual void SAL_CALL statusChanged(const css::frame::FeatureStateEvent& Event) override; @@ -74,7 +74,7 @@ class BibTBEditListener: public BibToolBarListener { public: - BibTBEditListener(BibToolBar *pTB, const OUString& aStr, sal_uInt16 nId); + BibTBEditListener(BibToolBar *pTB, const OUString& aStr, ToolBoxItemId nId); virtual ~BibTBEditListener() override; virtual void SAL_CALL statusChanged(const css::frame::FeatureStateEvent& Event) override; @@ -85,7 +85,7 @@ class BibTBQueryMenuListener: public BibToolBarListener { public: - BibTBQueryMenuListener(BibToolBar *pTB, const OUString& aStr, sal_uInt16 nId); + BibTBQueryMenuListener(BibToolBar *pTB, const OUString& aStr, ToolBoxItemId nId); virtual ~BibTBQueryMenuListener() override; virtual void SAL_CALL statusChanged(const css::frame::FeatureStateEvent& Event) override; @@ -156,13 +156,13 @@ class BibToolBar: public ToolBox Link<void*,void> aLayoutManager; sal_Int16 nSymbolsSize; - sal_uInt16 nTBC_SOURCE; - sal_uInt16 nTBC_QUERY; - sal_uInt16 nTBC_BT_AUTOFILTER; - sal_uInt16 nTBC_BT_COL_ASSIGN; - sal_uInt16 nTBC_BT_CHANGESOURCE; - sal_uInt16 nTBC_BT_FILTERCRIT; - sal_uInt16 nTBC_BT_REMOVEFILTER; + ToolBoxItemId nTBC_SOURCE; + ToolBoxItemId nTBC_QUERY; + ToolBoxItemId nTBC_BT_AUTOFILTER; + ToolBoxItemId nTBC_BT_COL_ASSIGN; + ToolBoxItemId nTBC_BT_CHANGESOURCE; + ToolBoxItemId nTBC_BT_FILTERCRIT; + ToolBoxItemId nTBC_BT_REMOVEFILTER; BibDataManager* pDatMan; DECL_LINK( SelHdl, weld::ComboBox&, void ); @@ -189,7 +189,7 @@ class BibToolBar: public ToolBox virtual ~BibToolBar() override; virtual void dispose() override; - sal_uInt16 GetChangeSourceId() const { return nTBC_BT_CHANGESOURCE; } + ToolBoxItemId GetChangeSourceId() const { return nTBC_BT_CHANGESOURCE; } void SetXController(const css::uno::Reference< css::frame::XController > &); @@ -211,7 +211,7 @@ class BibToolBar: public ToolBox void statusChanged(const css::frame::FeatureStateEvent& Event); void SetDatMan(BibDataManager& rDatMan) {pDatMan = &rDatMan;} - void SendDispatch(sal_uInt16 nId, const css::uno::Sequence< css::beans::PropertyValue >& rArgs); + void SendDispatch(ToolBoxItemId nId, const css::uno::Sequence< css::beans::PropertyValue >& rArgs); }; diff --git a/forms/source/solar/control/navtoolbar.cxx b/forms/source/solar/control/navtoolbar.cxx index e6497a8ea939..475038b8391d 100644 --- a/forms/source/solar/control/navtoolbar.cxx +++ b/forms/source/solar/control/navtoolbar.cxx @@ -123,12 +123,13 @@ namespace frm { if ( m_pDispatcher ) { - if ( !m_pDispatcher->isEnabled( GetCurItemId() ) ) + sal_Int16 nFeatureId = sal_uInt16(GetCurItemId()); + if ( !m_pDispatcher->isEnabled( nFeatureId ) ) // the toolbox is a little bit buggy: With ToolBoxItemBits::REPEAT, it sometimes // happens that a select is reported, even though the respective // item has just been disabled. return; - m_pDispatcher->dispatch( GetCurItemId() ); + m_pDispatcher->dispatch( nFeatureId ); } } @@ -165,7 +166,7 @@ namespace frm m_pToolbar->setDispatcher( _pDispatcher ); - RecordPositionInput* pPositionWindow = static_cast< RecordPositionInput* >( m_pToolbar->GetItemWindow( FormFeature::MoveAbsolute ) ); + RecordPositionInput* pPositionWindow = static_cast< RecordPositionInput* >( m_pToolbar->GetItemWindow( ToolBoxItemId(FormFeature::MoveAbsolute) ) ); OSL_ENSURE( pPositionWindow, "NavigationToolBar::setDispatcher: can't forward the dispatcher to the position window!" ); if ( pPositionWindow ) pPositionWindow->setDispatcher( _pDispatcher ); @@ -173,7 +174,7 @@ namespace frm // update feature states for ( ToolBox::ImplToolItems::size_type nPos = 0; nPos < m_pToolbar->GetItemCount(); ++nPos ) { - sal_uInt16 nItemId = m_pToolbar->GetItemId( nPos ); + sal_uInt16 nItemId = sal_uInt16(m_pToolbar->GetItemId( nPos )); if ( ( nItemId == LID_RECORD_LABEL ) || ( nItemId == LID_RECORD_FILLER ) ) continue; @@ -186,18 +187,18 @@ namespace frm void NavigationToolBar::implEnableItem( sal_uInt16 _nItemId, bool _bEnabled ) { - m_pToolbar->EnableItem( _nItemId, _bEnabled ); + m_pToolbar->EnableItem( ToolBoxItemId(_nItemId), _bEnabled ); if ( _nItemId == FormFeature::MoveAbsolute ) - m_pToolbar->EnableItem( LID_RECORD_LABEL, _bEnabled ); + m_pToolbar->EnableItem( ToolBoxItemId(LID_RECORD_LABEL), _bEnabled ); if ( _nItemId == FormFeature::TotalRecords ) - m_pToolbar->EnableItem( LID_RECORD_FILLER, _bEnabled ); + m_pToolbar->EnableItem( ToolBoxItemId(LID_RECORD_FILLER), _bEnabled ); } void NavigationToolBar::enableFeature( sal_Int16 _nFeatureId, bool _bEnabled ) { - DBG_ASSERT( m_pToolbar->GetItemPos( static_cast<sal_uInt16>(_nFeatureId) ) != ToolBox::ITEM_NOTFOUND, + DBG_ASSERT( m_pToolbar->GetItemPos( ToolBoxItemId(_nFeatureId) ) != ToolBox::ITEM_NOTFOUND, "NavigationToolBar::enableFeature: invalid id!" ); implEnableItem( static_cast<sal_uInt16>(_nFeatureId), _bEnabled ); @@ -205,18 +206,18 @@ namespace frm void NavigationToolBar::checkFeature( sal_Int16 _nFeatureId, bool _bEnabled ) { - DBG_ASSERT( m_pToolbar->GetItemPos( static_cast<sal_uInt16>(_nFeatureId) ) != ToolBox::ITEM_NOTFOUND, + DBG_ASSERT( m_pToolbar->GetItemPos( ToolBoxItemId(_nFeatureId) ) != ToolBox::ITEM_NOTFOUND, "NavigationToolBar::checkFeature: invalid id!" ); - m_pToolbar->CheckItem( static_cast<sal_uInt16>(_nFeatureId), _bEnabled ); + m_pToolbar->CheckItem( ToolBoxItemId(_nFeatureId), _bEnabled ); } void NavigationToolBar::setFeatureText( sal_Int16 _nFeatureId, const OUString& _rText ) { - DBG_ASSERT( m_pToolbar->GetItemPos( static_cast<sal_uInt16>(_nFeatureId) ) != ToolBox::ITEM_NOTFOUND, + DBG_ASSERT( m_pToolbar->GetItemPos( ToolBoxItemId(_nFeatureId) ) != ToolBox::ITEM_NOTFOUND, "NavigationToolBar::checkFeature: invalid id!" ); - vcl::Window* pItemWindow = m_pToolbar->GetItemWindow( static_cast<sal_uInt16>(_nFeatureId) ); + vcl::Window* pItemWindow = m_pToolbar->GetItemWindow( ToolBoxItemId(_nFeatureId) ); if ( pItemWindow ) { if (_nFeatureId == FormFeature::TotalRecords) @@ -225,7 +226,7 @@ namespace frm static_cast<RecordPositionInput*>(pItemWindow)->set_text(_rText); } else - m_pToolbar->SetItemText( static_cast<sal_uInt16>(_nFeatureId), _rText ); + m_pToolbar->SetItemText( ToolBoxItemId(_nFeatureId), _rText ); } void NavigationToolBar::implInit( ) @@ -277,15 +278,15 @@ namespace frm { // it's _not_ a separator // insert the entry - m_pToolbar->InsertItem( pSupportedFeatures->nId, OUString(), pSupportedFeatures->bRepeat ? ToolBoxItemBits::REPEAT : ToolBoxItemBits::NONE ); - m_pToolbar->SetQuickHelpText( pSupportedFeatures->nId, OUString() ); // TODO + m_pToolbar->InsertItem( ToolBoxItemId(pSupportedFeatures->nId), OUString(), pSupportedFeatures->bRepeat ? ToolBoxItemBits::REPEAT : ToolBoxItemBits::NONE ); + m_pToolbar->SetQuickHelpText( ToolBoxItemId(pSupportedFeatures->nId), OUString() ); // TODO if ( !isArtificialItem( pSupportedFeatures->nId ) ) { OUString sCommandURL( lcl_getCommandURL( pSupportedFeatures->nId ) ); - m_pToolbar->SetItemCommand( pSupportedFeatures->nId, sCommandURL ); + m_pToolbar->SetItemCommand( ToolBoxItemId(pSupportedFeatures->nId), sCommandURL ); auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(sCommandURL, m_sModuleId); - m_pToolbar->SetQuickHelpText(pSupportedFeatures->nId, + m_pToolbar->SetQuickHelpText(ToolBoxItemId(pSupportedFeatures->nId), vcl::CommandInfoProvider::GetLabelForCommand(aProperties)); } @@ -305,7 +306,7 @@ namespace frm pItemWindow = VclPtr<LabelItemWindow>::Create(m_pToolbar, ""); m_aChildWins.emplace_back(pItemWindow ); - m_pToolbar->SetItemWindow( pSupportedFeatures->nId, pItemWindow ); + m_pToolbar->SetItemWindow( ToolBoxItemId(pSupportedFeatures->nId), pItemWindow ); } } else @@ -334,9 +335,9 @@ namespace frm for ( ToolBox::ImplToolItems::size_type i=0; i<nItemCount; ++i ) { - sal_uInt16 nId = m_pToolbar->GetItemId( i ); - if ( ( ToolBoxItemType::BUTTON == m_pToolbar->GetItemType( i ) ) && !isArtificialItem( nId ) ) - aFormFeatures.push_back( nId ); + ToolBoxItemId nId = m_pToolbar->GetItemId( i ); + if ( ( ToolBoxItemType::BUTTON == m_pToolbar->GetItemType( i ) ) && !isArtificialItem( sal_uInt16(nId) ) ) + aFormFeatures.push_back( sal_uInt16(nId) ); } // translate them into command URLs @@ -352,9 +353,9 @@ namespace frm // and set them at the toolbar auto commandImage = aCommandImages.begin(); - for (auto const& formFeature : aFormFeatures) + for (sal_Int16 formFeature : aFormFeatures) { - m_pToolbar->SetItemImage( formFeature, *commandImage ); + m_pToolbar->SetItemImage( ToolBoxItemId(formFeature), *commandImage ); ++commandImage; } @@ -423,7 +424,7 @@ namespace frm if ( pGroupIds ) while ( *pGroupIds ) - m_pToolbar->ShowItem( *pGroupIds++, _bShow ); + m_pToolbar->ShowItem( ToolBoxItemId(*pGroupIds++), _bShow ); } @@ -440,7 +441,7 @@ namespace frm OSL_FAIL( "NavigationToolBar::IsFunctionGroupVisible: invalid group id!" ); } - return m_pToolbar->IsItemVisible( nIndicatorItem ); + return m_pToolbar->IsItemVisible( ToolBoxItemId(nIndicatorItem) ); } @@ -526,10 +527,10 @@ namespace frm { for ( ToolBox::ImplToolItems::size_type item = 0; item < m_pToolbar->GetItemCount(); ++item ) { - sal_uInt16 nItemId = m_pToolbar->GetItemId( item ); + ToolBoxItemId nItemId = m_pToolbar->GetItemId( item ); vcl::Window* pItemWindow = m_pToolbar->GetItemWindow( nItemId ); if ( pItemWindow ) - (this->*_handler)( nItemId, pItemWindow ); + (this->*_handler)( sal_uInt16(nItemId), pItemWindow ); } } @@ -537,10 +538,10 @@ namespace frm { for ( ToolBox::ImplToolItems::size_type item = 0; item < m_pToolbar->GetItemCount(); ++item ) { - sal_uInt16 nItemId = m_pToolbar->GetItemId( item ); + ToolBoxItemId nItemId = m_pToolbar->GetItemId( item ); vcl::Window* pItemWindow = m_pToolbar->GetItemWindow( nItemId ); if ( pItemWindow ) - (*_handler)( nItemId, pItemWindow, _pParam ); + (*_handler)( sal_uInt16(nItemId), pItemWindow, _pParam ); } } @@ -609,7 +610,7 @@ namespace frm aSize.AdjustWidth(6 ); _pItemWindow->SetSizePixel( aSize ); - m_pToolbar->SetItemWindow( _nItemId, _pItemWindow ); + m_pToolbar->SetItemWindow( ToolBoxItemId(_nItemId), _pItemWindow ); } void NavigationToolBar::enableItemRTL( sal_uInt16 /*_nItemId*/, vcl::Window* _pItemWindow, const void* _pIsRTLEnabled ) diff --git a/framework/inc/uielement/FixedImageToolbarController.hxx b/framework/inc/uielement/FixedImageToolbarController.hxx index 66533fbc9cde..30359a051b20 100644 --- a/framework/inc/uielement/FixedImageToolbarController.hxx +++ b/framework/inc/uielement/FixedImageToolbarController.hxx @@ -36,7 +36,7 @@ class FixedImageToolbarController final : public ComplexToolbarController public: FixedImageToolbarController(const css::uno::Reference<css::uno::XComponentContext>& rxContext, const css::uno::Reference<css::frame::XFrame>& rFrame, - ToolBox* pToolBar, sal_uInt16 nID, const OUString& aCommand); + ToolBox* pToolBar, ToolBoxItemId nID, const OUString& aCommand); // XComponent virtual void SAL_CALL dispose() override; diff --git a/framework/inc/uielement/FixedTextToolbarController.hxx b/framework/inc/uielement/FixedTextToolbarController.hxx index 3d257414b6d2..b51d0de53654 100644 --- a/framework/inc/uielement/FixedTextToolbarController.hxx +++ b/framework/inc/uielement/FixedTextToolbarController.hxx @@ -36,7 +36,7 @@ class FixedTextToolbarController final : public ComplexToolbarController public: FixedTextToolbarController(const css::uno::Reference<css::uno::XComponentContext>& rxContext, const css::uno::Reference<css::frame::XFrame>& rFrame, - ToolBox* pToolBar, sal_uInt16 nID, const OUString& aCommand); + ToolBox* pToolBar, ToolBoxItemId nID, const OUString& aCommand); // XComponent virtual void SAL_CALL dispose() override; diff --git a/framework/inc/uielement/comboboxtoolbarcontroller.hxx b/framework/inc/uielement/comboboxtoolbarcontroller.hxx index 8dcf79b03510..4762d595ace9 100644 --- a/framework/inc/uielement/comboboxtoolbarcontroller.hxx +++ b/framework/inc/uielement/comboboxtoolbarcontroller.hxx @@ -36,7 +36,7 @@ class ComboboxToolbarController final : public ComplexToolbarController ComboboxToolbarController( const css::uno::Reference< css::uno::XComponentContext >& rxContext, const css::uno::Reference< css::frame::XFrame >& rFrame, ToolBox* pToolBar, - sal_uInt16 nID, + ToolBoxItemId nID, sal_Int32 nWidth, const OUString& aCommand ); virtual ~ComboboxToolbarController() override; diff --git a/framework/inc/uielement/commandinfo.hxx b/framework/inc/uielement/commandinfo.hxx index b2c7c3e880a9..de3bee8ee88f 100644 --- a/framework/inc/uielement/commandinfo.hxx +++ b/framework/inc/uielement/commandinfo.hxx @@ -21,6 +21,7 @@ #define INCLUDED_FRAMEWORK_INC_UIELEMENT_COMMANDINFO_HXX #include <rtl/ustring.hxx> +#include <vcl/toolbox.hxx> #include <unordered_map> #include <vector> @@ -33,8 +34,8 @@ struct CommandInfo CommandInfo() : nId( 0 ), nImageInfo( 0 ) {} - sal_uInt16 nId; - ::std::vector< sal_uInt16 > aIds; + ToolBoxItemId nId; + ::std::vector< ToolBoxItemId > aIds; sal_Int16 nImageInfo; }; diff --git a/framework/inc/uielement/complextoolbarcontroller.hxx b/framework/inc/uielement/complextoolbarcontroller.hxx index 5036943299e9..5855d2cb41b3 100644 --- a/framework/inc/uielement/complextoolbarcontroller.hxx +++ b/framework/inc/uielement/complextoolbarcontroller.hxx @@ -43,7 +43,7 @@ class ComplexToolbarController : public svt::ToolboxController ComplexToolbarController( const css::uno::Reference< css::uno::XComponentContext >& rxContext, const css::uno::Reference< css::frame::XFrame >& rFrame, ToolBox* pToolBar, - sal_uInt16 nID, + ToolBoxItemId nID, const OUString& aCommand ); virtual ~ComplexToolbarController() override; @@ -88,7 +88,7 @@ class ComplexToolbarController : public svt::ToolboxController void notifyTextChanged( const OUString& aText ); VclPtr<ToolBox> m_xToolbar; - sal_uInt16 m_nID; + ToolBoxItemId m_nID; bool m_bMadeInvisible; mutable css::util::URL m_aURL; css::uno::Reference< css::util::XURLTransformer > m_xURLTransformer; diff --git a/framework/inc/uielement/dropdownboxtoolbarcontroller.hxx b/framework/inc/uielement/dropdownboxtoolbarcontroller.hxx index eb95c142cef3..d9f1664dfc87 100644 --- a/framework/inc/uielement/dropdownboxtoolbarcontroller.hxx +++ b/framework/inc/uielement/dropdownboxtoolbarcontroller.hxx @@ -39,7 +39,7 @@ class DropdownToolbarController final : public ComplexToolbarController DropdownToolbarController( const css::uno::Reference< css::uno::XComponentContext >& rxContext, const css::uno::Reference< css::frame::XFrame >& rFrame, ToolBox* pToolBar, - sal_uInt16 nID, + ToolBoxItemId nID, sal_Int32 nWidth, const OUString& aCommand ); virtual ~DropdownToolbarController() override; diff --git a/framework/inc/uielement/edittoolbarcontroller.hxx b/framework/inc/uielement/edittoolbarcontroller.hxx index 21e7f6935f6d..e7acaafe8aae 100644 --- a/framework/inc/uielement/edittoolbarcontroller.hxx +++ b/framework/inc/uielement/edittoolbarcontroller.hxx @@ -38,7 +38,7 @@ class EditToolbarController final : public ComplexToolbarController EditToolbarController( const css::uno::Reference< css::uno::XComponentContext >& rxContext, const css::uno::Reference< css::frame::XFrame >& rFrame, ToolBox* pToolBar, - sal_uInt16 nID, + ToolBoxItemId nID, sal_Int32 nWidth, const OUString& aCommand ); virtual ~EditToolbarController() override; diff --git a/framework/inc/uielement/imagebuttontoolbarcontroller.hxx b/framework/inc/uielement/imagebuttontoolbarcontroller.hxx index 9b625059717f..0888e390b037 100644 --- a/framework/inc/uielement/imagebuttontoolbarcontroller.hxx +++ b/framework/inc/uielement/imagebuttontoolbarcontroller.hxx @@ -37,7 +37,7 @@ class ImageButtonToolbarController final : public ComplexToolbarController ImageButtonToolbarController( const css::uno::Reference< css::uno::XComponentContext >& rxContext, const css::uno::Reference< css::frame::XFrame >& rFrame, ToolBox* pToolBar, - sal_uInt16 nID, + ToolBoxItemId nID, const OUString& aCommand ); virtual ~ImageButtonToolbarController() override; diff --git a/framework/inc/uielement/spinfieldtoolbarcontroller.hxx b/framework/inc/uielement/spinfieldtoolbarcontroller.hxx index beb95049a206..80a0d26ebdc0 100644 --- a/framework/inc/uielement/spinfieldtoolbarcontroller.hxx +++ b/framework/inc/uielement/spinfieldtoolbarcontroller.hxx @@ -39,7 +39,7 @@ class SpinfieldToolbarController final : public ComplexToolbarController SpinfieldToolbarController( const css::uno::Reference< css::uno::XComponentContext >& rxContext, const css::uno::Reference< css::frame::XFrame >& rFrame, ToolBox* pToolBar, - sal_uInt16 nID, + ToolBoxItemId nID, sal_Int32 nWidth, const OUString& aCommand ); virtual ~SpinfieldToolbarController() override; diff --git a/framework/inc/uielement/togglebuttontoolbarcontroller.hxx b/framework/inc/uielement/togglebuttontoolbarcontroller.hxx index 9e667da83ba0..aeab78785556 100644 --- a/framework/inc/uielement/togglebuttontoolbarcontroller.hxx +++ b/framework/inc/uielement/togglebuttontoolbarcontroller.hxx @@ -51,7 +51,7 @@ class ToggleButtonToolbarController final : public ComplexToolbarController ToggleButtonToolbarController( const css::uno::Reference< css::uno::XComponentContext >& rxContext, const css::uno::Reference< css::frame::XFrame >& rFrame, ToolBox* pToolBar, - sal_uInt16 nID, + ToolBoxItemId nID, Style eStyle, const OUString& aCommand ); virtual ~ToggleButtonToolbarController() override; diff --git a/framework/inc/uielement/toolbarmanager.hxx b/framework/inc/uielement/toolbarmanager.hxx index d77ae16312aa..3b5e37d8dbb0 100644 --- a/framework/inc/uielement/toolbarmanager.hxx +++ b/framework/inc/uielement/toolbarmanager.hxx @@ -41,6 +41,7 @@ #include <tools/link.hxx> #include <vcl/window.hxx> #include <vcl/timer.hxx> +#include <vcl/toolbox.hxx> #include <unordered_map> @@ -141,7 +142,7 @@ class ToolBarManager final : public ToolbarManager_Base void setToolBarImage(const Image& _aImage,const CommandToInfoMap::const_iterator& _pIter); void impl_elementChanged(bool _bRemove,const css::ui::ConfigurationEvent& Event ); - typedef std::unordered_map< sal_uInt16, css::uno::Reference< css::frame::XStatusListener > > ToolBarControllerMap; + typedef std::unordered_map< ToolBoxItemId, css::uno::Reference< css::frame::XStatusListener > > ToolBarControllerMap; typedef ::std::vector< css::uno::Reference< css::frame::XSubToolbarController > > SubToolBarControllerVector; typedef std::unordered_map<OUString, SubToolBarControllerVector> SubToolBarToSubToolBarControllerMap; diff --git a/framework/inc/uielement/toolbarmerger.hxx b/framework/inc/uielement/toolbarmerger.hxx index bd07bb17e7e4..01defd7b2e0f 100644 --- a/framework/inc/uielement/toolbarmerger.hxx +++ b/framework/inc/uielement/toolbarmerger.hxx @@ -81,7 +81,7 @@ class ToolBarMerger static bool ProcessMergeOperation( ToolBox* pToolbar, ToolBox::ImplToolItems::size_type nPos, - sal_uInt16& rItemId, + ToolBoxItemId& rItemId, CommandToInfoMap& rCommandMap, std::u16string_view rModuleIdentifier, std::u16string_view rMergeCommand, @@ -89,7 +89,7 @@ class ToolBarMerger const AddonToolbarItemContainer& rItems ); static bool ProcessMergeFallback( ToolBox* pToolbar, - sal_uInt16& rItemId, + ToolBoxItemId& rItemId, CommandToInfoMap& rCommandMap, std::u16string_view rModuleIdentifier, std::u16string_view rMergeCommand, @@ -99,14 +99,14 @@ class ToolBarMerger static void MergeItems( ToolBox* pToolbar, ToolBox::ImplToolItems::size_type nPos, sal_uInt16 nModIndex, - sal_uInt16& rItemId, + ToolBoxItemId& rItemId, CommandToInfoMap& rCommandMap, std::u16string_view rModuleIdentifier, const AddonToolbarItemContainer& rAddonToolbarItems ); static void ReplaceItem( ToolBox* pToolbar, ToolBox::ImplToolItems::size_type nPos, - sal_uInt16& rItemId, + ToolBoxItemId& rItemId, CommandToInfoMap& rCommandMap, std::u16string_view rModuleIdentifier, const AddonToolbarItemContainer& rAddonToolbarItems ); @@ -120,13 +120,13 @@ class ToolBarMerger const css::uno::Reference< css::frame::XFrame > & xFrame, ToolBox* pToolbar, const OUString& rCommandURL, - sal_uInt16 nId, + ToolBoxItemId nId, sal_uInt16 nWidth, std::u16string_view rControlType ); static void CreateToolbarItem( ToolBox* pToolbox, ToolBox::ImplToolItems::size_type nPos, - sal_uInt16 nItemId, + ToolBoxItemId nItemId, const AddonToolbarItem& rAddonToolbarItem ); private: diff --git a/framework/source/fwe/classes/sfxhelperfunctions.cxx b/framework/source/fwe/classes/sfxhelperfunctions.cxx index c96791c2f422..e456a7a42460 100644 --- a/framework/source/fwe/classes/sfxhelperfunctions.cxx +++ b/framework/source/fwe/classes/sfxhelperfunctions.cxx @@ -43,7 +43,7 @@ pfunc_setToolBoxControllerCreator SetToolBoxControllerCreator( pfunc_setToolBoxC return pOldSetToolBoxControllerCreator; } -rtl::Reference<svt::ToolboxController> CreateToolBoxController( const Reference< XFrame >& rFrame, ToolBox* pToolbox, unsigned short nID, const OUString& aCommandURL ) +rtl::Reference<svt::ToolboxController> CreateToolBoxController( const Reference< XFrame >& rFrame, ToolBox* pToolbox, ToolBoxItemId nID, const OUString& aCommandURL ) { pfunc_setToolBoxControllerCreator pFactory = nullptr; { diff --git a/framework/source/layoutmanager/toolbarlayoutmanager.cxx b/framework/source/layoutmanager/toolbarlayoutmanager.cxx index 1f46f09e2274..9f79f0ac7a14 100644 --- a/framework/source/layoutmanager/toolbarlayoutmanager.cxx +++ b/framework/source/layoutmanager/toolbarlayoutmanager.cxx @@ -923,8 +923,8 @@ void ToolbarLayoutManager::childWindowEvent( VclSimpleEvent const * pEvent ) if ( pToolBox ) { aToolbarName = retrieveToolbarNameFromHelpURL( pToolBox ); - sal_uInt16 nId = pToolBox->GetCurItemId(); - if ( nId > 0 ) + ToolBoxItemId nId = pToolBox->GetCurItemId(); + if ( nId > ToolBoxItemId(0) ) aCommand = pToolBox->GetItemCommand( nId ); } diff --git a/framework/source/uielement/FixedImageToolbarController.cxx b/framework/source/uielement/FixedImageToolbarController.cxx index 49377db5e555..303913432cd1 100644 --- a/framework/source/uielement/FixedImageToolbarController.cxx +++ b/framework/source/uielement/FixedImageToolbarController.cxx @@ -80,7 +80,7 @@ void FixedImageControl::dispose() FixedImageToolbarController::FixedImageToolbarController( const Reference<XComponentContext>& rxContext, const Reference<XFrame>& rFrame, - ToolBox* pToolbar, sal_uInt16 nID, const OUString& rCommand) + ToolBox* pToolbar, ToolBoxItemId nID, const OUString& rCommand) : ComplexToolbarController(rxContext, rFrame, pToolbar, nID, rCommand) , m_eSymbolSize(SvtMiscOptions().GetCurrentSymbolsSize()) { diff --git a/framework/source/uielement/FixedTextToolbarController.cxx b/framework/source/uielement/FixedTextToolbarController.cxx index 32b486379178..36a1061aa86f 100644 --- a/framework/source/uielement/FixedTextToolbarController.cxx +++ b/framework/source/uielement/FixedTextToolbarController.cxx @@ -71,7 +71,7 @@ void FixedTextControl::dispose() FixedTextToolbarController::FixedTextToolbarController( const Reference<XComponentContext>& rxContext, const Reference<XFrame>& rFrame, - ToolBox* pToolbar, sal_uInt16 nID, const OUString& aCommand) + ToolBox* pToolbar, ToolBoxItemId nID, const OUString& aCommand) : ComplexToolbarController(rxContext, rFrame, pToolbar, nID, aCommand) { m_pFixedTextControl = VclPtr<FixedTextControl>::Create(m_xToolbar); diff --git a/framework/source/uielement/comboboxtoolbarcontroller.cxx b/framework/source/uielement/comboboxtoolbarcontroller.cxx index 745b25d2cf99..a54c78d0d774 100644 --- a/framework/source/uielement/comboboxtoolbarcontroller.cxx +++ b/framework/source/uielement/comboboxtoolbarcontroller.cxx @@ -145,7 +145,7 @@ ComboboxToolbarController::ComboboxToolbarController( const Reference< XComponentContext >& rxContext, const Reference< XFrame >& rFrame, ToolBox* pToolbar, - sal_uInt16 nID, + ToolBoxItemId nID, sal_Int32 nWidth, const OUString& aCommand ) : ComplexToolbarController( rxContext, rFrame, pToolbar, nID, aCommand ) diff --git a/framework/source/uielement/complextoolbarcontroller.cxx b/framework/source/uielement/complextoolbarcontroller.cxx index b62febf87663..743306590056 100644 --- a/framework/source/uielement/complextoolbarcontroller.cxx +++ b/framework/source/uielement/complextoolbarcontroller.cxx @@ -49,7 +49,7 @@ ComplexToolbarController::ComplexToolbarController( const Reference< XComponentContext >& rxContext, const Reference< XFrame >& rFrame, ToolBox* pToolbar, - sal_uInt16 nID, + ToolBoxItemId nID, const OUString& aCommand ) : svt::ToolboxController( rxContext, rFrame, aCommand ) , m_xToolbar( pToolbar ) @@ -72,7 +72,7 @@ void SAL_CALL ComplexToolbarController::dispose() m_xURLTransformer.clear(); m_xToolbar.clear(); - m_nID = 0; + m_nID = ToolBoxItemId(0); } Sequence<PropertyValue> ComplexToolbarController::getExecuteArgs(sal_Int16 KeyModifier) const diff --git a/framework/source/uielement/dropdownboxtoolbarcontroller.cxx b/framework/source/uielement/dropdownboxtoolbarcontroller.cxx index b694bca18ed6..00c14f2b0c7c 100644 --- a/framework/source/uielement/dropdownboxtoolbarcontroller.cxx +++ b/framework/source/uielement/dropdownboxtoolbarcontroller.cxx @@ -122,7 +122,7 @@ DropdownToolbarController::DropdownToolbarController( const Reference< XComponentContext >& rxContext, const Reference< XFrame >& rFrame, ToolBox* pToolbar, - sal_uInt16 nID, + ToolBoxItemId nID, sal_Int32 nWidth, const OUString& aCommand ) : ComplexToolbarController( rxContext, rFrame, pToolbar, nID, aCommand ) diff --git a/framework/source/uielement/edittoolbarcontroller.cxx b/framework/source/uielement/edittoolbarcontroller.cxx index 3bbb3f9755cc..8bde909c703d 100644 --- a/framework/source/uielement/edittoolbarcontroller.cxx +++ b/framework/source/uielement/edittoolbarcontroller.cxx @@ -127,7 +127,7 @@ EditToolbarController::EditToolbarController( const Reference< XComponentContext >& rxContext, const Reference< XFrame >& rFrame, ToolBox* pToolbar, - sal_uInt16 nID, + ToolBoxItemId nID, sal_Int32 nWidth, const OUString& aCommand ) : ComplexToolbarController( rxContext, rFrame, pToolbar, nID, aCommand ) diff --git a/framework/source/uielement/generictoolbarcontroller.cxx b/framework/source/uielement/generictoolbarcontroller.cxx index 31c22d03bbb1..004fcf80ce78 100644 --- a/framework/source/uielement/generictoolbarcontroller.cxx +++ b/framework/source/uielement/generictoolbarcontroller.cxx @@ -82,7 +82,7 @@ static OUString getMasterCommand( const OUString& rCommand ) GenericToolbarController::GenericToolbarController( const Reference< XComponentContext >& rxContext, const Reference< XFrame >& rFrame, ToolBox* pToolbar, - sal_uInt16 nID, + ToolBoxItemId nID, const OUString& aCommand ) : svt::ToolboxController( rxContext, rFrame, aCommand ) , m_xToolbar( pToolbar ) @@ -104,7 +104,7 @@ GenericToolbarController::GenericToolbarController( const Reference< XComponentC const Reference< XFrame >& rFrame, weld::Toolbar& rToolbar, const OUString& aCommand ) : - GenericToolbarController( rxContext, rFrame, nullptr, 0, aCommand ) + GenericToolbarController( rxContext, rFrame, nullptr, ToolBoxItemId(0), aCommand ) { m_pToolbar = &rToolbar; } @@ -121,7 +121,7 @@ void SAL_CALL GenericToolbarController::dispose() m_pToolbar = nullptr; m_xToolbar.clear(); - m_nID = 0; + m_nID = ToolBoxItemId(0); } void SAL_CALL GenericToolbarController::execute( sal_Int16 KeyModifier ) diff --git a/framework/source/uielement/imagebuttontoolbarcontroller.cxx b/framework/source/uielement/imagebuttontoolbarcontroller.cxx index 19107d374019..e03a3cbc156a 100644 --- a/framework/source/uielement/imagebuttontoolbarcontroller.cxx +++ b/framework/source/uielement/imagebuttontoolbarcontroller.cxx @@ -57,7 +57,7 @@ ImageButtonToolbarController::ImageButtonToolbarController( const Reference< XComponentContext >& rxContext, const Reference< XFrame >& rFrame, ToolBox* pToolbar, - sal_uInt16 nID, + ToolBoxItemId nID, const OUString& aCommand ) : ComplexToolbarController( rxContext, rFrame, pToolbar, nID, aCommand ) { diff --git a/framework/source/uielement/popuptoolbarcontroller.cxx b/framework/source/uielement/popuptoolbarcontroller.cxx index 51fcd4f4ee13..7048778029e4 100644 --- a/framework/source/uielement/popuptoolbarcontroller.cxx +++ b/framework/source/uielement/popuptoolbarcontroller.cxx @@ -150,7 +150,7 @@ void SAL_CALL PopupMenuToolbarController::initialize( SolarMutexGuard aSolarLock; ToolBox* pToolBox = nullptr; - sal_uInt16 nItemId = 0; + ToolBoxItemId nItemId; if ( getToolboxId( nItemId, &pToolBox ) ) { ToolBoxItemBits nCurStyle( pToolBox->GetItemBits( nItemId ) ); @@ -169,7 +169,7 @@ void SAL_CALL PopupMenuToolbarController::statusChanged( const css::frame::Featu return; ToolBox* pToolBox = nullptr; - sal_uInt16 nItemId = 0; + ToolBoxItemId nItemId; if ( getToolboxId( nItemId, &pToolBox ) ) { SolarMutexGuard aSolarLock; @@ -355,7 +355,7 @@ void GenericPopupToolbarController::statusChanged( const css::frame::FeatureStat Menu* pVclMenu = comphelper::getUnoTunnelImplementation<VCLXMenu>( m_xPopupMenu )->GetMenu(); ToolBox* pToolBox = nullptr; - sal_uInt16 nId = 0; + ToolBoxItemId nId; if ( getToolboxId( nId, &pToolBox ) && pToolBox->IsItemEnabled( nId ) ) { pVclMenu->Activate(); @@ -389,7 +389,7 @@ void GenericPopupToolbarController::functionExecuted( const OUString& rCommand ) addStatusListener( m_aCommandURL ); ToolBox* pToolBox = nullptr; - sal_uInt16 nId = 0; + ToolBoxItemId nId; if ( getToolboxId( nId, &pToolBox ) ) { pToolBox->SetItemCommand( nId, rCommand ); @@ -461,7 +461,7 @@ void SaveToolbarController::initialize( const css::uno::Sequence< css::uno::Any PopupMenuToolbarController::initialize( aArguments ); ToolBox* pToolBox = nullptr; - sal_uInt16 nId = 0; + ToolBoxItemId nId; if ( !getToolboxId( nId, &pToolBox ) ) return; @@ -504,7 +504,7 @@ void SaveToolbarController::updateImage() { SolarMutexGuard aGuard; ToolBox* pToolBox = nullptr; - sal_uInt16 nId = 0; + ToolBoxItemId nId; if ( !getToolboxId( nId, &pToolBox ) ) return; @@ -536,7 +536,7 @@ void SaveToolbarController::updateImage() void SaveToolbarController::statusChanged( const css::frame::FeatureStateEvent& rEvent ) { ToolBox* pToolBox = nullptr; - sal_uInt16 nId = 0; + ToolBoxItemId nId; if ( !getToolboxId( nId, &pToolBox ) ) return; diff --git a/framework/source/uielement/spinfieldtoolbarcontroller.cxx b/framework/source/uielement/spinfieldtoolbarcontroller.cxx index d76db7516c88..cb5e16194193 100644 --- a/framework/source/uielement/spinfieldtoolbarcontroller.cxx +++ b/framework/source/uielement/spinfieldtoolbarcontroller.cxx @@ -168,7 +168,7 @@ SpinfieldToolbarController::SpinfieldToolbarController( const Reference< XComponentContext >& rxContext, const Reference< XFrame >& rFrame, ToolBox* pToolbar, - sal_uInt16 nID, + ToolBoxItemId nID, sal_Int32 nWidth, const OUString& aCommand ) : ComplexToolbarController( rxContext, rFrame, pToolbar, nID, aCommand ) diff --git a/framework/source/uielement/styletoolbarcontroller.cxx b/framework/source/uielement/styletoolbarcontroller.cxx index a5c2715095ec..05af487ff48f 100644 --- a/framework/source/uielement/styletoolbarcontroller.cxx +++ b/framework/source/uielement/styletoolbarcontroller.cxx @@ -220,7 +220,7 @@ void StyleToolbarController::statusChanged( const css::frame::FeatureStateEvent& throw css::lang::DisposedException(); ToolBox* pToolBox = nullptr; - sal_uInt16 nItemId = 0; + ToolBoxItemId nItemId; if ( getToolboxId( nItemId, &pToolBox ) ) { bool bChecked = false; diff --git a/framework/source/uielement/subtoolbarcontroller.cxx b/framework/source/uielement/subtoolbarcontroller.cxx index 6dcd8b67404a..489eb135593d 100644 --- a/framework/source/uielement/subtoolbarcontroller.cxx +++ b/framework/source/uielement/subtoolbarcontroller.cxx @@ -135,7 +135,7 @@ void SubToolBarController::statusChanged( const css::frame::FeatureStateEvent& E return; ToolBox* pToolBox = nullptr; - sal_uInt16 nId = 0; + ToolBoxItemId nId; if ( !getToolboxId( nId, &pToolBox ) ) return; @@ -196,7 +196,7 @@ css::uno::Reference< css::awt::XWindow > SubToolBarController::createPopupWindow SolarMutexGuard aGuard; ToolBox* pToolBox = nullptr; - sal_uInt16 nId = 0; + ToolBoxItemId nId; if ( getToolboxId( nId, &pToolBox ) ) { css::uno::Reference< css::frame::XFrame > xFrame ( getFrameInterface() ); @@ -284,7 +284,7 @@ void SubToolBarController::updateImage() if ( !m_aLastCommand.isEmpty() ) { ToolBox* pToolBox = nullptr; - sal_uInt16 nId = 0; + ToolBoxItemId nId; if ( getToolboxId( nId, &pToolBox ) ) { vcl::ImageType eImageType = pToolBox->GetImageSize(); @@ -400,7 +400,7 @@ void SubToolBarController::initialize( const css::uno::Sequence< css::uno::Any > svt::ToolboxController::initialize( rxArgs ); ToolBox* pToolBox = nullptr; - sal_uInt16 nId = 0; + ToolBoxItemId nId; if ( getToolboxId( nId, &pToolBox ) ) { if ( m_aLastCommand.isEmpty() ) diff --git a/framework/source/uielement/togglebuttontoolbarcontroller.cxx b/framework/source/uielement/togglebuttontoolbarcontroller.cxx index ee2cb30e9910..77bf14418ca5 100644 --- a/framework/source/uielement/togglebuttontoolbarcontroller.cxx +++ b/framework/source/uielement/togglebuttontoolbarcontroller.cxx @@ -38,7 +38,7 @@ ToggleButtonToolbarController::ToggleButtonToolbarController( const Reference< XComponentContext >& rxContext, const Reference< XFrame >& rFrame, ToolBox* pToolbar, - sal_uInt16 nID, + ToolBoxItemId nID, Style eStyle, const OUString& aCommand ) : ComplexToolbarController( rxContext, rFrame, pToolbar, nID, aCommand ) diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx index d88ba1384f39..c50d25650082 100644 --- a/framework/source/uielement/toolbarmanager.cxx +++ b/framework/source/uielement/toolbarmanager.cxx @@ -229,8 +229,8 @@ void ToolBarManager::Destroy() // Delete the additional add-ons data for ( ToolBox::ImplToolItems::size_type i = 0; i < m_pToolBar->GetItemCount(); i++ ) { - sal_uInt16 nItemId = m_pToolBar->GetItemId( i ); - if ( nItemId > 0 ) + ToolBoxItemId nItemId = m_pToolBar->GetItemId( i ); + if ( nItemId > ToolBoxItemId(0) ) delete static_cast< AddonsParams* >( m_pToolBar->GetItemData( nItemId )); } @@ -604,7 +604,7 @@ void ToolBarManager::impl_elementChanged(bool const isRemove, void ToolBarManager::setToolBarImage(const Image& rImage, const CommandToInfoMap::const_iterator& rIter) { - const ::std::vector<sal_uInt16>& rIDs = rIter->second.aIds; + const ::std::vector<ToolBoxItemId>& rIDs = rIter->second.aIds; m_pToolBar->SetItemImage( rIter->second.nId, rImage ); for (auto const& it : rIDs) { @@ -631,8 +631,8 @@ void ToolBarManager::RemoveControllers() // dtors where the item window is already invalid! for ( ToolBox::ImplToolItems::size_type i = 0; i < m_pToolBar->GetItemCount(); i++ ) { - sal_uInt16 nItemId = m_pToolBar->GetItemId( i ); - if ( nItemId > 0 ) + ToolBoxItemId nItemId = m_pToolBar->GetItemId( i ); + if ( nItemId > ToolBoxItemId(0) ) { Reference< XComponent > xComponent( m_aControllerMap[ nItemId ], UNO_QUERY ); if ( xComponent.is() ) @@ -661,8 +661,8 @@ void ToolBarManager::CreateControllers() for ( ToolBox::ImplToolItems::size_type i = 0; i < m_pToolBar->GetItemCount(); i++ ) { - sal_uInt16 nId = m_pToolBar->GetItemId( i ); - if ( nId == 0 ) + ToolBoxItemId nId = m_pToolBar->GetItemId( i ); + if ( nId == ToolBoxItemId(0) ) continue; bool bInit( true ); @@ -710,7 +710,7 @@ void ToolBarManager::CreateControllers() aPropValue.Value <<= xToolbarWindow; aPropertyVector.push_back( makeAny( aPropValue )); aPropValue.Name = "Identifier"; - aPropValue.Value <<= nId; + aPropValue.Value <<= sal_uInt16(nId); aPropertyVector.push_back( uno::makeAny( aPropValue ) ); Sequence< Any > aArgs( comphelper::containerToSequence( aPropertyVector )); @@ -822,7 +822,7 @@ void ToolBarManager::CreateControllers() aPropValue.Value <<= m_aModuleIdentifier; aPropertyVector.push_back( makeAny( aPropValue )); aPropValue.Name = "Identifier"; - aPropValue.Value <<= nId; + aPropValue.Value <<= sal_uInt16(nId); aPropertyVector.push_back( uno::makeAny( aPropValue ) ); Sequence< Any > aArgs( comphelper::containerToSequence( aPropertyVector )); @@ -973,7 +973,7 @@ void ToolBarManager::FillToolbar( const Reference< XIndexAccess >& rItemContaine m_aControllerMap.clear(); m_aCommandMap.clear(); - sal_uInt16 nId( 1 ); + ToolBoxItemId nId( 1 ); CommandInfo aCmdInfo; for ( sal_Int32 n = 0; n < rItemContainer->getCount(); n++ ) { @@ -1090,7 +1090,7 @@ void ToolBarManager::FillToolbar( const Reference< XIndexAccess >& rItemContaine if ( !aMergeInstructionContainer.empty() ) { - sal_uInt16 nItemId( TOOLBAR_ITEM_STARTID ); + ToolBoxItemId nItemId( TOOLBAR_ITEM_STARTID ); const sal_uInt32 nCount = aMergeInstructionContainer.size(); for ( sal_uInt32 i=0; i < nCount; i++ ) { @@ -1180,7 +1180,7 @@ void ToolBarManager::FillAddonToolbar( const Sequence< Sequence< PropertyValue > m_aControllerMap.clear(); m_aCommandMap.clear(); - sal_uInt16 nId( 1 ); + ToolBoxItemId nId( 1 ); CommandInfo aCmdInfo; for ( const Sequence< PropertyValue >& rSeq : rAddonToolbar ) { @@ -1248,7 +1248,7 @@ void ToolBarManager::FillOverflowToolbar( ToolBox const * pParent ) bool bInsertSeparator = false; for ( ToolBox::ImplToolItems::size_type i = 0; i < pParent->GetItemCount(); ++i ) { - sal_uInt16 nId = pParent->GetItemId( i ); + ToolBoxItemId nId = pParent->GetItemId( i ); if ( pParent->IsItemClipped( nId ) ) { if ( bInsertSeparator ) @@ -1394,7 +1394,7 @@ void ToolBarManager::HandleClick(void ( SAL_CALL XToolbarController::*_pClick )( if ( m_bDisposed ) return; - sal_uInt16 nId( m_pToolBar->GetCurItemId() ); + ToolBoxItemId nId( m_pToolBar->GetCurItemId() ); ToolBarControllerMap::const_iterator pIter = m_aControllerMap.find( nId ); if ( pIter != m_aControllerMap.end() ) { @@ -1417,7 +1417,7 @@ IMPL_LINK_NOARG(ToolBarManager, DropdownClick, ToolBox *, void) if ( m_bDisposed ) return; - sal_uInt16 nId( m_pToolBar->GetCurItemId() ); + ToolBoxItemId nId( m_pToolBar->GetCurItemId() ); ToolBarControllerMap::const_iterator pIter = m_aControllerMap.find( nId ); if ( pIter != m_aControllerMap.end() ) { @@ -1569,7 +1569,7 @@ void ToolBarManager::AddCustomizeMenuItems(ToolBox const * pToolBar) { if ( m_pToolBar->GetItemType(nPos) == ToolBoxItemType::BUTTON ) { - sal_uInt16 nId = m_pToolBar->GetItemId(nPos); + ToolBoxItemId nId = m_pToolBar->GetItemId(nPos); OUString aCommandURL = m_pToolBar->GetItemCommand( nId ); xVisibleItemsPopupMenu->InsertItem( STARTID_CUSTOMIZE_POPUPMENU+nPos, m_pToolBar->GetItemText( nId ), MenuItemBits::CHECKABLE ); xVisibleItemsPopupMenu->CheckItem( STARTID_CUSTOMIZE_POPUPMENU+nPos, m_pToolBar->IsItemVisible( nId ) ); @@ -1853,7 +1853,7 @@ IMPL_LINK_NOARG(ToolBarManager, Select, ToolBox *, void) return; sal_Int16 nKeyModifier( static_cast<sal_Int16>(m_pToolBar->GetModifier()) ); - sal_uInt16 nId( m_pToolBar->GetCurItemId() ); + ToolBoxItemId nId( m_pToolBar->GetCurItemId() ); ToolBarControllerMap::const_iterator pIter = m_aControllerMap.find( nId ); if ( pIter != m_aControllerMap.end() ) @@ -1898,7 +1898,7 @@ IMPL_LINK( ToolBarManager, DataChanged, DataChangedEvent const *, pDataChangedEv for ( ToolBox::ImplToolItems::size_type nPos = 0; nPos < m_pToolBar->GetItemCount(); ++nPos ) { - const sal_uInt16 nId = m_pToolBar->GetItemId(nPos); + const ToolBoxItemId nId = m_pToolBar->GetItemId(nPos); vcl::Window* pWindow = m_pToolBar->GetItemWindow( nId ); if ( pWindow ) { diff --git a/framework/source/uielement/toolbarmerger.cxx b/framework/source/uielement/toolbarmerger.cxx index 297f38cba9ad..652383988bcd 100644 --- a/framework/source/uielement/toolbarmerger.cxx +++ b/framework/source/uielement/toolbarmerger.cxx @@ -238,8 +238,8 @@ ReferenceToolbarPathInfo ToolBarMerger::FindReferencePoint( for ( ToolBox::ImplToolItems::size_type i = 0; i < nSize; i++ ) { - const sal_uInt16 nItemId = pToolbar->GetItemId( i ); - if ( nItemId > 0 ) + const ToolBoxItemId nItemId = pToolbar->GetItemId( i ); + if ( nItemId > ToolBoxItemId(0) ) { const OUString rCmd = pToolbar->GetItemCommand( nItemId ); if ( rCmd == rReferencePoint ) @@ -303,7 +303,7 @@ ReferenceToolbarPathInfo ToolBarMerger::FindReferencePoint( bool ToolBarMerger::ProcessMergeOperation( ToolBox* pToolbar, ToolBox::ImplToolItems::size_type nPos, - sal_uInt16& rItemId, + ToolBoxItemId& rItemId, CommandToInfoMap& rCommandMap, std::u16string_view rModuleIdentifier, std::u16string_view rMergeCommand, @@ -366,7 +366,7 @@ bool ToolBarMerger::ProcessMergeOperation( */ bool ToolBarMerger::ProcessMergeFallback( ToolBox* pToolbar, - sal_uInt16& rItemId, + ToolBoxItemId& rItemId, CommandToInfoMap& rCommandMap, std::u16string_view rModuleIdentifier, std::u16string_view rMergeCommand, @@ -430,7 +430,7 @@ void ToolBarMerger::MergeItems( ToolBox* pToolbar, ToolBox::ImplToolItems::size_type nPos, sal_uInt16 nModIndex, - sal_uInt16& rItemId, + ToolBoxItemId& rItemId, CommandToInfoMap& rCommandMap, std::u16string_view rModuleIdentifier, const AddonToolbarItemContainer& rAddonToolbarItems ) @@ -511,7 +511,7 @@ void ToolBarMerger::MergeItems( void ToolBarMerger::ReplaceItem( ToolBox* pToolbar, ToolBox::ImplToolItems::size_type nPos, - sal_uInt16& rItemId, + ToolBoxItemId& rItemId, CommandToInfoMap& rCommandMap, std::u16string_view rModuleIdentifier, const AddonToolbarItemContainer& rAddonToolbarItems ) @@ -587,7 +587,7 @@ rtl::Reference<::cppu::OWeakObject> ToolBarMerger::CreateController( const uno::Reference< frame::XFrame > & xFrame, ToolBox* pToolbar, const OUString& rCommandURL, - sal_uInt16 nId, + ToolBoxItemId nId, sal_uInt16 nWidth, std::u16string_view rControlType ) { @@ -621,7 +621,7 @@ rtl::Reference<::cppu::OWeakObject> ToolBarMerger::CreateController( return pResult; } -void ToolBarMerger::CreateToolbarItem( ToolBox* pToolbar, ToolBox::ImplToolItems::size_type nPos, sal_uInt16 nItemId, const AddonToolbarItem& rItem ) +void ToolBarMerger::CreateToolbarItem( ToolBox* pToolbar, ToolBox::ImplToolItems::size_type nPos, ToolBoxItemId nItemId, const AddonToolbarItem& rItem ) { pToolbar->InsertItem( nItemId, rItem.aLabel, ToolBoxItemBits::NONE, nPos ); pToolbar->SetItemCommand( nItemId, rItem.aCommandURL ); diff --git a/include/avmedia/mediatoolbox.hxx b/include/avmedia/mediatoolbox.hxx index 23a766d7829c..0a742abd6214 100644 --- a/include/avmedia/mediatoolbox.hxx +++ b/include/avmedia/mediatoolbox.hxx @@ -36,7 +36,7 @@ public: SFX_DECL_TOOLBOX_CONTROL(); - MediaToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbX ); + MediaToolBoxControl( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbX ); virtual ~MediaToolBoxControl() override; virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) override; diff --git a/include/framework/generictoolbarcontroller.hxx b/include/framework/generictoolbarcontroller.hxx index bebdf78621c2..8184de97e92f 100644 --- a/include/framework/generictoolbarcontroller.hxx +++ b/include/framework/generictoolbarcontroller.hxx @@ -34,7 +34,7 @@ class FWK_DLLPUBLIC GenericToolbarController final : public svt::ToolboxControll GenericToolbarController( const css::uno::Reference< css::uno::XComponentContext >& rxContext, const css::uno::Reference< css::frame::XFrame >& rFrame, ToolBox* pToolBar, - sal_uInt16 nID, + ToolBoxItemId nID, const OUString& aCommand ); GenericToolbarController( const css::uno::Reference< css::uno::XComponentContext >& rxContext, const css::uno::Reference< css::frame::XFrame >& rFrame, @@ -62,7 +62,7 @@ class FWK_DLLPUBLIC GenericToolbarController final : public svt::ToolboxControll private: VclPtr<ToolBox> m_xToolbar; - sal_uInt16 m_nID; + ToolBoxItemId m_nID; bool m_bEnumCommand : 1, m_bMadeInvisible : 1; OUString m_aEnumCommand; diff --git a/include/framework/sfxhelperfunctions.hxx b/include/framework/sfxhelperfunctions.hxx index 7a30899d97de..4858960f7edf 100644 --- a/include/framework/sfxhelperfunctions.hxx +++ b/include/framework/sfxhelperfunctions.hxx @@ -23,6 +23,7 @@ #include <framework/fwkdllapi.h> #include <rtl/ustring.hxx> #include <rtl/ref.hxx> +#include <vcl/toolbox.hxx> namespace com::sun::star::frame { class XFrame; } namespace com::sun::star::uno { template <typename > class Reference; } @@ -35,7 +36,7 @@ class ToolBox; typedef rtl::Reference<svt::ToolboxController> ( *pfunc_setToolBoxControllerCreator)( const css::uno::Reference< css::frame::XFrame >& rFrame, ToolBox* pToolbox, - unsigned short nID, + ToolBoxItemId nID, const OUString& aCommandURL ); typedef rtl::Reference<svt::StatusbarController> ( *pfunc_setStatusBarControllerCreator)( @@ -62,7 +63,7 @@ FWK_DLLPUBLIC pfunc_setToolBoxControllerCreator SetToolBoxControllerCreator( pfu FWK_DLLPUBLIC rtl::Reference<svt::ToolboxController> CreateToolBoxController( const css::uno::Reference< css::frame::XFrame >& rFrame, ToolBox* pToolbox, - unsigned short nID, + ToolBoxItemId nID, const OUString& aCommandURL ); FWK_DLLPUBLIC pfunc_setStatusBarControllerCreator SetStatusBarControllerCreator( pfunc_setStatusBarControllerCreator pSetStatusBarControllerCreator ); diff --git a/include/sfx2/tbxctrl.hxx b/include/sfx2/tbxctrl.hxx index daa9d77b84ac..65d44088629e 100644 --- a/include/sfx2/tbxctrl.hxx +++ b/include/sfx2/tbxctrl.hxx @@ -35,9 +35,9 @@ class InterimItemWindow; class SfxToolBoxControl; class SfxModule; -rtl::Reference<svt::ToolboxController> SfxToolBoxControllerFactory( const css::uno::Reference< css::frame::XFrame >& rFrame, ToolBox* pToolbox, unsigned short nID, const OUString& aCommandURL ); +rtl::Reference<svt::ToolboxController> SfxToolBoxControllerFactory( const css::uno::Reference< css::frame::XFrame >& rFrame, ToolBox* pToolbox, ToolBoxItemId nID, const OUString& aCommandURL ); -typedef rtl::Reference<SfxToolBoxControl> (*SfxToolBoxControlCtor)( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rBox ); +typedef rtl::Reference<SfxToolBoxControl> (*SfxToolBoxControlCtor)( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rBox ); struct SfxTbxCtrlFactory { @@ -55,7 +55,7 @@ struct SfxTbxCtrlFactory #define SFX_DECL_TOOLBOX_CONTROL() \ - static rtl::Reference<SfxToolBoxControl> CreateImpl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox &rTbx ); \ + static rtl::Reference<SfxToolBoxControl> CreateImpl( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox &rTbx ); \ static void RegisterControl(sal_uInt16 nSlotId = 0, SfxModule *pMod=nullptr) /* For special ToolBox controls, such as a font selection box or toolbox @@ -102,11 +102,11 @@ public: public: SFX_DECL_TOOLBOX_CONTROL(); - SfxToolBoxControl( sal_uInt16 nSlotID, sal_uInt16 nId, ToolBox& rBox, bool bShowStrings = false ); + SfxToolBoxControl( sal_uInt16 nSlotID, ToolBoxItemId nId, ToolBox& rBox, bool bShowStrings = false ); virtual ~SfxToolBoxControl() override; ToolBox& GetToolBox() const; - unsigned short GetId() const; + ToolBoxItemId GetId() const; unsigned short GetSlotId() const; void Dispatch( const OUString& aCommand, @@ -116,19 +116,19 @@ public: css::uno::Sequence< css::beans::PropertyValue > const & aArgs ); static SfxItemState GetItemState( const SfxPoolItem* pState ); - static rtl::Reference<SfxToolBoxControl> CreateControl( sal_uInt16 nSlotId, sal_uInt16 nTbxId, ToolBox *pBox, SfxModule const *pMod ); + static rtl::Reference<SfxToolBoxControl> CreateControl( sal_uInt16 nSlotId, ToolBoxItemId nTbxId, ToolBox *pBox, SfxModule const *pMod ); static void RegisterToolBoxControl( SfxModule*, const SfxTbxCtrlFactory&); }; #define SFX_IMPL_TOOLBOX_CONTROL(Class, nItemClass) \ - rtl::Reference<SfxToolBoxControl> Class::CreateImpl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox &rTbx ) \ + rtl::Reference<SfxToolBoxControl> Class::CreateImpl( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox &rTbx ) \ { return new Class( nSlotId, nId, rTbx ); } \ void Class::RegisterControl(sal_uInt16 nSlotId, SfxModule *pMod) \ { SfxToolBoxControl::RegisterToolBoxControl( pMod, SfxTbxCtrlFactory( \ Class::CreateImpl, typeid(nItemClass), nSlotId ) ); } #define SFX_IMPL_TOOLBOX_CONTROL_ARG(Class, nItemClass, Arg) \ - rtl::Reference<SfxToolBoxControl> Class::CreateImpl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox &rTbx ) \ + rtl::Reference<SfxToolBoxControl> Class::CreateImpl( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox &rTbx ) \ { return new Class( nSlotId, nId, rTbx, Arg); } \ void Class::RegisterControl(sal_uInt16 nSlotId, SfxModule *pMod) \ { SfxToolBoxControl::RegisterToolBoxControl( pMod, SfxTbxCtrlFactory( \ diff --git a/include/svtools/toolboxcontroller.hxx b/include/svtools/toolboxcontroller.hxx index 0bf372e9502f..ef15f70c263b 100644 --- a/include/svtools/toolboxcontroller.hxx +++ b/include/svtools/toolboxcontroller.hxx @@ -33,6 +33,7 @@ #include <comphelper/propertycontainer.hxx> #include <cppuhelper/propshlp.hxx> #include <tools/link.hxx> +#include <vcl/toolbox.hxx> #include <unordered_map> @@ -131,7 +132,7 @@ class SVT_DLLPUBLIC ToolboxController : bool IsInSidebar() const { return m_bSidebar; } protected: - bool getToolboxId( sal_uInt16& rItemId, ToolBox** ppToolBox ); + bool getToolboxId( ToolBoxItemId& rItemId, ToolBox** ppToolBox ); struct Listener { Listener( const css::util::URL& rURL, const css::uno::Reference< css::frame::XDispatch >& rDispatch ) : @@ -175,7 +176,7 @@ class SVT_DLLPUBLIC ToolboxController : bool m_bInitialized, m_bDisposed, m_bSidebar; - sal_uInt16 m_nToolBoxId; + ToolBoxItemId m_nToolBoxId; css::uno::Reference< css::frame::XFrame > m_xFrame; css::uno::Reference< css::uno::XComponentContext > m_xContext; OUString m_aCommandURL; diff --git a/include/svx/ParaSpacingControl.hxx b/include/svx/ParaSpacingControl.hxx index f6403e45207b..877ab9abd52e 100644 --- a/include/svx/ParaSpacingControl.hxx +++ b/include/svx/ParaSpacingControl.hxx @@ -41,7 +41,7 @@ namespace svx class ParaULSpacingControl : public SfxToolBoxControl { public: - ParaULSpacingControl(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx); + ParaULSpacingControl(sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx); virtual ~ParaULSpacingControl() override; virtual void StateChanged(sal_uInt16 nSID, SfxItemState eState, @@ -54,7 +54,7 @@ class SVX_DLLPUBLIC ParaAboveSpacingControl final : public ParaULSpacingControl public: SFX_DECL_TOOLBOX_CONTROL(); - ParaAboveSpacingControl(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx); + ParaAboveSpacingControl(sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx); virtual VclPtr<InterimItemWindow> CreateItemWindow(vcl::Window* pParent) override; }; @@ -63,14 +63,14 @@ class SVX_DLLPUBLIC ParaBelowSpacingControl final : public ParaULSpacingControl public: SFX_DECL_TOOLBOX_CONTROL(); - ParaBelowSpacingControl(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx); + ParaBelowSpacingControl(sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx); virtual VclPtr<InterimItemWindow> CreateItemWindow(vcl::Window* pParent) override; }; class ParaLRSpacingControl : public SfxToolBoxControl, public css::ui::XContextChangeEventListener { public: - ParaLRSpacingControl(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx); + ParaLRSpacingControl(sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx); virtual ~ParaLRSpacingControl() override; virtual void SAL_CALL dispose() override; @@ -100,7 +100,7 @@ class SVX_DLLPUBLIC ParaLeftSpacingControl final : public ParaLRSpacingControl public: SFX_DECL_TOOLBOX_CONTROL(); - ParaLeftSpacingControl(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx); + ParaLeftSpacingControl(sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx); virtual VclPtr<InterimItemWindow> CreateItemWindow(vcl::Window* pParent) override; }; @@ -109,7 +109,7 @@ class SVX_DLLPUBLIC ParaRightSpacingControl final : public ParaLRSpacingControl public: SFX_DECL_TOOLBOX_CONTROL(); - ParaRightSpacingControl(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx); + ParaRightSpacingControl(sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx); virtual VclPtr<InterimItemWindow> CreateItemWindow(vcl::Window* pParent) override; }; @@ -118,7 +118,7 @@ class SVX_DLLPUBLIC ParaFirstLineSpacingControl final : public ParaLRSpacingCont public: SFX_DECL_TOOLBOX_CONTROL(); - ParaFirstLineSpacingControl(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx); + ParaFirstLineSpacingControl(sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx); virtual VclPtr<InterimItemWindow> CreateItemWindow(vcl::Window* pParent) override; }; } diff --git a/include/svx/clipboardctl.hxx b/include/svx/clipboardctl.hxx index 00a0a301d7f7..2c93dedfaf86 100644 --- a/include/svx/clipboardctl.hxx +++ b/include/svx/clipboardctl.hxx @@ -37,7 +37,7 @@ class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxClipBoardControl final : public SfxToolBo public: SFX_DECL_TOOLBOX_CONTROL(); - SvxClipBoardControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ); + SvxClipBoardControl( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx ); virtual ~SvxClipBoardControl() override; void CreatePopupWindow() override; diff --git a/include/svx/colorwindow.hxx b/include/svx/colorwindow.hxx index 784f273e87a7..95f7c5c13d86 100644 --- a/include/svx/colorwindow.hxx +++ b/include/svx/colorwindow.hxx @@ -61,11 +61,11 @@ private: // or SvxColorToolBoxControl* m_pControl; VclPtr<ToolBox> m_xToolBox; - sal_uInt16 m_nId; + ToolBoxItemId m_nId; public: MenuOrToolMenuButton(weld::MenuButton* pMenuButton); MenuOrToolMenuButton(weld::Toolbar* pToolbar, const OString& rIdent); - MenuOrToolMenuButton(SvxColorToolBoxControl* pControl, ToolBox* pToolbar, sal_uInt16 nId); + MenuOrToolMenuButton(SvxColorToolBoxControl* pControl, ToolBox* pToolbar, ToolBoxItemId nId); ~MenuOrToolMenuButton(); MenuOrToolMenuButton(MenuOrToolMenuButton const &) = default; diff --git a/include/svx/fillctrl.hxx b/include/svx/fillctrl.hxx index 7155d261a090..ad428a10529f 100644 --- a/include/svx/fillctrl.hxx +++ b/include/svx/fillctrl.hxx @@ -65,7 +65,7 @@ private: public: SFX_DECL_TOOLBOX_CONTROL(); - SvxFillToolBoxControl(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx); + SvxFillToolBoxControl(sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx); virtual ~SvxFillToolBoxControl() override; virtual void StateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState) override; diff --git a/include/svx/formatpaintbrushctrl.hxx b/include/svx/formatpaintbrushctrl.hxx index 826344064051..a9bb530da25c 100644 --- a/include/svx/formatpaintbrushctrl.hxx +++ b/include/svx/formatpaintbrushctrl.hxx @@ -33,7 +33,7 @@ class SAL_WARN_UNUSED SVX_DLLPUBLIC FormatPaintBrushToolBoxControl final : publi { public: SFX_DECL_TOOLBOX_CONTROL(); - FormatPaintBrushToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ); + FormatPaintBrushToolBoxControl( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx ); virtual ~FormatPaintBrushToolBoxControl() override; virtual void DoubleClick() override; diff --git a/include/svx/grafctrl.hxx b/include/svx/grafctrl.hxx index b22b82392409..ad3187c6dcb3 100644 --- a/include/svx/grafctrl.hxx +++ b/include/svx/grafctrl.hxx @@ -28,7 +28,7 @@ class SvxGrafToolBoxControl : public SfxToolBoxControl { public: - SvxGrafToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ); + SvxGrafToolBoxControl( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx ); virtual ~SvxGrafToolBoxControl() override; virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) override; @@ -40,7 +40,7 @@ class SVX_DLLPUBLIC SvxGrafRedToolBoxControl final : public SvxGrafToolBoxContro { public: SFX_DECL_TOOLBOX_CONTROL(); - SvxGrafRedToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ); + SvxGrafRedToolBoxControl( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx ); }; @@ -48,7 +48,7 @@ class SVX_DLLPUBLIC SvxGrafGreenToolBoxControl final : public SvxGrafToolBoxCont { public: SFX_DECL_TOOLBOX_CONTROL(); - SvxGrafGreenToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ); + SvxGrafGreenToolBoxControl( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx ); }; @@ -56,7 +56,7 @@ class SVX_DLLPUBLIC SvxGrafBlueToolBoxControl final : public SvxGrafToolBoxContr { public: SFX_DECL_TOOLBOX_CONTROL(); - SvxGrafBlueToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ); + SvxGrafBlueToolBoxControl( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx ); }; @@ -64,7 +64,7 @@ class SVX_DLLPUBLIC SvxGrafLuminanceToolBoxControl final : public SvxGrafToolBox { public: SFX_DECL_TOOLBOX_CONTROL(); - SvxGrafLuminanceToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ); + SvxGrafLuminanceToolBoxControl( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx ); }; @@ -72,7 +72,7 @@ class SVX_DLLPUBLIC SvxGrafContrastToolBoxControl final : public SvxGrafToolBoxC { public: SFX_DECL_TOOLBOX_CONTROL(); - SvxGrafContrastToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ); + SvxGrafContrastToolBoxControl( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx ); }; @@ -80,7 +80,7 @@ class SVX_DLLPUBLIC SvxGrafGammaToolBoxControl final : public SvxGrafToolBoxCont { public: SFX_DECL_TOOLBOX_CONTROL(); - SvxGrafGammaToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ); + SvxGrafGammaToolBoxControl( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx ); }; @@ -88,7 +88,7 @@ class SVX_DLLPUBLIC SvxGrafTransparenceToolBoxControl final : public SvxGrafTool { public: SFX_DECL_TOOLBOX_CONTROL(); - SvxGrafTransparenceToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ); + SvxGrafTransparenceToolBoxControl( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx ); }; @@ -96,7 +96,7 @@ class SVX_DLLPUBLIC SvxGrafModeToolBoxControl final : public SfxToolBoxControl, { public: SFX_DECL_TOOLBOX_CONTROL(); - SvxGrafModeToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ); + SvxGrafModeToolBoxControl( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx ); virtual ~SvxGrafModeToolBoxControl() override; virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) override; diff --git a/include/svx/linectrl.hxx b/include/svx/linectrl.hxx index 7ade8dc06643..2fd24305ca2e 100644 --- a/include/svx/linectrl.hxx +++ b/include/svx/linectrl.hxx @@ -79,7 +79,7 @@ class SVX_DLLPUBLIC SvxLineWidthToolBoxControl final : public SfxToolBoxControl public: SFX_DECL_TOOLBOX_CONTROL(); - SvxLineWidthToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ); + SvxLineWidthToolBoxControl( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx ); virtual ~SvxLineWidthToolBoxControl() override; virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, diff --git a/include/svx/tbxctl.hxx b/include/svx/tbxctl.hxx index 46b8d6dbbfa0..f2e28c9ec47d 100644 --- a/include/svx/tbxctl.hxx +++ b/include/svx/tbxctl.hxx @@ -38,7 +38,7 @@ private: protected: public: - SvxTbxCtlDraw( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ); + SvxTbxCtlDraw( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx ); // XInitialization virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) override; diff --git a/include/vcl/builder.hxx b/include/vcl/builder.hxx index c7d7f645532c..153d52887d7a 100644 --- a/include/vcl/builder.hxx +++ b/include/vcl/builder.hxx @@ -17,6 +17,7 @@ #include <vcl/dllapi.h> #include <vcl/window.hxx> #include <vcl/vclptr.hxx> +#include <vcl/toolbox.hxx> #include <tools/wintypes.hxx> #include <vcl/EnumContext.hxx> @@ -282,7 +283,7 @@ private: std::vector< VclPtr<MessageDialog> > m_aMessageDialogs; - sal_uInt16 m_nLastToolbarId; + ToolBoxItemId m_nLastToolbarId; sal_uInt16 m_nLastMenuItemId; diff --git a/include/vcl/toolbox.hxx b/include/vcl/toolbox.hxx index 98d60ba1d73b..649cc0fe3093 100644 --- a/include/vcl/toolbox.hxx +++ b/include/vcl/toolbox.hxx @@ -68,6 +68,16 @@ enum class ToolBoxLayoutMode // Position of the text when icon and text are painted enum class ToolBoxTextPosition { Right, Bottom }; +typedef o3tl::strong_int<sal_uInt16, struct ToolBoxItemIdTag> ToolBoxItemId; +namespace std { + template<> + struct hash<ToolBoxItemId> + { + std::size_t operator()(ToolBoxItemId const & s) const + { return std::size_t(sal_uInt16(s)); } + }; +} + class Idle; class VCL_DLLPUBLIC ToolBox : public DockingWindow { @@ -79,7 +89,7 @@ public: virtual FactoryFunction GetUITestFactory() const override; - void SetCurItemId( sal_uInt16 CurID ) { mnCurItemId=CurID; } + void SetCurItemId( ToolBoxItemId CurID ) { mnCurItemId=CurID; } static constexpr auto APPEND = std::numeric_limits<ImplToolItems::size_type>::max(); @@ -114,10 +124,10 @@ private: tools::Long mnLastResizeDY; tools::Long mnActivateCount; Degree10 mnImagesRotationAngle; - sal_uInt16 mnLastFocusItemId; - sal_uInt16 mnHighItemId; - sal_uInt16 mnCurItemId; - sal_uInt16 mnDownItemId; + ToolBoxItemId mnLastFocusItemId; + ToolBoxItemId mnHighItemId; + ToolBoxItemId mnCurItemId; + ToolBoxItemId mnDownItemId; ImplToolItems::size_type mnCurPos; ImplToolItems::size_type mnLines; // total number of toolbox lines ImplToolItems::size_type mnCurLine; // the currently visible line @@ -173,7 +183,7 @@ private: SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle ); using DockingWindow::ImplInitSettings; SAL_DLLPRIVATE void ImplInitSettings( bool bFont, bool bForeground, bool bBackground ); - SAL_DLLPRIVATE ImplToolItem* ImplGetItem( sal_uInt16 nId ) const; + SAL_DLLPRIVATE ImplToolItem* ImplGetItem( ToolBoxItemId nId ) const; SAL_DLLPRIVATE bool ImplCalcItem(); SAL_DLLPRIVATE ImplToolItems::size_type ImplCalcBreaks( tools::Long nWidth, tools::Long* pMaxLineWidth, bool bCalcHorz ) const; SAL_DLLPRIVATE void ImplFormat( bool bResize = false ); @@ -199,7 +209,7 @@ private: SAL_DLLPRIVATE Point ImplGetPopupPosition( const tools::Rectangle& rRect ) const; SAL_DLLPRIVATE bool ImplIsFloatingMode() const; SAL_DLLPRIVATE bool ImplIsInPopupMode() const; - SAL_DLLPRIVATE const OUString& ImplGetHelpText( sal_uInt16 nItemId ) const; + SAL_DLLPRIVATE const OUString& ImplGetHelpText( ToolBoxItemId nItemId ) const; SAL_DLLPRIVATE Size ImplGetOptimalFloatingSize(); SAL_DLLPRIVATE bool ImplHasExternalMenubutton(); SAL_DLLPRIVATE void ImplDrawFloatwinBorder(vcl::RenderContext& rRenderContext, ImplToolItem const * pItem ); @@ -300,24 +310,24 @@ public: ToolBoxItemBits nBits, const Size& rRequestedSize, ImplToolItems::size_type nPos = APPEND ); - void InsertItem( sal_uInt16 nItemId, const Image& rImage, + void InsertItem( ToolBoxItemId nItemId, const Image& rImage, ToolBoxItemBits nBits = ToolBoxItemBits::NONE, ImplToolItems::size_type nPos = APPEND ); - void InsertItem( sal_uInt16 nItemId, const Image& rImage, + void InsertItem( ToolBoxItemId nItemId, const Image& rImage, const OUString& rText, ToolBoxItemBits nBits = ToolBoxItemBits::NONE, ImplToolItems::size_type nPos = APPEND ); - void InsertItem( sal_uInt16 nItemId, const OUString& rText, + void InsertItem( ToolBoxItemId nItemId, const OUString& rText, ToolBoxItemBits nBits = ToolBoxItemBits::NONE, ImplToolItems::size_type nPos = APPEND ); - void InsertWindow( sal_uInt16 nItemId, vcl::Window* pWindow, + void InsertWindow( ToolBoxItemId nItemId, vcl::Window* pWindow, ToolBoxItemBits nBits = ToolBoxItemBits::NONE, ImplToolItems::size_type nPos = APPEND ); void InsertSpace(); void InsertSeparator( ImplToolItems::size_type nPos = APPEND, sal_uInt16 nPixSize = 0 ); void InsertBreak( ImplToolItems::size_type nPos = APPEND ); void RemoveItem( ImplToolItems::size_type nPos ); - void CopyItem( const ToolBox& rToolBox, sal_uInt16 nItemId ); + void CopyItem( const ToolBox& rToolBox, ToolBoxItemId nItemId ); void Clear(); void SetButtonType( ButtonType eNewType ); @@ -337,80 +347,80 @@ public: ImplToolItems::size_type GetItemCount() const; ToolBoxItemType GetItemType( ImplToolItems::size_type nPos ) const; - ImplToolItems::size_type GetItemPos( sal_uInt16 nItemId ) const; + ImplToolItems::size_type GetItemPos( ToolBoxItemId nItemId ) const; ImplToolItems::size_type GetItemPos( const Point& rPos ) const; - sal_uInt16 GetItemId( ImplToolItems::size_type nPos ) const; - sal_uInt16 GetItemId( const Point& rPos ) const; + ToolBoxItemId GetItemId( ImplToolItems::size_type nPos ) const; + ToolBoxItemId GetItemId( const Point& rPos ) const; /// Map the command name (like .uno:Save) back to item id. - sal_uInt16 GetItemId( const OUString& rCommand ) const; - tools::Rectangle GetItemRect( sal_uInt16 nItemId ); + ToolBoxItemId GetItemId( const OUString& rCommand ) const; + tools::Rectangle GetItemRect( ToolBoxItemId nItemId ); tools::Rectangle GetItemPosRect( ImplToolItems::size_type nPos ); tools::Rectangle const & GetOverflowRect() const; /// Returns size of the bitmap / text that is inside this toolbox item. - Size GetItemContentSize( sal_uInt16 nItemId ); + Size GetItemContentSize( ToolBoxItemId nItemId ); - sal_uInt16 GetCurItemId() const { return mnCurItemId; } - sal_uInt16 GetDownItemId() const { return mnDownItemId; } + ToolBoxItemId GetCurItemId() const { return mnCurItemId; } + ToolBoxItemId GetDownItemId() const { return mnDownItemId; } sal_uInt16 GetModifier() const { return mnMouseModifier; } - void SetItemBits( sal_uInt16 nItemId, ToolBoxItemBits nBits ); - ToolBoxItemBits GetItemBits( sal_uInt16 nItemId ) const; + void SetItemBits( ToolBoxItemId nItemId, ToolBoxItemBits nBits ); + ToolBoxItemBits GetItemBits( ToolBoxItemId nItemId ) const; - void SetItemExpand( sal_uInt16 nItemId, bool bExpand ); + void SetItemExpand( ToolBoxItemId nItemId, bool bExpand ); // e.g. a label used as an itemwindow - void SetItemWindowNonInteractive(sal_uInt16 nItemId, bool bNonInteractive); + void SetItemWindowNonInteractive(ToolBoxItemId nItemId, bool bNonInteractive); - void SetItemData( sal_uInt16 nItemId, void* pNewData ); - void* GetItemData( sal_uInt16 nItemId ) const; - void SetItemImage( sal_uInt16 nItemId, const Image& rImage ); - Image GetItemImage( sal_uInt16 nItemId ) const; - void SetItemImageAngle( sal_uInt16 nItemId, Degree10 nAngle10 ); - void SetItemImageMirrorMode( sal_uInt16 nItemId, bool bMirror ); - void SetItemText( sal_uInt16 nItemId, const OUString& rText ); - const OUString& GetItemText( sal_uInt16 nItemId ) const; - void SetItemWindow( sal_uInt16 nItemId, vcl::Window* pNewWindow ); - vcl::Window* GetItemWindow( sal_uInt16 nItemId ) const; - sal_uInt16 GetHighlightItemId() const { return mnHighItemId; } + void SetItemData( ToolBoxItemId nItemId, void* pNewData ); + void* GetItemData( ToolBoxItemId nItemId ) const; + void SetItemImage( ToolBoxItemId nItemId, const Image& rImage ); + Image GetItemImage( ToolBoxItemId nItemId ) const; + void SetItemImageAngle( ToolBoxItemId nItemId, Degree10 nAngle10 ); + void SetItemImageMirrorMode( ToolBoxItemId nItemId, bool bMirror ); + void SetItemText( ToolBoxItemId nItemId, const OUString& rText ); + const OUString& GetItemText( ToolBoxItemId nItemId ) const; + void SetItemWindow( ToolBoxItemId nItemId, vcl::Window* pNewWindow ); + vcl::Window* GetItemWindow( ToolBoxItemId nItemId ) const; + ToolBoxItemId GetHighlightItemId() const { return mnHighItemId; } void EndSelection(); - void SetItemDown( sal_uInt16 nItemId, bool bDown ); + void SetItemDown( ToolBoxItemId nItemId, bool bDown ); - void SetItemState( sal_uInt16 nItemId, TriState eState ); - TriState GetItemState( sal_uInt16 nItemId ) const; + void SetItemState( ToolBoxItemId nItemId, TriState eState ); + TriState GetItemState( ToolBoxItemId nItemId ) const; - void CheckItem( sal_uInt16 nItemId, bool bCheck = true ); - bool IsItemChecked( sal_uInt16 nItemId ) const; + void CheckItem( ToolBoxItemId nItemId, bool bCheck = true ); + bool IsItemChecked( ToolBoxItemId nItemId ) const; - void EnableItem( sal_uInt16 nItemId, bool bEnable = true ); - bool IsItemEnabled( sal_uInt16 nItemId ) const; + void EnableItem( ToolBoxItemId nItemId, bool bEnable = true ); + bool IsItemEnabled( ToolBoxItemId nItemId ) const; - void TriggerItem( sal_uInt16 nItemId ); + void TriggerItem( ToolBoxItemId nItemId ); /// Shows or hides items. - void ShowItem(sal_uInt16 nItemId, bool bVisible = true); + void ShowItem(ToolBoxItemId nItemId, bool bVisible = true); /// Convenience method to hide items (via ShowItem). - void HideItem(sal_uInt16 nItemId) { ShowItem( nItemId, false ); } + void HideItem(ToolBoxItemId nItemId) { ShowItem( nItemId, false ); } - bool IsItemClipped( sal_uInt16 nItemId ) const; - bool IsItemVisible( sal_uInt16 nItemId ) const; - bool IsItemReallyVisible( sal_uInt16 nItemId ) const; + bool IsItemClipped( ToolBoxItemId nItemId ) const; + bool IsItemVisible( ToolBoxItemId nItemId ) const; + bool IsItemReallyVisible( ToolBoxItemId nItemId ) const; - void SetItemCommand( sal_uInt16 nItemId, const OUString& rCommand ); - OUString GetItemCommand( sal_uInt16 nItemId ) const; + void SetItemCommand( ToolBoxItemId nItemId, const OUString& rCommand ); + OUString GetItemCommand( ToolBoxItemId nItemId ) const; using Window::SetQuickHelpText; - void SetQuickHelpText( sal_uInt16 nItemId, const OUString& rText ); + void SetQuickHelpText( ToolBoxItemId nItemId, const OUString& rText ); using Window::GetQuickHelpText; - OUString GetQuickHelpText( sal_uInt16 nItemId ) const; + OUString GetQuickHelpText( ToolBoxItemId nItemId ) const; - void SetHelpText( sal_uInt16 nItemId, const OUString& rText ); - const OUString& GetHelpText( sal_uInt16 nItemId ) const; + void SetHelpText( ToolBoxItemId nItemId, const OUString& rText ); + const OUString& GetHelpText( ToolBoxItemId nItemId ) const; - void SetHelpId( sal_uInt16 nItemId, const OString& rHelpId ); + void SetHelpId( ToolBoxItemId nItemId, const OString& rHelpId ); // window size according to current alignment, floating state and number of lines Size CalcWindowSizePixel(); @@ -487,10 +497,10 @@ public: // returns the bounding box for the character at index nIndex // where nIndex is relative to the starting index of the item // with id nItemId (in coordinates of the displaying window) - tools::Rectangle GetCharacterBounds( sal_uInt16 nItemId, tools::Long nIndex ); + tools::Rectangle GetCharacterBounds( ToolBoxItemId nItemId, tools::Long nIndex ); // -1 is returned if no character is at that point // if an index is found the corresponding item id is filled in (else 0) - tools::Long GetIndexForPoint( const Point& rPoint, sal_uInt16& rItemID ); + tools::Long GetIndexForPoint( const Point& rPoint, ToolBoxItemId& rItemID ); static Size GetDefaultImageSize(ToolBoxButtonSize eToolBoxButtonSize); Size GetDefaultImageSize() const; @@ -507,12 +517,12 @@ public: virtual void DumpAsPropertyTree(tools::JsonWriter&) override; }; -inline void ToolBox::CheckItem( sal_uInt16 nItemId, bool bCheck ) +inline void ToolBox::CheckItem( ToolBoxItemId nItemId, bool bCheck ) { SetItemState( nItemId, bCheck ? TRISTATE_TRUE : TRISTATE_FALSE ); } -inline bool ToolBox::IsItemChecked( sal_uInt16 nItemId ) const +inline bool ToolBox::IsItemChecked( ToolBoxItemId nItemId ) const { return (GetItemState( nItemId ) == TRISTATE_TRUE); } diff --git a/sc/inc/NumberFormatControl.hxx b/sc/inc/NumberFormatControl.hxx index 77e3843613cd..55002b48d686 100644 --- a/sc/inc/NumberFormatControl.hxx +++ b/sc/inc/NumberFormatControl.hxx @@ -29,7 +29,7 @@ class ScNumberFormatControl final : public SfxToolBoxControl public: SFX_DECL_TOOLBOX_CONTROL(); - ScNumberFormatControl(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx); + ScNumberFormatControl(sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx); virtual ~ScNumberFormatControl() override; virtual void StateChanged(sal_uInt16 nSID, SfxItemState eState, diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc index 4e0001d3f1ff..d553c82e2cbe 100644 --- a/sc/inc/sc.hrc +++ b/sc/inc/sc.hrc @@ -94,11 +94,7 @@ #define SID_NUMBER_PERCENT (SC_VIEW_START + 46) // "slot" IDs for input images: -#define SID_INPUT_FUNCTION (SC_VIEW_START + 47) -#define SID_INPUT_SUM (SC_VIEW_START + 48) -#define SID_INPUT_EQUAL (SC_VIEW_START + 49) -#define SID_INPUT_CANCEL (SC_VIEW_START + 50) -#define SID_INPUT_OK (SC_VIEW_START + 51) +// 47..51 are used for toolbox ids #define SID_NUMBER_STANDARD (SC_VIEW_START + 52) #define SID_NUMBER_DATE (SC_VIEW_START + 53) diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx index 8974bbc2cf2c..bc91f0c835b6 100644 --- a/sc/source/ui/app/inputwin.cxx +++ b/sc/source/ui/app/inputwin.cxx @@ -91,6 +91,12 @@ using com::sun::star::beans::XPropertySet; namespace { +constexpr ToolBoxItemId SID_INPUT_FUNCTION (SC_VIEW_START + 47); +constexpr ToolBoxItemId SID_INPUT_SUM (SC_VIEW_START + 48); +constexpr ToolBoxItemId SID_INPUT_EQUAL (SC_VIEW_START + 49); +constexpr ToolBoxItemId SID_INPUT_CANCEL (SC_VIEW_START + 50); +constexpr ToolBoxItemId SID_INPUT_OK (SC_VIEW_START + 51); + enum ScNameInputType { SC_NAME_INPUT_CELL, @@ -178,7 +184,7 @@ ScInputWindow::ScInputWindow( vcl::Window* pParent, const SfxBindings* pBind ) : // Position window, 3 buttons, input window if (!comphelper::LibreOfficeKit::isActive()) { - InsertWindow (1, aWndPos.get(), ToolBoxItemBits::NONE, 0); + InsertWindow (ToolBoxItemId(1), aWndPos.get(), ToolBoxItemBits::NONE, 0); InsertSeparator (1); InsertItem (SID_INPUT_FUNCTION, Image(StockImage::Yes, RID_BMP_INPUT_FUNCTION), ToolBoxItemBits::NONE, 2); } @@ -194,7 +200,7 @@ ScInputWindow::ScInputWindow( vcl::Window* pParent, const SfxBindings* pBind ) : InsertItem (SID_INPUT_OK, Image(StockImage::Yes, RID_BMP_INPUT_OK), ToolBoxItemBits::NONE, 6); } - InsertWindow (7, mxTextWindow.get(), ToolBoxItemBits::NONE, 7); + InsertWindow (ToolBoxItemId(7), mxTextWindow.get(), ToolBoxItemBits::NONE, 7); SetDropdownClickHdl( LINK( this, ScInputWindow, DropdownClickHdl )); if (!comphelper::LibreOfficeKit::isActive()) @@ -332,87 +338,82 @@ void ScInputWindow::Select() ScModule* pScMod = SC_MOD(); ToolBox::Select(); - switch ( GetCurItemId() ) + ToolBoxItemId curItemId = GetCurItemId(); + if (curItemId == SID_INPUT_FUNCTION) { - case SID_INPUT_FUNCTION: - { - //! new method at ScModule to query if function autopilot is open - SfxViewFrame* pViewFrm = SfxViewFrame::Current(); - if ( pViewFrm && ( comphelper::LibreOfficeKit::isActive() || !pViewFrm->GetChildWindow( SID_OPENDLG_FUNCTION ) ) ) - { - pViewFrm->GetDispatcher()->Execute( SID_OPENDLG_FUNCTION, - SfxCallMode::SYNCHRON | SfxCallMode::RECORD ); + //! new method at ScModule to query if function autopilot is open + SfxViewFrame* pViewFrm = SfxViewFrame::Current(); + if ( pViewFrm && ( comphelper::LibreOfficeKit::isActive() || !pViewFrm->GetChildWindow( SID_OPENDLG_FUNCTION ) ) ) + { + pViewFrm->GetDispatcher()->Execute( SID_OPENDLG_FUNCTION, + SfxCallMode::SYNCHRON | SfxCallMode::RECORD ); - // The Toolbox will be disabled anyways, so we don't need to switch here, - // regardless whether it succeeded or not! + // The Toolbox will be disabled anyways, so we don't need to switch here, + // regardless whether it succeeded or not! // SetOkCancelMode(); - } - } - break; - - case SID_INPUT_CANCEL: - pScMod->InputCancelHandler(); - SetSumAssignMode(); - break; - - case SID_INPUT_OK: - pScMod->InputEnterHandler(); - SetSumAssignMode(); - mxTextWindow->Invalidate(); // Or else the Selection remains - break; - - case SID_INPUT_EQUAL: + } + } + else if (curItemId == SID_INPUT_CANCEL) + { + pScMod->InputCancelHandler(); + SetSumAssignMode(); + } + else if (curItemId == SID_INPUT_OK) + { + pScMod->InputEnterHandler(); + SetSumAssignMode(); + mxTextWindow->Invalidate(); // Or else the Selection remains + } + else if (curItemId == SID_INPUT_EQUAL) + { + mxTextWindow->StartEditEngine(); + if ( pScMod->IsEditMode() ) // Isn't if e.g. protected { mxTextWindow->StartEditEngine(); - if ( pScMod->IsEditMode() ) // Isn't if e.g. protected - { - mxTextWindow->StartEditEngine(); - sal_Int32 nStartPos = 1; - sal_Int32 nEndPos = 1; + sal_Int32 nStartPos = 1; + sal_Int32 nEndPos = 1; - ScTabViewShell* pViewSh = dynamic_cast<ScTabViewShell*>( SfxViewShell::Current() ); - if ( pViewSh ) - { - const OUString& rString = mxTextWindow->GetTextString(); - const sal_Int32 nLen = rString.getLength(); + ScTabViewShell* pViewSh = dynamic_cast<ScTabViewShell*>( SfxViewShell::Current() ); + if ( pViewSh ) + { + const OUString& rString = mxTextWindow->GetTextString(); + const sal_Int32 nLen = rString.getLength(); - ScDocument& rDoc = pViewSh->GetViewData().GetDocument(); - CellType eCellType = rDoc.GetCellType( pViewSh->GetViewData().GetCurPos() ); - switch ( eCellType ) + ScDocument& rDoc = pViewSh->GetViewData().GetDocument(); + CellType eCellType = rDoc.GetCellType( pViewSh->GetViewData().GetCurPos() ); + switch ( eCellType ) + { + case CELLTYPE_VALUE: { - case CELLTYPE_VALUE: - { - nEndPos = nLen + 1; - mxTextWindow->SetTextString("=" + rString); - break; - } - case CELLTYPE_STRING: - case CELLTYPE_EDIT: - nStartPos = 0; - nEndPos = nLen; - break; - case CELLTYPE_FORMULA: - nEndPos = nLen; - break; - default: - mxTextWindow->SetTextString("="); - break; + nEndPos = nLen + 1; + mxTextWindow->SetTextString("=" + rString); + break; } + case CELLTYPE_STRING: + case CELLTYPE_EDIT: + nStartPos = 0; + nEndPos = nLen; + break; + case CELLTYPE_FORMULA: + nEndPos = nLen; + break; + default: + mxTextWindow->SetTextString("="); + break; } + } - EditView* pView = mxTextWindow->GetEditView(); - if (pView) - { - if (comphelper::LibreOfficeKit::isActive()) - TextGrabFocus(); - pView->SetSelection( ESelection(0, nStartPos, 0, nEndPos) ); - pScMod->InputChanged(pView); - SetOkCancelMode(); - pView->SetEditEngineUpdateMode(true); - } + EditView* pView = mxTextWindow->GetEditView(); + if (pView) + { + if (comphelper::LibreOfficeKit::isActive()) + TextGrabFocus(); + pView->SetSelection( ESelection(0, nStartPos, 0, nEndPos) ); + pScMod->InputChanged(pView); + SetOkCancelMode(); + pView->SetEditEngineUpdateMode(true); } - break; } } } @@ -1026,7 +1027,7 @@ void ScInputWindow::MenuHdl(std::string_view command) IMPL_LINK_NOARG(ScInputWindow, DropdownClickHdl, ToolBox *, void) { - sal_uInt16 nCurID = GetCurItemId(); + ToolBoxItemId nCurID = GetCurItemId(); EndSelection(); if (nCurID == SID_INPUT_SUM) { diff --git a/sc/source/ui/cctrl/tbzoomsliderctrl.cxx b/sc/source/ui/cctrl/tbzoomsliderctrl.cxx index 2b00ebea34d1..9c5bbb107ca7 100644 --- a/sc/source/ui/cctrl/tbzoomsliderctrl.cxx +++ b/sc/source/ui/cctrl/tbzoomsliderctrl.cxx @@ -36,7 +36,7 @@ SFX_IMPL_TOOLBOX_CONTROL( ScZoomSliderControl, SvxZoomSliderItem ); ScZoomSliderControl::ScZoomSliderControl( sal_uInt16 nSlotId, - sal_uInt16 nId, + ToolBoxItemId nId, ToolBox& rTbx ) :SfxToolBoxControl( nSlotId, nId, rTbx ) { @@ -51,7 +51,7 @@ ScZoomSliderControl::~ScZoomSliderControl() void ScZoomSliderControl::StateChanged( sal_uInt16 /*nSID*/, SfxItemState eState, const SfxPoolItem* pState ) { - sal_uInt16 nId = GetId(); + ToolBoxItemId nId = GetId(); ToolBox& rTbx = GetToolBox(); ScZoomSliderWnd* pBox = static_cast<ScZoomSliderWnd*>(rTbx.GetItemWindow( nId )); OSL_ENSURE( pBox ,"Control not found!" ); diff --git a/sc/source/ui/inc/tbzoomsliderctrl.hxx b/sc/source/ui/inc/tbzoomsliderctrl.hxx index 944f9c86335e..8fc4033cb978 100644 --- a/sc/source/ui/inc/tbzoomsliderctrl.hxx +++ b/sc/source/ui/inc/tbzoomsliderctrl.hxx @@ -33,7 +33,7 @@ class ScZoomSliderControl : public SfxToolBoxControl { public: SFX_DECL_TOOLBOX_CONTROL(); - ScZoomSliderControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ); + ScZoomSliderControl( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx ); virtual ~ScZoomSliderControl() override; virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) override; diff --git a/sc/source/ui/sidebar/NumberFormatControl.cxx b/sc/source/ui/sidebar/NumberFormatControl.cxx index 5f823f1b0b39..0337ec5cad04 100644 --- a/sc/source/ui/sidebar/NumberFormatControl.cxx +++ b/sc/source/ui/sidebar/NumberFormatControl.cxx @@ -26,7 +26,7 @@ using namespace sc; SFX_IMPL_TOOLBOX_CONTROL(ScNumberFormatControl, SfxUInt16Item); -ScNumberFormatControl::ScNumberFormatControl(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx) +ScNumberFormatControl::ScNumberFormatControl(sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx) : SfxToolBoxControl(nSlotId, nId, rTbx) { } @@ -38,7 +38,7 @@ ScNumberFormatControl::~ScNumberFormatControl() void ScNumberFormatControl::StateChanged(sal_uInt16, SfxItemState eState, const SfxPoolItem* pState) { - sal_uInt16 nId = GetId(); + ToolBoxItemId nId = GetId(); ToolBox& rTbx = GetToolBox(); ScNumberFormat* pComboBox = static_cast<ScNumberFormat*>(rTbx.GetItemWindow(nId)); diff --git a/sd/source/ui/controller/displaymodecontroller.cxx b/sd/source/ui/controller/displaymodecontroller.cxx index c48f5d635ce9..8dc1a743897b 100644 --- a/sd/source/ui/controller/displaymodecontroller.cxx +++ b/sd/source/ui/controller/displaymodecontroller.cxx @@ -199,7 +199,7 @@ void SAL_CALL DisplayModeController::initialize( const css::uno::Sequence< css:: { svt::PopupWindowController::initialize( aArguments ); ToolBox* pToolBox = nullptr; - sal_uInt16 nId = 0; + ToolBoxItemId nId; if ( getToolboxId( nId, &pToolBox ) ) pToolBox->SetItemBits( nId, pToolBox->GetItemBits( nId ) | ToolBoxItemBits::DROPDOWNONLY ); setToolboxItemImage(BMP_DISPLAYMODE_SLIDE); @@ -222,7 +222,7 @@ VclPtr<vcl::Window> DisplayModeController::createVclPopupWindow( vcl::Window* pP void DisplayModeController::setToolboxItemImage(const OUString& rImage) { - sal_uInt16 nId; + ToolBoxItemId nId; ToolBox* pToolBox = nullptr; if (!getToolboxId( nId, &pToolBox )) return; diff --git a/sd/source/ui/controller/slidelayoutcontroller.cxx b/sd/source/ui/controller/slidelayoutcontroller.cxx index 284df02be296..1fcef5fa98de 100644 --- a/sd/source/ui/controller/slidelayoutcontroller.cxx +++ b/sd/source/ui/controller/slidelayoutcontroller.cxx @@ -317,7 +317,7 @@ void SAL_CALL SlideLayoutController::initialize( const css::uno::Sequence< css:: svt::PopupWindowController::initialize( aArguments ); ToolBox* pToolBox = nullptr; - sal_uInt16 nId = 0; + ToolBoxItemId nId; if ( getToolboxId( nId, &pToolBox ) ) { if ( mbInsertPage ) diff --git a/sd/source/ui/dlg/diactrl.cxx b/sd/source/ui/dlg/diactrl.cxx index aa4cff712d63..6dd4fb84516d 100644 --- a/sd/source/ui/dlg/diactrl.cxx +++ b/sd/source/ui/dlg/diactrl.cxx @@ -139,7 +139,7 @@ IMPL_LINK_NOARG(SdPagesField, ModifyHdl, weld::SpinButton&, void) aArgs ); } -SdTbxCtlDiaPages::SdTbxCtlDiaPages( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) : +SdTbxCtlDiaPages::SdTbxCtlDiaPages( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx ) : SfxToolBoxControl( nSlotId, nId, rTbx ) { } diff --git a/sd/source/ui/dlg/gluectrl.cxx b/sd/source/ui/dlg/gluectrl.cxx index 8e4389dd8983..23e1e4b98317 100644 --- a/sd/source/ui/dlg/gluectrl.cxx +++ b/sd/source/ui/dlg/gluectrl.cxx @@ -134,7 +134,7 @@ void GlueEscDirLB::Fill() * Constructor for glue point escape direction toolbox control */ SdTbxCtlGlueEscDir::SdTbxCtlGlueEscDir( - sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) : + sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx ) : SfxToolBoxControl( nSlotId, nId, rTbx ) { } diff --git a/sd/source/ui/inc/diactrl.hxx b/sd/source/ui/inc/diactrl.hxx index 850779a4b4be..63786b962312 100644 --- a/sd/source/ui/inc/diactrl.hxx +++ b/sd/source/ui/inc/diactrl.hxx @@ -62,7 +62,7 @@ public: SFX_DECL_TOOLBOX_CONTROL(); - SdTbxCtlDiaPages(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx); + SdTbxCtlDiaPages(sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx); virtual ~SdTbxCtlDiaPages() override; }; diff --git a/sd/source/ui/inc/gluectrl.hxx b/sd/source/ui/inc/gluectrl.hxx index 5176c980f402..c5a9b79fb901 100644 --- a/sd/source/ui/inc/gluectrl.hxx +++ b/sd/source/ui/inc/gluectrl.hxx @@ -63,7 +63,7 @@ public: SFX_DECL_TOOLBOX_CONTROL(); - SdTbxCtlGlueEscDir(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx); + SdTbxCtlGlueEscDir(sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx); }; #endif // INCLUDED_SD_SOURCE_UI_INC_GLUECTRL_HXX diff --git a/sfx2/inc/inettbc.hxx b/sfx2/inc/inettbc.hxx index 9e0bbac8541e..0eb4feecbe44 100644 --- a/sfx2/inc/inettbc.hxx +++ b/sfx2/inc/inettbc.hxx @@ -52,7 +52,7 @@ public: SFX_DECL_TOOLBOX_CONTROL(); - SfxURLToolBoxControl_Impl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rBox ); + SfxURLToolBoxControl_Impl( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rBox ); virtual ~SfxURLToolBoxControl_Impl() override; virtual VclPtr<InterimItemWindow> CreateItemWindow(vcl::Window* pParent) override; diff --git a/sfx2/inc/sidebar/ControllerFactory.hxx b/sfx2/inc/sidebar/ControllerFactory.hxx index d33f00d2e8b6..10ddf97c9df5 100644 --- a/sfx2/inc/sidebar/ControllerFactory.hxx +++ b/sfx2/inc/sidebar/ControllerFactory.hxx @@ -20,6 +20,7 @@ #include <sfx2/dllapi.h> #include <com/sun/star/uno/Reference.hxx> +#include <vcl/toolbox.hxx> namespace com::sun::star::awt { class XWindow; } namespace com::sun::star::frame { class XController; } @@ -42,7 +43,7 @@ class ControllerFactory public: static css::uno::Reference<css::frame::XToolbarController> CreateToolBoxController( ToolBox* pToolBox, - const sal_uInt16 nItemId, + const ToolBoxItemId nItemId, const OUString& rsCommandName, const css::uno::Reference<css::frame::XFrame>& rxFrame, const css::uno::Reference<css::frame::XController>& rxController, diff --git a/sfx2/inc/sidebar/SidebarToolBox.hxx b/sfx2/inc/sidebar/SidebarToolBox.hxx index 93cd0a9795dc..1dd26503b0fa 100644 --- a/sfx2/inc/sidebar/SidebarToolBox.hxx +++ b/sfx2/inc/sidebar/SidebarToolBox.hxx @@ -56,7 +56,7 @@ public: void InitToolBox(VclBuilder::stringmap& rMap); protected: - typedef std::map<sal_uInt16, css::uno::Reference<css::frame::XToolbarController>> ControllerContainer; + typedef std::map<ToolBoxItemId, css::uno::Reference<css::frame::XToolbarController>> ControllerContainer; ControllerContainer maControllers; bool mbAreHandlersRegistered; bool mbUseDefaultButtonSize; @@ -68,9 +68,9 @@ protected: DECL_LINK(SelectHandler, ToolBox*, void); DECL_LINK(ChangedIconSizeHandler, LinkParamNone*, void ); - css::uno::Reference<css::frame::XToolbarController> GetControllerForItemId(const sal_uInt16 nItemId) const; + css::uno::Reference<css::frame::XToolbarController> GetControllerForItemId(const ToolBoxItemId nItemId) const; - void CreateController(const sal_uInt16 nItemId, + void CreateController(const ToolBoxItemId nItemId, const css::uno::Reference<css::frame::XFrame>& rxFrame, const sal_Int32 nItemWidth, bool bSideBar); void RegisterHandlers(); diff --git a/sfx2/source/control/emojipopup.cxx b/sfx2/source/control/emojipopup.cxx index 82f9bc3fc1fd..a69fd80ed2cc 100644 --- a/sfx2/source/control/emojipopup.cxx +++ b/sfx2/source/control/emojipopup.cxx @@ -30,7 +30,7 @@ void EmojiPopup::initialize(const css::uno::Sequence<css::uno::Any>& rArguments) PopupWindowController::initialize(rArguments); ToolBox* pToolBox = nullptr; - sal_uInt16 nId = 0; + ToolBoxItemId nId; if (getToolboxId(nId, &pToolBox)) pToolBox->SetItemBits(nId, ToolBoxItemBits::DROPDOWNONLY | pToolBox->GetItemBits(nId)); } diff --git a/sfx2/source/dialog/charmappopup.cxx b/sfx2/source/dialog/charmappopup.cxx index bff52aaf85da..40b4ae43a9d9 100644 --- a/sfx2/source/dialog/charmappopup.cxx +++ b/sfx2/source/dialog/charmappopup.cxx @@ -32,7 +32,7 @@ void CharmapPopup::initialize(const css::uno::Sequence<css::uno::Any>& rArgument PopupWindowController::initialize(rArguments); ToolBox* pToolBox = nullptr; - sal_uInt16 nId = 0; + ToolBoxItemId nId; if (getToolboxId(nId, &pToolBox)) pToolBox->SetItemBits(nId, ToolBoxItemBits::DROPDOWNONLY | pToolBox->GetItemBits(nId)); } diff --git a/sfx2/source/dialog/titledockwin.cxx b/sfx2/source/dialog/titledockwin.cxx index 7483ee8d193d..2ab7833d628a 100644 --- a/sfx2/source/dialog/titledockwin.cxx +++ b/sfx2/source/dialog/titledockwin.cxx @@ -97,7 +97,7 @@ namespace sfx2 { m_bLayoutPending = false; - m_aToolbox->ShowItem( 1, !IsFloatingMode() ); + m_aToolbox->ShowItem( ToolBoxItemId(1), !IsFloatingMode() ); const Size aToolBoxSize( m_aToolbox->CalcWindowSizePixel() ); Size aWindowSize( GetOutputSizePixel() ); @@ -210,17 +210,17 @@ namespace sfx2 m_aToolbox->Clear(); // Get the closer bitmap and set it as right most button. - m_aToolbox->InsertItem(1, Image(StockImage::Yes, SFX_BMP_CLOSE_DOC)); - m_aToolbox->SetQuickHelpText(1, SfxResId(STR_CLOSE_PANE)); - m_aToolbox->ShowItem( 1 ); + m_aToolbox->InsertItem(ToolBoxItemId(1), Image(StockImage::Yes, SFX_BMP_CLOSE_DOC)); + m_aToolbox->SetQuickHelpText(ToolBoxItemId(1), SfxResId(STR_CLOSE_PANE)); + m_aToolbox->ShowItem( ToolBoxItemId(1) ); } IMPL_LINK( TitledDockingWindow, OnToolboxItemSelected, ToolBox*, pToolBox, void ) { - const sal_uInt16 nId = pToolBox->GetCurItemId(); + const ToolBoxItemId nId = pToolBox->GetCurItemId(); - if ( nId == 1 ) + if ( nId == ToolBoxItemId(1) ) { // the closer EndTracking(); diff --git a/sfx2/source/inet/inettbc.cxx b/sfx2/source/inet/inettbc.cxx index 4bea456af22e..5d8bd6c5bb7c 100644 --- a/sfx2/source/inet/inettbc.cxx +++ b/sfx2/source/inet/inettbc.cxx @@ -49,7 +49,7 @@ using namespace ::com::sun::star::task; SFX_IMPL_TOOLBOX_CONTROL(SfxURLToolBoxControl_Impl,SfxStringItem) -SfxURLToolBoxControl_Impl::SfxURLToolBoxControl_Impl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rBox ) +SfxURLToolBoxControl_Impl::SfxURLToolBoxControl_Impl( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rBox ) : SfxToolBoxControl( nSlotId, nId, rBox ) , m_bModified(false) { @@ -218,7 +218,7 @@ IMPL_LINK_NOARG(SfxURLToolBoxControl_Impl, OpenHdl, weld::ComboBox&, bool) void SfxURLToolBoxControl_Impl::StateChanged ( - sal_uInt16 nSID, + sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) diff --git a/sfx2/source/sidebar/ControllerFactory.cxx b/sfx2/source/sidebar/ControllerFactory.cxx index d42a9ff807ce..5aefd0668681 100644 --- a/sfx2/source/sidebar/ControllerFactory.cxx +++ b/sfx2/source/sidebar/ControllerFactory.cxx @@ -40,7 +40,7 @@ namespace sfx2::sidebar { Reference<frame::XToolbarController> ControllerFactory::CreateToolBoxController( ToolBox* pToolBox, - const sal_uInt16 nItemId, + const ToolBoxItemId nItemId, const OUString& rsCommandName, const Reference<frame::XFrame>& rxFrame, const Reference<frame::XController>& rxController, diff --git a/sfx2/source/sidebar/SidebarToolBox.cxx b/sfx2/source/sidebar/SidebarToolBox.cxx index 8e582861fb4f..dc9bdcedd07d 100644 --- a/sfx2/source/sidebar/SidebarToolBox.cxx +++ b/sfx2/source/sidebar/SidebarToolBox.cxx @@ -148,7 +148,7 @@ void SidebarToolBox::KeyInput(const KeyEvent& rKEvt) } void SidebarToolBox::CreateController ( - const sal_uInt16 nItemId, + const ToolBoxItemId nItemId, const css::uno::Reference<css::frame::XFrame>& rxFrame, const sal_Int32 nItemWidth, bool bSideBar) { @@ -162,7 +162,7 @@ void SidebarToolBox::CreateController ( maControllers.insert(std::make_pair(nItemId, xController)); } -Reference<frame::XToolbarController> SidebarToolBox::GetControllerForItemId (const sal_uInt16 nItemId) const +Reference<frame::XToolbarController> SidebarToolBox::GetControllerForItemId (const ToolBoxItemId nItemId) const { ControllerContainer::const_iterator iController (maControllers.find(nItemId)); if (iController != maControllers.end()) diff --git a/sfx2/source/toolbox/tbxitem.cxx b/sfx2/source/toolbox/tbxitem.cxx index 2a76b6534068..f07aa2d82a86 100644 --- a/sfx2/source/toolbox/tbxitem.cxx +++ b/sfx2/source/toolbox/tbxitem.cxx @@ -69,7 +69,7 @@ using namespace ::com::sun::star::ui; SFX_IMPL_TOOLBOX_CONTROL_ARG(SfxToolBoxControl, SfxStringItem, true); -rtl::Reference<svt::ToolboxController> SfxToolBoxControllerFactory( const Reference< XFrame >& rFrame, ToolBox* pToolbox, unsigned short nID, const OUString& aCommandURL ) +rtl::Reference<svt::ToolboxController> SfxToolBoxControllerFactory( const Reference< XFrame >& rFrame, ToolBox* pToolbox, ToolBoxItemId nID, const OUString& aCommandURL ) { SolarMutexGuard aGuard; @@ -113,13 +113,13 @@ struct SfxToolBoxControl_Impl { VclPtr<ToolBox> pBox; bool bShowString; - sal_uInt16 nTbxId; + ToolBoxItemId nTbxId; sal_uInt16 nSlotId; }; SfxToolBoxControl::SfxToolBoxControl( sal_uInt16 nSlotID, - sal_uInt16 nID, + ToolBoxItemId nID, ToolBox& rBox, bool bShowStringItems ) : pImpl( new SfxToolBoxControl_Impl ) @@ -140,7 +140,7 @@ ToolBox& SfxToolBoxControl::GetToolBox() const { return *pImpl->pBox; } -unsigned short SfxToolBoxControl::GetId() const +ToolBoxItemId SfxToolBoxControl::GetId() const { return pImpl->nTbxId; } @@ -170,7 +170,7 @@ void SfxToolBoxControl::RegisterToolBoxControl( SfxModule* pMod, const SfxTbxCtr SfxGetpApp()->RegisterToolBoxControl_Impl( pMod, rFact ); } -rtl::Reference<SfxToolBoxControl> SfxToolBoxControl::CreateControl( sal_uInt16 nSlotId, sal_uInt16 nTbxId, ToolBox *pBox, SfxModule const * pMod ) +rtl::Reference<SfxToolBoxControl> SfxToolBoxControl::CreateControl( sal_uInt16 nSlotId, ToolBoxItemId nTbxId, ToolBox *pBox, SfxModule const * pMod ) { SolarMutexGuard aGuard; @@ -472,7 +472,7 @@ Reference< css::awt::XWindow > SAL_CALL SfxToolBoxControl::createItemWindow( con void SfxToolBoxControl::StateChanged ( - sal_uInt16 nId, + sal_uInt16 /*nSlotId*/, SfxItemState eState, const SfxPoolItem* pState ) @@ -510,7 +510,7 @@ void SfxToolBoxControl::StateChanged else if ( pImpl->bShowString ) { if (auto pStringItem = dynamic_cast< const SfxStringItem *>( pState ) ) - pImpl->pBox->SetItemText(nId, pStringItem->GetValue() ); + pImpl->pBox->SetItemText(GetId(), pStringItem->GetValue() ); } } break; diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx index 4aa8f4d3d792..804a8da5da35 100644 --- a/sfx2/source/view/viewsh.cxx +++ b/sfx2/source/view/viewsh.cxx @@ -417,7 +417,7 @@ void SfxViewShell::ExecMisc_Impl( SfxRequest &rReq ) ToolBox::ImplToolItems::size_type nItemCount = pTextToolbox->GetItemCount(); for( ToolBox::ImplToolItems::size_type nItem = 0; nItem < nItemCount; ++nItem ) { - sal_uInt16 nItemId = pTextToolbox->GetItemId( nItem ); + ToolBoxItemId nItemId = pTextToolbox->GetItemId( nItem ); const OUString& rCommand = pTextToolbox->GetItemCommand( nItemId ); if (rCommand == ".uno:StyleApply") { diff --git a/svtools/source/uno/popupwindowcontroller.cxx b/svtools/source/uno/popupwindowcontroller.cxx index fe7eac4ff847..17b432c445e5 100644 --- a/svtools/source/uno/popupwindowcontroller.cxx +++ b/svtools/source/uno/popupwindowcontroller.cxx @@ -197,7 +197,7 @@ void SAL_CALL PopupWindowController::statusChanged( const frame::FeatureStateEve } ToolBox* pToolBox = nullptr; - sal_uInt16 nItemId = 0; + ToolBoxItemId nItemId; if ( getToolboxId( nItemId, &pToolBox ) ) { pToolBox->CheckItem( nItemId, bValue ); diff --git a/svtools/source/uno/toolboxcontroller.cxx b/svtools/source/uno/toolboxcontroller.cxx index f6d8e84d83d5..949c7c1cfb68 100644 --- a/svtools/source/uno/toolboxcontroller.cxx +++ b/svtools/source/uno/toolboxcontroller.cxx @@ -197,7 +197,11 @@ void SAL_CALL ToolboxController::initialize( const Sequence< Any >& aArguments ) else if ( aPropValue.Name == "ModuleIdentifier" ) aPropValue.Value >>= m_sModuleName; else if ( aPropValue.Name == "Identifier" ) - aPropValue.Value >>= m_nToolBoxId; + { + sal_uInt16 nTmp; + if (aPropValue.Value >>= nTmp) + m_nToolBoxId = ToolBoxItemId(nTmp); + } else if ( aPropValue.Name == "IsSidebar" ) aPropValue.Value >>= m_bSidebar; } @@ -732,26 +736,26 @@ IMPL_STATIC_LINK( ToolboxController, ExecuteHdl_Impl, void*, p, void ) void ToolboxController::enable( bool bEnable ) { ToolBox* pToolBox = nullptr; - sal_uInt16 nItemId = 0; + ToolBoxItemId nItemId; if( getToolboxId( nItemId, &pToolBox ) ) { pToolBox->EnableItem( nItemId, bEnable ); } } -bool ToolboxController::getToolboxId( sal_uInt16& rItemId, ToolBox** ppToolBox ) +bool ToolboxController::getToolboxId( ToolBoxItemId& rItemId, ToolBox** ppToolBox ) { - if( (m_nToolBoxId != SAL_MAX_UINT16) && (ppToolBox == nullptr) ) - return m_nToolBoxId; + if( (m_nToolBoxId != ToolBoxItemId(SAL_MAX_UINT16)) && (ppToolBox == nullptr) ) + return false; ToolBox* pToolBox = static_cast< ToolBox* >( VCLUnoHelper::GetWindow( getParent() ) ); - if( (m_nToolBoxId == SAL_MAX_UINT16) && pToolBox ) + if( (m_nToolBoxId == ToolBoxItemId(SAL_MAX_UINT16)) && pToolBox ) { const ToolBox::ImplToolItems::size_type nCount = pToolBox->GetItemCount(); for ( ToolBox::ImplToolItems::size_type nPos = 0; nPos < nCount; ++nPos ) { - const sal_uInt16 nItemId = pToolBox->GetItemId( nPos ); + const ToolBoxItemId nItemId = pToolBox->GetItemId( nPos ); if ( pToolBox->GetItemCommand( nItemId ) == m_aCommandURL ) { m_nToolBoxId = nItemId; @@ -765,7 +769,7 @@ bool ToolboxController::getToolboxId( sal_uInt16& rItemId, ToolBox** ppToolBox ) rItemId = m_nToolBoxId; - return (rItemId != SAL_MAX_UINT16) && (( ppToolBox == nullptr) || (*ppToolBox != nullptr) ); + return (rItemId != ToolBoxItemId(SAL_MAX_UINT16)) && (( ppToolBox == nullptr) || (*ppToolBox != nullptr) ); } //end diff --git a/svx/inc/tbxcolorupdate.hxx b/svx/inc/tbxcolorupdate.hxx index 391639cd3df8..df7751f9b58d 100644 --- a/svx/inc/tbxcolorupdate.hxx +++ b/svx/inc/tbxcolorupdate.hxx @@ -89,13 +89,13 @@ namespace svx class VclToolboxButtonColorUpdater : public ToolboxButtonColorUpdaterBase { public: - VclToolboxButtonColorUpdater(sal_uInt16 nSlotId, sal_uInt16 nTbxBtnId, ToolBox* ptrTbx, bool bWideButton, + VclToolboxButtonColorUpdater(sal_uInt16 nSlotId, ToolBoxItemId nTbxBtnId, ToolBox* ptrTbx, bool bWideButton, const OUString& rCommandLabel, const OUString& rCommandURL, const css::uno::Reference<css::frame::XFrame>& rFrame); private: - sal_uInt16 mnBtnId; + ToolBoxItemId mnBtnId; VclPtr<ToolBox> mpTbx; virtual void SetQuickHelpText(const OUString& rText) override; diff --git a/svx/source/dialog/srchdlg.cxx b/svx/source/dialog/srchdlg.cxx index 716a28253c94..06836388a33c 100644 --- a/svx/source/dialog/srchdlg.cxx +++ b/svx/source/dialog/srchdlg.cxx @@ -2367,7 +2367,7 @@ static void lcl_SetSearchLabelWindow(const OUString& rStr) VclPtr< ToolBox > pToolBox = static_cast<ToolBox*>( VCLUnoHelper::GetWindow(xWindow) ); for (ToolBox::ImplToolItems::size_type i = 0; pToolBox && i < pToolBox->GetItemCount(); ++i) { - sal_uInt16 id = pToolBox->GetItemId(i); + ToolBoxItemId id = pToolBox->GetItemId(i); if (pToolBox->GetItemCommand(id) == ".uno:SearchLabel") { LabelItemWindow* pSearchLabel = dynamic_cast<LabelItemWindow*>(pToolBox->GetItemWindow(id)); @@ -2414,7 +2414,7 @@ OUString SvxSearchDialogWrapper::GetSearchLabel() VclPtr< ToolBox > pToolBox = static_cast<ToolBox*>( VCLUnoHelper::GetWindow(xWindow) ); for (ToolBox::ImplToolItems::size_type i = 0; pToolBox && i < pToolBox->GetItemCount(); ++i) { - sal_uInt16 id = pToolBox->GetItemId(i); + ToolBoxItemId id = pToolBox->GetItemId(i); if (pToolBox->GetItemCommand(id) == ".uno:SearchLabel") { LabelItemWindow* pSearchLabel = dynamic_cast<LabelItemWindow*>(pToolBox->GetItemWindow(id)); diff --git a/svx/source/form/tbxform.cxx b/svx/source/form/tbxform.cxx index f888eccb3283..7f354f16d2d0 100644 --- a/svx/source/form/tbxform.cxx +++ b/svx/source/form/tbxform.cxx @@ -54,7 +54,7 @@ void SvxFmAbsRecWin::PositionFired(sal_Int64 nRecord) SFX_IMPL_TOOLBOX_CONTROL( SvxFmTbxCtlAbsRec, SfxInt32Item ); -SvxFmTbxCtlAbsRec::SvxFmTbxCtlAbsRec( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) +SvxFmTbxCtlAbsRec::SvxFmTbxCtlAbsRec( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx ) :SfxToolBoxControl( nSlotId, nId, rTbx ) { } @@ -66,7 +66,7 @@ SvxFmTbxCtlAbsRec::~SvxFmTbxCtlAbsRec() void SvxFmTbxCtlAbsRec::StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) { - sal_uInt16 nId = GetId(); + ToolBoxItemId nId = GetId(); ToolBox* pToolBox = &GetToolBox(); SvxFmAbsRecWin* pWin = static_cast<SvxFmAbsRecWin*>( pToolBox->GetItemWindow(nId) ); @@ -96,7 +96,7 @@ VclPtr<InterimItemWindow> SvxFmTbxCtlAbsRec::CreateItemWindow( vcl::Window* pPar SFX_IMPL_TOOLBOX_CONTROL( SvxFmTbxCtlRecText, SfxBoolItem ); -SvxFmTbxCtlRecText::SvxFmTbxCtlRecText( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) +SvxFmTbxCtlRecText::SvxFmTbxCtlRecText( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx ) :SfxToolBoxControl( nSlotId, nId, rTbx ) { rTbx.SetItemWindowNonInteractive(nId, true); @@ -118,7 +118,7 @@ VclPtr<InterimItemWindow> SvxFmTbxCtlRecText::CreateItemWindow( vcl::Window* pPa SFX_IMPL_TOOLBOX_CONTROL( SvxFmTbxCtlRecFromText, SfxBoolItem ); -SvxFmTbxCtlRecFromText::SvxFmTbxCtlRecFromText( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) +SvxFmTbxCtlRecFromText::SvxFmTbxCtlRecFromText( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx ) :SfxToolBoxControl( nSlotId, nId, rTbx ) { rTbx.SetItemWindowNonInteractive(nId, true); @@ -140,7 +140,7 @@ VclPtr<InterimItemWindow> SvxFmTbxCtlRecFromText::CreateItemWindow( vcl::Window* SFX_IMPL_TOOLBOX_CONTROL( SvxFmTbxCtlRecTotal, SfxStringItem ); -SvxFmTbxCtlRecTotal::SvxFmTbxCtlRecTotal( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) +SvxFmTbxCtlRecTotal::SvxFmTbxCtlRecTotal( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx ) : SfxToolBoxControl( nSlotId, nId, rTbx ) { rTbx.SetItemWindowNonInteractive(nId, true); @@ -180,7 +180,7 @@ void SvxFmTbxCtlRecTotal::StateChanged( sal_uInt16 nSID, SfxItemState eState, co SFX_IMPL_TOOLBOX_CONTROL( SvxFmTbxNextRec, SfxBoolItem ); -SvxFmTbxNextRec::SvxFmTbxNextRec( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) +SvxFmTbxNextRec::SvxFmTbxNextRec( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx ) :SfxToolBoxControl( nSlotId, nId, rTbx ) { rTbx.SetItemBits(nId, rTbx.GetItemBits(nId) | ToolBoxItemBits::REPEAT); @@ -195,7 +195,7 @@ SvxFmTbxNextRec::SvxFmTbxNextRec( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& r SFX_IMPL_TOOLBOX_CONTROL( SvxFmTbxPrevRec, SfxBoolItem ); -SvxFmTbxPrevRec::SvxFmTbxPrevRec( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) +SvxFmTbxPrevRec::SvxFmTbxPrevRec( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx ) :SfxToolBoxControl( nSlotId, nId, rTbx ) { rTbx.SetItemBits(nId, rTbx.GetItemBits(nId) | ToolBoxItemBits::REPEAT); diff --git a/svx/source/inc/tbxform.hxx b/svx/source/inc/tbxform.hxx index 0850082ab55a..6c60d806415c 100644 --- a/svx/source/inc/tbxform.hxx +++ b/svx/source/inc/tbxform.hxx @@ -38,7 +38,7 @@ class SvxFmTbxCtlAbsRec : public SfxToolBoxControl public: SFX_DECL_TOOLBOX_CONTROL(); - SvxFmTbxCtlAbsRec(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx); + SvxFmTbxCtlAbsRec(sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx); virtual ~SvxFmTbxCtlAbsRec() override; virtual VclPtr<InterimItemWindow> CreateItemWindow(vcl::Window* pParent) override; @@ -52,7 +52,7 @@ class SvxFmTbxCtlRecText : public SfxToolBoxControl public: SFX_DECL_TOOLBOX_CONTROL(); - SvxFmTbxCtlRecText(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx); + SvxFmTbxCtlRecText(sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx); virtual ~SvxFmTbxCtlRecText() override; virtual VclPtr<InterimItemWindow> CreateItemWindow(vcl::Window* pParent) override; @@ -63,7 +63,7 @@ class SvxFmTbxCtlRecFromText : public SfxToolBoxControl public: SFX_DECL_TOOLBOX_CONTROL(); - SvxFmTbxCtlRecFromText(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx); + SvxFmTbxCtlRecFromText(sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx); virtual ~SvxFmTbxCtlRecFromText() override; virtual VclPtr<InterimItemWindow> CreateItemWindow(vcl::Window* pParent) override; @@ -78,7 +78,7 @@ class SvxFmTbxCtlRecTotal : public SfxToolBoxControl public: SFX_DECL_TOOLBOX_CONTROL(); - SvxFmTbxCtlRecTotal(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx); + SvxFmTbxCtlRecTotal(sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx); virtual ~SvxFmTbxCtlRecTotal() override; virtual VclPtr<InterimItemWindow> CreateItemWindow(vcl::Window* pParent) override; @@ -90,14 +90,14 @@ class SvxFmTbxNextRec : public SfxToolBoxControl { public: SFX_DECL_TOOLBOX_CONTROL(); - SvxFmTbxNextRec(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx); + SvxFmTbxNextRec(sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx); }; class SvxFmTbxPrevRec : public SfxToolBoxControl { public: SFX_DECL_TOOLBOX_CONTROL(); - SvxFmTbxPrevRec(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx); + SvxFmTbxPrevRec(sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx); }; #endif diff --git a/svx/source/mnuctrls/clipboardctl.cxx b/svx/source/mnuctrls/clipboardctl.cxx index 84e686e72f35..1cf26601bb12 100644 --- a/svx/source/mnuctrls/clipboardctl.cxx +++ b/svx/source/mnuctrls/clipboardctl.cxx @@ -36,7 +36,7 @@ SFX_IMPL_TOOLBOX_CONTROL( SvxClipBoardControl, SfxVoidItem /*SfxUInt16Item*/ ); SvxClipBoardControl::SvxClipBoardControl( - sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) : + sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx ) : SfxToolBoxControl( nSlotId, nId, rTbx ), bDisabled( false ) @@ -70,7 +70,7 @@ void SvxClipBoardControl::CreatePopupWindow() } ToolBox& rBox = GetToolBox(); - sal_uInt16 nId = GetId(); + ToolBoxItemId nId = GetId(); rBox.SetItemDown( nId, true ); ::tools::Rectangle aRect(rBox.GetItemRect(nId)); diff --git a/svx/source/sidebar/paragraph/ParaLineSpacingPopup.cxx b/svx/source/sidebar/paragraph/ParaLineSpacingPopup.cxx index 2f5714aeaba3..97edf21f304b 100644 --- a/svx/source/sidebar/paragraph/ParaLineSpacingPopup.cxx +++ b/svx/source/sidebar/paragraph/ParaLineSpacingPopup.cxx @@ -43,7 +43,7 @@ void SvxLineSpacingToolBoxControl::initialize(const css::uno::Sequence<css::uno: } ToolBox* pToolBox = nullptr; - sal_uInt16 nId = 0; + ToolBoxItemId nId; if (getToolboxId(nId, &pToolBox)) pToolBox->SetItemBits(nId, ToolBoxItemBits::DROPDOWNONLY | pToolBox->GetItemBits(nId)); } diff --git a/svx/source/sidebar/paragraph/ParaSpacingControl.cxx b/svx/source/sidebar/paragraph/ParaSpacingControl.cxx index 118d1401083f..f1529c020205 100644 --- a/svx/source/sidebar/paragraph/ParaSpacingControl.cxx +++ b/svx/source/sidebar/paragraph/ParaSpacingControl.cxx @@ -42,7 +42,7 @@ SFX_IMPL_TOOLBOX_CONTROL(ParaLeftSpacingControl, SvxLRSpaceItem); SFX_IMPL_TOOLBOX_CONTROL(ParaRightSpacingControl, SvxLRSpaceItem); SFX_IMPL_TOOLBOX_CONTROL(ParaFirstLineSpacingControl, SvxLRSpaceItem); -ParaULSpacingControl::ParaULSpacingControl(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx) +ParaULSpacingControl::ParaULSpacingControl(sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx) : SfxToolBoxControl(nSlotId, nId, rTbx) { addStatusListener(".uno:MetricUnit"); @@ -55,7 +55,7 @@ ParaULSpacingControl::~ParaULSpacingControl() void ParaULSpacingControl::StateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState) { - sal_uInt16 nId = GetId(); + ToolBoxItemId nId = GetId(); ToolBox& rTbx = GetToolBox(); ParaULSpacingWindow* pWindow = static_cast<ParaULSpacingWindow*>(rTbx.GetItemWindow(nId)); @@ -82,7 +82,7 @@ void ParaULSpacingControl::StateChanged(sal_uInt16 nSID, SfxItemState eState, // ParaAboveSpacingControl -ParaAboveSpacingControl::ParaAboveSpacingControl(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx) +ParaAboveSpacingControl::ParaAboveSpacingControl(sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx) : ParaULSpacingControl(nSlotId, nId, rTbx) { } @@ -97,7 +97,7 @@ VclPtr<InterimItemWindow> ParaAboveSpacingControl::CreateItemWindow(vcl::Window* // ParaBelowSpacingControl -ParaBelowSpacingControl::ParaBelowSpacingControl(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx) +ParaBelowSpacingControl::ParaBelowSpacingControl(sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx) : ParaULSpacingControl(nSlotId, nId, rTbx) { } @@ -112,7 +112,7 @@ VclPtr<InterimItemWindow> ParaBelowSpacingControl::CreateItemWindow(vcl::Window* // ParaLRSpacingControl -ParaLRSpacingControl::ParaLRSpacingControl(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx) +ParaLRSpacingControl::ParaLRSpacingControl(sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx) : SfxToolBoxControl(nSlotId, nId, rTbx) { addStatusListener(".uno:MetricUnit"); @@ -136,7 +136,7 @@ void SAL_CALL ParaLRSpacingControl::dispose() void ParaLRSpacingControl::StateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState) { - sal_uInt16 nId = GetId(); + ToolBoxItemId nId = GetId(); ToolBox& rTbx = GetToolBox(); ParaLRSpacingWindow* pWindow = static_cast<ParaLRSpacingWindow*>(rTbx.GetItemWindow(nId)); @@ -172,7 +172,7 @@ void ParaLRSpacingControl::StateChanged(sal_uInt16 nSID, SfxItemState eState, void SAL_CALL ParaLRSpacingControl::notifyContextChangeEvent(const css::ui::ContextChangeEventObject& rEvent) { - sal_uInt16 nId = GetId(); + ToolBoxItemId nId = GetId(); ToolBox& rTbx = GetToolBox(); ParaLRSpacingWindow* pWindow = static_cast<ParaLRSpacingWindow*>(rTbx.GetItemWindow(nId)); @@ -211,7 +211,7 @@ void SAL_CALL ParaLRSpacingControl::release() throw () // ParaLeftSpacingControl -ParaLeftSpacingControl::ParaLeftSpacingControl(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx) +ParaLeftSpacingControl::ParaLeftSpacingControl(sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx) : ParaLRSpacingControl(nSlotId, nId, rTbx) { } @@ -226,7 +226,7 @@ VclPtr<InterimItemWindow> ParaLeftSpacingControl::CreateItemWindow(vcl::Window* // ParaRightSpacingControl -ParaRightSpacingControl::ParaRightSpacingControl(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx) +ParaRightSpacingControl::ParaRightSpacingControl(sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx) : ParaLRSpacingControl(nSlotId, nId, rTbx) { } @@ -241,7 +241,7 @@ VclPtr<InterimItemWindow> ParaRightSpacingControl::CreateItemWindow(vcl::Window* // ParaFirstLineSpacingControl -ParaFirstLineSpacingControl::ParaFirstLineSpacingControl(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx) +ParaFirstLineSpacingControl::ParaFirstLineSpacingControl(sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx) : ParaLRSpacingControl(nSlotId, nId, rTbx) { } diff --git a/svx/source/sidebar/text/TextCharacterSpacingPopup.cxx b/svx/source/sidebar/text/TextCharacterSpacingPopup.cxx index 7b10c3a30b02..141238b10c92 100644 --- a/svx/source/sidebar/text/TextCharacterSpacingPopup.cxx +++ b/svx/source/sidebar/text/TextCharacterSpacingPopup.cxx @@ -39,7 +39,7 @@ void TextCharacterSpacingPopup::initialize(const css::uno::Sequence<css::uno::An } ToolBox* pToolBox = nullptr; - sal_uInt16 nId = 0; + ToolBoxItemId nId; if (getToolboxId(nId, &pToolBox)) pToolBox->SetItemBits(nId, ToolBoxItemBits::DROPDOWNONLY | pToolBox->GetItemBits(nId)); } diff --git a/svx/source/sidebar/text/TextUnderlinePopup.cxx b/svx/source/sidebar/text/TextUnderlinePopup.cxx index dc35892871b0..dd6929382093 100644 --- a/svx/source/sidebar/text/TextUnderlinePopup.cxx +++ b/svx/source/sidebar/text/TextUnderlinePopup.cxx @@ -41,7 +41,7 @@ void TextUnderlinePopup::initialize(const css::uno::Sequence<css::uno::Any>& rAr } ToolBox* pToolBox = nullptr; - sal_uInt16 nId = 0; + ToolBoxItemId nId; if (getToolboxId(nId, &pToolBox) && pToolBox->GetItemCommand(nId) == m_aCommandURL) pToolBox->SetItemBits(nId, ToolBoxItemBits::DROPDOWN | pToolBox->GetItemBits(nId)); } diff --git a/svx/source/tbxctrls/bulletsnumbering.cxx b/svx/source/tbxctrls/bulletsnumbering.cxx index 7eeac2bd7202..b9820b84e2c6 100644 --- a/svx/source/tbxctrls/bulletsnumbering.cxx +++ b/svx/source/tbxctrls/bulletsnumbering.cxx @@ -213,7 +213,7 @@ void SAL_CALL NumberingToolBoxControl::initialize( const css::uno::Sequence< css } ToolBox* pToolBox = nullptr; - sal_uInt16 nId = 0; + ToolBoxItemId nId; if (getToolboxId(nId, &pToolBox)) { ToolBoxItemBits nBits = ( mePageType == NumberingPageType::OUTLINE ) ? ToolBoxItemBits::DROPDOWNONLY : ToolBoxItemBits::DROPDOWN; diff --git a/svx/source/tbxctrls/extrusioncontrols.cxx b/svx/source/tbxctrls/extrusioncontrols.cxx index 726d4a1cde78..65d407831ffc 100644 --- a/svx/source/tbxctrls/extrusioncontrols.cxx +++ b/svx/source/tbxctrls/extrusioncontrols.cxx @@ -278,7 +278,7 @@ void SAL_CALL ExtrusionDirectionControl::initialize( const css::uno::Sequence< c svt::PopupWindowController::initialize( aArguments ); ToolBox* pToolBox = nullptr; - sal_uInt16 nId = 0; + ToolBoxItemId nId; if ( getToolboxId( nId, &pToolBox ) ) pToolBox->SetItemBits( nId, pToolBox->GetItemBits( nId ) | ToolBoxItemBits::DROPDOWNONLY ); } @@ -534,7 +534,7 @@ void SAL_CALL ExtrusionDepthController::initialize( const css::uno::Sequence< cs svt::PopupWindowController::initialize( aArguments ); ToolBox* pToolBox = nullptr; - sal_uInt16 nId = 0; + ToolBoxItemId nId; if ( getToolboxId( nId, &pToolBox ) ) pToolBox->SetItemBits( nId, pToolBox->GetItemBits( nId ) | ToolBoxItemBits::DROPDOWNONLY ); } @@ -766,7 +766,7 @@ void SAL_CALL ExtrusionLightingControl::initialize( const css::uno::Sequence< cs svt::PopupWindowController::initialize( aArguments ); ToolBox* pToolBox = nullptr; - sal_uInt16 nId = 0; + ToolBoxItemId nId; if ( getToolboxId( nId, &pToolBox ) ) pToolBox->SetItemBits( nId, pToolBox->GetItemBits( nId ) | ToolBoxItemBits::DROPDOWNONLY ); } @@ -904,7 +904,7 @@ void SAL_CALL ExtrusionSurfaceControl::initialize( const css::uno::Sequence< css svt::PopupWindowController::initialize( aArguments ); ToolBox* pToolBox = nullptr; - sal_uInt16 nId = 0; + ToolBoxItemId nId; if ( getToolboxId( nId, &pToolBox ) ) pToolBox->SetItemBits( nId, pToolBox->GetItemBits( nId ) | ToolBoxItemBits::DROPDOWNONLY ); } diff --git a/svx/source/tbxctrls/fillctrl.cxx b/svx/source/tbxctrls/fillctrl.cxx index 94555daae594..5541475c78c8 100644 --- a/svx/source/tbxctrls/fillctrl.cxx +++ b/svx/source/tbxctrls/fillctrl.cxx @@ -53,7 +53,7 @@ SFX_IMPL_TOOLBOX_CONTROL( SvxFillToolBoxControl, XFillStyleItem ); SvxFillToolBoxControl::SvxFillToolBoxControl( sal_uInt16 nSlotId, - sal_uInt16 nId, + ToolBoxItemId nId, ToolBox& rTbx ) : SfxToolBoxControl( nSlotId, nId, rTbx ) , mpStyleItem() diff --git a/svx/source/tbxctrls/fontworkgallery.cxx b/svx/source/tbxctrls/fontworkgallery.cxx index 7acaac50b15c..6f9ee4992cde 100644 --- a/svx/source/tbxctrls/fontworkgallery.cxx +++ b/svx/source/tbxctrls/fontworkgallery.cxx @@ -425,7 +425,7 @@ void SAL_CALL FontworkAlignmentControl::initialize( const css::uno::Sequence< cs svt::PopupWindowController::initialize( aArguments ); ToolBox* pToolBox = nullptr; - sal_uInt16 nId = 0; + ToolBoxItemId nId; if ( getToolboxId( nId, &pToolBox ) ) pToolBox->SetItemBits( nId, pToolBox->GetItemBits( nId ) | ToolBoxItemBits::DROPDOWNONLY ); } @@ -699,7 +699,7 @@ void SAL_CALL FontworkCharacterSpacingControl::initialize( const css::uno::Seque svt::PopupWindowController::initialize( aArguments ); ToolBox* pToolBox = nullptr; - sal_uInt16 nId = 0; + ToolBoxItemId nId; if ( getToolboxId( nId, &pToolBox ) ) pToolBox->SetItemBits( nId, pToolBox->GetItemBits( nId ) | ToolBoxItemBits::DROPDOWNONLY ); } diff --git a/svx/source/tbxctrls/formatpaintbrushctrl.cxx b/svx/source/tbxctrls/formatpaintbrushctrl.cxx index 89fd2dff37e6..ef7298cf0328 100644 --- a/svx/source/tbxctrls/formatpaintbrushctrl.cxx +++ b/svx/source/tbxctrls/formatpaintbrushctrl.cxx @@ -34,7 +34,7 @@ using namespace ::com::sun::star::beans; SFX_IMPL_TOOLBOX_CONTROL( FormatPaintBrushToolBoxControl, SfxBoolItem ); -FormatPaintBrushToolBoxControl::FormatPaintBrushToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) +FormatPaintBrushToolBoxControl::FormatPaintBrushToolBoxControl( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx ) : SfxToolBoxControl( nSlotId, nId, rTbx ) , m_bPersistentCopy(false) , m_aDoubleClickTimer() diff --git a/svx/source/tbxctrls/grafctrl.cxx b/svx/source/tbxctrls/grafctrl.cxx index a88e0f5b59b8..724c96db4cf8 100644 --- a/svx/source/tbxctrls/grafctrl.cxx +++ b/svx/source/tbxctrls/grafctrl.cxx @@ -374,7 +374,7 @@ void ImplGrafModeControl::Update( const SfxPoolItem* pItem ) m_xWidget->set_active(-1); } -SvxGrafToolBoxControl::SvxGrafToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx) : +SvxGrafToolBoxControl::SvxGrafToolBoxControl( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx) : SfxToolBoxControl( nSlotId, nId, rTbx ) { rTbx.SetItemBits( nId, ToolBoxItemBits::DROPDOWN | rTbx.GetItemBits( nId ) ); @@ -413,56 +413,56 @@ VclPtr<InterimItemWindow> SvxGrafToolBoxControl::CreateItemWindow( vcl::Window * SFX_IMPL_TOOLBOX_CONTROL( SvxGrafRedToolBoxControl, SfxInt16Item ); -SvxGrafRedToolBoxControl::SvxGrafRedToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) : +SvxGrafRedToolBoxControl::SvxGrafRedToolBoxControl( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx ) : SvxGrafToolBoxControl( nSlotId, nId, rTbx ) { } SFX_IMPL_TOOLBOX_CONTROL( SvxGrafGreenToolBoxControl, SfxInt16Item ); -SvxGrafGreenToolBoxControl::SvxGrafGreenToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) : +SvxGrafGreenToolBoxControl::SvxGrafGreenToolBoxControl( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx ) : SvxGrafToolBoxControl( nSlotId, nId, rTbx ) { } SFX_IMPL_TOOLBOX_CONTROL( SvxGrafBlueToolBoxControl, SfxInt16Item ); -SvxGrafBlueToolBoxControl::SvxGrafBlueToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) : +SvxGrafBlueToolBoxControl::SvxGrafBlueToolBoxControl( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx ) : SvxGrafToolBoxControl( nSlotId, nId, rTbx ) { } SFX_IMPL_TOOLBOX_CONTROL( SvxGrafLuminanceToolBoxControl, SfxInt16Item ); -SvxGrafLuminanceToolBoxControl::SvxGrafLuminanceToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) : +SvxGrafLuminanceToolBoxControl::SvxGrafLuminanceToolBoxControl( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx ) : SvxGrafToolBoxControl( nSlotId, nId, rTbx ) { } SFX_IMPL_TOOLBOX_CONTROL( SvxGrafContrastToolBoxControl, SfxInt16Item ); -SvxGrafContrastToolBoxControl::SvxGrafContrastToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) : +SvxGrafContrastToolBoxControl::SvxGrafContrastToolBoxControl( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx ) : SvxGrafToolBoxControl( nSlotId, nId, rTbx ) { } SFX_IMPL_TOOLBOX_CONTROL( SvxGrafGammaToolBoxControl, SfxUInt32Item ); -SvxGrafGammaToolBoxControl::SvxGrafGammaToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) : +SvxGrafGammaToolBoxControl::SvxGrafGammaToolBoxControl( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx ) : SvxGrafToolBoxControl( nSlotId, nId, rTbx ) { } SFX_IMPL_TOOLBOX_CONTROL( SvxGrafTransparenceToolBoxControl, SfxUInt16Item ); -SvxGrafTransparenceToolBoxControl::SvxGrafTransparenceToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) : +SvxGrafTransparenceToolBoxControl::SvxGrafTransparenceToolBoxControl( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx ) : SvxGrafToolBoxControl( nSlotId, nId, rTbx ) { } SFX_IMPL_TOOLBOX_CONTROL( SvxGrafModeToolBoxControl, SfxUInt16Item ); -SvxGrafModeToolBoxControl::SvxGrafModeToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) : +SvxGrafModeToolBoxControl::SvxGrafModeToolBoxControl( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx ) : SfxToolBoxControl( nSlotId, nId, rTbx ) { } diff --git a/svx/source/tbxctrls/layctrl.cxx b/svx/source/tbxctrls/layctrl.cxx index ac2f554447e9..da696a2306c5 100644 --- a/svx/source/tbxctrls/layctrl.cxx +++ b/svx/source/tbxctrls/layctrl.cxx @@ -694,7 +694,7 @@ void SvxTableToolBoxControl::initialize( const css::uno::Sequence< css::uno::Any PopupWindowController::initialize(rArguments); ToolBox* pToolBox = nullptr; - sal_uInt16 nId = 0; + ToolBoxItemId nId; if (getToolboxId(nId, &pToolBox)) pToolBox->SetItemBits(nId, ToolBoxItemBits::DROPDOWNONLY | pToolBox->GetItemBits(nId)); } @@ -711,7 +711,7 @@ std::unique_ptr<WeldToolbarPopup> SvxTableToolBoxControl::weldPopupWindow() VclPtr<vcl::Window> SvxTableToolBoxControl::createVclPopupWindow( vcl::Window* pParent ) { ToolBox* pToolBox = nullptr; - sal_uInt16 nId = 0; + ToolBoxItemId nId; bool bToolBox = getToolboxId(nId, &pToolBox); mxInterimPopover = VclPtr<InterimToolbarPopup>::Create(getFrameInterface(), pParent, @@ -752,7 +752,7 @@ void SvxColumnsToolBoxControl::initialize( const css::uno::Sequence< css::uno::A PopupWindowController::initialize(rArguments); ToolBox* pToolBox = nullptr; - sal_uInt16 nId = 0; + ToolBoxItemId nId; if (getToolboxId(nId, &pToolBox)) pToolBox->SetItemBits(nId, ToolBoxItemBits::DROPDOWNONLY | pToolBox->GetItemBits(nId)); } @@ -769,7 +769,7 @@ std::unique_ptr<WeldToolbarPopup> SvxColumnsToolBoxControl::weldPopupWindow() VclPtr<vcl::Window> SvxColumnsToolBoxControl::createVclPopupWindow(vcl::Window* pParent) { ToolBox* pToolBox = nullptr; - sal_uInt16 nId = 0; + ToolBoxItemId nId; bool bToolBox = getToolboxId(nId, &pToolBox); mxInterimPopover = VclPtr<InterimToolbarPopup>::Create(getFrameInterface(), pParent, diff --git a/svx/source/tbxctrls/lboxctrl.cxx b/svx/source/tbxctrls/lboxctrl.cxx index 78a765f9d47f..c8a6b77b74e3 100644 --- a/svx/source/tbxctrls/lboxctrl.cxx +++ b/svx/source/tbxctrls/lboxctrl.cxx @@ -236,7 +236,7 @@ void SvxUndoRedoControl::initialize( const css::uno::Sequence< css::uno::Any >& PopupWindowController::initialize(rArguments); ToolBox* pToolBox = nullptr; - sal_uInt16 nId = 0; + ToolBoxItemId nId; if (!getToolboxId(nId, &pToolBox) && !m_pToolbar) return; @@ -274,7 +274,7 @@ void SAL_CALL SvxUndoRedoControl::statusChanged(const css::frame::FeatureStateEv PopupWindowController::statusChanged(rEvent); ToolBox* pToolBox = nullptr; - sal_uInt16 nId = 0; + ToolBoxItemId nId; if (!getToolboxId(nId, &pToolBox) && !m_pToolbar) return; diff --git a/svx/source/tbxctrls/linectrl.cxx b/svx/source/tbxctrls/linectrl.cxx index 895558d12f20..509b54c1d786 100644 --- a/svx/source/tbxctrls/linectrl.cxx +++ b/svx/source/tbxctrls/linectrl.cxx @@ -70,7 +70,7 @@ SvxLineStyleToolBoxControl::~SvxLineStyleToolBoxControl() void SAL_CALL SvxLineStyleToolBoxControl::statusChanged( const frame::FeatureStateEvent& rEvent ) { ToolBox* pToolBox = nullptr; - sal_uInt16 nId = 0; + ToolBoxItemId nId; if (!getToolboxId(nId, &pToolBox) && !m_pToolbar) return; @@ -163,7 +163,7 @@ void SvxLineStyleToolBoxControl::initialize( const css::uno::Sequence<css::uno:: } ToolBox* pToolBox = nullptr; - sal_uInt16 nId = 0; + ToolBoxItemId nId; if ( getToolboxId( nId, &pToolBox ) ) { pToolBox->SetItemBits( nId, pToolBox->GetItemBits( nId ) | ToolBoxItemBits::DROPDOWNONLY ); @@ -470,7 +470,7 @@ void SvxLineEndToolBoxControl::initialize( const css::uno::Sequence<css::uno::An } ToolBox* pToolBox = nullptr; - sal_uInt16 nId = 0; + ToolBoxItemId nId; if ( getToolboxId( nId, &pToolBox ) ) pToolBox->SetItemBits( nId, pToolBox->GetItemBits( nId ) | ToolBoxItemBits::DROPDOWNONLY ); } diff --git a/svx/source/tbxctrls/linewidthctrl.cxx b/svx/source/tbxctrls/linewidthctrl.cxx index b1f1cb536a56..b0e1a897f415 100644 --- a/svx/source/tbxctrls/linewidthctrl.cxx +++ b/svx/source/tbxctrls/linewidthctrl.cxx @@ -36,7 +36,7 @@ using namespace ::com::sun::star; SFX_IMPL_TOOLBOX_CONTROL( SvxLineWidthToolBoxControl, XLineWidthItem ); SvxLineWidthToolBoxControl::SvxLineWidthToolBoxControl( - sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) : + sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx ) : SfxToolBoxControl( nSlotId, nId, rTbx ) { addStatusListener( ".uno:MetricUnit"); diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx index df71726fc214..5d57508a9bc1 100644 --- a/svx/source/tbxctrls/tbcontrl.cxx +++ b/svx/source/tbxctrls/tbcontrl.cxx @@ -2952,7 +2952,7 @@ void SvxStyleToolBoxControl::statusChanged( const css::frame::FeatureStateEvent& else { ToolBox* pToolBox = nullptr; - sal_uInt16 nId = 0; + ToolBoxItemId nId; if (!getToolboxId( nId, &pToolBox ) ) return; pToolBox->EnableItem( nId, rEvent.IsEnabled ); @@ -3045,7 +3045,7 @@ void SvxFontNameToolBoxControl::statusChanged( const css::frame::FeatureStateEve else { ToolBox* pToolBox = nullptr; - sal_uInt16 nId = 0; + ToolBoxItemId nId; if (!getToolboxId( nId, &pToolBox ) ) return; pToolBox->EnableItem( nId, rEvent.IsEnabled ); @@ -3185,7 +3185,7 @@ void SvxColorToolBoxControl::initialize( const css::uno::Sequence<css::uno::Any> } ToolBox* pToolBox = nullptr; - sal_uInt16 nId = 0; + ToolBoxItemId nId; if (getToolboxId(nId, &pToolBox)) { m_xBtnUpdater.reset( new svx::VclToolboxButtonColorUpdater( m_nSlotId, nId, pToolBox, !m_bSplitButton, aCommandLabel, m_aCommandURL, m_xFrame ) ); @@ -3267,7 +3267,7 @@ std::unique_ptr<WeldToolbarPopup> SvxColorToolBoxControl::weldPopupWindow() VclPtr<vcl::Window> SvxColorToolBoxControl::createVclPopupWindow( vcl::Window* pParent ) { ToolBox* pToolBox = nullptr; - sal_uInt16 nId = 0; + ToolBoxItemId nId; if (!getToolboxId(nId, &pToolBox)) return nullptr; @@ -3306,7 +3306,7 @@ IMPL_LINK(SvxColorToolBoxControl, SelectedHdl, const NamedColor&, rColor, void) void SvxColorToolBoxControl::statusChanged( const css::frame::FeatureStateEvent& rEvent ) { ToolBox* pToolBox = nullptr; - sal_uInt16 nId = 0; + ToolBoxItemId nId; if (!getToolboxId(nId, &pToolBox) && !m_pToolbar) return; @@ -3446,7 +3446,7 @@ void SvxFrameToolBoxControl::initialize( const css::uno::Sequence< css::uno::Any } ToolBox* pToolBox = nullptr; - sal_uInt16 nId = 0; + ToolBoxItemId nId; if (getToolboxId(nId, &pToolBox)) pToolBox->SetItemBits( nId, pToolBox->GetItemBits( nId ) | ToolBoxItemBits::DROPDOWNONLY ); } @@ -3641,7 +3641,7 @@ void SvxCurrencyToolBoxControl::initialize( const css::uno::Sequence< css::uno:: } ToolBox* pToolBox = nullptr; - sal_uInt16 nId = 0; + ToolBoxItemId nId; if (getToolboxId(nId, &pToolBox) && pToolBox->GetItemCommand(nId) == m_aCommandURL) pToolBox->SetItemBits(nId, ToolBoxItemBits::DROPDOWN | pToolBox->GetItemBits(nId)); } @@ -3983,7 +3983,7 @@ MenuOrToolMenuButton::MenuOrToolMenuButton(weld::Toolbar* pToolbar, const OStrin { } -MenuOrToolMenuButton::MenuOrToolMenuButton(SvxColorToolBoxControl* pControl, ToolBox* pToolbar, sal_uInt16 nId) +MenuOrToolMenuButton::MenuOrToolMenuButton(SvxColorToolBoxControl* pControl, ToolBox* pToolbar, ToolBoxItemId nId) : m_pMenuButton(nullptr) , m_pToolbar(nullptr) , m_pControl(pControl) diff --git a/svx/source/tbxctrls/tbunocontroller.cxx b/svx/source/tbxctrls/tbunocontroller.cxx index ada0ada8c97e..2647678f1d7b 100644 --- a/svx/source/tbxctrls/tbunocontroller.cxx +++ b/svx/source/tbxctrls/tbunocontroller.cxx @@ -448,7 +448,7 @@ void SAL_CALL FontHeightToolBoxControl::statusChanged( else { ToolBox* pToolBox = nullptr; - sal_uInt16 nId = 0; + ToolBoxItemId nId; if (getToolboxId(nId, &pToolBox)) pToolBox->EnableItem(nId, rEvent.IsEnabled); } diff --git a/svx/source/tbxctrls/tbunosearchcontrollers.cxx b/svx/source/tbxctrls/tbunosearchcontrollers.cxx index 6158cdfdcf31..1b2606ed393a 100644 --- a/svx/source/tbxctrls/tbunosearchcontrollers.cxx +++ b/svx/source/tbxctrls/tbunosearchcontrollers.cxx @@ -135,7 +135,7 @@ void impl_executeSearch( const css::uno::Reference< css::uno::XComponentContext ToolBox::ImplToolItems::size_type nItemCount = pToolBox->GetItemCount(); for ( ToolBox::ImplToolItems::size_type i=0; i<nItemCount; ++i ) { - sal_uInt16 id = pToolBox->GetItemId(i); + ToolBoxItemId id = pToolBox->GetItemId(i); OUString sItemCommand = pToolBox->GetItemCommand(id); if ( sItemCommand == COMMAND_FINDTEXT ) { @@ -563,9 +563,9 @@ private: VclPtr<FindTextFieldControl> m_pFindTextFieldControl; - sal_uInt16 m_nDownSearchId; - sal_uInt16 m_nUpSearchId; - sal_uInt16 m_nFindAllId; + ToolBoxItemId m_nDownSearchId; + ToolBoxItemId m_nUpSearchId; + ToolBoxItemId m_nFindAllId; }; @@ -1391,7 +1391,7 @@ void SAL_CALL SearchLabelToolboxController::statusChanged( const css::frame::Fea css::uno::Reference< css::awt::XWindow > SAL_CALL SearchLabelToolboxController::createItemWindow( const css::uno::Reference< css::awt::XWindow >& Parent ) { ToolBox* pToolBox = nullptr; - sal_uInt16 nId = 0; + ToolBoxItemId nId; if (getToolboxId(nId, &pToolBox)) pToolBox->SetItemWindowNonInteractive(nId, true); @@ -1560,7 +1560,7 @@ void SAL_CALL FindbarDispatcher::dispatch( const css::util::URL& aURL, const css ToolBox::ImplToolItems::size_type nItemCount = pToolBox->GetItemCount(); for ( ToolBox::ImplToolItems::size_type i=0; i<nItemCount; ++i ) { - sal_uInt16 id = pToolBox->GetItemId(i); + ToolBoxItemId id = pToolBox->GetItemId(i); OUString sItemCommand = pToolBox->GetItemCommand(id); if ( sItemCommand == COMMAND_FINDTEXT ) { diff --git a/svx/source/tbxctrls/tbxcolorupdate.cxx b/svx/source/tbxctrls/tbxcolorupdate.cxx index 57f0c491aaf3..bb6a8fa95016 100644 --- a/svx/source/tbxctrls/tbxcolorupdate.cxx +++ b/svx/source/tbxctrls/tbxcolorupdate.cxx @@ -79,7 +79,7 @@ namespace svx } VclToolboxButtonColorUpdater::VclToolboxButtonColorUpdater( - sal_uInt16 nSlotId, sal_uInt16 nTbxBtnId, ToolBox* pToolBox, bool bWideButton, + sal_uInt16 nSlotId, ToolBoxItemId nTbxBtnId, ToolBox* pToolBox, bool bWideButton, const OUString& rCommandLabel, const OUString& rCommandURL, const css::uno::Reference<css::frame::XFrame>& rFrame) : ToolboxButtonColorUpdaterBase(bWideButton, rCommandLabel, rCommandURL, rFrame) diff --git a/svx/source/tbxctrls/tbxdrctl.cxx b/svx/source/tbxctrls/tbxdrctl.cxx index 088488a9e061..c6fa77b0553a 100644 --- a/svx/source/tbxctrls/tbxdrctl.cxx +++ b/svx/source/tbxctrls/tbxdrctl.cxx @@ -31,7 +31,7 @@ using namespace ::com::sun::star::uno; using namespace ::com::sun::star::frame; -SvxTbxCtlDraw::SvxTbxCtlDraw( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) : +SvxTbxCtlDraw::SvxTbxCtlDraw( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx ) : SfxToolBoxControl( nSlotId, nId, rTbx ) { rTbx.SetItemBits( nId, ToolBoxItemBits::CHECKABLE | rTbx.GetItemBits( nId ) ); diff --git a/svx/source/tbxctrls/verttexttbxctrl.cxx b/svx/source/tbxctrls/verttexttbxctrl.cxx index 40db5fef5c31..7d7d12006180 100644 --- a/svx/source/tbxctrls/verttexttbxctrl.cxx +++ b/svx/source/tbxctrls/verttexttbxctrl.cxx @@ -84,7 +84,7 @@ void SAL_CALL SvxVertCTLTextTbxCtrl::initialize(const css::uno::Sequence<css::un } ToolBox* pToolBox = nullptr; - sal_uInt16 nItemId = 0; + ToolBoxItemId nItemId; if (getToolboxId(nItemId, &pToolBox)) m_bVisible = pToolBox->IsItemVisible(nItemId); } @@ -92,7 +92,7 @@ void SAL_CALL SvxVertCTLTextTbxCtrl::initialize(const css::uno::Sequence<css::un void SAL_CALL SvxVertCTLTextTbxCtrl::statusChanged(const css::frame::FeatureStateEvent& rEvent) { ToolBox* pToolBox = nullptr; - sal_uInt16 nItemId = 0; + ToolBoxItemId nItemId; bool bVclToolBox = getToolboxId(nItemId, &pToolBox); bool bEnabled = false; diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h index 4634a5697d61..c47002b4b90c 100644 --- a/sw/inc/cmdid.h +++ b/sw/inc/cmdid.h @@ -394,10 +394,8 @@ #define FN_TABLE_HEADLINE_COUNT (FN_FORMAT + 147) /* number of repeated headlines of tables */ // Region: Ribbon -#define FN_FORMULA_CALC (FN_FORMAT + 156) /* select formula */ -#define FN_FORMULA_CANCEL (FN_FORMAT + 157) /* don't apply formula */ -#define FN_FORMULA_APPLY (FN_FORMAT + 158) /* apply formula */ #define FN_TABLE_UNSET_READ_ONLY (FN_FORMAT + 159) /* undo cell protection for table */ +// 156..158 are toolbox item ids #define FN_FRAME_WRAP_IDEAL (FN_FORMAT + 162) /* frame ideal wrapping */ #define FN_FRAME_WRAPTHRU_TOGGLE (FN_FORMAT + 163) /* toggle frame transparent wrapping */ diff --git a/sw/source/uibase/inc/workctrl.hxx b/sw/source/uibase/inc/workctrl.hxx index 69d5ea4466ab..de05fe608633 100644 --- a/sw/source/uibase/inc/workctrl.hxx +++ b/sw/source/uibase/inc/workctrl.hxx @@ -54,7 +54,7 @@ class SwTbxAutoTextCtrl : public SfxToolBoxControl public: SFX_DECL_TOOLBOX_CONTROL(); - SwTbxAutoTextCtrl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ); + SwTbxAutoTextCtrl( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx ); virtual ~SwTbxAutoTextCtrl() override; virtual void CreatePopupWindow() override; @@ -70,7 +70,7 @@ class SwPreviewZoomControl : public SfxToolBoxControl public: SFX_DECL_TOOLBOX_CONTROL(); - SwPreviewZoomControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ); + SwPreviewZoomControl( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx ); virtual ~SwPreviewZoomControl() override; virtual void StateChanged( sal_uInt16 nSID, @@ -85,7 +85,7 @@ class SwJumpToSpecificPageControl : public SfxToolBoxControl public: SFX_DECL_TOOLBOX_CONTROL(); - SwJumpToSpecificPageControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ); + SwJumpToSpecificPageControl( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx ); virtual ~SwJumpToSpecificPageControl() override; virtual VclPtr<InterimItemWindow> CreateItemWindow( vcl::Window *pParent ) override; diff --git a/sw/source/uibase/ribbar/inputwin.cxx b/sw/source/uibase/ribbar/inputwin.cxx index e4135fd7f6d4..5ba12dec0e76 100644 --- a/sw/source/uibase/ribbar/inputwin.cxx +++ b/sw/source/uibase/ribbar/inputwin.cxx @@ -54,8 +54,11 @@ #include <IDocumentContentOperations.hxx> -#define ED_POS 2 -#define ED_FORMULA 3 +constexpr ToolBoxItemId ED_POS(2); +constexpr ToolBoxItemId ED_FORMULA(3); +constexpr ToolBoxItemId FN_FORMULA_CALC(FN_FORMAT + 156); /* select formula */ +constexpr ToolBoxItemId FN_FORMULA_CANCEL(FN_FORMAT + 157); /* don't apply formula */ +constexpr ToolBoxItemId FN_FORMULA_APPLY(FN_FORMAT + 158); /* apply formula */ SFX_IMPL_POS_CHILDWINDOW_WITHID( SwInputChild, FN_EDIT_FORMULA, SFX_OBJECTBAR_OBJECT ) @@ -297,7 +300,7 @@ void SwInputWindow::MenuHdl(std::string_view command) IMPL_LINK_NOARG(SwInputWindow, DropdownClickHdl, ToolBox *, void) { - sal_uInt16 nCurID = GetCurItemId(); + ToolBoxItemId nCurID = GetCurItemId(); EndSelection(); // reset back CurItemId ! if (nCurID == FN_FORMULA_CALC) { @@ -311,21 +314,16 @@ IMPL_LINK_NOARG(SwInputWindow, DropdownClickHdl, ToolBox *, void) void SwInputWindow::Click( ) { - sal_uInt16 nCurID = GetCurItemId(); + ToolBoxItemId nCurID = GetCurItemId(); EndSelection(); // reset back CurItemId ! - switch ( nCurID ) + if ( nCurID == FN_FORMULA_CANCEL ) { - case FN_FORMULA_CANCEL: - { - CancelFormula(); - } - break; - case FN_FORMULA_APPLY: - { - ApplyFormula(); - } - break; - } + CancelFormula(); + } + else if (nCurID == FN_FORMULA_APPLY) + { + ApplyFormula(); + } } void SwInputWindow::ApplyFormula() diff --git a/sw/source/uibase/ribbar/workctrl.cxx b/sw/source/uibase/ribbar/workctrl.cxx index fb01e8b9ff2f..5fd2438c63a0 100644 --- a/sw/source/uibase/ribbar/workctrl.cxx +++ b/sw/source/uibase/ribbar/workctrl.cxx @@ -70,7 +70,7 @@ SFX_IMPL_TOOLBOX_CONTROL( SwTbxAutoTextCtrl, SfxVoidItem ); SwTbxAutoTextCtrl::SwTbxAutoTextCtrl( sal_uInt16 nSlotId, - sal_uInt16 nId, + ToolBoxItemId nId, ToolBox& rTbx ) : SfxToolBoxControl( nSlotId, nId, rTbx ) { @@ -116,7 +116,7 @@ void SwTbxAutoTextCtrl::CreatePopupWindow() } ToolBox* pToolBox = &GetToolBox(); - sal_uInt16 nId = GetId(); + ToolBoxItemId nId = GetId(); pToolBox->SetItemDown( nId, true ); pPopup->Execute( pToolBox, pToolBox->GetItemRect( nId ), @@ -462,7 +462,7 @@ SFX_IMPL_TOOLBOX_CONTROL( SwPreviewZoomControl, SfxUInt16Item); SwPreviewZoomControl::SwPreviewZoomControl( sal_uInt16 nSlotId, - sal_uInt16 nId, + ToolBoxItemId nId, ToolBox& rTbx) : SfxToolBoxControl( nSlotId, nId, rTbx ) { @@ -476,7 +476,7 @@ void SwPreviewZoomControl::StateChanged( sal_uInt16 /*nSID*/, SfxItemState eState, const SfxPoolItem* pState ) { - sal_uInt16 nId = GetId(); + ToolBoxItemId nId = GetId(); GetToolBox().EnableItem( nId, (GetItemState(pState) != SfxItemState::DISABLED) ); SwZoomBox_Impl* pBox = static_cast<SwZoomBox_Impl*>(GetToolBox().GetItemWindow( GetId() )); if(SfxItemState::DEFAULT <= eState) @@ -552,7 +552,7 @@ SFX_IMPL_TOOLBOX_CONTROL( SwJumpToSpecificPageControl, SfxUInt16Item); SwJumpToSpecificPageControl::SwJumpToSpecificPageControl( sal_uInt16 nSlotId, - sal_uInt16 nId, + ToolBoxItemId nId, ToolBox& rTbx) : SfxToolBoxControl( nSlotId, nId, rTbx ) {} @@ -1041,7 +1041,7 @@ void SAL_CALL PrevNextScrollToolboxController::statusChanged( const css::frame:: else { ToolBox* pToolBox = nullptr; - sal_uInt16 nId = 0; + ToolBoxItemId nId; if (getToolboxId(nId, &pToolBox)) pToolBox->SetQuickHelpText(nId, lcl_GetScrollToolTip(meType != PrevNextScrollToolboxController::PREVIOUS)); } @@ -1053,7 +1053,7 @@ void SAL_CALL PrevNextScrollToolboxController::statusChanged( const css::frame:: else { ToolBox* pToolBox = nullptr; - sal_uInt16 nId = 0; + ToolBoxItemId nId; if (getToolboxId(nId, &pToolBox)) pToolBox->EnableItem(nId, rEvent.IsEnabled); } diff --git a/sw/source/uibase/sidebar/PageColumnPopup.cxx b/sw/source/uibase/sidebar/PageColumnPopup.cxx index d44a896a3909..da64a484d342 100644 --- a/sw/source/uibase/sidebar/PageColumnPopup.cxx +++ b/sw/source/uibase/sidebar/PageColumnPopup.cxx @@ -30,7 +30,7 @@ void PageColumnPopup::initialize( const css::uno::Sequence< css::uno::Any >& rAr PopupWindowController::initialize(rArguments); ToolBox* pToolBox = nullptr; - sal_uInt16 nId = 0; + ToolBoxItemId nId; if (getToolboxId(nId, &pToolBox)) pToolBox->SetItemBits(nId, ToolBoxItemBits::DROPDOWNONLY | pToolBox->GetItemBits(nId)); } diff --git a/sw/source/uibase/sidebar/PageMarginPopup.cxx b/sw/source/uibase/sidebar/PageMarginPopup.cxx index 776248452a82..67f13acc01d8 100644 --- a/sw/source/uibase/sidebar/PageMarginPopup.cxx +++ b/sw/source/uibase/sidebar/PageMarginPopup.cxx @@ -30,7 +30,7 @@ void PageMarginPopup::initialize( const css::uno::Sequence< css::uno::Any >& rAr PopupWindowController::initialize(rArguments); ToolBox* pToolBox = nullptr; - sal_uInt16 nId = 0; + ToolBoxItemId nId; if (getToolboxId(nId, &pToolBox)) pToolBox->SetItemBits(nId, ToolBoxItemBits::DROPDOWNONLY | pToolBox->GetItemBits(nId)); } diff --git a/sw/source/uibase/sidebar/PageOrientationPopup.cxx b/sw/source/uibase/sidebar/PageOrientationPopup.cxx index d792ca10bb5a..ca506c83a6f5 100644 --- a/sw/source/uibase/sidebar/PageOrientationPopup.cxx +++ b/sw/source/uibase/sidebar/PageOrientationPopup.cxx @@ -30,7 +30,7 @@ void PageOrientationPopup::initialize( const css::uno::Sequence< css::uno::Any > PopupWindowController::initialize(rArguments); ToolBox* pToolBox = nullptr; - sal_uInt16 nId = 0; + ToolBoxItemId nId; if (getToolboxId(nId, &pToolBox)) pToolBox->SetItemBits(nId, ToolBoxItemBits::DROPDOWNONLY | pToolBox->GetItemBits(nId)); } diff --git a/sw/source/uibase/sidebar/PageSizePopup.cxx b/sw/source/uibase/sidebar/PageSizePopup.cxx index 3fbc3dd80ee4..7e2f7e7a4f90 100644 --- a/sw/source/uibase/sidebar/PageSizePopup.cxx +++ b/sw/source/uibase/sidebar/PageSizePopup.cxx @@ -30,7 +30,7 @@ void PageSizePopup::initialize( const css::uno::Sequence< css::uno::Any >& rArgu PopupWindowController::initialize(rArguments); ToolBox* pToolBox = nullptr; - sal_uInt16 nId = 0; + ToolBoxItemId nId; if (getToolboxId(nId, &pToolBox)) pToolBox->SetItemBits(nId, ToolBoxItemBits::DROPDOWNONLY | pToolBox->GetItemBits(nId)); } diff --git a/vcl/inc/salvtables.hxx b/vcl/inc/salvtables.hxx index 1a0563307e0d..340c546f6f40 100644 --- a/vcl/inc/salvtables.hxx +++ b/vcl/inc/salvtables.hxx @@ -1175,8 +1175,8 @@ class SalInstanceToolbar : public SalInstanceWidget, public virtual weld::Toolba { private: VclPtr<ToolBox> m_xToolBox; - std::map<sal_uInt16, VclPtr<vcl::Window>> m_aFloats; - std::map<sal_uInt16, VclPtr<PopupMenu>> m_aMenus; + std::map<ToolBoxItemId, VclPtr<vcl::Window>> m_aFloats; + std::map<ToolBoxItemId, VclPtr<PopupMenu>> m_aMenus; OString m_sStartShowIdent; diff --git a/vcl/inc/toolbox.h b/vcl/inc/toolbox.h index 8aa6bb915fcb..8e00f48f4772 100644 --- a/vcl/inc/toolbox.h +++ b/vcl/inc/toolbox.h @@ -58,7 +58,7 @@ struct ImplToolItem ToolBoxItemType meType; ToolBoxItemBits mnBits; TriState meState; - sal_uInt16 mnId; + ToolBoxItemId mnId; bool mbEnabled:1, mbVisible:1, mbEmptyBtn:1, @@ -68,11 +68,11 @@ struct ImplToolItem mbExpand:1; ImplToolItem(); - ImplToolItem( sal_uInt16 nItemId, const Image& rImage, + ImplToolItem( ToolBoxItemId nItemId, const Image& rImage, ToolBoxItemBits nItemBits ); - ImplToolItem( sal_uInt16 nItemId, const OUString& rTxt, + ImplToolItem( ToolBoxItemId nItemId, const OUString& rTxt, ToolBoxItemBits nItemBits ); - ImplToolItem( sal_uInt16 nItemId, const Image& rImage, + ImplToolItem( ToolBoxItemId nItemId, const Image& rImage, const OUString& rTxt, ToolBoxItemBits nItemBits ); @@ -97,7 +97,7 @@ struct ImplToolItem bool IsItemHidden() const; private: - void init(sal_uInt16 nItemId, ToolBoxItemBits nItemBits, bool bEmptyBtn); + void init(ToolBoxItemId nItemId, ToolBoxItemBits nItemBits, bool bEmptyBtn); }; namespace vcl @@ -105,7 +105,7 @@ namespace vcl struct ToolBoxLayoutData : public ControlLayoutData { - std::vector< sal_uInt16 > m_aLineItemIds; + std::vector< ToolBoxItemId > m_aLineItemIds; }; } /* namespace vcl */ diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index 781381aff7b2..103b7bc4a22c 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -860,7 +860,7 @@ bool SalInstanceToolbar::get_item_visible(const OString& rIdent) const void SalInstanceToolbar::set_item_active(const OString& rIdent, bool bActive) { - sal_uInt16 nItemId = m_xToolBox->GetItemId(OUString::fromUtf8(rIdent)); + ToolBoxItemId nItemId = m_xToolBox->GetItemId(OUString::fromUtf8(rIdent)); m_xToolBox->CheckItem(nItemId, bActive); } @@ -871,7 +871,7 @@ bool SalInstanceToolbar::get_item_active(const OString& rIdent) const void SalInstanceToolbar::set_menu_item_active(const OString& rIdent, bool bActive) { - sal_uInt16 nItemId = m_xToolBox->GetItemId(OUString::fromUtf8(rIdent)); + ToolBoxItemId nItemId = m_xToolBox->GetItemId(OUString::fromUtf8(rIdent)); assert(m_xToolBox->GetItemBits(nItemId) & ToolBoxItemBits::DROPDOWN); if (bActive) @@ -906,7 +906,7 @@ void SalInstanceToolbar::set_menu_item_active(const OString& rIdent, bool bActiv bool SalInstanceToolbar::get_menu_item_active(const OString& rIdent) const { - sal_uInt16 nItemId = m_xToolBox->GetItemId(OUString::fromUtf8(rIdent)); + ToolBoxItemId nItemId = m_xToolBox->GetItemId(OUString::fromUtf8(rIdent)); assert(m_xToolBox->GetItemBits(nItemId) & ToolBoxItemBits::DROPDOWN); if (rIdent == m_sStartShowIdent) @@ -938,7 +938,7 @@ void SalInstanceToolbar::set_item_popover(const OString& rIdent, weld::Widget* p pFloat->EnableDocking(); } - sal_uInt16 nId = m_xToolBox->GetItemId(OUString::fromUtf8(rIdent)); + ToolBoxItemId nId = m_xToolBox->GetItemId(OUString::fromUtf8(rIdent)); auto xOldFloat = m_aFloats[nId]; if (xOldFloat) { @@ -954,7 +954,7 @@ void SalInstanceToolbar::set_item_menu(const OString& rIdent, weld::Menu* pMenu) PopupMenu* pPopup = pInstanceMenu ? pInstanceMenu->getMenu() : nullptr; - sal_uInt16 nId = m_xToolBox->GetItemId(OUString::fromUtf8(rIdent)); + ToolBoxItemId nId = m_xToolBox->GetItemId(OUString::fromUtf8(rIdent)); m_aMenus[nId] = pPopup; m_aFloats[nId] = nullptr; } @@ -1076,13 +1076,13 @@ SalInstanceToolbar::~SalInstanceToolbar() IMPL_LINK_NOARG(SalInstanceToolbar, ClickHdl, ToolBox*, void) { - sal_uInt16 nItemId = m_xToolBox->GetCurItemId(); + ToolBoxItemId nItemId = m_xToolBox->GetCurItemId(); signal_clicked(m_xToolBox->GetItemCommand(nItemId).toUtf8()); } IMPL_LINK_NOARG(SalInstanceToolbar, DropdownClick, ToolBox*, void) { - sal_uInt16 nItemId = m_xToolBox->GetCurItemId(); + ToolBoxItemId nItemId = m_xToolBox->GetCurItemId(); set_menu_item_active(m_xToolBox->GetItemCommand(nItemId).toUtf8(), true); } @@ -1094,7 +1094,7 @@ IMPL_LINK(SalInstanceToolbar, MenuToggleListener, VclWindowEvent&, rEvent, void) { if (rEvent.GetWindow() == rFloat.second) { - sal_uInt16 nItemId = rFloat.first; + ToolBoxItemId nItemId = rFloat.first; signal_toggle_menu(m_xToolBox->GetItemCommand(nItemId).toUtf8()); break; } diff --git a/vcl/source/uitest/uiobject.cxx b/vcl/source/uitest/uiobject.cxx index 5af9ee2f82bc..75fae39da51b 100644 --- a/vcl/source/uitest/uiobject.cxx +++ b/vcl/source/uitest/uiobject.cxx @@ -1633,7 +1633,7 @@ OUString ToolBoxUIObject::get_action(VclEventId nEvent) const { if (nEvent == VclEventId::ToolboxClick) { - return "Click on item number " + OUString::number(mxToolBox->GetCurItemId()) + + return "Click on item number " + OUString::number(sal_uInt16(mxToolBox->GetCurItemId())) + " in " + mxToolBox->get_id(); } else @@ -1643,7 +1643,7 @@ OUString ToolBoxUIObject::get_action(VclEventId nEvent) const StringMap ToolBoxUIObject::get_state() { StringMap aMap = WindowUIObject::get_state(); - aMap["CurrSelectedItemID"] = OUString::number(mxToolBox->GetCurItemId()); + aMap["CurrSelectedItemID"] = OUString::number(sal_uInt16(mxToolBox->GetCurItemId())); aMap["CurrSelectedItemText"] = mxToolBox->GetItemText(mxToolBox->GetCurItemId()); aMap["CurrSelectedItemCommand"] = mxToolBox->GetItemCommand(mxToolBox->GetCurItemId()); aMap["ItemCount"] = OUString::number(mxToolBox->GetItemCount()); diff --git a/vcl/source/window/NotebookBarAddonsMerger.cxx b/vcl/source/window/NotebookBarAddonsMerger.cxx index f7cdbb2c3227..274b455bdb8f 100644 --- a/vcl/source/window/NotebookBarAddonsMerger.cxx +++ b/vcl/source/window/NotebookBarAddonsMerger.cxx @@ -67,7 +67,7 @@ static void CreateNotebookBarToolBox(vcl::Window* pNotebookbarToolBox, const AddonNotebookBarItem& aAddonNotebookBarItem, const std::vector<Image>& aImageVec, const tools::ULong nIter) { - sal_uInt16 nItemId = 0; + ToolBoxItemId nItemId(0); ToolBox* pToolbox = dynamic_cast<ToolBox*>(pNotebookbarToolBox); if (!pToolbox) return; diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx index 4519ae6e2ead..77f882fc8656 100644 --- a/vcl/source/window/builder.cxx +++ b/vcl/source/window/builder.cxx @@ -2111,7 +2111,7 @@ VclPtr<vcl::Window> VclBuilder::makeObject(vcl::Window *pParent, const OString & { OUString aCommand(extractActionName(rMap)); - sal_uInt16 nItemId = 0; + ToolBoxItemId nItemId(0); ToolBoxItemBits nBits = ToolBoxItemBits::NONE; if (name == "GtkMenuToolButton") nBits |= ToolBoxItemBits::DROPDOWN; @@ -2127,7 +2127,7 @@ VclPtr<vcl::Window> VclBuilder::makeObject(vcl::Window *pParent, const OString & } else { - nItemId = pToolBox->GetItemCount() + 1; + nItemId = ToolBoxItemId(pToolBox->GetItemCount() + 1); //TODO: ImplToolItems::size_type -> sal_uInt16! pToolBox->InsertItem(nItemId, extractLabel(rMap), nBits); if (aCommand.isEmpty() && !m_bLegacy) diff --git a/vcl/source/window/dlgctrl.cxx b/vcl/source/window/dlgctrl.cxx index 42a4ce82a8a2..961ec49ae038 100644 --- a/vcl/source/window/dlgctrl.cxx +++ b/vcl/source/window/dlgctrl.cxx @@ -191,10 +191,9 @@ static bool lcl_ToolBoxTabStop( Window* pWindow ) { ToolBox* pToolBoxWindow = static_cast<ToolBox*>( pWindow ); - sal_uInt16 nId; for ( ToolBox::ImplToolItems::size_type nPos = 0; nPos < pToolBoxWindow->GetItemCount(); nPos++ ) { - nId = pToolBoxWindow->GetItemId( nPos ); + ToolBoxItemId nId = pToolBoxWindow->GetItemId( nPos ); if ( pToolBoxWindow->IsItemVisible( nId ) && pToolBoxWindow->IsItemEnabled( nId ) ) return true; } diff --git a/vcl/source/window/floatwin.cxx b/vcl/source/window/floatwin.cxx index 6a661ae6b7b2..ecc2163a9d61 100644 --- a/vcl/source/window/floatwin.cxx +++ b/vcl/source/window/floatwin.cxx @@ -834,7 +834,7 @@ void FloatingWindow::StartPopupMode( ToolBox* pBox, FloatWinPopupFlags nFlags ) mpImplData->mpBox = pBox; // get selected button - sal_uInt16 nItemId = pBox->GetDownItemId(); + ToolBoxItemId nItemId = pBox->GetDownItemId(); if ( nItemId ) pBox->ImplFloatControl( true, this ); diff --git a/vcl/source/window/menubarwindow.cxx b/vcl/source/window/menubarwindow.cxx index c29a827b2c38..b3c78549dd49 100644 --- a/vcl/source/window/menubarwindow.cxx +++ b/vcl/source/window/menubarwindow.cxx @@ -61,14 +61,14 @@ void DecoToolBox::calcMinSize() ScopedVclPtrInstance<ToolBox> aTbx( GetParent() ); if( GetItemCount() == 0 ) { - aTbx->InsertItem(IID_DOCUMENTCLOSE, Image(StockImage::Yes, SV_RESID_BITMAP_CLOSEDOC)); + aTbx->InsertItem(ToolBoxItemId(IID_DOCUMENTCLOSE), Image(StockImage::Yes, SV_RESID_BITMAP_CLOSEDOC)); } else { ImplToolItems::size_type nItems = GetItemCount(); for( ImplToolItems::size_type i = 0; i < nItems; i++ ) { - sal_uInt16 nId = GetItemId( i ); + ToolBoxItemId nId = GetItemId( i ); aTbx->InsertItem( nId, GetItemImage( nId ) ); } } @@ -106,7 +106,7 @@ void DecoToolBox::SetImages( tools::Long nMaxHeight, bool bForce ) maImage.GetSizePixel() ); aBmpExDst.CopyPixel( aDestRect, aSrcRect, &aBmpExSrc ); - SetItemImage( IID_DOCUMENTCLOSE, Image( aBmpExDst ) ); + SetItemImage( ToolBoxItemId(IID_DOCUMENTCLOSE), Image( aBmpExDst ) ); } @@ -132,10 +132,10 @@ MenuBarWindow::MenuBarWindow( vcl::Window* pParent ) : m_aCloseBtn->SetPaintTransparent(true); m_aCloseBtn->SetParentClipMode(ParentClipMode::NoClip); - m_aCloseBtn->InsertItem(IID_DOCUMENTCLOSE, m_aCloseBtn->maImage); + m_aCloseBtn->InsertItem(ToolBoxItemId(IID_DOCUMENTCLOSE), m_aCloseBtn->maImage); m_aCloseBtn->SetSelectHdl(LINK(this, MenuBarWindow, CloseHdl)); m_aCloseBtn->AddEventListener(LINK(this, MenuBarWindow, ToolboxEventHdl)); - m_aCloseBtn->SetQuickHelpText(IID_DOCUMENTCLOSE, VclResId(SV_HELPTEXT_CLOSEDOCUMENT)); + m_aCloseBtn->SetQuickHelpText(ToolBoxItemId(IID_DOCUMENTCLOSE), VclResId(SV_HELPTEXT_CLOSEDOCUMENT)); m_aFloatBtn->SetSymbol( SymbolType::FLOAT ); m_aFloatBtn->SetQuickHelpText(VclResId(SV_HELPTEXT_RESTORE)); @@ -176,7 +176,7 @@ void MenuBarWindow::SetMenu( MenuBar* pMen ) m_nHighlightedItem = ITEMPOS_INVALID; if (pMen) { - m_aCloseBtn->ShowItem(IID_DOCUMENTCLOSE, pMen->HasCloseButton()); + m_aCloseBtn->ShowItem(ToolBoxItemId(IID_DOCUMENTCLOSE), pMen->HasCloseButton()); m_aCloseBtn->Show(pMen->HasCloseButton() || !m_aAddButtons.empty()); m_aFloatBtn->Show(pMen->HasFloatButton()); m_aHideBtn->Show(pMen->HasHideButton()); @@ -200,7 +200,7 @@ void MenuBarWindow::SetHeight(tools::Long nHeight) void MenuBarWindow::ShowButtons( bool bClose, bool bFloat, bool bHide ) { - m_aCloseBtn->ShowItem(IID_DOCUMENTCLOSE, bClose); + m_aCloseBtn->ShowItem(ToolBoxItemId(IID_DOCUMENTCLOSE), bClose); m_aCloseBtn->Show(bClose || !m_aAddButtons.empty()); if (m_pMenu->mpSalMenu) m_pMenu->mpSalMenu->ShowCloseButton(bClose); @@ -219,7 +219,7 @@ IMPL_LINK_NOARG(MenuBarWindow, CloseHdl, ToolBox *, void) if( ! m_pMenu ) return; - if( m_aCloseBtn->GetCurItemId() == IID_DOCUMENTCLOSE ) + if( m_aCloseBtn->GetCurItemId() == ToolBoxItemId(IID_DOCUMENTCLOSE) ) { // #i106052# call close hdl asynchronously to ease handler implementation // this avoids still being in the handler while the DecoToolBox already @@ -228,12 +228,12 @@ IMPL_LINK_NOARG(MenuBarWindow, CloseHdl, ToolBox *, void) } else { - std::map<sal_uInt16,AddButtonEntry>::iterator it = m_aAddButtons.find(m_aCloseBtn->GetCurItemId()); + std::map<sal_uInt16,AddButtonEntry>::iterator it = m_aAddButtons.find(sal_uInt16(m_aCloseBtn->GetCurItemId())); if( it != m_aAddButtons.end() ) { MenuBar::MenuBarButtonCallbackArg aArg; aArg.nId = it->first; - aArg.bHighlight = (m_aCloseBtn->GetHighlightItemId() == it->first); + aArg.bHighlight = (sal_uInt16(m_aCloseBtn->GetHighlightItemId()) == it->first); it->second.m_aSelectLink.Call( aArg ); } } @@ -248,11 +248,11 @@ IMPL_LINK( MenuBarWindow, ToolboxEventHdl, VclWindowEvent&, rEvent, void ) aArg.nId = 0xffff; aArg.bHighlight = (rEvent.GetId() == VclEventId::ToolboxHighlight); if( rEvent.GetId() == VclEventId::ToolboxHighlight ) - aArg.nId = m_aCloseBtn->GetHighlightItemId(); + aArg.nId =sal_uInt16(m_aCloseBtn->GetHighlightItemId()); else if( rEvent.GetId() == VclEventId::ToolboxHighlightOff ) { auto nPos = static_cast<ToolBox::ImplToolItems::size_type>(reinterpret_cast<sal_IntPtr>(rEvent.GetData())); - aArg.nId = m_aCloseBtn->GetItemId(nPos); + aArg.nId = sal_uInt16(m_aCloseBtn->GetItemId(nPos)); } std::map< sal_uInt16, AddButtonEntry >::iterator it = m_aAddButtons.find( aArg.nId ); if( it != m_aAddButtons.end() ) @@ -1167,9 +1167,9 @@ sal_uInt16 MenuBarWindow::AddMenuBarButton( const Image& i_rImage, const Link<Me SAL_WARN_IF( nId >= 128, "vcl", "too many addbuttons in menubar" ); AddButtonEntry& rNewEntry = m_aAddButtons[nId]; rNewEntry.m_aSelectLink = i_rLink; - m_aCloseBtn->InsertItem(nId, i_rImage, ToolBoxItemBits::NONE, 0); + m_aCloseBtn->InsertItem(ToolBoxItemId(nId), i_rImage, ToolBoxItemBits::NONE, 0); m_aCloseBtn->calcMinSize(); - ShowButtons(m_aCloseBtn->IsItemVisible(IID_DOCUMENTCLOSE), m_aFloatBtn->IsVisible(), m_aHideBtn->IsVisible()); + ShowButtons(m_aCloseBtn->IsItemVisible(ToolBoxItemId(IID_DOCUMENTCLOSE)), m_aFloatBtn->IsVisible(), m_aHideBtn->IsVisible()); LayoutChanged(); if( m_pMenu->mpSalMenu ) @@ -1202,7 +1202,7 @@ tools::Rectangle MenuBarWindow::GetMenuBarButtonRectPixel( sal_uInt16 nId ) if( aRect.IsEmpty() ) { - aRect = m_aCloseBtn->GetItemRect(nId); + aRect = m_aCloseBtn->GetItemRect(ToolBoxItemId(nId)); Point aOffset = m_aCloseBtn->OutputToScreenPixel(Point()); aRect.Move( aOffset.X(), aOffset.Y() ); } @@ -1212,7 +1212,7 @@ tools::Rectangle MenuBarWindow::GetMenuBarButtonRectPixel( sal_uInt16 nId ) void MenuBarWindow::RemoveMenuBarButton( sal_uInt16 nId ) { - ToolBox::ImplToolItems::size_type nPos = m_aCloseBtn->GetItemPos(nId); + ToolBox::ImplToolItems::size_type nPos = m_aCloseBtn->GetItemPos(ToolBoxItemId(nId)); m_aCloseBtn->RemoveItem(nPos); m_aAddButtons.erase( nId ); m_aCloseBtn->calcMinSize(); diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx index 935a1882e4aa..14bf3883e146 100644 --- a/vcl/source/window/toolbox.cxx +++ b/vcl/source/window/toolbox.cxx @@ -1112,9 +1112,9 @@ void ToolBox::ImplInitToolBoxData() mnRightBorder = 0; mnBottomBorder = 0; mnLastResizeDY = 0; - mnHighItemId = 0; - mnCurItemId = 0; - mnDownItemId = 0; + mnHighItemId = ToolBoxItemId(0); + mnCurItemId = ToolBoxItemId(0); + mnDownItemId = ToolBoxItemId(0); mnCurPos = ITEM_NOTFOUND; mnLines = 1; mnCurLine = 1; @@ -1147,7 +1147,7 @@ void ToolBox::ImplInitToolBoxData() mnWinStyle = 0; meLayoutMode = ToolBoxLayoutMode::Normal; meTextPosition = ToolBoxTextPosition::Right; - mnLastFocusItemId = 0; + mnLastFocusItemId = ToolBoxItemId(0); mnActivateCount = 0; mnImagesRotationAngle = 0_deg10; @@ -1327,7 +1327,7 @@ void ToolBox::dispose() DockingWindow::dispose(); } -ImplToolItem* ToolBox::ImplGetItem( sal_uInt16 nItemId ) const +ImplToolItem* ToolBox::ImplGetItem( ToolBoxItemId nItemId ) const { if (!mpData) return nullptr; @@ -2350,10 +2350,10 @@ IMPL_LINK_NOARG(ToolBox, ImplDropdownLongClickHdl, Timer *, void) InvalidateItem(mnCurPos); mnCurPos = ITEM_NOTFOUND; - mnCurItemId = 0; - mnDownItemId = 0; + mnCurItemId = ToolBoxItemId(0); + mnDownItemId = ToolBoxItemId(0); mnMouseModifier = 0; - mnHighItemId = 0; + mnHighItemId = ToolBoxItemId(0); } } @@ -2846,10 +2846,10 @@ void ToolBox::ImplFloatControl( bool bStart, FloatingWindow* pFloatWindow ) if( !bWasKeyboardActivate ) { mnCurPos = ITEM_NOTFOUND; - mnCurItemId = 0; - mnHighItemId = 0; + mnCurItemId = ToolBoxItemId(0); + mnHighItemId = ToolBoxItemId(0); } - mnDownItemId = 0; + mnDownItemId = ToolBoxItemId(0); } } @@ -2895,7 +2895,7 @@ bool ToolBox::ImplHandleMouseMove( const MouseEvent& rMEvt, bool bRepeat ) if ( mnCurItemId ) { InvalidateItem(mnCurPos); - mnCurItemId = 0; + mnCurItemId = ToolBoxItemId(0); InvalidateItem(mnCurPos); Highlight(); } @@ -3010,8 +3010,8 @@ bool ToolBox::ImplHandleMouseButtonUp( const MouseEvent& rMEvt, bool bCancel ) } mnCurPos = ITEM_NOTFOUND; - mnCurItemId = 0; - mnDownItemId = 0; + mnCurItemId = ToolBoxItemId(0); + mnDownItemId = ToolBoxItemId(0); mnMouseModifier = 0; return true; } @@ -3160,7 +3160,7 @@ void ToolBox::MouseMove( const MouseEvent& rMEvt ) CallEventListeners( VclEventId::ToolboxHighlightOff, reinterpret_cast< void* >( nClearPos ) ); } ImplHideFocus(); - mnHighItemId = 0; + mnHighItemId = ToolBoxItemId(0); } if( bMenuButtonHit ) @@ -3272,10 +3272,10 @@ void ToolBox::MouseButtonDown( const MouseEvent& rMEvt ) InvalidateItem(mnCurPos); mnCurPos = ITEM_NOTFOUND; - mnCurItemId = 0; - mnDownItemId = 0; + mnCurItemId = ToolBoxItemId(0); + mnDownItemId = ToolBoxItemId(0); mnMouseModifier = 0; - mnHighItemId = 0; + mnHighItemId = ToolBoxItemId(0); } return; } @@ -3596,7 +3596,7 @@ namespace } } -const OUString& ToolBox::ImplGetHelpText( sal_uInt16 nItemId ) const +const OUString& ToolBox::ImplGetHelpText( ToolBoxItemId nItemId ) const { ImplToolItem* pItem = ImplGetItem( nItemId ); @@ -3619,7 +3619,7 @@ const OUString& ToolBox::ImplGetHelpText( sal_uInt16 nItemId ) const void ToolBox::RequestHelp( const HelpEvent& rHEvt ) { - sal_uInt16 nItemId; + ToolBoxItemId nItemId; Point aHelpPos; if( !rHEvt.KeyboardActivated() ) @@ -3708,7 +3708,7 @@ bool ToolBox::EventNotify( NotifyEvent& rNEvt ) if( rNEvt.GetWindow() == this ) { // the toolbar itself got the focus - if( mnLastFocusItemId != 0 || mpData->mbMenubuttonWasLastSelected ) + if( mnLastFocusItemId != ToolBoxItemId(0) || mpData->mbMenubuttonWasLastSelected ) { // restore last item if( mpData->mbMenubuttonWasLastSelected ) @@ -3720,7 +3720,7 @@ bool ToolBox::EventNotify( NotifyEvent& rNEvt ) else { ImplChangeHighlight( ImplGetItem( mnLastFocusItemId ) ); - mnLastFocusItemId = 0; + mnLastFocusItemId = ToolBoxItemId(0); } } else if( (GetGetFocusFlags() & (GetFocusFlags::Backward|GetFocusFlags::Tab) ) == (GetFocusFlags::Backward|GetFocusFlags::Tab)) @@ -3729,7 +3729,7 @@ bool ToolBox::EventNotify( NotifyEvent& rNEvt ) else ImplChangeHighlightUpDn( true ); - mnLastFocusItemId = 0; + mnLastFocusItemId = ToolBoxItemId(0); return true; } @@ -3756,7 +3756,7 @@ bool ToolBox::EventNotify( NotifyEvent& rNEvt ) // deselect ImplHideFocus(); mpData->mbMenubuttonWasLastSelected = false; - mnHighItemId = 0; + mnHighItemId = ToolBoxItemId(0); mnCurPos = ITEM_NOTFOUND; } @@ -4176,7 +4176,7 @@ void ToolBox::LoseFocus() } // performs the action associated with an item, ie simulates clicking the item -void ToolBox::TriggerItem( sal_uInt16 nItemId ) +void ToolBox::TriggerItem( ToolBoxItemId nItemId ) { mnHighItemId = nItemId; vcl::KeyCode aKeyCode( 0, 0 ); @@ -4576,7 +4576,7 @@ void ToolBox::ImplChangeHighlight( ImplToolItem const * pItem, bool bNoGrabFocus // #i89962# ImplDrawItem can cause Invalidate/Update // which will in turn ImplShowFocus again // set mnHighItemId to 0 already to prevent this hen/egg problem - mnHighItemId = 0; + mnHighItemId = ToolBoxItemId(0); InvalidateItem(nPos); CallEventListeners( VclEventId::ToolboxHighlightOff, reinterpret_cast< void* >( nPos ) ); } @@ -4625,7 +4625,7 @@ void ToolBox::ImplChangeHighlight( ImplToolItem const * pItem, bool bNoGrabFocus else { ImplHideFocus(); - mnHighItemId = 0; + mnHighItemId = ToolBoxItemId(0); mnCurPos = ITEM_NOTFOUND; } diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx index 3dd2b5979546..6acf30e92d65 100644 --- a/vcl/source/window/toolbox2.cxx +++ b/vcl/source/window/toolbox2.cxx @@ -80,7 +80,7 @@ ImplToolBoxPrivateData::~ImplToolBoxPrivateData() mpMenu.disposeAndClear(); } -void ImplToolItem::init(sal_uInt16 nItemId, ToolBoxItemBits nItemBits, +void ImplToolItem::init(ToolBoxItemId nItemId, ToolBoxItemBits nItemBits, bool bEmptyBtn) { mnId = nItemId; @@ -105,24 +105,24 @@ void ImplToolItem::init(sal_uInt16 nItemId, ToolBoxItemBits nItemBits, ImplToolItem::ImplToolItem() { - init(0, ToolBoxItemBits::NONE, true); + init(ToolBoxItemId(0), ToolBoxItemBits::NONE, true); } -ImplToolItem::ImplToolItem( sal_uInt16 nItemId, const Image& rImage, +ImplToolItem::ImplToolItem( ToolBoxItemId nItemId, const Image& rImage, ToolBoxItemBits nItemBits ) : maImage( rImage ) { init(nItemId, nItemBits, false); } -ImplToolItem::ImplToolItem( sal_uInt16 nItemId, const OUString& rText, +ImplToolItem::ImplToolItem( ToolBoxItemId nItemId, const OUString& rText, ToolBoxItemBits nItemBits ) : maText( rText ) { init(nItemId, nItemBits, false); } -ImplToolItem::ImplToolItem( sal_uInt16 nItemId, const Image& rImage, +ImplToolItem::ImplToolItem( ToolBoxItemId nItemId, const Image& rImage, const OUString& rText, ToolBoxItemBits nItemBits ) : maImage( rImage ), maText( rText ) @@ -377,7 +377,7 @@ void ToolBox::Select() static_cast<FloatingWindow*>(pWrapper->GetFloatingWindow())->EndPopupMode(); } -void ToolBox::InsertItem( sal_uInt16 nItemId, const Image& rImage, ToolBoxItemBits nBits, ImplToolItems::size_type nPos ) +void ToolBox::InsertItem( ToolBoxItemId nItemId, const Image& rImage, ToolBoxItemBits nBits, ImplToolItems::size_type nPos ) { SAL_WARN_IF( !nItemId, "vcl", "ToolBox::InsertItem(): ItemId == 0" ); SAL_WARN_IF( GetItemPos( nItemId ) != ITEM_NOTFOUND, "vcl", @@ -395,7 +395,7 @@ void ToolBox::InsertItem( sal_uInt16 nItemId, const Image& rImage, ToolBoxItemBi CallEventListeners( VclEventId::ToolboxItemAdded, reinterpret_cast< void* >(nNewPos ) ); } -void ToolBox::InsertItem( sal_uInt16 nItemId, const Image& rImage, const OUString& rText, ToolBoxItemBits nBits, +void ToolBox::InsertItem( ToolBoxItemId nItemId, const Image& rImage, const OUString& rText, ToolBoxItemBits nBits, ImplToolItems::size_type nPos ) { SAL_WARN_IF( !nItemId, "vcl", "ToolBox::InsertItem(): ItemId == 0" ); @@ -414,7 +414,7 @@ void ToolBox::InsertItem( sal_uInt16 nItemId, const Image& rImage, const OUStrin CallEventListeners( VclEventId::ToolboxItemAdded, reinterpret_cast< void* >( nNewPos ) ); } -void ToolBox::InsertItem( sal_uInt16 nItemId, const OUString& rText, ToolBoxItemBits nBits, ImplToolItems::size_type nPos ) +void ToolBox::InsertItem( ToolBoxItemId nItemId, const OUString& rText, ToolBoxItemBits nBits, ImplToolItems::size_type nPos ) { SAL_WARN_IF( !nItemId, "vcl", "ToolBox::InsertItem(): ItemId == 0" ); SAL_WARN_IF( GetItemPos( nItemId ) != ITEM_NOTFOUND, "vcl", @@ -441,7 +441,7 @@ void ToolBox::InsertItem(const OUString& rCommand, const css::uno::Reference<css OUString aTooltip(vcl::CommandInfoProvider::GetTooltipForCommand(rCommand, aProperties, rFrame)); Image aImage(CommandInfoProvider::GetImageForCommand(rCommand, rFrame, GetImageSize())); - sal_uInt16 nItemId = GetItemCount() + 1; + ToolBoxItemId nItemId(GetItemCount() + 1); //TODO: ImplToolItems::size_type -> sal_uInt16! InsertItem(nItemId, aImage, aLabel, nBits, nPos); SetItemCommand(nItemId, rCommand); @@ -453,7 +453,7 @@ void ToolBox::InsertItem(const OUString& rCommand, const css::uno::Reference<css pItem->maMinimalItemSize = rRequestedSize; } -void ToolBox::InsertWindow( sal_uInt16 nItemId, vcl::Window* pWindow, +void ToolBox::InsertWindow( ToolBoxItemId nItemId, vcl::Window* pWindow, ToolBoxItemBits nBits, ImplToolItems::size_type nPos ) { SAL_WARN_IF( !nItemId, "vcl", "ToolBox::InsertWindow(): ItemId == 0" ); @@ -545,9 +545,9 @@ void ToolBox::RemoveItem( ImplToolItems::size_type nPos ) // ensure not to delete in the Select-Handler if ( mpData->m_aItems[nPos].mnId == mnCurItemId ) - mnCurItemId = 0; + mnCurItemId = ToolBoxItemId(0); if ( mpData->m_aItems[nPos].mnId == mnHighItemId ) - mnHighItemId = 0; + mnHighItemId = ToolBoxItemId(0); ImplInvalidate( bMustCalc ); @@ -558,7 +558,7 @@ void ToolBox::RemoveItem( ImplToolItems::size_type nPos ) CallEventListeners( VclEventId::ToolboxItemRemoved, reinterpret_cast< void* >( nPos ) ); } -void ToolBox::CopyItem( const ToolBox& rToolBox, sal_uInt16 nItemId ) +void ToolBox::CopyItem( const ToolBox& rToolBox, ToolBoxItemId nItemId ) { SAL_WARN_IF( GetItemPos( nItemId ) != ITEM_NOTFOUND, "vcl", "ToolBox::CopyItem(): ItemId already exists" ); @@ -591,8 +591,8 @@ void ToolBox::Clear() mpData->ImplClearLayoutData(); // ensure not to delete in the Select-Handler - mnCurItemId = 0; - mnHighItemId = 0; + mnCurItemId = ToolBoxItemId(0); + mnHighItemId = ToolBoxItemId(0); ImplInvalidate( true, true ); @@ -714,7 +714,7 @@ ToolBoxItemType ToolBox::GetItemType( ImplToolItems::size_type nPos ) const return (nPos < mpData->m_aItems.size()) ? mpData->m_aItems[nPos].meType : ToolBoxItemType::DONTKNOW; } -ToolBox::ImplToolItems::size_type ToolBox::GetItemPos( sal_uInt16 nItemId ) const +ToolBox::ImplToolItems::size_type ToolBox::GetItemPos( ToolBoxItemId nItemId ) const { if (mpData) { @@ -738,12 +738,12 @@ ToolBox::ImplToolItems::size_type ToolBox::GetItemPos( const Point& rPos ) const return ITEM_NOTFOUND; } -sal_uInt16 ToolBox::GetItemId( ImplToolItems::size_type nPos ) const +ToolBoxItemId ToolBox::GetItemId( ImplToolItems::size_type nPos ) const { - return (nPos < mpData->m_aItems.size()) ? mpData->m_aItems[nPos].mnId : 0; + return (nPos < mpData->m_aItems.size()) ? mpData->m_aItems[nPos].mnId : ToolBoxItemId(0); } -sal_uInt16 ToolBox::GetItemId( const Point& rPos ) const +ToolBoxItemId ToolBox::GetItemId( const Point& rPos ) const { // find item that was clicked auto it = std::find_if(mpData->m_aItems.begin(), mpData->m_aItems.end(), @@ -752,10 +752,10 @@ sal_uInt16 ToolBox::GetItemId( const Point& rPos ) const if( (it != mpData->m_aItems.end()) && (it->meType == ToolBoxItemType::BUTTON) ) return it->mnId; - return 0; + return ToolBoxItemId(0); } -Size ToolBox::GetItemContentSize( sal_uInt16 nItemId ) +Size ToolBox::GetItemContentSize( ToolBoxItemId nItemId ) { if ( mbCalc || mbFormat ) ImplFormat(); @@ -767,17 +767,17 @@ Size ToolBox::GetItemContentSize( sal_uInt16 nItemId ) return Size(); } -sal_uInt16 ToolBox::GetItemId(const OUString &rCommand) const +ToolBoxItemId ToolBox::GetItemId(const OUString &rCommand) const { if (!mpData) - return 0; + return ToolBoxItemId(0); auto it = std::find_if(mpData->m_aItems.begin(), mpData->m_aItems.end(), [&rCommand](const ImplToolItem& rItem) { return rItem.maCommandStr == rCommand; }); if (it != mpData->m_aItems.end()) return it->mnId; - return 0; + return ToolBoxItemId(0); } Point ToolBox::ImplGetPopupPosition( const tools::Rectangle& rRect ) const @@ -830,7 +830,7 @@ Point ToolBox::ImplGetPopupPosition( const tools::Rectangle& rRect ) const return aPos; } -tools::Rectangle ToolBox::GetItemRect( sal_uInt16 nItemId ) +tools::Rectangle ToolBox::GetItemRect( ToolBoxItemId nItemId ) { if ( mbCalc || mbFormat ) ImplFormat(); @@ -869,7 +869,7 @@ bool ToolBox::ImplHasExternalMenubutton() return bRet; } -void ToolBox::SetItemBits( sal_uInt16 nItemId, ToolBoxItemBits nBits ) +void ToolBox::SetItemBits( ToolBoxItemId nItemId, ToolBoxItemBits nBits ) { ImplToolItems::size_type nPos = GetItemPos( nItemId ); @@ -886,7 +886,7 @@ void ToolBox::SetItemBits( sal_uInt16 nItemId, ToolBoxItemBits nBits ) } } -void ToolBox::SetItemWindowNonInteractive(sal_uInt16 nItemId, bool bNonInteractive) +void ToolBox::SetItemWindowNonInteractive(ToolBoxItemId nItemId, bool bNonInteractive) { ImplToolItems::size_type nPos = GetItemPos( nItemId ); @@ -896,7 +896,7 @@ void ToolBox::SetItemWindowNonInteractive(sal_uInt16 nItemId, bool bNonInteracti } } -ToolBoxItemBits ToolBox::GetItemBits( sal_uInt16 nItemId ) const +ToolBoxItemBits ToolBox::GetItemBits( ToolBoxItemId nItemId ) const { ImplToolItem* pItem = ImplGetItem( nItemId ); @@ -906,7 +906,7 @@ ToolBoxItemBits ToolBox::GetItemBits( sal_uInt16 nItemId ) const return ToolBoxItemBits::NONE; } -void ToolBox::SetItemExpand( sal_uInt16 nItemId, bool bExpand ) +void ToolBox::SetItemExpand( ToolBoxItemId nItemId, bool bExpand ) { ImplToolItem* pItem = ImplGetItem( nItemId ); if (!pItem) @@ -919,7 +919,7 @@ void ToolBox::SetItemExpand( sal_uInt16 nItemId, bool bExpand ) } } -void ToolBox::SetItemData( sal_uInt16 nItemId, void* pNewData ) +void ToolBox::SetItemData( ToolBoxItemId nItemId, void* pNewData ) { ImplToolItems::size_type nPos = GetItemPos( nItemId ); @@ -930,7 +930,7 @@ void ToolBox::SetItemData( sal_uInt16 nItemId, void* pNewData ) } } -void* ToolBox::GetItemData( sal_uInt16 nItemId ) const +void* ToolBox::GetItemData( ToolBoxItemId nItemId ) const { ImplToolItem* pItem = ImplGetItem( nItemId ); @@ -940,7 +940,7 @@ void* ToolBox::GetItemData( sal_uInt16 nItemId ) const return nullptr; } -void ToolBox::SetItemImage( sal_uInt16 nItemId, const Image& rImage ) +void ToolBox::SetItemImage( ToolBoxItemId nItemId, const Image& rImage ) { ImplToolItems::size_type nPos = GetItemPos( nItemId ); @@ -971,7 +971,7 @@ static Image ImplRotImage( const Image& rImage, Degree10 nAngle10 ) return Image( aRotBitmapEx ); } -void ToolBox::SetItemImageAngle( sal_uInt16 nItemId, Degree10 nAngle10 ) +void ToolBox::SetItemImageAngle( ToolBoxItemId nItemId, Degree10 nAngle10 ) { ImplToolItems::size_type nPos = GetItemPos( nItemId ); @@ -1009,7 +1009,7 @@ static Image ImplMirrorImage( const Image& rImage ) return Image( aMirrBitmapEx ); } -void ToolBox::SetItemImageMirrorMode( sal_uInt16 nItemId, bool bMirror ) +void ToolBox::SetItemImageMirrorMode( ToolBoxItemId nItemId, bool bMirror ) { ImplToolItems::size_type nPos = GetItemPos( nItemId ); @@ -1031,13 +1031,13 @@ void ToolBox::SetItemImageMirrorMode( sal_uInt16 nItemId, bool bMirror ) } } -Image ToolBox::GetItemImage(sal_uInt16 nItemId) const +Image ToolBox::GetItemImage(ToolBoxItemId nItemId) const { ImplToolItem* pItem = ImplGetItem(nItemId); return pItem ? pItem->maImage : Image(); } -void ToolBox::SetItemText( sal_uInt16 nItemId, const OUString& rText ) +void ToolBox::SetItemText( ToolBoxItemId nItemId, const OUString& rText ) { ImplToolItems::size_type nPos = GetItemPos( nItemId ); @@ -1067,7 +1067,7 @@ void ToolBox::SetItemText( sal_uInt16 nItemId, const OUString& rText ) CallEventListeners( VclEventId::ToolboxItemTextChanged, reinterpret_cast< void* >( nPos ) ); } -const OUString& ToolBox::GetItemText( sal_uInt16 nItemId ) const +const OUString& ToolBox::GetItemText( ToolBoxItemId nItemId ) const { ImplToolItem* pItem = ImplGetItem( nItemId ); @@ -1077,7 +1077,7 @@ const OUString& ToolBox::GetItemText( sal_uInt16 nItemId ) const return pItem->maText; } -void ToolBox::SetItemWindow( sal_uInt16 nItemId, vcl::Window* pNewWindow ) +void ToolBox::SetItemWindow( ToolBoxItemId nItemId, vcl::Window* pNewWindow ) { ImplToolItems::size_type nPos = GetItemPos( nItemId ); @@ -1092,7 +1092,7 @@ void ToolBox::SetItemWindow( sal_uInt16 nItemId, vcl::Window* pNewWindow ) } } -vcl::Window* ToolBox::GetItemWindow( sal_uInt16 nItemId ) const +vcl::Window* ToolBox::GetItemWindow( ToolBoxItemId nItemId ) const { ImplToolItem* pItem = ImplGetItem( nItemId ); @@ -1117,12 +1117,12 @@ void ToolBox::EndSelection() } mnCurPos = ITEM_NOTFOUND; - mnCurItemId = 0; - mnDownItemId = 0; + mnCurItemId = ToolBoxItemId(0); + mnDownItemId = ToolBoxItemId(0); mnMouseModifier = 0; } -void ToolBox::SetItemDown( sal_uInt16 nItemId, bool bDown ) +void ToolBox::SetItemDown( ToolBoxItemId nItemId, bool bDown ) { ImplToolItems::size_type nPos = GetItemPos( nItemId ); @@ -1157,12 +1157,12 @@ void ToolBox::SetItemDown( sal_uInt16 nItemId, bool bDown ) Deactivate(); } - mnCurItemId = 0; - mnDownItemId = 0; + mnCurItemId = ToolBoxItemId(0); + mnDownItemId = ToolBoxItemId(0); mnMouseModifier = 0; } -void ToolBox::SetItemState( sal_uInt16 nItemId, TriState eState ) +void ToolBox::SetItemState( ToolBoxItemId nItemId, TriState eState ) { ImplToolItems::size_type nPos = GetItemPos( nItemId ); @@ -1222,7 +1222,7 @@ void ToolBox::SetItemState( sal_uInt16 nItemId, TriState eState ) CallEventListeners( VclEventId::ToolboxItemUpdated, reinterpret_cast< void* >(nPos) ); } -TriState ToolBox::GetItemState( sal_uInt16 nItemId ) const +TriState ToolBox::GetItemState( ToolBoxItemId nItemId ) const { ImplToolItem* pItem = ImplGetItem( nItemId ); @@ -1232,7 +1232,7 @@ TriState ToolBox::GetItemState( sal_uInt16 nItemId ) const return TRISTATE_FALSE; } -void ToolBox::EnableItem( sal_uInt16 nItemId, bool bEnable ) +void ToolBox::EnableItem( ToolBoxItemId nItemId, bool bEnable ) { ImplToolItems::size_type nPos = GetItemPos( nItemId ); @@ -1260,7 +1260,7 @@ void ToolBox::EnableItem( sal_uInt16 nItemId, bool bEnable ) CallEventListeners( bEnable ? VclEventId::ToolboxItemEnabled : VclEventId::ToolboxItemDisabled, reinterpret_cast< void* >( nPos ) ); } -bool ToolBox::IsItemEnabled( sal_uInt16 nItemId ) const +bool ToolBox::IsItemEnabled( ToolBoxItemId nItemId ) const { ImplToolItem* pItem = ImplGetItem( nItemId ); @@ -1270,7 +1270,7 @@ bool ToolBox::IsItemEnabled( sal_uInt16 nItemId ) const return false; } -void ToolBox::ShowItem( sal_uInt16 nItemId, bool bVisible ) +void ToolBox::ShowItem( ToolBoxItemId nItemId, bool bVisible ) { ImplToolItems::size_type nPos = GetItemPos( nItemId ); mpData->ImplClearLayoutData(); @@ -1286,7 +1286,7 @@ void ToolBox::ShowItem( sal_uInt16 nItemId, bool bVisible ) } } -bool ToolBox::IsItemClipped( sal_uInt16 nItemId ) const +bool ToolBox::IsItemClipped( ToolBoxItemId nItemId ) const { ImplToolItem* pItem = ImplGetItem( nItemId ); @@ -1296,7 +1296,7 @@ bool ToolBox::IsItemClipped( sal_uInt16 nItemId ) const return false; } -bool ToolBox::IsItemVisible( sal_uInt16 nItemId ) const +bool ToolBox::IsItemVisible( ToolBoxItemId nItemId ) const { ImplToolItem* pItem = ImplGetItem( nItemId ); @@ -1306,7 +1306,7 @@ bool ToolBox::IsItemVisible( sal_uInt16 nItemId ) const return false; } -bool ToolBox::IsItemReallyVisible( sal_uInt16 nItemId ) const +bool ToolBox::IsItemReallyVisible( ToolBoxItemId nItemId ) const { // is the item on the visible area of the toolbox? bool bRet = false; @@ -1322,7 +1322,7 @@ bool ToolBox::IsItemReallyVisible( sal_uInt16 nItemId ) const return bRet; } -void ToolBox::SetItemCommand(sal_uInt16 nItemId, const OUString& rCommand) +void ToolBox::SetItemCommand(ToolBoxItemId nItemId, const OUString& rCommand) { ImplToolItem* pItem = ImplGetItem( nItemId ); @@ -1330,7 +1330,7 @@ void ToolBox::SetItemCommand(sal_uInt16 nItemId, const OUString& rCommand) pItem->maCommandStr = rCommand; } -OUString ToolBox::GetItemCommand( sal_uInt16 nItemId ) const +OUString ToolBox::GetItemCommand( ToolBoxItemId nItemId ) const { ImplToolItem* pItem = ImplGetItem( nItemId ); @@ -1340,7 +1340,7 @@ OUString ToolBox::GetItemCommand( sal_uInt16 nItemId ) const return OUString(); } -void ToolBox::SetQuickHelpText( sal_uInt16 nItemId, const OUString& rText ) +void ToolBox::SetQuickHelpText( ToolBoxItemId nItemId, const OUString& rText ) { ImplToolItem* pItem = ImplGetItem( nItemId ); @@ -1348,7 +1348,7 @@ void ToolBox::SetQuickHelpText( sal_uInt16 nItemId, const OUString& rText ) pItem->maQuickHelpText = rText; } -OUString ToolBox::GetQuickHelpText( sal_uInt16 nItemId ) const +OUString ToolBox::GetQuickHelpText( ToolBoxItemId nItemId ) const { ImplToolItem* pItem = ImplGetItem( nItemId ); @@ -1358,7 +1358,7 @@ OUString ToolBox::GetQuickHelpText( sal_uInt16 nItemId ) const return OUString(); } -void ToolBox::SetHelpText( sal_uInt16 nItemId, const OUString& rText ) +void ToolBox::SetHelpText( ToolBoxItemId nItemId, const OUString& rText ) { ImplToolItem* pItem = ImplGetItem( nItemId ); @@ -1366,12 +1366,12 @@ void ToolBox::SetHelpText( sal_uInt16 nItemId, const OUString& rText ) pItem->maHelpText = rText; } -const OUString& ToolBox::GetHelpText( sal_uInt16 nItemId ) const +const OUString& ToolBox::GetHelpText( ToolBoxItemId nItemId ) const { return ImplGetHelpText( nItemId ); } -void ToolBox::SetHelpId( sal_uInt16 nItemId, const OString& rHelpId ) +void ToolBox::SetHelpId( ToolBoxItemId nItemId, const OString& rHelpId ) { ImplToolItem* pItem = ImplGetItem( nItemId ); @@ -1411,7 +1411,7 @@ OUString ToolBox::GetDisplayText() const return mpData->m_pLayoutData ? mpData->m_pLayoutData->m_aDisplayText : OUString(); } -tools::Rectangle ToolBox::GetCharacterBounds( sal_uInt16 nItemID, tools::Long nIndex ) +tools::Rectangle ToolBox::GetCharacterBounds( ToolBoxItemId nItemID, tools::Long nIndex ) { tools::Long nItemIndex = -1; if( ! mpData->m_pLayoutData ) @@ -1430,10 +1430,10 @@ tools::Rectangle ToolBox::GetCharacterBounds( sal_uInt16 nItemID, tools::Long nI return (mpData->m_pLayoutData && nItemIndex != -1) ? mpData->m_pLayoutData->GetCharacterBounds( nItemIndex+nIndex ) : tools::Rectangle(); } -tools::Long ToolBox::GetIndexForPoint( const Point& rPoint, sal_uInt16& rItemID ) +tools::Long ToolBox::GetIndexForPoint( const Point& rPoint, ToolBoxItemId& rItemID ) { tools::Long nIndex = -1; - rItemID = 0; + rItemID = ToolBoxItemId(0); if( ! mpData->m_pLayoutData ) ImplFillLayoutData(); if( mpData->m_pLayoutData ) @@ -1545,7 +1545,7 @@ void ToolBox::UpdateCustomMenu() { if( rItem.IsClipped() ) { - sal_uInt16 id = rItem.mnId + TOOLBOX_MENUITEM_START; + sal_uInt16 id = sal_uInt16(rItem.mnId) + TOOLBOX_MENUITEM_START; MenuItemBits nMenuItemBits = ConvertBitsFromToolBoxToMenu(rItem.mnBits); pMenu->InsertItem( id, rItem.maText, rItem.maImage, nMenuItemBits); pMenu->SetItemCommand( id, rItem.maCommandStr ); @@ -1562,7 +1562,7 @@ void ToolBox::UpdateCustomMenu() { if( rItem.IsItemHidden() ) { - sal_uInt16 id = rItem.mnId + TOOLBOX_MENUITEM_START; + sal_uInt16 id = sal_uInt16(rItem.mnId) + TOOLBOX_MENUITEM_START; MenuItemBits nMenuItemBits = ConvertBitsFromToolBoxToMenu(rItem.mnBits); pMenu->InsertItem( id, rItem.maText, rItem.maImage, nMenuItemBits ); pMenu->SetItemCommand( id, rItem.maCommandStr ); @@ -1578,7 +1578,7 @@ IMPL_LINK( ToolBox, ImplCustomMenuListener, VclMenuEvent&, rEvent, void ) { sal_uInt16 id = GetMenu()->GetItemId( rEvent.GetItemPos() ); if( id >= TOOLBOX_MENUITEM_START ) - TriggerItem( id - TOOLBOX_MENUITEM_START ); + TriggerItem( ToolBoxItemId(id - TOOLBOX_MENUITEM_START) ); } } @@ -1743,7 +1743,7 @@ void ToolBox::DumpAsPropertyTree(tools::JsonWriter& rJsonWriter) if (type == ToolBoxItemType::BUTTON) { auto childNode = rJsonWriter.startStruct(); - int nId = GetItemId(i); + ToolBoxItemId nId = GetItemId(i); if (!IsItemVisible(nId)) continue; rJsonWriter.put("type", "toolitem"); diff --git a/vcl/workben/vcldemo.cxx b/vcl/workben/vcldemo.cxx index dfc1f81b2a17..e9df921c293e 100644 --- a/vcl/workben/vcldemo.cxx +++ b/vcl/workben/vcldemo.cxx @@ -1919,8 +1919,8 @@ public: Help::EnableBalloonHelp(); mpToolbox->SetHelpText("Help text"); - mpToolbox->InsertItem(0, "Toolbar item"); - mpToolbox->SetQuickHelpText(0, "This is a tooltip popup"); + mpToolbox->InsertItem(ToolBoxItemId(0), "Toolbar item"); + mpToolbox->SetQuickHelpText(ToolBoxItemId(0), "This is a tooltip popup"); mpToolbox->InsertSeparator(); mpToolbox->Show(); |