xmloff/source/chart/PropertyMaps.cxx | 3 +-- xmloff/source/chart/SchXMLExport.cxx | 7 +++---- xmloff/source/chart/SchXMLPlotAreaContext.cxx | 3 +-- xmloff/source/chart/XMLErrorIndicatorPropertyHdl.cxx | 2 +- xmloff/source/draw/SignatureLineContext.cxx | 2 +- xmloff/source/draw/animexp.cxx | 3 +-- xmloff/source/draw/sdpropls.cxx | 2 +- xmloff/source/draw/sdxmlexp.cxx | 3 +-- xmloff/source/draw/shapeexport.cxx | 2 +- xmloff/source/forms/controlpropertyhdl.cxx | 2 +- xmloff/source/style/DrawAspectHdl.cxx | 5 +---- xmloff/source/style/XMLBitmapRepeatOffsetPropertyHandler.cxx | 3 +-- xmloff/source/style/XMLConstantsPropertyHandler.cxx | 3 +-- xmloff/source/style/XMLFillBitmapSizePropertyHandler.cxx | 3 +-- xmloff/source/style/cdouthdl.cxx | 6 +++--- xmloff/source/style/chrhghdl.cxx | 3 +-- xmloff/source/style/csmaphdl.cxx | 2 +- xmloff/source/style/fonthdl.cxx | 6 ++---- xmloff/source/style/shadwhdl.cxx | 3 +-- xmloff/source/style/styleexp.cxx | 2 +- xmloff/source/style/undlihdl.cxx | 6 +++--- xmloff/source/style/xmlbahdl.cxx | 10 +++++----- xmloff/source/style/xmlimppr.cxx | 3 +-- xmloff/source/style/xmlnumfe.cxx | 2 +- xmloff/source/style/xmlstyle.cxx | 3 +-- xmloff/source/text/XMLSectionFootnoteConfigExport.cxx | 2 +- xmloff/source/text/XMLTextHeaderFooterContext.cxx | 2 +- xmloff/source/text/txtdrope.cxx | 4 ++-- xmloff/source/text/txtflde.cxx | 2 +- xmloff/source/text/txtparae.cxx | 2 +- xmloff/source/text/txtstyle.cxx | 2 +- 31 files changed, 43 insertions(+), 60 deletions(-)
New commits: commit 7bd7ff5a8d938e474a8f15e2c6facad632a342bb Author: Noel <noelgran...@gmail.com> AuthorDate: Thu Oct 1 11:00:51 2020 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Thu Oct 1 12:23:08 2020 +0200 loplugin:reducevarscope in xmloff Change-Id: Ib67311f84a6a7a490afb392e642d74693fde3113 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103747 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/xmloff/source/chart/PropertyMaps.cxx b/xmloff/source/chart/PropertyMaps.cxx index 1b00ac9227cf..6ce23fb54c68 100644 --- a/xmloff/source/chart/PropertyMaps.cxx +++ b/xmloff/source/chart/PropertyMaps.cxx @@ -403,7 +403,6 @@ void XMLChartExportPropertyMapper::handleSpecialItem( OUString sAttrName = getPropertySetMapper()->GetEntryXMLName( rProperty.mnIndex ); sal_uInt16 nNameSpace = getPropertySetMapper()->GetEntryNameSpace( rProperty.mnIndex ); OUStringBuffer sValueBuffer; - OUString sValue; sal_Int32 nValue = 0; bool bValue = false; @@ -519,7 +518,7 @@ void XMLChartExportPropertyMapper::handleSpecialItem( if( !sValueBuffer.isEmpty()) { - sValue = sValueBuffer.makeStringAndClear(); + OUString sValue = sValueBuffer.makeStringAndClear(); sAttrName = rNamespaceMap.GetQNameByKey( nNameSpace, sAttrName ); rAttrList.AddAttribute( sAttrName, sValue ); } diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx index 4911d5180d03..07a1019ccc71 100644 --- a/xmloff/source/chart/SchXMLExport.cxx +++ b/xmloff/source/chart/SchXMLExport.cxx @@ -2659,7 +2659,6 @@ void SchXMLExportHelper_Impl::exportSeries( xSource->getDataSequences()); sal_Int32 nMainSequenceIndex = -1; sal_Int32 nSeriesLength = 0; - sal_Int32 nAttachedAxis = chart::ChartAxisAssign::PRIMARY_Y; bool bHasMeanValueLine = false; Reference< beans::XPropertySet > xPropSet; tLabelValuesDataPair aSeriesLabelValuesPair; @@ -2671,10 +2670,10 @@ void SchXMLExportHelper_Impl::exportSeries( sal_Int32 nSeqIdx=0; for( ; nSeqIdx<aSeqCnt.getLength(); ++nSeqIdx ) { - OUString aRole; Reference< chart2::data::XDataSequence > xTempValueSeq( aSeqCnt[nSeqIdx]->getValues() ); if( nMainSequenceIndex==-1 ) { + OUString aRole; Reference< beans::XPropertySet > xSeqProp( xTempValueSeq, uno::UNO_QUERY ); if( xSeqProp.is()) xSeqProp->getPropertyValue("Role") >>= aRole; @@ -2694,6 +2693,7 @@ void SchXMLExportHelper_Impl::exportSeries( // have found the main sequence, then xValuesSeq and // xLabelSeq contain those. Otherwise both are empty { + sal_Int32 nAttachedAxis = chart::ChartAxisAssign::PRIMARY_Y; // get property states for autostyles try { @@ -3351,7 +3351,6 @@ void SchXMLExportHelper_Impl::exportDataPoints( const sal_Int32 * pPoints = aDataPointSeq.getConstArray(); sal_Int32 nElement; - sal_Int32 nRepeat; Reference< chart2::XColorScheme > xColorScheme; if( xDiagram.is()) xColorScheme.set( xDiagram->getDefaultColorScheme()); @@ -3539,7 +3538,7 @@ void SchXMLExportHelper_Impl::exportDataPoints( nLastIndex = nCurrIndex; } // final empty elements - nRepeat = nSeriesLength - nLastIndex - 1; + sal_Int32 nRepeat = nSeriesLength - nLastIndex - 1; if( nRepeat > 0 ) { SchXMLDataPointStruct aPoint; diff --git a/xmloff/source/chart/SchXMLPlotAreaContext.cxx b/xmloff/source/chart/SchXMLPlotAreaContext.cxx index 8782ef7818ff..6507fc757ea0 100644 --- a/xmloff/source/chart/SchXMLPlotAreaContext.cxx +++ b/xmloff/source/chart/SchXMLPlotAreaContext.cxx @@ -724,7 +724,6 @@ void SchXMLDataPointContext::StartElement( const uno::Reference< xml::sax::XAttr { OUString sAttrName = xAttrList->getNameByIndex( i ); OUString aLocalName; - bool bHideLegend = false; sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName ); if( nPrefix == XML_NAMESPACE_CHART ) @@ -753,7 +752,7 @@ void SchXMLDataPointContext::StartElement( const uno::Reference< xml::sax::XAttr } else if (IsXMLToken(aLocalName, XML_HIDE_LEGEND)) { - bHideLegend = xAttrList->getValueByIndex(i).toBoolean(); + bool bHideLegend = xAttrList->getValueByIndex(i).toBoolean(); if (bHideLegend) { uno::Sequence<sal_Int32> deletedLegendEntriesSeq; diff --git a/xmloff/source/chart/XMLErrorIndicatorPropertyHdl.cxx b/xmloff/source/chart/XMLErrorIndicatorPropertyHdl.cxx index 12ea12f51aaa..65f39a9b6256 100644 --- a/xmloff/source/chart/XMLErrorIndicatorPropertyHdl.cxx +++ b/xmloff/source/chart/XMLErrorIndicatorPropertyHdl.cxx @@ -81,7 +81,6 @@ bool XMLErrorIndicatorPropertyHdl::importXML( const OUString& rStrImpValue, bool XMLErrorIndicatorPropertyHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& /*rUnitConverter*/ ) const { - OUStringBuffer aBuffer; chart::ChartErrorIndicatorType eType; rValue >>= eType; @@ -92,6 +91,7 @@ bool XMLErrorIndicatorPropertyHdl::exportXML( OUString& rStrExpValue, if( bValue ) { + OUStringBuffer aBuffer; ::sax::Converter::convertBool( aBuffer, bValue ); rStrExpValue = aBuffer.makeStringAndClear(); } diff --git a/xmloff/source/draw/SignatureLineContext.cxx b/xmloff/source/draw/SignatureLineContext.cxx index 497bd8489c70..aa51e54156f0 100644 --- a/xmloff/source/draw/SignatureLineContext.cxx +++ b/xmloff/source/draw/SignatureLineContext.cxx @@ -68,7 +68,6 @@ SignatureLineContext::SignatureLineContext(SvXMLImport& rImport, sal_uInt16 nPrf xPropSet->setPropertyValue("SignatureLineUnsignedImage", Any(xUnsignedGraphic)); Reference<XGraphic> xGraphic; - bool bIsSigned(false); try { // Get the document signatures @@ -97,6 +96,7 @@ SignatureLineContext::SignatureLineContext(SvXMLImport& rImport, sal_uInt16 nPrf [&xAttrList](const DocumentSignatureInformation& rSignatureInfo) { return rSignatureInfo.SignatureLineId == xAttrList->getValueByName("loext:id"); }); + bool bIsSigned(false); if (pSignatureInfo != xSignatureInfo.end()) { bIsSigned = true; diff --git a/xmloff/source/draw/animexp.cxx b/xmloff/source/draw/animexp.cxx index cc1beefbdd07..1d2ba75abbdd 100644 --- a/xmloff/source/draw/animexp.cxx +++ b/xmloff/source/draw/animexp.cxx @@ -299,7 +299,6 @@ void XMLAnimationsExporter::collect( const Reference< XShape >& xShape, SvXMLExp Reference< XPropertySet > xProps( xShape, UNO_QUERY ); if( xProps.is() ) { - AnimationEffect eEffect; XMLEffectHint aEffect; if( any2bool( xProps->getPropertyValue( AnimExpImpl::gsSoundOn ) ) ) @@ -328,7 +327,7 @@ void XMLAnimationsExporter::collect( const Reference< XShape >& xShape, SvXMLExp } { - + AnimationEffect eEffect; xProps->getPropertyValue( AnimExpImpl::gsEffect ) >>= eEffect; if( eEffect != AnimationEffect_NONE ) { diff --git a/xmloff/source/draw/sdpropls.cxx b/xmloff/source/draw/sdpropls.cxx index f9a8692a49f7..36a24e2f0d84 100644 --- a/xmloff/source/draw/sdpropls.cxx +++ b/xmloff/source/draw/sdpropls.cxx @@ -878,11 +878,11 @@ bool XMLSdHeaderFooterVisibilityTypeHdl::exportXML( const SvXMLUnitConverter& ) const { bool bRet = false; - OUStringBuffer aOut; bool bValue; if (rValue >>= bValue) { + OUStringBuffer aOut; ::sax::Converter::convertBool( aOut, bValue ); rStrExpValue = aOut.makeStringAndClear(); diff --git a/xmloff/source/draw/sdxmlexp.cxx b/xmloff/source/draw/sdxmlexp.cxx index b67829c58eac..db5dafb4c3ae 100644 --- a/xmloff/source/draw/sdxmlexp.cxx +++ b/xmloff/source/draw/sdxmlexp.cxx @@ -2264,12 +2264,11 @@ void SdXMLExport::ExportMasterStyles_() if(xMasterPage.is()) { // prepare masterpage attributes - OUString sMasterPageName; Reference < container::XNamed > xNamed(xMasterPage, UNO_QUERY); if(xNamed.is()) { bool bEncoded = false; - sMasterPageName = xNamed->getName(); + OUString sMasterPageName = xNamed->getName(); AddAttribute(XML_NAMESPACE_STYLE, XML_NAME, EncodeStyleName( sMasterPageName, &bEncoded )); if( bEncoded ) diff --git a/xmloff/source/draw/shapeexport.cxx b/xmloff/source/draw/shapeexport.cxx index 58d916c7608f..da40af685b0b 100644 --- a/xmloff/source/draw/shapeexport.cxx +++ b/xmloff/source/draw/shapeexport.cxx @@ -4756,7 +4756,6 @@ void XMLShapeExport::ImpExportCustomShape( if ( !xPropSet.is() ) return; - OUString aStr; uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() ); // Transformation @@ -4764,6 +4763,7 @@ void XMLShapeExport::ImpExportCustomShape( if ( xPropSetInfo.is() ) { + OUString aStr; if ( xPropSetInfo->hasPropertyByName( "CustomShapeEngine" ) ) { uno::Any aEngine( xPropSet->getPropertyValue( "CustomShapeEngine" ) ); diff --git a/xmloff/source/forms/controlpropertyhdl.cxx b/xmloff/source/forms/controlpropertyhdl.cxx index 7bd237a94721..feced0594b5c 100644 --- a/xmloff/source/forms/controlpropertyhdl.cxx +++ b/xmloff/source/forms/controlpropertyhdl.cxx @@ -117,7 +117,6 @@ namespace xmloff bool OControlTextEmphasisHandler::exportXML( OUString& _rStrExpValue, const Any& _rValue, const SvXMLUnitConverter& ) const { - OUStringBuffer aReturn; bool bSuccess = false; sal_Int16 nFontEmphasis = sal_Int16(); if (_rValue >>= nFontEmphasis) @@ -128,6 +127,7 @@ namespace xmloff bool bBelow = 0 != (nFontEmphasis & awt::FontEmphasisMark::BELOW); // convert + OUStringBuffer aReturn; bSuccess = SvXMLUnitConverter::convertEnum(aReturn, nType, aFontEmphasisMap, XML_NONE); if (bSuccess) { diff --git a/xmloff/source/style/DrawAspectHdl.cxx b/xmloff/source/style/DrawAspectHdl.cxx index 884d89a74625..7eeb374ca559 100644 --- a/xmloff/source/style/DrawAspectHdl.cxx +++ b/xmloff/source/style/DrawAspectHdl.cxx @@ -45,15 +45,12 @@ bool DrawAspectHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue, c bool DrawAspectHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& ) const { bool bRet = false; - OUStringBuffer aOut; sal_Int64 nAspect = 0; if( ( rValue >>= nAspect ) && nAspect > 0 ) { // store the aspect as an integer value - aOut.append( nAspect ); - - rStrExpValue = aOut.makeStringAndClear(); + rStrExpValue = OUString::number(nAspect); bRet = true; } diff --git a/xmloff/source/style/XMLBitmapRepeatOffsetPropertyHandler.cxx b/xmloff/source/style/XMLBitmapRepeatOffsetPropertyHandler.cxx index 4528cd8056c2..9b8ad7c63f80 100644 --- a/xmloff/source/style/XMLBitmapRepeatOffsetPropertyHandler.cxx +++ b/xmloff/source/style/XMLBitmapRepeatOffsetPropertyHandler.cxx @@ -76,11 +76,10 @@ bool XMLBitmapRepeatOffsetPropertyHandler::exportXML( const Any& rValue, const SvXMLUnitConverter& ) const { - OUStringBuffer aOut; - sal_Int32 nValue = 0; if( rValue >>= nValue ) { + OUStringBuffer aOut; ::sax::Converter::convertPercent( aOut, nValue ); aOut.append( ' ' ); aOut.append( mbX ? msHorizontal : msVertical ); diff --git a/xmloff/source/style/XMLConstantsPropertyHandler.cxx b/xmloff/source/style/XMLConstantsPropertyHandler.cxx index 73b880deb357..a5467f247354 100644 --- a/xmloff/source/style/XMLConstantsPropertyHandler.cxx +++ b/xmloff/source/style/XMLConstantsPropertyHandler.cxx @@ -49,8 +49,6 @@ bool XMLConstantsPropertyHandler::exportXML( const Any& rValue, const SvXMLUnitConverter& ) const { - OUStringBuffer aOut; - bool bRet = false; sal_Int32 nEnum = 0; @@ -70,6 +68,7 @@ bool XMLConstantsPropertyHandler::exportXML( if( (nEnum >= 0) && (nEnum <= 0xffff) ) { sal_uInt16 nConst = static_cast<sal_uInt16>( nEnum ); + OUStringBuffer aOut; bRet = SvXMLUnitConverter::convertEnum( aOut, nConst, pMap, eDefault ); diff --git a/xmloff/source/style/XMLFillBitmapSizePropertyHandler.cxx b/xmloff/source/style/XMLFillBitmapSizePropertyHandler.cxx index e9bf5926f130..4dded1859c35 100644 --- a/xmloff/source/style/XMLFillBitmapSizePropertyHandler.cxx +++ b/xmloff/source/style/XMLFillBitmapSizePropertyHandler.cxx @@ -65,11 +65,10 @@ bool XMLFillBitmapSizePropertyHandler::exportXML( const Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const { - OUStringBuffer aOut; - sal_Int32 nValue = 0; if( rValue >>= nValue ) { + OUStringBuffer aOut; if( nValue < 0 ) { ::sax::Converter::convertPercent( aOut, -nValue ); diff --git a/xmloff/source/style/cdouthdl.cxx b/xmloff/source/style/cdouthdl.cxx index 74eee9fa6b08..0b484dcf047a 100644 --- a/xmloff/source/style/cdouthdl.cxx +++ b/xmloff/source/style/cdouthdl.cxx @@ -134,10 +134,10 @@ bool XMLCrossedOutTypePropHdl::exportXML( OUString& rStrExpValue, const uno::Any { bool bRet = false; sal_uInt16 nValue = sal_uInt16(); - OUStringBuffer aOut; if (rValue >>= nValue) { + OUStringBuffer aOut; bRet = SvXMLUnitConverter::convertEnum( aOut, nValue, pXML_CrossedoutType_Enum ); if( bRet ) @@ -181,10 +181,10 @@ bool XMLCrossedOutStylePropHdl::exportXML( OUString& rStrExpValue, const uno::An { bool bRet = false; sal_uInt16 nValue = sal_uInt16(); - OUStringBuffer aOut; if( rValue >>= nValue ) { + OUStringBuffer aOut; bRet = SvXMLUnitConverter::convertEnum( aOut, nValue, pXML_CrossedoutStyle_Enum ); if( bRet ) @@ -250,10 +250,10 @@ bool XMLCrossedOutWidthPropHdl::exportXML( OUString& rStrExpValue, const uno::An { bool bRet = false; sal_uInt16 nValue = sal_uInt16(); - OUStringBuffer aOut; if( (rValue >>= nValue) && (awt::FontStrikeout::BOLD == nValue) ) { + OUStringBuffer aOut; bRet = SvXMLUnitConverter::convertEnum( aOut, nValue, pXML_CrossedoutWidth_Enum ); if( bRet ) diff --git a/xmloff/source/style/chrhghdl.cxx b/xmloff/source/style/chrhghdl.cxx index c6f04f34008f..5417800c6d18 100644 --- a/xmloff/source/style/chrhghdl.cxx +++ b/xmloff/source/style/chrhghdl.cxx @@ -135,11 +135,10 @@ bool XMLCharHeightDiffHdl::importXML( const OUString& rStrImpValue, uno::Any& rV bool XMLCharHeightDiffHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& ) const { - OUStringBuffer aOut; - float nRel = 0; if( (rValue >>= nRel) && (nRel != 0) ) { + OUStringBuffer aOut; ::sax::Converter::convertMeasure( aOut, static_cast<sal_Int32>(nRel), util::MeasureUnit::POINT, util::MeasureUnit::POINT ); rStrExpValue = aOut.makeStringAndClear(); diff --git a/xmloff/source/style/csmaphdl.cxx b/xmloff/source/style/csmaphdl.cxx index 97367734bfc7..4e760a6c9e33 100644 --- a/xmloff/source/style/csmaphdl.cxx +++ b/xmloff/source/style/csmaphdl.cxx @@ -58,10 +58,10 @@ bool XMLCaseMapPropHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValu { bool bRet = false; sal_uInt16 nValue = sal_uInt16(); - OUStringBuffer aOut; if( rValue >>= nValue ) { + OUStringBuffer aOut; bRet = SvXMLUnitConverter::convertEnum( aOut, nValue, pXML_Casemap_Enum ); if( bRet ) diff --git a/xmloff/source/style/fonthdl.cxx b/xmloff/source/style/fonthdl.cxx index e3a8adec7173..128dfa15289c 100644 --- a/xmloff/source/style/fonthdl.cxx +++ b/xmloff/source/style/fonthdl.cxx @@ -239,15 +239,13 @@ bool XMLFontEncodingPropHdl::importXML( const OUString& rStrImpValue, uno::Any& bool XMLFontEncodingPropHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& ) const { bool bRet = false; - OUStringBuffer aOut; sal_Int16 nSet = sal_Int16(); if( rValue >>= nSet ) { if( static_cast<rtl_TextEncoding>(nSet) == RTL_TEXTENCODING_SYMBOL ) { - aOut.append( GetXMLToken(XML_X_SYMBOL) ); - rStrExpValue = aOut.makeStringAndClear(); + rStrExpValue = GetXMLToken(XML_X_SYMBOL); bRet = true; } } @@ -275,7 +273,6 @@ bool XMLFontPitchPropHdl::exportXML( OUString& rStrExpValue, const uno::Any& rVa { bool bRet = false; sal_Int16 nPitch = sal_Int16(); - OUStringBuffer aOut; FontPitch ePitch = PITCH_DONTKNOW; if( rValue >>= nPitch ) @@ -283,6 +280,7 @@ bool XMLFontPitchPropHdl::exportXML( OUString& rStrExpValue, const uno::Any& rVa if( PITCH_DONTKNOW != ePitch ) { + OUStringBuffer aOut; bRet = SvXMLUnitConverter::convertEnum( aOut, ePitch, aFontPitchMapping, XML_FIXED ); rStrExpValue = aOut.makeStringAndClear(); } diff --git a/xmloff/source/style/shadwhdl.cxx b/xmloff/source/style/shadwhdl.cxx index 60db10a44f15..2b02a40cb1c8 100644 --- a/xmloff/source/style/shadwhdl.cxx +++ b/xmloff/source/style/shadwhdl.cxx @@ -120,7 +120,6 @@ bool XMLShadowPropHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue bool XMLShadowPropHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const { bool bRet = false; - OUStringBuffer aOut; table::ShadowFormat aShadow; if( rValue >>= aShadow ) @@ -150,8 +149,8 @@ bool XMLShadowPropHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue nX *= aShadow.ShadowWidth; nY *= aShadow.ShadowWidth; + OUStringBuffer aOut; ::sax::Converter::convertColor( aOut, aShadow.Color ); - aOut.append( ' ' ); rUnitConverter.convertMeasureToXML( aOut, nX ); aOut.append( ' ' ); diff --git a/xmloff/source/style/styleexp.cxx b/xmloff/source/style/styleexp.cxx index c87d3e3edff6..734318a0ab13 100644 --- a/xmloff/source/style/styleexp.cxx +++ b/xmloff/source/style/styleexp.cxx @@ -281,7 +281,6 @@ bool XMLStyleExport::exportStyle( Reference< XChapterNumberingSupplier > xCNSupplier (GetExport().GetModel(), UNO_QUERY); - OUString sOutlineName; if (xCNSupplier.is()) { Reference< XIndexReplace > xNumRule @@ -290,6 +289,7 @@ bool XMLStyleExport::exportStyle( Reference< XPropertySet > xNumRulePropSet (xNumRule, UNO_QUERY); + OUString sOutlineName; xNumRulePropSet->getPropertyValue("Name") >>= sOutlineName; bSuppressListStyle = sListName == sOutlineName; diff --git a/xmloff/source/style/undlihdl.cxx b/xmloff/source/style/undlihdl.cxx index 0e610442febb..4d6482c4f4be 100644 --- a/xmloff/source/style/undlihdl.cxx +++ b/xmloff/source/style/undlihdl.cxx @@ -168,12 +168,12 @@ bool XMLUnderlineTypePropHdl::exportXML( OUString& rStrExpValue, const uno::Any& { bool bRet = false; sal_uInt16 nValue = sal_uInt16(); - OUStringBuffer aOut; if( (rValue >>= nValue) && (awt::FontUnderline::DOUBLE == nValue || awt::FontUnderline::DOUBLEWAVE == nValue) ) { + OUStringBuffer aOut; bRet = SvXMLUnitConverter::convertEnum( aOut, nValue, pXML_UnderlineType_Enum ); if( bRet ) @@ -259,10 +259,10 @@ bool XMLUnderlineStylePropHdl::exportXML( OUString& rStrExpValue, const uno::Any { bool bRet = false; sal_uInt16 nValue = sal_uInt16(); - OUStringBuffer aOut; if( rValue >>= nValue ) { + OUStringBuffer aOut; bRet = SvXMLUnitConverter::convertEnum( aOut, nValue, pXML_UnderlineStyle_Enum ); if( bRet ) @@ -349,10 +349,10 @@ bool XMLUnderlineWidthPropHdl::exportXML( OUString& rStrExpValue, const uno::Any { bool bRet = false; sal_uInt16 nValue = sal_uInt16(); - OUStringBuffer aOut; if( (rValue >>= nValue) && (awt::FontUnderline::NONE != nValue) ) { + OUStringBuffer aOut; bRet = SvXMLUnitConverter::convertEnum( aOut, nValue, pXML_UnderlineWidth_Enum ); if( bRet ) diff --git a/xmloff/source/style/xmlbahdl.cxx b/xmloff/source/style/xmlbahdl.cxx index b4016039dff2..0a728467e4ba 100644 --- a/xmloff/source/style/xmlbahdl.cxx +++ b/xmloff/source/style/xmlbahdl.cxx @@ -192,10 +192,10 @@ bool XMLMeasurePropHdl::exportXML( OUString& rStrExpValue, const Any& rValue, co { bool bRet = false; sal_Int32 nValue; - OUStringBuffer aOut; if( lcl_xmloff_getAny( rValue, nValue, nBytes ) ) { + OUStringBuffer aOut; rUnitConverter.convertMeasureToXML( aOut, nValue ); rStrExpValue = aOut.makeStringAndClear(); @@ -304,10 +304,10 @@ bool XMLPercentPropHdl::exportXML( OUString& rStrExpValue, const Any& rValue, co { bool bRet = false; sal_Int32 nValue; - OUStringBuffer aOut; if( lcl_xmloff_getAny( rValue, nValue, nBytes ) ) { + OUStringBuffer aOut; ::sax::Converter::convertPercent( aOut, nValue ); rStrExpValue = aOut.makeStringAndClear(); @@ -382,10 +382,10 @@ bool XMLNegPercentPropHdl::exportXML( OUString& rStrExpValue, const Any& rValue, { bool bRet = false; sal_Int32 nValue; - OUStringBuffer aOut; if( lcl_xmloff_getAny( rValue, nValue, nBytes ) ) { + OUStringBuffer aOut; ::sax::Converter::convertPercent( aOut, 100-nValue ); rStrExpValue = aOut.makeStringAndClear(); @@ -412,10 +412,10 @@ bool XMLMeasurePxPropHdl::exportXML( OUString& rStrExpValue, const Any& rValue, { bool bRet = false; sal_Int32 nValue; - OUStringBuffer aOut; if( lcl_xmloff_getAny( rValue, nValue, nBytes ) ) { + OUStringBuffer aOut; ::sax::Converter::convertMeasurePx( aOut, nValue ); rStrExpValue = aOut.makeStringAndClear(); @@ -514,9 +514,9 @@ bool XMLHexPropHdl::exportXML( OUString& rStrExpValue, const Any& rValue, const bool bRet = false; sal_uInt32 nRsid = 0; - OUStringBuffer aOut; if( rValue >>= nRsid ) { + OUStringBuffer aOut; SvXMLUnitConverter::convertHex( aOut, nRsid ); rStrExpValue = aOut.makeStringAndClear(); diff --git a/xmloff/source/style/xmlimppr.cxx b/xmloff/source/style/xmlimppr.cxx index cf81dfcd1e1c..a0886b18bd2d 100644 --- a/xmloff/source/style/xmlimppr.cxx +++ b/xmloff/source/style/xmlimppr.cxx @@ -142,12 +142,11 @@ void SvXMLImportPropertyMapper::importXML( const css::uno::Sequence< css::xml::Attribute > unknownAttribs = xAttrList->getUnknownAttributes(); for (const css::xml::Attribute& rAttribute : unknownAttribs) { - OUString aPrefix; int nSepIndex = rAttribute.Name.indexOf(SvXMLImport::aNamespaceSeparator); if (nSepIndex != -1) { // If it's an unknown attribute in a known namespace, ignore it. - aPrefix = rAttribute.Name.copy(0, nSepIndex); + OUString aPrefix = rAttribute.Name.copy(0, nSepIndex); if (rNamespaceMap.GetKeyByPrefix(aPrefix) != USHRT_MAX) continue; } diff --git a/xmloff/source/style/xmlnumfe.cxx b/xmloff/source/style/xmlnumfe.cxx index 077dcb7b475a..e463b1dcd89d 100644 --- a/xmloff/source/style/xmlnumfe.cxx +++ b/xmloff/source/style/xmlnumfe.cxx @@ -1935,7 +1935,6 @@ sal_uInt32 SvXMLNumFmtExport::ForceSystemLanguage( sal_uInt32 nKey ) { SAL_WARN_IF( pFormatter == nullptr, "xmloff.style", "format without formatter?" ); - sal_Int32 nErrorPos; SvNumFormatType nType = pFormat->GetType(); sal_uInt32 nNewKey = pFormatter->GetFormatForLanguageIfBuiltIn( @@ -1948,6 +1947,7 @@ sal_uInt32 SvXMLNumFmtExport::ForceSystemLanguage( sal_uInt32 nKey ) else { OUString aFormatString( pFormat->GetFormatstring() ); + sal_Int32 nErrorPos; pFormatter->PutandConvertEntry( aFormatString, nErrorPos, nType, nNewKey, diff --git a/xmloff/source/style/xmlstyle.cxx b/xmloff/source/style/xmlstyle.cxx index 2a8e44b21285..fdaf07f47b4d 100644 --- a/xmloff/source/style/xmlstyle.cxx +++ b/xmloff/source/style/xmlstyle.cxx @@ -613,14 +613,13 @@ Reference < XAutoStyleFamily > SvXMLStylesContext::GetAutoStyles( XmlStyleFamily if( XmlStyleFamily::TEXT_TEXT == nFamily || XmlStyleFamily::TEXT_PARAGRAPH == nFamily) { bool bPara = XmlStyleFamily::TEXT_PARAGRAPH == nFamily; - OUString sName; if( !bPara && mxTextAutoStyles.is() ) xAutoStyles = mxTextAutoStyles; else if( bPara && mxParaAutoStyles.is() ) xAutoStyles = mxParaAutoStyles; else { - sName = bPara ? OUStringLiteral( u"ParagraphStyles" ): OUStringLiteral( u"CharacterStyles" ); + OUStringLiteral sName = bPara ? OUStringLiteral( u"ParagraphStyles" ): OUStringLiteral( u"CharacterStyles" ); Reference< XAutoStylesSupplier > xAutoStylesSupp( GetImport().GetModel(), UNO_QUERY ); Reference< XAutoStyles > xAutoStyleFamilies = xAutoStylesSupp->getAutoStyles(); if (xAutoStyleFamilies->hasByName(sName)) diff --git a/xmloff/source/text/XMLSectionFootnoteConfigExport.cxx b/xmloff/source/text/XMLSectionFootnoteConfigExport.cxx index 048e8b7ab7dd..6e1c06319110 100644 --- a/xmloff/source/text/XMLSectionFootnoteConfigExport.cxx +++ b/xmloff/source/text/XMLSectionFootnoteConfigExport.cxx @@ -131,7 +131,6 @@ void XMLSectionFootnoteConfigExport::exportXML( GetXMLToken( bEndnote ? XML_ENDNOTE : XML_FOOTNOTE ) ); // start numbering - OUStringBuffer sBuf; if (bNumRestart) { // restart number is stored as 0.., but interpreted as 1.. @@ -154,6 +153,7 @@ void XMLSectionFootnoteConfigExport::exportXML( } // number type: num format + OUStringBuffer sBuf; rExport.GetMM100UnitConverter().convertNumFormat( sBuf, nNumberingType ); rExport.AddAttribute(XML_NAMESPACE_STYLE, XML_NUM_FORMAT, diff --git a/xmloff/source/text/XMLTextHeaderFooterContext.cxx b/xmloff/source/text/XMLTextHeaderFooterContext.cxx index 5437cb508f71..1bb70bdd081e 100644 --- a/xmloff/source/text/XMLTextHeaderFooterContext.cxx +++ b/xmloff/source/text/XMLTextHeaderFooterContext.cxx @@ -46,7 +46,6 @@ XMLTextHeaderFooterContext::XMLTextHeaderFooterContext( SvXMLImport& rImport, bLeft( bLft ), bFirst( bFrst ) { - const OUString sShareContentFirst( "FirstIsShared" ); // NOTE: if this ever handles XML_DISPLAY attr then beware of fdo#72850 ! if( !(bLeft || bFirst) ) return; @@ -70,6 +69,7 @@ XMLTextHeaderFooterContext::XMLTextHeaderFooterContext( SvXMLImport& rImport, } if (bFirst) { + const OUString sShareContentFirst( "FirstIsShared" ); aAny = xPropSet->getPropertyValue( sShareContentFirst ); bool bSharedFirst = bool(); if (!(aAny >>= bSharedFirst)) diff --git a/xmloff/source/text/txtdrope.cxx b/xmloff/source/text/txtdrope.cxx index e85aa839b505..63b9222e14a3 100644 --- a/xmloff/source/text/txtdrope.cxx +++ b/xmloff/source/text/txtdrope.cxx @@ -47,8 +47,6 @@ void XMLTextDropCapExport::exportXML( const Any& rAny, { DropCapFormat aFormat; rAny >>= aFormat; - OUString sValue; - OUStringBuffer sBuffer; if( aFormat.Lines > 1 ) { SvXMLUnitConverter& rUnitConv = rExport.GetMM100UnitConverter(); @@ -58,6 +56,7 @@ void XMLTextDropCapExport::exportXML( const Any& rAny, OUString::number( aFormat.Lines ) ); // style:length + OUString sValue; if( bWholeWord ) { sValue = GetXMLToken(XML_WORD); @@ -72,6 +71,7 @@ void XMLTextDropCapExport::exportXML( const Any& rAny, // style:distance if( aFormat.Distance > 0 ) { + OUStringBuffer sBuffer; rUnitConv.convertMeasureToXML( sBuffer, aFormat.Distance ); rExport.AddAttribute( XML_NAMESPACE_STYLE, XML_DISTANCE, sBuffer.makeStringAndClear() ); diff --git a/xmloff/source/text/txtflde.cxx b/xmloff/source/text/txtflde.cxx index f4d32a263144..2654a23bca7e 100644 --- a/xmloff/source/text/txtflde.cxx +++ b/xmloff/source/text/txtflde.cxx @@ -2261,7 +2261,6 @@ void XMLTextFieldExport::ExportMacro( { // some strings we'll need OUString sEventType( "EventType" ); - OUString sScript( "Script" ); OUString sPropertyScriptURL( "ScriptURL" ); @@ -2285,6 +2284,7 @@ void XMLTextFieldExport::ExportMacro( // Framework URL, otherwise treat it as a Basic Macro if (!sName.isEmpty()) { + OUString sScript( "Script" ); aSeq = Sequence<PropertyValue> (2); PropertyValue* pArr = aSeq.getArray(); pArr[0].Name = sEventType; diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx index c33eec54ddf9..d787537e26f0 100644 --- a/xmloff/source/text/txtparae.cxx +++ b/xmloff/source/text/txtparae.cxx @@ -2001,7 +2001,6 @@ void XMLTextParagraphExport::exportParagraph( { Reference< XChapterNumberingSupplier > xCNSupplier( GetExport().GetModel(), UNO_QUERY ); - OUString sOutlineName; if (xCNSupplier.is()) { Reference< XIndexReplace > xNumRule ( xCNSupplier->getChapterNumberingRules() ); @@ -2010,6 +2009,7 @@ void XMLTextParagraphExport::exportParagraph( if (xNumRule.is()) { Reference< XPropertySet > xNumRulePropSet( xNumRule, UNO_QUERY ); + OUString sOutlineName; xNumRulePropSet->getPropertyValue( "Name" ) >>= sOutlineName; bAssignedtoOutlineStyle = ( sListStyleName == sOutlineName ); diff --git a/xmloff/source/text/txtstyle.cxx b/xmloff/source/text/txtstyle.cxx index 6b21eb44e208..fd04a925bc35 100644 --- a/xmloff/source/text/txtstyle.cxx +++ b/xmloff/source/text/txtstyle.cxx @@ -49,7 +49,6 @@ using namespace ::xmloff::token; void XMLTextParagraphExport::exportStyleAttributes( const css::uno::Reference< css::style::XStyle > & rStyle ) { - OUString sName; Reference< XPropertySet > xPropSet( rStyle, UNO_QUERY ); Reference< XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo()); @@ -91,6 +90,7 @@ void XMLTextParagraphExport::exportStyleAttributes( if( PropertyState_DIRECT_VALUE == xPropState->getPropertyState( gsPageDescName ) ) { + OUString sName; xPropSet->getPropertyValue( gsPageDescName ) >>= sName; // fix for #i5551# if( sName.getLength() > 0 ) GetExport().AddAttribute( XML_NAMESPACE_STYLE, _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits