kword

KWTextParag.h
1/* This file is part of the KDE project
2 Copyright (C) 2001 David Faure <faure@kde.org>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18*/
19
20#ifndef kwtextparag_h
21#define kwtextparag_h
22
23#include "KoTextParag.h"
24
25class KoStyleCollection;
26class TQDomDocument;
27class KWTextFrameSet;
28class KWTextDocument;
29class KWDocument;
30class KWTextParag;
31class KoParagStyle;
32
33// At the moment those are the same - to be discussed
34typedef KoParagLayout KWParagLayout;
35
40class KWTextParag : public KoTextParag
41{
42public:
43 KWTextParag( KoTextDocument *d, KoTextParag *pr = 0, KoTextParag *nx = 0, bool updateIds = true )
44 : KoTextParag( d, pr, nx, updateIds ) { }
45 ~KWTextParag() { }
46
47 KWTextDocument * kwTextDocument() const;
48
49 virtual void setParagLayout( const KoParagLayout &layout, int flags = KoParagLayout::All, int marginIndex = -1 );
50
52 void setPageBreaking( int pb ); // warning this sets all the flags!
53 int pageBreaking() const { return m_layout.pageBreaking; }
54 bool linesTogether() const { return m_layout.pageBreaking & KoParagLayout::KeepLinesTogether; }
55 bool hardFrameBreakBefore() const { return m_layout.pageBreaking & KoParagLayout::HardFrameBreakBefore; }
56 bool hardFrameBreakAfter() const { return m_layout.pageBreaking & KoParagLayout::HardFrameBreakAfter; }
57
59 static KoTextFormat loadFormat( TQDomElement &formatElem, KoTextFormat *refFormat, const TQFont &defaultFont, const TQString & defaultLanguage, bool hyphanation );
61 static TQDomElement saveFormat( TQDomDocument &doc, KoTextFormat *curFormat, KoTextFormat *refFormat, int pos, int len );
62
63
65 void save( TQDomElement &parentElem, bool saveAnchorsFramesets = false );
66
68 void save( TQDomElement &parentElem, int from, int to, bool saveAnchorsFramesets = false );
69
71 void load( TQDomElement &attributes );
72
74 void loadFormatting( TQDomElement &attributes, int offset = 0, bool loadFootNote=true );
75
77 void loadLayout( TQDomElement & attributes );
78
80 static KoParagLayout loadParagLayout( TQDomElement & parentElem, KWDocument *doc, bool useRefStyle );
81
82 virtual void loadOasis( const TQDomElement& e, KoOasisContext& context, KoStyleCollection *styleCollection, uint& pos );
83 virtual void saveOasis( KoXmlWriter& writer, KoSavingContext& context,
84 int from, int to, bool saveAnchorsFramesets = false ) const;
85
86 virtual void join( KoTextParag *parag );
87protected:
88 virtual void drawFormattingChars( TQPainter &painter, int start, int len,
89 int lastY_pix, int baseLine_pix, int h_pix, // in pixels
90 bool drawSelections,
91 KoTextFormat *lastFormat, const TQMemArray<int> &selectionStarts,
92 const TQMemArray<int> &selectionEnds, const TQColorGroup &cg,
93 bool rightToLeft, int line, KoTextZoomHandler* zh,
94 int whichFormattingChars );
95
96};
97
98#endif
This is our KoTextDocument reimplementation, to create KWTextParag instead of KoTextParags,...
Class: KWTextFrameSet Contains text (KoTextObject) and frames to display that text.
This class extends KoTextParag for KWord-specific formatting stuff, custom items, loading and saving.
Definition KWTextParag.h:41
void load(TQDomElement &attributes)
Load (from KWord-1.3 XML) the paragraph.
static KoTextFormat loadFormat(TQDomElement &formatElem, KoTextFormat *refFormat, const TQFont &defaultFont, const TQString &defaultLanguage, bool hyphanation)
Public for loading a style (KWord-1.3 XML)
static KoParagLayout loadParagLayout(TQDomElement &parentElem, KWDocument *doc, bool useRefStyle)
Load (from KWord-1.3 XML), optionally using styles from document.
static TQDomElement saveFormat(TQDomDocument &doc, KoTextFormat *curFormat, KoTextFormat *refFormat, int pos, int len)
Public for saving a style (KWord-1.3 XML)
void save(TQDomElement &parentElem, bool saveAnchorsFramesets=false)
Save (to KWord-1.3 XML) the whole paragraph.
void loadLayout(TQDomElement &attributes)
Load (from KWord-1.3 XML) and apply paragraph layout.
void setPageBreaking(int pb)
The type of page-breaking behaviour.
void loadFormatting(TQDomElement &attributes, int offset=0, bool loadFootNote=true)
Load (from KWord-1.3 XML) and apply <FORMAT> tags (used by KWTextParag::load and by KWPasteCommand)