loplugin:indentation check for indent inside block

look for places where the statements inside a block are
not indented

Change-Id: I0cbfa7e0b6fb194b2aff6fa7e070fb907d70ca2f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123885
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin
2021-10-20 15:39:38 +02:00
parent 18bdf78e15
commit 283a9790bf
27 changed files with 331 additions and 304 deletions
+3 -3
View File
@@ -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 );
}
}
};
+6 -6
View File
@@ -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() );
}
}
+31 -14
View File
@@ -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)
@@ -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: */
@@ -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)
@@ -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;
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;
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;
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;
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;
m_setContextClassLoaderMethod = m_environment.GetMethodID(
threadClass.get(), "setContextClassLoader", "(Ljava/lang/ClassLoader;)V" );
if ( m_setContextClassLoaderMethod == nullptr )
break;
}
while ( false );
+63 -63
View File
@@ -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< XCompletedConnection > xInteractiveConnection( xDataSource, UNO_QUERY );
if ( xInteractiveConnection.is() )
xConnection.reset( xInteractiveConnection->connectWithCompletion( xInteractionHandler ), SharedConnection::TakeOwnership );
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;
}
// 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 );
// 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 );
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 );
if ( aConnectionInfo.hasElements() )
xConnection.set( xDriverManager->getConnectionWithInfo( sConnectionResource, aConnectionInfo ), UNO_SET_THROW );
else
xConnection.set( xDriverManager->getConnection( sConnectionResource ), UNO_SET_THROW );
}
while ( false );
+2 -2
View File
@@ -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 );
}
}
}
+5 -5
View File
@@ -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;
}
}
}
+1 -1
View File
@@ -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);
}
}
+5 -5
View File
@@ -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
@@ -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;
+3 -3
View File
@@ -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) );
+40 -40
View File
@@ -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,45 +1690,45 @@ 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() )
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() )
{
// now calculating the character range for the paragraph
sal_Int16 nParagraph = aParaTarget.Paragraph;
Reference< XSimpleText > xText( xShape, UNO_QUERY );
if ( xText.is() )
Reference< XTextRange > xTextRange( xTextParagraphEnumeration->nextElement(), UNO_QUERY );
if ( xTextRange.is() )
{
rParagraphTarget = true;
Reference< XEnumerationAccess > xTextParagraphEnumerationAccess( xText, UNO_QUERY );
if ( xTextParagraphEnumerationAccess.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;
+11 -11
View File
@@ -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;
}
+6 -6
View File
@@ -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"
+3 -3
View File
@@ -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() )
{
+3 -3
View File
@@ -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())
{
+3 -3
View File
@@ -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 );
}
}
+4 -4
View File
@@ -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
+14 -14
View File
@@ -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 );
+5 -5
View File
@@ -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 );
}
}
+3 -3
View File
@@ -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;
}
+7 -7
View File
@@ -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() );
}
}
@@ -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() )
{
+34 -34
View File
@@ -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;
@@ -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 ) ||