[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/work/koffice-essen/filters/libmsooxml
From:       Carlos Licea <carlos_licea () hotmail ! com>
Date:       2010-11-16 5:31:33
Message-ID: 20101116053133.9DA4FAC8AB () svn ! kde ! org
[Download RAW message or body]

SVN commit 1197578 by clicea:

Don't overuse references.
Calculate the last column and row only once.

 M  +7 -4      MsooXmlDrawingTableStyle.cpp  


--- branches/work/koffice-essen/filters/libmsooxml/MsooXmlDrawingTableStyle.cpp \
#1197577:1197578 @@ -81,8 +81,8 @@
     //See MSOOXML Table Styles  §17.7.6 for details
 
      const TableStyleInstanceProperties::Roles& role = m_properties.m_role;
-     const int& lastRow = m_properties.m_rowCount - 1 ;
-     const int& lastColumn = m_properties.m_columnCount - 1 ;
+     const int lastRow = m_properties.m_rowCount - 1 ;
+     const int lastColumn = m_properties.m_columnCount - 1 ;
 
     applyStyle(TableStyle::WholeTbl, cellStyle, row, column);
 
@@ -170,6 +170,9 @@
 
 void TableStyleInstance::applyBordersStyle(TableStyle::Type type, KoCellStyle::Ptr& \
style, int row, int column)  {
+    const int lastRow = m_properties.m_rowCount - 1;
+    const int lastColumn = m_properties.m_columnCount - 1;
+
     //Borders, are a bit tricky too; we have to take into account whether the cell 
     //has borders facing other cells or facing the border of the table.
 
@@ -186,7 +189,7 @@
     style->borders()->setTopBorderWidth(topData->width);
 
     KoBorder::BorderData* bottomData;
-    if(row == m_properties.m_rowCount - 1) {
+    if(row == lastRow) {
         bottomData = &m_style->properties(type)->bottom;
     }
     else {
@@ -210,7 +213,7 @@
     style->borders()->setLeftBorderWidth(leftData->width);
 
     KoBorder::BorderData* rightData;
-    if(column == m_properties.m_columnCount - 1) {
+    if(column == lastColumn) {
         rightData = &m_style->properties(type)->right;
     }
     else {


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic