From 4212803e08052af2c1b3618f52fefb651c429345 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Fri, 18 Oct 2019 16:50:31 +0200 Subject: sw: WW8 import: be a little more flexible with FORMTEXT fields The subsequent export change will somehow create things like (rr) p pF->nLCode $1 = 13 (rr) p rStr $2 = " FORMTEXT \001\062\060" ... so be a little less strict with the 0x01. Change-Id: Ie99002d099a3803989b71ae8c26b7f4bfe61c943 Reviewed-on: https://gerrit.libreoffice.org/81083 Tested-by: Jenkins Reviewed-by: Michael Stahl --- sw/source/filter/ww8/ww8par3.cxx | 5 +++-- sw/source/filter/ww8/ww8par5.cxx | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'sw') diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx index 97701b5a2ea6..e62e13f6572d 100644 --- a/sw/source/filter/ww8/ww8par3.cxx +++ b/sw/source/filter/ww8/ww8par3.cxx @@ -91,8 +91,9 @@ eF_ResT SwWW8ImplReader::Read_F_FormTextBox( WW8FieldDesc* pF, OUString& rStr ) { WW8FormulaEditBox aFormula(*this); - if (pF->nLCode && rStr[pF->nLCode-1]==0x01) { - ImportFormulaControl(aFormula,pF->nSCode+pF->nLCode-1, WW8_CT_EDIT); + sal_Int32 const nPos(rStr.indexOf(0x01)); + if (pF->nLCode && nPos != -1 && nPos < pF->nLCode) { + ImportFormulaControl(aFormula, pF->nSCode + nPos, WW8_CT_EDIT); } /* diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx index 1ddbb49c3823..4089c42a665f 100644 --- a/sw/source/filter/ww8/ww8par5.cxx +++ b/sw/source/filter/ww8/ww8par5.cxx @@ -895,6 +895,7 @@ long SwWW8ImplReader::Read_Field(WW8PLCFManResult* pRes) if (aF.nId == 33) aF.bCodeNest=false; // do not recurse into nested page fields bool bCodeNest = aF.bCodeNest; if ( aF.nId == 6 ) bCodeNest = false; // We can handle them and lose the inner data + if (aF.nId == 70) bCodeNest = false; // need to import 0x01 in FORMTEXT m_aFieldStack.emplace_back(*m_pPaM->GetPoint(), aF.nId); -- cgit