Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 25204 → Rev 25205

/trunk/Scribus/scribus/plugins/gettext/odt2im/importodt.cpp
39,7 → 39,7
return ret;
}
 
void GetText2(const QString& filename, const QString& encoding, bool textOnly, bool prefix, bool append, PageItem *textItem)
void GetText2(const QString& filename, const QString& /*encoding*/, bool textOnly, bool prefix, bool append, PageItem *textItem)
{
ODTIm* docxim = new ODTIm(filename, textItem, textOnly, prefix, append);
delete docxim;
46,12 → 46,12
}
 
ODTIm::ODTIm(const QString& fileName, PageItem *textItem, bool textOnly, bool prefix, bool append)
: m_Doc(textItem->doc()),
m_item(textItem),
m_prefixName(prefix),
m_append(append)
{
m_Doc = textItem->doc();
m_item = textItem;
m_prefixName = prefix;
m_append = append;
QFileInfo fi = QFileInfo(fileName);
QFileInfo fi(fileName);
QString ext = fi.suffix().toLower();
if (ext == "fodt")
{
130,10 → 130,6
textItem->itemText.invalidateLayout();
}
 
ODTIm::~ODTIm()
{
}
 
/* Raw Text import */
 
bool ODTIm::parseRawDocReference(const QString& designMap)
154,7 → 150,7
return parseRawDocReferenceXML(designMapDom);
}
 
bool ODTIm::parseRawDocReferenceXML(QDomDocument &designMapDom)
bool ODTIm::parseRawDocReferenceXML(const QDomDocument &designMapDom)
{
QDomElement docElem = designMapDom.documentElement();
for (QDomElement drawPag = docElem.firstChildElement(); !drawPag.isNull(); drawPag = drawPag.nextSiblingElement())
173,7 → 169,7
return true;
}
 
void ODTIm::parseRawTextSpan(QDomElement &elem, PageItem* item, ParagraphStyle &tmpStyle, CharStyle &tmpCStyle, int &posC)
void ODTIm::parseRawTextSpan(const QDomElement &elem, PageItem* item, ParagraphStyle &tmpStyle, CharStyle &tmpCStyle, int &posC)
{
if (!elem.hasChildNodes())
return;
213,7 → 209,7
}
}
 
void ODTIm::parseRawTextParagraph(QDomNode &elem, PageItem* item, ParagraphStyle &newStyle, int &posC)
void ODTIm::parseRawTextParagraph(const QDomNode &elem, PageItem* item, ParagraphStyle &newStyle, int &posC)
{
CharStyle tmpCStyle = newStyle.charStyle();
if (elem.hasChildNodes())
257,7 → 253,7
posC = item->itemText.length();
}
 
void ODTIm::parseRawText(QDomElement &elem, PageItem* item)
void ODTIm::parseRawText(const QDomElement &elem, PageItem* item)
{
QString pStyleD = CommonStrings::DefaultParagraphStyle;
ParagraphStyle newStyle;
328,7 → 324,7
return parseStyleSheetsXML(designMapDom);
}
 
bool ODTIm::parseStyleSheetsXML(QDomDocument &designMapDom)
bool ODTIm::parseStyleSheetsXML(const QDomDocument &designMapDom)
{
QDomElement docElem = designMapDom.documentElement();
for (QDomElement sp = docElem.firstChildElement(); !sp.isNull(); sp = sp.nextSiblingElement() )
359,7 → 355,7
return true;
}
 
void ODTIm::parseStyles(QDomElement &sp, const QString& type)
void ODTIm::parseStyles(const QDomElement &sp, const QString& type)
{
for (QDomElement spd = sp.firstChildElement(); !spd.isNull(); spd = spd.nextSiblingElement() )
{
589,7 → 585,7
return parseDocReferenceXML(designMapDom);
}
 
bool ODTIm::parseDocReferenceXML(QDomDocument &designMapDom)
bool ODTIm::parseDocReferenceXML(const QDomDocument &designMapDom)
{
QDomElement docElem = designMapDom.documentElement();
for (QDomElement drawPag = docElem.firstChildElement(); !drawPag.isNull(); drawPag = drawPag.nextSiblingElement())
632,7 → 628,7
return true;
}
 
void ODTIm::parseTextSpan(QDomElement &elem, PageItem* item, ParagraphStyle &tmpStyle, CharStyle &tmpCStyle, ObjStyleODT &tmpOStyle, int &posC)
void ODTIm::parseTextSpan(const QDomElement &elem, PageItem* item, const ParagraphStyle &tmpStyle, const CharStyle &tmpCStyle, const ObjStyleODT &tmpOStyle, int &posC)
{
if (!elem.hasChildNodes())
return;
687,7 → 683,7
m_textStylesStack.pop();
}
 
void ODTIm::parseTextParagraph(QDomNode &elem, PageItem* item, ParagraphStyle &newStyle, ObjStyleODT &tmpOStyle, int &posC)
void ODTIm::parseTextParagraph(const QDomNode &elem, PageItem* item, const ParagraphStyle &newStyle, const ObjStyleODT &tmpOStyle, int &posC)
{
ParagraphStyle tmpStyle = newStyle;
CharStyle tmpCStyle = tmpStyle.charStyle();
809,7 → 805,7
m_textStylesStack.pop();
}
 
void ODTIm::parseText(QDomElement &elem, PageItem* item, ObjStyleODT &tmpOStyle)
void ODTIm::parseText(const QDomElement &elem, PageItem* item, const ObjStyleODT &tmpOStyle)
{
QString pStyleD = CommonStrings::DefaultParagraphStyle;
ParagraphStyle newStyle;
865,7 → 861,7
}
}
 
void ODTIm::insertChars(PageItem *item, QString &txt, ParagraphStyle &tmpStyle, CharStyle &tmpCStyle, int &posC)
void ODTIm::insertChars(PageItem *item, QString &txt, const ParagraphStyle &tmpStyle, const CharStyle &tmpCStyle, int &posC)
{
if (txt.length() > 0)
{
877,7 → 873,7
}
}
 
void ODTIm::applyCharacterStyle(CharStyle &tmpCStyle, ObjStyleODT &oStyle)
void ODTIm::applyCharacterStyle(CharStyle &tmpCStyle, const ObjStyleODT &oStyle)
{
tmpCStyle.setFont((*m_Doc->AllFonts)[oStyle.fontName]);
tmpCStyle.setFontSize(oStyle.fontSize * 10);
939,7 → 935,7
setFontstyle(tmpCStyle, 2);
}
 
void ODTIm::applyParagraphStyle(ParagraphStyle &tmpStyle, ObjStyleODT &oStyle)
void ODTIm::applyParagraphStyle(ParagraphStyle &tmpStyle, const ObjStyleODT &oStyle)
{
tmpStyle.setAlignment(oStyle.textAlign);
tmpStyle.setLeftMargin(oStyle.margin_left);
/trunk/Scribus/scribus/plugins/gettext/odt2im/importodt.h
67,7 → 67,7
{
public:
ODTIm(const QString& fileName, PageItem *textItem, bool textOnly, bool prefix, bool append);
~ODTIm();
~ODTIm() = default;
 
private:
struct DrawStyle
105,22 → 105,22
AttributeValue breakAfter;
};
bool parseRawDocReference(const QString& designMap);
bool parseRawDocReferenceXML(QDomDocument &designMapDom);
void parseRawTextSpan(QDomElement &elem, PageItem* item, ParagraphStyle &tmpStyle, CharStyle &tmpCStyle, int &posC);
void parseRawTextParagraph(QDomNode &elem, PageItem* item, ParagraphStyle &newStyle, int &posC);
void parseRawText(QDomElement &elem, PageItem* item);
bool parseRawDocReferenceXML(const QDomDocument &designMapDom);
void parseRawTextSpan(const QDomElement &elem, PageItem* item, ParagraphStyle &tmpStyle, CharStyle &tmpCStyle, int &posC);
void parseRawTextParagraph(const QDomNode &elem, PageItem* item, ParagraphStyle &newStyle, int &posC);
void parseRawText(const QDomElement &elem, PageItem* item);
 
bool parseStyleSheets(const QString& designMap);
bool parseStyleSheetsXML(QDomDocument &designMapDom);
void parseStyles(QDomElement &sp, const QString& type);
bool parseStyleSheetsXML(const QDomDocument &designMapDom);
void parseStyles(const QDomElement &sp, const QString& type);
bool parseDocReference(const QString& designMap);
bool parseDocReferenceXML(QDomDocument &designMapDom);
void parseTextSpan(QDomElement &elem, PageItem* item, ParagraphStyle &tmpStyle, CharStyle &tmpCStyle, ObjStyleODT& tmpOStyle, int &posC);
void parseTextParagraph(QDomNode &elem, PageItem* item, ParagraphStyle &newStyle, ObjStyleODT &tmpOStyle, int &posC);
void parseText(QDomElement &elem, PageItem* item, ObjStyleODT& tmpOStyle);
void insertChars(PageItem *item, QString &txt, ParagraphStyle &tmpStyle, CharStyle &tmpCStyle, int &posC);
void applyCharacterStyle(CharStyle &tmpCStyle, ObjStyleODT &oStyle);
void applyParagraphStyle(ParagraphStyle &tmpStyle, ObjStyleODT &oStyle);
bool parseDocReferenceXML(const QDomDocument &designMapDom);
void parseTextSpan(const QDomElement &elem, PageItem* item, const ParagraphStyle &tmpStyle, const CharStyle &tmpCStyle, const ObjStyleODT& tmpOStyle, int &posC);
void parseTextParagraph(const QDomNode &elem, PageItem* item, const ParagraphStyle &newStyle, const ObjStyleODT &tmpOStyle, int &posC);
void parseText(const QDomElement &elem, PageItem* item, const ObjStyleODT& tmpOStyle);
void insertChars(PageItem *item, QString &txt, const ParagraphStyle &tmpStyle, const CharStyle &tmpCStyle, int &posC);
void applyCharacterStyle(CharStyle &tmpCStyle, const ObjStyleODT &oStyle);
void applyParagraphStyle(ParagraphStyle &tmpStyle, const ObjStyleODT &oStyle);
void resolveStyle(ObjStyleODT &tmpOStyle, const QString& pAttrs);
double parseUnit(const QString &unit);
QString parseColor( const QString &s );