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 | |
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
81 files changed, 1068 insertions, 879 deletions
diff --git a/cui/source/tabpages/border.cxx b/cui/source/tabpages/border.cxx index c2a14328a42c..8a3a29a6180c 100644 --- a/cui/source/tabpages/border.cxx +++ b/cui/source/tabpages/border.cxx @@ -434,13 +434,13 @@ void SvxBorderTabPage::Reset( const SfxItemSet* rSet ) m_pBottomMF->SetMin( 0 ); m_pBottomMF->SetFirst( 0 ); } - long nLeftDist = pBoxItem->GetDistance( BOX_LINE_LEFT); + long nLeftDist = pBoxItem->GetDistance( SvxBoxItemLine::LEFT); SetMetricValue(*m_pLeftMF, nLeftDist, eCoreUnit); - long nRightDist = pBoxItem->GetDistance( BOX_LINE_RIGHT); + long nRightDist = pBoxItem->GetDistance( SvxBoxItemLine::RIGHT); SetMetricValue(*m_pRightMF, nRightDist, eCoreUnit); - long nTopDist = pBoxItem->GetDistance( BOX_LINE_TOP); + long nTopDist = pBoxItem->GetDistance( SvxBoxItemLine::TOP); SetMetricValue( *m_pTopMF, nTopDist, eCoreUnit ); - long nBottomDist = pBoxItem->GetDistance( BOX_LINE_BOTTOM); + long nBottomDist = pBoxItem->GetDistance( SvxBoxItemLine::BOTTOM); SetMetricValue( *m_pBottomMF, nBottomDist, eCoreUnit ); // if the distance is set with no active border line @@ -603,12 +603,11 @@ bool SvxBorderTabPage::FillItemSet( SfxItemSet* rCoreAttrs ) // outer border: - typedef ::std::pair<svx::FrameBorderType,sal_uInt16> TBorderPair; - TBorderPair eTypes1[] = { - TBorderPair(svx::FRAMEBORDER_TOP,BOX_LINE_TOP), - TBorderPair(svx::FRAMEBORDER_BOTTOM,BOX_LINE_BOTTOM), - TBorderPair(svx::FRAMEBORDER_LEFT,BOX_LINE_LEFT), - TBorderPair(svx::FRAMEBORDER_RIGHT,BOX_LINE_RIGHT), + ::std::pair<svx::FrameBorderType,SvxBoxItemLine> eTypes1[] = { + { svx::FRAMEBORDER_TOP,SvxBoxItemLine::TOP }, + { svx::FRAMEBORDER_BOTTOM,SvxBoxItemLine::BOTTOM }, + { svx::FRAMEBORDER_LEFT,SvxBoxItemLine::LEFT }, + { svx::FRAMEBORDER_RIGHT,SvxBoxItemLine::RIGHT }, }; for (sal_uInt32 i=0; i < SAL_N_ELEMENTS(eTypes1); ++i) @@ -617,9 +616,9 @@ bool SvxBorderTabPage::FillItemSet( SfxItemSet* rCoreAttrs ) // border hor/ver and TableFlag - TBorderPair eTypes2[] = { - TBorderPair(svx::FRAMEBORDER_HOR,BOXINFO_LINE_HORI), - TBorderPair(svx::FRAMEBORDER_VER,BOXINFO_LINE_VERT) + ::std::pair<svx::FrameBorderType,SvxBoxInfoItemLine> eTypes2[] = { + { svx::FRAMEBORDER_HOR,SvxBoxInfoItemLine::HORI }, + { svx::FRAMEBORDER_VER,SvxBoxInfoItemLine::VERT } }; for (sal_uInt32 j=0; j < SAL_N_ELEMENTS(eTypes2); ++j) aBoxInfoItem.SetLine( m_pFrameSel->GetFrameBorderStyle( eTypes2[j].first ), eTypes2[j].second ); @@ -664,17 +663,17 @@ bool SvxBorderTabPage::FillItemSet( SfxItemSet* rCoreAttrs ) (pOldBoxInfoItem && !pOldBoxInfoItem->IsValid(SvxBoxInfoItemValidFlags::DISTANCE)) ) { - aBoxItem.SetDistance( (sal_uInt16)GetCoreValue(*m_pLeftMF, eCoreUnit ), BOX_LINE_LEFT ); - aBoxItem.SetDistance( (sal_uInt16)GetCoreValue(*m_pRightMF, eCoreUnit ), BOX_LINE_RIGHT ); - aBoxItem.SetDistance( (sal_uInt16)GetCoreValue(*m_pTopMF, eCoreUnit ), BOX_LINE_TOP ); - aBoxItem.SetDistance( (sal_uInt16)GetCoreValue(*m_pBottomMF, eCoreUnit ), BOX_LINE_BOTTOM); + aBoxItem.SetDistance( (sal_uInt16)GetCoreValue(*m_pLeftMF, eCoreUnit ), SvxBoxItemLine::LEFT ); + aBoxItem.SetDistance( (sal_uInt16)GetCoreValue(*m_pRightMF, eCoreUnit ), SvxBoxItemLine::RIGHT ); + aBoxItem.SetDistance( (sal_uInt16)GetCoreValue(*m_pTopMF, eCoreUnit ), SvxBoxItemLine::TOP ); + aBoxItem.SetDistance( (sal_uInt16)GetCoreValue(*m_pBottomMF, eCoreUnit ), SvxBoxItemLine::BOTTOM); } else { - aBoxItem.SetDistance(pOldBoxItem->GetDistance(BOX_LINE_LEFT ), BOX_LINE_LEFT); - aBoxItem.SetDistance(pOldBoxItem->GetDistance(BOX_LINE_RIGHT), BOX_LINE_RIGHT); - aBoxItem.SetDistance(pOldBoxItem->GetDistance(BOX_LINE_TOP ), BOX_LINE_TOP); - aBoxItem.SetDistance(pOldBoxItem->GetDistance(BOX_LINE_BOTTOM), BOX_LINE_BOTTOM); + aBoxItem.SetDistance(pOldBoxItem->GetDistance(SvxBoxItemLine::LEFT ), SvxBoxItemLine::LEFT); + aBoxItem.SetDistance(pOldBoxItem->GetDistance(SvxBoxItemLine::RIGHT), SvxBoxItemLine::RIGHT); + aBoxItem.SetDistance(pOldBoxItem->GetDistance(SvxBoxItemLine::TOP ), SvxBoxItemLine::TOP); + aBoxItem.SetDistance(pOldBoxItem->GetDistance(SvxBoxItemLine::BOTTOM), SvxBoxItemLine::BOTTOM); } aBoxInfoItem.SetValid( SvxBoxInfoItemValidFlags::DISTANCE, true ); } diff --git a/cui/source/tabpages/page.cxx b/cui/source/tabpages/page.cxx index 5d6c92c7236a..25ab8752b22b 100644 --- a/cui/source/tabpages/page.cxx +++ b/cui/source/tabpages/page.cxx @@ -113,10 +113,10 @@ sal_uInt16 PosToPageUsage_Impl( sal_uInt16 nPos ) Size GetMinBorderSpace_Impl( const SvxShadowItem& rShadow, const SvxBoxItem& rBox ) { Size aSz; - aSz.Height() = rShadow.CalcShadowSpace( SHADOW_BOTTOM ) + rBox.CalcLineSpace( BOX_LINE_BOTTOM ); - aSz.Height() += rShadow.CalcShadowSpace( SHADOW_TOP ) + rBox.CalcLineSpace( BOX_LINE_TOP ); - aSz.Width() = rShadow.CalcShadowSpace( SHADOW_LEFT ) + rBox.CalcLineSpace( BOX_LINE_LEFT ); - aSz.Width() += rShadow.CalcShadowSpace( SHADOW_RIGHT ) + rBox.CalcLineSpace( BOX_LINE_RIGHT ); + aSz.Height() = rShadow.CalcShadowSpace( SHADOW_BOTTOM ) + rBox.CalcLineSpace( SvxBoxItemLine::BOTTOM ); + aSz.Height() += rShadow.CalcShadowSpace( SHADOW_TOP ) + rBox.CalcLineSpace( SvxBoxItemLine::TOP ); + aSz.Width() = rShadow.CalcShadowSpace( SHADOW_LEFT ) + rBox.CalcLineSpace( SvxBoxItemLine::LEFT ); + aSz.Width() += rShadow.CalcShadowSpace( SHADOW_RIGHT ) + rBox.CalcLineSpace( SvxBoxItemLine::RIGHT ); return aSz; } diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx index 3fe61eb639a3..2029a8578ed2 100644 --- a/editeng/source/items/frmitems.cxx +++ b/editeng/source/items/frmitems.cxx @@ -82,6 +82,7 @@ #include <editeng/memberids.hrc> #include <editeng/editerr.hxx> #include <libxml/xmlwriter.h> +#include <o3tl/enumrange.hxx> using namespace ::editeng; using namespace ::com::sun::star; @@ -1652,10 +1653,10 @@ SvxBoxItem& SvxBoxItem::operator=( const SvxBoxItem& rBox ) nBottomDist = rBox.nBottomDist; nLeftDist = rBox.nLeftDist; nRightDist = rBox.nRightDist; - SetLine( rBox.GetTop(), BOX_LINE_TOP ); - SetLine( rBox.GetBottom(), BOX_LINE_BOTTOM ); - SetLine( rBox.GetLeft(), BOX_LINE_LEFT ); - SetLine( rBox.GetRight(), BOX_LINE_RIGHT ); + SetLine( rBox.GetTop(), SvxBoxItemLine::TOP ); + SetLine( rBox.GetBottom(), SvxBoxItemLine::BOTTOM ); + SetLine( rBox.GetLeft(), SvxBoxItemLine::LEFT ); + SetLine( rBox.GetRight(), SvxBoxItemLine::RIGHT ); return *this; } @@ -1862,9 +1863,9 @@ lcl_extractBorderLine(const uno::Any& rAny, table::BorderLine2& rLine) return false; } -template<typename Item> +template<typename Item, typename Line> bool -lcl_setLine(const uno::Any& rAny, Item& rItem, sal_uInt16 nLine, const bool bConvert) +lcl_setLine(const uno::Any& rAny, Item& rItem, Line nLine, const bool bConvert) { bool bDone = false; table::BorderLine2 aBorderLine; @@ -1883,7 +1884,7 @@ lcl_setLine(const uno::Any& rAny, Item& rItem, sal_uInt16 nLine, const bool bCon bool SvxBoxItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) { bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); - sal_uInt16 nLine = BOX_LINE_TOP; + SvxBoxItemLine nLine = SvxBoxItemLine::TOP; bool bDistMember = false; nMemberId &= ~CONVERT_TWIPS; switch(nMemberId) @@ -1894,7 +1895,7 @@ bool SvxBoxItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) if (( rVal >>= aSeq ) && ( aSeq.getLength() == 9 )) { // 4 Borders and 5 distances - const sal_uInt16 aBorders[] = { BOX_LINE_LEFT, BOX_LINE_RIGHT, BOX_LINE_BOTTOM, BOX_LINE_TOP }; + const SvxBoxItemLine aBorders[] = { SvxBoxItemLine::LEFT, SvxBoxItemLine::RIGHT, SvxBoxItemLine::BOTTOM, SvxBoxItemLine::TOP }; for (int n(0); n != SAL_N_ELEMENTS(aBorders); ++n) { if (!lcl_setLine(aSeq[n], *this, aBorders[n], bConvert)) @@ -1902,7 +1903,7 @@ bool SvxBoxItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) } // WTH are the borders and the distances saved in different order? - sal_uInt16 nLines[4] = { BOX_LINE_TOP, BOX_LINE_BOTTOM, BOX_LINE_LEFT, BOX_LINE_RIGHT }; + SvxBoxItemLine nLines[4] = { SvxBoxItemLine::TOP, SvxBoxItemLine::BOTTOM, SvxBoxItemLine::LEFT, SvxBoxItemLine::RIGHT }; for ( sal_Int32 n = 4; n < 9; n++ ) { sal_Int32 nDist = 0; @@ -1929,28 +1930,28 @@ bool SvxBoxItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) //fall-through case LEFT_BORDER: case MID_LEFT_BORDER: - nLine = BOX_LINE_LEFT; + nLine = SvxBoxItemLine::LEFT; break; case RIGHT_BORDER_DISTANCE: bDistMember = true; //fall-through case RIGHT_BORDER: case MID_RIGHT_BORDER: - nLine = BOX_LINE_RIGHT; + nLine = SvxBoxItemLine::RIGHT; break; case BOTTOM_BORDER_DISTANCE: bDistMember = true; //fall-through case BOTTOM_BORDER: case MID_BOTTOM_BORDER: - nLine = BOX_LINE_BOTTOM; + nLine = SvxBoxItemLine::BOTTOM; break; case TOP_BORDER_DISTANCE: bDistMember = true; //fall-through case TOP_BORDER: case MID_TOP_BORDER: - nLine = BOX_LINE_TOP; + nLine = SvxBoxItemLine::TOP; break; case LINE_STYLE: { @@ -1971,10 +1972,9 @@ bool SvxBoxItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) } // Set the line style on all borders - const sal_uInt16 aBorders[] = { BOX_LINE_LEFT, BOX_LINE_RIGHT, BOX_LINE_BOTTOM, BOX_LINE_TOP }; - for (int n(0); n != SAL_N_ELEMENTS(aBorders); ++n) + for( SvxBoxItemLine n : o3tl::enumrange<SvxBoxItemLine>() ) { - editeng::SvxBorderLine* pLine = const_cast< editeng::SvxBorderLine* >( GetLine( aBorders[n] ) ); + editeng::SvxBorderLine* pLine = const_cast< editeng::SvxBorderLine* >( GetLine( n ) ); if( pLine ) pLine->SetBorderLineStyle( eBorderStyle ); } @@ -1990,10 +1990,9 @@ bool SvxBoxItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) nWidth = convertMm100ToTwip( nWidth ); // Set the line Width on all borders - const sal_uInt16 aBorders[] = { BOX_LINE_LEFT, BOX_LINE_RIGHT, BOX_LINE_BOTTOM, BOX_LINE_TOP }; - for (int n(0); n != SAL_N_ELEMENTS(aBorders); ++n) + for( SvxBoxItemLine n : o3tl::enumrange<SvxBoxItemLine>() ) { - editeng::SvxBorderLine* pLine = const_cast< editeng::SvxBorderLine* >( GetLine( aBorders[n] ) ); + editeng::SvxBorderLine* pLine = const_cast< editeng::SvxBorderLine* >( GetLine( n ) ); if( pLine ) pLine->SetWidth( nWidth ); } @@ -2308,8 +2307,8 @@ SfxPoolItem* SvxBoxItem::Create( SvStream& rStrm, sal_uInt16 nIVersion ) const rStrm.ReadUInt16( nDistance ); SvxBoxItem* pAttr = new SvxBoxItem( Which() ); - sal_uInt16 aLineMap[4] = { BOX_LINE_TOP, BOX_LINE_LEFT, - BOX_LINE_RIGHT, BOX_LINE_BOTTOM }; + SvxBoxItemLine aLineMap[4] = { SvxBoxItemLine::TOP, SvxBoxItemLine::LEFT, + SvxBoxItemLine::RIGHT, SvxBoxItemLine::BOTTOM }; sal_Int8 cLine; while( true ) @@ -2342,22 +2341,22 @@ SfxPoolItem* SvxBoxItem::Create( SvStream& rStrm, sal_uInt16 nIVersion ) const -const SvxBorderLine *SvxBoxItem::GetLine( sal_uInt16 nLine ) const +const SvxBorderLine *SvxBoxItem::GetLine( SvxBoxItemLine nLine ) const { const SvxBorderLine *pRet = 0; switch ( nLine ) { - case BOX_LINE_TOP: + case SvxBoxItemLine::TOP: pRet = pTop; break; - case BOX_LINE_BOTTOM: + case SvxBoxItemLine::BOTTOM: pRet = pBottom; break; - case BOX_LINE_LEFT: + case SvxBoxItemLine::LEFT: pRet = pLeft; break; - case BOX_LINE_RIGHT: + case SvxBoxItemLine::RIGHT: pRet = pRight; break; default: @@ -2370,25 +2369,25 @@ const SvxBorderLine *SvxBoxItem::GetLine( sal_uInt16 nLine ) const -void SvxBoxItem::SetLine( const SvxBorderLine* pNew, sal_uInt16 nLine ) +void SvxBoxItem::SetLine( const SvxBorderLine* pNew, SvxBoxItemLine nLine ) { SvxBorderLine* pTmp = pNew ? new SvxBorderLine( *pNew ) : 0; switch ( nLine ) { - case BOX_LINE_TOP: + case SvxBoxItemLine::TOP: delete pTop; pTop = pTmp; break; - case BOX_LINE_BOTTOM: + case SvxBoxItemLine::BOTTOM: delete pBottom; pBottom = pTmp; break; - case BOX_LINE_LEFT: + case SvxBoxItemLine::LEFT: delete pLeft; pLeft = pTmp; break; - case BOX_LINE_RIGHT: + case SvxBoxItemLine::RIGHT: delete pRight; pRight = pTmp; break; @@ -2416,21 +2415,21 @@ sal_uInt16 SvxBoxItem::GetDistance() const -sal_uInt16 SvxBoxItem::GetDistance( sal_uInt16 nLine ) const +sal_uInt16 SvxBoxItem::GetDistance( SvxBoxItemLine nLine ) const { sal_uInt16 nDist = 0; switch ( nLine ) { - case BOX_LINE_TOP: + case SvxBoxItemLine::TOP: nDist = nTopDist; break; - case BOX_LINE_BOTTOM: + case SvxBoxItemLine::BOTTOM: nDist = nBottomDist; break; - case BOX_LINE_LEFT: + case SvxBoxItemLine::LEFT: nDist = nLeftDist; break; - case BOX_LINE_RIGHT: + case SvxBoxItemLine::RIGHT: nDist = nRightDist; break; default: @@ -2442,20 +2441,20 @@ sal_uInt16 SvxBoxItem::GetDistance( sal_uInt16 nLine ) const -void SvxBoxItem::SetDistance( sal_uInt16 nNew, sal_uInt16 nLine ) +void SvxBoxItem::SetDistance( sal_uInt16 nNew, SvxBoxItemLine nLine ) { switch ( nLine ) { - case BOX_LINE_TOP: + case SvxBoxItemLine::TOP: nTopDist = nNew; break; - case BOX_LINE_BOTTOM: + case SvxBoxItemLine::BOTTOM: nBottomDist = nNew; break; - case BOX_LINE_LEFT: + case SvxBoxItemLine::LEFT: nLeftDist = nNew; break; - case BOX_LINE_RIGHT: + case SvxBoxItemLine::RIGHT: nRightDist = nNew; break; default: @@ -2465,25 +2464,25 @@ void SvxBoxItem::SetDistance( sal_uInt16 nNew, sal_uInt16 nLine ) -sal_uInt16 SvxBoxItem::CalcLineSpace( sal_uInt16 nLine, bool bIgnoreLine ) const +sal_uInt16 SvxBoxItem::CalcLineSpace( SvxBoxItemLine nLine, bool bIgnoreLine ) const { SvxBorderLine* pTmp = 0; sal_uInt16 nDist = 0; switch ( nLine ) { - case BOX_LINE_TOP: + case SvxBoxItemLine::TOP: pTmp = pTop; nDist = nTopDist; break; - case BOX_LINE_BOTTOM: + case SvxBoxItemLine::BOTTOM: pTmp = pBottom; nDist = nBottomDist; break; - case BOX_LINE_LEFT: + case SvxBoxItemLine::LEFT: pTmp = pLeft; nDist = nLeftDist; break; - case BOX_LINE_RIGHT: + case SvxBoxItemLine::RIGHT: pTmp = pRight; nDist = nRightDist; break; @@ -2575,16 +2574,16 @@ bool SvxBoxInfoItem::operator==( const SfxPoolItem& rAttr ) const -void SvxBoxInfoItem::SetLine( const SvxBorderLine* pNew, sal_uInt16 nLine ) +void SvxBoxInfoItem::SetLine( const SvxBorderLine* pNew, SvxBoxInfoItemLine nLine ) { SvxBorderLine* pTmp = pNew ? new SvxBorderLine( *pNew ) : 0; - if ( BOXINFO_LINE_HORI == nLine ) + if ( SvxBoxInfoItemLine::HORI == nLine ) { delete pHori; pHori = pTmp; } - else if ( BOXINFO_LINE_VERT == nLine ) + else if ( SvxBoxInfoItemLine::VERT == nLine ) { delete pVert; pVert = pTmp; @@ -2698,8 +2697,8 @@ SfxPoolItem* SvxBoxInfoItem::Create( SvStream& rStrm, sal_uInt16 ) const switch( cLine ) { - case 0: pAttr->SetLine( &aBorder, BOXINFO_LINE_HORI ); break; - case 1: pAttr->SetLine( &aBorder, BOXINFO_LINE_VERT ); break; + case 0: pAttr->SetLine( &aBorder, SvxBoxInfoItemLine::HORI ); break; + case 1: pAttr->SetLine( &aBorder, SvxBoxInfoItemLine::VERT ); break; } } return pAttr; @@ -2788,9 +2787,9 @@ bool SvxBoxInfoItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) if (( rVal >>= aSeq ) && ( aSeq.getLength() == 5 )) { // 2 BorderLines, flags, valid flags and distance - if (!lcl_setLine(aSeq[0], *this, BOXINFO_LINE_HORI, bConvert)) + if (!lcl_setLine(aSeq[0], *this, SvxBoxInfoItemLine::HORI, bConvert)) return false; - if (!lcl_setLine(aSeq[1], *this, BOXINFO_LINE_VERT, bConvert)) + if (!lcl_setLine(aSeq[1], *this, SvxBoxInfoItemLine::VERT, bConvert)) return false; sal_Int16 nFlags( 0 ); @@ -2896,7 +2895,7 @@ bool SvxBoxInfoItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) SvxBorderLine aLine; bool bSet = SvxBoxItem::LineToSvxLine(aBorderLine, aLine, bConvert); if ( bSet ) - SetLine( &aLine, nMemberId == MID_HORIZONTAL ? BOXINFO_LINE_HORI : BOXINFO_LINE_VERT ); + SetLine( &aLine, nMemberId == MID_HORIZONTAL ? SvxBoxInfoItemLine::HORI : SvxBoxInfoItemLine::VERT ); break; } case MID_FLAGS: diff --git a/editeng/source/rtf/rtfitem.cxx b/editeng/source/rtf/rtfitem.cxx index 36ab6059bdb6..ac62e58a9690 100644 --- a/editeng/source/rtf/rtfitem.cxx +++ b/editeng/source/rtf/rtfitem.cxx @@ -1366,22 +1366,22 @@ static void SetBorderLine( int nBorderTyp, SvxBoxItem& rItem, { case RTF_BOX: // run through all levels case RTF_BRDRT: - rItem.SetLine( &rBorder, BOX_LINE_TOP ); + rItem.SetLine( &rBorder, SvxBoxItemLine::TOP ); if( RTF_BOX != nBorderTyp ) return; // fall-through case RTF_BRDRB: - rItem.SetLine( &rBorder, BOX_LINE_BOTTOM ); + rItem.SetLine( &rBorder, SvxBoxItemLine::BOTTOM ); if( RTF_BOX != nBorderTyp ) return; // fall-through case RTF_BRDRL: - rItem.SetLine( &rBorder, BOX_LINE_LEFT ); + rItem.SetLine( &rBorder, SvxBoxItemLine::LEFT ); if( RTF_BOX != nBorderTyp ) return; // fall-through case RTF_BRDRR: - rItem.SetLine( &rBorder, BOX_LINE_RIGHT ); + rItem.SetLine( &rBorder, SvxBoxItemLine::RIGHT ); if( RTF_BOX != nBorderTyp ) return; } @@ -1525,19 +1525,19 @@ void SvxRTFParser::ReadBorderAttr( int nToken, SfxItemSet& rSet, switch( nBorderTyp ) { case RTF_BRDRB: - aAttr.SetDistance( (sal_uInt16)nTokenValue, BOX_LINE_BOTTOM ); + aAttr.SetDistance( (sal_uInt16)nTokenValue, SvxBoxItemLine::BOTTOM ); break; case RTF_BRDRT: - aAttr.SetDistance( (sal_uInt16)nTokenValue, BOX_LINE_TOP ); + aAttr.SetDistance( (sal_uInt16)nTokenValue, SvxBoxItemLine::TOP ); break; case RTF_BRDRL: - aAttr.SetDistance( (sal_uInt16)nTokenValue, BOX_LINE_LEFT ); + aAttr.SetDistance( (sal_uInt16)nTokenValue, SvxBoxItemLine::LEFT ); break; case RTF_BRDRR: - aAttr.SetDistance( (sal_uInt16)nTokenValue, BOX_LINE_RIGHT ); + aAttr.SetDistance( (sal_uInt16)nTokenValue, SvxBoxItemLine::RIGHT ); break; case RTF_BOX: diff --git a/include/editeng/boxitem.hxx b/include/editeng/boxitem.hxx index c99ef2956776..99379f42fc75 100644 --- a/include/editeng/boxitem.hxx +++ b/include/editeng/boxitem.hxx @@ -34,11 +34,10 @@ This item describes a border attribute (all four edges and the inward distance) */ - -#define BOX_LINE_TOP ((sal_uInt16)0) -#define BOX_LINE_BOTTOM ((sal_uInt16)1) -#define BOX_LINE_LEFT ((sal_uInt16)2) -#define BOX_LINE_RIGHT ((sal_uInt16)3) +enum class SvxBoxItemLine +{ + TOP, BOTTOM, LEFT, RIGHT, LAST = RIGHT +}; /** This version causes SvxBoxItem to store the 4 cell spacing distances separately @@ -93,20 +92,20 @@ public: const editeng::SvxBorderLine* GetLeft() const { return pLeft; } const editeng::SvxBorderLine* GetRight() const { return pRight; } - const editeng::SvxBorderLine* GetLine( sal_uInt16 nLine ) const; + const editeng::SvxBorderLine* GetLine( SvxBoxItemLine nLine ) const; //The Pointers are being copied! - void SetLine( const editeng::SvxBorderLine* pNew, sal_uInt16 nLine ); + void SetLine( const editeng::SvxBorderLine* pNew, SvxBoxItemLine nLine ); - sal_uInt16 GetDistance( sal_uInt16 nLine ) const; + sal_uInt16 GetDistance( SvxBoxItemLine nLine ) const; sal_uInt16 GetDistance() const; - void SetDistance( sal_uInt16 nNew, sal_uInt16 nLine ); + void SetDistance( sal_uInt16 nNew, SvxBoxItemLine nLine ); inline void SetDistance( sal_uInt16 nNew ); // Line width plus Space plus inward distance // bIgnoreLine = TRUE -> Also return distance, when no Line is set - sal_uInt16 CalcLineSpace( sal_uInt16 nLine, bool bIgnoreLine = false ) const; + sal_uInt16 CalcLineSpace( SvxBoxItemLine nLine, bool bIgnoreLine = false ) const; static com::sun::star::table::BorderLine2 SvxLineToLine( const editeng::SvxBorderLine* pLine, bool bConvert ); static bool LineToSvxLine(const ::com::sun::star::table::BorderLine& rLine, editeng::SvxBorderLine& rSvxLine, bool bConvert); static bool LineToSvxLine(const ::com::sun::star::table::BorderLine2& rLine, editeng::SvxBorderLine& rSvxLine, bool bConvert); @@ -127,8 +126,10 @@ inline void SvxBoxItem::SetDistance( sal_uInt16 nNew ) transported the borderline for the inner horizontal and vertical lines. */ -#define BOXINFO_LINE_HORI ((sal_uInt16)0) -#define BOXINFO_LINE_VERT ((sal_uInt16)1) +enum class SvxBoxInfoItemLine +{ + HORI, VERT, LAST = VERT +}; enum class SvxBoxInfoItemValidFlags { @@ -181,8 +182,8 @@ public: SvxBoxInfoItem &operator=( const SvxBoxInfoItem &rCpy ); // "pure virtual Methods" from SfxPoolItem - virtual bool operator==( const SfxPoolItem& ) const SAL_OVERRIDE; - virtual bool GetPresentation( SfxItemPresentation ePres, + virtual bool operator==( const SfxPoolItem& ) const SAL_OVERRIDE; + virtual bool GetPresentation( SfxItemPresentation ePres, SfxMapUnit eCoreMetric, SfxMapUnit ePresMetric, OUString &rText, const IntlWrapper * = 0 ) const SAL_OVERRIDE; @@ -199,22 +200,22 @@ public: const editeng::SvxBorderLine* GetVert() const { return pVert; } //The Pointers are being copied! - void SetLine( const editeng::SvxBorderLine* pNew, sal_uInt16 nLine ); - - bool IsTable() const { return mbEnableHor && mbEnableVer; } - void SetTable( bool bNew ) { mbEnableHor = mbEnableVer = bNew; } - - inline bool IsHorEnabled() const { return mbEnableHor; } - inline void EnableHor( bool bEnable ) { mbEnableHor = bEnable; } - inline bool IsVerEnabled() const { return mbEnableVer; } - inline void EnableVer( bool bEnable ) { mbEnableVer = bEnable; } - - bool IsDist() const { return bDist; } - void SetDist( bool bNew ) { bDist = bNew; } - bool IsMinDist() const { return bMinDist; } - void SetMinDist( bool bNew ) { bMinDist = bNew; } - sal_uInt16 GetDefDist() const { return nDefDist; } - void SetDefDist( sal_uInt16 nNew ) { nDefDist = nNew; } + void SetLine( const editeng::SvxBorderLine* pNew, SvxBoxInfoItemLine nLine ); + + bool IsTable() const { return mbEnableHor && mbEnableVer; } + void SetTable( bool bNew ) { mbEnableHor = mbEnableVer = bNew; } + + inline bool IsHorEnabled() const { return mbEnableHor; } + inline void EnableHor( bool bEnable ) { mbEnableHor = bEnable; } + inline bool IsVerEnabled() const { return mbEnableVer; } + inline void EnableVer( bool bEnable ) { mbEnableVer = bEnable; } + + bool IsDist() const { return bDist; } + void SetDist( bool bNew ) { bDist = bNew; } + bool IsMinDist() const { return bMinDist; } + void SetMinDist( bool bNew ) { bMinDist = bNew; } + sal_uInt16 GetDefDist() const { return nDefDist; } + void SetDefDist( sal_uInt16 nNew ) { nDefDist = nNew; } bool IsValid( SvxBoxInfoItemValidFlags nValid ) const { return bool( nValidFlags & nValid ); } diff --git a/include/o3tl/enumarray.hxx b/include/o3tl/enumarray.hxx new file mode 100644 index 000000000000..89f7e16a6ce1 --- /dev/null +++ b/include/o3tl/enumarray.hxx @@ -0,0 +1,107 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_O3TL_ENUMARRAY_HXX +#define INCLUDED_O3TL_ENUMARRAY_HXX + +#include <sal/config.h> +#include <initializer_list> +#include <iterator> + +namespace o3tl { + +template<typename EA> +class enumarray_iterator; + +/// +/// This is a container convenience class for arrays indexed by enum values. +/// +/// This assumes that the 'enum class' definition +/// - starts at zero +/// - has no holes in it's sequence of values +/// - defines a value called LAST which refers to the greatest constant. +/// +/// \param E the 'enum class' type. +/// \param V the value type to be stored in the array +template<typename E, typename V> +class enumarray SAL_FINAL +{ +public: + typedef enumarray<E, V> self_type; + typedef enumarray_iterator<self_type> iterator; + + typedef V value_type; + typedef E key_type; + typedef size_t size_type; + + static const size_type max_index = static_cast<size_type>(E::LAST); + + /** Create an enumarray with the given elements. + + @param init an initializer_list + */ + enumarray(std::initializer_list<V> init) + { std::copy(init.begin(), init.end(), std::begin(values)); } + + enumarray() {} + + const V operator[](E index) const + { + assert(index>=static_cast<E>(0) && index<=E::LAST); + return values[static_cast<size_type>(index)]; + } + + V& operator[](E index) + { + assert(index>=static_cast<E>(0) && index<=E::LAST); + return values[static_cast<size_type>(index)]; + } + + void fill(V val) + { for (size_type i=0; i<=max_index; ++i) values[i] = val; } + + size_type size() const { return max_index + 1; } + iterator begin() { return iterator(this, 0); } + iterator end() { return iterator(this, size()); } +private: + V values[max_index + 1]; +}; + + +template<typename EA> +class enumarray_iterator { + EA &m_buf; + size_t m_pos; +public: + typedef enumarray_iterator<EA> self_type; + typedef typename EA::value_type value_type; + typedef typename EA::key_type key_type; + + enumarray_iterator(EA& b, size_t start_pos) + : m_buf(b), m_pos(start_pos) {} + value_type &operator*() { return m_buf[static_cast<key_type>(m_pos)]; } + value_type *operator->() { return &(operator*()); } + self_type &operator++() { ++m_pos; return *this; } +}; + +}; // namespace o3tl + +#endif /* INCLUDED_O3TL_ENUMARRAY_HXX */ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/o3tl/enumrange.hxx b/include/o3tl/enumrange.hxx new file mode 100644 index 000000000000..b127daf54f15 --- /dev/null +++ b/include/o3tl/enumrange.hxx @@ -0,0 +1,90 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_O3TL_ENUMRANGE_HXX +#define INCLUDED_O3TL_ENUMRANGE_HXX + +#include <sal/config.h> + +namespace o3tl { + +/// +/// This is a container convenience class iterating over scoped enumerations. +/// +/// This assumes that the 'enum class' definition +/// - starts at zero +/// - has no holes in it's sequence of values +/// - defines a value called LAST which refers to the greatest constant. +/// +/// Use like this: +/// enum class COLOR { RED, GREEN, BLUE, LAST=BLUE }; +/// for( auto e : o3tl::enumrange<Color>() ) +/// .....; +/// +/// \param T the 'enum class' type. +template< typename T> +class enumrange +{ +public: + class Iterator + { + public: + Iterator( int value ) : + m_value( value ) + { } + + T operator*( void ) const + { + return (T)m_value; + } + + void operator++( void ) + { + ++m_value; + } + + bool operator!=( Iterator rhs ) + { + return m_value != rhs.m_value; + } + + private: + int m_value; + }; + +}; + +template< typename T > +typename enumrange<T>::Iterator begin( enumrange<T> ) +{ + return typename enumrange<T>::Iterator( (int)0 ); +} + +template< typename T > +typename enumrange<T>::Iterator end( enumrange<T> ) +{ + return typename enumrange<T>::Iterator( ((int)T::LAST) + 1 ); +} + + +}; // namespace o3tl + +#endif /* INCLUDED_O3TL_ENUMRANGE_HXX */ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 195be8f09c09..a80eaca5a212 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -2225,8 +2225,8 @@ void Test::testDataArea() // Now, set borders in some cells.... ::editeng::SvxBorderLine aLine(NULL, 50, table::BorderLineStyle::SOLID); SvxBoxItem aBorderItem(ATTR_BORDER); - aBorderItem.SetLine(&aLine, BOX_LINE_LEFT); - aBorderItem.SetLine(&aLine, BOX_LINE_RIGHT); + aBorderItem.SetLine(&aLine, SvxBoxItemLine::LEFT); + aBorderItem.SetLine(&aLine, SvxBoxItemLine::RIGHT); for (SCROW i = 0; i < 100; ++i) // Set borders from row 1 to 100. m_pDoc->ApplyAttr(0, i, 0, aBorderItem); diff --git a/sc/source/core/data/attarray.cxx b/sc/source/core/data/attarray.cxx index fcba8d924531..216ede66939b 100644 --- a/sc/source/core/data/attarray.cxx +++ b/sc/source/core/data/attarray.cxx @@ -695,10 +695,10 @@ void ScAttrArray::ApplyLineStyleArea( SCROW nStartRow, SCROW nEndRow, { if( pNewBoxItem ) { - if ( pNewBoxItem->GetTop() ) pNewBoxItem->SetLine( NULL, BOX_LINE_TOP ); - if ( pNewBoxItem->GetBottom() ) pNewBoxItem->SetLine( NULL, BOX_LINE_BOTTOM ); - if ( pNewBoxItem->GetLeft() ) pNewBoxItem->SetLine( NULL, BOX_LINE_LEFT ); - if ( pNewBoxItem->GetRight() ) pNewBoxItem->SetLine( NULL, BOX_LINE_RIGHT ); + if ( pNewBoxItem->GetTop() ) pNewBoxItem->SetLine( NULL, SvxBoxItemLine::TOP ); + if ( pNewBoxItem->GetBottom() ) pNewBoxItem->SetLine( NULL, SvxBoxItemLine::BOTTOM ); + if ( pNewBoxItem->GetLeft() ) pNewBoxItem->SetLine( NULL, SvxBoxItemLine::LEFT ); + if ( pNewBoxItem->GetRight() ) pNewBoxItem->SetLine( NULL, SvxBoxItemLine::RIGHT ); } if( pNewTLBRItem && pNewTLBRItem->GetLine() ) pNewTLBRItem->SetLine( 0 ); @@ -1006,45 +1006,45 @@ static void lcl_MergeToFrame( SvxBoxItem* pLineOuter, SvxBoxInfoItem* pLineInner if (bTop) { if (lcl_TestAttr( pLineOuter->GetTop(), pTopAttr, rFlags.nTop, pNew )) - pLineOuter->SetLine( pNew, BOX_LINE_TOP ); + pLineOuter->SetLine( pNew, SvxBoxItemLine::TOP ); } else { if (lcl_TestAttr( pLineInner->GetHori(), pTopAttr, rFlags.nHori, pNew )) - pLineInner->SetLine( pNew, BOXINFO_LINE_HORI ); + pLineInner->SetLine( pNew, SvxBoxInfoItemLine::HORI ); } if (nDistBottom == 0) { if (lcl_TestAttr( pLineOuter->GetBottom(), pBottomAttr, rFlags.nBottom, pNew )) - pLineOuter->SetLine( pNew, BOX_LINE_BOTTOM ); + pLineOuter->SetLine( pNew, SvxBoxItemLine::BOTTOM ); } else { if (lcl_TestAttr( pLineInner->GetHori(), pBottomAttr, rFlags.nHori, pNew )) - pLineInner->SetLine( pNew, BOXINFO_LINE_HORI ); + pLineInner->SetLine( pNew, SvxBoxInfoItemLine::HORI ); } if (bLeft) { if (lcl_TestAttr( pLineOuter->GetLeft(), pLeftAttr, rFlags.nLeft, pNew )) - pLineOuter->SetLine( pNew, BOX_LINE_LEFT ); + pLineOuter->SetLine( pNew, SvxBoxItemLine::LEFT ); } else { if (lcl_TestAttr( pLineInner->GetVert(), pLeftAttr, rFlags.nVert, pNew )) - pLineInner->SetLine( pNew, BOXINFO_LINE_VERT ); + pLineInner->SetLine( pNew, SvxBoxInfoItemLine::VERT ); } if (nDistRight == 0) { if (lcl_TestAttr( pLineOuter->GetRight(), pRightAttr, rFlags.nRight, pNew )) - pLineOuter->SetLine( pNew, BOX_LINE_RIGHT ); + pLineOuter->SetLine( pNew, SvxBoxItemLine::RIGHT ); } else { if (lcl_TestAttr( pLineInner->GetVert(), pRightAttr, rFlags.nVert, pNew )) - pLineInner->SetLine( pNew, BOXINFO_LINE_VERT ); + pLineInner->SetLine( pNew, SvxBoxInfoItemLine::VERT ); } } @@ -1112,35 +1112,35 @@ bool ScAttrArray::ApplyFrame( const SvxBoxItem* pBoxItem, if( bLeft && nDistRight==0) { if ( pBoxInfoItem->IsValid(SvxBoxInfoItemValidFlags::LEFT) ) - aNewFrame.SetLine( pBoxItem->GetLeft(), BOX_LINE_RIGHT ); + aNewFrame.SetLine( pBoxItem->GetLeft(), SvxBoxItemLine::RIGHT ); if ( pBoxInfoItem->IsValid(SvxBoxInfoItemValidFlags::RIGHT) ) - aNewFrame.SetLine( pBoxItem->GetRight(), BOX_LINE_LEFT ); + aNewFrame.SetLine( pBoxItem->GetRight(), SvxBoxItemLine::LEFT ); } else { if ( (nDistRight==0) ? pBoxInfoItem->IsValid(SvxBoxInfoItemValidFlags::LEFT) : pBoxInfoItem->IsValid(SvxBoxInfoItemValidFlags::VERT) ) aNewFrame.SetLine( (nDistRight==0) ? pBoxItem->GetLeft() : pBoxInfoItem->GetVert(), - BOX_LINE_RIGHT ); + SvxBoxItemLine::RIGHT ); if ( bLeft ? pBoxInfoItem->IsValid(SvxBoxInfoItemValidFlags::RIGHT) : pBoxInfoItem->IsValid(SvxBoxInfoItemValidFlags::VERT) ) aNewFrame.SetLine( bLeft ? pBoxItem->GetRight() : pBoxInfoItem->GetVert(), - BOX_LINE_LEFT ); + SvxBoxItemLine::LEFT ); } } else { if ( bLeft ? pBoxInfoItem->IsValid(SvxBoxInfoItemValidFlags::LEFT) : pBoxInfoItem->IsValid(SvxBoxInfoItemValidFlags::VERT) ) aNewFrame.SetLine( bLeft ? pBoxItem->GetLeft() : pBoxInfoItem->GetVert(), - BOX_LINE_LEFT ); + SvxBoxItemLine::LEFT ); if ( (nDistRight==0) ? pBoxInfoItem->IsValid(SvxBoxInfoItemValidFlags::RIGHT) : pBoxInfoItem->IsValid(SvxBoxInfoItemValidFlags::VERT) ) aNewFrame.SetLine( (nDistRight==0) ? pBoxItem->GetRight() : pBoxInfoItem->GetVert(), - BOX_LINE_RIGHT ); + SvxBoxItemLine::RIGHT ); } if ( bTop ? pBoxInfoItem->IsValid(SvxBoxInfoItemValidFlags::TOP) : pBoxInfoItem->IsValid(SvxBoxInfoItemValidFlags::HORI) ) aNewFrame.SetLine( bTop ? pBoxItem->GetTop() : pBoxInfoItem->GetHori(), - BOX_LINE_TOP ); + SvxBoxItemLine::TOP ); if ( (nDistBottom==0) ? pBoxInfoItem->IsValid(SvxBoxInfoItemValidFlags::BOTTOM) : pBoxInfoItem->IsValid(SvxBoxInfoItemValidFlags::HORI) ) aNewFrame.SetLine( (nDistBottom==0) ? pBoxItem->GetBottom() : pBoxInfoItem->GetHori(), - BOX_LINE_BOTTOM ); + SvxBoxItemLine::BOTTOM ); if (aNewFrame == *pOldFrame) { diff --git a/sc/source/core/data/docpool.cxx b/sc/source/core/data/docpool.cxx index 501c49f4b30b..eba1d984c183 100644 --- a/sc/source/core/data/docpool.cxx +++ b/sc/source/core/data/docpool.cxx @@ -218,8 +218,8 @@ ScDocumentPool::ScDocumentPool( SfxItemPool* pSecPool) ATTR_PAGE_ON, ATTR_PAGE_SHARED, 0 ); - pGlobalBorderInnerAttr->SetLine(NULL, BOXINFO_LINE_HORI); - pGlobalBorderInnerAttr->SetLine(NULL, BOXINFO_LINE_VERT); + pGlobalBorderInnerAttr->SetLine(NULL, SvxBoxInfoItemLine::HORI); + pGlobalBorderInnerAttr->SetLine(NULL, SvxBoxInfoItemLine::VERT); pGlobalBorderInnerAttr->SetTable(true); pGlobalBorderInnerAttr->SetDist(true); pGlobalBorderInnerAttr->SetMinDist(false); diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index 71d56c8bf425..c3a2f8e7f82e 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -4900,14 +4900,14 @@ void ScDocument::GetSelectionFrame( const ScMarkData& rMark, SvxBoxItem& rLineOuter, SvxBoxInfoItem& rLineInner ) { - rLineOuter.SetLine(NULL, BOX_LINE_TOP); - rLineOuter.SetLine(NULL, BOX_LINE_BOTTOM); - rLineOuter.SetLine(NULL, BOX_LINE_LEFT); - rLineOuter.SetLine(NULL, BOX_LINE_RIGHT); + rLineOuter.SetLine(NULL, SvxBoxItemLine::TOP); + rLineOuter.SetLine(NULL, SvxBoxItemLine::BOTTOM); + rLineOuter.SetLine(NULL, SvxBoxItemLine::LEFT); + rLineOuter.SetLine(NULL, SvxBoxItemLine::RIGHT); rLineOuter.SetDistance(0); - rLineInner.SetLine(NULL, BOXINFO_LINE_HORI); - rLineInner.SetLine(NULL, BOXINFO_LINE_VERT); + rLineInner.SetLine(NULL, SvxBoxInfoItemLine::HORI); + rLineInner.SetLine(NULL, SvxBoxInfoItemLine::VERT); rLineInner.SetTable(true); rLineInner.SetDist(true); rLineInner.SetMinDist(false); diff --git a/sc/source/core/data/dpoutput.cxx b/sc/source/core/data/dpoutput.cxx index d0340cbe1aba..dee436ac8ea7 100644 --- a/sc/source/core/data/dpoutput.cxx +++ b/sc/source/core/data/dpoutput.cxx @@ -240,31 +240,31 @@ void ScDPOutputImpl::OutputBlockFrame ( SCCOL nStartCol, SCROW nStartRow, SCCOL SvxBoxItem aBox( ATTR_BORDER ); if ( nStartCol == mnTabStartCol ) - aBox.SetLine(&aOutLine, BOX_LINE_LEFT); + aBox.SetLine(&aOutLine, SvxBoxItemLine::LEFT); else - aBox.SetLine(&aLine, BOX_LINE_LEFT); + aBox.SetLine(&aLine, SvxBoxItemLine::LEFT); if ( nStartRow == mnTabStartRow ) - aBox.SetLine(&aOutLine, BOX_LINE_TOP); + aBox.SetLine(&aOutLine, SvxBoxItemLine::TOP); else - aBox.SetLine(&aLine, BOX_LINE_TOP); + aBox.SetLine(&aLine, SvxBoxItemLine::TOP); if ( nEndCol == mnTabEndCol ) //bottom row - aBox.SetLine(&aOutLine, BOX_LINE_RIGHT); + aBox.SetLine(&aOutLine, SvxBoxItemLine::RIGHT); else - aBox.SetLine(&aLine, BOX_LINE_RIGHT); + aBox.SetLine(&aLine, SvxBoxItemLine::RIGHT); if ( nEndRow == mnTabEndRow ) //bottom - aBox.SetLine(&aOutLine, BOX_LINE_BOTTOM); + aBox.SetLine(&aOutLine, SvxBoxItemLine::BOTTOM); else - aBox.SetLine(&aLine, BOX_LINE_BOTTOM); + aBox.SetLine(&aLine, SvxBoxItemLine::BOTTOM); SvxBoxInfoItem aBoxInfo( ATTR_BORDER_INNER ); aBoxInfo.SetValid(SvxBoxInfoItemValidFlags::VERT,false ); if ( bHori ) { aBoxInfo.SetValid(SvxBoxInfoItemValidFlags::HORI,true); - aBoxInfo.SetLine( &aLine, BOXINFO_LINE_HORI ); + aBoxInfo.SetLine( &aLine, SvxBoxInfoItemLine::HORI ); } else aBoxInfo.SetValid(SvxBoxInfoItemValidFlags::HORI,false ); @@ -311,10 +311,10 @@ void lcl_SetFrame( ScDocument* pDoc, SCTAB nTab, { ::editeng::SvxBorderLine aLine(0, nWidth, table::BorderLineStyle::SOLID); SvxBoxItem aBox( ATTR_BORDER ); - aBox.SetLine(&aLine, BOX_LINE_LEFT); - aBox.SetLine(&aLine, BOX_LINE_TOP); - aBox.SetLine(&aLine, BOX_LINE_RIGHT); - aBox.SetLine(&aLine, BOX_LINE_BOTTOM); + aBox.SetLine(&aLine, SvxBoxItemLine::LEFT); + aBox.SetLine(&aLine, SvxBoxItemLine::TOP); + aBox.SetLine(&aLine, SvxBoxItemLine::RIGHT); + aBox.SetLine(&aLine, SvxBoxItemLine::BOTTOM); SvxBoxInfoItem aBoxInfo( ATTR_BORDER_INNER ); aBoxInfo.SetValid(SvxBoxInfoItemValidFlags::HORI,false); aBoxInfo.SetValid(SvxBoxInfoItemValidFlags::VERT,false); diff --git a/sc/source/core/data/stlpool.cxx b/sc/source/core/data/stlpool.cxx index 3a02702cb52b..7788fa32f94f 100644 --- a/sc/source/core/data/stlpool.cxx +++ b/sc/source/core/data/stlpool.cxx @@ -368,10 +368,10 @@ void ScStyleSheetPool::CreateStandardStyles() pSheet->SetHelpId( aHelpFile, HID_SC_SHEET_PAGE_REP ); // Background and 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 ); aBoxItem.SetDistance( 10 ); // 0.2mm aBoxInfoItem.SetValid( SvxBoxInfoItemValidFlags::TOP, true ); aBoxInfoItem.SetValid( SvxBoxInfoItemValidFlags::BOTTOM, true ); diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx index 6e067bfa8687..660a776cf90f 100644 --- a/sc/source/core/data/table2.cxx +++ b/sc/source/core/data/table2.cxx @@ -881,14 +881,14 @@ void ScTable::TransposeClip( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, if ( rOldBox.GetTop() || rOldBox.GetBottom() || rOldBox.GetLeft() || rOldBox.GetRight() ) { SvxBoxItem aNew( ATTR_BORDER ); - aNew.SetLine( rOldBox.GetLine( BOX_LINE_TOP ), BOX_LINE_LEFT ); - aNew.SetLine( rOldBox.GetLine( BOX_LINE_LEFT ), BOX_LINE_TOP ); - aNew.SetLine( rOldBox.GetLine( BOX_LINE_BOTTOM ), BOX_LINE_RIGHT ); - aNew.SetLine( rOldBox.GetLine( BOX_LINE_RIGHT ), BOX_LINE_BOTTOM ); - aNew.SetDistance( rOldBox.GetDistance( BOX_LINE_TOP ), BOX_LINE_LEFT ); - aNew.SetDistance( rOldBox.GetDistance( BOX_LINE_LEFT ), BOX_LINE_TOP ); - aNew.SetDistance( rOldBox.GetDistance( BOX_LINE_BOTTOM ), BOX_LINE_RIGHT ); - aNew.SetDistance( rOldBox.GetDistance( BOX_LINE_RIGHT ), BOX_LINE_BOTTOM ); + aNew.SetLine( rOldBox.GetLine( SvxBoxItemLine::TOP ), SvxBoxItemLine::LEFT ); + aNew.SetLine( rOldBox.GetLine( SvxBoxItemLine::LEFT ), SvxBoxItemLine::TOP ); + aNew.SetLine( rOldBox.GetLine( SvxBoxItemLine::BOTTOM ), SvxBoxItemLine::RIGHT ); + aNew.SetLine( rOldBox.GetLine( SvxBoxItemLine::RIGHT ), SvxBoxItemLine::BOTTOM ); + aNew.SetDistance( rOldBox.GetDistance( SvxBoxItemLine::TOP ), SvxBoxItemLine::LEFT ); + aNew.SetDistance( rOldBox.GetDistance( SvxBoxItemLine::LEFT ), SvxBoxItemLine::TOP ); + aNew.SetDistance( rOldBox.GetDistance( SvxBoxItemLine::BOTTOM ), SvxBoxItemLine::RIGHT ); + aNew.SetDistance( rOldBox.GetDistance( SvxBoxItemLine::RIGHT ), SvxBoxItemLine::BOTTOM ); rNewSet.Put( aNew ); } diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx index 7c6085000aa4..c82469b6a1c4 100644 --- a/sc/source/core/data/table4.cxx +++ b/sc/source/core/data/table4.cxx @@ -2021,48 +2021,48 @@ void ScTable::GetAutoFormatFrame(SCCOL nCol, SCROW nRow, sal_uInt16 nFlags, sal_ if (pLeftBox) { if (ScHasPriority(pTheBox->GetLeft(), pLeftBox->GetRight())) - aBox.SetLine(pTheBox->GetLeft(), BOX_LINE_LEFT); + aBox.SetLine(pTheBox->GetLeft(), SvxBoxItemLine::LEFT); else - aBox.SetLine(pLeftBox->GetRight(), BOX_LINE_LEFT); + aBox.SetLine(pLeftBox->GetRight(), SvxBoxItemLine::LEFT); } else - aBox.SetLine(pTheBox->GetLeft(), BOX_LINE_LEFT); + aBox.SetLine(pTheBox->GetLeft(), SvxBoxItemLine::LEFT); } if (nFlags & LF_TOP) { if (pTopBox) { if (ScHasPriority(pTheBox->GetTop(), pTopBox->GetBottom())) - aBox.SetLine(pTheBox->GetTop(), BOX_LINE_TOP); + aBox.SetLine(pTheBox->GetTop(), SvxBoxItemLine::TOP); else - aBox.SetLine(pTopBox->GetBottom(), BOX_LINE_TOP); + aBox.SetLine(pTopBox->GetBottom(), SvxBoxItemLine::TOP); } else - aBox.SetLine(pTheBox->GetTop(), BOX_LINE_TOP); + aBox.SetLine(pTheBox->GetTop(), SvxBoxItemLine::TOP); } if (nFlags & LF_RIGHT) { if (pRightBox) { if (ScHasPriority(pTheBox->GetRight(), pRightBox->GetLeft())) - aBox.SetLine(pTheBox->GetRight(), BOX_LINE_RIGHT); + aBox.SetLine(pTheBox->GetRight(), SvxBoxItemLine::RIGHT); else - aBox.SetLine(pRightBox->GetLeft(), BOX_LINE_RIGHT); + aBox.SetLine(pRightBox->GetLeft(), SvxBoxItemLine::RIGHT); } else - aBox.SetLine(pTheBox->GetRight(), BOX_LINE_RIGHT); + aBox.SetLine(pTheBox->GetRight(), SvxBoxItemLine::RIGHT); } if (nFlags & LF_BOTTOM) { if (pBottomBox) { if (ScHasPriority(pTheBox->GetBottom(), pBottomBox->GetTop())) - aBox.SetLine(pTheBox->GetBottom(), BOX_LINE_BOTTOM); + aBox.SetLine(pTheBox->GetBottom(), SvxBoxItemLine::BOTTOM); else - aBox.SetLine(pBottomBox->GetTop(), BOX_LINE_BOTTOM); + aBox.SetLine(pBottomBox->GetTop(), SvxBoxItemLine::BOTTOM); } else - aBox.SetLine(pTheBox->GetBottom(), BOX_LINE_BOTTOM); + aBox.SetLine(pTheBox->GetBottom(), SvxBoxItemLine::BOTTOM); } rData.PutItem( nIndex, aBox ); } diff --git a/sc/source/core/tool/autoform.cxx b/sc/source/core/tool/autoform.cxx index a6c5e3ffa562..6d69934d08a8 100644 --- a/sc/source/core/tool/autoform.cxx +++ b/sc/source/core/tool/autoform.cxx @@ -845,10 +845,10 @@ ScAutoFormat::ScAutoFormat() : Color aBlack( COL_BLACK ); ::editeng::SvxBorderLine aLine( &aBlack, DEF_LINE_WIDTH_0 ); SvxBoxItem aBox( ATTR_BORDER ); - aBox.SetLine(&aLine, BOX_LINE_LEFT); - aBox.SetLine(&aLine, BOX_LINE_TOP); - aBox.SetLine(&aLine, BOX_LINE_RIGHT); - aBox.SetLine(&aLine, BOX_LINE_BOTTOM); + aBox.SetLine(&aLine, SvxBoxItemLine::LEFT); + aBox.SetLine(&aLine, SvxBoxItemLine::TOP); + aBox.SetLine(&aLine, SvxBoxItemLine::RIGHT); + aBox.SetLine(&aLine, SvxBoxItemLine::BOTTOM); Color aWhite(COL_WHITE); Color aBlue(COL_BLUE); diff --git a/sc/source/filter/excel/xistyle.cxx b/sc/source/filter/excel/xistyle.cxx index 56d99366658e..393493535652 100644 --- a/sc/source/filter/excel/xistyle.cxx +++ b/sc/source/filter/excel/xistyle.cxx @@ -973,13 +973,13 @@ void XclImpCellBorder::FillToItemSet( SfxItemSet& rItemSet, const XclImpPalette& SvxBoxItem aBoxItem( ATTR_BORDER ); ::editeng::SvxBorderLine aLine; if( mbLeftUsed && lclConvertBorderLine( aLine, rPalette, mnLeftLine, mnLeftColor ) ) - aBoxItem.SetLine( &aLine, BOX_LINE_LEFT ); + aBoxItem.SetLine( &aLine, SvxBoxItemLine::LEFT ); if( mbRightUsed && lclConvertBorderLine( aLine, rPalette, mnRightLine, mnRightColor ) ) - aBoxItem.SetLine( &aLine, BOX_LINE_RIGHT ); + aBoxItem.SetLine( &aLine, SvxBoxItemLine::RIGHT ); if( mbTopUsed && lclConvertBorderLine( aLine, rPalette, mnTopLine, mnTopColor ) ) - aBoxItem.SetLine( &aLine, BOX_LINE_TOP ); + aBoxItem.SetLine( &aLine, SvxBoxItemLine::TOP ); if( mbBottomUsed && lclConvertBorderLine( aLine, rPalette, mnBottomLine, mnBottomColor ) ) - aBoxItem.SetLine( &aLine, BOX_LINE_BOTTOM ); + aBoxItem.SetLine( &aLine, SvxBoxItemLine::BOTTOM ); ScfTools::PutItem( rItemSet, aBoxItem, bSkipPoolDefs ); } if( mbDiagUsed ) @@ -1954,10 +1954,10 @@ void XclImpXFRangeBuffer::SetColumnDefXF( SCCOL nScCol, sal_uInt16 nXFIndex ) maColumns[ nIndex ]->SetDefaultXF( XclImpXFIndex( nXFIndex ) ); } -void XclImpXFRangeBuffer::SetBorderLine( const ScRange& rRange, SCTAB nScTab, sal_uInt16 nLine ) +void XclImpXFRangeBuffer::SetBorderLine( const ScRange& rRange, SCTAB nScTab, SvxBoxItemLine nLine ) { - SCCOL nFromScCol = (nLine == BOX_LINE_RIGHT) ? rRange.aEnd.Col() : rRange.aStart.Col(); - SCROW nFromScRow = (nLine == BOX_LINE_BOTTOM) ? rRange.aEnd.Row() : rRange.aStart.Row(); + SCCOL nFromScCol = (nLine == SvxBoxItemLine::RIGHT) ? rRange.aEnd.Col() : rRange.aStart.Col(); + SCROW nFromScRow = (nLine == SvxBoxItemLine::BOTTOM) ? rRange.aEnd.Row() : rRange.aStart.Row(); ScDocument& rDoc = GetDoc(); const SvxBoxItem* pFromItem = static_cast< const SvxBoxItem* >( @@ -2052,10 +2052,10 @@ void XclImpXFRangeBuffer::Finalize() bool bMultiRow = rStart.Row() != rEnd.Row(); // set correct right border if( bMultiCol ) - SetBorderLine( *pRange, nScTab, BOX_LINE_RIGHT ); + SetBorderLine( *pRange, nScTab, SvxBoxItemLine::RIGHT ); // set correct lower border if( bMultiRow ) - SetBorderLine( *pRange, nScTab, BOX_LINE_BOTTOM ); + SetBorderLine( *pRange, nScTab, SvxBoxItemLine::BOTTOM ); // do merge if( bMultiCol || bMultiRow ) rDoc.getDoc().DoMerge( nScTab, rStart.Col(), rStart.Row(), rEnd.Col(), rEnd.Row() ); diff --git a/sc/source/filter/html/htmlimp.cxx b/sc/source/filter/html/htmlimp.cxx index 24d6df0eee5e..6e4cc376f49b 100644 --- a/sc/source/filter/html/htmlimp.cxx +++ b/sc/source/filter/html/htmlimp.cxx @@ -148,13 +148,13 @@ void ScHTMLImport::WriteToDocument( { const SvxBoxItem* pFromItem = static_cast<const SvxBoxItem*>( mpDoc->GetAttr( pEntry->nCol + nColMerge - 1, pEntry->nRow, nTab, ATTR_BORDER ) ); - aNewItem.SetLine( pFromItem->GetLine( BOX_LINE_RIGHT ), BOX_LINE_RIGHT ); + aNewItem.SetLine( pFromItem->GetLine( SvxBoxItemLine::RIGHT ), SvxBoxItemLine::RIGHT ); } if( nRowMerge > 1 ) { const SvxBoxItem* pFromItem = static_cast<const SvxBoxItem*>( mpDoc->GetAttr( pEntry->nCol, pEntry->nRow + nRowMerge - 1, nTab, ATTR_BORDER ) ); - aNewItem.SetLine( pFromItem->GetLine( BOX_LINE_BOTTOM ), BOX_LINE_BOTTOM ); + aNewItem.SetLine( pFromItem->GetLine( SvxBoxItemLine::BOTTOM ), SvxBoxItemLine::BOTTOM ); } mpDoc->ApplyAttr( pEntry->nCol, pEntry->nRow, nTab, aNewItem ); } diff --git a/sc/source/filter/html/htmlpars.cxx b/sc/source/filter/html/htmlpars.cxx index 60cda8547d53..fd390dd5d5a6 100644 --- a/sc/source/filter/html/htmlpars.cxx +++ b/sc/source/filter/html/htmlpars.cxx @@ -2329,12 +2329,12 @@ void ScHTMLTable::ApplyCellBorders( ScDocument* pDoc, const ScAddress& rFirstPos SCROW nCellRow2 = nCellRow1 + GetDocSize( tdRow, nRow ) - 1; for( SCCOL nCellCol = nCellCol1; nCellCol <= nCellCol2; ++nCellCol ) { - aBorderItem.SetLine( (nCellCol == nCellCol1) ? pLeftLine : 0, BOX_LINE_LEFT ); - aBorderItem.SetLine( (nCellCol == nCellCol2) ? pRightLine : 0, BOX_LINE_RIGHT ); + aBorderItem.SetLine( (nCellCol == nCellCol1) ? pLeftLine : 0, SvxBoxItemLine::LEFT ); + aBorderItem.SetLine( (nCellCol == nCellCol2) ? pRightLine : 0, SvxBoxItemLine::RIGHT ); for( SCROW nCellRow = nCellRow1; nCellRow <= nCellRow2; ++nCellRow ) { - aBorderItem.SetLine( (nCellRow == nCellRow1) ? pTopLine : 0, BOX_LINE_TOP ); - aBorderItem.SetLine( (nCellRow == nCellRow2) ? pBottomLine : 0, BOX_LINE_BOTTOM ); + aBorderItem.SetLine( (nCellRow == nCellRow1) ? pTopLine : 0, SvxBoxItemLine::TOP ); + aBorderItem.SetLine( (nCellRow == nCellRow2) ? pBottomLine : 0, SvxBoxItemLine::BOTTOM ); pDoc->ApplyAttr( nCellCol, nCellRow, rFirstPos.Tab(), aBorderItem ); } } diff --git a/sc/source/filter/inc/xistyle.hxx b/sc/source/filter/inc/xistyle.hxx index dd08823d0482..2b69c1b54d8e 100644 --- a/sc/source/filter/inc/xistyle.hxx +++ b/sc/source/filter/inc/xistyle.hxx @@ -32,6 +32,7 @@ #include "xiroot.hxx" struct ScAttrEntry; +enum class SvxBoxItemLine; /* ============================================================================ - Buffers for style records (PALETTE, FONT, FORMAT, XF) @@ -648,9 +649,9 @@ private: /** Copies border of the last cell of the range to the first cell to keep it visible when the range is merged. @param nLine - BOX_LINE_RIGHT = copy most-right border of top row; - BOX_LINE_BOTTOM = copy most-bottom border of first column. */ - void SetBorderLine( const ScRange& rRange, SCTAB nScTab, sal_uInt16 nLine ); + SvxBoxItemLine::RIGHT = copy most-right border of top row; + SvxBoxItemLine::BOTTOM = copy most-bottom border of first column. */ + void SetBorderLine( const ScRange& rRange, SCTAB nScTab, SvxBoxItemLine nLine ); private: typedef boost::shared_ptr< XclImpXFRangeColumn > XclImpXFRangeColumnRef; diff --git a/sc/source/filter/lotus/lotattr.cxx b/sc/source/filter/lotus/lotattr.cxx index ec1071219025..9444d9cba035 100644 --- a/sc/source/filter/lotus/lotattr.cxx +++ b/sc/source/filter/lotus/lotattr.cxx @@ -119,10 +119,10 @@ const ScPatternAttr& LotAttrCache::GetPattAttr( const LotAttrWK3& rAttr ) nLine >>= 2; LotusToScBorderLine( nLine, aBottom ); - aBox.SetLine( &aTop, BOX_LINE_TOP ); - aBox.SetLine( &aLeft, BOX_LINE_LEFT ); - aBox.SetLine( &aBottom, BOX_LINE_BOTTOM ); - aBox.SetLine( &aRight, BOX_LINE_RIGHT ); + aBox.SetLine( &aTop, SvxBoxItemLine::TOP ); + aBox.SetLine( &aLeft, SvxBoxItemLine::LEFT ); + aBox.SetLine( &aBottom, SvxBoxItemLine::BOTTOM ); + aBox.SetLine( &aRight, SvxBoxItemLine::RIGHT ); rItemSet.Put( aBox ); } diff --git a/sc/source/filter/oox/sheetdatabuffer.cxx b/sc/source/filter/oox/sheetdatabuffer.cxx index 58fc26aa317a..812eee140a27 100644 --- a/sc/source/filter/oox/sheetdatabuffer.cxx +++ b/sc/source/filter/oox/sheetdatabuffer.cxx @@ -719,10 +719,10 @@ void SheetDataBuffer::setCellFormat( const CellModel& rModel, sal_Int32 nNumFmtI } } -void lcl_SetBorderLine( ScDocument& rDoc, ScRange& rRange, SCTAB nScTab, sal_uInt16 nLine ) +void lcl_SetBorderLine( ScDocument& rDoc, ScRange& rRange, SCTAB nScTab, SvxBoxItemLine nLine ) { - SCCOL nFromScCol = (nLine == BOX_LINE_RIGHT) ? rRange.aEnd.Col() : rRange.aStart.Col(); - SCROW nFromScRow = (nLine == BOX_LINE_BOTTOM) ? rRange.aEnd.Row() : rRange.aStart.Row(); + SCCOL nFromScCol = (nLine == SvxBoxItemLine::RIGHT) ? rRange.aEnd.Col() : rRange.aStart.Col(); + SCROW nFromScRow = (nLine == SvxBoxItemLine::BOTTOM) ? rRange.aEnd.Row() : rRange.aStart.Row(); const SvxBoxItem* pFromItem = static_cast< const SvxBoxItem* >( rDoc.GetAttr( nFromScCol, nFromScRow, nScTab, ATTR_BORDER ) ); @@ -746,10 +746,10 @@ void SheetDataBuffer::applyCellMerging( const CellRangeAddress& rRange ) ScDocument& rDoc = getScDocument(); // set correct right border if( bMultiCol ) - lcl_SetBorderLine( rDoc, aRange, getSheetIndex(), BOX_LINE_RIGHT ); + lcl_SetBorderLine( rDoc, aRange, getSheetIndex(), SvxBoxItemLine::RIGHT ); // set correct lower border if( bMultiRow ) - lcl_SetBorderLine( rDoc, aRange, getSheetIndex(), BOX_LINE_BOTTOM ); + lcl_SetBorderLine( rDoc, aRange, getSheetIndex(), SvxBoxItemLine::BOTTOM ); // do merge if( bMultiCol || bMultiRow ) rDoc.DoMerge( getSheetIndex(), rStart.Col(), rStart.Row(), rEnd.Col(), rEnd.Row() ); diff --git a/sc/source/filter/oox/stylesbuffer.cxx b/sc/source/filter/oox/stylesbuffer.cxx index 7cf7158c3239..39995a1a9504 100644 --- a/sc/source/filter/oox/stylesbuffer.cxx +++ b/sc/source/filter/oox/stylesbuffer.cxx @@ -1601,19 +1601,19 @@ void Border::fillToItemSet( SfxItemSet& rItemSet, bool bSkipPoolDefs ) const if (SvxBoxItem::LineToSvxLine(maApiData.maLeft, aLine, false)) { - aBoxItem.SetLine( &aLine, BOX_LINE_LEFT ); + aBoxItem.SetLine( &aLine, SvxBoxItemLine::LEFT ); } if (SvxBoxItem::LineToSvxLine(maApiData.maRight, aLine, false)) { - aBoxItem.SetLine( &aLine, BOX_LINE_RIGHT ); + aBoxItem.SetLine( &aLine, SvxBoxItemLine::RIGHT ); } if (SvxBoxItem::LineToSvxLine(maApiData.maTop, aLine, false)) { - aBoxItem.SetLine( &aLine, BOX_LINE_TOP ); + aBoxItem.SetLine( &aLine, SvxBoxItemLine::TOP ); } if (SvxBoxItem::LineToSvxLine(maApiData.maBottom, aLine, false)) { - aBoxItem.SetLine( &aLine, BOX_LINE_BOTTOM ); + aBoxItem.SetLine( &aLine, SvxBoxItemLine::BOTTOM ); } ScfTools::PutItem( rItemSet, aBoxItem, bSkipPoolDefs ); } diff --git a/sc/source/filter/starcalc/scflt.cxx b/sc/source/filter/starcalc/scflt.cxx index 791ec6ad8453..682eb20927c7 100644 --- a/sc/source/filter/starcalc/scflt.cxx +++ b/sc/source/filter/starcalc/scflt.cxx @@ -832,16 +832,16 @@ void Sc10PageCollection::PutToDoc( ScDocument* pDoc ) SvxBoxItem aBox( ATTR_BORDER ); aLine.SetWidth(nLeft); aLine.SetColor(ColorLeft); - aBox.SetLine(&aLine, BOX_LINE_LEFT); + aBox.SetLine(&aLine, SvxBoxItemLine::LEFT); aLine.SetWidth(nTop); aLine.SetColor(ColorTop); - aBox.SetLine(&aLine, BOX_LINE_TOP); + aBox.SetLine(&aLine, SvxBoxItemLine::TOP); aLine.SetWidth(nRight); aLine.SetColor(ColorRight); - aBox.SetLine(&aLine, BOX_LINE_RIGHT); + aBox.SetLine(&aLine, SvxBoxItemLine::RIGHT); aLine.SetWidth(nBottom); aLine.SetColor(ColorBottom); - aBox.SetLine(&aLine, BOX_LINE_BOTTOM); + aBox.SetLine(&aLine, SvxBoxItemLine::BOTTOM); aSetItemItemSet.Put(aBox); } @@ -1256,16 +1256,16 @@ void Sc10Import::LoadPatternCollection() aLine.SetWidth( nLeft ); aLine.SetColor( ColorLeft ); - aBox.SetLine( &aLine, BOX_LINE_LEFT ); + aBox.SetLine( &aLine, SvxBoxItemLine::LEFT ); aLine.SetWidth( nTop ); aLine.SetColor( ColorTop ); - aBox.SetLine( &aLine, BOX_LINE_TOP ); + aBox.SetLine( &aLine, SvxBoxItemLine::TOP ); aLine.SetWidth( nRight ); aLine.SetColor( ColorRight ); - aBox.SetLine( &aLine, BOX_LINE_RIGHT ); + aBox.SetLine( &aLine, SvxBoxItemLine::RIGHT ); aLine.SetWidth( nBottom ); aLine.SetColor( ColorBottom ); - aBox.SetLine( &aLine, BOX_LINE_BOTTOM ); + aBox.SetLine( &aLine, SvxBoxItemLine::BOTTOM ); rItemSet.Put( aBox ); } } @@ -1936,19 +1936,19 @@ void Sc10Import::LoadColAttr(SCCOL Col, SCTAB Tab) aLine.SetWidth( nLeft ); aLine.SetColor( ColorLeft ); - aBox.SetLine( &aLine, BOX_LINE_LEFT ); + aBox.SetLine( &aLine, SvxBoxItemLine::LEFT ); aLine.SetWidth( nTop ); aLine.SetColor( ColorTop ); - aBox.SetLine( &aLine, BOX_LINE_TOP ); + aBox.SetLine( &aLine, SvxBoxItemLine::TOP ); aLine.SetWidth( nRight ); aLine.SetColor( ColorRight ); - aBox.SetLine( &aLine, BOX_LINE_RIGHT ); + aBox.SetLine( &aLine, SvxBoxItemLine::RIGHT ); aLine.SetWidth( nBottom ); aLine.SetColor( ColorBottom ); - aBox.SetLine( &aLine, BOX_LINE_BOTTOM ); + aBox.SetLine( &aLine, SvxBoxItemLine::BOTTOM ); aScPattern.GetItemSet().Put( aBox ); pDoc->ApplyPatternAreaTab( Col, nStart, Col, nEnd, Tab, aScPattern ); diff --git a/sc/source/ui/sidebar/CellBorderStyleControl.cxx b/sc/source/ui/sidebar/CellBorderStyleControl.cxx index 17a28ae56570..5fad23d1f1cb 100644 --- a/sc/source/ui/sidebar/CellBorderStyleControl.cxx +++ b/sc/source/ui/sidebar/CellBorderStyleControl.cxx @@ -160,8 +160,8 @@ IMPL_LINK(CellBorderStyleControl, TB1SelectHdl, ToolBox*, pToolBox) break; case TBI_BORDER1_ALL: pLeft = pRight = pTop = pBottom = &theDefLine; - aBorderInner.SetLine( &theDefLine, BOXINFO_LINE_HORI ); - aBorderInner.SetLine( &theDefLine, BOXINFO_LINE_VERT ); + aBorderInner.SetLine( &theDefLine, SvxBoxInfoItemLine::HORI ); + aBorderInner.SetLine( &theDefLine, SvxBoxInfoItemLine::VERT ); nValidFlags |= FRM_VALID_ALL; break; case TBI_BORDER1_OUTER: @@ -175,10 +175,10 @@ IMPL_LINK(CellBorderStyleControl, TB1SelectHdl, ToolBox*, pToolBox) break; } - aBorderOuter.SetLine( pLeft, BOX_LINE_LEFT ); - aBorderOuter.SetLine( pRight, BOX_LINE_RIGHT ); - aBorderOuter.SetLine( pTop, BOX_LINE_TOP ); - aBorderOuter.SetLine( pBottom, BOX_LINE_BOTTOM ); + aBorderOuter.SetLine( pLeft, SvxBoxItemLine::LEFT ); + aBorderOuter.SetLine( pRight, SvxBoxItemLine::RIGHT ); + aBorderOuter.SetLine( pTop, SvxBoxItemLine::TOP ); + aBorderOuter.SetLine( pBottom, SvxBoxItemLine::BOTTOM ); aBorderInner.SetValid( SvxBoxInfoItemValidFlags::TOP, 0 != (nValidFlags&FRM_VALID_TOP )); aBorderInner.SetValid( SvxBoxInfoItemValidFlags::BOTTOM, 0 != (nValidFlags&FRM_VALID_BOTTOM )); @@ -244,10 +244,10 @@ IMPL_LINK(CellBorderStyleControl, TB2SelectHdl, ToolBox *, pToolBox) nValidFlags |= FRM_VALID_RIGHT|FRM_VALID_LEFT; break; } - aBorderOuter.SetLine( pLeft, BOX_LINE_LEFT ); - aBorderOuter.SetLine( pRight, BOX_LINE_RIGHT ); - aBorderOuter.SetLine( pTop, BOX_LINE_TOP ); - aBorderOuter.SetLine( pBottom, BOX_LINE_BOTTOM ); + aBorderOuter.SetLine( pLeft, SvxBoxItemLine::LEFT ); + aBorderOuter.SetLine( pRight, SvxBoxItemLine::RIGHT ); + aBorderOuter.SetLine( pTop, SvxBoxItemLine::TOP ); + aBorderOuter.SetLine( pBottom, SvxBoxItemLine::BOTTOM ); aBorderInner.SetValid( SvxBoxInfoItemValidFlags::TOP, 0 != (nValidFlags&FRM_VALID_TOP )); aBorderInner.SetValid( SvxBoxInfoItemValidFlags::BOTTOM, 0 != (nValidFlags&FRM_VALID_BOTTOM )); @@ -316,10 +316,10 @@ IMPL_LINK(CellBorderStyleControl, TB3SelectHdl, ToolBox *, pToolBox) break; } - aBorderOuter.SetLine( pTop.get(), BOX_LINE_TOP ); - aBorderOuter.SetLine( pBottom.get(), BOX_LINE_BOTTOM ); - aBorderOuter.SetLine( NULL, BOX_LINE_LEFT ); - aBorderOuter.SetLine( NULL, BOX_LINE_RIGHT ); + aBorderOuter.SetLine( pTop.get(), SvxBoxItemLine::TOP ); + aBorderOuter.SetLine( pBottom.get(), SvxBoxItemLine::BOTTOM ); + aBorderOuter.SetLine( NULL, SvxBoxItemLine::LEFT ); + aBorderOuter.SetLine( NULL, SvxBoxItemLine::RIGHT ); aBorderInner.SetValid( SvxBoxInfoItemValidFlags::TOP, 0 != (nValidFlags&FRM_VALID_TOP )); aBorderInner.SetValid( SvxBoxInfoItemValidFlags::BOTTOM, 0 != (nValidFlags&FRM_VALID_BOTTOM )); diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx index 9b6adf28b580..7a7d4f595f05 100644 --- a/sc/source/ui/unoobj/cellsuno.cxx +++ b/sc/source/ui/unoobj/cellsuno.cxx @@ -963,12 +963,12 @@ void lcl_fillBoxItems( SvxBoxItem& rOuter, SvxBoxInfoItem& rInner, const TableBo { ::editeng::SvxBorderLine aLine; rOuter.SetDistance( static_cast<sal_uInt16>(HMMToTwips( rBorder.Distance )) ); - rOuter.SetLine( ScHelperFunctions::GetBorderLine( aLine, rBorder.TopLine ), BOX_LINE_TOP ); - rOuter.SetLine( ScHelperFunctions::GetBorderLine( aLine, rBorder.BottomLine ), BOX_LINE_BOTTOM ); - rOuter.SetLine( ScHelperFunctions::GetBorderLine( aLine, rBorder.LeftLine ), BOX_LINE_LEFT ); - rOuter.SetLine( ScHelperFunctions::GetBorderLine( aLine, rBorder.RightLine ), BOX_LINE_RIGHT ); - rInner.SetLine( ScHelperFunctions::GetBorderLine( aLine, rBorder.HorizontalLine ), BOXINFO_LINE_HORI ); - rInner.SetLine( ScHelperFunctions::GetBorderLine( aLine, rBorder.VerticalLine ), BOXINFO_LINE_VERT ); + rOuter.SetLine( ScHelperFunctions::GetBorderLine( aLine, rBorder.TopLine ), SvxBoxItemLine::TOP ); + rOuter.SetLine( ScHelperFunctions::GetBorderLine( aLine, rBorder.BottomLine ), SvxBoxItemLine::BOTTOM ); + rOuter.SetLine( ScHelperFunctions::GetBorderLine( aLine, rBorder.LeftLine ), SvxBoxItemLine::LEFT ); + rOuter.SetLine( ScHelperFunctions::GetBorderLine( aLine, rBorder.RightLine ), SvxBoxItemLine::RIGHT ); + rInner.SetLine( ScHelperFunctions::GetBorderLine( aLine, rBorder.HorizontalLine ), SvxBoxInfoItemLine::HORI ); + rInner.SetLine( ScHelperFunctions::GetBorderLine( aLine, rBorder.VerticalLine ), SvxBoxInfoItemLine::VERT ); rInner.SetValid( SvxBoxInfoItemValidFlags::TOP, rBorder.IsTopLineValid ); rInner.SetValid( SvxBoxInfoItemValidFlags::BOTTOM, rBorder.IsBottomLineValid ); rInner.SetValid( SvxBoxInfoItemValidFlags::LEFT, rBorder.IsLeftLineValid ); diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx index 96c66498e929..706b0da2f28c 100644 --- a/sc/source/ui/view/formatsh.cxx +++ b/sc/source/ui/view/formatsh.cxx @@ -1799,13 +1799,13 @@ void ScFormatShell::ExecuteAttr( SfxRequest& rReq ) // -> Substitute existing lines with pDefLine only if widths are 0. SvxBoxItem aBoxItem ( *static_cast<const SvxBoxItem*>(pItem )); if ( aBoxItem.GetTop() && aBoxItem.GetTop()->GetOutWidth() == 0 ) - aBoxItem.SetLine( pDefLine, BOX_LINE_TOP ); + aBoxItem.SetLine( pDefLine, SvxBoxItemLine::TOP ); if ( aBoxItem.GetBottom() && aBoxItem.GetBottom()->GetOutWidth() == 0 ) - aBoxItem.SetLine( pDefLine, BOX_LINE_BOTTOM ); + aBoxItem.SetLine( pDefLine, SvxBoxItemLine::BOTTOM ); if ( aBoxItem.GetLeft() && aBoxItem.GetLeft()->GetOutWidth() == 0 ) - aBoxItem.SetLine( pDefLine, BOX_LINE_LEFT ); + aBoxItem.SetLine( pDefLine, SvxBoxItemLine::LEFT ); if ( aBoxItem.GetRight() && aBoxItem.GetRight()->GetOutWidth() == 0 ) - aBoxItem.SetLine( pDefLine, BOX_LINE_RIGHT ); + aBoxItem.SetLine( pDefLine, SvxBoxItemLine::RIGHT ); pNewSet->Put( aBoxItem ); rReq.AppendItem( aBoxItem ); } @@ -1815,17 +1815,17 @@ void ScFormatShell::ExecuteAttr( SfxRequest& rReq ) { SvxBoxInfoItem aBoxInfoItem( *static_cast<const SvxBoxInfoItem*>(pItem) ); if ( aBoxInfoItem.GetHori() && aBoxInfoItem.GetHori()->GetOutWidth() == 0 ) - aBoxInfoItem.SetLine( pDefLine, BOXINFO_LINE_HORI ); + aBoxInfoItem.SetLine( pDefLine, SvxBoxInfoItemLine::HORI ); if ( aBoxInfoItem.GetVert() && aBoxInfoItem.GetVert()->GetOutWidth() == 0 ) - aBoxInfoItem.SetLine( pDefLine, BOXINFO_LINE_VERT ); + aBoxInfoItem.SetLine( pDefLine, SvxBoxInfoItemLine::VERT ); pNewSet->Put( aBoxInfoItem ); rReq.AppendItem( aBoxInfoItem ); } else { SvxBoxInfoItem aBoxInfoItem( ATTR_BORDER_INNER ); - aBoxInfoItem.SetLine( NULL, BOXINFO_LINE_HORI ); - aBoxInfoItem.SetLine( NULL, BOXINFO_LINE_VERT ); + aBoxInfoItem.SetLine( NULL, SvxBoxInfoItemLine::HORI ); + aBoxInfoItem.SetLine( NULL, SvxBoxInfoItemLine::VERT ); pNewSet->Put( aBoxInfoItem ); } diff --git a/sc/source/ui/view/printfun.cxx b/sc/source/ui/view/printfun.cxx index 095ef36fe5a6..f97593973084 100644 --- a/sc/source/ui/view/printfun.cxx +++ b/sc/source/ui/view/printfun.cxx @@ -743,8 +743,8 @@ void ScPrintFunc::UpdateHFHeight( ScPrintHFParam& rParam ) long nPaperWidth = ( aPageSize.Width() - nLeftMargin - nRightMargin - rParam.nLeft - rParam.nRight ) * 100 / nZoom; if (rParam.pBorder) - nPaperWidth -= ( rParam.pBorder->GetDistance(BOX_LINE_LEFT) + - rParam.pBorder->GetDistance(BOX_LINE_RIGHT) + + nPaperWidth -= ( rParam.pBorder->GetDistance(SvxBoxItemLine::LEFT) + + rParam.pBorder->GetDistance(SvxBoxItemLine::RIGHT) + lcl_LineTotal(rParam.pBorder->GetLeft()) + lcl_LineTotal(rParam.pBorder->GetRight()) ) * 100 / nZoom; @@ -770,8 +770,8 @@ void ScPrintFunc::UpdateHFHeight( ScPrintHFParam& rParam ) rParam.nHeight = nMaxHeight + rParam.nDistance; if (rParam.pBorder) - rParam.nHeight += rParam.pBorder->GetDistance(BOX_LINE_TOP) + - rParam.pBorder->GetDistance(BOX_LINE_BOTTOM) + + rParam.nHeight += rParam.pBorder->GetDistance(SvxBoxItemLine::TOP) + + rParam.pBorder->GetDistance(SvxBoxItemLine::BOTTOM) + lcl_LineTotal( rParam.pBorder->GetTop() ) + lcl_LineTotal( rParam.pBorder->GetBottom() ); if (rParam.pShadow && rParam.pShadow->GetLocation() != SVX_SHADOW_NONE) @@ -1721,12 +1721,12 @@ void ScPrintFunc::PrintHF( long nPageNo, bool bHeader, long nStartY, Size aPaperSize( nLineWidth, rParam.nHeight-rParam.nDistance ); if ( rParam.pBorder ) { - long nLeft = lcl_LineTotal( rParam.pBorder->GetLeft() ) + rParam.pBorder->GetDistance(BOX_LINE_LEFT); - long nTop = lcl_LineTotal( rParam.pBorder->GetTop() ) + rParam.pBorder->GetDistance(BOX_LINE_TOP); + long nLeft = lcl_LineTotal( rParam.pBorder->GetLeft() ) + rParam.pBorder->GetDistance(SvxBoxItemLine::LEFT); + long nTop = lcl_LineTotal( rParam.pBorder->GetTop() ) + rParam.pBorder->GetDistance(SvxBoxItemLine::TOP); aStart.X() += nLeft; aStart.Y() += nTop; - aPaperSize.Width() -= nLeft + lcl_LineTotal( rParam.pBorder->GetRight() ) + rParam.pBorder->GetDistance(BOX_LINE_RIGHT); - aPaperSize.Height() -= nTop + lcl_LineTotal( rParam.pBorder->GetBottom() ) + rParam.pBorder->GetDistance(BOX_LINE_BOTTOM); + aPaperSize.Width() -= nLeft + lcl_LineTotal( rParam.pBorder->GetRight() ) + rParam.pBorder->GetDistance(SvxBoxItemLine::RIGHT); + aPaperSize.Height() -= nTop + lcl_LineTotal( rParam.pBorder->GetBottom() ) + rParam.pBorder->GetDistance(SvxBoxItemLine::BOTTOM); } if ( rParam.pShadow && rParam.pShadow->GetLocation() != SVX_SHADOW_NONE ) @@ -1760,8 +1760,8 @@ void ScPrintFunc::PrintHF( long nPageNo, bool bHeader, long nStartY, if (rParam.pBorder) nMaxHeight += lcl_LineTotal( rParam.pBorder->GetTop() ) + lcl_LineTotal( rParam.pBorder->GetBottom() ) + - rParam.pBorder->GetDistance(BOX_LINE_TOP) + - rParam.pBorder->GetDistance(BOX_LINE_BOTTOM); + rParam.pBorder->GetDistance(SvxBoxItemLine::TOP) + + rParam.pBorder->GetDistance(SvxBoxItemLine::BOTTOM); if (rParam.pShadow && rParam.pShadow->GetLocation() != SVX_SHADOW_NONE) nMaxHeight += rParam.pShadow->CalcShadowSpace(SHADOW_TOP) + rParam.pShadow->CalcShadowSpace(SHADOW_BOTTOM); @@ -2069,8 +2069,8 @@ void ScPrintFunc::PrintPage( long nPageNo, SCCOL nX1, SCROW nY1, SCCOL nX2, SCRO if (aTableParam.bHeaders) nDataWidth += (long) PRINT_HEADER_WIDTH; if (pBorderItem) - nDataWidth += pBorderItem->GetDistance(BOX_LINE_LEFT) + - pBorderItem->GetDistance(BOX_LINE_RIGHT); //! Line width? + nDataWidth += pBorderItem->GetDistance(SvxBoxItemLine::LEFT) + + pBorderItem->GetDistance(SvxBoxItemLine::RIGHT); //! Line width? if (pShadowItem && pShadowItem->GetLocation() != SVX_SHADOW_NONE) nDataWidth += pShadowItem->CalcShadowSpace(SHADOW_LEFT) + pShadowItem->CalcShadowSpace(SHADOW_RIGHT); @@ -2092,8 +2092,8 @@ void ScPrintFunc::PrintPage( long nPageNo, SCCOL nX1, SCROW nY1, SCCOL nX2, SCRO if (aTableParam.bHeaders) nDataHeight += (long) PRINT_HEADER_HEIGHT; if (pBorderItem) - nDataHeight += pBorderItem->GetDistance(BOX_LINE_TOP) + - pBorderItem->GetDistance(BOX_LINE_BOTTOM); //! Line width? + nDataHeight += pBorderItem->GetDistance(SvxBoxItemLine::TOP) + + pBorderItem->GetDistance(SvxBoxItemLine::BOTTOM); //! Line width? if (pShadowItem && pShadowItem->GetLocation() != SVX_SHADOW_NONE) nDataHeight += pShadowItem->CalcShadowSpace(SHADOW_TOP) + pShadowItem->CalcShadowSpace(SHADOW_BOTTOM); @@ -2136,9 +2136,9 @@ void ScPrintFunc::PrintPage( long nPageNo, SCCOL nX1, SCROW nY1, SCCOL nX2, SCRO if (pBorderItem) { nInnerStartX += (long) ( ( lcl_LineTotal(pBorderItem->GetLeft()) + - pBorderItem->GetDistance(BOX_LINE_LEFT) ) * nScaleX ); + pBorderItem->GetDistance(SvxBoxItemLine::LEFT) ) * nScaleX ); nInnerStartY += (long) ( ( lcl_LineTotal(pBorderItem->GetTop()) + - pBorderItem->GetDistance(BOX_LINE_TOP) ) * nScaleY ); + pBorderItem->GetDistance(SvxBoxItemLine::TOP) ) * nScaleY ); } if (pShadowItem && pShadowItem->GetLocation() != SVX_SHADOW_NONE) { @@ -2190,9 +2190,9 @@ void ScPrintFunc::PrintPage( long nPageNo, SCCOL nX1, SCROW nY1, SCCOL nX2, SCRO if (pBorderItem) { nBorderEndX += (long) ( ( lcl_LineTotal(pBorderItem->GetRight()) + - pBorderItem->GetDistance(BOX_LINE_RIGHT) ) * nScaleX ); + pBorderItem->GetDistance(SvxBoxItemLine::RIGHT) ) * nScaleX ); nBorderEndY += (long) ( ( lcl_LineTotal(pBorderItem->GetBottom()) + - pBorderItem->GetDistance(BOX_LINE_BOTTOM) ) * nScaleY ); + pBorderItem->GetDistance(SvxBoxItemLine::BOTTOM) ) * nScaleY ); } if (pShadowItem && pShadowItem->GetLocation() != SVX_SHADOW_NONE) { @@ -2911,12 +2911,12 @@ Size ScPrintFunc::GetDocPageSize() { aDocPageSize.Width() -= lcl_LineTotal(pBorderItem->GetLeft()) + lcl_LineTotal(pBorderItem->GetRight()) + - pBorderItem->GetDistance(BOX_LINE_LEFT) + - pBorderItem->GetDistance(BOX_LINE_RIGHT); + pBorderItem->GetDistance(SvxBoxItemLine::LEFT) + + pBorderItem->GetDistance(SvxBoxItemLine::RIGHT); aDocPageSize.Height() -= lcl_LineTotal(pBorderItem->GetTop()) + lcl_LineTotal(pBorderItem->GetBottom()) + - pBorderItem->GetDistance(BOX_LINE_TOP) + - pBorderItem->GetDistance(BOX_LINE_BOTTOM); + pBorderItem->GetDistance(SvxBoxItemLine::TOP) + + pBorderItem->GetDistance(SvxBoxItemLine::BOTTOM); } if (pShadowItem && pShadowItem->GetLocation() != SVX_SHADOW_NONE) { diff --git a/sc/source/ui/view/tabvwsha.cxx b/sc/source/ui/view/tabvwsha.cxx index 4864c84ed354..57ad8c88ca2d 100644 --- a/sc/source/ui/view/tabvwsha.cxx +++ b/sc/source/ui/view/tabvwsha.cxx @@ -490,9 +490,9 @@ void ScTabViewShell::ExecuteCellFormatDlg(SfxRequest& rReq, const OString &rName SvxBoxInfoItem aTempInfo( aLineInner ); if ( aLineInner.IsValid(SvxBoxInfoItemValidFlags::LEFT) ) - aNewFrame.SetLine( aLineOuter.GetLeft(), BOX_LINE_RIGHT ); + aNewFrame.SetLine( aLineOuter.GetLeft(), SvxBoxItemLine::RIGHT ); if ( aLineInner.IsValid(SvxBoxInfoItemValidFlags::RIGHT) ) - aNewFrame.SetLine( aLineOuter.GetRight(), BOX_LINE_LEFT ); + aNewFrame.SetLine( aLineOuter.GetRight(), SvxBoxItemLine::LEFT ); aLineInner.SetValid( SvxBoxInfoItemValidFlags::LEFT, aTempInfo.IsValid(SvxBoxInfoItemValidFlags::RIGHT)); aLineInner.SetValid( SvxBoxInfoItemValidFlags::RIGHT, aTempInfo.IsValid(SvxBoxInfoItemValidFlags::LEFT)); diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx index 9cf4091204c7..4b21f410f989 100644 --- a/sc/source/ui/view/viewfun2.cxx +++ b/sc/source/ui/view/viewfun2.cxx @@ -2884,13 +2884,13 @@ void ScViewFunc::SetSelectionFrameLines( const SvxBorderLine* pLine, SvxBoxItem aBoxItem( *static_cast<const SvxBoxItem*>(pBorderAttr) ); SvxBoxInfoItem aBoxInfoItem( ATTR_BORDER_INNER ); - SET_LINE_ATTRIBUTES(Top,BOX_LINE_TOP) - SET_LINE_ATTRIBUTES(Bottom,BOX_LINE_BOTTOM) - SET_LINE_ATTRIBUTES(Left,BOX_LINE_LEFT) - SET_LINE_ATTRIBUTES(Right,BOX_LINE_RIGHT) + SET_LINE_ATTRIBUTES(Top,SvxBoxItemLine::TOP) + SET_LINE_ATTRIBUTES(Bottom,SvxBoxItemLine::BOTTOM) + SET_LINE_ATTRIBUTES(Left,SvxBoxItemLine::LEFT) + SET_LINE_ATTRIBUTES(Right,SvxBoxItemLine::RIGHT) - aBoxInfoItem.SetLine( aBoxItem.GetTop(), BOXINFO_LINE_HORI ); - aBoxInfoItem.SetLine( aBoxItem.GetLeft(), BOXINFO_LINE_VERT ); + aBoxInfoItem.SetLine( aBoxItem.GetTop(), SvxBoxInfoItemLine::HORI ); + aBoxInfoItem.SetLine( aBoxItem.GetLeft(), SvxBoxInfoItemLine::VERT ); aBoxInfoItem.ResetFlags(); // set Lines to Valid pOldSet->Put( *pBorderAttr ); 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; } } } diff --git a/svx/source/table/cell.cxx b/svx/source/table/cell.cxx index 8a8af8c9f00e..c88b4bd2005d 100644 --- a/svx/source/table/cell.cxx +++ b/svx/source/table/cell.cxx @@ -1060,27 +1060,27 @@ void SAL_CALL Cell::setPropertyValue( const OUString& rPropertyName, const Any& SvxBorderLine aLine; bool bSet = SvxBoxItem::LineToSvxLine(pBorder->TopLine, aLine, false); - aBox.SetLine(bSet ? &aLine : 0, BOX_LINE_TOP); + aBox.SetLine(bSet ? &aLine : 0, SvxBoxItemLine::TOP); aBoxInfo.SetValid(SvxBoxInfoItemValidFlags::TOP, pBorder->IsTopLineValid); bSet = SvxBoxItem::LineToSvxLine(pBorder->BottomLine, aLine, false); - aBox.SetLine(bSet ? &aLine : 0, BOX_LINE_BOTTOM); + aBox.SetLine(bSet ? &aLine : 0, SvxBoxItemLine::BOTTOM); aBoxInfo.SetValid(SvxBoxInfoItemValidFlags::BOTTOM, pBorder->IsBottomLineValid); bSet = SvxBoxItem::LineToSvxLine(pBorder->LeftLine, aLine, false); - aBox.SetLine(bSet ? &aLine : 0, BOX_LINE_LEFT); + aBox.SetLine(bSet ? &aLine : 0, SvxBoxItemLine::LEFT); aBoxInfo.SetValid(SvxBoxInfoItemValidFlags::LEFT, pBorder->IsLeftLineValid); bSet = SvxBoxItem::LineToSvxLine(pBorder->RightLine, aLine, false); - aBox.SetLine(bSet ? &aLine : 0, BOX_LINE_RIGHT); + aBox.SetLine(bSet ? &aLine : 0, SvxBoxItemLine::RIGHT); aBoxInfo.SetValid(SvxBoxInfoItemValidFlags::RIGHT, pBorder->IsRightLineValid); bSet = SvxBoxItem::LineToSvxLine(pBorder->HorizontalLine, aLine, false); - aBoxInfo.SetLine(bSet ? &aLine : 0, BOXINFO_LINE_HORI); + aBoxInfo.SetLine(bSet ? &aLine : 0, SvxBoxInfoItemLine::HORI); aBoxInfo.SetValid(SvxBoxInfoItemValidFlags::HORI, pBorder->IsHorizontalLineValid); bSet = SvxBoxItem::LineToSvxLine(pBorder->VerticalLine, aLine, false); - aBoxInfo.SetLine(bSet ? &aLine : 0, BOXINFO_LINE_VERT); + aBoxInfo.SetLine(bSet ? &aLine : 0, SvxBoxInfoItemLine::VERT); aBoxInfo.SetValid(SvxBoxInfoItemValidFlags::VERT, pBorder->IsVerticalLineValid); aBox.SetDistance(pBorder->Distance); //TODO diff --git a/svx/source/table/tablecontroller.cxx b/svx/source/table/tablecontroller.cxx index e487b06585fc..b2d5d6aeaa10 100644 --- a/svx/source/table/tablecontroller.cxx +++ b/svx/source/table/tablecontroller.cxx @@ -68,6 +68,8 @@ #include <vcl/msgbox.hxx> #include <LibreOfficeKit/LibreOfficeKitEnums.h> #include <memory> +#include <o3tl/enumarray.hxx> +#include <o3tl/enumrange.hxx> using ::editeng::SvxBorderLine; using namespace ::sdr::table; @@ -889,10 +891,10 @@ namespace { // merge drawing layer text distance items into SvxBoxItem used by the dialog SvxBoxItem aBoxItem( static_cast< const SvxBoxItem& >( rAttrSet.Get( SDRATTR_TABLE_BORDER ) ) ); - aBoxItem.SetDistance( sal::static_int_cast< sal_uInt16 >( static_cast<const SdrMetricItem&>(rAttrSet.Get(SDRATTR_TEXT_LEFTDIST)).GetValue()), BOX_LINE_LEFT ); - aBoxItem.SetDistance( sal::static_int_cast< sal_uInt16 >( static_cast<const SdrMetricItem&>(rAttrSet.Get(SDRATTR_TEXT_RIGHTDIST)).GetValue()), BOX_LINE_RIGHT ); - aBoxItem.SetDistance( sal::static_int_cast< sal_uInt16 >( static_cast<const SdrMetricItem&>(rAttrSet.Get(SDRATTR_TEXT_UPPERDIST)).GetValue()), BOX_LINE_TOP ); - aBoxItem.SetDistance( sal::static_int_cast< sal_uInt16 >( static_cast<const SdrMetricItem&>(rAttrSet.Get(SDRATTR_TEXT_LOWERDIST)).GetValue()), BOX_LINE_BOTTOM ); + aBoxItem.SetDistance( sal::static_int_cast< sal_uInt16 >( static_cast<const SdrMetricItem&>(rAttrSet.Get(SDRATTR_TEXT_LEFTDIST)).GetValue()), SvxBoxItemLine::LEFT ); + aBoxItem.SetDistance( sal::static_int_cast< sal_uInt16 >( static_cast<const SdrMetricItem&>(rAttrSet.Get(SDRATTR_TEXT_RIGHTDIST)).GetValue()), SvxBoxItemLine::RIGHT ); + aBoxItem.SetDistance( sal::static_int_cast< sal_uInt16 >( static_cast<const SdrMetricItem&>(rAttrSet.Get(SDRATTR_TEXT_UPPERDIST)).GetValue()), SvxBoxItemLine::TOP ); + aBoxItem.SetDistance( sal::static_int_cast< sal_uInt16 >( static_cast<const SdrMetricItem&>(rAttrSet.Get(SDRATTR_TEXT_LOWERDIST)).GetValue()), SvxBoxItemLine::BOTTOM ); return aBoxItem; } } @@ -942,17 +944,17 @@ void SvxTableController::onFormatTable( SfxRequest& rReq ) SvxBoxItem aNewBoxItem( static_cast< const SvxBoxItem& >( aNewSet.Get( SDRATTR_TABLE_BORDER ) ) ); - if( aNewBoxItem.GetDistance( BOX_LINE_LEFT ) != aBoxItem.GetDistance( BOX_LINE_LEFT ) ) - aNewSet.Put(makeSdrTextLeftDistItem( aNewBoxItem.GetDistance( BOX_LINE_LEFT ) ) ); + if( aNewBoxItem.GetDistance( SvxBoxItemLine::LEFT ) != aBoxItem.GetDistance( SvxBoxItemLine::LEFT ) ) + aNewSet.Put(makeSdrTextLeftDistItem( aNewBoxItem.GetDistance( SvxBoxItemLine::LEFT ) ) ); - if( aNewBoxItem.GetDistance( BOX_LINE_RIGHT ) != aBoxItem.GetDistance( BOX_LINE_RIGHT ) ) - aNewSet.Put(makeSdrTextRightDistItem( aNewBoxItem.GetDistance( BOX_LINE_RIGHT ) ) ); + if( aNewBoxItem.GetDistance( SvxBoxItemLine::RIGHT ) != aBoxItem.GetDistance( SvxBoxItemLine::RIGHT ) ) + aNewSet.Put(makeSdrTextRightDistItem( aNewBoxItem.GetDistance( SvxBoxItemLine::RIGHT ) ) ); - if( aNewBoxItem.GetDistance( BOX_LINE_TOP ) != aBoxItem.GetDistance( BOX_LINE_TOP ) ) - aNewSet.Put(makeSdrTextUpperDistItem( aNewBoxItem.GetDistance( BOX_LINE_TOP ) ) ); + if( aNewBoxItem.GetDistance( SvxBoxItemLine::TOP ) != aBoxItem.GetDistance( SvxBoxItemLine::TOP ) ) + aNewSet.Put(makeSdrTextUpperDistItem( aNewBoxItem.GetDistance( SvxBoxItemLine::TOP ) ) ); - if( aNewBoxItem.GetDistance( BOX_LINE_BOTTOM ) != aBoxItem.GetDistance( BOX_LINE_BOTTOM ) ) - aNewSet.Put(makeSdrTextLowerDistItem( aNewBoxItem.GetDistance( BOX_LINE_BOTTOM ) ) ); + if( aNewBoxItem.GetDistance( SvxBoxItemLine::BOTTOM ) != aBoxItem.GetDistance( SvxBoxItemLine::BOTTOM ) ) + aNewSet.Put(makeSdrTextLowerDistItem( aNewBoxItem.GetDistance( SvxBoxItemLine::BOTTOM ) ) ); SetAttrToSelectedCells(aNewSet, false); } @@ -2249,7 +2251,7 @@ const sal_uInt16 CELL_LOWER = 0x0080; -static void ImplSetLinePreserveColor( SvxBoxItem& rNewFrame, const SvxBorderLine* pNew, sal_uInt16 nLine ) +static void ImplSetLinePreserveColor( SvxBoxItem& rNewFrame, const SvxBorderLine* pNew, SvxBoxItemLine nLine ) { if( pNew ) { @@ -2278,12 +2280,12 @@ static void ImplApplyBoxItem( sal_uInt16 nCellFlags, const SvxBoxItem* pBoxItem, if( nCellFlags & CELL_UPPER ) { if( pBoxInfoItem->IsValid(SvxBoxInfoItemValidFlags::TOP) ) - rNewFrame.SetLine(0, BOX_LINE_BOTTOM ); + rNewFrame.SetLine(0, SvxBoxItemLine::BOTTOM ); } else if( nCellFlags & CELL_LOWER ) { if( pBoxInfoItem->IsValid(SvxBoxInfoItemValidFlags::BOTTOM) ) - rNewFrame.SetLine( 0, BOX_LINE_TOP ); + rNewFrame.SetLine( 0, SvxBoxItemLine::TOP ); } } else if( (nCellFlags & ( CELL_UPPER|CELL_LOWER)) == 0 ) // check if its not sw or se corner @@ -2291,12 +2293,12 @@ static void ImplApplyBoxItem( sal_uInt16 nCellFlags, const SvxBoxItem* pBoxItem, if( nCellFlags & CELL_BEFORE ) { if( pBoxInfoItem->IsValid(SvxBoxInfoItemValidFlags::LEFT) ) - rNewFrame.SetLine( 0, BOX_LINE_RIGHT ); + rNewFrame.SetLine( 0, SvxBoxItemLine::RIGHT ); } else if( nCellFlags & CELL_AFTER ) { if( pBoxInfoItem->IsValid(SvxBoxInfoItemValidFlags::RIGHT) ) - rNewFrame.SetLine( 0, BOX_LINE_LEFT ); + rNewFrame.SetLine( 0, SvxBoxItemLine::LEFT ); } } } @@ -2305,27 +2307,27 @@ static void ImplApplyBoxItem( sal_uInt16 nCellFlags, const SvxBoxItem* pBoxItem, // current cell is inside the selection if( (nCellFlags & CELL_LEFT) ? pBoxInfoItem->IsValid(SvxBoxInfoItemValidFlags::LEFT) : pBoxInfoItem->IsValid(SvxBoxInfoItemValidFlags::VERT) ) - rNewFrame.SetLine( (nCellFlags & CELL_LEFT) ? pBoxItem->GetLeft() : pBoxInfoItem->GetVert(), BOX_LINE_LEFT ); + rNewFrame.SetLine( (nCellFlags & CELL_LEFT) ? pBoxItem->GetLeft() : pBoxInfoItem->GetVert(), SvxBoxItemLine::LEFT ); if( (nCellFlags & CELL_RIGHT) ? pBoxInfoItem->IsValid(SvxBoxInfoItemValidFlags::RIGHT) : pBoxInfoItem->IsValid(SvxBoxInfoItemValidFlags::VERT) ) - rNewFrame.SetLine( (nCellFlags & CELL_RIGHT) ? pBoxItem->GetRight() : pBoxInfoItem->GetVert(), BOX_LINE_RIGHT ); + rNewFrame.SetLine( (nCellFlags & CELL_RIGHT) ? pBoxItem->GetRight() : pBoxInfoItem->GetVert(), SvxBoxItemLine::RIGHT ); if( (nCellFlags & CELL_TOP) ? pBoxInfoItem->IsValid(SvxBoxInfoItemValidFlags::TOP) : pBoxInfoItem->IsValid(SvxBoxInfoItemValidFlags::HORI) ) - rNewFrame.SetLine( (nCellFlags & CELL_TOP) ? pBoxItem->GetTop() : pBoxInfoItem->GetHori(), BOX_LINE_TOP ); + rNewFrame.SetLine( (nCellFlags & CELL_TOP) ? pBoxItem->GetTop() : pBoxInfoItem->GetHori(), SvxBoxItemLine::TOP ); if( (nCellFlags & CELL_BOTTOM) ? pBoxInfoItem->IsValid(SvxBoxInfoItemValidFlags::BOTTOM) : pBoxInfoItem->IsValid(SvxBoxInfoItemValidFlags::HORI) ) - rNewFrame.SetLine( (nCellFlags & CELL_BOTTOM) ? pBoxItem->GetBottom() : pBoxInfoItem->GetHori(), BOX_LINE_BOTTOM ); + rNewFrame.SetLine( (nCellFlags & CELL_BOTTOM) ? pBoxItem->GetBottom() : pBoxInfoItem->GetHori(), SvxBoxItemLine::BOTTOM ); // apply distance to borders if( pBoxInfoItem->IsValid( SvxBoxInfoItemValidFlags::DISTANCE ) ) - for( sal_uInt16 nLine = 0; nLine < 4; ++nLine ) + for( SvxBoxItemLine nLine : o3tl::enumrange<SvxBoxItemLine>() ) rNewFrame.SetDistance( pBoxItem->GetDistance( nLine ), nLine ); } } -static void ImplSetLineColor( SvxBoxItem& rNewFrame, sal_uInt16 nLine, const Color& rColor ) +static void ImplSetLineColor( SvxBoxItem& rNewFrame, SvxBoxItemLine nLine, const Color& rColor ) { const SvxBorderLine* pSourceLine = rNewFrame.GetLine( nLine ); if( pSourceLine ) @@ -2343,16 +2345,16 @@ static void ImplApplyLineColorItem( sal_uInt16 nCellFlags, const SvxColorItem* p const Color aColor( pLineColorItem->GetValue() ); if( (nCellFlags & (CELL_LOWER|CELL_BEFORE|CELL_AFTER)) == 0 ) - ImplSetLineColor( rNewFrame, BOX_LINE_BOTTOM, aColor ); + ImplSetLineColor( rNewFrame, SvxBoxItemLine::BOTTOM, aColor ); if( (nCellFlags & (CELL_UPPER|CELL_BEFORE|CELL_AFTER)) == 0 ) - ImplSetLineColor( rNewFrame, BOX_LINE_TOP, aColor ); + ImplSetLineColor( rNewFrame, SvxBoxItemLine::TOP, aColor ); if( (nCellFlags & (CELL_UPPER|CELL_LOWER|CELL_AFTER)) == 0 ) - ImplSetLineColor( rNewFrame, BOX_LINE_RIGHT, aColor ); + ImplSetLineColor( rNewFrame, SvxBoxItemLine::RIGHT, aColor ); if( (nCellFlags & (CELL_UPPER|CELL_LOWER|CELL_BEFORE)) == 0 ) - ImplSetLineColor( rNewFrame, BOX_LINE_LEFT, aColor ); + ImplSetLineColor( rNewFrame, SvxBoxItemLine::LEFT, aColor ); } @@ -2366,12 +2368,12 @@ static void ImplApplyBorderLineItem( sal_uInt16 nCellFlags, const SvxBorderLine* if( nCellFlags & CELL_UPPER ) { if( rNewFrame.GetBottom() ) - ImplSetLinePreserveColor( rNewFrame, pBorderLineItem, BOX_LINE_BOTTOM ); + ImplSetLinePreserveColor( rNewFrame, pBorderLineItem, SvxBoxItemLine::BOTTOM ); } else if( nCellFlags & CELL_LOWER ) { if( rNewFrame.GetTop() ) - ImplSetLinePreserveColor( rNewFrame, pBorderLineItem, BOX_LINE_TOP ); + ImplSetLinePreserveColor( rNewFrame, pBorderLineItem, SvxBoxItemLine::TOP ); } } else if( (nCellFlags & ( CELL_UPPER|CELL_LOWER)) == 0 ) // check if its not sw or se corner @@ -2379,25 +2381,25 @@ static void ImplApplyBorderLineItem( sal_uInt16 nCellFlags, const SvxBorderLine* if( nCellFlags & CELL_BEFORE ) { if( rNewFrame.GetRight() ) - ImplSetLinePreserveColor( rNewFrame, pBorderLineItem, BOX_LINE_RIGHT ); + ImplSetLinePreserveColor( rNewFrame, pBorderLineItem, SvxBoxItemLine::RIGHT ); } else if( nCellFlags & CELL_AFTER ) { if( rNewFrame.GetLeft() ) - ImplSetLinePreserveColor( rNewFrame, pBorderLineItem, BOX_LINE_LEFT ); + ImplSetLinePreserveColor( rNewFrame, pBorderLineItem, SvxBoxItemLine::LEFT ); } } } else { if( rNewFrame.GetBottom() ) - ImplSetLinePreserveColor( rNewFrame, pBorderLineItem, BOX_LINE_BOTTOM ); + ImplSetLinePreserveColor( rNewFrame, pBorderLineItem, SvxBoxItemLine::BOTTOM ); if( rNewFrame.GetTop() ) - ImplSetLinePreserveColor( rNewFrame, pBorderLineItem, BOX_LINE_TOP ); + ImplSetLinePreserveColor( rNewFrame, pBorderLineItem, SvxBoxItemLine::TOP ); if( rNewFrame.GetRight() ) - ImplSetLinePreserveColor( rNewFrame, pBorderLineItem, BOX_LINE_RIGHT ); + ImplSetLinePreserveColor( rNewFrame, pBorderLineItem, SvxBoxItemLine::RIGHT ); if( rNewFrame.GetLeft() ) - ImplSetLinePreserveColor( rNewFrame, pBorderLineItem, BOX_LINE_LEFT ); + ImplSetLinePreserveColor( rNewFrame, pBorderLineItem, SvxBoxItemLine::LEFT ); } } @@ -2817,29 +2819,29 @@ struct LinesState , rBoxInfoItem(rBoxInfoItem_) , bDistanceIndeterminate(false) { - std::fill_n(aBorderSet, 4, false); - std::fill_n(aInnerLineSet, 2, false); - std::fill_n(aBorderIndeterminate, 4, false); - std::fill_n(aInnerLineIndeterminate, 2, false); - std::fill_n(aDistanceSet, 4, false); - std::fill_n(aDistance, 4, 0); + aBorderSet.fill(false); + aInnerLineSet.fill(false); + aBorderIndeterminate.fill(false); + aInnerLineIndeterminate.fill(false); + aDistanceSet.fill(false); + aDistance.fill(0); } SvxBoxItem& rBoxItem; SvxBoxInfoItem& rBoxInfoItem; - bool aBorderSet[4]; - bool aInnerLineSet[2]; - bool aBorderIndeterminate[4]; - bool aInnerLineIndeterminate[2]; - bool aDistanceSet[4]; - sal_uInt16 aDistance[4]; + o3tl::enumarray<SvxBoxItemLine, bool> aBorderSet; + o3tl::enumarray<SvxBoxInfoItemLine, bool> aInnerLineSet; + o3tl::enumarray<SvxBoxItemLine, bool> aBorderIndeterminate; + o3tl::enumarray<SvxBoxInfoItemLine, bool> aInnerLineIndeterminate; + o3tl::enumarray<SvxBoxItemLine, bool> aDistanceSet; + o3tl::enumarray<SvxBoxItemLine, sal_uInt16> aDistance; bool bDistanceIndeterminate; }; class BoxItemWrapper { public: - BoxItemWrapper(SvxBoxItem& rBoxItem, SvxBoxInfoItem& rBoxInfoItem, sal_uInt16 nBorderLine, sal_uInt16 nInnerLine, bool bBorder); + BoxItemWrapper(SvxBoxItem& rBoxItem, SvxBoxInfoItem& rBoxInfoItem, SvxBoxItemLine nBorderLine, SvxBoxInfoItemLine nInnerLine, bool bBorder); const SvxBorderLine* getLine() const; void setLine(const SvxBorderLine* pLine); @@ -2847,42 +2849,43 @@ public: private: SvxBoxItem& m_rBoxItem; SvxBoxInfoItem& m_rBoxInfoItem; - const sal_uInt16 m_nLine; + const SvxBoxItemLine m_nBorderLine; + const SvxBoxInfoItemLine m_nInnerLine; const bool m_bBorder; }; BoxItemWrapper::BoxItemWrapper( SvxBoxItem& rBoxItem, SvxBoxInfoItem& rBoxInfoItem, - const sal_uInt16 nBorderLine, const sal_uInt16 nInnerLine, const bool bBorder) + const SvxBoxItemLine nBorderLine, const SvxBoxInfoItemLine nInnerLine, const bool bBorder) : m_rBoxItem(rBoxItem) , m_rBoxInfoItem(rBoxInfoItem) - , m_nLine(bBorder ? nBorderLine : nInnerLine) + , m_nBorderLine(nBorderLine) + , m_nInnerLine(nInnerLine) , m_bBorder(bBorder) { - assert(bBorder ? (m_nLine <= BOX_LINE_RIGHT) : (m_nLine <= BOXINFO_LINE_VERT)); } const SvxBorderLine* BoxItemWrapper::getLine() const { if (m_bBorder) - return m_rBoxItem.GetLine(m_nLine); + return m_rBoxItem.GetLine(m_nBorderLine); else - return (m_nLine == BOXINFO_LINE_HORI) ? m_rBoxInfoItem.GetHori() : m_rBoxInfoItem.GetVert(); + return (m_nInnerLine == SvxBoxInfoItemLine::HORI) ? m_rBoxInfoItem.GetHori() : m_rBoxInfoItem.GetVert(); } void BoxItemWrapper::setLine(const SvxBorderLine* pLine) { if (m_bBorder) - m_rBoxItem.SetLine(pLine, m_nLine); + m_rBoxItem.SetLine(pLine, m_nBorderLine); else - m_rBoxInfoItem.SetLine(pLine, m_nLine); + m_rBoxInfoItem.SetLine(pLine, m_nInnerLine); } void lcl_MergeBorderLine( - LinesState& rLinesState, const SvxBorderLine* const pLine, const sal_uInt16 nLine, + LinesState& rLinesState, const SvxBorderLine* const pLine, const SvxBoxItemLine nLine, SvxBoxInfoItemValidFlags nValidFlag, const bool bBorder = true) { - const sal_uInt16 nInnerLine(bBorder ? 0 : ((nValidFlag & SvxBoxInfoItemValidFlags::HORI) ? BOXINFO_LINE_HORI : BOXINFO_LINE_VERT)); + const SvxBoxInfoItemLine nInnerLine(bBorder ? SvxBoxInfoItemLine::HORI : ((nValidFlag & SvxBoxInfoItemValidFlags::HORI) ? SvxBoxInfoItemLine::HORI : SvxBoxInfoItemLine::VERT)); BoxItemWrapper aBoxItem(rLinesState.rBoxItem, rLinesState.rBoxInfoItem, nLine, nInnerLine, bBorder); bool& rbSet(bBorder ? rLinesState.aBorderSet[nLine] : rLinesState.aInnerLineSet[nInnerLine]); @@ -2907,20 +2910,20 @@ void lcl_MergeBorderLine( } void lcl_MergeBorderOrInnerLine( - LinesState& rLinesState, const SvxBorderLine* const pLine, const sal_uInt16 nLine, + LinesState& rLinesState, const SvxBorderLine* const pLine, const SvxBoxItemLine nLine, SvxBoxInfoItemValidFlags nValidFlag, const bool bBorder) { if (bBorder) lcl_MergeBorderLine(rLinesState, pLine, nLine, nValidFlag); else { - const bool bVertical = (nLine == BOX_LINE_LEFT) || (nLine == BOX_LINE_RIGHT); + const bool bVertical = (nLine == SvxBoxItemLine::LEFT) || (nLine == SvxBoxItemLine::RIGHT); lcl_MergeBorderLine(rLinesState, pLine, nLine, bVertical ? SvxBoxInfoItemValidFlags::VERT : SvxBoxInfoItemValidFlags::HORI, false); } } void lcl_MergeDistance( - LinesState& rLinesState, const sal_uInt16 nIndex, const sal_uInt16 nDistance) + LinesState& rLinesState, const SvxBoxItemLine nIndex, const sal_uInt16 nDistance) { if (rLinesState.aDistanceSet[nIndex]) { @@ -2943,16 +2946,16 @@ void lcl_MergeCommonBorderAttr(LinesState& rLinesState, const SvxBoxItem& rCellB if( (nCellFlags & ( CELL_BEFORE|CELL_AFTER)) == 0 ) // check if its not nw or ne corner { if( nCellFlags & CELL_UPPER ) - lcl_MergeBorderLine(rLinesState, rCellBoxItem.GetBottom(), BOX_LINE_TOP, SvxBoxInfoItemValidFlags::TOP); + lcl_MergeBorderLine(rLinesState, rCellBoxItem.GetBottom(), SvxBoxItemLine::TOP, SvxBoxInfoItemValidFlags::TOP); else if( nCellFlags & CELL_LOWER ) - lcl_MergeBorderLine(rLinesState, rCellBoxItem.GetTop(), BOX_LINE_BOTTOM, SvxBoxInfoItemValidFlags::BOTTOM); + lcl_MergeBorderLine(rLinesState, rCellBoxItem.GetTop(), SvxBoxItemLine::BOTTOM, SvxBoxInfoItemValidFlags::BOTTOM); } else if( (nCellFlags & ( CELL_UPPER|CELL_LOWER)) == 0 ) // check if its not sw or se corner { if( nCellFlags & CELL_BEFORE ) - lcl_MergeBorderLine(rLinesState, rCellBoxItem.GetRight(), BOX_LINE_LEFT, SvxBoxInfoItemValidFlags::LEFT); + lcl_MergeBorderLine(rLinesState, rCellBoxItem.GetRight(), SvxBoxItemLine::LEFT, SvxBoxInfoItemValidFlags::LEFT); else if( nCellFlags & CELL_AFTER ) - lcl_MergeBorderLine(rLinesState, rCellBoxItem.GetLeft(), BOX_LINE_RIGHT, SvxBoxInfoItemValidFlags::RIGHT); + lcl_MergeBorderLine(rLinesState, rCellBoxItem.GetLeft(), SvxBoxItemLine::RIGHT, SvxBoxInfoItemValidFlags::RIGHT); } // NOTE: inner distances for cells outside the selected range @@ -2962,15 +2965,15 @@ void lcl_MergeCommonBorderAttr(LinesState& rLinesState, const SvxBoxItem& rCellB { // current cell is inside the selection - lcl_MergeBorderOrInnerLine(rLinesState, rCellBoxItem.GetTop(), BOX_LINE_TOP, SvxBoxInfoItemValidFlags::TOP, (nCellFlags & CELL_TOP) != 0); - lcl_MergeBorderOrInnerLine(rLinesState, rCellBoxItem.GetBottom(), BOX_LINE_BOTTOM, SvxBoxInfoItemValidFlags::BOTTOM, (nCellFlags & CELL_BOTTOM) != 0); - lcl_MergeBorderOrInnerLine(rLinesState, rCellBoxItem.GetLeft(), BOX_LINE_LEFT, SvxBoxInfoItemValidFlags::LEFT, (nCellFlags & CELL_LEFT) != 0); - lcl_MergeBorderOrInnerLine(rLinesState, rCellBoxItem.GetRight(), BOX_LINE_RIGHT, SvxBoxInfoItemValidFlags::RIGHT, (nCellFlags & CELL_RIGHT) != 0); + lcl_MergeBorderOrInnerLine(rLinesState, rCellBoxItem.GetTop(), SvxBoxItemLine::TOP, SvxBoxInfoItemValidFlags::TOP, (nCellFlags & CELL_TOP) != 0); + lcl_MergeBorderOrInnerLine(rLinesState, rCellBoxItem.GetBottom(), SvxBoxItemLine::BOTTOM, SvxBoxInfoItemValidFlags::BOTTOM, (nCellFlags & CELL_BOTTOM) != 0); + lcl_MergeBorderOrInnerLine(rLinesState, rCellBoxItem.GetLeft(), SvxBoxItemLine::LEFT, SvxBoxInfoItemValidFlags::LEFT, (nCellFlags & CELL_LEFT) != 0); + lcl_MergeBorderOrInnerLine(rLinesState, rCellBoxItem.GetRight(), SvxBoxItemLine::RIGHT, SvxBoxInfoItemValidFlags::RIGHT, (nCellFlags & CELL_RIGHT) != 0); - lcl_MergeDistance(rLinesState, BOX_LINE_TOP, rCellBoxItem.GetDistance(BOX_LINE_TOP)); - lcl_MergeDistance(rLinesState, BOX_LINE_BOTTOM, rCellBoxItem.GetDistance(BOX_LINE_BOTTOM)); - lcl_MergeDistance(rLinesState, BOX_LINE_LEFT, rCellBoxItem.GetDistance(BOX_LINE_LEFT)); - lcl_MergeDistance(rLinesState, BOX_LINE_RIGHT, rCellBoxItem.GetDistance(BOX_LINE_RIGHT)); + lcl_MergeDistance(rLinesState, SvxBoxItemLine::TOP, rCellBoxItem.GetDistance(SvxBoxItemLine::TOP)); + lcl_MergeDistance(rLinesState, SvxBoxItemLine::BOTTOM, rCellBoxItem.GetDistance(SvxBoxItemLine::BOTTOM)); + lcl_MergeDistance(rLinesState, SvxBoxItemLine::LEFT, rCellBoxItem.GetDistance(SvxBoxItemLine::LEFT)); + lcl_MergeDistance(rLinesState, SvxBoxItemLine::RIGHT, rCellBoxItem.GetDistance(SvxBoxItemLine::RIGHT)); } } @@ -3030,29 +3033,29 @@ void SvxTableController::FillCommonBorderAttrFromSelectedCells( SvxBoxItem& rBox } } - if (!aLinesState.aBorderIndeterminate[BOX_LINE_TOP]) + if (!aLinesState.aBorderIndeterminate[SvxBoxItemLine::TOP]) aLinesState.rBoxInfoItem.SetValid(SvxBoxInfoItemValidFlags::TOP); - if (!aLinesState.aBorderIndeterminate[BOX_LINE_BOTTOM]) + if (!aLinesState.aBorderIndeterminate[SvxBoxItemLine::BOTTOM]) aLinesState.rBoxInfoItem.SetValid(SvxBoxInfoItemValidFlags::BOTTOM); - if (!aLinesState.aBorderIndeterminate[BOX_LINE_LEFT]) + if (!aLinesState.aBorderIndeterminate[SvxBoxItemLine::LEFT]) aLinesState.rBoxInfoItem.SetValid(SvxBoxInfoItemValidFlags::LEFT); - if (!aLinesState.aBorderIndeterminate[BOX_LINE_RIGHT]) + if (!aLinesState.aBorderIndeterminate[SvxBoxItemLine::RIGHT]) aLinesState.rBoxInfoItem.SetValid(SvxBoxInfoItemValidFlags::RIGHT); - if (!aLinesState.aInnerLineIndeterminate[BOXINFO_LINE_HORI]) + if (!aLinesState.aInnerLineIndeterminate[SvxBoxInfoItemLine::HORI]) aLinesState.rBoxInfoItem.SetValid(SvxBoxInfoItemValidFlags::HORI); - if (!aLinesState.aInnerLineIndeterminate[BOXINFO_LINE_VERT]) + if (!aLinesState.aInnerLineIndeterminate[SvxBoxInfoItemLine::VERT]) aLinesState.rBoxInfoItem.SetValid(SvxBoxInfoItemValidFlags::VERT); if (!aLinesState.bDistanceIndeterminate) { - if (aLinesState.aDistanceSet[BOX_LINE_TOP]) - aLinesState.rBoxItem.SetDistance(aLinesState.aDistance[BOX_LINE_TOP], BOX_LINE_TOP); - if (aLinesState.aDistanceSet[BOX_LINE_BOTTOM]) - aLinesState.rBoxItem.SetDistance(aLinesState.aDistance[BOX_LINE_BOTTOM], BOX_LINE_BOTTOM); - if (aLinesState.aDistanceSet[BOX_LINE_LEFT]) - aLinesState.rBoxItem.SetDistance(aLinesState.aDistance[BOX_LINE_LEFT], BOX_LINE_LEFT); - if (aLinesState.aDistanceSet[BOX_LINE_RIGHT]) - aLinesState.rBoxItem.SetDistance(aLinesState.aDistance[BOX_LINE_RIGHT], BOX_LINE_RIGHT); + if (aLinesState.aDistanceSet[SvxBoxItemLine::TOP]) + aLinesState.rBoxItem.SetDistance(aLinesState.aDistance[SvxBoxItemLine::TOP], SvxBoxItemLine::TOP); + if (aLinesState.aDistanceSet[SvxBoxItemLine::BOTTOM]) + aLinesState.rBoxItem.SetDistance(aLinesState.aDistance[SvxBoxItemLine::BOTTOM], SvxBoxItemLine::BOTTOM); + if (aLinesState.aDistanceSet[SvxBoxItemLine::LEFT]) + aLinesState.rBoxItem.SetDistance(aLinesState.aDistance[SvxBoxItemLine::LEFT], SvxBoxItemLine::LEFT); + if (aLinesState.aDistanceSet[SvxBoxItemLine::RIGHT]) + aLinesState.rBoxItem.SetDistance(aLinesState.aDistance[SvxBoxItemLine::RIGHT], SvxBoxItemLine::RIGHT); aLinesState.rBoxInfoItem.SetValid(SvxBoxInfoItemValidFlags::DISTANCE); } } diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx index 16cbf3816782..b10b889d56e6 100644 --- a/svx/source/tbxctrls/tbcontrl.cxx +++ b/svx/source/tbxctrls/tbcontrl.cxx @@ -1587,39 +1587,39 @@ IMPL_LINK_NOARG(SvxFrameWindow_Impl, SelectHdl) // Inner Table: case 9: // HOR pTop = pBottom = &theDefLine; - aBorderInner.SetLine( &theDefLine, BOXINFO_LINE_HORI ); - aBorderInner.SetLine( NULL, BOXINFO_LINE_VERT ); + aBorderInner.SetLine( &theDefLine, SvxBoxInfoItemLine::HORI ); + aBorderInner.SetLine( NULL, SvxBoxInfoItemLine::VERT ); nValidFlags |= FRM_VALID_HINNER|FRM_VALID_TOP|FRM_VALID_BOTTOM; break; case 10: // HORINNER pLeft = pRight = pTop = pBottom = &theDefLine; - aBorderInner.SetLine( &theDefLine, BOXINFO_LINE_HORI ); - aBorderInner.SetLine( NULL, BOXINFO_LINE_VERT ); + aBorderInner.SetLine( &theDefLine, SvxBoxInfoItemLine::HORI ); + aBorderInner.SetLine( NULL, SvxBoxInfoItemLine::VERT ); nValidFlags |= FRM_VALID_RIGHT|FRM_VALID_LEFT|FRM_VALID_HINNER|FRM_VALID_TOP|FRM_VALID_BOTTOM; break; case 11: // VERINNER pLeft = pRight = pTop = pBottom = &theDefLine; - aBorderInner.SetLine( NULL, BOXINFO_LINE_HORI ); - aBorderInner.SetLine( &theDefLine, BOXINFO_LINE_VERT ); + aBorderInner.SetLine( NULL, SvxBoxInfoItemLine::HORI ); + aBorderInner.SetLine( &theDefLine, SvxBoxInfoItemLine::VERT ); nValidFlags |= FRM_VALID_RIGHT|FRM_VALID_LEFT|FRM_VALID_VINNER|FRM_VALID_TOP|FRM_VALID_BOTTOM; break; case 12: // ALL pLeft = pRight = pTop = pBottom = &theDefLine; - aBorderInner.SetLine( &theDefLine, BOXINFO_LINE_HORI ); - aBorderInner.SetLine( &theDefLine, BOXINFO_LINE_VERT ); + aBorderInner.SetLine( &theDefLine, SvxBoxInfoItemLine::HORI ); + aBorderInner.SetLine( &theDefLine, SvxBoxInfoItemLine::VERT ); nValidFlags |= FRM_VALID_ALL; break; default: break; } - aBorderOuter.SetLine( pLeft, BOX_LINE_LEFT ); - aBorderOuter.SetLine( pRight, BOX_LINE_RIGHT ); - aBorderOuter.SetLine( pTop, BOX_LINE_TOP ); - aBorderOuter.SetLine( pBottom, BOX_LINE_BOTTOM ); + aBorderOuter.SetLine( pLeft, SvxBoxItemLine::LEFT ); + aBorderOuter.SetLine( pRight, SvxBoxItemLine::RIGHT ); + aBorderOuter.SetLine( pTop, SvxBoxItemLine::TOP ); + aBorderOuter.SetLine( pBottom, SvxBoxItemLine::BOTTOM ); if(nModifier == KEY_SHIFT) nValidFlags |= FRM_VALID_ALL; diff --git a/sw/source/core/doc/DocumentStylePoolManager.cxx b/sw/source/core/doc/DocumentStylePoolManager.cxx index 8d9c8e7a5e9c..f415ca6fc1df 100644 --- a/sw/source/core/doc/DocumentStylePoolManager.cxx +++ b/sw/source/core/doc/DocumentStylePoolManager.cxx @@ -997,7 +997,7 @@ SwTxtFmtColl* DocumentStylePoolManager::GetTxtCollFromPool( sal_uInt16 nId, bool SvxBoxItem aBox( RES_BOX ); Color aColor( COL_GRAY ); SvxBorderLine aNew(&aColor, 1, table::BorderLineStyle::DOUBLE); - aBox.SetLine( &aNew, BOX_LINE_BOTTOM ); + aBox.SetLine( &aNew, SvxBoxItemLine::BOTTOM ); aSet.Put( aBox ); aSet.Put( SwParaConnectBorderItem( false ) ); @@ -1257,10 +1257,10 @@ SwFmt* DocumentStylePoolManager::GetFmtFromPool( sal_uInt16 nId ) Color aCol( COL_BLACK ); SvxBorderLine aLine( &aCol, DEF_LINE_WIDTH_0 ); SvxBoxItem aBox( RES_BOX ); - aBox.SetLine( &aLine, BOX_LINE_TOP ); - aBox.SetLine( &aLine, BOX_LINE_BOTTOM ); - aBox.SetLine( &aLine, BOX_LINE_LEFT ); - aBox.SetLine( &aLine, BOX_LINE_RIGHT ); + aBox.SetLine( &aLine, SvxBoxItemLine::TOP ); + aBox.SetLine( &aLine, SvxBoxItemLine::BOTTOM ); + aBox.SetLine( &aLine, SvxBoxItemLine::LEFT ); + aBox.SetLine( &aLine, SvxBoxItemLine::RIGHT ); aBox.SetDistance( 85 ); aSet.Put( aBox ); aSet.Put( SvxLRSpaceItem( 114, 114, 0, 0, RES_LR_SPACE ) ); diff --git a/sw/source/core/doc/gctable.cxx b/sw/source/core/doc/gctable.cxx index 1951495e7383..f5c7b75df09e 100644 --- a/sw/source/core/doc/gctable.cxx +++ b/sw/source/core/doc/gctable.cxx @@ -135,9 +135,9 @@ static void lcl_GCBorder_DelBorder( const SwCollectTblLineBoxes& rCollTLB, { SvxBoxItem aBox( *static_cast<const SvxBoxItem*>(pItem) ); if( bTop ) - aBox.SetLine( 0, BOX_LINE_TOP ); + aBox.SetLine( 0, SvxBoxItemLine::TOP ); else - aBox.SetLine( 0, BOX_LINE_BOTTOM ); + aBox.SetLine( 0, SvxBoxItemLine::BOTTOM ); if( pShareFmts ) pShareFmts->SetAttr( *pBox, aBox ); @@ -191,7 +191,7 @@ void sw_GC_Line_Border( const SwTableLine* pLine, _SwGCLineBorder* pGCPara ) aBPara.IsAnyBorderFound() ) { SvxBoxItem aBox( *static_cast<const SvxBoxItem*>(pItem) ); - aBox.SetLine( 0, BOX_LINE_RIGHT ); + aBox.SetLine( 0, SvxBoxItemLine::RIGHT ); if( pGCPara->pShareFmts ) pGCPara->pShareFmts->SetAttr( *pBox, aBox ); else diff --git a/sw/source/core/doc/tblafmt.cxx b/sw/source/core/doc/tblafmt.cxx index 446e29af773e..5880d2fa7a82 100644 --- a/sw/source/core/doc/tblafmt.cxx +++ b/sw/source/core/doc/tblafmt.cxx @@ -1085,13 +1085,13 @@ SwTableAutoFmtTbl::SwTableAutoFmtTbl() SvxBoxItem aBox( RES_BOX ); aBox.SetDistance( 55 ); SvxBorderLine aLn( &aColor, DEF_LINE_WIDTH_0 ); - aBox.SetLine( &aLn, BOX_LINE_LEFT ); - aBox.SetLine( &aLn, BOX_LINE_BOTTOM ); + aBox.SetLine( &aLn, SvxBoxItemLine::LEFT ); + aBox.SetLine( &aLn, SvxBoxItemLine::BOTTOM ); for( i = 0; i <= 15; ++i ) { - aBox.SetLine( i <= 3 ? &aLn : 0, BOX_LINE_TOP ); - aBox.SetLine( (3 == ( i & 3 )) ? &aLn : 0, BOX_LINE_RIGHT ); + aBox.SetLine( i <= 3 ? &aLn : 0, SvxBoxItemLine::TOP ); + aBox.SetLine( (3 == ( i & 3 )) ? &aLn : 0, SvxBoxItemLine::RIGHT ); const_cast<SwBoxAutoFmt&>(pNew->GetBoxFmt( i )).SetBox( aBox ); } diff --git a/sw/source/core/doc/tblrwcl.cxx b/sw/source/core/doc/tblrwcl.cxx index d2d4beeb1b44..1cee55f042a0 100644 --- a/sw/source/core/doc/tblrwcl.cxx +++ b/sw/source/core/doc/tblrwcl.cxx @@ -399,9 +399,9 @@ static void lcl_CopyCol( _FndBox & rFndBox, _CpyPara *const pCpyPara) SvxBoxItem aNew( rBoxItem ); if( 8 > pCpyPara->nDelBorderFlag ) - aNew.SetLine( 0, BOX_LINE_TOP ); + aNew.SetLine( 0, SvxBoxItemLine::TOP ); else - aNew.SetLine( 0, BOX_LINE_RIGHT ); + aNew.SetLine( 0, SvxBoxItemLine::RIGHT ); if( 1 == pCpyPara->nDelBorderFlag || 8 == pCpyPara->nDelBorderFlag ) @@ -724,7 +724,7 @@ void _DeleteBox( SwTable& rTbl, SwTableBox* pBox, SwUndo* pUndo, SvxBoxItem aTmp( rNxtBoxItem ); aTmp.SetLine( rBoxItem.GetLeft() ? rBoxItem.GetLeft() : rBoxItem.GetRight(), - BOX_LINE_LEFT ); + SvxBoxItemLine::LEFT ); if( pShareFmts ) pShareFmts->SetAttr( *pNxtBox, aTmp ); else @@ -746,7 +746,7 @@ void _DeleteBox( SwTable& rTbl, SwTableBox* pBox, SwUndo* pUndo, SvxBoxItem aTmp( rPrvBoxItem ); aTmp.SetLine( rBoxItem.GetLeft() ? rBoxItem.GetLeft() : rBoxItem.GetRight(), - BOX_LINE_RIGHT ); + SvxBoxItemLine::RIGHT ); if( pShareFmts ) pShareFmts->SetAttr( *pPrvBox, aTmp ); else @@ -945,7 +945,7 @@ lcl_SaveUpperLowerBorder( SwTable& rTbl, const SwTableBox& rBox, SvxBoxItem aTmp( rNxtBoxItem ); aTmp.SetLine( rBoxItem.GetTop() ? rBoxItem.GetTop() : rBoxItem.GetBottom(), - BOX_LINE_TOP ); + SvxBoxItemLine::TOP ); rShareFmts.SetAttr( *pNxtBox, aTmp ); bChgd = true; } @@ -959,7 +959,7 @@ lcl_SaveUpperLowerBorder( SwTable& rTbl, const SwTableBox& rBox, SvxBoxItem aTmp( rPrvBoxItem ); aTmp.SetLine( rBoxItem.GetTop() ? rBoxItem.GetTop() : rBoxItem.GetBottom(), - BOX_LINE_BOTTOM ); + SvxBoxItemLine::BOTTOM ); rShareFmts.SetAttr( *pPrvBox, aTmp ); } } @@ -1147,7 +1147,7 @@ bool SwTable::OldSplitRow( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16 nCn { pCpyBoxFrmFmt = static_cast<SwTableBoxFmt*>(pNewLine->GetTabBoxes()[ 0 ]->ClaimFrmFmt()); SvxBoxItem aTmp( pCpyBoxFrmFmt->GetBox() ); - aTmp.SetLine( 0, BOX_LINE_TOP ); + aTmp.SetLine( 0, SvxBoxItemLine::TOP ); pCpyBoxFrmFmt->SetFmtAttr( aTmp ); bChkBorder = false; } @@ -1269,7 +1269,7 @@ bool SwTable::SplitCol( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16 nCnt ) pInsLine->GetTabBoxes()[ nBoxPos + nCnt ]->ClaimFrmFmt(); SvxBoxItem aTmp( aSelBoxItem ); - aTmp.SetLine( 0, BOX_LINE_RIGHT ); + aTmp.SetLine( 0, SvxBoxItemLine::RIGHT ); aFindFrm.pNewFrmFmt->SetFmtAttr( aTmp ); // Remove the Format from the "cache" @@ -2661,7 +2661,7 @@ static bool lcl_InsSelBox( SwTableLine* pLine, CR_SetBoxWidth& rParam, if( rBoxItem.GetRight() ) { SvxBoxItem aTmp( rBoxItem ); - aTmp.SetLine( 0, BOX_LINE_RIGHT ); + aTmp.SetLine( 0, SvxBoxItemLine::RIGHT ); rParam.aShareFmts.SetAttr( rParam.bLeft ? *pNewBox : *pBox, aTmp ); @@ -4074,7 +4074,7 @@ static bool lcl_InsDelSelLine( SwTableLine* pLine, CR_SetLineHeight& rParam, if( rBoxItem.GetTop() ) { SvxBoxItem aTmp( rBoxItem ); - aTmp.SetLine( 0, BOX_LINE_TOP ); + aTmp.SetLine( 0, SvxBoxItemLine::TOP ); rParam.aShareFmts.SetAttr( rParam.bTop ? *pOld : *rNewBoxes[ n ], aTmp ); diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx index 876b5803515d..eac0891cb10d 100644 --- a/sw/source/core/docnode/ndtbl.cxx +++ b/sw/source/core/docnode/ndtbl.cxx @@ -127,13 +127,13 @@ static void lcl_SetDfltBoxAttr( SwFrmFmt& rFmt, sal_uInt8 nId ) } SvxBoxItem aBox(RES_BOX); aBox.SetDistance( 55 ); if ( bTop ) - aBox.SetLine( &aLine, BOX_LINE_TOP ); + aBox.SetLine( &aLine, SvxBoxItemLine::TOP ); if ( bBottom ) - aBox.SetLine( &aLine, BOX_LINE_BOTTOM ); + aBox.SetLine( &aLine, SvxBoxItemLine::BOTTOM ); if ( bLeft ) - aBox.SetLine( &aLine, BOX_LINE_LEFT ); + aBox.SetLine( &aLine, SvxBoxItemLine::LEFT ); if ( bRight ) - aBox.SetLine( &aLine, BOX_LINE_RIGHT ); + aBox.SetLine( &aLine, SvxBoxItemLine::RIGHT ); rFmt.SetFmtAttr( aBox ); } @@ -3039,7 +3039,7 @@ void sw_BoxSetSplitBoxFmts( SwTableBox* pBox, SwCollectTblLineBoxes* pSplPara ) if( !rBoxItem.GetTop() ) { SvxBoxItem aNew( rBoxItem ); - aNew.SetLine( pFmt->GetBox().GetBottom(), BOX_LINE_TOP ); + aNew.SetLine( pFmt->GetBox().GetBottom(), SvxBoxItemLine::TOP ); if( aNew != rBoxItem ) pBox->ClaimFrmFmt()->SetFmtAttr( aNew ); } diff --git a/sw/source/core/docnode/ndtbl1.cxx b/sw/source/core/docnode/ndtbl1.cxx index 3aa62a36caab..2b122d059d04 100644 --- a/sw/source/core/docnode/ndtbl1.cxx +++ b/sw/source/core/docnode/ndtbl1.cxx @@ -50,6 +50,7 @@ #include "undobj.hxx" #include <calbck.hxx> #include <UndoTable.hxx> +#include <o3tl/enumrange.hxx> using ::editeng::SvxBorderLine; using namespace ::com::sun::star; @@ -669,12 +670,12 @@ void SwDoc::SetTabBorders( const SwCursor& rCursor, const SfxItemSet& rSet ) { if ( bFirst && bTopOver ) { - aBox.SetLine( pTop, BOX_LINE_TOP ); + aBox.SetLine( pTop, SvxBoxItemLine::TOP ); nType |= 0x0001; } else if ( bHoriValid ) { - aBox.SetLine( 0, BOX_LINE_TOP ); + aBox.SetLine( 0, SvxBoxItemLine::TOP ); nType |= 0x0002; } } @@ -686,12 +687,12 @@ void SwDoc::SetTabBorders( const SwCursor& rCursor, const SfxItemSet& rSet ) { if ( bLeftValid ) { - aBox.SetLine( pLeft, BOX_LINE_RIGHT ); + aBox.SetLine( pLeft, SvxBoxItemLine::RIGHT ); nType |= 0x0010; } if ( bRightValid ) { - aBox.SetLine( pRight, BOX_LINE_LEFT ); + aBox.SetLine( pRight, SvxBoxItemLine::LEFT ); nType |= 0x0004; } } @@ -699,20 +700,20 @@ void SwDoc::SetTabBorders( const SwCursor& rCursor, const SfxItemSet& rSet ) { if ( bLeftValid ) { - aBox.SetLine( bRightOver ? pLeft : 0, BOX_LINE_RIGHT ); + aBox.SetLine( bRightOver ? pLeft : 0, SvxBoxItemLine::RIGHT ); bVertValid ? nType |= 0x0020 : nType |= 0x0010; } if ( bLeftOver ) { if ( bRightValid ) { - aBox.SetLine( pRight, BOX_LINE_LEFT ); + aBox.SetLine( pRight, SvxBoxItemLine::LEFT ); nType |= 0x0004; } } else if ( bVertValid ) { - aBox.SetLine( pVert, BOX_LINE_LEFT ); + aBox.SetLine( pVert, SvxBoxItemLine::LEFT ); nType |= 0x0008; } } @@ -724,13 +725,13 @@ void SwDoc::SetTabBorders( const SwCursor& rCursor, const SfxItemSet& rSet ) { if( bLeftValid ) { - aBox.SetLine( pLeft, BOX_LINE_LEFT ); + aBox.SetLine( pLeft, SvxBoxItemLine::LEFT ); nType |= 0x0004; } } else if( bVertValid ) { - aBox.SetLine( pVert, BOX_LINE_LEFT ); + aBox.SetLine( pVert, SvxBoxItemLine::LEFT ); nType |= 0x0008; } @@ -739,12 +740,12 @@ void SwDoc::SetTabBorders( const SwCursor& rCursor, const SfxItemSet& rSet ) { if ( bRightOver ) { - aBox.SetLine( pRight, BOX_LINE_RIGHT ); + aBox.SetLine( pRight, SvxBoxItemLine::RIGHT ); nType |= 0x0010; } else if ( bVertValid ) { - aBox.SetLine( 0, BOX_LINE_RIGHT ); + aBox.SetLine( 0, SvxBoxItemLine::RIGHT ); nType |= 0x0020; } } @@ -755,24 +756,20 @@ void SwDoc::SetTabBorders( const SwCursor& rCursor, const SfxItemSet& rSet ) { if( bBottomValid ) { - aBox.SetLine( pBottom, BOX_LINE_BOTTOM ); + aBox.SetLine( pBottom, SvxBoxItemLine::BOTTOM ); nType |= 0x0040; } } else if( bHoriValid ) { - aBox.SetLine( pHori, BOX_LINE_BOTTOM ); + aBox.SetLine( pHori, SvxBoxItemLine::BOTTOM ); nType |= 0x0080; } if( pSetBox ) { - static sal_uInt16 const aBorders[] = { - BOX_LINE_BOTTOM, BOX_LINE_TOP, - BOX_LINE_RIGHT, BOX_LINE_LEFT }; - const sal_uInt16* pBrd = aBorders; - for( int k = 0; k < 4; ++k, ++pBrd ) - aBox.SetDistance( pSetBox->GetDistance( *pBrd ), *pBrd ); + for( SvxBoxItemLine k : o3tl::enumrange<SvxBoxItemLine>() ) + aBox.SetDistance( pSetBox->GetDistance( k ), k ); } SwTableBox *pBox = const_cast<SwTableBox*>(pCell->GetTabBox()); @@ -981,14 +978,14 @@ void SwDoc::GetTabBorders( const SwCursor& rCursor, SfxItemSet& rSet ) const { if ( !bTopSet ) { bTopSet = true; - aSetBox.SetLine( rBox.GetTop(), BOX_LINE_TOP ); + aSetBox.SetLine( rBox.GetTop(), SvxBoxItemLine::TOP ); } else if ((aSetBox.GetTop() && rBox.GetTop() && !(*aSetBox.GetTop() == *rBox.GetTop())) || ((!aSetBox.GetTop()) != (!rBox.GetTop()))) // != expression is true, if one and only one of the two pointers is !0 { aSetBoxInfo.SetValid(SvxBoxInfoItemValidFlags::TOP, false ); - aSetBox.SetLine( 0, BOX_LINE_TOP ); + aSetBox.SetLine( 0, SvxBoxItemLine::TOP ); } } } @@ -1000,14 +997,14 @@ void SwDoc::GetTabBorders( const SwCursor& rCursor, SfxItemSet& rSet ) const { if ( !bLeftSet ) { bLeftSet = true; - aSetBox.SetLine( rBox.GetLeft(), BOX_LINE_LEFT ); + aSetBox.SetLine( rBox.GetLeft(), SvxBoxItemLine::LEFT ); } else if ((aSetBox.GetLeft() && rBox.GetLeft() && !(*aSetBox.GetLeft() == *rBox.GetLeft())) || ((!aSetBox.GetLeft()) != (!rBox.GetLeft()))) { aSetBoxInfo.SetValid(SvxBoxInfoItemValidFlags::LEFT, false ); - aSetBox.SetLine( 0, BOX_LINE_LEFT ); + aSetBox.SetLine( 0, SvxBoxItemLine::LEFT ); } } } @@ -1017,13 +1014,13 @@ void SwDoc::GetTabBorders( const SwCursor& rCursor, SfxItemSet& rSet ) const { if ( !bVertSet ) { bVertSet = true; - aSetBoxInfo.SetLine( rBox.GetLeft(), BOXINFO_LINE_VERT ); + aSetBoxInfo.SetLine( rBox.GetLeft(), SvxBoxInfoItemLine::VERT ); } else if ((aSetBoxInfo.GetVert() && rBox.GetLeft() && !(*aSetBoxInfo.GetVert() == *rBox.GetLeft())) || ((!aSetBoxInfo.GetVert()) != (!rBox.GetLeft()))) { aSetBoxInfo.SetValid( SvxBoxInfoItemValidFlags::VERT, false ); - aSetBoxInfo.SetLine( 0, BOXINFO_LINE_VERT ); + aSetBoxInfo.SetLine( 0, SvxBoxInfoItemLine::VERT ); } } } @@ -1033,13 +1030,13 @@ void SwDoc::GetTabBorders( const SwCursor& rCursor, SfxItemSet& rSet ) const { if ( !bRightSet ) { bRightSet = true; - aSetBox.SetLine( rBox.GetRight(), BOX_LINE_RIGHT ); + aSetBox.SetLine( rBox.GetRight(), SvxBoxItemLine::RIGHT ); } else if ((aSetBox.GetRight() && rBox.GetRight() && !(*aSetBox.GetRight() == *rBox.GetRight())) || (!aSetBox.GetRight() != !rBox.GetRight())) { aSetBoxInfo.SetValid( SvxBoxInfoItemValidFlags::RIGHT, false ); - aSetBox.SetLine( 0, BOX_LINE_RIGHT ); + aSetBox.SetLine( 0, SvxBoxItemLine::RIGHT ); } } @@ -1050,13 +1047,13 @@ void SwDoc::GetTabBorders( const SwCursor& rCursor, SfxItemSet& rSet ) const { if ( !bBottomSet ) { bBottomSet = true; - aSetBox.SetLine( rBox.GetBottom(), BOX_LINE_BOTTOM ); + aSetBox.SetLine( rBox.GetBottom(), SvxBoxItemLine::BOTTOM ); } else if ((aSetBox.GetBottom() && rBox.GetBottom() && !(*aSetBox.GetBottom() == *rBox.GetBottom())) || (!aSetBox.GetBottom() != !rBox.GetBottom())) { aSetBoxInfo.SetValid( SvxBoxInfoItemValidFlags::BOTTOM, false ); - aSetBox.SetLine( 0, BOX_LINE_BOTTOM ); + aSetBox.SetLine( 0, SvxBoxItemLine::BOTTOM ); } } } @@ -1068,14 +1065,14 @@ void SwDoc::GetTabBorders( const SwCursor& rCursor, SfxItemSet& rSet ) const { if ( !bHoriSet ) { bHoriSet = true; - aSetBoxInfo.SetLine( rBox.GetBottom(), BOXINFO_LINE_HORI ); + aSetBoxInfo.SetLine( rBox.GetBottom(), SvxBoxInfoItemLine::HORI ); } else if ((aSetBoxInfo.GetHori() && rBox.GetBottom() && !(*aSetBoxInfo.GetHori() == *rBox.GetBottom())) || ((!aSetBoxInfo.GetHori()) != (!rBox.GetBottom()))) { aSetBoxInfo.SetValid( SvxBoxInfoItemValidFlags::HORI, false ); - aSetBoxInfo.SetLine( 0, BOXINFO_LINE_HORI ); + aSetBoxInfo.SetLine( 0, SvxBoxInfoItemLine::HORI ); } } } @@ -1083,22 +1080,17 @@ void SwDoc::GetTabBorders( const SwCursor& rCursor, SfxItemSet& rSet ) const // Distance to text if (aSetBoxInfo.IsValid(SvxBoxInfoItemValidFlags::DISTANCE)) { - static sal_uInt16 const aBorders[] = { - BOX_LINE_BOTTOM, BOX_LINE_TOP, - BOX_LINE_RIGHT, BOX_LINE_LEFT }; - const sal_uInt16* pBrd = aBorders; - if( !bDistanceSet ) // Set on first iteration { bDistanceSet = true; - for( int k = 0; k < 4; ++k, ++pBrd ) - aSetBox.SetDistance( rBox.GetDistance( *pBrd ), *pBrd ); + for( SvxBoxItemLine k : o3tl::enumrange<SvxBoxItemLine>() ) + aSetBox.SetDistance( rBox.GetDistance( k ), k ); } else { - for( int k = 0; k < 4; ++k, ++pBrd ) - if( aSetBox.GetDistance( *pBrd ) != - rBox.GetDistance( *pBrd ) ) + for( SvxBoxItemLine k : o3tl::enumrange<SvxBoxItemLine>() ) + if( aSetBox.GetDistance( k ) != + rBox.GetDistance( k ) ) { aSetBoxInfo.SetValid( SvxBoxInfoItemValidFlags::DISTANCE, false ); aSetBox.SetDistance( (sal_uInt16) 0 ); @@ -1115,9 +1107,9 @@ void SwDoc::GetTabBorders( const SwCursor& rCursor, SfxItemSet& rSet ) const SvxBoxItem aTempBox (static_cast<const SvxBoxItem &>( rSet.Get(RES_BOX ))); SvxBoxInfoItem aTempBoxInfo(static_cast<const SvxBoxInfoItem&>( rSet.Get(SID_ATTR_BORDER_INNER))); - aTempBox.SetLine( aSetBox.GetRight(), BOX_LINE_RIGHT); - aSetBox.SetLine( aSetBox.GetLeft(), BOX_LINE_RIGHT); - aSetBox.SetLine( aTempBox.GetRight(), BOX_LINE_LEFT); + aTempBox.SetLine( aSetBox.GetRight(), SvxBoxItemLine::RIGHT); + aSetBox.SetLine( aSetBox.GetLeft(), SvxBoxItemLine::RIGHT); + aSetBox.SetLine( aTempBox.GetRight(), SvxBoxItemLine::LEFT); aTempBoxInfo.SetValid( SvxBoxInfoItemValidFlags::LEFT, aSetBoxInfo.IsValid(SvxBoxInfoItemValidFlags::LEFT) ); aSetBoxInfo.SetValid( SvxBoxInfoItemValidFlags::LEFT, aSetBoxInfo.IsValid(SvxBoxInfoItemValidFlags::RIGHT) ); diff --git a/sw/source/core/docnode/swbaslnk.cxx b/sw/source/core/docnode/swbaslnk.cxx index 3cb90bc9f8aa..3b3ae1b7c59d 100644 --- a/sw/source/core/docnode/swbaslnk.cxx +++ b/sw/source/core/docnode/swbaslnk.cxx @@ -318,10 +318,10 @@ static bool SetGrfFlySize( const Size& rGrfSz, SwGrfNode* pGrfNd, const Size& rO aCalcSz = rGrfSz; const SvxBoxItem &rBox = pFmt->GetBox(); - aCalcSz.Width() += rBox.CalcLineSpace(BOX_LINE_LEFT) + - rBox.CalcLineSpace(BOX_LINE_RIGHT); - aCalcSz.Height()+= rBox.CalcLineSpace(BOX_LINE_TOP) + - rBox.CalcLineSpace(BOX_LINE_BOTTOM); + aCalcSz.Width() += rBox.CalcLineSpace(SvxBoxItemLine::LEFT) + + rBox.CalcLineSpace(SvxBoxItemLine::RIGHT); + aCalcSz.Height()+= rBox.CalcLineSpace(SvxBoxItemLine::TOP) + + rBox.CalcLineSpace(SvxBoxItemLine::BOTTOM); const SwFmtFrmSize& rOldAttr = pFmt->GetFrmSize(); if( rOldAttr.GetSize() != aCalcSz ) { diff --git a/sw/source/core/edit/autofmt.cxx b/sw/source/core/edit/autofmt.cxx index e9e115258e10..8f1cf9914b1f 100644 --- a/sw/source/core/edit/autofmt.cxx +++ b/sw/source/core/edit/autofmt.cxx @@ -572,7 +572,7 @@ bool SwAutoFormat::DoUnderline() 0); aSet.Put( SwParaConnectBorderItem( false ) ); SvxBoxItem aBox( RES_BOX ); - aBox.SetLine( &aLine, BOX_LINE_BOTTOM ); + aBox.SetLine( &aLine, SvxBoxItemLine::BOTTOM ); aBox.SetDistance( 42 ); // ~0,75 mm aSet.Put(aBox); m_pDoc->getIDocumentContentOperations().InsertItemSet( m_aDelPam, aSet ); diff --git a/sw/source/core/frmedt/tblsel.cxx b/sw/source/core/frmedt/tblsel.cxx index 4a1f369b8cb7..d08835d11cde 100644 --- a/sw/source/core/frmedt/tblsel.cxx +++ b/sw/source/core/frmedt/tblsel.cxx @@ -1030,7 +1030,7 @@ void GetMergeSel( const SwPaM& rPam, SwSelBoxes& rBoxes, .GetItemState( RES_BOX, false, &pItem )) { SvxBoxItem aBox( *static_cast<const SvxBoxItem*>(pItem) ); - aBox.SetLine( 0, BOX_LINE_RIGHT ); + aBox.SetLine( 0, SvxBoxItemLine::RIGHT ); pBox->GetFrmFmt()->SetFmtAttr( aBox ); } } @@ -1313,8 +1313,8 @@ void GetMergeSel( const SwPaM& rPam, SwSelBoxes& rBoxes, { SvxBoxItem aBox( pFirstBox->GetFrmFmt()->GetBox() ); const SvxBoxItem& rBox = pLastBox->GetFrmFmt()->GetBox(); - aBox.SetLine( rBox.GetRight(), BOX_LINE_RIGHT ); - aBox.SetLine( rBox.GetBottom(), BOX_LINE_BOTTOM ); + aBox.SetLine( rBox.GetRight(), SvxBoxItemLine::RIGHT ); + aBox.SetLine( rBox.GetBottom(), SvxBoxItemLine::BOTTOM ); if( aBox.GetLeft() || aBox.GetTop() || aBox.GetRight() || aBox.GetBottom() ) (*ppMergeBox)->GetFrmFmt()->SetFmtAttr( aBox ); diff --git a/sw/source/core/graphic/ndgrf.cxx b/sw/source/core/graphic/ndgrf.cxx index 912bc83046be..228e61ba4169 100644 --- a/sw/source/core/graphic/ndgrf.cxx +++ b/sw/source/core/graphic/ndgrf.cxx @@ -818,8 +818,8 @@ void SwGrfNode::ScaleImageMap() { SwTwips nWidth = rFrmSize.GetWidth(); - nWidth -= rBox.CalcLineSpace(BOX_LINE_LEFT) + - rBox.CalcLineSpace(BOX_LINE_RIGHT); + nWidth -= rBox.CalcLineSpace(SvxBoxItemLine::LEFT) + + rBox.CalcLineSpace(SvxBoxItemLine::RIGHT); OSL_ENSURE( nWidth>0, "Do any 0 twip wide graphics exist!?" ); @@ -833,8 +833,8 @@ void SwGrfNode::ScaleImageMap() { SwTwips nHeight = rFrmSize.GetHeight(); - nHeight -= rBox.CalcLineSpace(BOX_LINE_TOP) + - rBox.CalcLineSpace(BOX_LINE_BOTTOM); + nHeight -= rBox.CalcLineSpace(SvxBoxItemLine::TOP) + + rBox.CalcLineSpace(SvxBoxItemLine::BOTTOM); OSL_ENSURE( nHeight>0, "Do any 0 twip high graphics exist!?" ); diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx index 7e4bc12d0000..78d36124a07a 100644 --- a/sw/source/core/layout/frmtool.cxx +++ b/sw/source/core/layout/frmtool.cxx @@ -1990,8 +1990,8 @@ long SwBorderAttrs::CalcLeft( const SwFrm *pCaller ) const void SwBorderAttrs::_CalcTopLine() { nTopLine = (bBorderDist && !rBox.GetTop()) - ? rBox.GetDistance (BOX_LINE_TOP) - : rBox.CalcLineSpace(BOX_LINE_TOP); + ? rBox.GetDistance (SvxBoxItemLine::TOP) + : rBox.CalcLineSpace(SvxBoxItemLine::TOP); nTopLine = nTopLine + rShadow.CalcShadowSpace(SHADOW_TOP); bTopLine = false; } @@ -1999,8 +1999,8 @@ void SwBorderAttrs::_CalcTopLine() void SwBorderAttrs::_CalcBottomLine() { nBottomLine = (bBorderDist && !rBox.GetBottom()) - ? rBox.GetDistance (BOX_LINE_BOTTOM) - : rBox.CalcLineSpace(BOX_LINE_BOTTOM); + ? rBox.GetDistance (SvxBoxItemLine::BOTTOM) + : rBox.CalcLineSpace(SvxBoxItemLine::BOTTOM); nBottomLine = nBottomLine + rShadow.CalcShadowSpace(SHADOW_BOTTOM); bBottomLine = false; } @@ -2008,8 +2008,8 @@ void SwBorderAttrs::_CalcBottomLine() void SwBorderAttrs::_CalcLeftLine() { nLeftLine = (bBorderDist && !rBox.GetLeft()) - ? rBox.GetDistance (BOX_LINE_LEFT) - : rBox.CalcLineSpace(BOX_LINE_LEFT); + ? rBox.GetDistance (SvxBoxItemLine::LEFT) + : rBox.CalcLineSpace(SvxBoxItemLine::LEFT); nLeftLine = nLeftLine + rShadow.CalcShadowSpace(SHADOW_LEFT); bLeftLine = false; } @@ -2017,8 +2017,8 @@ void SwBorderAttrs::_CalcLeftLine() void SwBorderAttrs::_CalcRightLine() { nRightLine = (bBorderDist && !rBox.GetRight()) - ? rBox.GetDistance (BOX_LINE_RIGHT) - : rBox.CalcLineSpace(BOX_LINE_RIGHT); + ? rBox.GetDistance (SvxBoxItemLine::RIGHT) + : rBox.CalcLineSpace(SvxBoxItemLine::RIGHT); nRightLine = nRightLine + rShadow.CalcShadowSpace(SHADOW_RIGHT); bRightLine = false; } diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index d753f2ba7f99..16e6d44eab99 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -1450,10 +1450,10 @@ static void lcl_CalcBorderRect( SwRect &rRect, const SwFrm *pFrm, if ( bTop ) { SwTwips nDiff = rBox.GetTop() ? - rBox.CalcLineSpace( BOX_LINE_TOP ) : + rBox.CalcLineSpace( SvxBoxItemLine::TOP ) : ( rAttrs.IsBorderDist() ? // Increase of distance by one twip is incorrect. - rBox.GetDistance( BOX_LINE_TOP ) : 0 ); + rBox.GetDistance( SvxBoxItemLine::TOP ) : 0 ); if( nDiff ) (rRect.*fnRect->fnSubTop)( nDiff ); } @@ -1473,26 +1473,26 @@ static void lcl_CalcBorderRect( SwRect &rRect, const SwFrm *pFrm, else { nDiff = rBox.GetBottom() ? - rBox.CalcLineSpace( BOX_LINE_BOTTOM ) : + rBox.CalcLineSpace( SvxBoxItemLine::BOTTOM ) : ( rAttrs.IsBorderDist() ? // Increase of distance by one twip is incorrect. - rBox.GetDistance( BOX_LINE_BOTTOM ) : 0 ); + rBox.GetDistance( SvxBoxItemLine::BOTTOM ) : 0 ); } if( nDiff ) (rRect.*fnRect->fnAddBottom)( nDiff ); } if ( rBox.GetLeft() ) - (rRect.*fnRect->fnSubLeft)( rBox.CalcLineSpace( BOX_LINE_LEFT ) ); + (rRect.*fnRect->fnSubLeft)( rBox.CalcLineSpace( SvxBoxItemLine::LEFT ) ); else if ( rAttrs.IsBorderDist() ) // Increase of distance by one twip is incorrect. - (rRect.*fnRect->fnSubLeft)( rBox.GetDistance( BOX_LINE_LEFT ) ); + (rRect.*fnRect->fnSubLeft)( rBox.GetDistance( SvxBoxItemLine::LEFT ) ); if ( rBox.GetRight() ) - (rRect.*fnRect->fnAddRight)( rBox.CalcLineSpace( BOX_LINE_RIGHT ) ); + (rRect.*fnRect->fnAddRight)( rBox.CalcLineSpace( SvxBoxItemLine::RIGHT ) ); else if ( rAttrs.IsBorderDist() ) // Increase of distance by one twip is incorrect. - (rRect.*fnRect->fnAddRight)( rBox.GetDistance( BOX_LINE_RIGHT ) ); + (rRect.*fnRect->fnAddRight)( rBox.GetDistance( SvxBoxItemLine::RIGHT ) ); if ( bShadow && rAttrs.GetShadow().GetLocation() != SVX_SHADOW_NONE ) { diff --git a/sw/source/core/layout/ssfrm.cxx b/sw/source/core/layout/ssfrm.cxx index b25ea093d5f5..74cb35ee70e0 100644 --- a/sw/source/core/layout/ssfrm.cxx +++ b/sw/source/core/layout/ssfrm.cxx @@ -656,13 +656,13 @@ const SwRect SwFrm::UnionFrm( bool bBorder ) const const SwBorderAttrs &rAttrs = *aAccess.Get(); const SvxBoxItem &rBox = rAttrs.GetBox(); if ( rBox.GetLeft() ) - nLeft -= rBox.CalcLineSpace( BOX_LINE_LEFT ); + nLeft -= rBox.CalcLineSpace( SvxBoxItemLine::LEFT ); else if ( rAttrs.IsBorderDist() ) - nLeft -= rBox.GetDistance( BOX_LINE_LEFT ) + 1; + nLeft -= rBox.GetDistance( SvxBoxItemLine::LEFT ) + 1; if ( rBox.GetRight() ) - nAdd += rBox.CalcLineSpace( BOX_LINE_RIGHT ); + nAdd += rBox.CalcLineSpace( SvxBoxItemLine::RIGHT ); else if ( rAttrs.IsBorderDist() ) - nAdd += rBox.GetDistance( BOX_LINE_RIGHT ) + 1; + nAdd += rBox.GetDistance( SvxBoxItemLine::RIGHT ) + 1; if( rAttrs.GetShadow().GetLocation() != SVX_SHADOW_NONE ) { const SvxShadowItem &rShadow = rAttrs.GetShadow(); diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx index 6ab7825db965..20145d5cda89 100644 --- a/sw/source/core/layout/tabfrm.cxx +++ b/sw/source/core/layout/tabfrm.cxx @@ -3838,7 +3838,7 @@ static sal_uInt16 lcl_GetTopSpace( const SwRowFrm& rRow ) { const SwAttrSet& rSet = const_cast<SwCellFrm*>(pCurrLower)->GetFmt()->GetAttrSet(); const SvxBoxItem& rBoxItem = rSet.GetBox(); - nTmpTopSpace = rBoxItem.CalcLineSpace( BOX_LINE_TOP, true ); + nTmpTopSpace = rBoxItem.CalcLineSpace( SvxBoxItemLine::TOP, true ); } nTopSpace = std::max( nTopSpace, nTmpTopSpace ); } @@ -3859,7 +3859,7 @@ static sal_uInt16 lcl_GetTopLineDist( const SwRowFrm& rRow ) { const SwAttrSet& rSet = const_cast<SwCellFrm*>(pCurrLower)->GetFmt()->GetAttrSet(); const SvxBoxItem& rBoxItem = rSet.GetBox(); - nTmpTopLineDist = rBoxItem.GetDistance( BOX_LINE_TOP ); + nTmpTopLineDist = rBoxItem.GetDistance( SvxBoxItemLine::TOP ); } nTopLineDist = std::max( nTopLineDist, nTmpTopLineDist ); } @@ -3883,8 +3883,8 @@ static sal_uInt16 lcl_GetBottomLineSize( const SwRowFrm& rRow ) { const SwAttrSet& rSet = const_cast<SwCellFrm*>(pCurrLower)->GetFmt()->GetAttrSet(); const SvxBoxItem& rBoxItem = rSet.GetBox(); - nTmpBottomLineSize = rBoxItem.CalcLineSpace( BOX_LINE_BOTTOM, true ) - - rBoxItem.GetDistance( BOX_LINE_BOTTOM ); + nTmpBottomLineSize = rBoxItem.CalcLineSpace( SvxBoxItemLine::BOTTOM, true ) - + rBoxItem.GetDistance( SvxBoxItemLine::BOTTOM ); } nBottomLineSize = std::max( nBottomLineSize, nTmpBottomLineSize ); } @@ -3908,7 +3908,7 @@ static sal_uInt16 lcl_GetBottomLineDist( const SwRowFrm& rRow ) { const SwAttrSet& rSet = const_cast<SwCellFrm*>(pCurrLower)->GetFmt()->GetAttrSet(); const SvxBoxItem& rBoxItem = rSet.GetBox(); - nTmpBottomLineDist = rBoxItem.GetDistance( BOX_LINE_BOTTOM ); + nTmpBottomLineDist = rBoxItem.GetDistance( SvxBoxItemLine::BOTTOM ); } nBottomLineDist = std::max( nBottomLineDist, nTmpBottomLineDist ); } @@ -4666,8 +4666,8 @@ void SwCellFrm::Format( const SwBorderAttrs *pAttrs ) if ( pTab->IsCollapsingBorders() && !Lower()->IsRowFrm() ) { const SvxBoxItem& rBoxItem = pAttrs->GetBox(); - nLeftSpace = rBoxItem.GetDistance( BOX_LINE_LEFT ); - nRightSpace = rBoxItem.GetDistance( BOX_LINE_RIGHT ); + nLeftSpace = rBoxItem.GetDistance( SvxBoxItemLine::LEFT ); + nRightSpace = rBoxItem.GetDistance( SvxBoxItemLine::RIGHT ); nTopSpace = static_cast<SwRowFrm*>(GetUpper())->GetTopMarginForLowers(); nBottomSpace = static_cast<SwRowFrm*>(GetUpper())->GetBottomMarginForLowers(); } diff --git a/sw/source/core/table/swnewtable.cxx b/sw/source/core/table/swnewtable.cxx index dbb1d007d41d..fb1f78b0ae61 100644 --- a/sw/source/core/table/swnewtable.cxx +++ b/sw/source/core/table/swnewtable.cxx @@ -742,7 +742,7 @@ bool SwTable::NewInsertCol( SwDoc* pDoc, const SwSelBoxes& rBoxes, if( aSelBoxItem.GetRight() ) { pNoRightBorder = new SvxBoxItem( aSelBoxItem ); - pNoRightBorder->SetLine( 0, BOX_LINE_RIGHT ); + pNoRightBorder->SetLine( 0, SvxBoxItemLine::RIGHT ); } for( sal_uInt16 j = 0; j < nCnt; ++j ) { @@ -951,8 +951,8 @@ bool SwTable::PrepareMerge( const SwPaM& rPam, SwSelBoxes& rBoxes, SvxBoxItem aBox( pMergeBox->GetFrmFmt()->GetBox() ); bool bOld = aBox.GetRight() || aBox.GetBottom(); const SvxBoxItem& rBox = pLastBox->GetFrmFmt()->GetBox(); - aBox.SetLine( rBox.GetRight(), BOX_LINE_RIGHT ); - aBox.SetLine( rBox.GetBottom(), BOX_LINE_BOTTOM ); + aBox.SetLine( rBox.GetRight(), SvxBoxItemLine::RIGHT ); + aBox.SetLine( rBox.GetBottom(), SvxBoxItemLine::BOTTOM ); if( bOld || aBox.GetLeft() || aBox.GetTop() || aBox.GetRight() || aBox.GetBottom() ) (*ppMergeBox)->GetFrmFmt()->SetFmtAttr( aBox ); } diff --git a/sw/source/core/text/atrstck.cxx b/sw/source/core/text/atrstck.cxx index 0bf4e711aadd..80f2dee123f4 100644 --- a/sw/source/core/text/atrstck.cxx +++ b/sw/source/core/text/atrstck.cxx @@ -698,10 +698,10 @@ void SwAttrHandler::FontChg(const SfxPoolItem& rItem, SwFont& rFnt, bool bPush ) rFnt.SetBottomBorder( aBoxItem.GetBottom() ); rFnt.SetRightBorder( aBoxItem.GetRight() ); rFnt.SetLeftBorder( aBoxItem.GetLeft() ); - rFnt.SetTopBorderDist( aBoxItem.GetDistance(BOX_LINE_TOP) ); - rFnt.SetBottomBorderDist( aBoxItem.GetDistance(BOX_LINE_BOTTOM) ); - rFnt.SetRightBorderDist( aBoxItem.GetDistance(BOX_LINE_RIGHT) ); - rFnt.SetLeftBorderDist( aBoxItem.GetDistance(BOX_LINE_LEFT) ); + rFnt.SetTopBorderDist( aBoxItem.GetDistance(SvxBoxItemLine::TOP) ); + rFnt.SetBottomBorderDist( aBoxItem.GetDistance(SvxBoxItemLine::BOTTOM) ); + rFnt.SetRightBorderDist( aBoxItem.GetDistance(SvxBoxItemLine::RIGHT) ); + rFnt.SetLeftBorderDist( aBoxItem.GetDistance(SvxBoxItemLine::LEFT) ); break; } case RES_CHRATR_SHADOW: diff --git a/sw/source/core/txtnode/swfont.cxx b/sw/source/core/txtnode/swfont.cxx index f7a6d750e3be..db618f9d6886 100644 --- a/sw/source/core/txtnode/swfont.cxx +++ b/sw/source/core/txtnode/swfont.cxx @@ -673,10 +673,10 @@ void SwFont::SetDiffFnt( const SfxItemSet *pAttrSet, SetBottomBorder(pBoxItem->GetBottom()); SetRightBorder(pBoxItem->GetRight()); SetLeftBorder(pBoxItem->GetLeft()); - SetTopBorderDist(pBoxItem->GetDistance(BOX_LINE_TOP)); - SetBottomBorderDist(pBoxItem->GetDistance(BOX_LINE_BOTTOM)); - SetRightBorderDist(pBoxItem->GetDistance(BOX_LINE_RIGHT)); - SetLeftBorderDist(pBoxItem->GetDistance(BOX_LINE_LEFT)); + SetTopBorderDist(pBoxItem->GetDistance(SvxBoxItemLine::TOP)); + SetBottomBorderDist(pBoxItem->GetDistance(SvxBoxItemLine::BOTTOM)); + SetRightBorderDist(pBoxItem->GetDistance(SvxBoxItemLine::RIGHT)); + SetLeftBorderDist(pBoxItem->GetDistance(SvxBoxItemLine::LEFT)); } if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_SHADOW, true, &pItem )) @@ -857,10 +857,10 @@ SwFont::SwFont( const SwAttrSet* pAttrSet, SetBottomBorder(pBoxItem->GetBottom()); SetRightBorder(pBoxItem->GetRight()); SetLeftBorder(pBoxItem->GetLeft()); - SetTopBorderDist(pBoxItem->GetDistance(BOX_LINE_TOP)); - SetBottomBorderDist(pBoxItem->GetDistance(BOX_LINE_BOTTOM)); - SetRightBorderDist(pBoxItem->GetDistance(BOX_LINE_RIGHT)); - SetLeftBorderDist(pBoxItem->GetDistance(BOX_LINE_LEFT)); + SetTopBorderDist(pBoxItem->GetDistance(SvxBoxItemLine::TOP)); + SetBottomBorderDist(pBoxItem->GetDistance(SvxBoxItemLine::BOTTOM)); + SetRightBorderDist(pBoxItem->GetDistance(SvxBoxItemLine::RIGHT)); + SetLeftBorderDist(pBoxItem->GetDistance(SvxBoxItemLine::LEFT)); } else { diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx index aa259f2c8590..8986268d449c 100644 --- a/sw/source/core/unocore/unotbl.cxx +++ b/sw/source/core/unocore/unotbl.cxx @@ -2747,22 +2747,22 @@ void SwXTextTable::setPropertyValue(const OUString& rPropertyName, const uno::An SvxBoxItem aBox( RES_BOX ); SvxBoxInfoItem aBoxInfo( SID_ATTR_BORDER_INNER ); - aBox.SetLine(aTopLine.isEmpty() ? 0 : &aTopLine, BOX_LINE_TOP); + aBox.SetLine(aTopLine.isEmpty() ? 0 : &aTopLine, SvxBoxItemLine::TOP); aBoxInfo.SetValid(SvxBoxInfoItemValidFlags::TOP, aBorder.IsTopLineValid); - aBox.SetLine(aBottomLine.isEmpty() ? 0 : &aBottomLine, BOX_LINE_BOTTOM); + aBox.SetLine(aBottomLine.isEmpty() ? 0 : &aBottomLine, SvxBoxItemLine::BOTTOM); aBoxInfo.SetValid(SvxBoxInfoItemValidFlags::BOTTOM, aBorder.IsBottomLineValid); - aBox.SetLine(aLeftLine.isEmpty() ? 0 : &aLeftLine, BOX_LINE_LEFT); + aBox.SetLine(aLeftLine.isEmpty() ? 0 : &aLeftLine, SvxBoxItemLine::LEFT); aBoxInfo.SetValid(SvxBoxInfoItemValidFlags::LEFT, aBorder.IsLeftLineValid); - aBox.SetLine(aRightLine.isEmpty() ? 0 : &aRightLine, BOX_LINE_RIGHT); + aBox.SetLine(aRightLine.isEmpty() ? 0 : &aRightLine, SvxBoxItemLine::RIGHT); aBoxInfo.SetValid(SvxBoxInfoItemValidFlags::RIGHT, aBorder.IsRightLineValid); - aBoxInfo.SetLine(aHoriLine.isEmpty() ? 0 : &aHoriLine, BOXINFO_LINE_HORI); + aBoxInfo.SetLine(aHoriLine.isEmpty() ? 0 : &aHoriLine, SvxBoxInfoItemLine::HORI); aBoxInfo.SetValid(SvxBoxInfoItemValidFlags::HORI, aBorder.IsHorizontalLineValid); - aBoxInfo.SetLine(aVertLine.isEmpty() ? 0 : &aVertLine, BOXINFO_LINE_VERT); + aBoxInfo.SetLine(aVertLine.isEmpty() ? 0 : &aVertLine, SvxBoxInfoItemLine::VERT); aBoxInfo.SetValid(SvxBoxInfoItemValidFlags::VERT, aBorder.IsVerticalLineValid); aBox.SetDistance((sal_uInt16)convertMm100ToTwip(aBorder.Distance)); @@ -2804,21 +2804,21 @@ void SwXTextTable::setPropertyValue(const OUString& rPropertyName, const uno::An const SwFrmFmt* pBoxFmt = pBox->GetFrmFmt(); const SvxBoxItem& rBox = pBoxFmt->GetBox(); if( - (aTableBorderDistances.IsLeftDistanceValid && nLeftDistance != rBox.GetDistance( BOX_LINE_LEFT )) || - (aTableBorderDistances.IsRightDistanceValid && nRightDistance != rBox.GetDistance( BOX_LINE_RIGHT )) || - (aTableBorderDistances.IsTopDistanceValid && nTopDistance != rBox.GetDistance( BOX_LINE_TOP )) || - (aTableBorderDistances.IsBottomDistanceValid && nBottomDistance != rBox.GetDistance( BOX_LINE_BOTTOM ))) + (aTableBorderDistances.IsLeftDistanceValid && nLeftDistance != rBox.GetDistance( SvxBoxItemLine::LEFT )) || + (aTableBorderDistances.IsRightDistanceValid && nRightDistance != rBox.GetDistance( SvxBoxItemLine::RIGHT )) || + (aTableBorderDistances.IsTopDistanceValid && nTopDistance != rBox.GetDistance( SvxBoxItemLine::TOP )) || + (aTableBorderDistances.IsBottomDistanceValid && nBottomDistance != rBox.GetDistance( SvxBoxItemLine::BOTTOM ))) { SvxBoxItem aSetBox( rBox ); SwFrmFmt* pSetBoxFmt = pBox->ClaimFrmFmt(); if( aTableBorderDistances.IsLeftDistanceValid ) - aSetBox.SetDistance( nLeftDistance, BOX_LINE_LEFT ); + aSetBox.SetDistance( nLeftDistance, SvxBoxItemLine::LEFT ); if( aTableBorderDistances.IsRightDistanceValid ) - aSetBox.SetDistance( nRightDistance, BOX_LINE_RIGHT ); + aSetBox.SetDistance( nRightDistance, SvxBoxItemLine::RIGHT ); if( aTableBorderDistances.IsTopDistanceValid ) - aSetBox.SetDistance( nTopDistance, BOX_LINE_TOP ); + aSetBox.SetDistance( nTopDistance, SvxBoxItemLine::TOP ); if( aTableBorderDistances.IsBottomDistanceValid ) - aSetBox.SetDistance( nBottomDistance, BOX_LINE_BOTTOM ); + aSetBox.SetDistance( nBottomDistance, SvxBoxItemLine::BOTTOM ); pDoc->SetAttr( aSetBox, *pSetBoxFmt ); } } @@ -3005,25 +3005,25 @@ uno::Any SwXTextTable::getPropertyValue(const OUString& rPropertyName) const SvxBoxItem& rBox = pBoxFmt->GetBox(); if( bFirst ) { - nLeftDistance = convertTwipToMm100( rBox.GetDistance( BOX_LINE_LEFT )); - nRightDistance = convertTwipToMm100( rBox.GetDistance( BOX_LINE_RIGHT )); - nTopDistance = convertTwipToMm100( rBox.GetDistance( BOX_LINE_TOP )); - nBottomDistance = convertTwipToMm100( rBox.GetDistance( BOX_LINE_BOTTOM )); + nLeftDistance = convertTwipToMm100( rBox.GetDistance( SvxBoxItemLine::LEFT )); + nRightDistance = convertTwipToMm100( rBox.GetDistance( SvxBoxItemLine::RIGHT )); + nTopDistance = convertTwipToMm100( rBox.GetDistance( SvxBoxItemLine::TOP )); + nBottomDistance = convertTwipToMm100( rBox.GetDistance( SvxBoxItemLine::BOTTOM )); bFirst = false; } else { if( aTableBorderDistances.IsLeftDistanceValid && - nLeftDistance != convertTwipToMm100( rBox.GetDistance( BOX_LINE_LEFT ))) + nLeftDistance != convertTwipToMm100( rBox.GetDistance( SvxBoxItemLine::LEFT ))) aTableBorderDistances.IsLeftDistanceValid = sal_False; if( aTableBorderDistances.IsRightDistanceValid && - nRightDistance != convertTwipToMm100( rBox.GetDistance( BOX_LINE_RIGHT ))) + nRightDistance != convertTwipToMm100( rBox.GetDistance( SvxBoxItemLine::RIGHT ))) aTableBorderDistances.IsRightDistanceValid = sal_False; if( aTableBorderDistances.IsTopDistanceValid && - nTopDistance != convertTwipToMm100( rBox.GetDistance( BOX_LINE_TOP ))) + nTopDistance != convertTwipToMm100( rBox.GetDistance( SvxBoxItemLine::TOP ))) aTableBorderDistances.IsTopDistanceValid = sal_False; if( aTableBorderDistances.IsBottomDistanceValid && - nBottomDistance != convertTwipToMm100( rBox.GetDistance( BOX_LINE_BOTTOM ))) + nBottomDistance != convertTwipToMm100( rBox.GetDistance( SvxBoxItemLine::BOTTOM ))) aTableBorderDistances.IsBottomDistanceValid = sal_False; } diff --git a/sw/source/filter/basflt/fltini.cxx b/sw/source/filter/basflt/fltini.cxx index 0cdd5cbf9138..5caa64d0d9af 100644 --- a/sw/source/filter/basflt/fltini.cxx +++ b/sw/source/filter/basflt/fltini.cxx @@ -361,7 +361,7 @@ void CalculateFlySize(SfxItemSet& rFlySet, const SwNodeIndex& rAnchor, // consider border and distance to content const SvxBoxItem& rBoxItem = static_cast<const SvxBoxItem&>(rFlySet.Get( RES_BOX )); - sal_uInt16 nLine = BOX_LINE_LEFT; + SvxBoxItemLine nLine = SvxBoxItemLine::LEFT; for( int i = 0; i < 2; ++i ) { const editeng::SvxBorderLine* pLn = rBoxItem.GetLine( nLine ); @@ -372,7 +372,7 @@ void CalculateFlySize(SfxItemSet& rFlySet, const SwNodeIndex& rAnchor, nMinFrm += nWidthTmp; nMaxFrm += nWidthTmp; } - nLine = BOX_LINE_RIGHT; + nLine = SvxBoxItemLine::RIGHT; } // enforce minimum width for contents diff --git a/sw/source/filter/html/css1atr.cxx b/sw/source/filter/html/css1atr.cxx index 27418d0ecbb3..fadc0722abf0 100644 --- a/sw/source/filter/html/css1atr.cxx +++ b/sw/source/filter/html/css1atr.cxx @@ -3472,10 +3472,10 @@ Writer& OutCSS1_SvxBox( Writer& rWrt, const SfxPoolItem& rHt ) OutCSS1_SvxBorderLine( rHTMLWrt, sCSS1_P_border_right, pRight ); } - long nTopDist = pTop ? rBoxItem.GetDistance( BOX_LINE_TOP ) : 0; - long nBottomDist = pBottom ? rBoxItem.GetDistance( BOX_LINE_BOTTOM ) : 0; - long nLeftDist = pLeft ? rBoxItem.GetDistance( BOX_LINE_LEFT ) : 0; - long nRightDist = pRight ? rBoxItem.GetDistance( BOX_LINE_RIGHT ) : 0; + long nTopDist = pTop ? rBoxItem.GetDistance( SvxBoxItemLine::TOP ) : 0; + long nBottomDist = pBottom ? rBoxItem.GetDistance( SvxBoxItemLine::BOTTOM ) : 0; + long nLeftDist = pLeft ? rBoxItem.GetDistance( SvxBoxItemLine::LEFT ) : 0; + long nRightDist = pRight ? rBoxItem.GetDistance( SvxBoxItemLine::RIGHT ) : 0; if( nTopDist == nBottomDist && nLeftDist == nRightDist ) { diff --git a/sw/source/filter/html/htmlflywriter.cxx b/sw/source/filter/html/htmlflywriter.cxx index 4a3c7d251c9d..ff4104f4c253 100644 --- a/sw/source/filter/html/htmlflywriter.cxx +++ b/sw/source/filter/html/htmlflywriter.cxx @@ -666,10 +666,10 @@ OString SwHTMLWriter::OutFrmFmtOptions( const SwFrmFmt &rFrmFmt, { const SvxBoxItem* pBoxItem = static_cast<const SvxBoxItem*>(pItem); - aTwipSpc.Width() += pBoxItem->CalcLineSpace( BOX_LINE_LEFT ); - aTwipSpc.Width() += pBoxItem->CalcLineSpace( BOX_LINE_RIGHT ); - aTwipSpc.Height() += pBoxItem->CalcLineSpace( BOX_LINE_TOP ); - aTwipSpc.Height() += pBoxItem->CalcLineSpace( BOX_LINE_BOTTOM ); + aTwipSpc.Width() += pBoxItem->CalcLineSpace( SvxBoxItemLine::LEFT ); + aTwipSpc.Width() += pBoxItem->CalcLineSpace( SvxBoxItemLine::RIGHT ); + aTwipSpc.Height() += pBoxItem->CalcLineSpace( SvxBoxItemLine::TOP ); + aTwipSpc.Height() += pBoxItem->CalcLineSpace( SvxBoxItemLine::BOTTOM ); } // WIDTH und/oder HEIGHT @@ -932,10 +932,10 @@ void SwHTMLWriter::writeFrameFormatOptions(HtmlWriter& aHtml, const SwFrmFmt& rF { const SvxBoxItem* pBoxItem = static_cast<const SvxBoxItem*>(pItem); - aTwipSpc.Width() += pBoxItem->CalcLineSpace( BOX_LINE_LEFT ); - aTwipSpc.Width() += pBoxItem->CalcLineSpace( BOX_LINE_RIGHT ); - aTwipSpc.Height() += pBoxItem->CalcLineSpace( BOX_LINE_TOP ); - aTwipSpc.Height() += pBoxItem->CalcLineSpace( BOX_LINE_BOTTOM ); + aTwipSpc.Width() += pBoxItem->CalcLineSpace( SvxBoxItemLine::LEFT ); + aTwipSpc.Width() += pBoxItem->CalcLineSpace( SvxBoxItemLine::RIGHT ); + aTwipSpc.Height() += pBoxItem->CalcLineSpace( SvxBoxItemLine::TOP ); + aTwipSpc.Height() += pBoxItem->CalcLineSpace( SvxBoxItemLine::BOTTOM ); } // "width" and/or "height" @@ -1132,7 +1132,7 @@ OUString lclWriteOutImap(SwHTMLWriter& rHTMLWrt, const SfxItemSet& rItemSet, con if (!rFrmSize.GetWidthPercent() && rRealSize.Width()) { SwTwips nWidth = rFrmSize.GetWidth(); - nWidth -= rBox.CalcLineSpace(BOX_LINE_LEFT) + rBox.CalcLineSpace(BOX_LINE_RIGHT); + nWidth -= rBox.CalcLineSpace(SvxBoxItemLine::LEFT) + rBox.CalcLineSpace(SvxBoxItemLine::RIGHT); OSL_ENSURE( nWidth > 0, "Gibt es 0 twip breite Grafiken!?" ); if (nWidth <= 0) // sollte nicht passieren @@ -1149,7 +1149,7 @@ OUString lclWriteOutImap(SwHTMLWriter& rHTMLWrt, const SfxItemSet& rItemSet, con { SwTwips nHeight = rFrmSize.GetHeight(); - nHeight -= rBox.CalcLineSpace(BOX_LINE_TOP) + rBox.CalcLineSpace(BOX_LINE_BOTTOM); + nHeight -= rBox.CalcLineSpace(SvxBoxItemLine::TOP) + rBox.CalcLineSpace(SvxBoxItemLine::BOTTOM); OSL_ENSURE( nHeight > 0, "Gibt es 0 twip hohe Grafiken!?" ); if (nHeight <= 0) diff --git a/sw/source/filter/html/htmlgrin.cxx b/sw/source/filter/html/htmlgrin.cxx index 3440326643e6..38f06b0af863 100644 --- a/sw/source/filter/html/htmlgrin.cxx +++ b/sw/source/filter/html/htmlgrin.cxx @@ -539,10 +539,10 @@ IMAGE_SETEVENT: } SvxBoxItem aBoxItem( RES_BOX ); - aBoxItem.SetLine( &aHBorderLine, BOX_LINE_TOP ); - aBoxItem.SetLine( &aHBorderLine, BOX_LINE_BOTTOM ); - aBoxItem.SetLine( &aVBorderLine, BOX_LINE_LEFT ); - aBoxItem.SetLine( &aVBorderLine, BOX_LINE_RIGHT ); + aBoxItem.SetLine( &aHBorderLine, SvxBoxItemLine::TOP ); + aBoxItem.SetLine( &aHBorderLine, SvxBoxItemLine::BOTTOM ); + aBoxItem.SetLine( &aVBorderLine, SvxBoxItemLine::LEFT ); + aBoxItem.SetLine( &aVBorderLine, SvxBoxItemLine::RIGHT ); aFrmSet.Put( aBoxItem ); } diff --git a/sw/source/filter/html/htmltab.cxx b/sw/source/filter/html/htmltab.cxx index 1aa0e643535c..3ff535072fe2 100644 --- a/sw/source/filter/html/htmltab.cxx +++ b/sw/source/filter/html/htmltab.cxx @@ -1417,12 +1417,12 @@ void HTMLTable::FixFrameFmt( SwTableBox *pBox, if( bTopLine ) { - aBoxItem.SetLine( &aTopBorderLine, BOX_LINE_TOP ); + aBoxItem.SetLine( &aTopBorderLine, SvxBoxItemLine::TOP ); bSet = true; } if( bLastBottomLine ) { - aBoxItem.SetLine( &aBottomBorderLine, BOX_LINE_BOTTOM ); + aBoxItem.SetLine( &aBottomBorderLine, SvxBoxItemLine::BOTTOM ); bSet = true; } else if( bBottomLine ) @@ -1439,11 +1439,11 @@ void HTMLTable::FixFrameFmt( SwTableBox *pBox, aThickBorderLine.SetBorderLineStyle( table::BorderLineStyle::SOLID); aThickBorderLine.SetWidth( nBorderWidth ); - aBoxItem.SetLine( &aThickBorderLine, BOX_LINE_BOTTOM ); + aBoxItem.SetLine( &aThickBorderLine, SvxBoxItemLine::BOTTOM ); } else { - aBoxItem.SetLine( &aBorderLine, BOX_LINE_BOTTOM ); + aBoxItem.SetLine( &aBorderLine, SvxBoxItemLine::BOTTOM ); } bSet = true; } @@ -1451,13 +1451,13 @@ void HTMLTable::FixFrameFmt( SwTableBox *pBox, { const SvxBorderLine& rBorderLine = 0==nCol ? aLeftBorderLine : aBorderLine; - aBoxItem.SetLine( &rBorderLine, BOX_LINE_LEFT ); + aBoxItem.SetLine( &rBorderLine, SvxBoxItemLine::LEFT ); nInnerFrmWidth -= GetBorderWidth( rBorderLine ); bSet = true; } if( nCol+nColSpan == nCols && bRightBorder ) { - aBoxItem.SetLine( &aRightBorderLine, BOX_LINE_RIGHT ); + aBoxItem.SetLine( &aRightBorderLine, SvxBoxItemLine::RIGHT ); nInnerFrmWidth -= GetBorderWidth( aRightBorderLine ); bSet = true; } @@ -1569,13 +1569,13 @@ void HTMLTable::FixFillerFrameFmt( SwTableBox *pBox, bool bRight ) const { SvxBoxItem aBoxItem( RES_BOX ); if( bFillerTopBorder ) - aBoxItem.SetLine( &aTopBorderLine, BOX_LINE_TOP ); + aBoxItem.SetLine( &aTopBorderLine, SvxBoxItemLine::TOP ); if( bFillerBottomBorder ) - aBoxItem.SetLine( &aBottomBorderLine, BOX_LINE_BOTTOM ); + aBoxItem.SetLine( &aBottomBorderLine, SvxBoxItemLine::BOTTOM ); if( !bRight && bInhLeftBorder ) - aBoxItem.SetLine( &aInhLeftBorderLine, BOX_LINE_LEFT ); + aBoxItem.SetLine( &aInhLeftBorderLine, SvxBoxItemLine::LEFT ); if( bRight && bInhRightBorder ) - aBoxItem.SetLine( &aInhRightBorderLine, BOX_LINE_RIGHT ); + aBoxItem.SetLine( &aInhRightBorderLine, SvxBoxItemLine::RIGHT ); aBoxItem.SetDistance( MIN_BORDER_DIST ); pFrmFmt->SetFmtAttr( aBoxItem ); } diff --git a/sw/source/filter/html/svxcss1.cxx b/sw/source/filter/html/svxcss1.cxx index 2f97dc1d750e..93ba8b334cda 100644 --- a/sw/source/filter/html/svxcss1.cxx +++ b/sw/source/filter/html/svxcss1.cxx @@ -285,10 +285,10 @@ struct SvxCSS1BorderInfo nNamedWidth( rInfo.nNamedWidth ), eStyle( rInfo.eStyle ) {} - void SetBorderLine( sal_uInt16 nLine, SvxBoxItem &rBoxItem ) const; + void SetBorderLine( SvxBoxItemLine nLine, SvxBoxItem &rBoxItem ) const; }; -void SvxCSS1BorderInfo::SetBorderLine( sal_uInt16 nLine, SvxBoxItem &rBoxItem ) const +void SvxCSS1BorderInfo::SetBorderLine( SvxBoxItemLine nLine, SvxBoxItem &rBoxItem ) const { if( CSS1_BS_NONE==eStyle || nAbsWidth==0 || (nAbsWidth==USHRT_MAX && nNamedWidth==USHRT_MAX) ) @@ -512,15 +512,15 @@ void SvxCSS1PropertyInfo::Merge( const SvxCSS1PropertyInfo& rProp ) } } -SvxCSS1BorderInfo *SvxCSS1PropertyInfo::GetBorderInfo( sal_uInt16 nLine, bool bCreate ) +SvxCSS1BorderInfo *SvxCSS1PropertyInfo::GetBorderInfo( SvxBoxItemLine nLine, bool bCreate ) { sal_uInt16 nPos = 0; switch( nLine ) { - case BOX_LINE_TOP: nPos = 0; break; - case BOX_LINE_BOTTOM: nPos = 1; break; - case BOX_LINE_LEFT: nPos = 2; break; - case BOX_LINE_RIGHT: nPos = 3; break; + case SvxBoxItemLine::TOP: nPos = 0; break; + case SvxBoxItemLine::BOTTOM: nPos = 1; break; + case SvxBoxItemLine::LEFT: nPos = 2; break; + case SvxBoxItemLine::RIGHT: nPos = 3; break; } if( !aBorderInfos[nPos] && bCreate ) @@ -529,7 +529,7 @@ SvxCSS1BorderInfo *SvxCSS1PropertyInfo::GetBorderInfo( sal_uInt16 nLine, bool bC return aBorderInfos[nPos]; } -void SvxCSS1PropertyInfo::CopyBorderInfo( sal_uInt16 nSrcLine, sal_uInt16 nDstLine, +void SvxCSS1PropertyInfo::CopyBorderInfo( SvxBoxItemLine nSrcLine, SvxBoxItemLine nDstLine, sal_uInt16 nWhat ) { SvxCSS1BorderInfo *pSrcInfo = GetBorderInfo( nSrcLine, false ); @@ -554,12 +554,12 @@ void SvxCSS1PropertyInfo::CopyBorderInfo( sal_uInt16 nCount, sal_uInt16 nWhat ) { if( nCount==0 ) { - CopyBorderInfo( BOX_LINE_BOTTOM, BOX_LINE_TOP, nWhat ); - CopyBorderInfo( BOX_LINE_TOP, BOX_LINE_LEFT, nWhat ); + CopyBorderInfo( SvxBoxItemLine::BOTTOM, SvxBoxItemLine::TOP, nWhat ); + CopyBorderInfo( SvxBoxItemLine::TOP, SvxBoxItemLine::LEFT, nWhat ); } if( nCount<=1 ) { - CopyBorderInfo( BOX_LINE_LEFT, BOX_LINE_RIGHT, nWhat ); + CopyBorderInfo( SvxBoxItemLine::LEFT, SvxBoxItemLine::RIGHT, nWhat ); } } @@ -584,40 +584,41 @@ void SvxCSS1PropertyInfo::SetBoxItem( SfxItemSet& rItemSet, if( pDfltItem ) aBoxItem = *pDfltItem; - SvxCSS1BorderInfo *pInfo = GetBorderInfo( BOX_LINE_TOP, false ); + SvxCSS1BorderInfo *pInfo = GetBorderInfo( SvxBoxItemLine::TOP, false ); if( pInfo ) - pInfo->SetBorderLine( BOX_LINE_TOP, aBoxItem ); + pInfo->SetBorderLine( SvxBoxItemLine::TOP, aBoxItem ); - pInfo = GetBorderInfo( BOX_LINE_BOTTOM, false ); + pInfo = GetBorderInfo( SvxBoxItemLine::BOTTOM, false ); if( pInfo ) - pInfo->SetBorderLine( BOX_LINE_BOTTOM, aBoxItem ); + pInfo->SetBorderLine( SvxBoxItemLine::BOTTOM, aBoxItem ); - pInfo = GetBorderInfo( BOX_LINE_LEFT, false ); + pInfo = GetBorderInfo( SvxBoxItemLine::LEFT, false ); if( pInfo ) - pInfo->SetBorderLine( BOX_LINE_LEFT, aBoxItem ); + pInfo->SetBorderLine( SvxBoxItemLine::LEFT, aBoxItem ); - pInfo = GetBorderInfo( BOX_LINE_RIGHT, false ); + pInfo = GetBorderInfo( SvxBoxItemLine::RIGHT, false ); if( pInfo ) - pInfo->SetBorderLine( BOX_LINE_RIGHT, aBoxItem ); + pInfo->SetBorderLine( SvxBoxItemLine::RIGHT, aBoxItem ); for( i=0; i<4; i++ ) { - sal_uInt16 nLine = BOX_LINE_TOP, nDist = 0; + SvxBoxItemLine nLine = SvxBoxItemLine::TOP; + sal_uInt16 nDist = 0; switch( i ) { - case 0: nLine = BOX_LINE_TOP; + case 0: nLine = SvxBoxItemLine::TOP; nDist = nTopBorderDistance; nTopBorderDistance = USHRT_MAX; break; - case 1: nLine = BOX_LINE_BOTTOM; + case 1: nLine = SvxBoxItemLine::BOTTOM; nDist = nBottomBorderDistance; nBottomBorderDistance = USHRT_MAX; break; - case 2: nLine = BOX_LINE_LEFT; + case 2: nLine = SvxBoxItemLine::LEFT; nDist = nLeftBorderDistance; nLeftBorderDistance = USHRT_MAX; break; - case 3: nLine = BOX_LINE_RIGHT; + case 3: nLine = SvxBoxItemLine::RIGHT; nDist = nRightBorderDistance; nRightBorderDistance = USHRT_MAX; break; @@ -2387,7 +2388,7 @@ static bool ParseCSS1_padding_xxx( const CSS1Expression *pExpr, SfxItemSet & /*rItemSet*/, SvxCSS1PropertyInfo& rPropInfo, const SvxCSS1Parser& /*rParser*/, - sal_uInt16 nWhichLine ) + SvxBoxItemLine nWhichLine ) { OSL_ENSURE( pExpr, "no expression" ); @@ -2431,10 +2432,10 @@ static bool ParseCSS1_padding_xxx( const CSS1Expression *pExpr, { switch( nWhichLine ) { - case BOX_LINE_TOP: rPropInfo.nTopBorderDistance = nDist; break; - case BOX_LINE_BOTTOM: rPropInfo.nBottomBorderDistance = nDist;break; - case BOX_LINE_LEFT: rPropInfo.nLeftBorderDistance = nDist; break; - case BOX_LINE_RIGHT: rPropInfo.nRightBorderDistance = nDist; break; + case SvxBoxItemLine::TOP: rPropInfo.nTopBorderDistance = nDist; break; + case SvxBoxItemLine::BOTTOM: rPropInfo.nBottomBorderDistance = nDist;break; + case SvxBoxItemLine::LEFT: rPropInfo.nLeftBorderDistance = nDist; break; + case SvxBoxItemLine::RIGHT: rPropInfo.nRightBorderDistance = nDist; break; } } @@ -2446,7 +2447,7 @@ static void ParseCSS1_padding_top( const CSS1Expression *pExpr, SvxCSS1PropertyInfo& rPropInfo, const SvxCSS1Parser& rParser ) { - ParseCSS1_padding_xxx( pExpr, rItemSet, rPropInfo, rParser, BOX_LINE_TOP ); + ParseCSS1_padding_xxx( pExpr, rItemSet, rPropInfo, rParser, SvxBoxItemLine::TOP ); } static void ParseCSS1_padding_bottom( const CSS1Expression *pExpr, @@ -2455,7 +2456,7 @@ static void ParseCSS1_padding_bottom( const CSS1Expression *pExpr, const SvxCSS1Parser& rParser ) { ParseCSS1_padding_xxx( pExpr, rItemSet, rPropInfo, rParser, - BOX_LINE_BOTTOM ); + SvxBoxItemLine::BOTTOM ); } static void ParseCSS1_padding_left( const CSS1Expression *pExpr, @@ -2463,7 +2464,7 @@ static void ParseCSS1_padding_left( const CSS1Expression *pExpr, SvxCSS1PropertyInfo& rPropInfo, const SvxCSS1Parser& rParser ) { - ParseCSS1_padding_xxx( pExpr, rItemSet, rPropInfo, rParser, BOX_LINE_LEFT ); + ParseCSS1_padding_xxx( pExpr, rItemSet, rPropInfo, rParser, SvxBoxItemLine::LEFT ); } static void ParseCSS1_padding_right( const CSS1Expression *pExpr, @@ -2472,7 +2473,7 @@ static void ParseCSS1_padding_right( const CSS1Expression *pExpr, const SvxCSS1Parser& rParser ) { ParseCSS1_padding_xxx( pExpr, rItemSet, rPropInfo, rParser, - BOX_LINE_RIGHT ); + SvxBoxItemLine::RIGHT ); } static void ParseCSS1_padding( const CSS1Expression *pExpr, @@ -2483,7 +2484,7 @@ static void ParseCSS1_padding( const CSS1Expression *pExpr, sal_uInt16 n=0; while( n<4 && pExpr && !pExpr->GetOp() ) { - sal_uInt16 nLine = n==0 || n==2 ? BOX_LINE_BOTTOM : BOX_LINE_LEFT; + SvxBoxItemLine nLine = n==0 || n==2 ? SvxBoxItemLine::BOTTOM : SvxBoxItemLine::LEFT; if( ParseCSS1_padding_xxx( pExpr, rItemSet, rPropInfo, rParser, nLine ) ) { @@ -2505,7 +2506,7 @@ static void ParseCSS1_border_xxx( const CSS1Expression *pExpr, SfxItemSet & /*rItemSet*/, SvxCSS1PropertyInfo& rPropInfo, const SvxCSS1Parser& /*rParser*/, - sal_uInt16 nWhichLine, bool bAll ) + SvxBoxItemLine nWhichLine, bool bAll ) { OSL_ENSURE( pExpr, "no expression" ); @@ -2550,8 +2551,8 @@ static void ParseCSS1_border_xxx( const CSS1Expression *pExpr, case CSS1_PIXLENGTH: { - bool bHori = nWhichLine == BOX_LINE_TOP || - nWhichLine == BOX_LINE_BOTTOM; + bool bHori = nWhichLine == SvxBoxItemLine::TOP || + nWhichLine == SvxBoxItemLine::BOTTOM; // Ein Pixel wird zur Haarlinie (ist huebscher) long nWidthL = (long)pExpr->GetNumber(); if( nWidthL > 1 ) @@ -2575,13 +2576,13 @@ static void ParseCSS1_border_xxx( const CSS1Expression *pExpr, for( sal_uInt16 i=0; i<4; i++ ) { - sal_uInt16 nLine = 0; + SvxBoxItemLine nLine = SvxBoxItemLine::TOP; switch( i ) { - case 0: nLine = BOX_LINE_TOP; break; - case 1: nLine = BOX_LINE_BOTTOM; break; - case 2: nLine = BOX_LINE_LEFT; break; - case 3: nLine = BOX_LINE_RIGHT; break; + case 0: nLine = SvxBoxItemLine::TOP; break; + case 1: nLine = SvxBoxItemLine::BOTTOM; break; + case 2: nLine = SvxBoxItemLine::LEFT; break; + case 3: nLine = SvxBoxItemLine::RIGHT; break; } if( bAll || nLine == nWhichLine ) @@ -2600,7 +2601,7 @@ static void ParseCSS1_border_xxx_width( const CSS1Expression *pExpr, SfxItemSet & /*rItemSet*/, SvxCSS1PropertyInfo& rPropInfo, const SvxCSS1Parser& /*rParser*/, - sal_uInt16 nWhichLine ) + SvxBoxItemLine nWhichLine ) { OSL_ENSURE( pExpr, "no expression" ); @@ -2625,8 +2626,8 @@ static void ParseCSS1_border_xxx_width( const CSS1Expression *pExpr, case CSS1_PIXLENGTH: { - bool bHori = nWhichLine == BOX_LINE_TOP || - nWhichLine == BOX_LINE_BOTTOM; + bool bHori = nWhichLine == SvxBoxItemLine::TOP || + nWhichLine == SvxBoxItemLine::BOTTOM; long nWidthL = (long)pExpr->GetNumber(); long nPWidth = bHori ? 0 : nWidthL; long nPHeight = bHori ? nWidthL : 0; @@ -2649,7 +2650,7 @@ static void ParseCSS1_border_top_width( const CSS1Expression *pExpr, SvxCSS1PropertyInfo& rPropInfo, const SvxCSS1Parser& rParser ) { - ParseCSS1_border_xxx_width( pExpr, rItemSet, rPropInfo, rParser, BOX_LINE_TOP ); + ParseCSS1_border_xxx_width( pExpr, rItemSet, rPropInfo, rParser, SvxBoxItemLine::TOP ); } static void ParseCSS1_border_right_width( const CSS1Expression *pExpr, @@ -2657,7 +2658,7 @@ static void ParseCSS1_border_right_width( const CSS1Expression *pExpr, SvxCSS1PropertyInfo& rPropInfo, const SvxCSS1Parser& rParser ) { - ParseCSS1_border_xxx_width( pExpr, rItemSet, rPropInfo, rParser, BOX_LINE_RIGHT ); + ParseCSS1_border_xxx_width( pExpr, rItemSet, rPropInfo, rParser, SvxBoxItemLine::RIGHT ); } static void ParseCSS1_border_bottom_width( const CSS1Expression *pExpr, @@ -2665,7 +2666,7 @@ static void ParseCSS1_border_bottom_width( const CSS1Expression *pExpr, SvxCSS1PropertyInfo& rPropInfo, const SvxCSS1Parser& rParser ) { - ParseCSS1_border_xxx_width( pExpr, rItemSet, rPropInfo, rParser, BOX_LINE_BOTTOM ); + ParseCSS1_border_xxx_width( pExpr, rItemSet, rPropInfo, rParser, SvxBoxItemLine::BOTTOM ); } static void ParseCSS1_border_left_width( const CSS1Expression *pExpr, @@ -2673,7 +2674,7 @@ static void ParseCSS1_border_left_width( const CSS1Expression *pExpr, SvxCSS1PropertyInfo& rPropInfo, const SvxCSS1Parser& rParser ) { - ParseCSS1_border_xxx_width( pExpr, rItemSet, rPropInfo, rParser, BOX_LINE_LEFT ); + ParseCSS1_border_xxx_width( pExpr, rItemSet, rPropInfo, rParser, SvxBoxItemLine::LEFT ); } static void ParseCSS1_border_width( const CSS1Expression *pExpr, @@ -2684,7 +2685,7 @@ static void ParseCSS1_border_width( const CSS1Expression *pExpr, sal_uInt16 n=0; while( n<4 && pExpr && !pExpr->GetOp() ) { - sal_uInt16 nLine = n==0 || n==2 ? BOX_LINE_BOTTOM : BOX_LINE_LEFT; + SvxBoxItemLine nLine = n==0 || n==2 ? SvxBoxItemLine::BOTTOM : SvxBoxItemLine::LEFT; ParseCSS1_border_xxx_width( pExpr, rItemSet, rPropInfo, rParser, nLine ); rPropInfo.CopyBorderInfo( n, SVX_CSS1_BORDERINFO_WIDTH ); @@ -2701,7 +2702,7 @@ static void ParseCSS1_border_color( const CSS1Expression *pExpr, sal_uInt16 n=0; while( n<4 && pExpr && !pExpr->GetOp() ) { - sal_uInt16 nLine = n==0 || n==2 ? BOX_LINE_BOTTOM : BOX_LINE_LEFT; + SvxBoxItemLine nLine = n==0 || n==2 ? SvxBoxItemLine::BOTTOM : SvxBoxItemLine::LEFT; Color aColor; switch( pExpr->GetType() ) { @@ -2729,7 +2730,7 @@ static void ParseCSS1_border_style( const CSS1Expression *pExpr, sal_uInt16 n=0; while( n<4 && pExpr && !pExpr->GetOp() ) { - sal_uInt16 nLine = n==0 || n==2 ? BOX_LINE_BOTTOM : BOX_LINE_LEFT; + SvxBoxItemLine nLine = n==0 || n==2 ? SvxBoxItemLine::BOTTOM : SvxBoxItemLine::LEFT; sal_uInt16 nValue = 0; if( CSS1_IDENT==pExpr->GetType() && SvxCSS1Parser::GetEnum( aBorderStyleTable, pExpr->GetString(), @@ -2749,7 +2750,7 @@ static void ParseCSS1_border_top( const CSS1Expression *pExpr, SvxCSS1PropertyInfo& rPropInfo, const SvxCSS1Parser& rParser ) { - ParseCSS1_border_xxx( pExpr, rItemSet, rPropInfo, rParser, BOX_LINE_TOP, false ); + ParseCSS1_border_xxx( pExpr, rItemSet, rPropInfo, rParser, SvxBoxItemLine::TOP, false ); } static void ParseCSS1_border_right( const CSS1Expression *pExpr, @@ -2757,7 +2758,7 @@ static void ParseCSS1_border_right( const CSS1Expression *pExpr, SvxCSS1PropertyInfo& rPropInfo, const SvxCSS1Parser& rParser ) { - ParseCSS1_border_xxx( pExpr, rItemSet, rPropInfo, rParser, BOX_LINE_RIGHT, false ); + ParseCSS1_border_xxx( pExpr, rItemSet, rPropInfo, rParser, SvxBoxItemLine::RIGHT, false ); } static void ParseCSS1_border_bottom( const CSS1Expression *pExpr, @@ -2765,7 +2766,7 @@ static void ParseCSS1_border_bottom( const CSS1Expression *pExpr, SvxCSS1PropertyInfo& rPropInfo, const SvxCSS1Parser& rParser ) { - ParseCSS1_border_xxx( pExpr, rItemSet, rPropInfo, rParser, BOX_LINE_BOTTOM, false ); + ParseCSS1_border_xxx( pExpr, rItemSet, rPropInfo, rParser, SvxBoxItemLine::BOTTOM, false ); } static void ParseCSS1_border_left( const CSS1Expression *pExpr, @@ -2773,7 +2774,7 @@ static void ParseCSS1_border_left( const CSS1Expression *pExpr, SvxCSS1PropertyInfo& rPropInfo, const SvxCSS1Parser& rParser ) { - ParseCSS1_border_xxx( pExpr, rItemSet, rPropInfo, rParser, BOX_LINE_LEFT, false ); + ParseCSS1_border_xxx( pExpr, rItemSet, rPropInfo, rParser, SvxBoxItemLine::LEFT, false ); } static void ParseCSS1_border( const CSS1Expression *pExpr, @@ -2781,7 +2782,7 @@ static void ParseCSS1_border( const CSS1Expression *pExpr, SvxCSS1PropertyInfo& rPropInfo, const SvxCSS1Parser& rParser ) { - ParseCSS1_border_xxx( pExpr, rItemSet, rPropInfo, rParser, 0, true ); + ParseCSS1_border_xxx( pExpr, rItemSet, rPropInfo, rParser, SvxBoxItemLine::TOP, true ); } static void ParseCSS1_float( const CSS1Expression *pExpr, diff --git a/sw/source/filter/html/svxcss1.hxx b/sw/source/filter/html/svxcss1.hxx index d9ee9169af2d..5496b608e599 100644 --- a/sw/source/filter/html/svxcss1.hxx +++ b/sw/source/filter/html/svxcss1.hxx @@ -141,8 +141,8 @@ public: void Clear(); - SvxCSS1BorderInfo *GetBorderInfo( sal_uInt16 nLine, bool bCreate=true ); - void CopyBorderInfo( sal_uInt16 nSrcLine, sal_uInt16 nDstLine, sal_uInt16 nWhat ); + SvxCSS1BorderInfo *GetBorderInfo( SvxBoxItemLine nLine, bool bCreate=true ); + void CopyBorderInfo( SvxBoxItemLine nSrcLine, SvxBoxItemLine nDstLine, sal_uInt16 nWhat ); void CopyBorderInfo( sal_uInt16 nCount, sal_uInt16 nWhat ); void SetBoxItem( SfxItemSet& rItemSet, sal_uInt16 nMinBorderDist, diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx index a676433811a6..f7699c78766d 100644 --- a/sw/source/filter/html/swhtml.cxx +++ b/sw/source/filter/html/swhtml.cxx @@ -5316,7 +5316,7 @@ void SwHTMLParser::InsertHorzRule() } SvxBoxItem aBoxItem(RES_BOX); - aBoxItem.SetLine( &aBorderLine, BOX_LINE_BOTTOM ); + aBoxItem.SetLine( &aBorderLine, SvxBoxItemLine::BOTTOM ); _HTMLAttr* pTmp = new _HTMLAttr( *pPam->GetPoint(), aBoxItem ); aSetAttrTab.push_back( pTmp ); } diff --git a/sw/source/filter/writer/wrtswtbl.cxx b/sw/source/filter/writer/wrtswtbl.cxx index 968a3ddd1d95..1f58fdf63d60 100644 --- a/sw/source/filter/writer/wrtswtbl.cxx +++ b/sw/source/filter/writer/wrtswtbl.cxx @@ -263,16 +263,16 @@ sal_uInt16 SwWriteTable::MergeBoxBorders( const SwTableBox *pBox, // boxes. if( bCollectBorderWidth ) { - sal_uInt16 nDist = rBoxItem.GetDistance( BOX_LINE_TOP ); + sal_uInt16 nDist = rBoxItem.GetDistance( SvxBoxItemLine::TOP ); if( nDist && (!nCellPadding || nDist < nCellPadding) ) nCellPadding = nDist; - nDist = rBoxItem.GetDistance( BOX_LINE_BOTTOM ); + nDist = rBoxItem.GetDistance( SvxBoxItemLine::BOTTOM ); if( nDist && (!nCellPadding || nDist < nCellPadding) ) nCellPadding = nDist; - nDist = rBoxItem.GetDistance( BOX_LINE_LEFT ); + nDist = rBoxItem.GetDistance( SvxBoxItemLine::LEFT ); if( nDist && (!nCellPadding || nDist < nCellPadding) ) nCellPadding = nDist; - nDist = rBoxItem.GetDistance( BOX_LINE_RIGHT ); + nDist = rBoxItem.GetDistance( SvxBoxItemLine::RIGHT ); if( nDist && (!nCellPadding || nDist < nCellPadding) ) nCellPadding = nDist; } diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index eb78b3389791..c0dbda73431f 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -2644,19 +2644,19 @@ static OutputBorderOptions lcl_getBoxBorderOptions() static bool boxHasLineLargerThan31(const SvxBoxItem& rBox) { return ( - ( rBox.GetDistance( BOX_LINE_TOP ) / 20 ) > 31 || - ( rBox.GetDistance( BOX_LINE_LEFT ) / 20 ) > 31 || - ( rBox.GetDistance( BOX_LINE_BOTTOM ) / 20 ) > 31 || - ( rBox.GetDistance( BOX_LINE_RIGHT ) / 20 ) > 31 + ( rBox.GetDistance( SvxBoxItemLine::TOP ) / 20 ) > 31 || + ( rBox.GetDistance( SvxBoxItemLine::LEFT ) / 20 ) > 31 || + ( rBox.GetDistance( SvxBoxItemLine::BOTTOM ) / 20 ) > 31 || + ( rBox.GetDistance( SvxBoxItemLine::RIGHT ) / 20 ) > 31 ); } static void impl_borders( FSHelperPtr pSerializer, const SvxBoxItem& rBox, const OutputBorderOptions& rOptions, PageMargins* pageMargins, - std::map<sal_uInt16, css::table::BorderLine2> &rTableStyleConf ) + std::map<SvxBoxItemLine, css::table::BorderLine2> &rTableStyleConf ) { - static const sal_uInt16 aBorders[] = + static const SvxBoxItemLine aBorders[] = { - BOX_LINE_TOP, BOX_LINE_LEFT, BOX_LINE_BOTTOM, BOX_LINE_RIGHT + SvxBoxItemLine::TOP, SvxBoxItemLine::LEFT, SvxBoxItemLine::BOTTOM, SvxBoxItemLine::RIGHT }; const sal_Int32 aXmlElements[] = @@ -2667,7 +2667,7 @@ static void impl_borders( FSHelperPtr pSerializer, const SvxBoxItem& rBox, const rOptions.bUseStartEnd ? XML_end : XML_right }; bool tagWritten = false; - const sal_uInt16* pBrd = aBorders; + const SvxBoxItemLine* pBrd = aBorders; bool bExportDistanceFromPageEdge = false; if ( rOptions.bCheckDistanceSize == true && boxHasLineLargerThan31(rBox) == true ) @@ -2714,10 +2714,10 @@ static void impl_borders( FSHelperPtr pSerializer, const SvxBoxItem& rBox, const // If there is a shadow, and it's not the regular 'Bottom-Right', // then write only the 'shadowed' sides of the border if ( - ( ( rOptions.aShadowLocation == SVX_SHADOW_TOPLEFT || rOptions.aShadowLocation == SVX_SHADOW_TOPRIGHT ) && *pBrd == BOX_LINE_TOP ) || - ( ( rOptions.aShadowLocation == SVX_SHADOW_TOPLEFT || rOptions.aShadowLocation == SVX_SHADOW_BOTTOMLEFT ) && *pBrd == BOX_LINE_LEFT ) || - ( ( rOptions.aShadowLocation == SVX_SHADOW_BOTTOMLEFT || rOptions.aShadowLocation == SVX_SHADOW_BOTTOMRIGHT ) && *pBrd == BOX_LINE_BOTTOM) || - ( ( rOptions.aShadowLocation == SVX_SHADOW_TOPRIGHT || rOptions.aShadowLocation == SVX_SHADOW_BOTTOMRIGHT ) && *pBrd == BOX_LINE_RIGHT ) + ( ( rOptions.aShadowLocation == SVX_SHADOW_TOPLEFT || rOptions.aShadowLocation == SVX_SHADOW_TOPRIGHT ) && *pBrd == SvxBoxItemLine::TOP ) || + ( ( rOptions.aShadowLocation == SVX_SHADOW_TOPLEFT || rOptions.aShadowLocation == SVX_SHADOW_BOTTOMLEFT ) && *pBrd == SvxBoxItemLine::LEFT ) || + ( ( rOptions.aShadowLocation == SVX_SHADOW_BOTTOMLEFT || rOptions.aShadowLocation == SVX_SHADOW_BOTTOMRIGHT ) && *pBrd == SvxBoxItemLine::BOTTOM) || + ( ( rOptions.aShadowLocation == SVX_SHADOW_TOPRIGHT || rOptions.aShadowLocation == SVX_SHADOW_BOTTOMRIGHT ) && *pBrd == SvxBoxItemLine::RIGHT ) ) { bWriteShadow = true; @@ -2730,13 +2730,13 @@ static void impl_borders( FSHelperPtr pSerializer, const SvxBoxItem& rBox, const if (bExportDistanceFromPageEdge) { // Export 'Distance from Page Edge' - if ( *pBrd == BOX_LINE_TOP) + if ( *pBrd == SvxBoxItemLine::TOP) nDist = pageMargins->nPageMarginTop - rBox.GetDistance( *pBrd ); - else if ( *pBrd == BOX_LINE_LEFT) + else if ( *pBrd == SvxBoxItemLine::LEFT) nDist = pageMargins->nPageMarginLeft - rBox.GetDistance( *pBrd ); - else if ( *pBrd == BOX_LINE_BOTTOM) + else if ( *pBrd == SvxBoxItemLine::BOTTOM) nDist = pageMargins->nPageMarginBottom - rBox.GetDistance( *pBrd ); - else if ( *pBrd == BOX_LINE_RIGHT) + else if ( *pBrd == SvxBoxItemLine::RIGHT) nDist = pageMargins->nPageMarginRight - rBox.GetDistance( *pBrd ); } else @@ -2759,16 +2759,16 @@ static void impl_borders( FSHelperPtr pSerializer, const SvxBoxItem& rBox, const if (bWriteInsideH) { const table::BorderLine2 *aStyleProps = NULL; - if( rTableStyleConf.find( BOX_LINE_BOTTOM ) != rTableStyleConf.end() ) - aStyleProps = &rTableStyleConf[ BOX_LINE_BOTTOM ]; - impl_borderLine( pSerializer, XML_insideH, rBox.GetLine(BOX_LINE_BOTTOM), 0, false, aStyleProps ); + if( rTableStyleConf.find( SvxBoxItemLine::BOTTOM ) != rTableStyleConf.end() ) + aStyleProps = &rTableStyleConf[ SvxBoxItemLine::BOTTOM ]; + impl_borderLine( pSerializer, XML_insideH, rBox.GetLine(SvxBoxItemLine::BOTTOM), 0, false, aStyleProps ); } if (bWriteInsideV) { const table::BorderLine2 *aStyleProps = NULL; - if( rTableStyleConf.find( BOX_LINE_RIGHT ) != rTableStyleConf.end() ) - aStyleProps = &rTableStyleConf[ BOX_LINE_RIGHT ]; - impl_borderLine( pSerializer, XML_insideV, rBox.GetLine(BOX_LINE_RIGHT), 0, false, aStyleProps ); + if( rTableStyleConf.find( SvxBoxItemLine::RIGHT ) != rTableStyleConf.end() ) + aStyleProps = &rTableStyleConf[ SvxBoxItemLine::RIGHT ]; + impl_borderLine( pSerializer, XML_insideV, rBox.GetLine(SvxBoxItemLine::RIGHT), 0, false, aStyleProps ); } if (tagWritten && rOptions.bWriteTag) { pSerializer->endElementNS( XML_w, rOptions.tag ); @@ -2777,9 +2777,9 @@ static void impl_borders( FSHelperPtr pSerializer, const SvxBoxItem& rBox, const static void impl_cellMargins( FSHelperPtr pSerializer, const SvxBoxItem& rBox, sal_Int32 tag, bool bUseStartEnd = false, const SvxBoxItem* pDefaultMargins = 0) { - static const sal_uInt16 aBorders[] = + static const SvxBoxItemLine aBorders[] = { - BOX_LINE_TOP, BOX_LINE_LEFT, BOX_LINE_BOTTOM, BOX_LINE_RIGHT + SvxBoxItemLine::TOP, SvxBoxItemLine::LEFT, SvxBoxItemLine::BOTTOM, SvxBoxItemLine::RIGHT }; const sal_Int32 aXmlElements[] = @@ -2790,12 +2790,12 @@ static void impl_cellMargins( FSHelperPtr pSerializer, const SvxBoxItem& rBox, s bUseStartEnd ? XML_end : XML_right }; bool tagWritten = false; - const sal_uInt16* pBrd = aBorders; + const SvxBoxItemLine* pBrd = aBorders; for( int i = 0; i < 4; ++i, ++pBrd ) { sal_Int32 nDist = sal_Int32( rBox.GetDistance( *pBrd ) ); - if ( aBorders[i] == BOX_LINE_LEFT ) { + if ( aBorders[i] == SvxBoxItemLine::LEFT ) { // Office's cell margin is measured from the right of the border. // While LO's cell spacing is measured from the center of the border. // So we add half left-border width to tblIndent value @@ -3148,13 +3148,13 @@ void DocxAttributeOutput::TableDefinition( ww8::WW8TableNodeInfoInner::Pointer_t FSEND ); } else if( aGrabBagElement->first == "TableStyleTopBorder" ) - m_aTableStyleConf[ BOX_LINE_TOP ] = aGrabBagElement->second.get<table::BorderLine2>(); + m_aTableStyleConf[ SvxBoxItemLine::TOP ] = aGrabBagElement->second.get<table::BorderLine2>(); else if( aGrabBagElement->first == "TableStyleBottomBorder" ) - m_aTableStyleConf[ BOX_LINE_BOTTOM ] = aGrabBagElement->second.get<table::BorderLine2>(); + m_aTableStyleConf[ SvxBoxItemLine::BOTTOM ] = aGrabBagElement->second.get<table::BorderLine2>(); else if( aGrabBagElement->first == "TableStyleLeftBorder" ) - m_aTableStyleConf[ BOX_LINE_LEFT ] = aGrabBagElement->second.get<table::BorderLine2>(); + m_aTableStyleConf[ SvxBoxItemLine::LEFT ] = aGrabBagElement->second.get<table::BorderLine2>(); else if( aGrabBagElement->first == "TableStyleRightBorder" ) - m_aTableStyleConf[ BOX_LINE_RIGHT ] = aGrabBagElement->second.get<table::BorderLine2>(); + m_aTableStyleConf[ SvxBoxItemLine::RIGHT ] = aGrabBagElement->second.get<table::BorderLine2>(); else if (aGrabBagElement->first == "TableStyleLook") { FastAttributeList* pAttributeList = FastSerializerHelper::createAttrList(); @@ -3277,7 +3277,7 @@ void DocxAttributeOutput::TableDefinition( ww8::WW8TableNodeInfoInner::Pointer_t { const SwTableBox * pTabBox = pTableTextNodeInfoInner->getTableBox(); const SwFrmFmt * pFrmFmt = pTabBox->GetFrmFmt(); - nIndent += sal_Int32( pFrmFmt->GetBox( ).GetDistance( BOX_LINE_LEFT ) ); + nIndent += sal_Int32( pFrmFmt->GetBox( ).GetDistance( SvxBoxItemLine::LEFT ) ); } break; } @@ -4195,10 +4195,10 @@ void DocxAttributeOutput::FlyFrameGraphic( const SwGrfNode* pGrfNode, const Size m_pSerializer->endElementNS( XML_a, XML_prstGeom ); const SvxBoxItem& rBoxItem = pFrmFmt->GetBox(); - const SvxBorderLine* pLeft = rBoxItem.GetLine(BOX_LINE_LEFT); - const SvxBorderLine* pRight = rBoxItem.GetLine(BOX_LINE_RIGHT); - const SvxBorderLine* pTop = rBoxItem.GetLine(BOX_LINE_TOP); - const SvxBorderLine* pBottom = rBoxItem.GetLine(BOX_LINE_BOTTOM); + const SvxBorderLine* pLeft = rBoxItem.GetLine(SvxBoxItemLine::LEFT); + const SvxBorderLine* pRight = rBoxItem.GetLine(SvxBoxItemLine::RIGHT); + const SvxBorderLine* pTop = rBoxItem.GetLine(SvxBoxItemLine::TOP); + const SvxBorderLine* pBottom = rBoxItem.GetLine(SvxBoxItemLine::BOTTOM); if (pLeft || pRight || pTop || pBottom) m_rExport.SdrExporter().writeBoxItemLine(rBoxItem); @@ -5476,7 +5476,7 @@ void DocxAttributeOutput::SectionPageBorders( const SwFrmFmt* pFmt, const SwFrmF if (aGlue.HasFooter()) aMargins.nPageMarginBottom = aGlue.dyaHdrBottom; - std::map<sal_uInt16, css::table::BorderLine2> aEmptyMap; // empty styles map + std::map<SvxBoxItemLine, css::table::BorderLine2> aEmptyMap; // empty styles map impl_borders( m_pSerializer, rBox, aOutputBorderOptions, &aMargins, aEmptyMap ); @@ -7121,8 +7121,8 @@ void DocxAttributeOutput::FormatLRSpace( const SvxLRSpaceItem& rLRSpace ) const SfxPoolItem* pItem = m_rExport.HasItem( RES_BOX ); if ( pItem ) { - m_pageMargins.nPageMarginRight = static_cast<const SvxBoxItem*>(pItem)->CalcLineSpace( BOX_LINE_LEFT ); - m_pageMargins.nPageMarginLeft = static_cast<const SvxBoxItem*>(pItem)->CalcLineSpace( BOX_LINE_RIGHT ); + m_pageMargins.nPageMarginRight = static_cast<const SvxBoxItem*>(pItem)->CalcLineSpace( SvxBoxItemLine::LEFT ); + m_pageMargins.nPageMarginLeft = static_cast<const SvxBoxItem*>(pItem)->CalcLineSpace( SvxBoxItemLine::RIGHT ); } else m_pageMargins.nPageMarginLeft = m_pageMargins.nPageMarginRight = 0; @@ -7677,18 +7677,18 @@ void DocxAttributeOutput::FormatBox( const SvxBoxItem& rBox ) if (m_rExport.SdrExporter().getDMLTextFrameSyntax()) { - m_rExport.SdrExporter().getBodyPrAttrList()->add(XML_lIns, OString::number(TwipsToEMU(rBox.GetDistance(BOX_LINE_LEFT)))); - m_rExport.SdrExporter().getBodyPrAttrList()->add(XML_tIns, OString::number(TwipsToEMU(rBox.GetDistance(BOX_LINE_TOP)))); - m_rExport.SdrExporter().getBodyPrAttrList()->add(XML_rIns, OString::number(TwipsToEMU(rBox.GetDistance(BOX_LINE_RIGHT)))); - m_rExport.SdrExporter().getBodyPrAttrList()->add(XML_bIns, OString::number(TwipsToEMU(rBox.GetDistance(BOX_LINE_BOTTOM)))); + m_rExport.SdrExporter().getBodyPrAttrList()->add(XML_lIns, OString::number(TwipsToEMU(rBox.GetDistance(SvxBoxItemLine::LEFT)))); + m_rExport.SdrExporter().getBodyPrAttrList()->add(XML_tIns, OString::number(TwipsToEMU(rBox.GetDistance(SvxBoxItemLine::TOP)))); + m_rExport.SdrExporter().getBodyPrAttrList()->add(XML_rIns, OString::number(TwipsToEMU(rBox.GetDistance(SvxBoxItemLine::RIGHT)))); + m_rExport.SdrExporter().getBodyPrAttrList()->add(XML_bIns, OString::number(TwipsToEMU(rBox.GetDistance(SvxBoxItemLine::BOTTOM)))); return; } // v:textbox's inset attribute: inner margin values for textbox text - write only non-default values - double fDistanceLeftTwips = double(rBox.GetDistance(BOX_LINE_LEFT)); - double fDistanceTopTwips = double(rBox.GetDistance(BOX_LINE_TOP)); - double fDistanceRightTwips = double(rBox.GetDistance(BOX_LINE_RIGHT)); - double fDistanceBottomTwips = double(rBox.GetDistance(BOX_LINE_BOTTOM)); + double fDistanceLeftTwips = double(rBox.GetDistance(SvxBoxItemLine::LEFT)); + double fDistanceTopTwips = double(rBox.GetDistance(SvxBoxItemLine::TOP)); + double fDistanceRightTwips = double(rBox.GetDistance(SvxBoxItemLine::RIGHT)); + double fDistanceBottomTwips = double(rBox.GetDistance(SvxBoxItemLine::BOTTOM)); // Convert 'TWIPS' to 'INCH' (because in Word the default values are in Inches) double fDistanceLeftInch = fDistanceLeftTwips / 1440; @@ -7735,7 +7735,7 @@ void DocxAttributeOutput::FormatBox( const SvxBoxItem& rBox ) // Open the paragraph's borders tag m_pSerializer->startElementNS( XML_w, XML_pBdr, FSEND ); - std::map<sal_uInt16, css::table::BorderLine2> aEmptyMap; // empty styles map + std::map<SvxBoxItemLine, css::table::BorderLine2> aEmptyMap; // empty styles map impl_borders( m_pSerializer, rBox, aOutputBorderOptions, &m_pageMargins, aEmptyMap ); diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx index c43b391c80d9..95bca2b4e4e5 100644 --- a/sw/source/filter/ww8/docxattributeoutput.hxx +++ b/sw/source/filter/ww8/docxattributeoutput.hxx @@ -924,7 +924,7 @@ private: /// Currently paragraph SDT has a <w:id> child element. bool m_bParagraphSdtHasId; - std::map<sal_uInt16, css::table::BorderLine2> m_aTableStyleConf; + std::map<SvxBoxItemLine, css::table::BorderLine2> m_aTableStyleConf; public: DocxAttributeOutput( DocxExport &rExport, ::sax_fastparser::FSHelperPtr pSerializer, oox::drawingml::DrawingML* pDrawingML ); diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx index 08f927bf3610..738887ef8245 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.cxx +++ b/sw/source/filter/ww8/rtfattributeoutput.cxx @@ -557,9 +557,9 @@ void RtfAttributeOutput::TableDefinition(ww8::WW8TableNodeInfoInner::Pointer_t p // Cell margins const SvxBoxItem& rBox = pFmt->GetBox(); - static const sal_uInt16 aBorders[] = + static const SvxBoxItemLine aBorders[] = { - BOX_LINE_TOP, BOX_LINE_LEFT, BOX_LINE_BOTTOM, BOX_LINE_RIGHT + SvxBoxItemLine::TOP, SvxBoxItemLine::LEFT, SvxBoxItemLine::BOTTOM, SvxBoxItemLine::RIGHT }; static const char* aRowPadNames[] = @@ -642,9 +642,9 @@ void RtfAttributeOutput::TableDefaultBorders(ww8::WW8TableNodeInfoInner::Pointer if (pCellFmt->GetAttrSet().HasItem(RES_BOX, &pItem)) { const SvxBoxItem& rBox = static_cast<const SvxBoxItem&>(*pItem); - static const sal_uInt16 aBorders[] = + static const SvxBoxItemLine aBorders[] = { - BOX_LINE_TOP, BOX_LINE_LEFT, BOX_LINE_BOTTOM, BOX_LINE_RIGHT + SvxBoxItemLine::TOP, SvxBoxItemLine::LEFT, SvxBoxItemLine::BOTTOM, SvxBoxItemLine::RIGHT }; static const char* aBorderNames[] = { @@ -1143,22 +1143,22 @@ void RtfAttributeOutput::SectionPageBorders(const SwFrmFmt* pFmt, const SwFrmFmt if (pLine) m_aSectionBreaks.append(OutBorderLine(m_rExport, pLine, OOO_STRING_SVTOOLS_RTF_PGBRDRT, - rBox.GetDistance(BOX_LINE_TOP))); + rBox.GetDistance(SvxBoxItemLine::TOP))); pLine = rBox.GetBottom(); if (pLine) m_aSectionBreaks.append(OutBorderLine(m_rExport, pLine, OOO_STRING_SVTOOLS_RTF_PGBRDRB, - rBox.GetDistance(BOX_LINE_BOTTOM))); + rBox.GetDistance(SvxBoxItemLine::BOTTOM))); pLine = rBox.GetLeft(); if (pLine) m_aSectionBreaks.append(OutBorderLine(m_rExport, pLine, OOO_STRING_SVTOOLS_RTF_PGBRDRL, - rBox.GetDistance(BOX_LINE_LEFT))); + rBox.GetDistance(SvxBoxItemLine::LEFT))); pLine = rBox.GetRight(); if (pLine) m_aSectionBreaks.append(OutBorderLine(m_rExport, pLine, OOO_STRING_SVTOOLS_RTF_PGBRDRR, - rBox.GetDistance(BOX_LINE_RIGHT))); + rBox.GetDistance(SvxBoxItemLine::RIGHT))); } void RtfAttributeOutput::SectionBiDi(bool bBiDi) @@ -3118,9 +3118,9 @@ void RtfAttributeOutput::FormatFillGradient(const XFillGradientItem& rFillGradie void RtfAttributeOutput::FormatBox(const SvxBoxItem& rBox) { - static const sal_uInt16 aBorders[] = + static const SvxBoxItemLine aBorders[] = { - BOX_LINE_TOP, BOX_LINE_LEFT, BOX_LINE_BOTTOM, BOX_LINE_RIGHT + SvxBoxItemLine::TOP, SvxBoxItemLine::LEFT, SvxBoxItemLine::BOTTOM, SvxBoxItemLine::RIGHT }; static const sal_Char* aBorderNames[] = { @@ -3132,15 +3132,15 @@ void RtfAttributeOutput::FormatBox(const SvxBoxItem& rBox) if (m_rExport.bRTFFlySyntax) { // Borders: spacing to contents, convert from twips to EMUs. - m_aFlyProperties.push_back(std::make_pair<OString, OString>("dxTextLeft", OString::number(rBox.GetDistance(BOX_LINE_LEFT) * 635))); - m_aFlyProperties.push_back(std::make_pair<OString, OString>("dyTextTop", OString::number(rBox.GetDistance(BOX_LINE_TOP) * 635))); - m_aFlyProperties.push_back(std::make_pair<OString, OString>("dxTextRight", OString::number(rBox.GetDistance(BOX_LINE_RIGHT) * 635))); - m_aFlyProperties.push_back(std::make_pair<OString, OString>("dyTextBottom", OString::number(rBox.GetDistance(BOX_LINE_BOTTOM) * 635))); - - const SvxBorderLine* pLeft = rBox.GetLine(BOX_LINE_LEFT); - const SvxBorderLine* pRight = rBox.GetLine(BOX_LINE_RIGHT); - const SvxBorderLine* pTop = rBox.GetLine(BOX_LINE_TOP); - const SvxBorderLine* pBottom = rBox.GetLine(BOX_LINE_BOTTOM); + m_aFlyProperties.push_back(std::make_pair<OString, OString>("dxTextLeft", OString::number(rBox.GetDistance(SvxBoxItemLine::LEFT) * 635))); + m_aFlyProperties.push_back(std::make_pair<OString, OString>("dyTextTop", OString::number(rBox.GetDistance(SvxBoxItemLine::TOP) * 635))); + m_aFlyProperties.push_back(std::make_pair<OString, OString>("dxTextRight", OString::number(rBox.GetDistance(SvxBoxItemLine::RIGHT) * 635))); + m_aFlyProperties.push_back(std::make_pair<OString, OString>("dyTextBottom", OString::number(rBox.GetDistance(SvxBoxItemLine::BOTTOM) * 635))); + + const SvxBorderLine* pLeft = rBox.GetLine(SvxBoxItemLine::LEFT); + const SvxBorderLine* pRight = rBox.GetLine(SvxBoxItemLine::RIGHT); + const SvxBorderLine* pTop = rBox.GetLine(SvxBoxItemLine::TOP); + const SvxBorderLine* pBottom = rBox.GetLine(SvxBoxItemLine::BOTTOM); if (pLeft && pRight && pTop && pBottom && *pLeft == *pRight && *pLeft == *pTop && *pLeft == *pBottom) { const Color& rColor = pTop->GetColor(); @@ -3166,10 +3166,10 @@ void RtfAttributeOutput::FormatBox(const SvxBoxItem& rBox) *rBox.GetTop() == *rBox.GetBottom() && *rBox.GetTop() == *rBox.GetLeft() && *rBox.GetTop() == *rBox.GetRight() && - nDist == rBox.GetDistance(BOX_LINE_TOP) && - nDist == rBox.GetDistance(BOX_LINE_LEFT) && - nDist == rBox.GetDistance(BOX_LINE_BOTTOM) && - nDist == rBox.GetDistance(BOX_LINE_RIGHT)) + nDist == rBox.GetDistance(SvxBoxItemLine::TOP) && + nDist == rBox.GetDistance(SvxBoxItemLine::LEFT) && + nDist == rBox.GetDistance(SvxBoxItemLine::BOTTOM) && + nDist == rBox.GetDistance(SvxBoxItemLine::RIGHT)) m_aSectionBreaks.append(OutBorderLine(m_rExport, rBox.GetTop(), OOO_STRING_SVTOOLS_RTF_BOX, nDist)); else { @@ -3177,7 +3177,7 @@ void RtfAttributeOutput::FormatBox(const SvxBoxItem& rBox) if (const SfxPoolItem* pItem = GetExport().HasItem(RES_SHADOW)) eShadowLocation = static_cast<const SvxShadowItem*>(pItem)->GetLocation(); - const sal_uInt16* pBrd = aBorders; + const SvxBoxItemLine* pBrd = aBorders; const sal_Char** pBrdNms = (const sal_Char**)aBorderNames; for (int i = 0; i < 4; ++i, ++pBrd, ++pBrdNms) { diff --git a/sw/source/filter/ww8/writerwordglue.cxx b/sw/source/filter/ww8/writerwordglue.cxx index 92d32d0e6a25..fef51ca962b7 100644 --- a/sw/source/filter/ww8/writerwordglue.cxx +++ b/sw/source/filter/ww8/writerwordglue.cxx @@ -341,11 +341,11 @@ static SvxLRSpaceItem lcl_getWordLRSpace(const SwFrmFmt& rFmt) SvxLRSpaceItem aLR(rFmt.GetLRSpace()); const SvxBoxItem& rBox = rFmt.GetBox(); - aLR.SetLeft(aLR.GetLeft() + rBox.GetDistance(BOX_LINE_LEFT)); + aLR.SetLeft(aLR.GetLeft() + rBox.GetDistance(SvxBoxItemLine::LEFT)); if (const editeng::SvxBorderLine* pLeft = rBox.GetLeft()) aLR.SetLeft(aLR.GetLeft() + pLeft->GetWidth()); - aLR.SetRight(aLR.GetRight() + rBox.GetDistance(BOX_LINE_RIGHT)); + aLR.SetRight(aLR.GetRight() + rBox.GetDistance(SvxBoxItemLine::RIGHT)); if (const editeng::SvxBorderLine* pRight = rBox.GetRight()) aLR.SetRight(aLR.GetRight() + pRight->GetWidth()); @@ -394,8 +394,8 @@ namespace sw { if (const SvxBoxItem *pBox = HasItem<SvxBoxItem>(rPage, RES_BOX)) { - dyaHdrTop = pBox->CalcLineSpace(BOX_LINE_TOP); - dyaHdrBottom = pBox->CalcLineSpace(BOX_LINE_BOTTOM); + dyaHdrTop = pBox->CalcLineSpace(SvxBoxItemLine::TOP); + dyaHdrBottom = pBox->CalcLineSpace(SvxBoxItemLine::BOTTOM); } else { diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx index c8142983635d..0e03963d58b0 100644 --- a/sw/source/filter/ww8/wrtw8esh.cxx +++ b/sw/source/filter/ww8/wrtw8esh.cxx @@ -96,6 +96,8 @@ #include "sfx2/sfxsids.hrc" #include <svl/urihelper.hxx> #include <unotools/saveopt.hxx> +#include <o3tl/enumrange.hxx> +#include <o3tl/enumarray.hxx> #include <algorithm> @@ -1903,14 +1905,14 @@ sal_Int32 SwBasicEscherEx::WriteFlyFrameAttr(const SwFrmFmt& rFmt, bool bFirstLine = true; if (SfxItemState::SET == rFmt.GetItemState(RES_BOX, true, &pItem)) { - static const sal_uInt16 aExhperProp[4] = + static const o3tl::enumarray<SvxBoxItemLine, sal_uInt16> aExhperProp = { ESCHER_Prop_dyTextTop, ESCHER_Prop_dyTextBottom, ESCHER_Prop_dxTextLeft, ESCHER_Prop_dxTextRight }; const SvxBorderLine* pLine; - for( sal_uInt16 n = 0; n < 4; ++n ) + for( SvxBoxItemLine n : o3tl::enumrange<SvxBoxItemLine>() ) if( 0 != ( pLine = static_cast<const SvxBoxItem*>(pItem)->GetLine( n )) ) { if( bFirstLine ) diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index 88ac89a49c3d..0dcd0265c6f2 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -2402,10 +2402,10 @@ void WW8AttributeOutput::TableDefaultBorders( ww8::WW8TableNodeInfoInner::Pointe //Set Default, just taken from the first cell of the first //row - static const sal_uInt16 aBorders[] = + static const SvxBoxItemLine aBorders[] = { - BOX_LINE_TOP, BOX_LINE_LEFT, - BOX_LINE_BOTTOM, BOX_LINE_RIGHT + SvxBoxItemLine::TOP, SvxBoxItemLine::LEFT, + SvxBoxItemLine::BOTTOM, SvxBoxItemLine::RIGHT }; for ( int i = 0; i < 4; ++i ) diff --git a/sw/source/filter/ww8/wrtww8gr.cxx b/sw/source/filter/ww8/wrtww8gr.cxx index 1bb47ec7ccf7..355ef9bda016 100644 --- a/sw/source/filter/ww8/wrtww8gr.cxx +++ b/sw/source/filter/ww8/wrtww8gr.cxx @@ -65,6 +65,7 @@ #include "docsh.hxx" #include <cstdio> +#include <o3tl/enumrange.hxx> #if OSL_DEBUG_LEVEL > 1 #include <stdio.h> @@ -574,16 +575,14 @@ void SwWW8WrGrf::WritePICFHeader(SvStream& rStrm, const sw::Frame &rFly, (pSI->GetWidth() != 0); } - sal_uInt8 aLnArr[4] = { BOX_LINE_TOP, BOX_LINE_LEFT, - BOX_LINE_BOTTOM, BOX_LINE_RIGHT }; - for( sal_uInt8 i = 0; i < 4; ++i ) + for( SvxBoxItemLine i : o3tl::enumrange<SvxBoxItemLine>() ) { - const ::editeng::SvxBorderLine* pLn = pBox->GetLine( aLnArr[ i ] ); + const ::editeng::SvxBorderLine* pLn = pBox->GetLine( i ); WW8_BRC aBrc; if (pLn) { WW8_BRCVer9 aBrc90 = rWrt.TranslateBorderLine( *pLn, - pBox->GetDistance( aLnArr[ i ] ), bShadow ); + pBox->GetDistance( i ), bShadow ); sal_uInt8 ico = msfilter::util::TransColToIco(msfilter::util::BGRToRGB( aBrc90.cv())); aBrc = WW8_BRC(aBrc90.dptLineWidth(), aBrc90.brcType(), ico, @@ -594,15 +593,15 @@ void SwWW8WrGrf::WritePICFHeader(SvStream& rStrm, const sw::Frame &rFly, // border will really be in word and adjust accordingly short nSpacing; short nThick = aBrc.DetermineBorderProperties(&nSpacing); - switch (aLnArr[ i ]) + switch (i) { - case BOX_LINE_TOP: - case BOX_LINE_BOTTOM: + case SvxBoxItemLine::TOP: + case SvxBoxItemLine::BOTTOM: nHeight -= bShadow ? nThick*2 : nThick; nHeight = nHeight - nSpacing; break; - case BOX_LINE_LEFT: - case BOX_LINE_RIGHT: + case SvxBoxItemLine::LEFT: + case SvxBoxItemLine::RIGHT: default: nWidth -= bShadow ? nThick*2 : nThick; nWidth = nWidth - nSpacing; @@ -764,23 +763,21 @@ void SwWW8WrGrf::WritePICBulletFHeader(SvStream& rStrm, const Graphic &rGrf, sal_uInt8* pArr = aArr + 0x2E; //Do borders first - sal_uInt8 aLnArr[4] = { BOX_LINE_TOP, BOX_LINE_LEFT, - BOX_LINE_BOTTOM, BOX_LINE_RIGHT }; - for( sal_uInt8 i = 0; i < 4; ++i ) + for( SvxBoxItemLine i : o3tl::enumrange<SvxBoxItemLine>() ) { WW8_BRC aBrc; short nSpacing; short nThick = aBrc.DetermineBorderProperties(&nSpacing); - switch (aLnArr[ i ]) + switch (i) { - case BOX_LINE_TOP: - case BOX_LINE_BOTTOM: + case SvxBoxItemLine::TOP: + case SvxBoxItemLine::BOTTOM: nHeight -= nThick; nHeight = nHeight - nSpacing; break; - case BOX_LINE_LEFT: - case BOX_LINE_RIGHT: + case SvxBoxItemLine::LEFT: + case SvxBoxItemLine::RIGHT: default: nWidth -= nThick; nWidth = nWidth - nSpacing; diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx index 70283f27364b..efe4b02b7917 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -135,6 +135,7 @@ #include <vcl/outdev.hxx> #include <i18nlangtag/languagetag.hxx> #include <unotools/fltrcfg.hxx> +#include <o3tl/enumrange.hxx> using ::editeng::SvxBorderLine; using namespace ::com::sun::star; @@ -3901,8 +3902,8 @@ void WW8AttributeOutput::FormatLRSpace( const SvxLRSpaceItem& rLR ) const SfxPoolItem* pItem = m_rWW8Export.HasItem( RES_BOX ); if ( pItem ) { - nRDist = static_cast<const SvxBoxItem*>(pItem)->CalcLineSpace( BOX_LINE_LEFT ); - nLDist = static_cast<const SvxBoxItem*>(pItem)->CalcLineSpace( BOX_LINE_RIGHT ); + nRDist = static_cast<const SvxBoxItem*>(pItem)->CalcLineSpace( SvxBoxItemLine::LEFT ); + nLDist = static_cast<const SvxBoxItem*>(pItem)->CalcLineSpace( SvxBoxItemLine::RIGHT ); } else nLDist = nRDist = 0; @@ -4377,9 +4378,9 @@ void WW8Export::Out_SwFmtBox(const SvxBoxItem& rBox, bool bShadow) if ( bOutPageDescs && !bWrtWW8 ) return; // no page ouline in WW6 - static const sal_uInt16 aBorders[] = + static const SvxBoxItemLine aBorders[] = { - BOX_LINE_TOP, BOX_LINE_LEFT, BOX_LINE_BOTTOM, BOX_LINE_RIGHT + SvxBoxItemLine::TOP, SvxBoxItemLine::LEFT, SvxBoxItemLine::BOTTOM, SvxBoxItemLine::RIGHT }; static const sal_uInt16 aPBrc[] = { @@ -4404,7 +4405,7 @@ void WW8Export::Out_SwFmtBox(const SvxBoxItem& rBox, bool bShadow) 38, 39, 40, 41 }; - const sal_uInt16* pBrd = aBorders; + const SvxBoxItemLine* pBrd = aBorders; for( sal_uInt16 i = 0; i < 4; ++i, ++pBrd ) { const SvxBorderLine* pLn = rBox.GetLine( *pBrd ); @@ -4437,18 +4438,13 @@ void WW8Export::Out_SwFmtBox(const SvxBoxItem& rBox, bool bShadow) void WW8Export::Out_SwFmtTableBox( ww::bytes& rO, const SvxBoxItem * pBox ) { // moeglich und vielleicht besser waere 0xffff - static const sal_uInt16 aBorders[] = - { - BOX_LINE_TOP, BOX_LINE_LEFT, BOX_LINE_BOTTOM, BOX_LINE_RIGHT - }; static const SvxBorderLine aBorderLine; - const sal_uInt16* pBrd = aBorders; - for( int i = 0; i < 4; ++i, ++pBrd ) + for( SvxBoxItemLine i : o3tl::enumrange<SvxBoxItemLine>() ) { const SvxBorderLine* pLn; if (pBox != NULL) - pLn = pBox->GetLine( *pBrd ); + pLn = pBox->GetLine( i ); else pLn = & aBorderLine; @@ -4459,9 +4455,9 @@ void WW8Export::Out_SwFmtTableBox( ww::bytes& rO, const SvxBoxItem * pBox ) void WW8Export::Out_CellRangeBorders( const SvxBoxItem * pBox, sal_uInt8 nStart, sal_uInt8 nLimit ) { - static const sal_uInt16 aBorders[] = + static const SvxBoxItemLine aBorders[] = { - BOX_LINE_TOP, BOX_LINE_LEFT, BOX_LINE_BOTTOM, BOX_LINE_RIGHT + SvxBoxItemLine::TOP, SvxBoxItemLine::LEFT, SvxBoxItemLine::BOTTOM, SvxBoxItemLine::RIGHT }; for( int i = 0; i < 4; ++i ) @@ -5512,22 +5508,22 @@ void AttributeOutputBase::FormatCharBorder( const SvxBoxItem& rBox ) if( rBox.GetTop() ) { pBorderLine = rBox.GetTop(); - nDist = rBox.GetDistance( BOX_LINE_TOP ); + nDist = rBox.GetDistance( SvxBoxItemLine::TOP ); } else if( rBox.GetLeft() ) { pBorderLine = rBox.GetLeft(); - nDist = rBox.GetDistance( BOX_LINE_LEFT ); + nDist = rBox.GetDistance( SvxBoxItemLine::LEFT ); } else if( rBox.GetBottom() ) { pBorderLine = rBox.GetBottom(); - nDist = rBox.GetDistance( BOX_LINE_BOTTOM ); + nDist = rBox.GetDistance( SvxBoxItemLine::BOTTOM ); } else if( rBox.GetRight() ) { pBorderLine = rBox.GetRight(); - nDist = rBox.GetDistance( BOX_LINE_RIGHT ); + nDist = rBox.GetDistance( SvxBoxItemLine::RIGHT ); } if( pBorderLine ) diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx index 3bf4b146133e..456ce2535c83 100644 --- a/sw/source/filter/ww8/ww8graf.cxx +++ b/sw/source/filter/ww8/ww8graf.cxx @@ -93,6 +93,7 @@ #include <fmturl.hxx> #include <svx/hlnkitem.hxx> #include <svl/whiter.hxx> +#include <o3tl/enumrange.hxx> using ::editeng::SvxBorderLine; using namespace ::com::sun::star; @@ -1538,7 +1539,7 @@ sal_Int32 SwWW8ImplReader::MatchSdrBoxIntoFlyBoxItem(const Color& rLineColor, aLine.SetWidth( nLineThick ); // No conversion here, nLineThick is already in twips aLine.SetBorderLineStyle(nIdx); - for(sal_uInt16 nLine = 0; nLine < 4; ++nLine) + for(SvxBoxItemLine nLine : o3tl::enumrange<SvxBoxItemLine>()) { // aLine is cloned by SetLine rBox.SetLine(&aLine, nLine); @@ -1622,35 +1623,35 @@ void SwWW8ImplReader::MatchSdrItemsIntoFlySet( SdrObject* pSdrObj, rInnerDist.Bottom()+=nLineThick; const SvxBorderLine *pLine; - if (0 != (pLine = aBox.GetLine(BOX_LINE_LEFT))) + if (0 != (pLine = aBox.GetLine(SvxBoxItemLine::LEFT))) { rInnerDist.Left() -= (pLine->GetScaledWidth()); } - if (0 != (pLine = aBox.GetLine(BOX_LINE_TOP))) + if (0 != (pLine = aBox.GetLine(SvxBoxItemLine::TOP))) { rInnerDist.Top() -= (pLine->GetScaledWidth()); } - if (0 != (pLine = aBox.GetLine(BOX_LINE_RIGHT))) + if (0 != (pLine = aBox.GetLine(SvxBoxItemLine::RIGHT))) { rInnerDist.Right() -= (pLine->GetScaledWidth()); } - if (0 != (pLine = aBox.GetLine(BOX_LINE_BOTTOM))) + if (0 != (pLine = aBox.GetLine(SvxBoxItemLine::BOTTOM))) { rInnerDist.Bottom() -= (pLine->GetScaledWidth()); } // set distances from box's border to text contained within the box if( 0 < rInnerDist.Left() ) - aBox.SetDistance( (sal_uInt16)rInnerDist.Left(), BOX_LINE_LEFT ); + aBox.SetDistance( (sal_uInt16)rInnerDist.Left(), SvxBoxItemLine::LEFT ); if( 0 < rInnerDist.Top() ) - aBox.SetDistance( (sal_uInt16)rInnerDist.Top(), BOX_LINE_TOP ); + aBox.SetDistance( (sal_uInt16)rInnerDist.Top(), SvxBoxItemLine::TOP ); if( 0 < rInnerDist.Right() ) - aBox.SetDistance( (sal_uInt16)rInnerDist.Right(), BOX_LINE_RIGHT ); + aBox.SetDistance( (sal_uInt16)rInnerDist.Right(), SvxBoxItemLine::RIGHT ); if( 0 < rInnerDist.Bottom() ) - aBox.SetDistance( (sal_uInt16)rInnerDist.Bottom(), BOX_LINE_BOTTOM ); + aBox.SetDistance( (sal_uInt16)rInnerDist.Bottom(), SvxBoxItemLine::BOTTOM ); bool bFixSize = !(WW8ITEMVALUE(rOldSet, SDRATTR_TEXT_AUTOGROWHEIGHT, SdrOnOffItem)); diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx index e91c18987d04..ff1b50702d0f 100644 --- a/sw/source/filter/ww8/ww8par2.cxx +++ b/sw/source/filter/ww8/ww8par2.cxx @@ -2947,18 +2947,18 @@ void WW8TabDesc::SetTabBorders(SwTableBox* pBox, short nWwIdx) { aFmtBox.SetDistance( pActBand->nOverrideValues[nWwIdx][WW8TabBandDesc::wwTOP], - BOX_LINE_TOP); + SvxBoxItemLine::TOP); } else - aFmtBox.SetDistance(pActBand->mnDefaultTop, BOX_LINE_TOP); + aFmtBox.SetDistance(pActBand->mnDefaultTop, SvxBoxItemLine::TOP); if (pActBand->nOverrideSpacing[nWwIdx] & (1 << WW8TabBandDesc::wwBOTTOM)) { aFmtBox.SetDistance( pActBand->nOverrideValues[nWwIdx][WW8TabBandDesc::wwBOTTOM], - BOX_LINE_BOTTOM); + SvxBoxItemLine::BOTTOM); } else - aFmtBox.SetDistance(pActBand->mnDefaultBottom,BOX_LINE_BOTTOM); + aFmtBox.SetDistance(pActBand->mnDefaultBottom,SvxBoxItemLine::BOTTOM); // nGapHalf for WW is a *horizontal* gap between table cell and content. short nLeftDist = @@ -2969,18 +2969,18 @@ void WW8TabDesc::SetTabBorders(SwTableBox* pBox, short nWwIdx) { aFmtBox.SetDistance( pActBand->nOverrideValues[nWwIdx][WW8TabBandDesc::wwLEFT], - BOX_LINE_LEFT); + SvxBoxItemLine::LEFT); } else - aFmtBox.SetDistance(nLeftDist, BOX_LINE_LEFT); + aFmtBox.SetDistance(nLeftDist, SvxBoxItemLine::LEFT); if (pActBand->nOverrideSpacing[nWwIdx] & (1 << WW8TabBandDesc::wwRIGHT)) { aFmtBox.SetDistance( pActBand->nOverrideValues[nWwIdx][WW8TabBandDesc::wwRIGHT], - BOX_LINE_RIGHT); + SvxBoxItemLine::RIGHT); } else - aFmtBox.SetDistance(nRightDist,BOX_LINE_RIGHT); + aFmtBox.SetDistance(nRightDist,SvxBoxItemLine::RIGHT); pBox->GetFrmFmt()->SetFmtAttr(aFmtBox); } @@ -3144,7 +3144,7 @@ void WW8TabDesc::AdjustNewBand() // we have to mimick this in the filter by picking the larger of the // sides and using that one on one side of the line (right) SvxBoxItem aCurrentBox(sw::util::ItemGet<SvxBoxItem>(*(pBox->GetFrmFmt()), RES_BOX)); - const ::editeng::SvxBorderLine *pLeftLine = aCurrentBox.GetLine(BOX_LINE_LEFT); + const ::editeng::SvxBorderLine *pLeftLine = aCurrentBox.GetLine(SvxBoxItemLine::LEFT); int nCurrentRightLineWidth = 0; if(pLeftLine) nCurrentRightLineWidth = pLeftLine->GetScaledWidth(); @@ -3153,15 +3153,15 @@ void WW8TabDesc::AdjustNewBand() { SwTableBox* pBox2 = (*pTabBoxes)[i-1]; SvxBoxItem aOldBox(sw::util::ItemGet<SvxBoxItem>(*(pBox2->GetFrmFmt()), RES_BOX)); - const ::editeng::SvxBorderLine *pRightLine = aOldBox.GetLine(BOX_LINE_RIGHT); + const ::editeng::SvxBorderLine *pRightLine = aOldBox.GetLine(SvxBoxItemLine::RIGHT); int nOldBoxRightLineWidth = 0; if(pRightLine) nOldBoxRightLineWidth = pRightLine->GetScaledWidth(); if(nOldBoxRightLineWidth>nCurrentRightLineWidth) - aCurrentBox.SetLine(aOldBox.GetLine(BOX_LINE_RIGHT), BOX_LINE_LEFT); + aCurrentBox.SetLine(aOldBox.GetLine(SvxBoxItemLine::RIGHT), SvxBoxItemLine::LEFT); - aOldBox.SetLine(0, BOX_LINE_RIGHT); + aOldBox.SetLine(0, SvxBoxItemLine::RIGHT); pBox2->GetFrmFmt()->SetFmtAttr(aOldBox); } diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx index 5081e7abe48d..418e130b6c65 100644 --- a/sw/source/filter/ww8/ww8par6.cxx +++ b/sw/source/filter/ww8/ww8par6.cxx @@ -449,41 +449,41 @@ void SwWW8ImplReader::SetPageBorder(SwFrmFmt &rFmt, const wwSection &rSection) c SvxULSpaceItem aUL(ItemGet<SvxULSpaceItem>(aSet, RES_UL_SPACE)); SvxBoxItem aBox(ItemGet<SvxBoxItem>(aSet, RES_BOX)); - short aOriginalBottomMargin = aBox.GetDistance(BOX_LINE_BOTTOM); + short aOriginalBottomMargin = aBox.GetDistance(SvxBoxItemLine::BOTTOM); if (rSection.maSep.pgbOffsetFrom == 1) { sal_uInt16 nDist; if (aBox.GetLeft()) { - nDist = aBox.GetDistance(BOX_LINE_LEFT); - aBox.SetDistance(lcl_MakeSafeNegativeSpacing(static_cast<sal_uInt16>(aLR.GetLeft() - nDist)), BOX_LINE_LEFT); + nDist = aBox.GetDistance(SvxBoxItemLine::LEFT); + aBox.SetDistance(lcl_MakeSafeNegativeSpacing(static_cast<sal_uInt16>(aLR.GetLeft() - nDist)), SvxBoxItemLine::LEFT); aSizeArray[WW8_LEFT] = - aSizeArray[WW8_LEFT] - nDist + aBox.GetDistance(BOX_LINE_LEFT); + aSizeArray[WW8_LEFT] - nDist + aBox.GetDistance(SvxBoxItemLine::LEFT); } if (aBox.GetRight()) { - nDist = aBox.GetDistance(BOX_LINE_RIGHT); - aBox.SetDistance(lcl_MakeSafeNegativeSpacing(static_cast<sal_uInt16>(aLR.GetRight() - nDist)), BOX_LINE_RIGHT); + nDist = aBox.GetDistance(SvxBoxItemLine::RIGHT); + aBox.SetDistance(lcl_MakeSafeNegativeSpacing(static_cast<sal_uInt16>(aLR.GetRight() - nDist)), SvxBoxItemLine::RIGHT); aSizeArray[WW8_RIGHT] = - aSizeArray[WW8_RIGHT] - nDist + aBox.GetDistance(BOX_LINE_RIGHT); + aSizeArray[WW8_RIGHT] - nDist + aBox.GetDistance(SvxBoxItemLine::RIGHT); } if (aBox.GetTop()) { - nDist = aBox.GetDistance(BOX_LINE_TOP); - aBox.SetDistance(lcl_MakeSafeNegativeSpacing(static_cast<sal_uInt16>(aUL.GetUpper() - nDist)), BOX_LINE_TOP); + nDist = aBox.GetDistance(SvxBoxItemLine::TOP); + aBox.SetDistance(lcl_MakeSafeNegativeSpacing(static_cast<sal_uInt16>(aUL.GetUpper() - nDist)), SvxBoxItemLine::TOP); aSizeArray[WW8_TOP] = - aSizeArray[WW8_TOP] - nDist + aBox.GetDistance(BOX_LINE_TOP); + aSizeArray[WW8_TOP] - nDist + aBox.GetDistance(SvxBoxItemLine::TOP); } if (aBox.GetBottom()) { - nDist = aBox.GetDistance(BOX_LINE_BOTTOM); - aBox.SetDistance(lcl_MakeSafeNegativeSpacing(static_cast<sal_uInt16>(aUL.GetLower() - nDist)), BOX_LINE_BOTTOM); + nDist = aBox.GetDistance(SvxBoxItemLine::BOTTOM); + aBox.SetDistance(lcl_MakeSafeNegativeSpacing(static_cast<sal_uInt16>(aUL.GetLower() - nDist)), SvxBoxItemLine::BOTTOM); aSizeArray[WW8_BOT] = - aSizeArray[WW8_BOT] - nDist + aBox.GetDistance(BOX_LINE_BOTTOM); + aSizeArray[WW8_BOT] - nDist + aBox.GetDistance(SvxBoxItemLine::BOTTOM); } aSet.Put(aBox); @@ -1320,7 +1320,7 @@ static sal_uInt8 lcl_ReadBorders(bool bVer67, WW8_BRCVer9* brc, WW8PLCFx_Cp_FKP* } void GetLineIndex(SvxBoxItem &rBox, short nLineThickness, short nSpace, - sal_uInt32 cv, short nIdx, sal_uInt16 nOOIndex, sal_uInt16 nWWIndex, + sal_uInt32 cv, short nIdx, SvxBoxItemLine nOOIndex, sal_uInt16 nWWIndex, short *pSize=0) { // LO cannot handle outset/inset (new in WW9 BRC) so fall back same as WW8 @@ -1352,7 +1352,7 @@ void GetLineIndex(SvxBoxItem &rBox, short nLineThickness, short nSpace, } -void Set1Border(SvxBoxItem &rBox, const WW8_BRCVer9& rBor, sal_uInt16 nOOIndex, +void Set1Border(SvxBoxItem &rBox, const WW8_BRCVer9& rBor, SvxBoxItemLine nOOIndex, sal_uInt16 nWWIndex, short *pSize, const bool bIgnoreSpace) { short nSpace; @@ -1381,25 +1381,25 @@ bool SwWW8ImplReader::SetBorder(SvxBoxItem& rBox, const WW8_BRCVer9* pbrc, short *pSizeArray, sal_uInt8 nSetBorders) const { bool bChange = false; - static const sal_uInt16 aIdArr[ 10 ] = + static const std::pair<sal_uInt16, SvxBoxItemLine> aIdArr[] = { - WW8_TOP, BOX_LINE_TOP, - WW8_LEFT, BOX_LINE_LEFT, - WW8_RIGHT, BOX_LINE_RIGHT, - WW8_BOT, BOX_LINE_BOTTOM, - WW8_BETW, BOX_LINE_BOTTOM + { WW8_TOP, SvxBoxItemLine::TOP }, + { WW8_LEFT, SvxBoxItemLine::LEFT }, + { WW8_RIGHT, SvxBoxItemLine::RIGHT }, + { WW8_BOT, SvxBoxItemLine::BOTTOM }, + { WW8_BETW, SvxBoxItemLine::BOTTOM } }; - for( int i = 0, nEnd = 8; i < nEnd; i += 2 ) + for( int i = 0, nEnd = 4; i < nEnd; ++i ) { // ungueltige Borders ausfiltern - const WW8_BRCVer9& rB = pbrc[ aIdArr[ i ] ]; + const WW8_BRCVer9& rB = pbrc[ aIdArr[ i ].first ]; if( !rB.isNil() && rB.brcType() ) { - Set1Border(rBox, rB, aIdArr[i+1], aIdArr[i], pSizeArray, false); + Set1Border(rBox, rB, aIdArr[i].second, aIdArr[i].first, pSizeArray, false); bChange = true; } - else if ( nSetBorders & (1 << aIdArr[i]) ) + else if ( nSetBorders & (1 << aIdArr[i].first) ) { /* ##826##, ##653## @@ -1412,7 +1412,7 @@ bool SwWW8ImplReader::SetBorder(SvxBoxItem& rBox, const WW8_BRCVer9* pbrc, border, so with a sprm set, but no border, then disable the appropriate border */ - rBox.SetLine( 0, aIdArr[ i+1 ] ); + rBox.SetLine( 0, aIdArr[ i ].second ); } } return bChange; @@ -4721,16 +4721,16 @@ void SwWW8ImplReader::Read_Border(sal_uInt16 , const sal_uInt8*, short nLen) GetBorderDistance( aBrcs, aInnerDist ); if (nBorder & (1 << WW8_LEFT)) - aBox.SetDistance( (sal_uInt16)aInnerDist.Left(), BOX_LINE_LEFT ); + aBox.SetDistance( (sal_uInt16)aInnerDist.Left(), SvxBoxItemLine::LEFT ); if (nBorder & (1 << WW8_TOP)) - aBox.SetDistance( (sal_uInt16)aInnerDist.Top(), BOX_LINE_TOP ); + aBox.SetDistance( (sal_uInt16)aInnerDist.Top(), SvxBoxItemLine::TOP ); if (nBorder & (1 << WW8_RIGHT)) - aBox.SetDistance( (sal_uInt16)aInnerDist.Right(), BOX_LINE_RIGHT ); + aBox.SetDistance( (sal_uInt16)aInnerDist.Right(), SvxBoxItemLine::RIGHT ); if (nBorder & (1 << WW8_BOT)) - aBox.SetDistance( (sal_uInt16)aInnerDist.Bottom(), BOX_LINE_BOTTOM ); + aBox.SetDistance( (sal_uInt16)aInnerDist.Bottom(), SvxBoxItemLine::BOTTOM ); NewAttr( aBox ); @@ -4769,10 +4769,10 @@ void SwWW8ImplReader::Read_CharBorder(sal_uInt16 nId, const sal_uInt8* pData, sh // Border style is none -> no border, no shadow if( editeng::ConvertBorderStyleFromWord(aBrc.brcType()) != table::BorderLineStyle::NONE ) { - Set1Border(aBoxItem, aBrc, BOX_LINE_TOP, 0, 0, true); - Set1Border(aBoxItem, aBrc, BOX_LINE_BOTTOM, 0, 0, true); - Set1Border(aBoxItem, aBrc, BOX_LINE_LEFT, 0, 0, true); - Set1Border(aBoxItem, aBrc, BOX_LINE_RIGHT, 0, 0, true); + Set1Border(aBoxItem, aBrc, SvxBoxItemLine::TOP, 0, 0, true); + Set1Border(aBoxItem, aBrc, SvxBoxItemLine::BOTTOM, 0, 0, true); + Set1Border(aBoxItem, aBrc, SvxBoxItemLine::LEFT, 0, 0, true); + Set1Border(aBoxItem, aBrc, SvxBoxItemLine::RIGHT, 0, 0, true); NewAttr( aBoxItem ); short aSizeArray[WW8_RIGHT+1]={0}; aSizeArray[WW8_RIGHT] = 1; diff --git a/sw/source/filter/xml/xmlexpit.cxx b/sw/source/filter/xml/xmlexpit.cxx index ba5aeef44a21..2e58b38ebb98 100644 --- a/sw/source/filter/xml/xmlexpit.cxx +++ b/sw/source/filter/xml/xmlexpit.cxx @@ -566,10 +566,10 @@ bool SvXMLExportItemMapper::QueryXMLValue( const SvxBorderLine* pRight = pBox->GetRight(); const SvxBorderLine* pTop = pBox->GetTop(); const SvxBorderLine* pBottom = pBox->GetBottom(); - const sal_uInt16 nTopDist = pBox->GetDistance( BOX_LINE_TOP ); - const sal_uInt16 nBottomDist = pBox->GetDistance( BOX_LINE_BOTTOM ); - const sal_uInt16 nLeftDist = pBox->GetDistance( BOX_LINE_LEFT ); - const sal_uInt16 nRightDist = pBox->GetDistance( BOX_LINE_RIGHT ); + const sal_uInt16 nTopDist = pBox->GetDistance( SvxBoxItemLine::TOP ); + const sal_uInt16 nBottomDist = pBox->GetDistance( SvxBoxItemLine::BOTTOM ); + const sal_uInt16 nLeftDist = pBox->GetDistance( SvxBoxItemLine::LEFT ); + const sal_uInt16 nRightDist = pBox->GetDistance( SvxBoxItemLine::RIGHT ); // check if we need to export it switch( nMemberId ) diff --git a/sw/source/filter/xml/xmlimpit.cxx b/sw/source/filter/xml/xmlimpit.cxx index 5dde34b5e661..7bd9541f659a 100644 --- a/sw/source/filter/xml/xmlimpit.cxx +++ b/sw/source/filter/xml/xmlimpit.cxx @@ -456,16 +456,16 @@ bool SvXMLImportItemMapper::PutXMLValue( if( nMemberId == LEFT_BORDER_PADDING || nMemberId == ALL_BORDER_PADDING ) - pBox->SetDistance( (sal_uInt16)nTemp, BOX_LINE_LEFT ); + pBox->SetDistance( (sal_uInt16)nTemp, SvxBoxItemLine::LEFT ); if( nMemberId == RIGHT_BORDER_PADDING || nMemberId == ALL_BORDER_PADDING ) - pBox->SetDistance( (sal_uInt16)nTemp, BOX_LINE_RIGHT ); + pBox->SetDistance( (sal_uInt16)nTemp, SvxBoxItemLine::RIGHT ); if( nMemberId == TOP_BORDER_PADDING || nMemberId == ALL_BORDER_PADDING ) - pBox->SetDistance( (sal_uInt16)nTemp, BOX_LINE_TOP ); + pBox->SetDistance( (sal_uInt16)nTemp, SvxBoxItemLine::TOP ); if( nMemberId == BOTTOM_BORDER_PADDING || nMemberId == ALL_BORDER_PADDING ) - pBox->SetDistance( (sal_uInt16)nTemp, BOX_LINE_BOTTOM); + pBox->SetDistance( (sal_uInt16)nTemp, SvxBoxItemLine::BOTTOM); break; case ALL_BORDER: @@ -578,10 +578,10 @@ bool SvXMLImportItemMapper::PutXMLValue( break; } - pBox->SetLine( aBoxes.pTop, BOX_LINE_TOP ); - pBox->SetLine( aBoxes.pBottom, BOX_LINE_BOTTOM ); - pBox->SetLine( aBoxes.pLeft, BOX_LINE_LEFT ); - pBox->SetLine( aBoxes.pRight, BOX_LINE_RIGHT ); + pBox->SetLine( aBoxes.pTop, SvxBoxItemLine::TOP ); + pBox->SetLine( aBoxes.pBottom, SvxBoxItemLine::BOTTOM ); + pBox->SetLine( aBoxes.pLeft, SvxBoxItemLine::LEFT ); + pBox->SetLine( aBoxes.pRight, SvxBoxItemLine::RIGHT ); bOk = true; } diff --git a/sw/source/ui/misc/pggrid.cxx b/sw/source/ui/misc/pggrid.cxx index 0042d67328be..76ab9a1c80a9 100644 --- a/sw/source/ui/misc/pggrid.cxx +++ b/sw/source/ui/misc/pggrid.cxx @@ -299,11 +299,11 @@ void SwTextGridPage::UpdatePageSize(const SfxItemSet& rSet) sal_Int32 nDistanceUL = rULSpace.GetUpper() + rULSpace.GetLower(); sal_Int32 nValue1 = rSize.GetSize().Height() - nDistanceUL - - rBox.GetDistance(BOX_LINE_TOP) - - rBox.GetDistance(BOX_LINE_BOTTOM); + rBox.GetDistance(SvxBoxItemLine::TOP) - + rBox.GetDistance(SvxBoxItemLine::BOTTOM); sal_Int32 nValue2 = rSize.GetSize().Width() - nDistanceLR - - rBox.GetDistance(BOX_LINE_LEFT) - - rBox.GetDistance(BOX_LINE_RIGHT); + rBox.GetDistance(SvxBoxItemLine::LEFT) - + rBox.GetDistance(SvxBoxItemLine::RIGHT); if(m_bVertical) { m_aPageSize.Width() = nValue1; diff --git a/sw/source/uibase/frmdlg/frmmgr.cxx b/sw/source/uibase/frmdlg/frmmgr.cxx index c455b0d48d7d..df0dbf6547b6 100644 --- a/sw/source/uibase/frmdlg/frmmgr.cxx +++ b/sw/source/uibase/frmdlg/frmmgr.cxx @@ -483,28 +483,28 @@ SwTwips SwFlyFrmAttrMgr::CalcTopSpace() { const SvxShadowItem& rShadow = GetShadow(); const SvxBoxItem& rBox = GetBox(); - return rShadow.CalcShadowSpace(SHADOW_TOP ) + rBox.CalcLineSpace(BOX_LINE_TOP); + return rShadow.CalcShadowSpace(SHADOW_TOP ) + rBox.CalcLineSpace(SvxBoxItemLine::TOP); } SwTwips SwFlyFrmAttrMgr::CalcBottomSpace() { const SvxShadowItem& rShadow = GetShadow(); const SvxBoxItem& rBox = GetBox(); - return rShadow.CalcShadowSpace(SHADOW_BOTTOM) + rBox.CalcLineSpace(BOX_LINE_BOTTOM); + return rShadow.CalcShadowSpace(SHADOW_BOTTOM) + rBox.CalcLineSpace(SvxBoxItemLine::BOTTOM); } SwTwips SwFlyFrmAttrMgr::CalcLeftSpace() { const SvxShadowItem& rShadow = GetShadow(); const SvxBoxItem& rBox = GetBox(); - return rShadow.CalcShadowSpace(SHADOW_LEFT) + rBox.CalcLineSpace(BOX_LINE_LEFT); + return rShadow.CalcShadowSpace(SHADOW_LEFT) + rBox.CalcLineSpace(SvxBoxItemLine::LEFT); } SwTwips SwFlyFrmAttrMgr::CalcRightSpace() { const SvxShadowItem& rShadow = GetShadow(); const SvxBoxItem& rBox = GetBox(); - return rShadow.CalcShadowSpace(SHADOW_RIGHT) + rBox.CalcLineSpace(BOX_LINE_RIGHT); + return rShadow.CalcShadowSpace(SHADOW_RIGHT) + rBox.CalcLineSpace(SvxBoxItemLine::RIGHT); } // erase attribute from the set diff --git a/sw/source/uibase/shells/frmsh.cxx b/sw/source/uibase/shells/frmsh.cxx index 56d04be6176c..a486f9dfbf4d 100644 --- a/sw/source/uibase/shells/frmsh.cxx +++ b/sw/source/uibase/shells/frmsh.cxx @@ -1012,13 +1012,13 @@ void SwFrameShell::ExecFrameStyle(SfxRequest& rReq) SvxBorderLine aDestBorderLine; if( aBoxItem.GetTop() != NULL ) - aBoxItem.SetLine(&aBorderLine, BOX_LINE_TOP); + aBoxItem.SetLine(&aBorderLine, SvxBoxItemLine::TOP); if( aBoxItem.GetBottom() != NULL ) - aBoxItem.SetLine(&aBorderLine, BOX_LINE_BOTTOM); + aBoxItem.SetLine(&aBorderLine, SvxBoxItemLine::BOTTOM); if( aBoxItem.GetLeft() != NULL ) - aBoxItem.SetLine(&aBorderLine, BOX_LINE_LEFT); + aBoxItem.SetLine(&aBorderLine, SvxBoxItemLine::LEFT); if( aBoxItem.GetRight() != NULL ) - aBoxItem.SetLine(&aBorderLine, BOX_LINE_RIGHT); + aBoxItem.SetLine(&aBorderLine, SvxBoxItemLine::RIGHT); } } break; @@ -1037,41 +1037,41 @@ void SwFrameShell::ExecFrameStyle(SfxRequest& rReq) if (!aBoxItem.GetTop() && !aBoxItem.GetBottom() && !aBoxItem.GetLeft() && !aBoxItem.GetRight()) { - 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); } else { if( aBoxItem.GetTop() ) { aBorderLine.SetColor( aBoxItem.GetTop()->GetColor() ); - aBoxItem.SetLine(&aBorderLine, BOX_LINE_TOP); + aBoxItem.SetLine(&aBorderLine, SvxBoxItemLine::TOP); } if( aBoxItem.GetBottom() ) { aBorderLine.SetColor( aBoxItem.GetBottom()->GetColor()); - aBoxItem.SetLine(&aBorderLine, BOX_LINE_BOTTOM); + aBoxItem.SetLine(&aBorderLine, SvxBoxItemLine::BOTTOM); } if( aBoxItem.GetLeft() ) { aBorderLine.SetColor( aBoxItem.GetLeft()->GetColor()); - aBoxItem.SetLine(&aBorderLine, BOX_LINE_LEFT); + aBoxItem.SetLine(&aBorderLine, SvxBoxItemLine::LEFT); } if( aBoxItem.GetRight() ) { aBorderLine.SetColor(aBoxItem.GetRight()->GetColor()); - aBoxItem.SetLine(&aBorderLine, BOX_LINE_RIGHT); + aBoxItem.SetLine(&aBorderLine, SvxBoxItemLine::RIGHT); } } } else { - aBoxItem.SetLine(0, BOX_LINE_TOP); - aBoxItem.SetLine(0, BOX_LINE_BOTTOM); - aBoxItem.SetLine(0, BOX_LINE_LEFT); - aBoxItem.SetLine(0, BOX_LINE_RIGHT); + aBoxItem.SetLine(0, SvxBoxItemLine::TOP); + aBoxItem.SetLine(0, SvxBoxItemLine::BOTTOM); + aBoxItem.SetLine(0, SvxBoxItemLine::LEFT); + aBoxItem.SetLine(0, SvxBoxItemLine::RIGHT); } } } @@ -1087,10 +1087,10 @@ void SwFrameShell::ExecFrameStyle(SfxRequest& rReq) !aBoxItem.GetLeft() && !aBoxItem.GetRight()) { aBorderLine.SetColor( rNewColor ); - 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); } else { diff --git a/sw/source/uibase/shells/tabsh.cxx b/sw/source/uibase/shells/tabsh.cxx index 4ab605313a44..888bf213cbfa 100644 --- a/sw/source/uibase/shells/tabsh.cxx +++ b/sw/source/uibase/shells/tabsh.cxx @@ -525,17 +525,17 @@ void SwTableShell::Execute(SfxRequest &rReq) bool bLine = false; if( aBox.GetTop() != NULL ) - aBox.SetLine(&aBorderLine, BOX_LINE_TOP), bLine |= true; + aBox.SetLine(&aBorderLine, SvxBoxItemLine::TOP), bLine |= true; if( aBox.GetBottom() != NULL ) - aBox.SetLine(&aBorderLine, BOX_LINE_BOTTOM), bLine |= true; + aBox.SetLine(&aBorderLine, SvxBoxItemLine::BOTTOM), bLine |= true; if( aBox.GetLeft() != NULL ) - aBox.SetLine(&aBorderLine, BOX_LINE_LEFT), bLine |= true; + aBox.SetLine(&aBorderLine, SvxBoxItemLine::LEFT), bLine |= true; if( aBox.GetRight() != NULL ) - aBox.SetLine(&aBorderLine, BOX_LINE_RIGHT), bLine |= true; + aBox.SetLine(&aBorderLine, SvxBoxItemLine::RIGHT), bLine |= true; if( aInfo.GetHori() != NULL ) - aInfo.SetLine(&aBorderLine, BOXINFO_LINE_HORI), bLine |= true; + aInfo.SetLine(&aBorderLine, SvxBoxInfoItemLine::HORI), bLine |= true; if( aInfo.GetVert() != NULL ) - aInfo.SetLine(&aBorderLine, BOXINFO_LINE_VERT), bLine |= true; + aInfo.SetLine(&aBorderLine, SvxBoxInfoItemLine::VERT), bLine |= true; aCoreSet.Put( aBox ); aCoreSet.Put( aInfo ); diff --git a/sw/source/uibase/shells/textsh.cxx b/sw/source/uibase/shells/textsh.cxx index cfffbd48123b..2ef122b9e8f9 100644 --- a/sw/source/uibase/shells/textsh.cxx +++ b/sw/source/uibase/shells/textsh.cxx @@ -601,7 +601,7 @@ void SwTextShell::ExecInsert(SfxRequest &rReq) SvxBoxInfoItem aBoxInfo(static_cast<const SvxBoxInfoItem &>(aSet.Get(SID_ATTR_BORDER_INNER))); const SvxBoxItem& rBox = static_cast<const SvxBoxItem&>(aSet.Get(RES_BOX)); aBoxInfo.SetMinDist(false); - aBoxInfo.SetDefDist(rBox.GetDistance(BOX_LINE_LEFT)); + aBoxInfo.SetDefDist(rBox.GetDistance(SvxBoxItemLine::LEFT)); aSet.Put(aBoxInfo); FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebDocShell, GetView().GetDocShell())); diff --git a/sw/source/uibase/uiview/viewtab.cxx b/sw/source/uibase/uiview/viewtab.cxx index 1a5c2d0a80b2..4ba0ed93be95 100644 --- a/sw/source/uibase/uiview/viewtab.cxx +++ b/sw/source/uibase/uiview/viewtab.cxx @@ -1341,8 +1341,8 @@ void SwView::StateTabWin(SfxItemSet& rSet) aCoreSet.Put( aBoxInfo ); rSh.GetFlyFrmAttr( aCoreSet ); const SvxBoxItem& rBox = static_cast<const SvxBoxItem&>(aCoreSet.Get(RES_BOX)); - aDistLR.SetLeft(rBox.GetDistance(BOX_LINE_LEFT)); - aDistLR.SetRight(rBox.GetDistance(BOX_LINE_RIGHT)); + aDistLR.SetLeft(rBox.GetDistance(SvxBoxItemLine::LEFT)); + aDistLR.SetRight(rBox.GetDistance(SvxBoxItemLine::RIGHT)); //add the paragraph border distance SfxItemSet aCoreSet1( GetPool(), @@ -1350,8 +1350,8 @@ void SwView::StateTabWin(SfxItemSet& rSet) 0 ); rSh.GetCurAttr( aCoreSet1 ); const SvxBoxItem& rParaBox = static_cast<const SvxBoxItem&>(aCoreSet1.Get(RES_BOX)); - aDistLR.SetLeft(aDistLR.GetLeft() + rParaBox.GetDistance(BOX_LINE_LEFT)); - aDistLR.SetRight(aDistLR.GetRight() + rParaBox.GetDistance(BOX_LINE_RIGHT)); + aDistLR.SetLeft(aDistLR.GetLeft() + rParaBox.GetDistance(SvxBoxItemLine::LEFT)); + aDistLR.SetRight(aDistLR.GetRight() + rParaBox.GetDistance(SvxBoxItemLine::RIGHT)); } rSet.Put(aDistLR); m_nLeftBorderDistance = static_cast< sal_uInt16 >(aDistLR.GetLeft()); @@ -1370,15 +1370,15 @@ void SwView::StateTabWin(SfxItemSet& rSet) aCoreSet2.Put(aBoxInfo); rSh.GetTabBorders( aCoreSet2 ); const SvxBoxItem& rBox = static_cast<const SvxBoxItem&>(aCoreSet2.Get(RES_BOX)); - aDistLR.SetLeft(rBox.GetDistance(BOX_LINE_LEFT)); - aDistLR.SetRight(rBox.GetDistance(BOX_LINE_RIGHT)); + aDistLR.SetLeft(rBox.GetDistance(SvxBoxItemLine::LEFT)); + aDistLR.SetRight(rBox.GetDistance(SvxBoxItemLine::RIGHT)); //add the border distance of the paragraph SfxItemSet aCoreSet1( GetPool(), RES_BOX, RES_BOX ); rSh.GetCurAttr( aCoreSet1 ); const SvxBoxItem& rParaBox = static_cast<const SvxBoxItem&>(aCoreSet1.Get(RES_BOX)); - aDistLR.SetLeft(aDistLR.GetLeft() + rParaBox.GetDistance(BOX_LINE_LEFT)); - aDistLR.SetRight(aDistLR.GetRight() + rParaBox.GetDistance(BOX_LINE_RIGHT)); + aDistLR.SetLeft(aDistLR.GetLeft() + rParaBox.GetDistance(SvxBoxItemLine::LEFT)); + aDistLR.SetRight(aDistLR.GetRight() + rParaBox.GetDistance(SvxBoxItemLine::RIGHT)); rSet.Put(aDistLR); m_nLeftBorderDistance = static_cast< sal_uInt16 >(aDistLR.GetLeft()); m_nRightBorderDistance = static_cast< sal_uInt16 >(aDistLR.GetRight()); @@ -1388,8 +1388,8 @@ void SwView::StateTabWin(SfxItemSet& rSet) //get the page/header/footer border distance const SwFrmFmt& rMaster = rDesc.GetMaster(); const SvxBoxItem& rBox = static_cast<const SvxBoxItem&>(rMaster.GetAttrSet().Get(RES_BOX)); - aDistLR.SetLeft(rBox.GetDistance(BOX_LINE_LEFT)); - aDistLR.SetRight(rBox.GetDistance(BOX_LINE_RIGHT)); + aDistLR.SetLeft(rBox.GetDistance(SvxBoxItemLine::LEFT)); + aDistLR.SetRight(rBox.GetDistance(SvxBoxItemLine::RIGHT)); const SvxBoxItem* pBox = 0; if(nFrmType & FrmTypeFlags::HEADER) @@ -1409,8 +1409,8 @@ void SwView::StateTabWin(SfxItemSet& rSet) } if(pBox) { - aDistLR.SetLeft(pBox->GetDistance(BOX_LINE_LEFT)); - aDistLR.SetRight(pBox->GetDistance(BOX_LINE_RIGHT)); + aDistLR.SetLeft(pBox->GetDistance(SvxBoxItemLine::LEFT)); + aDistLR.SetRight(pBox->GetDistance(SvxBoxItemLine::RIGHT)); } //add the border distance of the paragraph @@ -1419,8 +1419,8 @@ void SwView::StateTabWin(SfxItemSet& rSet) SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER, 0 ); rSh.GetCurAttr( aCoreSetTmp ); const SvxBoxItem& rParaBox = static_cast<const SvxBoxItem&>(aCoreSetTmp.Get(RES_BOX)); - aDistLR.SetLeft(aDistLR.GetLeft() + rParaBox.GetDistance(BOX_LINE_LEFT)); - aDistLR.SetRight(aDistLR.GetRight() + rParaBox.GetDistance(BOX_LINE_RIGHT)); + aDistLR.SetLeft(aDistLR.GetLeft() + rParaBox.GetDistance(SvxBoxItemLine::LEFT)); + aDistLR.SetRight(aDistLR.GetRight() + rParaBox.GetDistance(SvxBoxItemLine::RIGHT)); rSet.Put(aDistLR); m_nLeftBorderDistance = static_cast< sal_uInt16 >(aDistLR.GetLeft()); m_nRightBorderDistance = static_cast< sal_uInt16 >(aDistLR.GetRight()); |