[Libreoffice-commits] core.git: Branch 'aoo/trunk' - oox/inc oox/source

Steve Yin steve_y at apache.org
Sun Dec 29 22:07:40 PST 2013


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

New commits:
commit 7e7e0c820f442e3a7ee1b5f6ad80fe7999a75f0b
Author: Steve Yin <steve_y at apache.org>
Date:   Mon Dec 30 05:52:36 2013 +0000

    Bug 123910 - The reference in validation condition change to #REF! in exported xls file
    
    Build break fix

diff --git a/oox/inc/oox/xls/worksheethelper.hxx b/oox/inc/oox/xls/worksheethelper.hxx
index f32f53a..c0b8b2e 100644
--- a/oox/inc/oox/xls/worksheethelper.hxx
+++ b/oox/inc/oox/xls/worksheethelper.hxx
@@ -154,6 +154,7 @@ struct ValidationModel
     ApiCellRangeList    maRanges;
     ApiTokenSequence    maTokens1;
     ApiTokenSequence    maTokens2;
+    ::rtl::OUString     msRef;
     ::rtl::OUString     maInputTitle;
     ::rtl::OUString     maInputMessage;
     ::rtl::OUString     maErrorTitle;
diff --git a/oox/source/xls/worksheetfragment.cxx b/oox/source/xls/worksheetfragment.cxx
index 5c28866..cff0363 100644
--- a/oox/source/xls/worksheetfragment.cxx
+++ b/oox/source/xls/worksheetfragment.cxx
@@ -158,6 +158,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/oox/source/xls/worksheethelper.cxx b/oox/source/xls/worksheethelper.cxx
index 8174341..0f84cad 100644
--- a/oox/source/xls/worksheethelper.cxx
+++ b/oox/source/xls/worksheethelper.cxx
@@ -1093,6 +1093,26 @@ void WorksheetGlobals::finalizeValidationRanges() const
             {
             }
 
+            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( Exception& )
+            {
+            }
+
             // convert validation type to API enum
             ValidationType eType = ValidationType_ANY;
             switch( aIt->mnType )


More information about the Libreoffice-commits mailing list