diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2016-04-07 08:20:12 +0200 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2016-05-02 18:14:10 +0200 |
commit | fdb04adc44fc1f1ff85390e55730f78d6c644e41 (patch) | |
tree | 7c3f8c00e0757ff6d6f80ec2eb64aa1c6bde0f93 | |
parent | d2f262ba4105d7c6d8c30e46f64fc4949e7884fe (diff) |
we need the position in the formula converter, tdf#99093
Reviewed-on: https://gerrit.libreoffice.org/23884
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
(cherry picked from commit e214df32fb3637bd7810a299fb8b38810b1a3874)
Change-Id: Ic3dd13aa4d4b8190b78f3e6f1cdda844e39cc719
-rw-r--r-- | sc/source/filter/excel/xicontent.cxx | 60 |
1 files changed, 37 insertions, 23 deletions
diff --git a/sc/source/filter/excel/xicontent.cxx b/sc/source/filter/excel/xicontent.cxx index 96130197302b..69e77b5f5444 100644 --- a/sc/source/filter/excel/xicontent.cxx +++ b/sc/source/filter/excel/xicontent.cxx @@ -768,35 +768,21 @@ void XclImpValidationManager::ReadDV( XclImpStream& rStrm ) rStrm.SetNulSubstChar( '\n' ); ::std::unique_ptr< ScTokenArray > xTokArr1; - sal_uInt16 nLen = 0; - nLen = rStrm.ReaduInt16(); + // We can't import the formula directly because we need the range + sal_uInt16 nLenFormula1 = rStrm.ReaduInt16(); rStrm.Ignore( 2 ); - if( nLen > 0 ) - { - const ScTokenArray* pTokArr = 0; - rFmlaConv.Reset(); - rFmlaConv.Convert( pTokArr, rStrm, nLen, false, FT_CondFormat ); - // formula converter owns pTokArr -> create a copy of the token array - if( pTokArr ) - xTokArr1.reset( pTokArr->Clone() ); - } - rStrm.SetNulSubstChar(); // back to default + XclImpStreamPos aPosFormula1; + rStrm.StorePosition(aPosFormula1); + rStrm.Ignore(nLenFormula1); // second formula ::std::unique_ptr< ScTokenArray > xTokArr2; - nLen = 0; - nLen = rStrm.ReaduInt16(); + sal_uInt16 nLenFormula2 = rStrm.ReaduInt16(); rStrm.Ignore( 2 ); - if( nLen > 0 ) - { - const ScTokenArray* pTokArr = 0; - rFmlaConv.Reset(); - rFmlaConv.Convert( pTokArr, rStrm, nLen, false, FT_CondFormat ); - // formula converter owns pTokArr -> create a copy of the token array - if( pTokArr ) - xTokArr2.reset( pTokArr->Clone() ); - } + XclImpStreamPos aPosFormula2; + rStrm.StorePosition(aPosFormula2); + rStrm.Ignore(nLenFormula2); // read all cell ranges XclRangeList aXclRanges; @@ -810,6 +796,34 @@ void XclImpValidationManager::ReadDV( XclImpStream& rStrm ) if ( aScRanges.empty() ) return; + ScRange aCombinedRange = aScRanges.Combine(); + + XclImpStreamPos aCurrentPos; + rStrm.StorePosition(aCurrentPos); + rStrm.RestorePosition(aPosFormula1); + if( nLenFormula1 > 0 ) + { + const ScTokenArray* pTokArr = nullptr; + rFmlaConv.Reset(aCombinedRange.aStart); + rFmlaConv.Convert( pTokArr, rStrm, nLenFormula1, false, FT_CondFormat ); + // formula converter owns pTokArr -> create a copy of the token array + if( pTokArr ) + xTokArr1.reset( pTokArr->Clone() ); + } + rStrm.SetNulSubstChar(); // back to default + if (nLenFormula2 > 0) + { + rStrm.RestorePosition(aPosFormula2); + const ScTokenArray* pTokArr = nullptr; + rFmlaConv.Reset(aCombinedRange.aStart); + rFmlaConv.Convert( pTokArr, rStrm, nLenFormula2, false, FT_CondFormat ); + // formula converter owns pTokArr -> create a copy of the token array + if( pTokArr ) + xTokArr2.reset( pTokArr->Clone() ); + } + + rStrm.RestorePosition(aCurrentPos); + bool bIsValid = true; // valid settings in flags field ScValidationMode eValMode = SC_VALID_ANY; |