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