This commit is contained in:
Kathy Ruffing 2012-08-01 11:31:42 +00:00
parent 058c21ba65
commit 8bba4e7426
2 changed files with 60 additions and 31 deletions

View File

@ -201,7 +201,7 @@ namespace Volian.Print.Library
//if (localYPageStart != yPageStart) DebugText.WriteLine("ParToPdf-yPagestartDiff:{0},{1},{2}", MyItemInfo.ItemID, localYPageStart, yPageStart); //if (localYPageStart != yPageStart) DebugText.WriteLine("ParToPdf-yPagestartDiff:{0},{1},{2}", MyItemInfo.ItemID, localYPageStart, yPageStart);
return yPageStart; return yPageStart;
} }
private float DrawGrid(PdfContentByte cb, ref float yPageStart, float yTopMargin, float yBottomMargin, ref float yLocation) private float DrawGrid(PdfContentByte cb, ref float yPageStart, float yTopMargin, float yBottomMargin, ref float yLocation)
{ {
//DebugText.WriteLine("{0},'{1}','{2}','<<END>>'", MyItemInfo.ItemID, MyItemInfo.ShortPath, FormattedText); //DebugText.WriteLine("{0},'{1}','{2}','<<END>>'", MyItemInfo.ItemID, MyItemInfo.ShortPath, FormattedText);
@ -652,6 +652,7 @@ namespace Volian.Print.Library
private int COL_WID_ADJ = 6; // adjusts for incorrect use of WidSTable when breaking a line (it breaks 6 chars too short) private int COL_WID_ADJ = 6; // adjusts for incorrect use of WidSTable when breaking a line (it breaks 6 chars too short)
public vlnParagraph(vlnParagraph parent, PdfContentByte cb, ItemInfo itemInfo, float xoff, float yoff, int rnoLevel, int maxRNO, FormatInfo formatInfo) public vlnParagraph(vlnParagraph parent, PdfContentByte cb, ItemInfo itemInfo, float xoff, float yoff, int rnoLevel, int maxRNO, FormatInfo formatInfo)
{ {
int MetaLevel = 0; // if meta section, stores what level this section is.
float savCheckListBottomMost = 0; float savCheckListBottomMost = 0;
//int[] problemIDs = { 889 }; //int[] problemIDs = { 889 };
//List<int> lProblemIDs = new List<int>(problemIDs); //List<int> lProblemIDs = new List<int>(problemIDs);
@ -694,6 +695,8 @@ namespace Volian.Print.Library
itemInfo.FormatStepData.StepLayoutData.AlignWithParentTab itemInfo.FormatStepData.StepLayoutData.AlignWithParentTab
|| (itemInfo.Steps != null && itemInfo.Steps.Count > 0 && itemInfo.Steps[0].FormatStepData.StepLayoutData.AlignWithParentTab)) || (itemInfo.Steps != null && itemInfo.Steps.Count > 0 && itemInfo.Steps[0].FormatStepData.StepLayoutData.AlignWithParentTab))
itemInfo.MyTab = null; itemInfo.MyTab = null;
float xMetaAdj = 0;
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;
@ -715,20 +718,31 @@ namespace Volian.Print.Library
float offset = (float)itemInfo.MyDocStyle.Layout.LeftMargin; float offset = (float)itemInfo.MyDocStyle.Layout.LeftMargin;
if (formatInfo.PlantFormat.FormatData.SectData.SectionNumber.Pos != null) if (formatInfo.PlantFormat.FormatData.SectData.SectionNumber.Pos != null)
{ {
// determine level of metasections. This level will be used to calculate the
// indent. DO I NEED THIS HERE????
int level = 0;
ItemInfo iilvl = itemInfo; ItemInfo iilvl = itemInfo;
while (!iilvl.IsProcedure) while (!iilvl.IsProcedure)
{ {
level++; // see if this metasection, walking up the tree, has its header printed,
// if so, indent for it.
SectionConfig sch1 = iilvl.MyConfig as SectionConfig;
if (sch1.Section_PrintHdr == "Y" || MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.UseMetaSections) MetaLevel++;
iilvl = iilvl.MyParent; iilvl = iilvl.MyParent;
} }
level = level <= 2 ? 1 : level - 1; MetaLevel = MetaLevel <= 2 ? 1 : MetaLevel - 1;
if (level == 1) if (MetaLevel == 1)
offset += (float)formatInfo.PlantFormat.FormatData.SectData.SectionNumber.Pos; offset += (float)formatInfo.PlantFormat.FormatData.SectData.SectionNumber.Pos;
else else
offset += (level-1) * ((float)formatInfo.PlantFormat.FormatData.SectData.SectionHeader.Pos-(float)formatInfo.PlantFormat.FormatData.SectData.SectionNumber.Pos); {
xMetaAdj = (float)formatInfo.PlantFormat.FormatData.SectData.MetaSectionList[0].ColSByLevel;
for (int i = 0; i < MetaLevel; i++)
{
xMetaAdj += (float)formatInfo.PlantFormat.FormatData.SectData.SectionHeader.Pos - (float)formatInfo.PlantFormat.FormatData.SectData.SectionNumber.Pos;
xMetaAdj += (float)formatInfo.PlantFormat.FormatData.SectData.MetaSectionList[i].SecNumPositionAdj;
}
offset += xMetaAdj;
itemInfo.MyTab.Text = itemInfo.MyTab.Text.TrimEnd(" ".ToCharArray());
itemInfo.MyTab.CleanText = itemInfo.MyTab.CleanText.TrimEnd(" ".ToCharArray());
}
} }
localXOffset = offset; localXOffset = offset;
} }
@ -741,7 +755,7 @@ namespace Volian.Print.Library
} }
} }
AdjustWidth(itemInfo, maxRNO, formatInfo, mytab); AdjustWidth(itemInfo, maxRNO, formatInfo, mytab);
AdjustXOffsetForTab(itemInfo, maxRNO, formatInfo, mytab); AdjustXOffsetForTab(itemInfo, maxRNO, formatInfo, mytab, xMetaAdj);
if (itemInfo.MyHeader != null && itemInfo.MyHeader.Text != null && !doSectTab) if (itemInfo.MyHeader != null && itemInfo.MyHeader.Text != null && !doSectTab)
yoff += SetHeader(this, cb, itemInfo, formatInfo); yoff += SetHeader(this, cb, itemInfo, formatInfo);
if (itemInfo.Cautions != null && !(itemInfo.IsCaution || itemInfo.IsNote)) if (itemInfo.Cautions != null && !(itemInfo.IsCaution || itemInfo.IsNote))
@ -905,6 +919,7 @@ namespace Volian.Print.Library
yoff += AdjustForBlankLines(); yoff += AdjustForBlankLines();
if (dropCheckoff) if (dropCheckoff)
yForCheckoff += Height - SixLinesPerInch; // place checkoff on last row of text yForCheckoff += Height - SixLinesPerInch; // place checkoff on last row of text
} }
} }
CheckOff co = itemInfo.GetCheckOffStep(); CheckOff co = itemInfo.GetCheckOffStep();
@ -1567,7 +1582,7 @@ namespace Volian.Print.Library
return _ChildrenLeft; return _ChildrenLeft;
} }
} }
public void AdjustXOffsetForTab(ItemInfo itemInfo, int maxRNO, FormatInfo formatInfo, vlnTab myTab) public void AdjustXOffsetForTab(ItemInfo itemInfo, int maxRNO, FormatInfo formatInfo, vlnTab myTab, float xMetaAdj)
{ {
float tabWidth = (myTab == null) ? 0 : myTab.Width; float tabWidth = (myTab == null) ? 0 : myTab.Width;
if (itemInfo.IsStepSection) if (itemInfo.IsStepSection)
@ -1582,10 +1597,14 @@ namespace Volian.Print.Library
iilvl = iilvl.MyParent; iilvl = iilvl.MyParent;
} }
level = level <= 2 ? 1 : level - 1; level = level <= 2 ? 1 : level - 1;
if (level==1) if (level == 1)
XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + (level * (float)formatInfo.PlantFormat.FormatData.SectData.SectionHeader.Pos); XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + (level * (float)formatInfo.PlantFormat.FormatData.SectData.SectionHeader.Pos);
else else
{
XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + (float)formatInfo.PlantFormat.FormatData.SectData.MetaSectionList[level].ColSByLevel; XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + (float)formatInfo.PlantFormat.FormatData.SectData.MetaSectionList[level].ColSByLevel;
XOffset += (float)formatInfo.PlantFormat.FormatData.SectData.MetaSectionList[level].SecTitlePositionAdj;
XOffset -= xMetaAdj;
}
} }
return; return;
} }
@ -1637,15 +1656,14 @@ namespace Volian.Print.Library
int indxLevel = itemInfo.PrintLevel + itemInfo.CurrentSectionLevel(); int indxLevel = itemInfo.PrintLevel + itemInfo.CurrentSectionLevel();
float colsbylevel = (float)formatInfo.PlantFormat.FormatData.SectData.MetaSectionList[indxLevel % formatInfo.PlantFormat.FormatData.SectData.MetaSectionList.Count].ColSByLevel; float colsbylevel = (float)formatInfo.PlantFormat.FormatData.SectData.MetaSectionList[indxLevel % formatInfo.PlantFormat.FormatData.SectData.MetaSectionList.Count].ColSByLevel;
float seclvlindent = colsbylevel - (float)formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ColS; float seclvlindent = colsbylevel - (float)formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ColS;
x = (float)itemInfo.MyDocStyle.Layout.LeftMargin + (float)formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ColS + seclvlindent; float adjCols = (float)formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ColS + seclvlindent;
xoff = x - XOffset; float xtabcol = adjCols - (myTab.Text.Length * 7.2f);
if (myTab != null) myTab.XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + colsbylevel; if (indxLevel > 1 && myTab != null) myTab.XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + xtabcol;
LeftJustifyList jstlst = formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionPrintData.LeftJustifyList; else if (myTab != null) myTab.XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + colsbylevel;
if (jstlst.Count > 0) myTab.Rtf = myTab.Rtf.Replace(myTab.Text, myTab.Text.TrimStart(" ".ToCharArray()));
{ if (formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionPrintData.LeftJustifyList != null &&
float leftJustifyTabSize = jstlst[indxLevel % jstlst.Count].Size ?? 0; formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionPrintData.LeftJustifyList.Count > 0)
XOffset = myTab.XOffset + leftJustifyTabSize; XOffset = myTab.XOffset + GetLeftJustify(formatInfo, indxLevel);
}
else else
XOffset = myTab.XOffset + (myTab.Text.Length * (float)itemInfo.FormatStepData.Font.CPI) - colsbylevel; XOffset = myTab.XOffset + (myTab.Text.Length * (float)itemInfo.FormatStepData.Font.CPI) - colsbylevel;
} }
@ -1667,17 +1685,8 @@ namespace Volian.Print.Library
{ {
if (myTab != null && itemInfo.IsSequential && formatInfo.PlantFormat.FormatData.SectData.UseMetaSections && formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionPrintData.LeftJustifyList.Count > 0) if (myTab != null && itemInfo.IsSequential && formatInfo.PlantFormat.FormatData.SectData.UseMetaSections && formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionPrintData.LeftJustifyList.Count > 0)
{ {
int indxLevels = itemInfo.PrintLevel + itemInfo.CurrentSectionLevel(); // kbr -1; int indxLevels = itemInfo.PrintLevel + itemInfo.CurrentSectionLevel();
LeftJustifyList jstlst = formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionPrintData.LeftJustifyList; float tableftadj = GetLeftJustify(formatInfo, indxLevels);
float tableftadj = 0;
foreach (LeftJustify lj in jstlst)
{
if (lj.Index == indxLevels)
{
tableftadj = lj.Size ?? 0;
break;
}
}
// the order of this is important. First adjust the tab's xoffset for the width of // the order of this is important. First adjust the tab's xoffset for the width of
// the tab. The offset of text needs to be adjusted by the 'leftjustify' format variable // the tab. The offset of text needs to be adjusted by the 'leftjustify' format variable
// if it existed for this level. // if it existed for this level.
@ -1695,6 +1704,21 @@ namespace Volian.Print.Library
} }
} }
} }
private static float GetLeftJustify(FormatInfo formatInfo, int indxLevels)
{
LeftJustifyList jstlst = formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionPrintData.LeftJustifyList;
float tableftadj = 0;
foreach (LeftJustify lj in jstlst)
{
if (lj.Index == indxLevels)
{
tableftadj = lj.Size ?? 0;
break;
}
}
return tableftadj;
}
public void AdjustWidth(ItemInfo itemInfo, int maxRNO, FormatInfo formatInfo, vlnTab myTab) public void AdjustWidth(ItemInfo itemInfo, int maxRNO, FormatInfo formatInfo, vlnTab myTab)
{ {
int typ = ((int)itemInfo.MyContent.Type) % 10000; int typ = ((int)itemInfo.MyContent.Type) % 10000;

View File

@ -245,7 +245,12 @@ namespace Volian.Print.Library
// do positioning based on whether format has locations for section 'header'. If it's not centered, treat // do positioning based on whether format has locations for section 'header'. If it's not centered, treat
// it's location more like a 'tab'. // it's location more like a 'tab'.
if (doSectTab) if (doSectTab)
{
XOffset = xoffset; XOffset = xoffset;
// the width was just a little small, so it was wrapping - but only if there were no spaces at end
// so use this condition to do minimal impact (WCN1 format, for section tabs with three places, i.e. 6.1.2
if (!cleanTab.EndsWith(" "))Width += .1f;
}
else else
{ {
//if (MyFont.Family == "Arial" && MyFont.Size == 14) //if (MyFont.Family == "Arial" && MyFont.Size == 14)