Used the height and width of the page returned from the nsDeviceContext instead of hard coded values. r=buster

This commit is contained in:
dcone%netscape.com 1999-12-16 15:15:23 +00:00
parent 74f7b8e000
commit c9543cdc78

View File

@ -74,26 +74,34 @@ PrintContext::IsPaginated(PRBool* aResult)
NS_IMETHODIMP
PrintContext::GetPageWidth(nscoord* aResult)
{
PRInt32 width,height;
NS_PRECONDITION(nsnull != aResult, "null ptr");
if (nsnull == aResult) {
return NS_ERROR_NULL_POINTER;
}
// XXX assumes a 1/2 margin around all sides
*aResult = (nscoord) NS_INCHES_TO_TWIPS(7.5);
mDeviceContext->GetDeviceSurfaceDimensions(width,height);
// a xp margin can be added here
*aResult = width;
return NS_OK;
}
NS_IMETHODIMP
PrintContext::GetPageHeight(nscoord* aResult)
{
PRInt32 width,height;
NS_PRECONDITION(nsnull != aResult, "null ptr");
if (nsnull == aResult) {
return NS_ERROR_NULL_POINTER;
}
// XXX assumes a 1/2 margin around all sides
*aResult = (nscoord) NS_INCHES_TO_TWIPS(10);
mDeviceContext->GetDeviceSurfaceDimensions(width,height);
// a xp margin or header/footer space can be added here
*aResult = height;
return NS_OK;
}