diff --git a/filters/sheets/CMakeLists.txt b/filters/sheets/CMakeLists.txt index 9aae971dbfb..351a8e2c59b 100644 --- a/filters/sheets/CMakeLists.txt +++ b/filters/sheets/CMakeLists.txt @@ -1,24 +1,22 @@ include_directories( ${KOTEXT_INCLUDES} ) if(NOT TINY) add_subdirectory( applixspread ) add_subdirectory( csv ) add_subdirectory( dbase ) add_subdirectory( gnumeric ) add_subdirectory( opencalc ) add_subdirectory( qpro ) if(NOT WIN32 AND NOT QT_MAC_USE_COCOA) add_subdirectory( html ) - if (QT3SUPPORT) - add_subdirectory( latex ) - endif (QT3SUPPORT) + add_subdirectory( latex ) endif(NOT WIN32 AND NOT QT_MAC_USE_COCOA) endif(NOT TINY) add_subdirectory( excel ) if(SHOULD_BUILD_OOXML_FILTERS) add_subdirectory( xlsx ) endif(SHOULD_BUILD_OOXML_FILTERS) diff --git a/filters/sheets/latex/export/CMakeLists.txt b/filters/sheets/latex/export/CMakeLists.txt index be9c94da3b1..e154a63c383 100644 --- a/filters/sheets/latex/export/CMakeLists.txt +++ b/filters/sheets/latex/export/CMakeLists.txt @@ -1,40 +1,38 @@ -add_definitions(-DQT3_SUPPORT -DQT3_SUPPORT_WARNINGS) - -include_directories(${CMAKE_SOURCE_DIR}/kspread ${KOMAIN_INCLUDES}) +include_directories(${KOMAIN_INCLUDES}) ########### next target ############### set(kspreadlatexexport_PART_SRCS cell.cc column.cc config.cc document.cc fileheader.cc format.cc - kspreadlatexexportdiaImpl.cc + latexexportdialog.cc latexexport.cc latexexportAdaptor.cc map.cc pen.cc row.cc spreadsheet.cc table.cc xmlparser.cc ) -kde4_add_ui3_files(kspreadlatexexport_PART_SRCS latexexportdia.ui ) +kde4_add_ui_files(kspreadlatexexport_PART_SRCS latexexportwidget.ui ) kde4_add_plugin(kspreadlatexexport ${kspreadlatexexport_PART_SRCS}) -target_link_libraries(kspreadlatexexport komain ${KDE4_KDE3SUPPORT_LIBS}) +target_link_libraries(kspreadlatexexport komain) install(TARGETS kspreadlatexexport DESTINATION ${PLUGIN_INSTALL_DIR}) ########### install files ############### install( FILES kspread_latex_export.desktop DESTINATION ${SERVICES_INSTALL_DIR}) diff --git a/filters/sheets/latex/export/kspreadlatexexportdiaImpl.cc b/filters/sheets/latex/export/kspreadlatexexportdiaImpl.cc deleted file mode 100644 index 1370f14a21f..00000000000 --- a/filters/sheets/latex/export/kspreadlatexexportdiaImpl.cc +++ /dev/null @@ -1,237 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2002, 2003 Robert JACOLIN - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - This file use code from koTemplateOpenDia for the method chooseSlot. -*/ - -#include - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "latexexportAdaptor.h" - -#include "document.h" - -/*#ifdef __FreeBSD__ -#include -#endif*/ - -/* - * Constructs a KSpreadLatexExportDiaImpl which is a child of 'parent', with the - * name 'name' and widget flags set to 'f'. - * - * The dialog will by default be modeless, unless you set 'modal' to - * true to construct a modal dialog. - */ -KSpreadLatexExportDiaImpl::KSpreadLatexExportDiaImpl(KoStore* in, QWidget* parent, - const char* name_, bool modal, Qt::WFlags fl) - : LatexExportDia(parent, name_, modal, fl), _in(in) -{ - int i = 0; - - kapp->restoreOverrideCursor(); - - /* Recent files */ - _config = new KConfig("kspreadlatexexportdialog"); - //_config->setGroup( "KSpread latex export filter" ); - QString value; - while (i < 10) { - /*value = _config->readPathEntry( QString("Recent%1").arg(i), QString() ); - kDebug(30522) <<"recent :" << value; - if(!value.isEmpty()) - { - _recentList.append( value ); - recentBox->insertItem(value); - } - else - i = 10;*/ - i = i + 1; - } - - new LatexExportAdaptor(this); - QDBusConnection::sessionBus().registerObject("/filter/latex", this); - - - /* All these items inserted must not be translated so they are inserted here - * without i18n() method. */ - /*qualityComboBox->insertItem("final"); - qualityComboBox->insertItem("draft");*/ - - classComboBox->addItem("article"); - classComboBox->addItem("book"); - classComboBox->addItem("letter"); - classComboBox->addItem("report"); - classComboBox->addItem("slides"); - - encodingComboBox->addItem("unicode"); - encodingComboBox->addItem("ansinew"); - encodingComboBox->addItem("applemac"); - encodingComboBox->addItem("ascii"); - encodingComboBox->addItem("latin1"); - encodingComboBox->addItem("latin2"); - encodingComboBox->addItem("latin3"); - encodingComboBox->addItem("latin5"); - encodingComboBox->addItem("cp437"); - encodingComboBox->addItem("cp437de"); - encodingComboBox->addItem("cp850"); - encodingComboBox->addItem("cp852"); - encodingComboBox->addItem("cp865"); - encodingComboBox->addItem("cp1250"); - encodingComboBox->addItem("cp1252"); - encodingComboBox->addItem("decmulti"); - encodingComboBox->addItem("next"); - - languagesList->insertItem("american"); - languagesList->insertItem("austrian"); - languagesList->insertItem("bahasa"); - languagesList->insertItem("brazil"); - languagesList->insertItem("breton"); - languagesList->insertItem("catalan"); - languagesList->insertItem("croatian"); - languagesList->insertItem("czech"); - languagesList->insertItem("danish"); - languagesList->insertItem("dutch"); - languagesList->insertItem("english"); - languagesList->insertItem("esperanto"); - languagesList->insertItem("finnish"); - languagesList->insertItem("francais"); - languagesList->insertItem("french"); - languagesList->insertItem("galician"); - languagesList->insertItem("german"); - languagesList->insertItem("germanb"); - languagesList->insertItem("hungarian"); - languagesList->insertItem("magyar"); - languagesList->insertItem("italian"); - languagesList->insertItem("norsk"); - languagesList->insertItem("nynorsk"); - languagesList->insertItem("polish"); - languagesList->insertItem("portuges"); - languagesList->insertItem("romanian"); - languagesList->insertItem("russian"); - languagesList->insertItem("spanish"); - languagesList->insertItem("slovak"); - languagesList->insertItem("slovene"); - languagesList->insertItem("swedish"); - languagesList->insertItem("turkish"); -} - -/* - * Destroys the object and frees any allocated resources - */ -KSpreadLatexExportDiaImpl::~KSpreadLatexExportDiaImpl() -{ - delete _config; -} - -/** - * Called when thecancel button is clicked. - * Close the dialog box. - */ -void KSpreadLatexExportDiaImpl::reject() -{ - kDebug(30522) << "Export cancelled"; - QDialog::reject(); -} - -/** - * Called when the user clic on the ok button. The xslt sheet is put on the recent list which is - * saved, then export the document. - */ -void KSpreadLatexExportDiaImpl::accept() -{ - hide(); - kDebug(30522) << "KSPREAD LATEX EXPORT FILTER --> BEGIN"; - Config* config = Config::instance(); - - /* Document tab */ - if (embededButton == typeGroup->selected()) - config->setEmbeded(true); - else - config->setEmbeded(false); - if (wordsStyleButton == styleGroup->selected()) - config->useWordsStyle(); - else - config-> useLatexStyle(); - /* class names are not translated */ - config->setClass(classComboBox->currentText()); - - if (qualityComboBox->currentIndex() == 0) - config->setQuality("final"); - else - config->setQuality("draft"); - config->setDefaultFontSize(defaultFontSize->value()); - - /* Pictures tab */ - if (pictureCheckBox->isChecked()) - config->convertPictures(); - config->setPicturesDir(pathPictures->url().path()); - - /* Language tab */ - config->setEncoding(encodingComboBox->currentText()); - for (unsigned int index = 0; index < langUsedList->count(); index++) { - kDebug(30522) << "lang. :" << langUsedList->item(index)->text(); - config->addLanguage(langUsedList->item(index)->text()); - } - - /* The default language is the first language in the list */ - if (langUsedList->item(0) != NULL) - config->setDefaultLanguage(langUsedList->item(0)->text()); - if (!(langUsedList->currentText().isEmpty())) { - kDebug(30522) << "default lang. :" << langUsedList->currentText(); - config->setDefaultLanguage(langUsedList->currentText()); - } - - Document doc(_in, _fileOut); - kDebug(30522) << "---------- analyze file -------------"; - doc.analyze(); - kDebug(30522) << "---------- generate file -------------"; - doc.generate(); - kDebug(30522) << "KSPREAD LATEX EXPORT FILTER --> END"; -} - -void KSpreadLatexExportDiaImpl::addLanguage() -{ - kDebug(30522) << "add a new supported language" << languagesList->currentText(); - QString text = languagesList->currentText(); - languagesList->removeItem(languagesList->currentItem()); - langUsedList->insertItem(text); -} - -void KSpreadLatexExportDiaImpl::removeLanguage() -{ - kDebug(30522) << "remove a language" << langUsedList->currentText(); - QString text = langUsedList->currentText(); - langUsedList->removeItem(langUsedList->currentItem()); - languagesList->insertItem(text); -} - -#include diff --git a/filters/sheets/latex/export/latexexport.cc b/filters/sheets/latex/export/latexexport.cc index 3ebd52d19e5..61b61638370 100644 --- a/filters/sheets/latex/export/latexexport.cc +++ b/filters/sheets/latex/export/latexexport.cc @@ -1,66 +1,65 @@ /* This file is part of the KDE project Copyright (C) 1998, 1999 Reginald Stadlbauer This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ -#include -#include +#include "latexexportdialog.h" +#include "latexexport.h" +// KDE #include #include #include -#include -#include -#include -//Added by qt3to4: +// Qt #include -#include "kspreadlatexexportdiaImpl.h" K_PLUGIN_FACTORY(LATEXExportFactory, registerPlugin();) K_EXPORT_PLUGIN(LATEXExportFactory("calligrafilters")) LATEXExport::LATEXExport(QObject* parent, const QVariantList&) : KoFilter(parent) { } KoFilter::ConversionStatus LATEXExport::convert(const QByteArray& from, const QByteArray& to) { QString config; if (to != "text/x-tex" || from != "application/x-kspread") return KoFilter::NotImplemented; KoStore* in = KoStore::createStore(m_chain->inputFile(), KoStore::Read); if (!in || !in->open("root")) { kError(30503) << "Unable to open input file!" << endl; delete in; return KoFilter::FileNotFound; } kDebug(30522) << "In the kspread latex export filter..."; /* input file Reading */ in->close(); - KSpreadLatexExportDiaImpl* dialog = new KSpreadLatexExportDiaImpl(in); + LatexExportDialog* dialog = new LatexExportDialog(in); dialog->setOutputFile(m_chain->outputFile()); dialog->exec(); delete dialog; delete in; return KoFilter::OK; } + +#include diff --git a/filters/sheets/latex/export/latexexportAdaptor.cc b/filters/sheets/latex/export/latexexportAdaptor.cc index 3cc3a622c7f..4c1b8449d37 100644 --- a/filters/sheets/latex/export/latexexportAdaptor.cc +++ b/filters/sheets/latex/export/latexexportAdaptor.cc @@ -1,42 +1,42 @@ /* This file is part of the KDE project Copyright (C) 2003 Robert JACOLIN Copyright (C) 2006 Fredrik Edemar This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. This file use code from koTemplateOpenDia for the method chooseSlot. */ #include -#include "kspreadlatexexportdiaImpl.h" +#include "latexexportdialog.h" -LatexExportAdaptor::LatexExportAdaptor(KSpreadLatexExportDiaImpl* dia) +LatexExportAdaptor::LatexExportAdaptor(LatexExportDialog* dia) : QDBusAbstractAdaptor(dia) { // constructor setAutoRelaySignals(true); _dialog = dia; } LatexExportAdaptor::~LatexExportAdaptor() { } void LatexExportAdaptor::useDefaultConfig() { _dialog->accept(); } #include "latexexportAdaptor.moc" diff --git a/filters/sheets/latex/export/latexexportAdaptor.h b/filters/sheets/latex/export/latexexportAdaptor.h index 4ad632f0a92..428bba612ca 100644 --- a/filters/sheets/latex/export/latexexportAdaptor.h +++ b/filters/sheets/latex/export/latexexportAdaptor.h @@ -1,46 +1,46 @@ /* This file is part of the KDE project Copyright (C) 2003 Robert JACOLIN Copyright (C) 2006 Fredrik Edemar This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef __LATEXEXPORTADAPTOR_H__ #define __LATEXEXPORTADAPTOR_H__ #include #include -class KSpreadLatexExportDiaImpl; +class LatexExportDialog; class LatexExportAdaptor: public QDBusAbstractAdaptor { Q_OBJECT Q_CLASSINFO("D-Bus Interface", "org.kde.calligra.filter.kspread.latex") public: - LatexExportAdaptor(KSpreadLatexExportDiaImpl* dia); + LatexExportAdaptor(LatexExportDialog* dialog); ~LatexExportAdaptor(); public Q_SLOTS: // METHODS Q_SCRIPTABLE void useDefaultConfig(); private: - KSpreadLatexExportDiaImpl* _dialog; + LatexExportDialog* _dialog; }; #endif /* __LATEXEXPORTADAPTOR_H__ */ diff --git a/filters/sheets/latex/export/latexexportdia.ui b/filters/sheets/latex/export/latexexportdia.ui deleted file mode 100644 index 3f91f786004..00000000000 --- a/filters/sheets/latex/export/latexexportdia.ui +++ /dev/null @@ -1,676 +0,0 @@ - -LatexExportDia -This dialog box is used for all latex filter in calligra. -Robert Jacolin <rjacolin@ifrance.com> - - - LatexExportDia - - - - 0 - 0 - 471 - 364 - - - - Latex Export Filter Configuration - - - true - - - - unnamed - - - 11 - - - 6 - - - - _tab - - - true - - - - Widget2 - - - Document - - - - defaultFontSize - - - - 241 - 236 - 125 - 29 - - - - 12 - - - 0 - - - 1000 - - - - - styleGroup - - - - 13 - 9 - 378 - 73 - - - - Document Style - - - - wordsStyleButton - - - - 11 - 43 - 354 - 23 - - - - Words style - - - true - - - - - latexStyleButton - - - - 11 - 20 - 354 - 23 - - - - Latex style - - - - - - typeGroup - - - - 12 - 86 - 378 - 75 - - - - Document Type - - - - fullDocButton - - - - 14 - 21 - 349 - 23 - - - - Independent document - - - true - - - The document will be able to be compiled alone - - - The document will be generated as a full latex document since all the include will be generated before the \begin[document} and \end{document} commands. - - - - - embededButton - - - - 14 - 45 - 351 - 23 - - - - Document to include - - - Do not generate either the latex header or the document environment - - - The document will be generated as a latex document which will have to be included in a main latex document. It will allow you to generate several little files for each chapter of your document. - - - - - - TextLabel1_2 - - - - 38 - 174 - 187 - 18 - - - - Document class: - - - - - TextLabel2 - - - - 39 - 208 - 186 - 18 - - - - Quality: - - - - - defaultFontSizeTextZone - - - - 39 - 241 - 186 - 18 - - - - Default font size: - - - - - classComboBox - - - - 240 - 168 - 125 - 27 - - - - - - - Final - - - - - Draft - - - - qualityComboBox - - - - 241 - 201 - 125 - 28 - - - - - - - Widget3 - - - Pictures - - - - pathPictures - - - - 22 - 80 - 263 - 42 - - - - - - pictureCheckBox - - - - 21 - 21 - 262 - 23 - - - - Convert the pictures - - - true - - - - - TextLabel1 - - - - 24 - 58 - 255 - 18 - - - - Pictures directory: - - - - - - tab - - - Language - - - - ButtonGroup3 - - - - 18 - 17 - 359 - 73 - - - - Encoding - - - - encodingComboBox - - - - 25 - 31 - 157 - 26 - - - - - - - GroupBox4 - - - true - - - - 19 - 102 - 359 - 150 - - - - Language - - - - rmLanguageBtn - - - - 147 - 83 - 92 - 29 - - - - Remove - - - - - addLanguageBtn - - - - 147 - 48 - 92 - 29 - - - - Add - - - - - langUsedList - - - - 246 - 30 - 96 - 101 - - - - - - languagesList - - - - 16 - 30 - 122 - 105 - - - - - - - - tab - - - Contents - - - - exportAuthor - - - false - - - - 26 - 14 - 376 - 29 - - - - Export information about author - - - false - - - - - tableContents - - - false - - - - 26 - 49 - 377 - 39 - - - - Add a table of content - - - - - note - - - false - - - - 20 - 91 - 272 - 103 - - - - Notes - - - - RadioButton7 - - - - 16 - 19 - 251 - 23 - - - - Don't export - - - - - RadioButton6 - - - - 17 - 64 - 251 - 23 - - - - Export notes in comments - - - - - RadioButton5 - - - - 17 - 40 - 248 - 23 - - - - Export notes in margin notes - - - - - - - - Layout1 - - - - unnamed - - - 0 - - - 6 - - - - buttonHelp - - - &Help - - - F1 - - - true - - - - - Horizontal Spacing - - - Qt::Horizontal - - - Expanding - - - - 20 - 0 - - - - - - buttonOk - - - &OK - - - true - - - true - - - - - buttonCancel - - - &Cancel - - - true - - - - - - - - - buttonOk - clicked() - LatexExportDia - accept() - - - buttonCancel - clicked() - LatexExportDia - reject() - - - addLanguageBtn - clicked() - LatexExportDia - addLanguage() - - - rmLanguageBtn - clicked() - LatexExportDia - removeLanguage() - - - - addLanguage() - removeLanguage() - - - - - KIntNumInput -
knuminput.h
- 0 -
-
- - knuminput.h - kcombobox.h - kurlrequester.h - klineedit.h - kpushbutton.h - kcombobox.h - k3listbox.h - -
diff --git a/filters/sheets/latex/export/latexexportdialog.cc b/filters/sheets/latex/export/latexexportdialog.cc new file mode 100644 index 00000000000..0fce5cfc5b0 --- /dev/null +++ b/filters/sheets/latex/export/latexexportdialog.cc @@ -0,0 +1,256 @@ +/* This file is part of the KDE project + Copyright (C) 2002, 2003 Robert JACOLIN + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + This file use code from koTemplateOpenDia for the method chooseSlot. +*/ + +#include "latexexportdialog.h" + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "latexexportAdaptor.h" + +#include "document.h" + +/*#ifdef __FreeBSD__ +#include +#endif*/ + +/* + * Constructs a LatexExportDialog which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + * + * The dialog will by default be modeless, unless you set 'modal' to + * true to construct a modal dialog. + */ +LatexExportDialog::LatexExportDialog(KoStore* inputStore, QWidget* parent) + : KDialog(parent) + , m_inputStore(inputStore) +{ + QWidget *mainWidget = new QWidget(); + m_ui.setupUi(mainWidget); + + int i = 0; + + kapp->restoreOverrideCursor(); + + /* Recent files */ + m_config = new KConfig("kspreadlatexexportdialog"); + //m_config->setGroup( "KSpread latex export filter" ); + QString value; + while (i < 10) { + /*value = m_config->readPathEntry( QString("Recent%1").arg(i), QString() ); + kDebug(30522) <<"recent :" << value; + if(!value.isEmpty()) + { + _recentList.append( value ); + recentBox->addItem(value); + } + else + i = 10;*/ + i = i + 1; + } + + new LatexExportAdaptor(this); + QDBusConnection::sessionBus().registerObject("/filter/latex", this); + + + /* All these items inserted must not be translated so they are inserted here + * without i18n() method. */ + /*qualityComboBox->addItem("final"); + qualityComboBox->addItem("draft");*/ + + KComboBox* classComboBox = m_ui.classComboBox; + classComboBox->addItem("article"); + classComboBox->addItem("book"); + classComboBox->addItem("letter"); + classComboBox->addItem("report"); + classComboBox->addItem("slides"); + + KComboBox* encodingComboBox = m_ui.encodingComboBox; + encodingComboBox->addItem("unicode"); + encodingComboBox->addItem("ansinew"); + encodingComboBox->addItem("applemac"); + encodingComboBox->addItem("ascii"); + encodingComboBox->addItem("latin1"); + encodingComboBox->addItem("latin2"); + encodingComboBox->addItem("latin3"); + encodingComboBox->addItem("latin5"); + encodingComboBox->addItem("cp437"); + encodingComboBox->addItem("cp437de"); + encodingComboBox->addItem("cp850"); + encodingComboBox->addItem("cp852"); + encodingComboBox->addItem("cp865"); + encodingComboBox->addItem("cp1250"); + encodingComboBox->addItem("cp1252"); + encodingComboBox->addItem("decmulti"); + encodingComboBox->addItem("next"); + + KListWidget* languagesList = m_ui.languagesList; + languagesList->addItem("american"); + languagesList->addItem("austrian"); + languagesList->addItem("bahasa"); + languagesList->addItem("brazil"); + languagesList->addItem("breton"); + languagesList->addItem("catalan"); + languagesList->addItem("croatian"); + languagesList->addItem("czech"); + languagesList->addItem("danish"); + languagesList->addItem("dutch"); + languagesList->addItem("english"); + languagesList->addItem("esperanto"); + languagesList->addItem("finnish"); + languagesList->addItem("francais"); + languagesList->addItem("french"); + languagesList->addItem("galician"); + languagesList->addItem("german"); + languagesList->addItem("germanb"); + languagesList->addItem("hungarian"); + languagesList->addItem("magyar"); + languagesList->addItem("italian"); + languagesList->addItem("norsk"); + languagesList->addItem("nynorsk"); + languagesList->addItem("polish"); + languagesList->addItem("portuges"); + languagesList->addItem("romanian"); + languagesList->addItem("russian"); + languagesList->addItem("spanish"); + languagesList->addItem("slovak"); + languagesList->addItem("slovene"); + languagesList->addItem("swedish"); + languagesList->addItem("turkish"); + + connect(m_ui.addLanguageBtn, SIGNAL(clicked(bool)), SLOT(addLanguage())); + connect(m_ui.rmLanguageBtn, SIGNAL(clicked(bool)), SLOT(removeLanguage())); + + setMainWidget(mainWidget); + + setButtons(Ok | Cancel); + setDefaultButton(Ok); + setModal(true); + setCaption(i18n("Latex Export Filter Configuration")); +} + +/* + * Destroys the object and frees any allocated resources + */ +LatexExportDialog::~LatexExportDialog() +{ + delete m_config; +} + +/** + * Called when the cancel button is clicked. + * Close the dialog box. + */ +void LatexExportDialog::reject() +{ + kDebug(30522) << "Export cancelled"; + QDialog::reject(); +} + +/** + * Called when the user clicks on the ok button. The xslt sheet is put on the recent list which is + * saved, then export the document. + */ +void LatexExportDialog::accept() +{ + hide(); + kDebug(30522) << "KSPREAD LATEX EXPORT FILTER --> BEGIN"; + Config* config = Config::instance(); + + /* Document tab */ + config->setEmbeded(m_ui.embededButton->isChecked()); + if (m_ui.wordsStyleButton->isChecked()) + config->useWordsStyle(); + else + config-> useLatexStyle(); + /* class names are not translated */ + config->setClass(m_ui.classComboBox->currentText()); + + if (m_ui.qualityComboBox->currentIndex() == 0) + config->setQuality("final"); + else + config->setQuality("draft"); + config->setDefaultFontSize(m_ui.defaultFontSize->value()); + + /* Pictures tab */ + if (m_ui.pictureCheckBox->isChecked()) + config->convertPictures(); + config->setPicturesDir(m_ui.pathPictures->url().path()); + + /* Language tab */ + config->setEncoding(m_ui.encodingComboBox->currentText()); + KListWidget* langUsedList = m_ui.langUsedList; + for (int index = 0; index < langUsedList->count(); ++index) { + kDebug(30522) << "lang. :" << langUsedList->item(index)->text(); + config->addLanguage(langUsedList->item(index)->text()); + } + + /* The default language is the first language in the list */ + if (langUsedList->item(0) != NULL) + config->setDefaultLanguage(langUsedList->item(0)->text()); + if (langUsedList->currentItem() != NULL) { + const QString currentLanguage = langUsedList->currentItem()->text(); + kDebug(30522) << "default lang. :" << currentLanguage; + config->setDefaultLanguage(currentLanguage); + } + + Document doc(m_inputStore, m_fileOut); +// kDebug(30522) << "---------- analyze file -------------"; + doc.analyze(); +// kDebug(30522) << "---------- generate file -------------"; + doc.generate(); +// kDebug(30522) << "KSPREAD LATEX EXPORT FILTER --> END"; +} + +void LatexExportDialog::addLanguage() +{ + QListWidgetItem* currentItem = m_ui.languagesList->takeItem(m_ui.languagesList->currentRow()); + if (! currentItem) { + return; + } + const QString text = currentItem->text(); + kDebug(30522) << "add a new supported language" << text; + m_ui.langUsedList->addItem(text); + delete currentItem; +} + +void LatexExportDialog::removeLanguage() +{ + QListWidgetItem* currentItem = m_ui.langUsedList->takeItem(m_ui.langUsedList->currentRow()); + if (! currentItem) { + return; + } + const QString text = currentItem->text(); + kDebug(30522) << "remove a language" << text; + m_ui.languagesList->addItem(text); + delete currentItem; +} + +#include diff --git a/filters/sheets/latex/export/kspreadlatexexportdiaImpl.h b/filters/sheets/latex/export/latexexportdialog.h similarity index 65% rename from filters/sheets/latex/export/kspreadlatexexportdiaImpl.h rename to filters/sheets/latex/export/latexexportdialog.h index 93852fd306d..da432512e02 100644 --- a/filters/sheets/latex/export/kspreadlatexexportdiaImpl.h +++ b/filters/sheets/latex/export/latexexportdialog.h @@ -1,56 +1,61 @@ /* This file is part of the KDE project Copyright (C) 2002, 2003 Robert JACOLIN This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ -#ifndef __KSPREADLATEXEXPORTDIA_H__ -#define __KSPREADLATEXEXPORTDIA_H__ +#ifndef __LATEXEXPORTDIALOG_H__ +#define __LATEXEXPORTDIALOG_H__ -#include +#include + +// KDE +#include +#include +// Qt #include -#include class KoStore; class KConfig; -class KSpreadLatexExportDiaImpl : public LatexExportDia +class LatexExportDialog : public KDialog { Q_OBJECT -private: - QString _fileOut; - KoStore* _in; - KConfig* _config; - public: - explicit KSpreadLatexExportDiaImpl(KoStore*, QWidget* parent = 0, - const char* name = 0, - bool modal = false, Qt::WFlags fl = 0); - virtual ~KSpreadLatexExportDiaImpl(); + explicit LatexExportDialog(KoStore*, QWidget* parent = 0); + virtual ~LatexExportDialog(); - void setOutputFile(QString file) { - _fileOut = file; + void setOutputFile(const QString& file) { + m_fileOut = file; } public slots: virtual void reject(); virtual void accept(); virtual void addLanguage(); virtual void removeLanguage(); + +private: + Ui::LatexExportWidget m_ui; + + QString m_fileOut; + KoStore* m_inputStore; + KConfig* m_config; + }; -#endif /* __KSPREADLATEXEXPORTDIA_H__ */ +#endif /* __LATEXEXPORTDIALOG_H__ */ diff --git a/filters/sheets/latex/export/latexexportwidget.ui b/filters/sheets/latex/export/latexexportwidget.ui new file mode 100644 index 00000000000..f9dbc7d7ffe --- /dev/null +++ b/filters/sheets/latex/export/latexexportwidget.ui @@ -0,0 +1,413 @@ + + + LatexExportWidget + + + + 0 + 0 + 400 + 388 + + + + Form + + + + + + true + + + 0 + + + + Document + + + + + + + + Document Style + + + + + + Latex style + + + + + + + Words style + + + true + + + + + + + + + + Document Type + + + + + + The document will be able to be compiled alone + + + The document will be generated as a full latex document since all the include will be generated before the \begin[document} and \end{document} commands. + + + Independent document + + + true + + + + + + + Do not generate either the latex header or the document environment + + + The document will be generated as a latex document which will have to be included in a main latex document. It will allow you to generate several little files for each chapter of your document. + + + Document to include + + + + + + + + + + + + Document class: + + + false + + + + + + + + + + Quality: + + + false + + + + + + + + Final + + + + + Draft + + + + + + + + Default font size: + + + false + + + + + + + 12 + + + 0 + + + 1000 + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + Pictures + + + + + + Convert the pictures: + + + + + + + + + + true + + + + + + + Pictures directory: + + + false + + + + + + + + + + + Language + + + + + + Encoding + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + Language + + + + + + + + true + + + + + + + + + Add + + + + + + + Remove + + + + + + + + + true + + + + + + + + + + + + + false + + + Contents + + + + + + + + Export information about author: + + + + + + + false + + + + + + false + + + + + + + Add a table of content: + + + + + + + false + + + + + + + + + + + + Notes + + + + + + Don't export + + + + + + + Export notes in margin notes + + + + + + + Export notes in comments + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + + KComboBox + QComboBox +
kcombobox.h
+
+ + KListWidget + QListWidget +
klistwidget.h
+
+ + KUrlRequester + QFrame +
kurlrequester.h
+
+ + KIntNumInput + QWidget +
knuminput.h
+
+
+ + +
diff --git a/sheets/CMakeLists.txt b/sheets/CMakeLists.txt index 3dc10137d6d..9f96e41389b 100644 --- a/sheets/CMakeLists.txt +++ b/sheets/CMakeLists.txt @@ -1,397 +1,396 @@ project(calligra-sheets) add_subdirectory( data ) add_subdirectory( shape ) add_subdirectory( tests ) add_subdirectory( plugins ) add_subdirectory( dtd ) add_subdirectory( functions ) #add_definitions(-DCALLIGRA_SHEETS_MT) include_directories( ${CMAKE_SOURCE_DIR}/interfaces ${KOMAIN_INCLUDES} ${KOTEXT_INCLUDES} ${TEXTLAYOUT_INCLUDES} ${Boost_INCLUDE_DIR} ${EIGEN2_INCLUDE_DIR} ) ########### next target ############### SET (chart_DIR_SRCS chart/ChartDatabaseSelectorFactory.cpp chart/ChartDatabaseSelector.cpp chart/ChartDialog.cpp ) kde4_add_ui_files(chart_DIR_SRCS chart/ChartDatabaseSelector.ui ) SET (commands_DIR_SRCS commands/AbstractRegionCommand.cpp commands/ApplyFilterCommand.cpp commands/AutoFillCommand.cpp commands/AutoFilterCommand.cpp commands/AutoFormatCommand.cpp commands/BorderColorCommand.cpp commands/CommentCommand.cpp commands/ConditionCommand.cpp commands/CopyCommand.cpp commands/CSVDataCommand.cpp commands/DataManipulators.cpp commands/DeleteCommand.cpp commands/IndentationCommand.cpp commands/LinkCommand.cpp commands/MergeCommand.cpp commands/NamedAreaCommand.cpp commands/PageBreakCommand.cpp commands/PasteCommand.cpp commands/PrecisionCommand.cpp commands/RowColumnManipulators.cpp commands/SheetCommands.cpp commands/SortManipulator.cpp commands/SpellCheckCommand.cpp commands/StyleCommand.cpp commands/ValidityCommand.cpp ) SET (database_DIR_SRCS #database/Database.cpp #database/DatabaseManager.cpp database/DatabaseSource.cpp database/DatabaseSourceQuery.cpp database/DatabaseSourceSql.cpp database/DatabaseSourceTable.cpp #database/Filter.cpp database/FilterPopup.cpp ) SET (dialogs_DIR_SRCS dialogs/AddNamedAreaDialog.cpp dialogs/AngleDialog.cpp dialogs/AutoFormatDialog.cpp dialogs/CharacterSelectDialog.cpp dialogs/CommentDialog.cpp dialogs/ConditionalDialog.cpp dialogs/ConsolidateDialog.cpp dialogs/CSVDialog.cpp dialogs/DatabaseDialog.cpp dialogs/DocumentSettingsDialog.cpp dialogs/FindDialog.cpp dialogs/FormulaDialog.cpp dialogs/GoalSeekDialog.cpp dialogs/GotoDialog.cpp dialogs/InsertDialog.cpp dialogs/LayoutDialog.cpp dialogs/LinkDialog.cpp dialogs/ListDialog.cpp dialogs/NamedAreaDialog.cpp dialogs/PasteInsertDialog.cpp dialogs/Resize2Dialog.cpp dialogs/SeriesDialog.cpp dialogs/ShowDialog.cpp dialogs/ShowColRowDialog.cpp dialogs/SortDialog.cpp dialogs/SpecialPasteDialog.cpp dialogs/StyleManagerDialog.cpp dialogs/SubtotalDialog.cpp dialogs/ValidityDialog.cpp ) kde4_add_ui_files(dialogs_DIR_SRCS dialogs/ConsolidateWidget.ui dialogs/ConsolidateDetailsWidget.ui dialogs/FontWidget.ui dialogs/GoalSeekWidget.ui dialogs/PositionWidget.ui dialogs/ProtectionWidget.ui dialogs/SpecialPasteWidget.ui dialogs/SortWidget.ui dialogs/SortDetailsWidget.ui dialogs/SubtotalWidget.ui dialogs/SubtotalsDetailsWidget.ui ) SET (functions_DIR_SRCS functions/helper.cpp ) SET (interfaces_DIR_SRCS interfaces/MapAdaptor.cpp interfaces/SheetAdaptor.cpp interfaces/ViewAdaptor.cpp ) SET (part_DIR_SRCS part/CanvasBase.cpp part/Canvas.cpp part/CanvasItem.cpp part/CellTool.cpp part/CellToolFactory.cpp #part/Digest.cpp part/Doc.cpp part/Part.cpp part/Factory.cpp part/Find.cpp part/Headers.cpp part/HeaderWidgets.cpp part/HeaderItems.cpp part/PrintJob.cpp part/ToolRegistry.cpp part/TabBar.cpp part/View.cpp part/commands/DefinePrintRangeCommand.cpp part/commands/PageLayoutCommand.cpp part/dialogs/PageLayoutDialog.cpp part/dialogs/PreferenceDialog.cpp part/dialogs/SheetPropertiesDialog.cpp part/dialogs/SheetSelectPage.cpp ) kde4_add_ui_files(part_DIR_SRCS part/dialogs/FileOptionsWidget.ui part/dialogs/InterfaceOptionsWidget.ui part/dialogs/PageLayoutSheetPage.ui part/dialogs/SheetPropertiesWidget.ui part/dialogs/SheetSelectWidget.ui ) SET (ui_DIR_SRCS ui/AbstractSelectionStrategy.cpp ui/ActionOptionWidget.cpp ui/AutoFillStrategy.cpp ui/CellEditorBase.cpp ui/CellEditor.cpp ui/CellEditorDocker.cpp ui/CellToolBase.cpp ui/CellToolBase_p.cpp ui/CellView.cpp ui/DragAndDropStrategy.cpp ui/FormulaEditorHighlighter.cpp ui/FunctionCompletion.cpp ui/ExternalEditor.cpp ui/HyperlinkStrategy.cpp ui/LocationComboBox.cpp ui/MapViewModel.cpp ui/MergeStrategy.cpp ui/PasteStrategy.cpp ui/PixmapCachingSheetView.cpp ui/RegionSelector.cpp ui/RightToLeftPaintingStrategy.cpp ui/Selection.cpp ui/SelectionStrategy.cpp ui/SheetView.cpp ) SET (calligrasheetscommon_LIB_SRCS MapModel.cpp PageManager.cpp RegionModel.cpp tests/inspector.cpp ${chart_DIR_SRCS} ${commands_DIR_SRCS} ${database_DIR_SRCS} ${dialogs_DIR_SRCS} ${functions_DIR_SRCS} ${interfaces_DIR_SRCS} ${part_DIR_SRCS} ${ui_DIR_SRCS} ) set (calligrasheetsodf_LIB_SRCS part/Digest.cpp ApplicationSettings.cpp Binding.cpp BindingManager.cpp CalculationSettings.cpp Cell.cpp CellStorage.cpp Cluster.cpp Condition.cpp Currency.cpp Damages.cpp DependencyManager.cpp DocBase.cpp Format.cpp Formula.cpp GenValidationStyle.cpp HeaderFooter.cpp Localization.cpp Map.cpp NamedAreaManager.cpp Number.cpp PrintSettings.cpp ProtectableObject.cpp RecalcManager.cpp RectStorage.cpp Region.cpp RowColumnFormat.cpp RowFormatStorage.cpp RowRepeatStorage.cpp ShapeApplicationData.cpp Sheet.cpp SheetAccessModel.cpp SheetModel.cpp Style.cpp StyleManager.cpp StyleStorage.cpp Util.cpp Validity.cpp Value.cpp ValueCalc.cpp ValueConverter.cpp ValueFormatter.cpp ValueParser.cpp database/Database.cpp database/DatabaseManager.cpp database/Filter.cpp # TODO: move the formula evaluation out of Formula.cpp so these files can move out of libcalligrasheetsodf Function.cpp FunctionDescription.cpp FunctionModule.cpp FunctionModuleRegistry.cpp FunctionRepository.cpp # TODO: move HeaderFooter from SheetPrint to PrintSettings, and replace SheetPrint with PrintSettings in Sheet to get rid of this dependency SheetPrint.cpp SheetPrint_p.cpp ) kde4_add_library(calligrasheetsodf SHARED ${calligrasheetsodf_LIB_SRCS}) target_link_libraries(calligrasheetsodf komain) target_link_libraries(calligrasheetsodf LINK_INTERFACE_LIBRARIES komain) set_target_properties(calligrasheetsodf PROPERTIES VERSION ${GENERIC_CALLIGRA_LIB_VERSION} SOVERSION ${GENERIC_CALLIGRA_LIB_SOVERSION} ) install(TARGETS calligrasheetsodf ${INSTALL_TARGETS_DEFAULT_ARGS}) kde4_add_library(calligrasheetscommon SHARED ${calligrasheetscommon_LIB_SRCS}) target_link_libraries(calligrasheetscommon komain calligrasheetsodf ${QT_QTSQL_LIBRARY} ${KDE4_KNOTIFYCONFIG_LIBS} ${KDE4_THREADWEAVER_LIBS} -# ${KDE4_KDE3SUPPORT_LIBS} ) if(KDE4_KCMUTILS_LIBS) target_link_libraries(calligrasheetscommon ${KDE4_KCMUTILS_LIBS} ) else() target_link_libraries(calligrasheetscommon ${KDE4_KUTILS_LIBS} ) endif() target_link_libraries(calligrasheetscommon LINK_INTERFACE_LIBRARIES komain calligrasheetsodf ) set_target_properties(calligrasheetscommon PROPERTIES VERSION ${GENERIC_CALLIGRA_LIB_VERSION} SOVERSION ${GENERIC_CALLIGRA_LIB_SOVERSION} ) install(TARGETS calligrasheetscommon ${INSTALL_TARGETS_DEFAULT_ARGS}) ########### next target ############### SET (calligrasheetspart_PART_SRCS part/Factory_init.cpp ) kde4_add_plugin(calligrasheetspart ${calligrasheetspart_PART_SRCS}) target_link_libraries(calligrasheetspart calligrasheetscommon ) install(TARGETS calligrasheetspart DESTINATION ${PLUGIN_INSTALL_DIR}) ########### next target ############### SET (calligrasheets_KDEINIT_SRCS part/Main.cpp ) kde4_add_app_icon(calligrasheets_KDEINIT_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/data/pics/hi*-app-calligrasheets.png") kde4_add_kdeinit_executable( calligrasheets ${calligrasheets_KDEINIT_SRCS}) if (Q_WS_MAC) set_target_properties(calligrasheets PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist.template) set_target_properties(calligrasheets PROPERTIES MACOSX_BUNDLE_GUI_IDENTIFIER "org.calligra.sheets") set_target_properties(calligrasheets PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Calligra Sheets 2") endif (Q_WS_MAC) target_link_libraries(kdeinit_calligrasheets komain ) install(TARGETS kdeinit_calligrasheets ${INSTALL_TARGETS_DEFAULT_ARGS}) target_link_libraries( calligrasheets kdeinit_calligrasheets ) install(TARGETS calligrasheets ${INSTALL_TARGETS_DEFAULT_ARGS}) ########### install files ############### install( FILES sheets.rc sheets_readonly.rc DESTINATION ${DATA_INSTALL_DIR}/sheets) install( FILES ui/CellToolOptionWidgets.xml DESTINATION ${DATA_INSTALL_DIR}/sheets) install( FILES sheetspart.desktop DESTINATION ${SERVICES_INSTALL_DIR}) install( PROGRAMS sheets.desktop DESTINATION ${XDG_APPS_INSTALL_DIR}) install( FILES sheets.kcfg DESTINATION ${KCFG_INSTALL_DIR} ) install( FILES sheets_plugin.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR}) install( FILES sheetsrc DESTINATION ${CONFIG_INSTALL_DIR}) install( FILES calligra_sheets_export.h calligra_sheets_limits.h Cell.h CellStorage.h Condition.h Currency.h DocBase.h Format.h Global.h Map.h Number.h OdfLoadingContext.h PointStorage.h PrintSettings.h ProtectableObject.h RectStorage.h Region.h RowColumnFormat.h RowFormatStorage.h RTree.h Sheet.h Style.h Value.h ValueCalc.h ValueConverter.h ValueStorage.h DESTINATION ${INCLUDE_INSTALL_DIR}/sheets COMPONENT Devel) install( FILES part/CanvasBase.h part/CanvasItem.h part/CellTool.h part/Doc.h part/Part.h part/Find.h part/HeaderItems.h part/Headers.h part/ToolRegistry.h part/View.h DESTINATION ${INCLUDE_INSTALL_DIR}/sheets/part COMPONENT Devel) install( FILES ui/CellToolBase.h ui/CellEditorBase.h ui/Selection.h ui/SheetView.h DESTINATION ${INCLUDE_INSTALL_DIR}/sheets/ui COMPONENT Devel) install( FILES database/Database.h database/Filter.h DESTINATION ${INCLUDE_INSTALL_DIR}/sheets/database COMPONENT Devel) install( FILES commands/AbstractRegionCommand.h commands/DataManipulators.h commands/SortManipulator.h DESTINATION ${INCLUDE_INSTALL_DIR}/sheets/commands COMPONENT Devel)