[Libreoffice-commits] core.git: filter/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Fri Oct 9 13:12:01 UTC 2020


 filter/source/msfilter/msdffimp.cxx |   21 +++++++++------------
 filter/source/msfilter/svdfppt.cxx  |   14 +++++++-------
 2 files changed, 16 insertions(+), 19 deletions(-)

New commits:
commit 643ecd7c36f04da6d9b833855f37971c9cef3d79
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Oct 9 11:45:44 2020 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri Oct 9 15:11:20 2020 +0200

    ofz: Invalid-enum-value
    
    Change-Id: I31cbefcc7a759a266a34d30bd950d707feedcdfb
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104117
    Tested-by: Caolán McNamara <caolanm at redhat.com>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index a647709367af..bd29942a6931 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -911,7 +911,7 @@ void DffPropertyReader::ApplyLineAttributes( SfxItemSet& rSet, const MSO_SPT eSh
         sal_Int32 nLineWidth = static_cast<sal_Int32>(GetPropertyValue( DFF_Prop_lineWidth, 9525 ));
 
         // support LineCap
-        const MSO_LineCap eLineCap(static_cast<MSO_LineCap>(GetPropertyValue(DFF_Prop_lineEndCapStyle, mso_lineEndCapFlat)));
+        auto eLineCap = GetPropertyValue(DFF_Prop_lineEndCapStyle, mso_lineEndCapFlat);
 
         switch(eLineCap)
         {
@@ -933,7 +933,7 @@ void DffPropertyReader::ApplyLineAttributes( SfxItemSet& rSet, const MSO_SPT eSh
             }
         }
 
-        MSO_LineDashing eLineDashing = static_cast<MSO_LineDashing>(GetPropertyValue( DFF_Prop_lineDashing, mso_lineSolid ));
+        auto eLineDashing = GetPropertyValue( DFF_Prop_lineDashing, mso_lineSolid);
         if (eLineDashing == mso_lineSolid || nLineWidth < 0)
             rSet.Put(XLineStyleItem( drawing::LineStyle_SOLID ) );
         else
@@ -1063,9 +1063,9 @@ void DffPropertyReader::ApplyLineAttributes( SfxItemSet& rSet, const MSO_SPT eSh
 
             if ( IsProperty( DFF_Prop_lineStartArrowhead ) )
             {
-                MSO_LineEnd         eLineEnd = static_cast<MSO_LineEnd>(GetPropertyValue( DFF_Prop_lineStartArrowhead, 0 ));
-                MSO_LineEndWidth    eWidth = static_cast<MSO_LineEndWidth>(GetPropertyValue( DFF_Prop_lineStartArrowWidth, mso_lineMediumWidthArrow ));
-                MSO_LineEndLength   eLength = static_cast<MSO_LineEndLength>(GetPropertyValue( DFF_Prop_lineStartArrowLength, mso_lineMediumLenArrow ));
+                auto eLineEnd = GetPropertyValue(DFF_Prop_lineStartArrowhead, 0);
+                auto eWidth = GetPropertyValue(DFF_Prop_lineStartArrowWidth, mso_lineMediumWidthArrow);
+                auto eLength = GetPropertyValue(DFF_Prop_lineStartArrowLength, mso_lineMediumLenArrow);
 
                 sal_Int32   nArrowWidth;
                 bool        bArrowCenter;
@@ -1576,7 +1576,7 @@ void DffPropertyReader::ApplyCustomShapeTextAttributes( SfxItemSet& rSet ) const
     rSet.Put( makeSdrTextUpperDistItem( nTextTop ) );
     rSet.Put( makeSdrTextLowerDistItem( nTextBottom ) );
 
-    rSet.Put( makeSdrTextWordWrapItem( static_cast<MSO_WrapMode>(GetPropertyValue( DFF_Prop_WrapText, mso_wrapSquare )) != mso_wrapNone ) );
+    rSet.Put( makeSdrTextWordWrapItem( GetPropertyValue(DFF_Prop_WrapText, mso_wrapSquare) != mso_wrapNone ) );
     rSet.Put( makeSdrTextAutoGrowHeightItem( ( GetPropertyValue( DFF_Prop_FitTextToShape, 0 ) & 2 ) != 0 ) );
 }
 
@@ -5116,9 +5116,7 @@ SdrObject* SvxMSDffManager::ProcessObj(SvStream& rSt,
         pImpRec->nShapeId   = rObjData.nShapeId;
         pImpRec->eShapeType = rObjData.eShapeType;
 
-        MSO_WrapMode eWrapMode( static_cast<MSO_WrapMode>(GetPropertyValue(
-                                                            DFF_Prop_WrapText,
-                                                            mso_wrapSquare )) );
+        auto eWrapMode = GetPropertyValue(DFF_Prop_WrapText, mso_wrapSquare);
         rObjData.bClientAnchor = maShapeRecords.SeekToContent( rSt,
                                             DFF_msofbtClientAnchor,
                                             SEEK_FROM_CURRENT_AND_RESTART );
@@ -5342,7 +5340,7 @@ SdrObject* SvxMSDffManager::ProcessObj(SvStream& rSt,
                 aSet.Put( makeSdrTextAutoGrowWidthItem( false ) );
             }
 
-            switch ( static_cast<MSO_WrapMode>(GetPropertyValue( DFF_Prop_WrapText, mso_wrapSquare )) )
+            switch (GetPropertyValue(DFF_Prop_WrapText, mso_wrapSquare))
             {
                 case mso_wrapNone :
                     aSet.Put( makeSdrTextAutoGrowWidthItem( true ) );
@@ -5371,8 +5369,7 @@ SdrObject* SvxMSDffManager::ProcessObj(SvStream& rSt,
             // read text anchor
             if ( IsProperty( DFF_Prop_anchorText ) )
             {
-                MSO_Anchor eTextAnchor =
-                    static_cast<MSO_Anchor>(GetPropertyValue( DFF_Prop_anchorText, 0 ));
+                auto eTextAnchor = GetPropertyValue(DFF_Prop_anchorText, 0);
 
                 SdrTextVertAdjust eTVA = SDRTEXTVERTADJUST_CENTER;
                 bool bTVASet(false);
diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx
index 8a4db2499371..02c8ce67068a 100644
--- a/filter/source/msfilter/svdfppt.cxx
+++ b/filter/source/msfilter/svdfppt.cxx
@@ -816,7 +816,7 @@ SdrObject* SdrEscherImport::ProcessObj( SvStream& rSt, DffObjData& rObjData, Svx
                 sal_Int32 nTextRotationAngle = 0;
                 if ( IsProperty( DFF_Prop_txflTextFlow ) )
                 {
-                    MSO_TextFlow eTextFlow = static_cast<MSO_TextFlow>( GetPropertyValue( DFF_Prop_txflTextFlow, 0 ) & 0xFFFF );
+                    auto eTextFlow = GetPropertyValue(DFF_Prop_txflTextFlow, 0) & 0xFFFF;
                     switch( eTextFlow )
                     {
                         case mso_txflBtoT :                     // Bottom to Top non-@
@@ -877,7 +877,7 @@ SdrObject* SdrEscherImport::ProcessObj( SvStream& rSt, DffObjData& rObjData, Svx
                     eTHA = SDRTEXTHORZADJUST_CENTER;
 
                     // read text anchor
-                    MSO_Anchor eTextAnchor = static_cast<MSO_Anchor>(GetPropertyValue( DFF_Prop_anchorText, mso_anchorTop ));
+                    auto eTextAnchor = GetPropertyValue(DFF_Prop_anchorText, mso_anchorTop);
 
                     switch( eTextAnchor )
                     {
@@ -1047,7 +1047,7 @@ SdrObject* SdrEscherImport::ProcessObj( SvStream& rSt, DffObjData& rObjData, Svx
                     }
                 }
                 SdrObject* pTObj = nullptr;
-                bool bWordWrap = static_cast<MSO_WrapMode>(GetPropertyValue( DFF_Prop_WrapText, mso_wrapSquare )) != mso_wrapNone;
+                bool bWordWrap = GetPropertyValue(DFF_Prop_WrapText, mso_wrapSquare) != mso_wrapNone;
                 bool bFitShapeToText = ( GetPropertyValue( DFF_Prop_FitTextToShape, 0 ) & 2 ) != 0;
 
                 if ( dynamic_cast<const SdrObjCustomShape* >(pRet) !=  nullptr && ( eTextKind == OBJ_RECT ) )
@@ -1298,7 +1298,7 @@ SdrObject* SdrEscherImport::ProcessObj( SvStream& rSt, DffObjData& rObjData, Svx
         }
         if ( GetPropertyValue( DFF_Prop_fNoFillHitTest, 0 ) & 0x10 )
         {
-            if ( static_cast<MSO_FillType>(GetPropertyValue( DFF_Prop_fillType, mso_fillSolid )) == mso_fillBackground )
+            if (GetPropertyValue(DFF_Prop_fillType, mso_fillSolid) == mso_fillBackground)
             {
                 rData.aBackgroundColoredObjects.push_back( pRet );
             }
@@ -7661,7 +7661,7 @@ bool SdrPowerPointImport::IsVerticalText() const
     bool bVerticalText = false;
     if ( IsProperty( DFF_Prop_txflTextFlow ) )
     {
-        MSO_TextFlow eTextFlow = static_cast<MSO_TextFlow>( GetPropertyValue( DFF_Prop_txflTextFlow, 0 ) & 0xFFFF );
+        auto eTextFlow = GetPropertyValue(DFF_Prop_txflTextFlow, 0) & 0xFFFF;
         switch( eTextFlow )
         {
         case mso_txflTtoBA :                    // Top to Bottom @-font, above -> below
@@ -7692,7 +7692,7 @@ void    SdrPowerPointImport::ApplyTextAnchorAttributes( PPTTextObj const & rText
         eTHA = SDRTEXTHORZADJUST_CENTER;
 
         // read text anchor
-        MSO_Anchor eTextAnchor = static_cast<MSO_Anchor>(GetPropertyValue( DFF_Prop_anchorText, mso_anchorTop ));
+        auto eTextAnchor = GetPropertyValue(DFF_Prop_anchorText, mso_anchorTop);
 
         switch( eTextAnchor )
         {
@@ -7744,7 +7744,7 @@ void    SdrPowerPointImport::ApplyTextAnchorAttributes( PPTTextObj const & rText
         eTHA = SDRTEXTHORZADJUST_BLOCK;
 
         // read text anchor
-        MSO_Anchor eTextAnchor = static_cast<MSO_Anchor>(GetPropertyValue( DFF_Prop_anchorText, mso_anchorTop ));
+        auto eTextAnchor = GetPropertyValue(DFF_Prop_anchorText, mso_anchorTop);
 
         switch( eTextAnchor )
         {


More information about the Libreoffice-commits mailing list