summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Bankston <daniel.e.bankston@gmail.com>2012-06-01 00:52:51 -0500
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2012-06-17 17:04:00 +0200
commitc2e3aeab181b5b92faed77518d6a428ecd2c2969 (patch)
tree2f57a67c9316296fe3d74f4f44b52dd342a317c0
parent153275bacbab37d4b3ab2dbef8c5e32626f705c6 (diff)
Convert GetRealCellPos and calls to use ScAddress
Change-Id: Ic7a6ad82b5b4938ef67ddf8e62372635044cd5b2
-rw-r--r--sc/source/filter/xml/XMLDetectiveContext.cxx2
-rw-r--r--sc/source/filter/xml/xmlcelli.cxx28
-rw-r--r--sc/source/filter/xml/xmlsubti.cxx61
-rw-r--r--sc/source/filter/xml/xmlsubti.hxx2
4 files changed, 53 insertions, 40 deletions
diff --git a/sc/source/filter/xml/XMLDetectiveContext.cxx b/sc/source/filter/xml/XMLDetectiveContext.cxx
index 2a7b9b54c5c0..e669dae64d46 100644
--- a/sc/source/filter/xml/XMLDetectiveContext.cxx
+++ b/sc/source/filter/xml/XMLDetectiveContext.cxx
@@ -241,7 +241,7 @@ ScXMLDetectiveOperationContext::ScXMLDetectiveOperationContext(
break;
}
}
- ScUnoConversion::FillScAddress( aDetectiveOp.aPosition, rImport.GetTables().GetRealCellPos() );
+ aDetectiveOp.aPosition = rImport.GetTables().GetRealScCellPos();
}
ScXMLDetectiveOperationContext::~ScXMLDetectiveOperationContext()
diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx
index 73470d404e15..b3d208a38b66 100644
--- a/sc/source/filter/xml/xmlcelli.cxx
+++ b/sc/source/filter/xml/xmlcelli.cxx
@@ -279,7 +279,11 @@ void ScXMLTableRowCellContext::UnlockSolarMutex()
void ScXMLTableRowCellContext::SetCursorOnTextImport(const rtl::OUString& rOUTempText)
{
- com::sun::star::table::CellAddress aCellPos = rXMLImport.GetTables().GetRealCellPos();
+ //extra step here until this area is fully converted
+ com::sun::star::table::CellAddress aCellPos;
+ ScAddress aScCellPos = rXMLImport.GetTables().GetRealScCellPos();
+ ScUnoConversion::FillApiAddress( aCellPos, aScCellPos );
+
if (CellExists(aCellPos))
{
uno::Reference<table::XCellRange> xCellRange(rXMLImport.GetTables().GetCurrentXCellRange());
@@ -326,7 +330,12 @@ SvXMLImportContext *ScXMLTableRowCellContext::CreateChildContext( sal_uInt16 nPr
{
bIsEmpty = false;
bTextP = true;
- com::sun::star::table::CellAddress aCellPos = rXMLImport.GetTables().GetRealCellPos();
+
+ //extra step here until this area is fully converted
+ com::sun::star::table::CellAddress aCellPos;
+ ScAddress aScCellPos = rXMLImport.GetTables().GetRealScCellPos();
+ ScUnoConversion::FillApiAddress( aCellPos, aScCellPos );
+
if( ((nCellType == util::NumberFormat::TEXT) || bFormulaTextResult) &&
!rXMLImport.GetTables().IsPartOfMatrix(static_cast<SCCOL>(aCellPos.Column), static_cast<SCROW>(aCellPos.Row)) )
{
@@ -338,7 +347,6 @@ SvXMLImportContext *ScXMLTableRowCellContext::CreateChildContext( sal_uInt16 nPr
}
else
{
- // com::sun::star::table::CellAddress aCellPos = rXMLImport.GetTables().GetRealCellPos();
if (CellExists(aCellPos))
{
if (bIsFirstTextImport && !rXMLImport.GetRemoveLastChar())
@@ -421,7 +429,11 @@ SvXMLImportContext *ScXMLTableRowCellContext::CreateChildContext( sal_uInt16 nPr
if (!pContext && !bTextP)
{
- com::sun::star::table::CellAddress aCellPos = rXMLImport.GetTables().GetRealCellPos();
+ //extra step here until this area is fully converted
+ com::sun::star::table::CellAddress aCellPos;
+ ScAddress aScCellPos = rXMLImport.GetTables().GetRealScCellPos();
+ ScUnoConversion::FillApiAddress( aCellPos, aScCellPos );
+
uno::Reference<drawing::XShapes> xShapes (rXMLImport.GetTables().GetCurrentXShapes());
if (xShapes.is())
{
@@ -725,12 +737,16 @@ void ScXMLTableRowCellContext::EndElement()
}
}
ScMyTables& rTables = rXMLImport.GetTables();
- table::CellAddress aCellPos = rTables.GetRealCellPos();
+
+ //extra step here until this area is fully converted
+ com::sun::star::table::CellAddress aCellPos;
+ ScAddress aScCellPos = rXMLImport.GetTables().GetRealScCellPos();
+ ScUnoConversion::FillApiAddress( aCellPos, aScCellPos );
+
if (aCellPos.Column > 0 && nRepeatedRows > 1)
aCellPos.Row -= (nRepeatedRows - 1);
//duplicated for now
- ScAddress aScCellPos = rTables.GetRealScCellPos();
if (aScCellPos.Col() > 0 && nRepeatedRows > 1)
aScCellPos.SetRow( aScCellPos.Row() - (nRepeatedRows - 1) );
diff --git a/sc/source/filter/xml/xmlsubti.cxx b/sc/source/filter/xml/xmlsubti.cxx
index c70570f47241..576f44369d3e 100644
--- a/sc/source/filter/xml/xmlsubti.cxx
+++ b/sc/source/filter/xml/xmlsubti.cxx
@@ -39,6 +39,7 @@
#include "sheetdata.hxx"
#include "tabprotection.hxx"
#include "tokenarray.hxx"
+#include "convuno.hxx"
#include <svx/svdpage.hxx>
#include <sax/tools/converter.hxx>
@@ -65,12 +66,12 @@ using ::std::auto_ptr;
using namespace com::sun::star;
ScMyTableData::ScMyTableData(SCTAB nSheet, SCCOL nCol, SCROW nRow)
- : nColsPerCol(nDefaultColCount, 1),
+ : maTableCellPos(nCol, nRow, nSheet),
+ nColsPerCol(nDefaultColCount, 1),
nRealCols(nDefaultColCount + 1, 0),
nRowsPerRow(nDefaultRowCount, 1),
nRealRows(nDefaultRowCount + 1, 0),
- nChangedCols(),
- maTableCellPos(nCol, nRow, nSheet)
+ nChangedCols()
{
for (sal_Int32 i = 0; i < 3; ++i)
nRealCols[i] = i;
@@ -293,8 +294,13 @@ void ScMyTables::UnMerge()
{
if ( xCurrentCellRange.is() )
{
+ //extra step here until this area is fully converted
+ com::sun::star::table::CellAddress aCellPos;
+ ScAddress aScCellPos = GetRealScCellPos();
+ ScUnoConversion::FillApiAddress( aCellPos, aScCellPos );
+
table::CellRangeAddress aCellAddress;
- if (IsMerged(xCurrentCellRange, GetRealCellPos().Column, GetRealCellPos().Row, aCellAddress))
+ if (IsMerged(xCurrentCellRange, aCellPos.Column, aCellPos.Row, aCellAddress))
{
//unmerge
uno::Reference <util::XMergeable> xMergeable (xCurrentCellRange->getCellRangeByPosition(aCellAddress.StartColumn, aCellAddress.StartRow,
@@ -309,8 +315,13 @@ void ScMyTables::DoMerge(sal_Int32 nCount)
{
if ( xCurrentCellRange.is() )
{
+ //extra step here until this area is fully converted
+ com::sun::star::table::CellAddress aCellPos;
+ ScAddress aScCellPos = GetRealScCellPos();
+ ScUnoConversion::FillApiAddress( aCellPos, aScCellPos );
+
table::CellRangeAddress aCellAddress;
- if (IsMerged(xCurrentCellRange, GetRealCellPos().Column, GetRealCellPos().Row, aCellAddress))
+ if (IsMerged(xCurrentCellRange, aCellPos.Column, aCellPos.Row, aCellAddress))
{
//unmerge
uno::Reference <util::XMergeable> xMergeable (xCurrentCellRange->getCellRangeByPosition(aCellAddress.StartColumn, aCellAddress.StartRow,
@@ -347,9 +358,10 @@ void ScMyTables::InsertRow()
{
if ( xCurrentCellRange.is() )
{
+ ScAddress aScCellPos = GetRealScCellPos();
table::CellRangeAddress aCellAddress;
- sal_Int32 nRow(GetRealCellPos().Row);
- for (sal_Int32 j = 0; j < GetRealCellPos().Column - pCurrentTab->GetColumn() - 1; ++j)
+ SCROW nRow(aScCellPos.Row());
+ for (sal_Int32 j = 0; j < aScCellPos.Col() - pCurrentTab->GetColumn() - 1; ++j)
{
if (IsMerged(xCurrentCellRange, j, nRow - 1, aCellAddress))
{
@@ -380,7 +392,7 @@ void ScMyTables::NewRow()
if (pCurrentTab->GetRealRows(pCurrentTab->GetRow()) >
maTables[n-2].GetRowsPerRow(maTables[n-2].GetRow()) - 1)
{
- if (GetRealCellPos().Column > 0)
+ if (GetRealScCellPos().Col() > 0)
InsertRow();
for (size_t i = n - 1; i > 0; --i)
@@ -418,9 +430,14 @@ void ScMyTables::InsertColumn()
{
if ( xCurrentCellRange.is() )
{
+ //extra step here until this area is fully converted
+ com::sun::star::table::CellAddress aCellPos;
+ ScAddress aScCellPos = GetRealScCellPos();
+ ScUnoConversion::FillApiAddress( aCellPos, aScCellPos );
+
table::CellRangeAddress aCellAddress;
- sal_Int32 nCol(GetRealCellPos().Column);
- sal_Int32 n = GetRealCellPos().Row - pCurrentTab->GetRow() - 1;
+ sal_Int32 nCol(aCellPos.Column);
+ sal_Int32 n = aCellPos.Row - pCurrentTab->GetRow() - 1;
for (sal_Int32 j = 0; j <= n; ++j)
{
table::CellRangeAddress aTempCellAddress;
@@ -662,28 +679,10 @@ void ScMyTables::DeleteTable()
}
}
-table::CellAddress ScMyTables::GetRealCellPos()
-{
- sal_Int32 nRow = 0;
- sal_Int32 nCol = 0;
- size_t n = maTables.size();
- for (size_t i = 0; i < n; ++i)
- {
- const ScMyTableData& rTab = maTables[i];
- nCol += rTab.GetRealCols(rTab.GetColumn());
- nRow += rTab.GetRealRows(rTab.GetRow());
- }
-
- aRealCellPos.Row = nRow;
- aRealCellPos.Column = nCol;
- aRealCellPos.Sheet = nCurrentSheet;
- return aRealCellPos;
-}
-
ScAddress ScMyTables::GetRealScCellPos() const
{
- sal_Int32 nRow = 0;
- sal_Int32 nCol = 0;
+ SCROW nRow = 0;
+ SCCOL nCol = 0;
size_t n = maTables.size();
for (size_t i = 0; i < n; ++i)
{
@@ -691,7 +690,7 @@ ScAddress ScMyTables::GetRealScCellPos() const
nCol += rTab.GetRealCols(rTab.GetColumn());
nRow += rTab.GetRealRows(rTab.GetRow());
}
- return ScAddress( static_cast<SCCOL>(nCol), static_cast<SCCOL>(nRow), nCurrentSheet );
+ return ScAddress( nCol, nRow, nCurrentSheet );
}
void ScMyTables::AddColCount(sal_Int32 nTempColCount)
diff --git a/sc/source/filter/xml/xmlsubti.hxx b/sc/source/filter/xml/xmlsubti.hxx
index ea114ce151b8..352a7d3fc973 100644
--- a/sc/source/filter/xml/xmlsubti.hxx
+++ b/sc/source/filter/xml/xmlsubti.hxx
@@ -137,7 +137,6 @@ private:
::boost::ptr_vector<ScMyTableData> maTables;
ScXMLTabProtectionData maProtectionData;
ScMyMatrixRangeList aMatrixRangeList;
- com::sun::star::table::CellAddress aRealCellPos;
sal_Int32 nCurrentColStylePos;
sal_Int16 nCurrentDrawPage;
sal_Int16 nCurrentXShapes;
@@ -169,7 +168,6 @@ public:
bool IsOLE(com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& rShape) const
{ return ScMyOLEFixer::IsOLE(rShape); }
void DeleteTable();
- com::sun::star::table::CellAddress GetRealCellPos();
ScAddress GetRealScCellPos() const;
void AddColCount(sal_Int32 nTempColCount);
void AddColStyle(const sal_Int32 nRepeat, const rtl::OUString& rCellStyleName);