00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef FP_PAGESIZE_H
00021 #define FP_PAGESIZE_H
00022
00023 #include "ut_types.h"
00024 #include "ut_units.h"
00025
00026 class ABI_EXPORT fp_PageSize
00027 {
00028 public:
00029
00030 enum Predefined
00031 {
00032 _first_predefined_pagesize_ = 0,
00033
00034
00035
00036
00037 psA0 = 0, psA1, psA2, psA3, psA4, psA5, psA6, psA7, psA8, psA9, psA10,
00038 psB0, psB1, psB2, psB3, psB4, psB5, psB6, psB7, psB8, psB9, psB10,
00039 psC0, psC1, psC2, psC3, psC4, psC5, psC6, psC7, psC8, psC9, psC10,
00040 psLegal, psFolio, psLetter,
00041 ps1_3A4, ps1_4A4, ps1_8A4, ps1_4A3, ps1_3A5,
00042 psEnvelope_DL, psEnvelope_C6_C5, psEnvelope_no10, psEnvelope_6x9,
00043 psCustom,
00044
00045
00046 _last_predefined_pagesize_dont_use_
00047 };
00048
00049 fp_PageSize(Predefined preDef);
00050 fp_PageSize(const char *name);
00051 fp_PageSize(double w, double h, UT_Dimension u);
00052 fp_PageSize& operator=(fp_PageSize& rhs);
00053 fp_PageSize& operator=(const fp_PageSize& rhs);
00054
00055 bool match(double x, double y);
00056 void Set(Predefined preDef, UT_Dimension u = DIM_none);
00057 void Set(const char *name, UT_Dimension u = DIM_none);
00058 void Set(double w, double h, UT_Dimension u = DIM_none);
00059 void Set(UT_Dimension u) { m_unit = u; }
00060 bool Set(const gchar ** attributes);
00061 inline void setScale( double scale) { m_scale = scale; }
00062 void setPortrait(void);
00063 void setLandscape(void);
00064 bool isPortrait(void) const { return m_bisPortrait; }
00065 double Width(UT_Dimension u) const;
00066 double Height(UT_Dimension u) const;
00067
00068
00069
00070
00071 double MarginLeft(UT_Dimension u) const;
00072 double MarginRight(UT_Dimension u) const;
00073 double MarginTop(UT_Dimension u) const;
00074 double MarginBottom(UT_Dimension u) const;
00075
00076 double getScale(void) const { return m_scale; }
00077 UT_Dimension getDims(void) const { return m_unit; }
00078 inline char * getPredefinedName (void) const { return m_predefined; }
00079
00080 static bool IsPredefinedName(const char* szPageSizeName);
00081 static Predefined NameToPredefined(const char *name);
00082 static const char * PredefinedToName(Predefined preDef);
00083
00084 private:
00085 char * m_predefined;
00086
00087 double m_iWidth;
00088 double m_iHeight;
00089
00090 double m_iMarginLeft;
00091 double m_iMarginRight;
00092 double m_iMarginTop;
00093 double m_iMarginBottom;
00094
00095 bool m_bisPortrait;
00096 double m_scale;
00097 UT_Dimension m_unit;
00098 };
00099
00100 #endif // FP_PAGESIZE_H