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

Tomaž Vajngerl (via logerrit) logerrit at kemper.freedesktop.org
Thu Jun 3 08:05:17 UTC 2021


 sw/source/filter/html/htmlcss1.cxx |   18 ++---
 sw/source/filter/html/htmlctxt.cxx |    8 +-
 sw/source/filter/html/htmlfld.cxx  |    4 -
 sw/source/filter/html/htmlgrin.cxx |    6 -
 sw/source/filter/html/swhtml.cxx   |   46 +++++++--------
 sw/source/filter/html/swhtml.hxx   |  112 ++++++++++++++++++-------------------
 6 files changed, 97 insertions(+), 97 deletions(-)

New commits:
commit 91c23f55bb795156c2ea3b2c4458e70758a425c4
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Mon May 24 21:08:56 2021 +0900
Commit:     Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Thu Jun 3 10:04:33 2021 +0200

    sw: rename some variable/method names in html import/export
    
    Rename to "default" instead of "dflt", "start" instead of "stt",
    "content" instead of "cnt",....
    
    The shorter names are a product of utter laziness.
    
    Change-Id: I5f5c8f6504e788395db495c000c098401767f8a0
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116628
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>

diff --git a/sw/source/filter/html/htmlcss1.cxx b/sw/source/filter/html/htmlcss1.cxx
index 3f06fd00321b..b33ee8bdd3e0 100644
--- a/sw/source/filter/html/htmlcss1.cxx
+++ b/sw/source/filter/html/htmlcss1.cxx
@@ -2196,8 +2196,8 @@ void SwHTMLParser::GetMarginsFromContextWithNumberBullet( sal_uInt16& nLeft,
 void SwHTMLParser::GetULSpaceFromContext( sal_uInt16& nUpper,
                                           sal_uInt16& nLower ) const
 {
-    sal_uInt16 nDfltColl = 0;
-    OUString aDfltClass;
+    sal_uInt16 nDefaultColl = 0;
+    OUString aDefaultClass;
 
     HTMLAttrContexts::size_type nPos = m_aContexts.size();
     while( nPos > m_nContextStAttrMin )
@@ -2208,19 +2208,19 @@ void SwHTMLParser::GetULSpaceFromContext( sal_uInt16& nUpper,
             pCntxt->GetULSpace( nUpper, nLower );
             return;
         }
-        else if( !nDfltColl )
+        else if (!nDefaultColl)
         {
-            nDfltColl = pCntxt->GetDfltTextFormatColl();
-            if( nDfltColl )
-                aDfltClass = pCntxt->GetClass();
+            nDefaultColl = pCntxt->GetDefaultTextFormatColl();
+            if (nDefaultColl)
+                aDefaultClass = pCntxt->GetClass();
         }
     }
 
-    if( !nDfltColl )
-        nDfltColl = RES_POOLCOLL_TEXT;
+    if (!nDefaultColl)
+        nDefaultColl = RES_POOLCOLL_TEXT;
 
     const SwTextFormatColl *pColl =
-        m_pCSS1Parser->GetTextFormatColl( nDfltColl, aDfltClass );
+        m_pCSS1Parser->GetTextFormatColl(nDefaultColl, aDefaultClass);
     const SvxULSpaceItem& rULSpace = pColl->GetULSpace();
     nUpper = rULSpace.GetUpper();
     nLower = rULSpace.GetLower();
diff --git a/sw/source/filter/html/htmlctxt.cxx b/sw/source/filter/html/htmlctxt.cxx
index 6be3cab727d1..1769b600f1e0 100644
--- a/sw/source/filter/html/htmlctxt.cxx
+++ b/sw/source/filter/html/htmlctxt.cxx
@@ -200,7 +200,7 @@ void SwHTMLParser::SplitAttrTab( const SwPosition& rNewPos )
 
             sal_uInt16 nWhich = pAttr->m_pItem->Which();
             if( !nOldEndCnt && RES_PARATR_BEGIN <= nWhich &&
-                pAttr->GetSttParaIdx() < pOldEndPara->GetIndex() )
+                pAttr->GetStartParagraphIdx() < pOldEndPara->GetIndex() )
             {
                 // The attribute needs to be closed one content position beforehand
                 if( !bMoveBack )
@@ -217,9 +217,9 @@ void SwHTMLParser::SplitAttrTab( const SwPosition& rNewPos )
             }
 
             if( (RES_PARATR_BEGIN <= nWhich && bMoveBack) ||
-                pAttr->GetSttParaIdx() < pOldEndPara->GetIndex() ||
-                (pAttr->GetSttPara() == *pOldEndPara &&
-                 pAttr->GetSttCnt() != nOldEndCnt) )
+                pAttr->GetStartParagraphIdx() < pOldEndPara->GetIndex() ||
+                (pAttr->GetStartParagraph() == *pOldEndPara &&
+                 pAttr->GetStartContent() != nOldEndCnt) )
             {
                 // The attribute needs to be set. Because we still need the original, since
                 // pointers to the attribute still exists in the contexts, we need to clone it.
diff --git a/sw/source/filter/html/htmlfld.cxx b/sw/source/filter/html/htmlfld.cxx
index 5986a93f1ffb..92163ba4ec0c 100644
--- a/sw/source/filter/html/htmlfld.cxx
+++ b/sw/source/filter/html/htmlfld.cxx
@@ -621,8 +621,8 @@ void SwHTMLParser::InsertComment( const OUString& rComment, const char *pTag )
         for( auto i = m_aSetAttrTab.size(); i > 0; )
         {
             HTMLAttr *pAttr = m_aSetAttrTab[--i];
-            if( pAttr->GetSttParaIdx() != nNodeIdx ||
-                pAttr->GetSttCnt() != nIdx )
+            if( pAttr->GetStartParagraphIdx() != nNodeIdx ||
+                pAttr->GetStartContent() != nIdx )
                 break;
 
             if( RES_TXTATR_FIELD == pAttr->m_pItem->Which() &&
diff --git a/sw/source/filter/html/htmlgrin.cxx b/sw/source/filter/html/htmlgrin.cxx
index e52da66d701f..2cdaceda437b 100644
--- a/sw/source/filter/html/htmlgrin.cxx
+++ b/sw/source/filter/html/htmlgrin.cxx
@@ -844,9 +844,9 @@ IMAGE_SETEVENT:
         }
 
         if ((RndStdIds::FLY_AS_CHAR == pFlyFormat->GetAnchor().GetAnchorId()) &&
-            m_xAttrTab->pINetFormat->GetSttPara() ==
+            m_xAttrTab->pINetFormat->GetStartParagraph() ==
                         m_pPam->GetPoint()->nNode &&
-            m_xAttrTab->pINetFormat->GetSttCnt() ==
+            m_xAttrTab->pINetFormat->GetStartContent() ==
                         m_pPam->GetPoint()->nContent.GetIndex() - 1 )
         {
             // the attribute was insert right before as-character anchored
@@ -1369,7 +1369,7 @@ bool SwHTMLParser::HasCurrentParaBookmarks( bool bIgnoreStack ) const
             HTMLAttr* pAttr = m_aSetAttrTab[ --i ];
             if( RES_FLTR_BOOKMARK == pAttr->m_pItem->Which() )
             {
-                if( pAttr->GetSttParaIdx() == nNodeIdx )
+                if( pAttr->GetStartParagraphIdx() == nNodeIdx )
                     bHasMarks = true;
                 break;
             }
diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx
index ff7c32b44005..beedbf13bbb7 100644
--- a/sw/source/filter/html/swhtml.cxx
+++ b/sw/source/filter/html/swhtml.cxx
@@ -2217,14 +2217,14 @@ bool SwHTMLParser::AppendTextNode( SwHTMLAppendMode eMode, bool bUpdateNum )
             while( pAttr )
             {
                 HTMLAttr *pNext = pAttr->GetNext();
-                if( pAttr->GetSttParaIdx() < rEndIdx.GetIndex() ||
+                if( pAttr->GetStartParagraphIdx() < rEndIdx.GetIndex() ||
                     (!bWholePara &&
-                     pAttr->GetSttPara() == rEndIdx &&
-                     pAttr->GetSttCnt() != nEndCnt) )
+                     pAttr->GetStartParagraph() == rEndIdx &&
+                     pAttr->GetStartContent() != nEndCnt) )
                 {
                     bWholePara =
-                        pAttr->GetSttPara() == rEndIdx &&
-                        pAttr->GetSttCnt() == 0;
+                        pAttr->GetStartParagraph() == rEndIdx &&
+                        pAttr->GetStartContent() == 0;
 
                     sal_Int32 nStt = pAttr->m_nStartContent;
                     bool bScript = false;
@@ -2236,14 +2236,14 @@ bool SwHTMLParser::AppendTextNode( SwHTMLAppendMode eMode, bool bUpdateNum )
                     if( bScript )
                     {
                         const SwTextNode *pTextNd =
-                            pAttr->GetSttPara().GetNode().GetTextNode();
+                            pAttr->GetStartParagraph().GetNode().GetTextNode();
                         OSL_ENSURE( pTextNd, "No text node" );
                         if( pTextNd )
                         {
                             const OUString& rText = pTextNd->GetText();
                             sal_uInt16 nScriptText =
                                 g_pBreakIt->GetBreakIter()->getScriptType(
-                                            rText, pAttr->GetSttCnt() );
+                                            rText, pAttr->GetStartContent() );
                             sal_Int32 nScriptEnd = g_pBreakIt->GetBreakIter()
                                     ->endOfScript( rText, nStt, nScriptText );
                             while (nScriptEnd < nEndCnt && nScriptEnd != -1)
@@ -2723,7 +2723,7 @@ void SwHTMLParser::SetAttr_( bool bChkEnd, bool bBeforeTable,
         pAttr = m_aSetAttrTab[ --n ];
         sal_uInt16 nWhich = pAttr->m_pItem->Which();
 
-        sal_uLong nEndParaIdx = pAttr->GetEndParaIdx();
+        sal_uLong nEndParaIdx = pAttr->GetEndParagraphIdx();
         bool bSetAttr;
         if( bChkEnd )
         {
@@ -2737,11 +2737,11 @@ void SwHTMLParser::SetAttr_( bool bChkEnd, bool bBeforeTable,
                          (RES_LR_SPACE != nWhich || !GetNumInfo().GetNumRule()) ) ||
                        ( !pAttr->IsLikePara() &&
                          nEndParaIdx == rEndIdx.GetIndex() &&
-                         pAttr->GetEndCnt() < nEndCnt &&
+                         pAttr->GetEndContent() < nEndCnt &&
                          (isCHRATR(nWhich) || isTXTATR_WITHEND(nWhich)) ) ||
                        ( bBeforeTable &&
                          nEndParaIdx == rEndIdx.GetIndex() &&
-                         !pAttr->GetEndCnt() );
+                         !pAttr->GetEndContent() );
         }
         else
         {
@@ -2783,7 +2783,7 @@ void SwHTMLParser::SetAttr_( bool bChkEnd, bool bBeforeTable,
                 {
                     // because of the awful deleting of nodes an index can also
                     // point to an end node :-(
-                    if ( (pAttr->GetSttPara() == pAttr->GetEndPara()) &&
+                    if ( (pAttr->GetStartParagraph() == pAttr->GetEndParagraph()) &&
                          !isTXTATR_NOEND(nWhich) )
                     {
                         // when the end index also points to the node, we don't
@@ -2812,7 +2812,7 @@ void SwHTMLParser::SetAttr_( bool bChkEnd, bool bBeforeTable,
                 aAttrPam.GetPoint()->nContent.Assign( pCNd, pAttr->m_nStartContent );
 
                 aAttrPam.SetMark();
-                if ( (pAttr->GetSttPara() != pAttr->GetEndPara()) &&
+                if ( (pAttr->GetStartParagraph() != pAttr->GetEndParagraph()) &&
                          !isTXTATR_NOEND(nWhich) )
                 {
                     pCNd = pAttr->m_nEndPara.GetNode().GetContentNode();
@@ -3096,7 +3096,7 @@ bool SwHTMLParser::EndAttr( HTMLAttr* pAttr, bool bChkEmpty )
     bool bMoveBack = false;
     sal_uInt16 nWhich = pAttr->m_pItem->Which();
     if( !nEndCnt && RES_PARATR_BEGIN <= nWhich &&
-        *pEndIdx != pAttr->GetSttPara() )
+        *pEndIdx != pAttr->GetStartParagraph() )
     {
         // Then move back one position in the content!
         bMoveBack = m_pPam->Move( fnMoveBackward );
@@ -3112,12 +3112,12 @@ bool SwHTMLParser::EndAttr( HTMLAttr* pAttr, bool bChkEmpty )
     // does it have a non-empty range?
     if( !bChkEmpty || (RES_PARATR_BEGIN <= nWhich && bMoveBack) ||
         RES_PAGEDESC == nWhich || RES_BREAK == nWhich ||
-        *pEndIdx != pAttr->GetSttPara() ||
-        nEndCnt != pAttr->GetSttCnt() )
+        *pEndIdx != pAttr->GetStartParagraph() ||
+        nEndCnt != pAttr->GetStartContent() )
     {
         bInsert = true;
         // We do some optimization for script dependent attributes here.
-        if( *pEndIdx == pAttr->GetSttPara() )
+        if( *pEndIdx == pAttr->GetStartParagraph() )
         {
             lcl_swhtml_getItemInfo( *pAttr, bScript, nScriptItem );
         }
@@ -3128,16 +3128,16 @@ bool SwHTMLParser::EndAttr( HTMLAttr* pAttr, bool bChkEmpty )
     }
 
     const SwTextNode *pTextNd = (bInsert && bScript) ?
-        pAttr->GetSttPara().GetNode().GetTextNode() :
+        pAttr->GetStartParagraph().GetNode().GetTextNode() :
         nullptr;
 
     if (pTextNd)
     {
         const OUString& rText = pTextNd->GetText();
         sal_uInt16 nScriptText = g_pBreakIt->GetBreakIter()->getScriptType(
-                        rText, pAttr->GetSttCnt() );
+                        rText, pAttr->GetStartContent() );
         sal_Int32 nScriptEnd = g_pBreakIt->GetBreakIter()
-                    ->endOfScript( rText, pAttr->GetSttCnt(), nScriptText );
+                    ->endOfScript( rText, pAttr->GetStartContent(), nScriptText );
         while (nScriptEnd < nEndCnt && nScriptEnd != -1)
         {
             if( nScriptItem == nScriptText )
@@ -3355,9 +3355,9 @@ void SwHTMLParser::SplitAttrTab( std::shared_ptr<HTMLAttrTable> const & rNewAttr
             HTMLAttr *pPrev = pAttr->GetPrev();
 
             if( bSetAttr &&
-                ( pAttr->GetSttParaIdx() < nEndIdx.GetIndex() ||
-                  (pAttr->GetSttPara() == nEndIdx &&
-                   pAttr->GetSttCnt() != nEndCnt) ) )
+                ( pAttr->GetStartParagraphIdx() < nEndIdx.GetIndex() ||
+                  (pAttr->GetStartParagraph() == nEndIdx &&
+                   pAttr->GetStartContent() != nEndCnt) ) )
             {
                 // The attribute must be set before the list. We need the
                 // original and therefore we clone it, because pointer to the
@@ -4673,7 +4673,7 @@ void SwHTMLParser::SetTextCollAttrs( HTMLAttrContext *pContext )
         else
         {
             // Maybe a default style exists?
-            nColl = pCntxt->GetDfltTextFormatColl();
+            nColl = pCntxt->GetDefaultTextFormatColl();
             if( nColl )
                 nDfltColl = nColl;
         }
diff --git a/sw/source/filter/html/swhtml.hxx b/sw/source/filter/html/swhtml.hxx
index 2c365c09dfb4..3e3b693eb5a8 100644
--- a/sw/source/filter/html/swhtml.hxx
+++ b/sw/source/filter/html/swhtml.hxx
@@ -78,51 +78,49 @@ typedef std::deque<HTMLAttr *> HTMLAttrs;
 // beginning of the table will set first in EndAllAttrs.
 struct HTMLAttrTable
 {
-    HTMLAttr
-                *pKeep,         // frame attributes
-                *pBox,
-                *pBrush,
-                *pBreak,
-                *pPageDesc,
-
-                *pLRSpace,      // paragraph attributes
-                *pULSpace,
-                *pLineSpacing,
-                *pAdjust,
-                *pDropCap,
-                *pSplit,
-                *pWidows,
-                *pOrphans,
-                *pDirection,
-
-                *pCharFormats,     // text attributes
-                *pINetFormat,
-
-                *pBold,         // character attributes
-                *pBoldCJK,
-                *pBoldCTL,
-                *pItalic,
-                *pItalicCJK,
-                *pItalicCTL,
-                *pStrike,
-                *pUnderline,
-                *pBlink,
-                *pFont,
-                *pFontCJK,
-                *pFontCTL,
-                *pFontHeight,
-                *pFontHeightCJK,
-                *pFontHeightCTL,
-                *pFontColor,
-                *pEscapement,
-                *pCaseMap,
-                *pKerning,      // (only for SPACER)
-                *pCharBrush,    // character background
-                *pLanguage,
-                *pLanguageCJK,
-                *pLanguageCTL,
-                *pCharBox
-                ;
+    HTMLAttr* pKeep; // frame attributes
+    HTMLAttr* pBox;
+    HTMLAttr* pBrush;
+    HTMLAttr* pBreak;
+    HTMLAttr* pPageDesc;
+
+    HTMLAttr* pLRSpace; // paragraph attributes
+    HTMLAttr* pULSpace;
+    HTMLAttr* pLineSpacing;
+    HTMLAttr* pAdjust;
+    HTMLAttr* pDropCap;
+    HTMLAttr* pSplit;
+    HTMLAttr* pWidows;
+    HTMLAttr* pOrphans;
+    HTMLAttr* pDirection;
+
+    HTMLAttr* pCharFormats; // text attributes
+    HTMLAttr* pINetFormat;
+
+    HTMLAttr* pBold; // character attributes
+    HTMLAttr* pBoldCJK;
+    HTMLAttr* pBoldCTL;
+    HTMLAttr* pItalic;
+    HTMLAttr* pItalicCJK;
+    HTMLAttr* pItalicCTL;
+    HTMLAttr* pStrike;
+    HTMLAttr* pUnderline;
+    HTMLAttr* pBlink;
+    HTMLAttr* pFont;
+    HTMLAttr* pFontCJK;
+    HTMLAttr* pFontCTL;
+    HTMLAttr* pFontHeight;
+    HTMLAttr* pFontHeightCJK;
+    HTMLAttr* pFontHeightCTL;
+    HTMLAttr* pFontColor;
+    HTMLAttr* pEscapement;
+    HTMLAttr* pCaseMap;
+    HTMLAttr* pKerning; // (only for SPACER)
+    HTMLAttr* pCharBrush; // character background
+    HTMLAttr* pLanguage;
+    HTMLAttr* pLanguageCJK;
+    HTMLAttr* pLanguageCTL;
+    HTMLAttr* pCharBox;
 };
 
 class HTMLAttr
@@ -130,8 +128,10 @@ class HTMLAttr
     friend class SwHTMLParser;
     friend class CellSaveStruct;
 
-    SwNodeIndex m_nStartPara, m_nEndPara;
-    sal_Int32 m_nStartContent, m_nEndContent;
+    SwNodeIndex m_nStartPara;
+    SwNodeIndex m_nEndPara;
+    sal_Int32 m_nStartContent;
+    sal_Int32 m_nEndContent;
     bool m_bInsAtStart : 1;
     bool m_bLikePara : 1; // set attribute above the whole paragraph
     bool m_bValid : 1;    // is the attribute valid?
@@ -157,14 +157,14 @@ public:
                 HTMLAttr **pHd, const std::shared_ptr<HTMLAttrTable>& rAttrTab );
     inline void SetStart( const SwPosition& rPos );
 
-    sal_uInt32 GetSttParaIdx() const { return m_nStartPara.GetIndex(); }
-    sal_uInt32 GetEndParaIdx() const { return m_nEndPara.GetIndex(); }
+    sal_uInt32 GetStartParagraphIdx() const { return m_nStartPara.GetIndex(); }
+    sal_uInt32 GetEndParagraphIdx() const { return m_nEndPara.GetIndex(); }
 
-    const SwNodeIndex& GetSttPara() const { return m_nStartPara; }
-    const SwNodeIndex& GetEndPara() const { return m_nEndPara; }
+    const SwNodeIndex& GetStartParagraph() const { return m_nStartPara; }
+    const SwNodeIndex& GetEndParagraph() const { return m_nEndPara; }
 
-    sal_Int32 GetSttCnt() const { return m_nStartContent; }
-    sal_Int32 GetEndCnt() const { return m_nEndContent; }
+    sal_Int32 GetStartContent() const { return m_nStartContent; }
+    sal_Int32 GetEndContent() const { return m_nEndContent; }
 
     bool IsLikePara() const { return m_bLikePara; }
     void SetLikePara() { m_bLikePara = true; }
@@ -211,9 +211,9 @@ class HTMLAttrContext
     std::unique_ptr<HTMLAttrContext_SaveDoc> m_pSaveDocContext;
     std::unique_ptr<SfxItemSet> m_pFrameItemSet;
 
-    HtmlTokenId m_nToken;         // the token of the context
+    HtmlTokenId m_nToken;  // the token of the context
 
-    sal_uInt16  m_nTextFormatColl;    // a style created in the context or zero
+    sal_uInt16  m_nTextFormatColl; // a style created in the context or zero
 
     sal_uInt16  m_nLeftMargin;        // a changed left border
     sal_uInt16  m_nRightMargin;       // a changed right border
@@ -248,7 +248,7 @@ public:
     HtmlTokenId GetToken() const { return m_nToken; }
 
     sal_uInt16 GetTextFormatColl() const { return m_bDefaultTextFormatColl ? 0 : m_nTextFormatColl; }
-    sal_uInt16 GetDfltTextFormatColl() const { return m_bDefaultTextFormatColl ? m_nTextFormatColl : 0; }
+    sal_uInt16 GetDefaultTextFormatColl() const { return m_bDefaultTextFormatColl ? m_nTextFormatColl : 0; }
 
     const OUString& GetClass() const { return m_aClass; }
 


More information about the Libreoffice-commits mailing list