incubator-ooo-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 119440] [From Symphony]Some field is not shown
Date Thu, 09 Aug 2012 08:45:47 GMT
https://issues.apache.org/ooo/show_bug.cgi?id=119440

Oliver-Rainer Wittmann <orw@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |orw@apache.org
           Assignee|ooo-issues@incubator.apache |zjchencdl@gmail.com
                   |.org                        |

--- Comment #6 from Oliver-Rainer Wittmann <orw@apache.org> ---
@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.

Mime
View raw message