Commit ec8f8b96 authored by Matus Uzak's avatar Matus Uzak
Browse files

docx: picture bullets - update bulletSizePt in order to have correct picture size.

* In case only bulletRelativeSize is provided then use the default font-size
  or the font-size of the text chunk (if provided) to set bulletSizePt.
  The absolute font-size specifies fo:width and fo:height for the picture bullet.

CCBUG:239469
parent 8f4eb962
......@@ -227,6 +227,7 @@ KoFilter::ConversionStatus DocxImport::parseParts(KoOdfWriters *writers, MSOOXML
mainContext.m_tableStyles = context.m_tableStyles;
mainContext.m_namedDefaultStyles = context.m_namedDefaultStyles;
mainContext.m_defaultFontSizePt = context.m_defaultFontSizePt;
}
}
......
......@@ -2065,6 +2065,28 @@ KoFilter::ConversionStatus DocxXmlDocumentReader::read_p()
// In ooxml it seems that nothing should be created if sectPr was present
if (!m_createSectionToNext) {
if (m_listFound) {
// update the size of a bullet picture
if ((m_currentBulletProperties.m_type == MSOOXML::Utils::ParagraphBulletProperties::PictureType)
&& (m_currentBulletProperties.bulletSizePt() == "UNUSED")) {
int percent = 100;
if (m_currentBulletProperties.bulletRelativeSize() != "UNUSED") {
STRING_TO_INT(m_currentBulletProperties.bulletRelativeSize(), percent,
QString("PictureType: processing bulletRelativeSize"));
}
QString fontSize = m_currentParagraphStyle.property("fo:font-size",KoGenStyle::TextType);
// Using the default font size at the moment
if (fontSize.isEmpty()) {
fontSize = m_context->m_defaultFontSizePt;
}
qreal base = 10; //fair enough
if (!fontSize.isEmpty() && fontSize.endsWith("pt")) {
fontSize.chop(2);
STRING_TO_QREAL(fontSize, base, QString("PictureType: processing font-size"));
}
m_currentBulletProperties.setBulletSizePt(percent * base / 100);
}
// update automatic numbering info
if (m_currentBulletProperties.m_type == MSOOXML::Utils::ParagraphBulletProperties::NumberType) {
......
......@@ -427,6 +427,8 @@ public:
// is inherited by a numbering definition instance identified by numId (key).
QMap<QString, QString> m_abstractNumIDs;
QString m_defaultFontSizePt;
private:
};
......
......@@ -193,6 +193,10 @@ KoFilter::ConversionStatus DocxXmlStylesReader::read_docDefaults()
m_currentTextStyle.addProperty("style:use-window-font-color", "true");
}
if (!m_currentTextStyle.property("fo:font-size").isEmpty()) {
m_context->m_defaultFontSizePt = m_currentTextStyle.property("fo:font-size");
}
KoGenStyle::copyPropertiesFromStyle(m_currentTextStyle, m_currentParagraphStyle, KoGenStyle::TextType);
if (m_currentParagraphStyle.property("fo:line-height").isEmpty() &&
......
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