This commit is contained in:
Kathy Ruffing 2012-06-08 13:25:05 +00:00
parent 639895f46f
commit 0d8f8e4a39

View File

@ -103,6 +103,7 @@ namespace Volian.Print.Library
box.Height = yoff - box.YOffset; // new height, with children box.Height = yoff - box.YOffset; // new height, with children
yoff += 2 * vlnPrintObject.SixLinesPerInch; yoff += 2 * vlnPrintObject.SixLinesPerInch;
} }
return yoff; return yoff;
} }
public float ToPdf(PdfContentByte cb, float yPageStart, float yTopMargin, float yBottomMargin) public float ToPdf(PdfContentByte cb, float yPageStart, float yTopMargin, float yBottomMargin)
@ -127,6 +128,12 @@ namespace Volian.Print.Library
/// This variable is used to match 16 bit pagination /// This variable is used to match 16 bit pagination
/// </summary> /// </summary>
private bool _Match16BitPagination = false; private bool _Match16BitPagination = false;
private bool _IsWordDocPara = false;
public bool IsWordDocPara
{
get { return _IsWordDocPara; }
set { _IsWordDocPara = value; }
}
public float ParagraphToPdf(PdfContentByte cb, float yPageStart, float yTopMargin, float yBottomMargin) public float ParagraphToPdf(PdfContentByte cb, float yPageStart, float yTopMargin, float yBottomMargin)
{ {
if (Processed) return yPageStart; if (Processed) return yPageStart;
@ -214,6 +221,8 @@ namespace Volian.Print.Library
// multiplier accounts for both. // multiplier accounts for both.
if (!MyItemInfo.IsStepSection && MyItemInfo.FormatStepData.CenterOneLineOnly && MyItemInfo.MyPrevious == null && MyItemInfo.NextItem == null && Height < (1.2F * IParagraph.Leading)) if (!MyItemInfo.IsStepSection && MyItemInfo.FormatStepData.CenterOneLineOnly && MyItemInfo.MyPrevious == null && MyItemInfo.NextItem == null && Height < (1.2F * IParagraph.Leading))
IParagraph.Alignment = Element.ALIGN_CENTER; IParagraph.Alignment = Element.ALIGN_CENTER;
if (!MyItemInfo.IsStepSection && MyItemInfo.FormatStepData.StepPrintData.Justify == "Center")
IParagraph.Alignment = Element.ALIGN_CENTER;
retval = Rtf2Pdf.TextAt(cb, IParagraph, XOffset, yLocation, Width, 100, DebugInfo, yBottomMargin); retval = Rtf2Pdf.TextAt(cb, IParagraph, XOffset, yLocation, Width, 100, DebugInfo, yBottomMargin);
if (retval == 0) // problem occurred - paragraph was not able to be printed on page if (retval == 0) // problem occurred - paragraph was not able to be printed on page
{ // pagination logic needs to be fixed. { // pagination logic needs to be fixed.
@ -320,6 +329,16 @@ namespace Volian.Print.Library
} }
public override float ToPdf(PdfContentByte cb, float yPageStart, float yTopMargin, float yBottomMargin) public override float ToPdf(PdfContentByte cb, float yPageStart, float yTopMargin, float yBottomMargin)
{ {
if (IsWordDocPara)
{
PdfReader tmp = null;
string tmpstr = null;
SectionInfo si = SectionInfo.Get(MyItemInfo.ItemID);
cb.PdfDocument.NewPage();
MyPageHelper.MyPromsPrinter.CreateWordDocPdf(cb, si, ref tmp, ref tmpstr);
Processed = true;
return yPageStart;
}
float yLocalypagestart = yPageStart; float yLocalypagestart = yPageStart;
// yPageStart is offset into roll; YTopMost is offset of topmost of this paragraph. // yPageStart is offset into roll; YTopMost is offset of topmost of this paragraph.
float yLocation = yPageStart - YTopMost; float yLocation = yPageStart - YTopMost;
@ -922,6 +941,15 @@ namespace Volian.Print.Library
MyPageHelper.MyParagraphs.Add(itemInfo.ItemID, this); MyPageHelper.MyParagraphs.Add(itemInfo.ItemID, this);
MyItemInfo = itemInfo; MyItemInfo = itemInfo;
XOffset = xoff; XOffset = xoff;
if (!MyItemInfo.IsStep && !MyItemInfo.IsStepSection)
{
IsWordDocPara = true;
// special case - this is a 'Word Doc' paragraph. The Processed flag is used to know
// that steps need put out on a page for the pagination logic, and since there are no steps
// we don't want to have to worry about putting this out for pagination logic.
Processed = true;
return;
}
// Set any position adjustment (defined in the format on a per type basis) // Set any position adjustment (defined in the format on a per type basis)
yoff += (MyItemInfo.FormatStepData == null) ? 0 : MyItemInfo.FormatStepData.StepLayoutData.STExtraSpace ?? 0; yoff += (MyItemInfo.FormatStepData == null) ? 0 : MyItemInfo.FormatStepData.StepLayoutData.STExtraSpace ?? 0;
YTopMost = YOffset = yoff; YTopMost = YOffset = yoff;
@ -932,6 +960,10 @@ namespace Volian.Print.Library
// of characters. // of characters.
if (itemInfo.MyParent.IsCaution || itemInfo.MyParent.IsNote) if (itemInfo.MyParent.IsCaution || itemInfo.MyParent.IsNote)
XOffset += 72 * (itemInfo.FormatStepData.CautionOrNoteSubstepIndent == null ? 0 : (float)itemInfo.FormatStepData.CautionOrNoteSubstepIndent / (float)itemInfo.FormatStepData.Font.CPI); XOffset += 72 * (itemInfo.FormatStepData.CautionOrNoteSubstepIndent == null ? 0 : (float)itemInfo.FormatStepData.CautionOrNoteSubstepIndent / (float)itemInfo.FormatStepData.Font.CPI);
// research a better way - maybe add an xml tag or check printident vs editident:
if (MyItemInfo.ActiveFormat.Name == "WCNCKL" && (MyItemInfo.MyContent.Type == 20031 || MyItemInfo.MyContent.Type == 20030 || MyItemInfo.MyContent.Type == 20035))
itemInfo.MyTab = null;
if (itemInfo.MyTab != null && itemInfo.MyTab.Text != null && itemInfo.MyTab.Text != "") if (itemInfo.MyTab != null && itemInfo.MyTab.Text != null && itemInfo.MyTab.Text != "")
{ {
float localXOffset = XOffset; float localXOffset = XOffset;
@ -1054,12 +1086,21 @@ namespace Volian.Print.Library
{ {
Rtf = GetRtf(itemInfo); Rtf = GetRtf(itemInfo);
// Need the following with some modifications for WCNCKL format: // Need the following with some modifications for WCNCKL format:
//if (Rtf.Contains("{Backspace}")) if (Rtf.Contains("{Backspace}"))
//{ {
// XOffset -= 18; XOffset -= 22;
// Width += 24; Width += 24;
// Rtf = Rtf.Replace("{Backspace}", ""); Rtf = Rtf.Replace("{Backspace}", "");
//} }
if (formatInfo.Name == "WCNCKL")
{
if (itemInfo.IsStep && (MyItemInfo.MyContent.Type == 20031 || MyItemInfo.MyContent.Type == 20030 || MyItemInfo.MyContent.Type == 20035))
{
int stplevl = TheStepLevel(itemInfo);
if (stplevl >= 0 && MyItemInfo.MyHLS.FormatStepData.VertPos[stplevl] > 0)
XOffset = float.Parse(MyItemInfo.MyHLS.FormatStepData.VertPos.Split(",".ToCharArray())[stplevl]) + (float)itemInfo.MyDocStyle.Layout.LeftMargin;
}
}
if (itemInfo.IsTablePart) // Not for grid, this is for old-style tables. if (itemInfo.IsTablePart) // Not for grid, this is for old-style tables.
{ {
Width = GetTableWidth(cb, IParagraph, MyItemInfo.MyDocStyle.Layout.PageWidth); Width = GetTableWidth(cb, IParagraph, MyItemInfo.MyDocStyle.Layout.PageWidth);
@ -1068,6 +1109,7 @@ namespace Volian.Print.Library
else else
if (itemInfo.FormatStepData != null && itemInfo.FormatStepData.StepPrintData != null) XOffset += (float)(itemInfo.FormatStepData.StepPrintData.PosAdjust ?? 0); if (itemInfo.FormatStepData != null && itemInfo.FormatStepData.StepPrintData != null) XOffset += (float)(itemInfo.FormatStepData.StepPrintData.PosAdjust ?? 0);
bool printMetaHdr = false; bool printMetaHdr = false;
if (itemInfo.Steps != null && itemInfo.IsSection && itemInfo.Sections != null && itemInfo.Sections.Count > 0) if (itemInfo.Steps != null && itemInfo.IsSection && itemInfo.Sections != null && itemInfo.Sections.Count > 0)
{ {
@ -1075,11 +1117,13 @@ namespace Volian.Print.Library
if ((sc != null && sc.Section_PrintHdr == "Y") && itemInfo.ActiveFormat.PlantFormat.FormatData.SectData.UseMetaSections) printMetaHdr = true; if ((sc != null && sc.Section_PrintHdr == "Y") && itemInfo.ActiveFormat.PlantFormat.FormatData.SectData.UseMetaSections) printMetaHdr = true;
} }
// Determine if section title is output // Determine if section title is output
if (!itemInfo.IsStepSection if ((!itemInfo.IsStepSection && MyItemInfo.ActiveFormat.Name != "WCNCKL")
|| printMetaHdr || || printMetaHdr ||
(formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ShowSectionTitles (formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ShowSectionTitles
&& !MyItemInfo.MyDocStyle.CancelSectTitle && !MyItemInfo.MyDocStyle.CancelSectTitle
&& !MyItemInfo.MyDocStyle.SpecialStepsFoldout)) && !MyItemInfo.MyDocStyle.SpecialStepsFoldout)
|| (MyItemInfo.ActiveFormat.Name=="WCNCKL" && !MyItemInfo.IsStepSection
&& itemInfo.MyContent.Type != 20031 && itemInfo.MyContent.Type != 20030)) // && itemInfo.MyContent.Type != 20035))
{ {
yoff += Height; yoff += Height;
//yForCheckoff = yoff - SixLinesPerInch; //yForCheckoff = yoff - SixLinesPerInch;
@ -1143,6 +1187,18 @@ namespace Volian.Print.Library
YBottomMost = yoff; YBottomMost = yoff;
} }
private int TheStepLevel(ItemInfo itemInfo)
{
int lev = 0;
ItemInfo ii = itemInfo;
while (!ii.MyParent.IsHigh)
{
lev++;
ii = ii.MyParent;
}
return lev;
}
private string SectionHasCheckOffHeader(ItemInfo itemInfo, ref VE_Font font) private string SectionHasCheckOffHeader(ItemInfo itemInfo, ref VE_Font font)
{ {
// If the passed in itemInfo is not a section, get it's parent section. This may be a subsection, so // If the passed in itemInfo is not a section, get it's parent section. This may be a subsection, so