sc/source/filter/inc/worksheethelper.hxx   |    1 +
 sc/source/filter/oox/worksheetfragment.cxx |    1 +
 sc/source/filter/oox/worksheethelper.cxx   |   20 ++++++++++++++++++++
 3 files changed, 22 insertions(+)

New commits:
commit 5249a2022aa7152cba5bb6541eade43b9e77b755
Author: Steve Yin <stev...@apache.org>
Date:   Fri Dec 27 05:30:08 2013 +0000

    Resolves: #i123910# reference in validation condition changed...
    
    to #REF! in exported xls file
    
    (cherry picked from commit 81912caea58b89f9490ba4b9e3a3127071e23190)
    
    Change-Id: Iab560847f4528ffdcc68b365951cc6c55ca9075c

diff --git a/sc/source/filter/inc/worksheethelper.hxx 
b/sc/source/filter/inc/worksheethelper.hxx
index 9e23161..d93ccc4 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 927eb2b..81b6411b 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 5974560..47b759d 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 )
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to