Subversion Repositories DevTools

Rev

Rev 2130 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2130 Rev 2134
Line 158... Line 158...
158
 
158
 
159
         styleDefs.Add( "code", formStyleDef( style_type_e.STYLE_MS_WORD,   style_id_e.STYLE_ID_CODETEXT, EA_Constants.styleName_CodeText, 0, style_handling_e.STYLE_USE_TAG_STYLE ) );
159
         styleDefs.Add( "code", formStyleDef( style_type_e.STYLE_MS_WORD,   style_id_e.STYLE_ID_CODETEXT, EA_Constants.styleName_CodeText, 0, style_handling_e.STYLE_USE_TAG_STYLE ) );
160
         styleDefs.Add( "normal", formStyleDef( style_type_e.STYLE_MS_WORD, style_id_e.STYLE_ID_NORMAL,   EA_Constants.styleName_Normal  , 0, style_handling_e.STYLE_USE_TAG_STYLE ) );
160
         styleDefs.Add( "normal", formStyleDef( style_type_e.STYLE_MS_WORD, style_id_e.STYLE_ID_NORMAL,   EA_Constants.styleName_Normal  , 0, style_handling_e.STYLE_USE_TAG_STYLE ) );
161
         styleDefs.Add( "note", formStyleDef( style_type_e.STYLE_MS_WORD,   style_id_e.STYLE_ID_NOTE,     EA_Constants.styleName_Note    , 0, style_handling_e.STYLE_USE_TAG_STYLE ) );
161
         styleDefs.Add( "note", formStyleDef( style_type_e.STYLE_MS_WORD,   style_id_e.STYLE_ID_NOTE,     EA_Constants.styleName_Note    , 0, style_handling_e.STYLE_USE_TAG_STYLE ) );
162
         styleDefs.Add( "warn", formStyleDef( style_type_e.STYLE_MS_WORD,   style_id_e.STYLE_ID_WARNING,  EA_Constants.styleName_Warning , 0, style_handling_e.STYLE_USE_TAG_STYLE ) );
162
         styleDefs.Add( "warn", formStyleDef( style_type_e.STYLE_MS_WORD,   style_id_e.STYLE_ID_WARNING,  EA_Constants.styleName_Warning , 0, style_handling_e.STYLE_USE_TAG_STYLE ) );
163
 
-
 
164
      }
163
      }
165
 
164
 
166
      /// <summary>
165
      /// <summary>
167
      /// Helper for initialise() function
166
      /// Helper for initialise() function
168
      /// </summary>
167
      /// </summary>
Line 190... Line 189...
190
         token.styleHandling = style_handling_e.STYLE_USE_CALLER_STYLE;
189
         token.styleHandling = style_handling_e.STYLE_USE_CALLER_STYLE;
191
         token.txt = null;
190
         token.txt = null;
192
         token.level = 0;
191
         token.level = 0;
193
      }
192
      }
194
 
193
 
-
 
194
 
-
 
195
      private static string convert_EA7_1_RTF_ListTag(string s, string open, string close, string replacement_open, string replacement_close)
-
 
196
      {
-
 
197
         int pos;
-
 
198
         int pos_2;
-
 
199
 
-
 
200
         pos = s.IndexOf(open,0);
-
 
201
         if (pos >= 0)
-
 
202
         {
-
 
203
            while (pos >= 0)
-
 
204
            {
-
 
205
               pos_2 = s.IndexOf(close,pos);
-
 
206
 
-
 
207
               string seg = s.Substring(pos+4, pos_2 - (pos+4));
-
 
208
               seg = seg.Replace("\t<li>", replacement_open);
-
 
209
               seg = seg.Replace("</li>", replacement_close);
-
 
210
               
-
 
211
               s = s.Substring(0, pos) + seg + s.Substring(pos_2+5, s.Length - (pos_2+5));
-
 
212
 
-
 
213
               pos = s.IndexOf(open,0);
-
 
214
            }
-
 
215
         }
-
 
216
         return s;
-
 
217
      }
-
 
218
 
-
 
219
 
-
 
220
 
-
 
221
 
195
      /// <summary>
222
      /// <summary>
196
      /// Parse the notes of an element and use the results to form document content.
223
      /// Parse the notes of an element and use the results to form document content.
197
      /// </summary>
224
      /// </summary>
198
      /// <param name="theElement"></param>
225
      /// <param name="theElement"></param>
199
      /// <param name="callerStyle"></param>
226
      /// <param name="callerStyle"></param>
Line 208... Line 235...
208
         int pos_ContentEnd;
235
         int pos_ContentEnd;
209
         bool lookingForTagEnd;
236
         bool lookingForTagEnd;
210
         bool foundError = false;
237
         bool foundError = false;
211
         Word.Range wr_body;
238
         Word.Range wr_body;
212
 
239
 
-
 
240
         // Convert EA7.1 embedded RTF controls into EA_DocGen controls where possible
-
 
241
         s = convert_EA7_1_RTF_ListTag(s, "<ol>\r\n", "</ol>", "<ln0>", "</ln0>");
-
 
242
         s = convert_EA7_1_RTF_ListTag(s, "<ul>\r\n", "</ul>", "<lb0>", "</lb0>");
-
 
243
 
-
 
244
         // In EAv7.1, Sparx allows users to embed RTF into notes text. RTF uses <> to enclose controls just as EA_DocGen
-
 
245
         // does for its own controls which this function decodes. However, EA_DocGen controls are entered as text by
-
 
246
         // human users and so EAv7.1 converts < and > chars into a form such that they do not look like RTF tags.
-
 
247
         // We have to convert EA's escaping mechanism back into ascii text chars otherwise the parser wont work.
-
 
248
         // There may be issues to resolve with this parser if EAv7.1 users have used any of EA's RTF editing features
-
 
249
         // because if they do, the < and > chars there will not be escaped and the parser will find them and try to
-
 
250
         // decode them. Most will probably not be decodable.
-
 
251
         s = s.Replace("&lt;","<");
-
 
252
         s = s.Replace("&gt;",">");
213
 
253
 
214
         // Begin to construct a range that will eventually encompass ALL of the text we will serialize during the execution
254
         // Begin to construct a range that will eventually encompass ALL of the text we will serialize during the execution
215
         // of this function. This is needed later only if the caller has specified a requirement style that needs to have 
255
         // of this function. This is needed later only if the caller has specified a requirement style that needs to have 
216
         // global strikethrough or italicising applied to (all of) the text
256
         // global strikethrough or italicising applied to (all of) the text
217
         object startLocation;
257
         object startLocation;