summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2015-01-17 02:00:35 +0100
committerNoel Grandin <noelgrandin@gmail.com>2015-01-19 08:39:32 +0000
commitbfe79b50bce44707cb2416e6ff6b7441491967bb (patch)
treebc439d804193c01baa2f78bdf794169e912bf749 /xmloff
parent08f9bd504de9bcb267a0e71b07759080592bd0d8 (diff)
fdo#39440 reduce scope of local variables
This addresses some cppcheck warnings. Change-Id: If7ad3584b3124ed0b337836071af1a5bd0451d85 Reviewed-on: https://gerrit.libreoffice.org/13972 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/source/chart/SchXMLExport.cxx3
-rw-r--r--xmloff/source/chart/SchXMLImport.cxx3
-rw-r--r--xmloff/source/draw/shapeexport.cxx2
-rw-r--r--xmloff/source/forms/eventimport.cxx6
-rw-r--r--xmloff/source/text/XMLRedlineExport.cxx3
-rw-r--r--xmloff/source/text/XMLTextNumRuleInfo.cxx2
-rw-r--r--xmloff/source/text/txtimp.cxx3
7 files changed, 10 insertions, 12 deletions
diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx
index ca25f2b98ab0..f854708f3566 100644
--- a/xmloff/source/chart/SchXMLExport.cxx
+++ b/xmloff/source/chart/SchXMLExport.cxx
@@ -1898,10 +1898,11 @@ void SchXMLExportHelper_Impl::exportPlotArea(
if( xDocProp.is())
{
Any aAny;
- bool bFirstCol = false, bFirstRow = false;
try
{
+ bool bFirstCol = false, bFirstRow = false;
+
aAny = xDocProp->getPropertyValue(
OUString( "DataSourceLabelsInFirstColumn" ));
aAny >>= bFirstCol;
diff --git a/xmloff/source/chart/SchXMLImport.cxx b/xmloff/source/chart/SchXMLImport.cxx
index ce11bea12497..ca1f63c02353 100644
--- a/xmloff/source/chart/SchXMLImport.cxx
+++ b/xmloff/source/chart/SchXMLImport.cxx
@@ -620,9 +620,10 @@ void SAL_CALL SchXMLImport::setTargetDocument( const uno::Reference< lang::XComp
uno::Reference< container::XChild > xChild( xChartDoc, uno::UNO_QUERY );
uno::Reference< chart2::data::XDataReceiver > xDataReceiver( xChartDoc, uno::UNO_QUERY );
- bool bHasOwnData = true;
if( xChild.is() && xDataReceiver.is())
{
+ bool bHasOwnData = true;
+
Reference< lang::XMultiServiceFactory > xFact( xChild->getParent(), uno::UNO_QUERY );
if( xFact.is() )
{
diff --git a/xmloff/source/draw/shapeexport.cxx b/xmloff/source/draw/shapeexport.cxx
index 3f0858a88a66..db76c50e598e 100644
--- a/xmloff/source/draw/shapeexport.cxx
+++ b/xmloff/source/draw/shapeexport.cxx
@@ -1460,7 +1460,6 @@ bool XMLShapeExport::ImpExportPresentationAttributes( const uno::Reference< bean
{
uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() );
- bool bTemp = false;
// is empty pes shape?
if( xPropSetInfo.is() && xPropSetInfo->hasPropertyByName("IsEmptyPresentationObject"))
@@ -1473,6 +1472,7 @@ bool XMLShapeExport::ImpExportPresentationAttributes( const uno::Reference< bean
// is user-transformed?
if( xPropSetInfo.is() && xPropSetInfo->hasPropertyByName("IsPlaceholderDependent"))
{
+ bool bTemp = false;
xPropSet->getPropertyValue("IsPlaceholderDependent") >>= bTemp;
if(!bTemp)
mrExport.AddAttribute(XML_NAMESPACE_PRESENTATION, XML_USER_TRANSFORMED, XML_TRUE);
diff --git a/xmloff/source/forms/eventimport.cxx b/xmloff/source/forms/eventimport.cxx
index 2f499e7e84f6..256649dcc902 100644
--- a/xmloff/source/forms/eventimport.cxx
+++ b/xmloff/source/forms/eventimport.cxx
@@ -44,8 +44,6 @@ namespace xmloff
ScriptEventDescriptor* pTranslated = aTranslated.getArray();
// loop through the collected events and translate them
- const PropertyValue* pEventDescription;
- const PropertyValue* pEventDescriptionEnd;
sal_Int32 nSeparatorPos = -1;
for ( EventsVector::const_iterator aEvent = aCollectEvents.begin();
aEvent != aCollectEvents.end();
@@ -61,8 +59,8 @@ namespace xmloff
OUString sLibrary;
// the local macro name and the event type are specified as properties
- pEventDescription = aEvent->second.getConstArray();
- pEventDescriptionEnd = pEventDescription + aEvent->second.getLength();
+ const PropertyValue* pEventDescription = aEvent->second.getConstArray();
+ const PropertyValue* pEventDescriptionEnd = pEventDescription + aEvent->second.getLength();
for (;pEventDescription != pEventDescriptionEnd; ++pEventDescription)
{
if (pEventDescription->Name == EVENT_LOCALMACRONAME ||
diff --git a/xmloff/source/text/XMLRedlineExport.cxx b/xmloff/source/text/XMLRedlineExport.cxx
index 5aabd59fb25b..fa93ac9441d7 100644
--- a/xmloff/source/text/XMLRedlineExport.cxx
+++ b/xmloff/source/text/XMLRedlineExport.cxx
@@ -332,7 +332,6 @@ void XMLRedlineExport::ExportChangeInline(
enum XMLTokenEnum eElement = XML_TOKEN_INVALID;
Any aAny = rPropSet->getPropertyValue(sIsCollapsed);
bool bCollapsed = *(sal_Bool *)aAny.getValue();
- bool bStart = true; // ignored if bCollapsed = sal_True
if (bCollapsed)
{
eElement = XML_CHANGE;
@@ -340,7 +339,7 @@ void XMLRedlineExport::ExportChangeInline(
else
{
aAny = rPropSet->getPropertyValue(sIsStart);
- bStart = *(sal_Bool *)aAny.getValue();
+ const bool bStart = *(sal_Bool *)aAny.getValue();
eElement = bStart ? XML_CHANGE_START : XML_CHANGE_END;
}
diff --git a/xmloff/source/text/XMLTextNumRuleInfo.cxx b/xmloff/source/text/XMLTextNumRuleInfo.cxx
index 02fde000dc22..cb597daf167f 100644
--- a/xmloff/source/text/XMLTextNumRuleInfo.cxx
+++ b/xmloff/source/text/XMLTextNumRuleInfo.cxx
@@ -115,12 +115,12 @@ void XMLTextNumRuleInfo::Set(
{
if ( !mbOutlineStyleAsNormalListStyle )
{
- bool bIsOutline = false;
Reference<XPropertySet> xNumRulesProps(mxNumRules, UNO_QUERY);
if ( xNumRulesProps.is() &&
xNumRulesProps->getPropertySetInfo()->
hasPropertyByName( msNumberingIsOutline ) )
{
+ bool bIsOutline = false;
xNumRulesProps->getPropertyValue( msNumberingIsOutline ) >>= bIsOutline;
bSuppressListStyle = bIsOutline;
}
diff --git a/xmloff/source/text/txtimp.cxx b/xmloff/source/text/txtimp.cxx
index a7e781bcbc47..7be24938e296 100644
--- a/xmloff/source/text/txtimp.cxx
+++ b/xmloff/source/text/txtimp.cxx
@@ -2114,14 +2114,13 @@ void XMLTextImportHelper::SetRuby(
xPropSet->setPropertyValue(sRubyText, makeAny(rText));
// the ruby style (ruby-adjust)
- XMLPropStyleContext *pStyle = 0;
if (!rStyleName.isEmpty() && m_pImpl->m_xAutoStyles.Is())
{
const SvXMLStyleContext* pTempStyle =
static_cast<SvXMLStylesContext *>(&m_pImpl->m_xAutoStyles)->
FindStyleChildContext( XML_STYLE_FAMILY_TEXT_RUBY,
rStyleName, true );
- pStyle = const_cast<XMLPropStyleContext*>(PTR_CAST(XMLPropStyleContext,pTempStyle));
+ XMLPropStyleContext *pStyle = const_cast<XMLPropStyleContext*>(PTR_CAST(XMLPropStyleContext,pTempStyle));
if (NULL != pStyle)
pStyle->FillPropertySet( xPropSet );