This commit is contained in:
2013-04-17 12:31:14 +00:00
parent bc923f77a0
commit f0d9003d0d
15 changed files with 134 additions and 76 deletions

View File

@@ -491,6 +491,12 @@ namespace VEPROMS.CSLA.Library
get { return _PrintBias; }
set { _PrintBias = value; }
}
private int _OffsetTab = 0;
public int OffsetTab
{
get { return _OffsetTab; }
set { _OffsetTab = value; }
}
private int _PrintLevel = 0;
public int PrintLevel
{
@@ -2406,6 +2412,8 @@ namespace VEPROMS.CSLA.Library
{
_MyTab.CleanText = ((ItemInfo)ActiveParent).MyTab.CleanText;
_MyTab.Text = ((ItemInfo)ActiveParent).MyTab.Text;
if (((ItemInfo)ActiveParent).FormatStepData.TabData.RNOIdentPrint.Contains("{asterisk}"))
_MyTab.AsteriskOffset = -10;
return;
}
}
@@ -2461,15 +2469,24 @@ namespace VEPROMS.CSLA.Library
lv = lv % 2;
tbformat = (lv == 0) ? "{numeric}." : "{alpha}.";
}
bool trimTabStart = false;
if (useSubStepTabs || tbformat.IndexOf("{seq}") > -1)
{
int itmp = (localPrintLevel + PrintBias) % seqtabs.Count;
int itmp = (localPrintLevel + PrintBias + OffsetTab) % seqtabs.Count;
if (!tbformat.Contains(@"{!C"))
tbformat = seqtabs[itmp].PrintTabFormat; // seqtab in 16bit, i.e. '. or )' etc.
else
tbformat = tbformat.Replace("{seq}", seqtabs[itmp].PrintTabFormat);
string tbtoken = seqtabs[localPrintLevel % seqtabs.Count].TabToken; // seqstart in 16bit, number/letter
// if the tab has a character before the token, trim the front of tab:
int br = tbformat.IndexOf("{");
if (br > 0)
{
char isAChar = tbformat[br - 1];
if ("{} #".IndexOf(isAChar) < 0) trimTabStart = true;
}
tbformat = tbformat.Replace("{seq}", tbtoken);
}
else
@@ -2511,16 +2528,15 @@ namespace VEPROMS.CSLA.Library
// and also determine whether the tab itself gets converted to a bullet.
if (IsCaution || IsNote) tbformat = CheckNoteCautionTab(tbformat);
int ordinal = Ordinal;
bool trimTabStart = false;
// if there is a section prefix, trim any spaces from the start of this tab, so we don't have
// a tab that looks like "1. 1"
if (!IsSection && !IsProcedure && tbformat.IndexOf("{Section Prefix}") >= 0)
{
// if there is a section prefix, trim any spaces from the start of this tab, so we don't have
// a tab that looks like "1. 1"
string tmpsectpref = SectionPrefix(tbformat) ?? string.Empty;
if (ActiveSection.MyTab.CleanText != null && ActiveSection.MyTab.CleanText != "" && tmpsectpref != string.Empty) trimTabStart = true;
tbformat = tbformat.Replace("{Section Prefix}", SectionPrefix(tbformat));
}
int ordinal = Ordinal;
string alpha = AlphabeticalNumbering(ordinal);
tbformat = tbformat.Replace("{alpha}", alpha.ToLower());
tbformat = tbformat.Replace("{alphaWpar}", alpha.ToLower());
@@ -2531,7 +2547,13 @@ namespace VEPROMS.CSLA.Library
tbformat = tbformat.Replace("{ROMAN}", roman);
tbformat = tbformat.Replace("{numeric}", trimTabStart ? ordinal.ToString() : ordinal.ToString().PadLeft(2));
tbformat = tbformat.Replace("{numericWpar}", ordinal.ToString());
tbformat = tbformat.Replace("{asterisk}", "*");
if (tbformat.Contains("{asterisk}"))
{
// if this has a checkoff - need to set location of the asterisk - because the asterisk has to come before
// the checkoff. Otherwise, it doesn't matter
_MyTab.AsteriskOffset = - 10;
tbformat = tbformat.Replace("{asterisk}", ""); // the asteriskoffset flags a '*' to be printed at xloc - this.
}
int macroindx = tbformat.IndexOf("{!C");
if (macroindx > -1)
{
@@ -2543,7 +2565,14 @@ namespace VEPROMS.CSLA.Library
// tab, don't inherit the parent's tab, use a null.
if (MyPrevious != null && FormatStepData.Sep != null && FormatStepData.Sep != "{Null}")
{
if (_MyHeader == null) _MyHeader = new MetaTag(FormatStepData.TabData.Font);
// check if there is font information for the separator, use it. If not use the font information
// that is associated with the tab.
VE_Font hdrFont = ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.Separator == null ? null :
ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.Separator.Font;
if (hdrFont == null) hdrFont = FormatStepData.TabData.Font;
if (_MyHeader == null) _MyHeader = new MetaTag(hdrFont);
else _MyHeader.MyFont = hdrFont;
_MyHeader.Text = FormatStepData.Sep;
_MyHeader.CleanText = StripRtfFormatting(_MyHeader.Text);
_MyHeader.Justify = ContentAlignment.MiddleCenter;
@@ -2620,14 +2649,23 @@ namespace VEPROMS.CSLA.Library
int level = 0;
ItemInfo par = this;
ItemInfo LastRNO = null;
ItemInfo TopRNO = null;
while (par != null && !par.IsSection && !par.IsProcedure && !par.IsHigh)
{
if (par.IsRNOPart) LastRNO = par.MyParent;
if (par.IsRNOPart)
{
LastRNO = par.MyParent;
TopRNO = par;
}
if (!par.IsRNOPart && (par.IsSequential || (!(par.IsCaution || par.IsNote)
&& ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.CountAllSubLevels)))
level++;
par = par.MyParent;
}
// If high level RNOs are numbered, use the next level of tabs for lower
// level RNOs - unless DontOffsetTab format flag is set
if (LastRNO != null && LastRNO.IsHigh && TopRNO.FormatStepData.NumberHighLevel && TopRNO.FormatStepData.OffsetTab)
OffsetTab = TopRNO.FormatStepData.NumberHighLevel?1:0;
bias = 0;
if (par.FormatStepData != null && par.FormatStepData.TabData.IdentPrint.Contains("{ALPHA}"))
level--;
@@ -2767,7 +2805,7 @@ namespace VEPROMS.CSLA.Library
if (FormatStepData.TabData.Justify == "Center")
{
_MyHeader.Justify = ContentAlignment.MiddleCenter;
_MyHeader.Text = tbformat.Replace("\\xA0"," ").Trim();
_MyHeader.Text = (!FormatStepData.TabData.NoTrim)?tbformat.Replace("\\xA0"," ").Trim():tbformat.Replace("\\xA0"," ");
_MyHeader.CleanText = StripRtfFormatting(_MyHeader.Text);
// if there is only step in the group - no bullet is used, if more that one replace the tab
// with a bullet. Also, if only one in group and tab text ends with 'S', remove it:
@@ -3051,7 +3089,7 @@ namespace VEPROMS.CSLA.Library
int sectCoIndx = SectionDefaultCheckOffIndex(); // no checkoff on step, see if there is a section default.
if (sectCoIndx == -1) return null;
if ((ActiveFormat.PlantFormat.FormatData.ProcData.CheckOffData.CheckOffOnHLSOnly && IsHigh)
|| (!ActiveFormat.PlantFormat.FormatData.ProcData.CheckOffData.CheckOffOnHLSOnly && IsLowestLevelStep() && !RNOsHighHasCheckOff()))
|| (!ActiveFormat.PlantFormat.FormatData.ProcData.CheckOffData.CheckOffOnHLSOnly && IsLowestLevelStep())) // && !RNOsHighHasCheckOff()))
return ActiveFormat.PlantFormat.FormatData.ProcData.CheckOffData.CheckOffList[sectCoIndx];
return null;
}
@@ -3127,6 +3165,7 @@ namespace VEPROMS.CSLA.Library
MyFont = font;
}
public int Offset;
public int AsteriskOffset;
private static Regex _ReplaceSymbols = new Regex("^[^0-9A-Za-z]*"); // trim anything that isn't an ascii alpha/numeric from the beginning
public string CleanTextNoSymbols
{
@@ -4469,7 +4508,6 @@ namespace VEPROMS.CSLA.Library
//Procedure tmp = (Procedure)GetExistingByPrimaryKey(itemID);
if (tmp == null)
{
if (itm != null) Console.WriteLine("type = {0}", itm.GetType().Name);
tmp = DataPortal.Fetch<Procedure>(new PKCriteria(itemID));
AddToCache(tmp);
}