diff options
author | Daniel Bankston <daniel.e.bankston@gmail.com> | 2012-07-07 07:15:21 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@gmail.com> | 2012-07-11 20:37:41 -0400 |
commit | e94b1331b1e2139e09bd0ef663394ede80f11be3 (patch) | |
tree | 59567fe977815e8006f0b684052f0bc0f85c4026 /sc | |
parent | 5c5798878fd858183bd59b842ffa2ab79877cce5 (diff) |
Use indexOf instead of match
Change-Id: I2743929c3ba06ce1345d7217d9297515d2b5b2e4
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/filter/xml/xmlcelli.cxx | 12 | ||||
-rw-r--r-- | sc/source/ui/docshell/docsh.cxx | 5 |
2 files changed, 14 insertions, 3 deletions
diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx index 59ca217ce27e..3da5996ca10a 100644 --- a/sc/source/filter/xml/xmlcelli.cxx +++ b/sc/source/filter/xml/xmlcelli.cxx @@ -996,6 +996,15 @@ void ScXMLTableRowCellContext::AddNonFormulaCells( const ScAddress& rCellPos ) } } +namespace{ + +bool isErrOrNA(const rtl::OUString& rStr) +{ + return (rStr.indexOf("Err:") > -1) || (rStr.indexOf("#N/A") > -1); +} + +} + void ScXMLTableRowCellContext::AddNonMatrixFormulaCell( const ScAddress& rCellPos ) { ScDocument* pDoc = rXMLImport.GetDocument(); @@ -1007,8 +1016,7 @@ void ScXMLTableRowCellContext::AddNonMatrixFormulaCell( const ScAddress& rCellPo pExtRefGuard.reset(new ScExternalRefManager::ApiGuard(pDoc)); //if this is an "Err:###" or "#N/A" then use text:p value - if( bFormulaTextResult && pOUTextContent && - (pOUTextContent->match("Err:") || pOUTextContent->match("#N/A")) ) + if( bFormulaTextResult && pOUTextContent && isErrOrNA(*pOUTextContent) ) pOUTextValue.reset(*pOUTextContent); ScBaseCell* pNewCell = NULL; diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index 9e769de2ff66..752367c2ce3f 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -429,10 +429,13 @@ sal_Bool ScDocShell::LoadXML( SfxMedium* pLoadMedium, const ::com::sun::star::un if ( nError ) pLoadMedium->SetError( nError, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) ); + //if the document was not generated by LibreOffice, do hard recalc in case some other document + //generator saved cached formula results that differ from LibreOffice's calculated results or + //did not use cached formula results. uno::Reference<document::XDocumentPropertiesSupplier> xDPS(GetModel(), uno::UNO_QUERY_THROW); uno::Reference<document::XDocumentProperties> xDocProps = xDPS->getDocumentProperties(); rtl::OUString sGenerator(xDocProps->getGenerator()); - if(!sGenerator.match(SC_LIBO_PROD_NAME)) + if(sGenerator.indexOf(SC_LIBO_PROD_NAME) == -1) DoHardRecalc(false); aDocument.SetXMLFromWrapper( false ); |