2008-11-19 14:07:50 +00:00

127 lines
3.3 KiB
C#

using System;
using System.Collections.Generic;
using System.Text;
using VEPROMS.CSLA.Library;
namespace Volian.Controls.Library
{
class TemporaryFormat
{
private static string[] _TabFormats = new string[] {
"", // 0 base
"<seq>",// 1 //STANDARD
" <number> ",// 2 //HIGH
"[<number>] ",// 3 //IMMEDIATE
"o ",// 4 //AND
"o ",// 5 //OR
"CAUTION ",// 6 //CAUTION
"NOTE ",// 7 //NOTE
"",// 8 //TABLE
" <number>* ",// 9 //CONTINUOUS
"",// 10 //AERTABLE
"o ",// 11 //EQUIPMENTLIST
"",// 12 //TITLE
"",// 13 //PAGENUMBER
"o ",// 14 //EQUIPMENTWBLANK
"",// 15 //PROCNUMBER
"",// 16 //REVNUMBER
"",// 17 //ACCPAGES
"",// 18 //LOSSOFAC
"o ",// 19 //EXPLICITAND
"CAUTION ",// 20 //CAUTION1
"CAUTION ",// 21 //CAUTION2
"NOTE ",// 22 //NOTE1
"NOTE ",// 23 //NOTE2
"",// 24 //PARAGRAPH
"",// 25 //DEFAULT
"NOTE ",// 26 //NOTE3
"CAUTION ",// 27 //CAUTION3
"NOTE ",// 28 //NOTE4
"CAUTION ",// 29 //CAUTION4
"o ",// 30 //EQUIPMENTOPT
"o ",// 31 //EQUIPMENTOPTWBLANK
"NOTE ",// 32 //NOTE5
"",// 33 //BORDERLESSAERTABLE
"",// 34 //BORDERLESSTABLE
"o ",// 35 //IMPLICITOR
"",// 36 //FIGURE
"",// 37 //AERFIGURE
"",// 38 //BORDERLESSFIGURE
"",// 39 //BORDERLESSAERFIGURE
"",// 40 //RNOTYPE
" <number>! ",// 41 //HIGH5
"",// 42 //TITLEWITHTEXTRIGHT
"",// 43 //TITLEWITHTEXTBELOW
"",// 44 //CONTACSEQUENTIAL
"o ",// 45 //CONTACAND
"o ",// 46 //CONTACOR
"" // 47 //CONTACPARAGRAPH
};
private static string[] SeqTabFormat = new string[] {
"<number>. ",
"<alpha>. ",
"<number>) ",
"<alpha>) "
};
public static string TabFormat(StepItem myDisplayItem)
{
string format = string.Empty;
if (myDisplayItem.MyItemInfo != null)
{
int typ = (int)myDisplayItem.MyItemInfo.MyContent.Type;
if (typ >= 20000)
{
if (myDisplayItem.RNOLevel > 0 && IsRNO(myDisplayItem.MyItemInfo)) return "";
// Step 1: Get TabFormat from Format
format = _TabFormats[typ % 10000];
if (format == "<seq>")
{
format = SeqTabFormat[myDisplayItem.SeqLevel % SeqTabFormat.Length];
}
}
}
return format;
}
public static string TabFormat(ItemInfo item, int seqLevel)
{
string format = string.Empty;
if (item != null)
{
if (IsRNO(item)) return "";
if ((item.MyContent.Type / 10000) == 2)
{
// Step 1: Get TabFormat from Format
format = _TabFormats[((int)item.MyContent.Type) % 10000];
if (format == "<seq>")
{
format = SeqTabFormat[seqLevel];
}
}
}
return format;
}
// TODO: Move these to ItemExt.cs as properties
public static bool IsHigh(ItemInfo item)
{
// check to see if ActiveParent is a section
if(item.MyContent.Type / 10000 != 2)return false;
ItemInfo parent = (ItemInfo)item.ActiveParent;
if ((parent.MyContent.Type / 10000) == 1)
return true;
return false;
}
public static bool IsSequential(ItemInfo item)
{
//if (IsHigh(item)) return true;
if (((item.MyContent.Type / 10000) == 2) && ((((int)item.MyContent.Type) % 10000) == 0)) return true;
return false;
}
public static bool IsRNO(ItemInfo item)
{
if(item != null)
return ((item.ItemPartCount > 0) && (item.ItemParts[0].PartType == E_FromType.RNO));
return false;
}
}
}