r16699 by jghali - #10078: Changing styles imported with text from ODT documents doesn't work properly
scribus-commit
scribus-commit at lists.scribus.net
Mon Jun 27 22:23:57 UTC 2011
Author: jghali
Date: Mon Jun 27 22:23:57 2011
New Revision: 16699
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=16699
Log:
#10078: Changing styles imported with text from ODT documents doesn't work properly
Modified:
trunk/Scribus/scribus/gtgettext.cpp
Modified: trunk/Scribus/scribus/gtgettext.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16699&path=/trunk/Scribus/scribus/gtgettext.cpp
==============================================================================
--- trunk/Scribus/scribus/gtgettext.cpp (original)
+++ trunk/Scribus/scribus/gtgettext.cpp Mon Jun 27 22:23:57 2011
@@ -221,12 +221,12 @@
{
// 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);
+ // Type definition for GetText pointer in the function in question.
+ typedef void (*gt2ptr)(QString filename, QString encoding, bool textOnly, 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.
- gt2ptr fp_GetText2;
+ gt2ptr fp_GetText2;
sdem fp_GetText;
// Initialize Path to the "DLL"
QString pluginFilePath = QString("%1/gettext/%2").arg(ScPaths::instance().pluginDir()).arg(idata.soFilePath);
@@ -238,36 +238,38 @@
qWarning("Failed to load plugin %s", pluginFilePath.toAscii().constData());
return;
} // if (!gtplugin)
- fp_GetText2 = (gt2ptr) PluginManager::resolveSym(gtplugin,"GetText2");
-
- if (fp_GetText2)
- {
- if (!append)
- importItem->itemText.clear();
- // Execute the importer's "GetText2" method.
- (*fp_GetText2)(filePath, encoding, textOnly, importItem);
- } // if (!fp_GetText2)
- else
- {
- // Attempt to map the old GetText method to to the pointer via the PluginManager. Store the result in fp_GetText.
- fp_GetText = (sdem) PluginManager::resolveSym(gtplugin,"GetText");
- // If fp_GetText is NULL, we could not find the symbol,report the error, unload the "DLL" and exit the method.
- if (fp_GetText)
- {
- // Create a new writer object in "append"'s mode (true or false ) attached to the importItem
- gtWriter *w = new gtWriter(append, importItem);
- // Execute the importer's "GetText" method.
- (*fp_GetText)(filePath, encoding, textOnly, w);
- // Destroy the writer
- delete w;
- } // if (!fp_GetText)
- else
- {
- qWarning("Failed to get GetText() from %s",pluginFilePath.toAscii().constData());
- }
- }
- // Unload the plugin.
- PluginManager::unloadDLL(gtplugin);
+
+ fp_GetText2 = (gt2ptr) PluginManager::resolveSym(gtplugin,"GetText2");
+ if (fp_GetText2)
+ {
+ if (!append)
+ importItem->itemText.clear();
+ // Execute the importer's "GetText2" method.
+ (*fp_GetText2)(filePath, encoding, textOnly, importItem);
+ } // if (!fp_GetText2)
+ else
+ {
+ // Attempt to map the old GetText method to to the pointer via the PluginManager. Store the result in fp_GetText.
+ fp_GetText = (sdem) PluginManager::resolveSym(gtplugin,"GetText");
+ // If fp_GetText is NULL, we could not find the symbol,report the error, unload the "DLL" and exit the method.
+ if (fp_GetText)
+ {
+ // Create a new writer object in "append"'s mode (true or false ) attached to the importItem
+ gtWriter *w = new gtWriter(append, importItem);
+ // Execute the importer's "GetText" method.
+ (*fp_GetText)(filePath, encoding, textOnly, w);
+ // Destroy the writer
+ delete w;
+ } // if (!fp_GetText)
+ else
+ {
+ qWarning("Failed to get GetText() from %s",pluginFilePath.toAscii().constData());
+ }
+ }
+ // GetText is not quite up to date vs styles, clean char formatting already specified at paragraph level
+ importItem->itemText.fixLegacyFormatting();
+ // Unload the plugin.
+ PluginManager::unloadDLL(gtplugin);
} // void gtGetText::CallDLL(const ImporterData& idata, const QString& filePath,
// const QString& encoding, bool textOnly, bool append, PageItem* importItem)
More information about the scribus-commit
mailing list