summaryrefslogtreecommitdiffstats
path: root/src/ui/dialog/font-substitution.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/dialog/font-substitution.cpp')
-rw-r--r--src/ui/dialog/font-substitution.cpp28
1 files changed, 11 insertions, 17 deletions
diff --git a/src/ui/dialog/font-substitution.cpp b/src/ui/dialog/font-substitution.cpp
index 2ef61978f..19506c6a3 100644
--- a/src/ui/dialog/font-substitution.cpp
+++ b/src/ui/dialog/font-substitution.cpp
@@ -66,19 +66,15 @@ FontSubstitution::checkFontSubstitutions(SPDocument* doc)
int show_dlg = prefs->getInt("/options/font/substitutedlg", 0);
if (show_dlg) {
Glib::ustring out;
- GSList *l = getFontReplacedItems(doc, &out);
+ std::vector<SPItem*> l = getFontReplacedItems(doc, &out);
if (out.length() > 0) {
show(out, l);
}
- if (l) {
- g_slist_free(l);
- l = NULL;
- }
}
}
void
-FontSubstitution::show(Glib::ustring out, GSList *l)
+FontSubstitution::show(Glib::ustring out, std::vector<SPItem*> &l)
{
Gtk::MessageDialog warning(_("\nSome fonts are not available and have been substituted."),
false, Gtk::MESSAGE_INFO, Gtk::BUTTONS_OK, true);
@@ -148,20 +144,18 @@ FontSubstitution::show(Glib::ustring out, GSList *l)
* b. Build up a list of the objects rendered fonts - taken for the objects layout/spans
* If there are fonts in a. that are not in b. then those fonts have been substituted.
*/
-GSList * FontSubstitution::getFontReplacedItems(SPDocument* doc, Glib::ustring *out)
+std::vector<SPItem*> FontSubstitution::getFontReplacedItems(SPDocument* doc, Glib::ustring *out)
{
SPDesktop *desktop = SP_ACTIVE_DESKTOP;
- GSList *allList = NULL;
- GSList *outList = NULL;
+ std::vector<SPItem*> allList;
+ std::vector<SPItem*> outList,x,y;
std::set<Glib::ustring> setErrors;
std::set<Glib::ustring> setFontSpans;
std::map<SPItem *, Glib::ustring> mapFontStyles;
- allList = get_all_items(NULL, doc->getRoot(), desktop, false, false, true, NULL);
-
- for (GSList *i = allList; i != NULL; i = i->next) {
-
- SPItem *item = SP_ITEM(i->data);
+ allList = get_all_items(x, doc->getRoot(), desktop, false, false, true, y);
+ for(std::vector<SPItem*>::const_iterator i = allList.begin();i!=allList.end();i++){
+ SPItem *item = *i;
SPStyle *style = item->style;
Glib::ustring family = "";
@@ -216,8 +210,8 @@ GSList * FontSubstitution::getFontReplacedItems(SPDocument* doc, Glib::ustring *
}
// Check if any document styles are not in the actual layout
- std::map<SPItem *, Glib::ustring>::const_iterator mapIter;
- for (mapIter = mapFontStyles.begin(); mapIter != mapFontStyles.end(); ++mapIter) {
+ std::map<SPItem *, Glib::ustring>::const_reverse_iterator mapIter;
+ for (mapIter = mapFontStyles.rbegin(); mapIter != mapFontStyles.rend(); ++mapIter) {
SPItem *item = mapIter->first;
Glib::ustring fonts = mapIter->second;
@@ -250,7 +244,7 @@ GSList * FontSubstitution::getFontReplacedItems(SPDocument* doc, Glib::ustring *
Glib::ustring err = Glib::ustring::compose(
_("Font '%1' substituted with '%2'"), fonts.c_str(), subName.c_str());
setErrors.insert(err);
- outList = g_slist_prepend (outList, item);
+ outList.push_back(item);
}
}