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

« back to all changes in this revision

Viewing changes to plugins/chartshape/ChartShapeFactory.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:
53
53
K_EXPORT_PLUGIN(ChartShapePluginFactory("ChartShape"))
54
54
 
55
55
ChartShapePlugin::ChartShapePlugin(QObject * parent, const QVariantList&)
 
56
    : QObject(parent)
56
57
{
57
58
    // Register the chart shape factory.
58
59
    KoShapeRegistry::instance()->add(new ChartShapeFactory());
81
82
 
82
83
bool ChartShapeFactory::supports(const KoXmlElement &element, KoShapeLoadingContext &context) const
83
84
{
84
 
    Q_UNUSED(context);
85
 
    return element.namespaceURI() == "urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
86
 
        && element.tagName() == "object";
 
85
    if (element.namespaceURI() == "urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
 
86
        && element.tagName() == "object") {
 
87
 
 
88
        QString href = element.attribute("href");
 
89
        if (!href.isEmpty()) {
 
90
            // check the mimetype
 
91
            if (href.startsWith("./")) {
 
92
                href.remove(0,2);
 
93
            }
 
94
            const QString mimetype = context.odfLoadingContext().mimeTypeForPath(href);
 
95
            return mimetype.isEmpty() || mimetype == "application/vnd.oasis.opendocument.chart";
 
96
        }
 
97
    }
 
98
    return false;
87
99
}
88
100
 
89
101
KoShape *ChartShapeFactory::createShapeFromOdf(const KoXmlElement &element,