[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-22 10:13:36
Message-ID: 20101022101336.AD772AC897 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1188407 by lassin:

Fixed pptx support for inhering default list styles.


 M  +3 -0      kpresenter/pptx/PptxXmlDocumentReader.h  
 M  +27 -0     kpresenter/pptx/PptxXmlSlideReader.cpp  
 M  +14 -0     libmsooxml/MsooXmlCommonReaderDrawingMLImpl.h  
 M  +16 -0     libmsooxml/MsooXmlUtils.cpp  
 M  +4 -0      libmsooxml/MsooXmlUtils.h  


--- trunk/koffice/filters/kpresenter/pptx/PptxXmlDocumentReader.h #1188406:1188407
@@ -87,6 +87,9 @@
     QVector<QString> defaultTextColors;
     QVector<QString> defaultLatinFonts;
 
+    enum ColorReadingState {rprState, buClrState};
+    ColorReadingState m_colorState;
+
 private:
 
     void init();
--- trunk/koffice/filters/kpresenter/pptx/PptxXmlSlideReader.cpp #1188406:1188407
@@ -1825,40 +1825,62 @@
 
 void PptxXmlSlideReader::inheritListStyles()
 {
+    inheritDefaultListStyles();
+
     // Masterslide layer
     if (!d->phType.isEmpty()) {
         QMapIterator<int, MSOOXML::Utils::ParagraphBulletProperties> \
i(m_context->slideMasterPageProperties->listStyles[d->phType]);  while (i.hasNext()) \
{  i.next();
+            if (i.value().isEmpty()) {
             m_currentCombinedBulletProperties.insert(i.key(), i.value());
         }
+            else {
+                m_currentCombinedBulletProperties[i.key()].addInheritedValues(i.value());
  }
+        }
+    }
     if (!d->phIdx.isEmpty()) {
         QMapIterator<int, MSOOXML::Utils::ParagraphBulletProperties> \
i(m_context->slideMasterPageProperties->listStyles[d->phIdx]);  while (i.hasNext()) {
             i.next();
+            if (i.value().isEmpty()) {
             m_currentCombinedBulletProperties.insert(i.key(), i.value());
         }
+            else {
+                m_currentCombinedBulletProperties[i.key()].addInheritedValues(i.value());
  }
+        }
+    }
     // Layout layer
     if (!d->phType.isEmpty()) {
         if (m_context->type == SlideLayout || m_context->type == Slide) {
             QMapIterator<int, MSOOXML::Utils::ParagraphBulletProperties> \
i(m_context->slideLayoutProperties->listStyles[d->phType]);  while (i.hasNext()) {
                 i.next();
+                if (i.value().isEmpty()) {
                 m_currentCombinedBulletProperties.insert(i.key(), i.value());
             }
+                else {
+                    \
m_currentCombinedBulletProperties[i.key()].addInheritedValues(i.value());  }
     }
+        }
+    }
     if (!d->phIdx.isEmpty()) {
         if (m_context->type == SlideLayout || m_context->type == Slide) {
             QMapIterator<int, MSOOXML::Utils::ParagraphBulletProperties> \
i(m_context->slideLayoutProperties->listStyles[d->phIdx]);  while (i.hasNext()) {
                 i.next();
+                if (i.value().isEmpty()) {
                 m_currentCombinedBulletProperties.insert(i.key(), i.value());
             }
+                else {
+                    \
m_currentCombinedBulletProperties[i.key()].addInheritedValues(i.value());  }
     }
+        }
+    }
 
 
     if (m_context->type == Slide) {
@@ -1869,11 +1891,16 @@
             QMapIterator<int, MSOOXML::Utils::ParagraphBulletProperties> \
i(m_context->currentSlideStyles.listStyles[slideIdentifier]);  while (i.hasNext()) {
                 i.next();
+                if (i.value().isEmpty()) {
                 m_currentCombinedBulletProperties.insert(i.key(), i.value());
             }
+                else {
+                    \
m_currentCombinedBulletProperties[i.key()].addInheritedValues(i.value());  }
     }
 }
+    }
+}
 
 void PptxXmlSlideReader::inheritDefaultTextStyle(KoGenStyle& targetStyle)
 {
--- trunk/koffice/filters/libmsooxml/MsooXmlCommonReaderDrawingMLImpl.h \
#1188406:1188407 @@ -3620,7 +3620,12 @@
 
 #ifdef PPTXXMLDOCUMENTREADER_CPP
     // We skip reading this one properly as we do not know the correct theme in the \
time of reading +    if (m_colorState == PptxXmlDocumentReader::rprState) {
     defaultTextColors[defaultTextColors.size() - 1] = val;
+    }
+    else {
+        defaultBulletColors[defaultBulletColors.size() - 1] = val;
+    }
 
     skipCurrentElement();
     READ_EPILOGUE
@@ -4471,6 +4476,11 @@
 KoFilter::ConversionStatus MSOOXML_CURRENT_CLASS::read_buClr()
 {
     READ_PROLOGUE
+
+#ifdef PPTXXMLDOCUMENTREADER_CPP
+    m_colorState = PptxXmlDocumentReader::buClrState;
+#endif
+
     while (true) {
         readNext();
         BREAK_IF_END_OF(CURRENT_EL);
@@ -4958,6 +4968,10 @@
 
     m_currentColor = QColor();
 
+#ifdef PPTXXMLDOCUMENTREADER_CPP
+    m_colorState = PptxXmlDocumentReader::rprState;
+#endif
+
     while (!atEnd()) {
         readNext();
         kDebug() << *this;
--- trunk/koffice/filters/libmsooxml/MsooXmlUtils.cpp #1188406:1188407
@@ -1374,6 +1374,11 @@
     m_bulletColor = bulletColor;
 }
 
+MSOOXML_EXPORT QString Utils::ParagraphBulletProperties::bulletColor() const
+{
+    return m_bulletColor;
+}
+
 MSOOXML_EXPORT QString Utils::ParagraphBulletProperties::bulletChar() const
 {
     return m_bulletChar;
@@ -1384,6 +1389,17 @@
     return m_bulletFont;
 }
 
+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 (m_type == ParagraphBulletProperties::BulletType && m_bulletChar.isEmpty()) {
+        m_bulletChar = properties.bulletChar();
+    }
+}
+
 MSOOXML_EXPORT QString Utils::ParagraphBulletProperties::convertToListProperties() \
const  {
     QString returnValue;
--- trunk/koffice/filters/libmsooxml/MsooXmlUtils.h #1188406:1188407
@@ -93,10 +93,14 @@
     
     void setBulletColor(const QString& bulletColor);
 
+    QString bulletColor() const;
+
     QString bulletChar() const;
 
     QString bulletFont() const;
 
+    void addInheritedValues(const ParagraphBulletProperties& properties);
+
     int m_level;
     int m_startValue;
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic