[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-11-08 12:57:31
Message-ID: 20101108125731.5201DAC89B () svn ! kde ! org
[Download RAW message or body]

SVN commit 1194249 by lassin:

Fixed pptx text shrinking so that value can be received also from masterslide.


 M  +27 -2     kpresenter/pptx/PptxXmlSlideReader.cpp  
 M  +6 -0      kpresenter/pptx/PptxXmlSlideReader.h  
 M  +12 -10    libmsooxml/MsooXmlCommonReaderDrawingMLImpl.h  
 M  +2 -0      libmsooxml/MsooXmlCommonReaderDrawingMLMethods.h  
 M  +4 -0      libmsooxml/MsooXmlUtils.h  


--- trunk/koffice/filters/kpresenter/pptx/PptxXmlSlideReader.cpp #1194248:1194249
@@ -118,6 +118,7 @@
 PptxSlideLayoutProperties::PptxSlideLayoutProperties()
 {
     m_drawingPageProperties = KoGenStyle(KoGenStyle::DrawingPageAutoStyle, \
"drawing-page"); +    m_textAutoFit = MSOOXML::Utils::autoFitUnUsed;
 }
 
 PptxSlideLayoutProperties::~PptxSlideLayoutProperties()
@@ -131,6 +132,7 @@
 PptxSlideMasterPageProperties::PptxSlideMasterPageProperties()
 {
     m_drawingPageProperties = KoGenStyle(KoGenStyle::DrawingPageAutoStyle, \
"drawing-page"); +    m_textAutoFit = MSOOXML::Utils::autoFitUnUsed;
 }
 
 void PptxSlideMasterPageProperties::clear()
@@ -1596,6 +1598,7 @@
             m_context->slideMasterPageProperties->textRightBorders[d->phIdx] = \
                m_shapeTextRightOff;
             m_context->slideMasterPageProperties->textTopBorders[d->phIdx] = \
                m_shapeTextTopOff;
             m_context->slideMasterPageProperties->textBottomBorders[d->phIdx] = \
m_shapeTextBottomOff; +            \
m_context->slideMasterPageProperties->m_textAutoFit = m_normAutoFit;  }
         if (!d->phType.isEmpty()) {
             m_context->slideMasterPageProperties->textShapePositions[d->phType] = \
m_shapeTextPosition; @@ -1603,6 +1606,7 @@
             m_context->slideMasterPageProperties->textRightBorders[d->phType] = \
                m_shapeTextRightOff;
             m_context->slideMasterPageProperties->textTopBorders[d->phType] = \
                m_shapeTextTopOff;
             m_context->slideMasterPageProperties->textBottomBorders[d->phType] = \
m_shapeTextBottomOff; +            \
m_context->slideMasterPageProperties->m_textAutoFit = m_normAutoFit;  }
     }
     else if (m_context->type == SlideLayout) {
@@ -1612,6 +1616,7 @@
             m_context->slideLayoutProperties->textRightBorders[d->phIdx] = \
                m_shapeTextRightOff;
             m_context->slideLayoutProperties->textTopBorders[d->phIdx] = \
                m_shapeTextTopOff;
             m_context->slideLayoutProperties->textBottomBorders[d->phIdx] = \
m_shapeTextBottomOff; +            m_context->slideLayoutProperties->m_textAutoFit = \
m_normAutoFit;  }
         if (!d->phType.isEmpty()) {
             m_context->slideLayoutProperties->textShapePositions[d->phType] = \
m_shapeTextPosition; @@ -1619,14 +1624,13 @@
             m_context->slideLayoutProperties->textRightBorders[d->phType] = \
                m_shapeTextRightOff;
             m_context->slideLayoutProperties->textTopBorders[d->phType] = \
                m_shapeTextTopOff;
             m_context->slideLayoutProperties->textBottomBorders[d->phType] = \
m_shapeTextBottomOff; +            m_context->slideLayoutProperties->m_textAutoFit = \
m_normAutoFit;  }
     }
 }
 
 void PptxXmlSlideReader::inheritBodyProperties()
 {
-    // For now only text position is inherited, in the future
-    // stuff like fit-to-frame etc should be inherited most likely
     if (m_context->type == SlideMaster) {
         return; // Nothing needed for slidemaster
     }
@@ -1635,6 +1639,7 @@
 
     if (!d->phIdx.isEmpty()) {
         // In all cases, we take them first from masterslide
+
         position = m_context->slideMasterPageProperties->textShapePositions.value(d->phIdx);
  if (!position.isEmpty()) {
             m_shapeTextPosition = position;
@@ -1655,7 +1660,12 @@
         if (!bottom.isEmpty()) {
             m_shapeTextLeftOff = bottom;
         }
+        if (m_context->slideMasterPageProperties->m_textAutoFit != \
MSOOXML::Utils::autoFitUnUsed) { +             if (m_normAutoFit == \
MSOOXML::Utils::autoFitUnUsed) { +                 m_normAutoFit = \
m_context->slideMasterPageProperties->m_textAutoFit;  }
+        }
+    }
     if (!d->phType.isEmpty()) {
         // In all cases, we take them first from masterslide
         position = m_context->slideMasterPageProperties->textShapePositions.value(d->phType);
 @@ -1678,7 +1688,12 @@
         if (!bottom.isEmpty()) {
             m_shapeTextLeftOff = bottom;
         }
+        if (m_context->slideMasterPageProperties->m_textAutoFit != \
MSOOXML::Utils::autoFitUnUsed) { +             if (m_normAutoFit == \
MSOOXML::Utils::autoFitUnUsed) { +                 m_normAutoFit = \
m_context->slideMasterPageProperties->m_textAutoFit;  }
+        }
+    }
     if (m_context->type == SlideLayout) {
         return; // No futher actions needed for layout
     }
@@ -1703,7 +1718,12 @@
         if (!bottom.isEmpty()) {
             m_shapeTextLeftOff = bottom;
         }
+        if (m_context->slideLayoutProperties->m_textAutoFit != \
MSOOXML::Utils::autoFitUnUsed) { +             if (m_normAutoFit == \
MSOOXML::Utils::autoFitUnUsed) { +                 m_normAutoFit = \
m_context->slideMasterPageProperties->m_textAutoFit;  }
+        }
+    }
     if (!d->phIdx.isEmpty()) {
         position = m_context->slideLayoutProperties->textShapePositions.value(d->phIdx);
  if (!position.isEmpty()) {
@@ -1725,8 +1745,13 @@
         if (!bottom.isEmpty()) {
             m_shapeTextLeftOff = bottom;
         }
+        if (m_context->slideLayoutProperties->m_textAutoFit != \
MSOOXML::Utils::autoFitUnUsed) { +             if (m_normAutoFit == \
MSOOXML::Utils::autoFitUnUsed) { +                 m_normAutoFit = \
m_context->slideMasterPageProperties->m_textAutoFit;  }
 }
+    }
+}
 
 void PptxXmlSlideReader::inheritDefaultBodyProperties()
 {
--- trunk/koffice/filters/kpresenter/pptx/PptxXmlSlideReader.h #1194248:1194249
@@ -131,6 +131,9 @@
     //! Position of the text
     QMap<QString, QString> textShapePositions;
 
+    //! Possible text shrinkage
+    MSOOXML::Utils::autoFitStatus m_textAutoFit;
+
     //! Borders in the frame
     QMap<QString, QString> textLeftBorders;
     QMap<QString, QString> textRightBorders;
@@ -170,6 +173,9 @@
     //! Position of the text
     QMap<QString, QString> textShapePositions;
 
+    //! Possible text shrinkage
+    MSOOXML::Utils::autoFitStatus m_textAutoFit;
+
     //! Borders in the frame
     QMap<QString, QString> textLeftBorders;
     QMap<QString, QString> textRightBorders;
--- trunk/koffice/filters/libmsooxml/MsooXmlCommonReaderDrawingMLImpl.h \
#1194248:1194249 @@ -710,7 +710,10 @@
 
     inheritDefaultBodyProperties();
     inheritBodyProperties(); // Properties may or may not override default ones.
-#else
+
+    if (m_normAutoFit == MSOOXML::Utils::autoFitOn) {
+        m_currentPresentationStyle.addProperty("draw:fit-to-size", "true", \
KoGenStyle::GraphicType); +    }
 #endif
     if (m_contentType == "line") {
         body->startElement("draw:line");
@@ -5178,7 +5181,7 @@
  - flatTx (No text in 3D scene)  §20.1.5.8
  - noAutofit (No AutoFit)  §21.1.2.1.2
  - [done] normAutofit (Normal AutoFit)  §21.1.2.1.3
- - prstTxWarp (Preset Text Warp)  §20.1.9.19
+ - [done] prstTxWarp (Preset Text Warp)  §20.1.9.19
  - scene3d (3D Scene Properties)  §20.1.4.1.26
  - sp3d (Apply 3D shape properties)  §20.1.5.12
  - [done] spAutoFit (Shape AutoFit)  §21.1.2.1.4
@@ -5212,9 +5215,7 @@
     m_shapeTextLeftOff.clear();
     m_shapeTextRightOff.clear();
 
-#ifdef PPTXXMLSLIDEREADER_CPP
-    inheritBodyProperties();
-#endif
+    m_normAutoFit =  MSOOXML::Utils::autoFitUnUsed;
 
     if (!lIns.isEmpty()) {
         m_shapeTextLeftOff = lIns;
@@ -5247,7 +5248,6 @@
 //! @todo more atributes
 
     bool spAutoFit = false;
-    bool normAutoFit = false;
     while (!atEnd()) {
         readNext();
         BREAK_IF_END_OF(CURRENT_EL);
@@ -5257,10 +5257,15 @@
                 spAutoFit = true;
             }
             else if (qualifiedName() == QLatin1String("a:normAutofit")) {
-                normAutoFit = true;
+                m_normAutoFit = MSOOXML::Utils::autoFitOn;
             }
+            else if (qualifiedName() == QLatin1String("a:prstTxWarp")) {
+                // The handling here is not correct but better than nothing
+                // Also normAutoFit = true seems to be correct for value \
'textNoShape' +                m_normAutoFit = MSOOXML::Utils::autoFitOn;
         }
     }
+    }
 
 #ifdef PPTXXMLSLIDEREADER_CPP
 
@@ -5274,9 +5279,6 @@
     // text in shape
     m_currentPresentationStyle.addProperty("fo:wrap-option",
         wrap == QLatin1String("none") ? QLatin1String("no-wrap") : \
                QLatin1String("wrap"), KoGenStyle::GraphicType);
-    if (normAutoFit) {
-        m_currentPresentationStyle.addProperty("draw:fit-to-size", "true", \
                KoGenStyle::GraphicType);
-    }
 #endif
     READ_EPILOGUE
 }
--- trunk/koffice/filters/libmsooxml/MsooXmlCommonReaderDrawingMLMethods.h \
#1194248:1194249 @@ -136,6 +136,8 @@
 };
 spacingType m_currentSpacingType; // determines how spcPct and spcPts should behave
 
+MSOOXML::Utils::autoFitStatus m_normAutoFit; // Whether text should be fitted to fit \
the shape +
 KoFilter::ConversionStatus read_lnSpc();
 KoFilter::ConversionStatus read_spcPct();
 KoFilter::ConversionStatus read_spcBef();
--- trunk/koffice/filters/libmsooxml/MsooXmlUtils.h #1194248:1194249
@@ -62,6 +62,10 @@
 
 namespace Utils {
 
+enum autoFitStatus {
+    autoFitUnUsed, autoFitOn, autoFitOff
+};
+
 class ParagraphBulletProperties
 {
 public:


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

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