using FastReport.Utils;
namespace FastReport.Engine
{
public partial class ReportEngine
{
#region Fields
private bool keeping;
private int keepPosition;
private XmlItem keepOutline;
private int keepBookmarks;
private float keepCurX;
private float keepCurY;
private float keepDeltaY;
#endregion Fields
#region Properties
///
/// Returns true of keeping is enabled
///
public bool IsKeeping
{
get { return keeping; }
}
///
/// Returns keeping position
///
public float KeepCurY
{
get { return keepCurY; }
}
#endregion Properties
#region Private Methods
private void StartKeep(BandBase band)
{
// do not keep the first row on a page, avoid empty first page
if (keeping || (band != null && band.AbsRowNo == 1 && !band.FirstRowStartsNewPage))
return;
keeping = true;
keepPosition = PreparedPages.CurPosition;
keepOutline = PreparedPages.Outline.CurPosition;
keepBookmarks = PreparedPages.Bookmarks.CurPosition;
keepCurY = CurY;
Report.Dictionary.Totals.StartKeep();
StartKeepReprint();
}
private void CutObjects()
{
keepCurX = CurX;
keepDeltaY = CurY - keepCurY;
PreparedPages.CutObjects(keepPosition);
CurY = keepCurY;
}
private void PasteObjects()
{
PreparedPages.PasteObjects(CurX - keepCurX, CurY - keepCurY);
PreparedPages.Outline.Shift(keepOutline, CurY);
PreparedPages.Bookmarks.Shift(keepBookmarks, CurY);
EndKeep();
CurY += keepDeltaY;
}
#endregion Private Methods
#region Public Methods
///
/// Starts the keep mechanism.
///
///
/// Use this method along with the method if you want to keep
/// several bands together. Call StartKeep method before printing the first band
/// you want to keep, then call the EndKeep method after printing the last band you want to keep.
///
public void StartKeep()
{
StartKeep(null);
}
///
/// Ends the keep mechanism.
///
///
/// Use this method along with the method if you want to keep
/// several bands together. Call StartKeep method before printing the first band
/// you want to keep, then call the EndKeep method after printing the last band you want to keep.
///
public void EndKeep()
{
if (keeping)
{
Report.Dictionary.Totals.EndKeep();
EndKeepReprint();
keeping = false;
}
}
#endregion Public Methods
}
}