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

List:       kde-commits
Subject:    =?utf-8?q?=5Bcalligra=5D_filters/=3A_PPT=3A_Refactored_processin?=
From:       Matus Uzak <matus.uzak () ixonos ! com>
Date:       2011-01-28 18:37:34
Message-ID: 20110128183734.9BB85A6094 () git ! kde ! org
[Download RAW message or body]

Git commit 71e6117aba22c9de5d2dcad47703317a13780edc by Matus Uzak.
Pushed by uzak into branch 'master'.

PPT: Refactored processing of lists and improved readability of the header file.

M  +80   -70   filters/kpresenter/powerpoint/PptToOdp.cpp     
M  +209  -207  filters/kpresenter/powerpoint/PptToOdp.h     
M  +0    -14   filters/libmso/shapes.cpp     

http://commits.kde.org/47e7010d/71e6117aba22c9de5d2dcad47703317a13780edc

diff --git a/filters/kpresenter/powerpoint/PptToOdp.cpp \
b/filters/kpresenter/powerpoint/PptToOdp.cpp index accd653..6c34507 100644
--- a/filters/kpresenter/powerpoint/PptToOdp.cpp
+++ b/filters/kpresenter/powerpoint/PptToOdp.cpp
@@ -531,9 +531,9 @@ QString PptToOdp::DrawClient::formatPos(qreal v)
  */  
 PptToOdp::PptToOdp()
 : p(0),
-  currentSlideTexts(NULL),
-  currentMaster(NULL),
-  currentSlide(NULL),
+  m_currentSlideTexts(NULL),
+  m_currentMaster(NULL),
+  m_currentSlide(NULL),
   m_isList(false)
 {
 }
@@ -977,6 +977,7 @@ void PptToOdp::defineTextProperties(KoGenStyle& style,
     // style:use-window-font-color
 }
 
+//NOTE: required by defineDefaultTextProperties and addTextStyles
 void PptToOdp::defineTextProperties(KoGenStyle& style,
                                     const MSO::TextCFException* cf,
                                     const TextCFException9* /*cf9*/,
@@ -996,11 +997,10 @@ void PptToOdp::defineTextProperties(KoGenStyle& style,
         }
     }
 
-    //NOTE: TOTALLY WRONG APPROACH !!!!!!!  You have to check the corresponding
-    //master shape if you don't have a color!!!  And check if there's a master
-    //slide for it!!! Check the previous implementation of defineTextProperties
-    
-
+    // NOTE: TOTALLY WRONG APPROACH !!!!!!!  You have to check the corresponding
+    // master shape if you don't have a color!!!  And check if there's a master
+    // slide for it!!!  Check the implementation of defineTextProperties above.
+    //
     // Use the color defined by the corresponding color scheme.  Let's create a
     // temporary OfficeArtCOLORREF to reuse the toQColor function.  The red
     // value will be treated as an index into the current color scheme table.
@@ -1025,17 +1025,17 @@ void PptToOdp::defineTextProperties(KoGenStyle& style,
             break;
         }
 
-	const MSO::MasterOrSlideContainer* m = currentMaster;
+	const MSO::MasterOrSlideContainer* m = m_currentMaster;
 	const MSO::MainMasterContainer* mm = NULL;
 	const MSO::SlideContainer* tm = NULL;
 
         if (m) {
             if (m->anon.is<MainMasterContainer>()) {
                 mm = m->anon.get<MainMasterContainer>();
-                color = toQColor(tmp, mm, currentSlide);
+                color = toQColor(tmp, mm, m_currentSlide);
             } else if (m->anon.is<SlideContainer>()) {
                 tm = m->anon.get<SlideContainer>();
-                color = toQColor(tmp, tm, currentSlide);
+                color = toQColor(tmp, tm, m_currentSlide);
             }
         }
         //TODO: hande the case of a notes master slide/notes slide pair
@@ -1599,7 +1599,7 @@ public:
 void PptToOdp::defineMasterStyles(KoGenStyles& styles)
 {
     foreach (const MSO::MasterOrSlideContainer* m, p->masters) {
-        currentMaster = m;
+        m_currentMaster = m;
         const SlideContainer* sc = m->anon.get<SlideContainer>();
         const MainMasterContainer* mm = m->anon.get<MainMasterContainer>();
 
@@ -1646,7 +1646,7 @@ void PptToOdp::defineMasterStyles(KoGenStyles& styles)
             masterPresentationStyles[m][5] = styles.insert(style);
         }
     }
-    currentMaster = NULL;
+    m_currentMaster = NULL;
 }
 const MSO::OfficeArtSpContainer*
 getMasterShape(const MSO::MasterOrSlideContainer* m) {
@@ -1785,6 +1785,24 @@ void PptToOdp::defineAutomaticDrawingPageStyles(KoGenStyles& \
styles)  }
 }
 
+/**
+ * Define the standard arrows used in PPT files.
+ */
+void defineArrow(KoGenStyles& styles)
+{
+    KoGenStyle marker(KoGenStyle::MarkerStyle);
+    marker.addAttribute("draw:display-name", "msArrowEnd 5");
+    marker.addAttribute("svg:viewBox", "0 0 210 210");
+    marker.addAttribute("svg:d", "m105 0 105 210h-210z");
+    styles.insert(marker, "msArrowEnd_20_5", KoGenStyles::DontAddNumberToName);
+    // TODO: define proper styles for these arrows
+    KoGenStyles::InsertionFlags flags = KoGenStyles::DontAddNumberToName | \
KoGenStyles::AllowDuplicates; +    styles.insert(marker, "msArrowStealthEnd_20_5", \
flags); +    styles.insert(marker, "msArrowDiamondEnd_20_5", flags);
+    styles.insert(marker, "msArrowOvalEnd_20_5", flags);
+    styles.insert(marker, "msArrowOpenEnd_20_5", flags);
+}
+
 void PptToOdp::createMainStyles(KoGenStyles& styles)
 {
     /* This function is follows the flow of the styles.xml file.
@@ -1870,7 +1888,7 @@ void PptToOdp::createMainStyles(KoGenStyles& styles)
     /*
       Define the automatic styles
      */
-    currentSlideTexts = 0;
+    m_currentSlideTexts = 0;
     defineMasterStyles(styles);
     defineAutomaticDrawingPageStyles(styles);
 
@@ -1900,7 +1918,7 @@ void PptToOdp::createMainStyles(KoGenStyles& styles)
         writer.addAttribute("style:page-layout-name", notesPageLayoutName);
         writer.addAttribute("draw:style-name",
                             drawingPageStyles[p->notesMaster]);
-        currentMaster = 0;
+        m_currentMaster = 0;
 
         if (p->notesMaster->drawing.OfficeArtDg.groupShape) {
             const OfficeArtSpgrContainer& spgr = \
*(p->notesMaster->drawing.OfficeArtDg.groupShape).data(); @@ -1922,7 +1940,7 @@ void \
PptToOdp::createMainStyles(KoGenStyles& styles)  KoGenStyle \
                master(KoGenStyle::MasterPageStyle);
         master.addAttribute("style:page-layout-name", slidePageLayoutName);
         master.addAttribute("draw:style-name", drawingPageStyles[m]);
-        currentMaster = m;
+        m_currentMaster = m;
         QBuffer buffer;
         buffer.open(QIODevice::WriteOnly);
         KoXmlWriter writer(&buffer);
@@ -1943,7 +1961,7 @@ void PptToOdp::createMainStyles(KoGenStyles& styles)
         }
         masterNames[m] = styles.insert(master, "M");
     }
-    currentMaster = NULL;
+    m_currentMaster = NULL;
 
     // Creating dateTime class object
     if (getSlideHF()) {
@@ -2062,7 +2080,6 @@ namespace
 * @brief Write text deindentations the specified amount. Actually it just
 * closes elements.
 *
-* Doesn't close the last text:list-item though.
 * @param xmlWriter XML writer to write closing tags
 * @param count how many lists and list items to leave open
 * @param levels the list of levels to remove from
@@ -2071,25 +2088,35 @@ void writeTextObjectDeIndent(KoXmlWriter& xmlWriter, const \
int count,  QStack<QString>& levels)
 {
     while (levels.size() > count) {
-        xmlWriter.endElement(); // text:list
+        xmlWriter.endElement(); //text:list-item
+        xmlWriter.endElement(); //text:list
         levels.pop();
-        if (levels.size()) {
-            xmlWriter.endElement(); // text:list-item
-        }
     }
 }
-void addListElement(KoXmlWriter& xmlWriter, QStack<QString>& levels,
-                    const QString& listStyle)
+void addListElement(KoXmlWriter& xmlWriter, const QString& listStyle,
+                    QStack<QString>& levels, int depth,
+                    const PptTextPFRun &pf)
 {
-    // if the context is a text:list, a text:list-item is needed
-    if (levels.size() > 0) {
-        xmlWriter.startElement("text:list-item");
-    }
+    levels.push(listStyle);
     xmlWriter.startElement("text:list");
     if (!listStyle.isEmpty()) {
         xmlWriter.addAttribute("text:style-name", listStyle);
+    } else {
+        qDebug() << "Warning: list style name not provided!";
+    }
+    xmlWriter.startElement("text:list-item");
+
+    //kpresenter requires the start-value here!
+    if (pf.fBulletHasAutoNumber()) {
+        xmlWriter.addAttribute("text:start-value", pf.startNum());
+    }
+
+    // add styleless levels to get the right level of indentation
+    while (levels.size() < depth) {
+        xmlWriter.startElement("text:list");
+        xmlWriter.startElement("text:list-item");
+        levels.push("");
     }
-    levels.push(listStyle);
 }
 }
 
@@ -2333,7 +2360,7 @@ void PptToOdp::processTextLine(Writer& out,
     if (clientData) {
         pcd = clientData->anon.get<PptOfficeArtClientData>();
     }
-    PptTextPFRun pf(p->documentContainer, currentSlideTexts, currentMaster, pcd,
+    PptTextPFRun pf(p->documentContainer, m_currentSlideTexts, m_currentMaster, pcd,
                     &tc, tr, start);
 
     //The current TextCFException located in the TextContainer will be
@@ -2343,8 +2370,8 @@ void PptToOdp::processTextLine(Writer& out,
     //TODO: support for notes master slide required!
 
     //prepare the masters hierarchy
-    if (currentMaster) {
-        const MasterOrSlideContainer* m = currentMaster;
+    if (m_currentMaster) {
+        const MasterOrSlideContainer* m = m_currentMaster;
         while (m) {
             mh.append(m);
             //masterIdRef MUST be 0x00000000 if the record that contains this
@@ -2360,9 +2387,6 @@ void PptToOdp::processTextLine(Writer& out,
     PptTextCFRun cf(p->documentContainer, mh, tc, pf.level());
     m_isList = (pf.isList() && (start < end));
 
-    //TODO: do not use static here!!!
-    static bool first = true;
-
     if (m_isList) {
         int depth = pf.level() + 1;
         QString listStyle = defineAutoListStyle(out, pf);
@@ -2371,25 +2395,15 @@ void PptToOdp::processTextLine(Writer& out,
 	//close the list and create a new one (K.I.S.S.)
 	if (!levels.isEmpty() && (levels.first() != listStyle)) {
             writeTextObjectDeIndent(out.xml, 0, levels);
-            first = true;
         }
         if (levels.isEmpty()) {
-            addListElement(out.xml, levels, listStyle);
-        }
-        // add styleless levels to get the right level of indentation
-        while (levels.size() < depth) {
-            addListElement(out.xml, levels, "");
-        }
-        out.xml.startElement("text:list-item");
-
-        //kpresenter requires the start-value here!
-        if (first && pf.fBulletHasAutoNumber()) {
-            out.xml.addAttribute("text:start-value", pf.startNum());
-            first = false;
+            addListElement(out.xml, listStyle, levels, depth, pf);
+        } else {
+            out.xml.endElement(); //text:list-item
+            out.xml.startElement("text:list-item");
         }
     } else {
         writeTextObjectDeIndent(out.xml, 0, levels);
-        first = true;
     }
 
     out.xml.startElement("text:p");
@@ -2398,11 +2412,7 @@ void PptToOdp::processTextLine(Writer& out,
     defineParagraphProperties(style, pf);
     out.xml.addAttribute("text:style-name", out.styles.insert(style));
     processTextSpans(&cf, tc, out, text, start, end);
-    out.xml.endElement(); // text:p
-
-    if (m_isList) {
-        out.xml.endElement(); // text:list-item
-    }
+    out.xml.endElement(); //text:p
 }
 
 void PptToOdp::processTextForBody(const MSO::OfficeArtClientData* clientData,
@@ -2437,11 +2447,11 @@ void PptToOdp::processTextForBody(const \
MSO::OfficeArtClientData* clientData,  //         }
 //     }
 
-//     const MSO::MasterOrSlideContainer* tmpMaster = currentMaster;
+//     const MSO::MasterOrSlideContainer* tmpMaster = m_currentMaster;
 //     // if this is not a presentation frame, set master to 0, to avoid the
 //     // text style from inheriting from the master style
 //     if (p == 0) {
-//         currentMaster = 0;
+//         m_currentMaster = 0;
 //     }
 
 #ifdef DEBUG_PPTTOODP
@@ -2500,7 +2510,7 @@ void PptToOdp::processTextForBody(const \
MSO::OfficeArtClientData* clientData,  
     // close all open text:list elements
     writeTextObjectDeIndent(out.xml, 0, levels);
-//     currentMaster = tmpMaster;
+//     m_currentMaster = tmpMaster;
 }
 
 void PptToOdp::processSlideForBody(unsigned slideNo, Writer& out)
@@ -2574,10 +2584,10 @@ void PptToOdp::processSlideForBody(unsigned slideNo, Writer& \
                out)
             out.xml.addAttribute("presentation:use-footer-name", \
usedFooterDeclaration[slideNo]);  }
 
-    currentSlideTexts = &p->documentContainer->slideList->rgChildRec[slideNo];
+    m_currentSlideTexts = &p->documentContainer->slideList->rgChildRec[slideNo];
     //TODO: try to avoid using those
-    currentMaster = master;
-    currentSlide = slide;
+    m_currentMaster = master;
+    m_currentSlide = slide;
 
     DrawClient drawclient(this);
     ODrawToOdf odrawtoodf(drawclient);
@@ -2585,12 +2595,12 @@ void PptToOdp::processSlideForBody(unsigned slideNo, Writer& \
out)  if (slide->drawing.OfficeArtDg.groupShape) {
         const OfficeArtSpgrContainer& spgr = \
                *(slide->drawing.OfficeArtDg.groupShape).data();
         const OfficeArtSpContainer* shape = \
                (slide->drawing.OfficeArtDg.shape).data();
-        drawclient.setDrawClientData(master, slide, 0, 0, shape, currentSlideTexts);
+        drawclient.setDrawClientData(master, slide, 0, 0, shape, \
m_currentSlideTexts);  odrawtoodf.processGroupShape(spgr, out);
     }
 
-    currentMaster = NULL;
-    currentSlide = NULL;
+    m_currentMaster = NULL;
+    m_currentSlide = NULL;
 
     if (slide->drawing.OfficeArtDg.shape) {
         // leave it out until it is understood
@@ -2600,14 +2610,14 @@ void PptToOdp::processSlideForBody(unsigned slideNo, Writer& \
out)  // draw the notes
     const NotesContainer* nc = p->notes[slideNo];
     if (nc && nc->drawing.OfficeArtDg.groupShape) {
-        currentSlideTexts = 0;
+        m_currentSlideTexts = 0;
         out.xml.startElement("presentation:notes");
         value = drawingPageStyles[nc];
         if (!value.isEmpty()) {
             out.xml.addAttribute("draw:style-name", value);
         }
         const OfficeArtSpgrContainer& spgr = \
                *(nc->drawing.OfficeArtDg.groupShape).data();
-        drawclient.setDrawClientData(0, 0, p->notesMaster, nc, 0, \
currentSlideTexts); +        drawclient.setDrawClientData(0, 0, p->notesMaster, nc, \
0, m_currentSlideTexts);  odrawtoodf.processGroupShape(spgr, out);
         out.xml.endElement();
     }
@@ -2708,10 +2718,10 @@ QColor PptToOdp::toQColor(const ColorIndexStruct &color)
     }
 
     const QList<ColorStruct>* colorScheme = NULL;
-    const MSO::MasterOrSlideContainer* m = currentMaster;
+    const MSO::MasterOrSlideContainer* m = m_currentMaster;
     const MSO::MainMasterContainer* mmc = NULL;
     const MSO::SlideContainer* tmc = NULL;
-    const MSO::SlideContainer* sc = currentSlide;
+    const MSO::SlideContainer* sc = m_currentSlide;
 
     //TODO: hande the case of a notes master slide/notes slide pair
 //     const MSO::NotesContainer* nmc = NULL;
@@ -2968,10 +2978,10 @@ const TextContainer* PptToOdp::getTextContainer(
             const PptOfficeArtClientTextBox* clientTextbox,
             const PptOfficeArtClientData* clientData) const
 {
-    if (clientData && clientData->placeholderAtom && currentSlideTexts) {
+    if (clientData && clientData->placeholderAtom && m_currentSlideTexts) {
         const PlaceholderAtom* p = clientData->placeholderAtom.data();
-        if (p->position >= 0 && p->position < currentSlideTexts->atoms.size()) {
-            return &currentSlideTexts->atoms[p->position];
+        if (p->position >= 0 && p->position < m_currentSlideTexts->atoms.size()) {
+            return &m_currentSlideTexts->atoms[p->position];
         }
     }
     if (clientTextbox) {
diff --git a/filters/kpresenter/powerpoint/PptToOdp.h \
b/filters/kpresenter/powerpoint/PptToOdp.h index a066db1..6e544b2 100644
--- a/filters/kpresenter/powerpoint/PptToOdp.h
+++ b/filters/kpresenter/powerpoint/PptToOdp.h
@@ -88,6 +88,144 @@ public:
 private:
 
     /**
+    * @brief Struct that contains precalculated style names based on
+    * TextCFException and TextPFException combinations.
+    *
+    * For each individual character in this object's text three styles apply:
+    * Paragraph style, List style and Character style. These are parsed from
+    * TextCFException and TextPFException. For each character there is a
+    * corresponding pair of TextCFException and TextPFException.
+    *
+    * Saving of styles is done before saving text contents so we'll cache
+    * the style names and pairs of TextCFException and TextPFException.
+    */
+    class StyleName
+    {
+    public:
+        /**
+        * @brief Text style name (e.g. T1)
+        *
+        */
+        QString text;
+
+        /**
+        * @brief Paragraph style (e.g. P1)
+        *
+        */
+        QString paragraph;
+
+        /**
+        * @brief List style (e.g. L1)
+        *
+        */
+        QString list;
+        StyleName() {}
+        StyleName(const QString& t, const QString& p, const QString& l)
+                : text(t), paragraph(p), list(l) {}
+    };
+
+    /**
+     * Structure that influences all information that affects the style of a
+     * text:style.  This is a convenience container for passing this
+     * information.
+     **/
+    class ListStyleInput {
+    public:
+        PptTextPFRun pf;
+        const MSO::TextCFException* cf;
+        const MSO::TextCFException9* cf9;
+        const MSO::TextCFException10* cf10;
+        const MSO::TextSIException* si;
+
+        ListStyleInput() :cf(0), cf9(0), cf10(0), si(0) {}
+    };
+
+    /**
+      * @brief An enumeration that specifies an action that can be performed
+      * when interacting with an object during a slide show.
+      */
+    enum {
+        /**
+          * @brief No effect.
+          */
+        II_NoAction,
+
+        /**
+          * @brief A macro is executed.
+          */
+        II_MacroAction,
+
+        /**
+          * @brief A program is run.
+          */
+        II_RunProgramAction,
+
+        /**
+          * @brief The current presentation slide of the slide show jumps to
+          * another presentation slide in the same presentation.
+          */
+        II_JumpAction,
+
+        /**
+          * @brief A URL is executed.
+          */
+        II_HyperlinkAction,
+
+        /**
+          * @brief An OLE action (only valid if the object this applies to is an
+          * OLE embedded object).
+          */
+        II_OLEAction,
+
+        /**
+          * @brief A media object is played.
+          */
+        II_MediaAction,
+
+        /**
+          * @brief A named show is displayed.
+          */
+        II_CustomShowAction,
+    }InteractiveInfoActionEnum;
+
+    /**
+    * TextAutoNumberSchemeEnum
+    * Referenced by: TextAutoNumberScheme
+    * An enumeration that specifies the character sequence and delimiters to use for \
automatic +    * numbering.
+    */
+    enum {
+        ANM_AlphaLcPeriod,      //0x0000  Example: a., b., c., ...Lowercase Latin \
character followed by a period. +        ANM_AlphaUcPeriod ,     //0x0001  Example: \
A., B., C., ...Uppercase Latin character followed by a period. +        \
ANM_ArabicParenRight,   //0x0002  Example: 1), 2), 3), ...Arabic numeral followed by \
a closing parenthesis. +        ANM_ArabicPeriod,       //0x0003  Example: 1., 2., \
3., ...Arabic numeral followed by a period. +        ANM_RomanLcParenBoth,   //0x0004 \
Example: (i), (ii), (iii), ...Lowercase Roman numeral enclosed in parentheses. +      \
ANM_RomanLcParenRight,  //0x0005  Example: i), ii), iii), ... Lowercase Roman numeral \
followed by a closing parenthesis. +        ANM_RomanLcPeriod,      //0x0006  \
Example: i., ii., iii., ...Lowercase Roman numeral followed by a period. +        \
ANM_RomanUcPeriod ,     //0x0007  Example: I., II., III., ...Uppercase Roman numeral \
followed by a period. +        ANM_AlphaLcParenBoth,   //0x0008  Example: (a), (b), \
(c), ...Lowercase alphabetic character enclosed in parentheses. +        \
ANM_AlphaLcParenRight,  //0x0009  Example: a), b), c), ...Lowercase alphabetic \
character followed by a closing +        ANM_AlphaUcParenBoth,   //0x000A  Example: \
(A), (B), (C), ...Uppercase alphabetic character enclosed in parentheses. +        \
ANM_AlphaUcParenRight,  //0x000B  Example: A), B), C), ...Uppercase alphabetic \
character followed by a closing +        ANM_ArabicParenBoth,    //0x000C  Example: \
(1), (2), (3), ...Arabic numeral enclosed in parentheses. +        ANM_ArabicPlain,   \
//0x000D  Example: 1, 2, 3, ...Arabic numeral. +        ANM_RomanUcParenBoth,   \
//0x000E  Example: (I), (II), (III), ...Uppercase Roman numeral enclosed in \
parentheses. +        ANM_RomanUcParenRight,  //0x000F  Example: I), II), III), \
...Uppercase Roman numeral followed by a closing parenthesis. +        //Future
+    } TextAutoNumberSchemeEnum;
+
+    /**
+    * Declaration Type
+    * Referenced by: Declaration Type
+    * A declaration type ex:- Header,Footer,DateTime
+    */
+    enum DeclarationType {
+        Footer,
+        Header,
+        DateTime
+    };
+
+    /**
      * Function that does the actual conversion.
      *
      * It is shared by the two convert() functions.
@@ -98,6 +236,11 @@ private:
     KoFilter::ConversionStatus doConversion(POLE::Storage& input,
                                             KoStore* output);
 
+    /**
+     * TODO:
+     */
+    bool parse(POLE::Storage& storage);
+
     void createMainStyles(KoGenStyles& styles);
     void defineDefaultTextStyle(KoGenStyles& styles);
     void defineDefaultParagraphStyle(KoGenStyles& styles);
@@ -112,9 +255,10 @@ private:
     void defineDefaultDrawingPageStyle(KoGenStyles& styles);
     void defineDefaultChartStyle(KoGenStyles& styles);
 
-    /** define automatic styles for text, paragraphs, graphic and presentation
-      families
-      */
+    /**
+     * define automatic styles for text, paragraphs, graphic and presentation
+     * families
+     */
     void defineMasterStyles(KoGenStyles& styles);
     void defineAutomaticDrawingPageStyles(KoGenStyles& styles);
 
@@ -156,21 +300,6 @@ private:
                                 const MSO::HeadersFootersAtom* hf,
                                 const MSO::SlideFlags* sf = NULL);
 
-    /**
-     * Structure that influences all information that affects the style of a
-     * text:style.  This is a convenience container for passing this
-     * information.
-     **/
-    class ListStyleInput {
-    public:
-        PptTextPFRun pf;
-        const MSO::TextCFException* cf;
-        const MSO::TextCFException9* cf9;
-        const MSO::TextCFException10* cf10;
-        const MSO::TextSIException* si;
-
-        ListStyleInput() :cf(0), cf9(0), cf10(0), si(0) {}
-    };
     /* Extract data into the style element style:list */
     void defineListStyle(KoGenStyle& style,
                          const MSO::TextMasterStyleAtom& levels,
@@ -186,9 +315,10 @@ private:
                          const ListStyleInput& info,
                          const ListStyleInput& parent);
 
+    QString defineAutoListStyle(Writer& out, const PptTextPFRun& pf);
+
     const MSO::StyleTextProp9* getStyleTextProp9(quint32 slideIdRef,
                                                 quint32 textType, quint8 pp9rt);
-    QString defineAutoListStyle(Writer& out, const PptTextPFRun& pf);
 
     const MSO::TextContainer* getTextContainer(
             const MSO::PptOfficeArtClientTextBox* clientTextbox,
@@ -218,54 +348,6 @@ private:
     void processDeclaration(KoXmlWriter* xmlWriter);
 
     /**
-      * @brief An enumeration that specifies an action that can be performed
-      * when interacting with an object during a slide show.
-      */
-    enum {
-        /**
-          * @brief No effect.
-          */
-        II_NoAction,
-
-        /**
-          * @brief A macro is executed.
-          */
-        II_MacroAction,
-
-        /**
-          * @brief A program is run.
-          */
-        II_RunProgramAction,
-
-        /**
-          * @brief The current presentation slide of the slide show jumps to
-          * another presentation slide in the same presentation.
-          */
-        II_JumpAction,
-
-        /**
-          * @brief A URL is executed.
-          */
-        II_HyperlinkAction,
-
-        /**
-          * @brief An OLE action (only valid if the object this applies to is an
-          * OLE embedded object).
-          */
-        II_OLEAction,
-
-        /**
-          * @brief A media object is played.
-          */
-        II_MediaAction,
-
-        /**
-          * @brief A named show is displayed.
-          */
-        II_CustomShowAction,
-    }InteractiveInfoActionEnum;
-
-    /**
       * @brief Converts vector of quint16 to String
       *
       * Powerpoint files have text as utf16.
@@ -304,7 +386,7 @@ private:
     /**
     * @brief Convert TextAlignmentEnum value to a string from ODF specification
     * An enumeration that specifies paragraph alignments.
-    * Name                              Value       Meaning
+    * Name                      Value       Meaning
     * Tx_ALIGNLeft              0x0000    For horizontal text, left aligned.
     *                                     For vertical text, top aligned.
     * Tx_ALIGNCenter            0x0001    For horizontal text, centered.
@@ -363,7 +445,7 @@ private:
      * presentation slide or notes slide MUST be provided if applicable.  This
      * method returns the rgb values the specified struct refers to.
      *
-     * @param color atored as OfficeArtCOLORREF to convert
+     * @param color stored as OfficeArtCOLORREF to convert
      * @param pointer to a MainMasterContainer or NotesContainer
      * @param pointer to a SlideContainer or NotesContainer
      * @return QColor value, may be undefined
@@ -373,43 +455,6 @@ private:
                     const MSO::StreamOffset* common = NULL);
 
     /**
-    * TextAutoNumberSchemeEnum
-    * Referenced by: TextAutoNumberScheme
-    * An enumeration that specifies the character sequence and delimiters to use for \
                automatic
-    * numbering.
-    */
-    enum {
-        ANM_AlphaLcPeriod,      //0x0000  Example: a., b., c., ...Lowercase Latin \
                character followed by a period.
-        ANM_AlphaUcPeriod ,     //0x0001  Example: A., B., C., ...Uppercase Latin \
                character followed by a period.
-        ANM_ArabicParenRight,   //0x0002  Example: 1), 2), 3), ...Arabic numeral \
                followed by a closing parenthesis.
-        ANM_ArabicPeriod,       //0x0003  Example: 1., 2., 3., ...Arabic numeral \
                followed by a period.
-        ANM_RomanLcParenBoth,   //0x0004  Example: (i), (ii), (iii), ...Lowercase \
                Roman numeral enclosed in parentheses.
-        ANM_RomanLcParenRight,  //0x0005  Example: i), ii), iii), ... Lowercase \
                Roman numeral followed by a closing parenthesis.
-        ANM_RomanLcPeriod,      //0x0006  Example: i., ii., iii., ...Lowercase Roman \
                numeral followed by a period.
-        ANM_RomanUcPeriod ,     //0x0007  Example: I., II., III., ...Uppercase Roman \
                numeral followed by a period.
-        ANM_AlphaLcParenBoth,   //0x0008  Example: (a), (b), (c), ...Lowercase \
                alphabetic character enclosed in parentheses.
-        ANM_AlphaLcParenRight,  //0x0009  Example: a), b), c), ...Lowercase \
                alphabetic character followed by a closing
-        ANM_AlphaUcParenBoth,   //0x000A  Example: (A), (B), (C), ...Uppercase \
                alphabetic character enclosed in parentheses.
-        ANM_AlphaUcParenRight,  //0x000B  Example: A), B), C), ...Uppercase \
                alphabetic character followed by a closing
-        ANM_ArabicParenBoth,    //0x000C  Example: (1), (2), (3), ...Arabic numeral \
                enclosed in parentheses.
-        ANM_ArabicPlain,        //0x000D  Example: 1, 2, 3, ...Arabic numeral.
-        ANM_RomanUcParenBoth,   //0x000E  Example: (I), (II), (III), ...Uppercase \
                Roman numeral enclosed in parentheses.
-        ANM_RomanUcParenRight,  //0x000F  Example: I), II), III), ...Uppercase Roman \
                numeral followed by a closing parenthesis.
-        //Future
-    } TextAutoNumberSchemeEnum;
-
-    /**
-    * Declaration Type
-    * Referenced by: Declaration Type
-    * A declaration type ex:- Header,Footer,DateTime
-    */
-    enum DeclarationType {
-        Footer,
-        Header,
-        DateTime
-    };
-
-    /**
     * @brief processTextAutoNumberScheme : process the Textautoscheme to display the \
                Bullet and numbering.
     * @param TextAutomNumberSchemeEnum - enum values of textautoscheme.
     * @param numFormat - Format of the bulletand numbering scheme
@@ -420,81 +465,50 @@ private:
     void processTextAutoNumberScheme(int val, QString& numFormat, QString& \
numSuffix, QString& numPrefix);  
     /**
-    * @brief Struct that contains precalculated style names based on
-    * TextCFException and TextPFException combinations.
-    *
-    * For each individual character in this object's text three styles apply:
-    * Paragraph style, List style and Character style. These are parsed from
-    * TextCFException and TextPFException. For each character there is a
-    * corresponding pair of TextCFException and TextPFException.
-    *
-    * Saving of styles is done before saving text contents so we'll cache
-    * the style names and pairs of TextCFException and TextPFException.
-    *
-    *
+    * @brief find the text from  Declaration.
+    * @return pointer of the use name.
     */
-    class StyleName
-    {
-    public:
-        /**
-        * @brief Text style name (e.g. T1)
-        *
-        */
-        QString text;
-
-        /**
-        * @brief Paragraph style (e.g. P1)
-        *
-        */
-        QString paragraph;
-
-        /**
-        * @brief List style (e.g. L1)
-        *
-        */
-        QString list;
-        StyleName() {}
-        StyleName(const QString& t, const QString& p, const QString& l)
-                : text(t), paragraph(p), list(l) {}
-    };
-
-    QMap<QByteArray, QString> pictureNames;
-    QMap<quint16, QString> bulletPictureNames;
-    DateTimeFormat dateTime;
-    QString declarationStyleName;
+    QString findDeclaration(DeclarationType type, const QString &text) const;
+    /**
+    * @brief find the text from  notesDeclaration.
+    * @return pointer of the use notes name.
+    */
+    QString findNotesDeclaration(DeclarationType type, const QString &) const;
 
     /**
-     * name for to use in the style:page-layout-name attribute for master
-     * slides (style:master-page)
-     */
-    QString slidePageLayoutName;
+    * @brief insert the text into  Declaration.
+    * @param QString declaration use name string ex: ftr1
+    * @param QString declaration text to displayed.
+    */
+    void insertDeclaration(DeclarationType type, const QString &name, const QString \
&text);  /**
-     * name for to use in the style:page-layout-name attribute for notes
-     * and handout slides (presentation:notes and style:handout-master)
-     */
-    QString notesPageLayoutName;
-
-    const ParsedPresentation* p;
-
-    //Pointers to ppt specific information, try to avoid using those.
-    const MSO::SlideListWithTextSubContainerOrAtom* currentSlideTexts;
-    const MSO::MasterOrSlideContainer* currentMaster;
-    const MSO::SlideContainer* currentSlide;
+    * @brief insert the text into  notesDeclaration.
+    * @param QString notes declaration use name string ex: ftr2
+    * @param QString notes text to displayed.
+    */
+    void insertNotesDeclaration(DeclarationType type, const QString &name, const \
QString &text);  
-    bool parse(POLE::Storage& storage);
+    /**
+     * @brief retrieve the OfficeArtSpContainer of the master shape
+     * @param spid identifier of the master shape
+     * @return pointer to the OfficeArtSpContainer
+     */
+    const MSO::OfficeArtSpContainer* retrieveMasterShape(quint32 spid) const;
 
     /**
      * There is at most one SlideHeadersFootersContainer, but for some slides
      * it is in a strange positions. This convenience function returns a pointer
      * to the SlideHeadersFootersContainer or NULL if there is none.
      **/
-    const MSO::SlideHeadersFootersContainer* getSlideHF() const {
+    const MSO::SlideHeadersFootersContainer* getSlideHF() const
+    {
         return (p->documentContainer->slideHF)
                ? p->documentContainer->slideHF.data()
                : p->documentContainer->slideHF2.data();
     }
-    const MSO::PerSlideHeadersFootersContainer* getPerSlideHF(
-            const MSO::SlideContainer* slide) const {
+    const MSO::PerSlideHeadersFootersContainer*
+    getPerSlideHF(const MSO::SlideContainer* slide) const
+    {
         const MSO::PerSlideHeadersFootersContainer* hf = 0;
         const MSO::MasterOrSlideContainer* master = p->getMaster(slide);
         const MSO::MainMasterContainer* m1 =
@@ -514,7 +528,8 @@ private:
     /**
      * Look in blipStore for the id mapping to this object
      **/
-    QByteArray getRgbUid(quint16 pib) const {
+    QByteArray getRgbUid(quint16 pib) const
+    {
         // return 16 byte rgbuid for this given blip id
         if (p->documentContainer->drawingGroup.OfficeArtDgg.blipStore) {
             const MSO::OfficeArtBStoreContainer* b
@@ -529,8 +544,8 @@ private:
         }
         return QByteArray();
     }
-    const MSO::FontEntityAtom*
-    getFont(quint16 fontRef) {
+    const MSO::FontEntityAtom* getFont(quint16 fontRef)
+    {
         const MSO::FontCollectionContainer* f =
             p->documentContainer->documentTextInfo.fontCollection.data();
         if (f && f->rgFontCollectionEntry.size() > fontRef) {
@@ -539,6 +554,29 @@ private:
         return 0;
     }
 
+    /**
+     * name for to use in the style:page-layout-name attribute for master
+     * slides (style:master-page)
+     */
+    QString slidePageLayoutName;
+    /**
+     * name for to use in the style:page-layout-name attribute for notes
+     * and handout slides (presentation:notes and style:handout-master)
+     */
+    QString notesPageLayoutName;
+
+    const ParsedPresentation* p;
+
+    //Pointers to ppt specific information, try to avoid using those.
+    const MSO::SlideListWithTextSubContainerOrAtom* m_currentSlideTexts;
+    const MSO::MasterOrSlideContainer* m_currentMaster;
+    const MSO::SlideContainer* m_currentSlide;
+
+    QMap<QByteArray, QString> pictureNames;
+    QMap<quint16, QString> bulletPictureNames;
+    DateTimeFormat dateTime;
+    QString declarationStyleName;
+
     QMap<const void*, QString> presentationPageLayouts;
     QMap<const void*, QString> drawingPageStyles;
     typedef QMap<const MSO::MasterOrSlideContainer*, QMap<int, QString> > \
MasterStyles; @@ -546,7 +584,7 @@ private:
     MasterStyles masterPresentationStyles;
     QMap<const MSO::MasterOrSlideContainer*, QString> masterNames;
     QString notesMasterName;
-    bool m_isList;
+    bool m_isList; //true - processing a list, false - processing a paragraph
 
     /**
     * @brief An usedDeclaration.
@@ -577,42 +615,6 @@ private:
     * settings for notes declaration  text and usenotes declaration name.
     */
     QHash<DeclarationType/*type*/,QPair<QString /*declarationName*/,QString/*text*/> \
                >notesDeclaration;
-
-    /**
-    * @brief find the text from  Declaration.
-    * @return pointer of the use name.
-    */
-    QString findDeclaration(DeclarationType type, const QString &text) const;
-    /**
-    * @brief find the text from  notesDeclaration.
-    * @return pointer of the use notes name.
-    */
-    QString findNotesDeclaration(DeclarationType type, const QString &) const;
-
-    /**
-    * @brief insert the text into  Declaration.
-    * @param QString declaration use name string ex: ftr1
-    * @param QString declaration text to displayed.
-    */
-    void insertDeclaration(DeclarationType type, const QString &name, const QString \
                &text);
-    /**
-    * @brief insert the text into  notesDeclaration.
-    * @param QString notes declaration use name string ex: ftr2
-    * @param QString notes text to displayed.
-    */
-    void insertNotesDeclaration(DeclarationType type, const QString &name, const \
                QString &text);
-
-    /**
-     * @brief retrieve the OfficeArtSpContainer of the master shape
-     * @param spid identifier of the master shape
-     * @return pointer to the OfficeArtSpContainer
-     */
-    const MSO::OfficeArtSpContainer* retrieveMasterShape(quint32 spid) const;
 };
 
-/**
- * Define the standard arrows used in PPT files.
- */
-void defineArrow(KoGenStyles& styles);
-
-#endif // POWERPOINTIMPORT_H
+#endif // PPTTOODP_H
diff --git a/filters/libmso/shapes.cpp b/filters/libmso/shapes.cpp
index 1fae5f9..c0a14b8 100644
--- a/filters/libmso/shapes.cpp
+++ b/filters/libmso/shapes.cpp
@@ -1576,17 +1576,3 @@ void ODrawToOdf::setEnhancedGeometry(const \
MSO::OfficeArtSpContainer& o, Writer&  
 }
 
-void defineArrow(KoGenStyles& styles)
-{
-    KoGenStyle marker(KoGenStyle::MarkerStyle);
-    marker.addAttribute("draw:display-name", "msArrowEnd 5");
-    marker.addAttribute("svg:viewBox", "0 0 210 210");
-    marker.addAttribute("svg:d", "m105 0 105 210h-210z");
-    styles.insert(marker, "msArrowEnd_20_5", KoGenStyles::DontAddNumberToName);
-    // TODO: define proper styles for these arrows
-    KoGenStyles::InsertionFlags flags = KoGenStyles::DontAddNumberToName | \
                KoGenStyles::AllowDuplicates;
-    styles.insert(marker, "msArrowStealthEnd_20_5", flags);
-    styles.insert(marker, "msArrowDiamondEnd_20_5", flags);
-    styles.insert(marker, "msArrowOvalEnd_20_5", flags);
-    styles.insert(marker, "msArrowOpenEnd_20_5", flags);
-}


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

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