[Libreoffice-commits] core.git: officecfg/registry oox/source sd/qa sd/source sd/xml slideshow/source

Tomaž Vajngerl tomaz.vajngerl at collabora.com
Fri Nov 13 01:15:34 PST 2015


 officecfg/registry/data/org/openoffice/Office/UI/Effects.xcu           |   13 +
 oox/source/ppt/slidetransition.cxx                                     |    4 
 oox/source/ppt/slidetransitioncontext.cxx                              |    1 
 sd/qa/unit/data/AllTransitions.odp                                     |binary
 sd/qa/unit/export-tests.cxx                                            |    5 
 sd/source/filter/eppt/pptx-epptooxml.cxx                               |   16 +-
 sd/xml/transitions-ogl.xml                                             |    3 
 slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx   |   67 +++++++++-
 slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.hxx   |    1 
 slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionerImpl.cxx |    4 
 10 files changed, 105 insertions(+), 9 deletions(-)

New commits:
commit f6ef7e33b034d4ee5fb85ae4b72d8d255fbed2b6
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.com>
Date:   Fri Nov 13 10:10:17 2015 +0100

    slideshow: add "glitter" slide transition
    
    Change-Id: Ie89b64c4399cd0092eee579660c9fe85f8ca8e73

diff --git a/officecfg/registry/data/org/openoffice/Office/UI/Effects.xcu b/officecfg/registry/data/org/openoffice/Office/UI/Effects.xcu
index 0dd2fe9..f0fe30e 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/Effects.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/Effects.xcu
@@ -1605,6 +1605,14 @@
           <value xml:lang="en-US">Ripple</value>
         </prop>
       </node>
+      <node oor:name="glitter" oor:op="replace">
+        <prop oor:name="Group" oor:type="xs:string">
+          <value>exciting</value>
+        </prop>
+        <prop oor:name="Label" oor:type="xs:string">
+          <value xml:lang="en-US">Glitter</value>
+        </prop>
+      </node>
     </node>
     <node oor:name="TransitionVariants">
       <node oor:name="plain" oor:op="replace">
@@ -2348,6 +2356,11 @@
           <value>ripple</value>
         </prop>
       </node>
+      <node oor:name="glitter" oor:op="replace">
+        <prop oor:name="Set" oor:type="xs:string">
+          <value>glitter</value>
+        </prop>
+      </node>
     </node>
   </node>
   <node oor:name="Presets">
diff --git a/oox/source/ppt/slidetransition.cxx b/oox/source/ppt/slidetransition.cxx
index 0fe0b10..e5e87c9 100644
--- a/oox/source/ppt/slidetransition.cxx
+++ b/oox/source/ppt/slidetransition.cxx
@@ -413,6 +413,10 @@ namespace oox { namespace ppt {
             mnTransitionType = TransitionType::MISCSHAPEWIPE;
             mnTransitionSubType = TransitionSubType::HORIZONTAL;
             break;
+        case P14_TOKEN(glitter):
+            mnTransitionType = TransitionType::MISCSHAPEWIPE;
+            mnTransitionSubType = TransitionSubType::DIAMOND;
+            break;
         default:
             mnTransitionType = 0;
             break;
diff --git a/oox/source/ppt/slidetransitioncontext.cxx b/oox/source/ppt/slidetransitioncontext.cxx
index a5d5496..0d0c783 100644
--- a/oox/source/ppt/slidetransitioncontext.cxx
+++ b/oox/source/ppt/slidetransitioncontext.cxx
@@ -131,6 +131,7 @@ SlideTransitionContext::~SlideTransitionContext() throw()
     case PPT_TOKEN( wedge ):
     case P14_TOKEN( vortex ):
     case P14_TOKEN( ripple ):
+    case P14_TOKEN( glitter ):
         // CT_Empty
         if (!mbHasTransition)
         {
diff --git a/sd/qa/unit/data/AllTransitions.odp b/sd/qa/unit/data/AllTransitions.odp
index 35b7a49..11c7c9c 100644
Binary files a/sd/qa/unit/data/AllTransitions.odp and b/sd/qa/unit/data/AllTransitions.odp differ
diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx
index b0dcb74..ba6c309 100644
--- a/sd/qa/unit/export-tests.cxx
+++ b/sd/qa/unit/export-tests.cxx
@@ -1424,8 +1424,11 @@ void SdExportTest::testExportTransitionsPPTX()
     // RIPPLE
     CPPUNIT_ASSERT(checkTransitionOnPage(xDoc, 71, TransitionType::MISCSHAPEWIPE, TransitionSubType::HORIZONTAL));
 
+    // GLITTER
+    CPPUNIT_ASSERT(checkTransitionOnPage(xDoc, 72, TransitionType::MISCSHAPEWIPE, TransitionSubType::DIAMOND));
+
     // NEWSFLASH
-    CPPUNIT_ASSERT(checkTransitionOnPage(xDoc, 72, TransitionType::ZOOM, TransitionSubType::ROTATEIN));
+    CPPUNIT_ASSERT(checkTransitionOnPage(xDoc, 73, TransitionType::ZOOM, TransitionSubType::ROTATEIN));
 }
 
 CPPUNIT_TEST_SUITE_REGISTRATION(SdExportTest);
diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx b/sd/source/filter/eppt/pptx-epptooxml.cxx
index 257de7c..95d6b38 100644
--- a/sd/source/filter/eppt/pptx-epptooxml.cxx
+++ b/sd/source/filter/eppt/pptx-epptooxml.cxx
@@ -523,15 +523,17 @@ void PowerPointExport::WriteTransition( FSHelperPtr pFS )
 
     sal_Int32 nTransition = 0;
     const char* pDirection = nullptr;
-    const char* pDirection14 = nullptr;
     const char* pOrientation = nullptr;
     const char* pThruBlk = nullptr;
     const char* pSpokes = nullptr;
+
     char pSpokesTmp[2] = "0";
 
     // p14
     sal_Int32 nTransition14 = 0;
+    const char* pDirection14 = nullptr;
     const char* pInverted = nullptr;
+    const char* pPattern = nullptr; // diamond or hexagon
 
     //p15
     const char* pPresetTransition = nullptr;
@@ -581,13 +583,20 @@ void PowerPointExport::WriteTransition( FSHelperPtr pFS )
                         pPresetTransition = "fallOver";
                         bOOXmlSpecificTransition = true;
                         break;
-                    case animations::TransitionSubType::CORNERSIN:
+                    case animations::TransitionSubType::CORNERSIN: // Inside turning cube
                         pInverted = "true";
-                    case animations::TransitionSubType::CORNERSOUT:
+                    case animations::TransitionSubType::CORNERSOUT: // Outside turning cube
                         nTransition = XML_fade;
                         nTransition14 = XML_prism;
                         bOOXmlSpecificTransition = true;
                         break;
+                    case animations::TransitionSubType::DIAMOND: // Glitter
+                        nTransition = XML_fade;
+                        nTransition14 = XML_glitter;
+                        pDirection14 = "l";
+                        pPattern = "hexagon";
+                        bOOXmlSpecificTransition = true;
+                        break;
                 }
                 break;
             }
@@ -644,6 +653,7 @@ void PowerPointExport::WriteTransition( FSHelperPtr pFS )
             pFS->singleElementNS(XML_p14, nTransition14,
                                  XML_isInverted, pInverted,
                                  XML_dir, pDirection14,
+                                 XML_pattern, pPattern,
                                  FSEND );
         }
         else if (pPresetTransition)
diff --git a/sd/xml/transitions-ogl.xml b/sd/xml/transitions-ogl.xml
index d541133..d149c21 100644
--- a/sd/xml/transitions-ogl.xml
+++ b/sd/xml/transitions-ogl.xml
@@ -65,6 +65,9 @@
  <anim:par pres:preset-id="ripple">
   <anim:transitionFilter smil:type="miscShapeWipe" smil:subtype="horizontal"/>
  </anim:par>
+  <anim:par pres:preset-id="glitter">
+  <anim:transitionFilter smil:type="miscShapeWipe" smil:subtype="diamond"/>
+ </anim:par>
  <anim:par pres:preset-id="zoom-rotate-in">
   <anim:transitionFilter smil:type="zoom" smil:subtype="rotateIn"/>
  </anim:par>
diff --git a/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx b/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx
index cf79ead..3b3d581 100644
--- a/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx
+++ b/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx
@@ -836,6 +836,20 @@ std::shared_ptr<OGLTransitionImpl> makeHelix( sal_uInt16 nRows )
     return makeSimpleTransition(aLeavingSlide, aEnteringSlide);
 }
 
+float fdiv(int a, int b)
+{
+    return static_cast<float>(a)/b;
+}
+
+glm::vec2 vec(float x, float y, float nx, float ny)
+{
+    x = x < 0.0 ? 0.0 : x;
+    x = x > nx  ? nx  : x;
+    y = y < 0.0 ? 0.0 : y;
+    y = y > ny  ? ny  : y;
+    return glm::vec2(fdiv(x, nx), fdiv(y, ny));
+}
+
 std::shared_ptr<OGLTransitionImpl> makeNByMTileFlip( sal_uInt16 n, sal_uInt16 m )
 {
     double invN(1.0/static_cast<double>(n));
@@ -1649,11 +1663,6 @@ std::shared_ptr<OGLTransitionImpl> makeDissolve()
 namespace
 {
 
-float fdiv(int a, int b)
-{
-    return static_cast<float>(a)/b;
-}
-
 class VortexTransition : public ShaderTransition
 {
 public:
@@ -1863,6 +1872,54 @@ std::shared_ptr<OGLTransitionImpl> makeRipple()
     return makeRippleTransition(aLeavingSlide, aEnteringSlide, aSettings);
 }
 
+std::shared_ptr<OGLTransitionImpl> makeGlitter()
+{
+    const int NX = 30, NY = 30;
+
+    Primitives_t aLeavingSlide;
+    Primitives_t aEnteringSlide;
+
+    for (int y = 0; y < NY+2; y+=2)
+    {
+        for (int x = 0; x < NX+2; x+=2)
+        {
+            Primitive Slide;
+
+            if (y % 4 == 0)
+            {
+                Slide.pushTriangle(vec(x-1, y-1, NX, NY), vec(x,   y-2, NX, NY), vec(x, y+0.5, NX, NY));
+                Slide.pushTriangle(vec(x,   y-2, NX, NY), vec(x+1, y-1, NX, NY), vec(x, y+0.5, NX, NY));
+                Slide.pushTriangle(vec(x+1, y-1, NX, NY), vec(x+1, y,   NX, NY), vec(x, y+0.5, NX, NY));
+                Slide.pushTriangle(vec(x+1, y,   NX, NY), vec(x,   y+1, NX, NY), vec(x, y+0.5, NX, NY));
+                Slide.pushTriangle(vec(x,   y+1, NX, NY), vec(x-1, y,   NX, NY), vec(x, y+0.5, NX, NY));
+                Slide.pushTriangle(vec(x-1, y,   NX, NY), vec(x-1, y-1, NX, NY), vec(x, y+0.5, NX, NY));
+            }
+            else
+            {
+                Slide.pushTriangle(vec(x-2, y-1, NX, NY), vec(x-1, y-2, NX, NY), vec(x, y+0.5, NX, NY));
+                Slide.pushTriangle(vec(x-1, y-2, NX, NY), vec(x,   y-1, NX, NY), vec(x, y+0.5, NX, NY));
+                Slide.pushTriangle(vec(x,   y-1, NX, NY), vec(x,   y,   NX, NY), vec(x, y+0.5, NX, NY));
+                Slide.pushTriangle(vec(x,   y,   NX, NY), vec(x-1, y+1, NX, NY), vec(x, y+0.5, NX, NY));
+                Slide.pushTriangle(vec(x-1, y+1, NX, NY), vec(x-2, y,   NX, NY), vec(x, y+0.5, NX, NY));
+                Slide.pushTriangle(vec(x-2, y,   NX, NY), vec(x-2, y-1, NX, NY), vec(x, y+0.5, NX, NY));
+            }
+
+            glm::vec3 center = Slide.getVertices()[2];
+
+            float random = comphelper::rng::uniform_real_distribution(-0.2, std::nextafter(0.2, DBL_MAX));
+
+            Slide.Operations.push_back(makeSRotate(glm::vec3(0, 1, 0), center, 180 , true, fdiv(x, NX) + random , 1.0));
+
+            aLeavingSlide.push_back (Slide);
+
+            Slide.Operations.push_back(makeSRotate(glm::vec3(0, 1, 0), center, 180 , false, fdiv(x, NX) + random, 1.0));
+            aEnteringSlide.push_back (Slide);
+        }
+    }
+
+    return makeSimpleTransition(aLeavingSlide, aEnteringSlide);
+}
+
 std::shared_ptr<OGLTransitionImpl> makeNewsflash()
 {
     Primitive Slide;
diff --git a/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.hxx b/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.hxx
index 7193b6d..f7e2665 100644
--- a/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.hxx
+++ b/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.hxx
@@ -236,6 +236,7 @@ std::shared_ptr<OGLTransitionImpl> makeStatic();
 std::shared_ptr<OGLTransitionImpl> makeDissolve();
 std::shared_ptr<OGLTransitionImpl> makeVortex();
 std::shared_ptr<OGLTransitionImpl> makeRipple();
+std::shared_ptr<OGLTransitionImpl> makeGlitter();
 std::shared_ptr<OGLTransitionImpl> makeNewsflash();
 
 /** 2D replacements
diff --git a/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionerImpl.cxx b/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionerImpl.cxx
index be0686c..04c86b1 100644
--- a/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionerImpl.cxx
+++ b/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionerImpl.cxx
@@ -1432,6 +1432,7 @@ public:
                 case animations::TransitionSubType::CORNERSOUT:         //  12
                 case animations::TransitionSubType::VERTICAL:           //  13
                 case animations::TransitionSubType::HORIZONTAL:         //  14
+                case animations::TransitionSubType::DIAMOND:            //  26
                 case animations::TransitionSubType::CIRCLE:             //  27
                 case animations::TransitionSubType::FANOUTHORIZONTAL:   //  55
                 case animations::TransitionSubType::ACROSS:             // 108
@@ -1520,6 +1521,9 @@ public:
                 case animations::TransitionSubType::ACROSS:
                     pTransition = makeNByMTileFlip(8,6);
                     break;
+                case animations::TransitionSubType::DIAMOND:
+                    pTransition = makeGlitter();
+                    break;
                 }
         } else if( transitionType == animations::TransitionType::FADE && transitionSubType == animations::TransitionSubType::CROSSFADE ) {
             pTransition = makeFadeSmoothly();


More information about the Libreoffice-commits mailing list