[Libreoffice-commits] core.git: emfio/source filter/qa filter/source include/sal include/tools sc/qa sc/source sd/qa sd/source sfx2/source sot/source starmath/source sw/qa sw/source tools/qa tools/source vcl/qa vcl/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Wed Jan 20 15:21:09 UTC 2021
emfio/source/emfuno/xemfparser.cxx | 2
filter/source/graphicfilter/ieps/ieps.cxx | 350 ++--
filter/source/graphicfilter/ios2met/ios2met.cxx | 3
filter/source/graphicfilter/ipcx/ipcx.cxx | 12
filter/source/graphicfilter/ipsd/ipsd.cxx | 13
filter/source/graphicfilter/itga/itga.cxx | 15
filter/source/msfilter/msdffimp.cxx | 20
filter/source/msfilter/svdfppt.cxx | 751 ++++-----
include/sal/log-areas.dox | 1
include/tools/stream.hxx | 7
sc/source/filter/excel/read.cxx | 1985 +++++++++++-------------
sc/source/filter/excel/xistream.cxx | 60
sc/source/filter/excel/xltoolbar.cxx | 9
sc/source/filter/lotus/lotread.cxx | 17
sc/source/filter/qpro/qpro.cxx | 21
sd/source/filter/ppt/pptin.cxx | 11
sfx2/source/doc/oleprops.cxx | 74
sot/source/sdstor/stg.cxx | 13
sot/source/sdstor/stgelem.cxx | 4
sot/source/sdstor/stgio.cxx | 12
starmath/source/mathtype.cxx | 50
sw/source/filter/html/htmlreqifreader.cxx | 89 -
tools/qa/cppunit/test_stream.cxx | 12
tools/source/stream/stream.cxx | 34
vcl/source/bitmap/dibtools.cxx | 17
vcl/source/filter/graphicfilter.cxx | 9
vcl/source/filter/graphicfilter2.cxx | 1229 ++++++--------
vcl/source/filter/itiff/itiff.cxx | 4
vcl/source/filter/png/pngread.cxx | 132 -
vcl/source/gdi/impgraph.cxx | 37
30 files changed, 2336 insertions(+), 2657 deletions(-)
New commits:
commit 4e639c37b4dcdc27d46111d0d0cbca966544c2cb
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon Jan 18 16:19:10 2021 +0000
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed Jan 20 16:20:25 2021 +0100
ofz#29691 revert throw SvStreamEOFException
reasonably sane code like
s.ReadUInt32(a).ReadUInt32(b).ReadUInt32(c).ReadUInt32(d);
if (s.good())
// use a, b, c d;
stopped working.
FWIW on a short read we retain whatever was in the variable before the
read, rather than overwrite it with new random data, so
sal_uInt32 a(0xdead); s.ReadUInt32(a); assert(s.good() || a == 0xdead);
the msoffice ppt/escher/xls/doc filters especially speculatively parse
and rely on a variables preinit value in the case of a short read.
commit b345a2bab0d6f981049951a86b172ce49ce7d4c2
cid#1470786 Uncaught exception
commit 71aec4726a94dcde1169fd293dbecfeb0e840e6d
ofz#29528 uncaught exception
commit bed03603f6cae264abb9e5b58aa2ab00448d92ff
ofz#29414 uncaught exception
commit 684885a99a1eb7ad943e9736166d4bb1468663be
ofz#29443 uncaught exception
commit 93574ac7768d247ed754ecda322e54e4bd447e43
ofz#29251 Abrt
commit 413db68d95bd39d34e6a6b81a7c5c9478ced0514
ofz#29152 short read
commit f400e883044143f999c460375a293647b4a57244
ofz#29151 short read
commit 96ea80a725dfe4ef38993f78917c243f13e3beb5
ofz#29129 Abrt on uncaught exception
commit 646a635efe6eecbc3d1dd3a7cbb02a278c6f3be5
ofz#28931 Indirect-leak
commit b0e573f18629d28fe3179c12d0d434653f92fc93
ofz#29030 Abrt in xlsfuzzer
commit 95407c39168d186ee44e67b1a6a4bcf592c58b84
ofz#28902 uncaught exception
commit 45175d655ad3773df1c006182108cf25e87b1091
oss-fuzz: tgafuzzer doesn't pass sanity check
commit b82fc702bae9d6190bda1b4818a47cfa197df6d8
oss-fuzz: psdfuzzer doesn't pass sanity check
commit e7c76d604a4694e6568bf10c2a06a786f1096319
oss-fuzz: epsfuzzer doesn't pass sanity check
commit 901e5e7c9170184e286ea3e46fce406136aa9572
oss-fuzz: xlsfuzzer doesn't pass sanity check
commit 127bfab61c297df06fd8e71e709bc4362cb89d21
oss-fuzz: pngfuzzer doesn't pass sanity check
commit 77387ae00ae27e3f8bcdf7bccf97fb2db8f196b7
oss-fuzz: mtpfuzzer doesn't pass sanity check
commit 974ffa79b0fef4ca76558bb8b16bce84af3aaf6c
oss-fuzz: xlsxfuzzer doesn't pass sanity check
commit 6d6d104cbb382d0045e1f04b12d268992fa5c624
oss-fuzz: bmpfuzzer doesn't pass sanity check
commit a7d1d107ec58d3b00b4019c89edddcff71ca6ff3
oss-fuzz: qpwfuzzer doesn't pass sanity check
commit 898993aa62276f59480df8af1da4bad530829b56
oss-fuzz: pcxfuzzer doesn't pass sanity check
throw/catch parts of
commit 8c9a4ff511a3b1d84a7a6d08a1b153c07f164abb
throw exception in SvStream when reading past end of file
Change-Id: Ic49c249768b17b64d8e868655dbc05b31906c2e6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109621
Tested-by: Jenkins
Tested-by: Caolán McNamara <caolanm at redhat.com>
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/emfio/source/emfuno/xemfparser.cxx b/emfio/source/emfuno/xemfparser.cxx
index 472f7ec9d358..7788802c4e1c 100644
--- a/emfio/source/emfuno/xemfparser.cxx
+++ b/emfio/source/emfuno/xemfparser.cxx
@@ -109,7 +109,7 @@ namespace emfio::emfreader
pStream->SetEndian(SvStreamEndian::LITTLE);
sal_uInt32 nMetaType(0);
- if (checkSeek(*pStream, 0x28) && pStream->remainingSize() >= 4)
+ if (checkSeek(*pStream, 0x28))
pStream->ReadUInt32(nMetaType);
pStream->Seek(nOrgPos);
diff --git a/filter/qa/cppunit/data/met/fail/hang-3.met b/filter/qa/cppunit/data/met/pass/hang-3.met
similarity index 100%
rename from filter/qa/cppunit/data/met/fail/hang-3.met
rename to filter/qa/cppunit/data/met/pass/hang-3.met
diff --git a/filter/source/graphicfilter/ieps/ieps.cxx b/filter/source/graphicfilter/ieps/ieps.cxx
index b70407027b7d..ed294f9ec1fb 100644
--- a/filter/source/graphicfilter/ieps/ieps.cxx
+++ b/filter/source/graphicfilter/ieps/ieps.cxx
@@ -596,233 +596,225 @@ ipsGraphicImport( SvStream & rStream, Graphic & rGraphic, FilterConfigItem* )
auto nOrigPos = nPSStreamPos = rStream.Tell();
SvStreamEndian nOldFormat = rStream.GetEndian();
- try
+ rStream.SetEndian( SvStreamEndian::LITTLE );
+ rStream.ReadUInt32( nSignature );
+ if ( nSignature == 0xc6d3d0c5 )
{
- rStream.SetEndian( SvStreamEndian::LITTLE );
- rStream.ReadUInt32( nSignature );
- if ( nSignature == 0xc6d3d0c5 )
- {
- rStream.ReadUInt32( nPSStreamPos ).ReadUInt32( nPSSize ).ReadUInt32( nPosWMF ).ReadUInt32( nSizeWMF );
+ rStream.ReadUInt32( nPSStreamPos ).ReadUInt32( nPSSize ).ReadUInt32( nPosWMF ).ReadUInt32( nSizeWMF );
- // first we try to get the metafile grafix
+ // first we try to get the metafile grafix
- if ( nSizeWMF )
+ if ( nSizeWMF )
+ {
+ if (nPosWMF && checkSeek(rStream, nOrigPos + nPosWMF))
{
- if (nPosWMF && checkSeek(rStream, nOrigPos + nPosWMF))
- {
- if (GraphicConverter::Import(rStream, aGraphic, ConvertDataFormat::WMF) == ERRCODE_NONE)
- bHasPreview = bRetValue = true;
- }
+ if (GraphicConverter::Import(rStream, aGraphic, ConvertDataFormat::WMF) == ERRCODE_NONE)
+ bHasPreview = bRetValue = true;
}
- else
- {
- rStream.ReadUInt32( nPosTIFF ).ReadUInt32( nSizeTIFF );
+ }
+ else
+ {
+ rStream.ReadUInt32( nPosTIFF ).ReadUInt32( nSizeTIFF );
- // else we have to get the tiff grafix
+ // else we have to get the tiff grafix
- if (nPosTIFF && nSizeTIFF && checkSeek(rStream, nOrigPos + nPosTIFF))
+ if (nPosTIFF && nSizeTIFF && checkSeek(rStream, nOrigPos + nPosTIFF))
+ {
+ if ( GraphicConverter::Import( rStream, aGraphic, ConvertDataFormat::TIF ) == ERRCODE_NONE )
{
- if ( GraphicConverter::Import( rStream, aGraphic, ConvertDataFormat::TIF ) == ERRCODE_NONE )
- {
- MakeAsMeta(aGraphic);
- rStream.Seek( nOrigPos + nPosTIFF );
- bHasPreview = bRetValue = true;
- }
+ MakeAsMeta(aGraphic);
+ rStream.Seek( nOrigPos + nPosTIFF );
+ bHasPreview = bRetValue = true;
}
}
}
- else
- {
- nPSStreamPos = nOrigPos; // no preview available _>so we must get the size manually
- nPSSize = rStream.Seek( STREAM_SEEK_TO_END ) - nOrigPos;
- }
+ }
+ else
+ {
+ nPSStreamPos = nOrigPos; // no preview available _>so we must get the size manually
+ nPSSize = rStream.Seek( STREAM_SEEK_TO_END ) - nOrigPos;
+ }
- std::unique_ptr<sal_uInt8[]> pHeader( new sal_uInt8[ 22 ] );
- rStream.Seek( nPSStreamPos );
- rStream.ReadBytes(pHeader.get(), 22); // check PostScript header
- bool bOk = ImplSearchEntry(pHeader.get(), reinterpret_cast<sal_uInt8 const *>("%!PS-Adobe"), 10, 10) &&
- ImplSearchEntry(&pHeader[ 15 ], reinterpret_cast<sal_uInt8 const *>("EPS"), 3, 3);
- if (bOk)
- {
- rStream.Seek(nPSStreamPos);
- bOk = rStream.remainingSize() >= nPSSize;
- SAL_WARN_IF(!bOk, "filter.eps", "eps claims to be: " << nPSSize << " in size, but only " << rStream.remainingSize() << " remains");
- }
- if (bOk)
- {
- std::unique_ptr<sal_uInt8[]> pBuf( new sal_uInt8[ nPSSize ] );
+ std::unique_ptr<sal_uInt8[]> pHeader( new sal_uInt8[ 22 ] );
+ rStream.Seek( nPSStreamPos );
+ rStream.ReadBytes(pHeader.get(), 22); // check PostScript header
+ bool bOk = ImplSearchEntry(pHeader.get(), reinterpret_cast<sal_uInt8 const *>("%!PS-Adobe"), 10, 10) &&
+ ImplSearchEntry(&pHeader[ 15 ], reinterpret_cast<sal_uInt8 const *>("EPS"), 3, 3);
+ if (bOk)
+ {
+ rStream.Seek(nPSStreamPos);
+ bOk = rStream.remainingSize() >= nPSSize;
+ SAL_WARN_IF(!bOk, "filter.eps", "eps claims to be: " << nPSSize << " in size, but only " << rStream.remainingSize() << " remains");
+ }
+ if (bOk)
+ {
+ std::unique_ptr<sal_uInt8[]> pBuf( new sal_uInt8[ nPSSize ] );
- sal_uInt32 nBufStartPos = rStream.Tell();
- sal_uInt32 nBytesRead = rStream.ReadBytes(pBuf.get(), nPSSize);
- if ( nBytesRead == nPSSize )
+ sal_uInt32 nBufStartPos = rStream.Tell();
+ sal_uInt32 nBytesRead = rStream.ReadBytes(pBuf.get(), nPSSize);
+ if ( nBytesRead == nPSSize )
+ {
+ sal_uInt32 nSecurityCount = 32;
+ // if there is no tiff/wmf preview, we will parse for a preview in
+ // the eps prolog
+ if (!bHasPreview && nBytesRead >= nSecurityCount)
{
- sal_uInt32 nSecurityCount = 32;
- // if there is no tiff/wmf preview, we will parse for a preview in
- // the eps prolog
- if (!bHasPreview && nBytesRead >= nSecurityCount)
+ sal_uInt8* pDest = ImplSearchEntry( pBuf.get(), reinterpret_cast<sal_uInt8 const *>("%%BeginPreview:"), nBytesRead - nSecurityCount, 15 );
+ sal_uInt32 nRemainingBytes = pDest ? (nBytesRead - (pDest - pBuf.get())) : 0;
+ if (nRemainingBytes >= 15)
{
- sal_uInt8* pDest = ImplSearchEntry( pBuf.get(), reinterpret_cast<sal_uInt8 const *>("%%BeginPreview:"), nBytesRead - nSecurityCount, 15 );
- sal_uInt32 nRemainingBytes = pDest ? (nBytesRead - (pDest - pBuf.get())) : 0;
- if (nRemainingBytes >= 15)
+ pDest += 15;
+ nSecurityCount = nRemainingBytes - 15;
+ tools::Long nWidth = ImplGetNumber(pDest, nSecurityCount);
+ tools::Long nHeight = ImplGetNumber(pDest, nSecurityCount);
+ tools::Long nBitDepth = ImplGetNumber(pDest, nSecurityCount);
+ tools::Long nScanLines = ImplGetNumber(pDest, nSecurityCount);
+ pDest = ImplSearchEntry(pDest, reinterpret_cast<sal_uInt8 const *>("%"), nSecurityCount, 1); // go to the first Scanline
+ bOk = pDest && nWidth > 0 && nHeight > 0 && ( ( nBitDepth == 1 ) || ( nBitDepth == 8 ) ) && nScanLines;
+ if (bOk)
{
- pDest += 15;
- nSecurityCount = nRemainingBytes - 15;
- tools::Long nWidth = ImplGetNumber(pDest, nSecurityCount);
- tools::Long nHeight = ImplGetNumber(pDest, nSecurityCount);
- tools::Long nBitDepth = ImplGetNumber(pDest, nSecurityCount);
- tools::Long nScanLines = ImplGetNumber(pDest, nSecurityCount);
- pDest = ImplSearchEntry(pDest, reinterpret_cast<sal_uInt8 const *>("%"), nSecurityCount, 1); // go to the first Scanline
- bOk = pDest && nWidth > 0 && nHeight > 0 && ( ( nBitDepth == 1 ) || ( nBitDepth == 8 ) ) && nScanLines;
- if (bOk)
- {
- tools::Long nResult;
- bOk = !o3tl::checked_multiply(nWidth, nHeight, nResult) && nResult <= SAL_MAX_INT32/2/3;
- }
- if (bOk)
- {
- rStream.Seek( nBufStartPos + ( pDest - pBuf.get() ) );
+ tools::Long nResult;
+ bOk = !o3tl::checked_multiply(nWidth, nHeight, nResult) && nResult <= SAL_MAX_INT32/2/3;
+ }
+ if (bOk)
+ {
+ rStream.Seek( nBufStartPos + ( pDest - pBuf.get() ) );
- vcl::bitmap::RawBitmap aBitmap( Size( nWidth, nHeight ), 24 );
+ vcl::bitmap::RawBitmap aBitmap( Size( nWidth, nHeight ), 24 );
+ {
+ bool bIsValid = true;
+ sal_uInt8 nDat = 0;
+ char nByte;
+ for (tools::Long y = 0; bIsValid && y < nHeight; ++y)
{
- bool bIsValid = true;
- sal_uInt8 nDat = 0;
- char nByte;
- for (tools::Long y = 0; bIsValid && y < nHeight; ++y)
+ int nBitsLeft = 0;
+ for (tools::Long x = 0; x < nWidth; ++x)
{
- int nBitsLeft = 0;
- for (tools::Long x = 0; x < nWidth; ++x)
+ if ( --nBitsLeft < 0 )
{
- if ( --nBitsLeft < 0 )
+ while ( bIsValid && ( nBitsLeft != 7 ) )
{
- while ( bIsValid && ( nBitsLeft != 7 ) )
+ rStream.ReadChar(nByte);
+ bIsValid = rStream.good();
+ if (!bIsValid)
+ break;
+ switch (nByte)
{
- rStream.ReadChar(nByte);
- bIsValid = rStream.good();
- if (!bIsValid)
+ case 0x0a :
+ if ( --nScanLines < 0 )
+ bIsValid = false;
break;
- switch (nByte)
+ case 0x09 :
+ case 0x0d :
+ case 0x20 :
+ case 0x25 :
+ break;
+ default:
{
- case 0x0a :
- if ( --nScanLines < 0 )
- bIsValid = false;
- break;
- case 0x09 :
- case 0x0d :
- case 0x20 :
- case 0x25 :
- break;
- default:
+ if ( nByte >= '0' )
{
- if ( nByte >= '0' )
+ if ( nByte > '9' )
{
- if ( nByte > '9' )
- {
- nByte &=~0x20; // case none sensitive for hexadecimal values
- nByte -= ( 'A' - 10 );
- if ( nByte > 15 )
- bIsValid = false;
- }
- else
- nByte -= '0';
- nBitsLeft += 4;
- nDat <<= 4;
- nDat |= ( nByte ^ 0xf ); // in epsi a zero bit represents white color
+ nByte &=~0x20; // case none sensitive for hexadecimal values
+ nByte -= ( 'A' - 10 );
+ if ( nByte > 15 )
+ bIsValid = false;
}
else
- bIsValid = false;
+ nByte -= '0';
+ nBitsLeft += 4;
+ nDat <<= 4;
+ nDat |= ( nByte ^ 0xf ); // in epsi a zero bit represents white color
}
- break;
+ else
+ bIsValid = false;
}
+ break;
}
}
- if (!bIsValid)
- break;
- if ( nBitDepth == 1 )
- aBitmap.SetPixel( y, x, Color(ColorTransparency, static_cast<sal_uInt8>(nDat >> nBitsLeft) & 1) );
- else
- {
- aBitmap.SetPixel( y, x, nDat ? COL_WHITE : COL_BLACK ); // nBitDepth == 8
- nBitsLeft = 0;
- }
+ }
+ if (!bIsValid)
+ break;
+ if ( nBitDepth == 1 )
+ aBitmap.SetPixel( y, x, Color(ColorTransparency, static_cast<sal_uInt8>(nDat >> nBitsLeft) & 1) );
+ else
+ {
+ aBitmap.SetPixel( y, x, nDat ? COL_WHITE : COL_BLACK ); // nBitDepth == 8
+ nBitsLeft = 0;
}
}
- if (bIsValid)
- {
- ScopedVclPtrInstance<VirtualDevice> pVDev;
- GDIMetaFile aMtf;
- Size aSize( nWidth, nHeight );
- pVDev->EnableOutput( false );
- aMtf.Record( pVDev );
- aSize = OutputDevice::LogicToLogic(aSize, MapMode(), MapMode(MapUnit::Map100thMM));
- pVDev->DrawBitmapEx( Point(), aSize, vcl::bitmap::CreateFromData(std::move(aBitmap)) );
- aMtf.Stop();
- aMtf.WindStart();
- aMtf.SetPrefMapMode(MapMode(MapUnit::Map100thMM));
- aMtf.SetPrefSize( aSize );
- aGraphic = aMtf;
- bHasPreview = bRetValue = true;
- }
+ }
+ if (bIsValid)
+ {
+ ScopedVclPtrInstance<VirtualDevice> pVDev;
+ GDIMetaFile aMtf;
+ Size aSize( nWidth, nHeight );
+ pVDev->EnableOutput( false );
+ aMtf.Record( pVDev );
+ aSize = OutputDevice::LogicToLogic(aSize, MapMode(), MapMode(MapUnit::Map100thMM));
+ pVDev->DrawBitmapEx( Point(), aSize, vcl::bitmap::CreateFromData(std::move(aBitmap)) );
+ aMtf.Stop();
+ aMtf.WindStart();
+ aMtf.SetPrefMapMode(MapMode(MapUnit::Map100thMM));
+ aMtf.SetPrefSize( aSize );
+ aGraphic = aMtf;
+ bHasPreview = bRetValue = true;
}
}
}
}
+ }
- sal_uInt8* pDest = ImplSearchEntry( pBuf.get(), reinterpret_cast<sal_uInt8 const *>("%%BoundingBox:"), nBytesRead, 14 );
- sal_uInt32 nRemainingBytes = pDest ? (nBytesRead - (pDest - pBuf.get())) : 0;
- if (nRemainingBytes >= 14)
+ sal_uInt8* pDest = ImplSearchEntry( pBuf.get(), reinterpret_cast<sal_uInt8 const *>("%%BoundingBox:"), nBytesRead, 14 );
+ sal_uInt32 nRemainingBytes = pDest ? (nBytesRead - (pDest - pBuf.get())) : 0;
+ if (nRemainingBytes >= 14)
+ {
+ pDest += 14;
+ nSecurityCount = std::min<sal_uInt32>(nRemainingBytes - 14, 100);
+ tools::Long nNumb[4];
+ nNumb[0] = nNumb[1] = nNumb[2] = nNumb[3] = 0;
+ for ( int i = 0; ( i < 4 ) && nSecurityCount; i++ )
{
- pDest += 14;
- nSecurityCount = std::min<sal_uInt32>(nRemainingBytes - 14, 100);
- tools::Long nNumb[4];
- nNumb[0] = nNumb[1] = nNumb[2] = nNumb[3] = 0;
- for ( int i = 0; ( i < 4 ) && nSecurityCount; i++ )
+ nNumb[ i ] = ImplGetNumber(pDest, nSecurityCount);
+ }
+ bool bFail = nSecurityCount == 0;
+ tools::Long nWidth(0), nHeight(0);
+ if (!bFail)
+ bFail = o3tl::checked_sub(nNumb[2], nNumb[0], nWidth) || o3tl::checked_add(nWidth, tools::Long(1), nWidth);
+ if (!bFail)
+ bFail = o3tl::checked_sub(nNumb[3], nNumb[1], nHeight) || o3tl::checked_add(nHeight, tools::Long(1), nHeight);
+ if (!bFail && nWidth > 0 && nHeight > 0)
+ {
+ GDIMetaFile aMtf;
+
+ // if there is no preview -> try with gs to make one
+ if (!bHasPreview && !utl::ConfigManager::IsFuzzing())
{
- nNumb[ i ] = ImplGetNumber(pDest, nSecurityCount);
+ bHasPreview = RenderAsEMF(pBuf.get(), nBytesRead, aGraphic);
+ if (!bHasPreview)
+ bHasPreview = RenderAsBMP(pBuf.get(), nBytesRead, aGraphic);
}
- bool bFail = nSecurityCount == 0;
- tools::Long nWidth(0), nHeight(0);
- if (!bFail)
- bFail = o3tl::checked_sub(nNumb[2], nNumb[0], nWidth) || o3tl::checked_add(nWidth, tools::Long(1), nWidth);
- if (!bFail)
- bFail = o3tl::checked_sub(nNumb[3], nNumb[1], nHeight) || o3tl::checked_add(nHeight, tools::Long(1), nHeight);
- if (!bFail && nWidth > 0 && nHeight > 0)
- {
- GDIMetaFile aMtf;
-
- // if there is no preview -> try with gs to make one
- if (!bHasPreview && !utl::ConfigManager::IsFuzzing())
- {
- bHasPreview = RenderAsEMF(pBuf.get(), nBytesRead, aGraphic);
- if (!bHasPreview)
- bHasPreview = RenderAsBMP(pBuf.get(), nBytesRead, aGraphic);
- }
- // if there is no preview -> make a red box
- if( !bHasPreview )
- {
- MakePreview(pBuf.get(), nBytesRead, nWidth, nHeight,
- aGraphic);
- }
-
- GfxLink aGfxLink( std::move(pBuf), nPSSize, GfxLinkType::EpsBuffer ) ;
- aMtf.AddAction( static_cast<MetaAction*>( new MetaEPSAction( Point(), Size( nWidth, nHeight ),
- aGfxLink, aGraphic.GetGDIMetaFile() ) ) );
- CreateMtfReplacementAction( aMtf, rStream, nOrigPos, nPSSize, nPosWMF, nSizeWMF, nPosTIFF, nSizeTIFF );
- aMtf.WindStart();
- aMtf.SetPrefMapMode(MapMode(MapUnit::MapPoint));
- aMtf.SetPrefSize( Size( nWidth, nHeight ) );
- rGraphic = aMtf;
- bRetValue = true;
+ // if there is no preview -> make a red box
+ if( !bHasPreview )
+ {
+ MakePreview(pBuf.get(), nBytesRead, nWidth, nHeight,
+ aGraphic);
}
+
+ GfxLink aGfxLink( std::move(pBuf), nPSSize, GfxLinkType::EpsBuffer ) ;
+ aMtf.AddAction( static_cast<MetaAction*>( new MetaEPSAction( Point(), Size( nWidth, nHeight ),
+ aGfxLink, aGraphic.GetGDIMetaFile() ) ) );
+ CreateMtfReplacementAction( aMtf, rStream, nOrigPos, nPSSize, nPosWMF, nSizeWMF, nPosTIFF, nSizeTIFF );
+ aMtf.WindStart();
+ aMtf.SetPrefMapMode(MapMode(MapUnit::MapPoint));
+ aMtf.SetPrefSize( Size( nWidth, nHeight ) );
+ rGraphic = aMtf;
+ bRetValue = true;
}
}
}
}
- catch (const SvStreamEOFException&)
- {
- SAL_WARN("filter.eps", "EOF");
- bRetValue = false;
- }
rStream.SetEndian(nOldFormat);
rStream.Seek( nOrigPos );
diff --git a/filter/source/graphicfilter/ios2met/ios2met.cxx b/filter/source/graphicfilter/ios2met/ios2met.cxx
index e82c6a21eb99..f17565ebd715 100644
--- a/filter/source/graphicfilter/ios2met/ios2met.cxx
+++ b/filter/source/graphicfilter/ios2met/ios2met.cxx
@@ -2806,9 +2806,6 @@ imeGraphicImport( SvStream & rStream, Graphic & rGraphic, FilterConfigItem* )
catch (const css::uno::Exception&)
{
}
- catch(SvStreamEOFException&)
- {
- }
return bRet;
}
diff --git a/filter/source/graphicfilter/ipcx/ipcx.cxx b/filter/source/graphicfilter/ipcx/ipcx.cxx
index 1c012a8f78b9..67cbc947fefc 100644
--- a/filter/source/graphicfilter/ipcx/ipcx.cxx
+++ b/filter/source/graphicfilter/ipcx/ipcx.cxx
@@ -19,7 +19,6 @@
#include <memory>
-#include <sal/log.hxx>
#include <vcl/graph.hxx>
#include <vcl/BitmapTools.hxx>
#include <tools/stream.hxx>
@@ -403,16 +402,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT bool
ipxGraphicImport( SvStream & rStream, Graphic & rGraphic, FilterConfigItem* )
{
PCXReader aPCXReader(rStream);
- bool bRetValue;
- try
- {
- bRetValue = aPCXReader.ReadPCX(rGraphic);
- }
- catch (const SvStreamEOFException&)
- {
- SAL_WARN("filter.pcx", "EOF");
- bRetValue = false;
- }
+ bool bRetValue = aPCXReader.ReadPCX(rGraphic);
if ( !bRetValue )
rStream.SetError( SVSTREAM_FILEFORMAT_ERROR );
return bRetValue;
diff --git a/filter/source/graphicfilter/ipsd/ipsd.cxx b/filter/source/graphicfilter/ipsd/ipsd.cxx
index 528914a5cba1..91599bf3352b 100644
--- a/filter/source/graphicfilter/ipsd/ipsd.cxx
+++ b/filter/source/graphicfilter/ipsd/ipsd.cxx
@@ -764,17 +764,8 @@ extern "C" SAL_DLLPUBLIC_EXPORT bool
ipdGraphicImport( SvStream & rStream, Graphic & rGraphic, FilterConfigItem* )
{
PSDReader aPSDReader(rStream);
- bool bRet;
- try
- {
- bRet = aPSDReader.ReadPSD(rGraphic);
- }
- catch (const SvStreamEOFException&)
- {
- SAL_WARN("filter.psd", "EOF");
- bRet = false;
- }
- return bRet;
+
+ return aPSDReader.ReadPSD(rGraphic);
}
diff --git a/filter/source/graphicfilter/itga/itga.cxx b/filter/source/graphicfilter/itga/itga.cxx
index 023351c33b4e..8c8af9d52cd8 100644
--- a/filter/source/graphicfilter/itga/itga.cxx
+++ b/filter/source/graphicfilter/itga/itga.cxx
@@ -18,10 +18,9 @@
*/
-#include <sal/log.hxx>
-#include <tools/stream.hxx>
#include <vcl/graph.hxx>
#include <vcl/BitmapTools.hxx>
+#include <tools/stream.hxx>
#include <memory>
class FilterConfigItem;
@@ -786,17 +785,7 @@ itgGraphicImport( SvStream & rStream, Graphic & rGraphic, FilterConfigItem* )
{
TGAReader aTGAReader(rStream);
- bool bRet;
- try
- {
- bRet = aTGAReader.ReadTGA(rGraphic);
- }
- catch (const SvStreamEOFException&)
- {
- SAL_WARN("filter.tga", "EOF");
- bRet = false;
- }
- return bRet;
+ return aTGAReader.ReadTGA(rGraphic);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index 404dd3aff6bc..91b36b230129 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -29,7 +29,6 @@
#include <o3tl/safeint.hxx>
#include <osl/file.hxx>
#include <tools/solar.h>
-#include <tools/diagnose_ex.h>
#include <sal/log.hxx>
#include <rtl/math.hxx>
@@ -4183,11 +4182,9 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r
if( maShapeRecords.SeekToContent( rSt,
DFF_msofbtUDefProp ) )
{
- sal_uInt32 nBytesLeft = maShapeRecords.Current()->nRecLen;
+ sal_uInt32 nBytesLeft = maShapeRecords.Current()->nRecLen;
while( 5 < nBytesLeft )
{
- if (rSt.remainingSize() < 6)
- break;
sal_uInt16 nPID(0);
rSt.ReadUInt16(nPID);
if (!rSt.good())
@@ -4201,11 +4198,11 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r
mbRotateGranientFillWithAngle = nUDData & 0x20;
break;
}
- nBytesLeft -= 6;
+ nBytesLeft -= 6;
}
}
aObjData.bShapeType = maShapeRecords.SeekToContent( rSt, DFF_msofbtSp );
- if (aObjData.bShapeType && rSt.remainingSize() >= 8)
+ if ( aObjData.bShapeType )
{
sal_uInt32 temp;
rSt.ReadUInt32( aObjData.nShapeId )
@@ -4249,7 +4246,7 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r
}
aObjData.bChildAnchor = maShapeRecords.SeekToContent( rSt, DFF_msofbtChildAnchor, SEEK_FROM_CURRENT_AND_RESTART );
- if (aObjData.bChildAnchor && rSt.remainingSize() >= 16)
+ if ( aObjData.bChildAnchor )
{
sal_Int32 l(0), o(0), r(0), u(0);
rSt.ReadInt32( l ).ReadInt32( o ).ReadInt32( r ).ReadInt32( u );
@@ -5706,14 +5703,7 @@ SvxMSDffManager::SvxMSDffManager(SvStream& rStCtrl_,
SetDefaultPropSet( rStCtrl, nOffsDgg );
// read control stream, if successful set nBLIPCount
- try
- {
- GetCtrlData( nOffsDgg );
- }
- catch(SvStreamEOFException&)
- {
- TOOLS_WARN_EXCEPTION("filter.ms", "");
- }
+ GetCtrlData( nOffsDgg );
// check Text-Box-Story-Chain-Infos
CheckTxBxStoryChain();
diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx
index 77fe87758e8a..1d7a36032d4c 100644
--- a/filter/source/msfilter/svdfppt.cxx
+++ b/filter/source/msfilter/svdfppt.cxx
@@ -807,406 +807,399 @@ SdrObject* SdrEscherImport::ProcessObj( SvStream& rSt, DffObjData& rObjData, Svx
}
else
{
- try
- {
- // try to load some ppt text
- PPTTextObj aTextObj( rSt, static_cast<SdrPowerPointImport&>(*this), rPersistEntry, &rObjData );
- if ( aTextObj.Count() || aTextObj.GetOEPlaceHolderAtom() )
+ // try to load some ppt text
+ PPTTextObj aTextObj( rSt, static_cast<SdrPowerPointImport&>(*this), rPersistEntry, &rObjData );
+ if ( aTextObj.Count() || aTextObj.GetOEPlaceHolderAtom() )
+ {
+ bool bVerticalText = false;
+ // and if the text object is not empty, it must be applied to pRet, the object we
+ // initially got from our escher import
+ Degree100 nTextRotationAngle(0);
+ if ( IsProperty( DFF_Prop_txflTextFlow ) )
{
- bool bVerticalText = false;
- // and if the text object is not empty, it must be applied to pRet, the object we
- // initially got from our escher import
- Degree100 nTextRotationAngle(0);
- if ( IsProperty( DFF_Prop_txflTextFlow ) )
- {
- auto eTextFlow = GetPropertyValue(DFF_Prop_txflTextFlow, 0) & 0xFFFF;
- switch( eTextFlow )
- {
- case mso_txflBtoT : // Bottom to Top non-@
- nTextRotationAngle += 9000_deg100;
- break;
- case mso_txflTtoBA : /* #68110# */ // Top to Bottom @-font
- case mso_txflTtoBN : // Top to Bottom non-@
- case mso_txflVertN : // Vertical, non-@, top to bottom
- bVerticalText = !bVerticalText; // nTextRotationAngle += 27000;
- break;
- // case mso_txflHorzN : // Horizontal non-@, normal
- // case mso_txflHorzA : // Horizontal @-font, normal
- default: break;
- }
- }
- sal_Int32 nFontDirection = GetPropertyValue( DFF_Prop_cdirFont, mso_cdir0 );
- if ( ( nFontDirection == 1 ) || ( nFontDirection == 3 ) )
- {
- bVerticalText = !bVerticalText;
- }
- const bool bFail = o3tl::checked_multiply<sal_Int32>(nFontDirection, 9000, nFontDirection);
- if (!bFail)
- nTextRotationAngle -= Degree100(nFontDirection);
- else
- SAL_WARN("filter.ms", "Parsing error: bad fontdirection: " << nFontDirection);
- aTextObj.SetVertical( bVerticalText );
- if ( pRet )
+ auto eTextFlow = GetPropertyValue(DFF_Prop_txflTextFlow, 0) & 0xFFFF;
+ switch( eTextFlow )
{
- bool bDeleteSource = aTextObj.GetOEPlaceHolderAtom() != nullptr;
- if ( bDeleteSource && dynamic_cast<const SdrGrafObj* >(pRet) == nullptr // we are not allowed to get
- && dynamic_cast<const SdrObjGroup* >(pRet) == nullptr // grouped placeholder objects
- && dynamic_cast<const SdrOle2Obj* >(pRet) == nullptr )
- SdrObject::Free( pRet );
+ case mso_txflBtoT : // Bottom to Top non-@
+ nTextRotationAngle += 9000_deg100;
+ break;
+ case mso_txflTtoBA : /* #68110# */ // Top to Bottom @-font
+ case mso_txflTtoBN : // Top to Bottom non-@
+ case mso_txflVertN : // Vertical, non-@, top to bottom
+ bVerticalText = !bVerticalText; // nTextRotationAngle += 27000;
+ break;
+ // case mso_txflHorzN : // Horizontal non-@, normal
+ // case mso_txflHorzA : // Horizontal @-font, normal
+ default: break;
}
- sal_uInt32 nTextFlags = aTextObj.GetTextFlags();
- sal_Int32 nTextLeft = GetPropertyValue( DFF_Prop_dxTextLeft, 25 * 3600 ); // 0.25 cm (emu)
- sal_Int32 nTextRight = GetPropertyValue( DFF_Prop_dxTextRight, 25 * 3600 ); // 0.25 cm (emu)
- sal_Int32 nTextTop = GetPropertyValue( DFF_Prop_dyTextTop, 13 * 3600 ); // 0.13 cm (emu)
- sal_Int32 nTextBottom = GetPropertyValue( DFF_Prop_dyTextBottom, 13 * 3600 );
- ScaleEmu( nTextLeft );
- ScaleEmu( nTextRight );
- ScaleEmu( nTextTop );
- ScaleEmu( nTextBottom );
-
- sal_Int32 nMinFrameWidth = 0;
- sal_Int32 nMinFrameHeight = 0;
- bool bAutoGrowWidth, bAutoGrowHeight;
-
- SdrTextVertAdjust eTVA;
- SdrTextHorzAdjust eTHA;
-
- nTextFlags &= PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_LEFT | PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_RIGHT
- | PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_CENTER | PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_BLOCK;
-
- if ( bVerticalText )
- {
- eTVA = SDRTEXTVERTADJUST_BLOCK;
- eTHA = SDRTEXTHORZADJUST_CENTER;
+ }
+ sal_Int32 nFontDirection = GetPropertyValue( DFF_Prop_cdirFont, mso_cdir0 );
+ if ( ( nFontDirection == 1 ) || ( nFontDirection == 3 ) )
+ {
+ bVerticalText = !bVerticalText;
+ }
+ const bool bFail = o3tl::checked_multiply<sal_Int32>(nFontDirection, 9000, nFontDirection);
+ if (!bFail)
+ nTextRotationAngle -= Degree100(nFontDirection);
+ else
+ SAL_WARN("filter.ms", "Parsing error: bad fontdirection: " << nFontDirection);
+ aTextObj.SetVertical( bVerticalText );
+ if ( pRet )
+ {
+ bool bDeleteSource = aTextObj.GetOEPlaceHolderAtom() != nullptr;
+ if ( bDeleteSource && dynamic_cast<const SdrGrafObj* >(pRet) == nullptr // we are not allowed to get
+ && dynamic_cast<const SdrObjGroup* >(pRet) == nullptr // grouped placeholder objects
+ && dynamic_cast<const SdrOle2Obj* >(pRet) == nullptr )
+ SdrObject::Free( pRet );
+ }
+ sal_uInt32 nTextFlags = aTextObj.GetTextFlags();
+ sal_Int32 nTextLeft = GetPropertyValue( DFF_Prop_dxTextLeft, 25 * 3600 ); // 0.25 cm (emu)
+ sal_Int32 nTextRight = GetPropertyValue( DFF_Prop_dxTextRight, 25 * 3600 ); // 0.25 cm (emu)
+ sal_Int32 nTextTop = GetPropertyValue( DFF_Prop_dyTextTop, 13 * 3600 ); // 0.13 cm (emu)
+ sal_Int32 nTextBottom = GetPropertyValue( DFF_Prop_dyTextBottom, 13 * 3600 );
+ ScaleEmu( nTextLeft );
+ ScaleEmu( nTextRight );
+ ScaleEmu( nTextTop );
+ ScaleEmu( nTextBottom );
+
+ sal_Int32 nMinFrameWidth = 0;
+ sal_Int32 nMinFrameHeight = 0;
+ bool bAutoGrowWidth, bAutoGrowHeight;
+
+ SdrTextVertAdjust eTVA;
+ SdrTextHorzAdjust eTHA;
+
+ nTextFlags &= PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_LEFT | PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_RIGHT
+ | PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_CENTER | PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_BLOCK;
+
+ if ( bVerticalText )
+ {
+ eTVA = SDRTEXTVERTADJUST_BLOCK;
+ eTHA = SDRTEXTHORZADJUST_CENTER;
- // read text anchor
- auto eTextAnchor = GetPropertyValue(DFF_Prop_anchorText, mso_anchorTop);
+ // read text anchor
+ auto eTextAnchor = GetPropertyValue(DFF_Prop_anchorText, mso_anchorTop);
- switch( eTextAnchor )
- {
- case mso_anchorTop:
- case mso_anchorTopCentered:
- case mso_anchorTopBaseline:
- case mso_anchorTopCenteredBaseline:
- eTHA = SDRTEXTHORZADJUST_RIGHT;
- break;
+ switch( eTextAnchor )
+ {
+ case mso_anchorTop:
+ case mso_anchorTopCentered:
+ case mso_anchorTopBaseline:
+ case mso_anchorTopCenteredBaseline:
+ eTHA = SDRTEXTHORZADJUST_RIGHT;
+ break;
- case mso_anchorMiddle :
- case mso_anchorMiddleCentered:
- eTHA = SDRTEXTHORZADJUST_CENTER;
- break;
+ case mso_anchorMiddle :
+ case mso_anchorMiddleCentered:
+ eTHA = SDRTEXTHORZADJUST_CENTER;
+ break;
- case mso_anchorBottom:
- case mso_anchorBottomCentered:
- case mso_anchorBottomBaseline:
- case mso_anchorBottomCenteredBaseline:
- eTHA = SDRTEXTHORZADJUST_LEFT;
- break;
- }
- switch ( eTextAnchor )
+ case mso_anchorBottom:
+ case mso_anchorBottomCentered:
+ case mso_anchorBottomBaseline:
+ case mso_anchorBottomCenteredBaseline:
+ eTHA = SDRTEXTHORZADJUST_LEFT;
+ break;
+ }
+ switch ( eTextAnchor )
+ {
+ case mso_anchorTopCentered :
+ case mso_anchorMiddleCentered :
+ case mso_anchorBottomCentered :
+ case mso_anchorTopCenteredBaseline:
+ case mso_anchorBottomCenteredBaseline:
{
- case mso_anchorTopCentered :
- case mso_anchorMiddleCentered :
- case mso_anchorBottomCentered :
- case mso_anchorTopCenteredBaseline:
- case mso_anchorBottomCenteredBaseline:
+ // check if it is sensible to use the centered alignment
+ const sal_uInt32 nMask = PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_LEFT | PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_CENTER | PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_RIGHT | PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_BLOCK;
+ switch (nTextFlags & nMask)
{
- // check if it is sensible to use the centered alignment
- const sal_uInt32 nMask = PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_LEFT | PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_CENTER | PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_RIGHT | PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_BLOCK;
- switch (nTextFlags & nMask)
- {
- case PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_LEFT:
- case PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_CENTER:
- case PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_RIGHT:
- case PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_BLOCK:
- eTVA = SDRTEXTVERTADJUST_CENTER; // If the textobject has only one type of alignment, then the text has not to be displayed using the full width;
- break;
- }
+ case PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_LEFT:
+ case PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_CENTER:
+ case PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_RIGHT:
+ case PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_BLOCK:
+ eTVA = SDRTEXTVERTADJUST_CENTER; // If the textobject has only one type of alignment, then the text has not to be displayed using the full width;
break;
}
- default:
- break;
+ break;
}
- nMinFrameWidth = rTextRect.GetWidth() - ( nTextLeft + nTextRight );
+ default:
+ break;
}
- else
- {
- eTVA = SDRTEXTVERTADJUST_CENTER;
- eTHA = SDRTEXTHORZADJUST_BLOCK;
+ nMinFrameWidth = rTextRect.GetWidth() - ( nTextLeft + nTextRight );
+ }
+ else
+ {
+ eTVA = SDRTEXTVERTADJUST_CENTER;
+ eTHA = SDRTEXTHORZADJUST_BLOCK;
- // read text anchor
- auto eTextAnchor = GetPropertyValue(DFF_Prop_anchorText, mso_anchorTop);
+ // read text anchor
+ auto eTextAnchor = GetPropertyValue(DFF_Prop_anchorText, mso_anchorTop);
- switch( eTextAnchor )
- {
- case mso_anchorTop:
- case mso_anchorTopCentered:
- case mso_anchorTopBaseline:
- case mso_anchorTopCenteredBaseline:
- eTVA = SDRTEXTVERTADJUST_TOP;
- break;
+ switch( eTextAnchor )
+ {
+ case mso_anchorTop:
+ case mso_anchorTopCentered:
+ case mso_anchorTopBaseline:
+ case mso_anchorTopCenteredBaseline:
+ eTVA = SDRTEXTVERTADJUST_TOP;
+ break;
- case mso_anchorMiddle :
- case mso_anchorMiddleCentered:
- eTVA = SDRTEXTVERTADJUST_CENTER;
- break;
+ case mso_anchorMiddle :
+ case mso_anchorMiddleCentered:
+ eTVA = SDRTEXTVERTADJUST_CENTER;
+ break;
- case mso_anchorBottom:
- case mso_anchorBottomCentered:
- case mso_anchorBottomBaseline:
- case mso_anchorBottomCenteredBaseline:
- eTVA = SDRTEXTVERTADJUST_BOTTOM;
- break;
- }
- switch ( eTextAnchor )
+ case mso_anchorBottom:
+ case mso_anchorBottomCentered:
+ case mso_anchorBottomBaseline:
+ case mso_anchorBottomCenteredBaseline:
+ eTVA = SDRTEXTVERTADJUST_BOTTOM;
+ break;
+ }
+ switch ( eTextAnchor )
+ {
+ case mso_anchorTopCentered :
+ case mso_anchorMiddleCentered :
+ case mso_anchorBottomCentered :
+ case mso_anchorTopCenteredBaseline:
+ case mso_anchorBottomCenteredBaseline:
{
- case mso_anchorTopCentered :
- case mso_anchorMiddleCentered :
- case mso_anchorBottomCentered :
- case mso_anchorTopCenteredBaseline:
- case mso_anchorBottomCenteredBaseline:
+ // check if it is sensible to use the centered alignment
+ const sal_uInt32 nMask = PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_LEFT | PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_CENTER | PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_RIGHT | PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_BLOCK;
+ switch (nTextFlags & nMask)
{
- // check if it is sensible to use the centered alignment
- const sal_uInt32 nMask = PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_LEFT | PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_CENTER | PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_RIGHT | PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_BLOCK;
- switch (nTextFlags & nMask)
- {
- case PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_LEFT:
- case PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_CENTER:
- case PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_RIGHT:
- case PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_BLOCK:
- eTHA = SDRTEXTHORZADJUST_CENTER; // If the textobject has only one type of alignment, then the text has not to be displayed using the full width;
- break;
- }
+ case PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_LEFT:
+ case PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_CENTER:
+ case PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_RIGHT:
+ case PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_BLOCK:
+ eTHA = SDRTEXTHORZADJUST_CENTER; // If the textobject has only one type of alignment, then the text has not to be displayed using the full width;
break;
}
- default:
- break;
+ break;
}
- nMinFrameHeight = rTextRect.GetHeight() - ( nTextTop + nTextBottom );
+ default:
+ break;
}
+ nMinFrameHeight = rTextRect.GetHeight() - ( nTextTop + nTextBottom );
+ }
- SdrObjKind eTextKind = OBJ_RECT;
- if ( ( aPlaceholderAtom.nPlaceholderId == PptPlaceholder::NOTESSLIDEIMAGE )
- || ( aPlaceholderAtom.nPlaceholderId == PptPlaceholder::MASTERNOTESSLIDEIMAGE ) )
+ SdrObjKind eTextKind = OBJ_RECT;
+ if ( ( aPlaceholderAtom.nPlaceholderId == PptPlaceholder::NOTESSLIDEIMAGE )
+ || ( aPlaceholderAtom.nPlaceholderId == PptPlaceholder::MASTERNOTESSLIDEIMAGE ) )
+ {
+ aTextObj.SetInstance( TSS_Type::Notes );
+ eTextKind = OBJ_TITLETEXT;
+ }
+ else if ( ( aPlaceholderAtom.nPlaceholderId == PptPlaceholder::MASTERNOTESBODYIMAGE )
+ || ( aPlaceholderAtom.nPlaceholderId == PptPlaceholder::NOTESBODY ) )
+ {
+ aTextObj.SetInstance( TSS_Type::Notes );
+ eTextKind = OBJ_TEXT;
+ }
+
+ TSS_Type nDestinationInstance = aTextObj.GetInstance();
+ if ( rPersistEntry.ePageKind == PPT_MASTERPAGE )
+ {
+ if ( !rPersistEntry.pPresentationObjects )
{
- aTextObj.SetInstance( TSS_Type::Notes );
- eTextKind = OBJ_TITLETEXT;
+ rPersistEntry.pPresentationObjects.reset( new sal_uInt32[ PPT_STYLESHEETENTRIES ] );
+ memset( rPersistEntry.pPresentationObjects.get(), 0, PPT_STYLESHEETENTRIES * 4 );
}
- else if ( ( aPlaceholderAtom.nPlaceholderId == PptPlaceholder::MASTERNOTESBODYIMAGE )
- || ( aPlaceholderAtom.nPlaceholderId == PptPlaceholder::NOTESBODY ) )
+ if ( !rPersistEntry.pPresentationObjects[ static_cast<int>(nDestinationInstance) ] )
+ rPersistEntry.pPresentationObjects[ static_cast<int>(nDestinationInstance) ] = rObjData.rSpHd.GetRecBegFilePos();
+ }
+ switch ( nDestinationInstance )
+ {
+ case TSS_Type::PageTitle :
+ case TSS_Type::Title :
{
- aTextObj.SetInstance( TSS_Type::Notes );
- eTextKind = OBJ_TEXT;
+ if ( GetSlideLayoutAtom()->eLayout == PptSlideLayout::TITLEMASTERSLIDE )
+ nDestinationInstance = TSS_Type::Title;
+ else
+ nDestinationInstance = TSS_Type::PageTitle;
}
+ break;
+ case TSS_Type::Body :
+ case TSS_Type::HalfBody :
+ case TSS_Type::QuarterBody :
+ nDestinationInstance = TSS_Type::Body;
+ break;
+ default: break;
+ }
+ aTextObj.SetDestinationInstance( nDestinationInstance );
- TSS_Type nDestinationInstance = aTextObj.GetInstance();
- if ( rPersistEntry.ePageKind == PPT_MASTERPAGE )
- {
- if ( !rPersistEntry.pPresentationObjects )
- {
- rPersistEntry.pPresentationObjects.reset( new sal_uInt32[ PPT_STYLESHEETENTRIES ] );
- memset( rPersistEntry.pPresentationObjects.get(), 0, PPT_STYLESHEETENTRIES * 4 );
- }
- if ( !rPersistEntry.pPresentationObjects[ static_cast<int>(nDestinationInstance) ] )
- rPersistEntry.pPresentationObjects[ static_cast<int>(nDestinationInstance) ] = rObjData.rSpHd.GetRecBegFilePos();
- }
- switch ( nDestinationInstance )
+ bool bAutoFit = false; // auto-scale text into shape box
+ switch ( aTextObj.GetInstance() )
+ {
+ case TSS_Type::PageTitle :
+ case TSS_Type::Title : eTextKind = OBJ_TITLETEXT; break;
+ case TSS_Type::Subtitle : eTextKind = OBJ_TEXT; break;
+ case TSS_Type::Body :
+ case TSS_Type::HalfBody :
+ case TSS_Type::QuarterBody : eTextKind = OBJ_OUTLINETEXT; bAutoFit = true; break;
+ default: break;
+ }
+ if ( aTextObj.GetDestinationInstance() != TSS_Type::TextInShape )
+ {
+ if ( !aTextObj.GetOEPlaceHolderAtom() || aTextObj.GetOEPlaceHolderAtom()->nPlaceholderId == PptPlaceholder::NONE )
{
- case TSS_Type::PageTitle :
- case TSS_Type::Title :
- {
- if ( GetSlideLayoutAtom()->eLayout == PptSlideLayout::TITLEMASTERSLIDE )
- nDestinationInstance = TSS_Type::Title;
- else
- nDestinationInstance = TSS_Type::PageTitle;
- }
- break;
- case TSS_Type::Body :
- case TSS_Type::HalfBody :
- case TSS_Type::QuarterBody :
- nDestinationInstance = TSS_Type::Body;
- break;
- default: break;
+ aTextObj.SetDestinationInstance( TSS_Type::TextInShape );
+ eTextKind = OBJ_RECT;
}
- aTextObj.SetDestinationInstance( nDestinationInstance );
+ }
+ SdrObject* pTObj = nullptr;
+ bool bWordWrap = GetPropertyValue(DFF_Prop_WrapText, mso_wrapSquare) != mso_wrapNone;
+ bool bFitShapeToText = ( GetPropertyValue( DFF_Prop_FitTextToShape, 0 ) & 2 ) != 0;
- bool bAutoFit = false; // auto-scale text into shape box
- switch ( aTextObj.GetInstance() )
+ if ( dynamic_cast<const SdrObjCustomShape* >(pRet) != nullptr && ( eTextKind == OBJ_RECT ) )
+ {
+ bAutoGrowHeight = bFitShapeToText;
+ bAutoGrowWidth = !bWordWrap;
+ pTObj = pRet;
+ pRet = nullptr;
+ }
+ else
+ {
+ if ( dynamic_cast<const SdrObjCustomShape* >(pRet) != nullptr )
{
- case TSS_Type::PageTitle :
- case TSS_Type::Title : eTextKind = OBJ_TITLETEXT; break;
- case TSS_Type::Subtitle : eTextKind = OBJ_TEXT; break;
- case TSS_Type::Body :
- case TSS_Type::HalfBody :
- case TSS_Type::QuarterBody : eTextKind = OBJ_OUTLINETEXT; bAutoFit = true; break;
- default: break;
+ SdrObject::Free( pRet );
+ pRet = nullptr;
}
- if ( aTextObj.GetDestinationInstance() != TSS_Type::TextInShape )
+ pTObj = new SdrRectObj(
+ *pSdrModel,
+ eTextKind != OBJ_RECT ? eTextKind : OBJ_TEXT);
+ SfxItemSet aSet( pSdrModel->GetItemPool() );
+ if ( !pRet )
+ ApplyAttributes( rSt, aSet, rObjData );
+ pTObj->SetMergedItemSet( aSet );
+ if ( pRet )
{
- if ( !aTextObj.GetOEPlaceHolderAtom() || aTextObj.GetOEPlaceHolderAtom()->nPlaceholderId == PptPlaceholder::NONE )
- {
- aTextObj.SetDestinationInstance( TSS_Type::TextInShape );
- eTextKind = OBJ_RECT;
- }
+ pTObj->SetMergedItem( XLineStyleItem( drawing::LineStyle_NONE ) );
+ pTObj->SetMergedItem( XFillStyleItem( drawing::FillStyle_NONE ) );
}
- SdrObject* pTObj = nullptr;
- bool bWordWrap = GetPropertyValue(DFF_Prop_WrapText, mso_wrapSquare) != mso_wrapNone;
- bool bFitShapeToText = ( GetPropertyValue( DFF_Prop_FitTextToShape, 0 ) & 2 ) != 0;
-
- if ( dynamic_cast<const SdrObjCustomShape* >(pRet) != nullptr && ( eTextKind == OBJ_RECT ) )
+ if ( bVerticalText )
{
- bAutoGrowHeight = bFitShapeToText;
- bAutoGrowWidth = !bWordWrap;
- pTObj = pRet;
- pRet = nullptr;
+ bAutoGrowWidth = bFitShapeToText;
+ bAutoGrowHeight = false;
}
else
{
- if ( dynamic_cast<const SdrObjCustomShape* >(pRet) != nullptr )
- {
- SdrObject::Free( pRet );
- pRet = nullptr;
- }
- pTObj = new SdrRectObj(
- *pSdrModel,
- eTextKind != OBJ_RECT ? eTextKind : OBJ_TEXT);
- SfxItemSet aSet( pSdrModel->GetItemPool() );
- if ( !pRet )
- ApplyAttributes( rSt, aSet, rObjData );
- pTObj->SetMergedItemSet( aSet );
- if ( pRet )
- {
- pTObj->SetMergedItem( XLineStyleItem( drawing::LineStyle_NONE ) );
- pTObj->SetMergedItem( XFillStyleItem( drawing::FillStyle_NONE ) );
- }
- if ( bVerticalText )
- {
- bAutoGrowWidth = bFitShapeToText;
- bAutoGrowHeight = false;
- }
- else
- {
- bAutoGrowWidth = false;
+ bAutoGrowWidth = false;
- // #119885# re-activating bFitShapeToText here, could not find deeper explanations
- // for it (it was from 2005). Keeping the old comment here for reference
- // old comment: // bFitShapeToText; can't be used, because we cut the text if it is too height,
- bAutoGrowHeight = bFitShapeToText;
- }
+ // #119885# re-activating bFitShapeToText here, could not find deeper explanations
+ // for it (it was from 2005). Keeping the old comment here for reference
+ // old comment: // bFitShapeToText; can't be used, because we cut the text if it is too height,
+ bAutoGrowHeight = bFitShapeToText;
}
- pTObj->SetMergedItem( SvxFrameDirectionItem( bVerticalText ? SvxFrameDirection::Vertical_RL_TB : SvxFrameDirection::Horizontal_LR_TB, EE_PARA_WRITINGDIR ) );
+ }
+ pTObj->SetMergedItem( SvxFrameDirectionItem( bVerticalText ? SvxFrameDirection::Vertical_RL_TB : SvxFrameDirection::Horizontal_LR_TB, EE_PARA_WRITINGDIR ) );
- //Autofit text only if there is no auto grow height and width
- //See fdo#41245
- if (bAutoFit && !bAutoGrowHeight && !bAutoGrowWidth)
- {
- pTObj->SetMergedItem( SdrTextFitToSizeTypeItem(drawing::TextFitToSizeType_AUTOFIT) );
- }
+ //Autofit text only if there is no auto grow height and width
+ //See fdo#41245
+ if (bAutoFit && !bAutoGrowHeight && !bAutoGrowWidth)
+ {
+ pTObj->SetMergedItem( SdrTextFitToSizeTypeItem(drawing::TextFitToSizeType_AUTOFIT) );
+ }
- if ( dynamic_cast<const SdrObjCustomShape* >(pTObj) == nullptr )
- {
- pTObj->SetMergedItem( makeSdrTextAutoGrowWidthItem( bAutoGrowWidth ) );
- pTObj->SetMergedItem( makeSdrTextAutoGrowHeightItem( bAutoGrowHeight ) );
- }
- else
- {
- pTObj->SetMergedItem( makeSdrTextWordWrapItem( bWordWrap ) );
- pTObj->SetMergedItem( makeSdrTextAutoGrowHeightItem( bFitShapeToText ) );
- }
+ if ( dynamic_cast<const SdrObjCustomShape* >(pTObj) == nullptr )
+ {
+ pTObj->SetMergedItem( makeSdrTextAutoGrowWidthItem( bAutoGrowWidth ) );
+ pTObj->SetMergedItem( makeSdrTextAutoGrowHeightItem( bAutoGrowHeight ) );
+ }
+ else
+ {
+ pTObj->SetMergedItem( makeSdrTextWordWrapItem( bWordWrap ) );
+ pTObj->SetMergedItem( makeSdrTextAutoGrowHeightItem( bFitShapeToText ) );
+ }
- pTObj->SetMergedItem( SdrTextVertAdjustItem( eTVA ) );
- pTObj->SetMergedItem( SdrTextHorzAdjustItem( eTHA ) );
+ pTObj->SetMergedItem( SdrTextVertAdjustItem( eTVA ) );
+ pTObj->SetMergedItem( SdrTextHorzAdjustItem( eTHA ) );
- if ( nMinFrameHeight < 0 )
- nMinFrameHeight = 0;
- if ( dynamic_cast<const SdrObjCustomShape* >(pTObj) == nullptr )
- pTObj->SetMergedItem( makeSdrTextMinFrameHeightItem( nMinFrameHeight ) );
+ if ( nMinFrameHeight < 0 )
+ nMinFrameHeight = 0;
+ if ( dynamic_cast<const SdrObjCustomShape* >(pTObj) == nullptr )
+ pTObj->SetMergedItem( makeSdrTextMinFrameHeightItem( nMinFrameHeight ) );
- if ( nMinFrameWidth < 0 )
- nMinFrameWidth = 0;
- if ( dynamic_cast<const SdrObjCustomShape* >(pTObj) == nullptr )
- pTObj->SetMergedItem( makeSdrTextMinFrameWidthItem( nMinFrameWidth ) );
+ if ( nMinFrameWidth < 0 )
+ nMinFrameWidth = 0;
+ if ( dynamic_cast<const SdrObjCustomShape* >(pTObj) == nullptr )
+ pTObj->SetMergedItem( makeSdrTextMinFrameWidthItem( nMinFrameWidth ) );
- // set margins at the borders of the textbox
- pTObj->SetMergedItem( makeSdrTextLeftDistItem( nTextLeft ) );
- pTObj->SetMergedItem( makeSdrTextRightDistItem( nTextRight ) );
- pTObj->SetMergedItem( makeSdrTextUpperDistItem( nTextTop ) );
- pTObj->SetMergedItem( makeSdrTextLowerDistItem( nTextBottom ) );
- pTObj->SetMergedItem( SdrTextFixedCellHeightItem( true ) );
+ // set margins at the borders of the textbox
+ pTObj->SetMergedItem( makeSdrTextLeftDistItem( nTextLeft ) );
+ pTObj->SetMergedItem( makeSdrTextRightDistItem( nTextRight ) );
+ pTObj->SetMergedItem( makeSdrTextUpperDistItem( nTextTop ) );
+ pTObj->SetMergedItem( makeSdrTextLowerDistItem( nTextBottom ) );
+ pTObj->SetMergedItem( SdrTextFixedCellHeightItem( true ) );
- if ( dynamic_cast<const SdrObjCustomShape* >(pTObj) == nullptr )
- pTObj->SetSnapRect( rTextRect );
- pTObj = ReadObjText( &aTextObj, pTObj, rData.pPage );
+ if ( dynamic_cast<const SdrObjCustomShape* >(pTObj) == nullptr )
+ pTObj->SetSnapRect( rTextRect );
+ pTObj = ReadObjText( &aTextObj, pTObj, rData.pPage );
- if ( pTObj )
+ if ( pTObj )
+ {
+ /* check if our new snaprect makes trouble,
+ because we do not display the ADJUST_BLOCK
+ properly if the textsize is bigger than the
+ snaprect of the object. Then we will use
+ ADJUST_CENTER instead of ADJUST_BLOCK.
+ */
+ if ( dynamic_cast<const SdrObjCustomShape* >(pTObj) == nullptr && !bFitShapeToText && !bWordWrap )
{
- /* check if our new snaprect makes trouble,
- because we do not display the ADJUST_BLOCK
- properly if the textsize is bigger than the
- snaprect of the object. Then we will use
- ADJUST_CENTER instead of ADJUST_BLOCK.
- */
- if ( dynamic_cast<const SdrObjCustomShape* >(pTObj) == nullptr && !bFitShapeToText && !bWordWrap )
+ SdrTextObj* pText = dynamic_cast<SdrTextObj*>( pTObj );
+ if ( pText )
{
- SdrTextObj* pText = dynamic_cast<SdrTextObj*>( pTObj );
- if ( pText )
+ if ( bVerticalText )
{
- if ( bVerticalText )
+ if ( eTVA == SDRTEXTVERTADJUST_BLOCK )
{
- if ( eTVA == SDRTEXTVERTADJUST_BLOCK )
- {
- Size aTextSize( pText->GetTextSize() );
- aTextSize.AdjustWidth(nTextLeft + nTextRight );
- aTextSize.AdjustHeight(nTextTop + nTextBottom );
- if ( rTextRect.GetHeight() < aTextSize.Height() )
- pTObj->SetMergedItem( SdrTextVertAdjustItem( SDRTEXTVERTADJUST_CENTER ) );
- }
+ Size aTextSize( pText->GetTextSize() );
+ aTextSize.AdjustWidth(nTextLeft + nTextRight );
+ aTextSize.AdjustHeight(nTextTop + nTextBottom );
+ if ( rTextRect.GetHeight() < aTextSize.Height() )
+ pTObj->SetMergedItem( SdrTextVertAdjustItem( SDRTEXTVERTADJUST_CENTER ) );
}
- else
+ }
+ else
+ {
+ if ( eTHA == SDRTEXTHORZADJUST_BLOCK )
{
- if ( eTHA == SDRTEXTHORZADJUST_BLOCK )
- {
- Size aTextSize( pText->GetTextSize() );
- aTextSize.AdjustWidth(nTextLeft + nTextRight );
- aTextSize.AdjustHeight(nTextTop + nTextBottom );
- if ( rTextRect.GetWidth() < aTextSize.Width() )
- pTObj->SetMergedItem( SdrTextHorzAdjustItem( SDRTEXTHORZADJUST_CENTER ) );
- }
+ Size aTextSize( pText->GetTextSize() );
+ aTextSize.AdjustWidth(nTextLeft + nTextRight );
+ aTextSize.AdjustHeight(nTextTop + nTextBottom );
+ if ( rTextRect.GetWidth() < aTextSize.Width() )
+ pTObj->SetMergedItem( SdrTextHorzAdjustItem( SDRTEXTHORZADJUST_CENTER ) );
}
}
}
- // rotate text with shape?
- Degree100 nAngle = ( rObjData.nSpFlags & ShapeFlag::FlipV ) ? -mnFix16Angle : mnFix16Angle; // #72116# vertical flip -> rotate by using the other way
- nAngle += nTextRotationAngle;
+ }
+ // rotate text with shape?
+ Degree100 nAngle = ( rObjData.nSpFlags & ShapeFlag::FlipV ) ? -mnFix16Angle : mnFix16Angle; // #72116# vertical flip -> rotate by using the other way
+ nAngle += nTextRotationAngle;
- if ( dynamic_cast< const SdrObjCustomShape* >(pTObj) == nullptr )
- {
- if ( rObjData.nSpFlags & ShapeFlag::FlipV )
- {
- double a = 18000 * F_PI18000;
- pTObj->Rotate( rTextRect.Center(), 18000_deg100, sin( a ), cos( a ) );
- }
- if ( rObjData.nSpFlags & ShapeFlag::FlipH )
- nAngle = 36000_deg100 - nAngle;
- if ( nAngle )
- pTObj->NbcRotate( rObjData.aBoundRect.Center(), nAngle );
- }
- if ( pRet )
+ if ( dynamic_cast< const SdrObjCustomShape* >(pTObj) == nullptr )
+ {
+ if ( rObjData.nSpFlags & ShapeFlag::FlipV )
{
- SdrObject* pGroup = new SdrObjGroup(*pSdrModel);
- pGroup->GetSubList()->NbcInsertObject( pRet );
- pGroup->GetSubList()->NbcInsertObject( pTObj );
- pRet = pGroup;
+ double a = 18000 * F_PI18000;
+ pTObj->Rotate( rTextRect.Center(), 18000_deg100, sin( a ), cos( a ) );
}
- else
- pRet = pTObj;
+ if ( rObjData.nSpFlags & ShapeFlag::FlipH )
+ nAngle = 36000_deg100 - nAngle;
+ if ( nAngle )
+ pTObj->NbcRotate( rObjData.aBoundRect.Center(), nAngle );
+ }
+ if ( pRet )
+ {
+ SdrObject* pGroup = new SdrObjGroup(*pSdrModel);
+ pGroup->GetSubList()->NbcInsertObject( pRet );
+ pGroup->GetSubList()->NbcInsertObject( pTObj );
+ pRet = pGroup;
}
+ else
+ pRet = pTObj;
}
}
- catch (const SvStreamEOFException&)
- {
- SAL_WARN("filter.ms", "EOF");
- }
}
}
else
@@ -4775,66 +4768,58 @@ bool PPTTextSpecInfoAtomInterpreter::Read( SvStream& rIn, const DffRecordHeader&
rRecHd.SeekToContent( rIn );
auto nEndRecPos = DffPropSet::SanitizeEndPos(rIn, rRecHd.GetRecEndFilePos());
- try
+ while (rIn.Tell() < nEndRecPos && rIn.good())
{
- while (rIn.Tell() < nEndRecPos && rIn.good())
+ if ( nRecordType == PPT_PST_TextSpecInfoAtom )
{
- if ( nRecordType == PPT_PST_TextSpecInfoAtom )
- {
- sal_uInt32 nCharCount(0);
- rIn.ReadUInt32( nCharCount );
- nCharIdx += nCharCount;
- }
+ sal_uInt32 nCharCount(0);
+ rIn.ReadUInt32( nCharCount );
+ nCharIdx += nCharCount;
+ }
- sal_uInt32 nFlags(0);
- rIn.ReadUInt32(nFlags);
+ sal_uInt32 nFlags(0);
+ rIn.ReadUInt32(nFlags);
- PPTTextSpecInfo aEntry( nCharIdx );
- if ( pTextSpecDefault )
- {
- aEntry.nDontKnow = pTextSpecDefault->nDontKnow;
- aEntry.nLanguage[ 0 ] = pTextSpecDefault->nLanguage[ 0 ];
- aEntry.nLanguage[ 1 ] = pTextSpecDefault->nLanguage[ 1 ];
- aEntry.nLanguage[ 2 ] = pTextSpecDefault->nLanguage[ 2 ];
- }
- for (sal_uInt32 i = 1; nFlags && i ; i <<= 1)
+ PPTTextSpecInfo aEntry( nCharIdx );
+ if ( pTextSpecDefault )
+ {
+ aEntry.nDontKnow = pTextSpecDefault->nDontKnow;
+ aEntry.nLanguage[ 0 ] = pTextSpecDefault->nLanguage[ 0 ];
+ aEntry.nLanguage[ 1 ] = pTextSpecDefault->nLanguage[ 1 ];
+ aEntry.nLanguage[ 2 ] = pTextSpecDefault->nLanguage[ 2 ];
+ }
+ for (sal_uInt32 i = 1; nFlags && i ; i <<= 1)
+ {
+ sal_uInt16 nLang = 0;
+ switch( nFlags & i )
{
- sal_uInt16 nLang = 0;
- switch( nFlags & i )
+ case 0 : break;
+ case 1 : rIn.ReadUInt16( aEntry.nDontKnow ); break;
+ case 2 : rIn.ReadUInt16( nLang ); break;
+ case 4 : rIn.ReadUInt16( nLang ); break;
+ default :
{
- case 0 : break;
- case 1 : rIn.ReadUInt16( aEntry.nDontKnow ); break;
- case 2 : rIn.ReadUInt16( nLang ); break;
- case 4 : rIn.ReadUInt16( nLang ); break;
- default :
- {
- rIn.SeekRel( 2 );
- }
+ rIn.SeekRel( 2 );
}
- if ( nLang )
+ }
+ if ( nLang )
+ {
+ // #i119985#, we could probably handle this better if we have a
+ // place to override the final language for weak
+ // characters/fields to fallback to, rather than the current
+ // application locale. Assuming that we can determine what the
+ // default fallback language for a given .ppt, etc is during
+ // load time.
+ if (i == 2)
{
- // #i119985#, we could probably handle this better if we have a
- // place to override the final language for weak
- // characters/fields to fallback to, rather than the current
- // application locale. Assuming that we can determine what the
- // default fallback language for a given .ppt, etc is during
- // load time.
- if (i == 2)
- {
- aEntry.nLanguage[ 0 ] = aEntry.nLanguage[ 1 ] = aEntry.nLanguage[ 2 ] = LanguageType(nLang);
- }
+ aEntry.nLanguage[ 0 ] = aEntry.nLanguage[ 1 ] = aEntry.nLanguage[ 2 ] = LanguageType(nLang);
}
- nFlags &= ~i;
}
- aList.push_back( aEntry );
+ nFlags &= ~i;
}
- bValid = rIn.Tell() == rRecHd.GetRecEndFilePos();
- }
- catch (const SvStreamEOFException&)
- {
- SAL_WARN("filter.ms", "EOF");
- bValid = false;
+ aList.push_back( aEntry );
}
+ bValid = rIn.Tell() == rRecHd.GetRecEndFilePos();
return bValid;
}
diff --git a/include/sal/log-areas.dox b/include/sal/log-areas.dox
index 4bdd3fb19a23..0d286366d598 100644
--- a/include/sal/log-areas.dox
+++ b/include/sal/log-areas.dox
@@ -228,7 +228,6 @@ certain functionality.
@li @c filter.ms - escher import/export
@li @c filter.odfflatxml
@li @c filter.os2met
- at li @c filter.pcx
@li @c filter.pdf
@li @c filter.pict
@li @c filter.psd
diff --git a/include/tools/stream.hxx b/include/tools/stream.hxx
index 2032b30f1d74..fab4b005b40b 100644
--- a/include/tools/stream.hxx
+++ b/include/tools/stream.hxx
@@ -672,11 +672,4 @@ public:
virtual sal_uInt64 TellEnd() override { FlushBuffer(); return nEndOfData; }
};
-/** thrown when reading past the end of file */
-class TOOLS_DLLPUBLIC SvStreamEOFException : public std::exception
-{
-public:
- virtual const char * what() const throw() override;
-};
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/qa/unit/data/qpro/fail/CVE-2007-5745-1.wb2 b/sc/qa/unit/data/qpro/pass/CVE-2007-5745-1.wb2
similarity index 100%
rename from sc/qa/unit/data/qpro/fail/CVE-2007-5745-1.wb2
rename to sc/qa/unit/data/qpro/pass/CVE-2007-5745-1.wb2
diff --git a/sc/qa/unit/data/qpro/fail/CVE-2007-5745-2.wb2 b/sc/qa/unit/data/qpro/pass/CVE-2007-5745-2.wb2
similarity index 100%
rename from sc/qa/unit/data/qpro/fail/CVE-2007-5745-2.wb2
rename to sc/qa/unit/data/qpro/pass/CVE-2007-5745-2.wb2
diff --git a/sc/qa/unit/data/qpro/fail/ofz14090-1.wb2 b/sc/qa/unit/data/qpro/pass/ofz14090-1.wb2
similarity index 100%
rename from sc/qa/unit/data/qpro/fail/ofz14090-1.wb2
rename to sc/qa/unit/data/qpro/pass/ofz14090-1.wb2
diff --git a/sc/source/filter/excel/read.cxx b/sc/source/filter/excel/read.cxx
index 7b1dd32503fa..cf9465a37c95 100644
--- a/sc/source/filter/excel/read.cxx
+++ b/sc/source/filter/excel/read.cxx
@@ -69,734 +69,727 @@ namespace
ErrCode ImportExcel::Read()
{
- ErrCode eLastErr = ERRCODE_NONE;
- try
+ XclImpPageSettings& rPageSett = GetPageSettings();
+ XclImpTabViewSettings& rTabViewSett = GetTabViewSettings();
+ XclImpPalette& rPal = GetPalette();
+ XclImpFontBuffer& rFontBfr = GetFontBuffer();
+ XclImpNumFmtBuffer& rNumFmtBfr = GetNumFmtBuffer();
+ XclImpXFBuffer& rXFBfr = GetXFBuffer();
+ XclImpNameManager& rNameMgr = GetNameManager();
+ // call to GetCurrSheetDrawing() cannot be cached (changes in new sheets)
+
+ enum STATE {
+ Z_BiffNull, // not a valid Biff-Format
+ Z_Biff2, // Biff2: only one table
+
+ Z_Biff3, // Biff3: only one table
+
+ Z_Biff4, // Biff4: only one table
+ Z_Biff4W, // Biff4 Workbook: Globals
+ Z_Biff4T, // Biff4 Workbook: a table itself
+ Z_Biff4E, // Biff4 Workbook: between tables
+
+ Z_Biff5WPre,// Biff5: Prefetch Workbook
+ Z_Biff5W, // Biff5: Globals
+ Z_Biff5TPre,// Biff5: Prefetch for Shrfmla/Array Formula
+ Z_Biff5T, // Biff5: a table itself
+ Z_Biff5E, // Biff5: between tables
+ Z_Biffn0, // all Biffs: skip table till next EOF
+ Z_End };
+
+ STATE eCurrent = Z_BiffNull, ePrev = Z_BiffNull;
+
+ ErrCode eLastErr = ERRCODE_NONE;
+ sal_uInt16 nOpcode;
+ sal_uInt16 nBofLevel = 0;
+
+ std::unique_ptr< ScfSimpleProgressBar > pProgress( new ScfSimpleProgressBar(
+ aIn.GetSvStreamSize(), GetDocShell(), STR_LOAD_DOC ) );
+
+ /* #i104057# Need to track a base position for progress bar calculation,
+ because sheet substreams may not be in order of sheets. */
+ std::size_t nProgressBasePos = 0;
+ std::size_t nProgressBaseSize = 0;
+
+ for (; eCurrent != Z_End; mnLastRecId = nOpcode)
{
- XclImpPageSettings& rPageSett = GetPageSettings();
- XclImpTabViewSettings& rTabViewSett = GetTabViewSettings();
- XclImpPalette& rPal = GetPalette();
- XclImpFontBuffer& rFontBfr = GetFontBuffer();
- XclImpNumFmtBuffer& rNumFmtBfr = GetNumFmtBuffer();
- XclImpXFBuffer& rXFBfr = GetXFBuffer();
- XclImpNameManager& rNameMgr = GetNameManager();
- // call to GetCurrSheetDrawing() cannot be cached (changes in new sheets)
-
- enum STATE {
- Z_BiffNull, // not a valid Biff-Format
- Z_Biff2, // Biff2: only one table
-
- Z_Biff3, // Biff3: only one table
-
- Z_Biff4, // Biff4: only one table
- Z_Biff4W, // Biff4 Workbook: Globals
- Z_Biff4T, // Biff4 Workbook: a table itself
- Z_Biff4E, // Biff4 Workbook: between tables
-
- Z_Biff5WPre,// Biff5: Prefetch Workbook
- Z_Biff5W, // Biff5: Globals
- Z_Biff5TPre,// Biff5: Prefetch for Shrfmla/Array Formula
- Z_Biff5T, // Biff5: a table itself
- Z_Biff5E, // Biff5: between tables
- Z_Biffn0, // all Biffs: skip table till next EOF
- Z_End };
-
- STATE eCurrent = Z_BiffNull, ePrev = Z_BiffNull;
-
- sal_uInt16 nOpcode;
- sal_uInt16 nBofLevel = 0;
-
- std::unique_ptr< ScfSimpleProgressBar > pProgress( new ScfSimpleProgressBar(
- aIn.GetSvStreamSize(), GetDocShell(), STR_LOAD_DOC ) );
-
- /* #i104057# Need to track a base position for progress bar calculation,
- because sheet substreams may not be in order of sheets. */
- std::size_t nProgressBasePos = 0;
- std::size_t nProgressBaseSize = 0;
-
- for (; eCurrent != Z_End; mnLastRecId = nOpcode)
+ if( eCurrent == Z_Biff5E )
{
- if( eCurrent == Z_Biff5E )
+ sal_uInt16 nScTab = GetCurrScTab();
+ if( nScTab < maSheetOffsets.size() )
{
- sal_uInt16 nScTab = GetCurrScTab();
- if( nScTab < maSheetOffsets.size() )
- {
- nProgressBaseSize += (aIn.GetSvStreamPos() - nProgressBasePos);
- nProgressBasePos = maSheetOffsets[ nScTab ];
+ nProgressBaseSize += (aIn.GetSvStreamPos() - nProgressBasePos);
+ nProgressBasePos = maSheetOffsets[ nScTab ];
- bool bValid = TryStartNextRecord(aIn, nProgressBasePos);
- if (!bValid)
- {
- // Safeguard ourselves from potential infinite loop.
- eCurrent = Z_End;
- }
- }
- else
+ bool bValid = TryStartNextRecord(aIn, nProgressBasePos);
+ if (!bValid)
+ {
+ // Safeguard ourselves from potential infinite loop.
eCurrent = Z_End;
+ }
}
else
- aIn.StartNextRecord();
+ eCurrent = Z_End;
+ }
+ else
+ aIn.StartNextRecord();
- nOpcode = aIn.GetRecId();
+ nOpcode = aIn.GetRecId();
- if( !aIn.IsValid() )
+ if( !aIn.IsValid() )
+ {
+ // finalize table if EOF is missing
+ switch( eCurrent )
{
- // finalize table if EOF is missing
- switch( eCurrent )
- {
- case Z_Biff2:
- case Z_Biff3:
- case Z_Biff4:
- case Z_Biff4T:
- case Z_Biff5TPre:
- case Z_Biff5T:
- rNumFmtBfr.CreateScFormats();
- Eof();
- break;
- default:;
- }
+ case Z_Biff2:
+ case Z_Biff3:
+ case Z_Biff4:
+ case Z_Biff4T:
+ case Z_Biff5TPre:
+ case Z_Biff5T:
+ rNumFmtBfr.CreateScFormats();
+ Eof();
break;
+ default:;
}
+ break;
+ }
- if( eCurrent == Z_End )
- break;
+ if( eCurrent == Z_End )
+ break;
- if( eCurrent != Z_Biff5TPre && eCurrent != Z_Biff5WPre )
- pProgress->ProgressAbs( nProgressBaseSize + aIn.GetSvStreamPos() - nProgressBasePos );
+ if( eCurrent != Z_Biff5TPre && eCurrent != Z_Biff5WPre )
+ pProgress->ProgressAbs( nProgressBaseSize + aIn.GetSvStreamPos() - nProgressBasePos );
- switch( eCurrent )
- {
+ switch( eCurrent )
+ {
- case Z_BiffNull: // ------------------------------- Z_BiffNull -
+ case Z_BiffNull: // ------------------------------- Z_BiffNull -
+ {
+ switch( nOpcode )
{
- switch( nOpcode )
+ case EXC_ID2_BOF:
+ case EXC_ID3_BOF:
+ case EXC_ID4_BOF:
+ case EXC_ID5_BOF:
{
- case EXC_ID2_BOF:
- case EXC_ID3_BOF:
- case EXC_ID4_BOF:
- case EXC_ID5_BOF:
+ // #i23425# don't rely on the record ID, but on the detected BIFF version
+ switch( GetBiff() )
{
- // #i23425# don't rely on the record ID, but on the detected BIFF version
- switch( GetBiff() )
- {
- case EXC_BIFF2:
- Bof2();
- if( pExcRoot->eDateiTyp == Biff2 )
- {
- eCurrent = Z_Biff2;
- NewTable();
- }
- break;
- case EXC_BIFF3:
- Bof3();
- if( pExcRoot->eDateiTyp == Biff3 )
- {
- eCurrent = Z_Biff3;
- NewTable();
- }
- break;
- case EXC_BIFF4:
- Bof4();
- if( pExcRoot->eDateiTyp == Biff4 )
- {
- eCurrent = Z_Biff4;
- NewTable();
- }
- else if( pExcRoot->eDateiTyp == Biff4W )
- eCurrent = Z_Biff4W;
- break;
- case EXC_BIFF5:
- Bof5();
- if( pExcRoot->eDateiTyp == Biff5W )
- {
- eCurrent = Z_Biff5WPre;
-
- nBdshtTab = 0;
-
- aIn.StoreGlobalPosition(); // store position
- }
- else if( pExcRoot->eDateiTyp == Biff5 )
- {
- // #i62752# possible to have BIFF5 sheet without globals
- NewTable();
- eCurrent = Z_Biff5TPre; // Shrfmla Prefetch, Row-Prefetch
- nBofLevel = 0;
- aIn.StoreGlobalPosition(); // store position
- }
- break;
- default:
- DBG_ERROR_BIFF();
- }
+ case EXC_BIFF2:
+ Bof2();
+ if( pExcRoot->eDateiTyp == Biff2 )
+ {
+ eCurrent = Z_Biff2;
+ NewTable();
+ }
+ break;
+ case EXC_BIFF3:
+ Bof3();
+ if( pExcRoot->eDateiTyp == Biff3 )
+ {
+ eCurrent = Z_Biff3;
+ NewTable();
+ }
+ break;
+ case EXC_BIFF4:
+ Bof4();
+ if( pExcRoot->eDateiTyp == Biff4 )
+ {
+ eCurrent = Z_Biff4;
+ NewTable();
+ }
+ else if( pExcRoot->eDateiTyp == Biff4W )
+ eCurrent = Z_Biff4W;
+ break;
+ case EXC_BIFF5:
+ Bof5();
+ if( pExcRoot->eDateiTyp == Biff5W )
+ {
+ eCurrent = Z_Biff5WPre;
+
+ nBdshtTab = 0;
+
+ aIn.StoreGlobalPosition(); // store position
+ }
+ else if( pExcRoot->eDateiTyp == Biff5 )
+ {
+ // #i62752# possible to have BIFF5 sheet without globals
+ NewTable();
+ eCurrent = Z_Biff5TPre; // Shrfmla Prefetch, Row-Prefetch
+ nBofLevel = 0;
+ aIn.StoreGlobalPosition(); // store position
+ }
+ break;
+ default:
+ DBG_ERROR_BIFF();
}
- break;
}
- }
break;
+ }
+ }
+ break;
- case Z_Biff2: // ---------------------------------- Z_Biff2 -
+ case Z_Biff2: // ---------------------------------- Z_Biff2 -
+ {
+ switch( nOpcode )
{
- switch( nOpcode )
- {
- case EXC_ID2_DIMENSIONS:
- case EXC_ID3_DIMENSIONS: ReadDimensions(); break;
- case EXC_ID2_BLANK:
- case EXC_ID3_BLANK: ReadBlank(); break;
- case EXC_ID2_INTEGER: ReadInteger(); break;
- case EXC_ID2_NUMBER:
- case EXC_ID3_NUMBER: ReadNumber(); break;
- case EXC_ID2_LABEL:
- case EXC_ID3_LABEL: ReadLabel(); break;
- case EXC_ID2_BOOLERR:
- case EXC_ID3_BOOLERR: ReadBoolErr(); break;
- case EXC_ID_RK: ReadRk(); break;
-
- case 0x06: Formula25(); break; // FORMULA [ 2 5]
- case 0x08: Row25(); break; // ROW [ 2 5]
- case 0x0A: // EOF [ 2345]
- rNumFmtBfr.CreateScFormats();
- rNameMgr.ConvertAllTokens();
- Eof();
+ case EXC_ID2_DIMENSIONS:
+ case EXC_ID3_DIMENSIONS: ReadDimensions(); break;
+ case EXC_ID2_BLANK:
+ case EXC_ID3_BLANK: ReadBlank(); break;
+ case EXC_ID2_INTEGER: ReadInteger(); break;
+ case EXC_ID2_NUMBER:
+ case EXC_ID3_NUMBER: ReadNumber(); break;
+ case EXC_ID2_LABEL:
+ case EXC_ID3_LABEL: ReadLabel(); break;
+ case EXC_ID2_BOOLERR:
+ case EXC_ID3_BOOLERR: ReadBoolErr(); break;
+ case EXC_ID_RK: ReadRk(); break;
+
+ case 0x06: Formula25(); break; // FORMULA [ 2 5]
+ case 0x08: Row25(); break; // ROW [ 2 5]
+ case 0x0A: // EOF [ 2345]
+ rNumFmtBfr.CreateScFormats();
+ rNameMgr.ConvertAllTokens();
+ Eof();
+ eCurrent = Z_End;
+ break;
+ case 0x14:
+ case 0x15: rPageSett.ReadHeaderFooter( maStrm ); break;
+ case 0x17: Externsheet(); break; // EXTERNSHEET [ 2345]
+ case 0x18: rNameMgr.ReadName( maStrm ); break;
+ case 0x1C: GetCurrSheetDrawing().ReadNote( maStrm );break;
+ case 0x1D: rTabViewSett.ReadSelection( maStrm ); break;
+ case 0x1E: rNumFmtBfr.ReadFormat( maStrm ); break;
+ case 0x20: Columndefault(); break; // COLUMNDEFAULT[ 2 ]
+ case 0x21: Array25(); break; // ARRAY [ 2 5]
+ case 0x23: Externname25(); break; // EXTERNNAME [ 2 5]
+ case 0x24: Colwidth(); break; // COLWIDTH [ 2 ]
+ case 0x25: Defrowheight2(); break; // DEFAULTROWHEI[ 2 ]
+ case 0x26:
+ case 0x27:
+ case 0x28:
+ case 0x29: rPageSett.ReadMargin( maStrm ); break;
+ case 0x2A: rPageSett.ReadPrintHeaders( maStrm ); break;
+ case 0x2B: rPageSett.ReadPrintGridLines( maStrm ); break;
+ case 0x2F: // FILEPASS [ 2345]
+ eLastErr = XclImpDecryptHelper::ReadFilepass( maStrm );
+ if( eLastErr != ERRCODE_NONE )
eCurrent = Z_End;
- break;
- case 0x14:
- case 0x15: rPageSett.ReadHeaderFooter( maStrm ); break;
- case 0x17: Externsheet(); break; // EXTERNSHEET [ 2345]
- case 0x18: rNameMgr.ReadName( maStrm ); break;
- case 0x1C: GetCurrSheetDrawing().ReadNote( maStrm );break;
- case 0x1D: rTabViewSett.ReadSelection( maStrm ); break;
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list