[Libreoffice-commits] core.git: include/oox oox/source sd/qa sd/source

Tomaž Vajngerl tomaz.vajngerl at collabora.com
Mon Nov 9 04:36:42 PST 2015


 include/oox/ppt/slidetransition.hxx       |    3 ++
 oox/source/core/fragmenthandler2.cxx      |    1 
 oox/source/core/xmlfilterbase.cxx         |    2 +
 oox/source/ppt/slidetransition.cxx        |   13 +++++++++
 oox/source/ppt/slidetransitioncontext.cxx |    8 ++++++
 oox/source/token/namespaces-strict.txt    |    4 +++
 oox/source/token/namespaces.hxx.tail      |    1 
 oox/source/token/namespaces.txt           |    4 +++
 oox/source/token/tokens.txt               |    1 
 sd/qa/unit/export-tests.cxx               |    3 ++
 sd/source/filter/eppt/pptx-epptooxml.cxx  |   40 +++++++++++++++++++++++-------
 11 files changed, 71 insertions(+), 9 deletions(-)

New commits:
commit 18cd4b273f3781620ecb8dd68e6d616bba498992
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.com>
Date:   Mon Nov 9 13:32:32 2015 +0100

    pptx: "fall" transition, which needed p15 namespace
    
    Added p15 namespace which is present in MSO 2013+ documents. It
    adds a "prstTrans" element with a string "prst" attribute which
    is a name of the transition to be performed.
    
    This was added to support "fall" transition which translates to
    "fallOver" preset transition.
    
    Change-Id: I429bb106a12c1b99cce756502508e917720daef3

diff --git a/include/oox/ppt/slidetransition.hxx b/include/oox/ppt/slidetransition.hxx
index b0e2351..4680320 100644
--- a/include/oox/ppt/slidetransition.hxx
+++ b/include/oox/ppt/slidetransition.hxx
@@ -53,6 +53,9 @@ namespace oox { namespace ppt {
 
         void setOoxTransitionType( ::sal_Int32 OoxType,
                                                              ::sal_Int32 param1, ::sal_Int32 param2 );
+
+        void setPresetTransition(OUString sPresetTransition);
+
     private:
         ::sal_Int16 mnTransitionType;
         ::sal_Int16 mnTransitionSubType;
diff --git a/oox/source/core/fragmenthandler2.cxx b/oox/source/core/fragmenthandler2.cxx
index ba7b6ef..2057eb6 100644
--- a/oox/source/core/fragmenthandler2.cxx
+++ b/oox/source/core/fragmenthandler2.cxx
@@ -72,6 +72,7 @@ bool FragmentHandler2::prepareMceContext( sal_Int32 nElement, const AttributeLis
                 static std::vector<OUString> aSupportedNS =
                 {
                     "p14",
+                    "p15",
                 };
 
                 if (std::find(aSupportedNS.begin(), aSupportedNS.end(), aRequires) != aSupportedNS.end())
diff --git a/oox/source/core/xmlfilterbase.cxx b/oox/source/core/xmlfilterbase.cxx
index d59b2b4..fca049c 100644
--- a/oox/source/core/xmlfilterbase.cxx
+++ b/oox/source/core/xmlfilterbase.cxx
@@ -121,6 +121,7 @@ struct NamespaceIds: public rtl::StaticWithInit<
             "http://schemas.microsoft.com/office/spreadsheetml/2009/9/main",
             "http://schemas.libreoffice.org/",
             "http://schemas.microsoft.com/office/powerpoint/2010/main"
+            "http://schemas.microsoft.com/office/powerpoint/2012/main"
         };
 
         static const sal_Int32 namespaceIds[] = {
@@ -150,6 +151,7 @@ struct NamespaceIds: public rtl::StaticWithInit<
             NMSP_xls14Lst,
             NMSP_loext,
             NMSP_p14,
+            NMSP_p15,
         };
 
         Sequence< beans::Pair< OUString, sal_Int32 > > aRet(SAL_N_ELEMENTS(namespaceIds));
diff --git a/oox/source/ppt/slidetransition.cxx b/oox/source/ppt/slidetransition.cxx
index e623558..6681447 100644
--- a/oox/source/ppt/slidetransition.cxx
+++ b/oox/source/ppt/slidetransition.cxx
@@ -419,6 +419,19 @@ namespace oox { namespace ppt {
         }
     }
 
+    void SlideTransition::setPresetTransition(OUString sPresetTransition)
+    {
+        if (sPresetTransition == "fallOver")
+        {
+            mnTransitionType = TransitionType::MISCSHAPEWIPE;
+            mnTransitionSubType = TransitionSubType::LEFTTORIGHT;
+        }
+        else
+        {
+            mnTransitionType = 0;
+        }
+    }
+
 } }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/oox/source/ppt/slidetransitioncontext.cxx b/oox/source/ppt/slidetransitioncontext.cxx
index 4a9c996..a5d5496 100644
--- a/oox/source/ppt/slidetransitioncontext.cxx
+++ b/oox/source/ppt/slidetransitioncontext.cxx
@@ -152,6 +152,14 @@ SlideTransitionContext::~SlideTransitionContext() throw()
             maTransition.setOoxTransitionType(aElementToken, sal_Int32(rAttribs.getBool(XML_isInverted, false)), 0);
         }
         return this;
+    case P15_TOKEN(prstTrans):
+        if (!mbHasTransition)
+        {
+            mbHasTransition = true;
+            maTransition.setPresetTransition(rAttribs.getString(XML_prst, ""));
+        }
+        return this;
+
 
     default:
         break;
diff --git a/oox/source/token/namespaces-strict.txt b/oox/source/token/namespaces-strict.txt
index 74efa82..69eb335 100644
--- a/oox/source/token/namespaces-strict.txt
+++ b/oox/source/token/namespaces-strict.txt
@@ -80,6 +80,10 @@ w14                     http://schemas.microsoft.com/office/word/2010/wordml
 a14                     http://schemas.microsoft.com/office/drawingml/2010/main
 p14                     http://schemas.microsoft.com/office/powerpoint/2010/main
 
+# MSO 2012/2013 extensions ---------------------------------------------------------
+
+p15                     http://schemas.microsoft.com/office/powerpoint/2012/main
+
 # extlst namespaces
 
 # xls14Lst for features introduced by excel 2010
diff --git a/oox/source/token/namespaces.hxx.tail b/oox/source/token/namespaces.hxx.tail
index 792228c..89f8c1c 100644
--- a/oox/source/token/namespaces.hxx.tail
+++ b/oox/source/token/namespaces.hxx.tail
@@ -41,6 +41,7 @@ inline sal_Int32 getNamespace( sal_Int32 nToken ) { return nToken & NMSP_MASK; }
 #define PC_TOKEN( token )       OOX_TOKEN( packageContentTypes, token )
 #define PPT_TOKEN( token )      OOX_TOKEN( ppt, token )
 #define P14_TOKEN( token )      OOX_TOKEN( p14, token )
+#define P15_TOKEN( token )      OOX_TOKEN( p15, token )
 #define PR_TOKEN( token )       OOX_TOKEN( packageRel, token )
 #define R_TOKEN( token )        OOX_TOKEN( officeRel, token )
 #define VML_TOKEN( token )      OOX_TOKEN( vml, token )
diff --git a/oox/source/token/namespaces.txt b/oox/source/token/namespaces.txt
index b309dc6..7920572 100644
--- a/oox/source/token/namespaces.txt
+++ b/oox/source/token/namespaces.txt
@@ -80,6 +80,10 @@ w14                     http://schemas.microsoft.com/office/word/2010/wordml
 a14                     http://schemas.microsoft.com/office/drawing/2010/main
 p14                     http://schemas.microsoft.com/office/powerpoint/2010/main
 
+# MSO 2012/2013 extensions ---------------------------------------------------------
+
+p15                     http://schemas.microsoft.com/office/powerpoint/2012/main
+
 # extlst namespaces
 
 # xls14Lst for features introduced by excel 2010
diff --git a/oox/source/token/tokens.txt b/oox/source/token/tokens.txt
index e44830d..b113c84 100644
--- a/oox/source/token/tokens.txt
+++ b/oox/source/token/tokens.txt
@@ -3798,6 +3798,7 @@ overwriteClear
 owners
 p
 p14
+p15
 pBdr
 pLen
 pPos
diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx
index f16e9e9..7b078aa 100644
--- a/sd/qa/unit/export-tests.cxx
+++ b/sd/qa/unit/export-tests.cxx
@@ -1415,6 +1415,9 @@ void SdExportTest::testExportTransitionsPPTX()
     // INSIDE TURNING CUBE
     CPPUNIT_ASSERT(checkTransitionOnPage(xDoc, 60, TransitionType::MISCSHAPEWIPE, TransitionSubType::CORNERSIN));
 
+    // FALL
+    CPPUNIT_ASSERT(checkTransitionOnPage(xDoc, 61, TransitionType::MISCSHAPEWIPE, TransitionSubType::LEFTTORIGHT));
+
     // VORTEX
     CPPUNIT_ASSERT(checkTransitionOnPage(xDoc, 70, TransitionType::MISCSHAPEWIPE, TransitionSubType::VERTICAL));
 
diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx b/sd/source/filter/eppt/pptx-epptooxml.cxx
index 9d412f7..4d10949 100644
--- a/sd/source/filter/eppt/pptx-epptooxml.cxx
+++ b/sd/source/filter/eppt/pptx-epptooxml.cxx
@@ -70,6 +70,7 @@
                       FSNS(XML_xmlns, XML_p),   "http://schemas.openxmlformats.org/presentationml/2006/main", \
                       FSNS(XML_xmlns, XML_r),   "http://schemas.openxmlformats.org/officeDocument/2006/relationships", \
                       FSNS(XML_xmlns, XML_p14), "http://schemas.microsoft.com/office/powerpoint/2010/main", \
+                      FSNS(XML_xmlns, XML_p15), "http://schemas.microsoft.com/office/powerpoint/2012/main", \
                       FSNS(XML_xmlns, XML_mc),  "http://schemas.openxmlformats.org/markup-compatibility/2006"
 
 
@@ -521,16 +522,20 @@ void PowerPointExport::WriteTransition( FSHelperPtr pFS )
     bool bOOXmlSpecificTransition = false;
 
     sal_Int32 nTransition = 0;
-    sal_Int32 nTransition14 = 0;
-
     const char* pDirection = NULL;
     const char* pDirection14 = NULL;
     const char* pOrientation = NULL;
     const char* pThruBlk = NULL;
     const char* pSpokes = NULL;
     char pSpokesTmp[2] = "0";
+
+    // p14
+    sal_Int32 nTransition14 = 0;
     const char* pInverted = nullptr;
 
+    //p15
+    const char* pPresetTransition = nullptr;
+
     if (!nPPTTransitionType)
     {
         switch(nTransitionType)
@@ -570,6 +575,11 @@ void PowerPointExport::WriteTransition( FSHelperPtr pFS )
                         nTransition14 = XML_ripple;
                         bOOXmlSpecificTransition = true;
                         break;
+                    case animations::TransitionSubType::LEFTTORIGHT: // Fall
+                        nTransition = XML_fade;
+                        pPresetTransition = "fallOver";
+                        bOOXmlSpecificTransition = true;
+                        break;
                     case animations::TransitionSubType::CORNERSIN:
                         pInverted = "true";
                     case animations::TransitionSubType::CORNERSOUT:
@@ -615,20 +625,32 @@ void PowerPointExport::WriteTransition( FSHelperPtr pFS )
     if( changeType == 1 && GETA( Duration ) )
         mAny >>= advanceTiming;
 
-    if (nTransition14)
+    if (nTransition14 || pPresetTransition)
     {
+        const char* pRequiresNS = nTransition14 ? "p14" : "p15";
+
         pFS->startElement(FSNS(XML_mc, XML_AlternateContent), FSEND);
-        pFS->startElement(FSNS(XML_mc, XML_Choice), XML_Requires, "p14", FSEND);
+        pFS->startElement(FSNS(XML_mc, XML_Choice), XML_Requires, pRequiresNS, FSEND);
+
 
         pFS->startElementNS(XML_p, XML_transition,
                             XML_spd, speed,
                             XML_advTm, advanceTiming != -1 ? I32S( advanceTiming*1000 ) : NULL,
                             FSEND );
 
-        pFS->singleElementNS(XML_p14, nTransition14,
-                             XML_isInverted, pInverted,
-                             XML_dir, pDirection14,
-                             FSEND );
+        if (nTransition14)
+        {
+            pFS->singleElementNS(XML_p14, nTransition14,
+                                 XML_isInverted, pInverted,
+                                 XML_dir, pDirection14,
+                                 FSEND );
+        }
+        else if (pPresetTransition)
+        {
+            pFS->singleElementNS(XML_p15, XML_prstTrans,
+                                 XML_prst, pPresetTransition,
+                                 FSEND );
+        }
 
         pFS->endElement(FSNS(XML_p, XML_transition));
 
@@ -745,7 +767,7 @@ void PowerPointExport::WriteTransition( FSHelperPtr pFS )
 
     pFS->endElementNS(XML_p, XML_transition);
 
-    if (nTransition14)
+    if (nTransition14 || pPresetTransition)
     {
         pFS->endElement(FSNS(XML_mc, XML_Fallback));
         pFS->endElement(FSNS(XML_mc, XML_AlternateContent));


More information about the Libreoffice-commits mailing list