! *viewer/page.pvc - Page Object
! By Gord Davey
! (c) Copyright 2004-2005 Sage Software Canada Ltd.
! Version:
! Source Code File: $RCSfile: page.pvs,v $   Version: $Revision: 1.10 $
!      Last Edited: $Date: 2005/10/14 15:31:18 $   Author: $Author: gordd $
!
def class "*viewer/page" create OnCreate required delete OnDelete required

    property Version$ = mid(mid("$Revision: 1.10 $",12), 1, len(mid("$Revision: 1.10 $",12)) - 2)

    local This
    local Convert

    like "*viewer/papersize"
    like "*viewer/paperbin"

    precision 4

    property MarginLeft                 set SetMarginLeft
    property MarginRight                set SetMarginRight
    property MarginTop                  set SetMarginTop
    property MarginBottom               set SetMarginBottom

    property DefaultFont$
    property DefaultFontSize
    property DefaultFontAttributes$
    property DefaultFontRotation

    property CurrentFont$
    property CurrentFontSize
    property CurrentFontAttributes$
    property CurrentFontRotation

    property LPI
    property CPI
    property ForegroundColour$
    property BackgroundColour$
    property Mode$

    property Pen$
    property Fill$

    property Underline
    property ReverseVideo

    property SPCPMode
    property PlusS

    property DataType           set SetDataType
    property Data$

    property Metric             set SetMetric

fnend
!
!
OnCreate:
    This = _obj

    Convert = new("*viewer/convertlengths")

    MarginLeft = 250
    MarginRight = 250
    MarginTop = 250
    MarginBottom = 250

    return
!
!
OnDelete:
    drop object Convert
    return 1
!
!
SetMetric:
    enter (Value%)

    if Value%<0 or Value%>1 \
        then return 0

    if Value% = Metric \
        then return 1

    switch Value%
        case 0
            MarginLeft = Convert'MillimetersToInches(MarginLeft)
            MarginRight = Convert'MillimetersToInches(MarginRight)
            MarginTop = Convert'MillimetersToInches(MarginTop)
            MarginBottom = Convert'MillimetersToInches(MarginBottom)
            break

        case 1
            MarginLeft = Convert'InchesToMillimeters(MarginLeft)
            MarginRight = Convert'InchesToMillimeters(MarginRight)
            MarginTop = Convert'InchesToMillimeters(MarginTop)
            MarginBottom = Convert'InchesToMillimeters(MarginBottom)
            break

    esac

    _obj'Metric(from "*viewer/papersize", Value%)
    return Metric
!
!
SetDataType:
    enter (Value%)

    if Value%<0 or Value%>2 \
        then exit 41

    DataType = Value%
    Data$ = ""

    return
!
!
SetMarginLeft:
    enter (Value%)
    if Value% < 0 \
        then Value% = 250
    MarginLeft = Value%
    return
!
SetMarginRight:
    enter (Value%)
    if Value% < 0 \
        then Value% = 250
    MarginRight = Value%
    return
!
SetMarginTop:
    enter (Value%)
    if Value% < 0 \
        then Value% = 250
    MarginTop = Value%
    return
!
SetMarginBottom:
    enter (Value%)
    if Value% < 0 \
        then Value% = 250
    MarginBottom = Value%
    return
