~ubuntu-branches/ubuntu/precise/koffice/precise

« back to all changes in this revision

Viewing changes to lib/kotext/KoTextParag.h

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2006-04-20 21:38:53 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20060420213853-j5lxluqvymxt2zny
Tags: 1:1.5.0-0ubuntu2
UbuntuĀ uploadĀ 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef KOTEXTPARAG_H
 
2
#define KOTEXTPARAG_H
 
3
 
 
4
/* This file is part of the KDE project
 
5
   Copyright (C) 2001-2005 David Faure <faure@kde.org>
 
6
 
 
7
   This library is free software; you can redistribute it and/or
 
8
   modify it under the terms of the GNU Library General Public
 
9
   License as published by the Free Software Foundation; either
 
10
   version 2 of the License, or (at your option) any later version.
 
11
 
 
12
   This library is distributed in the hope that it will be useful,
 
13
   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
15
   Library General Public License for more details.
 
16
 
 
17
   You should have received a copy of the GNU Library General Public License
 
18
   along with this library; see the file COPYING.LIB.  If not, write to
 
19
   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 
20
 * Boston, MA 02110-1301, USA.
 
21
*/
 
22
 
 
23
// -*- c++ -*-
 
24
 
 
25
#include "KoParagLayout.h"
 
26
 
 
27
#include "KoTextFormat.h"
 
28
#include "KoRichText.h" // for KoTextString
 
29
class KoTextFormatterBase;
 
30
class KoTextParagLineStart;
 
31
class KoTextString;
 
32
class KoTextDocument;
 
33
class KoParagCounter;
 
34
class KoParagStyle;
 
35
class KoTextCustomItem;
 
36
class KoOasisContext;
 
37
class KoSavingContext;
 
38
class KoStyleCollection;
 
39
 
 
40
struct KoTextParagSelection
 
41
{
 
42
    int start, end;
 
43
};
 
44
 
 
45
#if defined(Q_TEMPLATEDLL)
 
46
// MOC_SKIP_BEGIN
 
47
template class QMap<int, KoTextParagSelection>;
 
48
template class QMap<int, KoTextParagLineStart*>;
 
49
// MOC_SKIP_END
 
50
#endif
 
51
 
 
52
class KOTEXT_EXPORT KoTextParag
 
53
{
 
54
    friend class KoTextDocument;
 
55
    friend class KoTextCursor;
 
56
 
 
57
public:
 
58
    KoTextParag( KoTextDocument *d, KoTextParag *pr = 0, KoTextParag *nx = 0, bool updateIds = TRUE );
 
59
    virtual ~KoTextParag();
 
60
 
 
61
    KoTextString *string() const;
 
62
    KoTextStringChar *at( int i ) const;
 
63
    int leftGap() const;
 
64
    int length() const;
 
65
 
 
66
    // Abstraction over the trailing-space thing, so that it can be removed later
 
67
    int lastCharPos() const { return str->length()-2; }
 
68
 
 
69
    void setFormat( KoTextFormat *fm );
 
70
    KoTextFormat *paragFormat() const;
 
71
 
 
72
    KoTextDocument *document() const;
 
73
 
 
74
    QRect rect() const;
 
75
    void setRect( const QRect& rect ) { r = rect; }
 
76
    void setHeight( int h ) { r.setHeight( h ); }
 
77
    void setWidth( int w ) { r.setWidth( w ); }
 
78
    void show();
 
79
    void hide();
 
80
    bool isVisible() const { return visible; }
 
81
 
 
82
    KoTextParag *prev() const;
 
83
    KoTextParag *next() const;
 
84
    void setPrev( KoTextParag *s );
 
85
    void setNext( KoTextParag *s );
 
86
 
 
87
    void insert( int index, const QString &s );
 
88
    void append( const QString &s, bool reallyAtEnd = FALSE );
 
89
    void truncate( int index );
 
90
    void remove( int index, int len );
 
91
 
 
92
    void move( int &dy );
 
93
    void format( int start = -1, bool doMove = TRUE );
 
94
 
 
95
    /// Call this to ensure that format() will be called on this paragraph later on
 
96
    void invalidate( int chr /*ignored*/ = 0 );
 
97
    /// Returns false if format() needs to be called on this paragraph
 
98
    bool isValid() const;
 
99
 
 
100
    /// 'changed' tells the painting code what it needs to paint
 
101
    bool hasChanged() const;
 
102
    void setChanged( bool b, bool recursive = FALSE );
 
103
    short int lineChanged(); // first line that has been changed.
 
104
    void setLineChanged( short int line );
 
105
 
 
106
    int lineHeightOfChar( int i, int *bl = 0, int *y = 0 ) const;
 
107
    KoTextStringChar *lineStartOfChar( int i, int *index = 0, int *line = 0 ) const;
 
108
    int lines() const;
 
109
    KoTextStringChar *lineStartOfLine( int line, int *index = 0 ) const;
 
110
    int lineY( int l ) const;
 
111
    int lineBaseLine( int l ) const;
 
112
    int lineHeight( int l ) const;
 
113
    void lineInfo( int l, int &y, int &h, int &bl ) const;
 
114
 
 
115
    void setSelection( int id, int start, int end );
 
116
    void removeSelection( int id );
 
117
    int selectionStart( int id ) const;
 
118
    int selectionEnd( int id ) const;
 
119
    bool hasSelection( int id ) const;
 
120
    bool hasAnySelection() const;
 
121
    bool fullSelected( int id ) const;
 
122
 
 
123
    //void setEndState( int s );
 
124
    //int endState() const;
 
125
 
 
126
    void setParagId( int i );
 
127
    int paragId() const;
 
128
 
 
129
    QMap<int, KoTextParagLineStart*> &lineStartList();
 
130
 
 
131
    void setFormat( int index, int len, const KoTextFormat *f, bool useCollection = TRUE, int flags = -1 );
 
132
 
 
133
    void setAlignment( uint a );
 
134
    void setAlignmentDirect( uint a ) { align = a; }
 
135
    uint alignment() const;
 
136
 
 
137
    virtual void paint( QPainter &painter, const QColorGroup &cg, KoTextCursor *cursor, bool drawSelections,
 
138
                       int clipx, int clipy, int clipw, int cliph ); // kotextparag.cc
 
139
 
 
140
 
 
141
    int topMargin() const;
 
142
    int bottomMargin() const;
 
143
    int leftMargin() const;
 
144
    int firstLineMargin() const;
 
145
    int rightMargin() const;
 
146
    int lineSpacing( int line ) const;
 
147
    int calculateLineSpacing( int line, int start, int last ) const;
 
148
 
 
149
    void registerFloatingItem( KoTextCustomItem *i );
 
150
    void unregisterFloatingItem( KoTextCustomItem *i );
 
151
 
 
152
    void setFullWidth( bool b ) { fullWidth = b; }
 
153
    bool isFullWidth() const { return fullWidth; }
 
154
 
 
155
    int customItems() const;
 
156
 
 
157
    void setDocumentRect( const QRect &r );
 
158
    int documentWidth() const;
 
159
    //int documentVisibleWidth() const;
 
160
    int documentX() const;
 
161
    int documentY() const;
 
162
    KoTextFormatCollection *formatCollection() const;
 
163
    //void setFormatter( KoTextFormatterBase *f );
 
164
    KoTextFormatterBase *formatter() const;
 
165
    //int minimumWidth() const;
 
166
    int widthUsed() const;
 
167
 
 
168
    int nextTabDefault( int i, int x );
 
169
    int nextTab( int i, int x, int availableWidth );
 
170
    int *tabArray() const;
 
171
    void setTabArray( int *a );
 
172
    void setTabStops( int tw );
 
173
 
 
174
    /// Set whether '\n' should break the paragraph into multiple lines
 
175
    /// Not used
 
176
    void setNewLinesAllowed( bool b );
 
177
    /// Return whether '\n' should break the paragraph into multiple lines
 
178
    bool isNewLinesAllowed() const;
 
179
 
 
180
    virtual void join( KoTextParag *s );
 
181
    virtual void copyParagData( KoTextParag *parag );
 
182
 
 
183
    //void setBreakable( bool b ) { breakable = b; }
 
184
    //bool isBreakable() const { return breakable; }
 
185
 
 
186
    void setMovedDown( bool b ) { movedDown = b; }
 
187
    bool wasMovedDown() const { return movedDown; }
 
188
 
 
189
    void setDirection( QChar::Direction d );
 
190
    QChar::Direction direction() const;
 
191
 
 
192
    /// Mark a paragraph as being part of the table of contents (kword only)
 
193
    void setPartOfTableOfContents( bool b ) { m_toc = b; }
 
194
    bool partOfTableOfContents() const { return m_toc; }
 
195
 
 
196
    // For KoTextFormatter only
 
197
    void insertLineStart( int index, KoTextParagLineStart *ls );
 
198
 
 
199
protected:
 
200
    void drawLabel( QPainter* p, int x, int y, int w, int h, int base, const QColorGroup& cg );
 
201
    void drawCursorDefault( QPainter &painter, KoTextCursor *cursor, int curx, int cury, int curh, const QColorGroup &cg );
 
202
    void drawCursor( QPainter &painter, KoTextCursor *cursor, int curx, int cury, int curh, const QColorGroup &cg );
 
203
 
 
204
/**
 
205
 * We extend KoTextParag with more (zoom-aware) features,
 
206
 * like linespacing, borders, counter, tabulators, etc.
 
207
 * This also implements WYSIWYG text drawing.
 
208
 */
 
209
public:
 
210
    KoTextDocument * textDocument() const { return document(); }
 
211
 
 
212
    KoTextFormat * paragraphFormat() const
 
213
    { return static_cast<KoTextFormat *>( paragFormat() ); }
 
214
 
 
215
    /** Sets all or some parameters from a paragLayout struct.
 
216
     * @param flags selects which settings to apply, see KoParagLayout's enum. */
 
217
    virtual void setParagLayout( const KoParagLayout &layout, int flags = KoParagLayout::All,
 
218
                                 int marginIndex = -1 );
 
219
 
 
220
    const KoParagLayout & paragLayout() { return m_layout; }
 
221
 
 
222
    // Margins
 
223
    double margin( QStyleSheetItem::Margin m ) { return m_layout.margins[m]; }
 
224
    const double * margins() const { return m_layout.margins; }
 
225
    void setMargin( QStyleSheetItem::Margin m, double _i );
 
226
    void setMargins( const double * _i );
 
227
 
 
228
    /** Line spacing in pt if >=0, can also be one of the LS_* values */
 
229
    double kwLineSpacing() const { return m_layout.lineSpacingValue(); }
 
230
 
 
231
    void setLineSpacing( double _i );
 
232
 
 
233
    KoParagLayout::SpacingType kwLineSpacingType() const { return m_layout.lineSpacingType; }
 
234
 
 
235
    void setLineSpacingType( KoParagLayout::SpacingType _type );
 
236
 
 
237
 
 
238
    /** Use this to change the paragraph alignment, not KoTextParag::setAlignment ! */
 
239
    void setAlign( int align );
 
240
    /** Return the real alignment: Auto is resolved to either Left or Right */
 
241
    int resolveAlignment() const;
 
242
 
 
243
    /// The part of the top margin that can be broken by a page break
 
244
    /// Obviously the non-breakable part (e.g. border width) is topMargin()-breakableTopMargin()
 
245
    int breakableTopMargin() const;
 
246
 
 
247
    // Borders
 
248
    KoBorder leftBorder() const { return m_layout.leftBorder; }
 
249
    KoBorder rightBorder() const { return m_layout.rightBorder; }
 
250
    KoBorder topBorder() const { return m_layout.topBorder; }
 
251
    KoBorder bottomBorder() const { return m_layout.bottomBorder; }
 
252
    bool hasBorder() const { return m_layout.hasBorder(); }
 
253
    bool joinBorder() const { return m_layout.joinBorder; }
 
254
 
 
255
    void setLeftBorder( const KoBorder & _brd ) { m_layout.leftBorder = _brd; }
 
256
    void setRightBorder( const KoBorder & _brd ) { m_layout.rightBorder = _brd; }
 
257
    void setTopBorder( const KoBorder & _brd );
 
258
    void setBottomBorder( const KoBorder & _brd );
 
259
    void setJoinBorder( bool join );
 
260
 
 
261
    // Paragraph background
 
262
    QColor backgroundColor() { return m_layout.backgroundColor; }
 
263
    void setBackgroundColor( const QColor& color);
 
264
 
 
265
    // Counters are used to implement list and heading numbering/bullets.
 
266
    void setCounter( const KoParagCounter & counter );
 
267
    void setNoCounter();
 
268
    void setCounter( const KoParagCounter * pCounter )
 
269
    {
 
270
        if ( pCounter ) setCounter( *pCounter );
 
271
        else setNoCounter();
 
272
    }
 
273
    KoParagCounter *counter();
 
274
 
 
275
    /** The space required to draw the complete counter label (i.e. the Counter for this
 
276
     * paragraph, as well as the Counters for any paragraphs above us in the numbering
 
277
     * hierarchy). @see drawLabel(). */
 
278
    int counterWidth() const;
 
279
 
 
280
    /** Style used by this paragraph */
 
281
    KoParagStyle *style() const { return m_layout.style; }
 
282
    /** Sets the style in this paragraph, but doesn't _apply_ it, only sets a reference */
 
283
    void setStyle( KoParagStyle *style ) { m_layout.style = style; }
 
284
    /** Applies the style directly (without undo/redo! See KoTextObject for undo/redo) */
 
285
    void applyStyle( KoParagStyle *style );
 
286
 
 
287
    /** Get tabulator positions */
 
288
    const KoTabulatorList& tabList() const { return m_layout.tabList(); }
 
289
    /** Set tabulator positions */
 
290
    void setTabList( const KoTabulatorList &tabList );
 
291
 
 
292
    /** Return the X for the shadow distance in pixels (zoomed) */
 
293
    int shadowX( KoTextZoomHandler *zh ) const;
 
294
    /** Return the Y for the shadow distance in pixels (zoomed) */
 
295
    int shadowY( KoTextZoomHandler *zh ) const;
 
296
    /** Return the Y for the shadow distance in pt */
 
297
    double shadowDistanceY() const;
 
298
 
 
299
    /** Set a @p custom item at position @p index, with format @p currentFormat (convenience method) */
 
300
    void setCustomItem( int index, KoTextCustomItem * custom, KoTextFormat * currentFormat );
 
301
    /** Remove the custom item from position @p index, but doesn't delete it */
 
302
    void removeCustomItem( int index );
 
303
 
 
304
    /** Find a custom item that we know is somewhere in this paragraph
 
305
     * Returns the index in the paragraph */
 
306
    int findCustomItem( const KoTextCustomItem * custom ) const;
 
307
 
 
308
    /** Cache to find a tab by char index, QMap<char index, tab index> */
 
309
    QMap<int, int>& tabCache() { return m_tabCache; }
 
310
 
 
311
    /** @return the parag rect, in pixels. This takes care of some rounding problems */
 
312
    QRect pixelRect( KoTextZoomHandler* zh ) const;
 
313
 
 
314
    /** draw underline and double underline. Static because it's used
 
315
     *  for draw double/simple in variable.
 
316
     */
 
317
     static void drawFontEffects( QPainter * p, KoTextFormat *format, KoTextZoomHandler *zh, QFont font, const QColor & color, int startX, int baseLine, int bw, int y, int h, QChar firstChar );
 
318
 
 
319
    /** a bit more clever than KoTextString::toString, e.g. with numbered lists */
 
320
    QString toString( int from = 0, int length = 0xffffffff) const;
 
321
 
 
322
    /// The app should call this during formatting - e.g. in formatVertically
 
323
    void fixParagWidth( bool viewFormattingChars );
 
324
 
 
325
    /// Load from XML
 
326
    virtual void loadOasis( const QDomElement& e, KoOasisContext& context, KoStyleCollection *styleCollection, uint& pos );
 
327
    /// Save to XML
 
328
    /// By default the whole paragraph is saved. from/to allow to save only a portion of it.
 
329
    /// The 'from' and 'to' characters are both included.
 
330
    virtual void saveOasis( KoXmlWriter& writer, KoSavingContext& context,
 
331
                            int from, int to, bool saveAnchorsFramesets = false ) const;
 
332
 
 
333
    void loadOasisSpan( const QDomElement& parent, KoOasisContext& context, uint& pos );
 
334
 
 
335
    void applyListStyle( KoOasisContext& context, int restartNumbering, bool orderedList, bool heading, int level );
 
336
 
 
337
#ifndef NDEBUG
 
338
    void printRTDebug( int );
 
339
#endif
 
340
 
 
341
protected:
 
342
    void invalidateCounters();
 
343
    bool lineHyphenated( int l ) const;
 
344
 
 
345
    void paintLines( QPainter &painter, const QColorGroup &cg, KoTextCursor *cursor, bool drawSelections,
 
346
                     int clipx, int clipy, int clipw, int cliph );
 
347
 
 
348
    void drawParagString( QPainter &painter, const QString &str, int start, int len, int startX,
 
349
                          int lastY, int baseLine, int bw, int h, bool drawSelections,
 
350
                          KoTextFormat *lastFormat, const QMemArray<int> &selectionStarts,
 
351
                          const QMemArray<int> &selectionEnds, const QColorGroup &cg, bool rightToLeft, int line );
 
352
    void drawParagStringInternal( QPainter &painter, const QString &s, int start, int len, int startX,
 
353
                                  int lastY, int baseLine, int bw, int h, bool drawSelections,
 
354
                                  KoTextFormat *lastFormat, const QMemArray<int> &selectionStarts,
 
355
                                  const QMemArray<int> &selectionEnds, const QColorGroup &cg, bool rightToLeft, int line, KoTextZoomHandler* zh, bool drawingShadow );
 
356
 
 
357
    /// Bitfield for drawFormattingChars's "whichFormattingChars" param
 
358
    enum { FormattingSpace = 1, FormattingBreak = 2, FormattingEndParag = 4, FormattingTabs = 8,
 
359
           AllFormattingChars = FormattingSpace | FormattingBreak | FormattingEndParag | FormattingTabs };
 
360
 
 
361
    /// Called by drawParagStringInternal to draw the formatting characters, if the
 
362
    /// kotextdocument drawingflag for it was set.
 
363
    /// The last arg is a bit special: drawParagStringInternal always sets it to "all",
 
364
    /// but reimplementations can change its value.
 
365
    virtual void drawFormattingChars( QPainter &painter, int start, int len,
 
366
                                      int lastY_pix, int baseLine_pix, int h_pix, // in pixels
 
367
                                      bool drawSelections,
 
368
                                      KoTextFormat *format, const QMemArray<int> &selectionStarts,
 
369
                                      const QMemArray<int> &selectionEnds, const QColorGroup &cg,
 
370
                                      bool rightToLeft, int line, KoTextZoomHandler* zh,
 
371
                                      int whichFormattingChars );
 
372
 
 
373
protected:
 
374
    KoParagLayout m_layout;
 
375
    QMap<int, int> m_tabCache;
 
376
 
 
377
private:
 
378
    KoParagLayout loadParagLayout( KoOasisContext& context, KoStyleCollection *styleCollection, bool findStyle );
 
379
 
 
380
 
 
381
 
 
382
    /////// End of kotext-specific additions
 
383
private:
 
384
    QMap<int, KoTextParagSelection> &selections() const;
 
385
    QPtrList<KoTextCustomItem> &floatingItems() const;
 
386
    /// Returns the height of the biggest character in that line
 
387
    int heightForLineSpacing( int startChar, int lastChar ) const;
 
388
 
 
389
    QMap<int, KoTextParagLineStart*> lineStarts;
 
390
    QRect r;
 
391
    KoTextParag *p, *n;
 
392
    KoTextDocument *doc;
 
393
    bool m_invalid : 1;
 
394
    bool changed : 1;
 
395
    bool fullWidth : 1;
 
396
    bool newLinesAllowed : 1;
 
397
    bool visible : 1;
 
398
    bool movedDown : 1;
 
399
    bool m_toc : 1;
 
400
    uint align : 4;
 
401
    short int m_lineChanged;
 
402
    int id;
 
403
    int m_wused;
 
404
    KoTextString *str;
 
405
    QMap<int, KoTextParagSelection> *mSelections;
 
406
    QPtrList<KoTextCustomItem> *mFloatingItems;
 
407
    KoTextFormat *defFormat; // is this really used?
 
408
    int *tArray;
 
409
 
 
410
    // Those things are used by QRT for the case of a paragraph without document
 
411
    // We don't use this currently, and it's not worth making EVERY parag bigger
 
412
    // just for a special case that's rarely used. Better have lightweight KoTextDocument
 
413
    // replacement (with common base class), if we ever want efficient single-parag docs...
 
414
    //int tabStopWidth;
 
415
    //QRect docRect;
 
416
    //KoTextFormatterBase *pFormatter;
 
417
    //KoTextDocCommandHistory *commandHistory;
 
418
};
 
419
 
 
420
inline int KoTextParag::length() const
 
421
{
 
422
    return str->length();
 
423
}
 
424
 
 
425
inline QRect KoTextParag::rect() const
 
426
{
 
427
    return r;
 
428
}
 
429
 
 
430
inline KoTextStringChar *KoTextParag::at( int i ) const
 
431
{
 
432
    return &str->at( i );
 
433
}
 
434
 
 
435
inline bool KoTextParag::isValid() const
 
436
{
 
437
    return !m_invalid;
 
438
}
 
439
 
 
440
inline bool KoTextParag::hasChanged() const
 
441
{
 
442
    return changed;
 
443
}
 
444
 
 
445
inline short int KoTextParag::lineChanged()
 
446
{
 
447
    return m_lineChanged;
 
448
}
 
449
 
 
450
inline void KoTextParag::append( const QString &s, bool reallyAtEnd )
 
451
{
 
452
    if ( reallyAtEnd )
 
453
        insert( str->length(), s );
 
454
    else
 
455
        insert( QMAX( str->length() - 1, 0 ), s );
 
456
}
 
457
 
 
458
inline KoTextParag *KoTextParag::prev() const
 
459
{
 
460
    return p;
 
461
}
 
462
 
 
463
inline KoTextParag *KoTextParag::next() const
 
464
{
 
465
    return n;
 
466
}
 
467
 
 
468
inline bool KoTextParag::hasAnySelection() const
 
469
{
 
470
    return mSelections ? !selections().isEmpty() : FALSE;
 
471
}
 
472
 
 
473
/*inline void KoTextParag::setEndState( int s )
 
474
{
 
475
    if ( s == state )
 
476
        return;
 
477
    state = s;
 
478
}
 
479
 
 
480
inline int KoTextParag::endState() const
 
481
{
 
482
    return state;
 
483
}*/
 
484
 
 
485
inline void KoTextParag::setParagId( int i )
 
486
{
 
487
    id = i;
 
488
}
 
489
 
 
490
inline int KoTextParag::paragId() const
 
491
{
 
492
    //if ( id == -1 )
 
493
    //  kdWarning() << "invalid parag id!!!!!!!! (" << (void*)this << ")" << endl;
 
494
    return id;
 
495
}
 
496
 
 
497
inline QMap<int, KoTextParagLineStart*> &KoTextParag::lineStartList()
 
498
{
 
499
    return lineStarts;
 
500
}
 
501
 
 
502
inline KoTextString *KoTextParag::string() const
 
503
{
 
504
    return str;
 
505
}
 
506
 
 
507
inline KoTextDocument *KoTextParag::document() const
 
508
{
 
509
    return doc;
 
510
}
 
511
 
 
512
inline void KoTextParag::setAlignment( uint a )
 
513
{
 
514
    if ( a == align )
 
515
        return;
 
516
    align = a;
 
517
    invalidate( 0 );
 
518
}
 
519
 
 
520
/*inline void KoTextParag::setListStyle( QStyleSheetItem::ListStyle ls )
 
521
{
 
522
    lstyle = ls;
 
523
    invalidate( 0 );
 
524
}
 
525
 
 
526
inline QStyleSheetItem::ListStyle KoTextParag::listStyle() const
 
527
{
 
528
    return lstyle;
 
529
}*/
 
530
 
 
531
inline KoTextFormat *KoTextParag::paragFormat() const
 
532
{
 
533
    return defFormat;
 
534
}
 
535
 
 
536
inline void KoTextParag::registerFloatingItem( KoTextCustomItem *i )
 
537
{
 
538
    floatingItems().append( i );
 
539
}
 
540
 
 
541
inline void KoTextParag::unregisterFloatingItem( KoTextCustomItem *i )
 
542
{
 
543
    floatingItems().removeRef( i );
 
544
}
 
545
 
 
546
/*inline void KoTextParag::addCustomItem()
 
547
{
 
548
    numCustomItems++;
 
549
}
 
550
 
 
551
inline void KoTextParag::removeCustomItem()
 
552
{
 
553
    numCustomItems--;
 
554
}*/
 
555
 
 
556
inline int KoTextParag::customItems() const
 
557
{
 
558
    return mFloatingItems ? mFloatingItems->count() : 0;
 
559
    // was numCustomItems, but no need for a separate count
 
560
}
 
561
 
 
562
inline void KoTextParag::setNewLinesAllowed( bool b )
 
563
{
 
564
    newLinesAllowed = b;
 
565
}
 
566
 
 
567
inline bool KoTextParag::isNewLinesAllowed() const
 
568
{
 
569
    return newLinesAllowed;
 
570
}
 
571
 
 
572
#endif