[Libreoffice-commits] core.git: 2 commits - reportdesign/source sdext/source
Noel (via logerrit)
logerrit at kemper.freedesktop.org
Sun Oct 4 12:07:43 UTC 2020
reportdesign/source/filter/xml/xmlExport.cxx | 2 +-
reportdesign/source/ui/inspection/DefaultInspection.cxx | 2 +-
reportdesign/source/ui/inspection/GeometryHandler.cxx | 2 +-
reportdesign/source/ui/report/FormattedFieldBeautifier.cxx | 4 +---
reportdesign/source/ui/report/ReportController.cxx | 2 +-
sdext/source/minimizer/optimizerdialog.cxx | 2 +-
sdext/source/pdfimport/filterdet.cxx | 6 ++----
sdext/source/presenter/PresenterController.cxx | 5 ++---
sdext/source/presenter/PresenterScreen.cxx | 3 +--
sdext/source/presenter/PresenterSlideShowView.cxx | 2 +-
sdext/source/presenter/PresenterToolBar.cxx | 2 +-
11 files changed, 13 insertions(+), 19 deletions(-)
New commits:
commit d06fe13f234e6b13c15da07ceed9d50c3c0675fa
Author: Noel <noelgrandin at gmail.com>
AuthorDate: Fri Oct 2 13:37:17 2020 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sun Oct 4 14:07:15 2020 +0200
loplugin:reducevarscope in reportdesign
Change-Id: Id77ea5524570654c36aa50a0e55c02b5a2a20876
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103838
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/reportdesign/source/filter/xml/xmlExport.cxx b/reportdesign/source/filter/xml/xmlExport.cxx
index e692bf76724f..af5e3222d57d 100644
--- a/reportdesign/source/filter/xml/xmlExport.cxx
+++ b/reportdesign/source/filter/xml/xmlExport.cxx
@@ -691,7 +691,6 @@ void ORptExport::exportReportComponentAutoStyles(const Reference<XSection>& _xPr
void ORptExport::exportSection(const Reference<XSection>& _xSection,bool bHeader)
{
OSL_ENSURE(_xSection.is(),"Section is NULL -> GPF");
- OUStringBuffer sValue;
AddAttribute(XML_NAMESPACE_TABLE, XML_NAME,_xSection->getName());
if ( !_xSection->getVisible() )
@@ -699,6 +698,7 @@ void ORptExport::exportSection(const Reference<XSection>& _xSection,bool bHeader
if ( !bHeader )
{
+ OUStringBuffer sValue;
sal_Int16 nRet = _xSection->getForceNewPage();
const SvXMLEnumMapEntry<sal_Int16>* aXML_EnumMap = OXMLHelper::GetForceNewPageOptions();
if ( SvXMLUnitConverter::convertEnum( sValue, nRet,aXML_EnumMap ) )
diff --git a/reportdesign/source/ui/inspection/DefaultInspection.cxx b/reportdesign/source/ui/inspection/DefaultInspection.cxx
index 5ab49d95ae01..91b8921e08f5 100644
--- a/reportdesign/source/ui/inspection/DefaultInspection.cxx
+++ b/reportdesign/source/ui/inspection/DefaultInspection.cxx
@@ -129,9 +129,9 @@ namespace rptui
return;
}
- sal_Int32 nMinHelpTextLines( 0 ), nMaxHelpTextLines( 0 );
if ( _arguments.getLength() == 2 )
{ // constructor: "createWithHelpSection( long, long )"
+ sal_Int32 nMinHelpTextLines( 0 ), nMaxHelpTextLines( 0 );
if ( !( _arguments[0] >>= nMinHelpTextLines ) || !( _arguments[1] >>= nMaxHelpTextLines ) )
throw lang::IllegalArgumentException( OUString(), *this, 0 );
createWithHelpSection( nMinHelpTextLines, nMaxHelpTextLines );
diff --git a/reportdesign/source/ui/inspection/GeometryHandler.cxx b/reportdesign/source/ui/inspection/GeometryHandler.cxx
index e9dd9325fbe4..606d9af18bd5 100644
--- a/reportdesign/source/ui/inspection/GeometryHandler.cxx
+++ b/reportdesign/source/ui/inspection/GeometryHandler.cxx
@@ -498,7 +498,6 @@ void SAL_CALL GeometryHandler::setPropertyValue(const OUString & PropertyName, c
}
else if ( m_nDataFieldType == USER_DEF_FUNCTION )
{
- OUString sDataField;
OBlocker aBlocker(m_bIn);
const sal_uInt32 nNewDataType = impl_getDataFieldType_throw(sFunction);
if ( nNewDataType != UNDEF_DATA && nNewDataType != m_nDataFieldType )
@@ -513,6 +512,7 @@ void SAL_CALL GeometryHandler::setPropertyValue(const OUString & PropertyName, c
else
{
OUString sNamePostfix;
+ OUString sDataField;
const uno::Reference< report::XFunctionsSupplier> xFunctionsSupplier = fillScope_throw(sNamePostfix);
isDefaultFunction(sFunction,sDataField,xFunctionsSupplier,true);
}
diff --git a/reportdesign/source/ui/report/FormattedFieldBeautifier.cxx b/reportdesign/source/ui/report/FormattedFieldBeautifier.cxx
index 6ebc21915ccd..9ff564ca4d3d 100644
--- a/reportdesign/source/ui/report/FormattedFieldBeautifier.cxx
+++ b/reportdesign/source/ui/report/FormattedFieldBeautifier.cxx
@@ -66,14 +66,12 @@ namespace rptui
void FormattedFieldBeautifier::setPlaceholderText( const uno::Reference< uno::XInterface >& _rxComponent )
{
- OUString sDataField;
-
try
{
uno::Reference< report::XFormattedField > xControlModel( _rxComponent, uno::UNO_QUERY );
if ( xControlModel.is() )
{
- sDataField = xControlModel->getDataField();
+ OUString sDataField = xControlModel->getDataField();
if ( !sDataField.isEmpty() )
{
diff --git a/reportdesign/source/ui/report/ReportController.cxx b/reportdesign/source/ui/report/ReportController.cxx
index f6509cd3beaf..0c2ba10ea590 100644
--- a/reportdesign/source/ui/report/ReportController.cxx
+++ b/reportdesign/source/ui/report/ReportController.cxx
@@ -3995,7 +3995,6 @@ void OReportController::checkChartEnabled()
return;
m_bChartEnabledAsked = true;
- const OUString sPropertyName( "UserData/Chart" );
try
{
@@ -4003,6 +4002,7 @@ void OReportController::checkChartEnabled()
::utl::OConfigurationTreeRoot::createWithComponentContext( m_xContext, "/org.openoffice.Office.ReportDesign" ) );
bool bChartEnabled = false;
+ const OUString sPropertyName( "UserData/Chart" );
if ( aConfiguration.hasByHierarchicalName(sPropertyName) )
aConfiguration.getNodeValue( sPropertyName ) >>= bChartEnabled;
m_bChartEnabled = bChartEnabled;
commit 05082326bed3aac6fe3c902a21e854fcb9813d7c
Author: Noel <noelgrandin at gmail.com>
AuthorDate: Fri Oct 2 13:37:03 2020 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sun Oct 4 14:07:02 2020 +0200
loplugin:reducevarscope in sdext
Change-Id: I92f57e803ebf47e77b5c1990984d0dee1cdd2c73
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103837
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/sdext/source/minimizer/optimizerdialog.cxx b/sdext/source/minimizer/optimizerdialog.cxx
index 536b70974b71..ab392266e56d 100644
--- a/sdext/source/minimizer/optimizerdialog.cxx
+++ b/sdext/source/minimizer/optimizerdialog.cxx
@@ -348,12 +348,12 @@ void ItemListener::itemStateChanged( const ItemEvent& Event )
try
{
sal_Int16 nState;
- OUString aControlName;
Reference< XControl > xControl;
Any aSource( Event.Source );
if ( aSource >>= xControl )
{
Reference< XPropertySet > xPropertySet( xControl->getModel(), UNO_QUERY_THROW );
+ OUString aControlName;
xPropertySet->getPropertyValue( "Name" ) >>= aControlName;
PPPOptimizerTokenEnum eControl( TKGet( aControlName ) );
switch( eControl )
diff --git a/sdext/source/pdfimport/filterdet.cxx b/sdext/source/pdfimport/filterdet.cxx
index 7619f4518b89..88f617ecea89 100644
--- a/sdext/source/pdfimport/filterdet.cxx
+++ b/sdext/source/pdfimport/filterdet.cxx
@@ -87,14 +87,12 @@ FileEmitContext::FileEmitContext( const OUString& rOr
m_xOut = m_xContextStream->getOutputStream();
m_xSeek.set(m_xOut, uno::UNO_QUERY_THROW );
- oslFileError aErr = osl_File_E_None;
if( osl_openFile( rOrigFile.pData,
&m_aReadHandle,
osl_File_OpenFlag_Read ) == osl_File_E_None )
{
- if( (aErr=osl_setFilePos( m_aReadHandle,
- osl_Pos_End,
- 0 )) == osl_File_E_None )
+ oslFileError aErr = osl_setFilePos( m_aReadHandle, osl_Pos_End, 0 );
+ if( aErr == osl_File_E_None )
{
sal_uInt64 nFileSize = 0;
if( (aErr=osl_getFilePos( m_aReadHandle,
diff --git a/sdext/source/presenter/PresenterController.cxx b/sdext/source/presenter/PresenterController.cxx
index 281f77e59d5e..6d414d5f66ca 100644
--- a/sdext/source/presenter/PresenterController.cxx
+++ b/sdext/source/presenter/PresenterController.cxx
@@ -273,10 +273,9 @@ void PresenterController::GetSlides (const sal_Int32 nOffset)
// Get the current slide from the slide show controller.
mxCurrentSlide = nullptr;
Reference<container::XIndexAccess> xIndexAccess(mxSlideShowController, UNO_QUERY);
- sal_Int32 nSlideIndex = -1;
try
{
- nSlideIndex = mxSlideShowController->getCurrentSlideIndex() + nOffset;
+ sal_Int32 nSlideIndex = mxSlideShowController->getCurrentSlideIndex() + nOffset;
if (mxSlideShowController->isPaused())
nSlideIndex = -1;
@@ -571,12 +570,12 @@ const Reference<drawing::XDrawPage>& PresenterController::GetCurrentSlide() cons
bool PresenterController::HasTransition (Reference<drawing::XDrawPage> const & rxPage)
{
bool bTransition = false;
- sal_uInt16 aTransitionType = 0;
if( rxPage.is() )
{
Reference<beans::XPropertySet> xSlidePropertySet (rxPage, UNO_QUERY);
try
{
+ sal_uInt16 aTransitionType = 0;
xSlidePropertySet->getPropertyValue("TransitionType") >>= aTransitionType;
if (aTransitionType > 0)
{
diff --git a/sdext/source/presenter/PresenterScreen.cxx b/sdext/source/presenter/PresenterScreen.cxx
index 25e5093bbab4..a06bf17c5a00 100644
--- a/sdext/source/presenter/PresenterScreen.cxx
+++ b/sdext/source/presenter/PresenterScreen.cxx
@@ -422,7 +422,6 @@ sal_Int32 PresenterScreen::GetPresenterScreenNumber (
const Reference<presentation::XPresentation2>& rxPresentation) const
{
sal_Int32 nScreenNumber (0);
- sal_Int32 nScreenCount (1);
try
{
if ( ! rxPresentation.is())
@@ -456,7 +455,7 @@ sal_Int32 PresenterScreen::GetPresenterScreenNumber (
// We still have to determine the number of screens to decide
// whether the presenter screen may be shown at all.
- nScreenCount = Application::GetScreenCount();
+ sal_Int32 nScreenCount = Application::GetScreenCount();
if (nScreenCount < 2 || nDisplayNumber > nScreenCount)
{
diff --git a/sdext/source/presenter/PresenterSlideShowView.cxx b/sdext/source/presenter/PresenterSlideShowView.cxx
index f4bb536d6d3e..7ad4bc207645 100644
--- a/sdext/source/presenter/PresenterSlideShowView.cxx
+++ b/sdext/source/presenter/PresenterSlideShowView.cxx
@@ -842,9 +842,9 @@ void PresenterSlideShowView::Resize()
return;
const awt::Rectangle aWindowBox (mxWindow->getPosSize());
- awt::Rectangle aViewWindowBox;
if (aWindowBox.Height > 0)
{
+ awt::Rectangle aViewWindowBox;
const double nWindowAspectRatio (
double(aWindowBox.Width) / double(aWindowBox.Height));
if (nWindowAspectRatio > mnPageAspectRatio)
diff --git a/sdext/source/presenter/PresenterToolBar.cxx b/sdext/source/presenter/PresenterToolBar.cxx
index d36f42277da4..14f0f31d5e92 100644
--- a/sdext/source/presenter/PresenterToolBar.cxx
+++ b/sdext/source/presenter/PresenterToolBar.cxx
@@ -1478,13 +1478,13 @@ awt::Size Button::CreateBoundingSize (
widths.push_back(sal::static_int_cast<sal_Int32>(0.5 + aTextBBoxDisabled.X2 - aTextBBoxDisabled.X1));
widths.push_back(sal::static_int_cast<sal_Int32>(0.5 + aTextBBoxMouseOverSelected.X2 - aTextBBoxMouseOverSelected.X1));
- const sal_Int32 nGap (5);
sal_Int32 nTextHeight (sal::static_int_cast<sal_Int32>(0.5 + aTextBBox.Y2 - aTextBBox.Y1));
Reference<rendering::XBitmap> xBitmap;
if (mpMode->mpIcon)
xBitmap = mpMode->mpIcon->GetNormalBitmap();
if (xBitmap.is())
{
+ const sal_Int32 nGap (5);
geometry::IntegerSize2D aSize (xBitmap->getSize());
return awt::Size(
::std::max(aSize.Width, *std::max_element(widths.begin(), widths.end())),
More information about the Libreoffice-commits
mailing list