From 1f11bd90b6d43eee382d54a3041b1e1eb2a6af27 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 12 Mar 2015 08:33:40 +0200 Subject: convert SidebarPosition to enum class Change-Id: Id3da97083a8e30a32712443485b3801a8891a1db --- sw/inc/PostItMgr.hxx | 2 +- sw/inc/SidebarWindowsTypes.hxx | 8 ++++---- sw/inc/postithelper.hxx | 2 +- sw/source/core/layout/layact.cxx | 2 +- sw/source/core/layout/pagechg.cxx | 12 ++++++------ sw/source/core/layout/paintfrm.cxx | 4 ++-- sw/source/core/view/viewsh.cxx | 4 ++-- sw/source/uibase/docvw/PageBreakWin.cxx | 4 ++-- sw/source/uibase/docvw/PostItMgr.cxx | 32 ++++++++++++++++---------------- sw/source/uibase/docvw/SidebarWin.cxx | 6 +++--- 10 files changed, 38 insertions(+), 38 deletions(-) diff --git a/sw/inc/PostItMgr.hxx b/sw/inc/PostItMgr.hxx index f72357a3f99a..f880d609b34a 100644 --- a/sw/inc/PostItMgr.hxx +++ b/sw/inc/PostItMgr.hxx @@ -73,7 +73,7 @@ struct SwPostItPageItem long lOffset; SwRect mPageRect; SwSidebarItem_list* mList; - SwPostItPageItem(): bScrollbar(false), eSidebarPosition( sw::sidebarwindows::SIDEBAR_LEFT ), lOffset(0) + SwPostItPageItem(): bScrollbar(false), eSidebarPosition( sw::sidebarwindows::SidebarPosition::LEFT ), lOffset(0) { mList = new SwSidebarItem_list; } diff --git a/sw/inc/SidebarWindowsTypes.hxx b/sw/inc/SidebarWindowsTypes.hxx index 28d1e5891ff1..b041c3f32a2f 100644 --- a/sw/inc/SidebarWindowsTypes.hxx +++ b/sw/inc/SidebarWindowsTypes.hxx @@ -29,11 +29,11 @@ enum class ViewState EDIT }; -enum SidebarPosition +enum class SidebarPosition { - SIDEBAR_LEFT, // sidebar on left side - SIDEBAR_RIGHT, // sidebar on right side - SIDEBAR_NONE // sidebar on neither side + LEFT, // sidebar on left side + RIGHT, // sidebar on right side + NONE // sidebar on neither side }; } } // end of namespace sw::sidebarwindows diff --git a/sw/inc/postithelper.hxx b/sw/inc/postithelper.hxx index 10bc05fed989..80b26ac520e6 100644 --- a/sw/inc/postithelper.hxx +++ b/sw/inc/postithelper.hxx @@ -64,7 +64,7 @@ struct SwLayoutInfo , mPageFrame() , mPagePrtArea() , mnPageNumber(1) - , meSidebarPosition(sw::sidebarwindows::SIDEBAR_NONE) + , meSidebarPosition(sw::sidebarwindows::SidebarPosition::NONE) , mRedlineAuthor(0) {} }; diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx index f4f8512b1e21..9a8dd9e55038 100644 --- a/sw/source/core/layout/layact.cxx +++ b/sw/source/core/layout/layact.cxx @@ -1321,7 +1321,7 @@ bool SwLayAction::FormatLayout( SwLayoutFrm *pLay, bool bAddRect ) { SwPageFrm::GetBorderAndShadowBoundRect(aPageRect, pSh, aPageRect, pPageFrm->IsLeftShadowNeeded(), pPageFrm->IsRightShadowNeeded(), - pPageFrm->SidebarPosition() == sw::sidebarwindows::SIDEBAR_RIGHT); + pPageFrm->SidebarPosition() == sw::sidebarwindows::SidebarPosition::RIGHT); } if ( bPrev ) diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx index 81f3456381ba..62de3e720f03 100644 --- a/sw/source/core/layout/pagechg.cxx +++ b/sw/source/core/layout/pagechg.cxx @@ -256,7 +256,7 @@ SwPageFrm::~SwPageFrm() pImp->GetLayAction().SetAgain(); // OD 12.02.2003 #i9719#, #105645# - retouche area of page // including border and shadow area. - const bool bRightSidebar = (SidebarPosition() == sw::sidebarwindows::SIDEBAR_RIGHT); + const bool bRightSidebar = (SidebarPosition() == sw::sidebarwindows::SidebarPosition::RIGHT); SwRect aRetoucheRect; SwPageFrm::GetBorderAndShadowBoundRect( Frm(), pSh, aRetoucheRect, IsLeftShadowNeeded(), IsRightShadowNeeded(), bRightSidebar ); pSh->AddPaintRect( aRetoucheRect ); @@ -599,7 +599,7 @@ void SwPageFrm::_UpdateAttr( const SfxPoolItem *pOld, const SfxPoolItem *pNew, { // OD 12.02.2003 #i9719#, #105645# - consider border and shadow of // page frame for determine 'old' rectangle - it's used for invalidating. - const bool bRightSidebar = (SidebarPosition() == sw::sidebarwindows::SIDEBAR_RIGHT); + const bool bRightSidebar = (SidebarPosition() == sw::sidebarwindows::SidebarPosition::RIGHT); SwRect aOldRectWithBorderAndShadow; SwPageFrm::GetBorderAndShadowBoundRect( aOldPageFrmRect, pSh, aOldRectWithBorderAndShadow, IsLeftShadowNeeded(), IsRightShadowNeeded(), bRightSidebar ); @@ -1251,7 +1251,7 @@ sw::sidebarwindows::SidebarPosition SwPageFrm::SidebarPosition() const SwViewShell *pSh = getRootFrm()->GetCurrShell(); if( !pSh || pSh->GetViewOptions()->getBrowseMode() ) { - return sw::sidebarwindows::SIDEBAR_RIGHT; + return sw::sidebarwindows::SidebarPosition::RIGHT; } else { @@ -1260,8 +1260,8 @@ sw::sidebarwindows::SidebarPosition SwPageFrm::SidebarPosition() const const bool bRightSidebar = bLTR ? (!bBookMode || OnRightPage()) : (bBookMode && !OnRightPage()); return bRightSidebar - ? sw::sidebarwindows::SIDEBAR_RIGHT - : sw::sidebarwindows::SIDEBAR_LEFT; + ? sw::sidebarwindows::SidebarPosition::RIGHT + : sw::sidebarwindows::SidebarPosition::LEFT; } } @@ -2055,7 +2055,7 @@ void SwRootFrm::CheckViewLayout( const SwViewOption* pViewOpt, const SwRect* pVi const SwTwips nCurrentPageWidth = pFormatPage->Frm().Width() + (pFormatPage->IsEmptyPage() ? 0 : nSidebarWidth); const Point aOldPagePos = pPageToAdjust->Frm().Pos(); - const bool bLeftSidebar = pPageToAdjust->SidebarPosition() == sw::sidebarwindows::SIDEBAR_LEFT; + const bool bLeftSidebar = pPageToAdjust->SidebarPosition() == sw::sidebarwindows::SidebarPosition::LEFT; const SwTwips nLeftPageAddOffset = bLeftSidebar ? nSidebarWidth : 0; diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index 667291ede229..d2372ace8860 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -3270,7 +3270,7 @@ void SwRootFrm::Paint(SwRect const& rRect, SwPrintData const*const pPrintData) c { const bool bPaintRightShadow = pPage->IsRightShadowNeeded(); const bool bPaintLeftShadow = pPage->IsLeftShadowNeeded(); - const bool bRightSidebar = pPage->SidebarPosition() == sw::sidebarwindows::SIDEBAR_RIGHT; + const bool bRightSidebar = pPage->SidebarPosition() == sw::sidebarwindows::SidebarPosition::RIGHT; if ( !pPage->IsEmptyPage() ) { @@ -6400,7 +6400,7 @@ SwRect SwPageFrm::GetBoundRect() const } SwPageFrm::GetBorderAndShadowBoundRect( aPageRect, pSh, aResult, - IsLeftShadowNeeded(), IsRightShadowNeeded(), SidebarPosition() == sw::sidebarwindows::SIDEBAR_RIGHT ); + IsLeftShadowNeeded(), IsRightShadowNeeded(), SidebarPosition() == sw::sidebarwindows::SidebarPosition::RIGHT ); return aResult; } diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx index cd11f95ab384..b42032362ab5 100644 --- a/sw/source/core/view/viewsh.cxx +++ b/sw/source/core/view/viewsh.cxx @@ -1074,7 +1074,7 @@ void SwViewShell::VisPortChgd( const SwRect &rRect) SwTwips nPageRight = 0; const sw::sidebarwindows::SidebarPosition aSidebarPos = pPage->SidebarPosition(); - if( aSidebarPos != sw::sidebarwindows::SIDEBAR_NONE ) + if( aSidebarPos != sw::sidebarwindows::SidebarPosition::NONE ) { nPageLeft = aPageRect.Left(); nPageRight = aPageRect.Right(); @@ -1473,7 +1473,7 @@ void SwViewShell::PaintDesktop( const SwRect &rRect ) } const bool bSidebarRight = - static_cast(pPage)->SidebarPosition() == sw::sidebarwindows::SIDEBAR_RIGHT; + static_cast(pPage)->SidebarPosition() == sw::sidebarwindows::SidebarPosition::RIGHT; aPageRect.Pos().X() -= bSidebarRight ? 0 : nSidebarWidth; aPageRect.SSize().Width() += nSidebarWidth; diff --git a/sw/source/uibase/docvw/PageBreakWin.cxx b/sw/source/uibase/docvw/PageBreakWin.cxx index 2e7d98fd98a7..b28429028b1e 100644 --- a/sw/source/uibase/docvw/PageBreakWin.cxx +++ b/sw/source/uibase/docvw/PageBreakWin.cxx @@ -349,9 +349,9 @@ void SwPageBreakWin::UpdatePosition( const Point* pEvtPt ) if ( pPostItMngr && pPostItMngr->HasNotes() && pPostItMngr->ShowNotes() ) nSidebarWidth = pPostItMngr->GetSidebarBorderWidth( true ) + pPostItMngr->GetSidebarWidth( true ); - if ( pPageFrm->SidebarPosition( ) == sw::sidebarwindows::SIDEBAR_LEFT ) + if ( pPageFrm->SidebarPosition( ) == sw::sidebarwindows::SidebarPosition::LEFT ) nPgLeft -= nSidebarWidth; - else if ( pPageFrm->SidebarPosition( ) == sw::sidebarwindows::SIDEBAR_RIGHT ) + else if ( pPageFrm->SidebarPosition( ) == sw::sidebarwindows::SidebarPosition::RIGHT ) nPgRight += nSidebarWidth; Size aBtnSize( BUTTON_WIDTH + ARROW_WIDTH, BUTTON_HEIGHT ); diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx index 3857c85ff72e..fa8f58d10d76 100644 --- a/sw/source/uibase/docvw/PostItMgr.cxx +++ b/sw/source/uibase/docvw/PostItMgr.cxx @@ -616,7 +616,7 @@ void SwPostItMgr::LayoutPostIts() SwSidebarItem* pItem = (*i); SwSidebarWin* pPostIt = pItem->pPostIt; - if (mPages[n]->eSidebarPosition == sw::sidebarwindows::SIDEBAR_LEFT ) + if (mPages[n]->eSidebarPosition == sw::sidebarwindows::SidebarPosition::LEFT ) { // x value for notes positioning mlPageBorder = mpEditWin->LogicToPixel( Point( mPages[n]->mPageRect.Left(), 0)).X() - GetSidebarWidth(true);// - GetSidebarBorderWidth(true); @@ -626,7 +626,7 @@ void SwPostItMgr::LayoutPostIts() ? pItem->maLayoutInfo.mPagePrtArea.Left() : mPages[n]->mPageRect.Left() + 350; } - else if (mPages[n]->eSidebarPosition == sw::sidebarwindows::SIDEBAR_RIGHT ) + else if (mPages[n]->eSidebarPosition == sw::sidebarwindows::SidebarPosition::RIGHT ) { // x value for notes positioning mlPageBorder = mpEditWin->LogicToPixel( Point(mPages[n]->mPageRect.Right(), 0)).X() + GetSidebarBorderWidth(true); @@ -734,19 +734,19 @@ void SwPostItMgr::LayoutPostIts() { if (mpEditWin->PixelToLogic(Point(0,(*i)->VirtualPos().Y())).Y() < (mPages[n]->mPageRect.Top()+aSidebarheight)) { - if ( mPages[n]->eSidebarPosition == sw::sidebarwindows::SIDEBAR_LEFT ) + if ( mPages[n]->eSidebarPosition == sw::sidebarwindows::SidebarPosition::LEFT ) (*i)->ShowAnchorOnly(Point( mPages[n]->mPageRect.Left(), mPages[n]->mPageRect.Top())); - else if ( mPages[n]->eSidebarPosition == sw::sidebarwindows::SIDEBAR_RIGHT ) + else if ( mPages[n]->eSidebarPosition == sw::sidebarwindows::SidebarPosition::RIGHT ) (*i)->ShowAnchorOnly(Point( mPages[n]->mPageRect.Right(), mPages[n]->mPageRect.Top())); } else { - if ( mPages[n]->eSidebarPosition == sw::sidebarwindows::SIDEBAR_LEFT ) + if ( mPages[n]->eSidebarPosition == sw::sidebarwindows::SidebarPosition::LEFT ) (*i)->ShowAnchorOnly(Point(mPages[n]->mPageRect.Left(), mPages[n]->mPageRect.Bottom())); - else if ( mPages[n]->eSidebarPosition == sw::sidebarwindows::SIDEBAR_RIGHT ) + else if ( mPages[n]->eSidebarPosition == sw::sidebarwindows::SidebarPosition::RIGHT ) (*i)->ShowAnchorOnly(Point(mPages[n]->mPageRect.Right(), mPages[n]->mPageRect.Bottom())); } @@ -876,16 +876,16 @@ void SwPostItMgr::Scroll(const long lScroll,const unsigned long aPage) { if ( mpEditWin->PixelToLogic(Point(0,pPostIt->VirtualPos().Y())).Y() < (mPages[aPage-1]->mPageRect.Top()+aSidebarheight)) { - if (mPages[aPage-1]->eSidebarPosition == sw::sidebarwindows::SIDEBAR_LEFT) + if (mPages[aPage-1]->eSidebarPosition == sw::sidebarwindows::SidebarPosition::LEFT) pPostIt->ShowAnchorOnly(Point(mPages[aPage-1]->mPageRect.Left(),mPages[aPage-1]->mPageRect.Top())); - else if (mPages[aPage-1]->eSidebarPosition == sw::sidebarwindows::SIDEBAR_RIGHT) + else if (mPages[aPage-1]->eSidebarPosition == sw::sidebarwindows::SidebarPosition::RIGHT) pPostIt->ShowAnchorOnly(Point(mPages[aPage-1]->mPageRect.Right(),mPages[aPage-1]->mPageRect.Top())); } else { - if (mPages[aPage-1]->eSidebarPosition == sw::sidebarwindows::SIDEBAR_LEFT) + if (mPages[aPage-1]->eSidebarPosition == sw::sidebarwindows::SidebarPosition::LEFT) pPostIt->ShowAnchorOnly(Point(mPages[aPage-1]->mPageRect.Left(),mPages[aPage-1]->mPageRect.Bottom())); - else if (mPages[aPage-1]->eSidebarPosition == sw::sidebarwindows::SIDEBAR_RIGHT) + else if (mPages[aPage-1]->eSidebarPosition == sw::sidebarwindows::SidebarPosition::RIGHT) pPostIt->ShowAnchorOnly(Point(mPages[aPage-1]->mPageRect.Right(),mPages[aPage-1]->mPageRect.Bottom())); } } @@ -1657,7 +1657,7 @@ bool SwPostItMgr::IsHit(const Point &aPointPixel) { Rectangle aRect; OSL_ENSURE(mPages.size()>nPageNum-1,"SwPostitMgr:: page container size wrong"); - aRect = mPages[nPageNum-1]->eSidebarPosition == sw::sidebarwindows::SIDEBAR_LEFT + aRect = mPages[nPageNum-1]->eSidebarPosition == sw::sidebarwindows::SidebarPosition::LEFT ? Rectangle(Point(aPageFrm.Left()-GetSidebarWidth()-GetSidebarBorderWidth(),aPageFrm.Top()),Size(GetSidebarWidth(),aPageFrm.Height())) : Rectangle( Point(aPageFrm.Right()+GetSidebarBorderWidth(),aPageFrm.Top()) , Size(GetSidebarWidth(),aPageFrm.Height())); if (aRect.IsInside(aPoint)) @@ -1676,7 +1676,7 @@ bool SwPostItMgr::IsHit(const Point &aPointPixel) Rectangle SwPostItMgr::GetBottomScrollRect(const unsigned long aPage) const { SwRect aPageRect = mPages[aPage-1]->mPageRect; - Point aPointBottom = mPages[aPage-1]->eSidebarPosition == sw::sidebarwindows::SIDEBAR_LEFT + Point aPointBottom = mPages[aPage-1]->eSidebarPosition == sw::sidebarwindows::SidebarPosition::LEFT ? Point(aPageRect.Left() - GetSidebarWidth() - GetSidebarBorderWidth() + mpEditWin->PixelToLogic(Size(2,0)).Width(),aPageRect.Bottom()- mpEditWin->PixelToLogic(Size(0,2+GetSidebarScrollerHeight())).Height()) : Point(aPageRect.Right() + GetSidebarBorderWidth() + mpEditWin->PixelToLogic(Size(2,0)).Width(),aPageRect.Bottom()- mpEditWin->PixelToLogic(Size(0,2+GetSidebarScrollerHeight())).Height()); Size aSize(GetSidebarWidth() - mpEditWin->PixelToLogic(Size(4,0)).Width(), mpEditWin->PixelToLogic(Size(0,GetSidebarScrollerHeight())).Height()) ; @@ -1686,7 +1686,7 @@ Rectangle SwPostItMgr::GetBottomScrollRect(const unsigned long aPage) const Rectangle SwPostItMgr::GetTopScrollRect(const unsigned long aPage) const { SwRect aPageRect = mPages[aPage-1]->mPageRect; - Point aPointTop = mPages[aPage-1]->eSidebarPosition == sw::sidebarwindows::SIDEBAR_LEFT + Point aPointTop = mPages[aPage-1]->eSidebarPosition == sw::sidebarwindows::SidebarPosition::LEFT ? Point(aPageRect.Left() - GetSidebarWidth() -GetSidebarBorderWidth()+ mpEditWin->PixelToLogic(Size(2,0)).Width(),aPageRect.Top() + mpEditWin->PixelToLogic(Size(0,2)).Height()) : Point(aPageRect.Right() + GetSidebarBorderWidth() + mpEditWin->PixelToLogic(Size(2,0)).Width(),aPageRect.Top() + mpEditWin->PixelToLogic(Size(0,2)).Height()); Size aSize(GetSidebarWidth() - mpEditWin->PixelToLogic(Size(4,0)).Width(), mpEditWin->PixelToLogic(Size(0,GetSidebarScrollerHeight())).Height()) ; @@ -1697,11 +1697,11 @@ Rectangle SwPostItMgr::GetTopScrollRect(const unsigned long aPage) const bool SwPostItMgr::ScrollbarHit(const unsigned long aPage,const Point &aPoint) { SwRect aPageRect = mPages[aPage-1]->mPageRect; - Point aPointBottom = mPages[aPage-1]->eSidebarPosition == sw::sidebarwindows::SIDEBAR_LEFT + Point aPointBottom = mPages[aPage-1]->eSidebarPosition == sw::sidebarwindows::SidebarPosition::LEFT ? Point(aPageRect.Left() - GetSidebarWidth()-GetSidebarBorderWidth() + mpEditWin->PixelToLogic(Size(2,0)).Width(),aPageRect.Bottom()- mpEditWin->PixelToLogic(Size(0,2+GetSidebarScrollerHeight())).Height()) : Point(aPageRect.Right() + GetSidebarBorderWidth()+ mpEditWin->PixelToLogic(Size(2,0)).Width(),aPageRect.Bottom()- mpEditWin->PixelToLogic(Size(0,2+GetSidebarScrollerHeight())).Height()); - Point aPointTop = mPages[aPage-1]->eSidebarPosition == sw::sidebarwindows::SIDEBAR_LEFT + Point aPointTop = mPages[aPage-1]->eSidebarPosition == sw::sidebarwindows::SidebarPosition::LEFT ? Point(aPageRect.Left() - GetSidebarWidth()-GetSidebarBorderWidth()+ mpEditWin->PixelToLogic(Size(2,0)).Width(),aPageRect.Top() + mpEditWin->PixelToLogic(Size(0,2)).Height()) : Point(aPageRect.Right()+GetSidebarBorderWidth()+ mpEditWin->PixelToLogic(Size(2,0)).Width(),aPageRect.Top() + mpEditWin->PixelToLogic(Size(0,2)).Height()); @@ -1764,7 +1764,7 @@ void SwPostItMgr::CorrectPositions() // check, if anchor overlay object exists. if ( (*i)->bShow && (*i)->pPostIt && (*i)->pPostIt->Anchor() ) { - aAnchorPosX = mPages[n]->eSidebarPosition == sw::sidebarwindows::SIDEBAR_LEFT + aAnchorPosX = mPages[n]->eSidebarPosition == sw::sidebarwindows::SidebarPosition::LEFT ? mpEditWin->LogicToPixel( Point((long)((*i)->pPostIt->Anchor()->GetSeventhPosition().getX()),0)).X() : mpEditWin->LogicToPixel( Point((long)((*i)->pPostIt->Anchor()->GetSixthPosition().getX()),0)).X(); aAnchorPosY = mpEditWin->LogicToPixel( Point(0,(long)((*i)->pPostIt->Anchor()->GetSixthPosition().getY()))).Y() + 1; diff --git a/sw/source/uibase/docvw/SidebarWin.cxx b/sw/source/uibase/docvw/SidebarWin.cxx index 6fd6c992e4cd..60405050f1b6 100644 --- a/sw/source/uibase/docvw/SidebarWin.cxx +++ b/sw/source/uibase/docvw/SidebarWin.cxx @@ -113,7 +113,7 @@ SwSidebarWin::SwSidebarWin( SwEditWin& rEditWin, , mColorDark() , mColorLight() , mChangeColor() - , meSidebarPosition( sw::sidebarwindows::SIDEBAR_NONE ) + , meSidebarPosition( sw::sidebarwindows::SidebarPosition::NONE ) , mPosSize() , mAnchorRect() , mPageBorder( 0 ) @@ -542,13 +542,13 @@ void SwSidebarWin::SetPosAndSize() Point aLineEnd ; switch ( meSidebarPosition ) { - case sw::sidebarwindows::SIDEBAR_LEFT: + case sw::sidebarwindows::SidebarPosition::LEFT: { aLineStart = EditWin()->PixelToLogic( Point(GetPosPixel().X()+GetSizePixel().Width(),GetPosPixel().Y()-1) ); aLineEnd = EditWin()->PixelToLogic( Point(GetPosPixel().X(),GetPosPixel().Y()-1) ); } break; - case sw::sidebarwindows::SIDEBAR_RIGHT: + case sw::sidebarwindows::SidebarPosition::RIGHT: { aLineStart = EditWin()->PixelToLogic( Point(GetPosPixel().X(),GetPosPixel().Y()-1) ); aLineEnd = EditWin()->PixelToLogic( Point(GetPosPixel().X()+GetSizePixel().Width(),GetPosPixel().Y()-1) ); -- cgit