summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOliver-Rainer Wittmann <orw@apache.org>2012-08-21 12:28:29 +0000
committerCaolán McNamara <caolanm@redhat.com>2013-04-13 10:54:36 +0100
commitddbf7961ef0c33672ad27af6416a69c1180e62e8 (patch)
treeee899964cf2baccd48c1a6ab7db7795df3d6edb5
parent4de8beed1c6dd77e379e460d359f79ea73b855f8 (diff)
i#119446# correct condition for fields containing '.' or '/'
See also: i#61075, i#89667, i#111684 Found by: Yan Ji Patch by: zjchen Review by: Oliver (cherry picked from commit 2eeb8010f1afbe47b56387a5ba96db41ece13fcc) Conflicts: sw/source/filter/ww8/ww8par5.cxx Change-Id: Ia53b599c01d1a4b46bd52eac8a933ac6c0605586
-rw-r--r--sw/source/filter/ww8/ww8par5.cxx15
1 files changed, 9 insertions, 6 deletions
diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx
index 37229ccaae89..e746d6e88fee 100644
--- a/sw/source/filter/ww8/ww8par5.cxx
+++ b/sw/source/filter/ww8/ww8par5.cxx
@@ -1060,13 +1060,16 @@ long SwWW8ImplReader::Read_Field(WW8PLCFManResult* pRes)
pStrm->Seek( nOldPos );
// field codes which contain '/' or '.' are not displayed in WinWord
+ // skip if it is formula field or found space before. see #i119446, #i119585.
+ const xub_StrLen nDotPos = aStr.Search('.');
+ const xub_StrLen nSlashPos = aStr.Search('/');
xub_StrLen nSpacePos = aStr.Search( ' ', 1 );
- if ( STRING_NOTFOUND == nSpacePos )
- nSpacePos = aStr.Len( );
- xub_StrLen nSearchPos = STRING_NOTFOUND;
- if ( !( aStr.EqualsAscii( "=", 1, 1 ) ) && (
- ( ( nSearchPos = aStr.Search('.') ) != STRING_NOTFOUND && nSearchPos < nSpacePos ) ||
- ( ( nSearchPos = aStr.Search('/') ) != STRING_NOTFOUND && nSearchPos < nSpacePos ) ) )
+ if ( nSpacePos == STRING_NOTFOUND )
+ nSpacePos = aStr.Len();
+
+ if ( !( aStr.EqualsAscii( "=", 1, 1 ) ) &&
+ ((( nDotPos != STRING_NOTFOUND ) && ( nDotPos < nSpacePos )) ||
+ (( nSlashPos != STRING_NOTFOUND ) && ( nSlashPos < nSpacePos ))))
return aF.nLen;
else
{