summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2014-10-12 18:42:14 +0200
committerNoel Grandin <noelgrandin@gmail.com>2014-10-13 06:54:23 +0000
commitedb6783c14a9303af000b54ce63f55967289a7a6 (patch)
treedfb843caf6019b7c9922c7122d3becea75832b17
parenteadc132d5fa339b6fe5b2f8bb482ed30dbd23147 (diff)
convert SW_TAB #defines to enum
Change-Id: I8f2c63dc381416af1eb74794a1bbc3417eb272d6 Reviewed-on: https://gerrit.libreoffice.org/11936 Tested-by: LibreOffice gerrit bot <gerrit@libreoffice.org> Reviewed-by: Norbert Thiebaud <nthiebaud@gmail.com> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
-rw-r--r--sw/inc/authratr.hxx2
-rw-r--r--sw/inc/fesh.hxx33
-rw-r--r--sw/source/core/access/accpara.cxx2
-rw-r--r--sw/source/core/frmedt/fetab.cxx24
-rw-r--r--sw/source/ui/config/optpage.cxx12
-rw-r--r--sw/source/uibase/app/swmodul1.cxx2
-rw-r--r--sw/source/uibase/docvw/edtwin.cxx47
-rw-r--r--sw/source/uibase/docvw/edtwin2.cxx27
8 files changed, 77 insertions, 72 deletions
diff --git a/sw/inc/authratr.hxx b/sw/inc/authratr.hxx
index 3bd8bde98858..188da163ac90 100644
--- a/sw/inc/authratr.hxx
+++ b/sw/inc/authratr.hxx
@@ -24,7 +24,7 @@
#include <tools/color.hxx>
#include "swdllapi.h"
-#define COL_NONE TRGB_COLORDATA( 0x80, 0xFF, 0xFF, 0xFF )
+#define COL_NONE_COLOR TRGB_COLORDATA( 0x80, 0xFF, 0xFF, 0xFF )
class SW_DLLPUBLIC AuthorCharAttr
{
diff --git a/sw/inc/fesh.hxx b/sw/inc/fesh.hxx
index f01e2d5c4722..4896406e76a4 100644
--- a/sw/inc/fesh.hxx
+++ b/sw/inc/fesh.hxx
@@ -151,20 +151,23 @@ enum class SwMove
RIGHT = 3
};
-#define SW_TABCOL_NONE 0
-#define SW_TABCOL_HORI 1
-#define SW_TABCOL_VERT 2
-#define SW_TABROW_HORI 3
-#define SW_TABROW_VERT 4
-
-#define SW_TABSEL_HORI 5
-#define SW_TABSEL_HORI_RTL 6
-#define SW_TABROWSEL_HORI 7
-#define SW_TABROWSEL_HORI_RTL 8
-#define SW_TABCOLSEL_HORI 9
-#define SW_TABSEL_VERT 10
-#define SW_TABROWSEL_VERT 11
-#define SW_TABCOLSEL_VERT 12
+// return values for WhichMouseTabCol
+enum class SwTab
+{
+ COL_NONE = 0,
+ COL_HORI = 1,
+ COL_VERT = 2,
+ ROW_HORI = 3,
+ ROW_VERT = 4,
+ SEL_HORI = 5,
+ SEL_HORI_RTL = 6,
+ ROWSEL_HORI = 7,
+ ROWSEL_HORI_RTL = 8,
+ COLSEL_HORI = 9,
+ SEL_VERT = 10,
+ ROWSEL_VERT = 11,
+ COLSEL_VERT = 12
+};
class SdrDropMarkerOverlay;
@@ -633,7 +636,7 @@ public:
void SetRowBackground( const SvxBrushItem &rNew );
bool GetRowBackground( SvxBrushItem &rToFill ) const; ///< FALSE ambiguous.
- sal_uInt8 WhichMouseTabCol( const Point &rPt ) const;
+ SwTab WhichMouseTabCol( const Point &rPt ) const;
void GetTabCols( SwTabCols &rToFill ) const; ///< Info about columns and margins.
void SetTabCols( const SwTabCols &rNew, bool bCurRowOnly = true );
void GetMouseTabCols( SwTabCols &rToFill, const Point &rPt ) const;
diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx
index dee3966db56b..b4fe38f066bb 100644
--- a/sw/source/core/access/accpara.cxx
+++ b/sw/source/core/access/accpara.cxx
@@ -2215,7 +2215,7 @@ void SwAccessibleParagraph::_correctValues( const sal_Int32 nIndex,
ChangeAttr.Value <<= aChangeAttr.nAttr; //underline line
break;
}
- if( aChangeAttr.nColor != COL_NONE )
+ if( aChangeAttr.nColor != COL_NONE_COLOR )
{
if( aChangeAttr.nItemId == SID_ATTR_BRUSH )
{
diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx
index cddae56cac54..f84d21028567 100644
--- a/sw/source/core/frmedt/fetab.cxx
+++ b/sw/source/core/frmedt/fetab.cxx
@@ -1852,9 +1852,9 @@ bool SwFEShell::SelTblRowCol( const Point& rPt, const Point* pEnd, bool bRowDrag
return bRet;
}
-sal_uInt8 SwFEShell::WhichMouseTabCol( const Point &rPt ) const
+SwTab SwFEShell::WhichMouseTabCol( const Point &rPt ) const
{
- sal_uInt8 nRet = SW_TABCOL_NONE;
+ SwTab nRet = SwTab::COL_NONE;
bool bRow = false;
bool bCol = false;
bool bSelect = false;
@@ -1883,9 +1883,9 @@ sal_uInt8 SwFEShell::WhichMouseTabCol( const Point &rPt ) const
if ( !bSelect )
{
if ( pFrm->IsVertical() )
- nRet = bRow ? SW_TABCOL_VERT : SW_TABROW_VERT;
+ nRet = bRow ? SwTab::COL_VERT : SwTab::ROW_VERT;
else
- nRet = bRow ? SW_TABROW_HORI : SW_TABCOL_HORI;
+ nRet = bRow ? SwTab::ROW_HORI : SwTab::COL_HORI;
}
else
{
@@ -1894,15 +1894,15 @@ sal_uInt8 SwFEShell::WhichMouseTabCol( const Point &rPt ) const
{
if ( bRow && bCol )
{
- nRet = SW_TABSEL_VERT;
+ nRet = SwTab::SEL_VERT;
}
else if ( bRow )
{
- nRet = SW_TABROWSEL_VERT;
+ nRet = SwTab::ROWSEL_VERT;
}
else if ( bCol )
{
- nRet = SW_TABCOLSEL_VERT;
+ nRet = SwTab::COLSEL_VERT;
}
}
else
@@ -1910,18 +1910,18 @@ sal_uInt8 SwFEShell::WhichMouseTabCol( const Point &rPt ) const
if ( bRow && bCol )
{
nRet = pTabFrm->IsRightToLeft() ?
- SW_TABSEL_HORI_RTL :
- SW_TABSEL_HORI;
+ SwTab::SEL_HORI_RTL :
+ SwTab::SEL_HORI;
}
else if ( bRow )
{
nRet = pTabFrm->IsRightToLeft() ?
- SW_TABROWSEL_HORI_RTL :
- SW_TABROWSEL_HORI;
+ SwTab::ROWSEL_HORI_RTL :
+ SwTab::ROWSEL_HORI;
}
else if ( bCol )
{
- nRet = SW_TABCOLSEL_HORI;
+ nRet = SwTab::COLSEL_HORI;
}
}
}
diff --git a/sw/source/ui/config/optpage.cxx b/sw/source/ui/config/optpage.cxx
index 9d7a6f408e65..cca1d2873316 100644
--- a/sw/source/ui/config/optpage.cxx
+++ b/sw/source/ui/config/optpage.cxx
@@ -1761,7 +1761,7 @@ bool SwRedlineOptionsTabPage::FillItemSet( SfxItemSet* )
switch (nPos)
{
case 0:
- aInsertedAttr.nColor = COL_NONE;
+ aInsertedAttr.nColor = COL_NONE_COLOR;
break;
case 1:
case LISTBOX_ENTRY_NOTFOUND:
@@ -1787,7 +1787,7 @@ bool SwRedlineOptionsTabPage::FillItemSet( SfxItemSet* )
switch (nPos)
{
case 0:
- aDeletedAttr.nColor = COL_NONE;
+ aDeletedAttr.nColor = COL_NONE_COLOR;
break;
case 1:
case LISTBOX_ENTRY_NOTFOUND:
@@ -1813,7 +1813,7 @@ bool SwRedlineOptionsTabPage::FillItemSet( SfxItemSet* )
switch (nPos)
{
case 0:
- aChangedAttr.nColor = COL_NONE;
+ aChangedAttr.nColor = COL_NONE_COLOR;
break;
case 1:
case LISTBOX_ENTRY_NOTFOUND:
@@ -1910,7 +1910,7 @@ void SwRedlineOptionsTabPage::Reset( const SfxItemSet* )
case COL_TRANSPARENT:
pInsertColorLB->SelectEntryPos(1);
break;
- case COL_NONE:
+ case COL_NONE_COLOR:
pInsertColorLB->SelectEntryPos(0);
break;
default:
@@ -1924,7 +1924,7 @@ void SwRedlineOptionsTabPage::Reset( const SfxItemSet* )
case COL_TRANSPARENT:
pDeletedColorLB->SelectEntryPos(1);
break;
- case COL_NONE:
+ case COL_NONE_COLOR:
pDeletedColorLB->SelectEntryPos(0);
break;
default:
@@ -1938,7 +1938,7 @@ void SwRedlineOptionsTabPage::Reset( const SfxItemSet* )
case COL_TRANSPARENT:
pChangedColorLB->SelectEntryPos(1);
break;
- case COL_NONE:
+ case COL_NONE_COLOR:
pChangedColorLB->SelectEntryPos(0);
break;
default:
diff --git a/sw/source/uibase/app/swmodul1.cxx b/sw/source/uibase/app/swmodul1.cxx
index aaa607cbf7a1..bf80bc0e9733 100644
--- a/sw/source/uibase/app/swmodul1.cxx
+++ b/sw/source/uibase/app/swmodul1.cxx
@@ -455,7 +455,7 @@ static void lcl_FillAuthorAttr( sal_uInt16 nAuthor, SfxItemSet &rSet,
sizeof( aColArr[0] )) ] );
}
- bool bBackGr = COL_NONE == rAttr.nColor;
+ bool bBackGr = COL_NONE_COLOR == rAttr.nColor;
switch (rAttr.nItemId)
{
diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx
index 95d2bf3d2f52..a8d3f61601a7 100644
--- a/sw/source/uibase/docvw/edtwin.cxx
+++ b/sw/source/uibase/docvw/edtwin.cxx
@@ -2986,24 +2986,24 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt)
m_aStartPos = rMEvt.GetPosPixel();
m_aRszMvHdlPt.X() = 0, m_aRszMvHdlPt.Y() = 0;
- sal_uInt8 nMouseTabCol = 0;
+ SwTab nMouseTabCol = SwTab::COL_NONE;
const bool bTmp = !rSh.IsDrawCreate() && !m_pApplyTempl && !rSh.IsInSelect() &&
rMEvt.GetClicks() == 1 && MOUSE_LEFT == rMEvt.GetButtons();
if ( bTmp &&
- 0 != (nMouseTabCol = rSh.WhichMouseTabCol( aDocPos ) ) &&
+ SwTab::COL_NONE != (nMouseTabCol = rSh.WhichMouseTabCol( aDocPos ) ) &&
!rSh.IsObjSelectable( aDocPos ) )
{
// Enhanced table selection
- if ( SW_TABSEL_HORI <= nMouseTabCol && SW_TABCOLSEL_VERT >= nMouseTabCol )
+ if ( SwTab::SEL_HORI <= nMouseTabCol && SwTab::COLSEL_VERT >= nMouseTabCol )
{
rSh.EnterStdMode();
rSh.SelectTableRowCol( aDocPos );
- if( SW_TABSEL_HORI != nMouseTabCol && SW_TABSEL_HORI_RTL != nMouseTabCol)
+ if( SwTab::SEL_HORI != nMouseTabCol && SwTab::SEL_HORI_RTL != nMouseTabCol)
{
m_pRowColumnSelectionStart = new Point( aDocPos );
- m_bIsRowDrag = SW_TABROWSEL_HORI == nMouseTabCol||
- SW_TABROWSEL_HORI_RTL == nMouseTabCol ||
- SW_TABCOLSEL_VERT == nMouseTabCol;
+ m_bIsRowDrag = SwTab::ROWSEL_HORI == nMouseTabCol||
+ SwTab::ROWSEL_HORI_RTL == nMouseTabCol ||
+ SwTab::COLSEL_VERT == nMouseTabCol;
m_bMBPressed = true;
CaptureMouse();
}
@@ -3013,7 +3013,7 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt)
if ( !rSh.IsTableMode() )
{
// comes from table columns out of the document.
- if(SW_TABCOL_VERT == nMouseTabCol || SW_TABCOL_HORI == nMouseTabCol)
+ if(SwTab::COL_VERT == nMouseTabCol || SwTab::COL_HORI == nMouseTabCol)
m_rView.SetTabColFromDoc( true );
else
m_rView.SetTabRowFromDoc( true );
@@ -3023,7 +3023,7 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt)
SfxBindings& rBind = m_rView.GetViewFrame()->GetBindings();
rBind.Update();
if ( RulerColumnDrag( rMEvt,
- (SW_TABCOL_VERT == nMouseTabCol || SW_TABROW_HORI == nMouseTabCol)) )
+ (SwTab::COL_VERT == nMouseTabCol || SwTab::ROW_HORI == nMouseTabCol)) )
{
m_rView.SetTabColFromDoc( false );
m_rView.SetTabRowFromDoc( false );
@@ -3858,10 +3858,10 @@ void SwEditWin::MouseMove(const MouseEvent& _rMEvt)
}
}
- sal_uInt8 nMouseTabCol;
+ SwTab nMouseTabCol;
if( !bIsDocReadOnly && bInsWin && !m_pApplyTempl && !rSh.IsInSelect() )
{
- if ( SW_TABCOL_NONE != (nMouseTabCol = rSh.WhichMouseTabCol( aDocPt ) ) &&
+ if ( SwTab::COL_NONE != (nMouseTabCol = rSh.WhichMouseTabCol( aDocPt ) ) &&
!rSh.IsObjSelectable( aDocPt ) )
{
sal_uInt16 nPointer = USHRT_MAX;
@@ -3869,35 +3869,36 @@ void SwEditWin::MouseMove(const MouseEvent& _rMEvt)
switch ( nMouseTabCol )
{
- case SW_TABCOL_VERT :
- case SW_TABROW_HORI :
+ case SwTab::COL_VERT :
+ case SwTab::ROW_HORI :
nPointer = POINTER_VSIZEBAR;
bChkTblSel = true;
break;
- case SW_TABROW_VERT :
- case SW_TABCOL_HORI :
+ case SwTab::ROW_VERT :
+ case SwTab::COL_HORI :
nPointer = POINTER_HSIZEBAR;
bChkTblSel = true;
break;
// Enhanced table selection
- case SW_TABSEL_HORI :
+ case SwTab::SEL_HORI :
nPointer = POINTER_TAB_SELECT_SE;
break;
- case SW_TABSEL_HORI_RTL :
- case SW_TABSEL_VERT :
+ case SwTab::SEL_HORI_RTL :
+ case SwTab::SEL_VERT :
nPointer = POINTER_TAB_SELECT_SW;
break;
- case SW_TABCOLSEL_HORI :
- case SW_TABROWSEL_VERT :
+ case SwTab::COLSEL_HORI :
+ case SwTab::ROWSEL_VERT :
nPointer = POINTER_TAB_SELECT_S;
break;
- case SW_TABROWSEL_HORI :
+ case SwTab::ROWSEL_HORI :
nPointer = POINTER_TAB_SELECT_E;
break;
- case SW_TABROWSEL_HORI_RTL :
- case SW_TABCOLSEL_VERT :
+ case SwTab::ROWSEL_HORI_RTL :
+ case SwTab::COLSEL_VERT :
nPointer = POINTER_TAB_SELECT_W;
break;
+ case SwTab::COL_NONE: break; // prevent compiler warning
}
if ( USHRT_MAX != nPointer &&
diff --git a/sw/source/uibase/docvw/edtwin2.cxx b/sw/source/uibase/docvw/edtwin2.cxx
index 19989be4de5c..9b887b17da6c 100644
--- a/sw/source/uibase/docvw/edtwin2.cxx
+++ b/sw/source/uibase/docvw/edtwin2.cxx
@@ -389,33 +389,34 @@ void SwEditWin::RequestHelp(const HelpEvent &rEvt)
}
if( bContinue )
{
- sal_uInt8 nTabCols = rSh.WhichMouseTabCol(aPos);
+ SwTab nTabCols = rSh.WhichMouseTabCol(aPos);
sal_uInt16 nTabRes = 0;
switch(nTabCols)
{
- case SW_TABCOL_HORI:
- case SW_TABCOL_VERT:
+ case SwTab::COL_HORI:
+ case SwTab::COL_VERT:
nTabRes = STR_TABLE_COL_ADJUST;
break;
- case SW_TABROW_HORI:
- case SW_TABROW_VERT:
+ case SwTab::ROW_HORI:
+ case SwTab::ROW_VERT:
nTabRes = STR_TABLE_ROW_ADJUST;
break;
// #i32329# Enhanced table selection
- case SW_TABSEL_HORI:
- case SW_TABSEL_HORI_RTL:
- case SW_TABSEL_VERT:
+ case SwTab::SEL_HORI:
+ case SwTab::SEL_HORI_RTL:
+ case SwTab::SEL_VERT:
nTabRes = STR_TABLE_SELECT_ALL;
break;
- case SW_TABROWSEL_HORI:
- case SW_TABROWSEL_HORI_RTL:
- case SW_TABROWSEL_VERT:
+ case SwTab::ROWSEL_HORI:
+ case SwTab::ROWSEL_HORI_RTL:
+ case SwTab::ROWSEL_VERT:
nTabRes = STR_TABLE_SELECT_ROW;
break;
- case SW_TABCOLSEL_HORI:
- case SW_TABCOLSEL_VERT:
+ case SwTab::COLSEL_HORI:
+ case SwTab::COLSEL_VERT:
nTabRes = STR_TABLE_SELECT_COL;
break;
+ case SwTab::COL_NONE: break; // prevent compiler warning
}
if(nTabRes)
{