This commit is contained in:
Kathy Ruffing 2012-02-15 15:06:40 +00:00
parent ae455b6007
commit 7ff80c70f7

View File

@ -109,6 +109,11 @@ namespace Volian.Print.Library
if ((MySection.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DontCountInTabOfCont) == 0)
CurrentTOCPageNumber++;
}
if (NegPageItems != null)
{
NegPageItems.Clear();
NegPageItems = null;
}
YMultiplier = 1;
}
private void DrawRuler(PdfContentByte cb)
@ -260,7 +265,8 @@ namespace Volian.Print.Library
{
_MySection = value;
MySectionTitle = ((_MySection.DisplayNumber ?? "")=="" ? "" : _MySection.DisplayNumber + " - ") + _MySection.DisplayText;
MySvg = BuildSvg(_MySection);
Volian.Svg.Library.Svg sectSvg = BuildSvg(_MySection);
if (sectSvg != null) MySvg = sectSvg;
}
}
private string _MySectionTitle;
@ -404,11 +410,8 @@ namespace Volian.Print.Library
{
VEPROMS.CSLA.Library.FormatInfo activeFormat = mySection.ActiveFormat;
VEPROMS.CSLA.Library.DocStyle docStyle = mySection.MyDocStyle;
Volian.Svg.Library.Svg mySvg = null;
//string jsj = BuildMyText(activeFormat);
//if (jsj == "")
// Console.WriteLine("here");
//mySvg = SvgSerializer<Volian.Svg.Library.Svg>.StringDeserialize(jsj);
mySvg = SvgSerializer<Volian.Svg.Library.Svg>.StringDeserialize(BuildMyText(activeFormat));
mySvg.ViewBox.Height = 1100;
mySvg.ViewBox.Width = 850;
@ -419,6 +422,17 @@ namespace Volian.Print.Library
VEPROMS.CSLA.Library.PageStyle pageStyle = docStyle.pagestyle;
AddPageListItems(mySvg, pageStyle, mySection);
mySvg.ProcessText += new SvgProcessTextEvent(mySvg_ProcessText);
// if this section had a previous section and this is continuous, don't generate the svg for
// it, we'll use the previous section. The only thing we need to do is to process through the
// pagelist items in case there are some section items, for example the checkoff header needs
// to be processed for each section whether or not it is continuous.
SectionConfig.SectionPagination sPag = SectionConfig.SectionPagination.Separate;
if (mySection.IsStepSection && mySection.MyPrevious != null && mySection.MyPrevious.IsStepSection)
{
SectionConfig sc = mySection.MyConfig as SectionConfig;
sPag = sc.Section_Pagination;
}
if (sPag == SectionConfig.SectionPagination.Continuous) return null;
return mySvg;
}
public PageCounts MyPageCounts = null;
@ -542,8 +556,17 @@ namespace Volian.Print.Library
return token.Substring(1, 1) + token.Substring(token.Length - 2, 1);
}
private static Regex regexJustTokens = new Regex(@"^{([^{}]*}{)*[^{}]*}$");
public Dictionary<SectionInfo, CheckOffHeaderHelper> NegPageItems;
private void AddPageListItems(Volian.Svg.Library.Svg mySvg, VEPROMS.CSLA.Library.PageStyle pageStyle, VEPROMS.CSLA.Library.SectionInfo section)
{
// If this is a continuous section, then the only pagelist items we want are section type since
// we are still on the same page. - CHECK IF ON SAME PAGE!!!!
SectionConfig.SectionPagination sPag = SectionConfig.SectionPagination.Separate;
if (section.IsStepSection && section.MyPrevious != null && section.MyPrevious.IsStepSection)
{
SectionConfig sc = section.MyConfig as SectionConfig;
sPag = sc.Section_Pagination;
}
SvgGroup svgGroup = new SvgGroup();
//int defPtPerRow = 72 / 6;
@ -552,6 +575,8 @@ namespace Volian.Print.Library
//float PrevRow = 0;
//float rowAdj = 0; // = 18;
foreach (VEPROMS.CSLA.Library.PageItem pageItem in pageStyle.PageItems)
{
if (sPag == SectionConfig.SectionPagination.Separate || ((sPag == SectionConfig.SectionPagination.Continuous || sPag ==0 )&& pageItem.Row < 0))
{
//if (PrevRow > 0)
//{
@ -566,7 +591,7 @@ namespace Volian.Print.Library
// }
//}
MatchCollection matches = regexFindToken.Matches(pageItem.Token);
if (matches.Count>0)
if (matches.Count > 0)
{
string plstr = "";
// When a pagelist line (row) has more than one token that is resolved to text, each resolved token text was place on top
@ -582,7 +607,7 @@ namespace Volian.Print.Library
case "{!atom}":
// Add an Atom Figure to the SVG
plstr = plstr.Replace(token, "");
AddImage(svgGroup,160.5f, 170.5f,288f, 323f,"atom.bmp");
AddImage(svgGroup, 160.5f, 170.5f, 288f, 323f, "atom.bmp");
break;
case "{!cpllogo}":
plstr = plstr.Replace(token, "");
@ -648,7 +673,7 @@ namespace Volian.Print.Library
break;
case "{COVERTITLE1}":
case "{COVERTITLE2}":
int ctlen = section.ActiveFormat.PlantFormat.FormatData.ProcData.CoverTitleLength??0;
int ctlen = section.ActiveFormat.PlantFormat.FormatData.ProcData.CoverTitleLength ?? 0;
float coverlinelen = ((ctlen == 0) ? (int)section.ActiveFormat.PlantFormat.FormatData.ProcData.TitleLength : ctlen) * (float)pageItem.Font.CPI / 12;
plstr = SplitCoverTitle(svgGroup, pageItem, section.MyProcedure.MyContent.Text, (int)coverlinelen, token, plstr);//, rowAdj);
//SplitTitle(svgGroup, pageItem, section.MyProcedure.MyContent.Text, (int)section.ActiveFormat.PlantFormat.FormatData.ProcData.TitleLength, token);
@ -681,6 +706,27 @@ namespace Volian.Print.Library
if (sindx > 0)
{
plstr = plstr.Replace(token, "");
if (pageItem.Row < 0)
{
// for the checkoff header, use the font from the CheckOffData Checkoffheader, font to get the
// font style, i.e. bold - underline.
if (NegPageItems == null) NegPageItems = new Dictionary<SectionInfo, CheckOffHeaderHelper>();
// now see if this same checkoff header is on the page, if so, don't
// add it to the list. We only want those that are different.
bool add = true;
foreach (CheckOffHeaderHelper h in NegPageItems.Values)
{
if (section.ActiveFormat.PlantFormat.FormatData.ProcData.CheckOffData.CheckOffHeaderList[sindx].CheckOffHeading == h.SvgText.Text) add=false;
}
if (add)
{
SvgText svgt = PageItemToSvgText(pageItem, section.ActiveFormat.PlantFormat.FormatData.ProcData.CheckOffData.CheckOffHeaderList[sindx].CheckOffHeading, section.ActiveFormat.PlantFormat.FormatData.ProcData.CheckOffData.CheckOffHeaderList[sindx].Font);
CheckOffHeaderHelper hlp = new CheckOffHeaderHelper(svgt, section.ActiveFormat.PlantFormat.FormatData.ProcData.CheckOffData.CheckOffHeaderList[sindx].Font);
NegPageItems.Add(section, hlp);
}
}
else
svgGroup.Add(PageItemToSvgText(pageItem, section.ActiveFormat.PlantFormat.FormatData.ProcData.CheckOffData.CheckOffHeaderList[sindx].CheckOffHeading, section.ActiveFormat.PlantFormat.FormatData.ProcData.CheckOffData.CheckOffHeaderList[sindx].Font));
}
break;
@ -692,7 +738,7 @@ namespace Volian.Print.Library
if (procConfig != null)
{
int indx = token.IndexOf("-");
string val = procConfig.GetValue("PSI", token.Substring(4,token.Length-5));
string val = procConfig.GetValue("PSI", token.Substring(4, token.Length - 5));
plstr = plstr.Replace(token, val);
//svgGroup.Add(PageItemToSvgText(pageItem, pageItem.Token.Replace(token, val)));
}
@ -744,11 +790,15 @@ namespace Volian.Print.Library
else
svgGroup.Add(PageItemToSvgText(pageItem, pageItem.Token));
}
}
// Proms page numbering designed requires a "{PAGE}" token to increment the page counter. So the easiest way
// to do that was to add a "{PAGE}" token to every page that is flagged as not to be printed.
if (sPag == SectionConfig.SectionPagination.Separate)
{
SvgText st = new SvgText(new System.Drawing.PointF(300, 300), "Non-printing {PAGE}", new System.Drawing.Font("Arial", 10), System.Drawing.Color.Black);
svgGroup.Add(st);
mySvg.Add(svgGroup);
}
if (svgGroup.Count>0) mySvg.Add(svgGroup);
}
private static void AddImage(SvgGroup svgGroup, float x, float y, float w, float h, string figure)
@ -840,7 +890,7 @@ namespace Volian.Print.Library
}
else
{
m = Regex.Match(text.Substring(indx), @"^\\[uU][a-fA-F0-9][a-fA-F0-9][a-fA-F0-9][a-fA-F0-9]?");
m = Regex.Match(text.Substring(indx), @"^\\[uU][a-fA-F0-9][a-fA-F0-9][a-fA-F0-9][a-fA-F0-9][?]");
if (m.Success)
{
indx += m.Length - 1;
@ -868,7 +918,7 @@ namespace Volian.Print.Library
if (width > len)
{
// what should be done if lastspace == 0
results.Add(nextprefix+text.Substring(start, lastspace));
results.Add(nextprefix+text.Substring(start, lastspace-start));
nextprefix = rtfprefix;
if (nextprefix != "") nextprefix += " ";
start = lastspace + 1;
@ -1109,4 +1159,24 @@ namespace Volian.Print.Library
}
}
}
public class CheckOffHeaderHelper
{
private SvgText _SvgText;
public SvgText SvgText
{
get { return _SvgText; }
set { _SvgText = value; }
}
private VEPROMS.CSLA.Library.VE_Font _CheckOffHeaderFont;
public VEPROMS.CSLA.Library.VE_Font CheckOffHeaderFont
{
get { return _CheckOffHeaderFont; }
set { _CheckOffHeaderFont = value; }
}
public CheckOffHeaderHelper(SvgText stext, VEPROMS.CSLA.Library.VE_Font vf)
{
_SvgText = stext;
_CheckOffHeaderFont = vf;
}
}
}