diff --git a/src/document.cpp b/src/document.cpp
index 863266c051321f49d663f4be8e16409fcdb9514c..71f607b6524dcdc2e88a1c974c565243c1d830fc 100644 (file)
--- a/src/document.cpp
+++ b/src/document.cpp
#include "prefs-utils.h"
#include "libavoid/router.h"
#include "libnr/nr-rect.h"
-#include "sp-item-transform.h"
+#include "sp-item-group.h"
#include "display/nr-arena-item.h"
if (root) {
sp_object_invoke_release(root);
- g_object_unref(G_OBJECT(root));
+ sp_object_unref(root);
root = NULL;
}
sp_document_set_height(this, h, &unit);
NR::translate tr = NR::translate::translate(-rect.x0,-(rect.y0 + (h - old_height)));
- sp_item_move_rel((SPItem *) root, tr);
+ static_cast<SPGroup *>(root)->translateChildItems(tr);
}
void sp_document_set_uri(SPDocument *document, gchar const *uri)
return (SPObject*)g_hash_table_lookup(priv->reprdef, repr);
}
+Glib::ustring SPDocument::getLanguage() {
+ gchar const *document_language = rdf_get_work_entity(this, rdf_find_entity("language"));
+ if (document_language) {
+ while (isspace(*document_language))
+ document_language++;
+ }
+ if ( !document_language || 0 == *document_language) {
+ // retrieve system language
+ document_language = getenv("LC_ALL");
+ if ( NULL == document_language || *document_language == 0 ) {
+ document_language = getenv ("LC_MESSAGES");
+ }
+ if ( NULL == document_language || *document_language == 0 ) {
+ document_language = getenv ("LANG");
+ }
+
+ if ( NULL != document_language ) {
+ gchar *pos = strchr(document_language, '_');
+ if ( NULL != pos ) {
+ return Glib::ustring(document_language, pos - document_language);
+ }
+ }
+ }
+
+ if ( NULL == document_language )
+ return Glib::ustring();
+ return document_language;
+}
+
/* Object modification root handler */
void