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

Bartosz Kosiorek gang65 at poczta.onet.pl
Tue Nov 29 08:48:34 UTC 2016


 sc/source/filter/inc/addressconverter.hxx     |   14 ++++++
 sc/source/filter/inc/externallinkfragment.hxx |    2 
 sc/source/filter/inc/pivotcachebuffer.hxx     |    5 --
 sc/source/filter/inc/tablebuffer.hxx          |   19 +++------
 sc/source/filter/oox/addressconverter.cxx     |   38 ++++++++++++++++++
 sc/source/filter/oox/formulaparser.cxx        |    2 
 sc/source/filter/oox/pivotcachebuffer.cxx     |   53 +++++++++++++-------------
 sc/source/filter/oox/pivotcachefragment.cxx   |    2 
 sc/source/filter/oox/pivottablebuffer.cxx     |    6 ++
 sc/source/filter/oox/tablebuffer.cxx          |   11 ++++-
 sc/source/filter/oox/worksheethelper.cxx      |    6 +-
 11 files changed, 110 insertions(+), 48 deletions(-)

New commits:
commit ad129cda465d7d16130469eb9e232e9e8ce53d58
Author: Bartosz Kosiorek <gang65 at poczta.onet.pl>
Date:   Fri Nov 25 13:33:46 2016 +0100

    tdf#48140 Replace uno with direct calls
    
    Change-Id: I63e30c4bb32837b28401474a4ab7627ad2863c5b
    Reviewed-on: https://gerrit.libreoffice.org/31219
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sc/source/filter/inc/addressconverter.hxx b/sc/source/filter/inc/addressconverter.hxx
index add5401..f1afeb2d 100644
--- a/sc/source/filter/inc/addressconverter.hxx
+++ b/sc/source/filter/inc/addressconverter.hxx
@@ -366,6 +366,10 @@ public:
                             const css::table::CellRangeAddress& rRange,
                             bool bAllowOverflow, bool bTrackOverflow );
 
+    bool                checkCellRange(
+                            const ScRange& rRange,
+                            bool bAllowOverflow, bool bTrackOverflow );
+
     /** Checks the passed cell range, may try to fit it to current sheet limits.
 
         First, this function reorders the column and row indexes so that the
@@ -409,6 +413,11 @@ public:
                             const OUString& rString,
                             sal_Int16 nSheet );
 
+    static bool         convertToCellRangeUnchecked(
+                            ScRange& orRange,
+                            const OUString& rString,
+                            sal_Int16 nSheet );
+
     /** Tries to convert the passed string to a cell range address.
 
         @param orRange  (out-parameter) Returns the converted cell range
@@ -451,6 +460,11 @@ public:
                             const BinRange& rBinRange,
                             sal_Int16 nSheet );
 
+    static void         convertToCellRangeUnchecked(
+                            ScRange& orRange,
+                            const BinRange& rBinRange,
+                            sal_Int16 nSheet );
+
     /** Tries to convert the passed range to a cell range address.
 
         @param orRange  (out-parameter) Returns the converted cell range
diff --git a/sc/source/filter/inc/externallinkfragment.hxx b/sc/source/filter/inc/externallinkfragment.hxx
index 1d5f5c3..ec82be8 100644
--- a/sc/source/filter/inc/externallinkfragment.hxx
+++ b/sc/source/filter/inc/externallinkfragment.hxx
@@ -67,7 +67,7 @@ private:
 private:
     css::uno::Reference< css::sheet::XExternalSheetCache >
                         mxSheetCache;               /// The sheet cache used to store external cell values.
-    ScAddress           maCurrPos; /// Position of current cell.
+    ScAddress           maCurrPos;                  /// Position of current cell.
     sal_Int32           mnCurrType;                 /// Data type of current cell.
 };
 
diff --git a/sc/source/filter/inc/pivotcachebuffer.hxx b/sc/source/filter/inc/pivotcachebuffer.hxx
index 2add88c..4ff96f0 100644
--- a/sc/source/filter/inc/pivotcachebuffer.hxx
+++ b/sc/source/filter/inc/pivotcachebuffer.hxx
@@ -337,8 +337,7 @@ struct PCWorksheetSourceModel
     OUString     maRelId;            /// Relation identifier for an external document URL.
     OUString     maSheet;            /// Sheet name for cell range or sheet-local defined names.
     OUString     maDefName;          /// Defined name containing a cell range if present.
-    css::table::CellRangeAddress
-                 maRange;            /// Source cell range of the data.
+    ScRange      maRange;            /// Source cell range of the data.
 
     explicit            PCWorksheetSourceModel();
 };
@@ -373,7 +372,7 @@ public:
     /** Returns true, if the pivot cache is based on a dummy sheet created in finalizeImport. */
     inline bool         isBasedOnDummySheet() const { return mbDummySheet; }
     /** Returns the internal cell range the cache is based on. */
-    inline const css::table::CellRangeAddress&
+    inline const ScRange&
                         getSourceRange() const { return maSheetSrcModel.maRange; }
     /** Returns the relation identifier of the pivot cache records fragment. */
     inline const OUString& getRecordsRelId() const { return maDefModel.maRelId; }
diff --git a/sc/source/filter/inc/tablebuffer.hxx b/sc/source/filter/inc/tablebuffer.hxx
index 55eb2bd..384b461 100644
--- a/sc/source/filter/inc/tablebuffer.hxx
+++ b/sc/source/filter/inc/tablebuffer.hxx
@@ -20,7 +20,6 @@
 #ifndef INCLUDED_SC_SOURCE_FILTER_INC_TABLEBUFFER_HXX
 #define INCLUDED_SC_SOURCE_FILTER_INC_TABLEBUFFER_HXX
 
-#include <com/sun/star/table/CellRangeAddress.hpp>
 #include "autofilterbuffer.hxx"
 #include "tablecolumnsbuffer.hxx"
 #include "workbookhelper.hxx"
@@ -30,8 +29,7 @@ namespace xls {
 
 struct TableModel
 {
-    css::table::CellRangeAddress
-                        maRange;            /// Original (unchecked) range of the table.
+    ScRange             maRange;            /// Original (unchecked) range of the table.
     OUString            maProgName;         /// Programmatical name.
     OUString            maDisplayName;      /// Display name.
     sal_Int32           mnId;               /// Unique table identifier.
@@ -69,13 +67,13 @@ public:
     inline const OUString& getDisplayName() const { return maModel.maDisplayName; }
 
     /** Returns the original (unchecked) total range of the table. */
-    inline const css::table::CellRangeAddress& getOriginalRange() const { return maModel.maRange; }
+    inline const ScRange& getOriginalRange() const { return maModel.maRange; }
     /** Returns the cell range of this table. */
-    inline const css::table::CellRangeAddress& getRange() const { return maDestRange; }
+    inline const ScRange& getRange() const { return maDestRange; }
     /** Returns the number of columns of this table. */
-    inline sal_Int32    getWidth() const { return maDestRange.EndColumn - maDestRange.StartColumn + 1; }
+    inline SCCOL        getWidth() const { return maDestRange.aEnd.Col() - maDestRange.aStart.Col() + 1; }
     /** Returns the number of rows of this table. */
-    inline sal_Int32    getHeight() const { return maDestRange.EndRow - maDestRange.StartRow + 1; }
+    inline SCROW        getHeight() const { return maDestRange.aEnd.Row() - maDestRange.aStart.Row() + 1; }
     /** Returns the number of header rows in the table range. */
     inline sal_Int32    getHeaderRows() const { return maModel.mnHeaderRows; }
     /** Returns the number of totals rows in the table range. */
@@ -86,8 +84,7 @@ private:
     AutoFilterBuffer    maAutoFilters;      /// Filter settings for this table.
     TableColumnsBuffer  maTableColumns;     /// Column names of this table.
     OUString            maDBRangeName;      /// Name of the database range in the Calc document.
-    css::table::CellRangeAddress
-                        maDestRange;        /// Validated range of the table in the worksheet.
+    ScRange             maDestRange;        /// Validated range of the table in the worksheet.
     sal_Int32           mnTokenIndex;       /// Token index used in API token array.
 };
 
@@ -117,8 +114,8 @@ private:
     void                insertTableToMaps( const TableRef& rxTable );
 
 private:
-    typedef RefVector< Table >                  TableVector;
-    typedef RefMap< sal_Int32, Table >          TableIdMap;
+    typedef RefVector< Table >           TableVector;
+    typedef RefMap< sal_Int32, Table >   TableIdMap;
     typedef RefMap< OUString, Table >    TableNameMap;
 
     TableVector         maTables;
diff --git a/sc/source/filter/oox/addressconverter.cxx b/sc/source/filter/oox/addressconverter.cxx
index 60fdb33..47132e8 100644
--- a/sc/source/filter/oox/addressconverter.cxx
+++ b/sc/source/filter/oox/addressconverter.cxx
@@ -363,6 +363,16 @@ ScAddress AddressConverter::createValidCellAddress(
     return aAddress;
 }
 
+bool AddressConverter::checkCellRange( const ScRange& rRange, bool bAllowOverflow, bool bTrackOverflow )
+{
+    return
+        (checkCol( rRange.aEnd.Col(), bTrackOverflow ) || bAllowOverflow) &&     // bAllowOverflow after checkCol to track overflow!
+        (checkRow( rRange.aEnd.Row(), bTrackOverflow ) || bAllowOverflow) &&     // bAllowOverflow after checkRow to track overflow!
+        checkTab( rRange.aStart.Tab(), bTrackOverflow ) &&
+        checkCol( rRange.aStart.Col(), bTrackOverflow ) &&
+        checkRow( rRange.aStart.Row(), bTrackOverflow );
+}
+
 bool AddressConverter::checkCellRange( const CellRangeAddress& rRange, bool bAllowOverflow, bool bTrackOverflow )
 {
     return
@@ -388,6 +398,23 @@ bool AddressConverter::validateCellRange( CellRangeAddress& orRange, bool bAllow
     return true;
 }
 
+bool AddressConverter::convertToCellRangeUnchecked( ScRange& orRange,
+        const OUString& rString, sal_Int16 nSheet )
+{
+    orRange.aStart.SetTab( nSheet );
+    orRange.aEnd.SetTab( nSheet );
+    sal_Int32 aStartCol = orRange.aStart.Col();
+    sal_Int32 aStartRow = orRange.aStart.Row();
+    sal_Int32 aEndCol = orRange.aEnd.Col();
+    sal_Int32 aEndRow = orRange.aEnd.Row();
+    bool bReturnValue = parseOoxRange2d( aStartCol, aStartRow, aEndCol, aEndRow, rString );
+    orRange.aStart.SetCol( aStartCol );
+    orRange.aStart.SetRow( aStartRow );
+    orRange.aEnd.SetCol( aEndCol );
+    orRange.aEnd.SetRow( aEndRow );
+    return bReturnValue;
+}
+
 bool AddressConverter::convertToCellRangeUnchecked( CellRangeAddress& orRange,
         const OUString& rString, sal_Int16 nSheet )
 {
@@ -413,6 +440,17 @@ void AddressConverter::convertToCellRangeUnchecked( CellRangeAddress& orRange,
     orRange.EndRow      = rBinRange.maLast.mnRow;
 }
 
+void AddressConverter::convertToCellRangeUnchecked( ScRange& orRange,
+        const BinRange& rBinRange, sal_Int16 nSheet )
+{
+    orRange.aStart.SetTab( nSheet );
+    orRange.aStart.SetCol( rBinRange.maFirst.mnCol );
+    orRange.aStart.SetRow( rBinRange.maFirst.mnRow );
+    orRange.aEnd.SetTab( nSheet );
+    orRange.aEnd.SetCol( rBinRange.maLast.mnCol );
+    orRange.aEnd.SetRow( rBinRange.maLast.mnRow );
+}
+
 bool AddressConverter::convertToCellRange( CellRangeAddress& orRange,
         const BinRange& rBinRange, sal_Int16 nSheet, bool bAllowOverflow, bool bTrackOverflow )
 {
diff --git a/sc/source/filter/oox/formulaparser.cxx b/sc/source/filter/oox/formulaparser.cxx
index 3600fbf..af4e50e 100644
--- a/sc/source/filter/oox/formulaparser.cxx
+++ b/sc/source/filter/oox/formulaparser.cxx
@@ -1559,7 +1559,7 @@ bool OoxFormulaParserImpl::importTableToken( SequenceInputStream& rStrm )
                 }
                 else if( bThisRow )
                 {
-                    nStartRow = nEndRow = maBaseAddr.Row() - xTable->getRange().StartRow;
+                    nStartRow = nEndRow = maBaseAddr.Row() - xTable->getRange().aStart.Row();
                     bFixedHeight = true;
                 }
                 else
diff --git a/sc/source/filter/oox/pivotcachebuffer.cxx b/sc/source/filter/oox/pivotcachebuffer.cxx
index 8c2397f..b6e8226 100644
--- a/sc/source/filter/oox/pivotcachebuffer.cxx
+++ b/sc/source/filter/oox/pivotcachebuffer.cxx
@@ -846,7 +846,7 @@ PCSourceModel::PCSourceModel() :
 
 PCWorksheetSourceModel::PCWorksheetSourceModel()
 {
-    maRange.StartColumn = maRange.StartRow = maRange.EndColumn = maRange.EndRow = -1;
+    maRange.SetInvalid();
 }
 
 PivotCache::PivotCache( const WorkbookHelper& rHelper ) :
@@ -1035,11 +1035,11 @@ sal_Int32 PivotCache::getCacheDatabaseIndex( sal_Int32 nFieldIdx ) const
 
 void PivotCache::writeSourceHeaderCells( WorksheetHelper& rSheetHelper ) const
 {
-    OSL_ENSURE( static_cast< size_t >( maSheetSrcModel.maRange.EndColumn - maSheetSrcModel.maRange.StartColumn + 1 ) == maDatabaseFields.size(),
+    OSL_ENSURE( static_cast< size_t >( maSheetSrcModel.maRange.aEnd.Col() - maSheetSrcModel.maRange.aStart.Col() + 1 ) == maDatabaseFields.size(),
         "PivotCache::writeSourceHeaderCells - source cell range width does not match number of source fields" );
-    sal_Int32 nCol = maSheetSrcModel.maRange.StartColumn;
-    sal_Int32 nMaxCol = getAddressConverter().getMaxApiAddress().Col();
-    sal_Int32 nRow = maSheetSrcModel.maRange.StartRow;
+    SCCOL nCol = maSheetSrcModel.maRange.aStart.Col();
+    SCCOL nMaxCol = getAddressConverter().getMaxApiAddress().Col();
+    SCROW nRow = maSheetSrcModel.maRange.aStart.Row();
     mnCurrRow = -1;
     updateSourceDataRow( rSheetHelper, nRow );
     for( PivotCacheFieldVector::const_iterator aIt = maDatabaseFields.begin(), aEnd = maDatabaseFields.end(); (aIt != aEnd) && (nCol <= nMaxCol); ++aIt, ++nCol )
@@ -1048,10 +1048,10 @@ void PivotCache::writeSourceHeaderCells( WorksheetHelper& rSheetHelper ) const
 
 void PivotCache::writeSourceDataCell( WorksheetHelper& rSheetHelper, sal_Int32 nColIdx, sal_Int32 nRowIdx, const PivotCacheItem& rItem ) const
 {
-    sal_Int32 nCol = maSheetSrcModel.maRange.StartColumn + nColIdx;
-    OSL_ENSURE( (maSheetSrcModel.maRange.StartColumn <= nCol) && (nCol <= maSheetSrcModel.maRange.EndColumn), "PivotCache::writeSourceDataCell - invalid column index" );
-    sal_Int32 nRow = maSheetSrcModel.maRange.StartRow + nRowIdx;
-    OSL_ENSURE( (maSheetSrcModel.maRange.StartRow < nRow) && (nRow <= maSheetSrcModel.maRange.EndRow), "PivotCache::writeSourceDataCell - invalid row index" );
+    SCCOL nCol = maSheetSrcModel.maRange.aStart.Col() + nColIdx;
+    OSL_ENSURE( ( maSheetSrcModel.maRange.aStart.Col() <= nCol ) && ( nCol <= maSheetSrcModel.maRange.aEnd.Col() ), "PivotCache::writeSourceDataCell - invalid column index" );
+    SCROW nRow = maSheetSrcModel.maRange.aStart.Row() + nRowIdx;
+    OSL_ENSURE( ( maSheetSrcModel.maRange.aStart.Row() < nRow ) && ( nRow <= maSheetSrcModel.maRange.aEnd.Row() ), "PivotCache::writeSourceDataCell - invalid row index" );
     updateSourceDataRow( rSheetHelper, nRow );
     if( const PivotCacheField* pCacheField = maDatabaseFields.get( nColIdx ).get() )
         pCacheField->writeSourceDataCell( rSheetHelper, nCol, nRow, rItem );
@@ -1059,10 +1059,10 @@ void PivotCache::writeSourceDataCell( WorksheetHelper& rSheetHelper, sal_Int32 n
 
 void PivotCache::importPCRecord( SequenceInputStream& rStrm, WorksheetHelper& rSheetHelper, sal_Int32 nRowIdx ) const
 {
-    sal_Int32 nRow = maSheetSrcModel.maRange.StartRow + nRowIdx;
-    OSL_ENSURE( (maSheetSrcModel.maRange.StartRow < nRow) && (nRow <= maSheetSrcModel.maRange.EndRow), "PivotCache::importPCRecord - invalid row index" );
-    sal_Int32 nCol = maSheetSrcModel.maRange.StartColumn;
-    sal_Int32 nMaxCol = getAddressConverter().getMaxApiAddress().Col();
+    SCROW nRow = maSheetSrcModel.maRange.aStart.Row() + nRowIdx;
+    OSL_ENSURE( ( maSheetSrcModel.maRange.aStart.Row() < nRow ) && ( nRow <= maSheetSrcModel.maRange.aEnd.Row() ), "PivotCache::importPCRecord - invalid row index" );
+    SCCOL nCol = maSheetSrcModel.maRange.aStart.Col();
+    SCCOL nMaxCol = getAddressConverter().getMaxApiAddress().Col();
     for( PivotCacheFieldVector::const_iterator aIt = maDatabaseFields.begin(), aEnd = maDatabaseFields.end(); !rStrm.isEof() && (aIt != aEnd) && (nCol <= nMaxCol); ++aIt, ++nCol )
         (*aIt)->importPCRecordItem( rStrm, rSheetHelper, nCol, nRow );
 }
@@ -1080,7 +1080,10 @@ void PivotCache::finalizeInternalSheetSource()
         // local or global defined name
         if( const DefinedName* pDefName = getDefinedNames().getByModelName( maSheetSrcModel.maDefName, nSheet ).get() )
         {
-            mbValidSource = pDefName->getAbsoluteRange( maSheetSrcModel.maRange );
+            CellRangeAddress aCellRange = CellRangeAddress( maSheetSrcModel.maRange.aStart.Tab(),
+                                                            maSheetSrcModel.maRange.aStart.Col(), maSheetSrcModel.maRange.aStart.Row(),
+                                                            maSheetSrcModel.maRange.aEnd.Col(), maSheetSrcModel.maRange.aEnd.Row() );
+            mbValidSource = pDefName->getAbsoluteRange( aCellRange );
         }
         // table
         else if( const Table* pTable = getTables().getTable( maSheetSrcModel.maDefName ).get() )
@@ -1089,14 +1092,14 @@ void PivotCache::finalizeInternalSheetSource()
             maSheetSrcModel.maRange = pTable->getOriginalRange();
             mbValidSource = (pTable->getHeight() - pTable->getTotalsRows()) > 1;
             if( mbValidSource )
-                maSheetSrcModel.maRange.EndRow -= pTable->getTotalsRows();
+                maSheetSrcModel.maRange.aEnd.SetRow( maSheetSrcModel.maRange.aEnd.Row() - pTable->getTotalsRows() );
         }
     }
     // else try the cell range (if the sheet exists)
     else if( nSheet >= 0 )
     {
         // insert sheet index into the range, range address will be checked below
-        maSheetSrcModel.maRange.Sheet = nSheet;
+        maSheetSrcModel.maRange.aStart.SetTab( nSheet );
         mbValidSource = true;
     }
     // else sheet has been deleted, generate the source data from cache
@@ -1110,7 +1113,7 @@ void PivotCache::finalizeInternalSheetSource()
     // check range location, do not allow ranges that overflow the sheet partly
     mbValidSource = mbValidSource &&
         getAddressConverter().checkCellRange( maSheetSrcModel.maRange, false, true ) &&
-        (maSheetSrcModel.maRange.StartRow < maSheetSrcModel.maRange.EndRow);
+            ( maSheetSrcModel.maRange.aStart.Row() < maSheetSrcModel.maRange.aEnd.Row() );
 }
 
 void PivotCache::finalizeExternalSheetSource()
@@ -1125,19 +1128,19 @@ void PivotCache::finalizeExternalSheetSource()
 
 void PivotCache::prepareSourceDataSheet()
 {
-    CellRangeAddress& rRange = maSheetSrcModel.maRange;
+    ScRange& rRange = maSheetSrcModel.maRange;
     // data will be inserted in top-left cell, sheet index is still set to 0 (will be set below)
-    rRange.EndColumn -= rRange.StartColumn;
-    rRange.StartColumn = 0;
-    rRange.EndRow -= rRange.StartRow;
-    rRange.StartRow = 0;
+    rRange.aEnd.SetCol( rRange.aEnd.Col() - rRange.aStart.Col() );
+    rRange.aStart.SetCol( 0 );
+    rRange.aEnd.SetRow( rRange.aEnd.Row() - rRange.aStart.Row() );
+    rRange.aStart.SetRow( 0 );
     // check range location, do not allow ranges that overflow the sheet partly
     if( getAddressConverter().checkCellRange( rRange, false, true ) )
     {
-        maColSpans.insert( ValueRange( rRange.StartColumn, rRange.EndColumn ) );
+        maColSpans.insert( ValueRange( rRange.aStart.Col(), rRange.aEnd.Col() ) );
         OUString aSheetName = "DPCache_" + maSheetSrcModel.maSheet;
-        rRange.Sheet = getWorksheets().insertEmptySheet( aSheetName );
-        mbValidSource = mbDummySheet = rRange.Sheet >= 0;
+        rRange.aStart.SetTab( getWorksheets().insertEmptySheet( aSheetName ) );
+        mbValidSource = mbDummySheet = rRange.aStart.Tab() >= 0;
     }
 }
 
diff --git a/sc/source/filter/oox/pivotcachefragment.cxx b/sc/source/filter/oox/pivotcachefragment.cxx
index 4f9c7a3..f324b12 100644
--- a/sc/source/filter/oox/pivotcachefragment.cxx
+++ b/sc/source/filter/oox/pivotcachefragment.cxx
@@ -197,7 +197,7 @@ void PivotCacheDefinitionFragment::finalizeImport()
         OUString aRecFragmentPath = getRelations().getFragmentPathFromRelId( mrPivotCache.getRecordsRelId() );
         if( !aRecFragmentPath.isEmpty() )
         {
-            sal_Int16 nSheet = mrPivotCache.getSourceRange().Sheet;
+            SCTAB nSheet = mrPivotCache.getSourceRange().aStart.Tab();
             WorksheetGlobalsRef xSheetGlob = WorksheetHelper::constructGlobals( *this, ISegmentProgressBarRef(), SHEETTYPE_WORKSHEET, nSheet );
             if( xSheetGlob.get() )
                 importOoxFragment( new PivotCacheRecordsFragment( *xSheetGlob, aRecFragmentPath, mrPivotCache ) );
diff --git a/sc/source/filter/oox/pivottablebuffer.cxx b/sc/source/filter/oox/pivottablebuffer.cxx
index 987cdc1..5a0281b 100644
--- a/sc/source/filter/oox/pivottablebuffer.cxx
+++ b/sc/source/filter/oox/pivottablebuffer.cxx
@@ -1202,7 +1202,11 @@ void PivotTable::finalizeImport()
                 Reference< XDataPilotTablesSupplier > xDPTablesSupp( getSheetFromDoc( maLocationModel.maRange.Sheet ), UNO_QUERY_THROW );
                 Reference< XDataPilotTables > xDPTables( xDPTablesSupp->getDataPilotTables(), UNO_SET_THROW );
                 mxDPDescriptor.set( xDPTables->createDataPilotDescriptor(), UNO_SET_THROW );
-                mxDPDescriptor->setSourceRange( mpPivotCache->getSourceRange() );
+                ScRange aRange = mpPivotCache->getSourceRange();
+                CellRangeAddress aCellRangeAddress = CellRangeAddress( aRange.aStart.Tab(),
+                                                      aRange.aStart.Col(), aRange.aStart.Row(),
+                                                      aRange.aEnd.Col(), aRange.aEnd.Row() );
+                mxDPDescriptor->setSourceRange( aCellRangeAddress );
                 mxDPDescriptor->setTag( maDefModel.maTag );
 
                 // TODO: This is a hack. Eventually we need to convert the whole thing to the internal API.
diff --git a/sc/source/filter/oox/tablebuffer.cxx b/sc/source/filter/oox/tablebuffer.cxx
index 3218701..737d0ce 100644
--- a/sc/source/filter/oox/tablebuffer.cxx
+++ b/sc/source/filter/oox/tablebuffer.cxx
@@ -90,9 +90,16 @@ void Table::finalizeImport()
     if( (maModel.mnId > 0) && !maModel.maDisplayName.isEmpty() ) try
     {
         maDBRangeName = maModel.maDisplayName;
+        ::css::table::CellRangeAddress aCellRangeAddress = ::css::table::CellRangeAddress(
+                    maModel.maRange.aStart.Tab(),
+                    maModel.maRange.aStart.Col(), maModel.maRange.aStart.Row(),
+                    maModel.maRange.aEnd.Col(), maModel.maRange.aEnd.Row() );
+
         Reference< XDatabaseRange > xDatabaseRange(
-            createDatabaseRangeObject( maDBRangeName, maModel.maRange ), UNO_SET_THROW);
-        maDestRange = xDatabaseRange->getDataArea();
+            createDatabaseRangeObject( maDBRangeName, aCellRangeAddress ), UNO_SET_THROW);
+        ::css::table::CellRangeAddress aAddressRange = xDatabaseRange->getDataArea();
+        maDestRange = ScRange( aAddressRange.StartColumn, aAddressRange.StartRow, aAddressRange.Sheet,
+                               aAddressRange.EndColumn, aAddressRange.EndRow, aAddressRange.Sheet );
 
         PropertySet aPropSet( xDatabaseRange );
 
diff --git a/sc/source/filter/oox/worksheethelper.cxx b/sc/source/filter/oox/worksheethelper.cxx
index 6d68ad4..525b036 100644
--- a/sc/source/filter/oox/worksheethelper.cxx
+++ b/sc/source/filter/oox/worksheethelper.cxx
@@ -206,7 +206,7 @@ public:
                             const WorkbookHelper& rHelper,
                             const ISegmentProgressBarRef& rxProgressBar,
                             WorksheetType eSheetType,
-                            sal_Int16 nSheet );
+                            SCTAB nSheet );
     virtual            ~WorksheetGlobals() override {}
 
     /** Returns true, if this helper refers to an existing Calc sheet. */
@@ -400,7 +400,7 @@ private:
     bool                mbHasDefWidth;      /// True = default column width is set from defaultColWidth attribute.
 };
 
-WorksheetGlobals::WorksheetGlobals( const WorkbookHelper& rHelper, const ISegmentProgressBarRef& rxProgressBar, WorksheetType eSheetType, sal_Int16 nSheet ) :
+WorksheetGlobals::WorksheetGlobals( const WorkbookHelper& rHelper, const ISegmentProgressBarRef& rxProgressBar, WorksheetType eSheetType, SCTAB nSheet ) :
     WorkbookHelper( rHelper ),
     maSheetCellRanges( "com.sun.star.sheet.SheetCellRanges" ),
     mrMaxApiPos( rHelper.getAddressConverter().getMaxApiAddress() ),
@@ -1389,7 +1389,7 @@ WorksheetHelper::WorksheetHelper( WorksheetGlobals& rSheetGlob ) :
 }
 
 /*static*/ WorksheetGlobalsRef WorksheetHelper::constructGlobals( const WorkbookHelper& rHelper,
-        const ISegmentProgressBarRef& rxProgressBar, WorksheetType eSheetType, sal_Int16 nSheet )
+        const ISegmentProgressBarRef& rxProgressBar, WorksheetType eSheetType, SCTAB nSheet )
 {
     WorksheetGlobalsRef xSheetGlob( new WorksheetGlobals( rHelper, rxProgressBar, eSheetType, nSheet ) );
     if( !xSheetGlob->isValidSheet() )


More information about the Libreoffice-commits mailing list