• 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., 51 Franklin Street, Fifth Floor, Boston, MA
00017  * 02110-1301 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 #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         // If you append a predefined pagesize here, don't forget
00042         // to update the cpp accordingly.
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         // append new pagesizes here
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

Generated on Sun Feb 14 2021 for AbiWord by  doxygen 1.7.1