• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

fp_PageSize.h

Go to the documentation of this file.
00001 /* AbiWord
00002  * Copyright (C) 2000,2001 Mike Nordell, Dom Lachowicz, and others
00003  *
00004  * This program is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU General Public License
00006  * as published by the Free Software Foundation; either version 2
00007  * of the License, or (at your option) any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software
00016  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
00017  * 02111-1307, USA.
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         // If you append a predefined pagesize here, don't forget
00041         // to update the cpp accordingly.
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         // append new pagesizes here
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

Generated on Sun May 27 2012 for AbiWord by  doxygen 1.7.1