Apache OpenOffice (AOO) Bugzilla – Issue 119440
[From Symphony]Some field is not shown
Last modified: 2017-05-20 10:31:57 UTC
Created attachment 77626 [details] sample Build: AOO3.4 Load sample file, compare with MS Office Defect: three fields above the table in page 2 are not shown.
The problem is that the field code like "eq \o \ad (XXX)" is not supported in Writer. The only usage of EQ field is to support Combined Characters which is strictly follow the pattern "eq \o(\s\up Y(XXX),\s\do Y(XXX))" and Ruby text. Since the "\o \ad" is unsupported field, so the solution is skipped the token when parsing EQ field.
Created attachment 78837 [details] patch for i119440
Created attachment 78838 [details] patch for i119440
Created attachment 78839 [details] test case for i119440 post my test case for reference
Comment on attachment 78838 [details] patch for i119440 Patch looks good and solves the problem. I have adjusted the patch - see my further comment
@zjchen: I would like to propose the following change to the patch: replace + else if ( sCombinedCharacters.Len() == 0 ) + { + String sPart = aOriFldParam.GetResult(); + xub_StrLen nBegin = sPart.Search('('); + xub_StrLen nEnd = sPart.Search(')'); + xub_StrLen nOldBegin = nBegin; + for (int i = nBegin;i< nEnd-1;i++) + { + char cC = sPart.GetChar(nBegin+1); + if ( (-1 < cC) && (cC < 32) ) + { + nBegin++; + } + else if ( i > nOldBegin) + { + nBegin--; + } + else + break; + } + if ((nBegin != STRING_NOTFOUND) && + (nEnd != STRING_NOTFOUND)) + { + sCombinedCharacters += + sPart.Copy(nBegin+1,nEnd-nBegin-1); + } + if (sCombinedCharacters.Len()) + { + if (STRING_NOTFOUND != (nEnd = sPart.Search(','))) + { + sCombinedCharacters = + sPart.Copy(nBegin+1,nEnd-nBegin-1); + } + SwInputField aFld( (SwInputFieldType*)rDoc.GetSysFldType( RES_INPUTFLD ), + sCombinedCharacters, sCombinedCharacters, INP_TXT, 0 ); + rDoc.InsertPoolItem( *pPaM, SwFmtFld( aFld ), 0 ); // insert input field + } by + else + { + const String sPart = aOriFldParam.GetResult(); + xub_StrLen nBegin = sPart.Search('('); + xub_StrLen nEnd = sPart.Search(','); + if ( nEnd == STRING_NOTFOUND ) + { + nEnd = sPart.Search(')'); + } + if ( (nBegin != STRING_NOTFOUND) && (nEnd != STRING_NOTFOUND) ) + { + // skip certain leading characters + for (int i = nBegin;i< nEnd-1;i++) + { + const sal_Unicode cC = sPart.GetChar(nBegin+1); + if ( (-1 < cC) && (cC < 32) ) + { + nBegin++; + } + else + break; + } + sCombinedCharacters = sPart.Copy( nBegin+1, nEnd-nBegin-1 ); + if ( sCombinedCharacters.Len() != 0 ) + { + SwInputField aFld( (SwInputFieldType*)rDoc.GetSysFldType( RES_INPUTFLD ), + sCombinedCharacters, sCombinedCharacters, INP_TXT, 0 ); + rDoc.InsertPoolItem( *pPaM, SwFmtFld( aFld ), 0 ); // insert input field + } The propose change has the following purposes: - setting <nEnd> to position of ',' or '(' right at the beginning. - adjusting the loop regarding skipping leading characters. Please review the change, if it makes sense and is ok for you. Thanks in advance.
Created attachment 78899 [details] patch for i119440 with review adjustment @Oliver Thanks for your response. The change make sense and is OK for me. I posted this new patch regarding your review change with a minor modification. Would you please help to review. Thanks again.
taking over to review the revised patch
Comment on attachment 78899 [details] patch for i119440 with review adjustment patch is good and solves the problem --> I will apply it on trunk
Comment on attachment 78838 [details] patch for i119440 this one is obsolete having the revised one.
"orw" committed SVN revision 1372411 into trunk: #119440# - method <SwWW8ImplReader::Read_SubF_Combined(..)>
fixed by applying patch
"orw" committed SVN revision 1372915 into trunk: #119440# - correction to be warning-free - sal_Unicode is signed on all platf...
verified on the build AOO3.5_r1374181