Issue 119440 - [From Symphony]Some field is not shown
[From Symphony]Some field is not shown
Status: VERIFIED FIXED
Product: Writer
Classification: Application
Component: ui
3.4.0
PC All
: P3 normal (vote)
: 4.0.0
Assigned To: Oliver-Rainer Wittmann
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-05-28 08:13 UTC by Yan Ji
Modified: 2012-12-26 08:49 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation on: ---
Developer Difficulty: ---


Attachments
sample (64.00 KB, application/msword)
2012-05-28 08:13 UTC, Yan Ji
no flags Details
patch for i119440 (5.78 KB, patch)
2012-08-03 06:30 UTC, zjchen
no flags Details | Diff
patch for i119440 (4.93 KB, patch)
2012-08-03 06:39 UTC, zjchen
orw: review+
Details | Diff
test case for i119440 (29.50 KB, application/msword)
2012-08-03 06:42 UTC, zjchen
no flags Details
patch for i119440 with review adjustment (5.95 KB, patch)
2012-08-10 03:11 UTC, zjchen
orw: review+
Details | Diff

Note You need to log in before you can comment on or make changes to this issue.
Description Yan Ji 2012-05-28 08:13:30 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.
Comment 1 zjchen 2012-08-03 06:25:41 UTC
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.
Comment 2 zjchen 2012-08-03 06:30:44 UTC
Created attachment 78837 [details]
patch for i119440
Comment 3 zjchen 2012-08-03 06:39:04 UTC
Created attachment 78838 [details]
patch for i119440
Comment 4 zjchen 2012-08-03 06:42:56 UTC
Created attachment 78839 [details]
test case for i119440

post my test case for reference
Comment 5 Oliver-Rainer Wittmann 2012-08-09 08:36:15 UTC
Comment on attachment 78838 [details]
patch for i119440

Patch looks good and solves the problem.
I have adjusted the patch - see my further comment
Comment 6 Oliver-Rainer Wittmann 2012-08-09 08:45:47 UTC
@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.
Comment 7 zjchen 2012-08-10 03:11:42 UTC
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.
Comment 8 Oliver-Rainer Wittmann 2012-08-10 06:08:11 UTC
taking over to review the revised patch
Comment 9 Oliver-Rainer Wittmann 2012-08-13 11:52:54 UTC
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 10 Oliver-Rainer Wittmann 2012-08-13 11:53:58 UTC
Comment on attachment 78838 [details]
patch for i119440

this one is obsolete having the revised one.
Comment 11 SVN Robot 2012-08-13 13:04:59 UTC
"orw" committed SVN revision 1372411 into trunk:
#119440# - method <SwWW8ImplReader::Read_SubF_Combined(..)>
Comment 12 Oliver-Rainer Wittmann 2012-08-13 13:05:38 UTC
fixed by applying patch
Comment 13 SVN Robot 2012-08-14 15:03:53 UTC
"orw" committed SVN revision 1372915 into trunk:
#119440# - correction to be warning-free - sal_Unicode is signed on all platf...
Comment 14 Du Jing 2012-08-20 09:31:00 UTC
verified on the build AOO3.5_r1374181