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

« back to all changes in this revision

Viewing changes to filters/kformula/kformula1.3/KFormula13Import.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:
29
29
#include <QFile>
30
30
 
31
31
typedef KGenericFactory<KFormula13Import> KFormula13ImportFactory;
32
 
K_EXPORT_COMPONENT_FACTORY( libkformula13import,
33
 
                            KFormula13ImportFactory( "kofficefilters" ) )
34
 
 
35
 
 
36
 
KFormula13Import::KFormula13Import( QObject* parent, const QStringList& )
37
 
                 : KoFilter(parent)
 
32
K_EXPORT_COMPONENT_FACTORY(libkformula13import,
 
33
                           KFormula13ImportFactory("kofficefilters"))
 
34
 
 
35
 
 
36
KFormula13Import::KFormula13Import(QObject* parent, const QStringList&)
 
37
        : KoFilter(parent)
38
38
{
39
39
}
40
40
 
42
42
{
43
43
}
44
44
 
45
 
KoFilter::ConversionStatus KFormula13Import::convert( const QByteArray& from,
46
 
                                                      const QByteArray& to )
 
45
KoFilter::ConversionStatus KFormula13Import::convert(const QByteArray& from,
 
46
        const QByteArray& to)
47
47
{
48
 
    if ( to != "application/mathml+xml" || from != "application/x-kformula" )
 
48
    if (to != "application/mathml+xml" || from != "application/x-kformula")
49
49
        return KoFilter::NotImplemented;
50
50
 
51
 
    KoStoreDevice* in = m_chain->storageFile( "root", KoStore::Read );
52
 
    if( !in )
53
 
    {
 
51
    KoStoreDevice* in = m_chain->storageFile("root", KoStore::Read);
 
52
    if (!in) {
54
53
        QApplication::restoreOverrideCursor();
55
 
        KMessageBox::error( 0, i18n( "Failed to read data." ),
56
 
                            i18n( "KFormula Import Error" ) );
 
54
        KMessageBox::error(0, i18n("Failed to read data."),
 
55
                           i18n("KFormula Import Error"));
57
56
        return KoFilter::StorageCreationError;
58
57
    }
59
58
 
60
 
    KoStoreDevice* out = m_chain->storageFile( "root", KoStore::Write );
61
 
    if( !out )
62
 
    {
 
59
    KoStoreDevice* out = m_chain->storageFile("root", KoStore::Write);
 
60
    if (!out) {
63
61
        kError(30506) << "KFormula13 Import unable to open output file! (Root)";
64
 
        KMessageBox::error( NULL, i18n("Unable to save main document."),
65
 
                            i18n("KFormula1.3 Import Filter"), 0 );
 
62
        KMessageBox::error(NULL, i18n("Unable to save main document."),
 
63
                           i18n("KFormula1.3 Import Filter"), 0);
66
64
        return KoFilter::StorageCreationError;
67
65
    }
68
66
 
69
67
    KFormula13ContentHandler handler;
70
 
    QXmlInputSource source( in );
 
68
    QXmlInputSource source(in);
71
69
    QXmlSimpleReader reader;
72
 
    reader.setContentHandler( &handler );
73
 
    reader.parse( &source );
74
 
    
 
70
    reader.setContentHandler(&handler);
 
71
    reader.parse(&source);
 
72
 
75
73
    return KoFilter::OK;
76
74
}
77
75