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

« back to all changes in this revision

Viewing changes to kword/part/frames/KWCopyShape.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2010-09-21 15:36:35 UTC
  • mfrom: (1.4.1 upstream) (60.2.11 maverick)
  • Revision ID: james.westby@ubuntu.com-20100921153635-6tejqkiro2u21ydi
Tags: 1:2.2.2-0ubuntu3
Add kubuntu_03_fix-crash-on-closing-sqlite-connection-2.2.2.diff and
kubuntu_04_support-large-memo-values-for-msaccess-2.2.2.diff as
recommended by upstream http://kexi-
project.org/wiki/wikiview/index.php@Kexi2.2_Patches.html#sqlite_stab
ility

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* This file is part of the KDE project
2
 
 * Copyright (C) 2006, 2009 Thomas Zander <zander@kde.org>
 
2
 * Copyright (C) 2006, 2009,2010 Thomas Zander <zander@kde.org>
3
3
 *
4
4
 * This library is free software; you can redistribute it and/or
5
5
 * modify it under the terms of the GNU Library General Public
25
25
#include <KoShapeBorderModel.h>
26
26
#include <KoViewConverter.h>
27
27
#include <KoTextShapeData.h>
 
28
#include <KoShapeContainer.h>
28
29
 
29
30
#include <QPainter>
30
31
#include <QPainterPath>
35
36
        m_pageManager(pageManager)
36
37
{
37
38
    setSize(m_original->size());
 
39
    // allow selecting me to get the tool for the original to still work.
 
40
    QSet<KoShape*> delegates;
 
41
    delegates << m_original;
 
42
    setToolDelegates(delegates);
38
43
}
39
44
 
40
45
KWCopyShape::~KWCopyShape()
55
60
        }
56
61
    }
57
62
 
 
63
    //paint the original shape
58
64
    painter.save();
59
65
    m_original->paint(painter, converter);
60
66
    painter.restore();
61
 
    if (m_original->border())
62
 
        m_original->border()->paintBorder(m_original, painter, converter);
 
67
    if (m_original->border()) {
 
68
        m_original->border()->paint(m_original, painter, converter);
 
69
    }
 
70
 
 
71
    //paint all child shapes
 
72
    KoShapeContainer* container = dynamic_cast<KoShapeContainer*>(m_original);
 
73
    if (container) {
 
74
        if (!container->childCount()) {
 
75
            return;
 
76
        }
 
77
 
 
78
        QList<KoShape*> sortedObjects = container->childShapes();
 
79
        qSort(sortedObjects.begin(), sortedObjects.end(), KoShape::compareShapeZIndex);
 
80
 
 
81
        // Do the following to revert the absolute transformation of the
 
82
        // container that is re-applied in shape->absoluteTransformation()
 
83
        // later on.  The transformation matrix of the container has already
 
84
        // been applied once before this function is called.
 
85
        QMatrix baseMatrix = container->absoluteTransformation(&converter).inverted() * painter.matrix();
 
86
 
 
87
        foreach(KoShape *shape, sortedObjects) {
 
88
            painter.save();
 
89
            painter.setMatrix(shape->absoluteTransformation(&converter) * baseMatrix);
 
90
            shape->paint(painter, converter);
 
91
            painter.restore();
 
92
            if (shape->border()) {
 
93
                painter.save();
 
94
                painter.setMatrix(shape->absoluteTransformation(&converter) * baseMatrix);
 
95
                shape->border()->paint(shape, painter, converter);
 
96
                painter.restore();
 
97
            }
 
98
        }
 
99
    }
63
100
}
64
101
 
65
102
void KWCopyShape::paintDecorations(QPainter &painter, const KoViewConverter &converter, const KoCanvasBase *canvas)
72
109
    return m_original->outline();
73
110
}
74
111
 
75
 
void KWCopyShape::saveOdf(KoShapeSavingContext & context) const
 
112
void KWCopyShape::saveOdf(KoShapeSavingContext &context) const
76
113
{
77
114
    // TODO
78
115
}