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