~ubuntu-branches/ubuntu/oneiric/koffice/oneiric-updates

« back to all changes in this revision

Viewing changes to filters/karbon/svg/svgexport.cc

  • Committer: Bazaar Package Importer
  • Author(s): Alessandro Ghersi
  • Date: 2010-10-27 17:52:57 UTC
  • mfrom: (0.12.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20101027175257-s04zqqk5bs8ckm9o
Tags: 1:2.2.83-0ubuntu1
* Merge with Debian git remaining changes:
 - Add build-deps on librcps-dev, opengtl-dev, libqtgtl-dev, freetds-dev,
   create-resources, libspnav-dev
 - Remove needless build-dep on libwv2-dev
 - koffice-libs recommends create-resources
 - krita recommends pstoedit
 - Keep our patches
* New upstream release 2.3 beta 3
  - Remove debian/patches fixed by upstream
  - Update install files

Show diffs side-by-side

added added

removed removed

Lines of Context:
164
164
    printIndentation(m_body, m_indent++);
165
165
    *m_body << "<g" << getID(layer) << ">" << endl;
166
166
 
167
 
    QList<KoShape*> sortedShapes = layer->childShapes();
 
167
    QList<KoShape*> sortedShapes = layer->shapes();
168
168
    qSort(sortedShapes.begin(), sortedShapes.end(), KoShape::compareShapeZIndex);
169
169
 
170
170
    foreach(KoShape * shape, sortedShapes) {
187
187
    getStyle(group, m_body);
188
188
    *m_body << ">" << endl;
189
189
 
190
 
    QList<KoShape*> sortedShapes = group->childShapes();
 
190
    QList<KoShape*> sortedShapes = group->shapes();
191
191
    qSort(sortedShapes.begin(), sortedShapes.end(), KoShape::compareShapeZIndex);
192
192
 
193
193
    foreach(KoShape * shape, sortedShapes) {
306
306
    return QString(" id=\"%1\"").arg(createID(obj));
307
307
}
308
308
 
309
 
QString SvgExport::getTransform(const QMatrix &matrix, const QString &attributeName)
 
309
QString SvgExport::getTransform(const QTransform &matrix, const QString &attributeName)
310
310
{
311
311
    if (matrix.isIdentity())
312
312
        return "";
327
327
    return transform + "\"";
328
328
}
329
329
 
330
 
bool SvgExport::isTranslation(const QMatrix &m)
 
330
bool SvgExport::isTranslation(const QTransform &m)
331
331
{
332
332
    return (m.m11() == 1.0 && m.m12() == 0.0 && m.m21() == 0.0 && m.m22() == 1.0);
333
333
}
344
344
    m_indent2--;
345
345
}
346
346
 
347
 
void SvgExport::getGradient(const QGradient * gradient, const QMatrix &gradientTransform)
 
347
void SvgExport::getGradient(const QGradient * gradient, const QTransform &gradientTransform)
348
348
{
349
349
    if (! gradient)
350
350
        return;
543
543
    KoGradientBackground * gbg = dynamic_cast<KoGradientBackground*>(shape->background());
544
544
    if (gbg) {
545
545
        *stream << " fill=\"";
546
 
        getGradient(gbg->gradient(), gbg->matrix());
 
546
        getGradient(gbg->gradient(), gbg->transform());
547
547
        *stream << "\"";
548
548
    }
549
549
    KoPatternBackground * pbg = dynamic_cast<KoPatternBackground*>(shape->background());
571
571
    if (line->lineStyle() == Qt::NoPen)
572
572
        *stream << "none";
573
573
    else if (line->lineBrush().gradient())
574
 
        getGradient(line->lineBrush().gradient(), line->lineBrush().matrix());
 
574
        getGradient(line->lineBrush().gradient(), line->lineBrush().transform());
575
575
    else
576
576
        *stream << line->color().name();
577
577
    *stream << "\"";
671
671
 
672
672
    // check if we are set on a path
673
673
    if (text->layout() == ArtisticTextShape::Straight) {
674
 
        QMatrix m = text->transformation();
 
674
        QTransform m = text->transformation();
675
675
        if (isTranslation(m)) {
676
676
            QPointF position = text->position();
677
677
            *m_body << " x=\"" << position.x() + anchorOffset << "pt\"";
721
721
    printIndentation(m_body, m_indent);
722
722
 
723
723
    *m_body << "<image" << getID(picture);
724
 
    QMatrix m = picture->transformation();
 
724
    QTransform m = picture->transformation();
725
725
    if (isTranslation(m)) {
726
726
        QPointF position = picture->position();
727
727
        *m_body << " x=\"" << position.x() << "pt\"";