[Libreoffice-commits] core.git: 9 commits - filter/source oox/source sw/qa

Stephan Bergmann sbergman at redhat.com
Tue Oct 13 05:05:37 PDT 2015


 filter/source/msfilter/msdffimp.cxx     |   12 +++++-------
 filter/source/msfilter/svdfppt.cxx      |    8 +++-----
 oox/source/drawingml/fillproperties.cxx |    4 +---
 oox/source/export/shapes.cxx            |    4 +++-
 sw/qa/extras/ww8export/ww8export.cxx    |   10 +++++-----
 5 files changed, 17 insertions(+), 21 deletions(-)

New commits:
commit 176c60dd19f29457aca02a1477ffcc1ab312f050
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Oct 13 14:04:17 2015 +0200

    sw/qa/extras/ww8export/data/tdf94386.odt is missing
    
    ...from b630f9a36a844f46757abb6ce16fa7cd527a4341 "tdf#94386: Unit test stub -
    emulates the steps to trigger the bug."
    
    Change-Id: Id845ed86920614c592f891d85e6ee3d1673056f8

diff --git a/sw/qa/extras/ww8export/ww8export.cxx b/sw/qa/extras/ww8export/ww8export.cxx
index 4268e4f..f8b5911 100644
--- a/sw/qa/extras/ww8export/ww8export.cxx
+++ b/sw/qa/extras/ww8export/ww8export.cxx
@@ -568,11 +568,11 @@ DECLARE_WW8EXPORT_TEST(testMoveRange, "fdo66304-1.odt")
     //the save must survive without asserting
 }
 
-DECLARE_WW8EXPORT_TEST(testTdf94386, "tdf94386.odt")
-{
-    // TODO: assert here that the 2nd page has the right size even after
-    // the save as .doc
-}
+// DECLARE_WW8EXPORT_TEST(testTdf94386, "tdf94386.odt")
+// {
+//     // TODO: assert here that the 2nd page has the right size even after
+//     // the save as .doc
+// }
 
 CPPUNIT_PLUGIN_IMPLEMENT();
 
commit 8a5382fec79f3a8651b7d4f9f2d6452b5a6d367d
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Oct 13 13:13:34 2015 +0200

    Use nRadius value at least to decide between "rect" and "roundRect" presets
    
    (found by clang-analyzer-deadcode.DeadStores)
    
    Change-Id: I27ff1222295a151a7616ed380439b87d27866899

diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index 2f73d27..a8464e3 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -882,6 +882,8 @@ ShapeExport& ShapeExport::WriteRectangleShape( Reference< XShape > xShape )
     {
         nRadius = MapSize( awt::Size( nRadius, 0 ) ).Width;
     }
+    //TODO: use nRadius value more precisely than just deciding whether to use
+    // "rect" or "roundRect" preset shape below
 
     // non visual shape properties
     if (GetDocumentType() == DOCUMENT_DOCX)
@@ -898,7 +900,7 @@ ShapeExport& ShapeExport::WriteRectangleShape( Reference< XShape > xShape )
     // visual shape properties
     pFS->startElementNS( mnXmlNamespace, XML_spPr, FSEND );
     WriteShapeTransformation( xShape, XML_a, false, false);
-    WritePresetShape( "rect" );
+    WritePresetShape( nRadius == 0 ? "rect" : "roundRect" );
     Reference< XPropertySet > xProps( xShape, UNO_QUERY );
     if( xProps.is() )
     {
commit 949628c412d04a27ef655d4103812b53235a82c1
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Oct 13 11:40:14 2015 +0200

    Reduce scope of variable
    
    Change-Id: I07745fc47f5d7908c35045e83cb230d4e91a813a

diff --git a/oox/source/drawingml/fillproperties.cxx b/oox/source/drawingml/fillproperties.cxx
index 883f9a45..a667bc5 100644
--- a/oox/source/drawingml/fillproperties.cxx
+++ b/oox/source/drawingml/fillproperties.cxx
@@ -365,7 +365,6 @@ void FillProperties::pushToPropMap( ShapePropertyMap& rPropMap,
                     if ( !maGradientProps.moRotateWithShape.get( false ) )
                         nShapeRotation = 0;
 
-                    sal_Int32 nDmlAngle = 0;
                     if( maGradientProps.moGradientPath.has() )
                     {
                         aGradient.Style = (maGradientProps.moGradientPath.get() == XML_circle) ? awt::GradientStyle_ELLIPTICAL : awt::GradientStyle_RECT;
@@ -533,7 +532,7 @@ void FillProperties::pushToPropMap( ShapePropertyMap& rPropMap,
                         // Now we have a potential border and a largest segment. Use those.
 
                         aGradient.Style = bSymmetric ? awt::GradientStyle_AXIAL : awt::GradientStyle_LINEAR;
-                        nDmlAngle = maGradientProps.moShadeAngle.get( 0 ) - nShapeRotation;
+                        sal_Int32 nDmlAngle = maGradientProps.moShadeAngle.get( 0 ) - nShapeRotation;
                         // convert DrawingML angle (in 1/60000 degrees) to API angle (in 1/10 degrees)
                         aGradient.Angle = static_cast< sal_Int16 >( (4500 - (nDmlAngle / (PER_DEGREE / 10))) % 3600 );
                         Color aStartColor, aEndColor;
commit 9059a17e3a8cfe536f66dfe17bd213d81f09c625
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Oct 13 11:35:27 2015 +0200

    clang-analyzer-deadcode.DeadStores
    
    ever since 68e756de2ec7f9aeb1b6a6a28468745eca114715 "n#657896 - Gradient
    Transparencies and Muticolor Gradient fills" moved the use of nDmlANgle (to set
    aGradient.Angle) from after the if/else to inside the else branch.  According
    to vmiklos: "i guess it's just an oversight that the
    'nDmlAngle = nShapeRotation;' is not removed in the 'if' branch."
    
    Change-Id: I63e449e01a83415d988d6616388d724449997f39

diff --git a/oox/source/drawingml/fillproperties.cxx b/oox/source/drawingml/fillproperties.cxx
index 6879896..883f9a45 100644
--- a/oox/source/drawingml/fillproperties.cxx
+++ b/oox/source/drawingml/fillproperties.cxx
@@ -377,7 +377,6 @@ void FillProperties::pushToPropMap( ShapePropertyMap& rPropMap,
                         aGradient.YOffset = getLimitedValue< sal_Int16, sal_Int32 >( nCenterY / PER_PERCENT, 30, 70 );
                         ::std::swap( aGradient.StartColor, aGradient.EndColor );
                         ::std::swap( nStartTrans, nEndTrans );
-                        nDmlAngle = nShapeRotation;
                     }
                     else
                     {
commit cd79d5caf67d1769cd1bdea6f4ae26810d27ebc0
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Oct 13 11:10:54 2015 +0200

    Reduce scope of variable
    
    Change-Id: Ifa8cf3fcb7b33ffb03ef89d2f88cf4ab8287e43f

diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx
index bac0395..d01b8ed 100644
--- a/filter/source/msfilter/svdfppt.cxx
+++ b/filter/source/msfilter/svdfppt.cxx
@@ -1506,10 +1506,10 @@ SdrPowerPointImport::SdrPowerPointImport( PowerPointImportParam& rParam, const O
                 pE->bStarDrawFiller = true;     // this is a dummy master page
             m_pMasterPages->insert(m_pMasterPages->begin(), std::move(pE));
 
-            sal_uInt16 nPageListNum = 0;
             DffRecordHeader* pSlideListWithTextHd = aDocRecManager.GetRecordHeader( PPT_PST_SlideListWithText );
             PptSlidePersistEntry* pPreviousPersist = NULL;
-            while ( pSlideListWithTextHd && ( nPageListNum < 3 ) )
+            for (sal_uInt16 nPageListNum = 0;
+                 pSlideListWithTextHd && nPageListNum < 3; ++nPageListNum)
             {
                 pSlideListWithTextHd->SeekToContent( rStCtrl );
                 PptSlidePersistList* pPageList = GetPageList( PptPageKind( nPageListNum ) );
@@ -1528,7 +1528,6 @@ SdrPowerPointImport::SdrPowerPointImport( PowerPointImportParam& rParam, const O
                 if ( pPreviousPersist )
                     pPreviousPersist->nSlidePersistEndOffset = nSlideListWithTextHdEndOffset;
                 pSlideListWithTextHd = aDocRecManager.GetRecordHeader( PPT_PST_SlideListWithText, SEEK_FROM_CURRENT );
-                nPageListNum++;
             }
 
             // we will ensure that there is at least one master page
@@ -1556,8 +1555,7 @@ SdrPowerPointImport::SdrPowerPointImport( PowerPointImportParam& rParam, const O
             }
 
             // read for each page the SlideAtom respectively the NotesAtom if it exists
-            nPageListNum = 0;
-            for ( nPageListNum = 0; nPageListNum < 3; nPageListNum++ )
+            for (sal_uInt16 nPageListNum = 0; nPageListNum < 3; ++nPageListNum)
             {
                 PptSlidePersistList* pPageList = GetPageList( PptPageKind( nPageListNum ) );
                 for ( size_t nPageNum = 0; nPageNum < pPageList->size(); nPageNum++ )
commit b076bb1da6a370bcba7394d7349c73311130e335
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Oct 13 11:05:45 2015 +0200

    Reduce scope of variable
    
    Change-Id: Id55865a539c90ef7e1fa1a2da2cc614e71115e6c

diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index 77956dd..8b49de9 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -4517,9 +4517,9 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r
                         pAny = ((SdrCustomShapeGeometryItem&)aGeometryItem).GetPropertyValueByName( sAdjustmentValues );
                         if ( pAny && ( *pAny >>= seqAdjustmentValues ) && seqAdjustmentValues.getLength() > 1 )
                         {
-                            double fNumber;
                             if ( seqAdjustmentValues[ 0 ].State == css::beans::PropertyState_DIRECT_VALUE )
                             {
+                                double fNumber;
                                 seqAdjustmentValues[ 0 ].Value >>= fNumber;
                                 nEndAngle = NormAngle360( - (sal_Int32)fNumber * 100 );
                             }
@@ -4527,6 +4527,7 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r
                             {
                                 //normal situation:if endAngle != 90,there will be a direct_value,but for damaged curve,the endAngle need to recalculate.
                                 Point cent = aPolyBoundRect.Center();
+                                double fNumber;
                                 if ( aStartPt.Y() == cent.Y() )
                                     fNumber = ( aStartPt.X() >= cent.X() ) ? 0:180.0;
                                 else if ( aStartPt.X() == cent.X() )
@@ -4543,13 +4544,13 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r
 
                             if ( seqAdjustmentValues[ 1 ].State == css::beans::PropertyState_DIRECT_VALUE )
                             {
+                                double fNumber;
                                 seqAdjustmentValues[ 1 ].Value >>= fNumber;
                                 nStartAngle = NormAngle360( - (sal_Int32)fNumber * 100 );
                             }
                             else
                             {
-                                fNumber = 0.0;
-                                seqAdjustmentValues[ 1 ].Value <<= fNumber;
+                                seqAdjustmentValues[ 1 ].Value <<= 0.0;
                                 seqAdjustmentValues[ 1 ].State = css::beans::PropertyState_DIRECT_VALUE;
                             }
 
commit 6fc3c9a50dfb555ab806fa6cd35d433af4a36415
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Oct 13 11:02:28 2015 +0200

    clang-analyzer-deadcode.DeadStores
    
    since 1cbec9cd986100de185f6dc10301a54f6604e6af "Resolves: #i119480# Fixed import
    of curves from PPT"
    
    Change-Id: I90107e4163503fd83676c4e104d1c7db08f12a18

diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index 875abbd..77956dd 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -4525,7 +4525,6 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r
                             }
                             else
                             {
-                                fNumber = 270.0;
                                 //normal situation:if endAngle != 90,there will be a direct_value,but for damaged curve,the endAngle need to recalculate.
                                 Point cent = aPolyBoundRect.Center();
                                 if ( aStartPt.Y() == cent.Y() )
commit f7e74036441ac3052ce31f8b0cd31fc04a8bcf4d
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Oct 13 10:59:06 2015 +0200

    clang-analyzer-deadcode.DeadStores
    
    Change-Id: I8082afe49a568b1cba9ce25dde9cad5e283244e4

diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index c9ba758..875abbd 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -1424,7 +1424,6 @@ void DffPropertyReader::ApplyCustomShapeTextAttributes( SfxItemSet& rSet ) const
 
     if ( bVerticalText )
     {
-        eTVA = SDRTEXTVERTADJUST_BLOCK;
         eTHA = SDRTEXTHORZADJUST_CENTER;
 
         // read text anchor
@@ -1470,7 +1469,6 @@ void DffPropertyReader::ApplyCustomShapeTextAttributes( SfxItemSet& rSet ) const
     else
     {
         eTVA = SDRTEXTVERTADJUST_CENTER;
-        eTHA = SDRTEXTHORZADJUST_BLOCK;
 
         // read text anchor
         sal_uInt32 eTextAnchor = GetPropertyValue( DFF_Prop_anchorText, mso_anchorTop );
commit 7a169c11be07f651330cf540aa1579534761be0b
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Oct 13 10:57:03 2015 +0200

    Read this MSO_Anchor value as a sal_uInt32 too
    
    ...for consistency with 0fad62c2178d6b8157b07ff30fe9e2fc8173d393
    "-fsanitize=enum"
    
    Change-Id: I96e2a791811b5f45735d2ccb0686bcc12fe9a5a2

diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index fe39cb8..c9ba758 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -1428,7 +1428,7 @@ void DffPropertyReader::ApplyCustomShapeTextAttributes( SfxItemSet& rSet ) const
         eTHA = SDRTEXTHORZADJUST_CENTER;
 
         // read text anchor
-        MSO_Anchor eTextAnchor = (MSO_Anchor)GetPropertyValue( DFF_Prop_anchorText, mso_anchorTop );
+        sal_uInt32 eTextAnchor = GetPropertyValue( DFF_Prop_anchorText, mso_anchorTop );
 
         switch( eTextAnchor )
         {


More information about the Libreoffice-commits mailing list