C# Class SIL.FieldWorks.Common.PrintLayout.Page

Class that represents a publication page that can be laid out.
Inheritance: IPageInfo, IFWDisposable
Exibir arquivo Open project: sillsdev/FieldWorks Class Usage Examples

Protected Properties

Property Type Description
m_hPage int

Private Properties

Property Type Description
AddSeparatorForDependentStream void
AdjustFreeSpace void
AdjustOffsetFromTopOfDiv void
AdjustOffsetFromTopOfDiv void
AdjustPageElement void
DisposeDependentObjectStream void
Draw void
GetElementBounds System.Drawing.Rectangle
GetElementClipBounds System.Drawing.Rectangle
GetLastElement SIL.FieldWorks.Common.PrintLayout.PageElement
InsertPageElement void
LayOut void
LayOutIfNeeded bool
LayoutPageCore void
NextColumnIsEmpty bool
NoteDependentRoots void
NoteRootSizeChanged void
OffsetFromTopOfDiv int
TowardsTrailingEdge bool
TryToReuseDependentRootStream bool

Public Methods

Method Description
CheckDisposed ( ) : void

Check to see if the object has been disposed. All public Properties and Methods should call this before doing anything else.

Dispose ( ) : void

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

Must not be virtual.

GetFirstElementForStream ( IVwLayoutStream stream ) : SIL.FieldWorks.Common.PrintLayout.PageElement

Retrieves the page element that corresponds to the given stream. If multiple elements correspond to this stream, it gets the one with the smallest offset in the division (i.e., the one which corresponds to the highest place in the total document).

GetPositionOnPage ( IVwLayoutStream stream, Point pt, Point &result ) : bool

Gets the position of the point pt on the page.

OffsetFromTopOfDiv ( SIL.FieldWorks.Common.PrintLayout.DivisionLayoutMgr div ) : int

Gets the number of printer pixels (source/layout units) from the top of the given division's main layout stream to the top of the data represented by the first page element on this page for that stream. This may only be an estimate, particularly if: this page has no elements (at least for the given division) this page is broken there are previous pages that are not fully laid out (or broken)

Public to make testing easier.

Page ( SIL.FieldWorks.Common.PrintLayout.PublicationControl pub, int iFirstDivOnPage, int ypOffsetFromTopOfDiv, int pageNumber, int dypTopMarginInPrinterPixels, int dypBottomMarginInPrinterPixels ) : System

Constructs a Page object to represent a publication page that can be laid out.

Protected Methods

Method Description
AddPageElement ( SIL.FieldWorks.Common.PrintLayout.DivisionLayoutMgr division, IVwLayoutStream stream, bool fPageElementOwnsStream, Rectangle locationOnPage, int dypOffsetToTopOfDataOnPage, bool fMainStream, int currentColumn, int totalColumns, int columnGap, int columnHeight, int dypOverlapWithPreviousElement, bool isRightToLeft, bool fReducesFreeSpaceFromTop ) : void

Adds a page element, representing a layout stream in a particular location on the page.

Dispose ( bool disposing ) : void

Executes in two distinct scenarios. 1. If disposing is true, the method has been called directly or indirectly by a user's code via the Dispose method. Both managed and unmanaged resources can be disposed. 2. If disposing is false, the method has been called by the runtime from inside the finalizer and you should not reference (access) other managed objects, as they already have been garbage collected. Only unmanaged resources can be disposed.

If any exceptions are thrown, that is fine. If the method is being done in a finalizer, it will be ignored. If it is thrown by client code calling Dispose, it needs to be handled by fixing the bug. If subclasses override this method, they should call the base implementation.

Private Methods

Method Description
AddSeparatorForDependentStream ( Graphics gr, SIL.FieldWorks.Common.PrintLayout.PageElement element, Rectangle rectElement, Rectangle rectDst ) : void

Adds the separator for dependent stream.

AdjustFreeSpace ( Rectangle locationOnPage, bool fReducesFreeSpaceFromTop, SIL.FieldWorks.Common.PrintLayout.PageElement element ) : void

Adjusts the free space.

AdjustOffsetFromTopOfDiv ( SIL.FieldWorks.Common.PrintLayout.PageElement pe, int ypNewOffset ) : void

Sets the offset to top of data, effectively breaking this page. This can be used on a page that may or may not have been laid out. Depending on the value of the page element parameter passed in, this can affect either the first division on the page or some subsequent division.

AdjustOffsetFromTopOfDiv ( int ypNewOffset ) : void

The Division uses this method to adjust the data offset value for the first division on a page that may or may not have been laid out. Typically this is necessary because the layout stream may have tweaked the offset so that it landed at a line break.

AdjustPageElement ( SIL.FieldWorks.Common.PrintLayout.PageElement element, Rectangle newLocation, bool fReducesFreeSpaceFromTop ) : void

Adjusts the location and height of the page element as well as the available free space on the page.

DisposeDependentObjectStream ( ) : void

True if the page is ready for drawing. When this is true, the page had better not get broken; otherwise, bad stuff will happen. For tests, we don't actually want to set this because we don't really draw the pages, so this flag never gets cleared. It's purpose in the production code is just to catch problems.

Draw ( Graphics gr, Rectangle rectClip, float zoom, bool fScreen ) : void

Draw as much of this page as will fit in the clip rectangle. We must draw something in every part of the clip rectangle (unless fScreen is false), because (to avoid flicker drawing selections) we don't erase the window before drawing. We do this by stretching the element horizontally, and separately erasing the areas between elements (and before and after them).

GetElementBounds ( SIL.FieldWorks.Common.PrintLayout.DivisionLayoutMgr division, int dysSpaceUsedOnPage, int currentColumn, int numberColumns, int leftMargin, int offsetFromTopOfDiv, int columnHeight ) : Rectangle

Gets the element bounds.

GetElementClipBounds ( SIL.FieldWorks.Common.PrintLayout.PageElement element, Rectangle rectElement ) : Rectangle

Gets the clip rectangle for the element depending on the whether the stream is left-to-right or right-to-left, and whether the next column has contents.

The clip rectangle for the element contains more then the element bounds so that we erase the surrounding background.

GetLastElement ( SIL.FieldWorks.Common.PrintLayout.DivisionLayoutMgr division, int &xd ) : SIL.FieldWorks.Common.PrintLayout.PageElement
InsertPageElement ( SIL.FieldWorks.Common.PrintLayout.PageElement newElement ) : void

Insert a page element (at it's proper position so they are ordered top to bottom)

LayOut ( ) : void

Perform the layout for each division that is to occupy space on this page.

LayOutIfNeeded ( ) : bool

Lay the page out if it has not already been done. Return true if anything had to be done.

LayoutPageCore ( int reserveHeight ) : void
NextColumnIsEmpty ( SIL.FieldWorks.Common.PrintLayout.PageElement element ) : bool

Determines if the next column from the specified column has a page element.

NoteDependentRoots ( int rgHvo ) : void

When laying out a page in trial mode, notifies the page that the specified HVOs have been added to it.

NoteRootSizeChanged ( IVwRootBox root ) : void
OffsetFromTopOfDiv ( IVwLayoutStream stream, SIL.FieldWorks.Common.PrintLayout.DivisionLayoutMgr div, SIL.FieldWorks.Common.PrintLayout.PageElement &pe ) : int

Gets the number of printer pixels (source/layout units) from the top of the given division's main layout stream to the top of the data represented by the first page element on this page for that stream. This may only be an estimate, particularly if: this page has no elements (at least for the given division) this page is broken there are previous pages that are not fully laid out (or broken)

TowardsTrailingEdge ( SIL.FieldWorks.Common.PrintLayout.PageElement pe, SIL.FieldWorks.Common.PrintLayout.PageElement lastMainElement, bool fIsRightToLeft ) : bool

Determines the pe is more toward the trailing edge than the current lastMainElement.

TryToReuseDependentRootStream ( int &cDepRoot ) : bool

This method checks for the possibility that, though the page got broken, nothing significant changed that affected the dependent object stream that has already been set up for this page. If this is the case we can mostly just keep things the way they are.

Method Details

AddPageElement() protected method

Adds a page element, representing a layout stream in a particular location on the page.
protected AddPageElement ( SIL.FieldWorks.Common.PrintLayout.DivisionLayoutMgr division, IVwLayoutStream stream, bool fPageElementOwnsStream, Rectangle locationOnPage, int dypOffsetToTopOfDataOnPage, bool fMainStream, int currentColumn, int totalColumns, int columnGap, int columnHeight, int dypOverlapWithPreviousElement, bool isRightToLeft, bool fReducesFreeSpaceFromTop ) : void
division SIL.FieldWorks.Common.PrintLayout.DivisionLayoutMgr The division
stream IVwLayoutStream The stream (rootbox) which supplies data for this element
fPageElementOwnsStream bool true if this element is responsible for /// closing its stream when it is destoyed
locationOnPage System.Drawing.Rectangle Location where this stream is laid out, in printer /// pixels, relative to the top left of the physical page
dypOffsetToTopOfDataOnPage int Offset in stream to top of data being shown /// on this page, in printer pixels
fMainStream bool true if this element is for a "main" stream; /// false if it's for a subordinate stream or a Header/Footer stream
currentColumn int The current column (1-based).
totalColumns int The total columns in the specified stream.
columnGap int The gap between the columns.
columnHeight int The height of the current column.
dypOverlapWithPreviousElement int
isRightToLeft bool if set to true the stream is right-to-left. /// Otherwise, it is left-to-right.
fReducesFreeSpaceFromTop bool Flag indicating whether additoin of this /// element reduces the free space from top or bottom.
return void

CheckDisposed() public method

Check to see if the object has been disposed. All public Properties and Methods should call this before doing anything else.
public CheckDisposed ( ) : void
return void

Dispose() public method

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Must not be virtual.
public Dispose ( ) : void
return void

Dispose() protected method

Executes in two distinct scenarios. 1. If disposing is true, the method has been called directly or indirectly by a user's code via the Dispose method. Both managed and unmanaged resources can be disposed. 2. If disposing is false, the method has been called by the runtime from inside the finalizer and you should not reference (access) other managed objects, as they already have been garbage collected. Only unmanaged resources can be disposed.
If any exceptions are thrown, that is fine. If the method is being done in a finalizer, it will be ignored. If it is thrown by client code calling Dispose, it needs to be handled by fixing the bug. If subclasses override this method, they should call the base implementation.
protected Dispose ( bool disposing ) : void
disposing bool true to release both managed and unmanaged resources; /// false to release only unmanaged resources.
return void

GetFirstElementForStream() public method

Retrieves the page element that corresponds to the given stream. If multiple elements correspond to this stream, it gets the one with the smallest offset in the division (i.e., the one which corresponds to the highest place in the total document).
public GetFirstElementForStream ( IVwLayoutStream stream ) : SIL.FieldWorks.Common.PrintLayout.PageElement
stream IVwLayoutStream The stream
return SIL.FieldWorks.Common.PrintLayout.PageElement

GetPositionOnPage() public method

Gets the position of the point pt on the page.
public GetPositionOnPage ( IVwLayoutStream stream, Point pt, Point &result ) : bool
stream IVwLayoutStream The stream.
pt Point The point in the stream.
result Point the converted result
return bool

OffsetFromTopOfDiv() public method

Gets the number of printer pixels (source/layout units) from the top of the given division's main layout stream to the top of the data represented by the first page element on this page for that stream. This may only be an estimate, particularly if: this page has no elements (at least for the given division) this page is broken there are previous pages that are not fully laid out (or broken)
Public to make testing easier.
public OffsetFromTopOfDiv ( SIL.FieldWorks.Common.PrintLayout.DivisionLayoutMgr div ) : int
div SIL.FieldWorks.Common.PrintLayout.DivisionLayoutMgr The division layout manager.
return int

Page() public method

Constructs a Page object to represent a publication page that can be laid out.
public Page ( SIL.FieldWorks.Common.PrintLayout.PublicationControl pub, int iFirstDivOnPage, int ypOffsetFromTopOfDiv, int pageNumber, int dypTopMarginInPrinterPixels, int dypBottomMarginInPrinterPixels ) : System
pub SIL.FieldWorks.Common.PrintLayout.PublicationControl Publication that owns this page
iFirstDivOnPage int Index (into array of divisions in the publication) of /// the first division expected to lay out on this page
ypOffsetFromTopOfDiv int Estimated number of pixels (in source/layout /// units) from the top of the division to the top of this page
pageNumber int The page number for this page. Page numbers can restart for /// different divisions, so this should not be regarded as an index into an array of /// pages.
dypTopMarginInPrinterPixels int The top margin in printer pixels.
dypBottomMarginInPrinterPixels int The bottom margin in printer pixels. ///
return System

Property Details

m_hPage protected_oe property

protected int m_hPage
return int