[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: koffice/filters
From: Lassi Taneli Nieminen <lassniem () gmail ! com>
Date: 2010-10-26 12:46:05
Message-ID: 20101026124605.904DFAC897 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1189939 by lassin:
Fixed drawingML support for relatively sized picture bullets.
M +1 -1 kpresenter/pptx/PptxXmlSlideReader.cpp
M +1 -1 kword/docx/DocxXmlNumberingReader.cpp
M +68 -21 libmsooxml/MsooXmlCommonReaderDrawingMLImpl.h
M +1 -0 libmsooxml/MsooXmlCommonReaderDrawingMLMethods.h
M +61 -15 libmsooxml/MsooXmlUtils.cpp
M +8 -4 libmsooxml/MsooXmlUtils.h
--- trunk/koffice/filters/kpresenter/pptx/PptxXmlSlideReader.cpp #1189938:1189939
@@ -1840,6 +1840,7 @@
}
}
}
+
if (!d->phIdx.isEmpty()) {
QMapIterator<int, MSOOXML::Utils::ParagraphBulletProperties> \
i(m_context->slideMasterPageProperties->listStyles[d->phIdx]); while (i.hasNext()) {
@@ -1882,7 +1883,6 @@
}
}
-
if (m_context->type == Slide) {
QString slideIdentifier = d->phType + d->phIdx;
--- trunk/koffice/filters/kword/docx/DocxXmlNumberingReader.cpp #1189938:1189939
@@ -492,7 +492,7 @@
TRY_READ_ATTR(val)
if (!val.isEmpty()) {
m_currentBulletProperties.setPicturePath(m_picBulletPaths.value(val));
- m_currentBulletProperties.setPictureSize(m_picBulletSizes.value(val));
+ m_currentBulletProperties.setBulletSize(m_picBulletSizes.value(val));
}
readNext();
--- trunk/koffice/filters/libmsooxml/MsooXmlCommonReaderDrawingMLImpl.h \
#1189938:1189939 @@ -1617,6 +1617,7 @@
if (!pprRead) {
inheritDefaultParagraphStyle(m_currentParagraphStyle);
inheritParagraphStyle(m_currentParagraphStyle);
+ m_currentBulletProperties = \
m_currentCombinedBulletProperties[m_currentListLevel]; }
if (!rRead) {
// We are inheriting to paragraph's text-properties because there is no text
@@ -1640,8 +1641,30 @@
}
m_previousListWasAltered = false;
}
+ if (m_currentBulletProperties.bulletRelativeSize() != "UNUSED") {
+ m_listStylePropertiesAltered = true;
+ QString textSize = m_currentTextStyle.property("fo:font-size");
+ if (!textSize.isEmpty()) {
+ textSize = textSize.left(textSize.length() - 2); // removes 'pt'
+ qreal convertedSize = textSize.toDouble() * \
m_currentBulletProperties.bulletRelativeSize().toDouble()/100; + \
m_currentBulletProperties.setBulletSize(QSize(convertedSize, convertedSize)); + \
} + }
+ if (m_currentBulletProperties.bulletFont().startsWith("Wingdings") && \
m_currentBulletProperties.bulletChar() != "UNUSED") { + // Ooxml files have \
very often wingdings fonts, but usually they are not installed + // Making the \
bullet character look ugly, thus defaulting to "-" + \
m_listStylePropertiesAltered = true; + \
m_currentBulletProperties.setBulletChar("-"); + }
if (m_listStylePropertiesAltered) {
+ m_currentListStyle = KoGenStyle(KoGenStyle::ListAutoStyle, "list");
+
+ // For now we take a stand that any altered style makes its own list.
+ m_currentBulletProperties.m_level = m_currentListLevel;
+
+ m_currentListStyle.addChildElement("list-style-properties",
+ m_currentBulletProperties.convertToListProperties());
m_previousListWasAltered = true;
}
@@ -1650,7 +1673,8 @@
// we don't output a bullet to it
m_currentListLevel = 0;
}
- else if (m_currentCombinedBulletProperties.value(m_currentListLevel).isEmpty() \
&& !m_listStylePropertiesAltered) { + else if \
((m_currentCombinedBulletProperties.value(m_currentListLevel).isEmpty() && \
!m_listStylePropertiesAltered) || + (m_currentBulletProperties.isEmpty() \
&& m_listStylePropertiesAltered)) { m_currentListLevel = 0;
}
@@ -2052,7 +2076,7 @@
- [done] buFont (Specified) §21.1.2.4.6
- buFontTx (Follow text) §21.1.2.4.7
- [done] buNone (No Bullet) §21.1.2.4.8
- - buSzPct (Bullet Size Percentage) §21.1.2.4.9
+ - [done] buSzPct (Bullet Size Percentage) §21.1.2.4.9
- buSzPts (Bullet Size Points) §21.1.2.4.10
- buSzTx (Bullet Size Follows Text) §21.1.2.4.11
- defRPr (Default Text Run Properties) §21.1.2.3.2
@@ -2120,6 +2144,7 @@
ELSE_TRY_READ_IF(buClr)
ELSE_TRY_READ_IF(buFont)
ELSE_TRY_READ_IF(buBlip)
+ ELSE_TRY_READ_IF(buSzPct)
else if (QUALIFIED_NAME_IS(spcBef)) {
m_currentSpacingType = spacingMarginTop;
TRY_READ(spcBef)
@@ -2135,23 +2160,6 @@
}
}
- if (m_currentBulletProperties.bulletFont().startsWith("Wingdings") && \
m_currentBulletProperties.bulletChar() != "") {
- // Ooxml files have very often wingdings fonts, but usually they are not \
installed
- // Making the bullet character look ugly, thus defaulting to "-"
- m_listStylePropertiesAltered = true;
- m_currentBulletProperties.setBulletChar("-");
- }
-
- if (m_listStylePropertiesAltered) {
- m_currentListStyle = KoGenStyle(KoGenStyle::ListAutoStyle, "list");
-
- // For now we take a stand that any altered style makes its own list.
- m_currentBulletProperties.m_level = m_currentListLevel;
-
- m_currentListStyle.addChildElement("list-style-properties",
- m_currentBulletProperties.convertToListProperties());
- }
-
READ_EPILOGUE
}
@@ -4165,6 +4173,8 @@
// Number 3 makes eg. lvl4 -> 4
m_currentListLevel = QString(level.at(3)).toInt();
+ m_currentBulletProperties = \
m_currentCombinedBulletProperties[m_currentListLevel]; +
Q_ASSERT(m_currentListLevel > 0);
m_currentBulletProperties.m_level = m_currentListLevel;
@@ -4213,6 +4223,7 @@
ELSE_TRY_READ_IF(buFont)
ELSE_TRY_READ_IF(buBlip)
ELSE_TRY_READ_IF(buClr)
+ ELSE_TRY_READ_IF(buSzPct)
else if (QUALIFIED_NAME_IS(spcBef)) {
m_currentSpacingType = spacingMarginTop;
TRY_READ(spcBef)
@@ -4270,7 +4281,7 @@
- [done] buFont (Specified) §21.1.2.4.6
- buFontTx (Follow text) §21.1.2.4.7
- [done] buNone (No Bullet) §21.1.2.4.8
- - buSzPct (Bullet Size Percentage) §21.1.2.4.9
+ - [done] buSzPct (Bullet Size Percentage) §21.1.2.4.9
- buSzPts (Bullet Size Points) §21.1.2.4.10
- buSzTx (Bullet Size Follows Text) §21.1.2.4.11
- [done] defRPr (Default Text Run Properties) §21.1.2.3.2
@@ -4407,7 +4418,7 @@
if (!m_xlinkHref.isEmpty()) {
m_currentBulletProperties.setPicturePath(m_xlinkHref);
- m_currentBulletProperties.setPictureSize(m_imageSize);
+ m_currentBulletProperties.setBulletSize(m_imageSize);
m_listStylePropertiesAltered = true;
}
@@ -4501,6 +4512,42 @@
}
#undef CURRENT_EL
+#define CURRENT_EL buSzPct
+//! buSzPct - bullet size
+/*!
+ Parent elements:
+ - defPPr ( §21.1.2.2.2)
+ - [done] lvl1pPr ( §21.1.2.4.13)
+ - [done] lvl2pPr ( §21.1.2.4.14)
+ - [done] lvl3pPr ( §21.1.2.4.15)
+ - [done] lvl4pPr ( §21.1.2.4.16)
+ - [done] lvl5pPr ( §21.1.2.4.17)
+ - [done] lvl6pPr ( §21.1.2.4.18)
+ - [done] lvl7pPr ( §21.1.2.4.19)
+ - [done] lvl8pPr ( §21.1.2.4.20)
+ - [done] lvl9pPr ( §21.1.2.4.21)
+ - [done] pPr ( §21.1.2.2.7)
+
+ Child elements:
+ - none
+*/
+KoFilter::ConversionStatus MSOOXML_CURRENT_CLASS::read_buSzPct()
+{
+ READ_PROLOGUE
+ const QXmlStreamAttributes attrs(attributes());
+ TRY_READ_ATTR_WITHOUT_NS(val)
+
+ if (!val.isEmpty()) {
+ // As percentage
+ m_currentBulletProperties.setBulletRelativeSize(val.toInt()/1000);
+ }
+
+ readNext();
+
+ READ_EPILOGUE
+}
+
+#undef CURRENT_EL
#define CURRENT_EL buFont
//! buFont - bullet font
/*!
--- trunk/koffice/filters/libmsooxml/MsooXmlCommonReaderDrawingMLMethods.h \
#1189938:1189939 @@ -151,6 +151,7 @@
bool m_previousListWasAltered;
KoFilter::ConversionStatus read_buClr();
+KoFilter::ConversionStatus read_buSzPct();
KoFilter::ConversionStatus read_buChar();
KoFilter::ConversionStatus read_buBlip();
KoFilter::ConversionStatus read_buNone();
--- trunk/koffice/filters/libmsooxml/MsooXmlUtils.cpp #1189938:1189939
@@ -157,6 +157,9 @@
// A.7 Custom XML Schema References
const char* const MSOOXML::Schemas::schemaLibrary = \
"http://schemas.openxmlformats.org/schemaLibrary/2006/main";
+// Marks that the value has not been modified;
+const char* UNUSED = "UNUSED";
+
using namespace MSOOXML;
//-----------------------------------------
@@ -1305,14 +1308,15 @@
// </units> -------------------
MSOOXML_EXPORT Utils::ParagraphBulletProperties::ParagraphBulletProperties() :
- m_startValue(0), m_type(ParagraphBulletProperties::BulletType), \
m_bulletChar(""),
- m_align(""), m_indent(0), m_bulletColor("")
+ m_startValue(0), m_type(ParagraphBulletProperties::DefaultType), \
m_bulletFont(UNUSED), + m_bulletChar(UNUSED), m_numFormat(UNUSED), \
m_suffix(UNUSED), m_align(UNUSED), + m_indent(UNUSED), m_picturePath(UNUSED), \
m_bulletColor(UNUSED), m_bulletRelativeSize(UNUSED) {
}
MSOOXML_EXPORT bool Utils::ParagraphBulletProperties::isEmpty() const
{
- if (m_bulletChar == "" && m_type == ParagraphBulletProperties::BulletType) {
+ if (m_type == ParagraphBulletProperties::DefaultType) {
return true;
}
return false;
@@ -1321,9 +1325,16 @@
MSOOXML_EXPORT void Utils::ParagraphBulletProperties::clear()
{
m_startValue = 0;
- setBulletChar("");
- m_align = "";
- m_indent = 0;
+ m_type = ParagraphBulletProperties::DefaultType;
+ m_bulletFont = UNUSED;
+ m_bulletChar = UNUSED;
+ m_numFormat = UNUSED;
+ m_suffix = UNUSED;
+ m_align = UNUSED;
+ m_indent = UNUSED;
+ m_picturePath = UNUSED;
+ m_bulletColor = UNUSED;
+ m_bulletRelativeSize = UNUSED;
}
MSOOXML_EXPORT void Utils::ParagraphBulletProperties::setAlign(const QString& align)
@@ -1331,6 +1342,11 @@
m_align = align;
}
+MSOOXML_EXPORT void Utils::ParagraphBulletProperties::setBulletRelativeSize(int \
size) +{
+ m_bulletRelativeSize = QString("%1").arg(size);
+}
+
MSOOXML_EXPORT void Utils::ParagraphBulletProperties::setBulletChar(const QString& \
bulletChar) {
m_bulletChar = bulletChar;
@@ -1339,7 +1355,7 @@
MSOOXML_EXPORT void Utils::ParagraphBulletProperties::setIndent(const qreal indent)
{
- m_indent = indent;
+ m_indent = QString("%1").arg(indent);
}
MSOOXML_EXPORT void Utils::ParagraphBulletProperties::setSuffix(const QString& \
suffixChar) @@ -1359,7 +1375,7 @@
m_type = ParagraphBulletProperties::PictureType;
}
-MSOOXML_EXPORT void Utils::ParagraphBulletProperties::setPictureSize(const QSize& \
size) +MSOOXML_EXPORT void Utils::ParagraphBulletProperties::setBulletSize(const \
QSize& size) {
m_pictureSize = size;
}
@@ -1389,16 +1405,46 @@
return m_bulletFont;
}
+MSOOXML_EXPORT QString Utils::ParagraphBulletProperties::bulletRelativeSize() const
+{
+ return m_bulletRelativeSize;
+}
+
MSOOXML_EXPORT void Utils::ParagraphBulletProperties::addInheritedValues(const \
ParagraphBulletProperties& properties) {
// This function is intented for helping to inherit some values from other \
properties
- if (!m_bulletColor.isEmpty()) {
- m_bulletColor = properties.bulletColor();
+ if (properties.m_type != ParagraphBulletProperties::DefaultType) {
+ m_type = properties.m_type;
}
- if (m_type == ParagraphBulletProperties::BulletType && m_bulletChar.isEmpty()) {
- m_bulletChar = properties.bulletChar();
+ if (properties.m_bulletFont != UNUSED) {
+ m_bulletFont = m_bulletFont;
}
+ if (properties.m_bulletChar != UNUSED) {
+ m_bulletChar = properties.m_bulletChar;
}
+ if (properties.m_numFormat != UNUSED) {
+ m_numFormat = properties.m_numFormat;
+ }
+ if (properties.m_suffix != UNUSED) {
+ m_suffix = properties.m_suffix;
+ }
+ if (properties.m_align != UNUSED) {
+ m_align = properties.m_align;
+ }
+ if (properties.m_indent != UNUSED) {
+ m_indent = properties.m_indent;
+ }
+ if (properties.m_picturePath != UNUSED) {
+ m_picturePath = properties.m_picturePath;
+ }
+ if (properties.m_bulletColor != UNUSED) {
+ m_bulletColor = properties.m_bulletColor;
+ }
+ if (properties.m_bulletRelativeSize != UNUSED) {
+ m_bulletRelativeSize = properties.m_bulletRelativeSize;
+ }
+ m_pictureSize = properties.m_pictureSize;
+}
MSOOXML_EXPORT QString Utils::ParagraphBulletProperties::convertToListProperties() \
const {
@@ -1423,14 +1469,14 @@
returnValue += QString("text:bullet-char=\"%1\" ").arg(m_bulletChar);
ending = "</text:list-level-style-bullet>";
}
- if (!m_align.isEmpty()) {
+ if (m_align != "UNUSED") {
returnValue += QString("fo:text-align=\"%1\" ").arg(m_align);
}
returnValue += ">";
returnValue += "<style:list-level-properties ";
- if (m_indent > 0) {
+ if (m_indent != "UNUSED") {
returnValue += QString("text:space-before=\"%1pt\" ").arg(m_indent);
}
@@ -1443,7 +1489,7 @@
returnValue += "<style:text-properties ";
- if (!m_bulletColor.isEmpty()) {
+ if (m_bulletColor != "UNUSED") {
returnValue += QString("fo:color=\"%1\" ").arg(m_bulletColor);
}
--- trunk/koffice/filters/libmsooxml/MsooXmlUtils.h #1189938:1189939
@@ -39,7 +39,6 @@
class QLocale;
class QDomElement;
class QDomDocument;
-class QSize;
class KZip;
struct KoOdfWriters;
class KoCharacterStyle;
@@ -87,7 +86,7 @@
void setPicturePath(const QString& picturePath);
- void setPictureSize(const QSize& size);
+ void setBulletSize(const QSize& size);
void setBulletFont(const QString& font);
@@ -101,11 +100,15 @@
void addInheritedValues(const ParagraphBulletProperties& properties);
+ void setBulletRelativeSize(int size);
+
+ QString bulletRelativeSize() const;
+
int m_level;
int m_startValue;
private:
- enum ParagraphBulletType {BulletType, NumberType, PictureType};
+ enum ParagraphBulletType {BulletType, NumberType, PictureType, DefaultType};
ParagraphBulletType m_type;
QString m_bulletFont;
@@ -113,10 +116,11 @@
QString m_numFormat;
QString m_suffix;
QString m_align;
- qreal m_indent;
+ QString m_indent;
QString m_picturePath;
QString m_bulletColor;
QSize m_pictureSize;
+ QString m_bulletRelativeSize;
};
//! Container autodeleter. Works for QList, QHash and QMap.
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic