[Libreoffice-commits] core.git: 3 commits - sc/inc sc/source
Eike Rathke
erack at redhat.com
Fri Dec 13 12:15:11 PST 2013
sc/inc/table.hxx | 2 -
sc/source/core/data/table2.cxx | 9 ----
sc/source/ui/Accessibility/AccessibleTableBase.cxx | 38 ++++++++++++++-------
3 files changed, 26 insertions(+), 23 deletions(-)
New commits:
commit c16ec3067e96fe0a53ae56d118e85dda4831f88b
Author: Eike Rathke <erack at redhat.com>
Date: Fri Dec 13 21:13:12 2013 +0100
there is no need to expose an ScColumn*, and always check for validity
Change-Id: Id7f4f180083ec61a98cc93dd7c41b66cbac28953
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 1a84fce..f07e8d4 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -1068,8 +1068,6 @@ private:
SCROW mnUBound;
};
-public :
- ScColumn* GetColumnByIndex( sal_Int32 nIndex );
};
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index e4b9ea6..30771ab 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -3654,13 +3654,4 @@ sal_uLong ScTable::GetColOffset( SCCOL nCol, bool bHiddenAsZero ) const
return n;
}
-ScColumn* ScTable::GetColumnByIndex( sal_Int32 nIndex )
-{
- if (ValidCol(nIndex))
- {
- return &(aCol[nIndex]);
- }
- return NULL;
-}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/Accessibility/AccessibleTableBase.cxx b/sc/source/ui/Accessibility/AccessibleTableBase.cxx
index 9ce33be..9963e34 100644
--- a/sc/source/ui/Accessibility/AccessibleTableBase.cxx
+++ b/sc/source/ui/Accessibility/AccessibleTableBase.cxx
@@ -146,12 +146,19 @@ sal_Int32 SAL_CALL ScAccessibleTableBase::getAccessibleRowExtentAt( sal_Int32 nR
if (mpDoc)
{
- SCROW nEndRow(0);
- SCCOL nEndCol(0);
- mpDoc->FetchTable(maRange.aStart.Tab())->GetColumnByIndex(nColumn)->
- ExtendMerge( static_cast<SCCOL>(nColumn), static_cast<SCROW>(nRow), nRow, nEndCol, nEndRow, sal_False );
- if (nEndRow > nRow)
- nCount = nEndRow - nRow + 1;
+ ScTable* pTab = mpDoc->FetchTable(maRange.aStart.Tab());
+ if (pTab)
+ {
+ SCROW nStartRow = static_cast<SCROW>(nRow);
+ SCROW nEndRow = nStartRow;
+ SCCOL nStartCol = static_cast<SCCOL>(nColumn);
+ SCCOL nEndCol = nStartCol;
+ if (pTab->ExtendMerge( nStartCol, nStartRow, nEndCol, nEndRow, false))
+ {
+ if (nEndRow > nStartRow)
+ nCount = nEndRow - nStartRow + 1;
+ }
+ }
}
return nCount;
@@ -173,12 +180,19 @@ sal_Int32 SAL_CALL ScAccessibleTableBase::getAccessibleColumnExtentAt( sal_Int32
if (mpDoc)
{
- SCROW nEndRow(0);
- SCCOL nEndCol(0);
- mpDoc->FetchTable(maRange.aStart.Tab())->GetColumnByIndex(nColumn)->
- ExtendMerge( static_cast<SCCOL>(nColumn), static_cast<SCROW>(nRow), nRow, nEndCol, nEndRow, sal_False );
- if (nEndCol > nColumn)
- nCount = nEndCol - nColumn + 1;
+ ScTable* pTab = mpDoc->FetchTable(maRange.aStart.Tab());
+ if (pTab)
+ {
+ SCROW nStartRow = static_cast<SCROW>(nRow);
+ SCROW nEndRow = nStartRow;
+ SCCOL nStartCol = static_cast<SCCOL>(nColumn);
+ SCCOL nEndCol = nStartCol;
+ if (pTab->ExtendMerge( nStartCol, nStartRow, nEndCol, nEndRow, false))
+ {
+ if (nEndCol > nStartCol)
+ nCount = nEndCol - nStartCol + 1;
+ }
+ }
}
return nCount;
commit ffb8b734c0654c3e1d7d2acb01d5ea00400b1b68
Author: Eike Rathke <erack at redhat.com>
Date: Fri Dec 13 20:18:17 2013 +0100
how about style?
Change-Id: I2b53f87f0bf0838c0ef61c3b31408643ae4a0fc3
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index f29e7f9..1a84fce 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -1069,7 +1069,7 @@ private:
};
public :
- ScColumn* GetColumnByIndex(sal_Int32 index);
+ ScColumn* GetColumnByIndex( sal_Int32 nIndex );
};
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index cc7b435..e4b9ea6 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -3654,11 +3654,11 @@ sal_uLong ScTable::GetColOffset( SCCOL nCol, bool bHiddenAsZero ) const
return n;
}
-ScColumn* ScTable::GetColumnByIndex(sal_Int32 index)
+ScColumn* ScTable::GetColumnByIndex( sal_Int32 nIndex )
{
- if (ValidCol(index))
+ if (ValidCol(nIndex))
{
- return &(aCol[index]);
+ return &(aCol[nIndex]);
}
return NULL;
}
commit b51b34ca82411d91e300107b0fca9041ba806366
Author: Eike Rathke <erack at redhat.com>
Date: Fri Dec 13 20:09:48 2013 +0100
we do have ValidCol(), so use it
Change-Id: I50d39f7022edcf851f299fc3589e43bf95f682b5
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index 87e4832..cc7b435 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -3656,7 +3656,7 @@ sal_uLong ScTable::GetColOffset( SCCOL nCol, bool bHiddenAsZero ) const
ScColumn* ScTable::GetColumnByIndex(sal_Int32 index)
{
- if( index <= MAXCOL && index >= 0 )
+ if (ValidCol(index))
{
return &(aCol[index]);
}
More information about the Libreoffice-commits
mailing list