diff options
Diffstat (limited to 'connectivity/source/drivers/calc/CDatabaseMetaData.cxx')
-rw-r--r-- | connectivity/source/drivers/calc/CDatabaseMetaData.cxx | 53 |
1 files changed, 26 insertions, 27 deletions
diff --git a/connectivity/source/drivers/calc/CDatabaseMetaData.cxx b/connectivity/source/drivers/calc/CDatabaseMetaData.cxx index 31798f5bafd0..aad5b4e50193 100644 --- a/connectivity/source/drivers/calc/CDatabaseMetaData.cxx +++ b/connectivity/source/drivers/calc/CDatabaseMetaData.cxx @@ -34,7 +34,6 @@ using namespace connectivity::file; using namespace connectivity::component; 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::table; @@ -59,37 +58,37 @@ static bool lcl_IsEmptyOrHidden( const Reference<XSpreadsheets>& xSheets, const { Any aAny = xSheets->getByName( rName ); Reference<XSpreadsheet> xSheet; - if ( aAny >>= xSheet ) + if ( !(aAny >>= xSheet) ) + return false; + + // test if sheet is hidden + + Reference<XPropertySet> xProp( xSheet, UNO_QUERY ); + if (xProp.is()) { - // test if sheet is hidden + bool bVisible; + Any aVisAny = xProp->getPropertyValue("IsVisible"); + if ( (aVisAny >>= bVisible) && !bVisible) + return true; // hidden + } - Reference<XPropertySet> xProp( xSheet, UNO_QUERY ); - if (xProp.is()) - { - bool bVisible; - Any aVisAny = xProp->getPropertyValue("IsVisible"); - if ( (aVisAny >>= bVisible) && !bVisible) - return true; // hidden - } + // use the same data area as in OCalcTable to test for empty table - // use the same data area as in OCalcTable to test for empty table + Reference<XSheetCellCursor> xCursor = xSheet->createCursor(); + Reference<XCellRangeAddressable> xRange( xCursor, UNO_QUERY ); + if ( xRange.is() ) + { + xCursor->collapseToSize( 1, 1 ); // single (first) cell + xCursor->collapseToCurrentRegion(); // contiguous data area - Reference<XSheetCellCursor> xCursor = xSheet->createCursor(); - Reference<XCellRangeAddressable> xRange( xCursor, UNO_QUERY ); - if ( xRange.is() ) + CellRangeAddress aRangeAddr = xRange->getRangeAddress(); + if ( aRangeAddr.StartColumn == aRangeAddr.EndColumn && + aRangeAddr.StartRow == aRangeAddr.EndRow ) { - xCursor->collapseToSize( 1, 1 ); // single (first) cell - xCursor->collapseToCurrentRegion(); // contiguous data area - - CellRangeAddress aRangeAddr = xRange->getRangeAddress(); - if ( aRangeAddr.StartColumn == aRangeAddr.EndColumn && - aRangeAddr.StartRow == aRangeAddr.EndRow ) - { - // single cell -> check content - Reference<XCell> xCell = xCursor->getCellByPosition( 0, 0 ); - if ( xCell.is() && xCell->getType() == CellContentType_EMPTY ) - return true; - } + // single cell -> check content + Reference<XCell> xCell = xCursor->getCellByPosition( 0, 0 ); + if ( xCell.is() && xCell->getType() == CellContentType_EMPTY ) + return true; } } |