diff options
-rw-r--r-- | sc/source/filter/inc/worksheethelper.hxx | 1 | ||||
-rw-r--r-- | sc/source/filter/oox/worksheetfragment.cxx | 1 | ||||
-rw-r--r-- | sc/source/filter/oox/worksheethelper.cxx | 20 |
3 files changed, 22 insertions, 0 deletions
diff --git a/sc/source/filter/inc/worksheethelper.hxx b/sc/source/filter/inc/worksheethelper.hxx index 9e231615b795..d93ccc47751a 100644 --- a/sc/source/filter/inc/worksheethelper.hxx +++ b/sc/source/filter/inc/worksheethelper.hxx @@ -152,6 +152,7 @@ struct ValidationModel ApiCellRangeList maRanges; ApiTokenSequence maTokens1; ApiTokenSequence maTokens2; + OUString msRef; OUString maInputTitle; OUString maInputMessage; OUString maErrorTitle; diff --git a/sc/source/filter/oox/worksheetfragment.cxx b/sc/source/filter/oox/worksheetfragment.cxx index 927eb2bb9a20..81b6411b945b 100644 --- a/sc/source/filter/oox/worksheetfragment.cxx +++ b/sc/source/filter/oox/worksheetfragment.cxx @@ -147,6 +147,7 @@ void DataValidationsContext::importDataValidation( const AttributeList& rAttribs { mxValModel.reset( new ValidationModel ); getAddressConverter().convertToCellRangeList( mxValModel->maRanges, rAttribs.getString( XML_sqref, OUString() ), getSheetIndex(), true ); + mxValModel->msRef = rAttribs.getString( XML_sqref, OUString() ); mxValModel->maInputTitle = rAttribs.getXString( XML_promptTitle, OUString() ); mxValModel->maInputMessage = rAttribs.getXString( XML_prompt, OUString() ); mxValModel->maErrorTitle = rAttribs.getXString( XML_errorTitle, OUString() ); diff --git a/sc/source/filter/oox/worksheethelper.cxx b/sc/source/filter/oox/worksheethelper.cxx index 597456059399..47b759d3b4b3 100644 --- a/sc/source/filter/oox/worksheethelper.cxx +++ b/sc/source/filter/oox/worksheethelper.cxx @@ -1103,6 +1103,26 @@ void WorksheetGlobals::finalizeValidationRanges() const { PropertySet aValProps( xValidation ); + try + { + sal_Int32 nIndex = 0; + OUString aToken = aIt->msRef.getToken( 0, ' ', nIndex ); + + Reference<XSpreadsheet> xSheet = getSheetFromDoc( getCurrentSheetIndex() ); + Reference<XCellRange> xDBCellRange; + Reference<XCell> xCell; + xDBCellRange = xSheet->getCellRangeByName( aToken ); + + xCell = xDBCellRange->getCellByPosition( 0, 0 ); + Reference<XCellAddressable> xCellAddressable( xCell, UNO_QUERY_THROW ); + CellAddress aFirstCell = xCellAddressable->getCellAddress(); + Reference<XSheetCondition> xCondition( xValidation, UNO_QUERY_THROW ); + xCondition->setSourcePosition( aFirstCell ); + } + catch(const Exception&) + { + } + // convert validation type to API enum ValidationType eType = ValidationType_ANY; switch( aIt->mnType ) |