diff options
Diffstat (limited to 'connectivity/source/drivers/calc/CTable.cxx')
-rw-r--r-- | connectivity/source/drivers/calc/CTable.cxx | 70 |
1 files changed, 25 insertions, 45 deletions
diff --git a/connectivity/source/drivers/calc/CTable.cxx b/connectivity/source/drivers/calc/CTable.cxx index 8e37cdd99071..da7e74542af3 100644 --- a/connectivity/source/drivers/calc/CTable.cxx +++ b/connectivity/source/drivers/calc/CTable.cxx @@ -49,10 +49,8 @@ using namespace ::cppu; using namespace ::dbtools; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::sdbcx; using namespace ::com::sun::star::sdbc; using namespace ::com::sun::star::container; -using namespace ::com::sun::star::lang; using namespace ::com::sun::star::sheet; using namespace ::com::sun::star::table; using namespace ::com::sun::star::text; @@ -71,14 +69,11 @@ static void lcl_UpdateArea( const Reference<XCellRange>& xUsedRange, sal_Int32& CellFlags::STRING | CellFlags::VALUE | CellFlags::DATETIME | CellFlags::FORMULA | CellFlags::ANNOTATION; const Reference<XSheetCellRanges> xUsedRanges = xUsedQuery->queryContentCells( nContentFlags ); - const Sequence<CellRangeAddress> aAddresses = xUsedRanges->getRangeAddresses(); - const sal_Int32 nCount = aAddresses.getLength(); - const CellRangeAddress* pData = aAddresses.getConstArray(); - for ( sal_Int32 i=0; i<nCount; i++ ) + for (auto& address : xUsedRanges->getRangeAddresses()) { - rEndCol = std::max(pData[i].EndColumn, rEndCol); - rEndRow = std::max(pData[i].EndRow, rEndRow); + rEndCol = std::max(address.EndColumn, rEndCol); + rEndRow = std::max(address.EndRow, rEndRow); } } @@ -139,7 +134,7 @@ static CellContentType lcl_GetContentOrResultType( const Reference<XCell>& xCell Reference<XPropertySet> xProp( xCell, UNO_QUERY ); try { - xProp->getPropertyValue( "CellContentType" ) >>= eCellType; // type of cell content + xProp->getPropertyValue( u"CellContentType"_ustr ) >>= eCellType; // type of cell content } catch (UnknownPropertyException&) { @@ -191,24 +186,23 @@ static bool lcl_HasTextInColumn( const Reference<XSpreadsheet>& xSheet, sal_Int3 // look for any text cell or text result in the column Reference<XCellRangeAddressable> xAddr( xSheet, UNO_QUERY ); - if (xAddr.is()) - { - CellRangeAddress aTotalRange = xAddr->getRangeAddress(); - sal_Int32 nLastRow = aTotalRange.EndRow; - Reference<XCellRangesQuery> xQuery( xSheet->getCellRangeByPosition( nDocColumn, nDocRow, nDocColumn, nLastRow ), UNO_QUERY ); - if (xQuery.is()) - { - // are there text cells in the column? - Reference<XSheetCellRanges> xTextContent = xQuery->queryContentCells( CellFlags::STRING ); - if ( xTextContent.is() && xTextContent->hasElements() ) - return true; - - // are there formulas with text results in the column? - Reference<XSheetCellRanges> xTextFormula = xQuery->queryFormulaCells( FormulaResult::STRING ); - if ( xTextFormula.is() && xTextFormula->hasElements() ) - return true; - } - } + if (!xAddr) + return false; + CellRangeAddress aTotalRange = xAddr->getRangeAddress(); + sal_Int32 nLastRow = aTotalRange.EndRow; + Reference<XCellRangesQuery> xQuery( xSheet->getCellRangeByPosition( nDocColumn, nDocRow, nDocColumn, nLastRow ), UNO_QUERY ); + if (!xQuery) + return false; + + // are there text cells in the column? + Reference<XSheetCellRanges> xTextContent = xQuery->queryContentCells( CellFlags::STRING ); + if ( xTextContent.is() && xTextContent->hasElements() ) + return true; + + // are there formulas with text results in the column? + Reference<XSheetCellRanges> xTextFormula = xQuery->queryFormulaCells( FormulaResult::STRING ); + if ( xTextFormula.is() && xTextFormula->hasElements() ) + return true; return false; } @@ -254,7 +248,7 @@ static void lcl_GetColumnInfo( const Reference<XSpreadsheet>& xSheet, const Refe { sal_Int32 nKey = 0; - if ( xProp->getPropertyValue( "NumberFormat" ) >>= nKey ) + if ( xProp->getPropertyValue( u"NumberFormat"_ustr ) >>= nKey ) { const Reference<XPropertySet> xFormat = xFormats->getByKey( nKey ); if ( xFormat.is() ) @@ -538,7 +532,7 @@ void OCalcTable::construct() Reference<XPropertySet> xDocProp( xDoc, UNO_QUERY ); if ( xDocProp.is() ) { - Reference<XDatabaseRanges> xRanges(xDocProp->getPropertyValue("DatabaseRanges"),UNO_QUERY); + Reference<XDatabaseRanges> xRanges(xDocProp->getPropertyValue(u"DatabaseRanges"_ustr),UNO_QUERY); if ( xRanges.is() && xRanges->hasByName( m_Name ) ) { @@ -552,7 +546,7 @@ void OCalcTable::construct() bool bRangeHeader = true; Reference<XPropertySet> xFiltProp( xDBRange->getFilterDescriptor(), UNO_QUERY ); if ( xFiltProp.is() ) - xFiltProp->getPropertyValue("ContainsHeader") >>= bRangeHeader; + xFiltProp->getPropertyValue(u"ContainsHeader"_ustr) >>= bRangeHeader; Reference<XSheetCellRange> xSheetRange( xRefer->getReferredCells(), UNO_QUERY ); Reference<XCellRangeAddressable> xAddr( xSheetRange, UNO_QUERY ); @@ -586,7 +580,7 @@ void OCalcTable::construct() if (xProp.is()) { css::util::Date aDateStruct; - if ( xProp->getPropertyValue("NullDate") >>= aDateStruct ) + if ( xProp->getPropertyValue(u"NullDate"_ustr) >>= aDateStruct ) m_aNullDate = ::Date( aDateStruct.Day, aDateStruct.Month, aDateStruct.Year ); } } @@ -609,20 +603,6 @@ void SAL_CALL OCalcTable::disposing() } -Sequence< sal_Int8 > OCalcTable::getUnoTunnelId() -{ - static const comphelper::UnoIdInit implId; - return implId.getSeq(); -} - -// css::lang::XUnoTunnel - -sal_Int64 OCalcTable::getSomething( const Sequence< sal_Int8 > & rId ) -{ - return comphelper::getSomethingImpl(rId, this, - comphelper::FallbackToGetSomethingOf<OCalcTable_BASE>{}); -} - bool OCalcTable::fetchRow( OValueRefRow& _rRow, const OSQLColumns & _rCols, bool bRetrieveData ) { |