filters

KWEFStructures.h

00001 /*
00002    This file is part of the KDE project
00003    Copyright (C) 2001, 2002, 2004 Nicolas GOUTTE <goutte@kde.org>
00004    Copyright (c) 2001 IABG mbH. All rights reserved.
00005                       Contact: Wolf-Michael Bolle <Bolle@IABG.de>
00006 
00007    This library is free software; you can redistribute it and/or
00008    modify it under the terms of the GNU Library General Public
00009    License as published by the Free Software Foundation; either
00010    version 2 of the License, or (at your option) any later version.
00011 
00012    This library is distributed in the hope that it will be useful,
00013    but WITHOUT ANY WARRANTY; without even the implied warranty of
00014    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015    Library General Public License for more details.
00016 
00017    You should have received a copy of the GNU Library General Public License
00018    along with this library; see the file COPYING.LIB.  If not, write to
00019    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00020  * Boston, MA 02110-1301, USA.
00021 */
00022 
00023 /*
00024    The classes in this file are based on a class in the old files:
00025     /home/kde/koffice/filters/kword/ascii/asciiexport.cc
00026     /home/kde/koffice/filters/kword/docbookexpert/docbookexport.cc
00027 
00028    The old file was copyrighted by
00029     Copyright (C) 1998, 1999 Reginald Stadlbauer <reggie@kde.org>
00030     Copyright (c) 2000 ID-PRO Deutschland GmbH. All rights reserved.
00031                        Contact: Wolf-Michael Bolle <Wolf-Michael.Bolle@GMX.de>
00032 */
00033 
00034 /*
00035    Part of the code is based on code licensed under the terms of the
00036    GNU Library General Public License version 2:
00037    Copyright 2001 Michael Johnson <mikej@xnet.com>
00038 */
00039 
00040 #ifndef EXPORTFILTERSSTRUCTURES_H
00041 #define EXPORTFILTERSSTRUCTURES_H
00042 
00043 #include <qvaluelist.h>
00044 #include <qstring.h>
00045 #include <qmap.h>
00046 #include <qcolor.h>
00047 #include <qdom.h>
00048 #include <qdatetime.h>
00049 
00050 #include <KoPictureKey.h>
00051 #include <koffice_export.h>
00056 class TextFormatting
00057 {
00058     public:
00059         TextFormatting(): italic (false), underline (false), underlineWord(false),
00060             strikeout (false), strikeoutWord( false ),
00061             weight (50), fontSize (0), verticalAlignment (0), missing (true) {}
00062 
00063         TextFormatting(const bool newMissing) : italic (false),
00064             underline (false), underlineWord(false), strikeout (false), strikeoutWord( false ),
00065             weight (50), fontSize (0), verticalAlignment (0),
00066             missing (newMissing) {}
00067 
00068         TextFormatting ( QString f,
00069                          bool    i,
00070                          bool    u,
00071                          bool    s,
00072                          int     w,
00073                          int     sz,
00074                          QColor  fg,
00075                          QColor  bg,
00076                          int     v) :
00077             fontName (f), italic (i), underline (u), underlineWord(false),
00078             strikeout(s), strikeoutWord( false ),
00079             weight (w), fontSize (sz), fgColor (fg),
00080             bgColor (bg), verticalAlignment (v), missing (false) {}
00081 
00082         QString fontName;
00083 
00084         bool    italic;
00085 
00086         bool    underline;       
00087 
00088         QString    underlineValue; 
00089         QString    underlineStyle; 
00090         bool       underlineWord;  
00091         QColor     underlineColor; 
00092 
00093         bool    strikeout;             
00094         QString strikeoutType;         
00095         QString strikeoutLineStyle;    
00096     bool    strikeoutWord;  
00097 
00098         int     weight;
00099         int     fontSize;
00100         QColor  fgColor;
00101         QColor  bgColor;
00102         int     verticalAlignment;
00103 
00104         QString fontAttribute;
00109         QString language;
00110 
00111         bool    missing;   
00112 };
00113 
00114 
00115 class Picture
00116 {
00117     public:
00118         Picture () {}
00119 
00120         KoPictureKey key;      
00121         QString koStoreName;   
00122 };
00123 
00129 class FrameData
00130 {
00131 public:
00132     double right;
00133     double left;
00134     double top;
00135     double bottom;
00136     double minHeight;
00137     int runaround;
00138     QString runaroundSide;
00139     double runaroundGap;
00140     int autoCreateNewFrame;
00141     int newFrameBehavior;
00142     int copy;
00143     int sheetSide;
00144 
00145     double lWidth, rWidth, tWidth, bWidth;
00146 
00147     QColor lColor;
00148     QColor rColor;
00149     QColor tColor;
00150     QColor bColor;
00151 
00152     int lStyle, rStyle, tStyle, bStyle;
00153 
00154     QColor bkColor;
00155     int    bkStyle;
00156     double bleftpt, brightpt, btoppt, bbottompt;
00157 };
00158 
00159 
00160 class ParaData;
00161 
00162 class KOFFICEFILTER_EXPORT TableCell
00163 {
00164    public:
00165       TableCell (): col( 0 ), row( 0 ), m_cols( 0 ), m_rows( 0 ), paraList( 0 ) {}
00166 
00168       TableCell ( int c, int r, int _cols, int _rows, QValueList<ParaData> *p, FrameData &frameData  )
00169          : col (c), row (r), m_cols( _cols ), m_rows( _rows ), paraList (p), frame (frameData) {}
00170 
00171       ~TableCell ();
00172 
00173       int                   col;
00174       int                   row;
00175       int m_cols; 
00176       int m_rows; 
00177       QValueList<ParaData> *paraList;
00178       FrameData   frame;
00179 };
00180 
00181 
00182 class Table
00183 {
00184    public:
00185       Table () : cols (0) {}
00186 
00188       void addCell ( int c, int r, int _cols, int _rows, QValueList<ParaData> &p, FrameData &frameData );
00189 
00190       int                   cols;
00191       QValueList<TableCell> cellList;
00192 };
00193 
00194 
00196 class FrameAnchor
00197 {
00198    public:
00199       FrameAnchor ():
00200        type(-1) {}
00201 
00202       FrameAnchor ( const KoPictureKey& n  ) : key (n), type (-1) {}
00203 
00204       KoPictureKey key; 
00205       int     type;
00206       FrameData   frame;
00207 
00208       Picture picture;
00209       Table   table;
00210 };
00211 
00215 class KOFFICEFILTER_EXPORT VariableData
00216 {
00217 public:
00218     VariableData (): m_type(-1), footnotePara(0) {}
00219     VariableData ( const QString& text ) : m_text(text), m_type(-1) {}
00220     VariableData ( const VariableData& other ) :
00221       m_key(other.m_key), m_text(other.m_text),
00222       m_type(other.m_type), propertyMap(other.propertyMap),
00223       footnotePara(other.footnotePara) {}
00224 public:
00228     void setLink(const QString& linkName, const QString& hrefName);
00229     QString getLinkName(void) const; 
00230     QString getHrefName(void) const; 
00231 
00234     void setPgNum(const QString& subtype, const QString& value);
00235     bool isPageNumber(void) const;
00236     bool isPageCount(void) const;
00240     void setField(const QString& subtype, const QString& value);
00241     QString getFieldName(void) const;
00242     QString getFieldValue(void) const;
00247     void setFootnote( const QString& notetype, const QString& automatic, const QString& value, QValueList<ParaData>* para );
00252     bool getFootnoteAuto(void) const;
00254     QString getFootnoteValue(void) const;
00260     bool getFootnoteType( void ) const;
00262     QValueList<ParaData>* getFootnotePara(void) const;
00263 
00268     void setGenericData( const QString& key, const QString& data );
00273     QString getGenericData( const QString& key ) const;
00274 
00275     QString m_key;
00276     QString m_text;
00277     int m_type;
00278 
00279 protected:
00280     QMap<QString,QString> propertyMap;
00281     QValueList<ParaData>* footnotePara;
00282 };
00283 
00284 class FormatData
00285 {
00286 public:
00287     FormatData ()
00288         : id (-1), pos (-1), len (-1), text(true) {}
00289 
00290     FormatData ( const int p, const int l, const bool missing  )
00291         : id (1), pos (p), len (l), text(missing) {}
00292 
00293     FormatData ( const int i, const int p, const int l  )
00294         : id (i), pos (p), len (l), text(false) {}
00295 
00296     FormatData ( const int p, const int l, const FrameAnchor& t )
00297         : id (6), pos (p), len (l), frameAnchor (t) {}
00298 
00299     FormatData ( const FormatData& other )
00300         : id(other.id), pos(other.pos), len(other.len),
00301           text(other.text), frameAnchor(other.frameAnchor), variable(other.variable) {}
00302 public:
00303     int id;
00304     int pos;    
00305     int len;
00306 
00307     TextFormatting  text;
00308     FrameAnchor     frameAnchor;
00309     VariableData    variable;
00310 };
00311 
00312 
00313 class ValueListFormatData : public QValueList<FormatData>
00314 {
00315 public:
00316     ValueListFormatData (void) { }
00317     virtual ~ValueListFormatData (void) { }
00318 };
00319 
00320 
00322 class CounterData
00323 {
00324 public:
00325     CounterData()
00326         : numbering (NUM_NONE), style (STYLE_NONE), depth(0), start(0), customCharacter(0)
00327         {}
00328 
00329     enum Numbering
00330     {
00331         NUM_LIST    = 0,   
00332         NUM_CHAPTER = 1,   
00333         NUM_NONE    = 2    
00334     };
00335 
00336     enum Style
00337     {
00338         STYLE_NONE         = 0,
00339         STYLE_NUM          = 1,
00340         STYLE_ALPHAB_L     = 2,
00341         STYLE_ALPHAB_U     = 3,
00342         STYLE_ROM_NUM_L    = 4,
00343         STYLE_ROM_NUM_U    = 5,
00344         STYLE_CUSTOMBULLET = 6,
00345         STYLE_CUSTOM       = 7,
00346         STYLE_CIRCLEBULLET = 8,
00347         STYLE_SQUAREBULLET = 9,
00348         STYLE_DISCBULLET   = 10,
00349         STYLE_BOXBULLET    = 11
00350     };
00351 
00352     Numbering numbering;
00353     Style style;
00354     /*unsigned*/ int depth;
00355     int start;
00356     QString lefttext;
00357     QString righttext;
00358 
00359     int /*QChar*/ customCharacter;
00360     QString customFont;
00361     //QString custom;
00362 
00363     QString text;   
00364 };
00365 
00366 
00368 class BorderData
00369 {
00370 public:
00371     BorderData() : style(0), width(0.0) {}
00372 public:
00373     QColor color;
00374     int style;
00375     double width;
00376 };
00377 
00381 class KOFFICEFILTER_EXPORT TabulatorData
00382 {
00383 public:
00384 
00385     enum
00386     {
00387         TF_NONE       = 0,
00388         TF_DOT        = 1,
00389         TF_LINE       = 2,
00390         TF_DASH       = 3,
00391         TF_DASHDOT    = 4,
00392         TF_DASHDOTDOT = 5
00393     };
00394 
00395     TabulatorData() : m_type(0), m_ptpos(0.0), m_filling(0), m_width(0.0) {}
00396 public:
00397     bool operator == (const TabulatorData& other) const;
00398 public:
00399     int m_type;
00400     double m_ptpos;
00401     int m_filling;
00402     double m_width;
00403 };
00404 
00408 class TabulatorList : public QValueList<TabulatorData>
00409 {
00410 public:
00411     TabulatorList(void) {}
00412     virtual ~TabulatorList(void) {}
00413 };
00414 
00416 class LayoutData
00417 {
00418 public:
00419     LayoutData():indentFirst(0.0), indentLeft(-1.0), indentRight(-1.0), marginTop(-1.0), marginBottom(-1.0),
00420         lineSpacingType(10), lineSpacing(0.0), pageBreakBefore(false), pageBreakAfter(false),
00421         keepLinesTogether(false),
00422         shadowDistance(0.0), shadowDirection(0)
00423         { }
00424 
00425 
00426     enum { LS_CUSTOM = 0, LS_SINGLE = 10, LS_ONEANDHALF = 15, LS_DOUBLE = 20,
00427       LS_ATLEAST = 30, LS_MULTIPLE = 40, LS_FIXED = 50 };
00428 
00429     QString     styleName;
00430     QString     styleFollowing;
00431     QString     alignment;      
00432     CounterData counter;
00433     FormatData  formatData;
00434     double      indentFirst;    
00435     double      indentLeft;     
00436     double      indentRight;    
00437     double      marginTop;      
00438     double      marginBottom;   
00439 
00440     int         lineSpacingType;
00441     double      lineSpacing;    
00442 
00443     bool        pageBreakBefore;
00444     bool        pageBreakAfter;
00445     bool        keepLinesTogether;
00446 
00447     double      shadowDistance; 
00448     int         shadowDirection;
00449     QColor      shadowColor;    
00450     BorderData  leftBorder;
00451     BorderData  rightBorder;
00452     BorderData  topBorder;
00453     BorderData  bottomBorder;
00454     TabulatorList tabulatorList; 
00455 };
00456 
00457 
00458 struct ParaData
00459 {
00460     QString                    text;
00461     ValueListFormatData        formattingList;
00462     LayoutData                 layout;
00463 };
00464 
00465 struct HeaderFooterData
00466 {
00467     enum HeaderFooterPage
00468     {
00469       PAGE_FIRST,
00470       PAGE_ODD,
00471       PAGE_EVEN,
00472       PAGE_ALL
00473     };
00474 
00475     HeaderFooterPage page;
00476     QValueList<ParaData> para;
00477 };
00478 
00479 typedef HeaderFooterData HeaderData;
00480 typedef HeaderFooterData FooterData;
00481 
00483 struct FootnoteData
00484 {
00485     QString frameName;
00486     QValueList<ParaData> para;
00487 };
00488 
00490 class VariableSettingsData
00491 {
00492 public:
00493     VariableSettingsData () : startingPageNumber (1),
00494                               displaylink (true),
00495                               underlinelink (true),
00496                               displaycomment (true),
00497                               displayfieldcode (false)
00498     {
00499     }
00500 
00501     int startingPageNumber;
00502     bool displaylink;
00503     bool underlinelink;
00504     bool displaycomment;
00505     bool displayfieldcode;
00506     QDateTime creationTime;
00507     QDateTime modificationTime;
00508     QDateTime printTime;
00509 };
00510 
00511 class KWEFDocumentInfo
00512 {
00513 public:
00514     KWEFDocumentInfo(void) { } // Initiate all QString
00515 public:
00516     // <ABOUT>
00517     QString title;
00518     QString abstract;
00519     QString keywords;
00520     QString subject;
00521     // <AUTHOR>
00522     QString fullName;
00523     QString jobTitle;
00524     QString company;
00525     QString email;
00526     QString telephone;
00527     QString fax;
00528     QString country;
00529     QString postalCode;
00530     QString city;
00531     QString street;
00532     QString initial;
00533     QString position;
00534     QString telephonework;
00535 };
00536 
00538 class Bookmark
00539 {
00540 public:
00541     Bookmark();
00543     QString m_name;
00545     QString m_frameset;
00547     int m_startparag;
00549     int m_endparag;
00551     int m_cursorIndexStart;
00553     int m_cursorIndexEnd;
00554 };
00555 
00556 // Helper functions
00557 
00558 void CreateMissingFormatData ( QString &paraText, ValueListFormatData &paraFormatDataList );
00559 
00560 #endif /* EXPORTFILTERSSTRUCTURES_H */
KDE Home | KDE Accessibility Home | Description of Access Keys