https://issues.apache.org/ooo/show_bug.cgi?id=119440
Oliver-Rainer Wittmann <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |[email protected] Assignee|[email protected] |[email protected] |.org | --- Comment #6 from Oliver-Rainer Wittmann <[email protected]> --- @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. -- You are receiving this mail because: You are the assignee for the bug.
