diff options
author | Noel Grandin <noel@peralex.com> | 2015-03-30 11:20:37 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2015-04-01 09:36:19 +0200 |
commit | 4b66829390b286010b37b37ec1537a320d8cea8f (patch) | |
tree | e3070f55a80dd8d6f5944db4594608865d0fbbcc /sd | |
parent | 427ef167e1a49ba7fcdef082de43622e02a84ce5 (diff) |
convert BOX_LINE and BOXINFO_LINE to enum class
since their usage is intertwined.
Also introduce new o3tl utilities enumrange and enumarray to make
working with scoped enums a little simpler.
Change-Id: I2e1cc65dd7c638e59f17d96dfae504747cad6533
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/core/drawdoc4.cxx | 8 | ||||
-rw-r--r-- | sd/source/ui/table/TableDesignPane.cxx | 14 |
2 files changed, 11 insertions, 11 deletions
diff --git a/sd/source/core/drawdoc4.cxx b/sd/source/core/drawdoc4.cxx index 8572e1e6ce5d..b56b0eeffd3a 100644 --- a/sd/source/core/drawdoc4.cxx +++ b/sd/source/core/drawdoc4.cxx @@ -603,10 +603,10 @@ void SdDrawDocument::CreateDefaultCellStyles() &aWhite, 1, table::BorderLineStyle::SOLID); SvxBoxItem aBoxItem( SDRATTR_TABLE_BORDER ); - aBoxItem.SetLine( &aBorderLine, BOX_LINE_TOP ); - aBoxItem.SetLine( &aBorderLine, BOX_LINE_BOTTOM ); - aBoxItem.SetLine( &aBorderLine, BOX_LINE_LEFT ); - aBoxItem.SetLine( &aBorderLine, BOX_LINE_RIGHT ); + aBoxItem.SetLine( &aBorderLine, SvxBoxItemLine::TOP ); + aBoxItem.SetLine( &aBorderLine, SvxBoxItemLine::BOTTOM ); + aBoxItem.SetLine( &aBorderLine, SvxBoxItemLine::LEFT ); + aBoxItem.SetLine( &aBorderLine, SvxBoxItemLine::RIGHT ); rISet.Put( aBoxItem ); diff --git a/sd/source/ui/table/TableDesignPane.cxx b/sd/source/ui/table/TableDesignPane.cxx index 5be0d543cdd1..564b9265eab2 100644 --- a/sd/source/ui/table/TableDesignPane.cxx +++ b/sd/source/ui/table/TableDesignPane.cxx @@ -43,6 +43,7 @@ #include <editeng/colritem.hxx> #include <editeng/eeitem.hxx> #include <svx/sdr/table/tabledesign.hxx> +#include <o3tl/enumrange.hxx> #include "TableDesignPane.hxx" #include "createtabledesignpanel.hxx" @@ -694,7 +695,7 @@ const Bitmap CreateDesignPreview( const Reference< XIndexAccess >& xTableStyle, sal_Int32* pDiff = &border_diffs[0]; // draw top border - for( sal_uInt16 nLine = 0; nLine < 4; ++nLine ) + for( SvxBoxItemLine nLine : o3tl::enumrange<SvxBoxItemLine>() ) { const ::editeng::SvxBorderLine* pBorderLine = xCellInfo->maBorder.GetLine(nLine); if( !pBorderLine || ((pBorderLine->GetOutWidth() == 0) && (pBorderLine->GetInWidth()==0)) ) @@ -708,8 +709,7 @@ const Bitmap CreateDesignPreview( const Reference< XIndexAccess >& xTableStyle, boost::shared_ptr< CellInfo > xBorderInfo( aMatrix[nBorderCol][nBorderRow] ); if( xBorderInfo.get() ) { - const sal_uInt16 nOtherLine = nLine ^ 1; - const ::editeng::SvxBorderLine* pBorderLine2 = xBorderInfo->maBorder.GetLine(nOtherLine^1); + const ::editeng::SvxBorderLine* pBorderLine2 = xBorderInfo->maBorder.GetLine(static_cast<SvxBoxItemLine>(static_cast<int>(nLine)^1^1)); if( pBorderLine2 && pBorderLine2->HasPriority(*pBorderLine) ) continue; // other border line wins } @@ -718,10 +718,10 @@ const Bitmap CreateDesignPreview( const Reference< XIndexAccess >& xTableStyle, pAccess->SetLineColor( pBorderLine->GetColor() ); switch( nLine ) { - case 0: pAccess->DrawLine( aPntTL, aPntTR ); break; - case 1: pAccess->DrawLine( aPntBL, aPntBR ); break; - case 2: pAccess->DrawLine( aPntTL, aPntBL ); break; - case 3: pAccess->DrawLine( aPntTR, aPntBR ); break; + case SvxBoxItemLine::TOP: pAccess->DrawLine( aPntTL, aPntTR ); break; + case SvxBoxItemLine::BOTTOM: pAccess->DrawLine( aPntBL, aPntBR ); break; + case SvxBoxItemLine::LEFT: pAccess->DrawLine( aPntTL, aPntBL ); break; + case SvxBoxItemLine::RIGHT: pAccess->DrawLine( aPntTR, aPntBR ); break; } } } |