From 0f4ac20e0456b32995f7a3aff4e46b59e64704a6 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 11 May 2016 10:37:46 +0200 Subject: Convert RulerType to scoped enum Change-Id: I2233b70e5413bfa3156011e1b3306d539003795b Reviewed-on: https://gerrit.libreoffice.org/24879 Tested-by: Jenkins Reviewed-by: Noel Grandin --- include/svtools/ruler.hxx | 64 ++++++++++++------------- sd/source/ui/view/sdruler.cxx | 2 +- svtools/source/control/ruler.cxx | 60 ++++++++++++------------ svx/source/dialog/svxruler.cxx | 93 +++++++++++++++++++------------------ sw/source/uibase/docvw/edtwin3.cxx | 8 ++-- sw/source/uibase/uiview/viewmdi.cxx | 10 ++-- 6 files changed, 119 insertions(+), 118 deletions(-) diff --git a/include/svtools/ruler.hxx b/include/svtools/ruler.hxx index d18ae426eeb5..60436bbad4a6 100644 --- a/include/svtools/ruler.hxx +++ b/include/svtools/ruler.hxx @@ -244,11 +244,11 @@ it has been dragged. There are the following query methods: - GetDragType() Returns what has been dragged. - RULER_TYPE_MARGIN1 - RULER_TYPE_MARGIN2 - RULER_TYPE_BORDER - RULER_TYPE_INDENT - RULER_TYPE_TAB + RulerType::Margin1 + RulerType::Margin2 + RulerType::Border + RulerType::Indent + RulerType::Tab - GetDragPos() Returns the pixel position to which the user has moved the mouse @@ -298,13 +298,13 @@ it has been dragged. There are the following query methods: - GetClickType() Returns what is applied by double click: - RULER_TYPE_DONTKNOW (no element in the ruler area) - RULER_TYPE_OUTSIDE (outside of the ruler area) - RULER_TYPE_MARGIN1 (only Margin1 border) - RULER_TYPE_MARGIN2 (only Margin2 border) - RULER_TYPE_BORDER (Border: GetClickAryPos()) - RULER_TYPE_INDENT (indent: GetClickAryPos()) - RULER_TYPE_TAB (Tab: GetClickAryPos()) + RulerType::DontKnow (no element in the ruler area) + RulerType::Outside (outside of the ruler area) + RulerType::Margin1 (only Margin1 border) + RulerType::Margin2 (only Margin2 border) + RulerType::Border (Border: GetClickAryPos()) + RulerType::Indent (indent: GetClickAryPos()) + RulerType::Tab (Tab: GetClickAryPos()) - GetClickAryPos() Returns the index in the array if a Border, an Indent or a Tab @@ -318,13 +318,13 @@ it has been dragged. There are the following query methods: sal_uInt16 are passed, in order to determine the array position of a Tab, an Indent, or a Border. The following values are returned as type: - RULER_TYPE_DONTKNOW (no element in the ruler area) - RULER_TYPE_OUTSIDE (outside of the ruler area) - RULER_TYPE_MARGIN1 (only Margin1 border) - RULER_TYPE_MARGIN2 (only Margin2 border) - RULER_TYPE_BORDER (Border: GetClickAryPos()) - RULER_TYPE_INDENT (indent: GetClickAryPos()) - RULER_TYPE_TAB (Tab: GetClickAryPos()) + RulerType::DontKnow (no element in the ruler area) + RulerType::Outside (outside of the ruler area) + RulerType::Margin1 (only Margin1 border) + RulerType::Margin2 (only Margin2 border) + RulerType::Border (Border: GetClickAryPos()) + RulerType::Indent (indent: GetClickAryPos()) + RulerType::Tab (Tab: GetClickAryPos()) If the drag process should be canceled, this can be done using CancelDrag(). There are the following methods for controlling the Drag: @@ -342,7 +342,7 @@ methods: - StartDocDrag() This method is passed the MouseEvent of the document window - and what should be dragged. If RULER_TYPE_DONTKNOW is passed + and what should be dragged. If RulerType::DontKnow is passed as DragType, the ruler decides what should be dragged. In case of the other types, the Drag is only started if a respective element was found at the given position. @@ -435,22 +435,22 @@ Tips for the use of the ruler: multiple of one value because the screen resolution is very imprecise. - DoubleClicks should be handled in the following way (GetClickType()): - - RULER_TYPE_DONTKNOW - RULER_TYPE_MARGIN1 - RULER_TYPE_MARGIN2 + - RulerType::DontKnow + RulerType::Margin1 + RulerType::Margin2 If the conditions GetClickPos() <= GetMargin1() or GetClickPos() >= GetMargin2() are met or the type is equal to - RULER_TYPE_MARGIN1 or RULER_TYPE_MARGIN2, a side dialog should + RulerType::Margin1 or RulerType::Margin2, a side dialog should be displayed in which the focus is at the respective border. - - RULER_TYPE_BORDER + - RulerType::Border A column or table dialog should be shown in which the focus is at the respective column that can be queried using GetClickAryPos(). - - RULER_TYPE_INDENT + - RulerType::Indent The dialog, in which the indents can be configured, should be shown. In this, the focus should be on the indent which can be queried using GetClickAryPos(). - - RULER_TYPE_TAB + - RulerType::Tab A TabDialog should be displayed in which the Tab, that can be queried using GetClickAryPos(), should be selected. @@ -462,9 +462,9 @@ Tips for the use of the ruler: #define WB_STDRULER WB_HORZ -enum RulerType { RULER_TYPE_DONTKNOW, RULER_TYPE_OUTSIDE, - RULER_TYPE_MARGIN1, RULER_TYPE_MARGIN2, - RULER_TYPE_BORDER, RULER_TYPE_INDENT, RULER_TYPE_TAB }; +enum class RulerType { DontKnow, Outside, + Margin1, Margin2, + Border, Indent, Tab }; enum class RulerExtra { DontKnow, NullOffset, Tab }; @@ -561,7 +561,7 @@ struct RulerSelection RulerSelection() : nPos(0) - , eType(RULER_TYPE_DONTKNOW) + , eType(RulerType::DontKnow) , nAryPos(0) , mnDragSize(RulerDragSize::Move) , bSize(false) @@ -750,7 +750,7 @@ public: void SetExtraType( RulerExtra eNewExtraType, sal_uInt16 nStyle = 0 ); bool StartDocDrag( const MouseEvent& rMEvt, - RulerType eDragType = RULER_TYPE_DONTKNOW ); + RulerType eDragType = RulerType::DontKnow ); RulerType GetDragType() const { return meDragType; } long GetDragPos() const { return mnDragPos; } sal_uInt16 GetDragAryPos() const { return mnDragAryPos; } diff --git a/sd/source/ui/view/sdruler.cxx b/sd/source/ui/view/sdruler.cxx index 5f3bebf255c5..19efdac3cf02 100644 --- a/sd/source/ui/view/sdruler.cxx +++ b/sd/source/ui/view/sdruler.cxx @@ -111,7 +111,7 @@ void Ruler::MouseButtonDown(const MouseEvent& rMEvt) if ( !pDrViewShell->GetView()->IsTextEdit() && rMEvt.IsLeft() && rMEvt.GetClicks() == 1 && - (eType == RULER_TYPE_DONTKNOW || eType == RULER_TYPE_OUTSIDE) ) + (eType == RulerType::DontKnow || eType == RulerType::Outside) ) { pDrViewShell->StartRulerDrag(*this, rMEvt); } diff --git a/svtools/source/control/ruler.cxx b/svtools/source/control/ruler.cxx index 2c9abac4d231..aa2bf9de9a53 100644 --- a/svtools/source/control/ruler.cxx +++ b/svtools/source/control/ruler.cxx @@ -254,7 +254,7 @@ void Ruler::ImplInit( WinBits nWinBits ) mnUpdateFlags = 0; // What needs to be updated mpData = mpSaveData; // Pointer to normal data meExtraType = RulerExtra::DontKnow; // What is in extra field - meDragType = RULER_TYPE_DONTKNOW; // Which element is dragged + meDragType = RulerType::DontKnow; // Which element is dragged // Initialize Units mnUnitIndex = RULER_UNIT_CM; @@ -854,11 +854,11 @@ void Ruler::ImplDrawIndents(vcl::RenderContext& rRenderContext, long nMin, long if (RulerIndentStyle::Border != nIndentStyle) { bool bIsHit = false; - if(mxCurrentHitTest.get() != nullptr && mxCurrentHitTest->eType == RULER_TYPE_INDENT) + if(mxCurrentHitTest.get() != nullptr && mxCurrentHitTest->eType == RulerType::Indent) { bIsHit = mxCurrentHitTest->nAryPos == j; } - else if(mbDrag && meDragType == RULER_TYPE_INDENT) + else if(mbDrag && meDragType == RulerType::Indent) { bIsHit = mnDragAryPos == j; } @@ -1520,13 +1520,13 @@ bool Ruler::ImplHitTest( const Point& rPos, RulerSelection* pHitTest, (nY > nHitBottom) ) { pHitTest->nPos = 0; - pHitTest->eType = RULER_TYPE_OUTSIDE; + pHitTest->eType = RulerType::Outside; return false; } nX -= mpData->nNullVirOff; pHitTest->nPos = nX; - pHitTest->eType = RULER_TYPE_DONTKNOW; + pHitTest->eType = RulerType::DontKnow; // first test the tabs Rectangle aRect; @@ -1565,7 +1565,7 @@ bool Ruler::ImplHitTest( const Point& rPos, RulerSelection* pHitTest, if ( aRect.IsInside( Point( nX, nY ) ) ) { - pHitTest->eType = RULER_TYPE_TAB; + pHitTest->eType = RulerType::Tab; pHitTest->nAryPos = i; return true; } @@ -1605,7 +1605,7 @@ bool Ruler::ImplHitTest( const Point& rPos, RulerSelection* pHitTest, if ( aRect.IsInside( Point( nX, nY ) ) ) { - pHitTest->eType = RULER_TYPE_INDENT; + pHitTest->eType = RulerType::Indent; pHitTest->nAryPos = i-1; return true; } @@ -1617,7 +1617,7 @@ bool Ruler::ImplHitTest( const Point& rPos, RulerSelection* pHitTest, if ( (nXTemp < mpData->nRulVirOff) || (nXTemp > mpData->nRulVirOff+mpData->nRulWidth) ) { pHitTest->nPos = 0; - pHitTest->eType = RULER_TYPE_OUTSIDE; + pHitTest->eType = RulerType::Outside; return false; } @@ -1646,7 +1646,7 @@ bool Ruler::ImplHitTest( const Point& rPos, RulerSelection* pHitTest, RulerBorderStyle nBorderStyle = mpData->pBorders[i-1].nStyle; if ( !(nBorderStyle & RulerBorderStyle::Invisible) ) { - pHitTest->eType = RULER_TYPE_BORDER; + pHitTest->eType = RulerType::Border; pHitTest->nAryPos = i-1; if ( !(nBorderStyle & RulerBorderStyle::Sizeable) ) @@ -1704,7 +1704,7 @@ bool Ruler::ImplHitTest( const Point& rPos, RulerSelection* pHitTest, n1 = mpData->nMargin1; if ( (nX >= n1 - nMarginTolerance) && (nX <= n1 + nMarginTolerance) ) { - pHitTest->eType = RULER_TYPE_MARGIN1; + pHitTest->eType = RulerType::Margin1; pHitTest->bSize = true; return true; } @@ -1714,7 +1714,7 @@ bool Ruler::ImplHitTest( const Point& rPos, RulerSelection* pHitTest, n1 = mpData->nMargin2; if ( (nX >= n1 - nMarginTolerance) && (nX <= n1 + nMarginTolerance) ) { - pHitTest->eType = RULER_TYPE_MARGIN2; + pHitTest->eType = RulerType::Margin2; pHitTest->bSize = true; return true; } @@ -1759,7 +1759,7 @@ bool Ruler::ImplHitTest( const Point& rPos, RulerSelection* pHitTest, if ( aRect.IsInside( Point( nX, nY ) ) ) { - pHitTest->eType = RULER_TYPE_TAB; + pHitTest->eType = RulerType::Tab; pHitTest->nAryPos = i; return true; } @@ -1778,7 +1778,7 @@ bool Ruler::ImplDocHitTest( const Point& rPos, RulerType eDragType, bool bRequiredStyle = false; RulerIndentStyle nRequiredStyle = RulerIndentStyle::Top; - if (eDragType == RULER_TYPE_INDENT) + if (eDragType == RulerType::Indent) { bRequiredStyle = true; nRequiredStyle = RulerIndentStyle::Bottom; @@ -1789,7 +1789,7 @@ bool Ruler::ImplDocHitTest( const Point& rPos, RulerType eDragType, else aPos.Y() += mnWinOff; - if ( (eDragType == RULER_TYPE_INDENT) || (eDragType == RULER_TYPE_DONTKNOW) ) + if ( (eDragType == RulerType::Indent) || (eDragType == RulerType::DontKnow) ) { if ( mnWinStyle & WB_HORZ ) aPos.Y() = RULER_OFF + 1; @@ -1798,14 +1798,14 @@ bool Ruler::ImplDocHitTest( const Point& rPos, RulerType eDragType, if ( ImplHitTest( aPos, pHitTest, bRequiredStyle, nRequiredStyle ) ) { - if ( (pHitTest->eType == eDragType) || (eDragType == RULER_TYPE_DONTKNOW) ) + if ( (pHitTest->eType == eDragType) || (eDragType == RulerType::DontKnow) ) return true; } } - if ( (eDragType == RULER_TYPE_INDENT) || - (eDragType == RULER_TYPE_TAB) || - (eDragType == RULER_TYPE_DONTKNOW) ) + if ( (eDragType == RulerType::Indent) || + (eDragType == RulerType::Tab) || + (eDragType == RulerType::DontKnow) ) { if ( mnWinStyle & WB_HORZ ) aPos.Y() = mnHeight - RULER_OFF - 1; @@ -1814,13 +1814,13 @@ bool Ruler::ImplDocHitTest( const Point& rPos, RulerType eDragType, if ( ImplHitTest( aPos, pHitTest, bRequiredStyle, nRequiredStyle ) ) { - if ( (pHitTest->eType == eDragType) || (eDragType == RULER_TYPE_DONTKNOW) ) + if ( (pHitTest->eType == eDragType) || (eDragType == RulerType::DontKnow) ) return true; } } - if ( (eDragType == RULER_TYPE_MARGIN1) || (eDragType == RULER_TYPE_MARGIN2) || - (eDragType == RULER_TYPE_BORDER) || (eDragType == RULER_TYPE_DONTKNOW) ) + if ( (eDragType == RulerType::Margin1) || (eDragType == RulerType::Margin2) || + (eDragType == RulerType::Border) || (eDragType == RulerType::DontKnow) ) { if ( mnWinStyle & WB_HORZ ) aPos.Y() = RULER_OFF + (mnVirHeight / 2); @@ -1829,12 +1829,12 @@ bool Ruler::ImplDocHitTest( const Point& rPos, RulerType eDragType, if ( ImplHitTest( aPos, pHitTest ) ) { - if ( (pHitTest->eType == eDragType) || (eDragType == RULER_TYPE_DONTKNOW) ) + if ( (pHitTest->eType == eDragType) || (eDragType == RulerType::DontKnow) ) return true; } } - pHitTest->eType = RULER_TYPE_DONTKNOW; + pHitTest->eType = RulerType::DontKnow; return false; } @@ -1842,7 +1842,7 @@ bool Ruler::ImplDocHitTest( const Point& rPos, RulerType eDragType, bool Ruler::ImplStartDrag( RulerSelection* pHitTest, sal_uInt16 nModifier ) { // don't trigger drag if a border that was clicked can not be changed - if ( (pHitTest->eType == RULER_TYPE_BORDER) && + if ( (pHitTest->eType == RulerType::Border) && !pHitTest->bSize && !pHitTest->bSizeBar ) return false; @@ -1868,7 +1868,7 @@ bool Ruler::ImplStartDrag( RulerSelection* pHitTest, sal_uInt16 nModifier ) else { // otherwise reset the data - meDragType = RULER_TYPE_DONTKNOW; + meDragType = RulerType::DontKnow; mnDragPos = 0; mnDragAryPos = 0; mnDragSize = RulerDragSize::Move; @@ -1969,7 +1969,7 @@ void Ruler::ImplEndDrag() EndDrag(); // reset drag values - meDragType = RULER_TYPE_DONTKNOW; + meDragType = RulerType::DontKnow; mnDragPos = 0; mnDragAryPos = 0; mnDragSize = RulerDragSize::Move; @@ -2018,7 +2018,7 @@ void Ruler::MouseButtonDown( const MouseEvent& rMEvt ) else { // calculate position inside of ruler area - if ( pHitTest->eType == RULER_TYPE_DONTKNOW ) + if ( pHitTest->eType == RulerType::DontKnow ) { mnDragPos = pHitTest->nPos; Click(); @@ -2041,7 +2041,7 @@ void Ruler::MouseButtonDown( const MouseEvent& rMEvt ) DoubleClick(); - meDragType = RULER_TYPE_DONTKNOW; + meDragType = RulerType::DontKnow; mnDragPos = 0; mnDragAryPos = 0; } @@ -2057,7 +2057,7 @@ void Ruler::MouseMove( const MouseEvent& rMEvt ) mxCurrentHitTest.reset(new RulerSelection); - maHoverSelection.eType = RULER_TYPE_DONTKNOW; + maHoverSelection.eType = RulerType::DontKnow; if (ImplHitTest( rMEvt.GetPosPixel(), mxCurrentHitTest.get() )) { @@ -2314,7 +2314,7 @@ bool Ruler::StartDocDrag( const MouseEvent& rMEvt, RulerType eDragType ) sal_uInt16 nMouseModifier = rMEvt.GetModifier(); RulerSelection aHitTest; - if(eDragType != RULER_TYPE_DONTKNOW) + if(eDragType != RulerType::DontKnow) aHitTest.bExpandTest = true; // update ruler diff --git a/svx/source/dialog/svxruler.cxx b/svx/source/dialog/svxruler.cxx index cce37b1254d0..bdbfa8658f2d 100644 --- a/svx/source/dialog/svxruler.cxx +++ b/svx/source/dialog/svxruler.cxx @@ -597,7 +597,7 @@ void SvxRuler::MouseMove( const MouseEvent& rMEvt ) RulerSelection aSelection = GetHoverSelection(); - if (aSelection.eType == RULER_TYPE_DONTKNOW) + if (aSelection.eType == RulerType::DontKnow) { SetQuickHelpText(""); return; @@ -610,7 +610,7 @@ void SvxRuler::MouseMove( const MouseEvent& rMEvt ) switch (aSelection.eType) { - case RULER_TYPE_INDENT: + case RulerType::Indent: { if (!mxParaItem.get()) break; @@ -631,7 +631,7 @@ void SvxRuler::MouseMove( const MouseEvent& rMEvt ) SetQuickHelpText(OUString::number(fValue) + " " + sUnit); break; } - case RULER_TYPE_BORDER: + case RulerType::Border: { if (mxColumnItem.get() == nullptr) break; @@ -651,7 +651,7 @@ void SvxRuler::MouseMove( const MouseEvent& rMEvt ) OUString::number(fEnd) + " " + sUnit ); break; } - case RULER_TYPE_MARGIN1: + case RulerType::Margin1: { long nLeft = 0.0; if (mxLRSpaceItem.get()) @@ -667,7 +667,7 @@ void SvxRuler::MouseMove( const MouseEvent& rMEvt ) break; } - case RULER_TYPE_MARGIN2: + case RulerType::Margin2: { long nRight = 0.0; if (mxLRSpaceItem.get()) @@ -1745,7 +1745,7 @@ void SvxRuler::DragBorders() bool bRightIndentsCorrected = false; int nIndex; - if(GetDragType() == RULER_TYPE_BORDER) + if(GetDragType() == RulerType::Border) { DrawLine_Impl(lTabPos, 7, bHorz); nIndex = GetDragAryPos(); @@ -1766,10 +1766,10 @@ void SvxRuler::DragBorders() case RulerDragSize::Move: { ADD_DEBUG_TEXT("lLastLMargin: ", OUString::number(mxRulerImpl->lLastLMargin)) - if(GetDragType() == RULER_TYPE_BORDER) + if(GetDragType() == RulerType::Border) lDiff = lPos - nDragOffset - mpBorders[nIndex].nPos; else - lDiff = GetDragType() == RULER_TYPE_MARGIN1 ? lPos - mxRulerImpl->lLastLMargin : lPos - mxRulerImpl->lLastRMargin; + lDiff = GetDragType() == RulerType::Margin1 ? lPos - mxRulerImpl->lLastLMargin : lPos - mxRulerImpl->lLastRMargin; if(nDragType & SvxRulerDragFlags::OBJECT_SIZE_LINEAR) { @@ -1804,7 +1804,7 @@ ADD_DEBUG_TEXT("lLastLMargin: ", OUString::number(mxRulerImpl->lLastLMargin)) default: ;//prevent warning OSL_FAIL("svx::SvxRuler::DragBorders(), unknown drag type!" ); SAL_FALLTHROUGH; - case RULER_TYPE_BORDER: + case RulerType::Border: if(mxRulerImpl->bIsTableRows) { mpBorders[nIndex].nPos += lDiff; @@ -1830,12 +1830,12 @@ ADD_DEBUG_TEXT("lLastLMargin: ", OUString::number(mxRulerImpl->lLastLMargin)) mxRulerImpl->nTotalDist -= lDiff; } break; - case RULER_TYPE_MARGIN1: + case RulerType::Margin1: nLimit = 0; lLeft = mxRulerImpl->lLastLMargin + lDiff; mxRulerImpl->nTotalDist -= lDiff; break; - case RULER_TYPE_MARGIN2: + case RulerType::Margin2: nLimit = 0; lLeft= 0; nStartLimit = mpBorders.size() - 2; @@ -1893,7 +1893,7 @@ ADD_DEBUG_TEXT("lLastLMargin: ", OUString::number(mxRulerImpl->lLastLMargin)) //This includes the left border when the table is not limited //to a lower frame border. int nLimit; - if(GetDragType()==RULER_TYPE_BORDER) + if(GetDragType()==RulerType::Border) { nLimit = nIndex + 1; mpBorders[nIndex].nPos += lDiff; @@ -2348,11 +2348,11 @@ void SvxRuler::PrepareProportional_Impl(RulerType eType) proportional share of the total width in parts per thousand. */ mxRulerImpl->nTotalDist = GetMargin2(); - switch((int)eType) + switch(eType) { - case RULER_TYPE_MARGIN2: - case RULER_TYPE_MARGIN1: - case RULER_TYPE_BORDER: + case RulerType::Margin2: + case RulerType::Margin1: + case RulerType::Border: { DBG_ASSERT(mxColumnItem.get(), "no ColumnItem"); @@ -2366,7 +2366,7 @@ void SvxRuler::PrepareProportional_Impl(RulerType eType) long lActBorderSum; long lOrigLPos; - if(eType != RULER_TYPE_BORDER) + if(eType != RulerType::Border) { lOrigLPos = GetMargin1(); nStart = 0; @@ -2390,7 +2390,7 @@ void SvxRuler::PrepareProportional_Impl(RulerType eType) //in horizontal mode the percentage value has to be //calculated on a "current change" position base //because the height of the table changes while dragging - if(mxRulerImpl->bIsTableRows && RULER_TYPE_BORDER == eType) + if(mxRulerImpl->bIsTableRows && RulerType::Border == eType) { sal_uInt16 nStartBorder; sal_uInt16 nEndBorder; @@ -2451,7 +2451,7 @@ void SvxRuler::PrepareProportional_Impl(RulerType eType) } } break; - case RULER_TYPE_TAB: + case RulerType::Tab: { const sal_uInt16 nIdx = GetDragAryPos()+TAB_GAP; mxRulerImpl->nTotalDist -= mpTabs[nIdx].nPos; @@ -2464,6 +2464,7 @@ void SvxRuler::PrepareProportional_Impl(RulerType eType) } break; } + default: break; } } @@ -2501,10 +2502,10 @@ void SvxRuler::EvalModifier() { const RulerType eType = GetDragType(); nDragType = SvxRulerDragFlags::OBJECT_SIZE_PROPORTIONAL; - if( RULER_TYPE_TAB == eType || - ( ( RULER_TYPE_BORDER == eType || - RULER_TYPE_MARGIN1 == eType || - RULER_TYPE_MARGIN2 == eType ) && + if( RulerType::Tab == eType || + ( ( RulerType::Border == eType || + RulerType::Margin1 == eType || + RulerType::Margin2 == eType ) && mxColumnItem.get() ) ) { PrepareProportional_Impl(eType); @@ -2512,8 +2513,8 @@ void SvxRuler::EvalModifier() } break; case KEY_MOD1 | KEY_SHIFT: - if( GetDragType() != RULER_TYPE_MARGIN1 && - GetDragType() != RULER_TYPE_MARGIN2 ) + if( GetDragType() != RulerType::Margin1 && + GetDragType() != RulerType::Margin2 ) { nDragType = SvxRulerDragFlags::OBJECT_ACTLINE_ONLY; } @@ -2595,7 +2596,7 @@ void SvxRuler::CalcMinMax() mxRulerImpl->lMaxLeftLogic=mxRulerImpl->lMaxRightLogic=-1; switch(GetDragType()) { - case RULER_TYPE_MARGIN1: + case RulerType::Margin1: { // left edge of the surrounding Frame // DragPos - NOf between left - right mxRulerImpl->lMaxLeftLogic = GetLeftMin(); @@ -2684,7 +2685,7 @@ void SvxRuler::CalcMinMax() } break; } - case RULER_TYPE_MARGIN2: + case RulerType::Margin2: { // right edge of the surrounding Frame mxRulerImpl->lMaxRightLogic = mxMinMaxItem.get() ? @@ -2765,7 +2766,7 @@ void SvxRuler::CalcMinMax() } break; } - case RULER_TYPE_BORDER: + case RulerType::Border: { // Table, column (Modifier) const sal_uInt16 nIdx = GetDragAryPos(); switch(GetDragSize()) @@ -3014,7 +3015,7 @@ void SvxRuler::CalcMinMax() nMaxRight += nDragOffset; break; } - case RULER_TYPE_INDENT: + case RulerType::Indent: { const sal_uInt16 nIdx = GetDragAryPos(); switch(nIdx) { @@ -3103,7 +3104,7 @@ void SvxRuler::CalcMinMax() } break; } - case RULER_TYPE_TAB: // Tabs (Modifier) + case RulerType::Tab: // Tabs (Modifier) /* left = NOf + Max(LAR, EZ) right = NOf + RAR */ @@ -3144,8 +3145,8 @@ bool SvxRuler::StartDrag() lInitialDragPos = GetDragPos(); switch(GetDragType()) { - case RULER_TYPE_MARGIN1: // left edge of the surrounding Frame - case RULER_TYPE_MARGIN2: // right edge of the surrounding Frame + case RulerType::Margin1: // left edge of the surrounding Frame + case RulerType::Margin2: // right edge of the surrounding Frame if((bHorz && mxLRSpaceItem.get()) || (!bHorz && mxULSpaceItem.get())) { if(!mxColumnItem.get()) @@ -3158,7 +3159,7 @@ bool SvxRuler::StartDrag() bOk = false; } break; - case RULER_TYPE_BORDER: // Table, column (Modifier) + case RulerType::Border: // Table, column (Modifier) if(mxColumnItem.get()) { nDragOffset = 0; @@ -3169,7 +3170,7 @@ bool SvxRuler::StartDrag() else nDragOffset = 0; break; - case RULER_TYPE_INDENT: // Paragraph indents (Modifier) + case RulerType::Indent: // Paragraph indents (Modifier) { if( bContentProtected ) return false; @@ -3185,7 +3186,7 @@ bool SvxRuler::StartDrag() mpIndents[1] = mpIndents[GetDragAryPos() + INDENT_GAP]; break; } - case RULER_TYPE_TAB: // Tabs (Modifier) + case RulerType::Tab: // Tabs (Modifier) if( bContentProtected ) return false; EvalModifier(); @@ -3211,24 +3212,24 @@ void SvxRuler::Drag() return; } switch(GetDragType()) { - case RULER_TYPE_MARGIN1: // left edge of the surrounding Frame + case RulerType::Margin1: // left edge of the surrounding Frame DragMargin1(); mxRulerImpl->lLastLMargin = GetMargin1(); break; - case RULER_TYPE_MARGIN2: // right edge of the surrounding Frame + case RulerType::Margin2: // right edge of the surrounding Frame DragMargin2(); mxRulerImpl->lLastRMargin = GetMargin2(); break; - case RULER_TYPE_INDENT: // Paragraph indents + case RulerType::Indent: // Paragraph indents DragIndents(); break; - case RULER_TYPE_BORDER: // Table, columns + case RulerType::Border: // Table, columns if(mxColumnItem.get()) DragBorders(); else if(mxObjectItem.get()) DragObjectBorder(); break; - case RULER_TYPE_TAB: // Tabs + case RulerType::Tab: // Tabs DragTabs(); break; default: @@ -3253,8 +3254,8 @@ void SvxRuler::EndDrag() { switch(GetDragType()) { - case RULER_TYPE_MARGIN1: // upper left edge of the surrounding Frame - case RULER_TYPE_MARGIN2: // lower right edge of the surrounding Frame + case RulerType::Margin1: // upper left edge of the surrounding Frame + case RulerType::Margin2: // lower right edge of the surrounding Frame { if(!mxColumnItem.get() || !mxColumnItem->IsTable()) ApplyMargins(); @@ -3266,7 +3267,7 @@ void SvxRuler::EndDrag() } break; - case RULER_TYPE_BORDER: // Table, columns + case RulerType::Border: // Table, columns if(lInitialDragPos != lPos || (mxRulerImpl->bIsTableRows && bHorz)) //special case - the null offset is changed here { @@ -3280,12 +3281,12 @@ void SvxRuler::EndDrag() ApplyObject(); } break; - case RULER_TYPE_INDENT: // Paragraph indents + case RulerType::Indent: // Paragraph indents if(lInitialDragPos != lPos) ApplyIndents(); SetIndents(INDENT_COUNT, &mpIndents[0] + INDENT_GAP); break; - case RULER_TYPE_TAB: // Tabs + case RulerType::Tab: // Tabs { ApplyTabs(); mpTabs[GetDragAryPos()].nStyle &= ~RULER_STYLE_INVISIBLE; @@ -3382,7 +3383,7 @@ void SvxRuler::Command( const CommandEvent& rCommandEvent ) CancelDrag(); bool bRTL = mxRulerImpl->pTextRTLItem && mxRulerImpl->pTextRTLItem->GetValue(); if ( !mpTabs.empty() && - RULER_TYPE_TAB == + RulerType::Tab == GetType( rCommandEvent.GetMousePosPixel(), &mxRulerImpl->nIdx ) && mpTabs[mxRulerImpl->nIdx + TAB_GAP].nStyle < RULER_TAB_DEFAULT ) { diff --git a/sw/source/uibase/docvw/edtwin3.cxx b/sw/source/uibase/docvw/edtwin3.cxx index 07037d57ed3a..745bbd4ca864 100644 --- a/sw/source/uibase/docvw/edtwin3.cxx +++ b/sw/source/uibase/docvw/edtwin3.cxx @@ -86,9 +86,9 @@ void FrameNotify( SwViewShell* pVwSh, FlyMode eMode ) bool SwEditWin::RulerColumnDrag( const MouseEvent& rMEvt, bool bVerticalMode) { SvxRuler& rRuler = bVerticalMode ? m_rView.GetVRuler() : m_rView.GetHRuler(); - return (!rRuler.StartDocDrag( rMEvt, RULER_TYPE_BORDER ) && - !rRuler.StartDocDrag( rMEvt, RULER_TYPE_MARGIN1) && - !rRuler.StartDocDrag( rMEvt, RULER_TYPE_MARGIN2)); + return (!rRuler.StartDocDrag( rMEvt, RulerType::Border ) && + !rRuler.StartDocDrag( rMEvt, RulerType::Margin1) && + !rRuler.StartDocDrag( rMEvt, RulerType::Margin2)); } // #i23726# @@ -98,7 +98,7 @@ bool SwEditWin::RulerMarginDrag( const MouseEvent& rMEvt, const bool bVerticalMode ) { SvxRuler& rRuler = bVerticalMode ? m_rView.GetVRuler() : m_rView.GetHRuler(); - return !rRuler.StartDocDrag( rMEvt, RULER_TYPE_INDENT); + return !rRuler.StartDocDrag( rMEvt, RulerType::Indent); } TableChgMode GetTableChgDefaultMode() diff --git a/sw/source/uibase/uiview/viewmdi.cxx b/sw/source/uibase/uiview/viewmdi.cxx index 18023fd3e1df..33812bb0beed 100644 --- a/sw/source/uibase/uiview/viewmdi.cxx +++ b/sw/source/uibase/uiview/viewmdi.cxx @@ -523,11 +523,11 @@ IMPL_LINK_TYPED( SwView, ExecRulerClick, Ruler *, pRuler, void ) OUString sDefPage; switch( pRuler->GetClickType() ) { - case RULER_TYPE_DONTKNOW: - case RULER_TYPE_OUTSIDE: - case RULER_TYPE_INDENT: - case RULER_TYPE_MARGIN1: - case RULER_TYPE_MARGIN2: + case RulerType::DontKnow: + case RulerType::Outside: + case RulerType::Indent: + case RulerType::Margin1: + case RulerType::Margin2: sDefPage = "indents"; break; default: -- cgit