File indexing completed on 2025-02-16 13:49:57
0001 /* This file is part of the KDE project 0002 Copyright (C) 1998, 1999 Reginald Stadlbauer <reggie@kde.org> 0003 0004 This library is free software; you can redistribute it and/or 0005 modify it under the terms of the GNU Library General Public 0006 License as published by the Free Software Foundation; either 0007 version 2 of the License, or (at your option) any later version. 0008 0009 This library is distributed in the hope that it will be useful, 0010 but WITHOUT ANY WARRANTY; without even the implied warranty of 0011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0012 Library General Public License for more details. 0013 0014 You should have received a copy of the GNU Library General Public License 0015 along with this library; see the file COPYING.LIB. If not, write to 0016 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0017 * Boston, MA 02110-1301, USA. 0018 */ 0019 0020 #include "latexexport.h" 0021 0022 #include "latexexportdialog.h" 0023 #include "LatexDebug.h" 0024 // KF5 0025 #include <KoFilterChain.h> 0026 #include <kpluginfactory.h> 0027 // Qt 0028 #include <QByteArray> 0029 0030 K_PLUGIN_FACTORY_WITH_JSON(LATEXExportFactory, "calligra_filter_kspread2tex.json", 0031 registerPlugin<LATEXExport>();) 0032 0033 0034 LATEXExport::LATEXExport(QObject* parent, const QVariantList&) : 0035 KoFilter(parent) 0036 { 0037 } 0038 0039 KoFilter::ConversionStatus LATEXExport::convert(const QByteArray& from, const QByteArray& to) 0040 { 0041 QString config; 0042 0043 if (to != "text/x-tex" || from != "application/x-kspread") 0044 return KoFilter::NotImplemented; 0045 0046 KoStore* in = KoStore::createStore(m_chain->inputFile(), KoStore::Read); 0047 if (!in || !in->open("root")) { 0048 errorLatex << "Unable to open input file!" << endl; 0049 delete in; 0050 return KoFilter::FileNotFound; 0051 } 0052 debugLatex << "In the kspread latex export filter..."; 0053 /* input file Reading */ 0054 in->close(); 0055 0056 LatexExportDialog* dialog = new LatexExportDialog(in); 0057 dialog->setOutputFile(m_chain->outputFile()); 0058 0059 dialog->exec(); 0060 delete dialog; 0061 delete in; 0062 0063 return KoFilter::OK; 0064 } 0065 0066 #include <latexexport.moc>