Back to index

scribus-ng  1.3.4.dfsg+svn20071115
gtgettext.h
Go to the documentation of this file.
00001 /*
00002 For general Scribus (>=1.3.2) copyright and licensing information please refer
00003 to the COPYING file provided with the program. Following this notice may exist
00004 a copyright and/or license notice that predates the release of Scribus 1.3.2
00005 for which a new license (GPL+exception) is in place.
00006 */
00007 /***************************************************************************
00008  *   Copyright (C) 2004 by Riku Leino                                      *
00009  *   tsoots@gmail.com                                                      *
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  *   This program is distributed in the hope that it will be useful,       *
00017  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00018  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00019  *   GNU General Public License for more details.                          *
00020  *                                                                         *
00021  *   You should have received a copy of the GNU General Public License     *
00022  *   along with this program; if not, write to the                         *
00023  *   Free Software Foundation, Inc.,                                       *
00024  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00025  ***************************************************************************/
00026 
00027 #ifndef GTGETTEXT_H
00028 #define GTGETTEXT_H
00029 
00030 #include <iostream>
00031 #include <vector>
00032 
00033 #include <qdir.h>
00034 #include <qmap.h>
00035 #include <qobject.h>
00036 #include <qstring.h>
00037 #include <qstringlist.h>
00038 
00039 #include "scconfig.h"
00040 #include "scribusapi.h"
00041 #include "gtdialogs.h"
00042 #include "gtwriter.h"
00043 #include "scfonts.h"
00044 
00045 class PageItem;
00046 class ScribusDoc;
00047 
00048 struct ImporterData {
00049        QString     soFilePath;
00050        QString     fileFormatName;
00051        QStringList fileEndings;
00052 };
00053 
00054 struct ImportSetup {
00055        bool runDialog;
00056        int importer;
00057        QString filename;
00058        bool textOnly;
00059        QString encoding;
00060 };
00061 
00062 /*
00063        GetText handles the open file dialog and importer plugins loading and launching.
00064 */
00065 class SCRIBUS_API gtGetText
00066 {
00067 private:
00068        std::vector<ImporterData> importers;
00069        QMap<QString, ImporterData*> importerMap; // map ImporterDatas to file endings for easy launc for desired plugin
00070        void loadImporterPlugins();
00071        void CallDLL(const ImporterData& idata, const QString& filePath,
00072                     const QString& encoding, bool textOnly, bool append, PageItem* importItem);
00073        bool DLLName(QString name, QString *ffName, QStringList *fileEndings);
00074        void createMap();
00075        gtDialogs* dias;
00076        QStringList ilist;
00077        ScribusDoc* m_Doc;
00078 public:
00079        gtGetText(ScribusDoc* doc);
00080        ~gtGetText();
00081        ImportSetup run();
00082        void launchImporter(int importer, const QString& filename, bool textOnly, const QString& encoding, bool append, PageItem* target=0);
00083 };
00084 
00085 #endif