[Libreoffice-commits] core.git: editeng/source

Noel Grandin noel at peralex.com
Tue Oct 14 22:46:25 PDT 2014


 editeng/source/editeng/editdoc.cxx  |    9 ++--
 editeng/source/editeng/editdoc.hxx  |   45 ++++++++++++------------
 editeng/source/editeng/impedit.cxx  |    2 -
 editeng/source/editeng/impedit2.cxx |   38 ++++++++++----------
 editeng/source/editeng/impedit3.cxx |   67 ++++++++++++++++++------------------
 5 files changed, 84 insertions(+), 77 deletions(-)

New commits:
commit 0141e9cac82c16b7cdb01f4e7e595c9d98f8d6ce
Author: Noel Grandin <noel at peralex.com>
Date:   Mon Oct 13 11:00:19 2014 +0200

    convert PORTION_KIND constants to enum
    
    Change-Id: I32d65cfd7a67cd7ebca0f99061293a9ac3398133
    Reviewed-on: https://gerrit.libreoffice.org/11970
    Tested-by: LibreOffice gerrit bot <gerrit at libreoffice.org>
    Reviewed-by: Noel Grandin <noelgrandin at gmail.com>

diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx
index 53662ae..8baa214 100644
--- a/editeng/source/editeng/editdoc.cxx
+++ b/editeng/source/editeng/editdoc.cxx
@@ -1088,9 +1088,9 @@ Size EditLine::CalcTextSize( ParaPortion& rParaPortion )
         pPortion = rParaPortion.GetTextPortions()[n];
         switch ( pPortion->GetKind() )
         {
-            case PORTIONKIND_TEXT:
-            case PORTIONKIND_FIELD:
-            case PORTIONKIND_HYPHENATOR:
+            case PortionKind::TEXT:
+            case PortionKind::FIELD:
+            case PortionKind::HYPHENATOR:
             {
                 aTmpSz = pPortion->GetSize();
                 aSz.Width() += aTmpSz.Width();
@@ -1098,11 +1098,12 @@ Size EditLine::CalcTextSize( ParaPortion& rParaPortion )
                     aSz.Height() = aTmpSz.Height();
             }
             break;
-            case PORTIONKIND_TAB:
+            case PortionKind::TAB:
             {
                 aSz.Width() += pPortion->GetSize().Width();
             }
             break;
+            case PortionKind::LINEBREAK: break;
         }
     }
 
diff --git a/editeng/source/editeng/editdoc.hxx b/editeng/source/editeng/editdoc.hxx
index 1aa1c58..8ed9816 100644
--- a/editeng/source/editeng/editdoc.hxx
+++ b/editeng/source/editeng/editdoc.hxx
@@ -329,11 +329,14 @@ public:
     bool operator !() const { return !pNode && !nIndex; }
 };
 
-#define PORTIONKIND_TEXT        0
-#define PORTIONKIND_TAB         1
-#define PORTIONKIND_LINEBREAK   2
-#define PORTIONKIND_FIELD       3
-#define PORTIONKIND_HYPHENATOR  4
+enum class PortionKind
+{
+    TEXT        = 0,
+    TAB         = 1,
+    LINEBREAK   = 2,
+    FIELD       = 3,
+    HYPHENATOR  = 4
+};
 
 #define DELMODE_SIMPLE          0
 #define DELMODE_RESTOFWORD      1
@@ -378,10 +381,10 @@ class TextPortion
 {
 private:
     ExtraPortionInfo*   pExtraInfos;
-    sal_Int32              nLen;
+    sal_Int32           nLen;
     Size                aOutSz;
-    sal_uInt8               nKind;
-    sal_uInt8                nRightToLeft;
+    PortionKind         nKind;
+    sal_uInt8           nRightToLeft;
     sal_Unicode         nExtraValue;
 
 
@@ -389,7 +392,7 @@ private:
                 : pExtraInfos( NULL )
                 , nLen( 0 )
                 , aOutSz()
-                , nKind( PORTIONKIND_TEXT )
+                , nKind( PortionKind::TEXT )
                 , nRightToLeft( sal_False )
                 , nExtraValue( 0 )
                 {
@@ -400,7 +403,7 @@ public:
                 : pExtraInfos( NULL )
                 , nLen( nL )
                 , aOutSz( -1, -1 )
-                , nKind( PORTIONKIND_TEXT )
+                , nKind( PortionKind::TEXT )
                 , nRightToLeft( sal_False )
                 , nExtraValue( 0 )
                 {
@@ -418,22 +421,22 @@ public:
 
 
     sal_Int32      GetLen() const              { return nLen; }
-    void        SetLen( sal_Int32 nL )         { nLen = nL; }
+    void           SetLen( sal_Int32 nL )         { nLen = nL; }
 
-    Size&       GetSize()                   { return aOutSz; }
-    const Size& GetSize() const             { return aOutSz; }
+    Size&          GetSize()                   { return aOutSz; }
+    const Size&    GetSize() const             { return aOutSz; }
 
-    sal_uInt8&      GetKind()                   { return nKind; }
-    sal_uInt8       GetKind() const             { return nKind; }
+    PortionKind&   GetKind()                   { return nKind; }
+    PortionKind    GetKind() const             { return nKind; }
 
-    void        SetRightToLeft( sal_uInt8 b )    { nRightToLeft = b; }
-    sal_uInt8        GetRightToLeft() const      { return nRightToLeft; }
-    bool        IsRightToLeft() const       { return (nRightToLeft&1); }
+    void           SetRightToLeft( sal_uInt8 b )    { nRightToLeft = b; }
+    sal_uInt8      GetRightToLeft() const      { return nRightToLeft; }
+    bool           IsRightToLeft() const       { return (nRightToLeft&1); }
 
-    sal_Unicode GetExtraValue() const       { return nExtraValue; }
-    void        SetExtraValue( sal_Unicode n )  { nExtraValue = n; }
+    sal_Unicode    GetExtraValue() const       { return nExtraValue; }
+    void           SetExtraValue( sal_Unicode n )  { nExtraValue = n; }
 
-    bool        HasValidSize() const        { return aOutSz.Width() != (-1); }
+    bool           HasValidSize() const        { return aOutSz.Width() != (-1); }
 
     ExtraPortionInfo*   GetExtraInfos() const { return pExtraInfos; }
     void                SetExtraInfos( ExtraPortionInfo* p ) { delete pExtraInfos; pExtraInfos = p; }
diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx
index 7e069d6..a71176c 100644
--- a/editeng/source/editeng/impedit.cxx
+++ b/editeng/source/editeng/impedit.cxx
@@ -684,7 +684,7 @@ void ImpEditView::ShowCursor( bool bGotoCursor, bool bForceVisCursor, sal_uInt16
 
             sal_Int32 nTextPortion = pParaPortion->GetTextPortions().FindPortion( aPaM.GetIndex(), nTextPortionStart, true );
             const TextPortion* pTextPortion = pParaPortion->GetTextPortions()[nTextPortion];
-            if ( pTextPortion->GetKind() == PORTIONKIND_TAB )
+            if ( pTextPortion->GetKind() == PortionKind::TAB )
             {
                 aEditCursor.Right() += pTextPortion->GetSize().Width();
             }
diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx
index ed238cd..3b56fdb 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -3130,14 +3130,14 @@ sal_uInt32 ImpEditEngine::CalcLineWidth( ParaPortion* pPortion, EditLine* pLine,
         const TextPortion* pTextPortion = pPortion->GetTextPortions()[nTP];
         switch ( pTextPortion->GetKind() )
         {
-            case PORTIONKIND_FIELD:
-            case PORTIONKIND_HYPHENATOR:
-            case PORTIONKIND_TAB:
+            case PortionKind::FIELD:
+            case PortionKind::HYPHENATOR:
+            case PortionKind::TAB:
             {
                 nWidth += pTextPortion->GetSize().Width();
             }
             break;
-            case PORTIONKIND_TEXT:
+            case PortionKind::TEXT:
             {
                 if ( ( eJustification != SVX_ADJUST_BLOCK ) || ( !bIgnoreExtraSpace ) )
                 {
@@ -3153,6 +3153,7 @@ sal_uInt32 ImpEditEngine::CalcLineWidth( ParaPortion* pPortion, EditLine* pLine,
                 }
             }
             break;
+            case PortionKind::LINEBREAK: break;
         }
         nPos = nPos + pTextPortion->GetLen();
     }
@@ -3690,7 +3691,7 @@ sal_Int32 ImpEditEngine::GetChar(
             // Search within Portion...
 
             // Don't search within special portions...
-            if ( pPortion->GetKind() != PORTIONKIND_TEXT )
+            if ( pPortion->GetKind() != PortionKind::TEXT )
             {
                 // ...but check on which side
                 if ( bSmart )
@@ -3811,14 +3812,15 @@ long ImpEditEngine::GetPortionXOffset(
         const TextPortion* pPortion = pParaPortion->GetTextPortions()[i];
         switch ( pPortion->GetKind() )
         {
-            case PORTIONKIND_FIELD:
-            case PORTIONKIND_TEXT:
-            case PORTIONKIND_HYPHENATOR:
-            case PORTIONKIND_TAB:
+            case PortionKind::FIELD:
+            case PortionKind::TEXT:
+            case PortionKind::HYPHENATOR:
+            case PortionKind::TAB:
             {
                 nX += pPortion->GetSize().Width();
             }
             break;
+            case PortionKind::LINEBREAK: break;
         }
     }
 
@@ -3826,7 +3828,7 @@ long ImpEditEngine::GetPortionXOffset(
     bool bR2LPara = IsRightToLeft( nPara );
 
     const TextPortion* pDestPortion = pParaPortion->GetTextPortions()[nTextPortion];
-    if ( pDestPortion->GetKind() != PORTIONKIND_TAB )
+    if ( pDestPortion->GetKind() != PortionKind::TAB )
     {
         if ( !bR2LPara && pDestPortion->GetRightToLeft() )
         {
@@ -3835,7 +3837,7 @@ long ImpEditEngine::GetPortionXOffset(
             while ( nTmpPortion <= pLine->GetEndPortion() )
             {
                 const TextPortion* pNextTextPortion = pParaPortion->GetTextPortions()[nTmpPortion];
-                if ( pNextTextPortion->GetRightToLeft() && ( pNextTextPortion->GetKind() != PORTIONKIND_TAB ) )
+                if ( pNextTextPortion->GetRightToLeft() && ( pNextTextPortion->GetKind() != PortionKind::TAB ) )
                     nX += pNextTextPortion->GetSize().Width();
                 else
                     break;
@@ -3847,7 +3849,7 @@ long ImpEditEngine::GetPortionXOffset(
             {
                 --nTmpPortion;
                 const TextPortion* pPrevTextPortion = pParaPortion->GetTextPortions()[nTmpPortion];
-                if ( pPrevTextPortion->GetRightToLeft() && ( pPrevTextPortion->GetKind() != PORTIONKIND_TAB ) )
+                if ( pPrevTextPortion->GetRightToLeft() && ( pPrevTextPortion->GetKind() != PortionKind::TAB ) )
                     nX -= pPrevTextPortion->GetSize().Width();
                 else
                     break;
@@ -3860,7 +3862,7 @@ long ImpEditEngine::GetPortionXOffset(
             while ( nTmpPortion <= pLine->GetEndPortion() )
             {
                 const TextPortion* pNextTextPortion = pParaPortion->GetTextPortions()[nTmpPortion];
-                if ( !pNextTextPortion->IsRightToLeft() && ( pNextTextPortion->GetKind() != PORTIONKIND_TAB ) )
+                if ( !pNextTextPortion->IsRightToLeft() && ( pNextTextPortion->GetKind() != PortionKind::TAB ) )
                     nX += pNextTextPortion->GetSize().Width();
                 else
                     break;
@@ -3872,7 +3874,7 @@ long ImpEditEngine::GetPortionXOffset(
             {
                 --nTmpPortion;
                 const TextPortion* pPrevTextPortion = pParaPortion->GetTextPortions()[nTmpPortion];
-                if ( !pPrevTextPortion->IsRightToLeft() && ( pPrevTextPortion->GetKind() != PORTIONKIND_TAB ) )
+                if ( !pPrevTextPortion->IsRightToLeft() && ( pPrevTextPortion->GetKind() != PortionKind::TAB ) )
                     nX -= pPrevTextPortion->GetSize().Width();
                 else
                     break;
@@ -3916,7 +3918,7 @@ long ImpEditEngine::GetXPos(
     // calc text width, portion size may include CJK/CTL spacing...
     // But the array migh not be init yet, if using text ranger this method is called within CreateLines()...
     long nPortionTextWidth = pPortion->GetSize().Width();
-    if ( ( pPortion->GetKind() == PORTIONKIND_TEXT ) && pPortion->GetLen() && !GetTextRanger() )
+    if ( ( pPortion->GetKind() == PortionKind::TEXT ) && pPortion->GetLen() && !GetTextRanger() )
         nPortionTextWidth = pLine->GetCharPosArray()[nTextPortionStart + pPortion->GetLen() - 1 - pLine->GetStart()];
 
     if ( nTextPortionStart != nIndex )
@@ -3925,12 +3927,12 @@ long ImpEditEngine::GetXPos(
         if ( nIndex == ( nTextPortionStart + pPortion->GetLen() ) )
         {
             // End of Portion
-            if ( pPortion->GetKind() == PORTIONKIND_TAB )
+            if ( pPortion->GetKind() == PortionKind::TAB )
             {
                 if ( nTextPortion+1 < pParaPortion->GetTextPortions().Count() )
                 {
                     const TextPortion* pNextPortion = pParaPortion->GetTextPortions()[nTextPortion+1];
-                    if ( pNextPortion->GetKind() != PORTIONKIND_TAB )
+                    if ( pNextPortion->GetKind() != PortionKind::TAB )
                     {
                         if ( !bPreferPortionStart )
                             nX = GetXPos( pParaPortion, pLine, nIndex, true );
@@ -3948,7 +3950,7 @@ long ImpEditEngine::GetXPos(
                 nX += nPortionTextWidth;
             }
         }
-        else if ( pPortion->GetKind() == PORTIONKIND_TEXT )
+        else if ( pPortion->GetKind() == PortionKind::TEXT )
         {
             OSL_ENSURE( nIndex != pLine->GetStart(), "Strange behavior in new GetXPos()" );
             OSL_ENSURE( pLine && pLine->GetCharPosArray().size(), "svx::ImpEditEngine::GetXPos(), portion in an empty line?" );
diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx
index e12209d..4ba25a6 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -880,7 +880,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY )
         {
             nPortionStart = nTmpPos;
             pPortion = pParaPortion->GetTextPortions()[nTmpPortion];
-            if ( pPortion->GetKind() == PORTIONKIND_HYPHENATOR )
+            if ( pPortion->GetKind() == PortionKind::HYPHENATOR )
             {
                 // Throw away a Portion, if necessary correct the one before,
                 // if the Hyph portion has swallowed a character ...
@@ -890,7 +890,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY )
                 {
                     nTmpPortion--;
                     TextPortion* pPrev = pParaPortion->GetTextPortions()[nTmpPortion];
-                    DBG_ASSERT( pPrev->GetKind() == PORTIONKIND_TEXT, "Portion?!" );
+                    DBG_ASSERT( pPrev->GetKind() == PortionKind::TEXT, "Portion?!" );
                     nTmpWidth -= pPrev->GetSize().Width();
                     nTmpPos = nTmpPos - pPrev->GetLen();
                     pPrev->SetLen(pPrev->GetLen() + nTmpLen);
@@ -900,7 +900,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY )
                 DBG_ASSERT( nTmpPortion < pParaPortion->GetTextPortions().Count(), "No more Portions left!" );
                 pPortion = pParaPortion->GetTextPortions()[nTmpPortion];
             }
-            DBG_ASSERT( pPortion->GetKind() != PORTIONKIND_HYPHENATOR, "CreateLines: Hyphenator-Portion!" );
+            DBG_ASSERT( pPortion->GetKind() != PortionKind::HYPHENATOR, "CreateLines: Hyphenator-Portion!" );
             DBG_ASSERT( pPortion->GetLen() || bProcessingEmptyLine, "Empty Portion in CreateLines ?!" );
             (void)bProcessingEmptyLine;
             if ( pNextFeature && ( pNextFeature->GetStart() == nTmpPos ) )
@@ -943,7 +943,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY )
                             aCurrentTab.nTabPortion = nTmpPortion;
                         }
 
-                        pPortion->GetKind() = PORTIONKIND_TAB;
+                        pPortion->GetKind() = PortionKind::TAB;
                         pPortion->SetExtraValue( aCurrentTab.aTabStop.GetFill() );
                         pPortion->GetSize().Width() = aCurrentTab.nTabPos - (nTmpWidth+nStartX);
 
@@ -978,7 +978,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY )
                         pPortion->GetSize().Width() = 0;
                         bEOL = true;
                         bLineBreak = true;
-                        pPortion->GetKind() = PORTIONKIND_LINEBREAK;
+                        pPortion->GetKind() = PortionKind::LINEBREAK;
                         bCompressedChars = false;
                         EditLine::CharPosArrayType& rArray = pLine->GetCharPosArray();
                         size_t nPos = nTmpPos - pLine->GetStart();
@@ -1028,7 +1028,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY )
                         EditLine::CharPosArrayType& rArray = pLine->GetCharPosArray();
                         size_t nPos = nTmpPos - pLine->GetStart();
                         rArray.insert(rArray.begin()+nPos, pPortion->GetSize().Width());
-                        pPortion->GetKind() = cChar ? PORTIONKIND_TEXT : PORTIONKIND_FIELD;
+                        pPortion->GetKind() = cChar ? PortionKind::TEXT : PortionKind::FIELD;
                         // If this is the first token on the line,
                         // and nTmpWidth > aPaperSize.Width, => infinite loop!
                         if ( ( nTmpWidth >= nXWidth ) && ( nTmpPortion == pLine->GetStartPortion() ) )
@@ -1181,7 +1181,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY )
             // one Non-Feature-Portion has to be wrapped
             if ( pPortion && pPortion->GetLen() > 1 )
             {
-                DBG_ASSERT( pPortion->GetKind() == PORTIONKIND_TEXT, "Len>1, but no TextPortion?" );
+                DBG_ASSERT( pPortion->GetKind() == PortionKind::TEXT, "Len>1, but no TextPortion?" );
                 nTmpWidth -= pPortion->GetSize().Width();
                 sal_Int32 nP = SplitTextPortion( pParaPortion, nTmpPos, pLine );
                 const TextPortion* p = pParaPortion->GetTextPortions()[nP];
@@ -1199,13 +1199,13 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY )
             bEOC = false;
             if( pPortion ) switch ( pPortion->GetKind() )
             {
-                case PORTIONKIND_TEXT:
+                case PortionKind::TEXT:
                 {
                     nTmpWidth -= pPortion->GetSize().Width();
                 }
                 break;
-                case PORTIONKIND_FIELD:
-                case PORTIONKIND_TAB:
+                case PortionKind::FIELD:
+                case PortionKind::TAB:
                 {
                     nTmpWidth -= pPortion->GetSize().Width();
                     bEOL = true;
@@ -1215,7 +1215,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY )
                 default:
                 {
                     //  A feature is not wrapped:
-                    DBG_ASSERT( ( pPortion->GetKind() == PORTIONKIND_LINEBREAK ), "What Feature ?" );
+                    DBG_ASSERT( ( pPortion->GetKind() == PortionKind::LINEBREAK ), "What Feature ?" );
                     bEOL = true;
                     bFixedEnd = true;
                 }
@@ -1296,7 +1296,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY )
         {
             const TextPortion* pTP = pParaPortion->GetTextPortions()[nP];
             // problem with hard font height attribute, when everything but the line break has this attribute
-            if ( pTP->GetKind() != PORTIONKIND_LINEBREAK )
+            if ( pTP->GetKind() != PortionKind::LINEBREAK )
             {
                 SeekCursor( pNode, nTPos+1, aTmpFont );
                 aTmpFont.SetPhysFont( GetRefDevice() );
@@ -1944,7 +1944,7 @@ void ImpEditEngine::ImpBreakLine( ParaPortion* pParaPortion, EditLine* pLine, Te
     if ( bCompressBlank || bHangingPunctuation )
     {
         TextPortion* const pTP = pParaPortion->GetTextPortions()[nEndPortion];
-        DBG_ASSERT( pTP->GetKind() == PORTIONKIND_TEXT, "BlankRubber: No TextPortion!" );
+        DBG_ASSERT( pTP->GetKind() == PortionKind::TEXT, "BlankRubber: No TextPortion!" );
         DBG_ASSERT( nBreakPos > pLine->GetStart(), "SplitTextPortion at the beginning of the line?" );
         sal_Int32 nPosInArray = nBreakPos - 1 - pLine->GetStart();
         pTP->GetSize().Width() = ( nPosInArray && ( pTP->GetLen() > 1 ) ) ? pLine->GetCharPosArray()[ nPosInArray-1 ] : 0;
@@ -1954,7 +1954,7 @@ void ImpEditEngine::ImpBreakLine( ParaPortion* pParaPortion, EditLine* pLine, Te
     {
         // A portion for inserting the separator ...
         TextPortion* pHyphPortion = new TextPortion( 0 );
-        pHyphPortion->GetKind() = PORTIONKIND_HYPHENATOR;
+        pHyphPortion->GetKind() = PortionKind::HYPHENATOR;
         OUString aHyphText(CH_HYPH);
         if ( (cAlternateReplChar || cAlternateExtraChar) && bAltFullRight ) // alternation after the break doesn't supported
         {
@@ -2251,7 +2251,7 @@ sal_Int32 ImpEditEngine::SplitTextPortion( ParaPortion* pPortion, sal_Int32 nPos
     if (!pTextPortion)
         return 0;
 
-    DBG_ASSERT( pTextPortion->GetKind() == PORTIONKIND_TEXT, "SplitTextPortion: No TextPortion!" );
+    DBG_ASSERT( pTextPortion->GetKind() == PortionKind::TEXT, "SplitTextPortion: No TextPortion!" );
 
     sal_Int32 nOverlapp = nTmpPos - nPos;
     pTextPortion->SetLen( pTextPortion->GetLen() - nOverlapp );
@@ -2402,7 +2402,7 @@ void ImpEditEngine::RecalcTextPortion( ParaPortion* pParaPortion, sal_Int32 nSta
                     !pParaPortion->GetTextPortions()[nNewPortionPos]->GetLen() )
             {
                 TextPortion* const pTP = pParaPortion->GetTextPortions()[nNewPortionPos];
-                DBG_ASSERT( pTP->GetKind() == PORTIONKIND_TEXT, "the empty portion was no TextPortion!" );
+                DBG_ASSERT( pTP->GetKind() == PortionKind::TEXT, "the empty portion was no TextPortion!" );
                 pTP->SetLen( pTP->GetLen() + nNewChars );
             }
             else
@@ -2451,9 +2451,9 @@ void ImpEditEngine::RecalcTextPortion( ParaPortion* pParaPortion, sal_Int32 nSta
         if ( ( nPos == nStartPos ) && ( (nPos+pTP->GetLen()) == nEnd ) )
         {
             // Remove portion;
-            sal_uInt8 nType = pTP->GetKind();
+            PortionKind nType = pTP->GetKind();
             pParaPortion->GetTextPortions().Remove( nPortion );
-            if ( nType == PORTIONKIND_LINEBREAK )
+            if ( nType == PortionKind::LINEBREAK )
             {
                 TextPortion* pNext = pParaPortion->GetTextPortions()[ nPortion ];
                 if ( pNext && !pNext->GetLen() )
@@ -2476,14 +2476,14 @@ void ImpEditEngine::RecalcTextPortion( ParaPortion* pParaPortion, sal_Int32 nSta
             // No HYPHENATOR portion is allowed to get stuck right at the end...
             sal_Int32 nLastPortion = nPortionCount - 1;
             pTP = pParaPortion->GetTextPortions()[nLastPortion];
-            if ( pTP->GetKind() == PORTIONKIND_HYPHENATOR )
+            if ( pTP->GetKind() == PortionKind::HYPHENATOR )
             {
                 // Discard portion; if possible, correct the ones before,
                 // if the Hyphenator portion has swallowed one character...
                 if ( nLastPortion && pTP->GetLen() )
                 {
                     TextPortion* pPrev = pParaPortion->GetTextPortions()[nLastPortion - 1];
-                    DBG_ASSERT( pPrev->GetKind() == PORTIONKIND_TEXT, "Portion?!" );
+                    DBG_ASSERT( pPrev->GetKind() == PortionKind::TEXT, "Portion?!" );
                     pPrev->SetLen( pPrev->GetLen() + pTP->GetLen() );
                     pPrev->GetSize().Width() = (-1);
                 }
@@ -2993,15 +2993,15 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRect, Point aSt
 
                         switch ( pTextPortion->GetKind() )
                         {
-                            case PORTIONKIND_TEXT:
-                            case PORTIONKIND_FIELD:
-                            case PORTIONKIND_HYPHENATOR:
+                            case PortionKind::TEXT:
+                            case PortionKind::FIELD:
+                            case PortionKind::HYPHENATOR:
                             {
                                 SeekCursor( pPortion->GetNode(), nIndex+1, aTmpFont, pOutDev );
 
                                 bool bDrawFrame = false;
 
-                                if ( ( pTextPortion->GetKind() == PORTIONKIND_FIELD ) && !aTmpFont.IsTransparent() &&
+                                if ( ( pTextPortion->GetKind() == PortionKind::FIELD ) && !aTmpFont.IsTransparent() &&
                                      ( GetBackgroundColor() != COL_AUTO ) && GetBackgroundColor().IsDark() &&
                                      ( IsAutoColorEnabled() && ( pOutDev->GetOutDevType() != OUTDEV_PRINTER ) ) )
                                 {
@@ -3042,7 +3042,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRect, Point aSt
                                 const long* pDXArray = 0;
                                 boost::scoped_array<long> pTmpDXArray;
 
-                                if ( pTextPortion->GetKind() == PORTIONKIND_TEXT )
+                                if ( pTextPortion->GetKind() == PortionKind::TEXT )
                                 {
                                     aText = pPortion->GetNode()->GetString();
                                     nTextStart = nIndex;
@@ -3139,7 +3139,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRect, Point aSt
                                         }
                                     }
                                 }
-                                else if ( pTextPortion->GetKind() == PORTIONKIND_FIELD )
+                                else if ( pTextPortion->GetKind() == PortionKind::FIELD )
                                 {
                                     const EditCharAttrib* pAttr = pPortion->GetNode()->GetCharAttribs().FindFeature(nIndex);
                                     DBG_ASSERT( pAttr, "Field not found");
@@ -3205,7 +3205,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRect, Point aSt
                                     }
 
                                 }
-                                else if ( pTextPortion->GetKind() == PORTIONKIND_HYPHENATOR )
+                                else if ( pTextPortion->GetKind() == PortionKind::HYPHENATOR )
                                 {
                                     if ( pTextPortion->GetExtraValue() )
                                         aText = OUString(pTextPortion->GetExtraValue());
@@ -3283,7 +3283,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRect, Point aSt
 
                                     const SvxFieldData* pFieldData = 0;
 
-                                    if(PORTIONKIND_FIELD == pTextPortion->GetKind())
+                                    if(PortionKind::FIELD == pTextPortion->GetKind())
                                     {
                                         const EditCharAttrib* pAttr = pPortion->GetNode()->GetCharAttribs().FindFeature(nIndex);
                                         const SvxFieldItem* pFieldItem = dynamic_cast<const SvxFieldItem*>(pAttr->GetItem());
@@ -3407,7 +3407,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRect, Point aSt
                                             }
                                         }
                                         Point aRealOutPos( aOutPos );
-                                        if ( ( pTextPortion->GetKind() == PORTIONKIND_TEXT )
+                                        if ( ( pTextPortion->GetKind() == PortionKind::TEXT )
                                                && pTextPortion->GetExtraInfos() && pTextPortion->GetExtraInfos()->bCompressed
                                                && pTextPortion->GetExtraInfos()->bFirstCharIsRightPunktuation )
                                         {
@@ -3438,7 +3438,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRect, Point aSt
                                         // PDF export:
                                         if ( pPDFExtOutDevData )
                                         {
-                                            if ( pTextPortion->GetKind() == PORTIONKIND_FIELD )
+                                            if ( pTextPortion->GetKind() == PortionKind::FIELD )
                                             {
                                                 const EditCharAttrib* pAttr = pPortion->GetNode()->GetCharAttribs().FindFeature(nIndex);
                                                 const SvxFieldItem* pFieldItem = dynamic_cast<const SvxFieldItem*>(pAttr->GetItem());
@@ -3486,7 +3486,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRect, Point aSt
 
                                 pTmpDXArray.reset();
 
-                                if ( pTextPortion->GetKind() == PORTIONKIND_FIELD )
+                                if ( pTextPortion->GetKind() == PortionKind::FIELD )
                                 {
                                     const EditCharAttrib* pAttr = pPortion->GetNode()->GetCharAttribs().FindFeature(nIndex);
                                     DBG_ASSERT( pAttr, "Field not found" );
@@ -3509,7 +3509,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRect, Point aSt
 
                             }
                             break;
-                            case PORTIONKIND_TAB:
+                            case PortionKind::TAB:
                             {
                                 if ( pTextPortion->GetExtraValue() && ( pTextPortion->GetExtraValue() != ' ' ) )
                                 {
@@ -3574,6 +3574,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRect, Point aSt
                                 }
                             }
                             break;
+                            case PortionKind::LINEBREAK: break;
                         }
                         if( bParsingFields )
                             nPortion--;
@@ -4527,7 +4528,7 @@ void ImpEditEngine::ImplExpandCompressedPortions( EditLine* pLine, ParaPortion*
 
     sal_Int32 nPortion = pLine->GetEndPortion();
     TextPortion* pTP = pParaPortion->GetTextPortions()[ nPortion ];
-    while ( pTP && ( pTP->GetKind() == PORTIONKIND_TEXT ) )
+    while ( pTP && ( pTP->GetKind() == PortionKind::TEXT ) )
     {
         if ( pTP->GetExtraInfos() && pTP->GetExtraInfos()->bCompressed )
         {


More information about the Libreoffice-commits mailing list