Kaydet (Commit) e316c4f2 authored tarafından Jochen Nitschke's avatar Jochen Nitschke

tdf#48140 replace CellAddress in xlsx import (1)

Change-Id: I14bd0d9d55a03f4cd33aaf131e66f859569f5b18
Reviewed-on: https://gerrit.libreoffice.org/32968Reviewed-by: 's avatarJochen Nitschke <j.nitschke+logerrit@ok.de>
Tested-by: 's avatarJochen Nitschke <j.nitschke+logerrit@ok.de>
üst b365d56e
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#define INCLUDED_SC_SOURCE_FILTER_INC_ADDRESSCONVERTER_HXX #define INCLUDED_SC_SOURCE_FILTER_INC_ADDRESSCONVERTER_HXX
#include <vector> #include <vector>
#include <com/sun/star/table/CellAddress.hpp>
#include <com/sun/star/table/CellRangeAddress.hpp> #include <com/sun/star/table/CellRangeAddress.hpp>
#include "workbookhelper.hxx" #include "workbookhelper.hxx"
...@@ -239,17 +238,6 @@ public: ...@@ -239,17 +238,6 @@ public:
*/ */
bool checkTab( sal_Int16 nSheet, bool bTrackOverflow ); bool checkTab( sal_Int16 nSheet, bool bTrackOverflow );
/** Checks the passed cell address if it fits into the spreadsheet limits.
@param rAddress The cell address to be checked.
@param bTrackOverflow true = Update the internal overflow flags, if
the address is outside of the supported sheet limits.
@return true = Passed address is valid (no index overflow).
*/
bool checkCellAddress(
const css::table::CellAddress& rAddress,
bool bTrackOverflow );
/** Checks the passed cell address if it fits into the spreadsheet limits. /** Checks the passed cell address if it fits into the spreadsheet limits.
@param rAddress The cell address to be checked. @param rAddress The cell address to be checked.
......
...@@ -193,9 +193,6 @@ public: ...@@ -193,9 +193,6 @@ public:
getSheet() const; getSheet() const;
/** Returns the XCell interface for the passed cell address. */ /** Returns the XCell interface for the passed cell address. */
css::uno::Reference< css::table::XCell >
getCell( const css::table::CellAddress& rAddress ) const;
css::uno::Reference< css::table::XCell > css::uno::Reference< css::table::XCell >
getCell( const ScAddress& rAddress ) const; getCell( const ScAddress& rAddress ) const;
/** Returns the XCellRange interface for the passed cell range address. */ /** Returns the XCellRange interface for the passed cell range address. */
......
...@@ -262,14 +262,6 @@ bool AddressConverter::checkTab( sal_Int16 nSheet, bool bTrackOverflow ) ...@@ -262,14 +262,6 @@ bool AddressConverter::checkTab( sal_Int16 nSheet, bool bTrackOverflow )
return bValid; return bValid;
} }
bool AddressConverter::checkCellAddress( const CellAddress& rAddress, bool bTrackOverflow )
{
return
checkTab( rAddress.Sheet, bTrackOverflow ) &&
checkCol( rAddress.Column, bTrackOverflow ) &&
checkRow( rAddress.Row, bTrackOverflow );
}
bool AddressConverter::checkCellAddress( const ScAddress& rAddress, bool bTrackOverflow ) bool AddressConverter::checkCellAddress( const ScAddress& rAddress, bool bTrackOverflow )
{ {
return return
......
...@@ -133,16 +133,16 @@ void Comment::finalizeImport() ...@@ -133,16 +133,16 @@ void Comment::finalizeImport()
// BIFF12 stores cell range instead of cell address, use first cell of this range // BIFF12 stores cell range instead of cell address, use first cell of this range
OSL_ENSURE( maModel.maRange.aStart == maModel.maRange.aEnd, OSL_ENSURE( maModel.maRange.aStart == maModel.maRange.aEnd,
"Comment::finalizeImport - comment anchor should be a single cell" ); "Comment::finalizeImport - comment anchor should be a single cell" );
CellAddress aNotePos( maModel.maRange.aStart.Tab(), maModel.maRange.aStart.Col(), maModel.maRange.aStart.Row() ); if( getAddressConverter().checkCellAddress( maModel.maRange.aStart, true ) && maModel.mxText.get() ) try
if( getAddressConverter().checkCellAddress( aNotePos, true ) && maModel.mxText.get() ) try
{ {
CellAddress aNotePos( maModel.maRange.aStart.Tab(), maModel.maRange.aStart.Col(), maModel.maRange.aStart.Row() );
Reference< XSheetAnnotationsSupplier > xAnnosSupp( getSheet(), UNO_QUERY_THROW ); Reference< XSheetAnnotationsSupplier > xAnnosSupp( getSheet(), UNO_QUERY_THROW );
Reference< XSheetAnnotations > xAnnos( xAnnosSupp->getAnnotations(), UNO_SET_THROW ); Reference< XSheetAnnotations > xAnnos( xAnnosSupp->getAnnotations(), UNO_SET_THROW );
// non-empty string required by note implementation (real text will be added below) // non-empty string required by note implementation (real text will be added below)
xAnnos->insertNew( aNotePos, OUString( ' ' ) ); xAnnos->insertNew( aNotePos, OUString( ' ' ) );
// receive created note from cell (insertNew does not return the note) // receive created note from cell (insertNew does not return the note)
Reference< XSheetAnnotationAnchor > xAnnoAnchor( getCell( aNotePos ), UNO_QUERY_THROW ); Reference< XSheetAnnotationAnchor > xAnnoAnchor( getCell( maModel.maRange.aStart ), UNO_QUERY_THROW );
Reference< XSheetAnnotation > xAnno( xAnnoAnchor->getAnnotation(), UNO_SET_THROW ); Reference< XSheetAnnotation > xAnno( xAnnoAnchor->getAnnotation(), UNO_SET_THROW );
Reference< XSheetAnnotationShapeSupplier > xAnnoShapeSupp( xAnno, UNO_QUERY_THROW ); Reference< XSheetAnnotationShapeSupplier > xAnnoShapeSupp( xAnno, UNO_QUERY_THROW );
Reference< XShape > xAnnoShape( xAnnoShapeSupp->getAnnotationShape(), UNO_SET_THROW ); Reference< XShape > xAnnoShape( xAnnoShapeSupp->getAnnotationShape(), UNO_SET_THROW );
......
...@@ -219,7 +219,6 @@ public: ...@@ -219,7 +219,6 @@ public:
inline const Reference< XSpreadsheet >& getSheet() const { return mxSheet; } inline const Reference< XSpreadsheet >& getSheet() const { return mxSheet; }
/** Returns the XCell interface for the passed cell address. */ /** Returns the XCell interface for the passed cell address. */
Reference< XCell > getCell( const CellAddress& rAddress ) const;
Reference< XCell > getCell( const ScAddress& rAddress ) const; Reference< XCell > getCell( const ScAddress& rAddress ) const;
/** Returns the XCellRange interface for the passed cell range address. */ /** Returns the XCellRange interface for the passed cell range address. */
Reference< XCellRange > getCellRange( const ScRange& rRange ) const; Reference< XCellRange > getCellRange( const ScRange& rRange ) const;
...@@ -449,19 +448,6 @@ WorksheetGlobals::WorksheetGlobals( const WorkbookHelper& rHelper, const ISegmen ...@@ -449,19 +448,6 @@ WorksheetGlobals::WorksheetGlobals( const WorkbookHelper& rHelper, const ISegmen
} }
} }
Reference< XCell > WorksheetGlobals::getCell( const CellAddress& rAddress ) const
{
Reference< XCell > xCell;
if( mxSheet.is() ) try
{
xCell = mxSheet->getCellByPosition( rAddress.Column, rAddress.Row );
}
catch( Exception& )
{
}
return xCell;
}
Reference< XCell > WorksheetGlobals::getCell( const ScAddress& rAddress ) const Reference< XCell > WorksheetGlobals::getCell( const ScAddress& rAddress ) const
{ {
Reference< XCell > xCell; Reference< XCell > xCell;
...@@ -555,7 +541,7 @@ const awt::Size& WorksheetGlobals::getDrawPageSize() const ...@@ -555,7 +541,7 @@ const awt::Size& WorksheetGlobals::getDrawPageSize() const
awt::Point WorksheetGlobals::getCellPosition( sal_Int32 nCol, sal_Int32 nRow ) const awt::Point WorksheetGlobals::getCellPosition( sal_Int32 nCol, sal_Int32 nRow ) const
{ {
awt::Point aPoint; awt::Point aPoint;
PropertySet aCellProp( getCell( CellAddress( getSheetIndex(), nCol, nRow ) ) ); PropertySet aCellProp( getCell( ScAddress( nCol, nRow, getSheetIndex() ) ) );
aCellProp.getProperty( aPoint, PROP_Position ); aCellProp.getProperty( aPoint, PROP_Position );
return aPoint; return aPoint;
} }
...@@ -563,7 +549,7 @@ awt::Point WorksheetGlobals::getCellPosition( sal_Int32 nCol, sal_Int32 nRow ) c ...@@ -563,7 +549,7 @@ awt::Point WorksheetGlobals::getCellPosition( sal_Int32 nCol, sal_Int32 nRow ) c
awt::Size WorksheetGlobals::getCellSize( sal_Int32 nCol, sal_Int32 nRow ) const awt::Size WorksheetGlobals::getCellSize( sal_Int32 nCol, sal_Int32 nRow ) const
{ {
awt::Size aSize; awt::Size aSize;
PropertySet aCellProp( getCell( CellAddress( getSheetIndex(), nCol, nRow ) ) ); PropertySet aCellProp( getCell( ScAddress( nCol, nRow, getSheetIndex() ) ) );
aCellProp.getProperty( aSize, PROP_Size ); aCellProp.getProperty( aSize, PROP_Size );
return aSize; return aSize;
} }
...@@ -1398,11 +1384,6 @@ const Reference< XSpreadsheet >& WorksheetHelper::getSheet() const ...@@ -1398,11 +1384,6 @@ const Reference< XSpreadsheet >& WorksheetHelper::getSheet() const
return mrSheetGlob.getSheet(); return mrSheetGlob.getSheet();
} }
Reference< XCell > WorksheetHelper::getCell( const CellAddress& rAddress ) const
{
return mrSheetGlob.getCell( rAddress );
}
Reference< XCell > WorksheetHelper::getCell( const ScAddress& rAddress ) const Reference< XCell > WorksheetHelper::getCell( const ScAddress& rAddress ) const
{ {
return mrSheetGlob.getCell( rAddress ); return mrSheetGlob.getCell( rAddress );
......
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