This commit is contained in:
2010-07-14 16:17:39 +00:00
parent 2bf01da344
commit ebd566dcb2
11 changed files with 1058 additions and 468 deletions

View File

@@ -26,12 +26,6 @@ namespace Volian.Print.Library
get { return _BottomMessage; }
set { _BottomMessage = value; }
}
//vlnParagraphs _MyParagraphs = new vlnParagraphs(null);
//public vlnParagraphs MyParagraphs
//{
// get { return _MyParagraphs; }
// set { _MyParagraphs = value; }
//}
Dictionary<int, vlnParagraph> _MyParagraphs = new Dictionary<int, vlnParagraph>();
public Dictionary<int, vlnParagraph> MyParagraphs
{
@@ -44,16 +38,32 @@ namespace Volian.Print.Library
get { return _YMultiplier; }
set { _YMultiplier = value; }
}
private PdfWriter _MyPdfWriter;
public PdfWriter MyPdfWriter
{
get { return _MyPdfWriter; }
set
{
MyPageCounts = new PageCounts();
_MyPdfWriter = value;
}
}
private PdfContentByte _MyPdfContentByte;
public PdfContentByte MyPdfContentByte
{
get { return _MyPdfContentByte; }
set { _MyPdfContentByte = value; }
}
public override void OnCloseDocument(PdfWriter writer, iTextSharp.text.Document document)
{
MyPageCounts.DrawTemplates();
}
public override void OnEndPage(PdfWriter writer, iTextSharp.text.Document document)
{
MyPageCounts.CanIncrement = true;
base.OnEndPage(writer, document);
DrawChangeBars(writer.DirectContent);
DrawMessages(writer.DirectContent);
//DrawBackground(writer.DirectContentUnder);
//DrawPageList(writer.DirectContent);
//DrawWatermark(writer.DirectContentUnder);
//DrawZoomOMatic(writer.DirectContent);
//CurrentPageNumber++;
}
private void DrawMessages(PdfContentByte cb)
{
@@ -233,7 +243,7 @@ namespace Volian.Print.Library
vcb.YChangeBarBottomExtend >= (cb.YChangeBarBottomExtend - vlnPrintObject.SixLinesPerInch)) return true;
return false;
}
public VlnSvgPageHelper(VEPROMS.CSLA.Library.SectionInfo mySection)
public VlnSvgPageHelper(VEPROMS.CSLA.Library.SectionInfo mySection) : base()
{
MySection = mySection;
}
@@ -251,15 +261,66 @@ namespace Volian.Print.Library
mySvg.TopMargin = 9.6F;
VEPROMS.CSLA.Library.PageStyle pageStyle = docStyle.pagestyle;
AddPageListItems(mySvg, pageStyle, mySection);
//DocStyle docStyle = GetDocStyle(activeFormat, (section.MyContent.Type ?? 10000));
mySvg.ProcessText += new SvgProcessTextEvent(mySvg_ProcessText);
return mySvg;
}
PageCounts MyPageCounts = null;
private static Regex regexFindToken = new Regex("{[^{}]*}");
private string mySvg_ProcessText(object sender, SvgProcessTextArgs args)
{
if (!args.MyText.Contains("{"))
return args.MyText;
/*
* Check if tokens for handling page counts ({PAGE} {OF} etc). if so, do templates.
*/
if (args.MyText.Contains("{PAGE}") || args.MyText.Contains("{OF}"))
{
/*
public enum E_NumberingSequence : uint
{
NoPageNum = 0,
WithSteps = 1, Add to original steps section page count.
WithinEachDocStyle = 2,
WithinEachSection = 3,
WithinEachDocStyle1 = 4,
GroupedByPagination = 5,
GroupedByLevel = 6,
WithStepsAndSecondaryPageNumber = 7,
WithStepsAndSecondaryPageNumberGroupedByLevel = 8,
Like6_ButDoesntNeedSubsection = 9,
Like6_ButDoesntNeedSubsection1 = 10
};
*/
// default for the key is to make it NumberingSequence. Then handle
// specific cases.
string key = ((int)MySection.MyDocStyle.NumberingSequence).ToString();
E_NumberingSequence numseq = MySection.MyDocStyle.NumberingSequence??0;
switch (numseq)
{
case E_NumberingSequence.WithSteps: // Number with 'originalstepsection'
ProcedureInfo pc = MySection.MyProcedure;
int sectid = 0;
foreach (SectionInfo si in pc.Sections)
{
SectionConfig sc = si.MyConfig as SectionConfig;
if (sc.Section_OriginalSteps == "Y")
{
sectid = si.ItemID;
break;
}
}
if (sectid != 0) key = (int)E_NumberingSequence.WithinEachSection + "." + sectid;
break;
case E_NumberingSequence.WithinEachDocStyle:
key = key + "." + MySection.ActiveFormat.FormatID + "." + MySection.MyDocStyle.Index;
break;
case E_NumberingSequence.WithinEachSection:
key = key + "." + MySection.ItemID;
break;
}
MyPdfContentByte.AddTemplate(MyPageCounts.AddToTemplateList(key, MyPdfWriter, args.MyText, args.MySvgText.Font, args.MySvgText.Align, args.MySvgText.FillColor), args.MySvgScale.X(args.MySvgText.X), args.MySvgScale.Y(MyPdfContentByte, args.MySvgText.Y));
return string.Empty;
}
return regexFindToken.Replace(args.MyText, new MatchEvaluator(ReplacePageListToken));
}
private string BuildMyText(VEPROMS.CSLA.Library.FormatInfo activeFormat)