File indexing completed on 2024-05-05 04:21:07
0001 0002 /* 0003 Copyright (c) 2003-2007 Clarence Dang <dang@kde.org> 0004 All rights reserved. 0005 0006 Redistribution and use in source and binary forms, with or without 0007 modification, are permitted provided that the following conditions 0008 are met: 0009 0010 1. Redistributions of source code must retain the above copyright 0011 notice, this list of conditions and the following disclaimer. 0012 2. Redistributions in binary form must reproduce the above copyright 0013 notice, this list of conditions and the following disclaimer in the 0014 documentation and/or other materials provided with the distribution. 0015 0016 THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 0017 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 0018 OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 0019 IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 0020 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 0021 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 0022 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 0023 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 0024 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 0025 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 0026 */ 0027 0028 0029 #ifndef KP_DOCUMENT_META_INFO_H 0030 #define KP_DOCUMENT_META_INFO_H 0031 0032 0033 #include <QImage> 0034 #include <QList> 0035 #include <QMap> 0036 #include <QString> 0037 0038 #include "commands/kpCommandSize.h" 0039 0040 0041 class QPoint; 0042 0043 0044 class kpDocumentMetaInfo 0045 { 0046 public: 0047 kpDocumentMetaInfo (); 0048 kpDocumentMetaInfo (const kpDocumentMetaInfo &rhs); 0049 virtual ~kpDocumentMetaInfo (); 0050 0051 bool operator== (const kpDocumentMetaInfo &rhs) const; 0052 bool operator!= (const kpDocumentMetaInfo &rhs) const; 0053 0054 kpDocumentMetaInfo &operator= (const kpDocumentMetaInfo &rhs); 0055 0056 0057 void printDebug (const QString &prefix) const; 0058 0059 0060 kpCommandSize::SizeType size () const; 0061 0062 0063 // 0064 // Constants (enforced by methods) 0065 // 0066 0067 static const int MinDotsPerMeter, MaxDotsPerMeter; 0068 static const int MinOffset, MaxOffset; 0069 0070 0071 // See QImage documentation 0072 0073 // <val> is 0 if the resolution is unspecified. 0074 // Else, these methods automatically bound <val> to be between 0075 // MinDotsPerMeter ... MaxDotsPerMeter inclusive. 0076 int dotsPerMeterX () const; 0077 void setDotsPerMeterX (int val); 0078 0079 // <val> is 0 if the resolution is unspecified. 0080 // Else, these methods automatically bound <val> to be between 0081 // MinDotsPerMeter ... MaxDotsPerMeter inclusive. 0082 int dotsPerMeterY () const; 0083 void setDotsPerMeterY (int val); 0084 0085 0086 // These methods automatically bound each of X and Y to be between 0087 // MinOffset and MaxOffset inclusive. 0088 QPoint offset () const; 0089 void setOffset (const QPoint &point); 0090 0091 0092 QMap <QString, QString> textMap () const; 0093 QList <QString> textKeys () const; 0094 0095 // (if <key> is empty, it returns an empty string) 0096 QString text (const QString &key) const; 0097 0098 // (if <key> is empty, the operation is ignored) 0099 void setText (const QString &key, const QString &value); 0100 0101 0102 private: 0103 struct kpDocumentMetaInfoPrivate *d; 0104 }; 0105 0106 0107 #endif // KP_DOCUMENT_META_INFO_H