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 #if _MSC_VER
00027 #pragma warning(disable: 4522) // multiple assignment operators specified
00028 #endif
00029
00030 class UT_UTF8String;
00031
00032 class ABI_EXPORT fp_PageSize
00033 {
00034 public:
00035
00036 enum Predefined
00037 {
00038 _first_predefined_pagesize_ = 0,
00039
00040
00041
00042
00043 psA0 = 0, psA1, psA2, psA3, psA4, psA5, psA6, psA7, psA8, psA9, psA10,
00044 psB0, psB1, psB2, psB3, psB4, psB5, psB6, psB7, psB8, psB9, psB10,
00045 psC0, psC1, psC2, psC3, psC4, psC5, psC6, psC7, psC8, psC9, psC10,
00046 psLegal, psFolio, psLetter,
00047 ps1_3A4, ps1_4A4, ps1_8A4, ps1_4A3, ps1_3A5,
00048 psEnvelope_DL, psEnvelope_C6_C5, psEnvelope_no10, psEnvelope_6x9,
00049 psCustom,
00050
00051
00052 _last_predefined_pagesize_dont_use_
00053 };
00054
00055 UT_UTF8String static getDefaultPageMargin(UT_Dimension dim);
00056
00057 fp_PageSize(Predefined preDef);
00058 fp_PageSize(const char *name);
00059 fp_PageSize(double w, double h, UT_Dimension u);
00060 fp_PageSize& operator=(fp_PageSize& rhs);
00061 fp_PageSize& operator=(const fp_PageSize& rhs);
00062
00063 bool match(double x, double y);
00064 void Set(Predefined preDef, UT_Dimension u = DIM_none);
00065 void Set(const char *name, UT_Dimension u = DIM_none);
00066 void Set(double w, double h, UT_Dimension u = DIM_none);
00067 void Set(UT_Dimension u) { m_unit = u; }
00068 bool Set(const gchar ** attributes);
00069 inline void setScale( double scale) { m_scale = scale; }
00070 void setPortrait(void);
00071 void setLandscape(void);
00072 bool isPortrait(void) const { return m_bisPortrait; }
00073 double Width(UT_Dimension u) const;
00074 double Height(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 bool m_bisPortrait;
00091 double m_scale;
00092 UT_Dimension m_unit;
00093 };
00094
00095 #endif // FP_PAGESIZE_H