~ubuntu-branches/ubuntu/breezy/koffice/breezy

« back to all changes in this revision

Viewing changes to kchart/kdchart/KDChartTextPiece.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Ben Burton
  • Date: 2004-05-09 11:33:00 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20040509113300-vfrdadqsvjfuhn3b
Tags: 1:1.3.1-1
* New upstream bugfix release.
* Built against newer imagemagick (closes: #246623).
* Made koffice-libs/kformula recommend/depend on latex-xft-fonts, which
  provides mathematical fonts that the formula editor can use.  Also
  patched the kformula part to make these fonts the default.
* Changed kword menu hint from "WordProcessors" to "Word processors"
  (closes: #246209).
* Spellchecker configuration is now fixed (closes: #221256, #227568).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* -*- Mode: C++ -*-
2
 
 
3
 
  $Id: KDChartTextPiece.cpp,v 1.3.2.1 2001/12/08 12:15:41 khz Exp $
4
 
 
5
 
  KDChart - a multi-platform charting engine
6
 
 
7
 
  Copyright (C) 2001 by Klar�lvdalens Datakonsult AB
8
 
*/
9
 
 
 
2
   KDChart - a multi-platform charting engine
 
3
   */
 
4
 
 
5
/****************************************************************************
 
6
 ** Copyright (C) 2001-2003 Klar�lvdalens Datakonsult AB.  All rights reserved.
 
7
 **
 
8
 ** This file is part of the KDChart library.
 
9
 **
 
10
 ** This file may be distributed and/or modified under the terms of the
 
11
 ** GNU General Public License version 2 as published by the Free Software
 
12
 ** Foundation and appearing in the file LICENSE.GPL included in the
 
13
 ** packaging of this file.
 
14
 **
 
15
 ** Licensees holding valid commercial KDChart licenses may use this file in
 
16
 ** accordance with the KDChart Commercial License Agreement provided with
 
17
 ** the Software.
 
18
 **
 
19
 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
 
20
 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 
21
 **
 
22
 ** See http://www.klaralvdalens-datakonsult.se/?page=products for
 
23
 **   information about KDChart Commercial License Agreements.
 
24
 **
 
25
 ** Contact info@klaralvdalens-datakonsult.se if any conditions of this
 
26
 ** licensing are not clear to you.
 
27
 **
 
28
 **********************************************************************/
10
29
#include "KDChartTextPiece.h"
11
30
 
12
31
#include <qstylesheet.h>
38
57
    if( src._richText ) {
39
58
        _richText = new QSimpleRichText( src._text, src._font );
40
59
        _richText->adjustSize();
41
 
    }
 
60
    } else
 
61
        _richText = 0;
42
62
 
43
63
    // used for both
44
64
    _metrics = new QFontMetrics( *src._metrics );
107
127
 
108
128
 
109
129
void KDChartTextPiece::draw( QPainter *p, int x, int y,
110
 
                             const QRegion& clipRegion,
111
 
                             const QColor& color,
112
 
                             const QBrush* paper ) const
 
130
        const QRect& clipRect,
 
131
        const QColor& color,
 
132
        const QBrush* paper ) const
 
133
{
 
134
    if( _isRichText ) {
 
135
        QColorGroup cg;
 
136
        cg.setColor( QColorGroup::Text, color );
 
137
        _richText->setWidth( clipRect.width() );
 
138
        _richText->draw( p, x, y, clipRect, cg, paper );
 
139
    } else {
 
140
        p->save();
 
141
        p->setFont( _font );
 
142
        if( paper )
 
143
            p->setBrush( *paper );
 
144
        p->setPen( color );
 
145
        p->setClipRect( clipRect );
 
146
        p->drawText( x, y + _metrics->ascent(), _text );
 
147
        p->restore();
 
148
    }
 
149
}
 
150
 
 
151
 
 
152
void KDChartTextPiece::draw( QPainter *p, int x, int y,
 
153
        const QRegion& clipRegion,
 
154
        const QColor& color,
 
155
        const QBrush* paper ) const
113
156
{
114
157
    if( _isRichText ) {
115
158
        QColorGroup cg;