This commit is contained in:
Kathy Ruffing 2010-10-25 17:38:19 +00:00
parent 0188c05d23
commit f9fa0d401e

View File

@ -282,21 +282,83 @@ namespace VEPROMS.CSLA.Library
} }
#endregion #endregion
} }
public class TransitionBuilder
{
private StringBuilder _Results = new StringBuilder();
public FormatData _FormatData;
public string _TransFormat;
public E_TransUI _TransUI;
public ItemInfo _FromItem;
public int _TranType;
public ItemInfo _ToItem;
public ItemInfo _RangeItem;
public bool _UsedRangeAncestor;
private string _Token;
public string Token
{
get { return _Token; }
set { _Token = value; }
}
private string _Prefix;
public string Prefix
{
get { return _Prefix; }
set { if(_Prefix==null)_Prefix = value; }
}
public bool HasText
{
get
{
return _Results.Length > 0;
}
}
public StringBuilder Append(string str)
{
return _Results.Append(str);
}
public StringBuilder ReplaceToken(string str)
{
if (str == null || str == "") return _Results;
if (_FormatData.TransData.XchngTranSpForHard && str[0]!=',' && str[0] != ' ')
{
int indx = str.IndexOf(' '); // 16 bit code only processes 1st occurance
if (indx > -1) // Not a while loop in 16 bit.
{ // (see \promsnt\lib\edit\gettran.c:TransitionCat)
str.Remove(indx, 1);
str.Insert(indx, @"\u160?");
}
}
return _Results.Append(str);
}
public override string ToString()
{
return _Results.ToString();
}
public StringBuilder Remove(int startIndex, int length)
{
return _Results.Remove(startIndex, length);
}
public int Length
{
get { return _Results.Length; }
}
public void AppendPrefix()
{
if (HasText && Prefix != null)
{
_Results.Append(Prefix);
_Prefix = null;
}
}
public string OverridePrefix
{
set { _Prefix = value; }
}
}
public static class TransitionText public static class TransitionText
{ {
private delegate bool TransitionAppendFunction(bool textAdded, TransitionBuilder tb, string token, string nonToken); private delegate bool TransitionAppendFunction(TransitionBuilder tb);
private struct TransitionBuilder
{
public StringBuilder _Results;
public FormatData _FormatData;
public string _TransFormat;
public E_TransUI _TransUI;
public ItemInfo _FromItem;
public int _TranType;
public ItemInfo _ToItem;
public ItemInfo _RangeItem;
public bool _UsedRangeAncestor;
}
private static Dictionary<string, TransitionAppendFunction> _AppendMethods; private static Dictionary<string, TransitionAppendFunction> _AppendMethods;
private static void SetupMethods() private static void SetupMethods()
{ {
@ -310,8 +372,8 @@ namespace VEPROMS.CSLA.Library
_AppendMethods.Add("{.}", AddIncludedStepNumber); _AppendMethods.Add("{.}", AddIncludedStepNumber);
_AppendMethods.Add("{Sect Hdr}", AddTranGetSectionHdr); _AppendMethods.Add("{Sect Hdr}", AddTranGetSectionHdr);
_AppendMethods.Add("{?.Sect Hdr}", AddOptionalTranGetSectionHdr); _AppendMethods.Add("{?.Sect Hdr}", AddOptionalTranGetSectionHdr);
_AppendMethods.Add("{Sect Title}", AddTranGetSectionHdr); _AppendMethods.Add("{Sect Title}", AddTranGetSectionTitle);
_AppendMethods.Add("{?.Sect Title}", AddOptionalTranGetSectionHdr); _AppendMethods.Add("{?.Sect Title}", AddOptionalTranGetSectionTitle);
_AppendMethods.Add("{Sect Num}", AddTranGetSectionNumber); _AppendMethods.Add("{Sect Num}", AddTranGetSectionNumber);
} }
public static string GetResolvedText(ItemInfo fromInfo, int tranType, ItemInfo toItem, ItemInfo rangeItem) public static string GetResolvedText(ItemInfo fromInfo, int tranType, ItemInfo toItem, ItemInfo rangeItem)
@ -329,7 +391,6 @@ namespace VEPROMS.CSLA.Library
private static TransitionBuilder SetupTransitionBuilder(FormatInfo formatInfo, ItemInfo fromInfo, int tranType, ItemInfo toItem, ItemInfo rangeItem) private static TransitionBuilder SetupTransitionBuilder(FormatInfo formatInfo, ItemInfo fromInfo, int tranType, ItemInfo toItem, ItemInfo rangeItem)
{ {
TransitionBuilder tb = new TransitionBuilder(); TransitionBuilder tb = new TransitionBuilder();
tb._Results = new StringBuilder();
tb._FormatData = formatInfo.PlantFormat.FormatData; tb._FormatData = formatInfo.PlantFormat.FormatData;
// get the format of the transition string based on this transition's index into the TransData part of // get the format of the transition string based on this transition's index into the TransData part of
// format.... // format....
@ -348,16 +409,15 @@ namespace VEPROMS.CSLA.Library
{ {
int startIndex = 0; int startIndex = 0;
int index = -1; int index = -1;
string nonToken = null; string prefix = null;
bool textAdded = false; bool lastAdded = false;
while ((index = tb._TransFormat.IndexOf("{", startIndex)) > -1) while ((index = tb._TransFormat.IndexOf("{", startIndex)) > -1)
{ {
if (index > startIndex) nonToken = tb._TransFormat.Substring(startIndex, index - startIndex); if (index > startIndex) prefix = tb._TransFormat.Substring(startIndex, index - startIndex);
if (startIndex == 0 && nonToken != null && nonToken.Length > 0) if (startIndex == 0 && prefix != null && prefix.Length > 0)
{ {
tb._Results.Append(nonToken); tb.Append(prefix);
//textAdded = true; prefix = "";
nonToken = "";
} }
int endtokn = tb._TransFormat.IndexOf("}", index); int endtokn = tb._TransFormat.IndexOf("}", index);
string token = tb._TransFormat.Substring(index, endtokn - index + 1); string token = tb._TransFormat.Substring(index, endtokn - index + 1);
@ -367,59 +427,55 @@ namespace VEPROMS.CSLA.Library
break; break;
} }
if (_AppendMethods.ContainsKey(token)) if (_AppendMethods.ContainsKey(token))
textAdded = _AppendMethods[token](textAdded, tb, token, nonToken); {
tb.Token = token;
if (token[1] == '?') // If it's a conditional token, only update the prefix if the prefix is null
tb.Prefix = prefix;
else // If not conditional, force the prefix to be updated
tb.OverridePrefix = prefix;
lastAdded = _AppendMethods[token](tb);
}
else else
tb._Results.Append("\\"+token.Substring(0,token.Length -1)+"\\}"); tb.Append("\\" + token.Substring(0, token.Length - 1) + "\\}");
startIndex = endtokn + 1; startIndex = endtokn + 1;
if (startIndex >= tb._TransFormat.Length) break; if (startIndex >= tb._TransFormat.Length) break;
} }
if (startIndex < tb._TransFormat.Length) Append(tb, tb._TransFormat.Substring(startIndex, tb._TransFormat.Length - startIndex - 1), false); if (startIndex < tb._TransFormat.Length) tb.Append(tb._TransFormat.Substring(startIndex, tb._TransFormat.Length - startIndex - 1));
return (tb._Results.ToString()); return (tb.ToString());
}
private static void Append(TransitionBuilder tb, string str, bool doflags)
{
if (str == null || str == "") return;
if (doflags && tb._FormatData.TransData.XchngTranSpForHard)
{
int indx = str.IndexOf(' ');
if (indx > -1)
{
str.Remove(indx, 1);
str.Insert(indx, @"\u160?");
}
}
tb._Results.Append(str);
} }
// TODO: TStepNoFlag, i.e. include step number in range items. // TODO: TStepNoFlag, i.e. include step number in range items.
// TODO: TStepNoFlag, i.e. include step number in range items. // TODO: TStepNoFlag, i.e. include step number in range items.
// TODO: For hlp: LowerCaseTranNumber - lower case substep numbers in transitions // TODO: For hlp: LowerCaseTranNumber - lower case substep numbers in transitions
private static bool AddTransitionProcNum(bool textAdded, TransitionBuilder tb, string token, string nonToken) // Coded for HLP private static bool AddTransitionProcNum(TransitionBuilder tb) // Coded for HLP
{ {
string retstr = tb._ToItem.MyProcedure.MyContent.Number; string retstr = tb._ToItem.MyProcedure.MyContent.Number;
// LATER: start with UnitSpecific procedure number. // LATER: start with UnitSpecific procedure number.
// LATER: Format Flag TruncateProcNmAfter1stSpace (dropped plants) // LATER: Format Flag TruncateProcNmAfter1stSpace (dropped plants)
// LATER: Format Flag HardSpTranProcNumb (active plants) // LATER: Format Flag HardSpTranProcNumb (active plants)
if (textAdded) Append(tb, nonToken, false); tb.AppendPrefix();
Append(tb, retstr, true); tb.ReplaceToken(retstr);
if (retstr != null && retstr != "") return true; return (retstr != null && retstr != "");
return false;
} }
private static bool AddOptionalTransitionProcNum(bool textAdded, TransitionBuilder tb, string token, string nonToken) private static bool AddOptionalTransitionProcNum(TransitionBuilder tb)
{ {
// token is passed in for future use, i.e. if text is placed between "?" and "." to // token is passed in for future use, i.e. if text is placed between "?" and "." to
// request other processing. // request other processing.
// for now the only test is to check if the toitem is in the current procedure. // for now the only test is to check if the toitem is in the current procedure.
if (tb._FromItem.MyProcedure.ItemID == tb._ToItem.MyProcedure.ItemID) return textAdded ? true : false; if (tb._FromItem.MyProcedure.ItemID == tb._ToItem.MyProcedure.ItemID) return false; // tb.TextAdded;
return AddTransitionProcNum(textAdded, tb, token, nonToken); return AddTransitionProcNum(tb);
} }
private static bool AddTransitionProcTitle(bool textAdded, TransitionBuilder tb, string token, string nonToken)// Coded for HLP private static bool AddTransitionProcTitle(TransitionBuilder tb)// Coded for HLP
{ {
tb.AppendPrefix();
// if can't find procedure, just put in a question mark.
if (tb._ToItem.PreviousID == null && tb._ToItem.ItemPartCount == 0 && tb._ToItem.ItemDocVersionCount == 0) if (tb._ToItem.PreviousID == null && tb._ToItem.ItemPartCount == 0 && tb._ToItem.ItemDocVersionCount == 0)
{ {
Append(tb, "?", true); tb.Append("?");
return true; return true; // (tb.TextAdded = true);
} }
string parenstr = tb._ToItem.MyProcedure.MyContent.Text; string parenstr = tb._ToItem.MyProcedure.MyContent.Text;
StringBuilder lretstr = new StringBuilder(); StringBuilder lretstr = new StringBuilder();
@ -433,19 +489,17 @@ namespace VEPROMS.CSLA.Library
lretstr.Append(tb._FormatData.TransData.DelimiterForTransitionTitle); lretstr.Append(tb._FormatData.TransData.DelimiterForTransitionTitle);
} }
// LATER: if (DoSectionTransitions && GetSTepNO(TSeq1)) TransitionCat(AddCommaStep", Step")); // LATER: if (DoSectionTransitions && GetSTepNO(TSeq1)) TransitionCat(AddCommaStep", Step"));
if (textAdded) Append(tb, nonToken, false); tb.ReplaceToken(lretstr.ToString());
Append(tb, lretstr.ToString(), true); return (lretstr.Length != 0);
if (lretstr.Length != 0) return true;
return false;
} }
private static bool AddOptionalTransitionProcTitle(bool textAdded, TransitionBuilder tb, string token, string nonToken) private static bool AddOptionalTransitionProcTitle(TransitionBuilder tb)
{ {
// token is passed in for future use, i.e. if text is placed between "?" and "." to // token is passed in for future use, i.e. if text is placed between "?" and "." to
// request other processing. // request other processing.
// for now the only test is to check if the toitem is in the current procedure. // for now the only test is to check if the toitem is in the current procedure.
if (tb._FromItem.MyProcedure.ItemID == tb._ToItem.MyProcedure.ItemID) return textAdded ? true : false; if (tb._FromItem.MyProcedure.ItemID == tb._ToItem.MyProcedure.ItemID) return false; // tb.TextAdded;
return AddTransitionProcTitle(textAdded, tb, token, nonToken); return AddTransitionProcTitle(tb);
} }
private static string Tab(ItemInfo item) private static string Tab(ItemInfo item)
{ {
@ -467,7 +521,6 @@ namespace VEPROMS.CSLA.Library
string thisTab = StepInfo.Get(pitem.ItemID).MyTab.CleanText; string thisTab = StepInfo.Get(pitem.ItemID).MyTab.CleanText;
if (pitem.IsRNOPart) if (pitem.IsRNOPart)
{ {
//string mytb = sret.Trim(" .)".ToCharArray());
if (thisTab == null || thisTab == "") if (thisTab == null || thisTab == "")
sret = "RNO." + sret; sret = "RNO." + sret;
else else
@ -478,7 +531,6 @@ namespace VEPROMS.CSLA.Library
} }
else else
{ {
//sret = Tab(item.ActiveParent as ItemInfo) + "." + sret.Trim(" .)".ToCharArray()); //original
if (thisTab != null && thisTab != "") if (thisTab != null && thisTab != "")
{ {
thisTab = thisTab.Trim(" ".ToCharArray()); thisTab = thisTab.Trim(" ".ToCharArray());
@ -502,106 +554,55 @@ namespace VEPROMS.CSLA.Library
sret = sret.Trim(" .)".ToCharArray()); sret = sret.Trim(" .)".ToCharArray());
return sret; return sret;
} }
private static string RhmTab(ItemInfo item) private static bool AddStepNumber(TransitionBuilder tb)
{
if (item == null) return "";
//if (item.ItemID == 2065) Console.WriteLine("here");
string sret = "";
switch (item.MyContent.Type / 10000)
{
case 0: //procedure
sret = ProcedureInfo.Get(item.ItemID).MyTab.CleanText;
break;
case 1: // section
sret = SectionInfo.Get(item.ItemID).MyTab.CleanText;
break;
case 2: // step
sret = StepInfo.Get(item.ItemID).MyTab.CleanText;
if (!item.IsHigh)
{
if (item.IsRNOPart)
{
string mytb = sret.Trim(" .)".ToCharArray());
if (mytb == null || mytb == "")
sret = Tab(item.ActiveParent as ItemInfo) + ".RNO";
else
sret = Tab(item.ActiveParent as ItemInfo) + ".RNO." + sret.Trim(" .)".ToCharArray());
}
else
{
//sret = Tab(item.ActiveParent as ItemInfo) + "." + sret.Trim(" .)".ToCharArray()); //original
string tmp1 = sret.Contains(@")") ? ")" : ".";
string tmp2 = sret.Trim(" .)".ToCharArray());
string srettmp = Tab(item.ActiveParent as ItemInfo);
sret = srettmp + sret.Trim(" ".ToCharArray());
if (!sret.EndsWith(".") && !sret.EndsWith(")")) sret = sret + ".";
}
}
else
{
sret = sret.Trim(" ".ToCharArray());
if (!sret.EndsWith(".") && !sret.EndsWith(")")) sret = sret + ".";
}
break;
}
//sret = sret.Trim(" .)".ToCharArray()); // original
return sret;
}
private static bool AddStepNumber(bool textAdded, TransitionBuilder tb, string token, string nonToken)
{ {
// If we're on a step put out the step number. // If we're on a step put out the step number.
ItemInfo secitm = TranGetSectionItem(tb._ToItem); ItemInfo secitm = TranGetSectionItem(tb._ToItem);
if ((!((tb._TransUI & E_TransUI.StepAllowNone) == E_TransUI.StepAllowNone)) || tb._ToItem.MyContent.Type > 20000) if ((!((tb._TransUI & E_TransUI.StepAllowNone) == E_TransUI.StepAllowNone)) || tb._ToItem.MyContent.Type > 20000)
{ {
if (textAdded) if (tb.HasText)
{ {
// check for transition that goes to a procedure step section with title of 'Procedure steps' followed // check for transition that goes to a procedure step section with title of 'Procedure steps' followed
// by ', Step'. This should output as 'Procedure step xyz' rather than 'Procedure steps, step xyz' // by ', Step'. This should output as 'Procedure step xyz' rather than 'Procedure steps, step xyz'
if (!tb._TransFormat.Contains("{Last Step}") && nonToken.ToUpper().Contains(", STEP") && tb._Results.ToString().ToUpper().EndsWith("PROCEDURE STEPS")) if (!tb._TransFormat.Contains("{Last Step}") && tb.Prefix.ToUpper().Contains(", STEP") && tb.ToString().ToUpper().EndsWith("PROCEDURE STEPS"))
{ {
tb._Results = tb._Results.Remove(tb._Results.Length-15,15); // remove "procedure steps" tb.Remove(tb.Length - 15, 15); // remove "procedure steps"
tb._Results = tb._Results.Append("procedure Step"); tb.Append("procedure Step");
nonToken = " "; tb.Prefix = " ";
} }
if (nonToken!=null)Append(tb, nonToken, false); tb.AppendPrefix();
} }
//Console.WriteLine("NEW - ItemID={0},Ordinal={1}", tb._ToItem.ItemID, tb._ToItem.Ordinal);
if (tb._ToItem.PreviousID == null && tb._ToItem.ItemPartCount == 0 && tb._ToItem.ItemDocVersionCount == 0) if (tb._ToItem.PreviousID == null && tb._ToItem.ItemPartCount == 0 && tb._ToItem.ItemDocVersionCount == 0)
Append(tb, "?", true); tb.Append("?");
else else
Append(tb, Tab(tb._ToItem), true); tb.ReplaceToken(Tab(tb._ToItem));
//Append(tb, tb._ToItem.Ordinal.ToString(), true); return true;
//Append(tb, tb._ToItem.MyTab.CleanText, true);
textAdded = true;
} }
return textAdded;
}
private static bool AddRangeStepNumber(bool textAdded, TransitionBuilder tb, string token, string nonToken)
{
if (textAdded) Append(tb, nonToken, false);
if (tb._RangeItem.PreviousID == null && tb._RangeItem.ItemPartCount == 0 && tb._RangeItem.ItemDocVersionCount == 0)
Append(tb, "?", true);
else else
Append(tb, Tab(tb._RangeItem), true); return false;
//Append(tb, tb._RangeItem.Ordinal.ToString(), true);
//Append(tb, tb._RangeItem.MyTab.CleanText, true);
textAdded = true;
return textAdded;
} }
private static bool AddIncludedStepNumber(bool textAdded, TransitionBuilder tb, string token, string nonToken) private static bool AddRangeStepNumber(TransitionBuilder tb)
{
tb.AppendPrefix();
if (tb._RangeItem.PreviousID == null && tb._RangeItem.ItemPartCount == 0 && tb._RangeItem.ItemDocVersionCount == 0)
tb.Append("?");
else
tb.ReplaceToken(Tab(tb._RangeItem));
return true;
}
private static bool AddIncludedStepNumber(TransitionBuilder tb)
{ {
Dictionary<int, ItemInfo> rangeAncestors = GetAncestors(tb._RangeItem); Dictionary<int, ItemInfo> rangeAncestors = GetAncestors(tb._RangeItem);
if (textAdded) Append(tb, nonToken, false); tb.AppendPrefix();
bool usedRangeAncestor = false; bool usedRangeAncestor = false;
ItemInfo next = GetNextItem(tb._ToItem, rangeAncestors, ref usedRangeAncestor); ItemInfo next = GetNextItem(tb._ToItem, rangeAncestors, ref usedRangeAncestor);
while (next.ItemID != tb._RangeItem.ItemID) while (next.ItemID != tb._RangeItem.ItemID)
{ {
Append(tb, ", " + Tab(next), true); // TODO: Intermediate Range. tb.ReplaceToken(", " + Tab(next)); // TODO: Intermediate Range.
next = GetNextItem(next, rangeAncestors, ref usedRangeAncestor); next = GetNextItem(next, rangeAncestors, ref usedRangeAncestor);
} }
textAdded = true;
tb._UsedRangeAncestor = usedRangeAncestor; tb._UsedRangeAncestor = usedRangeAncestor;
return textAdded; return true;
} }
private static Dictionary<int, ItemInfo> GetAncestors(ItemInfo itemInfo) private static Dictionary<int, ItemInfo> GetAncestors(ItemInfo itemInfo)
{ {
@ -622,25 +623,35 @@ namespace VEPROMS.CSLA.Library
next = next.ActiveParent as ItemInfo; next = next.ActiveParent as ItemInfo;
return next.NextItem; return next.NextItem;
} }
private static bool AddOptionalTranGetSectionHdr(bool textAdded, TransitionBuilder tb, string token, string nonToken) private static bool AddOptionalTranGetSectionHdr(TransitionBuilder tb)
{ {
// first handle 'to' non-step section. Always add it. // first handle 'to' non-step section. Always add it.
if (tb._ToItem.IsSection && !tb._ToItem.IsStepSection)return AddTranGetSectionHdr(textAdded, tb, token, nonToken); if (tb._ToItem.IsSection && !tb._ToItem.IsStepSection) return AddTranGetSectionHdr(tb);
int cntsect = 0; int cntsect = 0;
ItemInfo sect = TranGetSectionItem(tb._ToItem); ItemInfo sect = TranGetSectionItem(tb._ToItem);
foreach (ItemInfo ii in tb._ToItem.MyProcedure.Sections) if (ii.IsStepSection) cntsect++; foreach (ItemInfo ii in tb._ToItem.MyProcedure.Sections) if (ii.IsStepSection) cntsect++;
// If Procedure going to has only 1 step section, do not add it. // If Procedure going to has only 1 step section, do not add it.
if (cntsect == 1) return textAdded ? true : false; if (cntsect == 1) return false; // tb.TextAdded;
// If procedure going to has more than 1 step section and is NOT same procedure // If procedure going to has more than 1 step section and is NOT same procedure
// and going to default section, do not add it. // and going to default section, do not add it.
if (tb._ToItem.MyProcedure.ItemID != tb._FromItem.MyProcedure.ItemID && sect != null && if (tb._ToItem.MyProcedure.ItemID != tb._FromItem.MyProcedure.ItemID && sect != null &&
sect.IsDefaultSection) return textAdded ? true : false; sect.IsDefaultSection) return false; // tb.TextAdded;
return AddTranGetSectionHdr(textAdded, tb, token, nonToken); // If a 'thru' range, only put out the section if it's to a different section
// that is not the default section.
if (((tb._TransUI & E_TransUI.StepLast) == E_TransUI.StepLast) && ((tb._TransUI & E_TransUI.SectMenuStep) == E_TransUI.SectMenuStep))
{
ItemInfo fi = tb._FromItem;
while (!fi.IsSection)fi = fi.ActiveParent as ItemInfo;
ItemInfo ti = tb._ToItem;
while (!ti.IsSection) ti = ti.ActiveParent as ItemInfo;
if (fi.ItemID == ti.ItemID || ti.IsDefaultSection) return false; // tb.TextAdded;
}
return AddTranGetSectionHdr(tb);
} }
private static bool AddTranGetSectionHdr(bool textAdded, TransitionBuilder tb, string token, string nonToken) private static bool AddTranGetSectionHdr(TransitionBuilder tb)
{ {
// output from 16-bit code looks like section header // output from 16-bit code looks like section header
// if this is a step section & the default section, just return // if this is a step section & the default section, just return
@ -650,43 +661,40 @@ namespace VEPROMS.CSLA.Library
string txt = TranGetSectionTitle(tb,tb._ToItem); string txt = TranGetSectionTitle(tb,tb._ToItem);
if (retstr.Length > 0 && txt.Length > 0) retstr.Append(", "); if (retstr.Length > 0 && txt.Length > 0) retstr.Append(", ");
retstr.Append(txt); retstr.Append(txt);
if (textAdded) Append(tb, nonToken, false); tb.AppendPrefix();
Append(tb, retstr.ToString(), true); tb.ReplaceToken(retstr.ToString());
if (retstr.Length != 0) return true; return (retstr.Length != 0);
return false;
} }
private static bool AddOptionalTranGetSectionTitle(bool textAdded, TransitionBuilder tb, string token, string nonToken) private static bool AddOptionalTranGetSectionTitle(TransitionBuilder tb)
{ {
// token is passed in for future use, i.e. if text is placed between "?" and "." to // token is passed in for future use, i.e. if text is placed between "?" and "." to
// request other processing. // request other processing.
// for now the only test is to check if the toitem is in the current section. // for now the only test is to check if the toitem is in the current section.
if (TranGetSectionItem(tb._FromItem).ItemID == TranGetSectionItem(tb._ToItem).ItemID) return textAdded ? true : false; if (TranGetSectionItem(tb._FromItem).ItemID == TranGetSectionItem(tb._ToItem).ItemID) return false; // tb.TextAdded;
if (textAdded) Append(tb, nonToken, false); tb.AppendPrefix();
string retstr = TranGetSectionTitle(tb,tb._ToItem); string retstr = TranGetSectionTitle(tb,tb._ToItem);
Append(tb, retstr, true); tb.ReplaceToken(retstr);
if (retstr != null && retstr != "") return true; return (retstr != null && retstr != "");
return false;
} }
private static bool AddTranGetSectionTitle(bool textAdded, TransitionBuilder tb, string token, string nonToken) private static bool AddTranGetSectionTitle(TransitionBuilder tb)
{ {
// LATER: Cap1stSectionTitle, CapFirstLetterOnly // LATER: Cap1stSectionTitle, CapFirstLetterOnly
if (tb._FormatData.TransData.UseSecTitles) if (tb._FormatData.TransData.UseSecTitles)
{ {
string retstr = TranGetSectionTitle(tb,tb._FromItem); string retstr = TranGetSectionTitle(tb,tb._FromItem);
if (textAdded) Append(tb, nonToken, false); tb.AppendPrefix();
Append(tb, retstr, true); tb.ReplaceToken(retstr);
if (retstr != null && retstr != "") return true; return (retstr != null && retstr != "");
} }
return false; return false;
} }
private static bool AddTranGetSectionNumber(bool textAdded, TransitionBuilder tb, string token, string nonToken) private static bool AddTranGetSectionNumber(TransitionBuilder tb)
{ {
string retstr = TranGetSectionNumber(tb._ToItem); string retstr = TranGetSectionNumber(tb._ToItem);
if (textAdded) Append(tb, nonToken, false); tb.AppendPrefix();
Append(tb, retstr, true); tb.ReplaceToken(retstr);
if (retstr != null && retstr != "") return true; return (retstr != null && retstr != "");
return false;
} }
private static string CapFirstLetterOnly(string retstr, int p) private static string CapFirstLetterOnly(string retstr, int p)
{ {