[Libreoffice-commits] .: sw/source

Miklos Vajna vmiklos at kemper.freedesktop.org
Mon Aug 1 13:09:15 PDT 2011


 sw/source/filter/ww8/WW8TableInfo.cxx |  103 ++++++++++++++++++++++++++++++++++
 sw/source/filter/ww8/WW8TableInfo.hxx |    4 +
 2 files changed, 107 insertions(+)

New commits:
commit aa3a17653bcc049edd5764f3ec18ba78ba697a9c
Author: Miklos Vajna <vmiklos at frugalware.org>
Date:   Mon Aug 1 22:05:05 2011 +0200

    Partially revert "Removed dead code"
    
    This partially reverts commit 1e2c9be36ba9f94a27b3aa73c87ceb3d52e100dc,
    CellInfo::toString and WW8TableCellGrid::toString is still needed with
    dbglevel>1.

diff --git a/sw/source/filter/ww8/WW8TableInfo.cxx b/sw/source/filter/ww8/WW8TableInfo.cxx
index 4e449e6..2883e98 100644
--- a/sw/source/filter/ww8/WW8TableInfo.cxx
+++ b/sw/source/filter/ww8/WW8TableInfo.cxx
@@ -1014,6 +1014,27 @@ bool CellInfo::operator < (const CellInfo & aCellInfo) const
     return aRet;
 }
 
+#if OSL_DEBUG_LEVEL > 1
+::std::string CellInfo::toString() const
+{
+    static char sBuffer[256];
+
+    snprintf(sBuffer, sizeof(sBuffer),
+             "<cellinfo left=\"%ld\""
+             " right=\"%ld\""
+             " top=\"%ld\""
+             " bottom=\"%ld\""
+             " node=\"%p\"/>",
+             left(),
+             right(),
+             top(),
+             bottom(),
+             m_pNodeInfo);
+
+    return sBuffer;
+}
+#endif
+
 WW8TableNodeInfo * WW8TableInfo::reorderByLayout(const SwTable * pTable)
 {
     WW8TableNodeInfo * pPrev = NULL;
@@ -1280,6 +1301,88 @@ WW8TableNodeInfo * WW8TableCellGrid::connectCells()
     return pLastNodeInfo;
 }
 
+#if OSL_DEBUG_LEVEL > 1
+string WW8TableCellGrid::toString()
+{
+    string sResult = "<WW8TableCellGrid>";
+
+    RowTops_t::const_iterator aTopsIt = getRowTopsBegin();
+    static char sBuffer[1024];
+    while (aTopsIt != getRowTopsEnd())
+    {
+        sprintf(sBuffer, "<row y=\"%ld\">", *aTopsIt);
+        sResult += sBuffer;
+
+        CellInfoMultiSet::const_iterator aCellIt = getCellsBegin(*aTopsIt);
+        CellInfoMultiSet::const_iterator aCellsEnd = getCellsEnd(*aTopsIt);
+
+        while (aCellIt != aCellsEnd)
+        {
+            snprintf(sBuffer, sizeof(sBuffer), "<cellInfo top=\"%ld\" bottom=\"%ld\" left=\"%ld\" right=\"%ld\">",
+                     aCellIt->top(), aCellIt->bottom(), aCellIt->left(), aCellIt->right());
+            sResult += sBuffer;
+
+            WW8TableNodeInfo * pInfo = aCellIt->getTableNodeInfo();
+            if (pInfo != NULL)
+                sResult += pInfo->toString();
+            else
+                sResult += "<shadow/>\n";
+
+            sResult += "</cellInfo>\n";
+            ++aCellIt;
+        }
+
+        WW8TableCellGridRow::Pointer_t pRow = getRow(*aTopsIt);
+        WidthsPtr pWidths = pRow->getWidths();
+        if (pWidths != NULL)
+        {
+            sResult += "<widths>";
+
+            Widths::const_iterator aItEnd = pWidths->end();
+            for (Widths::const_iterator aIt = pWidths->begin();
+                 aIt != aItEnd;
+                 ++aIt)
+            {
+                if (aIt != pWidths->begin())
+                    sResult += ", ";
+
+                snprintf(sBuffer, sizeof(sBuffer), "%" SAL_PRIxUINT32 "", *aIt);
+                sResult += sBuffer;
+            }
+
+            sResult += "</widths>";
+        }
+
+        RowSpansPtr pRowSpans = pRow->getRowSpans();
+        if (pRowSpans.get() != NULL)
+        {
+            sResult += "<rowspans>";
+
+            RowSpans::const_iterator aItEnd = pRowSpans->end();
+            for (RowSpans::const_iterator aIt = pRowSpans->begin();
+                 aIt != aItEnd;
+                 ++aIt)
+            {
+                if (aIt != pRowSpans->begin())
+                    sResult += ", ";
+
+                snprintf(sBuffer, sizeof(sBuffer), "%" SAL_PRIxUINT32 "", *aIt);
+                sResult += sBuffer;
+            }
+
+            sResult += "</rowspans>";
+        }
+
+        sResult += "</row>\n";
+        ++aTopsIt;
+    }
+
+    sResult += "</WW8TableCellGrid>\n";
+
+    return sResult;
+}
+#endif
+
 TableBoxVectorPtr WW8TableCellGrid::getTableBoxesOfRow
 (WW8TableNodeInfoInner * pNodeInfoInner)
 {
diff --git a/sw/source/filter/ww8/WW8TableInfo.hxx b/sw/source/filter/ww8/WW8TableInfo.hxx
index 3979db3..96baf31 100644
--- a/sw/source/filter/ww8/WW8TableInfo.hxx
+++ b/sw/source/filter/ww8/WW8TableInfo.hxx
@@ -246,7 +246,9 @@ public:
     void addShadowCells();
     WW8TableNodeInfo * connectCells();
 
+#if OSL_DEBUG_LEVEL > 1
     string toString();
+#endif
 
     TableBoxVectorPtr getTableBoxesOfRow(WW8TableNodeInfoInner * pNodeInfo);
     WidthsPtr getWidthsOfRow(WW8TableNodeInfoInner * pNodeInfo);
@@ -352,7 +354,9 @@ public:
         m_nFmtFrmWidth = nFmtFrmWidth;
     }
 
+#if OSL_DEBUG_LEVEL > 1
     ::std::string toString() const;
+#endif
 };
 
 }


More information about the Libreoffice-commits mailing list