Пример #1
0
QString X2Svg::offsetMin(const QString & svg) {
	if (m_minX == 0 && m_minY == 0) return svg;

	QString errorStr;
	int errorLine;
	int errorColumn;
	QDomDocument domDocument;
	if (!domDocument.setContent(svg, true, &errorStr, &errorLine, &errorColumn)) {
		throw QObject::tr("failure in svg conversion 1: %1 %2 %3").arg(errorStr).arg(errorLine).arg(errorColumn);
	}

	QDomElement root = domDocument.documentElement();
	if (root.isNull()) {
		throw QObject::tr("failure in svg conversion 2: %1 %2 %3").arg(errorStr).arg(errorLine).arg(errorColumn);
	}

	SvgFileSplitter splitter;
	splitter.shiftChild(root, -m_minX, -m_minY, true);
	return TextUtils::removeXMLEntities(domDocument.toString());
}