editeng/source/items/frmitems.cxx |  333 ++++++++++++++++++--------------------
 include/editeng/boxitem.hxx       |  116 +++++++------
 2 files changed, 231 insertions(+), 218 deletions(-)

New commits:
commit ef106661fcc40cfdd406064cbf73fd62477d0e79
Author:     Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
AuthorDate: Fri May 12 16:05:36 2023 +0900
Commit:     Tomaž Vajngerl <qui...@gmail.com>
CommitDate: Sat May 13 16:12:18 2023 +0200

    prefix members and cleanup SvxBoxItem, SvxBoxInfoItem
    
    Change-Id: I9f3d36257175a5118a2b8ddca981815b24b8d243
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151718
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <qui...@gmail.com>

diff --git a/editeng/source/items/frmitems.cxx 
b/editeng/source/items/frmitems.cxx
index 250b61e33753..ad0977fab753 100644
--- a/editeng/source/items/frmitems.cxx
+++ b/editeng/source/items/frmitems.cxx
@@ -2289,29 +2289,23 @@ void SvxShadowItem::dumpAsXml(xmlTextWriterPtr pWriter) 
const
 
 // class SvxBoxItem ------------------------------------------------------
 
-SvxBoxItem::SvxBoxItem( const SvxBoxItem& rCpy ) :
-
-    SfxPoolItem ( rCpy ),
-    pTop        ( rCpy.pTop     ? new SvxBorderLine( *rCpy.pTop )    : nullptr 
),
-    pBottom     ( rCpy.pBottom  ? new SvxBorderLine( *rCpy.pBottom ) : nullptr 
),
-    pLeft       ( rCpy.pLeft    ? new SvxBorderLine( *rCpy.pLeft )   : nullptr 
),
-    pRight      ( rCpy.pRight   ? new SvxBorderLine( *rCpy.pRight )  : nullptr 
),
-    nTopDist    ( rCpy.nTopDist ),
-    nBottomDist ( rCpy.nBottomDist ),
-    nLeftDist   ( rCpy.nLeftDist ),
-    nRightDist  ( rCpy.nRightDist ),
-    bRemoveAdjCellBorder ( rCpy.bRemoveAdjCellBorder )
+SvxBoxItem::SvxBoxItem(const SvxBoxItem& rCopy)
+    : SfxPoolItem (rCopy)
+    , mpTopBorderLine(rCopy.mpTopBorderLine ? new 
SvxBorderLine(*rCopy.mpTopBorderLine) : nullptr)
+    , mpBottomBorderLine(rCopy.mpBottomBorderLine ? new 
SvxBorderLine(*rCopy.mpBottomBorderLine) : nullptr)
+    , mpLeftBorderLine(rCopy.mpLeftBorderLine ? new 
SvxBorderLine(*rCopy.mpLeftBorderLine) : nullptr)
+    , mpRightBorderLine(rCopy.mpRightBorderLine ? new 
SvxBorderLine(*rCopy.mpRightBorderLine) : nullptr)
+    , mnTopDistance(rCopy.mnTopDistance)
+    , mnBottomDistance(rCopy.mnBottomDistance)
+    , mnLeftDistance(rCopy.mnLeftDistance)
+    , mnRightDistance(rCopy.mnRightDistance)
+    , mbRemoveAdjCellBorder(rCopy.mbRemoveAdjCellBorder)
 {
 }
 
 
-SvxBoxItem::SvxBoxItem( const sal_uInt16 nId ) :
-    SfxPoolItem( nId ),
-    nTopDist    ( 0 ),
-    nBottomDist ( 0 ),
-    nLeftDist   ( 0 ),
-    nRightDist  ( 0 ),
-    bRemoveAdjCellBorder ( false )
+SvxBoxItem::SvxBoxItem(const sal_uInt16 nId)
+    : SfxPoolItem(nId)
 {
 }
 
@@ -2324,13 +2318,13 @@ void SvxBoxItem::dumpAsXml(xmlTextWriterPtr pWriter) 
const
 {
     (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SvxBoxItem"));
     (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("top-dist"),
-                                      
BAD_CAST(OString::number(nTopDist).getStr()));
+                                      
BAD_CAST(OString::number(mnTopDistance).getStr()));
     (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("bottom-dist"),
-                                      
BAD_CAST(OString::number(nBottomDist).getStr()));
+                                      
BAD_CAST(OString::number(mnBottomDistance).getStr()));
     (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("left-dist"),
-                                      
BAD_CAST(OString::number(nLeftDist).getStr()));
+                                      
BAD_CAST(OString::number(mnLeftDistance).getStr()));
     (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("right-dist"),
-                                      
BAD_CAST(OString::number(nRightDist).getStr()));
+                                      
BAD_CAST(OString::number(mnRightDistance).getStr()));
     SfxPoolItem::dumpAsXml(pWriter);
     (void)xmlTextWriterEndElement(pWriter);
 }
@@ -2352,7 +2346,7 @@ boost::property_tree::ptree SvxBoxItem::dumpAsJSON() const
 }
 
 
-static bool CmpBrdLn( const std::unique_ptr<SvxBorderLine> & pBrd1, const 
SvxBorderLine* pBrd2 )
+static bool CompareBorderLine(const std::unique_ptr<SvxBorderLine> & pBrd1, 
const SvxBorderLine* pBrd2)
 {
     if( pBrd1.get() == pBrd2 )
         return true;
@@ -2368,15 +2362,15 @@ bool SvxBoxItem::operator==( const SfxPoolItem& rAttr ) 
const
 
     const SvxBoxItem& rBoxItem = static_cast<const SvxBoxItem&>(rAttr);
     return (
-        ( nTopDist == rBoxItem.nTopDist ) &&
-        ( nBottomDist == rBoxItem.nBottomDist )   &&
-        ( nLeftDist == rBoxItem.nLeftDist )   &&
-        ( nRightDist == rBoxItem.nRightDist ) &&
-        ( bRemoveAdjCellBorder == rBoxItem.bRemoveAdjCellBorder ) &&
-        CmpBrdLn( pTop, rBoxItem.GetTop() )           &&
-        CmpBrdLn( pBottom, rBoxItem.GetBottom() )     &&
-        CmpBrdLn( pLeft, rBoxItem.GetLeft() )         &&
-        CmpBrdLn( pRight, rBoxItem.GetRight() ) );
+        (mnTopDistance == rBoxItem.mnTopDistance) &&
+        (mnBottomDistance == rBoxItem.mnBottomDistance) &&
+        (mnLeftDistance == rBoxItem.mnLeftDistance) &&
+        (mnRightDistance == rBoxItem.mnRightDistance) &&
+        (mbRemoveAdjCellBorder == rBoxItem.mbRemoveAdjCellBorder ) &&
+        CompareBorderLine(mpTopBorderLine, rBoxItem.GetTop()) &&
+        CompareBorderLine(mpBottomBorderLine, rBoxItem.GetBottom()) &&
+        CompareBorderLine(mpLeftBorderLine, rBoxItem.GetLeft()) &&
+        CompareBorderLine(mpRightBorderLine, rBoxItem.GetRight()));
 }
 
 
@@ -2417,11 +2411,11 @@ bool SvxBoxItem::QueryValue( uno::Any& rVal, sal_uInt8 
nMemberId ) const
                 uno::Any(SvxBoxItem::SvxLineToLine(GetRight(), bConvert)),
                 uno::Any(SvxBoxItem::SvxLineToLine(GetBottom(), bConvert)),
                 uno::Any(SvxBoxItem::SvxLineToLine(GetTop(), bConvert)),
-                uno::Any(static_cast<sal_Int32>(bConvert ? convertTwipToMm100( 
GetSmallestDistance()) : GetSmallestDistance())),
-                uno::Any(static_cast<sal_Int32>(bConvert ? convertTwipToMm100( 
nTopDist ) : nTopDist )),
-                uno::Any(static_cast<sal_Int32>(bConvert ? convertTwipToMm100( 
nBottomDist ) : nBottomDist )),
-                uno::Any(static_cast<sal_Int32>(bConvert ? convertTwipToMm100( 
nLeftDist ) : nLeftDist )),
-                uno::Any(static_cast<sal_Int32>(bConvert ? convertTwipToMm100( 
nRightDist ) : nRightDist ))
+                uno::Any(static_cast<sal_Int32>(bConvert ? 
convertTwipToMm100(GetSmallestDistance()) : GetSmallestDistance())),
+                uno::Any(static_cast<sal_Int32>(bConvert ? 
convertTwipToMm100(mnTopDistance) : mnTopDistance)),
+                uno::Any(static_cast<sal_Int32>(bConvert ? 
convertTwipToMm100(mnBottomDistance) : mnBottomDistance)),
+                uno::Any(static_cast<sal_Int32>(bConvert ? 
convertTwipToMm100(mnLeftDistance) : mnLeftDistance)),
+                uno::Any(static_cast<sal_Int32>(bConvert ? 
convertTwipToMm100(mnRightDistance) : mnRightDistance))
             };
             rVal <<= aSeq;
             return true;
@@ -2447,19 +2441,19 @@ bool SvxBoxItem::QueryValue( uno::Any& rVal, sal_uInt8 
nMemberId ) const
             bDistMember = true;
             break;
         case TOP_BORDER_DISTANCE:
-            nDist = nTopDist;
+            nDist = mnTopDistance;
             bDistMember = true;
             break;
         case BOTTOM_BORDER_DISTANCE:
-            nDist = nBottomDist;
+            nDist = mnBottomDistance;
             bDistMember = true;
             break;
         case LEFT_BORDER_DISTANCE:
-            nDist = nLeftDist;
+            nDist = mnLeftDistance;
             bDistMember = true;
             break;
         case RIGHT_BORDER_DISTANCE:
-            nDist = nRightDist;
+            nDist = mnRightDistance;
             bDistMember = true;
             break;
         case LINE_STYLE:
@@ -2784,112 +2778,111 @@ bool SvxBoxItem::GetPresentation
         {
             rText.clear();
 
-            if ( pTop )
+            if (mpTopBorderLine)
             {
-                rText = pTop->GetValueString( eCoreUnit, ePresUnit, &rIntl ) + 
cpDelimTmp;
+                rText = mpTopBorderLine->GetValueString( eCoreUnit, ePresUnit, 
&rIntl ) + cpDelimTmp;
             }
-            if( !(pTop && pBottom && pLeft && pRight &&
-                  *pTop == *pBottom && *pTop == *pLeft && *pTop == *pRight) )
+            if ( !(mpTopBorderLine && mpBottomBorderLine && mpLeftBorderLine 
&& mpRightBorderLine &&
+                  *mpTopBorderLine == *mpBottomBorderLine &&
+                  *mpTopBorderLine == *mpLeftBorderLine &&
+                  *mpTopBorderLine == *mpRightBorderLine))
             {
-                if ( pBottom )
+                if (mpBottomBorderLine)
                 {
-                    rText += pBottom->GetValueString( eCoreUnit, ePresUnit, 
&rIntl ) + cpDelimTmp;
+                    rText += mpBottomBorderLine->GetValueString( eCoreUnit, 
ePresUnit, &rIntl ) + cpDelimTmp;
                 }
-                if ( pLeft )
+                if (mpLeftBorderLine)
                 {
-                    rText += pLeft->GetValueString( eCoreUnit, ePresUnit, 
&rIntl ) + cpDelimTmp;
+                    rText += mpLeftBorderLine->GetValueString( eCoreUnit, 
ePresUnit, &rIntl ) + cpDelimTmp;
                 }
-                if ( pRight )
+                if (mpRightBorderLine)
                 {
-                    rText += pRight->GetValueString( eCoreUnit, ePresUnit, 
&rIntl ) + cpDelimTmp;
+                    rText += mpRightBorderLine->GetValueString( eCoreUnit, 
ePresUnit, &rIntl ) + cpDelimTmp;
                 }
             }
-            rText += GetMetricText( static_cast<tools::Long>(nTopDist), 
eCoreUnit, ePresUnit, &rIntl );
-            if( nTopDist != nBottomDist || nTopDist != nLeftDist ||
-                nTopDist != nRightDist )
+            rText += GetMetricText( static_cast<tools::Long>(mnTopDistance), 
eCoreUnit, ePresUnit, &rIntl );
+            if (mnTopDistance != mnBottomDistance ||
+                mnTopDistance != mnLeftDistance ||
+                mnTopDistance != mnRightDistance)
             {
                 rText += cpDelimTmp +
-                        GetMetricText( static_cast<tools::Long>(nBottomDist), 
eCoreUnit,
-                                        ePresUnit, &rIntl ) +
+                        GetMetricText( tools::Long(mnBottomDistance), 
eCoreUnit, ePresUnit, &rIntl ) +
                         cpDelimTmp +
-                        GetMetricText( static_cast<tools::Long>(nLeftDist), 
eCoreUnit, ePresUnit, &rIntl ) +
+                        GetMetricText( tools::Long(mnLeftDistance), eCoreUnit, 
ePresUnit, &rIntl ) +
                         cpDelimTmp +
-                        GetMetricText( static_cast<tools::Long>(nRightDist), 
eCoreUnit,
-                                        ePresUnit, &rIntl );
+                        GetMetricText( tools::Long(mnRightDistance), 
eCoreUnit, ePresUnit, &rIntl );
             }
             return true;
         }
         case SfxItemPresentation::Complete:
         {
-            if( !(pTop || pBottom || pLeft || pRight) )
+            if (!(mpTopBorderLine || mpBottomBorderLine || mpLeftBorderLine || 
mpRightBorderLine))
             {
                 rText = EditResId(RID_SVXITEMS_BORDER_NONE) + cpDelimTmp;
             }
             else
             {
                 rText = EditResId(RID_SVXITEMS_BORDER_COMPLETE);
-                if( pTop && pBottom && pLeft && pRight &&
-                    *pTop == *pBottom && *pTop == *pLeft && *pTop == *pRight )
+                if (mpTopBorderLine && mpBottomBorderLine && mpLeftBorderLine 
&& mpRightBorderLine &&
+                    *mpTopBorderLine == *mpBottomBorderLine &&
+                    *mpTopBorderLine == *mpLeftBorderLine &&
+                    *mpTopBorderLine == *mpRightBorderLine)
                 {
-                    rText += pTop->GetValueString( eCoreUnit, ePresUnit, 
&rIntl, true ) + cpDelimTmp;
+                    rText += mpTopBorderLine->GetValueString( eCoreUnit, 
ePresUnit, &rIntl, true ) + cpDelimTmp;
                 }
                 else
                 {
-                    if ( pTop )
+                    if (mpTopBorderLine)
                     {
                         rText += EditResId(RID_SVXITEMS_BORDER_TOP) +
-                                pTop->GetValueString( eCoreUnit, ePresUnit, 
&rIntl, true ) +
+                                mpTopBorderLine->GetValueString( eCoreUnit, 
ePresUnit, &rIntl, true ) +
                                 cpDelimTmp;
                     }
-                    if ( pBottom )
+                    if (mpBottomBorderLine)
                     {
                         rText += EditResId(RID_SVXITEMS_BORDER_BOTTOM) +
-                                pBottom->GetValueString( eCoreUnit, ePresUnit, 
&rIntl, true ) +
+                                mpBottomBorderLine->GetValueString( eCoreUnit, 
ePresUnit, &rIntl, true ) +
                                 cpDelimTmp;
                     }
-                    if ( pLeft )
+                    if (mpLeftBorderLine)
                     {
                         rText += EditResId(RID_SVXITEMS_BORDER_LEFT) +
-                                pLeft->GetValueString( eCoreUnit, ePresUnit, 
&rIntl, true ) +
+                                mpLeftBorderLine->GetValueString( eCoreUnit, 
ePresUnit, &rIntl, true ) +
                                 cpDelimTmp;
                     }
-                    if ( pRight )
+                    if (mpRightBorderLine)
                     {
                         rText += EditResId(RID_SVXITEMS_BORDER_RIGHT) +
-                                pRight->GetValueString( eCoreUnit, ePresUnit, 
&rIntl, true ) +
+                                mpRightBorderLine->GetValueString( eCoreUnit, 
ePresUnit, &rIntl, true ) +
                                 cpDelimTmp;
                     }
                 }
             }
 
             rText += EditResId(RID_SVXITEMS_BORDER_DISTANCE);
-            if( nTopDist == nBottomDist && nTopDist == nLeftDist &&
-                nTopDist == nRightDist )
+            if (mnTopDistance == mnBottomDistance &&
+                mnTopDistance == mnLeftDistance &&
+                mnTopDistance == mnRightDistance)
             {
-                rText += GetMetricText( static_cast<tools::Long>(nTopDist), 
eCoreUnit,
-                                            ePresUnit, &rIntl ) +
+                rText += GetMetricText(tools::Long(mnTopDistance), eCoreUnit, 
ePresUnit, &rIntl ) +
                         " " + EditResId(GetMetricId(ePresUnit));
             }
             else
             {
                 rText += EditResId(RID_SVXITEMS_BORDER_TOP) +
-                        GetMetricText( static_cast<tools::Long>(nTopDist), 
eCoreUnit,
-                                        ePresUnit, &rIntl ) +
+                        GetMetricText(tools::Long(mnTopDistance), eCoreUnit, 
ePresUnit, &rIntl) +
                         " " + EditResId(GetMetricId(ePresUnit)) +
                         cpDelimTmp +
                         EditResId(RID_SVXITEMS_BORDER_BOTTOM) +
-                        GetMetricText( static_cast<tools::Long>(nBottomDist), 
eCoreUnit,
-                                        ePresUnit, &rIntl ) +
+                        GetMetricText(tools::Long(mnBottomDistance), 
eCoreUnit, ePresUnit, &rIntl) +
                         " " + EditResId(GetMetricId(ePresUnit)) +
                         cpDelimTmp +
                         EditResId(RID_SVXITEMS_BORDER_LEFT) +
-                        GetMetricText( static_cast<tools::Long>(nLeftDist), 
eCoreUnit,
-                                        ePresUnit, &rIntl ) +
+                        GetMetricText(tools::Long(mnLeftDistance), eCoreUnit, 
ePresUnit, &rIntl) +
                         " " + EditResId(GetMetricId(ePresUnit)) +
                         cpDelimTmp +
                         EditResId(RID_SVXITEMS_BORDER_RIGHT) +
-                        GetMetricText( static_cast<tools::Long>(nRightDist), 
eCoreUnit,
-                                        ePresUnit, &rIntl ) +
+                        GetMetricText(tools::Long(mnRightDistance), eCoreUnit, 
ePresUnit, &rIntl) +
                         " " + EditResId(GetMetricId(ePresUnit));
             }
             return true;
@@ -2902,14 +2895,19 @@ bool SvxBoxItem::GetPresentation
 
 void SvxBoxItem::ScaleMetrics( tools::Long nMult, tools::Long nDiv )
 {
-    if ( pTop )     pTop->ScaleMetrics( nMult, nDiv );
-    if ( pBottom )  pBottom->ScaleMetrics( nMult, nDiv );
-    if ( pLeft )    pLeft->ScaleMetrics( nMult, nDiv );
-    if ( pRight )   pRight->ScaleMetrics( nMult, nDiv );
-    nTopDist = static_cast<sal_Int16>(BigInt::Scale( nTopDist, nMult, nDiv ));
-    nBottomDist = static_cast<sal_Int16>(BigInt::Scale( nBottomDist, nMult, 
nDiv ));
-    nLeftDist = static_cast<sal_Int16>(BigInt::Scale( nLeftDist, nMult, nDiv 
));
-    nRightDist = static_cast<sal_Int16>(BigInt::Scale( nRightDist, nMult, nDiv 
));
+    if (mpTopBorderLine)
+        mpTopBorderLine->ScaleMetrics( nMult, nDiv );
+    if (mpBottomBorderLine)
+        mpBottomBorderLine->ScaleMetrics( nMult, nDiv );
+    if (mpLeftBorderLine)
+        mpLeftBorderLine->ScaleMetrics( nMult, nDiv );
+    if (mpRightBorderLine)
+        mpRightBorderLine->ScaleMetrics( nMult, nDiv );
+
+    mnTopDistance = static_cast<sal_Int16>(BigInt::Scale(mnTopDistance, nMult, 
nDiv));
+    mnBottomDistance = static_cast<sal_Int16>(BigInt::Scale(mnBottomDistance, 
nMult, nDiv));
+    mnLeftDistance = static_cast<sal_Int16>(BigInt::Scale(mnLeftDistance, 
nMult, nDiv));
+    mnRightDistance = static_cast<sal_Int16>(BigInt::Scale(mnRightDistance, 
nMult, nDiv));
 }
 
 
@@ -2926,16 +2924,16 @@ const SvxBorderLine *SvxBoxItem::GetLine( 
SvxBoxItemLine nLine ) const
     switch ( nLine )
     {
         case SvxBoxItemLine::TOP:
-            pRet = pTop.get();
+            pRet = mpTopBorderLine.get();
             break;
         case SvxBoxItemLine::BOTTOM:
-            pRet = pBottom.get();
+            pRet = mpBottomBorderLine.get();
             break;
         case SvxBoxItemLine::LEFT:
-            pRet = pLeft.get();
+            pRet = mpLeftBorderLine.get();
             break;
         case SvxBoxItemLine::RIGHT:
-            pRet = pRight.get();
+            pRet = mpRightBorderLine.get();
             break;
         default:
             OSL_FAIL( "wrong line" );
@@ -2953,16 +2951,16 @@ void SvxBoxItem::SetLine( const SvxBorderLine* pNew, 
SvxBoxItemLine nLine )
     switch ( nLine )
     {
         case SvxBoxItemLine::TOP:
-            pTop = std::move( pTmp );
+            mpTopBorderLine = std::move(pTmp);
             break;
         case SvxBoxItemLine::BOTTOM:
-            pBottom = std::move( pTmp );
+            mpBottomBorderLine = std::move(pTmp);
             break;
         case SvxBoxItemLine::LEFT:
-            pLeft = std::move( pTmp );
+            mpLeftBorderLine = std::move(pTmp);
             break;
         case SvxBoxItemLine::RIGHT:
-            pRight = std::move( pTmp );
+            mpRightBorderLine = std::move(pTmp);
             break;
         default:
             OSL_FAIL( "wrong line" );
@@ -2973,13 +2971,13 @@ void SvxBoxItem::SetLine( const SvxBorderLine* pNew, 
SvxBoxItemLine nLine )
 sal_uInt16 SvxBoxItem::GetSmallestDistance() const
 {
     // The smallest distance that is not 0 will be returned.
-    sal_uInt16 nDist = nTopDist;
-    if( nBottomDist && (!nDist || nBottomDist < nDist) )
-        nDist = nBottomDist;
-    if( nLeftDist && (!nDist || nLeftDist < nDist) )
-        nDist = nLeftDist;
-    if( nRightDist && (!nDist || nRightDist < nDist) )
-        nDist = nRightDist;
+    sal_uInt16 nDist = mnTopDistance;
+    if (mnBottomDistance && (!nDist || mnBottomDistance < nDist))
+        nDist = mnBottomDistance;
+    if (mnLeftDistance && (!nDist || mnLeftDistance < nDist))
+        nDist = mnLeftDistance;
+    if (mnRightDistance && (!nDist || mnRightDistance < nDist))
+        nDist = mnRightDistance;
 
     return nDist;
 }
@@ -2991,16 +2989,16 @@ sal_Int16 SvxBoxItem::GetDistance( SvxBoxItemLine 
nLine, bool bAllowNegative ) c
     switch ( nLine )
     {
         case SvxBoxItemLine::TOP:
-            nDist = nTopDist;
+            nDist = mnTopDistance;
             break;
         case SvxBoxItemLine::BOTTOM:
-            nDist = nBottomDist;
+            nDist = mnBottomDistance;
             break;
         case SvxBoxItemLine::LEFT:
-            nDist = nLeftDist;
+            nDist = mnLeftDistance;
             break;
         case SvxBoxItemLine::RIGHT:
-            nDist = nRightDist;
+            nDist = mnRightDistance;
             break;
         default:
             OSL_FAIL( "wrong line" );
@@ -3019,16 +3017,16 @@ void SvxBoxItem::SetDistance( sal_Int16 nNew, 
SvxBoxItemLine nLine )
     switch ( nLine )
     {
         case SvxBoxItemLine::TOP:
-            nTopDist = nNew;
+            mnTopDistance = nNew;
             break;
         case SvxBoxItemLine::BOTTOM:
-            nBottomDist = nNew;
+            mnBottomDistance = nNew;
             break;
         case SvxBoxItemLine::LEFT:
-            nLeftDist = nNew;
+            mnLeftDistance = nNew;
             break;
         case SvxBoxItemLine::RIGHT:
-            nRightDist = nNew;
+            mnRightDistance = nNew;
             break;
         default:
             OSL_FAIL( "wrong line" );
@@ -3042,16 +3040,16 @@ sal_uInt16 SvxBoxItem::CalcLineWidth( SvxBoxItemLine 
nLine ) const
     switch ( nLine )
     {
     case SvxBoxItemLine::TOP:
-        pTmp = pTop.get();
+        pTmp = mpTopBorderLine.get();
         break;
     case SvxBoxItemLine::BOTTOM:
-        pTmp = pBottom.get();
+        pTmp = mpBottomBorderLine.get();
         break;
     case SvxBoxItemLine::LEFT:
-        pTmp = pLeft.get();
+        pTmp = mpLeftBorderLine.get();
         break;
     case SvxBoxItemLine::RIGHT:
-        pTmp = pRight.get();
+        pTmp = mpRightBorderLine.get();
         break;
     default:
         OSL_FAIL( "wrong line" );
@@ -3070,20 +3068,20 @@ sal_Int16 SvxBoxItem::CalcLineSpace( SvxBoxItemLine 
nLine, bool bEvenIfNoLine, b
     switch ( nLine )
     {
     case SvxBoxItemLine::TOP:
-        pTmp = pTop.get();
-        nDist = nTopDist;
+        pTmp = mpTopBorderLine.get();
+        nDist = mnTopDistance;
         break;
     case SvxBoxItemLine::BOTTOM:
-        pTmp = pBottom.get();
-        nDist = nBottomDist;
+        pTmp = mpBottomBorderLine.get();
+        nDist = mnBottomDistance;
         break;
     case SvxBoxItemLine::LEFT:
-        pTmp = pLeft.get();
-        nDist = nLeftDist;
+        pTmp = mpLeftBorderLine.get();
+        nDist = mnLeftDistance;
         break;
     case SvxBoxItemLine::RIGHT:
-        pTmp = pRight.get();
-        nDist = nRightDist;
+        pTmp = mpRightBorderLine.get();
+        nDist = mnRightDistance;
         break;
     default:
         OSL_FAIL( "wrong line" );
@@ -3114,27 +3112,25 @@ bool SvxBoxItem::HasBorder( bool bTreatPaddingAsBorder 
) const
 
 // class SvxBoxInfoItem --------------------------------------------------
 
-SvxBoxInfoItem::SvxBoxInfoItem( const sal_uInt16 nId ) :
-    SfxPoolItem( nId ),
-    mbEnableHor( false ),
-    mbEnableVer( false ),
-    nDefDist( 0 )
+SvxBoxInfoItem::SvxBoxInfoItem(const sal_uInt16 nId)
+    : SfxPoolItem(nId)
+    , mbDistance(false)
+    , mbMinimumDistance(false)
 {
-    bDist = bMinDist = false;
     ResetFlags();
 }
 
 
-SvxBoxInfoItem::SvxBoxInfoItem( const SvxBoxInfoItem& rCpy ) :
-    SfxPoolItem( rCpy ),
-    pHori( rCpy.pHori ? new SvxBorderLine( *rCpy.pHori ) : nullptr ),
-    pVert( rCpy.pVert ? new SvxBorderLine( *rCpy.pVert ) : nullptr ),
-    mbEnableHor( rCpy.mbEnableHor ),
-    mbEnableVer( rCpy.mbEnableVer ),
-    bDist( rCpy.bDist ),
-    bMinDist ( rCpy.bMinDist ),
-    nValidFlags( rCpy.nValidFlags ),
-    nDefDist( rCpy.nDefDist )
+SvxBoxInfoItem::SvxBoxInfoItem( const SvxBoxInfoItem& rCopy )
+    : SfxPoolItem(rCopy)
+    , mpHorizontalLine(rCopy.mpHorizontalLine ? new 
SvxBorderLine(*rCopy.mpHorizontalLine) : nullptr)
+    , mpVerticalLine(rCopy.mpVerticalLine ? new 
SvxBorderLine(*rCopy.mpVerticalLine) : nullptr)
+    , mbEnableHorizontalLine(rCopy.mbEnableHorizontalLine)
+    , mbEnableVerticalLine(rCopy.mbEnableVerticalLine)
+    , mbDistance(rCopy.mbDistance)
+    , mbMinimumDistance (rCopy.mbMinimumDistance)
+    , mnValidFlags(rCopy.mnValidFlags)
+    , mnDefaultMinimumDistance(rCopy.mnDefaultMinimumDistance)
 {
 }
 
@@ -3164,29 +3160,28 @@ bool SvxBoxInfoItem::operator==( const SfxPoolItem& 
rAttr ) const
 
     const SvxBoxInfoItem& rBoxInfo = static_cast<const SvxBoxInfoItem&>(rAttr);
 
-    return (   mbEnableHor               == rBoxInfo.mbEnableHor
-            && mbEnableVer               == rBoxInfo.mbEnableVer
-            && bDist                     == rBoxInfo.IsDist()
-            && bMinDist                  == rBoxInfo.IsMinDist()
-            && nValidFlags               == rBoxInfo.nValidFlags
-            && nDefDist                  == rBoxInfo.GetDefDist()
-            && CmpBrdLn( pHori, rBoxInfo.GetHori() )
-            && CmpBrdLn( pVert, rBoxInfo.GetVert() )
-           );
+    return (mbEnableHorizontalLine == rBoxInfo.mbEnableHorizontalLine
+            && mbEnableVerticalLine == rBoxInfo.mbEnableVerticalLine
+            && mbDistance == rBoxInfo.mbDistance
+            && mbMinimumDistance == rBoxInfo.mbMinimumDistance
+            && mnValidFlags == rBoxInfo.mnValidFlags
+            && mnDefaultMinimumDistance == rBoxInfo.mnDefaultMinimumDistance
+            && CompareBorderLine(mpHorizontalLine, rBoxInfo.GetHori())
+            && CompareBorderLine(mpVerticalLine, rBoxInfo.GetVert()));
 }
 
 
 void SvxBoxInfoItem::SetLine( const SvxBorderLine* pNew, SvxBoxInfoItemLine 
nLine )
 {
-    std::unique_ptr<SvxBorderLine> pTmp( pNew ? new SvxBorderLine( *pNew ) : 
nullptr );
+    std::unique_ptr<SvxBorderLine> pCopy(pNew ? new SvxBorderLine(*pNew) : 
nullptr);
 
     if ( SvxBoxInfoItemLine::HORI == nLine )
     {
-        pHori = std::move(pTmp);
+        mpHorizontalLine = std::move(pCopy);
     }
     else if ( SvxBoxInfoItemLine::VERT == nLine )
     {
-        pVert = std::move(pTmp);
+        mpVerticalLine = std::move(pCopy);
     }
     else
     {
@@ -3214,9 +3209,11 @@ bool SvxBoxInfoItem::GetPresentation
 
 void SvxBoxInfoItem::ScaleMetrics( tools::Long nMult, tools::Long nDiv )
 {
-    if ( pHori ) pHori->ScaleMetrics( nMult, nDiv );
-    if ( pVert ) pVert->ScaleMetrics( nMult, nDiv );
-    nDefDist = static_cast<sal_uInt16>(BigInt::Scale( nDefDist, nMult, nDiv ));
+    if (mpHorizontalLine)
+        mpHorizontalLine->ScaleMetrics(nMult, nDiv);
+    if (mpVerticalLine)
+        mpVerticalLine->ScaleMetrics(nMult, nDiv);
+    mnDefaultMinimumDistance = 
sal_uInt16(BigInt::Scale(mnDefaultMinimumDistance, nMult, nDiv));
 }
 
 
@@ -3228,7 +3225,7 @@ bool SvxBoxInfoItem::HasMetrics() const
 
 void SvxBoxInfoItem::ResetFlags()
 {
-    nValidFlags = static_cast<SvxBoxInfoItemValidFlags>(0x7F); // all valid 
except Disable
+    mnValidFlags = static_cast<SvxBoxInfoItemValidFlags>(0x7F); // all valid 
except Disable
 }
 
 bool SvxBoxInfoItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
@@ -3250,10 +3247,10 @@ bool SvxBoxInfoItem::QueryValue( uno::Any& rVal, 
sal_uInt8 nMemberId ) const
             if ( IsMinDist() )
                 nVal |= 0x04;
             css::uno::Sequence< css::uno::Any > aSeq{
-                uno::Any(SvxBoxItem::SvxLineToLine( pHori.get(), bConvert)),
-                uno::Any(SvxBoxItem::SvxLineToLine( pVert.get(), bConvert)),
+                uno::Any(SvxBoxItem::SvxLineToLine(mpHorizontalLine.get(), 
bConvert)),
+                uno::Any(SvxBoxItem::SvxLineToLine(mpVerticalLine.get(), 
bConvert)),
                 uno::Any(nVal),
-                uno::Any(static_cast<sal_Int16>(nValidFlags)),
+                uno::Any(static_cast<sal_Int16>(mnValidFlags)),
                 uno::Any(static_cast<sal_Int32>(bConvert ? 
convertTwipToMm100(GetDefDist()) : GetDefDist()))
             };
             rVal <<= aSeq;
@@ -3261,10 +3258,10 @@ bool SvxBoxInfoItem::QueryValue( uno::Any& rVal, 
sal_uInt8 nMemberId ) const
         }
 
         case MID_HORIZONTAL:
-            aRetLine = SvxBoxItem::SvxLineToLine( pHori.get(), bConvert);
+            aRetLine = SvxBoxItem::SvxLineToLine(mpHorizontalLine.get(), 
bConvert);
             break;
         case MID_VERTICAL:
-            aRetLine = SvxBoxItem::SvxLineToLine( pVert.get(), bConvert);
+            aRetLine = SvxBoxItem::SvxLineToLine(mpVerticalLine.get(), 
bConvert);
             break;
         case MID_FLAGS:
             bIntMember = true;
@@ -3278,7 +3275,7 @@ bool SvxBoxInfoItem::QueryValue( uno::Any& rVal, 
sal_uInt8 nMemberId ) const
             break;
         case MID_VALIDFLAGS:
             bIntMember = true;
-            rVal <<= static_cast<sal_Int16>(nValidFlags);
+            rVal <<= static_cast<sal_Int16>(mnValidFlags);
             break;
         case MID_DISTANCE:
             bIntMember = true;
@@ -3323,7 +3320,7 @@ bool SvxBoxInfoItem::PutValue( const uno::Any& rVal, 
sal_uInt8 nMemberId )
                 else
                     return false;
                 if ( aSeq[3] >>= nFlags )
-                    nValidFlags = 
static_cast<SvxBoxInfoItemValidFlags>(nFlags);
+                    mnValidFlags = 
static_cast<SvxBoxInfoItemValidFlags>(nFlags);
                 else
                     return false;
                 if (( aSeq[4] >>= nVal ) && ( nVal >= 0 ))
@@ -3436,7 +3433,7 @@ bool SvxBoxInfoItem::PutValue( const uno::Any& rVal, 
sal_uInt8 nMemberId )
             sal_Int16 nFlags = sal_Int16();
             bRet = (rVal >>= nFlags);
             if ( bRet )
-                nValidFlags = static_cast<SvxBoxInfoItemValidFlags>(nFlags);
+                mnValidFlags = static_cast<SvxBoxInfoItemValidFlags>(nFlags);
             break;
         }
         case MID_DISTANCE:
@@ -3728,7 +3725,7 @@ bool SvxLineItem::operator==( const SfxPoolItem& rAttr ) 
const
 {
     assert(SfxPoolItem::operator==(rAttr));
 
-    return CmpBrdLn( pLine, static_cast<const SvxLineItem&>(rAttr).GetLine() );
+    return CompareBorderLine(pLine, static_cast<const 
SvxLineItem&>(rAttr).GetLine());
 }
 
 SvxLineItem* SvxLineItem::Clone( SfxItemPool* ) const
diff --git a/include/editeng/boxitem.hxx b/include/editeng/boxitem.hxx
index 786821c02ff0..7b1058f570a9 100644
--- a/include/editeng/boxitem.hxx
+++ b/include/editeng/boxitem.hxx
@@ -54,16 +54,17 @@ constexpr sal_uInt16 BOX_BORDER_STYLE_VERSION = 2;
 
 class EDITENG_DLLPUBLIC SvxBoxItem final : public SfxPoolItem
 {
-    std::unique_ptr<editeng::SvxBorderLine>
-                    pTop,
-                    pBottom,
-                    pLeft,
-                    pRight;
-    sal_Int16       nTopDist,
-                    nBottomDist,
-                    nLeftDist,
-                    nRightDist;
-    bool            bRemoveAdjCellBorder;
+    std::unique_ptr<editeng::SvxBorderLine> mpTopBorderLine;
+    std::unique_ptr<editeng::SvxBorderLine> mpBottomBorderLine;
+    std::unique_ptr<editeng::SvxBorderLine> mpLeftBorderLine;
+    std::unique_ptr<editeng::SvxBorderLine> mpRightBorderLine;
+
+    sal_Int16 mnTopDistance = 0;
+    sal_Int16 mnBottomDistance = 0;
+    sal_Int16 mnLeftDistance = 0;
+    sal_Int16 mnRightDistance = 0;
+
+    bool mbRemoveAdjCellBorder = false;
 
 public:
     static SfxPoolItem* CreateDefault();
@@ -87,10 +88,22 @@ public:
     virtual void             ScaleMetrics( tools::Long nMult, tools::Long nDiv 
) override;
     virtual bool             HasMetrics() const override;
 
-    const   editeng::SvxBorderLine* GetTop()    const { return pTop.get(); }
-    const   editeng::SvxBorderLine* GetBottom() const { return pBottom.get(); }
-    const   editeng::SvxBorderLine* GetLeft()   const { return pLeft.get(); }
-    const   editeng::SvxBorderLine* GetRight()  const { return pRight.get(); }
+    const editeng::SvxBorderLine* GetTop() const
+    {
+        return mpTopBorderLine.get();
+    }
+    const editeng::SvxBorderLine* GetBottom() const
+    {
+        return mpBottomBorderLine.get();
+    }
+    const editeng::SvxBorderLine* GetLeft() const
+    {
+        return mpLeftBorderLine.get();
+    }
+    const editeng::SvxBorderLine* GetRight() const
+    {
+        return mpRightBorderLine.get();
+    }
 
     const   editeng::SvxBorderLine* GetLine( SvxBoxItemLine nLine ) const;
 
@@ -100,12 +113,15 @@ public:
     sal_Int16  GetDistance( SvxBoxItemLine nLine, bool bAllowNegative = false 
) const;
     sal_uInt16  GetSmallestDistance() const;
 
-    bool IsRemoveAdjacentCellBorder() const { return bRemoveAdjCellBorder; }
+    bool IsRemoveAdjacentCellBorder() const { return mbRemoveAdjCellBorder; }
 
     void    SetDistance( sal_Int16 nNew, SvxBoxItemLine nLine );
-    inline void SetAllDistances( sal_Int16 nNew );
+    void SetAllDistances(sal_Int16 nNew)
+    {
+        mnTopDistance = mnBottomDistance = mnLeftDistance = mnRightDistance = 
nNew;
+    }
 
-    void SetRemoveAdjacentCellBorder( bool bSet ) { bRemoveAdjCellBorder = 
bSet; }
+    void SetRemoveAdjacentCellBorder( bool bSet ) { mbRemoveAdjCellBorder = 
bSet; }
 
     // Line width plus Space plus inward distance
     // bEvenIfNoLine = TRUE -> Also return distance, when no Line is set
@@ -120,11 +136,6 @@ public:
     void dumpAsXml(xmlTextWriterPtr pWriter) const override;
 };
 
-inline void SvxBoxItem::SetAllDistances(sal_Int16 const nNew)
-{
-    nTopDist = nBottomDist = nLeftDist = nRightDist = nNew;
-}
-
 // class SvxBoxInfoItem --------------------------------------------------
 
 /*  [Description]
@@ -160,11 +171,11 @@ namespace o3tl
 
 class EDITENG_DLLPUBLIC SvxBoxInfoItem final : public SfxPoolItem
 {
-    std::unique_ptr<editeng::SvxBorderLine> pHori;   //inner horizontal Line
-    std::unique_ptr<editeng::SvxBorderLine> pVert;   //inner vertical Line
+    std::unique_ptr<editeng::SvxBorderLine> mpHorizontalLine; //inner 
horizontal Line
+    std::unique_ptr<editeng::SvxBorderLine> mpVerticalLine; //inner vertical 
Line
 
-    bool                mbEnableHor;   /// true = Enable inner horizontal line.
-    bool                mbEnableVer;   /// true = Enable inner vertical line.
+    bool mbEnableHorizontalLine = false; /// true = Enable inner horizontal 
line.
+    bool mbEnableVerticalLine = false; /// true = Enable inner vertical line.
 
     /*
      Currently only for StarWriter: distance inward from SvxBoxItem. If the
@@ -176,11 +187,11 @@ class EDITENG_DLLPUBLIC SvxBoxInfoItem final : public 
SfxPoolItem
      forth to the dialogue.
     */
 
-    bool        bDist      :1;  // TRUE, Unlock Distance.
-    bool        bMinDist   :1;  // TRUE, Going below minimum Distance is 
prohibited
+    bool mbDistance :1;  // TRUE, Unlock Distance.
+    bool mbMinimumDistance :1;  // TRUE, Going below minimum Distance is 
prohibited
 
-    SvxBoxInfoItemValidFlags nValidFlags;
-    sal_uInt16  nDefDist;       // The default or minimum distance.
+    SvxBoxInfoItemValidFlags mnValidFlags;
+    sal_uInt16 mnDefaultMinimumDistance = 0; // The default or minimum 
distance.
 
 public:
     static SfxPoolItem* CreateDefault();
@@ -202,37 +213,42 @@ public:
     virtual void            ScaleMetrics( tools::Long nMult, tools::Long nDiv 
) override;
     virtual bool            HasMetrics() const override;
 
-    const editeng::SvxBorderLine*   GetHori() const { return pHori.get(); }
-    const editeng::SvxBorderLine*   GetVert() const { return pVert.get(); }
+    const editeng::SvxBorderLine*   GetHori() const { return 
mpHorizontalLine.get(); }
+    const editeng::SvxBorderLine*   GetVert() const { return 
mpVerticalLine.get(); }
 
     //The Pointers are being copied!
     void                    SetLine( const editeng::SvxBorderLine* pNew, 
SvxBoxInfoItemLine nLine );
 
-    bool                    IsTable() const             { return mbEnableHor 
&& mbEnableVer; }
-    void                    SetTable( bool bNew )       { mbEnableHor = 
mbEnableVer = bNew; }
+    bool IsTable() const { return mbEnableHorizontalLine && 
mbEnableVerticalLine; }
+    void SetTable(bool bNew) { mbEnableHorizontalLine = mbEnableVerticalLine = 
bNew; }
 
-    bool             IsHorEnabled() const { return mbEnableHor; }
-    void             EnableHor( bool bEnable ) { mbEnableHor = bEnable; }
-    bool             IsVerEnabled() const { return mbEnableVer; }
-    void             EnableVer( bool bEnable ) { mbEnableVer = bEnable; }
+    bool IsHorEnabled() const { return mbEnableHorizontalLine; }
+    void EnableHor( bool bEnable ) { mbEnableHorizontalLine = bEnable; }
+    bool IsVerEnabled() const { return mbEnableVerticalLine; }
+    void EnableVer( bool bEnable ) { mbEnableVerticalLine = 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 IsDist() const { return mbDistance; }
+    void SetDist(bool bNew)
+    {
+        mbDistance = bNew;
+    }
+    bool IsMinDist() const { return mbMinimumDistance; }
+    void SetMinDist(bool bNew) { mbMinimumDistance = bNew; }
+    sal_uInt16 GetDefDist() const { return mnDefaultMinimumDistance; }
+    void SetDefDist(sal_uInt16 nNew) { mnDefaultMinimumDistance = nNew; }
 
-    bool                    IsValid( SvxBoxInfoItemValidFlags nValid ) const
-                                { return bool( nValidFlags & nValid ); }
-    void                    SetValid( SvxBoxInfoItemValidFlags nValid, bool 
bValid = true )
+    bool IsValid( SvxBoxInfoItemValidFlags nValid ) const
+    {
+        return bool(mnValidFlags & nValid);
+    }
+    void SetValid(SvxBoxInfoItemValidFlags nValid, bool bValid = true)
     {
         if (bValid)
-            nValidFlags |= nValid;
+            mnValidFlags |= nValid;
         else
-            nValidFlags &= ~nValid;
+            mnValidFlags &= ~nValid;
     }
-    void                    ResetFlags();
+    void ResetFlags();
 
     virtual boost::property_tree::ptree dumpAsJSON() const override;
 };

Reply via email to