diff options
author | Steve Yin <steve_y@apache.org> | 2013-12-27 05:30:08 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-12-30 08:17:46 +0000 |
commit | 5249a2022aa7152cba5bb6541eade43b9e77b755 (patch) | |
tree | 4f4c31d9b34af9585114604529afd71600096572 | |
parent | ecc62c9cd21bec2580d5a936c7784735bff89504 (diff) |
Resolves: #i123910# reference in validation condition changed...
to #REF! in exported xls file
(cherry picked from commit 81912caea58b89f9490ba4b9e3a3127071e23190)
Change-Id: Iab560847f4528ffdcc68b365951cc6c55ca9075c
-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 ) |