drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx | 3 include/vcl/metaact.hxx | 137 --- vcl/source/filter/svm/SvmReader.cxx | 451 ++----------- vcl/source/gdi/metaact.cxx | 21 4 files changed, 104 insertions(+), 508 deletions(-)
New commits: commit 7f35303c3161486727c4b94033ac973af187d47c Author: Noel Grandin <[email protected]> AuthorDate: Thu Sep 4 13:00:16 2025 +0200 Commit: Noel Grandin <[email protected]> CommitDate: Thu Sep 4 17:06:26 2025 +0200 remove setters from MetaAction classes to make it obvious these are constructed once and then (mostly) not changed Change-Id: Iebba987736755bdb0974c9adf9cd333ac004c574 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190584 Tested-by: Jenkins Reviewed-by: Noel Grandin <[email protected]> diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx index 7d8c1f93647c..6c8160f09a70 100644 --- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx @@ -2637,9 +2637,8 @@ void VclMetafileProcessor2D::processTransparencePrimitive2D( GDIMetaFile* pMetaFile(mpOutputDevice->GetConnectMetaFile()); rtl::Reference<::MetaFloatTransparentAction> pAction(new MetaFloatTransparentAction( aContentMetafile, aPrimitiveRectangle.TopLeft(), aPrimitiveRectangle.GetSize(), - std::move(aVCLGradient))); + std::move(aVCLGradient), std::move(aSVGTransparencyColorStops))); - pAction->addSVGTransparencyColorStops(aSVGTransparencyColorStops); pMetaFile->AddAction(pAction); } else diff --git a/include/vcl/metaact.hxx b/include/vcl/metaact.hxx index 74ece4d2f211..0ca9b1fe87ca 100644 --- a/include/vcl/metaact.hxx +++ b/include/vcl/metaact.hxx @@ -122,8 +122,6 @@ public: const Point& GetPoint() const { return maPt; } const Color& GetColor() const { return maColor; } - void SetPoint(const Point& rPt) { maPt = rPt; } - void SetColor(Color rColor) { maColor = rColor; } }; class VCL_DLLPUBLIC MetaPointAction final : public MetaAction @@ -149,7 +147,6 @@ public: SAL_DLLPRIVATE virtual void Scale( double fScaleX, double fScaleY ) override; const Point& GetPoint() const { return maPt; } - void SetPoint(const Point& rPt) { maPt = rPt; } }; class VCL_DLLPUBLIC MetaLineAction final : public MetaAction @@ -182,9 +179,6 @@ public: const Point& GetStartPoint() const { return maStartPt; } const Point& GetEndPoint() const { return maEndPt; } const LineInfo& GetLineInfo() const { return maLineInfo; } - void SetStartPoint(const Point& rPoint) { maStartPt = rPoint; } - void SetEndPoint(const Point& rPoint) { maEndPt = rPoint; } - void SetLineInfo(const LineInfo& rLineInfo) { maLineInfo = rLineInfo; } }; class VCL_DLLPUBLIC MetaRectAction final : public MetaAction @@ -211,7 +205,6 @@ public: SAL_DLLPRIVATE virtual void Scale( double fScaleX, double fScaleY ) override; const tools::Rectangle& GetRect() const { return maRect; } - void SetRect(const tools::Rectangle& rRect) { maRect = rRect; } }; class VCL_DLLPUBLIC MetaRoundRectAction final : public MetaAction @@ -243,9 +236,6 @@ public: const tools::Rectangle& GetRect() const { return maRect; } sal_uInt32 GetHorzRound() const { return mnHorzRound; } sal_uInt32 GetVertRound() const { return mnVertRound; } - void SetRect(const tools::Rectangle& rRect) { maRect = rRect; } - void SetHorzRound(sal_uInt32 rHorzRound) { mnHorzRound = rHorzRound; } - void SetVertRound(sal_uInt32 rVertRound) { mnVertRound = rVertRound; } }; class VCL_DLLPUBLIC MetaEllipseAction final : public MetaAction @@ -272,7 +262,6 @@ public: SAL_DLLPRIVATE virtual void Scale( double fScaleX, double fScaleY ) override; const tools::Rectangle& GetRect() const { return maRect; } - void SetRect(const tools::Rectangle& rRect) { maRect = rRect; } }; class VCL_DLLPUBLIC MetaArcAction final : public MetaAction @@ -304,9 +293,6 @@ public: const tools::Rectangle& GetRect() const { return maRect; } const Point& GetStartPoint() const { return maStartPt; } const Point& GetEndPoint() const { return maEndPt; } - void SetRect(const tools::Rectangle& rRect) { maRect = rRect; } - void SetStartPoint(const Point& rPoint) { maStartPt = rPoint; } - void SetEndPoint(const Point& rPoint) { maEndPt = rPoint; } }; class VCL_DLLPUBLIC MetaPieAction final : public MetaAction @@ -338,9 +324,6 @@ public: const tools::Rectangle& GetRect() const { return maRect; } const Point& GetStartPoint() const { return maStartPt; } const Point& GetEndPoint() const { return maEndPt; } - void SetRect(const tools::Rectangle& rRect) { maRect = rRect; } - void SetStartPoint(const Point& rPoint) { maStartPt = rPoint; } - void SetEndPoint(const Point& rPoint) { maEndPt = rPoint; } }; class VCL_DLLPUBLIC MetaChordAction final : public MetaAction @@ -372,9 +355,6 @@ public: const tools::Rectangle& GetRect() const { return maRect; } const Point& GetStartPoint() const { return maStartPt; } const Point& GetEndPoint() const { return maEndPt; } - void SetRect(const tools::Rectangle& rRect) { maRect = rRect; } - void SetStartPoint(const Point& rPoint) { maStartPt = rPoint; } - void SetEndPoint(const Point& rPoint) { maEndPt = rPoint; } }; class VCL_DLLPUBLIC MetaPolyLineAction final : public MetaAction @@ -404,8 +384,6 @@ public: const tools::Polygon& GetPolygon() const { return maPoly; } const LineInfo& GetLineInfo() const { return maLineInfo; } - void SetLineInfo(const LineInfo& rLineInfo) { maLineInfo = rLineInfo; } - void SetPolygon(const tools::Polygon& rPoly) { maPoly = rPoly; } }; class VCL_DLLPUBLIC MetaPolygonAction final : public MetaAction @@ -432,7 +410,6 @@ public: SAL_DLLPRIVATE virtual void Scale( double fScaleX, double fScaleY ) override; const tools::Polygon& GetPolygon() const { return maPoly; } - void SetPolygon(const tools::Polygon& rPoly) { maPoly = rPoly; } }; class VCL_DLLPUBLIC MetaPolyPolygonAction final : public MetaAction @@ -459,7 +436,6 @@ public: SAL_DLLPRIVATE virtual void Scale( double fScaleX, double fScaleY ) override; const tools::PolyPolygon& GetPolyPolygon() const { return maPolyPoly; } - void SetPolyPolygon(const tools::PolyPolygon& rPolyPoly) { maPolyPoly = rPolyPoly; } }; class SAL_DLLPUBLIC_RTTI MetaTextAction final : public MetaAction @@ -493,10 +469,6 @@ public: const OUString& GetText() const { return maStr; } sal_Int32 GetIndex() const { return mnIndex; } sal_Int32 GetLen() const { return mnLen; } - void SetPoint(const Point& rPt) { maPt = rPt; } - void SetText(const OUString& rStr) { maStr = rStr; } - void SetIndex(sal_Int32 rIndex) { mnIndex = rIndex; } - void SetLen(sal_Int32 rLen) { mnLen = rLen; } }; class VCL_DLLPUBLIC MetaTextArrayAction final : public MetaAction @@ -546,20 +518,6 @@ public: sal_Int32 GetLayoutContextLen() const { return mnLayoutContextLen; } const KernArray& GetDXArray() const { return maDXAry; } const std::vector<sal_Bool> & GetKashidaArray() const { return maKashidaAry; } - void SetPoint(const Point& rPt) { maStartPt = rPt; } - void SetText(const OUString& rStr) { maStr = rStr; } - void SetIndex(sal_Int32 rIndex) { mnIndex = rIndex; } - void SetLen(sal_Int32 rLen) { mnLen = rLen; } - void SetLayoutContextIndex(sal_Int32 nLayoutContextIndex) - { - mnLayoutContextIndex = nLayoutContextIndex; - } - void SetLayoutContextLen(sal_Int32 nLayoutContextLen) - { - mnLayoutContextLen = nLayoutContextLen; - } - SAL_DLLPRIVATE void SetDXArray(KernArray aArray); - SAL_DLLPRIVATE void SetKashidaArray(std::vector<sal_Bool> aArray); }; class SAL_DLLPUBLIC_RTTI MetaStretchTextAction final : public MetaAction @@ -596,11 +554,6 @@ public: sal_uInt32 GetWidth() const { return mnWidth; } sal_Int32 GetIndex() const { return mnIndex; } sal_Int32 GetLen() const { return mnLen; } - void SetPoint(const Point& rPt) { maPt = rPt; } - void SetText(const OUString& rStr) { maStr = rStr; } - void SetWidth(sal_uInt32 rWidth) { mnWidth = rWidth; } - void SetIndex(sal_uInt32 rIndex) { mnIndex = rIndex; } - void SetLen(sal_uInt32 rLen) { mnLen = rLen; } }; class SAL_DLLPUBLIC_RTTI MetaTextRectAction final : public MetaAction @@ -632,9 +585,6 @@ public: const tools::Rectangle& GetRect() const { return maRect; } const OUString& GetText() const { return maStr; } DrawTextFlags GetStyle() const { return mnStyle; } - void SetRect(const tools::Rectangle& rRect) { maRect = rRect; } - void SetText(const OUString& rStr) { maStr = rStr; } - void SetStyle(DrawTextFlags rStyle) { mnStyle = rStyle; } }; class SAL_DLLPUBLIC_RTTI MetaTextLineAction final : public MetaAction @@ -671,11 +621,6 @@ public: FontStrikeout GetStrikeout() const { return meStrikeout; } FontLineStyle GetUnderline() const { return meUnderline; } FontLineStyle GetOverline() const { return meOverline; } - void SetStartPoint(const Point& rPos) { maPos = rPos; } - void SetWidth(tools::Long rWidth) { mnWidth = rWidth; } - void SetStrikeout(FontStrikeout eStrikeout) { meStrikeout = eStrikeout; } - void SetUnderline(FontLineStyle eUnderline) { meUnderline = eUnderline; } - void SetOverline(FontLineStyle eOverline) { meOverline = eOverline; } }; class VCL_DLLPUBLIC MetaBmpAction final : public MetaAction @@ -704,8 +649,6 @@ public: const Bitmap& GetBitmap() const { return maBmp; } const Point& GetPoint() const { return maPt; } - void SetBitmap(const Bitmap& rBmp) { maBmp = rBmp; } - void SetPoint(const Point& rPt) { maPt = rPt; } }; class VCL_DLLPUBLIC MetaBmpScaleAction final : public MetaAction @@ -737,9 +680,6 @@ public: const Bitmap& GetBitmap() const { return maBmp; } const Point& GetPoint() const { return maPt; } const Size& GetSize() const { return maSz; } - void SetBitmap(const Bitmap& rBmp) { maBmp = rBmp; } - void SetPoint(const Point& rPt) { maPt = rPt; } - void SetSize(const Size& rSz) { maSz = rSz; } }; class VCL_DLLPUBLIC MetaBmpScalePartAction final : public MetaAction @@ -776,11 +716,6 @@ public: const Size& GetDestSize() const { return maDstSz; } const Point& GetSrcPoint() const { return maSrcPt; } const Size& GetSrcSize() const { return maSrcSz; } - void SetBitmap(const Bitmap& rBmp) { maBmp = rBmp; } - void SetDestPoint(const Point& rPt) { maDstPt = rPt; } - void SetDestSize(const Size& rSz) { maDstSz = rSz; } - void SetSrcPoint(const Point& rPt) { maSrcPt = rPt; } - void SetSrcSize(const Size& rSz) { maSrcSz = rSz; } }; class VCL_DLLPUBLIC MetaBmpExAction final : public MetaAction @@ -809,8 +744,6 @@ public: const Bitmap& GetBitmap() const { return maBmp; } const Point& GetPoint() const { return maPt; } - void SetBitmap(const Bitmap& rBmp) { maBmp = rBmp; } - void SetPoint(const Point& rPt) { maPt = rPt; } bool IsTransparent() const override { return GetBitmap().HasAlpha(); } }; @@ -843,9 +776,6 @@ public: const Bitmap& GetBitmap() const { return maBmp; } const Point& GetPoint() const { return maPt; } const Size& GetSize() const { return maSz; } - void SetBitmap(const Bitmap& rBmp) { maBmp = rBmp; } - void SetPoint(const Point& rPt) { maPt = rPt; } - void SetSize(const Size& rSz) { maSz = rSz; } bool IsTransparent() const override { return GetBitmap().HasAlpha(); } }; @@ -883,11 +813,6 @@ public: const Size& GetDestSize() const { return maDstSz; } const Point& GetSrcPoint() const { return maSrcPt; } const Size& GetSrcSize() const { return maSrcSz; } - void SetBitmap(const Bitmap& rBmp) { maBmp = rBmp; } - void SetDestPoint(const Point& rDstPt) { maDstPt = rDstPt; } - void SetDestSize(const Size& rDstSz) { maDstSz = rDstSz; } - void SetSrcPoint(const Point& rSrcPt) { maSrcPt = rSrcPt; } - void SetSrcSize(const Size& rSrcSz) { maSrcSz = rSrcSz; } bool IsTransparent() const override { return GetBitmap().HasAlpha(); } }; @@ -921,8 +846,6 @@ public: const Bitmap& GetBitmap() const { return maBmp; } const Color& GetColor() const { return maColor; } const Point& GetPoint() const { return maPt; } - void SetBitmap(const Bitmap& rBmp) { maBmp = rBmp; } - void SetPoint(const Point& rPt) { maPt = rPt; } }; class SAL_DLLPUBLIC_RTTI MetaMaskScaleAction final : public MetaAction @@ -957,9 +880,6 @@ public: const Color& GetColor() const { return maColor; } const Point& GetPoint() const { return maPt; } const Size& GetSize() const { return maSz; } - void SetBitmap(const Bitmap& rBmp) { maBmp = rBmp; } - void SetPoint(const Point& rPt) { maPt = rPt; } - void SetSize(const Size& rSz) { maSz = rSz; } }; class SAL_DLLPUBLIC_RTTI MetaMaskScalePartAction final : public MetaAction @@ -999,12 +919,6 @@ public: const Size& GetDestSize() const { return maDstSz; } const Point& GetSrcPoint() const { return maSrcPt; } const Size& GetSrcSize() const { return maSrcSz; } - void SetBitmap(const Bitmap& rBmp) { maBmp = rBmp; } - void SetColor(Color rColor) { maColor = rColor; } - void SetDestPoint(const Point& rPt) { maDstPt = rPt; } - void SetDestSize(const Size& rSz) { maDstSz = rSz; } - void SetSrcPoint(const Point& rPt) { maSrcPt = rPt; } - void SetSrcSize(const Size& rSz) { maSrcSz = rSz; } }; class SAL_DLLPUBLIC_RTTI MetaGradientAction final : public MetaAction @@ -1033,8 +947,6 @@ public: const tools::Rectangle& GetRect() const { return maRect; } const Gradient& GetGradient() const { return maGradient; } - void SetGradient(const Gradient& rGradient) { maGradient = rGradient; } - void SetRect(const tools::Rectangle& rRect) { maRect = rRect; } }; class VCL_DLLPUBLIC MetaGradientExAction final : public MetaAction @@ -1063,8 +975,6 @@ public: const tools::PolyPolygon& GetPolyPolygon() const { return maPolyPoly; } const Gradient& GetGradient() const { return maGradient; } - void SetPolyPolygon(const tools::PolyPolygon& rPolyPoly) { maPolyPoly = rPolyPoly; } - void SetGradient(const Gradient& rGradient) { maGradient = rGradient; } }; class SAL_DLLPUBLIC_RTTI MetaHatchAction final : public MetaAction @@ -1093,8 +1003,6 @@ public: const tools::PolyPolygon& GetPolyPolygon() const { return maPolyPoly; } const Hatch& GetHatch() const { return maHatch; } - void SetPolyPolygon(const tools::PolyPolygon& rPolyPoly) { maPolyPoly = rPolyPoly; } - void SetHatch(const Hatch& rHatch) { maHatch = rHatch; } }; class VCL_DLLPUBLIC MetaWallpaperAction final : public MetaAction @@ -1124,7 +1032,6 @@ public: const tools::Rectangle& GetRect() const { return maRect; } const Wallpaper& GetWallpaper() const { return maWallpaper; } - void SetWallpaper(const Wallpaper& rWallpaper) { maWallpaper = rWallpaper; } }; class VCL_DLLPUBLIC MetaClipRegionAction final : public MetaAction @@ -1153,8 +1060,6 @@ public: const vcl::Region& GetRegion() const { return maRegion; } bool IsClipping() const { return mbClip; } - void SetRegion(const vcl::Region& rRegion) { maRegion = rRegion; } - void SetClipping(bool bClip) { mbClip = bClip; } }; class VCL_DLLPUBLIC MetaISectRectClipRegionAction final : public MetaAction @@ -1181,7 +1086,6 @@ public: SAL_DLLPRIVATE virtual void Scale( double fScaleX, double fScaleY ) override; const tools::Rectangle& GetRect() const { return maRect; } - void SetRect(const tools::Rectangle& rRect) { maRect = rRect; } }; class VCL_DLLPUBLIC MetaISectRegionClipRegionAction final : public MetaAction @@ -1208,7 +1112,6 @@ public: SAL_DLLPRIVATE virtual void Scale( double fScaleX, double fScaleY ) override; const vcl::Region& GetRegion() const { return maRegion; } - void SetRegion(const vcl::Region& rRegion) { maRegion = rRegion; } }; class VCL_DLLPUBLIC MetaMoveClipRegionAction final : public MetaAction @@ -1236,8 +1139,6 @@ public: tools::Long GetHorzMove() const { return mnHorzMove; } tools::Long GetVertMove() const { return mnVertMove; } - void SetHorzMove(tools::Long nHorzMove) { mnHorzMove = nHorzMove; } - void SetVertMove(tools::Long nVertMove) { mnVertMove = nVertMove; } }; class VCL_DLLPUBLIC MetaLineColorAction final : public MetaAction @@ -1263,8 +1164,6 @@ public: const Color& GetColor() const { return maColor; } bool IsSetting() const { return mbSet; } - void SetColor(const Color& rColor) { maColor = rColor; } - void SetSetting(bool rSet) { mbSet = rSet; } }; class VCL_DLLPUBLIC MetaFillColorAction final : public MetaAction @@ -1290,8 +1189,6 @@ public: const Color& GetColor() const { return maColor; } bool IsSetting() const { return mbSet; } - void SetSetting(bool rSet) { mbSet = rSet; } - void SetColor(Color rColor) { maColor = rColor; } }; @@ -1316,7 +1213,6 @@ public: explicit MetaTextColorAction( const Color& ); const Color& GetColor() const { return maColor; } - void SetColor(Color rColor) { maColor = rColor; } }; class VCL_DLLPUBLIC MetaTextFillColorAction final : public MetaAction @@ -1341,8 +1237,6 @@ public: MetaTextFillColorAction( const Color& rColor, bool bSet ); const Color& GetColor() const { return maColor; } - void SetColor(Color rColor) { maColor = rColor; } - void SetSetting(bool bSet) { mbSet = bSet; } bool IsSetting() const { return mbSet; } }; @@ -1369,8 +1263,6 @@ public: SAL_DLLPRIVATE MetaTextLineColorAction( const Color& rColor, bool bSet ); const Color& GetColor() const { return maColor; } - void SetColor(const Color& rColor) { maColor = rColor; } - void SetSetting(bool bSet) { mbSet = bSet; } bool IsSetting() const { return mbSet; } }; @@ -1396,8 +1288,6 @@ public: SAL_DLLPRIVATE MetaOverlineColorAction( const Color& rColor, bool bSet ); const Color& GetColor() const { return maColor; } - void SetColor(const Color& rColor) { maColor = rColor; } - void SetSetting(bool bSet) { mbSet = bSet; } bool IsSetting() const { return mbSet; } }; @@ -1422,7 +1312,6 @@ public: explicit MetaTextAlignAction( TextAlign eAlign ); TextAlign GetTextAlign() const { return maAlign; } - void SetTextAlign(TextAlign eAlign) { maAlign = eAlign; } }; class VCL_DLLPUBLIC MetaMapModeAction final : public MetaAction @@ -1448,7 +1337,6 @@ public: SAL_DLLPRIVATE virtual void Scale( double fScaleX, double fScaleY ) override; const MapMode& GetMapMode() const { return maMapMode; } - void SetMapMode(const MapMode& rMapMode) { maMapMode = rMapMode; } }; // tdf#127471 decl for friend below @@ -1482,7 +1370,6 @@ public: SAL_DLLPRIVATE virtual void Scale( double fScaleX, double fScaleY ) override; const vcl::Font& GetFont() const { return maFont; } - void SetFont(const vcl::Font& rFont) { maFont = rFont; } }; @@ -1507,7 +1394,6 @@ public: explicit MetaPushAction( vcl::PushFlags nFlags ); vcl::PushFlags GetFlags() const { return mnFlags; } - void SetPushFlags(const vcl::PushFlags nFlags) { mnFlags = nFlags; } }; class VCL_DLLPUBLIC MetaPopAction final : public MetaAction @@ -1547,7 +1433,6 @@ public: explicit MetaRasterOpAction( RasterOp eRasterOp ); RasterOp GetRasterOp() const { return meRasterOp; } - void SetRasterOp(const RasterOp eRasterOp) { meRasterOp = eRasterOp; } }; class SAL_DLLPUBLIC_RTTI MetaTransparentAction final : public MetaAction @@ -1576,8 +1461,6 @@ public: const tools::PolyPolygon& GetPolyPolygon() const { return maPolyPoly; } sal_uInt16 GetTransparence() const { return mnTransPercent; } - void SetPolyPolygon(const tools::PolyPolygon& rPolyPoly) { maPolyPoly = rPolyPoly; } - void SetTransparence(const sal_uInt16 nTransPercent) { mnTransPercent = nTransPercent; } bool IsTransparent() const override { return true; } }; @@ -1607,7 +1490,8 @@ public: SAL_DLLPRIVATE virtual rtl::Reference<MetaAction> Clone() const override; MetaFloatTransparentAction( const GDIMetaFile& rMtf, const Point& rPos, - const Size& rSize, Gradient aGradient ); + const Size& rSize, Gradient aGradient, + std::optional<basegfx::BColorStops> oStops = std::nullopt); SAL_DLLPRIVATE virtual void Move( tools::Long nHorzMove, tools::Long nVertMove ) override; SAL_DLLPRIVATE virtual void Scale( double fScaleX, double fScaleY ) override; @@ -1616,16 +1500,11 @@ public: const Point& GetPoint() const { return maPoint; } const Size& GetSize() const { return maSize; } const Gradient& GetGradient() const { return maGradient; } - void SetGDIMetaFile(const GDIMetaFile &rMtf) { maMtf = rMtf; } - void SetPoint(const Point& rPoint) { maPoint = rPoint; } - void SetSize(const Size& rSize) { maSize = rSize; } - void SetGradient(const Gradient& rGradient) { maGradient = rGradient; } bool IsTransparent() const override { return true; } // tdf#155479 allow holding MCGR infos const basegfx::BColorStops* getSVGTransparencyColorStops() const { return !maSVGTransparencyColorStops ? nullptr : &(*maSVGTransparencyColorStops); } - void addSVGTransparencyColorStops(const basegfx::BColorStops& rSVGTransparencyColorStops); }; class UNLESS_MERGELIBS(VCL_DLLPUBLIC) MetaEPSAction final : public MetaAction @@ -1659,10 +1538,6 @@ public: const GDIMetaFile& GetSubstitute() const { return maSubst; } const Point& GetPoint() const { return maPoint; } const Size& GetSize() const { return maSize; } - void SetLink(const GfxLink& rGfxLink) { maGfxLink = rGfxLink; } - void SetSubstitute(const GDIMetaFile& rSubst) { maSubst = rSubst; } - void SetPoint(const Point& rPoint) { maPoint = rPoint; } - void SetSize(const Size& rSize) { maSize = rSize; } }; class VCL_DLLPUBLIC MetaRefPointAction final : public MetaAction @@ -1687,8 +1562,6 @@ public: SAL_DLLPRIVATE MetaRefPointAction( const Point& rRefPoint, bool bSet ); const Point& GetRefPoint() const { return maRefPoint; } - void SetRefPoint(const Point& rRefPoint) { maRefPoint = rRefPoint; } - void SetSetting(const bool bSet) { mbSet = bSet; } bool IsSetting() const { return mbSet; } }; @@ -1722,10 +1595,6 @@ public: sal_Int32 GetValue() const { return mnValue; } sal_uInt32 GetDataSize() const { return mnDataSize; } const sal_uInt8* GetData() const { return mpData.get(); } - void SetComment(const OString& rComment) { maComment = rComment; } - void SetValue(const sal_Int32 nValue) { mnValue = nValue; } - void SetDataSize(const sal_Int32 nDataSize) { mnDataSize = nDataSize; } - void SetData(const sal_uInt8* pData, const sal_uInt32 nDataSize) { ImplInitDynamicData(pData, nDataSize); } }; class VCL_DLLPUBLIC MetaLayoutModeAction final : public MetaAction @@ -1749,7 +1618,6 @@ public: explicit MetaLayoutModeAction( vcl::text::ComplexTextLayoutFlags nLayoutMode ); vcl::text::ComplexTextLayoutFlags GetLayoutMode() const { return mnLayoutMode; } - void SetLayoutMode(const vcl::text::ComplexTextLayoutFlags nLayoutMode) { mnLayoutMode = nLayoutMode; } }; class VCL_DLLPUBLIC MetaTextLanguageAction final : public MetaAction @@ -1773,7 +1641,6 @@ public: SAL_DLLPRIVATE explicit MetaTextLanguageAction( LanguageType ); LanguageType GetTextLanguage() const { return meTextLanguage; } - void SetTextLanguage(const LanguageType eTextLanguage) { meTextLanguage = eTextLanguage; } }; #endif // INCLUDED_VCL_METAACT_HXX diff --git a/vcl/source/filter/svm/SvmReader.cxx b/vcl/source/filter/svm/SvmReader.cxx index a04b60f7f69a..84e3959605a5 100644 --- a/vcl/source/filter/svm/SvmReader.cxx +++ b/vcl/source/filter/svm/SvmReader.cxx @@ -288,24 +288,18 @@ void SvmReader::ReadColor(Color& rColor) rtl::Reference<MetaAction> SvmReader::LineColorHandler() { - rtl::Reference<MetaLineColorAction> pAction(new MetaLineColorAction); - VersionCompatRead aCompat(mrStream); Color aColor; ReadColor(aColor); bool aBool(false); mrStream.ReadCharAsBool(aBool); - pAction->SetSetting(aBool); - pAction->SetColor(aColor); - + rtl::Reference<MetaLineColorAction> pAction(new MetaLineColorAction(aColor, aBool)); return pAction; } rtl::Reference<MetaAction> SvmReader::FillColorHandler() { - rtl::Reference<MetaFillColorAction> pAction(new MetaFillColorAction); - VersionCompatRead aCompat(mrStream); Color aColor; @@ -313,44 +307,36 @@ rtl::Reference<MetaAction> SvmReader::FillColorHandler() bool aBool(false); mrStream.ReadCharAsBool(aBool); - pAction->SetColor(aColor); - pAction->SetSetting(aBool); - + rtl::Reference<MetaFillColorAction> pAction(new MetaFillColorAction(aColor, aBool)); return pAction; } rtl::Reference<MetaAction> SvmReader::RectHandler() { - rtl::Reference<MetaRectAction> pAction(new MetaRectAction); - VersionCompatRead aCompat(mrStream); TypeSerializer aSerializer(mrStream); tools::Rectangle aRectangle; aSerializer.readRectangle(aRectangle); - pAction->SetRect(aRectangle); + rtl::Reference<MetaRectAction> pAction(new MetaRectAction(aRectangle)); return pAction; } rtl::Reference<MetaAction> SvmReader::PointHandler() { - rtl::Reference<MetaPointAction> pAction(new MetaPointAction); - VersionCompatRead aCompat(mrStream); TypeSerializer aSerializer(mrStream); Point aPoint; aSerializer.readPoint(aPoint); - pAction->SetPoint(aPoint); + rtl::Reference<MetaPointAction> pAction(new MetaPointAction(aPoint)); return pAction; } rtl::Reference<MetaAction> SvmReader::PixelHandler() { - rtl::Reference<MetaPixelAction> pAction(new MetaPixelAction); - VersionCompatRead aCompat(mrStream); TypeSerializer aSerializer(mrStream); @@ -359,16 +345,12 @@ rtl::Reference<MetaAction> SvmReader::PixelHandler() Color aColor; ReadColor(aColor); - pAction->SetPoint(aPoint); - pAction->SetColor(aColor); - + rtl::Reference<MetaPixelAction> pAction(new MetaPixelAction(aPoint, aColor)); return pAction; } rtl::Reference<MetaAction> SvmReader::LineHandler() { - rtl::Reference<MetaLineAction> pAction(new MetaLineAction); - VersionCompatRead aCompat(mrStream); // Version 1 @@ -378,24 +360,19 @@ rtl::Reference<MetaAction> SvmReader::LineHandler() aSerializer.readPoint(aPoint); aSerializer.readPoint(aEndPoint); - pAction->SetStartPoint(aPoint); - pAction->SetEndPoint(aEndPoint); - // Version 2 if (aCompat.GetVersion() >= 2) { LineInfo aLineInfo; ReadLineInfo(mrStream, aLineInfo); - pAction->SetLineInfo(aLineInfo); + return new MetaLineAction(aPoint, aEndPoint, aLineInfo); } - - return pAction; + else + return new MetaLineAction(aPoint, aEndPoint); } rtl::Reference<MetaAction> SvmReader::RoundRectHandler() { - rtl::Reference<MetaRoundRectAction> pAction(new MetaRoundRectAction); - VersionCompatRead aCompat(mrStream); TypeSerializer aSerializer(mrStream); @@ -405,32 +382,25 @@ rtl::Reference<MetaAction> SvmReader::RoundRectHandler() sal_uInt32 VertRound(0); mrStream.ReadUInt32(HorzRound).ReadUInt32(VertRound); - pAction->SetRect(aRectangle); - pAction->SetHorzRound(HorzRound); - pAction->SetVertRound(VertRound); - + rtl::Reference<MetaRoundRectAction> pAction( + new MetaRoundRectAction(aRectangle, HorzRound, VertRound)); return pAction; } rtl::Reference<MetaAction> SvmReader::EllipseHandler() { - rtl::Reference<MetaEllipseAction> pAction(new MetaEllipseAction); - VersionCompatRead aCompat(mrStream); TypeSerializer aSerializer(mrStream); tools::Rectangle aRectangle; aSerializer.readRectangle(aRectangle); - pAction->SetRect(aRectangle); - + rtl::Reference<MetaEllipseAction> pAction(new MetaEllipseAction(aRectangle)); return pAction; } rtl::Reference<MetaAction> SvmReader::ArcHandler() { - rtl::Reference<MetaArcAction> pAction(new MetaArcAction); - VersionCompatRead aCompat(mrStream); TypeSerializer aSerializer(mrStream); @@ -441,17 +411,12 @@ rtl::Reference<MetaAction> SvmReader::ArcHandler() Point aEndPoint; aSerializer.readPoint(aEndPoint); - pAction->SetRect(aRectangle); - pAction->SetStartPoint(aPoint); - pAction->SetEndPoint(aEndPoint); - + rtl::Reference<MetaArcAction> pAction(new MetaArcAction(aRectangle, aPoint, aEndPoint)); return pAction; } rtl::Reference<MetaAction> SvmReader::PieHandler() { - rtl::Reference<MetaPieAction> pAction(new MetaPieAction); - VersionCompatRead aCompat(mrStream); TypeSerializer aSerializer(mrStream); @@ -462,17 +427,12 @@ rtl::Reference<MetaAction> SvmReader::PieHandler() Point aEndPoint; aSerializer.readPoint(aEndPoint); - pAction->SetRect(aRectangle); - pAction->SetStartPoint(aPoint); - pAction->SetEndPoint(aEndPoint); - + rtl::Reference<MetaPieAction> pAction(new MetaPieAction(aRectangle, aPoint, aEndPoint)); return pAction; } rtl::Reference<MetaAction> SvmReader::ChordHandler() { - rtl::Reference<MetaChordAction> pAction(new MetaChordAction); - VersionCompatRead aCompat(mrStream); TypeSerializer aSerializer(mrStream); @@ -483,17 +443,12 @@ rtl::Reference<MetaAction> SvmReader::ChordHandler() Point aEndPoint; aSerializer.readPoint(aEndPoint); - pAction->SetRect(aRectangle); - pAction->SetStartPoint(aPoint); - pAction->SetEndPoint(aEndPoint); - + rtl::Reference<MetaChordAction> pAction(new MetaChordAction(aRectangle, aPoint, aEndPoint)); return pAction; } rtl::Reference<MetaAction> SvmReader::PolyLineHandler() { - rtl::Reference<MetaPolyLineAction> pAction(new MetaPolyLineAction); - VersionCompatRead aCompat(mrStream); // Version 1 @@ -501,11 +456,10 @@ rtl::Reference<MetaAction> SvmReader::PolyLineHandler() ReadPolygon(mrStream, aPolygon); // Version 2 + LineInfo aLineInfo; if (aCompat.GetVersion() >= 2) { - LineInfo aLineInfo; ReadLineInfo(mrStream, aLineInfo); - pAction->SetLineInfo(aLineInfo); } if (aCompat.GetVersion() >= 3) { @@ -514,15 +468,15 @@ rtl::Reference<MetaAction> SvmReader::PolyLineHandler() if (bHasPolyFlags) aPolygon.Read(mrStream); } - pAction->SetPolygon(aPolygon); - return pAction; + if (aCompat.GetVersion() < 2) + return new MetaPolyLineAction(aPolygon); + else + return new MetaPolyLineAction(aPolygon, aLineInfo); } rtl::Reference<MetaAction> SvmReader::PolygonHandler() { - rtl::Reference<MetaPolygonAction> pAction(new MetaPolygonAction); - VersionCompatRead aCompat(mrStream); tools::Polygon aPolygon; @@ -536,23 +490,18 @@ rtl::Reference<MetaAction> SvmReader::PolygonHandler() aPolygon.Read(mrStream); } - pAction->SetPolygon(aPolygon); - - return pAction; + return new MetaPolygonAction(aPolygon); } rtl::Reference<MetaAction> SvmReader::PolyPolygonHandler() { - rtl::Reference<MetaPolyPolygonAction> pAction(new MetaPolyPolygonAction); - VersionCompatRead aCompat(mrStream); tools::PolyPolygon aPolyPolygon; ReadPolyPolygon(mrStream, aPolyPolygon); // Version 1 if (aCompat.GetVersion() < 2) // Version 2 { - pAction->SetPolyPolygon(aPolyPolygon); - return pAction; + return new MetaPolyPolygonAction(aPolyPolygon); } sal_uInt16 nNumberOfComplexPolygons(0); @@ -582,15 +531,12 @@ rtl::Reference<MetaAction> SvmReader::PolyPolygonHandler() aPolyPolygon.Replace(aPoly, nIndex); } - pAction->SetPolyPolygon(aPolyPolygon); - + rtl::Reference<MetaPolyPolygonAction> pAction(new MetaPolyPolygonAction(aPolyPolygon)); return pAction; } rtl::Reference<MetaAction> SvmReader::TextHandler(const ImplMetaReadData* pData) { - rtl::Reference<MetaTextAction> pAction(new MetaTextAction); - VersionCompatRead aCompat(mrStream); TypeSerializer aSerializer(mrStream); @@ -602,8 +548,6 @@ rtl::Reference<MetaAction> SvmReader::TextHandler(const ImplMetaReadData* pData) sal_uInt16 nTmpLen(0); mrStream.ReadUInt16(nTmpLen); - pAction->SetPoint(aPoint); - if (aCompat.GetVersion() >= 2) // Version 2 aStr = read_uInt16_lenPrefixed_uInt16s_ToOUString(mrStream); @@ -619,18 +563,12 @@ rtl::Reference<MetaAction> SvmReader::TextHandler(const ImplMetaReadData* pData) nTmpLen = aStr.getLength() - nTmpIndex; } - pAction->SetIndex(nTmpIndex); - pAction->SetLen(nTmpLen); - - pAction->SetText(aStr); - + rtl::Reference<MetaTextAction> pAction(new MetaTextAction(aPoint, aStr, nTmpIndex, nTmpLen)); return pAction; } rtl::Reference<MetaAction> SvmReader::TextArrayHandler(const ImplMetaReadData* pData) { - rtl::Reference<MetaTextArrayAction> pAction(new MetaTextArrayAction); - KernArray aArray; VersionCompatRead aCompat(mrStream); @@ -638,35 +576,29 @@ rtl::Reference<MetaAction> SvmReader::TextArrayHandler(const ImplMetaReadData* p Point aPoint; aSerializer.readPoint(aPoint); - pAction->SetPoint(aPoint); OUString aStr = mrStream.ReadUniOrByteString(pData->meActualCharSet); - pAction->SetText(aStr); - sal_uInt16 nTmpIndex(0); - mrStream.ReadUInt16(nTmpIndex); + sal_uInt16 nStrIndex(0); + mrStream.ReadUInt16(nStrIndex); - sal_uInt16 nTmpLen(0); - mrStream.ReadUInt16(nTmpLen); + sal_uInt16 nStrLen(0); + mrStream.ReadUInt16(nStrLen); sal_Int32 nAryLen(0); mrStream.ReadInt32(nAryLen); - if (nTmpLen > aStr.getLength() - nTmpIndex) + if (nStrLen > aStr.getLength() - nStrIndex) { SAL_WARN("vcl.gdi", "inconsistent offset and len"); - pAction->SetIndex(0); - pAction->SetLen(aStr.getLength()); - return pAction; + return new MetaTextArrayAction(aPoint, aStr, KernArray(), std::vector<sal_Bool>(), 0, + aStr.getLength()); } - pAction->SetIndex(nTmpIndex); - pAction->SetLen(nTmpLen); - if (nAryLen) { // #i9762#, #106172# Ensure that DX array is at least mnLen entries long - if (nTmpLen >= nAryLen) + if (nStrLen >= nAryLen) { try { @@ -678,7 +610,7 @@ rtl::Reference<MetaAction> SvmReader::TextArrayHandler(const ImplMetaReadData* p aArray.push_back(val); } // #106172# setup remainder - for (; i < nTmpLen; i++) + for (; i < nStrLen; i++) aArray.push_back(0); } catch (std::bad_alloc&) @@ -687,45 +619,44 @@ rtl::Reference<MetaAction> SvmReader::TextArrayHandler(const ImplMetaReadData* p } else { - return pAction; + return new MetaTextArrayAction(aPoint, aStr, KernArray(), std::vector<sal_Bool>(), + nStrIndex, nStrLen); } } if (aCompat.GetVersion() >= 2) // Version 2 { aStr = read_uInt16_lenPrefixed_uInt16s_ToOUString(mrStream); - pAction->SetText(aStr); - if (nTmpLen > aStr.getLength() - nTmpIndex) + if (nStrLen > aStr.getLength() - nStrIndex) { SAL_WARN("vcl.gdi", "inconsistent offset and len"); - pAction->SetIndex(0); - pAction->SetLen(aStr.getLength()); + nStrIndex = 0; + nStrLen = aStr.getLength(); aArray.clear(); } } - if (!aArray.empty()) - pAction->SetDXArray(std::move(aArray)); - + std::vector<sal_Bool> aKashidaArray; if (aCompat.GetVersion() >= 3) // Version 3 { sal_uInt32 nKashidaAryLen(0); mrStream.ReadUInt32(nKashidaAryLen); - nTmpLen = std::min(nKashidaAryLen, static_cast<sal_uInt32>(pAction->GetDXArray().size())); + sal_uInt32 nTmpLen = std::min(nKashidaAryLen, static_cast<sal_uInt32>(aArray.size())); if (nTmpLen) { // aKashidaArray, if not empty, must be the same size as aArray - std::vector<sal_Bool> aKashidaArray(pAction->GetDXArray().size(), 0); + aKashidaArray.resize(aArray.size(), 0); for (sal_uInt32 i = 0; i < nTmpLen; i++) { mrStream.ReadUChar(aKashidaArray[i]); } - pAction->SetKashidaArray(std::move(aKashidaArray)); } } + sal_Int32 nLayoutContextIndex = -1; + sal_Int32 nLayoutContextLen = -1; if (aCompat.GetVersion() >= 4) // Version 4 { bool bTmpHasContext = false; @@ -733,34 +664,33 @@ rtl::Reference<MetaAction> SvmReader::TextArrayHandler(const ImplMetaReadData* p if (bTmpHasContext) { - sal_uInt16 nTmpContextIndex = 0; - mrStream.ReadUInt16(nTmpContextIndex); - - sal_uInt16 nTmpContextLen = 0; - mrStream.ReadUInt16(nTmpContextLen); - - sal_uInt16 nTmpEnd = nTmpIndex + nTmpLen; - sal_uInt16 nTmpContextEnd = nTmpContextIndex + nTmpContextLen; - if ((nTmpContextEnd <= aStr.getLength()) && (nTmpContextIndex <= nTmpIndex) + sal_uInt16 nTmp = 0; + mrStream.ReadUInt16(nTmp); + nLayoutContextIndex = nTmp; + mrStream.ReadUInt16(nTmp); + nLayoutContextLen = nTmp; + + sal_uInt16 nTmpEnd = nStrIndex + nStrLen; + sal_uInt16 nTmpContextEnd = nLayoutContextIndex + nLayoutContextLen; + if ((nTmpContextEnd <= aStr.getLength()) && (nLayoutContextIndex <= nStrIndex) && (nTmpContextEnd >= nTmpEnd)) { - pAction->SetLayoutContextIndex(nTmpContextIndex); - pAction->SetLayoutContextLen(nTmpContextLen); } else { + nLayoutContextIndex = -1; + nLayoutContextLen = -1; SAL_WARN("vcl.gdi", "inconsistent layout context offset and len"); } } } - return pAction; + return new MetaTextArrayAction(aPoint, aStr, std::move(aArray), std::move(aKashidaArray), + nStrIndex, nStrLen, nLayoutContextIndex, nLayoutContextLen); } rtl::Reference<MetaAction> SvmReader::StretchTextHandler(const ImplMetaReadData* pData) { - rtl::Reference<MetaStretchTextAction> pAction(new MetaStretchTextAction); - VersionCompatRead aCompat(mrStream); TypeSerializer aSerializer(mrStream); @@ -774,9 +704,6 @@ rtl::Reference<MetaAction> SvmReader::StretchTextHandler(const ImplMetaReadData* sal_uInt16 nTmpLen(0); mrStream.ReadUInt16(nTmpLen); - pAction->SetPoint(aPoint); - pAction->SetWidth(nTmpWidth); - if (aCompat.GetVersion() >= 2) // Version 2 aStr = read_uInt16_lenPrefixed_uInt16s_ToOUString(mrStream); @@ -792,18 +719,13 @@ rtl::Reference<MetaAction> SvmReader::StretchTextHandler(const ImplMetaReadData* nTmpLen = aStr.getLength() - nTmpIndex; } - pAction->SetIndex(nTmpIndex); - pAction->SetLen(nTmpLen); - - pAction->SetText(aStr); - + rtl::Reference<MetaStretchTextAction> pAction( + new MetaStretchTextAction(aPoint, nTmpWidth, aStr, nTmpIndex, nTmpLen)); return pAction; } rtl::Reference<MetaAction> SvmReader::TextRectHandler(const ImplMetaReadData* pData) { - rtl::Reference<MetaTextRectAction> pAction(new MetaTextRectAction); - VersionCompatRead aCompat(mrStream); TypeSerializer aSerializer(mrStream); @@ -813,27 +735,20 @@ rtl::Reference<MetaAction> SvmReader::TextRectHandler(const ImplMetaReadData* pD sal_uInt16 nTmp(0); mrStream.ReadUInt16(nTmp); - pAction->SetRect(aRect); - DrawTextFlags nFlags(static_cast<DrawTextFlags>(nTmp)); const static bool bFuzzing = comphelper::IsFuzzing(); if (bFuzzing) nFlags = nFlags & ~DrawTextFlags::MultiLine; - pAction->SetStyle(nFlags); - if (aCompat.GetVersion() >= 2) // Version 2 aStr = read_uInt16_lenPrefixed_uInt16s_ToOUString(mrStream); - pAction->SetText(aStr); - + rtl::Reference<MetaTextRectAction> pAction(new MetaTextRectAction(aRect, aStr, nFlags)); return pAction; } rtl::Reference<MetaAction> SvmReader::TextLineHandler() { - rtl::Reference<MetaTextLineAction> pAction(new MetaTextLineAction); - VersionCompatRead aCompat(mrStream); TypeSerializer aSerializer(mrStream); @@ -842,36 +757,31 @@ rtl::Reference<MetaAction> SvmReader::TextLineHandler() sal_Int32 nTempWidth(0); mrStream.ReadInt32(nTempWidth); - pAction->SetStartPoint(aPos); if (nTempWidth < 0) { SAL_WARN("vcl.gdi", "negative width"); nTempWidth = 0; } - pAction->SetWidth(nTempWidth); sal_uInt32 nTempStrikeout(0); mrStream.ReadUInt32(nTempStrikeout); sal_uInt32 nTempUnderline(0); mrStream.ReadUInt32(nTempUnderline); - pAction->SetStrikeout(static_cast<FontStrikeout>(nTempStrikeout & SAL_MAX_ENUM)); - pAction->SetUnderline(static_cast<FontLineStyle>(nTempUnderline & SAL_MAX_ENUM)); - + sal_uInt32 nTempOverline(0); if (aCompat.GetVersion() >= 2) { - sal_uInt32 nTempOverline(0); mrStream.ReadUInt32(nTempOverline); - pAction->SetOverline(static_cast<FontLineStyle>(nTempOverline & SAL_MAX_ENUM)); } - return pAction; + return new MetaTextLineAction(aPos, nTempWidth, + static_cast<FontStrikeout>(nTempStrikeout & SAL_MAX_ENUM), + static_cast<FontLineStyle>(nTempUnderline & SAL_MAX_ENUM), + static_cast<FontLineStyle>(nTempOverline & SAL_MAX_ENUM)); } rtl::Reference<MetaAction> SvmReader::BmpHandler() { - rtl::Reference<MetaBmpAction> pAction(new MetaBmpAction); - VersionCompatRead aCompat(mrStream); Bitmap aBmp; ReadDIB(aBmp, mrStream, true); @@ -879,16 +789,12 @@ rtl::Reference<MetaAction> SvmReader::BmpHandler() Point aPoint; aSerializer.readPoint(aPoint); - pAction->SetBitmap(aBmp); - pAction->SetPoint(aPoint); - + rtl::Reference<MetaBmpAction> pAction(new MetaBmpAction(aPoint, aBmp)); return pAction; } rtl::Reference<MetaAction> SvmReader::BmpScaleHandler() { - rtl::Reference<MetaBmpScaleAction> pAction(new MetaBmpScaleAction); - VersionCompatRead aCompat(mrStream); Bitmap aBmp; ReadDIB(aBmp, mrStream, true); @@ -899,17 +805,13 @@ rtl::Reference<MetaAction> SvmReader::BmpScaleHandler() Size aSz; aSerializer.readSize(aSz); - pAction->SetBitmap(aBmp); - pAction->SetPoint(aPoint); - pAction->SetSize(aSz); + rtl::Reference<MetaBmpScaleAction> pAction(new MetaBmpScaleAction(aPoint, aSz, aBmp)); return pAction; } rtl::Reference<MetaAction> SvmReader::BmpScalePartHandler() { - rtl::Reference<MetaBmpScalePartAction> pAction(new MetaBmpScalePartAction); - VersionCompatRead aCompat(mrStream); Bitmap aBmp; ReadDIB(aBmp, mrStream, true); @@ -923,19 +825,11 @@ rtl::Reference<MetaAction> SvmReader::BmpScalePartHandler() Size aSrcSize; aSerializer.readSize(aSrcSize); - pAction->SetBitmap(aBmp); - pAction->SetDestPoint(aDestPoint); - pAction->SetDestSize(aDestSize); - pAction->SetSrcPoint(aSrcPoint); - pAction->SetSrcSize(aSrcSize); - - return pAction; + return new MetaBmpScalePartAction(aDestPoint, aDestSize, aSrcPoint, aSrcSize, aBmp); } rtl::Reference<MetaAction> SvmReader::BmpExHandler() { - rtl::Reference<MetaBmpExAction> pAction(new MetaBmpExAction); - VersionCompatRead aCompat(mrStream); Bitmap aBmp; ReadDIBBitmapEx(aBmp, mrStream); @@ -943,16 +837,11 @@ rtl::Reference<MetaAction> SvmReader::BmpExHandler() Point aPoint; aSerializer.readPoint(aPoint); - pAction->SetPoint(aPoint); - pAction->SetBitmap(aBmp); - - return pAction; + return new MetaBmpExAction(aPoint, aBmp); } rtl::Reference<MetaAction> SvmReader::BmpExScaleHandler() { - rtl::Reference<MetaBmpExScaleAction> pAction(new MetaBmpExScaleAction); - VersionCompatRead aCompat(mrStream); Bitmap aBmp; ReadDIBBitmapEx(aBmp, mrStream); @@ -963,17 +852,11 @@ rtl::Reference<MetaAction> SvmReader::BmpExScaleHandler() Size aSize; aSerializer.readSize(aSize); - pAction->SetBitmap(aBmp); - pAction->SetPoint(aPoint); - pAction->SetSize(aSize); - - return pAction; + return new MetaBmpExScaleAction(aPoint, aSize, aBmp); } rtl::Reference<MetaAction> SvmReader::BmpExScalePartHandler() { - rtl::Reference<MetaBmpExScalePartAction> pAction(new MetaBmpExScalePartAction); - VersionCompatRead aCompat(mrStream); Bitmap aBmp; ReadDIBBitmapEx(aBmp, mrStream); @@ -987,19 +870,11 @@ rtl::Reference<MetaAction> SvmReader::BmpExScalePartHandler() Size aSrcSize; aSerializer.readSize(aSrcSize); - pAction->SetBitmap(aBmp); - pAction->SetDestPoint(aDstPoint); - pAction->SetDestSize(aDstSize); - pAction->SetSrcPoint(aSrcPoint); - pAction->SetSrcSize(aSrcSize); - - return pAction; + return new MetaBmpExScalePartAction(aDstPoint, aDstSize, aSrcPoint, aSrcSize, aBmp); } rtl::Reference<MetaAction> SvmReader::MaskHandler() { - rtl::Reference<MetaMaskAction> pAction(new MetaMaskAction); - VersionCompatRead aCompat(mrStream); Bitmap aBmp; ReadDIB(aBmp, mrStream, true); @@ -1007,16 +882,11 @@ rtl::Reference<MetaAction> SvmReader::MaskHandler() Point aPoint; aSerializer.readPoint(aPoint); - pAction->SetBitmap(aBmp); - pAction->SetPoint(aPoint); - - return pAction; + return new MetaMaskAction(aPoint, aBmp, Color()); } rtl::Reference<MetaAction> SvmReader::MaskScaleHandler() { - rtl::Reference<MetaMaskScaleAction> pAction(new MetaMaskScaleAction); - VersionCompatRead aCompat(mrStream); Bitmap aBmp; ReadDIB(aBmp, mrStream, true); @@ -1026,17 +896,11 @@ rtl::Reference<MetaAction> SvmReader::MaskScaleHandler() Size aSize; aSerializer.readSize(aSize); - pAction->SetBitmap(aBmp); - pAction->SetPoint(aPoint); - pAction->SetSize(aSize); - - return pAction; + return new MetaMaskScaleAction(aPoint, aSize, aBmp, Color()); } rtl::Reference<MetaAction> SvmReader::MaskScalePartHandler() { - rtl::Reference<MetaMaskScalePartAction> pAction(new MetaMaskScalePartAction); - VersionCompatRead aCompat(mrStream); Bitmap aBmp; ReadDIB(aBmp, mrStream, true); @@ -1052,20 +916,11 @@ rtl::Reference<MetaAction> SvmReader::MaskScalePartHandler() Size aSrcSz; aSerializer.readSize(aSrcSz); - pAction->SetBitmap(aBmp); - pAction->SetColor(aColor); - pAction->SetDestPoint(aDstPt); - pAction->SetDestSize(aDstSz); - pAction->SetSrcPoint(aSrcPt); - pAction->SetSrcSize(aSrcSz); - - return pAction; + return new MetaMaskScalePartAction(aDstPt, aDstSz, aSrcPt, aSrcSz, aBmp, aColor); } rtl::Reference<MetaAction> SvmReader::GradientHandler() { - rtl::Reference<MetaGradientAction> pAction(new MetaGradientAction); - VersionCompatRead aCompat(mrStream); TypeSerializer aSerializer(mrStream); @@ -1074,16 +929,11 @@ rtl::Reference<MetaAction> SvmReader::GradientHandler() Gradient aGradient; aSerializer.readGradient(aGradient); - pAction->SetRect(aRect); - pAction->SetGradient(aGradient); - - return pAction; + return new MetaGradientAction(aRect, aGradient); } rtl::Reference<MetaAction> SvmReader::GradientExHandler() { - rtl::Reference<MetaGradientExAction> pAction(new MetaGradientExAction); - VersionCompatRead aCompat(mrStream); tools::PolyPolygon aPolyPoly; ReadPolyPolygon(mrStream, aPolyPoly); @@ -1091,169 +941,117 @@ rtl::Reference<MetaAction> SvmReader::GradientExHandler() Gradient aGradient; aSerializer.readGradient(aGradient); - pAction->SetGradient(aGradient); - pAction->SetPolyPolygon(aPolyPoly); - - return pAction; + return new MetaGradientExAction(aPolyPoly, aGradient); } rtl::Reference<MetaAction> SvmReader::HatchHandler() { - rtl::Reference<MetaHatchAction> pAction(new MetaHatchAction); - VersionCompatRead aCompat(mrStream); tools::PolyPolygon aPolyPoly; ReadPolyPolygon(mrStream, aPolyPoly); Hatch aHatch; ReadHatch(mrStream, aHatch); - pAction->SetPolyPolygon(aPolyPoly); - pAction->SetHatch(aHatch); - - return pAction; + return new MetaHatchAction(aPolyPoly, aHatch); } rtl::Reference<MetaAction> SvmReader::WallpaperHandler() { - rtl::Reference<MetaWallpaperAction> pAction(new MetaWallpaperAction); - VersionCompatRead aCompat(mrStream); Wallpaper aWallpaper; ReadWallpaper(mrStream, aWallpaper); - pAction->SetWallpaper(aWallpaper); - - return pAction; + return new MetaWallpaperAction(tools::Rectangle(), aWallpaper); } rtl::Reference<MetaAction> SvmReader::ClipRegionHandler() { - rtl::Reference<MetaClipRegionAction> pAction(new MetaClipRegionAction); - VersionCompatRead aCompat(mrStream); vcl::Region aRegion; ReadRegion(mrStream, aRegion); bool aClip(false); mrStream.ReadCharAsBool(aClip); - pAction->SetRegion(aRegion); - pAction->SetClipping(aClip); - - return pAction; + return new MetaClipRegionAction(aRegion, aClip); } rtl::Reference<MetaAction> SvmReader::ISectRectClipRegionHandler() { - rtl::Reference<MetaISectRectClipRegionAction> pAction(new MetaISectRectClipRegionAction); - VersionCompatRead aCompat(mrStream); TypeSerializer aSerializer(mrStream); tools::Rectangle aRect; aSerializer.readRectangle(aRect); - pAction->SetRect(aRect); - - return pAction; + return new MetaISectRectClipRegionAction(aRect); } rtl::Reference<MetaAction> SvmReader::ISectRegionClipRegionHandler() { - rtl::Reference<MetaISectRegionClipRegionAction> pAction(new MetaISectRegionClipRegionAction); - VersionCompatRead aCompat(mrStream); vcl::Region aRegion; ReadRegion(mrStream, aRegion); - pAction->SetRegion(aRegion); - return pAction; + return new MetaISectRegionClipRegionAction(aRegion); } rtl::Reference<MetaAction> SvmReader::MoveClipRegionHandler() { - rtl::Reference<MetaMoveClipRegionAction> pAction(new MetaMoveClipRegionAction); - VersionCompatRead aCompat(mrStream); sal_Int32 nTmpHM(0), nTmpVM(0); mrStream.ReadInt32(nTmpHM).ReadInt32(nTmpVM); - pAction->SetHorzMove(nTmpHM); - pAction->SetVertMove(nTmpVM); - - return pAction; + return new MetaMoveClipRegionAction(nTmpHM, nTmpVM); } rtl::Reference<MetaAction> SvmReader::TextColorHandler() { - rtl::Reference<MetaTextColorAction> pAction(new MetaTextColorAction); - VersionCompatRead aCompat(mrStream); Color aColor; ReadColor(aColor); - pAction->SetColor(aColor); - - return pAction; + return new MetaTextColorAction(aColor); } rtl::Reference<MetaAction> SvmReader::TextFillColorHandler() { - rtl::Reference<MetaTextFillColorAction> pAction(new MetaTextFillColorAction); - VersionCompatRead aCompat(mrStream); Color aColor; ReadColor(aColor); bool bSet(false); mrStream.ReadCharAsBool(bSet); - pAction->SetColor(aColor); - pAction->SetSetting(bSet); - - return pAction; + return new MetaTextFillColorAction(aColor, bSet); } rtl::Reference<MetaAction> SvmReader::TextLineColorHandler() { - rtl::Reference<MetaTextLineColorAction> pAction(new MetaTextLineColorAction); - VersionCompatRead aCompat(mrStream); Color aColor; ReadColor(aColor); bool bSet(false); mrStream.ReadCharAsBool(bSet); - pAction->SetColor(aColor); - pAction->SetSetting(bSet); - - return pAction; + return new MetaTextLineColorAction(aColor, bSet); } rtl::Reference<MetaAction> SvmReader::OverlineColorHandler() { - rtl::Reference<MetaOverlineColorAction> pAction(new MetaOverlineColorAction); - VersionCompatRead aCompat(mrStream); Color aColor; ReadColor(aColor); bool bSet(false); mrStream.ReadCharAsBool(bSet); - pAction->SetColor(aColor); - pAction->SetSetting(bSet); - - return pAction; + return new MetaOverlineColorAction(aColor, bSet); } rtl::Reference<MetaAction> SvmReader::TextAlignHandler() { - rtl::Reference<MetaTextAlignAction> pAction(new MetaTextAlignAction); - VersionCompatRead aCompat(mrStream); sal_uInt16 nTmp16(0); mrStream.ReadUInt16(nTmp16); - pAction->SetTextAlign(static_cast<TextAlign>(nTmp16)); - - return pAction; + return new MetaTextAlignAction(static_cast<TextAlign>(nTmp16)); } rtl::Reference<MetaAction> SvmReader::MapModeHandler() @@ -1266,15 +1064,11 @@ rtl::Reference<MetaAction> SvmReader::MapModeHandler() if (!bSuccess) return nullptr; - rtl::Reference<MetaMapModeAction> pAction(new MetaMapModeAction); - pAction->SetMapMode(aMapMode); - return pAction; + return new MetaMapModeAction(aMapMode); } rtl::Reference<MetaAction> SvmReader::FontHandler(ImplMetaReadData* pData) { - rtl::Reference<MetaFontAction> pAction(new MetaFontAction); - VersionCompatRead aCompat(mrStream); vcl::Font aFont; ReadFont(mrStream, aFont); @@ -1282,22 +1076,16 @@ rtl::Reference<MetaAction> SvmReader::FontHandler(ImplMetaReadData* pData) if (pData->meActualCharSet == RTL_TEXTENCODING_DONTKNOW) pData->meActualCharSet = osl_getThreadTextEncoding(); - pAction->SetFont(aFont); - - return pAction; + return new MetaFontAction(aFont); } rtl::Reference<MetaAction> SvmReader::PushHandler() { - rtl::Reference<MetaPushAction> pAction(new MetaPushAction); - VersionCompatRead aCompat(mrStream); sal_uInt16 nTmp(0); mrStream.ReadUInt16(nTmp); - pAction->SetPushFlags(static_cast<vcl::PushFlags>(nTmp)); - - return pAction; + return new MetaPushAction(static_cast<vcl::PushFlags>(nTmp)); } rtl::Reference<MetaAction> SvmReader::PopHandler() @@ -1311,38 +1099,27 @@ rtl::Reference<MetaAction> SvmReader::PopHandler() rtl::Reference<MetaAction> SvmReader::RasterOpHandler() { - rtl::Reference<MetaRasterOpAction> pAction(new MetaRasterOpAction); - sal_uInt16 nTmp16(0); VersionCompatRead aCompat(mrStream); mrStream.ReadUInt16(nTmp16); - pAction->SetRasterOp(static_cast<RasterOp>(nTmp16)); - - return pAction; + return new MetaRasterOpAction(static_cast<RasterOp>(nTmp16)); } rtl::Reference<MetaAction> SvmReader::TransparentHandler() { - rtl::Reference<MetaTransparentAction> pAction(new MetaTransparentAction); - VersionCompatRead aCompat(mrStream); tools::PolyPolygon aPolyPoly; ReadPolyPolygon(mrStream, aPolyPoly); sal_uInt16 nTransPercent(0); mrStream.ReadUInt16(nTransPercent); - pAction->SetPolyPolygon(aPolyPoly); - pAction->SetTransparence(nTransPercent); - - return pAction; + return new MetaTransparentAction(aPolyPoly, nTransPercent); } rtl::Reference<MetaAction> SvmReader::FloatTransparentHandler(ImplMetaReadData* pData) { - rtl::Reference<MetaFloatTransparentAction> pAction(new MetaFloatTransparentAction); - VersionCompatRead aCompat(mrStream); GDIMetaFile aMtf; SvmReader aReader(mrStream); @@ -1357,15 +1134,10 @@ rtl::Reference<MetaAction> SvmReader::FloatTransparentHandler(ImplMetaReadData* Gradient aGradient; aSerializer.readGradient(aGradient); - pAction->SetGDIMetaFile(aMtf); - pAction->SetPoint(aPoint); - pAction->SetSize(aSize); - pAction->SetGradient(aGradient); - // tdf#155479 add support for MCGR and SVG export + basegfx::BColorStops aColorStops; if (aCompat.GetVersion() > 1) { - basegfx::BColorStops aColorStops; sal_uInt16 nTmp(0); double fOff, fR, fG, fB; mrStream.ReadUInt16(nTmp); @@ -1388,17 +1160,13 @@ rtl::Reference<MetaAction> SvmReader::FloatTransparentHandler(ImplMetaReadData* aColorStops.emplace_back(fOff, basegfx::BColor(fR, fG, fB)); } - - pAction->addSVGTransparencyColorStops(aColorStops); } - return pAction; + return new MetaFloatTransparentAction(aMtf, aPoint, aSize, aGradient, aColorStops); } rtl::Reference<MetaAction> SvmReader::EPSHandler() { - rtl::Reference<MetaEPSAction> pAction(new MetaEPSAction); - VersionCompatRead aCompat(mrStream); TypeSerializer aSerializer(mrStream); GfxLink aGfxLink; @@ -1410,18 +1178,11 @@ rtl::Reference<MetaAction> SvmReader::EPSHandler() GDIMetaFile aSubst; Read(aSubst); - pAction->SetLink(aGfxLink); - pAction->SetPoint(aPoint); - pAction->SetSize(aSize); - pAction->SetSubstitute(aSubst); - - return pAction; + return new MetaEPSAction(aPoint, aSize, aGfxLink, aSubst); } rtl::Reference<MetaAction> SvmReader::RefPointHandler() { - rtl::Reference<MetaRefPointAction> pAction(new MetaRefPointAction); - VersionCompatRead aCompat(mrStream); TypeSerializer aSerializer(mrStream); @@ -1430,16 +1191,11 @@ rtl::Reference<MetaAction> SvmReader::RefPointHandler() bool bSet(false); mrStream.ReadCharAsBool(bSet); - pAction->SetRefPoint(aRefPoint); - pAction->SetSetting(bSet); - - return pAction; + return new MetaRefPointAction(aRefPoint, bSet); } rtl::Reference<MetaAction> SvmReader::CommentHandler() { - rtl::Reference<MetaCommentAction> pAction(new MetaCommentAction); - VersionCompatRead aCompat(mrStream); OString aComment; aComment = read_uInt16_lenPrefixed_uInt8s_ToOString(mrStream); @@ -1465,38 +1221,25 @@ rtl::Reference<MetaAction> SvmReader::CommentHandler() mrStream.ReadBytes(pData.get(), nDataSize); } - pAction->SetComment(aComment); - pAction->SetDataSize(nDataSize); - pAction->SetValue(nValue); - pAction->SetData(pData.get(), nDataSize); - - return pAction; + return new MetaCommentAction(aComment, nValue, pData.get(), nDataSize); } rtl::Reference<MetaAction> SvmReader::LayoutModeHandler() { - rtl::Reference<MetaLayoutModeAction> pAction(new MetaLayoutModeAction); - VersionCompatRead aCompat(mrStream); sal_uInt32 tmp(0); mrStream.ReadUInt32(tmp); - pAction->SetLayoutMode(static_cast<vcl::text::ComplexTextLayoutFlags>(tmp)); - - return pAction; + return new MetaLayoutModeAction(static_cast<vcl::text::ComplexTextLayoutFlags>(tmp)); } rtl::Reference<MetaAction> SvmReader::TextLanguageHandler() { - rtl::Reference<MetaTextLanguageAction> pAction(new MetaTextLanguageAction); - VersionCompatRead aCompat(mrStream); sal_uInt16 nTmp = 0; mrStream.ReadUInt16(nTmp); - pAction->SetTextLanguage(static_cast<LanguageType>(nTmp)); - - return pAction; + return new MetaTextLanguageAction(static_cast<LanguageType>(nTmp)); } rtl::Reference<MetaAction> SvmReader::DefaultHandler() diff --git a/vcl/source/gdi/metaact.cxx b/vcl/source/gdi/metaact.cxx index ea527fa8c89a..20406866e658 100644 --- a/vcl/source/gdi/metaact.cxx +++ b/vcl/source/gdi/metaact.cxx @@ -737,16 +737,6 @@ void MetaTextArrayAction::Scale( double fScaleX, double fScaleY ) } } -void MetaTextArrayAction::SetDXArray(KernArray aArray) -{ - maDXAry = std::move(aArray); -} - -void MetaTextArrayAction::SetKashidaArray(std::vector<sal_Bool> aArray) -{ - maKashidaAry = std::move(aArray); -} - MetaStretchTextAction::MetaStretchTextAction() : MetaAction ( MetaActionType::STRETCHTEXT ), mnWidth ( 0 ), @@ -1954,12 +1944,14 @@ MetaFloatTransparentAction::~MetaFloatTransparentAction() {} MetaFloatTransparentAction::MetaFloatTransparentAction( const GDIMetaFile& rMtf, const Point& rPos, - const Size& rSize, Gradient aGradient ) : + const Size& rSize, Gradient aGradient, + std::optional<basegfx::BColorStops> oStops ) : MetaAction ( MetaActionType::FLOATTRANSPARENT ), maMtf ( rMtf ), maPoint ( rPos ), maSize ( rSize ), - maGradient (std::move( aGradient )) + maGradient (std::move( aGradient )), + maSVGTransparencyColorStops (std::move(oStops)) {} void MetaFloatTransparentAction::Execute( OutputDevice* pOut ) @@ -1985,11 +1977,6 @@ void MetaFloatTransparentAction::Scale( double fScaleX, double fScaleY ) maSize = aRectangle.GetSize(); } -void MetaFloatTransparentAction::addSVGTransparencyColorStops(const basegfx::BColorStops& rSVGTransparencyColorStops) -{ - maSVGTransparencyColorStops = rSVGTransparencyColorStops; -} - MetaEPSAction::MetaEPSAction() : MetaAction(MetaActionType::EPS) {}
