diff options
27 files changed, 338 insertions, 311 deletions
diff --git a/basctl/source/basicide/moduldl2.cxx b/basctl/source/basicide/moduldl2.cxx index 17e937ee9513..42bcccebd67b 100644 --- a/basctl/source/basicide/moduldl2.cxx +++ b/basctl/source/basicide/moduldl2.cxx @@ -92,9 +92,9 @@ public: { if ( m_xHandler.is() ) { - script::ModuleSizeExceededRequest aModSizeException; - if ( rRequest->getRequest() >>= aModSizeException ) - m_xHandler->handle( rRequest ); + script::ModuleSizeExceededRequest aModSizeException; + if ( rRequest->getRequest() >>= aModSizeException ) + m_xHandler->handle( rRequest ); } } }; diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx index 7771c0575f61..75c323afe848 100644 --- a/basic/source/classes/sbxmod.cxx +++ b/basic/source/classes/sbxmod.cxx @@ -1281,12 +1281,12 @@ void SbModule::RemoveVars() { for ( const auto& rModuleVariableName: mModuleVariableNames ) { - // We don't want a Find being called in a derived class ( e.g. - // SbUserform because it could trigger say an initialise event - // which would cause basic to be re-run in the middle of the init ( and remember RemoveVars is called from compile and we don't want code to run as part of the compile ) - SbxVariableRef p = SbModule::Find( rModuleVariableName, SbxClassType::Property ); - if( p.is() ) - Remove( p.get() ); + // We don't want a Find being called in a derived class ( e.g. + // SbUserform because it could trigger say an initialise event + // which would cause basic to be re-run in the middle of the init ( and remember RemoveVars is called from compile and we don't want code to run as part of the compile ) + SbxVariableRef p = SbModule::Find( rModuleVariableName, SbxClassType::Property ); + if( p.is() ) + Remove( p.get() ); } } diff --git a/compilerplugins/clang/indentation.cxx b/compilerplugins/clang/indentation.cxx index 345b33a5bd63..2dda32f8174c 100644 --- a/compilerplugins/clang/indentation.cxx +++ b/compilerplugins/clang/indentation.cxx @@ -345,8 +345,8 @@ void Indentation::checkCompoundStmtBraces(const Stmt* parentStmt, const Compound if (invalid1) return; - auto startBraceLoc = compat::getBeginLoc(compoundStmt); - auto endBraceLoc = compat::getEndLoc(compoundStmt); + auto startBraceLoc = compoundStmt->getLBracLoc(); + auto endBraceLoc = compoundStmt->getRBracLoc(); unsigned beginColumn = SM.getPresumedColumnNumber(startBraceLoc, &invalid1); unsigned beginLine = SM.getPresumedLineNumber(startBraceLoc, &invalid2); if (invalid1 || invalid2) @@ -384,21 +384,38 @@ void Indentation::checkCompoundStmtBraces(const Stmt* parentStmt, const Compound endBraceLoc); report(DiagnosticsEngine::Note, "statement beginning here", parentBeginLoc); } + return; } - else + + if (parentColumn != beginColumn) { - if (parentColumn != beginColumn) - { - report(DiagnosticsEngine::Warning, - "start brace not aligned with beginning of parent statement", startBraceLoc); - report(DiagnosticsEngine::Note, "statement beginning here", parentBeginLoc); - } - else if (beginColumn != endColumn) - { - report(DiagnosticsEngine::Warning, "start and end brace not aligned", endBraceLoc); - report(DiagnosticsEngine::Note, "start brace here", startBraceLoc); - } + report(DiagnosticsEngine::Warning, + "start brace not aligned with beginning of parent statement", startBraceLoc); + report(DiagnosticsEngine::Note, "statement beginning here", parentBeginLoc); + } + else if (beginColumn != endColumn) + { + report(DiagnosticsEngine::Warning, "start and end brace not aligned", endBraceLoc); + report(DiagnosticsEngine::Note, "start brace here", startBraceLoc); } + + /** now check that lines inside the compoundstmt are indented */ + if (!compoundStmt->size()) + return; + auto firstStmt = compoundStmt->body_front(); + if (isa<LabelStmt>(firstStmt)) + return; + auto firstStmtLoc = compat::getBeginLoc(firstStmt); + unsigned firstStmtBeginColumn = SM.getPresumedColumnNumber(firstStmtLoc, &invalid1); + if (invalid1) + return; + if (firstStmtBeginColumn > beginColumn) + return; + StringRef fn = getFilenameOfLocation(compiler.getSourceManager().getSpellingLoc(firstStmtLoc)); + // this is doing code generation, so the weird layout is deliberate + if (loplugin::hasPathnamePrefix(fn, SRCDIR "/sc/source/core/opencl/")) + return; + report(DiagnosticsEngine::Warning, "body inside brace not indented", firstStmtLoc); } bool Indentation::VisitSwitchStmt(SwitchStmt const* switchStmt) diff --git a/compilerplugins/clang/test/indentation.cxx b/compilerplugins/clang/test/indentation.cxx index 8ef6d2c03653..71b8c6f61e5a 100644 --- a/compilerplugins/clang/test/indentation.cxx +++ b/compilerplugins/clang/test/indentation.cxx @@ -101,4 +101,14 @@ void attr_bad() { } #endif +void xxx(); +void test5(bool x) +{ + if (x) + { + xxx(); // expected-error {{body inside brace not indented [loplugin:indentation]}} + } +} + + /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/connectivity/source/drivers/evoab2/NTable.cxx b/connectivity/source/drivers/evoab2/NTable.cxx index efb3288dd226..208c52747768 100644 --- a/connectivity/source/drivers/evoab2/NTable.cxx +++ b/connectivity/source/drivers/evoab2/NTable.cxx @@ -62,9 +62,9 @@ void OEvoabTable::refreshColumns() if (xResult.is()) { - Reference< XRow > xRow(xResult, UNO_QUERY); - while (xResult->next()) - aVector.push_back(xRow->getString(4)); + Reference< XRow > xRow(xResult, UNO_QUERY); + while (xResult->next()) + aVector.push_back(xRow->getString(4)); } } if (m_xColumns) diff --git a/connectivity/source/drivers/jdbc/ContextClassLoader.cxx b/connectivity/source/drivers/jdbc/ContextClassLoader.cxx index 50e6bc632bc2..3ab1b88eb33b 100644 --- a/connectivity/source/drivers/jdbc/ContextClassLoader.cxx +++ b/connectivity/source/drivers/jdbc/ContextClassLoader.cxx @@ -43,33 +43,33 @@ namespace connectivity::jdbc do // artificial loop for easier flow control { - LocalRef< jclass > threadClass( m_environment ); - threadClass.set( m_environment.FindClass( "java/lang/Thread" ) ); - if ( !threadClass.is() ) - break; - - jmethodID currentThreadMethod( m_environment.GetStaticMethodID( - threadClass.get(), "currentThread", "()Ljava/lang/Thread;" ) ); - if ( currentThreadMethod == nullptr ) - break; - - m_currentThread.set( m_environment.CallStaticObjectMethod( threadClass.get(), currentThreadMethod ) ); - if ( !m_currentThread.is() ) - break; - - jmethodID getContextClassLoaderMethod( m_environment.GetMethodID( - threadClass.get(), "getContextClassLoader", "()Ljava/lang/ClassLoader;" ) ); - if ( getContextClassLoaderMethod == nullptr ) - break; - m_oldContextClassLoader.set( m_environment.CallObjectMethod( m_currentThread.get(), getContextClassLoaderMethod ) ); - LocalRef< jthrowable > throwable( m_environment, m_environment.ExceptionOccurred() ); - if ( throwable.is() ) - break; - - m_setContextClassLoaderMethod = m_environment.GetMethodID( - threadClass.get(), "setContextClassLoader", "(Ljava/lang/ClassLoader;)V" ); - if ( m_setContextClassLoaderMethod == nullptr ) - break; + LocalRef< jclass > threadClass( m_environment ); + threadClass.set( m_environment.FindClass( "java/lang/Thread" ) ); + if ( !threadClass.is() ) + break; + + jmethodID currentThreadMethod( m_environment.GetStaticMethodID( + threadClass.get(), "currentThread", "()Ljava/lang/Thread;" ) ); + if ( currentThreadMethod == nullptr ) + break; + + m_currentThread.set( m_environment.CallStaticObjectMethod( threadClass.get(), currentThreadMethod ) ); + if ( !m_currentThread.is() ) + break; + + jmethodID getContextClassLoaderMethod( m_environment.GetMethodID( + threadClass.get(), "getContextClassLoader", "()Ljava/lang/ClassLoader;" ) ); + if ( getContextClassLoaderMethod == nullptr ) + break; + m_oldContextClassLoader.set( m_environment.CallObjectMethod( m_currentThread.get(), getContextClassLoaderMethod ) ); + LocalRef< jthrowable > throwable( m_environment, m_environment.ExceptionOccurred() ); + if ( throwable.is() ) + break; + + m_setContextClassLoaderMethod = m_environment.GetMethodID( + threadClass.get(), "setContextClassLoader", "(Ljava/lang/ClassLoader;)V" ); + if ( m_setContextClassLoaderMethod == nullptr ) + break; } while ( false ); diff --git a/dbaccess/source/ui/uno/copytablewizard.cxx b/dbaccess/source/ui/uno/copytablewizard.cxx index 48aaabdf42ff..d343dc4149f1 100644 --- a/dbaccess/source/ui/uno/copytablewizard.cxx +++ b/dbaccess/source/ui/uno/copytablewizard.cxx @@ -799,79 +799,79 @@ SharedConnection CopyTableWizard::impl_extractConnection_throw( const Reference< do { - Reference< XPropertySetInfo > xPSI( _rxDataSourceDescriptor->getPropertySetInfo(), UNO_SET_THROW ); + Reference< XPropertySetInfo > xPSI( _rxDataSourceDescriptor->getPropertySetInfo(), UNO_SET_THROW ); - // if there's an ActiveConnection, use it - if ( xPSI->hasPropertyByName( PROPERTY_ACTIVE_CONNECTION ) ) - { - Reference< XConnection > xPure; - OSL_VERIFY( _rxDataSourceDescriptor->getPropertyValue( PROPERTY_ACTIVE_CONNECTION ) >>= xPure ); - xConnection.reset( xPure, SharedConnection::NoTakeOwnership ); - } - if ( xConnection.is() ) - { - xInteractionHandler = lcl_getInteractionHandler_throw( xConnection.getTyped(), m_xInteractionHandler ); - SAL_WARN_IF( !xInteractionHandler.is(), "dbaccess.ui", "CopyTableWizard::impl_extractConnection_throw: lcl_getInteractionHandler_throw returned nonsense!" ); - break; - } - - // there could be a DataSourceName or a DatabaseLocation, describing the css.sdb.DataSource - OUString sDataSource, sDatabaseLocation; - if ( xPSI->hasPropertyByName( PROPERTY_DATASOURCENAME ) ) - OSL_VERIFY( _rxDataSourceDescriptor->getPropertyValue( PROPERTY_DATASOURCENAME ) >>= sDataSource ); - if ( xPSI->hasPropertyByName( PROPERTY_DATABASE_LOCATION ) ) - OSL_VERIFY( _rxDataSourceDescriptor->getPropertyValue( PROPERTY_DATABASE_LOCATION ) >>= sDatabaseLocation ); - - // need a DatabaseContext for loading the data source - Reference< XDatabaseContext > xDatabaseContext = DatabaseContext::create( m_xContext ); - Reference< XDataSource > xDataSource; - if ( !sDataSource.isEmpty() ) - xDataSource.set( xDatabaseContext->getByName( sDataSource ), UNO_QUERY_THROW ); - if ( !xDataSource.is() && !sDatabaseLocation.isEmpty() ) - xDataSource.set( xDatabaseContext->getByName( sDatabaseLocation ), UNO_QUERY_THROW ); - - if ( xDataSource.is() ) - { - // first, try connecting with completion - xInteractionHandler = lcl_getInteractionHandler_throw( xDataSource, m_xInteractionHandler ); - SAL_WARN_IF( !xInteractionHandler.is(), "dbaccess.ui", "CopyTableWizard::impl_extractConnection_throw: lcl_getInteractionHandler_throw returned nonsense!" ); - if ( xInteractionHandler.is() ) + // if there's an ActiveConnection, use it + if ( xPSI->hasPropertyByName( PROPERTY_ACTIVE_CONNECTION ) ) + { + Reference< XConnection > xPure; + OSL_VERIFY( _rxDataSourceDescriptor->getPropertyValue( PROPERTY_ACTIVE_CONNECTION ) >>= xPure ); + xConnection.reset( xPure, SharedConnection::NoTakeOwnership ); + } + if ( xConnection.is() ) { - Reference< XCompletedConnection > xInteractiveConnection( xDataSource, UNO_QUERY ); - if ( xInteractiveConnection.is() ) - xConnection.reset( xInteractiveConnection->connectWithCompletion( xInteractionHandler ), SharedConnection::TakeOwnership ); + xInteractionHandler = lcl_getInteractionHandler_throw( xConnection.getTyped(), m_xInteractionHandler ); + SAL_WARN_IF( !xInteractionHandler.is(), "dbaccess.ui", "CopyTableWizard::impl_extractConnection_throw: lcl_getInteractionHandler_throw returned nonsense!" ); + break; } - // interactively connecting was not successful or possible -> connect without interaction - if ( !xConnection.is() ) + // there could be a DataSourceName or a DatabaseLocation, describing the css.sdb.DataSource + OUString sDataSource, sDatabaseLocation; + if ( xPSI->hasPropertyByName( PROPERTY_DATASOURCENAME ) ) + OSL_VERIFY( _rxDataSourceDescriptor->getPropertyValue( PROPERTY_DATASOURCENAME ) >>= sDataSource ); + if ( xPSI->hasPropertyByName( PROPERTY_DATABASE_LOCATION ) ) + OSL_VERIFY( _rxDataSourceDescriptor->getPropertyValue( PROPERTY_DATABASE_LOCATION ) >>= sDatabaseLocation ); + + // need a DatabaseContext for loading the data source + Reference< XDatabaseContext > xDatabaseContext = DatabaseContext::create( m_xContext ); + Reference< XDataSource > xDataSource; + if ( !sDataSource.isEmpty() ) + xDataSource.set( xDatabaseContext->getByName( sDataSource ), UNO_QUERY_THROW ); + if ( !xDataSource.is() && !sDatabaseLocation.isEmpty() ) + xDataSource.set( xDatabaseContext->getByName( sDatabaseLocation ), UNO_QUERY_THROW ); + + if ( xDataSource.is() ) { - xConnection.reset( xDataSource->getConnection( OUString(), OUString() ), SharedConnection::TakeOwnership ); + // first, try connecting with completion + xInteractionHandler = lcl_getInteractionHandler_throw( xDataSource, m_xInteractionHandler ); + SAL_WARN_IF( !xInteractionHandler.is(), "dbaccess.ui", "CopyTableWizard::impl_extractConnection_throw: lcl_getInteractionHandler_throw returned nonsense!" ); + if ( xInteractionHandler.is() ) + { + Reference< XCompletedConnection > xInteractiveConnection( xDataSource, UNO_QUERY ); + if ( xInteractiveConnection.is() ) + xConnection.reset( xInteractiveConnection->connectWithCompletion( xInteractionHandler ), SharedConnection::TakeOwnership ); + } + + // interactively connecting was not successful or possible -> connect without interaction + if ( !xConnection.is() ) + { + xConnection.reset( xDataSource->getConnection( OUString(), OUString() ), SharedConnection::TakeOwnership ); + } } - } - if ( xConnection.is() ) - break; + if ( xConnection.is() ) + break; - // finally, there could be a ConnectionResource/ConnectionInfo - OUString sConnectionResource; - Sequence< PropertyValue > aConnectionInfo; - if ( xPSI->hasPropertyByName( PROPERTY_CONNECTION_RESOURCE ) ) - OSL_VERIFY( _rxDataSourceDescriptor->getPropertyValue( PROPERTY_CONNECTION_RESOURCE ) >>= sConnectionResource ); - if ( xPSI->hasPropertyByName( PROPERTY_CONNECTION_INFO ) ) - OSL_VERIFY( _rxDataSourceDescriptor->getPropertyValue( PROPERTY_CONNECTION_INFO ) >>= aConnectionInfo ); - - Reference< XDriverManager > xDriverManager; - try { - xDriverManager.set( ConnectionPool::create( m_xContext ), UNO_QUERY_THROW ); - } catch( const Exception& ) { } - if ( !xDriverManager.is() ) - // no connection pool installed - xDriverManager.set( DriverManager::create( m_xContext ), UNO_QUERY_THROW ); - - if ( aConnectionInfo.hasElements() ) - xConnection.set( xDriverManager->getConnectionWithInfo( sConnectionResource, aConnectionInfo ), UNO_SET_THROW ); - else - xConnection.set( xDriverManager->getConnection( sConnectionResource ), UNO_SET_THROW ); + // finally, there could be a ConnectionResource/ConnectionInfo + OUString sConnectionResource; + Sequence< PropertyValue > aConnectionInfo; + if ( xPSI->hasPropertyByName( PROPERTY_CONNECTION_RESOURCE ) ) + OSL_VERIFY( _rxDataSourceDescriptor->getPropertyValue( PROPERTY_CONNECTION_RESOURCE ) >>= sConnectionResource ); + if ( xPSI->hasPropertyByName( PROPERTY_CONNECTION_INFO ) ) + OSL_VERIFY( _rxDataSourceDescriptor->getPropertyValue( PROPERTY_CONNECTION_INFO ) >>= aConnectionInfo ); + + Reference< XDriverManager > xDriverManager; + try { + xDriverManager.set( ConnectionPool::create( m_xContext ), UNO_QUERY_THROW ); + } catch( const Exception& ) { } + if ( !xDriverManager.is() ) + // no connection pool installed + xDriverManager.set( DriverManager::create( m_xContext ), UNO_QUERY_THROW ); + + if ( aConnectionInfo.hasElements() ) + xConnection.set( xDriverManager->getConnectionWithInfo( sConnectionResource, aConnectionInfo ), UNO_SET_THROW ); + else + xConnection.set( xDriverManager->getConnection( sConnectionResource ), UNO_SET_THROW ); } while ( false ); diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx index 5ab075d6050a..bd25e5248c79 100644 --- a/filter/source/msfilter/escherex.cxx +++ b/filter/source/msfilter/escherex.cxx @@ -2547,8 +2547,8 @@ void EscherPropertyContainer::LookForPolarHandles( const MSO_SPT eShapeType, sal { if ( pData->nFlags & SvxMSDffHandleFlags::POLAR ) { - if ( ( pData->nPositionY >= 0x256 ) || ( pData->nPositionY <= 0x107 ) ) - nAdjustmentsWhichNeedsToBeConverted |= ( 1 << k ); + if ( ( pData->nPositionY >= 0x256 ) || ( pData->nPositionY <= 0x107 ) ) + nAdjustmentsWhichNeedsToBeConverted |= ( 1 << k ); } } } diff --git a/hwpfilter/source/solver.cxx b/hwpfilter/source/solver.cxx index 07889620f9c2..7e2788f7f626 100644 --- a/hwpfilter/source/solver.cxx +++ b/hwpfilter/source/solver.cxx @@ -119,11 +119,11 @@ bool mgcLinearSystemD::Solve (int n, std::unique_ptr<std::unique_ptr<double[]>[] { if ( j != icol ) { - save = a[j][icol]; - a[j][icol] = 0; - for (k = 0; k < n; k++) - a[j][k] -= a[icol][k]*save; - b[j] -= b[icol]*save; + save = a[j][icol]; + a[j][icol] = 0; + for (k = 0; k < n; k++) + a[j][k] -= a[icol][k]*save; + b[j] -= b[icol]*save; } } } diff --git a/opencl/source/opencl_device.cxx b/opencl/source/opencl_device.cxx index 3444caf74930..ca9f4f43b5d1 100644 --- a/opencl/source/opencl_device.cxx +++ b/opencl/source/opencl_device.cxx @@ -37,7 +37,7 @@ namespace { void DS_CHECK_STATUS(cl_int status, char const * name) { if (CL_SUCCESS != status) { - SAL_INFO("opencl.device", "Error code is " << status << " at " << name); + SAL_INFO("opencl.device", "Error code is " << status << " at " << name); } } diff --git a/pyuno/source/module/pyuno_util.cxx b/pyuno/source/module/pyuno_util.cxx index 6023a4e310c6..12d58f0eca20 100644 --- a/pyuno/source/module/pyuno_util.cxx +++ b/pyuno/source/module/pyuno_util.cxx @@ -60,12 +60,12 @@ OUString pyString2ustring( PyObject *pystr ) if( PyUnicode_Check( pystr ) ) { #if Py_UNICODE_SIZE == 2 - ret = OUString( - reinterpret_cast<sal_Unicode const *>(PyUnicode_AS_UNICODE( pystr )) ); + ret = OUString( + reinterpret_cast<sal_Unicode const *>(PyUnicode_AS_UNICODE( pystr )) ); #else - Py_ssize_t size(0); - char const *pUtf8(PyUnicode_AsUTF8AndSize(pystr, &size)); - ret = OUString(pUtf8, size, RTL_TEXTENCODING_UTF8); + Py_ssize_t size(0); + char const *pUtf8(PyUnicode_AsUTF8AndSize(pystr, &size)); + ret = OUString(pUtf8, size, RTL_TEXTENCODING_UTF8); #endif } else diff --git a/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx b/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx index e2d0d011092d..b10bdcb685e7 100644 --- a/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx +++ b/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx @@ -917,11 +917,11 @@ uno::Reference< XAccessible > SAL_CALL ScAccessibleSpreadsheet::getAccessibleCel IsObjectValid(); if (!IsFormulaMode()) { - if (nRow > (maRange.aEnd.Row() - maRange.aStart.Row()) || - nRow < 0 || - nColumn > (maRange.aEnd.Col() - maRange.aStart.Col()) || - nColumn < 0) - throw lang::IndexOutOfBoundsException(); + if (nRow > (maRange.aEnd.Row() - maRange.aStart.Row()) || + nRow < 0 || + nColumn > (maRange.aEnd.Col() - maRange.aStart.Col()) || + nColumn < 0) + throw lang::IndexOutOfBoundsException(); } rtl::Reference<ScAccessibleCell> pAccessibleCell = GetAccessibleCellAt(nRow, nColumn); return pAccessibleCell; diff --git a/scaddins/source/analysis/bessel.cxx b/scaddins/source/analysis/bessel.cxx index b356dc219e44..623415e18dfe 100644 --- a/scaddins/source/analysis/bessel.cxx +++ b/scaddins/source/analysis/bessel.cxx @@ -212,9 +212,9 @@ double BesselI( double x, sal_Int32 n ) = -------- TERM(n,k-1) k(n+k) */ - fTerm = fTerm * fXHalf / static_cast<double>(nK) * fXHalf / static_cast<double>(nK+n); - fResult += fTerm; - nK++; + fTerm = fTerm * fXHalf / static_cast<double>(nK) * fXHalf / static_cast<double>(nK+n); + fResult += fTerm; + nK++; } while( (fabs( fTerm ) > fabs(fResult) * fEpsilon) && (nK < nMaxIteration) ); diff --git a/sd/source/filter/eppt/pptexanimations.cxx b/sd/source/filter/eppt/pptexanimations.cxx index 1b455036b766..74ef8cd96619 100644 --- a/sd/source/filter/eppt/pptexanimations.cxx +++ b/sd/source/filter/eppt/pptexanimations.cxx @@ -887,13 +887,13 @@ sal_uInt32 AnimationExporter::GetPresetID( const OUString& rPreset, sal_uInt32 n if ( rPreset.match("ppt_", 0) ) { - sal_Int32 nLast = rPreset.lastIndexOf( '_' ); - if ( ( nLast != -1 ) && ( ( nLast + 1 ) < rPreset.getLength() ) ) - { - OUString aNumber( rPreset.copy( nLast + 1 ) ); - nPresetId = aNumber.toUInt32(); - bPresetId = true; - } + sal_Int32 nLast = rPreset.lastIndexOf( '_' ); + if ( ( nLast != -1 ) && ( ( nLast + 1 ) < rPreset.getLength() ) ) + { + OUString aNumber( rPreset.copy( nLast + 1 ) ); + nPresetId = aNumber.toUInt32(); + bPresetId = true; + } } else { @@ -1690,46 +1690,46 @@ Reference< XShape > AnimationExporter::getTargetElementShape( const Any& rAny, s rParagraphTarget = false; - if( !xShape.is() ) - { + if( xShape.is() ) + return xShape; + ParagraphTarget aParaTarget; if( rAny >>= aParaTarget ) xShape = aParaTarget.Shape; - if ( xShape.is() ) - { - // now calculating the character range for the paragraph - sal_Int16 nParagraph = aParaTarget.Paragraph; - Reference< XSimpleText > xText( xShape, UNO_QUERY ); - if ( xText.is() ) - { - rParagraphTarget = true; - Reference< XEnumerationAccess > xTextParagraphEnumerationAccess( xText, UNO_QUERY ); - if ( xTextParagraphEnumerationAccess.is() ) + if ( !xShape.is() ) + return xShape; + + // now calculating the character range for the paragraph + sal_Int16 nParagraph = aParaTarget.Paragraph; + Reference< XSimpleText > xText( xShape, UNO_QUERY ); + if ( !xText.is() ) + return xShape; + + rParagraphTarget = true; + Reference< XEnumerationAccess > xTextParagraphEnumerationAccess( xText, UNO_QUERY ); + if ( !xTextParagraphEnumerationAccess.is() ) + return xShape; + + Reference< XEnumeration > xTextParagraphEnumeration( xTextParagraphEnumerationAccess->createEnumeration() ); + if ( !xTextParagraphEnumeration.is() ) + return xShape; + + sal_Int16 nCurrentParagraph; + rBegin = rEnd = nCurrentParagraph = 0; + while ( xTextParagraphEnumeration->hasMoreElements() ) + { + Reference< XTextRange > xTextRange( xTextParagraphEnumeration->nextElement(), UNO_QUERY ); + if ( xTextRange.is() ) { - Reference< XEnumeration > xTextParagraphEnumeration( xTextParagraphEnumerationAccess->createEnumeration() ); - if ( xTextParagraphEnumeration.is() ) - { - sal_Int16 nCurrentParagraph; - rBegin = rEnd = nCurrentParagraph = 0; - while ( xTextParagraphEnumeration->hasMoreElements() ) - { - Reference< XTextRange > xTextRange( xTextParagraphEnumeration->nextElement(), UNO_QUERY ); - if ( xTextRange.is() ) - { - OUString aParaText( xTextRange->getString() ); - sal_Int32 nLength = aParaText.getLength() + 1; - rEnd += nLength; - if ( nCurrentParagraph == nParagraph ) - break; - nCurrentParagraph++; - rBegin += nLength; - } - } - } - } + OUString aParaText( xTextRange->getString() ); + sal_Int32 nLength = aParaText.getLength() + 1; + rEnd += nLength; + if ( nCurrentParagraph == nParagraph ) + break; + nCurrentParagraph++; + rBegin += nLength; } } - } return xShape; } diff --git a/soltools/mkdepend/include.c b/soltools/mkdepend/include.c index fd005c3284c7..d05a8fd75a7f 100644 --- a/soltools/mkdepend/include.c +++ b/soltools/mkdepend/include.c @@ -315,17 +315,17 @@ void included_by(struct inclist *ip, struct inclist *newfile) newfile->i_file[i-1] == 'c' && newfile->i_file[i-2] == '.')) { - /* only complain if ip has */ - /* no #include SYMBOL lines */ - /* and is not a .c file */ - if (warn_multiple) - { - warning("%s includes %s more than once!\n", - ip->i_file, newfile->i_file); - warning1("Already have\n"); - for (i=0; i<ip->i_listlen; i++) - warning1("\t%s\n", ip->i_list[i]->i_file); - } + /* only complain if ip has */ + /* no #include SYMBOL lines */ + /* and is not a .c file */ + if (warn_multiple) + { + warning("%s includes %s more than once!\n", + ip->i_file, newfile->i_file); + warning1("Already have\n"); + for (i=0; i<ip->i_listlen; i++) + warning1("\t%s\n", ip->i_list[i]->i_file); + } } return; } diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx index 70303008b48c..fb1a5f8426fb 100644 --- a/sw/source/core/layout/frmtool.cxx +++ b/sw/source/core/layout/frmtool.cxx @@ -2342,12 +2342,12 @@ tools::Long SwBorderAttrs::CalcLeft( const SwFrame *pCaller ) const if (!pCaller->IsTextFrame() || !static_cast<const SwTextFrame*>(pCaller)->GetDoc().GetDocumentSettingManager().get(DocumentSettingId::INVERT_BORDER_SPACING)) { - // OD 23.01.2003 #106895# - for cell frame in R2L text direction the left - // and right border are painted on the right respectively left. - if ( pCaller->IsCellFrame() && pCaller->IsRightToLeft() ) - nLeft = CalcRightLine(); - else - nLeft = CalcLeftLine(); + // OD 23.01.2003 #106895# - for cell frame in R2L text direction the left + // and right border are painted on the right respectively left. + if ( pCaller->IsCellFrame() && pCaller->IsRightToLeft() ) + nLeft = CalcRightLine(); + else + nLeft = CalcLeftLine(); } // for paragraphs, "left" is "before text" and "right" is "after text" diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx index c3b508493667..daa52cfc2da9 100644 --- a/sw/source/core/table/swtable.cxx +++ b/sw/source/core/table/swtable.cxx @@ -147,9 +147,9 @@ void InsTableBox( SwDoc& rDoc, SwTableNode* pTableNd, SwAttrSet aAttrSet( *pCNd->GetpSwAttrSet() ); if(pCNd->GetSwAttrSet().HasItem(RES_PARATR_LIST_AUTOFMT)) { - SwFormatAutoFormat format = aAttrSet.Get(RES_PARATR_LIST_AUTOFMT); - const std::shared_ptr<SfxItemSet>& handle = format.GetStyleHandle(); - aAttrSet.Put(*handle); + SwFormatAutoFormat format = aAttrSet.Get(RES_PARATR_LIST_AUTOFMT); + const std::shared_ptr<SfxItemSet>& handle = format.GetStyleHandle(); + aAttrSet.Put(*handle); } if( pBox->GetSaveNumFormatColor() ) { diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx index f2e394b76e8b..577e1726d1e0 100644 --- a/sw/source/core/txtnode/thints.cxx +++ b/sw/source/core/txtnode/thints.cxx @@ -420,9 +420,9 @@ SwpHints::TryInsertNesting( SwTextNode & rNode, SwTextAttrNesting & rNewHint ) { if (!bNewSelfNestable && (nNewWhich == nOtherWhich)) { - // ruby and hyperlink: if there is nesting, _overwrite_ - OverwrittenExisting.push_back( - static_txtattr_cast<SwTextAttrNesting*>(pOther)); + // ruby and hyperlink: if there is nesting, _overwrite_ + OverwrittenExisting.push_back( + static_txtattr_cast<SwTextAttrNesting*>(pOther)); } else if ((nNewStart == nOtherStart) && pOther->HasDummyChar()) { diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx index f97a61c2387a..5b372141f48a 100644 --- a/sw/source/core/view/viewsh.cxx +++ b/sw/source/core/view/viewsh.cxx @@ -537,9 +537,9 @@ bool SwViewShell::AddPaintRect( const SwRect & rRect ) { if( rSh.Imp() ) { - if ( rSh.IsPreview() && rSh.GetWin() ) - ::RepaintPagePreview( &rSh, rRect ); - else + if ( rSh.IsPreview() && rSh.GetWin() ) + ::RepaintPagePreview( &rSh, rRect ); + else bRet |= rSh.Imp()->AddPaintRect( rRect ); } } diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index 6e6ed96981f7..2aa94c7059b5 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -3081,10 +3081,10 @@ void WW8Export::WriteFkpPlcUsw() if ( pFibData ) { - pFib->m_fReadOnlyRecommended = - pFibData->getReadOnlyRecommended(); - pFib->m_fWriteReservation = - pFibData->getWriteReservation(); + pFib->m_fReadOnlyRecommended = + pFibData->getReadOnlyRecommended(); + pFib->m_fWriteReservation = + pFibData->getWriteReservation(); } pFib->Write( Strm() ); // FIB diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx index 3ed905061c9e..e44b629c06d0 100644 --- a/sw/source/uibase/docvw/edtwin.cxx +++ b/sw/source/uibase/docvw/edtwin.cxx @@ -5640,26 +5640,26 @@ void SwEditWin::Command( const CommandEvent& rCEvt ) if( nPosNodeIdx < nMarkNodeIdx ) { - rSh.GetCursor()->GetPoint()->nNode = nPosNodeIdx; - rSh.GetCursor()->GetPoint()->nContent = nPosIdx; - rSh.GetCursor()->GetMark()->nNode = nPosNodeIdx; - rSh.GetCursor()->GetMark()->nContent = - rSh.GetCursor()->GetContentNode()->Len(); + rSh.GetCursor()->GetPoint()->nNode = nPosNodeIdx; + rSh.GetCursor()->GetPoint()->nContent = nPosIdx; + rSh.GetCursor()->GetMark()->nNode = nPosNodeIdx; + rSh.GetCursor()->GetMark()->nContent = + rSh.GetCursor()->GetContentNode()->Len(); } else if( nPosNodeIdx == nMarkNodeIdx ) { - rSh.GetCursor()->GetPoint()->nNode = nPosNodeIdx; - rSh.GetCursor()->GetPoint()->nContent = nPosIdx; - rSh.GetCursor()->GetMark()->nNode = nMarkNodeIdx; - rSh.GetCursor()->GetMark()->nContent = nMarkIdx; + rSh.GetCursor()->GetPoint()->nNode = nPosNodeIdx; + rSh.GetCursor()->GetPoint()->nContent = nPosIdx; + rSh.GetCursor()->GetMark()->nNode = nMarkNodeIdx; + rSh.GetCursor()->GetMark()->nContent = nMarkIdx; } else { - rSh.GetCursor()->GetMark()->nNode = nMarkNodeIdx; - rSh.GetCursor()->GetMark()->nContent = nMarkIdx; - rSh.GetCursor()->GetPoint()->nNode = nMarkNodeIdx; - rSh.GetCursor()->GetPoint()->nContent = - rSh.GetCursor()->GetContentNode( false )->Len(); + rSh.GetCursor()->GetMark()->nNode = nMarkNodeIdx; + rSh.GetCursor()->GetMark()->nContent = nMarkIdx; + rSh.GetCursor()->GetPoint()->nNode = nMarkNodeIdx; + rSh.GetCursor()->GetPoint()->nContent = + rSh.GetCursor()->GetContentNode( false )->Len(); } rSh.EndCursorMove( true ); diff --git a/toolkit/source/controls/unocontrols.cxx b/toolkit/source/controls/unocontrols.cxx index 034be82a3d7c..c4f6a1de7640 100644 --- a/toolkit/source/controls/unocontrols.cxx +++ b/toolkit/source/controls/unocontrols.cxx @@ -245,12 +245,12 @@ void UnoEditControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolk uno::Reference< awt::XTextComponent > xText( getPeer(), uno::UNO_QUERY ); if ( xText.is() ) { - xText->addTextListener( this ); + xText->addTextListener( this ); - if ( mbSetMaxTextLenInPeer ) - xText->setMaxTextLen( mnMaxTextLen ); - if ( mbSetTextInPeer ) - xText->setText( maText ); + if ( mbSetMaxTextLenInPeer ) + xText->setMaxTextLen( mnMaxTextLen ); + if ( mbSetTextInPeer ) + xText->setText( maText ); } } diff --git a/vcl/source/treelist/transfer.cxx b/vcl/source/treelist/transfer.cxx index 4c2ce3195169..9d6be1feb0c2 100644 --- a/vcl/source/treelist/transfer.cxx +++ b/vcl/source/treelist/transfer.cxx @@ -1841,9 +1841,10 @@ bool TransferableDataHelper::GetINetBookmark( SotClipboardFormatId nFormat, INet bool TransferableDataHelper::GetINetBookmark( const css::datatransfer::DataFlavor& rFlavor, INetBookmark& rBmk ) const { + if( !HasFormat( rFlavor )) + return false; + bool bRet = false; - if( HasFormat( rFlavor )) - { const SotClipboardFormatId nFormat = SotExchange::GetFormat( rFlavor ); switch( nFormat ) { @@ -1969,7 +1970,6 @@ bool TransferableDataHelper::GetINetBookmark( const css::datatransfer::DataFlavo #endif default: break; } - } return bRet; } diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx index 890f4874aa6c..1c7d615db77c 100644 --- a/vcl/source/window/winproc.cxx +++ b/vcl/source/window/winproc.cxx @@ -2262,16 +2262,16 @@ static void ImplHandleSurroundingTextRequest( vcl::Window *pWindow, if ( !pChild ) { - rText.clear(); - rSelRange.setMin( 0 ); - rSelRange.setMax( 0 ); + rText.clear(); + rSelRange.setMin( 0 ); + rSelRange.setMax( 0 ); } else { - rText = pChild->GetSurroundingText(); - Selection aSel = pChild->GetSurroundingTextSelection(); - rSelRange.setMin( aSel.Min() ); - rSelRange.setMax( aSel.Max() ); + rText = pChild->GetSurroundingText(); + Selection aSel = pChild->GetSurroundingTextSelection(); + rSelRange.setMin( aSel.Min() ); + rSelRange.setMax( aSel.Max() ); } } diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 3be1aa56024c..ccb0a7dc224a 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -6246,36 +6246,36 @@ void DomainMapper_Impl::CloseFieldCommand() "com.sun.star.text.FieldMaster.SetExpression." + sFirstParam)) { - xFieldProperties->setPropertyValue( - getPropertyName(PROP_REFERENCE_FIELD_SOURCE), - uno::makeAny( sal_Int16(text::ReferenceFieldSource::BOOKMARK)) ); - xFieldProperties->setPropertyValue( - getPropertyName(PROP_SOURCE_NAME), - uno::makeAny(sFirstParam) ); - sal_Int16 nFieldPart = (bPageRef ? text::ReferenceFieldPart::PAGE : text::ReferenceFieldPart::TEXT); - OUString sValue; - if( lcl_FindInCommand( pContext->GetCommand(), 'p', sValue )) - { - //above-below - nFieldPart = text::ReferenceFieldPart::UP_DOWN; - } - else if( lcl_FindInCommand( pContext->GetCommand(), 'r', sValue )) - { - //number - nFieldPart = text::ReferenceFieldPart::NUMBER; - } - else if( lcl_FindInCommand( pContext->GetCommand(), 'n', sValue )) - { - //number-no-context - nFieldPart = text::ReferenceFieldPart::NUMBER_NO_CONTEXT; - } - else if( lcl_FindInCommand( pContext->GetCommand(), 'w', sValue )) - { - //number-full-context - nFieldPart = text::ReferenceFieldPart::NUMBER_FULL_CONTEXT; - } - xFieldProperties->setPropertyValue( - getPropertyName( PROP_REFERENCE_FIELD_PART ), uno::makeAny( nFieldPart )); + xFieldProperties->setPropertyValue( + getPropertyName(PROP_REFERENCE_FIELD_SOURCE), + uno::makeAny( sal_Int16(text::ReferenceFieldSource::BOOKMARK)) ); + xFieldProperties->setPropertyValue( + getPropertyName(PROP_SOURCE_NAME), + uno::makeAny(sFirstParam) ); + sal_Int16 nFieldPart = (bPageRef ? text::ReferenceFieldPart::PAGE : text::ReferenceFieldPart::TEXT); + OUString sValue; + if( lcl_FindInCommand( pContext->GetCommand(), 'p', sValue )) + { + //above-below + nFieldPart = text::ReferenceFieldPart::UP_DOWN; + } + else if( lcl_FindInCommand( pContext->GetCommand(), 'r', sValue )) + { + //number + nFieldPart = text::ReferenceFieldPart::NUMBER; + } + else if( lcl_FindInCommand( pContext->GetCommand(), 'n', sValue )) + { + //number-no-context + nFieldPart = text::ReferenceFieldPart::NUMBER_NO_CONTEXT; + } + else if( lcl_FindInCommand( pContext->GetCommand(), 'w', sValue )) + { + //number-full-context + nFieldPart = text::ReferenceFieldPart::NUMBER_FULL_CONTEXT; + } + xFieldProperties->setPropertyValue( + getPropertyName( PROP_REFERENCE_FIELD_PART ), uno::makeAny( nFieldPart )); } else if( m_xTextFactory.is() ) { diff --git a/xmloff/source/chart/SchXMLPlotAreaContext.cxx b/xmloff/source/chart/SchXMLPlotAreaContext.cxx index 3d2b9495c643..f3491ce37fab 100644 --- a/xmloff/source/chart/SchXMLPlotAreaContext.cxx +++ b/xmloff/source/chart/SchXMLPlotAreaContext.cxx @@ -334,48 +334,48 @@ void SchXMLPlotAreaContext::startFastElement (sal_Int32 /*nElement*/, //remember default values for dataseries if(xProp.is()) { - try - { - mrSeriesDefaultsAndStyles.maSymbolTypeDefault = xProp->getPropertyValue("SymbolType"); - mrSeriesDefaultsAndStyles.maDataCaptionDefault = xProp->getPropertyValue("DataCaption"); - - mrSeriesDefaultsAndStyles.maMeanValueDefault = xProp->getPropertyValue("MeanValue"); - mrSeriesDefaultsAndStyles.maRegressionCurvesDefault = xProp->getPropertyValue("RegressionCurves"); - - bool bStacked = false; - mrSeriesDefaultsAndStyles.maStackedDefault = xProp->getPropertyValue("Stacked"); - mrSeriesDefaultsAndStyles.maStackedDefault >>= bStacked; - mrSeriesDefaultsAndStyles.maPercentDefault = xProp->getPropertyValue("Percent"); - mrSeriesDefaultsAndStyles.maPercentDefault >>= mbPercentStacked; - mrSeriesDefaultsAndStyles.maStackedBarsConnectedDefault = xProp->getPropertyValue("StackedBarsConnected"); - - // deep - uno::Any aDeepProperty( xProp->getPropertyValue("Deep")); - // #124488# old versions store a 3d area and 3D line deep chart with Deep==false => workaround for this - if( ! (bStacked || mbPercentStacked )) + try { - if( SchXMLTools::isDocumentGeneratedWithOpenOfficeOlderThan2_3( GetImport().GetModel() ) ) + mrSeriesDefaultsAndStyles.maSymbolTypeDefault = xProp->getPropertyValue("SymbolType"); + mrSeriesDefaultsAndStyles.maDataCaptionDefault = xProp->getPropertyValue("DataCaption"); + + mrSeriesDefaultsAndStyles.maMeanValueDefault = xProp->getPropertyValue("MeanValue"); + mrSeriesDefaultsAndStyles.maRegressionCurvesDefault = xProp->getPropertyValue("RegressionCurves"); + + bool bStacked = false; + mrSeriesDefaultsAndStyles.maStackedDefault = xProp->getPropertyValue("Stacked"); + mrSeriesDefaultsAndStyles.maStackedDefault >>= bStacked; + mrSeriesDefaultsAndStyles.maPercentDefault = xProp->getPropertyValue("Percent"); + mrSeriesDefaultsAndStyles.maPercentDefault >>= mbPercentStacked; + mrSeriesDefaultsAndStyles.maStackedBarsConnectedDefault = xProp->getPropertyValue("StackedBarsConnected"); + + // deep + uno::Any aDeepProperty( xProp->getPropertyValue("Deep")); + // #124488# old versions store a 3d area and 3D line deep chart with Deep==false => workaround for this + if( ! (bStacked || mbPercentStacked )) { - bool bIs3d = false; - if( ( xProp->getPropertyValue("Dim3D") >>= bIs3d ) && - bIs3d ) + if( SchXMLTools::isDocumentGeneratedWithOpenOfficeOlderThan2_3( GetImport().GetModel() ) ) { - if( maChartTypeServiceName == "com.sun.star.chart2.AreaChartType" || maChartTypeServiceName == "com.sun.star.chart2.LineChartType" ) + bool bIs3d = false; + if( ( xProp->getPropertyValue("Dim3D") >>= bIs3d ) && + bIs3d ) { - aDeepProperty <<= true; + if( maChartTypeServiceName == "com.sun.star.chart2.AreaChartType" || maChartTypeServiceName == "com.sun.star.chart2.LineChartType" ) + { + aDeepProperty <<= true; + } } } } - } - mrSeriesDefaultsAndStyles.maDeepDefault = aDeepProperty; + mrSeriesDefaultsAndStyles.maDeepDefault = aDeepProperty; - xProp->getPropertyValue("NumberOfLines") >>= mnNumOfLinesProp; - xProp->getPropertyValue("Volume") >>= mbStockHasVolume; - } - catch( const uno::Exception & ) - { - TOOLS_INFO_EXCEPTION("xmloff.chart", "PlotAreaContext:EndElement(): Exception caught"); - } + xProp->getPropertyValue("NumberOfLines") >>= mnNumOfLinesProp; + xProp->getPropertyValue("Volume") >>= mbStockHasVolume; + } + catch( const uno::Exception & ) + { + TOOLS_INFO_EXCEPTION("xmloff.chart", "PlotAreaContext:EndElement(): Exception caught"); + } } // if bool bCreateInternalDataProvider = false; diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx index 51fcc91d7467..ab9b47d0e619 100644 --- a/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx +++ b/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx @@ -1577,14 +1577,14 @@ void ImportContext::importDefaults( sal_Bool bVisible = true; if (getBoolAttr( &bVisible, "visible", xAttributes, _pImport->XMLNS_DIALOGS_UID ) && !bVisible) { - try - { - _xControlModel->setPropertyValue( "EnableVisible", makeAny( false ) ); - } - catch( Exception& ) - { - DBG_UNHANDLED_EXCEPTION("xmlscript.xmldlg"); - } + try + { + _xControlModel->setPropertyValue( "EnableVisible", makeAny( false ) ); + } + catch( Exception& ) + { + DBG_UNHANDLED_EXCEPTION("xmlscript.xmldlg"); + } } if (!importLongProperty( nBaseX, "PositionX", "left", xAttributes ) || |