summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBartosz Kosiorek <gang65@poczta.onet.pl>2017-02-28 00:43:33 +0100
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2017-02-28 02:44:39 +0000
commitb51bc85cd2ded95668cfcacdb8a2a4a388fe51f4 (patch)
treecfee5a4f1738c518f3e719b86c4bf3efdae561c5
parent3015572007fcce57ee66ec45b4bc342fbce11332 (diff)
tdf#48140 Replace CellRangeAddress with ScRange
Change-Id: I5aa1dabf938e1567d386fceb153e2986862f70a6 Reviewed-on: https://gerrit.libreoffice.org/34707 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
-rw-r--r--sc/source/filter/xml/xmlexprt.cxx42
-rw-r--r--sc/source/filter/xml/xmlexprt.hxx9
2 files changed, 31 insertions, 20 deletions
diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx
index 01e88a37c5bb..110837196a8b 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -787,7 +787,7 @@ void ScXMLExport::CloseHeaderColumn()
EndElement(XML_NAMESPACE_TABLE, XML_TABLE_HEADER_COLUMNS, true);
}
-void ScXMLExport::ExportColumns(const sal_Int32 nTable, const table::CellRangeAddress& aColumnHeaderRange, const bool bHasColumnHeader)
+void ScXMLExport::ExportColumns(const sal_Int32 nTable, const ScRange& aColumnHeaderRange, const bool bHasColumnHeader)
{
sal_Int32 nColsRepeated (1);
sal_Int32 nIndex;
@@ -803,7 +803,7 @@ void ScXMLExport::ExportColumns(const sal_Int32 nTable, const table::CellRangeAd
bool bIsVisible(true);
nIndex = pColumnStyles->GetStyleNameIndex(nTable, nColumn, bIsVisible);
- const bool bIsHeader = bHasColumnHeader && (aColumnHeaderRange.StartColumn <= nColumn) && (nColumn <= aColumnHeaderRange.EndColumn);
+ const bool bIsHeader = bHasColumnHeader && (aColumnHeaderRange.aStart.Col() <= nColumn) && (nColumn <= aColumnHeaderRange.aEnd.Col());
if (bIsHeader != bWasHeader)
{
if (bIsHeader)
@@ -1394,13 +1394,13 @@ void ScXMLExport::OpenNewRow(
if (bHasRowHeader && bRowHeaderOpen)
OpenHeaderRows();
}
- if (bHasRowHeader && !bRowHeaderOpen && nStartRow >= aRowHeaderRange.StartRow && nStartRow <= aRowHeaderRange.EndRow)
+ if (bHasRowHeader && !bRowHeaderOpen && nStartRow >= aRowHeaderRange.aStart.Row() && nStartRow <= aRowHeaderRange.aEnd.Row())
{
- if (nStartRow == aRowHeaderRange.StartRow)
+ if (nStartRow == aRowHeaderRange.aStart.Row())
OpenHeaderRows();
sal_Int32 nEquals;
- if (aRowHeaderRange.EndRow < nStartRow + nEqualRows - 1)
- nEquals = aRowHeaderRange.EndRow - nStartRow + 1;
+ if (aRowHeaderRange.aEnd.Row() < nStartRow + nEqualRows - 1)
+ nEquals = aRowHeaderRange.aEnd.Row() - nStartRow + 1;
else
nEquals = nEqualRows;
WriteRowStartTag(nIndex, nEquals, bHidden, bFiltered);
@@ -1471,7 +1471,7 @@ void ScXMLExport::OpenRow(const sal_Int32 nTable, const sal_Int32 nStartRow, con
bFiltered = rRowAttr.rowFiltered(nTable, nRow, nEndRowFiltered);
}
if (nIndex == nPrevIndex && bHidden == bPrevHidden && bFiltered == bPrevFiltered &&
- !(bHasRowHeader && ((nRow == aRowHeaderRange.StartRow) || (nRow - 1 == aRowHeaderRange.EndRow))) &&
+ !(bHasRowHeader && ((nRow == aRowHeaderRange.aStart.Row()) || (nRow - 1 == aRowHeaderRange.aEnd.Row()))) &&
!(pGroupRows->IsGroupStart(nRow)) &&
!(pGroupRows->IsGroupEnd(nRow - 1)))
++nEqualRows;
@@ -1517,7 +1517,7 @@ void ScXMLExport::CloseRow(const sal_Int32 nRow)
if (nOpenRow > -1)
{
EndElement(sElemRow, true);
- if (bHasRowHeader && nRow == aRowHeaderRange.EndRow)
+ if (bHasRowHeader && nRow == aRowHeaderRange.aEnd.Row())
{
CloseHeaderRows();
bRowHeaderOpen = false;
@@ -1615,8 +1615,8 @@ void ScXMLExport::ExportFormatRanges(const sal_Int32 nStartCol, const sal_Int32
}
}
-void ScXMLExport::GetColumnRowHeader(bool& rHasColumnHeader, table::CellRangeAddress& rColumnHeaderRange,
- bool& rHasRowHeader, table::CellRangeAddress& rRowHeaderRange,
+void ScXMLExport::GetColumnRowHeader(bool& rHasColumnHeader, ScRange& rColumnHeaderRange,
+ bool& rHasRowHeader, ScRange& rRowHeaderRange,
OUString& rPrintRanges) const
{
uno::Reference <sheet::XPrintAreas> xPrintAreas (xCurrentTable, uno::UNO_QUERY);
@@ -1624,8 +1624,20 @@ void ScXMLExport::GetColumnRowHeader(bool& rHasColumnHeader, table::CellRangeAdd
{
rHasRowHeader = xPrintAreas->getPrintTitleRows();
rHasColumnHeader = xPrintAreas->getPrintTitleColumns();
- rRowHeaderRange = xPrintAreas->getTitleRows();
- rColumnHeaderRange = xPrintAreas->getTitleColumns();
+ table::CellRangeAddress rTempRowHeaderRange = xPrintAreas->getTitleRows();
+ rRowHeaderRange = ScRange(rTempRowHeaderRange.StartColumn,
+ rTempRowHeaderRange.StartRow,
+ rTempRowHeaderRange.Sheet,
+ rTempRowHeaderRange.EndColumn,
+ rTempRowHeaderRange.EndRow,
+ rTempRowHeaderRange.Sheet);
+ table::CellRangeAddress rTempColumnHeaderRange = xPrintAreas->getTitleColumns();
+ rColumnHeaderRange = ScRange(rTempColumnHeaderRange.StartColumn,
+ rTempColumnHeaderRange.StartRow,
+ rTempColumnHeaderRange.Sheet,
+ rTempColumnHeaderRange.EndColumn,
+ rTempColumnHeaderRange.EndRow,
+ rTempColumnHeaderRange.Sheet);
uno::Sequence< table::CellRangeAddress > aRangeList( xPrintAreas->getPrintAreas() );
ScRangeStringConverter::GetStringFromRangeList( rPrintRanges, aRangeList, pDoc, FormulaGrammar::CONV_OOO );
}
@@ -2871,7 +2883,7 @@ void ScXMLExport::WriteTable(sal_Int32 nTable, const Reference<sheet::XSpreadshe
}
}
OUString sPrintRanges;
- table::CellRangeAddress aColumnHeaderRange;
+ ScRange aColumnHeaderRange;
bool bHasColumnHeader;
GetColumnRowHeader(bHasColumnHeader, aColumnHeaderRange, bHasRowHeader, aRowHeaderRange, sPrintRanges);
if( !sPrintRanges.isEmpty() )
@@ -2928,10 +2940,10 @@ void ScXMLExport::WriteTable(sal_Int32 nTable, const Reference<sheet::XSpreadshe
pGroupRows->NewTable();
FillColumnRowGroups();
if (bHasColumnHeader)
- pSharedData->SetLastColumn(nTable, aColumnHeaderRange.EndColumn);
+ pSharedData->SetLastColumn(nTable, aColumnHeaderRange.aEnd.Col());
bRowHeaderOpen = false;
if (bHasRowHeader)
- pSharedData->SetLastRow(nTable, aRowHeaderRange.EndRow);
+ pSharedData->SetLastRow(nTable, aRowHeaderRange.aEnd.Row());
pDefaults->FillDefaultStyles(nTable, pSharedData->GetLastRow(nTable),
pSharedData->GetLastColumn(nTable), pCellStyles, pDoc);
pRowFormatRanges->SetColDefaults(&pDefaults->GetColDefaults());
diff --git a/sc/source/filter/xml/xmlexprt.hxx b/sc/source/filter/xml/xmlexprt.hxx
index 65f6efe54e2a..f1a69c5b7e31 100644
--- a/sc/source/filter/xml/xmlexprt.hxx
+++ b/sc/source/filter/xml/xmlexprt.hxx
@@ -99,7 +99,7 @@ class ScXMLExport : public SvXMLExport
ScFormatRangeStyles* pCellStyles;
ScRowFormatRanges* pRowFormatRanges;
std::vector<OUString> aTableStyles;
- css::table::CellRangeAddress aRowHeaderRange;
+ ScRange aRowHeaderRange;
ScMyOpenCloseColumnRowGroup* pGroupColumns;
ScMyOpenCloseColumnRowGroup* pGroupRows;
ScMyDefaultStyles* pDefaults;
@@ -153,7 +153,7 @@ class ScXMLExport : public SvXMLExport
const sal_Int32 nStyleIndex, const bool bIsVisible);
void OpenHeaderColumn();
void CloseHeaderColumn();
- void ExportColumns(const sal_Int32 nTable, const css::table::CellRangeAddress& aColumnHeaderRange, const bool bHasColumnHeader);
+ void ExportColumns(const sal_Int32 nTable, const ScRange& aColumnHeaderRange, const bool bHasColumnHeader);
void ExportExternalRefCacheStyles();
void ExportCellTextAutoStyles(sal_Int32 nTable);
void ExportFormatRanges(const sal_Int32 nStartCol, const sal_Int32 nStartRow,
@@ -168,9 +168,8 @@ class ScXMLExport : public SvXMLExport
bool bHidden, bool bFiltered);
void OpenRow(const sal_Int32 nTable, const sal_Int32 nStartRow, const sal_Int32 nRepeatRow, ScXMLCachedRowAttrAccess& rRowAttr);
void CloseRow(const sal_Int32 nRow);
- void GetColumnRowHeader(bool& bHasColumnHeader, css::table::CellRangeAddress& aColumnHeaderRange,
- bool& bHasRowHeader, css::table::CellRangeAddress& aRowHeaderRange,
- OUString& rPrintRanges) const;
+ void GetColumnRowHeader(bool& bHasColumnHeader, ScRange& aColumnHeaderRange,
+ bool& bHasRowHeader, ScRange& aRowHeaderRange, OUString& rPrintRanges) const;
static void FillFieldGroup(ScOutlineArray* pFields, ScMyOpenCloseColumnRowGroup* pGroups);
void FillColumnRowGroups();