File indexing completed on 2025-03-16 10:52:55
0001 /* This file is part of the KDE project 0002 SPDX-FileCopyrightText: 1998, 1999 Reginald Stadlbauer <reggie@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #include "latexexport.h" 0008 0009 #include "latexexportdialog.h" 0010 #include "LatexDebug.h" 0011 // KF5 0012 #include <KoFilterChain.h> 0013 #include <kpluginfactory.h> 0014 // Qt 0015 #include <QByteArray> 0016 0017 K_PLUGIN_FACTORY_WITH_JSON(LATEXExportFactory, "calligra_filter_kspread2tex.json", 0018 registerPlugin<LATEXExport>();) 0019 0020 0021 LATEXExport::LATEXExport(QObject* parent, const QVariantList&) : 0022 KoFilter(parent) 0023 { 0024 } 0025 0026 KoFilter::ConversionStatus LATEXExport::convert(const QByteArray& from, const QByteArray& to) 0027 { 0028 0029 if (to != "text/x-tex" || from != "application/x-kspread") 0030 return KoFilter::NotImplemented; 0031 0032 KoStore* in = KoStore::createStore(m_chain->inputFile(), KoStore::Read); 0033 if (!in || !in->open("root")) { 0034 errorLatex << "Unable to open input file!" << endl; 0035 delete in; 0036 return KoFilter::FileNotFound; 0037 } 0038 debugLatex << "In the kspread latex export filter..."; 0039 /* input file Reading */ 0040 in->close(); 0041 0042 LatexExportDialog* dialog = new LatexExportDialog(in); 0043 dialog->setOutputFile(m_chain->outputFile()); 0044 0045 dialog->exec(); 0046 delete dialog; 0047 delete in; 0048 0049 return KoFilter::OK; 0050 } 0051 0052 #include <latexexport.moc>