kviewshell
pageSize.h
Go to the documentation of this file.00001 // -*- C++ -*- 00002 // 00003 // pageSize.h 00004 // 00005 // Part of KVIEWSHELL - A framework for multipage text/gfx viewers 00006 // 00007 // (C) 2002-2005 Stefan Kebekus 00008 // Distributed under the GPL 00009 00010 // Add header files alphabetically 00011 00012 #ifndef PAGESIZE_H 00013 #define PAGESIZE_H 00014 00015 #include "simplePageSize.h" 00016 00017 #include <qobject.h> 00018 00019 class QString; 00020 class QStringList; 00021 00022 00023 /* \brief This class represents physical page sizes. 00024 00025 The main difference to the SimplePageSize class are the following. 00026 00027 - This class knows about standard page sizes and accepts page sizes in 00028 various formats, e.g. as a string "DIN A4", or by specifiying the 00029 page width and height. Several units (inch, millimeters, 00030 centimeters) are possible. 00031 00032 - It is made sure that page width an hight are always in a resonable 00033 range, which is currently set to 5cm .. 50cm 00034 00035 - The default constructor provides a locale-depending default. 00036 00037 @author Stefan Kebekus <kebekus@kde.org> 00038 @version 1.0.0 00039 */ 00040 00041 class pageSize : public QObject, public SimplePageSize 00042 { 00043 Q_OBJECT 00044 00045 public: 00053 pageSize(); 00054 00056 pageSize(const SimplePageSize&); 00057 00069 QStringList pageSizeNames(); 00070 00100 bool setPageSize(const QString& name); 00101 00128 void setPageSize(const QString& width, const QString& widthUnits, const QString& height, const QString& heightUnits); 00129 00144 virtual void setPageSize(double width_in_mm, double height_in_mm); 00145 00151 pageSize & operator= (const pageSize &src); 00152 00160 QString preferredUnit() const; 00161 00170 QString widthString(const QString& unit) const; 00171 00181 QString heightString(const QString& unit) const; 00182 00195 QString formatName() const; 00196 00209 int formatNumber() const {return currentSize;} 00210 00221 int getOrientation() const; 00222 00229 QString serialize() const; 00230 00231 public slots: 00241 void setOrientation(int orient); 00242 00243 signals: 00252 void sizeChanged(const SimplePageSize& t); 00253 00254 private: 00257 void rectifySizes(); 00258 00267 void reconstructCurrentSize(); 00268 00272 int defaultPageSize(); 00273 00277 int currentSize; 00278 }; 00279 00280 #endif