lib Library API Documentation

koparaglayout.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 2001 David Faure <faure@kde.org>
00003 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License as published by the Free Software Foundation; either
00007    version 2 of the License, or (at your option) any later version.
00008 
00009    This library 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 GNU
00012    Library General Public License for more details.
00013 
00014    You should have received a copy of the GNU Library General Public License
00015    along with this library; see the file COPYING.LIB.  If not, write to
00016    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00017    Boston, MA 02111-1307, USA.
00018 */
00019 
00020 #ifndef koparaglayout_h
00021 #define koparaglayout_h
00022 
00023 #include <koRuler.h> // for KoTabulatorList
00024 #include "koborder.h"
00025 class KoParagCounter;
00026 class KoStyle;
00027 
00033 class KoParagLayout
00034 {
00035 public:
00036     KoParagLayout();
00037     KoParagLayout( const KoParagLayout &layout ) { operator=( layout ); }
00038 
00039     ~KoParagLayout();
00040 
00043     enum { Alignment = 1,
00044            BulletNumber = 2, // TODO: we can use Counter now :)
00045            Margins = 4,
00046            LineSpacing = 8,
00047            Borders = 16,
00048            Tabulator = 32,
00049            PageBreaking = 64,
00050            /* Style is maybe missing */
00051            All = Alignment | BulletNumber | Margins | LineSpacing | Borders | Tabulator | PageBreaking
00052     } Flags;
00053 
00055     enum {
00056         BreakBetweenLines = 0, // default
00057         KeepLinesTogether = 1,
00058         HardFrameBreakBefore = 2,      // incompatible with KeepWithPrevious
00059         HardFrameBreakAfter = 4,       // incompatible with KeepWithNext
00060         KeepWithPrevious = 8,          // incompatible with HardFrameBreakBefore
00061         KeepWithNext = 16              // incompatible with HardFrameBreakAfter
00062     };
00063 
00064     // This class is used as a struct, which explains the public vars :)
00068     int alignment;
00070     double margins[5];
00082     enum SpacingType { LS_SINGLE = 0, LS_ONEANDHALF = -1, LS_DOUBLE = -2,
00083                        LS_CUSTOM = -3, LS_AT_LEAST = -4, LS_MULTIPLE = -5, LS_FIXED = -6 };
00084     SpacingType lineSpacingType;
00085     double lineSpacingValue() const { return lineSpacing;}
00086     void setLineSpacingValue(double _value) { lineSpacing = _value;}
00087 
00088     static QString* shadowCssCompat; // used for compat with koffice-1.2 when loading
00089     char unused;          // for future use
00090     char pageBreaking;    // Page breaking flags
00091     char direction;       // QChar::Direction
00092     char unused2;         // for future use
00093     KoBorder leftBorder, rightBorder, topBorder, bottomBorder;
00095     KoParagCounter* counter;
00096 
00097     KoStyle* style;
00098 
00099     bool hasBorder() const { return topBorder.penWidth() > 0
00100                                  || bottomBorder.penWidth() > 0
00101                                  || leftBorder.penWidth() > 0
00102                                  || rightBorder.penWidth() > 0; }
00103 
00104     void setTabList( const KoTabulatorList & tabList ) { m_tabList = tabList; }
00105     const KoTabulatorList& tabList() const { return m_tabList; }
00106 
00107     void operator=( const KoParagLayout & );
00108 
00110     int compare( const KoParagLayout & layout ) const;
00111 
00115     void saveParagLayout( QDomElement & parentElem, int alignment ) const;
00116 
00120     static void loadParagLayout( KoParagLayout& layout, const QDomElement& parentElem, int docVersion = 2 );
00121 
00122 private:
00123     KoTabulatorList m_tabList;
00124     double lineSpacing;
00125     class Private;
00126     Private *d;
00127 
00129     void initialise();
00130 };
00131 
00132 #endif
KDE Logo
This file is part of the documentation for lib Library Version 1.3.5.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Nov 17 13:19:24 2004 by doxygen 1.3.5 written by Dimitri van Heesch, © 1997-2003