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

« back to all changes in this revision

Viewing changes to karbon/visitors/vtransformnodes.cc

  • 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
/* This file is part of the KDE project
 
2
   Copyright (C) 2002, The Karbon Developers
 
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., 59 Temple Place - Suite 330,
 
17
   Boston, MA 02111-1307, USA.
 
18
*/
 
19
 
 
20
 
 
21
#include "vpath.h"
 
22
#include "vsegment.h"
 
23
#include "vtransformnodes.h"
 
24
 
 
25
 
 
26
VTransformNodes::VTransformNodes( const QWMatrix& m )
 
27
        : m_matrix( m )
 
28
{
 
29
}
 
30
 
 
31
void
 
32
VTransformNodes::visitVSubpath( VSubpath& path )
 
33
{
 
34
        path.first();
 
35
        while( path.current() )
 
36
        {
 
37
                if( path.current()->isCurve() )
 
38
                {
 
39
                        if( !path.current()->knotIsSelected() &&
 
40
                                path.current()->pointIsSelected( 1 ) &&
 
41
                                path.current()->next() &&
 
42
                                path.current()->next()->isCurve() &&
 
43
                                !path.current()->next()->pointIsSelected( 0 ) &&
 
44
                                path.current()->isSmooth() )
 
45
                        {
 
46
                                // Do extra reverse trafo for smooth beziers
 
47
                                QWMatrix m2( m_matrix.m11(), m_matrix.m12(), m_matrix.m21(), m_matrix.m22(),
 
48
                                                        -m_matrix.dx(), -m_matrix.dy() );
 
49
                                path.current()->next()->setPoint( 0, path.current()->next()->point( 0 ).transform( m2 ) );
 
50
                        }
 
51
                        if( path.current()->pointIsSelected( 0 ) &&
 
52
                                path.current()->prev() &&
 
53
                                path.current()->prev()->isCurve() &&
 
54
                                !path.current()->prev()->knotIsSelected() &&
 
55
                                !path.current()->prev()->pointIsSelected( 1 ) &&
 
56
                                path.current()->prev()->isSmooth() )
 
57
                        {
 
58
                                // Do extra reverse trafo for smooth beziers
 
59
                                QWMatrix m2( m_matrix.m11(), m_matrix.m12(), m_matrix.m21(), m_matrix.m22(),
 
60
                                                        -m_matrix.dx(), -m_matrix.dy() );
 
61
                                path.current()->prev()->setPoint( 1, path.current()->prev()->point( 1 ).transform( m2 ) );
 
62
                        }
 
63
                }
 
64
 
 
65
                for( uint i = 0; i < path.current()->degree(); ++i )
 
66
                {
 
67
                        if( path.current()->pointIsSelected( i ) )
 
68
                                path.current()->setPoint( i, path.current()->point( i ).transform( m_matrix ) );
 
69
                }
 
70
 
 
71
                if( !success() )
 
72
                        setSuccess();
 
73
                path.next();
 
74
        }
 
75
}
 
76