~smartboyhw/ubuntu/raring/calligra/2.6.0-0ubuntu1

« back to all changes in this revision

Viewing changes to plugins/vectorshape/VectorShapeFactory.cpp

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2012-08-08 11:05:31 UTC
  • mfrom: (1.1.9)
  • Revision ID: package-import@ubuntu.com-20120808110531-43wco1j5sdm8n47s
Tags: 1:2.5.0-0ubuntu1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
 
24
24
// VectorShape
25
25
#include "VectorShape.h"
 
26
#include "VectorShapeConfigWidget.h"
26
27
 
27
28
// Calligra
28
29
#include <KoXmlNS.h>
39
40
    : KoShapeFactoryBase(VectorShape_SHAPEID, i18n("Vector image"))
40
41
{
41
42
    setToolTip(i18n("A shape that shows a vector image"));
42
 
    setIcon( "vector-shape" );
 
43
    // FIXME: x-shape-vectorimage
 
44
    setIcon("application-x-wmf");
43
45
    setXmlElementNames(KoXmlNS::draw, QStringList("image"));
44
46
    setLoadingPriority(2);
45
47
}
61
63
            if (href.startsWith("./")) {
62
64
                href.remove(0,2);
63
65
            }
64
 
            QString mimetype = context.odfLoadingContext().mimeTypeForPath(href);
65
 
            // don't try to load image types
66
 
            return !mimetype.startsWith("image");
 
66
            // LO 3.5 does not write a mimetype for embedded wmf files, so guess also from content
 
67
            const QString mimetype = context.odfLoadingContext().mimeTypeForPath(href, true);
 
68
 
 
69
            return
 
70
                mimetype == QLatin1String("application/x-svm") ||
 
71
                mimetype == QLatin1String("image/x-emf") ||
 
72
                mimetype == QLatin1String("image/x-wmf") ||
 
73
                // next two for backward compatibility with Calligra
 
74
                mimetype == QLatin1String("application/x-emf") ||
 
75
                mimetype == QLatin1String("application/x-wmf") ||
 
76
                // guessing of svm files returns application/octet-stream so also test on that
 
77
                // see sundaram.fedorapeople.org%2Fpresentations%2Ffedora-fail-learn.odp
 
78
                mimetype == QLatin1String("application/octet-stream") ||
 
79
                // seems like MSO does not always write a mimetype
 
80
                // see jeffcoweb.jeffco.k12.co.us%2Fhigh%2Fchatfield%2Fdepartments%2Fbusiness%2Fbanking_finance%2Funit_Plan_Budget.odp
 
81
                mimetype.isEmpty() ||
 
82
                // next for compatibility with OO/LO and our filters
 
83
                // see drwho.virtadpt.net%2Ffiles%2FNOVALUG-Tor.odp
 
84
                mimetype.startsWith("application/x-openoffice");
67
85
        }
68
86
        return true;
69
87
    }
74
92
QList<KoShapeConfigWidgetBase*> VectorShapeFactory::createShapeOptionPanels()
75
93
{
76
94
    QList<KoShapeConfigWidgetBase*> result;
77
 
 
 
95
    result.append(new VectorShapeConfigWidget());
78
96
    return result;
79
97
}