Kaydet (Commit) d9e335ea authored tarafından Jochen Nitschke's avatar Jochen Nitschke

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/29917Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarJochen Nitschke <j.nitschke+logerrit@ok.de>
üst 9bcae1a1
...@@ -174,7 +174,7 @@ void CustomShapeProperties::pushToPropSet( const ::oox::core::FilterBase& /* rFi ...@@ -174,7 +174,7 @@ void CustomShapeProperties::pushToPropSet( const ::oox::core::FilterBase& /* rFi
OUString presetTextWarp; OUString presetTextWarp;
if ( aGeoPropSeq[ i ].Value >>= presetTextWarp ) if ( aGeoPropSeq[ i ].Value >>= presetTextWarp )
{ {
aPropertyMap.setProperty( PROP_PresetTextWarp, Any( presetTextWarp ) ); aPropertyMap.setProperty( PROP_PresetTextWarp, presetTextWarp );
} }
} }
} }
......
...@@ -805,19 +805,19 @@ Reference< XShape > const & Shape::createAndInsert( ...@@ -805,19 +805,19 @@ Reference< XShape > const & Shape::createAndInsert(
// TextFrames have BackColor, not FillColor // TextFrames have BackColor, not FillColor
if (aShapeProps.hasProperty(PROP_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); aShapeProps.erase(PROP_FillColor);
} }
// TextFrames have BackColorTransparency, not FillTransparence // TextFrames have BackColorTransparency, not FillTransparence
if (aShapeProps.hasProperty(PROP_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); aShapeProps.erase(PROP_FillTransparence);
} }
// TextFrames have BackGrahicURL, not FillBitmapURL // TextFrames have BackGrahicURL, not FillBitmapURL
if (aShapeProps.hasProperty(PROP_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); aShapeProps.erase(PROP_FillBitmapURL);
} }
if (aShapeProps.hasProperty(PROP_FillBitmapName)) if (aShapeProps.hasProperty(PROP_FillBitmapName))
...@@ -840,7 +840,7 @@ Reference< XShape > const & Shape::createAndInsert( ...@@ -840,7 +840,7 @@ Reference< XShape > const & Shape::createAndInsert(
aBorderLine.Color = aShapeProps.getProperty(PROP_LineColor).get<sal_Int32>(); aBorderLine.Color = aShapeProps.getProperty(PROP_LineColor).get<sal_Int32>();
if (aLineProperties.moLineWidth.has()) if (aLineProperties.moLineWidth.has())
aBorderLine.LineWidth = convertEmuToHmm(aLineProperties.moLineWidth.get()); aBorderLine.LineWidth = convertEmuToHmm(aLineProperties.moLineWidth.get());
aShapeProps.setProperty(nBorder, uno::makeAny(aBorderLine)); aShapeProps.setProperty(nBorder, aBorderLine);
} }
aShapeProps.erase(PROP_LineColor); aShapeProps.erase(PROP_LineColor);
} }
...@@ -913,12 +913,12 @@ Reference< XShape > const & Shape::createAndInsert( ...@@ -913,12 +913,12 @@ Reference< XShape > const & Shape::createAndInsert(
aFormat.Location = nLocation; aFormat.Location = nLocation;
} }
aFormat.ShadowWidth = *oShadowDistance; aFormat.ShadowWidth = *oShadowDistance;
aShapeProps.setProperty(PROP_ShadowFormat, uno::makeAny(aFormat)); aShapeProps.setProperty(PROP_ShadowFormat, aFormat);
} }
} }
else if (mbTextBox) else if (mbTextBox)
{ {
aShapeProps.setProperty(PROP_TextBox, uno::makeAny(true)); aShapeProps.setProperty(PROP_TextBox, true);
} }
if (aServiceName != "com.sun.star.text.TextFrame" && isLinkedTxbx()) if (aServiceName != "com.sun.star.text.TextFrame" && isLinkedTxbx())
......
...@@ -288,15 +288,15 @@ void BulletList::apply( const BulletList& rSource ) ...@@ -288,15 +288,15 @@ void BulletList::apply( const BulletList& rSource )
void BulletList::pushToPropMap( const ::oox::core::XmlFilterBase* pFilterBase, PropertyMap& rPropMap ) const void BulletList::pushToPropMap( const ::oox::core::XmlFilterBase* pFilterBase, PropertyMap& rPropMap ) const
{ {
if( msNumberingPrefix.hasValue() ) if( msNumberingPrefix.hasValue() )
rPropMap.setProperty( PROP_Prefix, msNumberingPrefix); rPropMap.setAnyProperty( PROP_Prefix, msNumberingPrefix);
if( msNumberingSuffix.hasValue() ) if( msNumberingSuffix.hasValue() )
rPropMap.setProperty( PROP_Suffix, msNumberingSuffix); rPropMap.setAnyProperty( PROP_Suffix, msNumberingSuffix);
if( mnStartAt.hasValue() ) if( mnStartAt.hasValue() )
rPropMap.setProperty( PROP_StartWith, mnStartAt); rPropMap.setAnyProperty( PROP_StartWith, mnStartAt);
rPropMap.setProperty( PROP_Adjust, HoriOrientation::LEFT); rPropMap.setProperty( PROP_Adjust, HoriOrientation::LEFT);
if( mnNumberingType.hasValue() ) if( mnNumberingType.hasValue() )
rPropMap.setProperty( PROP_NumberingType, mnNumberingType); rPropMap.setAnyProperty( PROP_NumberingType, mnNumberingType);
OUString aBulletFontName; OUString aBulletFontName;
sal_Int16 nBulletFontPitch = 0; sal_Int16 nBulletFontPitch = 0;
...@@ -352,9 +352,9 @@ void BulletList::pushToPropMap( const ::oox::core::XmlFilterBase* pFilterBase, P ...@@ -352,9 +352,9 @@ void BulletList::pushToPropMap( const ::oox::core::XmlFilterBase* pFilterBase, P
rPropMap.setProperty( PROP_Graphic, xBitmap); rPropMap.setProperty( PROP_Graphic, xBitmap);
} }
if( mnSize.hasValue() ) if( mnSize.hasValue() )
rPropMap.setProperty( PROP_BulletRelSize, mnSize); rPropMap.setAnyProperty( PROP_BulletRelSize, mnSize);
if ( maStyleName.hasValue() ) if ( maStyleName.hasValue() )
rPropMap.setProperty( PROP_CharStyleName, maStyleName); rPropMap.setAnyProperty( PROP_CharStyleName, maStyleName);
if (pFilterBase ) { if (pFilterBase ) {
if ( maBulletColorPtr->isUsed() ) if ( maBulletColorPtr->isUsed() )
rPropMap.setProperty( PROP_BulletColor, maBulletColorPtr->getColor( pFilterBase->getGraphicHelper() )); rPropMap.setProperty( PROP_BulletColor, maBulletColorPtr->getColor( pFilterBase->getGraphicHelper() ));
...@@ -426,20 +426,20 @@ void TextParagraphProperties::pushToPropSet( const ::oox::core::XmlFilterBase* p ...@@ -426,20 +426,20 @@ void TextParagraphProperties::pushToPropSet( const ::oox::core::XmlFilterBase* p
{ {
if ( noParaLeftMargin ) if ( noParaLeftMargin )
{ {
aPropSet.setProperty( PROP_ParaLeftMargin, static_cast< sal_Int32 >(0)); aPropSet.setProperty<sal_Int32>( PROP_ParaLeftMargin, 0);
rioBulletMap.setProperty( PROP_LeftMargin, static_cast< sal_Int32 >( *noParaLeftMargin )); rioBulletMap.setProperty( PROP_LeftMargin, *noParaLeftMargin);
noParaLeftMargin = boost::none; noParaLeftMargin = boost::none;
} }
if ( noFirstLineIndentation ) if ( noFirstLineIndentation )
{ {
// Force Paragraph property as zero - impress seems to use the value from previous // Force Paragraph property as zero - impress seems to use the value from previous
// (non) bullet line if not set to zero explicitly :( // (non) bullet line if not set to zero explicitly :(
aPropSet.setProperty( PROP_ParaFirstLineIndent, static_cast< sal_Int32 >(0) ); aPropSet.setProperty<sal_Int32>( PROP_ParaFirstLineIndent, 0);
rioBulletMap.setProperty( PROP_FirstLineOffset, static_cast< sal_Int32 >( *noFirstLineIndentation )); rioBulletMap.setProperty( PROP_FirstLineOffset, *noFirstLineIndentation);
noFirstLineIndentation = boost::none; noFirstLineIndentation = boost::none;
} }
if ( nNumberingType != NumberingType::BITMAP && !rioBulletMap.hasProperty( PROP_BulletColor ) && pFilterBase ) 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 ) if ( bApplyBulletMap )
...@@ -456,7 +456,7 @@ void TextParagraphProperties::pushToPropSet( const ::oox::core::XmlFilterBase* p ...@@ -456,7 +456,7 @@ void TextParagraphProperties::pushToPropSet( const ::oox::core::XmlFilterBase* p
{ {
// fix default bullet size to be 100% // fix default bullet size to be 100%
if( !rioBulletMap.hasProperty( PROP_BulletRelSize ) ) 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(); Sequence< PropertyValue > aBulletPropSeq = rioBulletMap.makePropertyValueSequence();
xNumRule->replaceByIndex( getLevel(), makeAny( aBulletPropSeq ) ); xNumRule->replaceByIndex( getLevel(), makeAny( aBulletPropSeq ) );
} }
...@@ -470,7 +470,7 @@ void TextParagraphProperties::pushToPropSet( const ::oox::core::XmlFilterBase* p ...@@ -470,7 +470,7 @@ void TextParagraphProperties::pushToPropSet( const ::oox::core::XmlFilterBase* p
} }
} }
if ( noParaLeftMargin ) if ( noParaLeftMargin )
aPropSet.setProperty( PROP_ParaLeftMargin, sal_Int32( *noParaLeftMargin ) ); aPropSet.setProperty( PROP_ParaLeftMargin, *noParaLeftMargin);
if ( noFirstLineIndentation ) if ( noFirstLineIndentation )
{ {
aPropSet.setProperty( PROP_ParaFirstLineIndent, *noFirstLineIndentation ); aPropSet.setProperty( PROP_ParaFirstLineIndent, *noFirstLineIndentation );
......
...@@ -830,7 +830,7 @@ void ShadowModel::pushToPropMap(ShapePropertyMap& rPropMap, const GraphicHelper& ...@@ -830,7 +830,7 @@ void ShadowModel::pushToPropMap(ShapePropertyMap& rPropMap, const GraphicHelper&
aFormat.Location = table::ShadowLocation_BOTTOM_RIGHT; aFormat.Location = table::ShadowLocation_BOTTOM_RIGHT;
// The width of the shadow is the average of the x and y values, see SwWW8ImplReader::MatchSdrItemsIntoFlySet(). // The width of the shadow is the average of the x and y values, see SwWW8ImplReader::MatchSdrItemsIntoFlySet().
aFormat.ShadowWidth = ((nOffsetX + nOffsetY) / 2); aFormat.ShadowWidth = ((nOffsetX + nOffsetY) / 2);
rPropMap.setProperty(PROP_ShadowFormat, uno::makeAny(aFormat)); rPropMap.setProperty(PROP_ShadowFormat, aFormat);
} }
TextpathModel::TextpathModel() TextpathModel::TextpathModel()
......
...@@ -511,7 +511,7 @@ void ShapeBase::convertShapeProperties( const Reference< XShape >& rxShape ) con ...@@ -511,7 +511,7 @@ void ShapeBase::convertShapeProperties( const Reference< XShape >& rxShape ) con
aBorderLine.Color = aPropMap.getProperty(PROP_LineColor).get<sal_Int32>(); aBorderLine.Color = aPropMap.getProperty(PROP_LineColor).get<sal_Int32>();
if (oLineWidth) if (oLineWidth)
aBorderLine.LineWidth = *oLineWidth; aBorderLine.LineWidth = *oLineWidth;
aPropMap.setProperty(nBorder, uno::makeAny(aBorderLine)); aPropMap.setProperty(nBorder, aBorderLine);
} }
aPropMap.erase(PROP_LineColor); aPropMap.erase(PROP_LineColor);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment