convert NAV_STATE to scoped enum
Change-Id: I855a320884c42807fadf9ce42adc0ece8c65ce1c Reviewed-on: https://gerrit.libreoffice.org/25067 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
This commit is contained in:
committed by
Noel Grandin
parent
397f567ebc
commit
45ec74a080
@@ -843,45 +843,45 @@ void SdNavigatorControllerItem::StateChanged( sal_uInt16 nSId,
|
|||||||
if( eState >= SfxItemState::DEFAULT && nSId == SID_NAVIGATOR_STATE )
|
if( eState >= SfxItemState::DEFAULT && nSId == SID_NAVIGATOR_STATE )
|
||||||
{
|
{
|
||||||
const SfxUInt32Item& rStateItem = dynamic_cast<const SfxUInt32Item&>(*pItem);
|
const SfxUInt32Item& rStateItem = dynamic_cast<const SfxUInt32Item&>(*pItem);
|
||||||
sal_uInt32 nState = rStateItem.GetValue();
|
NavState nState = (NavState)rStateItem.GetValue();
|
||||||
|
|
||||||
// only if doc in LB is the active
|
// only if doc in LB is the active
|
||||||
NavDocInfo* pInfo = pNavigatorWin->GetDocInfo();
|
NavDocInfo* pInfo = pNavigatorWin->GetDocInfo();
|
||||||
if( pInfo && pInfo->IsActive() )
|
if( pInfo && pInfo->IsActive() )
|
||||||
{
|
{
|
||||||
// First
|
// First
|
||||||
if( nState & NAVBTN_FIRST_ENABLED &&
|
if( nState & NavState::BtnFirstEnabled &&
|
||||||
!pNavigatorWin->maToolbox->IsItemEnabled( TBI_FIRST ) )
|
!pNavigatorWin->maToolbox->IsItemEnabled( TBI_FIRST ) )
|
||||||
pNavigatorWin->maToolbox->EnableItem( TBI_FIRST );
|
pNavigatorWin->maToolbox->EnableItem( TBI_FIRST );
|
||||||
if( nState & NAVBTN_FIRST_DISABLED &&
|
if( nState & NavState::BtnFirstDisabled &&
|
||||||
pNavigatorWin->maToolbox->IsItemEnabled( TBI_FIRST ) )
|
pNavigatorWin->maToolbox->IsItemEnabled( TBI_FIRST ) )
|
||||||
pNavigatorWin->maToolbox->EnableItem( TBI_FIRST, false );
|
pNavigatorWin->maToolbox->EnableItem( TBI_FIRST, false );
|
||||||
|
|
||||||
// Prev
|
// Prev
|
||||||
if( nState & NAVBTN_PREV_ENABLED &&
|
if( nState & NavState::BtnPrevEnabled &&
|
||||||
!pNavigatorWin->maToolbox->IsItemEnabled( TBI_PREVIOUS ) )
|
!pNavigatorWin->maToolbox->IsItemEnabled( TBI_PREVIOUS ) )
|
||||||
pNavigatorWin->maToolbox->EnableItem( TBI_PREVIOUS );
|
pNavigatorWin->maToolbox->EnableItem( TBI_PREVIOUS );
|
||||||
if( nState & NAVBTN_PREV_DISABLED &&
|
if( nState & NavState::BtnPrevDisabled &&
|
||||||
pNavigatorWin->maToolbox->IsItemEnabled( TBI_PREVIOUS ) )
|
pNavigatorWin->maToolbox->IsItemEnabled( TBI_PREVIOUS ) )
|
||||||
pNavigatorWin->maToolbox->EnableItem( TBI_PREVIOUS, false );
|
pNavigatorWin->maToolbox->EnableItem( TBI_PREVIOUS, false );
|
||||||
|
|
||||||
// Last
|
// Last
|
||||||
if( nState & NAVBTN_LAST_ENABLED &&
|
if( nState & NavState::BtnLastEnabled &&
|
||||||
!pNavigatorWin->maToolbox->IsItemEnabled( TBI_LAST ) )
|
!pNavigatorWin->maToolbox->IsItemEnabled( TBI_LAST ) )
|
||||||
pNavigatorWin->maToolbox->EnableItem( TBI_LAST );
|
pNavigatorWin->maToolbox->EnableItem( TBI_LAST );
|
||||||
if( nState & NAVBTN_LAST_DISABLED &&
|
if( nState & NavState::BtnLastDisabled &&
|
||||||
pNavigatorWin->maToolbox->IsItemEnabled( TBI_LAST ) )
|
pNavigatorWin->maToolbox->IsItemEnabled( TBI_LAST ) )
|
||||||
pNavigatorWin->maToolbox->EnableItem( TBI_LAST, false );
|
pNavigatorWin->maToolbox->EnableItem( TBI_LAST, false );
|
||||||
|
|
||||||
// Next
|
// Next
|
||||||
if( nState & NAVBTN_NEXT_ENABLED &&
|
if( nState & NavState::BtnNextEnabled &&
|
||||||
!pNavigatorWin->maToolbox->IsItemEnabled( TBI_NEXT ) )
|
!pNavigatorWin->maToolbox->IsItemEnabled( TBI_NEXT ) )
|
||||||
pNavigatorWin->maToolbox->EnableItem( TBI_NEXT );
|
pNavigatorWin->maToolbox->EnableItem( TBI_NEXT );
|
||||||
if( nState & NAVBTN_NEXT_DISABLED &&
|
if( nState & NavState::BtnNextDisabled &&
|
||||||
pNavigatorWin->maToolbox->IsItemEnabled( TBI_NEXT ) )
|
pNavigatorWin->maToolbox->IsItemEnabled( TBI_NEXT ) )
|
||||||
pNavigatorWin->maToolbox->EnableItem( TBI_NEXT, false );
|
pNavigatorWin->maToolbox->EnableItem( TBI_NEXT, false );
|
||||||
|
|
||||||
if( nState & NAVTLB_UPDATE )
|
if( nState & NavState::TableUpdate )
|
||||||
{
|
{
|
||||||
// InitTlb; is initiated by Slot
|
// InitTlb; is initiated by Slot
|
||||||
if (maUpdateRequest)
|
if (maUpdateRequest)
|
||||||
|
@@ -27,20 +27,6 @@
|
|||||||
#include "sdtreelb.hxx"
|
#include "sdtreelb.hxx"
|
||||||
#include "pres.hxx"
|
#include "pres.hxx"
|
||||||
|
|
||||||
#define NAVSTATE_NONE 0x00000000
|
|
||||||
|
|
||||||
#define NAVTLB_UPDATE 0x00000100
|
|
||||||
|
|
||||||
#define NAVBTN_FIRST_ENABLED 0x00001000
|
|
||||||
#define NAVBTN_FIRST_DISABLED 0x00002000
|
|
||||||
#define NAVBTN_PREV_ENABLED 0x00004000
|
|
||||||
#define NAVBTN_PREV_DISABLED 0x00008000
|
|
||||||
|
|
||||||
#define NAVBTN_LAST_ENABLED 0x00010000
|
|
||||||
#define NAVBTN_LAST_DISABLED 0x00020000
|
|
||||||
#define NAVBTN_NEXT_ENABLED 0x00040000
|
|
||||||
#define NAVBTN_NEXT_DISABLED 0x00080000
|
|
||||||
|
|
||||||
// forward
|
// forward
|
||||||
namespace sd {
|
namespace sd {
|
||||||
class DrawDocShell;
|
class DrawDocShell;
|
||||||
@@ -50,6 +36,22 @@ class Menu;
|
|||||||
class SdNavigatorControllerItem;
|
class SdNavigatorControllerItem;
|
||||||
class SdPageNameControllerItem;
|
class SdPageNameControllerItem;
|
||||||
|
|
||||||
|
enum class NavState {
|
||||||
|
NONE = 0x000000,
|
||||||
|
TableUpdate = 0x000100,
|
||||||
|
BtnFirstEnabled = 0x001000,
|
||||||
|
BtnFirstDisabled = 0x002000,
|
||||||
|
BtnPrevEnabled = 0x004000,
|
||||||
|
BtnPrevDisabled = 0x008000,
|
||||||
|
BtnLastEnabled = 0x010000,
|
||||||
|
BtnLastDisabled = 0x020000,
|
||||||
|
BtnNextEnabled = 0x040000,
|
||||||
|
BtnNextDisabled = 0x080000,
|
||||||
|
};
|
||||||
|
namespace o3tl {
|
||||||
|
template<> struct typed_flags<NavState> : is_typed_flags<NavState, 0x0ff100> {};
|
||||||
|
}
|
||||||
|
|
||||||
class NavDocInfo
|
class NavDocInfo
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@@ -152,13 +152,13 @@ void DrawViewShell::ExecNavigatorWin( SfxRequest& rReq )
|
|||||||
|
|
||||||
void DrawViewShell::GetNavigatorWinState( SfxItemSet& rSet )
|
void DrawViewShell::GetNavigatorWinState( SfxItemSet& rSet )
|
||||||
{
|
{
|
||||||
sal_uInt32 nState = NAVSTATE_NONE;
|
NavState nState = NavState::NONE;
|
||||||
sal_uInt16 nCurrentPage = 0;
|
sal_uInt16 nCurrentPage = 0;
|
||||||
sal_uInt16 nFirstPage = 0;
|
sal_uInt16 nFirstPage = 0;
|
||||||
sal_uInt16 nLastPage;
|
sal_uInt16 nLastPage;
|
||||||
OUString aPageName;
|
OUString aPageName;
|
||||||
|
|
||||||
nState |= NAVTLB_UPDATE;
|
nState |= NavState::TableUpdate;
|
||||||
|
|
||||||
if (mpActualPage != nullptr)
|
if (mpActualPage != nullptr)
|
||||||
{
|
{
|
||||||
@@ -171,24 +171,24 @@ void DrawViewShell::GetNavigatorWinState( SfxItemSet& rSet )
|
|||||||
// first page / previous page
|
// first page / previous page
|
||||||
if( nCurrentPage == nFirstPage )
|
if( nCurrentPage == nFirstPage )
|
||||||
{
|
{
|
||||||
nState |= NAVBTN_FIRST_DISABLED | NAVBTN_PREV_DISABLED;
|
nState |= NavState::BtnFirstDisabled | NavState::BtnPrevDisabled;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
nState |= NAVBTN_FIRST_ENABLED | NAVBTN_PREV_ENABLED;
|
nState |= NavState::BtnFirstEnabled | NavState::BtnPrevEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
// last page / next page
|
// last page / next page
|
||||||
if( nCurrentPage == nLastPage )
|
if( nCurrentPage == nLastPage )
|
||||||
{
|
{
|
||||||
nState |= NAVBTN_LAST_DISABLED | NAVBTN_NEXT_DISABLED;
|
nState |= NavState::BtnLastDisabled | NavState::BtnNextDisabled;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
nState |= NAVBTN_LAST_ENABLED | NAVBTN_NEXT_ENABLED;
|
nState |= NavState::BtnLastEnabled | NavState::BtnNextEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
rSet.Put( SfxUInt32Item( SID_NAVIGATOR_STATE, nState ) );
|
rSet.Put( SfxUInt32Item( SID_NAVIGATOR_STATE, (sal_uInt32)nState ) );
|
||||||
rSet.Put( SfxStringItem( SID_NAVIGATOR_PAGENAME, aPageName ) );
|
rSet.Put( SfxStringItem( SID_NAVIGATOR_PAGENAME, aPageName ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user