Kaydet (Commit) f6e6a613 authored tarafından Bartosz Kosiorek's avatar Bartosz Kosiorek Kaydeden (comit) Markus Mohrhard

tdf#48140 Replace uno CellRangeAddress and CellAddress with direct calls

Change-Id: I43c5c1274c9ed45c929a2d5a8596d54626b5e4f6
Reviewed-on: https://gerrit.libreoffice.org/30994Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMarkus Mohrhard <markus.mohrhard@googlemail.com>
Tested-by: 's avatarMarkus Mohrhard <markus.mohrhard@googlemail.com>
üst f68340b4
......@@ -24,7 +24,6 @@
#include <list>
#include <set>
#include <com/sun/star/sheet/XSpreadsheet.hpp>
#include <com/sun/star/table/CellAddress.hpp>
#include <com/sun/star/table/CellRangeAddress.hpp>
#include <com/sun/star/table/XCell.hpp>
#include <com/sun/star/text/XText.hpp>
......@@ -46,7 +45,7 @@ class ScFormatRangeStyles;
class ScMyIteratorBase
{
protected:
virtual bool GetFirstAddress( css::table::CellAddress& rCellAddress ) = 0;
virtual bool GetFirstAddress( ScAddress& rCellAddress ) = 0;
public:
ScMyIteratorBase();
......@@ -55,7 +54,7 @@ public:
virtual void SetCellData( ScMyCell& rMyCell ) = 0;
virtual void Sort() = 0;
void UpdateAddress( css::table::CellAddress& rCellAddress );
void UpdateAddress( ScAddress& rCellAddress );
};
struct ScMyShape
......@@ -76,7 +75,7 @@ class ScMyShapesContainer : public ScMyIteratorBase
private:
ScMyShapeList aShapeList;
protected:
virtual bool GetFirstAddress( css::table::CellAddress& rCellAddress ) override;
virtual bool GetFirstAddress( ScAddress& rCellAddress ) override;
public:
ScMyShapesContainer();
virtual ~ScMyShapesContainer() override;
......@@ -105,7 +104,7 @@ class ScMyNoteShapesContainer : public ScMyIteratorBase
private:
ScMyNoteShapeList aNoteShapeList;
protected:
virtual bool GetFirstAddress( css::table::CellAddress& rCellAddress ) override;
virtual bool GetFirstAddress( ScAddress& rCellAddress ) override;
public:
ScMyNoteShapesContainer();
virtual ~ScMyNoteShapesContainer() override;
......@@ -120,7 +119,7 @@ public:
struct ScMyMergedRange
{
css::table::CellRangeAddress aCellRange;
ScRange aCellRange;
sal_Int32 nRows;
bool bIsFirst;
bool operator<(const ScMyMergedRange& aRange) const;
......@@ -133,11 +132,11 @@ class ScMyMergedRangesContainer : public ScMyIteratorBase
private:
ScMyMergedRangeList aRangeList;
protected:
virtual bool GetFirstAddress( css::table::CellAddress& rCellAddress ) override;
virtual bool GetFirstAddress( ScAddress& rCellAddress ) override;
public:
ScMyMergedRangesContainer();
virtual ~ScMyMergedRangesContainer() override;
void AddRange(const css::table::CellRangeAddress& rMergedRange);
void AddRange(const ScRange& rMergedRange);
using ScMyIteratorBase::UpdateAddress;
virtual void SetCellData( ScMyCell& rMyCell ) override;
......@@ -151,13 +150,13 @@ struct ScMyAreaLink
OUString sFilterOptions;
OUString sURL;
OUString sSourceStr;
css::table::CellRangeAddress aDestRange;
ScRange aDestRange;
sal_Int32 nRefresh;
inline ScMyAreaLink() : nRefresh( 0 ) {}
inline sal_Int32 GetColCount() const { return aDestRange.EndColumn - aDestRange.StartColumn + 1; }
inline sal_Int32 GetRowCount() const { return aDestRange.EndRow - aDestRange.StartRow + 1; }
inline sal_Int32 GetColCount() const { return aDestRange.aEnd.Col() - aDestRange.aStart.Col() + 1; }
inline sal_Int32 GetRowCount() const { return aDestRange.aEnd.Row() - aDestRange.aStart.Col() + 1; }
bool Compare( const ScMyAreaLink& rAreaLink ) const;
bool operator<(const ScMyAreaLink& rAreaLink ) const;
......@@ -170,7 +169,7 @@ class ScMyAreaLinksContainer : public ScMyIteratorBase
private:
ScMyAreaLinkList aAreaLinkList;
protected:
virtual bool GetFirstAddress( css::table::CellAddress& rCellAddress ) override;
virtual bool GetFirstAddress( ScAddress& rCellAddress ) override;
public:
ScMyAreaLinksContainer();
virtual ~ScMyAreaLinksContainer() override;
......@@ -184,9 +183,9 @@ public:
void SkipTable(SCTAB nSkip);
};
struct ScMyCellRangeAddress : css::table::CellRangeAddress
struct ScMyCellRangeAddress : ScRange
{
explicit ScMyCellRangeAddress(const css::table::CellRangeAddress& rRange);
explicit ScMyCellRangeAddress(const ScRange& rRange);
bool operator<(const ScMyCellRangeAddress& rCellRangeAddress ) const;
};
......@@ -197,7 +196,7 @@ class ScMyEmptyDatabaseRangesContainer : public ScMyIteratorBase
private:
ScMyEmptyDatabaseRangeList aDatabaseList;
protected:
virtual bool GetFirstAddress( css::table::CellAddress& rCellAddress ) override;
virtual bool GetFirstAddress( ScAddress& rCellAddress ) override;
public:
ScMyEmptyDatabaseRangesContainer();
virtual ~ScMyEmptyDatabaseRangesContainer() override;
......@@ -211,8 +210,8 @@ public:
struct ScMyDetectiveObj
{
css::table::CellAddress aPosition;
css::table::CellRangeAddress aSourceRange;
ScAddress aPosition;
ScRange aSourceRange;
ScDetectiveObjType eObjType;
bool bHasError;
bool operator<(const ScMyDetectiveObj& rDetObj) const;
......@@ -226,7 +225,7 @@ class ScMyDetectiveObjContainer : public ScMyIteratorBase
private:
ScMyDetectiveObjList aDetectiveObjList;
protected:
virtual bool GetFirstAddress( css::table::CellAddress& rCellAddress ) override;
virtual bool GetFirstAddress( ScAddress& rCellAddress ) override;
public:
ScMyDetectiveObjContainer();
virtual ~ScMyDetectiveObjContainer() override;
......@@ -246,7 +245,7 @@ public:
struct ScMyDetectiveOp
{
css::table::CellAddress aPosition;
ScAddress aPosition;
ScDetOpType eOpType;
sal_Int32 nIndex;
bool operator<(const ScMyDetectiveOp& rDetOp) const;
......@@ -260,7 +259,7 @@ class ScMyDetectiveOpContainer : public ScMyIteratorBase
private:
ScMyDetectiveOpList aDetectiveOpList;
protected:
virtual bool GetFirstAddress( css::table::CellAddress& rCellAddress ) override;
virtual bool GetFirstAddress( ScAddress& rCellAddress ) override;
public:
ScMyDetectiveOpContainer();
virtual ~ScMyDetectiveOpContainer() override;
......@@ -278,9 +277,9 @@ struct ScMyCell
{
ScAddress maCellAddress; /// Use this instead of the UNO one.
css::table::CellAddress aCellAddress;
css::table::CellRangeAddress aMergeRange;
css::table::CellRangeAddress aMatrixRange;
ScAddress aCellAddress;
ScRange aMergeRange;
ScRange aMatrixRange;
ScMyAreaLink aAreaLink;
ScMyShapeList aShapeList;
......@@ -321,7 +320,7 @@ class ScMyNotEmptyCellsIterator
css::uno::Reference<css::sheet::XSpreadsheet> xTable;
css::uno::Reference<css::table::XCellRange> xCellRange;
css::table::CellAddress aLastAddress;
ScAddress aLastAddress;
ScMyShapesContainer* pShapes;
ScMyNoteShapesContainer* pNoteShapes;
......@@ -338,8 +337,8 @@ class ScMyNotEmptyCellsIterator
SCROW nCellRow;
SCTAB nCurrentTable;
void UpdateAddress( css::table::CellAddress& rAddress );
void SetCellData( ScMyCell& rMyCell, const css::table::CellAddress& rAddress );
void UpdateAddress( ScAddress& rAddress );
void SetCellData( ScMyCell& rMyCell, const ScAddress& rAddress );
void HasAnnotation( ScMyCell& aCell );
public:
......
......@@ -711,7 +711,7 @@ void ScXMLExport::GetAreaLinks( ScMyAreaLinksContainer& rAreaLinks )
if (pLink)
{
ScMyAreaLink aAreaLink;
ScUnoConversion::FillApiRange( aAreaLink.aDestRange, pLink->GetDestArea() );
aAreaLink.aDestRange = pLink->GetDestArea();
aAreaLink.sSourceStr = pLink->GetSource();
aAreaLink.sFilter = pLink->GetFilter();
aAreaLink.sFilterOptions = pLink->GetOptions();
......@@ -2763,14 +2763,17 @@ bool ScXMLExport::GetMerged (const table::CellRangeAddress* pCellAddress,
uno::Reference<sheet::XCellRangeAddressable> xCellAddress (xCursor, uno::UNO_QUERY);
xCursor->collapseToMergedArea();
table::CellRangeAddress aCellAddress2(xCellAddress->getRangeAddress());
if ((aCellAddress2.EndRow > nRow ||
aCellAddress2.EndColumn > nCol) &&
aCellAddress2.StartRow == nRow &&
aCellAddress2.StartColumn == nCol)
ScRange aScRange = ScRange( aCellAddress2.StartColumn, aCellAddress2.StartRow, aCellAddress2.Sheet,
aCellAddress2.EndColumn, aCellAddress2.EndRow, aCellAddress2.Sheet );
if ((aScRange.aEnd.Row() > nRow ||
aScRange.aEnd.Col() > nCol) &&
aScRange.aStart.Row() == nRow &&
aScRange.aStart.Col() == nCol)
{
pMergedRangesContainer->AddRange(aCellAddress2);
pSharedData->SetLastColumn(aCellAddress2.Sheet, aCellAddress2.EndColumn);
pSharedData->SetLastRow(aCellAddress2.Sheet, aCellAddress2.EndRow);
pMergedRangesContainer->AddRange(aScRange);
pSharedData->SetLastColumn(aScRange.aEnd.Tab(), aScRange.aEnd.Col());
pSharedData->SetLastRow(aScRange.aEnd.Tab(), aScRange.aEnd.Row());
}
else
bReady = true;
......@@ -2789,7 +2792,7 @@ bool ScXMLExport::GetMerged (const table::CellRangeAddress* pCellAddress,
}
bool ScXMLExport::IsMatrix (const ScAddress& aCell,
table::CellRangeAddress& aCellAddress, bool& bIsFirst) const
ScRange& aCellAddress, bool& bIsFirst) const
{
bIsFirst = false;
......@@ -2797,15 +2800,15 @@ bool ScXMLExport::IsMatrix (const ScAddress& aCell,
if (pDoc && pDoc->GetMatrixFormulaRange(aCell, aMatrixRange))
{
ScUnoConversion::FillApiRange( aCellAddress, aMatrixRange );
if ((aCellAddress.StartColumn == aCell.Col() && aCellAddress.StartRow == aCell.Row()) &&
(aCellAddress.EndColumn > aCell.Col() || aCellAddress.EndRow > aCell.Row()))
aCellAddress = aMatrixRange;
if ((aCellAddress.aStart.Col() == aCell.Col() && aCellAddress.aStart.Row() == aCell.Row()) &&
(aCellAddress.aEnd.Col() > aCell.Col() || aCellAddress.aEnd.Row() > aCell.Row()))
{
bIsFirst = true;
return true;
}
else if (aCellAddress.StartColumn != aCell.Col() || aCellAddress.StartRow != aCell.Row() ||
aCellAddress.EndColumn != aCell.Col() || aCellAddress.EndRow != aCell.Row())
else if (aCellAddress.aStart.Col() != aCell.Col() || aCellAddress.aStart.Row() != aCell.Row() ||
aCellAddress.aEnd.Col() != aCell.Col() || aCellAddress.aEnd.Row()!= aCell.Row())
return true;
else
{
......@@ -3148,8 +3151,8 @@ void ScXMLExport::WriteCell(ScMyCell& aCell, sal_Int32 nEqualCellCount)
bool bIsFirstMatrixCell(aCell.bIsMatrixBase);
if (bIsFirstMatrixCell)
{
sal_Int32 nColumns(aCell.aMatrixRange.EndColumn - aCell.aMatrixRange.StartColumn + 1);
sal_Int32 nRows(aCell.aMatrixRange.EndRow - aCell.aMatrixRange.StartRow + 1);
sal_Int32 nColumns(aCell.aMatrixRange.aEnd.Col() - aCell.aMatrixRange.aStart.Col() + 1);
sal_Int32 nRows(aCell.aMatrixRange.aEnd.Row() - aCell.aMatrixRange.aStart.Row() + 1);
OUStringBuffer sColumns;
OUStringBuffer sRows;
::sax::Converter::convertNumber(sColumns, nColumns);
......@@ -3264,8 +3267,8 @@ void ScXMLExport::WriteCell(ScMyCell& aCell, sal_Int32 nEqualCellCount)
{
if (aCell.bIsMergedBase)
{
sal_Int32 nColumns(aCell.aMergeRange.EndColumn - aCell.aMergeRange.StartColumn + 1);
sal_Int32 nRows(aCell.aMergeRange.EndRow - aCell.aMergeRange.StartRow + 1);
sal_Int32 nColumns(aCell.aMergeRange.aEnd.Col() - aCell.aMergeRange.aStart.Col() + 1);
sal_Int32 nRows(aCell.aMergeRange.aEnd.Row() - aCell.aMergeRange.aStart.Row() + 1);
OUStringBuffer sColumns;
OUStringBuffer sRows;
::sax::Converter::convertNumber(sColumns, nColumns);
......
......@@ -238,7 +238,7 @@ public:
inline ScDocument* GetDocument() { return pDoc; }
inline const ScDocument* GetDocument() const { return pDoc; }
bool IsMatrix (const ScAddress& aCell,
css::table::CellRangeAddress& aCellAddress, bool& bIsFirst) const;
ScRange& aCellAddress, bool& bIsFirst) const;
const rtl::Reference < XMLPropertySetMapper >& GetCellStylesPropertySetMapper() { return xCellStylesPropertySetMapper; }
const rtl::Reference < XMLPropertySetMapper >& GetTableStylesPropertySetMapper() { return xTableStylesPropertySetMapper; }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment