diff options
author | Noel Grandin <noel@peralex.com> | 2014-12-20 16:21:21 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2015-01-06 10:59:40 +0200 |
commit | bae855e667993ea6cddd551452c6e2fa60bdc2f3 (patch) | |
tree | 6ddf4f5d003ce53e9855cbe260851ef00ffa69ca | |
parent | 9b45157ab20c9b158a1ef8f4f364d7a46d9c276b (diff) |
fdo#84938: replace BUTTONTYPE_ constants with 'enum class'
Change-Id: I54f9019297913683605b5aea9f79b3defc1dcc13
-rw-r--r-- | accessibility/source/standard/vclxaccessibletoolboxitem.cxx | 8 | ||||
-rw-r--r-- | cui/source/customize/cfg.cxx | 6 | ||||
-rw-r--r-- | framework/inc/uielement/uielement.hxx | 6 | ||||
-rw-r--r-- | framework/source/layoutmanager/layoutmanager.cxx | 2 | ||||
-rw-r--r-- | framework/source/layoutmanager/toolbarlayoutmanager.cxx | 4 | ||||
-rw-r--r-- | include/rsc/rsc-vcl-shared-types.hxx | 6 | ||||
-rw-r--r-- | include/vcl/toolbox.hxx | 2 | ||||
-rw-r--r-- | rsc/inc/rscdb.hxx | 3 | ||||
-rw-r--r-- | rsc/source/parser/rscicpx.cxx | 6 | ||||
-rw-r--r-- | sfx2/source/doc/templatedlg.cxx | 4 | ||||
-rw-r--r-- | sw/source/uibase/dbui/mailmergechildwindow.cxx | 2 | ||||
-rw-r--r-- | vcl/source/window/toolbox.cxx | 12 | ||||
-rw-r--r-- | vcl/source/window/toolbox2.cxx | 6 |
13 files changed, 34 insertions, 33 deletions
diff --git a/accessibility/source/standard/vclxaccessibletoolboxitem.cxx b/accessibility/source/standard/vclxaccessibletoolboxitem.cxx index b3143a362a29..3d2fb8d929c8 100644 --- a/accessibility/source/standard/vclxaccessibletoolboxitem.cxx +++ b/accessibility/source/standard/vclxaccessibletoolboxitem.cxx @@ -125,7 +125,7 @@ OUString VCLXAccessibleToolBoxItem::GetText( bool _bAsName ) { OUString sRet; // no text for separators and spaces - if ( m_pToolBox && m_nItemId > 0 && ( _bAsName || m_pToolBox->GetButtonType() != BUTTON_SYMBOL ) ) + if ( m_pToolBox && m_nItemId > 0 && ( _bAsName || m_pToolBox->GetButtonType() != ButtonType::SYMBOLONLY ) ) { sRet = m_pToolBox->GetItemText( m_nItemId ); if (sRet.isEmpty()) @@ -270,7 +270,7 @@ Any SAL_CALL VCLXAccessibleToolBoxItem::queryInterface( const Type& _rType ) thr { // #i33611# - toolbox buttons without text don't support XAccessibleText if ( _rType == cppu::UnoType<XAccessibleText>::get() - && ( !m_pToolBox || m_pToolBox->GetButtonType() == BUTTON_SYMBOL ) ) + && ( !m_pToolBox || m_pToolBox->GetButtonType() == ButtonType::SYMBOLONLY ) ) return Any(); ::com::sun::star::uno::Any aReturn = AccessibleTextHelper_BASE::queryInterface( _rType ); @@ -466,7 +466,7 @@ awt::Rectangle SAL_CALL VCLXAccessibleToolBoxItem::getCharacterBounds( sal_Int32 throw IndexOutOfBoundsException(); awt::Rectangle aBounds( 0, 0, 0, 0 ); - if ( m_pToolBox && m_pToolBox->GetButtonType() != BUTTON_SYMBOL ) // symbol buttons have no character bounds + if ( m_pToolBox && m_pToolBox->GetButtonType() != ButtonType::SYMBOLONLY ) // symbol buttons have no character bounds { Rectangle aCharRect = m_pToolBox->GetCharacterBounds( m_nItemId, nIndex ); Rectangle aItemRect = m_pToolBox->GetItemRect( m_nItemId ); @@ -482,7 +482,7 @@ sal_Int32 SAL_CALL VCLXAccessibleToolBoxItem::getIndexAtPoint( const awt::Point& OExternalLockGuard aGuard( this ); sal_Int32 nIndex = -1; - if ( m_pToolBox && m_pToolBox->GetButtonType() != BUTTON_SYMBOL ) // symbol buttons have no character bounds + if ( m_pToolBox && m_pToolBox->GetButtonType() != ButtonType::SYMBOLONLY ) // symbol buttons have no character bounds { sal_uInt16 nItemId = 0; Rectangle aItemRect = m_pToolBox->GetItemRect( m_nItemId ); diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx index c3d32dd96881..88b0bf637b9d 100644 --- a/cui/source/customize/cfg.cxx +++ b/cui/source/customize/cfg.cxx @@ -3506,15 +3506,15 @@ void ToolbarSaveInData::SetSystemStyle( if ( nStyle == 0 ) { - toolbox->SetButtonType( BUTTON_SYMBOL ); + toolbox->SetButtonType( ButtonType::SYMBOLONLY ); } else if ( nStyle == 1 ) { - toolbox->SetButtonType( BUTTON_TEXT ); + toolbox->SetButtonType( ButtonType::TEXT ); } if ( nStyle == 2 ) { - toolbox->SetButtonType( BUTTON_SYMBOLTEXT ); + toolbox->SetButtonType( ButtonType::SYMBOLTEXT ); } } } diff --git a/framework/inc/uielement/uielement.hxx b/framework/inc/uielement/uielement.hxx index 49ddd1bf9842..bbec95ab92ba 100644 --- a/framework/inc/uielement/uielement.hxx +++ b/framework/inc/uielement/uielement.hxx @@ -68,7 +68,7 @@ struct UIElement m_bNoClose( false ), m_bSoftClose( false ), m_bStateRead( false ), - m_nStyle( BUTTON_SYMBOL ) + m_nStyle( ButtonType::SYMBOLONLY ) {} UIElement( const OUString& rName, @@ -89,7 +89,7 @@ struct UIElement m_bNoClose( false ), m_bSoftClose( false ), m_bStateRead( false ), - m_nStyle( BUTTON_SYMBOL ) {} + m_nStyle( ButtonType::SYMBOLONLY ) {} bool operator< ( const UIElement& aUIElement ) const; UIElement& operator=( const UIElement& rUIElement ); @@ -109,7 +109,7 @@ struct UIElement bool m_bNoClose, m_bSoftClose, m_bStateRead; - sal_Int16 m_nStyle; + ButtonType m_nStyle; DockedData m_aDockedData; FloatingData m_aFloatingData; }; diff --git a/framework/source/layoutmanager/layoutmanager.cxx b/framework/source/layoutmanager/layoutmanager.cxx index 245b5b07da36..d1d5dbc5d4d5 100644 --- a/framework/source/layoutmanager/layoutmanager.cxx +++ b/framework/source/layoutmanager/layoutmanager.cxx @@ -552,7 +552,7 @@ bool LayoutManager::readWindowStateData( const OUString& aName, UIElement& rElem { sal_Int32 nStyle = 0; if ( aWindowState[n].Value >>= nStyle ) - rElementData.m_nStyle = sal_Int16( nStyle ); + rElementData.m_nStyle = static_cast<ButtonType>( nStyle ); } else if ( aWindowState[n].Name == WINDOWSTATE_PROPERTY_LOCKED ) { diff --git a/framework/source/layoutmanager/toolbarlayoutmanager.cxx b/framework/source/layoutmanager/toolbarlayoutmanager.cxx index b044bad39c7e..4a793ddc7a9c 100644 --- a/framework/source/layoutmanager/toolbarlayoutmanager.cxx +++ b/framework/source/layoutmanager/toolbarlayoutmanager.cxx @@ -1422,8 +1422,6 @@ void ToolbarLayoutManager::implts_setElementData( UIElement& rElement, const uno } if ( pToolBox ) { - if (( rElement.m_nStyle < 0 ) || ( rElement.m_nStyle > BUTTON_SYMBOLTEXT )) - rElement.m_nStyle = BUTTON_SYMBOL; pToolBox->SetButtonType( (ButtonType)rElement.m_nStyle ); if ( rElement.m_bNoClose ) pToolBox->SetFloatStyle( pToolBox->GetFloatStyle() & ~WB_CLOSEABLE ); @@ -1604,7 +1602,7 @@ void ToolbarLayoutManager::implts_writeWindowStateData( const UIElement& rElemen aWindowState[7].Name = WINDOWSTATE_PROPERTY_LOCKED; aWindowState[7].Value = uno::makeAny( rElementData.m_aDockedData.m_bLocked ); aWindowState[8].Name = WINDOWSTATE_PROPERTY_STYLE; - aWindowState[8].Value = uno::makeAny( rElementData.m_nStyle ); + aWindowState[8].Value = uno::makeAny( static_cast<sal_uInt16>(rElementData.m_nStyle) ); OUString aName = rElementData.m_aName; if ( xPersistentWindowState->hasByName( aName )) diff --git a/include/rsc/rsc-vcl-shared-types.hxx b/include/rsc/rsc-vcl-shared-types.hxx index 016ff2fca176..73f702b62caa 100644 --- a/include/rsc/rsc-vcl-shared-types.hxx +++ b/include/rsc/rsc-vcl-shared-types.hxx @@ -62,10 +62,10 @@ enum class ToolBoxItemBits AUTOSIZE = 0x0010, DROPDOWN = 0x0020, REPEAT = 0x0040, - DROPDOWNONLY = 0x00a0, // 0x0080 | TIB_DROPDOWN + DROPDOWNONLY = 0x00a0, // 0x0080 | DROPDOWN TEXT_ONLY = 0x0100, ICON_ONLY = 0x0200, - TEXTICON = 0x0300 // TIB_TEXT_ONLY | TIB_ICON_ONLY + TEXTICON = 0x0300 // TEXT_ONLY | ICON_ONLY }; namespace o3tl { @@ -74,7 +74,7 @@ namespace o3tl enum class ToolBoxItemType { DONTKNOW, BUTTON, SPACE, SEPARATOR, BREAK }; -enum ButtonType { BUTTON_SYMBOL, BUTTON_TEXT, BUTTON_SYMBOLTEXT }; +enum class ButtonType { SYMBOLONLY, TEXT, SYMBOLTEXT }; enum class SymbolType : sal_uInt16 { diff --git a/include/vcl/toolbox.hxx b/include/vcl/toolbox.hxx index 3f2fbc19904a..2d6961da1286 100644 --- a/include/vcl/toolbox.hxx +++ b/include/vcl/toolbox.hxx @@ -356,7 +356,7 @@ public: const ImageList& GetImageList() const { return maImageList; } void SetImageList( const ImageList& rImageList ); - void SetButtonType( ButtonType eNewType = BUTTON_SYMBOL ); + void SetButtonType( ButtonType eNewType = ButtonType::SYMBOLONLY ); ButtonType GetButtonType() const { return meButtonType; } // sets a fixed button size (small, large or dontcare (==autosize)) diff --git a/rsc/inc/rscdb.hxx b/rsc/inc/rscdb.hxx index 9a8aa723d1de..6ddfe7d36fab 100644 --- a/rsc/inc/rscdb.hxx +++ b/rsc/inc/rscdb.hxx @@ -42,6 +42,7 @@ enum class WindowBorderStyle : sal_Int16; enum class KeyFuncType : sal_Int32; enum class MenuItemBits : sal_Int16; enum class ToolBoxItemType; +enum class ButtonType; struct WriteRcContext { @@ -152,6 +153,8 @@ class RscTypCont inline void SETCONST( RscConst *p1, const char * p2, MenuItemBits p3 ) { SETCONST(p1, p2, static_cast<sal_uInt32>(p3)); } inline void SETCONST( RscConst *p1, Atom p2, MenuItemBits p3 ) { SETCONST(p1, p2, static_cast<sal_uInt32>(p3)); } inline void SETCONST( RscConst *p1, const char * p2, ToolBoxItemType p3 ) { SETCONST(p1, p2, static_cast<sal_uInt32>(p3)); } + inline void SETCONST( RscConst *p1, Atom p2, ButtonType p3 ) { SETCONST(p1, p2, static_cast<sal_uInt32>(p3)); } + inline void SETCONST( RscConst *p1, const char * p2, ButtonType p3 ) { SETCONST(p1, p2, static_cast<sal_uInt32>(p3)); } RscEnum * InitLangType(); RscEnum * InitFieldUnitsType(); RscEnum * InitColor(); diff --git a/rsc/source/parser/rscicpx.cxx b/rsc/source/parser/rscicpx.cxx index f62ff3e61ba7..0d23d0b05b58 100644 --- a/rsc/source/parser/rscicpx.cxx +++ b/rsc/source/parser/rscicpx.cxx @@ -1238,9 +1238,9 @@ RscTop * RscTypCont::InitClassToolBox( RscTop * pSuper, RscEnum * pEnum; aBaseLst.push_back( pEnum = new RscEnum( pHS->getID( "EnumButtonType" ), RSC_NOTYPE ) ); - SETCONST( pEnum, "BUTTON_SYMBOL", BUTTON_SYMBOL ); - SETCONST( pEnum, "BUTTON_TEXT", BUTTON_TEXT ); - SETCONST( pEnum, "BUTTON_SYMBOLTEXT", BUTTON_SYMBOLTEXT ); + SETCONST( pEnum, "BUTTON_SYMBOL", ButtonType::SYMBOLONLY ); + SETCONST( pEnum, "BUTTON_TEXT", ButtonType::TEXT ); + SETCONST( pEnum, "BUTTON_SYMBOLTEXT", ButtonType::SYMBOLTEXT ); // Variable einfuegen nId = aNmTb.Put( "ButtonType", VARNAME ); diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx index ca1d508ce570..c361aa26c588 100644 --- a/sfx2/source/doc/templatedlg.cxx +++ b/sfx2/source/doc/templatedlg.cxx @@ -220,8 +220,8 @@ SfxTemplateManagerDlg::SfxTemplateManagerDlg(vcl::Window *parent) mpActionMenu->SetPopupMenu(MNI_ACTION_DEFAULT,mpTemplateDefaultMenu); // Set toolbox styles - mpViewBar->SetButtonType(BUTTON_SYMBOLTEXT); - mpTemplateBar->SetButtonType(BUTTON_SYMBOLTEXT); + mpViewBar->SetButtonType(ButtonType::SYMBOLTEXT); + mpTemplateBar->SetButtonType(ButtonType::SYMBOLTEXT); // Set toolbox button bits mpViewBar->SetItemBits(mpViewBar->GetItemId(VIEWBAR_REPOSITORY), ToolBoxItemBits::DROPDOWNONLY); diff --git a/sw/source/uibase/dbui/mailmergechildwindow.cxx b/sw/source/uibase/dbui/mailmergechildwindow.cxx index 4e53fdfe8a39..e43731b1e399 100644 --- a/sw/source/uibase/dbui/mailmergechildwindow.cxx +++ b/sw/source/uibase/dbui/mailmergechildwindow.cxx @@ -70,7 +70,7 @@ SwMailMergeChildWin::SwMailMergeChildWin(SfxBindings* _pBindings, { get(m_pBackTB, "back"); m_pBackTB->SetSelectHdl(LINK(this, SwMailMergeChildWin, BackHdl)); - m_pBackTB->SetButtonType( BUTTON_SYMBOLTEXT ); + m_pBackTB->SetButtonType( ButtonType::SYMBOLTEXT ); } IMPL_LINK_NOARG(SwMailMergeChildWin, BackHdl) diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx index 490feac7f767..5816fe333970 100644 --- a/vcl/source/window/toolbox.cxx +++ b/vcl/source/window/toolbox.cxx @@ -169,11 +169,11 @@ ButtonType determineButtonType( ImplToolItem* pItem, ButtonType defaultType ) ButtonType tmpButtonType = defaultType; if ( pItem->mnBits & (ToolBoxItemBits::TEXT_ONLY | ToolBoxItemBits::ICON_ONLY) ) // item has custom setting { - tmpButtonType = BUTTON_SYMBOLTEXT; + tmpButtonType = ButtonType::SYMBOLTEXT; if ( pItem->mnBits & ToolBoxItemBits::TEXT_ONLY ) - tmpButtonType = BUTTON_TEXT; + tmpButtonType = ButtonType::TEXT; else if ( pItem->mnBits & ToolBoxItemBits::ICON_ONLY ) - tmpButtonType = BUTTON_SYMBOL; + tmpButtonType = ButtonType::SYMBOLONLY; } return tmpButtonType; } @@ -1398,7 +1398,7 @@ void ToolBox::ImplInit( vcl::Window* pParent, WinBits nStyle ) mbIsShift = false; mbIsKeyEvent = false; mbChangingHighlight = false; - meButtonType = BUTTON_SYMBOL; + meButtonType = ButtonType::SYMBOLONLY; meAlign = WINDOWALIGN_TOP; meLastStyle = POINTER_ARROW; mnWinStyle = nStyle; @@ -1755,7 +1755,7 @@ bool ToolBox::ImplCalcItem() it->mbEmptyBtn = false; - if ( tmpButtonType == BUTTON_SYMBOL ) + if ( tmpButtonType == ButtonType::SYMBOLONLY ) { // we're drawing images only if ( bImage || !bText ) @@ -1769,7 +1769,7 @@ bool ToolBox::ImplCalcItem() it->mbVisibleText = true; } } - else if ( tmpButtonType == BUTTON_TEXT ) + else if ( tmpButtonType == ButtonType::TEXT ) { // we're drawing text only if ( bText || !bImage ) diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx index 938a93223025..c1f4e0581b3d 100644 --- a/vcl/source/window/toolbox2.cxx +++ b/vcl/source/window/toolbox2.cxx @@ -282,7 +282,7 @@ void ImplToolItem::DetermineButtonDrawStyle( ButtonType eButtonType, bool& rbIma // prefer images if symbolonly buttons are drawn // prefer texts if textonly buttons are dreawn - if ( eButtonType == BUTTON_SYMBOL ) // drawing icons only + if ( eButtonType == ButtonType::SYMBOLONLY ) // drawing icons only { if( bHasImage || !bHasText ) { @@ -295,7 +295,7 @@ void ImplToolItem::DetermineButtonDrawStyle( ButtonType eButtonType, bool& rbIma rbText = true; } } - else if ( eButtonType == BUTTON_TEXT ) // drawing text only + else if ( eButtonType == ButtonType::TEXT ) // drawing text only { if( bHasText || !bHasImage ) { @@ -1270,7 +1270,7 @@ void ToolBox::SetItemText( sal_uInt16 nItemId, const OUString& rText ) ImplToolItem* pItem = &mpData->m_aItems[nPos]; // only once all is calculated, do extra work if ( !mbCalc && - ((meButtonType != BUTTON_SYMBOL) || !pItem->maImage) ) + ((meButtonType != ButtonType::SYMBOLONLY) || !pItem->maImage) ) { long nOldWidth = GetCtrlTextWidth( pItem->maText ); pItem->maText = ImplConvertMenuString( rText ); |