[Libreoffice-commits] core.git: sc/source

Bartosz Kosiorek gang65 at poczta.onet.pl
Tue Feb 28 02:45:08 UTC 2017


 sc/source/filter/xml/xmlexprt.cxx |   42 ++++++++++++++++++++++++--------------
 sc/source/filter/xml/xmlexprt.hxx |    9 +++-----
 2 files changed, 31 insertions(+), 20 deletions(-)

New commits:
commit b51bc85cd2ded95668cfcacdb8a2a4a388fe51f4
Author: Bartosz Kosiorek <gang65 at poczta.onet.pl>
Date:   Tue Feb 28 00:43:33 2017 +0100

    tdf#48140 Replace CellRangeAddress with ScRange
    
    Change-Id: I5aa1dabf938e1567d386fceb153e2986862f70a6
    Reviewed-on: https://gerrit.libreoffice.org/34707
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx
index 01e88a3..1108371 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 65f6efe..f1a69c5 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();
 


More information about the Libreoffice-commits mailing list