[Libreoffice-commits] core.git: 5 commits - oox/source writerfilter/source

Cédric Bosdonnat cedric.bosdonnat at free.fr
Thu Jun 27 06:23:36 PDT 2013


 oox/source/vml/vmlformatting.cxx                   |   34 +++++++++++++--------
 oox/source/vml/vmlshape.cxx                        |    7 ++++
 writerfilter/source/dmapper/GraphicImport.cxx      |    3 -
 writerfilter/source/dmapper/WrapPolygonHandler.cxx |    8 ++--
 writerfilter/source/dmapper/WrapPolygonHandler.hxx |    2 -
 5 files changed, 35 insertions(+), 19 deletions(-)

New commits:
commit 8054a7dc0a1b9c27aea7717f58891e49bd25d14c
Author: Cédric Bosdonnat <cedric.bosdonnat at free.fr>
Date:   Wed Jun 26 11:26:56 2013 +0200

    n#820504: start a new subpath with m and t in VML path decoding
    
    Change-Id: I7bac4b111ede5e815d2ed121c18f4cfe1ad0950e
    (cherry picked from commit 8d6eb11d6965ee93e72513f5e01b67f598edf6c3)

diff --git a/oox/source/vml/vmlformatting.cxx b/oox/source/vml/vmlformatting.cxx
index 31d4f32..267d8e5 100644
--- a/oox/source/vml/vmlformatting.cxx
+++ b/oox/source/vml/vmlformatting.cxx
@@ -310,11 +310,16 @@ void ConversionHelper::decodeVmlPath( ::std::vector< ::std::vector< Point > >& r
             // Upon finding the next command code, deal with stored
             // coordinates for previous command and reset parameters counter if needed.
             // See http://www.w3.org/TR/NOTE-VML#_Toc416858382 for params count reference
-            if ( rPath[ i ] != ',' || nParamCount == 0)
+            if ( rPath[ i ] != ',' || nParamCount == 0 )
             {
                 switch ( state )
                 {
                 case MOVE_REL: // 2* params -> param count reset
+                    if ( rPointLists.size() > 0 && rPointLists.back().size() > 0 )
+                    {
+                        rPointLists.push_back( ::std::vector< Point >() );
+                        rFlagLists.push_back( ::std::vector< PolygonFlags >() );
+                    }
                     rPointLists.back().push_back( Point( aCoordList[ 0 ], aCoordList[ 1 ] ) );
                     rFlagLists.back().push_back( PolygonFlags_NORMAL );
                     aCurrentPoint = rPointLists.back().back();
@@ -322,6 +327,11 @@ void ConversionHelper::decodeVmlPath( ::std::vector< ::std::vector< Point > >& r
                     break;
 
                 case MOVE_ABS: // 2 params -> no param count reset
+                    if ( rPointLists.size() > 0 && rPointLists.back().size() > 0 )
+                    {
+                        rPointLists.push_back( ::std::vector< Point >() );
+                        rFlagLists.push_back( ::std::vector< PolygonFlags >() );
+                    }
                     rPointLists.back().push_back( Point( aCoordList[ 0 ], aCoordList[ 1 ] ) );
                     rFlagLists.back().push_back( PolygonFlags_NORMAL );
                     aCurrentPoint = rPointLists.back().back();
commit a3f2d5c140e9864b1da644ec18ad44fd6ab6334f
Author: Cédric Bosdonnat <cedric.bosdonnat at free.fr>
Date:   Mon Jun 24 11:39:30 2013 +0200

    Forgot to remove one case where nParamCount is set to twice the value
    
    Change-Id: I3649364a889b7ef6ce7ac4316a1621b6328170eb
    (cherry picked from commit 7f7a1294e2d0da30a58d897558a18a13dbc5e690)

diff --git a/oox/source/vml/vmlformatting.cxx b/oox/source/vml/vmlformatting.cxx
index 69d9b35..31d4f32 100644
--- a/oox/source/vml/vmlformatting.cxx
+++ b/oox/source/vml/vmlformatting.cxx
@@ -338,7 +338,7 @@ void ConversionHelper::decodeVmlPath( ::std::vector< ::std::vector< Point > >& r
                     rFlagLists.back().push_back( PolygonFlags_CONTROL );
                     rFlagLists.back().push_back( PolygonFlags_NORMAL );
                     aCurrentPoint = rPointLists.back().back();
-                    nParamCount = 2 * 6;
+                    nParamCount = 6;
                     break;
 
                 case BEZIER_ABS: // 6* params -> param count reset
commit b25eb9f78b55ba10636c56e6723b66939239b3f5
Author: Cédric Bosdonnat <cedric.bosdonnat at free.fr>
Date:   Mon Jun 24 10:37:05 2013 +0200

    n#820504: VML path import fixes: get back missing points
    
    nParamsCount was set to the double of the expected value, but the code
    handling the command only took the first set of parameters. Removing
    this 2* in nParamsCount.
    
    (cherry picked from commit 442ad6eef9d6e1588e4985e97ec3eafd6289f9ae)
    
    Conflicts:
    	oox/source/vml/vmlformatting.cxx
    
    Change-Id: I2a4bb07fc9167e056a52c7adfbee9e1ef8e2636c

diff --git a/oox/source/vml/vmlformatting.cxx b/oox/source/vml/vmlformatting.cxx
index 806c624..69d9b35 100644
--- a/oox/source/vml/vmlformatting.cxx
+++ b/oox/source/vml/vmlformatting.cxx
@@ -318,7 +318,7 @@ void ConversionHelper::decodeVmlPath( ::std::vector< ::std::vector< Point > >& r
                     rPointLists.back().push_back( Point( aCoordList[ 0 ], aCoordList[ 1 ] ) );
                     rFlagLists.back().push_back( PolygonFlags_NORMAL );
                     aCurrentPoint = rPointLists.back().back();
-                    nParamCount = 2 * 2;
+                    nParamCount = 2;
                     break;
 
                 case MOVE_ABS: // 2 params -> no param count reset
@@ -349,7 +349,7 @@ void ConversionHelper::decodeVmlPath( ::std::vector< ::std::vector< Point > >& r
                     rFlagLists.back().push_back( PolygonFlags_CONTROL );
                     rFlagLists.back().push_back( PolygonFlags_NORMAL );
                     aCurrentPoint = rPointLists.back().back();
-                    nParamCount = 2 * 6;
+                    nParamCount = 6;
                     break;
 
                 case LINE_REL: // 2* params -> param count reset
@@ -357,14 +357,14 @@ void ConversionHelper::decodeVmlPath( ::std::vector< ::std::vector< Point > >& r
                                             aCurrentPoint.Y + aCoordList[ 1 ] ) );
                     rFlagLists.back().push_back( PolygonFlags_NORMAL );
                     aCurrentPoint = rPointLists.back().back();
-                    nParamCount = 2 * 2;
+                    nParamCount = 2;
                     break;
 
                 case LINE_ABS: // 2* params -> param count reset
                     rPointLists.back().push_back( Point( aCoordList[ 0 ], aCoordList[ 1 ] ) );
                     rFlagLists.back().push_back( PolygonFlags_NORMAL );
                     aCurrentPoint = rPointLists.back().back();
-                    nParamCount = 2 * 2;
+                    nParamCount = 2;
                     break;
 
                 case CLOSE: // 0 param
@@ -397,17 +397,17 @@ void ConversionHelper::decodeVmlPath( ::std::vector< ::std::vector< Point > >& r
             {
             // Single-character commands
             case 't': // rmoveto
-                state = MOVE_REL; nParamCount = 2 * 2; break;
+                state = MOVE_REL; nParamCount = 2; break;
             case 'm': // moveto
-                state = MOVE_ABS; nParamCount = 2 * 2; break;
+                state = MOVE_ABS; nParamCount = 2; break;
             case 'v': // rcurveto
-                state = BEZIER_REL; nParamCount = 2 * 6; break;
+                state = BEZIER_REL; nParamCount = 6; break;
             case 'c': // curveto
-                state = BEZIER_ABS; nParamCount = 2 * 6; break;
+                state = BEZIER_ABS; nParamCount = 6; break;
             case 'r': // rlineto
-                state = LINE_REL; nParamCount = 2 * 2; break;
+                state = LINE_REL; nParamCount = 2; break;
             case 'l': // lineto
-                state = LINE_ABS; nParamCount = 2 * 2; break;
+                state = LINE_ABS; nParamCount = 2; break;
             case 'x': // close
                 state = CLOSE; break;
             case 'e': // end
diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index 4551eee..1cb4772 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -715,7 +715,7 @@ awt::Rectangle LineShape::getRelRectangle() const
 // ============================================================================
 
 BezierShape::BezierShape(Drawing& rDrawing)
-    : SimpleShape(rDrawing, "com.sun.star.drawing.OpenBezierShape") // TODO Could we need both Open and Closed?
+    : SimpleShape(rDrawing, "com.sun.star.drawing.OpenBezierShape")
 {
 }
 
commit 781904af36158b72c131f2d72e562e92f73a9bd2
Author: Cédric Bosdonnat <cedric.bosdonnat at free.fr>
Date:   Fri Jun 21 10:47:42 2013 +0200

    n#820504: Some imported VML paths are closed, try to detect the
    
    (cherry picked from commit 08db0b22bdce0f779e4af01a209aef1be29e9907)
    
    Conflicts:
    	oox/source/vml/vmlshape.cxx
    
    Change-Id: Idefd0277a85bd7b2b727f59cc4e568869b4932a1

diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index 358fe16..4551eee 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -715,12 +715,19 @@ awt::Rectangle LineShape::getRelRectangle() const
 // ============================================================================
 
 BezierShape::BezierShape(Drawing& rDrawing)
-    : SimpleShape(rDrawing, "com.sun.star.drawing.OpenBezierShape")
+    : SimpleShape(rDrawing, "com.sun.star.drawing.OpenBezierShape") // TODO Could we need both Open and Closed?
 {
 }
 
 Reference< XShape > BezierShape::implConvertAndInsert( const Reference< XShapes >& rxShapes, const awt::Rectangle& rShapeRect ) const
 {
+    // If we have an 'x' in the last part of the path it means it is closed...
+    sal_Int32 nPos = maShapeModel.maVmlPath.lastIndexOf(',');
+    if ( nPos != -1 && maShapeModel.maVmlPath.copy(nPos).indexOf('x') != -1 )
+    {
+        const_cast<BezierShape*>( this )->setService( "com.sun.star.drawing.ClosedBezierShape" );
+    }
+
     awt::Rectangle aCoordSys = getCoordSystem();
     PolyPolygonBezierCoords aBezierCoords;
 
commit ee80670695014697cdfa26a6fd142c69a423cbdd
Author: Cédric Bosdonnat <cedric.bosdonnat at free.fr>
Date:   Wed Jun 19 10:42:47 2013 +0200

    n#820800: docx import of wrap polyon was based on dest size of picture
    
    ... instead of the original size of it.
    
    Change-Id: Ib251206dd092a7c47343caf50bd05a3dfec1af09
    (cherry picked from commit ae6981601b0e9175efaf9849b1279290ea3380f6)

diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx
index a6c6295..ce80724 100644
--- a/writerfilter/source/dmapper/GraphicImport.cxx
+++ b/writerfilter/source/dmapper/GraphicImport.cxx
@@ -1536,8 +1536,7 @@ uno::Reference< text::XTextContent > GraphicImport::createGraphicObject( const b
                 if( aGraphicSize.Width && aGraphicSize.Height &&
                     m_pImpl->mpWrapPolygon.get() != NULL)
                 {
-                    awt::Size aDstSize(m_pImpl->getXSize(), m_pImpl->getYSize());
-                    WrapPolygon::Pointer_t pCorrected = m_pImpl->mpWrapPolygon->correctWordWrapPolygon(aGraphicSize, aDstSize);
+                    WrapPolygon::Pointer_t pCorrected = m_pImpl->mpWrapPolygon->correctWordWrapPolygon(aGraphicSize);
                     aContourPolyPolygon <<= pCorrected->getPointSequenceSequence();
                 }
 
diff --git a/writerfilter/source/dmapper/WrapPolygonHandler.cxx b/writerfilter/source/dmapper/WrapPolygonHandler.cxx
index 885925d..134c49c 100644
--- a/writerfilter/source/dmapper/WrapPolygonHandler.cxx
+++ b/writerfilter/source/dmapper/WrapPolygonHandler.cxx
@@ -104,7 +104,7 @@ WrapPolygon::Pointer_t WrapPolygon::scale(const Fraction & rFractionX, const Fra
     return pResult;
 }
 
-WrapPolygon::Pointer_t WrapPolygon::correctWordWrapPolygon(const awt::Size & rSrcSize, const awt::Size & rDstSize)
+WrapPolygon::Pointer_t WrapPolygon::correctWordWrapPolygon(const awt::Size & rSrcSize)
 {
     WrapPolygon::Pointer_t pResult;
 
@@ -119,9 +119,9 @@ WrapPolygon::Pointer_t WrapPolygon::correctWordWrapPolygon(const awt::Size & rSr
     Fraction aScaleY(nWrap100Percent, Fraction(nWrap100Percent) - aMove);
     pResult = pResult->scale(aScaleX, aScaleY);
 
-    Fraction aScaleDestX(rDstSize.Width, nWrap100Percent);
-    Fraction aScaleDestY(rDstSize.Height, nWrap100Percent);
-    pResult = pResult->scale(aScaleDestX, aScaleDestY);
+    Fraction aScaleSrcX(rSrcSize.Width, nWrap100Percent);
+    Fraction aScaleSrcY(rSrcSize.Height, nWrap100Percent);
+    pResult = pResult->scale(aScaleSrcX, aScaleSrcY);
 
     return pResult;
 }
diff --git a/writerfilter/source/dmapper/WrapPolygonHandler.hxx b/writerfilter/source/dmapper/WrapPolygonHandler.hxx
index 9312db7..52cdf5e 100644
--- a/writerfilter/source/dmapper/WrapPolygonHandler.hxx
+++ b/writerfilter/source/dmapper/WrapPolygonHandler.hxx
@@ -55,7 +55,7 @@ public:
 
     WrapPolygon::Pointer_t move(const awt::Point & rMove);
     WrapPolygon::Pointer_t scale(const Fraction & rFractionX, const Fraction & rFractionY);
-    WrapPolygon::Pointer_t correctWordWrapPolygon(const awt::Size & rSrcSize, const awt::Size & rDstSize);
+    WrapPolygon::Pointer_t correctWordWrapPolygon(const awt::Size & rSrcSize);
     drawing::PointSequenceSequence getPointSequenceSequence() const;
 };
 


More information about the Libreoffice-commits mailing list