1*5e7646d2SAndroid Build Coastguard Worker //
2*5e7646d2SAndroid Build Coastguard Worker // Shared media size class for the CUPS PPD Compiler.
3*5e7646d2SAndroid Build Coastguard Worker //
4*5e7646d2SAndroid Build Coastguard Worker // Copyright 2007-2009 by Apple Inc.
5*5e7646d2SAndroid Build Coastguard Worker // Copyright 2002-2005 by Easy Software Products.
6*5e7646d2SAndroid Build Coastguard Worker //
7*5e7646d2SAndroid Build Coastguard Worker // Licensed under Apache License v2.0. See the file "LICENSE" for more information.
8*5e7646d2SAndroid Build Coastguard Worker //
9*5e7646d2SAndroid Build Coastguard Worker
10*5e7646d2SAndroid Build Coastguard Worker //
11*5e7646d2SAndroid Build Coastguard Worker // Include necessary headers...
12*5e7646d2SAndroid Build Coastguard Worker //
13*5e7646d2SAndroid Build Coastguard Worker
14*5e7646d2SAndroid Build Coastguard Worker #include "ppdc-private.h"
15*5e7646d2SAndroid Build Coastguard Worker
16*5e7646d2SAndroid Build Coastguard Worker
17*5e7646d2SAndroid Build Coastguard Worker //
18*5e7646d2SAndroid Build Coastguard Worker // 'ppdcMediaSize::ppdcMediaSize()' - Create a new media size.
19*5e7646d2SAndroid Build Coastguard Worker //
20*5e7646d2SAndroid Build Coastguard Worker
ppdcMediaSize(const char * n,const char * t,float w,float l,float lm,float bm,float rm,float tm,const char * sc,const char * rc)21*5e7646d2SAndroid Build Coastguard Worker ppdcMediaSize::ppdcMediaSize(const char *n, // I - Name of media size
22*5e7646d2SAndroid Build Coastguard Worker const char *t, // I - Text of media size
23*5e7646d2SAndroid Build Coastguard Worker float w, // I - Width in points
24*5e7646d2SAndroid Build Coastguard Worker float l, // I - Length in points
25*5e7646d2SAndroid Build Coastguard Worker float lm, // I - Left margin in points
26*5e7646d2SAndroid Build Coastguard Worker float bm, // I - Bottom margin in points
27*5e7646d2SAndroid Build Coastguard Worker float rm, // I - Right margin in points
28*5e7646d2SAndroid Build Coastguard Worker float tm, // I - Top margin in points
29*5e7646d2SAndroid Build Coastguard Worker const char *sc, // I - PageSize code, if any
30*5e7646d2SAndroid Build Coastguard Worker const char *rc) // I - PageRegion code, if any
31*5e7646d2SAndroid Build Coastguard Worker : ppdcShared()
32*5e7646d2SAndroid Build Coastguard Worker {
33*5e7646d2SAndroid Build Coastguard Worker PPDC_NEW;
34*5e7646d2SAndroid Build Coastguard Worker
35*5e7646d2SAndroid Build Coastguard Worker name = new ppdcString(n);
36*5e7646d2SAndroid Build Coastguard Worker text = new ppdcString(t);
37*5e7646d2SAndroid Build Coastguard Worker width = w;
38*5e7646d2SAndroid Build Coastguard Worker length = l;
39*5e7646d2SAndroid Build Coastguard Worker left = lm;
40*5e7646d2SAndroid Build Coastguard Worker bottom = bm;
41*5e7646d2SAndroid Build Coastguard Worker right = rm;
42*5e7646d2SAndroid Build Coastguard Worker top = tm;
43*5e7646d2SAndroid Build Coastguard Worker size_code = new ppdcString(sc);
44*5e7646d2SAndroid Build Coastguard Worker region_code = new ppdcString(rc);
45*5e7646d2SAndroid Build Coastguard Worker
46*5e7646d2SAndroid Build Coastguard Worker if (left < 0.0f)
47*5e7646d2SAndroid Build Coastguard Worker left = 0.0f;
48*5e7646d2SAndroid Build Coastguard Worker if (bottom < 0.0f)
49*5e7646d2SAndroid Build Coastguard Worker bottom = 0.0f;
50*5e7646d2SAndroid Build Coastguard Worker if (right < 0.0f)
51*5e7646d2SAndroid Build Coastguard Worker right = 0.0f;
52*5e7646d2SAndroid Build Coastguard Worker if (top < 0.0f)
53*5e7646d2SAndroid Build Coastguard Worker top = 0.0f;
54*5e7646d2SAndroid Build Coastguard Worker }
55*5e7646d2SAndroid Build Coastguard Worker
56*5e7646d2SAndroid Build Coastguard Worker
57*5e7646d2SAndroid Build Coastguard Worker //
58*5e7646d2SAndroid Build Coastguard Worker // 'ppdcMediaSize::~ppdcMediaSize()' - Destroy a media size.
59*5e7646d2SAndroid Build Coastguard Worker //
60*5e7646d2SAndroid Build Coastguard Worker
~ppdcMediaSize()61*5e7646d2SAndroid Build Coastguard Worker ppdcMediaSize::~ppdcMediaSize()
62*5e7646d2SAndroid Build Coastguard Worker {
63*5e7646d2SAndroid Build Coastguard Worker PPDC_DELETE;
64*5e7646d2SAndroid Build Coastguard Worker
65*5e7646d2SAndroid Build Coastguard Worker name->release();
66*5e7646d2SAndroid Build Coastguard Worker text->release();
67*5e7646d2SAndroid Build Coastguard Worker size_code->release();
68*5e7646d2SAndroid Build Coastguard Worker region_code->release();
69*5e7646d2SAndroid Build Coastguard Worker }
70