r20671 by fschmid -

scribus-commit scribus-commit at lists.scribus.net
Sun Jan 10 10:48:30 UTC 2016


Author: fschmid
Date: Sun Jan 10 10:48:30 2016
New Revision: 20671

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=20671
Log:
Fixing Bug #13406: Paragraph Styles are not being imported from RTF files
Now you can choose if the imported styles are prepended with the item name.

Modified:
    trunk/Scribus/scribus/gtgettext.cpp
    trunk/Scribus/scribus/gtgettext.h
    trunk/Scribus/scribus/plugins/gettext/docxim/docxim.cpp
    trunk/Scribus/scribus/plugins/gettext/docxim/docxim.h
    trunk/Scribus/scribus/plugins/gettext/odt2im/importodt.cpp
    trunk/Scribus/scribus/plugins/gettext/odt2im/importodt.h
    trunk/Scribus/scribus/plugins/gettext/rtfim/rtfim.cpp
    trunk/Scribus/scribus/plugins/gettext/rtfim/rtfim.h
    trunk/Scribus/scribus/plugins/gettext/xtgim/xtgim.cpp
    trunk/Scribus/scribus/plugins/gettext/xtgim/xtgim.h
    trunk/Scribus/scribus/plugins/gettext/xtgim/xtgscanner.cpp
    trunk/Scribus/scribus/plugins/gettext/xtgim/xtgscanner.h
    trunk/Scribus/scribus/plugins/scriptplugin/cmdtext.cpp
    trunk/Scribus/scribus/scribus.cpp
    trunk/Scribus/scribus/scribusdoc.cpp
    trunk/Scribus/scribus/third_party/rtf-qt/sladocumentrtfoutput.cpp
    trunk/Scribus/scribus/third_party/rtf-qt/sladocumentrtfoutput.h
    trunk/Scribus/scribus/ui/gtdialogs.cpp
    trunk/Scribus/scribus/ui/gtdialogs.h
    trunk/Scribus/scribus/ui/gtfiledialog.cpp
    trunk/Scribus/scribus/ui/gtfiledialog.ui

Modified: trunk/Scribus/scribus/gtgettext.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20671&path=/trunk/Scribus/scribus/gtgettext.cpp
==============================================================================
--- trunk/Scribus/scribus/gtgettext.cpp	(original)
+++ trunk/Scribus/scribus/gtgettext.cpp	Sun Jan 10 10:48:30 2016
@@ -47,7 +47,7 @@
 // Look at the results of the file selection dialog and figure out if you need to use an importer.
 // Prompt the user if the importer to use isn't obvious.
 void gtGetText::launchImporter(int importer, const QString& filename, bool textOnly, 
-								const QString& encoding, bool append, PageItem* target)
+								const QString& encoding, bool append, bool prefix, PageItem* target)
 {
 	// Struct for the plugin info, we'll load this up from the array.
 	struct ImporterData ida;
@@ -103,7 +103,7 @@
 	// If the targetframe is not zero, and we do need to call the importer, 
 	// Run the importer via "CallDLL" and pass it what it needs to know.
 	if (targetFrame!=0 && callImporter)
-		CallDLL(ida, filename, encoding, textOnly, append, targetFrame);
+		CallDLL(ida, filename, encoding, textOnly, append, prefix, targetFrame);
 }  //void gtGetText::launchImporter(int importer, const QString& filename, bool textOnly, 
    //						const QString& encoding, bool append, PageItem* target)
 
@@ -199,12 +199,13 @@
 	if (m_dias->runFileDialog(filters, m_ilist))
 	{
 		// Set the runDialog to true
-		impsetup.runDialog=true;
+		impsetup.runDialog = true;
 		// Copy the other values for the struct from the dialog results
-		impsetup.encoding=m_dias->getEncoding();
-		impsetup.filename=m_dias->getFileName();
-		impsetup.importer=m_dias->getImporter();
-		impsetup.textOnly=m_dias->importTextOnly();
+		impsetup.encoding = m_dias->getEncoding();
+		impsetup.filename = m_dias->getFileName();
+		impsetup.importer = m_dias->getImporter();
+		impsetup.textOnly = m_dias->importTextOnly();
+		impsetup.prefixNames = m_dias->prefixStyles();
 // 		launchImporter(dias->getImporter(), dias->getFileName(),
 // 		               dias->importTextOnly(), dias->getEncoding(), append);
 	}  // if (dias->runFileDialog(filters, ilist))
@@ -216,12 +217,12 @@
 
 // Loads, validates, and executes the Importer code.
 void gtGetText::CallDLL(const ImporterData& idata, const QString& filePath,
-                        const QString& encoding, bool textOnly, bool append, PageItem* importItem)
+						const QString& encoding, bool textOnly, bool append, bool prefix, PageItem* importItem)
 {
 	// Pointer for the loaded plugin.
 	void* gtplugin;
 	// Type definition for GetText pointer in the function in question.
-	typedef void (*gt2ptr)(QString filename, QString encoding, bool textOnly, PageItem *textframe);
+	typedef void (*gt2ptr)(QString filename, QString encoding, bool textOnly, bool prefix, PageItem *textframe);
 	// Type definition for GetText pointer in the function in question.
 	typedef void (*sdem)(QString filename, QString encoding, bool textOnly, gtWriter *writer);
 	// The point to the above.
@@ -244,7 +245,7 @@
 		if (!append)
 			importItem->itemText.clear();
 		// Execute the importer's "GetText2" method.
-		(*fp_GetText2)(filePath, encoding, textOnly, importItem);
+		(*fp_GetText2)(filePath, encoding, textOnly, prefix, importItem);
 	}  // if (!fp_GetText2)        
 	else
 	{

Modified: trunk/Scribus/scribus/gtgettext.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20671&path=/trunk/Scribus/scribus/gtgettext.h
==============================================================================
--- trunk/Scribus/scribus/gtgettext.h	(original)
+++ trunk/Scribus/scribus/gtgettext.h	Sun Jan 10 10:48:30 2016
@@ -57,6 +57,7 @@
 	int importer;					// Which importer was selected?
 	QString filename;				// What filename is to be loaded?
 	bool textOnly;					// Do we import as text only?
+	bool prefixNames;				// Prefix Style names with item name;
 	QString encoding;				// File encoding
 };
 
@@ -71,7 +72,7 @@
 	void loadImporterPlugins();					// Find the available plugins based on the environment, validate they load, and 
 												// create quick lookup mappings.
 	void CallDLL(const ImporterData& idata, const QString& filePath,
-	             const QString& encoding, bool textOnly, bool append, PageItem* importItem);
+				 const QString& encoding, bool textOnly, bool append, bool prefix, PageItem* importItem);
 												// Loads, validates, and executes the Importer code.
 	bool DLLName(QString name, QString *ffName, QStringList *fileEndings);
 												// Loads the "DLL", validates the importer is good, populates the passed parameters with 
@@ -84,7 +85,7 @@
 	gtGetText(ScribusDoc* doc);					// Constructor
 	~gtGetText();								// Destructor
 	ImportSetup run();							// Creates the dialog for the user to import a file based on the supported file formats.
-	void launchImporter(int importer, const QString& filename, bool textOnly, const QString& encoding, bool append, PageItem* target=0);
+	void launchImporter(int importer, const QString& filename, bool textOnly, const QString& encoding, bool append, bool prefix, PageItem* target=0);
 												// Look at the results of the file selection dialog and figure out if you need to use an importer.
 												// Prompt the user if the importer to use isn't obvious.
 };

Modified: trunk/Scribus/scribus/plugins/gettext/docxim/docxim.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20671&path=/trunk/Scribus/scribus/plugins/gettext/docxim/docxim.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/gettext/docxim/docxim.cpp	(original)
+++ trunk/Scribus/scribus/plugins/gettext/docxim/docxim.cpp	Sun Jan 10 10:48:30 2016
@@ -34,16 +34,17 @@
 	return QStringList("docx");
 }
 
-void GetText2(QString filename, QString encoding, bool textOnly, PageItem *textItem)
-{
-	DocXIm* docxim = new DocXIm(filename, textItem, textOnly);
+void GetText2(QString filename, QString encoding, bool textOnly, bool prefix, PageItem *textItem)
+{
+	DocXIm* docxim = new DocXIm(filename, textItem, textOnly, prefix);
 	delete docxim;
 }
 
-DocXIm::DocXIm(QString fileName, PageItem *textItem, bool textOnly)
+DocXIm::DocXIm(QString fileName, PageItem *textItem, bool textOnly, bool prefix)
 {
 	m_Doc = textItem->doc();
 	m_item = textItem;
+	m_prefixName = prefix;
 	themePart = "";
 	docPart = "";
 	stylePart = "";
@@ -220,10 +221,16 @@
 				QDomElement nam = drawPag.firstChildElement("w:name");
 				if (!nam.isNull())
 				{
-					map_ID_to_Name.insert(drawPag.attribute("w:styleId"), m_item->itemName() + "_" + nam.attribute("w:val"));
+					if (m_prefixName)
+						map_ID_to_Name.insert(drawPag.attribute("w:styleId"), m_item->itemName() + "_" + nam.attribute("w:val"));
+					else
+						map_ID_to_Name.insert(drawPag.attribute("w:styleId"), nam.attribute("w:val"));
 					ParagraphStyle newStyle;
 					newStyle = defaultParagraphStyle;
-					newStyle.setName(m_item->itemName() + "_" + nam.attribute("w:val"));
+					if (m_prefixName)
+						newStyle.setName(m_item->itemName() + "_" + nam.attribute("w:val"));
+					else
+						newStyle.setName(nam.attribute("w:val"));
 					for(QDomElement spf = drawPag.firstChildElement(); !spf.isNull(); spf = spf.nextSiblingElement() )
 					{
 						if (spf.tagName() == "w:basedOn")

Modified: trunk/Scribus/scribus/plugins/gettext/docxim/docxim.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20671&path=/trunk/Scribus/scribus/plugins/gettext/docxim/docxim.h
==============================================================================
--- trunk/Scribus/scribus/plugins/gettext/docxim/docxim.h	(original)
+++ trunk/Scribus/scribus/plugins/gettext/docxim/docxim.h	Sun Jan 10 10:48:30 2016
@@ -22,14 +22,14 @@
 #include <QHash>
 class ScZipHandler;
 
-extern "C" PLUGIN_API void GetText2(QString filename, QString encoding, bool textOnly, PageItem *textItem);
+extern "C" PLUGIN_API void GetText2(QString filename, QString encoding, bool textOnly, bool prefix, PageItem *textItem);
 extern "C" PLUGIN_API QString FileFormatName();
 extern "C" PLUGIN_API QStringList FileExtensions();
 
 class DocXIm
 {
 	public:
-		DocXIm(QString fileName, PageItem *textItem, bool textOnly);
+		DocXIm(QString fileName, PageItem *textItem, bool textOnly, bool prefix);
 		~DocXIm();
 	private:
 		void parseContentTypes();
@@ -49,6 +49,7 @@
 		ScZipHandler *uz;
 		ScribusDoc* m_Doc;
 		PageItem* m_item;
+		bool m_prefixName;
 		ParagraphStyle defaultParagraphStyle;
 		ParagraphStyle currentParagraphStyle;
 		QHash<QString, QString> map_ID_to_Name;

Modified: trunk/Scribus/scribus/plugins/gettext/odt2im/importodt.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20671&path=/trunk/Scribus/scribus/plugins/gettext/odt2im/importodt.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/gettext/odt2im/importodt.cpp	(original)
+++ trunk/Scribus/scribus/plugins/gettext/odt2im/importodt.cpp	Sun Jan 10 10:48:30 2016
@@ -40,16 +40,17 @@
 	return ret;
 }
 
-void GetText2(QString filename, QString encoding, bool textOnly, PageItem *textItem)
-{
-	ODTIm* docxim = new ODTIm(filename, textItem, textOnly);
+void GetText2(QString filename, QString encoding, bool textOnly, bool prefix, PageItem *textItem)
+{
+	ODTIm* docxim = new ODTIm(filename, textItem, textOnly, prefix);
 	delete docxim;
 }
 
-ODTIm::ODTIm(QString fileName, PageItem *textItem, bool textOnly)
+ODTIm::ODTIm(QString fileName, PageItem *textItem, bool textOnly, bool prefix)
 {
 	m_Doc = textItem->doc();
 	m_item = textItem;
+	m_prefixName = prefix;
 	QFileInfo fi = QFileInfo(fileName);
 	QString ext = fi.suffix().toLower();
 	if (ext == "fodt")
@@ -516,7 +517,10 @@
 					QString styleName = spd.attribute("style:name");
 					if (currStyle.displayName.valid)
 						styleName = currStyle.displayName.value;
-					newStyle.setName(m_item->itemName() + "_" + styleName);
+					if (m_prefixName)
+						newStyle.setName(m_item->itemName() + "_" + styleName);
+					else
+						newStyle.setName(styleName);
 					QString parentName = CommonStrings::DefaultParagraphStyle;
 					if (currStyle.parentStyle.valid)
 					{
@@ -528,7 +532,10 @@
 								parentName = pStyle.displayName.value;
 						}
 					}
-					newStyle.setParent(m_item->itemName() + "_" + parentName);
+					if (m_prefixName)
+						newStyle.setParent(m_item->itemName() + "_" + parentName);
+					else
+						newStyle.setParent(parentName);
 					applyParagraphStyle(newStyle, tmpOStyle);
 					applyCharacterStyle(newStyle.charStyle(), tmpOStyle);
 					StyleSet<ParagraphStyle>tmp;
@@ -542,7 +549,10 @@
 					QString styleName = spd.attribute("style:name");
 					if (currStyle.displayName.valid)
 						styleName = currStyle.displayName.value;
-					newStyle.setName(m_item->itemName() + "_" + styleName);
+					if (m_prefixName)
+						newStyle.setName(m_item->itemName() + "_" + styleName);
+					else
+						newStyle.setName(styleName);
 					newStyle.setParent(CommonStrings::DefaultCharacterStyle);
 					applyCharacterStyle(newStyle, tmpOStyle);
 					StyleSet<CharStyle> temp;
@@ -671,9 +681,18 @@
 			DrawStyle currStyle = m_Styles[pStyleName];
 			if (currStyle.styleOrigin.value == "styles")
 			{
-				parStyleName = m_item->itemName() + "_" + pStyleName;
-				if (currStyle.displayName.valid)
-					parStyleName = m_item->itemName() + "_" + currStyle.displayName.value;
+				if (m_prefixName)
+				{
+					parStyleName = m_item->itemName() + "_" + pStyleName;
+					if (currStyle.displayName.valid)
+						parStyleName = m_item->itemName() + "_" + currStyle.displayName.value;
+				}
+				else
+				{
+					parStyleName = pStyleName;
+					if (currStyle.displayName.valid)
+						parStyleName = currStyle.displayName.value;
+				}
 			}
 		}
 	}

Modified: trunk/Scribus/scribus/plugins/gettext/odt2im/importodt.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20671&path=/trunk/Scribus/scribus/plugins/gettext/odt2im/importodt.h
==============================================================================
--- trunk/Scribus/scribus/plugins/gettext/odt2im/importodt.h	(original)
+++ trunk/Scribus/scribus/plugins/gettext/odt2im/importodt.h	Sun Jan 10 10:48:30 2016
@@ -23,7 +23,7 @@
 #include <QHash>
 class ScZipHandler;
 
-extern "C" PLUGIN_API void GetText2(QString filename, QString encoding, bool textOnly, PageItem *textItem);
+extern "C" PLUGIN_API void GetText2(QString filename, QString encoding, bool textOnly, bool prefix, PageItem *textItem);
 extern "C" PLUGIN_API QString FileFormatName();
 extern "C" PLUGIN_API QStringList FileExtensions();
 
@@ -91,7 +91,7 @@
 class ODTIm
 {
 	public:
-		ODTIm(QString fileName, PageItem *textItem, bool textOnly);
+		ODTIm(QString fileName, PageItem *textItem, bool textOnly, bool prefix);
 		~ODTIm();
 	private:
 		struct DrawStyle
@@ -154,6 +154,7 @@
 		ScZipHandler *uz;
 		ScribusDoc* m_Doc;
 		PageItem* m_item;
+		bool m_prefixName;
 		QHash<QString, QString> map_ID_to_Name;
 		QHash<QString, QString> m_fontMap;
 		QHash<QString, DrawStyle> m_Styles;

Modified: trunk/Scribus/scribus/plugins/gettext/rtfim/rtfim.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20671&path=/trunk/Scribus/scribus/plugins/gettext/rtfim/rtfim.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/gettext/rtfim/rtfim.cpp	(original)
+++ trunk/Scribus/scribus/plugins/gettext/rtfim/rtfim.cpp	Sun Jan 10 10:48:30 2016
@@ -30,7 +30,7 @@
 	return QStringList("rtf");
 }
 
-void GetText2(QString filename, QString encoding, bool textOnly, PageItem *textItem)
+void GetText2(QString filename, QString encoding, bool textOnly, bool prefix, PageItem *textItem)
 {
 	QFile f(filename);
 	if (f.open(QIODevice::ReadOnly))
@@ -39,7 +39,7 @@
 		f.close();
 		QBuffer buffer(&daten);
 		buffer.open(QIODevice::ReadOnly);
-		RtfReader::SlaDocumentRtfOutput *output = new RtfReader::SlaDocumentRtfOutput(textItem, textItem->doc());
+		RtfReader::SlaDocumentRtfOutput *output = new RtfReader::SlaDocumentRtfOutput(textItem, textItem->doc(), prefix);
 		RtfReader::Reader reader;
 		reader.parseFromDeviceTo(&buffer, output);
 		textItem->itemText.trim();

Modified: trunk/Scribus/scribus/plugins/gettext/rtfim/rtfim.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20671&path=/trunk/Scribus/scribus/plugins/gettext/rtfim/rtfim.h
==============================================================================
--- trunk/Scribus/scribus/plugins/gettext/rtfim/rtfim.h	(original)
+++ trunk/Scribus/scribus/plugins/gettext/rtfim/rtfim.h	Sun Jan 10 10:48:30 2016
@@ -18,7 +18,7 @@
 
 #include <QString>
 
-extern "C" PLUGIN_API void GetText2(QString filename, QString encoding, bool textOnly, PageItem *textItem);
+extern "C" PLUGIN_API void GetText2(QString filename, QString encoding, bool textOnly, bool prefix, PageItem *textItem);
 extern "C" PLUGIN_API QString FileFormatName();
 extern "C" PLUGIN_API QStringList FileExtensions();
 

Modified: trunk/Scribus/scribus/plugins/gettext/xtgim/xtgim.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20671&path=/trunk/Scribus/scribus/plugins/gettext/xtgim/xtgim.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/gettext/xtgim/xtgim.cpp	(original)
+++ trunk/Scribus/scribus/plugins/gettext/xtgim/xtgim.cpp	Sun Jan 10 10:48:30 2016
@@ -37,17 +37,17 @@
 	return QStringList("xtg");
 }
 
-void GetText2(QString filename, QString encoding, bool textOnly, PageItem *textItem)
+void GetText2(QString filename, QString encoding, bool textOnly, bool prefix, PageItem *textItem)
 {
-	XtgIm* xtgim = new XtgIm(filename, textItem, textOnly);
+	XtgIm* xtgim = new XtgIm(filename, textItem, textOnly, prefix);
 	delete xtgim;
 }
 
 /********************************Class XtgIm***********************************/
 
-XtgIm::XtgIm(QString fileName, PageItem *textItem, bool textOnly)
+XtgIm::XtgIm(QString fileName, PageItem *textItem, bool textOnly, bool prefix)
 {
-	XtgScanner *scanner = new XtgScanner(fileName, textItem, textOnly);
+	XtgScanner *scanner = new XtgScanner(fileName, textItem, textOnly, prefix);
 	scanner->xtgParse();
 	delete scanner;
 }

Modified: trunk/Scribus/scribus/plugins/gettext/xtgim/xtgim.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20671&path=/trunk/Scribus/scribus/plugins/gettext/xtgim/xtgim.h
==============================================================================
--- trunk/Scribus/scribus/plugins/gettext/xtgim/xtgim.h	(original)
+++ trunk/Scribus/scribus/plugins/gettext/xtgim/xtgim.h	Sun Jan 10 10:48:30 2016
@@ -35,14 +35,14 @@
 
 class StyleManager;
 
-extern "C" PLUGIN_API void GetText2(QString filename, QString encoding, bool textOnly, PageItem *textItem);
+extern "C" PLUGIN_API void GetText2(QString filename, QString encoding, bool textOnly, bool prefix, PageItem *textItem);
 extern "C" PLUGIN_API QString FileFormatName();
 extern "C" PLUGIN_API QStringList FileExtensions();
 
 class XtgIm
 {
 public:
-	XtgIm(QString fileName, PageItem *textItem, bool textOnly);
+	XtgIm(QString fileName, PageItem *textItem, bool textOnly, bool prefix);
 	~XtgIm();
 };
 #endif			/* XTGIM_H */

Modified: trunk/Scribus/scribus/plugins/gettext/xtgim/xtgscanner.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20671&path=/trunk/Scribus/scribus/plugins/gettext/xtgim/xtgscanner.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/gettext/xtgim/xtgscanner.cpp	(original)
+++ trunk/Scribus/scribus/plugins/gettext/xtgim/xtgscanner.cpp	Sun Jan 10 10:48:30 2016
@@ -39,7 +39,7 @@
 #include "util.h"
 
 
-XtgScanner::XtgScanner (QString filename, PageItem *item, bool textOnly)
+XtgScanner::XtgScanner(QString filename, PageItem *item, bool textOnly, bool prefix)
 {
 	m_item = item;
 	importTextOnly = textOnly;
@@ -71,6 +71,7 @@
 	m_isBold = false;
 	m_isItalic = false;
 	inDef = false;
+	m_prefixName = prefix;
 }
 
 /** Initialise a QHash which maps the values of n## to corresponding language strings
@@ -1007,7 +1008,10 @@
 	if (lookAhead() != '[')
 	{
 		define = 1;
-		currentCharStyle.setName(m_item->itemName() + "_" + sfcName);
+		if (m_prefixName)
+			currentCharStyle.setName(m_item->itemName() + "_" + sfcName);
+		else
+			currentCharStyle.setName(sfcName);
 		enterState(textMode);
 	}
 	else 
@@ -1170,7 +1174,10 @@
 	}
 	else
 		newStyle.setParent(pStyle);
-	newStyle.setName(m_item->itemName() + "_" + sfcName);
+	if (m_prefixName)
+		newStyle.setName(m_item->itemName() + "_" + sfcName);
+	else
+		newStyle.setName((sfcName));
 	newStyle.setLineSpacingMode(ParagraphStyle::AutomaticLineSpacing);
 	if (s3 != "")
 	{

Modified: trunk/Scribus/scribus/plugins/gettext/xtgim/xtgscanner.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20671&path=/trunk/Scribus/scribus/plugins/gettext/xtgim/xtgscanner.h
==============================================================================
--- trunk/Scribus/scribus/plugins/gettext/xtgim/xtgscanner.h	(original)
+++ trunk/Scribus/scribus/plugins/gettext/xtgim/xtgscanner.h	Sun Jan 10 10:48:30 2016
@@ -63,6 +63,7 @@
 	 */
 	PageItem* m_item;
 	bool importTextOnly;
+	bool m_prefixName;
 	/**
 	 \variable Flag variables used in the scanner
 	 */
@@ -110,7 +111,7 @@
 	bool m_isItalic;
 	
 public:
-	XtgScanner(QString filename, PageItem* item, bool textOnly);
+	XtgScanner(QString filename, PageItem* item, bool textOnly, bool prefix);
 	~XtgScanner();
 
 	/**

Modified: trunk/Scribus/scribus/plugins/scriptplugin/cmdtext.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20671&path=/trunk/Scribus/scribus/plugins/scriptplugin/cmdtext.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin/cmdtext.cpp	(original)
+++ trunk/Scribus/scribus/plugins/scriptplugin/cmdtext.cpp	Sun Jan 10 10:48:30 2016
@@ -370,7 +370,7 @@
 	QString fileName = QString::fromUtf8(file);
 
 	gtGetText gt(ScCore->primaryMainWindow()->doc);
-	gt.launchImporter(-1, fileName, false, QString("utf-8"), false, it);
+	gt.launchImporter(-1, fileName, false, QString("utf-8"), false, true, it);
 
 	// FIXME: PyMem_Free() - are any needed??
 	Py_RETURN_NONE;

Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20671&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp	(original)
+++ trunk/Scribus/scribus/scribus.cpp	Sun Jan 10 10:48:30 2016
@@ -3881,7 +3881,7 @@
 					if (t == QMessageBox::No)
 						return;
 				}
-				gt->launchImporter(impsetup.importer, impsetup.filename, impsetup.textOnly, impsetup.encoding, false);
+				gt->launchImporter(impsetup.importer, impsetup.filename, impsetup.textOnly, impsetup.encoding, false, impsetup.prefixNames);
 			}
 			delete gt;
 			if (doc->docHyphenator->AutoCheck)
@@ -4051,7 +4051,7 @@
 		ImportSetup impsetup=gt->run();
 		if (impsetup.runDialog)
 		{
-			gt->launchImporter(impsetup.importer, impsetup.filename, impsetup.textOnly, impsetup.encoding, true);
+			gt->launchImporter(impsetup.importer, impsetup.filename, impsetup.textOnly, impsetup.encoding, true, impsetup.prefixNames);
 		}
 		delete gt;
 		//CB Hyphenating now emits doc changed, plus we change lang as appropriate

Modified: trunk/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20671&path=/trunk/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.cpp	(original)
+++ trunk/Scribus/scribus/scribusdoc.cpp	Sun Jan 10 10:48:30 2016
@@ -5758,7 +5758,7 @@
 				{
 					gtGetText* gt = new gtGetText(this);
 					if (iafData.impsetup.runDialog)
-						gt->launchImporter(iafData.impsetup.importer, iafData.impsetup.filename, iafData.impsetup.textOnly, iafData.impsetup.encoding, true, currItem);
+						gt->launchImporter(iafData.impsetup.importer, iafData.impsetup.filename, iafData.impsetup.textOnly, iafData.impsetup.encoding, true, iafData.impsetup.prefixNames, currItem);
 					delete gt;
 				}
 				prevItem=currItem;

Modified: trunk/Scribus/scribus/third_party/rtf-qt/sladocumentrtfoutput.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20671&path=/trunk/Scribus/scribus/third_party/rtf-qt/sladocumentrtfoutput.cpp
==============================================================================
--- trunk/Scribus/scribus/third_party/rtf-qt/sladocumentrtfoutput.cpp	(original)
+++ trunk/Scribus/scribus/third_party/rtf-qt/sladocumentrtfoutput.cpp	Sun Jan 10 10:48:30 2016
@@ -29,10 +29,11 @@
 
 namespace RtfReader
 {
-	SlaDocumentRtfOutput::SlaDocumentRtfOutput(PageItem *ite, ScribusDoc *doc) : AbstractRtfOutput()
+	SlaDocumentRtfOutput::SlaDocumentRtfOutput(PageItem *ite, ScribusDoc *doc, bool prefix) : AbstractRtfOutput()
 	{
 		m_item = ite;
 		m_Doc = doc;
+		m_prefixName = prefix;
 		QString pStyle = CommonStrings::DefaultParagraphStyle;
 		ParagraphStyle newStyle;
 		newStyle.setParent(pStyle);
@@ -430,7 +431,9 @@
 
 	void SlaDocumentRtfOutput::insertStyleSheetTableEntry(quint32 stylesheetTableIndex, ParagraphStyle stylesheetTableEntry)
 	{
-		QString newName = m_item->itemName() + "_" + stylesheetTableEntry.name();
+		QString newName = stylesheetTableEntry.name();
+		if (m_prefixName)
+			newName = m_item->itemName() + "_" + stylesheetTableEntry.name();
 		stylesheetTableEntry.setName(newName);
 		if (stylesheetTableEntry.charStyle().fontVariant() != "")
 		{

Modified: trunk/Scribus/scribus/third_party/rtf-qt/sladocumentrtfoutput.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20671&path=/trunk/Scribus/scribus/third_party/rtf-qt/sladocumentrtfoutput.h
==============================================================================
--- trunk/Scribus/scribus/third_party/rtf-qt/sladocumentrtfoutput.h	(original)
+++ trunk/Scribus/scribus/third_party/rtf-qt/sladocumentrtfoutput.h	Sun Jan 10 10:48:30 2016
@@ -32,7 +32,7 @@
 	class SlaDocumentRtfOutput : public AbstractRtfOutput
 	{
 	public:
-		explicit SlaDocumentRtfOutput(PageItem* ite, ScribusDoc* doc);
+		explicit SlaDocumentRtfOutput(PageItem* ite, ScribusDoc* doc, bool prefix);
 		virtual ~SlaDocumentRtfOutput();
 		virtual void startGroup();
 		virtual void endGroup();
@@ -116,6 +116,7 @@
 		bool m_keepn;
 		bool m_isBold;
 		bool m_isItalic;
+		bool m_prefixName;
 	};
 }
 #endif // SLADOCUMENTRTFOUTPUT_H

Modified: trunk/Scribus/scribus/ui/gtdialogs.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20671&path=/trunk/Scribus/scribus/ui/gtdialogs.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/gtdialogs.cpp	(original)
+++ trunk/Scribus/scribus/ui/gtdialogs.cpp	Sun Jan 10 10:48:30 2016
@@ -231,6 +231,14 @@
 	return ret;
 }
 
+bool gtDialogs::prefixStyles()
+{
+	bool ret = false;
+	if (fdia)
+		ret = fdia->prefixStylesCheckBox->isChecked();
+	return ret;
+}
+
 gtDialogs::~gtDialogs()
 {
 	delete fdia;

Modified: trunk/Scribus/scribus/ui/gtdialogs.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20671&path=/trunk/Scribus/scribus/ui/gtdialogs.h
==============================================================================
--- trunk/Scribus/scribus/ui/gtdialogs.h	(original)
+++ trunk/Scribus/scribus/ui/gtdialogs.h	Sun Jan 10 10:48:30 2016
@@ -67,6 +67,7 @@
 	const QString& getEncoding();
 	int getImporter();
 	bool importTextOnly();
+	bool prefixStyles();
 	bool runFileDialog(const QString& filters, const QStringList& importers);
 	bool runImporterDialog(const QStringList& importers);
 };

Modified: trunk/Scribus/scribus/ui/gtfiledialog.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20671&path=/trunk/Scribus/scribus/ui/gtfiledialog.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/gtfiledialog.cpp	(original)
+++ trunk/Scribus/scribus/ui/gtfiledialog.cpp	Sun Jan 10 10:48:30 2016
@@ -26,6 +26,7 @@
 	importerCombo->addItems(importers);
 
 	textOnlyCheckBox->setToolTip( tr("Import text without any formatting"));
+	prefixStylesCheckBox->setToolTip( tr("Prepend the item name to the Style name in Scribus"));
 
 	QList<QByteArray> codecNames = QTextCodec::availableCodecs();
 	QStringList codecList;
@@ -89,6 +90,11 @@
 		bool textOnly = context->getBool("textonly");
 		textOnlyCheckBox->setChecked(textOnly);
 	}
+	if (context->contains("prefix"))
+	{
+		bool textOnly = context->getBool("prefix");
+		textOnlyCheckBox->setChecked(textOnly);
+	}
 }
 
 void gtFileDialog::saveSettings(void)
@@ -98,6 +104,7 @@
 	context->set("importer", importerCombo->currentText());
 	context->set("encoding", encodingCombo->currentText());
 	context->set("textonly", textOnlyCheckBox->isChecked());
+	context->set("prefix", prefixStylesCheckBox->isChecked());
 }
 
 gtFileDialog::~gtFileDialog()

Modified: trunk/Scribus/scribus/ui/gtfiledialog.ui
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20671&path=/trunk/Scribus/scribus/ui/gtfiledialog.ui
==============================================================================
--- trunk/Scribus/scribus/ui/gtfiledialog.ui	(original)
+++ trunk/Scribus/scribus/ui/gtfiledialog.ui	Sun Jan 10 10:48:30 2016
@@ -1,61 +1,72 @@
-<ui version="4.0" >
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
  <class>gtFileDialog</class>
- <widget class="QDialog" name="gtFileDialog" >
-  <property name="geometry" >
+ <widget class="QDialog" name="gtFileDialog">
+  <property name="geometry">
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>373</width>
-    <height>317</height>
+    <width>410</width>
+    <height>320</height>
    </rect>
   </property>
-  <property name="windowTitle" >
+  <property name="windowTitle">
    <string>Open</string>
   </property>
-  <layout class="QGridLayout" >
-   <item row="0" column="0" colspan="3" >
-    <widget class="ScFileWidget" native="1" name="fileWidget" />
+  <layout class="QGridLayout" name="gridLayout">
+   <item row="0" column="0" colspan="3">
+    <widget class="ScFileWidget" name="fileWidget" native="true"/>
    </item>
-   <item row="1" column="0" >
-    <widget class="QLabel" name="label" >
-     <property name="text" >
+   <item row="1" column="0">
+    <widget class="QLabel" name="label">
+     <property name="text">
       <string>&Importer:</string>
      </property>
-     <property name="buddy" >
+     <property name="buddy">
       <cstring>importerCombo</cstring>
      </property>
     </widget>
    </item>
-   <item row="1" column="1" >
-    <widget class="ScComboBox" name="importerCombo" />
+   <item row="1" column="1">
+    <widget class="ScComboBox" name="importerCombo"/>
    </item>
-   <item row="1" column="2" >
-    <widget class="QCheckBox" name="textOnlyCheckBox" >
-     <property name="text" >
+   <item row="1" column="2">
+    <widget class="QCheckBox" name="textOnlyCheckBox">
+     <property name="text">
       <string>Import &Text Only</string>
      </property>
     </widget>
    </item>
-   <item row="2" column="0" >
-    <widget class="QLabel" name="label_2" >
-     <property name="text" >
+   <item row="2" column="0">
+    <widget class="QLabel" name="label_2">
+     <property name="text">
       <string>&Encoding:</string>
      </property>
-     <property name="buddy" >
+     <property name="buddy">
       <cstring>encodingCombo</cstring>
      </property>
     </widget>
    </item>
-   <item row="2" column="1" >
-    <widget class="ScComboBox" name="encodingCombo" />
+   <item row="2" column="1">
+    <widget class="ScComboBox" name="encodingCombo"/>
    </item>
-   <item row="3" column="0" colspan="3" >
-    <widget class="QDialogButtonBox" name="buttonBox" >
-     <property name="orientation" >
+   <item row="2" column="2">
+    <widget class="QCheckBox" name="prefixStylesCheckBox">
+     <property name="text">
+      <string>Prefix Styles with Item Name</string>
+     </property>
+     <property name="checked">
+      <bool>true</bool>
+     </property>
+    </widget>
+   </item>
+   <item row="3" column="0" colspan="2">
+    <widget class="QDialogButtonBox" name="buttonBox">
+     <property name="orientation">
       <enum>Qt::Horizontal</enum>
      </property>
-     <property name="standardButtons" >
-      <set>QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set>
+     <property name="standardButtons">
+      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
      </property>
     </widget>
    </item>
@@ -82,11 +93,11 @@
    <receiver>gtFileDialog</receiver>
    <slot>accept()</slot>
    <hints>
-    <hint type="sourcelabel" >
+    <hint type="sourcelabel">
      <x>248</x>
      <y>254</y>
     </hint>
-    <hint type="destinationlabel" >
+    <hint type="destinationlabel">
      <x>157</x>
      <y>274</y>
     </hint>
@@ -98,11 +109,11 @@
    <receiver>gtFileDialog</receiver>
    <slot>reject()</slot>
    <hints>
-    <hint type="sourcelabel" >
+    <hint type="sourcelabel">
      <x>316</x>
      <y>260</y>
     </hint>
-    <hint type="destinationlabel" >
+    <hint type="destinationlabel">
      <x>286</x>
      <y>274</y>
     </hint>




More information about the scribus-commit mailing list