summaryrefslogtreecommitdiff
path: root/filter/source/msfilter/escherex.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'filter/source/msfilter/escherex.cxx')
-rw-r--r--filter/source/msfilter/escherex.cxx262
1 files changed, 130 insertions, 132 deletions
diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx
index bd25e5248c79..b5be935d9b95 100644
--- a/filter/source/msfilter/escherex.cxx
+++ b/filter/source/msfilter/escherex.cxx
@@ -19,6 +19,7 @@
#include "eschesdo.hxx"
#include <o3tl/any.hxx>
+#include <o3tl/string_view.hxx>
#include <svx/svdxcgv.hxx>
#include <svx/svdomedia.hxx>
#include <svx/xflftrit.hxx>
@@ -30,6 +31,7 @@
#include <svx/svdoole2.hxx>
#include <svx/sdtfsitm.hxx>
#include <editeng/outlobj.hxx>
+#include <utility>
#include <vcl/graph.hxx>
#include <vcl/cvtgrf.hxx>
#include <vcl/svapp.hxx>
@@ -91,6 +93,7 @@
#include <sal/log.hxx>
#include <basegfx/polygon/b2dpolypolygontools.hxx>
#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <basegfx/numeric/ftools.hxx>
#include <osl/diagnose.h>
#include <algorithm>
@@ -106,8 +109,8 @@ EscherExContainer::EscherExContainer( SvStream& rSt, const sal_uInt16 nRecType,
}
EscherExContainer::~EscherExContainer()
{
- sal_uInt32 nPos = rStrm.Tell();
- sal_uInt32 nSize= nPos - nContPos;
+ sal_uInt64 nPos = rStrm.Tell();
+ sal_uInt32 nSize = nPos - nContPos;
if ( nSize )
{
rStrm.Seek( nContPos - 4 );
@@ -124,8 +127,8 @@ EscherExAtom::EscherExAtom( SvStream& rSt, const sal_uInt16 nRecType, const sal_
}
EscherExAtom::~EscherExAtom()
{
- sal_uInt32 nPos = rStrm.Tell();
- sal_uInt32 nSize= nPos - nContPos;
+ sal_uInt64 nPos = rStrm.Tell();
+ sal_uInt32 nSize = nPos - nContPos;
if ( nSize )
{
rStrm.Seek( nContPos - 4 );
@@ -206,14 +209,13 @@ void EscherPropertyContainer::AddOpt(
void EscherPropertyContainer::AddOpt(
sal_uInt16 nPropID,
- const OUString& rString)
+ std::u16string_view rString)
{
std::vector<sal_uInt8> aBuf;
- aBuf.reserve(rString.getLength() * 2 + 2);
+ aBuf.reserve(rString.size() * 2 + 2);
- for(sal_Int32 i(0); i < rString.getLength(); i++)
+ for(const sal_Unicode nUnicode: rString)
{
- const sal_Unicode nUnicode(rString[i]);
aBuf.push_back(static_cast<sal_uInt8>(nUnicode));
aBuf.push_back(static_cast<sal_uInt8>(nUnicode >> 8));
}
@@ -405,7 +407,7 @@ void EscherPropertyContainer::CreateGradientProperties(
nFillType = ESCHER_FillShadeScale;
nAngle = (rGradient.Angle * 0x10000) / 10;
nFillFocus = (sal::static_int_cast<int>(rGradient.Style) ==
- sal::static_int_cast<int>(GradientStyle::Linear)) ? 0 : 50;
+ sal::static_int_cast<int>(css::awt::GradientStyle_LINEAR)) ? 0 : 50;
}
break;
case awt::GradientStyle_RADIAL :
@@ -596,7 +598,7 @@ void EscherPropertyContainer::CreateFillProperties(
uno::Any aAny;
AddOpt( ESCHER_Prop_WrapText, ESCHER_WrapNone );
AddOpt( ESCHER_Prop_AnchorText, ESCHER_AnchorMiddle );
- static const OUStringLiteral aPropName( u"FillStyle" );
+ static constexpr OUString aPropName( u"FillStyle"_ustr );
if ( EscherPropertyValueHelper::GetPropertyValue(
aAny, rXPropSet, aPropName ) )
@@ -928,16 +930,16 @@ bool EscherPropertyContainer::GetLineArrow( const bool bLineStart,
if ( !bIsMapped && comphelper::string::getTokenCount(aArrowStartName, ' ') == 2 )
{
sal_Int32 nIdx{ 0 };
- OUString aArrowName( aArrowStartName.getToken( 0, ' ', nIdx ) );
- if ( aArrowName == "msArrowEnd" )
+ std::u16string_view aArrowName( o3tl::getToken(aArrowStartName, 0, ' ', nIdx ) );
+ if ( aArrowName == u"msArrowEnd" )
reLineEnd = ESCHER_LineArrowEnd;
- else if ( aArrowName == "msArrowOpenEnd" )
+ else if ( aArrowName == u"msArrowOpenEnd" )
reLineEnd = ESCHER_LineArrowOpenEnd;
- else if ( aArrowName == "msArrowStealthEnd" )
+ else if ( aArrowName == u"msArrowStealthEnd" )
reLineEnd = ESCHER_LineArrowStealthEnd;
- else if ( aArrowName == "msArrowDiamondEnd" )
+ else if ( aArrowName == u"msArrowDiamondEnd" )
reLineEnd = ESCHER_LineArrowDiamondEnd;
- else if ( aArrowName == "msArrowOvalEnd" )
+ else if ( aArrowName == u"msArrowOvalEnd" )
reLineEnd = ESCHER_LineArrowOvalEnd;
else
nIdx = -1;
@@ -945,8 +947,8 @@ bool EscherPropertyContainer::GetLineArrow( const bool bLineStart,
// now we have the arrow, and try to determine the arrow size;
if ( nIdx>0 )
{
- OUString aArrowSize( aArrowStartName.getToken( 0, ' ', nIdx ) );
- sal_Int32 nArrowSize = aArrowSize.toInt32();
+ std::u16string_view aArrowSize = o3tl::getToken(aArrowStartName, 0, ' ', nIdx );
+ sal_Int32 nArrowSize = o3tl::toInt32(aArrowSize);
rnArrowWidth = ( nArrowSize - 1 ) / 3;
rnArrowLength = nArrowSize - ( rnArrowWidth * 3 ) - 1;
}
@@ -1339,8 +1341,7 @@ bool EscherPropertyContainer::CreateOLEGraphicProperties(const uno::Reference<dr
const Graphic* pGraphic = pOle2Obj->GetGraphic();
if (pGraphic)
{
- Graphic aGraphic(*pGraphic);
- GraphicObject aGraphicObject(aGraphic);
+ GraphicObject aGraphicObject(*pGraphic);
bRetValue = CreateGraphicProperties(rXShape, aGraphicObject);
}
}
@@ -1415,10 +1416,10 @@ void EscherPropertyContainer::CreateEmbeddedBitmapProperties(
uno::Reference<graphic::XGraphic> xGraphic(rxBitmap, uno::UNO_QUERY);
if (!xGraphic.is())
return;
- const Graphic aGraphic(xGraphic);
+ Graphic aGraphic(xGraphic);
if (aGraphic.IsNone())
return;
- const GraphicObject aGraphicObject(aGraphic);
+ GraphicObject aGraphicObject(std::move(aGraphic));
if (aGraphicObject.GetType() == GraphicType::NONE)
return;
if (ImplCreateEmbeddedBmp(aGraphicObject))
@@ -1464,7 +1465,7 @@ void EscherPropertyContainer::CreateEmbeddedHatchProperties(const drawing::Hatch
{
const tools::Rectangle aRect(pShapeBoundRect ? *pShapeBoundRect : tools::Rectangle(Point(0,0), Size(28000, 21000)));
Graphic aGraphic(lclDrawHatch(rHatch, rBackColor, bFillBackground, aRect));
- GraphicObject aGraphicObject(aGraphic);
+ GraphicObject aGraphicObject(std::move(aGraphic));
if (ImplCreateEmbeddedBmp(aGraphicObject))
AddOpt( ESCHER_Prop_fillType, ESCHER_FillTexture );
@@ -1631,7 +1632,9 @@ bool EscherPropertyContainer::CreateGraphicProperties(const uno::Reference<beans
nFormat != GraphicFileFormat::TIF &&
nFormat != GraphicFileFormat::PCT &&
nFormat != GraphicFileFormat::WMF &&
- nFormat != GraphicFileFormat::EMF) )
+ nFormat != GraphicFileFormat::WMZ &&
+ nFormat != GraphicFileFormat::EMF &&
+ nFormat != GraphicFileFormat::EMZ) )
{
std::unique_ptr<SvStream> pIn(::utl::UcbStreamHelper::CreateStream(
aTmp.GetMainURL( INetURLObject::DecodeMechanism::NONE ), StreamMode::READ ));
@@ -1773,7 +1776,7 @@ bool EscherPropertyContainer::CreateGraphicProperties(const uno::Reference<beans
{
EscherGraphicProvider aProvider;
SvMemoryStream aMemStrm;
- GraphicObject aGraphicObject(aGraphic);
+ GraphicObject aGraphicObject(std::move(aGraphic));
if (aProvider.GetBlibID(aMemStrm, aGraphicObject, nullptr, pGraphicAttr.get(), bOOxmlExport))
{
@@ -1997,47 +2000,45 @@ bool EscherPropertyContainer::CreatePolygonProperties(
}
}
- if(0 != nTotalPoints && aSegments.size() >= 6 && aVertices.size() >= 6)
- {
- // Little endian
- aVertices[0] = static_cast<sal_uInt8>(nTotalPoints);
- aVertices[1] = static_cast<sal_uInt8>(nTotalPoints >> 8);
- aVertices[2] = static_cast<sal_uInt8>(nTotalPoints);
- aVertices[3] = static_cast<sal_uInt8>(nTotalPoints >> 8);
-
- aSegments.push_back(static_cast<sal_uInt8>(0));
- aSegments.push_back(static_cast<sal_uInt8>(0x80));
-
- const sal_uInt32 nSegmentBufSize(aSegments.size() - 6);
- aSegments[0] = static_cast<sal_uInt8>(nSegmentBufSize >> 1);
- aSegments[1] = static_cast<sal_uInt8>(nSegmentBufSize >> 9);
- aSegments[2] = static_cast<sal_uInt8>(nSegmentBufSize >> 1);
- aSegments[3] = static_cast<sal_uInt8>(nSegmentBufSize >> 9);
-
- AddOpt(
- ESCHER_Prop_geoRight,
- rGeoRect.Width);
- AddOpt(
- ESCHER_Prop_geoBottom,
- rGeoRect.Height);
- AddOpt(
- ESCHER_Prop_shapePath,
- ESCHER_ShapeComplex);
- AddOpt(
- ESCHER_Prop_pVertices,
- true,
- aVertices.size() - 6,
- aVertices);
- AddOpt(
- ESCHER_Prop_pSegmentInfo,
- true,
- aSegments.size(),
- aSegments);
+ if(0 == nTotalPoints || aSegments.size() < 6 || aVertices.size() < 6)
+ return false;
- return true;
- }
+ // Little endian
+ aVertices[0] = static_cast<sal_uInt8>(nTotalPoints);
+ aVertices[1] = static_cast<sal_uInt8>(nTotalPoints >> 8);
+ aVertices[2] = static_cast<sal_uInt8>(nTotalPoints);
+ aVertices[3] = static_cast<sal_uInt8>(nTotalPoints >> 8);
+
+ aSegments.push_back(static_cast<sal_uInt8>(0));
+ aSegments.push_back(static_cast<sal_uInt8>(0x80));
+
+ const sal_uInt32 nSegmentBufSize(aSegments.size() - 6);
+ aSegments[0] = static_cast<sal_uInt8>(nSegmentBufSize >> 1);
+ aSegments[1] = static_cast<sal_uInt8>(nSegmentBufSize >> 9);
+ aSegments[2] = static_cast<sal_uInt8>(nSegmentBufSize >> 1);
+ aSegments[3] = static_cast<sal_uInt8>(nSegmentBufSize >> 9);
+
+ AddOpt(
+ ESCHER_Prop_geoRight,
+ rGeoRect.Width);
+ AddOpt(
+ ESCHER_Prop_geoBottom,
+ rGeoRect.Height);
+ AddOpt(
+ ESCHER_Prop_shapePath,
+ ESCHER_ShapeComplex);
+ AddOpt(
+ ESCHER_Prop_pVertices,
+ true,
+ aVertices.size() - 6,
+ aVertices);
+ AddOpt(
+ ESCHER_Prop_pSegmentInfo,
+ true,
+ aSegments.size(),
+ aSegments);
- return false;
+ return true;
}
@@ -2452,13 +2453,13 @@ static void ConvertEnhancedCustomShapeEquation(
sal_Int32 i;
for ( i = 0; i < nEquationSourceCount; i++ )
{
- EnhancedCustomShape2d aCustoShape2d(
+ EnhancedCustomShape2d aCustomShape2d(
const_cast< SdrObjCustomShape& >(rSdrObjCustomShape));
try
{
std::shared_ptr< EnhancedCustomShape::ExpressionNode > aExpressNode(
EnhancedCustomShape::FunctionParser::parseFunction(
- sEquationSource[ i ], aCustoShape2d));
+ sEquationSource[ i ], aCustomShape2d));
drawing::EnhancedCustomShapeParameter aPara( aExpressNode->fillNode( rEquations, nullptr, 0 ) );
if ( aPara.Type != drawing::EnhancedCustomShapeParameterType::EQUATION )
{
@@ -2517,7 +2518,7 @@ bool EscherPropertyContainer::IsDefaultObject(
{
switch(eShapeType)
{
- // if the custom shape is not default shape of ppt, return sal_Fasle;
+ // if the custom shape is not default shape of ppt, return false;
case mso_sptTearDrop:
return false;
@@ -2538,13 +2539,13 @@ bool EscherPropertyContainer::IsDefaultObject(
void EscherPropertyContainer::LookForPolarHandles( const MSO_SPT eShapeType, sal_Int32& nAdjustmentsWhichNeedsToBeConverted )
{
const mso_CustomShape* pDefCustomShape = GetCustomShapeContent( eShapeType );
- if ( !(pDefCustomShape && pDefCustomShape->nHandles && pDefCustomShape->pHandles) )
+ if ( !pDefCustomShape || pDefCustomShape->pHandles.empty() )
return;
- sal_Int32 k, nkCount = pDefCustomShape->nHandles;
- const SvxMSDffHandle* pData = pDefCustomShape->pHandles;
- for ( k = 0; k < nkCount; k++, pData++ )
+ sal_Int32 k, nkCount = pDefCustomShape->pHandles.size();
+ for (k = 0; k < nkCount; k++)
{
+ const SvxMSDffHandle* pData = &pDefCustomShape->pHandles[k];
if ( pData->nFlags & SvxMSDffHandleFlags::POLAR )
{
if ( ( pData->nPositionY >= 0x256 ) || ( pData->nPositionY <= 0x107 ) )
@@ -2595,14 +2596,14 @@ void EscherPropertyContainer::CreateCustomShapeProperties( const MSO_SPT eShapeT
if ( !(aGeoPropSet >>= aGeoPropSeq) )
return;
- static const OUStringLiteral sViewBox ( u"ViewBox" );
- static const OUStringLiteral sTextRotateAngle ( u"TextRotateAngle" );
- static const OUStringLiteral sExtrusion ( u"Extrusion" );
- static const OUStringLiteral sEquations ( u"Equations" );
- static const OUStringLiteral sPath ( u"Path" );
- static const OUStringLiteral sTextPath ( u"TextPath" );
- static const OUStringLiteral sHandles ( u"Handles" );
- static const OUStringLiteral sAdjustmentValues ( u"AdjustmentValues" );
+ static constexpr OUStringLiteral sViewBox ( u"ViewBox" );
+ static constexpr OUStringLiteral sTextRotateAngle ( u"TextRotateAngle" );
+ static constexpr OUString sExtrusion ( u"Extrusion"_ustr );
+ static constexpr OUStringLiteral sEquations ( u"Equations" );
+ static constexpr OUStringLiteral sPath ( u"Path" );
+ static constexpr OUString sTextPath ( u"TextPath"_ustr );
+ static constexpr OUStringLiteral sHandles ( u"Handles" );
+ static constexpr OUStringLiteral sAdjustmentValues ( u"AdjustmentValues" );
bool bAdjustmentValuesProp = false;
uno::Any aAdjustmentValuesProp;
@@ -2849,8 +2850,9 @@ void EscherPropertyContainer::CreateCustomShapeProperties( const MSO_SPT eShapeT
drawing::Direction3D aExtrusionRotationCenter;
if ( rrProp.Value >>= aExtrusionRotationCenter )
{
- AddOpt( DFF_Prop_c3DRotationCenterX, static_cast<sal_Int32>( aExtrusionRotationCenter.DirectionX * 360.0 ) );
- AddOpt( DFF_Prop_c3DRotationCenterY, static_cast<sal_Int32>( aExtrusionRotationCenter.DirectionY * 360.0 ) );
+ // tdf#145904 X- and Y-component is fraction, Z-component in EMU
+ AddOpt( DFF_Prop_c3DRotationCenterX, static_cast<sal_Int32>( aExtrusionRotationCenter.DirectionX * 65536.0 ) );
+ AddOpt( DFF_Prop_c3DRotationCenterY, static_cast<sal_Int32>( aExtrusionRotationCenter.DirectionY * 65536.0 ) );
AddOpt( DFF_Prop_c3DRotationCenterZ, static_cast<sal_Int32>( aExtrusionRotationCenter.DirectionZ * 360.0 ) );
nFillHarshFlags &=~8; // don't use AutoRotationCenter;
}
@@ -2859,7 +2861,11 @@ void EscherPropertyContainer::CreateCustomShapeProperties( const MSO_SPT eShapeT
{
double fExtrusionShininess = 0;
if ( rrProp.Value >>= fExtrusionShininess )
- AddOpt( DFF_Prop_c3DShininess, static_cast<sal_Int32>( fExtrusionShininess * 655.36 ) );
+ {
+ // ODF to MS Office conversion invers to msdffimp.cxx
+ fExtrusionShininess = std::round(fExtrusionShininess / 10.0);
+ AddOpt( DFF_Prop_c3DShininess, static_cast<sal_Int32>(fExtrusionShininess) );
+ }
}
else if ( rrProp.Name == "Skew" )
{
@@ -2876,7 +2882,7 @@ void EscherPropertyContainer::CreateCustomShapeProperties( const MSO_SPT eShapeT
{
double fExtrusionSpecularity = 0;
if ( rrProp.Value >>= fExtrusionSpecularity )
- AddOpt( DFF_Prop_c3DSpecularAmt, static_cast<sal_Int32>( fExtrusionSpecularity * 1333 ) );
+ AddOpt( DFF_Prop_c3DSpecularAmt, static_cast<sal_Int32>( fExtrusionSpecularity * 655.36 ) );
}
else if ( rrProp.Name == "ProjectionMode" )
{
@@ -3446,7 +3452,7 @@ void EscherPropertyContainer::CreateCustomShapeProperties( const MSO_SPT eShapeT
AddOpt(DFF_Prop_gtextAlign,gTextAlign);
}
}
- if((nTextPathFlags & 0x4000) != 0) // Is Font work
+ if((nTextPathFlags & 0x4000) != 0) // Is Fontwork
{
OutlinerParaObject* pOutlinerParaObject(rSdrObjCustomShape.GetOutlinerParaObject());
if ( pOutlinerParaObject && pOutlinerParaObject->IsEffectivelyVertical() )
@@ -3713,8 +3719,7 @@ MSO_SPT EscherPropertyContainer::GetCustomShapeType( const uno::Reference< drawi
// In case of VML export, try to handle the
// ooxml- prefix in rShapeType. If that fails,
// just do the same as the binary export.
- OString aType = OUStringToOString(rShapeType, RTL_TEXTENCODING_UTF8);
- eShapeType = msfilter::util::GETVMLShapeType(aType);
+ eShapeType = msfilter::util::GETVMLShapeType(rShapeType);
if (eShapeType == mso_sptNil)
eShapeType = EnhancedCustomShapeTypeNames::Get(rShapeType);
}
@@ -3750,22 +3755,22 @@ bool EscherPropertyContainer::CreateBlipPropertiesforOLEControl(const uno::Refer
const uno::Reference<drawing::XShape> & rXShape)
{
SdrObject* pShape = SdrObject::getSdrObjectFromXShape(rXShape);
- if ( pShape )
- {
- const Graphic aGraphic(SdrExchangeView::GetObjGraphic(*pShape));
- const GraphicObject aGraphicObject(aGraphic);
+ if ( !pShape )
+ return false;
+
+ Graphic aGraphic(SdrExchangeView::GetObjGraphic(*pShape));
+ const GraphicObject aGraphicObject(std::move(aGraphic));
- if (!aGraphicObject.GetUniqueID().isEmpty())
+ if (!aGraphicObject.GetUniqueID().isEmpty())
+ {
+ if ( pGraphicProvider && pPicOutStrm && pShapeBoundRect )
{
- if ( pGraphicProvider && pPicOutStrm && pShapeBoundRect )
+ sal_uInt32 nBlibId = pGraphicProvider->GetBlibID(*pPicOutStrm, aGraphicObject);
+ if ( nBlibId )
{
- sal_uInt32 nBlibId = pGraphicProvider->GetBlibID(*pPicOutStrm, aGraphicObject);
- if ( nBlibId )
- {
- AddOpt( ESCHER_Prop_pib, nBlibId, true );
- ImplCreateGraphicAttributes( rXPropSet, nBlibId, false );
- return true;
- }
+ AddOpt( ESCHER_Prop_pib, nBlibId, true );
+ ImplCreateGraphicAttributes( rXPropSet, nBlibId, false );
+ return true;
}
}
}
@@ -3783,12 +3788,8 @@ EscherPersistTable::~EscherPersistTable()
bool EscherPersistTable::PtIsID( sal_uInt32 nID )
{
- for(auto const & pPtr : maPersistTable) {
- if ( pPtr->mnID == nID ) {
- return true;
- }
- }
- return false;
+ return std::any_of(maPersistTable.begin(), maPersistTable.end(),
+ [&nID](const auto& rxEntry) { return rxEntry->mnID == nID; });
}
void EscherPersistTable::PtInsert( sal_uInt32 nID, sal_uInt32 nOfs )
@@ -4052,7 +4053,8 @@ void EscherGraphicProvider::WriteBlibStoreContainer( SvStream& rSt, SvStream* pM
if ( pMergePicStreamBSE )
{
- sal_uInt32 nBlipSize, nOldPos = pMergePicStreamBSE->Tell();
+ sal_uInt32 nBlipSize;
+ sal_uInt64 nOldPos = pMergePicStreamBSE->Tell();
const sal_uInt32 nBuf = 0x40000; // 256KB buffer
std::unique_ptr<sal_uInt8[]> pBuf(new sal_uInt8[ nBuf ]);
@@ -4196,15 +4198,13 @@ sal_uInt32 EscherGraphicProvider::GetBlibID( SvStream& rPicOutStrm, GraphicObjec
SvMemoryStream aGIFStream;
const char* const pString = "MSOFFICE9.0";
aGIFStream.WriteBytes(pString, strlen(pString));
- nErrCode = rFilter.ExportGraphic( aGraphic, OUString(), aGIFStream,
+ nErrCode = rFilter.ExportGraphic( aGraphic, u"", aGIFStream,
rFilter.GetExportFormatNumberForShortName( u"GIF" ) );
SAL_WARN_IF(
nErrCode != ERRCODE_NONE, "filter.ms",
"ExportGraphic to GIF failed with " << nErrCode);
if (nErrCode == ERRCODE_NONE)
{
- uno::Sequence<beans::PropertyValue> aFilterData( 1 );
- uno::Sequence<beans::PropertyValue> aAdditionalChunkSequence( 1 );
sal_uInt32 nGIFSreamLen = aGIFStream.Tell();
uno::Sequence<sal_Int8> aGIFSeq( nGIFSreamLen );
sal_Int8* pSeq = aGIFSeq.getArray();
@@ -4213,11 +4213,11 @@ sal_uInt32 EscherGraphicProvider::GetBlibID( SvStream& rPicOutStrm, GraphicObjec
beans::PropertyValue aChunkProp, aFilterProp;
aChunkProp.Name = "msOG";
aChunkProp.Value <<= aGIFSeq;
- aAdditionalChunkSequence[ 0 ] = aChunkProp;
+ uno::Sequence<beans::PropertyValue> aAdditionalChunkSequence{ aChunkProp };
aFilterProp.Name = "AdditionalChunks";
aFilterProp.Value <<= aAdditionalChunkSequence;
- aFilterData[ 0 ] = aFilterProp;
- nErrCode = rFilter.ExportGraphic( aGraphic, OUString(), aStream,
+ uno::Sequence<beans::PropertyValue> aFilterData{ aFilterProp };
+ nErrCode = rFilter.ExportGraphic( aGraphic, u"", aStream,
rFilter.GetExportFormatNumberForShortName( u"PNG" ), &aFilterData );
}
}
@@ -4341,7 +4341,7 @@ sal_uInt32 EscherGraphicProvider::GetBlibID( SvStream& rPicOutStrm, GraphicObjec
}
if ( nAtomSize )
{
- sal_uInt32 nPos = rPicOutStrm.Tell();
+ sal_uInt64 nPos = rPicOutStrm.Tell();
rPicOutStrm.Seek( nAtomSize - 4 );
rPicOutStrm.WriteUInt32( nPos - nAtomSize );
rPicOutStrm.Seek( nPos );
@@ -4371,8 +4371,8 @@ struct EscherShapeListEntry
uno::Reference<drawing::XShape>aXShape;
sal_uInt32 n_EscherId;
- EscherShapeListEntry(const uno::Reference<drawing::XShape> & rShape, sal_uInt32 nId)
- : aXShape(rShape)
+ EscherShapeListEntry(uno::Reference<drawing::XShape> xShape, sal_uInt32 nId)
+ : aXShape(std::move(xShape))
, n_EscherId(nId)
{}
};
@@ -4561,7 +4561,7 @@ sal_uInt32 EscherConnectorListEntry::GetConnectorRule( bool bFirst )
else if ( nGluePointType == drawing::EnhancedCustomShapeGluePointType::SEGMENTS )
{
tools::PolyPolygon aPolyPoly;
- SdrObjectUniquePtr pTemporaryConvertResultObject(pSdrObjCustomShape->DoConvertToPolyObj(true, true));
+ rtl::Reference<SdrObject> pTemporaryConvertResultObject(pSdrObjCustomShape->DoConvertToPolyObj(true, true));
SdrPathObj* pSdrPathObj(dynamic_cast< SdrPathObj* >(pTemporaryConvertResultObject.get()));
if(pSdrPathObj)
@@ -4572,7 +4572,7 @@ sal_uInt32 EscherConnectorListEntry::GetConnectorRule( bool bFirst )
}
// do *not* forget to delete the temporary used SdrObject - possible memory leak (!)
- pTemporaryConvertResultObject.reset();
+ pTemporaryConvertResultObject.clear();
pSdrPathObj = nullptr;
if(0 != aPolyPoly.Count())
@@ -4860,10 +4860,9 @@ public:
}
-EscherEx::EscherEx(const std::shared_ptr<EscherExGlobal>& rxGlobal, SvStream* pOutStrm, bool bOOXML)
- : mxGlobal(rxGlobal)
+EscherEx::EscherEx(std::shared_ptr<EscherExGlobal> xGlobal, SvStream* pOutStrm, bool bOOXML)
+ : mxGlobal(std::move(xGlobal))
, mpOutStrm(pOutStrm)
- , mbOwnsStrm(false)
, mnCurrentDg(0)
, mnCountOfs(0)
, mnGroupLevel(0)
@@ -4874,8 +4873,8 @@ EscherEx::EscherEx(const std::shared_ptr<EscherExGlobal>& rxGlobal, SvStream* pO
{
if (!mpOutStrm)
{
- mpOutStrm = new SvNullStream();
- mbOwnsStrm = true;
+ mxOwnStrm = std::make_unique<SvNullStream>();
+ mpOutStrm = mxOwnStrm.get();
}
mnStrmStartOfs = mpOutStrm->Tell();
mpImplEESdrWriter.reset( new ImplEESdrWriter( *this ) );
@@ -4883,8 +4882,6 @@ EscherEx::EscherEx(const std::shared_ptr<EscherExGlobal>& rxGlobal, SvStream* pO
EscherEx::~EscherEx()
{
- if (mbOwnsStrm)
- delete mpOutStrm;
}
void EscherEx::Flush( SvStream* pPicStreamMergeBSE /* = NULL */ )
@@ -4924,7 +4921,8 @@ void EscherEx::Flush( SvStream* pPicStreamMergeBSE /* = NULL */ )
void EscherEx::InsertAtCurrentPos( sal_uInt32 nBytes )
{
- sal_uInt32 nSize, nType, nSource, nBufSize, nToCopy, nCurPos = mpOutStrm->Tell();
+ sal_uInt32 nSize, nType, nSource, nBufSize, nToCopy;
+ sal_uInt64 nCurPos = mpOutStrm->Tell();
// adjust persist table
for(auto const & pPtr : maPersistTable) {
@@ -4939,7 +4937,7 @@ void EscherEx::InsertAtCurrentPos( sal_uInt32 nBytes )
while ( mpOutStrm->Tell() < nCurPos )
{
mpOutStrm->ReadUInt32( nType ).ReadUInt32( nSize );
- sal_uInt32 nEndOfRecord = mpOutStrm->Tell() + nSize;
+ sal_uInt64 nEndOfRecord = mpOutStrm->Tell() + nSize;
bool bContainer = (nType & 0x0F) == 0x0F;
/* Expand the record, if the insertion position is inside, or if the
position is at the end of a container (expands always), or at the
@@ -5016,7 +5014,7 @@ bool EscherEx::SeekToPersistOffset( sal_uInt32 nKey )
void EscherEx::InsertAtPersistOffset( sal_uInt32 nKey, sal_uInt32 nValue )
{
- sal_uInt32 nOldPos = mpOutStrm->Tell();
+ sal_uInt64 nOldPos = mpOutStrm->Tell();
bool bRetValue = SeekToPersistOffset( nKey );
if ( bRetValue )
{
@@ -5083,8 +5081,8 @@ void EscherEx::OpenContainer( sal_uInt16 nEscherContainer, int nRecInstance )
void EscherEx::CloseContainer()
{
- sal_uInt32 nSize, nPos = mpOutStrm->Tell();
- nSize = ( nPos - mOffsets.back() ) - 4;
+ sal_uInt64 nPos = mpOutStrm->Tell();
+ sal_uInt32 nSize = ( nPos - mOffsets.back() ) - 4;
mpOutStrm->Seek( mOffsets.back() );
mpOutStrm->WriteUInt32( nSize );
@@ -5127,7 +5125,7 @@ void EscherEx::BeginAtom()
void EscherEx::EndAtom( sal_uInt16 nRecType, int nRecVersion, int nRecInstance )
{
- sal_uInt32 nOldPos = mpOutStrm->Tell();
+ sal_uInt64 nOldPos = mpOutStrm->Tell();
mpOutStrm->Seek( mnCountOfs );
sal_uInt32 nSize = nOldPos - mnCountOfs;
mpOutStrm->WriteUInt16( ( nRecInstance << 4 ) | ( nRecVersion & 0xf ) ).WriteUInt16( nRecType ).WriteUInt32( nSize - 8 );
@@ -5219,7 +5217,7 @@ void EscherEx::SetGroupSnapRect( sal_uInt32 nGroupLevel, const tools::Rectangle&
{
if ( nGroupLevel )
{
- sal_uInt32 nCurrentPos = mpOutStrm->Tell();
+ sal_uInt64 nCurrentPos = mpOutStrm->Tell();
if ( DoSeek( ESCHER_Persist_Grouping_Snap | ( nGroupLevel - 1 ) ) )
{
mpOutStrm ->WriteInt32( rRect.Left() ) // Bounding box for the grouped shapes to which they will be attached
@@ -5235,7 +5233,7 @@ void EscherEx::SetGroupLogicRect( sal_uInt32 nGroupLevel, const tools::Rectangle
{
if ( nGroupLevel )
{
- sal_uInt32 nCurrentPos = mpOutStrm->Tell();
+ sal_uInt64 nCurrentPos = mpOutStrm->Tell();
if ( DoSeek( ESCHER_Persist_Grouping_Logic | ( nGroupLevel - 1 ) ) )
{
mpOutStrm->WriteInt16( rRect.Top() ).WriteInt16( rRect.Left() ).WriteInt16( rRect.Right() ).WriteInt16( rRect.Bottom() );