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

Jochen Nitschke j.nitschke+logerrit at ok.de
Mon Oct 17 15:38:50 UTC 2016


 include/oox/helper/propertymap.hxx               |    3 ++
 oox/source/drawingml/customshapeproperties.cxx   |    2 -
 oox/source/drawingml/shape.cxx                   |   12 +++++-----
 oox/source/drawingml/textparagraphproperties.cxx |   26 +++++++++++------------
 oox/source/vml/vmlformatting.cxx                 |    2 -
 oox/source/vml/vmlshape.cxx                      |    2 -
 6 files changed, 25 insertions(+), 22 deletions(-)

New commits:
commit a8cfb651ac0d2669d5780b707bfb1efb43f0f34c
Author: Jochen Nitschke <j.nitschke+logerrit at ok.de>
Date:   Sun Oct 16 19:09:01 2016 +0200

    delete setProperty specialisation with value type Any
    
    Using delete instead of std::enable_if
    because of better error message.
    
    Change-Id: I92c57a4bb3281b119166a8f98a94ed3aa6079df5
    Reviewed-on: https://gerrit.libreoffice.org/29930
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Jochen Nitschke <j.nitschke+logerrit at ok.de>

diff --git a/include/oox/helper/propertymap.hxx b/include/oox/helper/propertymap.hxx
index cf9b802..badcf0d 100644
--- a/include/oox/helper/propertymap.hxx
+++ b/include/oox/helper/propertymap.hxx
@@ -76,6 +76,9 @@ public:
         return true;
     }
 
+    /** setAnyProperty should be used */
+    bool                setProperty( sal_Int32, const css::uno::Any& ) = delete;
+
     css::uno::Any       getProperty( sal_Int32 nPropId );
 
     void                erase( sal_Int32 nPropId );
commit d9e335ea6f7c99932fdc822c3b87321201389634
Author: Jochen Nitschke <j.nitschke+logerrit at ok.de>
Date:   Sun Oct 16 12:29:31 2016 +0200

    fix wrong usages of setProperty vs setAnyProperty...
    
    and remove some useless casts.
    
    setAnyProperty takes an Any for property value.
    setProperty takes any value and creates an Any.
    
    Change-Id: Ida0a80bd679775c08925309bfbc695630af2225f
    Reviewed-on: https://gerrit.libreoffice.org/29917
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Jochen Nitschke <j.nitschke+logerrit at ok.de>

diff --git a/oox/source/drawingml/customshapeproperties.cxx b/oox/source/drawingml/customshapeproperties.cxx
index daf178d..3ef04b4 100644
--- a/oox/source/drawingml/customshapeproperties.cxx
+++ b/oox/source/drawingml/customshapeproperties.cxx
@@ -174,7 +174,7 @@ void CustomShapeProperties::pushToPropSet( const ::oox::core::FilterBase& /* rFi
                     OUString presetTextWarp;
                     if ( aGeoPropSeq[ i ].Value >>= presetTextWarp )
                     {
-                        aPropertyMap.setProperty( PROP_PresetTextWarp, Any( presetTextWarp ) );
+                        aPropertyMap.setProperty( PROP_PresetTextWarp, presetTextWarp );
                     }
                 }
             }
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index 83a02d4..1befb50 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -805,19 +805,19 @@ Reference< XShape > const & Shape::createAndInsert(
                 // TextFrames have BackColor, not FillColor
                 if (aShapeProps.hasProperty(PROP_FillColor))
                 {
-                    aShapeProps.setProperty(PROP_BackColor, aShapeProps.getProperty(PROP_FillColor));
+                    aShapeProps.setAnyProperty(PROP_BackColor, aShapeProps.getProperty(PROP_FillColor));
                     aShapeProps.erase(PROP_FillColor);
                 }
                 // TextFrames have BackColorTransparency, not FillTransparence
                 if (aShapeProps.hasProperty(PROP_FillTransparence))
                 {
-                    aShapeProps.setProperty(PROP_BackColorTransparency, aShapeProps.getProperty(PROP_FillTransparence));
+                    aShapeProps.setAnyProperty(PROP_BackColorTransparency, aShapeProps.getProperty(PROP_FillTransparence));
                     aShapeProps.erase(PROP_FillTransparence);
                 }
                 // TextFrames have BackGrahicURL, not FillBitmapURL
                 if (aShapeProps.hasProperty(PROP_FillBitmapURL))
                 {
-                    aShapeProps.setProperty(PROP_BackGraphicURL, aShapeProps.getProperty(PROP_FillBitmapURL));
+                    aShapeProps.setAnyProperty(PROP_BackGraphicURL, aShapeProps.getProperty(PROP_FillBitmapURL));
                     aShapeProps.erase(PROP_FillBitmapURL);
                 }
                 if (aShapeProps.hasProperty(PROP_FillBitmapName))
@@ -840,7 +840,7 @@ Reference< XShape > const & Shape::createAndInsert(
                         aBorderLine.Color = aShapeProps.getProperty(PROP_LineColor).get<sal_Int32>();
                         if (aLineProperties.moLineWidth.has())
                             aBorderLine.LineWidth = convertEmuToHmm(aLineProperties.moLineWidth.get());
-                        aShapeProps.setProperty(nBorder, uno::makeAny(aBorderLine));
+                        aShapeProps.setProperty(nBorder, aBorderLine);
                     }
                     aShapeProps.erase(PROP_LineColor);
                 }
@@ -913,12 +913,12 @@ Reference< XShape > const & Shape::createAndInsert(
                         aFormat.Location = nLocation;
                     }
                     aFormat.ShadowWidth = *oShadowDistance;
-                    aShapeProps.setProperty(PROP_ShadowFormat, uno::makeAny(aFormat));
+                    aShapeProps.setProperty(PROP_ShadowFormat, aFormat);
                 }
             }
             else if (mbTextBox)
             {
-                aShapeProps.setProperty(PROP_TextBox, uno::makeAny(true));
+                aShapeProps.setProperty(PROP_TextBox, true);
             }
 
             if (aServiceName != "com.sun.star.text.TextFrame" && isLinkedTxbx())
diff --git a/oox/source/drawingml/textparagraphproperties.cxx b/oox/source/drawingml/textparagraphproperties.cxx
index d9b3636..4d281c0 100644
--- a/oox/source/drawingml/textparagraphproperties.cxx
+++ b/oox/source/drawingml/textparagraphproperties.cxx
@@ -288,15 +288,15 @@ void BulletList::apply( const BulletList& rSource )
 void BulletList::pushToPropMap( const ::oox::core::XmlFilterBase* pFilterBase, PropertyMap& rPropMap ) const
 {
     if( msNumberingPrefix.hasValue() )
-        rPropMap.setProperty( PROP_Prefix, msNumberingPrefix);
+        rPropMap.setAnyProperty( PROP_Prefix, msNumberingPrefix);
     if( msNumberingSuffix.hasValue() )
-        rPropMap.setProperty( PROP_Suffix, msNumberingSuffix);
+        rPropMap.setAnyProperty( PROP_Suffix, msNumberingSuffix);
     if( mnStartAt.hasValue() )
-        rPropMap.setProperty( PROP_StartWith, mnStartAt);
+        rPropMap.setAnyProperty( PROP_StartWith, mnStartAt);
     rPropMap.setProperty( PROP_Adjust, HoriOrientation::LEFT);
 
     if( mnNumberingType.hasValue() )
-        rPropMap.setProperty( PROP_NumberingType, mnNumberingType);
+        rPropMap.setAnyProperty( PROP_NumberingType, mnNumberingType);
 
     OUString aBulletFontName;
     sal_Int16 nBulletFontPitch = 0;
@@ -352,9 +352,9 @@ void BulletList::pushToPropMap( const ::oox::core::XmlFilterBase* pFilterBase, P
             rPropMap.setProperty( PROP_Graphic, xBitmap);
     }
     if( mnSize.hasValue() )
-        rPropMap.setProperty( PROP_BulletRelSize, mnSize);
+        rPropMap.setAnyProperty( PROP_BulletRelSize, mnSize);
     if ( maStyleName.hasValue() )
-        rPropMap.setProperty( PROP_CharStyleName, maStyleName);
+        rPropMap.setAnyProperty( PROP_CharStyleName, maStyleName);
     if (pFilterBase ) {
         if ( maBulletColorPtr->isUsed() )
             rPropMap.setProperty( PROP_BulletColor, maBulletColorPtr->getColor( pFilterBase->getGraphicHelper() ));
@@ -426,20 +426,20 @@ void TextParagraphProperties::pushToPropSet( const ::oox::core::XmlFilterBase* p
     {
         if ( noParaLeftMargin )
         {
-            aPropSet.setProperty( PROP_ParaLeftMargin, static_cast< sal_Int32 >(0));
-            rioBulletMap.setProperty( PROP_LeftMargin, static_cast< sal_Int32 >( *noParaLeftMargin ));
+            aPropSet.setProperty<sal_Int32>( PROP_ParaLeftMargin, 0);
+            rioBulletMap.setProperty( PROP_LeftMargin, *noParaLeftMargin);
             noParaLeftMargin = boost::none;
         }
         if ( noFirstLineIndentation )
         {
             // Force Paragraph property as zero - impress seems to use the value from previous
             // (non) bullet line if not set to zero explicitly :(
-            aPropSet.setProperty( PROP_ParaFirstLineIndent, static_cast< sal_Int32 >(0) );
-            rioBulletMap.setProperty( PROP_FirstLineOffset, static_cast< sal_Int32 >( *noFirstLineIndentation ));
+            aPropSet.setProperty<sal_Int32>( PROP_ParaFirstLineIndent, 0);
+            rioBulletMap.setProperty( PROP_FirstLineOffset, *noFirstLineIndentation);
             noFirstLineIndentation = boost::none;
         }
         if ( nNumberingType != NumberingType::BITMAP && !rioBulletMap.hasProperty( PROP_BulletColor ) && pFilterBase )
-            rioBulletMap.setProperty( PROP_BulletColor, static_cast< sal_Int32 >( maTextCharacterProperties.maFillProperties.getBestSolidColor().getColor( pFilterBase->getGraphicHelper())));
+            rioBulletMap.setProperty( PROP_BulletColor, maTextCharacterProperties.maFillProperties.getBestSolidColor().getColor( pFilterBase->getGraphicHelper()));
     }
 
     if ( bApplyBulletMap )
@@ -456,7 +456,7 @@ void TextParagraphProperties::pushToPropSet( const ::oox::core::XmlFilterBase* p
                 {
                     // fix default bullet size to be 100%
                     if( !rioBulletMap.hasProperty( PROP_BulletRelSize ) )
-                        rioBulletMap.setProperty( PROP_BulletRelSize, static_cast< sal_Int16 >( 100 ));
+                        rioBulletMap.setProperty<sal_Int16>( PROP_BulletRelSize, 100);
                     Sequence< PropertyValue > aBulletPropSeq = rioBulletMap.makePropertyValueSequence();
                     xNumRule->replaceByIndex( getLevel(), makeAny( aBulletPropSeq ) );
                 }
@@ -470,7 +470,7 @@ void TextParagraphProperties::pushToPropSet( const ::oox::core::XmlFilterBase* p
         }
     }
     if ( noParaLeftMargin )
-        aPropSet.setProperty( PROP_ParaLeftMargin, sal_Int32( *noParaLeftMargin ) );
+        aPropSet.setProperty( PROP_ParaLeftMargin, *noParaLeftMargin);
     if ( noFirstLineIndentation )
     {
         aPropSet.setProperty( PROP_ParaFirstLineIndent, *noFirstLineIndentation );
diff --git a/oox/source/vml/vmlformatting.cxx b/oox/source/vml/vmlformatting.cxx
index 4dd8814..36cc43d 100644
--- a/oox/source/vml/vmlformatting.cxx
+++ b/oox/source/vml/vmlformatting.cxx
@@ -830,7 +830,7 @@ void ShadowModel::pushToPropMap(ShapePropertyMap& rPropMap, const GraphicHelper&
     aFormat.Location = table::ShadowLocation_BOTTOM_RIGHT;
     // The width of the shadow is the average of the x and y values, see SwWW8ImplReader::MatchSdrItemsIntoFlySet().
     aFormat.ShadowWidth = ((nOffsetX + nOffsetY) / 2);
-    rPropMap.setProperty(PROP_ShadowFormat, uno::makeAny(aFormat));
+    rPropMap.setProperty(PROP_ShadowFormat, aFormat);
 }
 
 TextpathModel::TextpathModel()
diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index 4c5f54c..c978c39 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -511,7 +511,7 @@ void ShapeBase::convertShapeProperties( const Reference< XShape >& rxShape ) con
                 aBorderLine.Color = aPropMap.getProperty(PROP_LineColor).get<sal_Int32>();
                 if (oLineWidth)
                     aBorderLine.LineWidth = *oLineWidth;
-                aPropMap.setProperty(nBorder, uno::makeAny(aBorderLine));
+                aPropMap.setProperty(nBorder, aBorderLine);
             }
             aPropMap.erase(PROP_LineColor);
         }


More information about the Libreoffice-commits mailing list