summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorNoel <noelgrandin@gmail.com>2020-10-02 13:36:56 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-10-03 08:13:09 +0200
commit1f40a488fcf95f90fdd18c41ef7041d475cf08a2 (patch)
treedb765704a71903a2cf1c57aedb173c466d87b15f /oox
parent16a7f98f99d334ea865b800e0b32d6fed1483942 (diff)
loplugin:reducevarscope in oox
Change-Id: I6f2f91b821271415c4cec0eb1e694b00b3b2f59f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103836 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'oox')
-rw-r--r--oox/source/export/chartexport.cxx8
-rw-r--r--oox/source/export/drawingml.cxx2
-rw-r--r--oox/source/helper/propertymap.cxx2
-rw-r--r--oox/source/ole/axcontrol.cxx2
-rw-r--r--oox/source/ppt/pptshapecontext.cxx3
-rw-r--r--oox/source/vml/vmlshape.cxx2
6 files changed, 9 insertions, 10 deletions
diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx
index fd33d9a38bc8..0e3cff0d4a95 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -1735,15 +1735,15 @@ void ChartExport::exportGradientFill( const Reference< XPropertySet >& xPropSet
OUString sFillGradientName;
xPropSet->getPropertyValue("FillGradientName") >>= sFillGradientName;
- awt::Gradient aGradient;
- awt::Gradient aTransparenceGradient;
uno::Reference< lang::XMultiServiceFactory > xFact( getModel(), uno::UNO_QUERY );
try
{
uno::Reference< container::XNameAccess > xGradient( xFact->createInstance("com.sun.star.drawing.GradientTable"), uno::UNO_QUERY );
uno::Any rGradientValue = xGradient->getByName( sFillGradientName );
+ awt::Gradient aGradient;
if( rGradientValue >>= aGradient )
{
+ awt::Gradient aTransparenceGradient;
mpFS->startElementNS(XML_a, XML_gradFill);
OUString sFillTransparenceGradientName;
if( (xPropSet->getPropertyValue("FillTransparenceGradientName") >>= sFillTransparenceGradientName) && !sFillTransparenceGradientName.isEmpty())
@@ -2282,11 +2282,11 @@ void ChartExport::exportSeries( const Reference<chart2::XChartType>& xChartType,
sal_Int32 nSeqIdx=0;
for( ; nSeqIdx<aSeqCnt.getLength(); ++nSeqIdx )
{
- OUString aRole;
Reference< chart2::data::XDataSequence > xTempValueSeq( aSeqCnt[nSeqIdx]->getValues() );
if( nMainSequenceIndex==-1 )
{
Reference< beans::XPropertySet > xSeqProp( xTempValueSeq, uno::UNO_QUERY );
+ OUString aRole;
if( xSeqProp.is())
xSeqProp->getPropertyValue("Role") >>= aRole;
// "main" sequence
@@ -3237,9 +3237,9 @@ void ChartExport::_exportAxis(
mAny >>= bDisplayUnits;
if(bDisplayUnits)
{
- OUString aVal;
if(GetProperty( xAxisProp, "BuiltInUnit" ))
{
+ OUString aVal;
mAny >>= aVal;
if(!aVal.isEmpty())
{
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 0612fe56ed43..01f926c0c90c 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -518,7 +518,6 @@ bool DrawingML::EqualGradients( awt::Gradient aGradient1, awt::Gradient aGradien
void DrawingML::WriteGradientFill( const Reference< XPropertySet >& rXPropSet )
{
awt::Gradient aGradient;
- awt::Gradient aTransparenceGradient;
if (!GetProperty(rXPropSet, "FillGradient"))
return;
@@ -553,6 +552,7 @@ void DrawingML::WriteGradientFill( const Reference< XPropertySet >& rXPropSet )
}
else
{
+ awt::Gradient aTransparenceGradient;
mpFS->startElementNS(XML_a, XML_gradFill, XML_rotWithShape, "0");
OUString sFillTransparenceGradientName;
if (GetProperty(rXPropSet, "FillTransparenceGradientName")
diff --git a/oox/source/helper/propertymap.cxx b/oox/source/helper/propertymap.cxx
index aff0e66452c4..74351064a85a 100644
--- a/oox/source/helper/propertymap.cxx
+++ b/oox/source/helper/propertymap.cxx
@@ -905,9 +905,9 @@ void PropertyMap::dumpCode( const Reference< XPropertySet >& rXPropSet )
continue;
OString name = OUStringToOString( rProp.Name, RTL_TEXTENCODING_UTF8);
- int level = 1;
try {
+ int level = 1;
printLevel (level);
fprintf (stderr, "{\n");
const char* var = lclDumpAnyValueCode (rXPropSet->getPropertyValue (rProp.Name), level + 1);
diff --git a/oox/source/ole/axcontrol.cxx b/oox/source/ole/axcontrol.cxx
index 81fce321d0ad..59f9d62fefc1 100644
--- a/oox/source/ole/axcontrol.cxx
+++ b/oox/source/ole/axcontrol.cxx
@@ -538,7 +538,6 @@ void ControlConverter::convertToAxState( PropertySet const & rPropSet,
sal_Int16 nState = API_STATE_DONTKNOW;
- bool bTriStateEnabled = false;
// need to use State for current state ( I think this is regardless of whether
// control is awt or not )
rPropSet.getProperty( nState, PROP_State );
@@ -552,6 +551,7 @@ void ControlConverter::convertToAxState( PropertySet const & rPropSet,
// tristate
if( bSupportsTriState )
{
+ bool bTriStateEnabled = false;
bool bPropertyExists = rPropSet.getProperty( bTriStateEnabled, PROP_TriState );
if( bPropertyExists && bTriStateEnabled )
nMultiSelect = AX_SELECTION_MULTI;
diff --git a/oox/source/ppt/pptshapecontext.cxx b/oox/source/ppt/pptshapecontext.cxx
index 72c96dd8d9c2..a853843930a6 100644
--- a/oox/source/ppt/pptshapecontext.cxx
+++ b/oox/source/ppt/pptshapecontext.cxx
@@ -68,14 +68,13 @@ ContextHandlerRef PPTShapeContext::onCreateContext( sal_Int32 aElementToken, con
SlidePersistPtr pMasterPersist( mpSlidePersistPtr->getMasterPersist() );
OptValue< sal_Int32 > oSubType( rAttribs.getToken( XML_type) );
sal_Int32 nSubType( rAttribs.getToken( XML_type, XML_obj ) );
- sal_Int32 nSubTypeIndex;
oox::drawingml::ShapePtr pTmpPlaceholder;
mpShapePtr->setSubType( nSubType );
if( rAttribs.hasAttribute( XML_idx ) )
{
- nSubTypeIndex = rAttribs.getString( XML_idx ).get().toInt32();
+ sal_Int32 nSubTypeIndex = rAttribs.getString( XML_idx ).get().toInt32();
mpShapePtr->setSubTypeIndex( nSubTypeIndex );
if(!oSubType.has() && pMasterPersist)
diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index eb0f886c32b6..6cd5aff9110d 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -1061,13 +1061,13 @@ Reference< XShape > BezierShape::implConvertAndInsert( const Reference< XShapes
typedef ::std::vector< ::std::vector< PolygonFlags > > FlagsList;
std::vector< ::std::vector< awt::Point > > aCoordLists;
FlagsList aFlagLists;
- sal_Int32 nIndex = 0;
// Curve defined by to, from, control1 and control2 attributes
if ( maShapeModel.maVmlPath.isEmpty() )
{
aCoordLists.emplace_back( );
aFlagLists.emplace_back( );
+ sal_Int32 nIndex = 0;
// Start point
aCoordLists[ 0 ].emplace_back(