Commit 48740f19 authored by Matus Uzak's avatar Matus Uzak
Browse files

docx: Added support for bidi el. (Right to Left Section Layout).

Changed interpretation of values of the jc element: In order to
support different writing modes, left and right should be
interpreted as start and end respectively.

Reverted 36531721

CCBUG:286971
parent a3d46a11
......@@ -154,7 +154,6 @@ void DocxXmlDocumentReader::init()
m_closeHyperlink = false;
m_listFound = false;
m_insideParagraph = false;
m_isRightToLeftText = false;
m_createSectionStyle = false;
m_createSectionToNext = false;
m_currentVMLProperties.insideGroup = false;
......@@ -314,7 +313,7 @@ KoFilter::ConversionStatus DocxXmlDocumentReader::read_body()
- docPartBody (§17.12.6)
Chils elements:
- bidi (Right to Left Section Layout) §17.6.1
- [done] bidi (Right to Left Section Layout) §17.6.1
- [done] cols (Column Definitions) §17.6.4
- docGrid (Document Grid) §17.6.5
- [done] endnotePr (Section-Wide Endnote Properties) §17.11.5
......@@ -382,6 +381,9 @@ KoFilter::ConversionStatus DocxXmlDocumentReader::read_sectPr()
ELSE_TRY_READ_IF(footnotePr)
ELSE_TRY_READ_IF(endnotePr)
ELSE_TRY_READ_IF(lnNumType)
else if (name() == "bidi") {
m_currentPageStyle.addProperty("style:writing-mode", "rl-tb");
}
SKIP_UNKNOWN
}
}
......@@ -2339,16 +2341,6 @@ KoFilter::ConversionStatus DocxXmlDocumentReader::read_p()
m_currentParagraphStyle.removeAllProperties(KoGenStyle::TextType);
}
if (m_isRightToLeftText) {
QString align = m_currentParagraphStyle.property("fo:text-align");
if (align == "left") {
m_currentParagraphStyle.addProperty("fo:text-align", "start");
}
else if (align == "right") {
m_currentParagraphStyle.addProperty("fo:text-align", "end");
}
}
//---------------------------------------------
// Process Paragraph Content
//---------------------------------------------
......@@ -2924,7 +2916,7 @@ KoFilter::ConversionStatus DocxXmlDocumentReader::read_r()
- [done] rFonts (Run Fonts) §17.3.2.26
- rPrChange (Revision Information for Run Properties on the Paragraph Mark) §17.13.5.30
- [done] rStyle (Referenced Character Style) §17.3.2.29
- [done] rtl (Right To Left Text) §17.3.2.30
- rtl (Right To Left Text) §17.3.2.30
- shadow (Shadow) §17.3.2.31
- [done] shd (Run Shading) §17.3.2.32
- [done] smallCaps (Small Caps) §17.3.2.33
......@@ -2976,9 +2968,6 @@ KoFilter::ConversionStatus DocxXmlDocumentReader::read_rPr()
ELSE_TRY_READ_IF(webHidden)
ELSE_TRY_READ_IF(bdr)
ELSE_TRY_READ_IF(vanish)
else if (name() == "rtl") {
m_isRightToLeftText = true;
}
SKIP_UNKNOWN
//! @todo add ELSE_WRONG_FORMAT
}
......@@ -3884,7 +3873,7 @@ KoFilter::ConversionStatus DocxXmlDocumentReader::read_jc(jcCaller caller)
}
else if ((val == "start") || (val == "left")) {
if (caller == jc_pPr) {
m_currentParagraphStyle.addProperty("fo:text-align", val);
m_currentParagraphStyle.addProperty("fo:text-align", "start");
}
else {
m_tableMainStyle->setHorizontalAlign(KoTblStyle::LeftAlign);
......@@ -3892,7 +3881,7 @@ KoFilter::ConversionStatus DocxXmlDocumentReader::read_jc(jcCaller caller)
}
else if ((val == "right") || (val == "end")) {
if (caller == jc_pPr) {
m_currentParagraphStyle.addProperty("fo:text-align", val);
m_currentParagraphStyle.addProperty("fo:text-align", "end");
}
else {
m_tableMainStyle->setHorizontalAlign(KoTblStyle::RightAlign);
......
......@@ -363,7 +363,6 @@ private:
bool m_closeHyperlink; // should read_r close hyperlink
bool m_listFound; // was there numPr element in ppr
bool m_insideParagraph;
bool m_isRightToLeftText;
QString m_currentNumId;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment