summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-08-07 16:35:49 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-08-08 08:46:37 +0200
commit37c3da6d2c453448952783ef9437f12469edc316 (patch)
tree29028f267f64dccc11cb7b9c3cffdec762684a79 /sc
parent47b19a51c47332981b89c250c69ec240c811a325 (diff)
loplugin:flatten in sc/filter
Change-Id: I3fa60b5c1ef253d9e9e9a727e29c052de277e77a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100339 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/filter/ftools/fprogressbar.cxx46
-rw-r--r--sc/source/filter/html/htmlexp.cxx112
-rw-r--r--sc/source/filter/html/htmlexp2.cxx112
-rw-r--r--sc/source/filter/html/htmlpars.cxx186
-rw-r--r--sc/source/filter/lotus/lotimpop.cxx44
-rw-r--r--sc/source/filter/lotus/op.cxx110
-rw-r--r--sc/source/filter/rtf/eeimpars.cxx22
-rw-r--r--sc/source/filter/rtf/rtfparse.cxx40
-rw-r--r--sc/source/filter/xcl97/XclExpChangeTrack.cxx20
-rw-r--r--sc/source/filter/xcl97/XclImpChangeTrack.cxx204
-rw-r--r--sc/source/filter/xcl97/xcl97esc.cxx5
-rw-r--r--sc/source/filter/xcl97/xcl97rec.cxx218
-rw-r--r--sc/source/filter/xml/xmlexprt.cxx84
13 files changed, 604 insertions, 599 deletions
diff --git a/sc/source/filter/ftools/fprogressbar.cxx b/sc/source/filter/ftools/fprogressbar.cxx
index ed6ea6c1bfe0..b46f36027e8c 100644
--- a/sc/source/filter/ftools/fprogressbar.cxx
+++ b/sc/source/filter/ftools/fprogressbar.cxx
@@ -78,33 +78,33 @@ ScfProgressBar::ScfProgressSegment* ScfProgressBar::GetSegment( sal_Int32 nSegme
void ScfProgressBar::SetCurrSegment( ScfProgressSegment* pSegment )
{
- if( mpCurrSegment != pSegment )
- {
- mpCurrSegment = pSegment;
+ if( mpCurrSegment == pSegment )
+ return;
- if( mpParentProgress && mpParentSegment )
- {
- mpParentProgress->SetCurrSegment( mpParentSegment );
- }
- else if( !mxSysProgress && (mnTotalSize > 0) )
- {
- // System progress has an internal limit of ULONG_MAX/100.
- mnSysProgressScale = 1;
- sal_uLong nSysTotalSize = static_cast< sal_uLong >( mnTotalSize );
- while( nSysTotalSize >= ULONG_MAX / 100 )
- {
- nSysTotalSize /= 2;
- mnSysProgressScale *= 2;
- }
- mxSysProgress.reset( new ScProgress( mpDocShell, maText, nSysTotalSize, true ) );
- }
+ mpCurrSegment = pSegment;
- if( !mbInProgress && mpCurrSegment && (mnTotalSize > 0) )
+ if( mpParentProgress && mpParentSegment )
+ {
+ mpParentProgress->SetCurrSegment( mpParentSegment );
+ }
+ else if( !mxSysProgress && (mnTotalSize > 0) )
+ {
+ // System progress has an internal limit of ULONG_MAX/100.
+ mnSysProgressScale = 1;
+ sal_uLong nSysTotalSize = static_cast< sal_uLong >( mnTotalSize );
+ while( nSysTotalSize >= ULONG_MAX / 100 )
{
- mnUnitSize = mnTotalSize / 256 + 1; // at most 256 calls of system progress
- mnNextUnitPos = 0;
- mbInProgress = true;
+ nSysTotalSize /= 2;
+ mnSysProgressScale *= 2;
}
+ mxSysProgress.reset( new ScProgress( mpDocShell, maText, nSysTotalSize, true ) );
+ }
+
+ if( !mbInProgress && mpCurrSegment && (mnTotalSize > 0) )
+ {
+ mnUnitSize = mnTotalSize / 256 + 1; // at most 256 calls of system progress
+ mnNextUnitPos = 0;
+ mbInProgress = true;
}
}
diff --git a/sc/source/filter/html/htmlexp.cxx b/sc/source/filter/html/htmlexp.cxx
index 6f1a3cfbbf36..8fa70bce0259 100644
--- a/sc/source/filter/html/htmlexp.cxx
+++ b/sc/source/filter/html/htmlexp.cxx
@@ -398,35 +398,35 @@ void ScHTMLExport::WriteHeader()
void ScHTMLExport::WriteOverview()
{
- if ( nUsedTables > 1 )
- {
- IncIndent(1);
- OUT_HR();
- IncIndent(1); TAG_ON( OOO_STRING_SVTOOLS_HTML_parabreak ); TAG_ON_LF( OOO_STRING_SVTOOLS_HTML_center );
- TAG_ON( OOO_STRING_SVTOOLS_HTML_head1 );
- OUT_STR( ScResId( STR_OVERVIEW ) );
- TAG_OFF_LF( OOO_STRING_SVTOOLS_HTML_head1 );
+ if ( nUsedTables <= 1 )
+ return;
+
+ IncIndent(1);
+ OUT_HR();
+ IncIndent(1); TAG_ON( OOO_STRING_SVTOOLS_HTML_parabreak ); TAG_ON_LF( OOO_STRING_SVTOOLS_HTML_center );
+ TAG_ON( OOO_STRING_SVTOOLS_HTML_head1 );
+ OUT_STR( ScResId( STR_OVERVIEW ) );
+ TAG_OFF_LF( OOO_STRING_SVTOOLS_HTML_head1 );
- OUString aStr;
+ OUString aStr;
- const SCTAB nCount = pDoc->GetTableCount();
- for ( SCTAB nTab = 0; nTab < nCount; nTab++ )
+ const SCTAB nCount = pDoc->GetTableCount();
+ for ( SCTAB nTab = 0; nTab < nCount; nTab++ )
+ {
+ if ( !IsEmptyTable( nTab ) )
{
- if ( !IsEmptyTable( nTab ) )
- {
- pDoc->GetName( nTab, aStr );
- rStrm.WriteCharPtr( "<A HREF=\"#table" )
- .WriteOString( OString::number(nTab) )
- .WriteCharPtr( "\">" );
- OUT_STR( aStr );
- rStrm.WriteCharPtr( "</A>" );
- TAG_ON_LF( OOO_STRING_SVTOOLS_HTML_linebreak );
- }
+ pDoc->GetName( nTab, aStr );
+ rStrm.WriteCharPtr( "<A HREF=\"#table" )
+ .WriteOString( OString::number(nTab) )
+ .WriteCharPtr( "\">" );
+ OUT_STR( aStr );
+ rStrm.WriteCharPtr( "</A>" );
+ TAG_ON_LF( OOO_STRING_SVTOOLS_HTML_linebreak );
}
-
- IncIndent(-1); OUT_LF();
- IncIndent(-1); TAG_OFF( OOO_STRING_SVTOOLS_HTML_center ); TAG_OFF_LF( OOO_STRING_SVTOOLS_HTML_parabreak );
}
+
+ IncIndent(-1); OUT_LF();
+ IncIndent(-1); TAG_OFF( OOO_STRING_SVTOOLS_HTML_center ); TAG_OFF_LF( OOO_STRING_SVTOOLS_HTML_parabreak );
}
const SfxItemSet& ScHTMLExport::PageDefaults( SCTAB nTab )
@@ -1248,50 +1248,50 @@ void ScHTMLExport::CopyLocalFileToINet( OUString& rFileNm,
INetURLObject aFileUrl, aTargetUrl;
aFileUrl.SetSmartURL( rFileNm );
aTargetUrl.SetSmartURL( rTargetNm );
- if( INetProtocol::File == aFileUrl.GetProtocol() &&
+ if( !(INetProtocol::File == aFileUrl.GetProtocol() &&
( INetProtocol::File != aTargetUrl.GetProtocol() &&
INetProtocol::Ftp <= aTargetUrl.GetProtocol() &&
- INetProtocol::Javascript >= aTargetUrl.GetProtocol()) )
+ INetProtocol::Javascript >= aTargetUrl.GetProtocol())) )
+ return;
+
+ if( pFileNameMap )
{
- if( pFileNameMap )
+ // Did we already move the file?
+ std::map<OUString, OUString>::iterator it = pFileNameMap->find( rFileNm );
+ if( it != pFileNameMap->end() )
{
- // Did we already move the file?
- std::map<OUString, OUString>::iterator it = pFileNameMap->find( rFileNm );
- if( it != pFileNameMap->end() )
- {
- rFileNm = it->second;
- return;
- }
- }
- else
- {
- pFileNameMap.reset( new std::map<OUString, OUString> );
+ rFileNm = it->second;
+ return;
}
+ }
+ else
+ {
+ pFileNameMap.reset( new std::map<OUString, OUString> );
+ }
- bool bRet = false;
- SvFileStream aTmp( aFileUrl.PathToFileName(), StreamMode::READ );
+ bool bRet = false;
+ SvFileStream aTmp( aFileUrl.PathToFileName(), StreamMode::READ );
- OUString aSrc = rFileNm;
- OUString aDest = aTargetUrl.GetPartBeforeLastName() + aFileUrl.GetLastName();
+ OUString aSrc = rFileNm;
+ OUString aDest = aTargetUrl.GetPartBeforeLastName() + aFileUrl.GetLastName();
- SfxMedium aMedium( aDest, StreamMode::WRITE | StreamMode::SHARE_DENYNONE );
+ SfxMedium aMedium( aDest, StreamMode::WRITE | StreamMode::SHARE_DENYNONE );
- {
- SvFileStream aCpy( aMedium.GetPhysicalName(), StreamMode::WRITE );
- aCpy.WriteStream( aTmp );
- }
+ {
+ SvFileStream aCpy( aMedium.GetPhysicalName(), StreamMode::WRITE );
+ aCpy.WriteStream( aTmp );
+ }
- // Take over
- aMedium.Close();
- aMedium.Commit();
+ // Take over
+ aMedium.Close();
+ aMedium.Commit();
- bRet = ERRCODE_NONE == aMedium.GetError();
+ bRet = ERRCODE_NONE == aMedium.GetError();
- if( bRet )
- {
- pFileNameMap->insert( std::make_pair( aSrc, aDest ) );
- rFileNm = aDest;
- }
+ if( bRet )
+ {
+ pFileNameMap->insert( std::make_pair( aSrc, aDest ) );
+ rFileNm = aDest;
}
}
diff --git a/sc/source/filter/html/htmlexp2.cxx b/sc/source/filter/html/htmlexp2.cxx
index e6959bfa35fe..af00eddd462d 100644
--- a/sc/source/filter/html/htmlexp2.cxx
+++ b/sc/source/filter/html/htmlexp2.cxx
@@ -40,23 +40,23 @@ using namespace com::sun::star;
void ScHTMLExport::PrepareGraphics( ScDrawLayer* pDrawLayer, SCTAB nTab,
SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow )
{
- if ( pDrawLayer->HasObjectsInRows( nTab, nStartRow, nEndRow ) )
+ if ( !pDrawLayer->HasObjectsInRows( nTab, nStartRow, nEndRow ) )
+ return;
+
+ SdrPage* pDrawPage = pDrawLayer->GetPage( static_cast<sal_uInt16>(nTab) );
+ if ( !pDrawPage )
+ return;
+
+ bTabHasGraphics = true;
+ FillGraphList( pDrawPage, nTab, nStartCol, nStartRow, nEndCol, nEndRow );
+ size_t ListSize = aGraphList.size();
+ for ( size_t i = 0; i < ListSize; ++i )
{
- SdrPage* pDrawPage = pDrawLayer->GetPage( static_cast<sal_uInt16>(nTab) );
- if ( pDrawPage )
- {
- bTabHasGraphics = true;
- FillGraphList( pDrawPage, nTab, nStartCol, nStartRow, nEndCol, nEndRow );
- size_t ListSize = aGraphList.size();
- for ( size_t i = 0; i < ListSize; ++i )
- {
- ScHTMLGraphEntry* pE = &aGraphList[ i ];
- if ( !pE->bInCell )
- { // not all cells: table next to some
- bTabAlignedLeft = true;
- break;
- }
- }
+ ScHTMLGraphEntry* pE = &aGraphList[ i ];
+ if ( !pE->bInCell )
+ { // not all cells: table next to some
+ bTabAlignedLeft = true;
+ break;
}
}
}
@@ -64,50 +64,50 @@ void ScHTMLExport::PrepareGraphics( ScDrawLayer* pDrawLayer, SCTAB nTab,
void ScHTMLExport::FillGraphList( const SdrPage* pPage, SCTAB nTab,
SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow )
{
- if ( pPage->GetObjCount() )
+ if ( !pPage->GetObjCount() )
+ return;
+
+ tools::Rectangle aRect;
+ if ( !bAll )
+ aRect = pDoc->GetMMRect( nStartCol, nStartRow, nEndCol, nEndRow, nTab );
+ SdrObjListIter aIter( pPage, SdrIterMode::Flat );
+ SdrObject* pObject = aIter.Next();
+ while ( pObject )
{
- tools::Rectangle aRect;
- if ( !bAll )
- aRect = pDoc->GetMMRect( nStartCol, nStartRow, nEndCol, nEndRow, nTab );
- SdrObjListIter aIter( pPage, SdrIterMode::Flat );
- SdrObject* pObject = aIter.Next();
- while ( pObject )
+ tools::Rectangle aObjRect = pObject->GetCurrentBoundRect();
+ if ( (bAll || aRect.IsInside( aObjRect )) && !ScDrawLayer::IsNoteCaption(pObject) )
{
- tools::Rectangle aObjRect = pObject->GetCurrentBoundRect();
- if ( (bAll || aRect.IsInside( aObjRect )) && !ScDrawLayer::IsNoteCaption(pObject) )
- {
- Size aSpace;
- ScRange aR = pDoc->GetRange( nTab, aObjRect );
- // Rectangle in mm/100
- Size aSize( MMToPixel( aObjRect.GetSize() ) );
- // If the image is somewhere in a merged range we must
- // move the anchor to the upper left (THE span cell).
- pDoc->ExtendOverlapped( aR );
- SCCOL nCol1 = aR.aStart.Col();
- SCROW nRow1 = aR.aStart.Row();
- SCCOL nCol2 = aR.aEnd.Col();
- SCROW nRow2 = aR.aEnd.Row();
- // All cells empty under object?
- bool bInCell = (pDoc->GetEmptyLinesInBlock(
- nCol1, nRow1, nTab, nCol2, nRow2, nTab, DIR_TOP )
- == static_cast< SCSIZE >( nRow2 - nRow1 )); // rows-1 !
- if ( bInCell )
- { // Spacing in spanning cell
- tools::Rectangle aCellRect = pDoc->GetMMRect(
- nCol1, nRow1, nCol2, nRow2, nTab );
- aSpace = MMToPixel( Size(
- aCellRect.GetWidth() - aObjRect.GetWidth(),
- aCellRect.GetHeight() - aObjRect.GetHeight() ));
- aSpace.AdjustWidth((nCol2-nCol1) * (nCellSpacing+1) );
- aSpace.AdjustHeight((nRow2-nRow1) * (nCellSpacing+1) );
- aSpace.setWidth( aSpace.Width() / 2 );
- aSpace.setHeight( aSpace.Height() / 2 );
- }
- aGraphList.emplace_back( pObject,
- aR, aSize, bInCell, aSpace );
+ Size aSpace;
+ ScRange aR = pDoc->GetRange( nTab, aObjRect );
+ // Rectangle in mm/100
+ Size aSize( MMToPixel( aObjRect.GetSize() ) );
+ // If the image is somewhere in a merged range we must
+ // move the anchor to the upper left (THE span cell).
+ pDoc->ExtendOverlapped( aR );
+ SCCOL nCol1 = aR.aStart.Col();
+ SCROW nRow1 = aR.aStart.Row();
+ SCCOL nCol2 = aR.aEnd.Col();
+ SCROW nRow2 = aR.aEnd.Row();
+ // All cells empty under object?
+ bool bInCell = (pDoc->GetEmptyLinesInBlock(
+ nCol1, nRow1, nTab, nCol2, nRow2, nTab, DIR_TOP )
+ == static_cast< SCSIZE >( nRow2 - nRow1 )); // rows-1 !
+ if ( bInCell )
+ { // Spacing in spanning cell
+ tools::Rectangle aCellRect = pDoc->GetMMRect(
+ nCol1, nRow1, nCol2, nRow2, nTab );
+ aSpace = MMToPixel( Size(
+ aCellRect.GetWidth() - aObjRect.GetWidth(),
+ aCellRect.GetHeight() - aObjRect.GetHeight() ));
+ aSpace.AdjustWidth((nCol2-nCol1) * (nCellSpacing+1) );
+ aSpace.AdjustHeight((nRow2-nRow1) * (nCellSpacing+1) );
+ aSpace.setWidth( aSpace.Width() / 2 );
+ aSpace.setHeight( aSpace.Height() / 2 );
}
- pObject = aIter.Next();
+ aGraphList.emplace_back( pObject,
+ aR, aSize, bInCell, aSpace );
}
+ pObject = aIter.Next();
}
}
diff --git a/sc/source/filter/html/htmlpars.cxx b/sc/source/filter/html/htmlpars.cxx
index 67df16696434..f632d871222b 100644
--- a/sc/source/filter/html/htmlpars.cxx
+++ b/sc/source/filter/html/htmlpars.cxx
@@ -432,37 +432,38 @@ void ScHTMLLayoutParser::ModifyOffset( ScHTMLColOffset* pOffset, sal_uInt16& nOl
void ScHTMLLayoutParser::SkipLocked( ScEEParseEntry* pE, bool bJoin )
{
- if ( mpDoc->ValidCol(pE->nCol) )
- { // Or else this would create a wrong value at ScAddress (chance for an infinite loop)!
- bool bBadCol = false;
- bool bAgain;
- ScRange aRange( pE->nCol, pE->nRow, 0,
- pE->nCol + pE->nColOverlap - 1, pE->nRow + pE->nRowOverlap - 1, 0 );
- do
+ if ( !mpDoc->ValidCol(pE->nCol) )
+ return;
+
+// Or else this would create a wrong value at ScAddress (chance for an infinite loop)!
+ bool bBadCol = false;
+ bool bAgain;
+ ScRange aRange( pE->nCol, pE->nRow, 0,
+ pE->nCol + pE->nColOverlap - 1, pE->nRow + pE->nRowOverlap - 1, 0 );
+ do
+ {
+ bAgain = false;
+ for ( size_t i = 0, nRanges = xLockedList->size(); i < nRanges; ++i )
{
- bAgain = false;
- for ( size_t i = 0, nRanges = xLockedList->size(); i < nRanges; ++i )
+ ScRange & rR = (*xLockedList)[i];
+ if ( rR.Intersects( aRange ) )
{
- ScRange & rR = (*xLockedList)[i];
- if ( rR.Intersects( aRange ) )
+ pE->nCol = rR.aEnd.Col() + 1;
+ SCCOL nTmp = pE->nCol + pE->nColOverlap - 1;
+ if ( pE->nCol > mpDoc->MaxCol() || nTmp > mpDoc->MaxCol() )
+ bBadCol = true;
+ else
{
- pE->nCol = rR.aEnd.Col() + 1;
- SCCOL nTmp = pE->nCol + pE->nColOverlap - 1;
- if ( pE->nCol > mpDoc->MaxCol() || nTmp > mpDoc->MaxCol() )
- bBadCol = true;
- else
- {
- bAgain = true;
- aRange.aStart.SetCol( pE->nCol );
- aRange.aEnd.SetCol( nTmp );
- }
- break;
+ bAgain = true;
+ aRange.aStart.SetCol( pE->nCol );
+ aRange.aEnd.SetCol( nTmp );
}
+ break;
}
- } while ( bAgain );
- if ( bJoin && !bBadCol )
- xLockedList->Join( aRange );
- }
+ }
+ } while ( bAgain );
+ if ( bJoin && !bBadCol )
+ xLockedList->Join( aRange );
}
void ScHTMLLayoutParser::Adjust()
@@ -1346,21 +1347,21 @@ void ScHTMLLayoutParser::Image( HtmlImportInfo* pInfo )
pImage->aSize = pDefaultDev->LogicToPixel( pImage->pGraphic->GetPrefSize(),
pImage->pGraphic->GetPrefMapMode() );
}
- if (!mxActEntry->maImageList.empty())
+ if (mxActEntry->maImageList.empty())
+ return;
+
+ long nWidth = 0;
+ for (const std::unique_ptr<ScHTMLImage> & pI : mxActEntry->maImageList)
{
- long nWidth = 0;
- for (const std::unique_ptr<ScHTMLImage> & pI : mxActEntry->maImageList)
- {
- if ( pI->nDir & nHorizontal )
- nWidth += pI->aSize.Width() + 2 * pI->aSpace.X();
- else
- nWidth = 0;
- }
- if ( mxActEntry->nWidth
- && (nWidth + pImage->aSize.Width() + 2 * pImage->aSpace.X()
- >= mxActEntry->nWidth) )
- mxActEntry->maImageList.back()->nDir = nVertical;
+ if ( pI->nDir & nHorizontal )
+ nWidth += pI->aSize.Width() + 2 * pI->aSpace.X();
+ else
+ nWidth = 0;
}
+ if ( mxActEntry->nWidth
+ && (nWidth + pImage->aSize.Width() + 2 * pImage->aSpace.X()
+ >= mxActEntry->nWidth) )
+ mxActEntry->maImageList.back()->nDir = nVertical;
}
void ScHTMLLayoutParser::ColOn( HtmlImportInfo* pInfo )
@@ -1417,54 +1418,55 @@ bool ScHTMLLayoutParser::IsAtBeginningOfText( const HtmlImportInfo* pInfo )
void ScHTMLLayoutParser::FontOn( HtmlImportInfo* pInfo )
{
- if ( IsAtBeginningOfText( pInfo ) )
- { // Only at the start of the text; applies to whole line
- const HTMLOptions& rOptions = static_cast<HTMLParser*>(pInfo->pParser)->GetOptions();
- for (const auto & rOption : rOptions)
+ if ( !IsAtBeginningOfText( pInfo ) )
+ return;
+
+// Only at the start of the text; applies to whole line
+ const HTMLOptions& rOptions = static_cast<HTMLParser*>(pInfo->pParser)->GetOptions();
+ for (const auto & rOption : rOptions)
+ {
+ switch( rOption.GetToken() )
{
- switch( rOption.GetToken() )
+ case HtmlOptionId::FACE :
{
- case HtmlOptionId::FACE :
- {
- const OUString& rFace = rOption.GetString();
- OUStringBuffer aFontName;
- sal_Int32 nPos = 0;
- while( nPos != -1 )
- {
- // Font list, VCL uses the semicolon as separator
- // HTML uses the comma
- OUString aFName = rFace.getToken( 0, ',', nPos );
- aFName = comphelper::string::strip(aFName, ' ');
- if( !aFontName.isEmpty() )
- aFontName.append(";");
- aFontName.append(aFName);
- }
- if ( !aFontName.isEmpty() )
- mxActEntry->aItemSet.Put( SvxFontItem( FAMILY_DONTKNOW,
- aFontName.makeStringAndClear(), EMPTY_OUSTRING, PITCH_DONTKNOW,
- RTL_TEXTENCODING_DONTKNOW, ATTR_FONT ) );
- }
- break;
- case HtmlOptionId::SIZE :
- {
- sal_uInt16 nSize = static_cast<sal_uInt16>(rOption.GetNumber());
- if ( nSize == 0 )
- nSize = 1;
- else if ( nSize > SC_HTML_FONTSIZES )
- nSize = SC_HTML_FONTSIZES;
- mxActEntry->aItemSet.Put( SvxFontHeightItem(
- maFontHeights[nSize-1], 100, ATTR_FONT_HEIGHT ) );
- }
- break;
- case HtmlOptionId::COLOR :
+ const OUString& rFace = rOption.GetString();
+ OUStringBuffer aFontName;
+ sal_Int32 nPos = 0;
+ while( nPos != -1 )
{
- Color aColor;
- rOption.GetColor( aColor );
- mxActEntry->aItemSet.Put( SvxColorItem( aColor, ATTR_FONT_COLOR ) );
+ // Font list, VCL uses the semicolon as separator
+ // HTML uses the comma
+ OUString aFName = rFace.getToken( 0, ',', nPos );
+ aFName = comphelper::string::strip(aFName, ' ');
+ if( !aFontName.isEmpty() )
+ aFontName.append(";");
+ aFontName.append(aFName);
}
- break;
- default: break;
+ if ( !aFontName.isEmpty() )
+ mxActEntry->aItemSet.Put( SvxFontItem( FAMILY_DONTKNOW,
+ aFontName.makeStringAndClear(), EMPTY_OUSTRING, PITCH_DONTKNOW,
+ RTL_TEXTENCODING_DONTKNOW, ATTR_FONT ) );
}
+ break;
+ case HtmlOptionId::SIZE :
+ {
+ sal_uInt16 nSize = static_cast<sal_uInt16>(rOption.GetNumber());
+ if ( nSize == 0 )
+ nSize = 1;
+ else if ( nSize > SC_HTML_FONTSIZES )
+ nSize = SC_HTML_FONTSIZES;
+ mxActEntry->aItemSet.Put( SvxFontHeightItem(
+ maFontHeights[nSize-1], 100, ATTR_FONT_HEIGHT ) );
+ }
+ break;
+ case HtmlOptionId::COLOR :
+ {
+ Color aColor;
+ rOption.GetColor( aColor );
+ mxActEntry->aItemSet.Put( SvxColorItem( aColor, ATTR_FONT_COLOR ) );
+ }
+ break;
+ default: break;
}
}
}
@@ -2965,19 +2967,19 @@ void ScHTMLQueryParser::TitleOn()
void ScHTMLQueryParser::TitleOff( const HtmlImportInfo& rInfo )
{
- if( mbTitleOn )
+ if( !mbTitleOn )
+ return;
+
+ OUString aTitle = maTitle.makeStringAndClear().trim();
+ if (!aTitle.isEmpty() && mpDoc->GetDocumentShell())
{
- OUString aTitle = maTitle.makeStringAndClear().trim();
- if (!aTitle.isEmpty() && mpDoc->GetDocumentShell())
- {
- uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
- mpDoc->GetDocumentShell()->GetModel(), uno::UNO_QUERY_THROW);
+ uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
+ mpDoc->GetDocumentShell()->GetModel(), uno::UNO_QUERY_THROW);
- xDPS->getDocumentProperties()->setTitle(aTitle);
- }
- InsertText( rInfo );
- mbTitleOn = false;
+ xDPS->getDocumentProperties()->setTitle(aTitle);
}
+ InsertText( rInfo );
+ mbTitleOn = false;
}
void ScHTMLQueryParser::TableOn( const HtmlImportInfo& rInfo )
diff --git a/sc/source/filter/lotus/lotimpop.cxx b/sc/source/filter/lotus/lotimpop.cxx
index 0c8db339f29a..69cea998aa91 100644
--- a/sc/source/filter/lotus/lotimpop.cxx
+++ b/sc/source/filter/lotus/lotimpop.cxx
@@ -108,21 +108,21 @@ void ImportLotus::Columnwidth( sal_uInt16 nRecLen )
if( !pD->HasTable( static_cast<SCTAB> (nLTab) ) )
pD->MakeTable( static_cast<SCTAB> (nLTab) );
- if( !nWindow2 )
- {
- Skip( 2 );
+ if( nWindow2 )
+ return;
- sal_uInt8 nCol, nSpaces;
+ Skip( 2 );
- while( nCnt )
- {
- Read( nCol );
- Read( nSpaces );
- // Attention: ambiguous Correction factor!
- pD->SetColWidth( static_cast<SCCOL> (nCol), static_cast<SCTAB> (nLTab), static_cast<sal_uInt16>( TWIPS_PER_CHAR * 1.28 * nSpaces ) );
+ sal_uInt8 nCol, nSpaces;
- nCnt--;
- }
+ while( nCnt )
+ {
+ Read( nCol );
+ Read( nSpaces );
+ // Attention: ambiguous Correction factor!
+ pD->SetColWidth( static_cast<SCCOL> (nCol), static_cast<SCTAB> (nLTab), static_cast<sal_uInt16>( TWIPS_PER_CHAR * 1.28 * nSpaces ) );
+
+ nCnt--;
}
}
@@ -136,19 +136,19 @@ void ImportLotus::Hiddencolumn( sal_uInt16 nRecLen )
Read( nLTab );
Read( nWindow2 );
- if( !nWindow2 )
- {
- Skip( 2 );
+ if( nWindow2 )
+ return;
- sal_uInt8 nCol;
+ Skip( 2 );
- while( nCnt )
- {
- Read( nCol );
+ sal_uInt8 nCol;
- pD->SetColHidden(static_cast<SCCOL>(nCol), static_cast<SCCOL>(nCol), static_cast<SCTAB>(nLTab), true);
- nCnt--;
- }
+ while( nCnt )
+ {
+ Read( nCol );
+
+ pD->SetColHidden(static_cast<SCCOL>(nCol), static_cast<SCCOL>(nCol), static_cast<SCTAB>(nLTab), true);
+ nCnt--;
}
}
diff --git a/sc/source/filter/lotus/op.cxx b/sc/source/filter/lotus/op.cxx
index 73713508a568..59e4fb1a4b7f 100644
--- a/sc/source/filter/lotus/op.cxx
+++ b/sc/source/filter/lotus/op.cxx
@@ -170,22 +170,22 @@ void OP_ColumnWidth(LotusContext& rContext, SvStream& r, sal_uInt16 /*n*/)
r.ReadUInt16(nTmpCol).ReadUChar(nWidthSpaces);
SCCOL nCol(static_cast<SCCOL>(nTmpCol));
- if (rContext.pDoc->ValidCol(nCol))
- {
- nCol = rContext.pDoc->SanitizeCol(nCol);
+ if (!rContext.pDoc->ValidCol(nCol))
+ return;
- sal_uInt16 nBreite;
- if( nWidthSpaces )
- // assuming 10cpi character set
- nBreite = static_cast<sal_uInt16>( TWIPS_PER_CHAR * nWidthSpaces );
- else
- {
- rContext.pDoc->SetColHidden(nCol, nCol, 0, true);
- nBreite = nDefWidth;
- }
+ nCol = rContext.pDoc->SanitizeCol(nCol);
- rContext.pDoc->SetColWidth(nCol, 0, nBreite);
+ sal_uInt16 nBreite;
+ if( nWidthSpaces )
+ // assuming 10cpi character set
+ nBreite = static_cast<sal_uInt16>( TWIPS_PER_CHAR * nWidthSpaces );
+ else
+ {
+ rContext.pDoc->SetColHidden(nCol, nCol, 0, true);
+ nBreite = nDefWidth;
}
+
+ rContext.pDoc->SetColWidth(nCol, 0, nBreite);
}
void OP_NamedRange(LotusContext& rContext, SvStream& r, sal_uInt16 /*n*/)
@@ -199,31 +199,31 @@ void OP_NamedRange(LotusContext& rContext, SvStream& r, sal_uInt16 /*n*/)
r.ReadUInt16( nColSt ).ReadUInt16( nRowSt ).ReadUInt16( nColEnd ).ReadUInt16( nRowEnd );
- if (rContext.pDoc->ValidColRow( static_cast<SCCOL>(nColSt), nRowSt) && rContext.pDoc->ValidColRow( static_cast<SCCOL>(nColEnd), nRowEnd))
- {
- std::unique_ptr<LotusRange> pRange;
-
- if( nColSt == nColEnd && nRowSt == nRowEnd )
- pRange.reset(new LotusRange( static_cast<SCCOL> (nColSt), static_cast<SCROW> (nRowSt) ));
- else
- pRange.reset(new LotusRange( static_cast<SCCOL> (nColSt), static_cast<SCROW> (nRowSt),
- static_cast<SCCOL> (nColEnd), static_cast<SCROW> (nRowEnd) ));
-
- char cBuf[sizeof(cBuffer)+1];
- if( rtl::isAsciiDigit( static_cast<unsigned char>(*cBuffer) ) )
- { // first char in name is a number -> prepend 'A'
- cBuf[0] = 'A';
- strcpy( cBuf + 1, cBuffer ); // #100211# - checked
- }
- else
- strcpy( cBuf, cBuffer ); // #100211# - checked
+ if (!(rContext.pDoc->ValidColRow( static_cast<SCCOL>(nColSt), nRowSt) && rContext.pDoc->ValidColRow( static_cast<SCCOL>(nColEnd), nRowEnd)))
+ return;
- OUString aTmp( cBuf, strlen(cBuf), rContext.eCharset );
+ std::unique_ptr<LotusRange> pRange;
- aTmp = ScfTools::ConvertToScDefinedName( aTmp );
+ if( nColSt == nColEnd && nRowSt == nRowEnd )
+ pRange.reset(new LotusRange( static_cast<SCCOL> (nColSt), static_cast<SCROW> (nRowSt) ));
+ else
+ pRange.reset(new LotusRange( static_cast<SCCOL> (nColSt), static_cast<SCROW> (nRowSt),
+ static_cast<SCCOL> (nColEnd), static_cast<SCROW> (nRowEnd) ));
- rContext.maRangeNames.Append( rContext.pDoc, std::move(pRange) );
+ char cBuf[sizeof(cBuffer)+1];
+ if( rtl::isAsciiDigit( static_cast<unsigned char>(*cBuffer) ) )
+ { // first char in name is a number -> prepend 'A'
+ cBuf[0] = 'A';
+ strcpy( cBuf + 1, cBuffer ); // #100211# - checked
}
+ else
+ strcpy( cBuf, cBuffer ); // #100211# - checked
+
+ OUString aTmp( cBuf, strlen(cBuf), rContext.eCharset );
+
+ aTmp = ScfTools::ConvertToScDefinedName( aTmp );
+
+ rContext.maRangeNames.Append( rContext.pDoc, std::move(pRange) );
}
void OP_SymphNamedRange(LotusContext& rContext, SvStream& r, sal_uInt16 /*n*/)
@@ -238,30 +238,30 @@ void OP_SymphNamedRange(LotusContext& rContext, SvStream& r, sal_uInt16 /*n*/)
r.ReadUInt16( nColSt ).ReadUInt16( nRowSt ).ReadUInt16( nColEnd ).ReadUInt16( nRowEnd ).ReadUChar( nType );
- if (rContext.pDoc->ValidColRow( static_cast<SCCOL>(nColSt), nRowSt) && rContext.pDoc->ValidColRow( static_cast<SCCOL>(nColEnd), nRowEnd))
- {
- std::unique_ptr<LotusRange> pRange;
-
- if( nType )
- pRange.reset(new LotusRange( static_cast<SCCOL> (nColSt), static_cast<SCROW> (nRowSt) ));
- else
- pRange.reset(new LotusRange( static_cast<SCCOL> (nColSt), static_cast<SCROW> (nRowSt),
- static_cast<SCCOL> (nColEnd), static_cast<SCROW> (nRowEnd) ));
-
- char cBuf[sizeof(cBuffer)+1];
- if( rtl::isAsciiDigit( static_cast<unsigned char>(*cBuffer) ) )
- { // first char in name is a number -> prepend 'A'
- cBuf[0] = 'A';
- strcpy( cBuf + 1, cBuffer ); // #100211# - checked
- }
- else
- strcpy( cBuf, cBuffer ); // #100211# - checked
+ if (!(rContext.pDoc->ValidColRow( static_cast<SCCOL>(nColSt), nRowSt) && rContext.pDoc->ValidColRow( static_cast<SCCOL>(nColEnd), nRowEnd)))
+ return;
+
+ std::unique_ptr<LotusRange> pRange;
- OUString aTmp( cBuf, strlen(cBuf), rContext.eCharset );
- aTmp = ScfTools::ConvertToScDefinedName( aTmp );
+ if( nType )
+ pRange.reset(new LotusRange( static_cast<SCCOL> (nColSt), static_cast<SCROW> (nRowSt) ));
+ else
+ pRange.reset(new LotusRange( static_cast<SCCOL> (nColSt), static_cast<SCROW> (nRowSt),
+ static_cast<SCCOL> (nColEnd), static_cast<SCROW> (nRowEnd) ));
- rContext.maRangeNames.Append( rContext.pDoc, std::move(pRange) );
+ char cBuf[sizeof(cBuffer)+1];
+ if( rtl::isAsciiDigit( static_cast<unsigned char>(*cBuffer) ) )
+ { // first char in name is a number -> prepend 'A'
+ cBuf[0] = 'A';
+ strcpy( cBuf + 1, cBuffer ); // #100211# - checked
}
+ else
+ strcpy( cBuf, cBuffer ); // #100211# - checked
+
+ OUString aTmp( cBuf, strlen(cBuf), rContext.eCharset );
+ aTmp = ScfTools::ConvertToScDefinedName( aTmp );
+
+ rContext.maRangeNames.Append( rContext.pDoc, std::move(pRange) );
}
void OP_Footer(LotusContext& /*rContext*/, SvStream& r, sal_uInt16 n)
diff --git a/sc/source/filter/rtf/eeimpars.cxx b/sc/source/filter/rtf/eeimpars.cxx
index 2c7e79b4f4a6..b2bc46c8ab0c 100644
--- a/sc/source/filter/rtf/eeimpars.cxx
+++ b/sc/source/filter/rtf/eeimpars.cxx
@@ -461,19 +461,19 @@ void ScEEImport::WriteToDocument( bool bSizeColsRows, double nOutputFactor, SvNu
}
}
}
- if ( bHasGraphics )
+ if ( !bHasGraphics )
+ return;
+
+ // Insert graphics
+ for ( size_t i = 0, nListSize = mpParser->ListSize(); i < nListSize; ++i )
{
- // Insert graphics
- for ( size_t i = 0, nListSize = mpParser->ListSize(); i < nListSize; ++i )
+ pE = mpParser->ListEntry( i );
+ if ( !pE->maImageList.empty() )
{
- pE = mpParser->ListEntry( i );
- if ( !pE->maImageList.empty() )
- {
- SCCOL nCol = pE->nCol;
- SCROW nRow = pE->nRow;
- if ( mpDoc->ValidCol(nCol) && mpDoc->ValidRow(nRow) )
- InsertGraphic( nCol, nRow, nTab, pE );
- }
+ SCCOL nCol = pE->nCol;
+ SCROW nRow = pE->nRow;
+ if ( mpDoc->ValidCol(nCol) && mpDoc->ValidRow(nRow) )
+ InsertGraphic( nCol, nRow, nTab, pE );
}
}
}
diff --git a/sc/source/filter/rtf/rtfparse.cxx b/sc/source/filter/rtf/rtfparse.cxx
index a0f4d4c758fb..3fe14db20929 100644
--- a/sc/source/filter/rtf/rtfparse.cxx
+++ b/sc/source/filter/rtf/rtfparse.cxx
@@ -124,30 +124,30 @@ bool ScRTFParser::SeekTwips( sal_uInt16 nTwips, SCCOL* pCol )
void ScRTFParser::ColAdjust()
{
- if ( nStartAdjust != sal_uLong(~0) )
+ if ( nStartAdjust == sal_uLong(~0) )
+ return;
+
+ SCCOL nCol = 0;
+ for (size_t i = nStartAdjust, nListSize = maList.size(); i < nListSize; ++i)
{
- SCCOL nCol = 0;
- for (size_t i = nStartAdjust, nListSize = maList.size(); i < nListSize; ++i)
+ auto& pE = maList[i];
+ if ( pE->nCol == 0 )
+ nCol = 0;
+ pE->nCol = nCol;
+ if ( pE->nColOverlap > 1 )
+ nCol = nCol + pE->nColOverlap; // Merged cells with \clmrg
+ else
{
- auto& pE = maList[i];
- if ( pE->nCol == 0 )
- nCol = 0;
- pE->nCol = nCol;
- if ( pE->nColOverlap > 1 )
- nCol = nCol + pE->nColOverlap; // Merged cells with \clmrg
- else
- {
- SeekTwips( pE->nTwips, &nCol );
- if ( ++nCol <= pE->nCol )
- nCol = pE->nCol + 1; // Moved cell X
- pE->nColOverlap = nCol - pE->nCol; // Merged cells without \clmrg
- }
- if ( nCol > nColMax )
- nColMax = nCol;
+ SeekTwips( pE->nTwips, &nCol );
+ if ( ++nCol <= pE->nCol )
+ nCol = pE->nCol + 1; // Moved cell X
+ pE->nColOverlap = nCol - pE->nCol; // Merged cells without \clmrg
}
- nStartAdjust = sal_uLong(~0);
- aColTwips.clear();
+ if ( nCol > nColMax )
+ nColMax = nCol;
}
+ nStartAdjust = sal_uLong(~0);
+ aColTwips.clear();
}
IMPL_LINK( ScRTFParser, RTFImportHdl, RtfImportInfo&, rInfo, void )
diff --git a/sc/source/filter/xcl97/XclExpChangeTrack.cxx b/sc/source/filter/xcl97/XclExpChangeTrack.cxx
index e80aed2267da..bfb16a9d14c3 100644
--- a/sc/source/filter/xcl97/XclExpChangeTrack.cxx
+++ b/sc/source/filter/xcl97/XclExpChangeTrack.cxx
@@ -1597,19 +1597,19 @@ void XclExpChangeTrack::Write()
if (maRecList.empty())
return;
- if( WriteUserNamesStream() )
+ if( !WriteUserNamesStream() )
+ return;
+
+ tools::SvRef<SotStorageStream> xSvStrm = OpenStream( EXC_STREAM_REVLOG );
+ OSL_ENSURE( xSvStrm.is(), "XclExpChangeTrack::Write - no stream" );
+ if( xSvStrm.is() )
{
- tools::SvRef<SotStorageStream> xSvStrm = OpenStream( EXC_STREAM_REVLOG );
- OSL_ENSURE( xSvStrm.is(), "XclExpChangeTrack::Write - no stream" );
- if( xSvStrm.is() )
- {
- XclExpStream aXclStrm( *xSvStrm, GetRoot(), EXC_MAXRECSIZE_BIFF8 + 8 );
+ XclExpStream aXclStrm( *xSvStrm, GetRoot(), EXC_MAXRECSIZE_BIFF8 + 8 );
- for(const auto& rxRec : maRecList)
- rxRec->Save(aXclStrm);
+ for(const auto& rxRec : maRecList)
+ rxRec->Save(aXclStrm);
- xSvStrm->Commit();
- }
+ xSvStrm->Commit();
}
}
diff --git a/sc/source/filter/xcl97/XclImpChangeTrack.cxx b/sc/source/filter/xcl97/XclImpChangeTrack.cxx
index d2f85df7bb6f..6157de77435f 100644
--- a/sc/source/filter/xcl97/XclImpChangeTrack.cxx
+++ b/sc/source/filter/xcl97/XclImpChangeTrack.cxx
@@ -49,22 +49,22 @@ XclImpChangeTrack::XclImpChangeTrack( const XclImpRoot& rRoot, const XclImpStrea
return;
xInStrm = OpenStream( EXC_STREAM_REVLOG );
- if( xInStrm.is() )
+ if( !xInStrm.is() )
+ return;
+
+ xInStrm->Seek( STREAM_SEEK_TO_END );
+ sal_uInt64 const nStreamLen = xInStrm->Tell();
+ if( (xInStrm->GetErrorCode() == ERRCODE_NONE) && (nStreamLen != STREAM_SEEK_TO_END) )
{
- xInStrm->Seek( STREAM_SEEK_TO_END );
- sal_uInt64 const nStreamLen = xInStrm->Tell();
- if( (xInStrm->GetErrorCode() == ERRCODE_NONE) && (nStreamLen != STREAM_SEEK_TO_END) )
- {
- xInStrm->Seek( STREAM_SEEK_TO_BEGIN );
- pStrm.reset( new XclImpStream( *xInStrm, GetRoot() ) );
- pStrm->CopyDecrypterFrom( rBookStrm );
- pChangeTrack.reset(new ScChangeTrack( &GetDoc() ));
+ xInStrm->Seek( STREAM_SEEK_TO_BEGIN );
+ pStrm.reset( new XclImpStream( *xInStrm, GetRoot() ) );
+ pStrm->CopyDecrypterFrom( rBookStrm );
+ pChangeTrack.reset(new ScChangeTrack( &GetDoc() ));
- sOldUsername = pChangeTrack->GetUser();
- pChangeTrack->SetUseFixDateTime( true );
+ sOldUsername = pChangeTrack->GetUser();
+ pChangeTrack->SetUseFixDateTime( true );
- ReadRecords();
- }
+ ReadRecords();
}
}
@@ -284,40 +284,40 @@ void XclImpChangeTrack::ReadCell(
void XclImpChangeTrack::ReadChTrInsert()
{
*pStrm >> aRecHeader;
- if( CheckRecord( EXC_CHTR_OP_UNKNOWN ) )
+ if( !CheckRecord( EXC_CHTR_OP_UNKNOWN ) )
+ return;
+
+ if( (aRecHeader.nOpCode != EXC_CHTR_OP_INSROW) &&
+ (aRecHeader.nOpCode != EXC_CHTR_OP_INSCOL) &&
+ (aRecHeader.nOpCode != EXC_CHTR_OP_DELROW) &&
+ (aRecHeader.nOpCode != EXC_CHTR_OP_DELCOL) )
{
- if( (aRecHeader.nOpCode != EXC_CHTR_OP_INSROW) &&
- (aRecHeader.nOpCode != EXC_CHTR_OP_INSCOL) &&
- (aRecHeader.nOpCode != EXC_CHTR_OP_DELROW) &&
- (aRecHeader.nOpCode != EXC_CHTR_OP_DELCOL) )
- {
- OSL_FAIL( "XclImpChangeTrack::ReadChTrInsert - unknown action" );
- return;
- }
+ OSL_FAIL( "XclImpChangeTrack::ReadChTrInsert - unknown action" );
+ return;
+ }
- ScRange aRange;
- aRange.aStart.SetTab( ReadTabNum() );
- aRange.aEnd.SetTab( aRange.aStart.Tab() );
- sal_uInt16 nFlags = pStrm->ReaduInt16();
- bool bEndOfList = (nFlags & 0x0001); // row auto-inserted at the bottom.
- Read2DRange( aRange );
+ ScRange aRange;
+ aRange.aStart.SetTab( ReadTabNum() );
+ aRange.aEnd.SetTab( aRange.aStart.Tab() );
+ sal_uInt16 nFlags = pStrm->ReaduInt16();
+ bool bEndOfList = (nFlags & 0x0001); // row auto-inserted at the bottom.
+ Read2DRange( aRange );
- if( aRecHeader.nOpCode & EXC_CHTR_OP_COLFLAG )
- aRange.aEnd.SetRow( GetDocImport().getDoc().MaxRow() );
- else
- aRange.aEnd.SetCol( GetDocImport().getDoc().MaxCol() );
+ if( aRecHeader.nOpCode & EXC_CHTR_OP_COLFLAG )
+ aRange.aEnd.SetRow( GetDocImport().getDoc().MaxRow() );
+ else
+ aRange.aEnd.SetCol( GetDocImport().getDoc().MaxCol() );
- bool bValid = pStrm->IsValid();
- if( FoundNestedMode() )
- ReadNestedRecords();
+ bool bValid = pStrm->IsValid();
+ if( FoundNestedMode() )
+ ReadNestedRecords();
- if( bValid )
- {
- if( aRecHeader.nOpCode & EXC_CHTR_OP_DELFLAG )
- DoDeleteRange( aRange );
- else
- DoInsertRange(aRange, bEndOfList);
- }
+ if( bValid )
+ {
+ if( aRecHeader.nOpCode & EXC_CHTR_OP_DELFLAG )
+ DoDeleteRange( aRange );
+ else
+ DoInsertRange(aRange, bEndOfList);
}
}
@@ -342,49 +342,49 @@ void XclImpChangeTrack::ReadChTrInfo()
void XclImpChangeTrack::ReadChTrCellContent()
{
*pStrm >> aRecHeader;
- if( CheckRecord( EXC_CHTR_OP_CELL ) )
+ if( !CheckRecord( EXC_CHTR_OP_CELL ) )
+ return;
+
+ ScAddress aPosition;
+ SCTAB nTab = ReadTabNum();
+ aPosition.SetTab( nTab );
+ sal_uInt16 nValueType;
+ nValueType = pStrm->ReaduInt16();
+ sal_uInt16 nOldValueType = (nValueType >> 3) & EXC_CHTR_TYPE_MASK;
+ sal_uInt16 nNewValueType = nValueType & EXC_CHTR_TYPE_MASK;
+ pStrm->Ignore( 2 );
+ Read2DAddress( aPosition );
+ sal_uInt16 nOldSize;
+ nOldSize = pStrm->ReaduInt16();
+ SAL_WARN_IF( (nOldSize == 0) != (nOldValueType == EXC_CHTR_TYPE_EMPTY),
+ "sc.filter",
+ "XclImpChangeTrack::ReadChTrCellContent - old value mismatch" );
+ pStrm->Ignore( 4 );
+ switch( nValueType & EXC_CHTR_TYPE_FORMATMASK )
{
- ScAddress aPosition;
- SCTAB nTab = ReadTabNum();
- aPosition.SetTab( nTab );
- sal_uInt16 nValueType;
- nValueType = pStrm->ReaduInt16();
- sal_uInt16 nOldValueType = (nValueType >> 3) & EXC_CHTR_TYPE_MASK;
- sal_uInt16 nNewValueType = nValueType & EXC_CHTR_TYPE_MASK;
- pStrm->Ignore( 2 );
- Read2DAddress( aPosition );
- sal_uInt16 nOldSize;
- nOldSize = pStrm->ReaduInt16();
- SAL_WARN_IF( (nOldSize == 0) != (nOldValueType == EXC_CHTR_TYPE_EMPTY),
- "sc.filter",
- "XclImpChangeTrack::ReadChTrCellContent - old value mismatch" );
- pStrm->Ignore( 4 );
- switch( nValueType & EXC_CHTR_TYPE_FORMATMASK )
- {
- case 0x0000: break;
- case 0x1100: pStrm->Ignore( 16 ); break;
- case 0x1300: pStrm->Ignore( 8 ); break;
- default: OSL_FAIL( "XclImpChangeTrack::ReadChTrCellContent - unknown format info" );
- }
+ case 0x0000: break;
+ case 0x1100: pStrm->Ignore( 16 ); break;
+ case 0x1300: pStrm->Ignore( 8 ); break;
+ default: OSL_FAIL( "XclImpChangeTrack::ReadChTrCellContent - unknown format info" );
+ }
- ScCellValue aOldCell;
- ScCellValue aNewCell;
- sal_uInt32 nOldFormat;
- sal_uInt32 nNewFormat;
- ReadCell(aOldCell, nOldFormat, nOldValueType, aPosition);
- ReadCell(aNewCell, nNewFormat, nNewValueType, aPosition);
- if( !pStrm->IsValid() || (pStrm->GetRecLeft() > 0) )
- {
- OSL_FAIL( "XclImpChangeTrack::ReadChTrCellContent - bytes left, action ignored" );
- aOldCell.clear();
- aNewCell.clear();
- }
- else
- {
- ScChangeActionContent* pNewAction =
- pChangeTrack->AppendContentOnTheFly(aPosition, aOldCell, aNewCell, nOldFormat, nNewFormat);
- DoAcceptRejectAction( pNewAction );
- }
+ ScCellValue aOldCell;
+ ScCellValue aNewCell;
+ sal_uInt32 nOldFormat;
+ sal_uInt32 nNewFormat;
+ ReadCell(aOldCell, nOldFormat, nOldValueType, aPosition);
+ ReadCell(aNewCell, nNewFormat, nNewValueType, aPosition);
+ if( !pStrm->IsValid() || (pStrm->GetRecLeft() > 0) )
+ {
+ OSL_FAIL( "XclImpChangeTrack::ReadChTrCellContent - bytes left, action ignored" );
+ aOldCell.clear();
+ aNewCell.clear();
+ }
+ else
+ {
+ ScChangeActionContent* pNewAction =
+ pChangeTrack->AppendContentOnTheFly(aPosition, aOldCell, aNewCell, nOldFormat, nNewFormat);
+ DoAcceptRejectAction( pNewAction );
}
}
@@ -397,26 +397,26 @@ void XclImpChangeTrack::ReadChTrTabId()
void XclImpChangeTrack::ReadChTrMoveRange()
{
*pStrm >> aRecHeader;
- if( CheckRecord( EXC_CHTR_OP_MOVE ) )
+ if( !CheckRecord( EXC_CHTR_OP_MOVE ) )
+ return;
+
+ ScRange aSourceRange;
+ ScRange aDestRange;
+ aDestRange.aStart.SetTab( ReadTabNum() );
+ aDestRange.aEnd.SetTab( aDestRange.aStart.Tab() );
+ Read2DRange( aSourceRange );
+ Read2DRange( aDestRange );
+ aSourceRange.aStart.SetTab( ReadTabNum() );
+ aSourceRange.aEnd.SetTab( aSourceRange.aStart.Tab() );
+
+ bool bValid = pStrm->IsValid();
+ if( FoundNestedMode() )
+ ReadNestedRecords();
+
+ if( bValid )
{
- ScRange aSourceRange;
- ScRange aDestRange;
- aDestRange.aStart.SetTab( ReadTabNum() );
- aDestRange.aEnd.SetTab( aDestRange.aStart.Tab() );
- Read2DRange( aSourceRange );
- Read2DRange( aDestRange );
- aSourceRange.aStart.SetTab( ReadTabNum() );
- aSourceRange.aEnd.SetTab( aSourceRange.aStart.Tab() );
-
- bool bValid = pStrm->IsValid();
- if( FoundNestedMode() )
- ReadNestedRecords();
-
- if( bValid )
- {
- pChangeTrack->AppendMove( aSourceRange, aDestRange, nullptr );
- DoAcceptRejectAction( pChangeTrack->GetLast() );
- }
+ pChangeTrack->AppendMove( aSourceRange, aDestRange, nullptr );
+ DoAcceptRejectAction( pChangeTrack->GetLast() );
}
}
diff --git a/sc/source/filter/xcl97/xcl97esc.cxx b/sc/source/filter/xcl97/xcl97esc.cxx
index 8af611f4315a..97129cdda671 100644
--- a/sc/source/filter/xcl97/xcl97esc.cxx
+++ b/sc/source/filter/xcl97/xcl97esc.cxx
@@ -447,7 +447,10 @@ std::unique_ptr<XclExpTbxControlObj> XclEscherEx::CreateTBXCtrlObj( Reference< X
void XclEscherEx::ConvertTbxMacro( XclExpTbxControlObj& rTbxCtrlObj, Reference< XControlModel > const & xCtrlModel )
{
SdrPage* pSdrPage = GetSdrPage( GetCurrScTab() );
- if( xCtrlModel.is() && GetDocShell() && pSdrPage ) try
+ if( !(xCtrlModel.is() && GetDocShell() && pSdrPage) )
+ return;
+
+ try
{
Reference< XFormsSupplier > xFormsSupplier( pSdrPage->getUnoPage(), UNO_QUERY_THROW );
Reference< XIndexAccess > xFormsIA( xFormsSupplier->getForms(), UNO_QUERY_THROW );
diff --git a/sc/source/filter/xcl97/xcl97rec.cxx b/sc/source/filter/xcl97/xcl97rec.cxx
index c4037caa6848..213dfe77d4ae 100644
--- a/sc/source/filter/xcl97/xcl97rec.cxx
+++ b/sc/source/filter/xcl97/xcl97rec.cxx
@@ -499,24 +499,24 @@ void XclObj::Save( XclExpStream& rStrm )
void XclObj::WriteSubRecs( XclExpStream& rStrm )
{
- if( mnObjType == EXC_OBJTYPE_NOTE )
- {
- // FtNts subrecord
- AddRecSize( 26 );
- // ft, cb
- rStrm << EXC_ID_OBJNTS << sal_uInt16(0x0016);
- sal_uInt8 aGUID[16];
- rtl_createUuid( aGUID, nullptr, false );
- // guid
- rStrm.SetSliceSize( 16 );
- for( int i = 0; i < 16; i++ )
- rStrm << aGUID[i];
- rStrm.SetSliceSize( 0 );
- // fSharedNote
- rStrm << sal_uInt16(0);
- // unused
- rStrm.WriteZeroBytes( 4 );
- }
+ if( mnObjType != EXC_OBJTYPE_NOTE )
+ return;
+
+ // FtNts subrecord
+ AddRecSize( 26 );
+ // ft, cb
+ rStrm << EXC_ID_OBJNTS << sal_uInt16(0x0016);
+ sal_uInt8 aGUID[16];
+ rtl_createUuid( aGUID, nullptr, false );
+ // guid
+ rStrm.SetSliceSize( 16 );
+ for( int i = 0; i < 16; i++ )
+ rStrm << aGUID[i];
+ rStrm.SetSliceSize( 0 );
+ // fSharedNote
+ rStrm << sal_uInt16(0);
+ // unused
+ rStrm.WriteZeroBytes( 4 );
}
void XclObj::SaveTextRecs( XclExpStream& rStrm )
@@ -890,35 +890,35 @@ XclTxo::XclTxo( const XclExpRoot& rRoot, const EditTextObject& rEditObj, SdrObje
mnHorAlign( EXC_OBJ_HOR_LEFT ),
mnVerAlign( EXC_OBJ_VER_TOP )
{
- if(pCaption)
+ if(!pCaption)
+ return;
+
+ // Excel has one alignment per NoteObject while Calc supports
+ // one alignment per paragraph - use the first paragraph
+ // alignment (if set) as our overall alignment.
+ OUString aParaText( rEditObj.GetText( 0 ) );
+ if( !aParaText.isEmpty() )
{
- // Excel has one alignment per NoteObject while Calc supports
- // one alignment per paragraph - use the first paragraph
- // alignment (if set) as our overall alignment.
- OUString aParaText( rEditObj.GetText( 0 ) );
- if( !aParaText.isEmpty() )
+ const SfxItemSet& aSet( rEditObj.GetParaAttribs( 0));
+ const SfxPoolItem* pItem = nullptr;
+ if( aSet.GetItemState( EE_PARA_JUST, true, &pItem ) == SfxItemState::SET )
{
- const SfxItemSet& aSet( rEditObj.GetParaAttribs( 0));
- const SfxPoolItem* pItem = nullptr;
- if( aSet.GetItemState( EE_PARA_JUST, true, &pItem ) == SfxItemState::SET )
- {
- SvxAdjust eEEAlign = static_cast< const SvxAdjustItem& >( *pItem ).GetAdjust();
- pCaption->SetMergedItem( SvxAdjustItem( eEEAlign, EE_PARA_JUST ) );
- }
+ SvxAdjust eEEAlign = static_cast< const SvxAdjustItem& >( *pItem ).GetAdjust();
+ pCaption->SetMergedItem( SvxAdjustItem( eEEAlign, EE_PARA_JUST ) );
}
- const SfxItemSet& rItemSet = pCaption->GetMergedItemSet();
+ }
+ const SfxItemSet& rItemSet = pCaption->GetMergedItemSet();
- // horizontal alignment
- SetHorAlign( lcl_GetHorAlignFromItemSet( rItemSet ) );
+ // horizontal alignment
+ SetHorAlign( lcl_GetHorAlignFromItemSet( rItemSet ) );
- // vertical alignment
- SetVerAlign( lcl_GetVerAlignFromItemSet( rItemSet ) );
+ // vertical alignment
+ SetVerAlign( lcl_GetVerAlignFromItemSet( rItemSet ) );
- // orientation alignment
- const SvxWritingModeItem& rItem = rItemSet.Get( SDRATTR_TEXTDIRECTION );
- if( rItem.GetValue() == css::text::WritingMode_TB_RL )
- mnRotation = EXC_OBJ_ORIENT_90CW;
- }
+ // orientation alignment
+ const SvxWritingModeItem& rItem = rItemSet.Get( SDRATTR_TEXTDIRECTION );
+ if( rItem.GetValue() == css::text::WritingMode_TB_RL )
+ mnRotation = EXC_OBJ_ORIENT_90CW;
}
void XclTxo::SaveCont( XclExpStream& rStrm )
@@ -943,21 +943,21 @@ void XclTxo::Save( XclExpStream& rStrm )
ExcRecord::Save( rStrm );
// CONTINUE records are only written if there is some text
- if( !mpString->IsEmpty() )
- {
- // CONTINUE for character array
- rStrm.StartRecord( EXC_ID_CONT, mpString->GetBufferSize() + 1 );
- rStrm << static_cast< sal_uInt8 >( mpString->GetFlagField() & EXC_STRF_16BIT ); // only Unicode flag
- mpString->WriteBuffer( rStrm );
- rStrm.EndRecord();
-
- // CONTINUE for formatting runs
- rStrm.StartRecord( EXC_ID_CONT, 8 * mpString->GetFormatsCount() );
- const XclFormatRunVec& rFormats = mpString->GetFormats();
- for( const auto& rFormat : rFormats )
- rStrm << rFormat.mnChar << rFormat.mnFontIdx << sal_uInt32( 0 );
- rStrm.EndRecord();
- }
+ if( mpString->IsEmpty() )
+ return;
+
+ // CONTINUE for character array
+ rStrm.StartRecord( EXC_ID_CONT, mpString->GetBufferSize() + 1 );
+ rStrm << static_cast< sal_uInt8 >( mpString->GetFlagField() & EXC_STRF_16BIT ); // only Unicode flag
+ mpString->WriteBuffer( rStrm );
+ rStrm.EndRecord();
+
+ // CONTINUE for formatting runs
+ rStrm.StartRecord( EXC_ID_CONT, 8 * mpString->GetFormatsCount() );
+ const XclFormatRunVec& rFormats = mpString->GetFormats();
+ for( const auto& rFormat : rFormats )
+ rStrm << rFormat.mnChar << rFormat.mnFontIdx << sal_uInt32( 0 );
+ rStrm.EndRecord();
}
sal_uInt16 XclTxo::GetNum() const
@@ -993,59 +993,59 @@ void XclObjOle::WriteSubRecs( XclExpStream& rStrm )
sprintf( aBuf, "%08X", static_cast< unsigned int >( nPictureId ) );
aStorageName += OUString::createFromAscii(aBuf);
tools::SvRef<SotStorage> xOleStg = pRootStorage->OpenSotStorage( aStorageName );
- if( xOleStg.is() )
- {
- uno::Reference < embed::XEmbeddedObject > xObj( static_cast<const SdrOle2Obj&>(rOleObj).GetObjRef() );
- if ( xObj.is() )
- {
- // set version to "old" version, because it must be
- // saved in MS notation.
- sal_uInt32 nFl = 0;
- const SvtFilterOptions& rFltOpts = SvtFilterOptions::Get();
- if( rFltOpts.IsMath2MathType() )
- nFl |= OLE_STARMATH_2_MATHTYPE;
-
- if( rFltOpts.IsWriter2WinWord() )
- nFl |= OLE_STARWRITER_2_WINWORD;
-
- if( rFltOpts.IsCalc2Excel() )
- nFl |= OLE_STARCALC_2_EXCEL;
-
- if( rFltOpts.IsImpress2PowerPoint() )
- nFl |= OLE_STARIMPRESS_2_POWERPOINT;
-
- SvxMSExportOLEObjects aOLEExpFilt( nFl );
- aOLEExpFilt.ExportOLEObject( xObj, *xOleStg );
-
- // OBJCF subrecord, undocumented as usual
- rStrm.StartRecord( EXC_ID_OBJCF, 2 );
- rStrm << sal_uInt16(0x0002);
- rStrm.EndRecord();
-
- // OBJFLAGS subrecord, undocumented as usual
- rStrm.StartRecord( EXC_ID_OBJFLAGS, 2 );
- sal_uInt16 nFlags = EXC_OBJ_PIC_MANUALSIZE;
- ::set_flag( nFlags, EXC_OBJ_PIC_SYMBOL, static_cast<const SdrOle2Obj&>(rOleObj).GetAspect() == embed::Aspects::MSOLE_ICON );
- rStrm << nFlags;
- rStrm.EndRecord();
-
- // OBJPICTFMLA subrecord, undocumented as usual
- XclExpString aName( xOleStg->GetUserName() );
- sal_uInt16 nPadLen = static_cast<sal_uInt16>(aName.GetSize() & 0x01);
- sal_uInt16 nFmlaLen = static_cast< sal_uInt16 >( 12 + aName.GetSize() + nPadLen );
- sal_uInt16 nSubRecLen = nFmlaLen + 6;
-
- rStrm.StartRecord( EXC_ID_OBJPICTFMLA, nSubRecLen );
- rStrm << nFmlaLen
- << sal_uInt16( 5 ) << sal_uInt32( 0 ) << sal_uInt8( 2 )
- << sal_uInt32( 0 ) << sal_uInt8( 3 )
- << aName;
- if( nPadLen )
- rStrm << sal_uInt8( 0 ); // pad byte
- rStrm << nPictureId;
- rStrm.EndRecord();
- }
- }
+ if( !xOleStg.is() )
+ return;
+
+ uno::Reference < embed::XEmbeddedObject > xObj( static_cast<const SdrOle2Obj&>(rOleObj).GetObjRef() );
+ if ( !xObj.is() )
+ return;
+
+ // set version to "old" version, because it must be
+ // saved in MS notation.
+ sal_uInt32 nFl = 0;
+ const SvtFilterOptions& rFltOpts = SvtFilterOptions::Get();
+ if( rFltOpts.IsMath2MathType() )
+ nFl |= OLE_STARMATH_2_MATHTYPE;
+
+ if( rFltOpts.IsWriter2WinWord() )
+ nFl |= OLE_STARWRITER_2_WINWORD;
+
+ if( rFltOpts.IsCalc2Excel() )
+ nFl |= OLE_STARCALC_2_EXCEL;
+
+ if( rFltOpts.IsImpress2PowerPoint() )
+ nFl |= OLE_STARIMPRESS_2_POWERPOINT;
+
+ SvxMSExportOLEObjects aOLEExpFilt( nFl );
+ aOLEExpFilt.ExportOLEObject( xObj, *xOleStg );
+
+ // OBJCF subrecord, undocumented as usual
+ rStrm.StartRecord( EXC_ID_OBJCF, 2 );
+ rStrm << sal_uInt16(0x0002);
+ rStrm.EndRecord();
+
+ // OBJFLAGS subrecord, undocumented as usual
+ rStrm.StartRecord( EXC_ID_OBJFLAGS, 2 );
+ sal_uInt16 nFlags = EXC_OBJ_PIC_MANUALSIZE;
+ ::set_flag( nFlags, EXC_OBJ_PIC_SYMBOL, static_cast<const SdrOle2Obj&>(rOleObj).GetAspect() == embed::Aspects::MSOLE_ICON );
+ rStrm << nFlags;
+ rStrm.EndRecord();
+
+ // OBJPICTFMLA subrecord, undocumented as usual
+ XclExpString aName( xOleStg->GetUserName() );
+ sal_uInt16 nPadLen = static_cast<sal_uInt16>(aName.GetSize() & 0x01);
+ sal_uInt16 nFmlaLen = static_cast< sal_uInt16 >( 12 + aName.GetSize() + nPadLen );
+ sal_uInt16 nSubRecLen = nFmlaLen + 6;
+
+ rStrm.StartRecord( EXC_ID_OBJPICTFMLA, nSubRecLen );
+ rStrm << nFmlaLen
+ << sal_uInt16( 5 ) << sal_uInt32( 0 ) << sal_uInt8( 2 )
+ << sal_uInt32( 0 ) << sal_uInt8( 3 )
+ << aName;
+ if( nPadLen )
+ rStrm << sal_uInt8( 0 ); // pad byte
+ rStrm << nPictureId;
+ rStrm.EndRecord();
}
void XclObjOle::Save( XclExpStream& rStrm )
diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx
index 3ea2aef57ba3..0a4b11101acf 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -3857,52 +3857,52 @@ void ScXMLExport::WriteTableSource()
return;
sal_Int32 nCount(xIndex->getCount());
- if (nCount)
+ if (!nCount)
+ return;
+
+ bool bFound(false);
+ uno::Reference <beans::XPropertySet> xLinkProps;
+ for (sal_Int32 i = 0; (i < nCount) && !bFound; ++i)
{
- bool bFound(false);
- uno::Reference <beans::XPropertySet> xLinkProps;
- for (sal_Int32 i = 0; (i < nCount) && !bFound; ++i)
+ xLinkProps.set(xIndex->getByIndex(i), uno::UNO_QUERY);
+ if (xLinkProps.is())
{
- xLinkProps.set(xIndex->getByIndex(i), uno::UNO_QUERY);
- if (xLinkProps.is())
- {
- OUString sNewLink;
- if (xLinkProps->getPropertyValue(SC_UNONAME_LINKURL) >>= sNewLink)
- bFound = sLink == sNewLink;
- }
- }
- if (bFound && xLinkProps.is())
- {
- OUString sFilter;
- OUString sFilterOptions;
- OUString sTableName (xLinkable->getLinkSheetName());
- sal_Int32 nRefresh(0);
- xLinkProps->getPropertyValue(SC_UNONAME_FILTER) >>= sFilter;
- xLinkProps->getPropertyValue(SC_UNONAME_FILTOPT) >>= sFilterOptions;
- xLinkProps->getPropertyValue(SC_UNONAME_REFDELAY) >>= nRefresh;
- if (!sLink.isEmpty())
- {
- AddAttribute(XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE);
- AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, GetRelativeReference(sLink));
- if (!sTableName.isEmpty())
- AddAttribute(XML_NAMESPACE_TABLE, XML_TABLE_NAME, sTableName);
- if (!sFilter.isEmpty())
- AddAttribute(XML_NAMESPACE_TABLE, XML_FILTER_NAME, sFilter);
- if (!sFilterOptions.isEmpty())
- AddAttribute(XML_NAMESPACE_TABLE, XML_FILTER_OPTIONS, sFilterOptions);
- if (nMode != sheet::SheetLinkMode_NORMAL)
- AddAttribute(XML_NAMESPACE_TABLE, XML_MODE, XML_COPY_RESULTS_ONLY);
- if( nRefresh )
- {
- OUStringBuffer sBuffer;
- ::sax::Converter::convertDuration( sBuffer,
- static_cast<double>(nRefresh) / 86400 );
- AddAttribute( XML_NAMESPACE_TABLE, XML_REFRESH_DELAY, sBuffer.makeStringAndClear() );
- }
- SvXMLElementExport aSourceElem(*this, XML_NAMESPACE_TABLE, XML_TABLE_SOURCE, true, true);
- }
+ OUString sNewLink;
+ if (xLinkProps->getPropertyValue(SC_UNONAME_LINKURL) >>= sNewLink)
+ bFound = sLink == sNewLink;
}
}
+ if (!(bFound && xLinkProps.is()))
+ return;
+
+ OUString sFilter;
+ OUString sFilterOptions;
+ OUString sTableName (xLinkable->getLinkSheetName());
+ sal_Int32 nRefresh(0);
+ xLinkProps->getPropertyValue(SC_UNONAME_FILTER) >>= sFilter;
+ xLinkProps->getPropertyValue(SC_UNONAME_FILTOPT) >>= sFilterOptions;
+ xLinkProps->getPropertyValue(SC_UNONAME_REFDELAY) >>= nRefresh;
+ if (sLink.isEmpty())
+ return;
+
+ AddAttribute(XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE);
+ AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, GetRelativeReference(sLink));
+ if (!sTableName.isEmpty())
+ AddAttribute(XML_NAMESPACE_TABLE, XML_TABLE_NAME, sTableName);
+ if (!sFilter.isEmpty())
+ AddAttribute(XML_NAMESPACE_TABLE, XML_FILTER_NAME, sFilter);
+ if (!sFilterOptions.isEmpty())
+ AddAttribute(XML_NAMESPACE_TABLE, XML_FILTER_OPTIONS, sFilterOptions);
+ if (nMode != sheet::SheetLinkMode_NORMAL)
+ AddAttribute(XML_NAMESPACE_TABLE, XML_MODE, XML_COPY_RESULTS_ONLY);
+ if( nRefresh )
+ {
+ OUStringBuffer sBuffer;
+ ::sax::Converter::convertDuration( sBuffer,
+ static_cast<double>(nRefresh) / 86400 );
+ AddAttribute( XML_NAMESPACE_TABLE, XML_REFRESH_DELAY, sBuffer.makeStringAndClear() );
+ }
+ SvXMLElementExport aSourceElem(*this, XML_NAMESPACE_TABLE, XML_TABLE_SOURCE, true, true);
}
// core implementation