sc/source/filter/xml/XMLDetectiveContext.cxx | 2 sc/source/filter/xml/xmlcelli.cxx | 28 +++++++-- sc/source/filter/xml/xmlsubti.cxx | 76 ++++++++++++--------------- sc/source/filter/xml/xmlsubti.hxx | 13 +--- 4 files changed, 64 insertions(+), 55 deletions(-)
New commits: commit 9e62caee992f9c352f1a8e7ea6772ae998fd309a Author: Daniel Bankston <daniel.e.banks...@gmail.com> Date: Fri Jun 1 00:52:51 2012 -0500 Convert GetRealCellPos and calls to use ScAddress Change-Id: Ic7a6ad82b5b4938ef67ddf8e62372635044cd5b2 diff --git a/sc/source/filter/xml/XMLDetectiveContext.cxx b/sc/source/filter/xml/XMLDetectiveContext.cxx index 2a7b9b5..e669dae 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 25f8f17..9e36e95 100644 --- a/sc/source/filter/xml/xmlcelli.cxx +++ b/sc/source/filter/xml/xmlcelli.cxx @@ -284,7 +284,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()); @@ -331,7 +335,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)) ) { @@ -343,7 +352,6 @@ SvXMLImportContext *ScXMLTableRowCellContext::CreateChildContext( sal_uInt16 nPr } else { - // com::sun::star::table::CellAddress aCellPos = rXMLImport.GetTables().GetRealCellPos(); if (CellExists(aCellPos)) { if (bIsFirstTextImport && !rXMLImport.GetRemoveLastChar()) @@ -426,7 +434,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()) { @@ -730,12 +742,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 941c7d1..2876309 100644 --- a/sc/source/filter/xml/xmlsubti.cxx +++ b/sc/source/filter/xml/xmlsubti.cxx @@ -41,6 +41,7 @@ #include "sheetdata.hxx" #include "tabprotection.hxx" #include "tokenarray.hxx" +#include "convuno.hxx" #include <svx/svdpage.hxx> #include <sax/tools/converter.hxx> @@ -67,12 +68,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; @@ -295,8 +296,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, @@ -311,8 +317,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, @@ -349,9 +360,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)) { @@ -382,7 +394,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) @@ -420,9 +432,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; @@ -664,28 +681,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) { @@ -693,7 +692,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 ea114ce..352a7d3 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); commit 1f806b5e1019be4b859f52af22ecc86eade0461c Author: Daniel Bankston <daniel.e.banks...@gmail.com> Date: Thu May 31 21:48:45 2012 -0500 Convert ScMyTableData to use ScAddress Change-Id: I10972bc2b76a517c465ce32cf4832ab069be1bec diff --git a/sc/source/filter/xml/xmlsubti.cxx b/sc/source/filter/xml/xmlsubti.cxx index 7c48ad1..941c7d1 100644 --- a/sc/source/filter/xml/xmlsubti.cxx +++ b/sc/source/filter/xml/xmlsubti.cxx @@ -66,17 +66,14 @@ using ::std::auto_ptr; using namespace com::sun::star; -ScMyTableData::ScMyTableData(SCTAB nSheet, sal_Int32 nCol, sal_Int32 nRow) +ScMyTableData::ScMyTableData(SCTAB nSheet, SCCOL nCol, SCROW nRow) : nColsPerCol(nDefaultColCount, 1), nRealCols(nDefaultColCount + 1, 0), nRowsPerRow(nDefaultRowCount, 1), nRealRows(nDefaultRowCount + 1, 0), - nChangedCols() + nChangedCols(), + maTableCellPos(nCol, nRow, nSheet) { - aTableCellPos.Sheet = nSheet; - aTableCellPos.Column = nCol; - aTableCellPos.Row = nRow; - for (sal_Int32 i = 0; i < 3; ++i) nRealCols[i] = i; for (sal_Int32 j = 0; j < 3; ++j) @@ -93,24 +90,24 @@ ScMyTableData::~ScMyTableData() void ScMyTableData::AddRow() { - ++aTableCellPos.Row; - if (static_cast<sal_uInt32>(aTableCellPos.Row) >= nRowsPerRow.size()) + maTableCellPos.SetRow( maTableCellPos.Row() + 1 ); + if (static_cast<sal_uInt32>(maTableCellPos.Row()) >= nRowsPerRow.size()) { nRowsPerRow.resize(nRowsPerRow.size() + nDefaultRowCount, 1); nRealRows.resize(nRowsPerRow.size() + nDefaultRowCount + 1, 0); } - nRealRows[aTableCellPos.Row + 1] = nRealRows[aTableCellPos.Row] + nRowsPerRow[aTableCellPos.Row]; + nRealRows[maTableCellPos.Row() + 1] = nRealRows[maTableCellPos.Row()] + nRowsPerRow[maTableCellPos.Row()]; } void ScMyTableData::AddColumn() { - ++aTableCellPos.Column; - if (static_cast<sal_uInt32>(aTableCellPos.Column) >= nColsPerCol.size()) + maTableCellPos.SetCol( maTableCellPos.Col() + 1 ); + if (static_cast<sal_uInt32>(maTableCellPos.Col()) >= nColsPerCol.size()) { nColsPerCol.resize(nColsPerCol.size() + nDefaultColCount, 1); nRealCols.resize(nColsPerCol.size() + nDefaultColCount + 1, 0); } - nRealCols[aTableCellPos.Column + 1] = nRealCols[aTableCellPos.Column] + nColsPerCol[aTableCellPos.Column]; + nRealCols[maTableCellPos.Col() + 1] = nRealCols[maTableCellPos.Col()] + nColsPerCol[maTableCellPos.Col()]; } sal_Int32 ScMyTableData::GetRealCols(const sal_Int32 nIndex, const bool /* bIsNormal */) const diff --git a/sc/source/filter/xml/xmlsubti.hxx b/sc/source/filter/xml/xmlsubti.hxx index e954314..ea114ce 100644 --- a/sc/source/filter/xml/xmlsubti.hxx +++ b/sc/source/filter/xml/xmlsubti.hxx @@ -57,7 +57,7 @@ const ScMysalIntVec::size_type nDefaultTabCount = 10; class ScMyTableData { private: - com::sun::star::table::CellAddress aTableCellPos; + ScAddress maTableCellPos; ScMysalIntVec nColsPerCol; ScMysalIntVec nRealCols; ScMysalIntVec nRowsPerRow; @@ -67,13 +67,13 @@ private: sal_Int32 nSubTableSpanned; ScMysalIntList nChangedCols; public: - ScMyTableData(SCTAB nSheet = -1, sal_Int32 nCol = -1, sal_Int32 nRow = -1); + ScMyTableData(SCTAB nSheet = -1, SCCOL nCol = -1, SCROW nRow = -1); ~ScMyTableData(); - sal_Int32 GetRow() const { return aTableCellPos.Row; } - sal_Int32 GetColumn() const { return aTableCellPos.Column; } + SCROW GetRow() const { return maTableCellPos.Row(); } + SCCOL GetColumn() const { return maTableCellPos.Col(); } void AddRow(); void AddColumn(); - void SetFirstColumn() { aTableCellPos.Column = -1; } + void SetFirstColumn() { maTableCellPos.SetCol(-1); } sal_Int32 GetColsPerCol(const sal_Int32 nIndex) const { return nColsPerCol[nIndex]; } void SetColsPerCol(const sal_Int32 nIndex, sal_Int32 nValue = 1) { nColsPerCol[nIndex] = nValue; } sal_Int32 GetRealCols(const sal_Int32 nIndex, const bool bIsNormal = true) const; commit ac9ce5b3a97f31a11c67bb8865843d7c24730524 Author: Daniel Bankston <daniel.e.banks...@gmail.com> Date: Thu May 31 19:56:55 2012 -0500 Remove unused method Change-Id: I9be889c8d0ef2d606614592a2a918b2d089da682 diff --git a/sc/source/filter/xml/xmlsubti.hxx b/sc/source/filter/xml/xmlsubti.hxx index 101eddd..e954314 100644 --- a/sc/source/filter/xml/xmlsubti.hxx +++ b/sc/source/filter/xml/xmlsubti.hxx @@ -69,7 +69,6 @@ private: public: ScMyTableData(SCTAB nSheet = -1, sal_Int32 nCol = -1, sal_Int32 nRow = -1); ~ScMyTableData(); - com::sun::star::table::CellAddress GetCellPos() const { return aTableCellPos; } sal_Int32 GetRow() const { return aTableCellPos.Row; } sal_Int32 GetColumn() const { return aTableCellPos.Column; } void AddRow(); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits