kword

KWTextParag.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., 51 Franklin Street, Fifth Floor,
00017  * Boston, MA 02110-1301, USA.
00018 */
00019 
00020 #ifndef kwtextparag_h
00021 #define kwtextparag_h
00022 
00023 #include "KoTextParag.h"
00024 
00025 class KoStyleCollection;
00026 class QDomDocument;
00027 class KWTextFrameSet;
00028 class KWTextDocument;
00029 class KWDocument;
00030 class KWTextParag;
00031 class KoParagStyle;
00032 
00033 // At the moment those are the same - to be discussed
00034 typedef KoParagLayout KWParagLayout;
00035 
00040 class KWTextParag : public KoTextParag
00041 {
00042 public:
00043     KWTextParag( KoTextDocument *d, KoTextParag *pr = 0, KoTextParag *nx = 0, bool updateIds = TRUE )
00044         : KoTextParag( d, pr, nx, updateIds ) { }
00045     ~KWTextParag() { }
00046 
00047     KWTextDocument * kwTextDocument() const;
00048 
00049     virtual void setParagLayout( const KoParagLayout &layout, int flags = KoParagLayout::All, int marginIndex = -1 );
00050 
00052     void setPageBreaking( int pb ); // warning this sets all the flags!
00053     int pageBreaking() const { return m_layout.pageBreaking; }
00054     bool linesTogether() const { return m_layout.pageBreaking & KoParagLayout::KeepLinesTogether; }
00055     bool hardFrameBreakBefore() const { return m_layout.pageBreaking & KoParagLayout::HardFrameBreakBefore; }
00056     bool hardFrameBreakAfter() const { return m_layout.pageBreaking & KoParagLayout::HardFrameBreakAfter; }
00057 
00059     static KoTextFormat loadFormat( QDomElement &formatElem, KoTextFormat *refFormat, const QFont &defaultFont, const QString & defaultLanguage, bool hyphanation );
00061     static QDomElement saveFormat( QDomDocument &doc, KoTextFormat *curFormat, KoTextFormat *refFormat, int pos, int len );
00062 
00063 
00065     void save( QDomElement &parentElem, bool saveAnchorsFramesets = false );
00066 
00068     void save( QDomElement &parentElem, int from, int to, bool saveAnchorsFramesets = false );
00069 
00071     void load( QDomElement &attributes );
00072 
00074     void loadFormatting( QDomElement &attributes, int offset = 0, bool loadFootNote=true );
00075 
00077     void loadLayout( QDomElement & attributes );
00078 
00080     static KoParagLayout loadParagLayout( QDomElement & parentElem, KWDocument *doc, bool useRefStyle );
00081 
00082     virtual void loadOasis( const QDomElement& e, KoOasisContext& context, KoStyleCollection *styleCollection, uint& pos );
00083     virtual void saveOasis( KoXmlWriter& writer, KoSavingContext& context,
00084                             int from, int to, bool saveAnchorsFramesets = false ) const;
00085 
00086     virtual void join( KoTextParag *parag );
00087 protected:
00088     virtual void drawFormattingChars( QPainter &painter, int start, int len,
00089                                       int lastY_pix, int baseLine_pix, int h_pix, // in pixels
00090                                       bool drawSelections,
00091                                       KoTextFormat *lastFormat, const QMemArray<int> &selectionStarts,
00092                                       const QMemArray<int> &selectionEnds, const QColorGroup &cg,
00093                                       bool rightToLeft, int line, KoTextZoomHandler* zh,
00094                                       int whichFormattingChars );
00095 
00096 };
00097 
00098 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys