filter/source/svg/svgfilter.cxx | 2 include/drawinglayer/attribute/lineattribute.hxx | 93 +++++++++------------ include/drawinglayer/attribute/strokeattribute.hxx | 73 +++++++--------- include/vcl/graph.hxx | 4 include/vcl/vectorgraphicdata.hxx | 2 solenv/clang-format/blacklist | 2 svx/source/core/graphichelper.cxx | 6 - svx/source/svdraw/svdograf.cxx | 16 +-- svx/source/xoutdev/_xoutbmp.cxx | 15 +-- sw/source/core/graphic/ndgrf.cxx | 8 - vcl/inc/graphic/Manager.hxx | 3 vcl/inc/impgraph.hxx | 6 - vcl/source/filter/graphicfilter.cxx | 36 ++++---- vcl/source/filter/wmf/wmf.cxx | 2 vcl/source/gdi/graph.cxx | 4 vcl/source/gdi/impgraph.cxx | 6 - vcl/source/graphic/GraphicID.cxx | 4 vcl/source/graphic/Manager.cxx | 3 18 files changed, 130 insertions(+), 155 deletions(-)
New commits: commit 9504ca53238acfce0cb7ba7ef527a3bf1f5277ae Author: Tomaž Vajngerl <[email protected]> AuthorDate: Sat Apr 11 12:12:19 2020 +0200 Commit: Tomaž Vajngerl <[email protected]> CommitDate: Sat Apr 11 12:12:19 2020 +0200 remove lineattribute.hxx, strokeattribute.hxx from clang-format blacklist Change-Id: I4826b94da3982be8807c4eba63971cb7d3df9d8a diff --git a/include/drawinglayer/attribute/lineattribute.hxx b/include/drawinglayer/attribute/lineattribute.hxx index 90c50f904fe9..77828a15d21e 100644 --- a/include/drawinglayer/attribute/lineattribute.hxx +++ b/include/drawinglayer/attribute/lineattribute.hxx @@ -26,51 +26,50 @@ #include <com/sun/star/drawing/LineCap.hpp> #include <o3tl/cow_wrapper.hxx> -namespace basegfx { - class BColor; +namespace basegfx +{ +class BColor; } -namespace drawinglayer::attribute { - class ImpLineAttribute; +namespace drawinglayer::attribute +{ +class ImpLineAttribute; } namespace drawinglayer::attribute { - class DRAWINGLAYER_DLLPUBLIC LineAttribute - { - public: - typedef o3tl::cow_wrapper< ImpLineAttribute > ImplType; +class DRAWINGLAYER_DLLPUBLIC LineAttribute +{ +public: + typedef o3tl::cow_wrapper<ImpLineAttribute> ImplType; - private: - ImplType mpLineAttribute; +private: + ImplType mpLineAttribute; - public: - /// constructors/assignmentoperator/destructor - explicit LineAttribute( - const basegfx::BColor& rColor, - double fWidth = 0.0, - basegfx::B2DLineJoin aB2DLineJoin = basegfx::B2DLineJoin::Round, - css::drawing::LineCap aLineCap = css::drawing::LineCap_BUTT, - double fMiterMinimumAngle = basegfx::deg2rad(15.0)); - LineAttribute(); - LineAttribute(const LineAttribute&); - LineAttribute& operator=(const LineAttribute&); - ~LineAttribute(); +public: + /// constructors/assignmentoperator/destructor + explicit LineAttribute(const basegfx::BColor& rColor, double fWidth = 0.0, + basegfx::B2DLineJoin aB2DLineJoin = basegfx::B2DLineJoin::Round, + css::drawing::LineCap aLineCap = css::drawing::LineCap_BUTT, + double fMiterMinimumAngle = basegfx::deg2rad(15.0)); + LineAttribute(); + LineAttribute(const LineAttribute&); + LineAttribute& operator=(const LineAttribute&); + ~LineAttribute(); - // checks if the incarnation is default constructed - bool isDefault() const; + // checks if the incarnation is default constructed + bool isDefault() const; - // compare operator - bool operator==(const LineAttribute& rCandidate) const; + // compare operator + bool operator==(const LineAttribute& rCandidate) const; - // data read access - const basegfx::BColor& getColor() const; - double getWidth() const; - basegfx::B2DLineJoin getLineJoin() const; - css::drawing::LineCap getLineCap() const; - double getMiterMinimumAngle() const; - }; + // data read access + const basegfx::BColor& getColor() const; + double getWidth() const; + basegfx::B2DLineJoin getLineJoin() const; + css::drawing::LineCap getLineCap() const; + double getMiterMinimumAngle() const; +}; } // end of namespace drawinglayer - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/drawinglayer/attribute/strokeattribute.hxx b/include/drawinglayer/attribute/strokeattribute.hxx index fd9409e9519d..d5d825c54710 100644 --- a/include/drawinglayer/attribute/strokeattribute.hxx +++ b/include/drawinglayer/attribute/strokeattribute.hxx @@ -23,43 +23,42 @@ #include <o3tl/cow_wrapper.hxx> #include <vector> -namespace drawinglayer::attribute { - class ImpStrokeAttribute; +namespace drawinglayer::attribute +{ +class ImpStrokeAttribute; } namespace drawinglayer::attribute { - class DRAWINGLAYER_DLLPUBLIC StrokeAttribute - { - public: - typedef o3tl::cow_wrapper< ImpStrokeAttribute > ImplType; +class DRAWINGLAYER_DLLPUBLIC StrokeAttribute +{ +public: + typedef o3tl::cow_wrapper<ImpStrokeAttribute> ImplType; - private: - ImplType mpStrokeAttribute; +private: + ImplType mpStrokeAttribute; - public: - /// constructors/assignmentoperator/destructor - explicit StrokeAttribute( - const ::std::vector< double >& rDotDashArray, - double fFullDotDashLen = 0.0); - StrokeAttribute(); - StrokeAttribute(const StrokeAttribute&); - StrokeAttribute(StrokeAttribute&&); - StrokeAttribute& operator=(const StrokeAttribute&); - StrokeAttribute& operator=(StrokeAttribute&&); - ~StrokeAttribute(); +public: + /// constructors/assignmentoperator/destructor + explicit StrokeAttribute(const ::std::vector<double>& rDotDashArray, + double fFullDotDashLen = 0.0); + StrokeAttribute(); + StrokeAttribute(const StrokeAttribute&); + StrokeAttribute(StrokeAttribute&&); + StrokeAttribute& operator=(const StrokeAttribute&); + StrokeAttribute& operator=(StrokeAttribute&&); + ~StrokeAttribute(); - // checks if the incarnation is default constructed - bool isDefault() const; + // checks if the incarnation is default constructed + bool isDefault() const; - // compare operator - bool operator==(const StrokeAttribute& rCandidate) const; + // compare operator + bool operator==(const StrokeAttribute& rCandidate) const; - // data read access - const ::std::vector< double >& getDotDashArray() const; - double getFullDotDashLen() const; - }; + // data read access + const ::std::vector<double>& getDotDashArray() const; + double getFullDotDashLen() const; +}; } // end of namespace drawinglayer::attribute - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/solenv/clang-format/blacklist b/solenv/clang-format/blacklist index 01f1129e7ee0..f64f6002a703 100644 --- a/solenv/clang-format/blacklist +++ b/solenv/clang-format/blacklist @@ -5851,7 +5851,6 @@ include/drawinglayer/attribute/fillgradientattribute.hxx include/drawinglayer/attribute/fillgraphicattribute.hxx include/drawinglayer/attribute/fillhatchattribute.hxx include/drawinglayer/attribute/fontattribute.hxx -include/drawinglayer/attribute/lineattribute.hxx include/drawinglayer/attribute/linestartendattribute.hxx include/drawinglayer/attribute/materialattribute3d.hxx include/drawinglayer/attribute/sdrallattribute3d.hxx @@ -5864,7 +5863,6 @@ include/drawinglayer/attribute/sdrlinestartendattribute.hxx include/drawinglayer/attribute/sdrobjectattribute3d.hxx include/drawinglayer/attribute/sdrsceneattribute3d.hxx include/drawinglayer/attribute/sdrshadowattribute.hxx -include/drawinglayer/attribute/strokeattribute.hxx include/drawinglayer/geometry/viewinformation3d.hxx include/drawinglayer/primitive2d/discretebitmapprimitive2d.hxx include/drawinglayer/primitive2d/discreteshadowprimitive2d.hxx commit 53d0ad5dc9e92f9782eb4982170b2a03503af08a Author: Tomaž Vajngerl <[email protected]> AuthorDate: Sat Apr 11 12:08:45 2020 +0200 Commit: Tomaž Vajngerl <[email protected]> CommitDate: Sat Apr 11 12:08:45 2020 +0200 clean-up NS and pragma once for LineAttribute, StrokeAttribute Change-Id: Ic914fcb9a0bf9b30feff40ec39c1002ac6eae1cb diff --git a/include/drawinglayer/attribute/lineattribute.hxx b/include/drawinglayer/attribute/lineattribute.hxx index 4f01c1f574cb..90c50f904fe9 100644 --- a/include/drawinglayer/attribute/lineattribute.hxx +++ b/include/drawinglayer/attribute/lineattribute.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_LINEATTRIBUTE_HXX -#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_LINEATTRIBUTE_HXX +#pragma once #include <drawinglayer/drawinglayerdllapi.h> @@ -27,22 +26,16 @@ #include <com/sun/star/drawing/LineCap.hpp> #include <o3tl/cow_wrapper.hxx> - -// predefines - namespace basegfx { class BColor; } -namespace drawinglayer { namespace attribute { +namespace drawinglayer::attribute { class ImpLineAttribute; -}} - +} -namespace drawinglayer +namespace drawinglayer::attribute { - namespace attribute - { class DRAWINGLAYER_DLLPUBLIC LineAttribute { public: @@ -77,10 +70,7 @@ namespace drawinglayer css::drawing::LineCap getLineCap() const; double getMiterMinimumAngle() const; }; - } // end of namespace attribute } // end of namespace drawinglayer -#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_LINEATTRIBUTE_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/drawinglayer/attribute/strokeattribute.hxx b/include/drawinglayer/attribute/strokeattribute.hxx index 40e15707b25f..fd9409e9519d 100644 --- a/include/drawinglayer/attribute/strokeattribute.hxx +++ b/include/drawinglayer/attribute/strokeattribute.hxx @@ -17,25 +17,18 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_STROKEATTRIBUTE_HXX -#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_STROKEATTRIBUTE_HXX +#pragma once #include <drawinglayer/drawinglayerdllapi.h> #include <o3tl/cow_wrapper.hxx> #include <vector> - -// predefines - -namespace drawinglayer { namespace attribute { +namespace drawinglayer::attribute { class ImpStrokeAttribute; -}} +} - -namespace drawinglayer +namespace drawinglayer::attribute { - namespace attribute - { class DRAWINGLAYER_DLLPUBLIC StrokeAttribute { public: @@ -66,10 +59,7 @@ namespace drawinglayer const ::std::vector< double >& getDotDashArray() const; double getFullDotDashLen() const; }; - } // end of namespace attribute -} // end of namespace drawinglayer - +} // end of namespace drawinglayer::attribute -#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_STROKEATTRIBUTE_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ commit c5a6c4c3b6843fd2c75e4a24ea6108723e38f776 Author: Tomaž Vajngerl <[email protected]> AuthorDate: Sat Apr 11 12:02:47 2020 +0200 Commit: Tomaž Vajngerl <[email protected]> CommitDate: Sat Apr 11 12:02:47 2020 +0200 replace and remove VectorGraphicDataPtr typedef for the real type There is no need to hide std::shared_ptr<VectorGraphicData> type under an alias name. It doesn't make the code more understandble and it usually is the exact opposite because we know with what type we are dealing with. Change-Id: Iec80ee99697ff2fe3a8275fc2787b5370510ebe6 diff --git a/filter/source/svg/svgfilter.cxx b/filter/source/svg/svgfilter.cxx index b7e6bcb66e53..0440ac94e1c9 100644 --- a/filter/source/svg/svgfilter.cxx +++ b/filter/source/svg/svgfilter.cxx @@ -254,7 +254,7 @@ bool SVGFilter::filterImpressOrDraw( const Sequence< PropertyValue >& rDescripto // tdf#118232 Get the sequence of primitives and check if geometry is completely // hidden. If so, there is no need to add a SdrObject at all - const VectorGraphicDataPtr& rVectorGraphicData(aGraphic.getVectorGraphicData()); + auto const & rVectorGraphicData(aGraphic.getVectorGraphicData()); bool bContainsNoGeometry(false); if(bool(rVectorGraphicData) && VectorGraphicDataType::Svg == rVectorGraphicData->getVectorGraphicDataType()) diff --git a/include/vcl/graph.hxx b/include/vcl/graph.hxx index 6e70f66731ac..b304cfb7ac97 100644 --- a/include/vcl/graph.hxx +++ b/include/vcl/graph.hxx @@ -99,7 +99,7 @@ public: Graphic( const Bitmap& rBmp ); Graphic( const Image& rImage ); Graphic( const BitmapEx& rBmpEx ); - Graphic( const VectorGraphicDataPtr& rVectorGraphicDataPtr ); + Graphic( const std::shared_ptr<VectorGraphicData>& rVectorGraphicDataPtr ); Graphic( const Animation& rAnimation ); Graphic( const GDIMetaFile& rMtf ); Graphic( const css::uno::Reference< css::graphic::XGraphic >& rxGraphic ); @@ -202,7 +202,7 @@ public: public: - const VectorGraphicDataPtr& getVectorGraphicData() const; + const std::shared_ptr<VectorGraphicData>& getVectorGraphicData() const; /// Get the page number of the multi-page source this Graphic is rendered from. sal_Int32 getPageNumber() const; diff --git a/include/vcl/vectorgraphicdata.hxx b/include/vcl/vectorgraphicdata.hxx index 7e272602f67f..f982537da67d 100644 --- a/include/vcl/vectorgraphicdata.hxx +++ b/include/vcl/vectorgraphicdata.hxx @@ -115,8 +115,6 @@ public: bool isPrimitiveSequenceCreated() const { return mbSequenceCreated; } }; -typedef std::shared_ptr< VectorGraphicData > VectorGraphicDataPtr; - #endif // INCLUDED_VCL_VECTORGRAPHICDATA_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/core/graphichelper.cxx b/svx/source/core/graphichelper.cxx index ab2b85786be9..e1278da3b5ab 100644 --- a/svx/source/core/graphichelper.cxx +++ b/svx/source/core/graphichelper.cxx @@ -67,11 +67,11 @@ namespace drawing = com::sun::star::drawing; void GraphicHelper::GetPreferredExtension( OUString& rExtension, const Graphic& rGraphic ) { OUString aExtension = "png"; - const VectorGraphicDataPtr& aVectorGraphicDataPtr(rGraphic.getVectorGraphicData()); + auto const & rVectorGraphicDataPtr(rGraphic.getVectorGraphicData()); - if (aVectorGraphicDataPtr.get() && aVectorGraphicDataPtr->getVectorGraphicDataArrayLength()) + if (rVectorGraphicDataPtr && rVectorGraphicDataPtr->getVectorGraphicDataArrayLength()) { - switch (aVectorGraphicDataPtr->getVectorGraphicDataType()) + switch (rVectorGraphicDataPtr->getVectorGraphicDataType()) { case VectorGraphicDataType::Wmf: aExtension = "wmf"; diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx index 49c4c3175dd6..fc70e8bc1984 100644 --- a/svx/source/svdraw/svdograf.cxx +++ b/svx/source/svdraw/svdograf.cxx @@ -133,9 +133,9 @@ void SdrGrafObj::onGraphicChanged() if (!mpGraphicObject || !mpGraphicObject->GetGraphic().isAvailable()) return; - const VectorGraphicDataPtr& rVectorGraphicDataPtr = mpGraphicObject->GetGraphic().getVectorGraphicData(); + auto const & rVectorGraphicDataPtr = mpGraphicObject->GetGraphic().getVectorGraphicData(); - if (!rVectorGraphicDataPtr.get()) + if (!rVectorGraphicDataPtr) return; // Skip for PDF as it is only a bitmap primitive in a sequence and @@ -282,9 +282,9 @@ const GraphicObject* SdrGrafObj::GetReplacementGraphicObject() const { if (!mpReplacementGraphicObject && mpGraphicObject) { - const VectorGraphicDataPtr& rVectorGraphicDataPtr = mpGraphicObject->GetGraphic().getVectorGraphicData(); + auto const & rVectorGraphicDataPtr = mpGraphicObject->GetGraphic().getVectorGraphicData(); - if (rVectorGraphicDataPtr.get()) + if (rVectorGraphicDataPtr) { const_cast< SdrGrafObj* >(this)->mpReplacementGraphicObject.reset(new GraphicObject(rVectorGraphicDataPtr->getReplacement())); } @@ -552,11 +552,11 @@ OUString SdrGrafObj::TakeObjNameSingul() const if (!mpGraphicObject) return OUString(); - const VectorGraphicDataPtr& rVectorGraphicDataPtr = mpGraphicObject->GetGraphic().getVectorGraphicData(); + auto const & rVectorGraphicDataPtr = mpGraphicObject->GetGraphic().getVectorGraphicData(); OUStringBuffer sName; - if(rVectorGraphicDataPtr.get()) + if (rVectorGraphicDataPtr) { switch (rVectorGraphicDataPtr->getVectorGraphicDataType()) { @@ -622,11 +622,11 @@ OUString SdrGrafObj::TakeObjNamePlural() const if (!mpGraphicObject) return OUString(); - const VectorGraphicDataPtr& rVectorGraphicDataPtr = mpGraphicObject->GetGraphic().getVectorGraphicData(); + auto const & rVectorGraphicDataPtr = mpGraphicObject->GetGraphic().getVectorGraphicData(); OUStringBuffer sName; - if(rVectorGraphicDataPtr.get()) + if (rVectorGraphicDataPtr) { switch (rVectorGraphicDataPtr->getVectorGraphicDataType()) { diff --git a/svx/source/xoutdev/_xoutbmp.cxx b/svx/source/xoutdev/_xoutbmp.cxx index 7eadfe7cacc4..500a30375c62 100644 --- a/svx/source/xoutdev/_xoutbmp.cxx +++ b/svx/source/xoutdev/_xoutbmp.cxx @@ -130,15 +130,14 @@ ErrCode XOutBitmap::WriteGraphic( const Graphic& rGraphic, OUString& rFileName, } // #i121128# use shortcut to write Vector Graphic Data data in original form (if possible) - const VectorGraphicDataPtr& aVectorGraphicDataPtr(rGraphic.getVectorGraphicData()); + auto const & rVectorGraphicDataPtr(rGraphic.getVectorGraphicData()); - if(aVectorGraphicDataPtr.get() - && aVectorGraphicDataPtr->getVectorGraphicDataArrayLength()) + if (rVectorGraphicDataPtr && rVectorGraphicDataPtr->getVectorGraphicDataArrayLength()) { - const bool bIsSvg(rFilterName.equalsIgnoreAsciiCase("svg") && VectorGraphicDataType::Svg == aVectorGraphicDataPtr->getVectorGraphicDataType()); - const bool bIsWmf(rFilterName.equalsIgnoreAsciiCase("wmf") && VectorGraphicDataType::Wmf == aVectorGraphicDataPtr->getVectorGraphicDataType()); - const bool bIsEmf(rFilterName.equalsIgnoreAsciiCase("emf") && VectorGraphicDataType::Emf == aVectorGraphicDataPtr->getVectorGraphicDataType()); - const bool bIsPdf(rFilterName.equalsIgnoreAsciiCase("pdf") && VectorGraphicDataType::Pdf == aVectorGraphicDataPtr->getVectorGraphicDataType()); + const bool bIsSvg(rFilterName.equalsIgnoreAsciiCase("svg") && VectorGraphicDataType::Svg == rVectorGraphicDataPtr->getVectorGraphicDataType()); + const bool bIsWmf(rFilterName.equalsIgnoreAsciiCase("wmf") && VectorGraphicDataType::Wmf == rVectorGraphicDataPtr->getVectorGraphicDataType()); + const bool bIsEmf(rFilterName.equalsIgnoreAsciiCase("emf") && VectorGraphicDataType::Emf == rVectorGraphicDataPtr->getVectorGraphicDataType()); + const bool bIsPdf(rFilterName.equalsIgnoreAsciiCase("pdf") && VectorGraphicDataType::Pdf == rVectorGraphicDataPtr->getVectorGraphicDataType()); if (bIsSvg || bIsWmf || bIsEmf || bIsPdf) { @@ -153,7 +152,7 @@ ErrCode XOutBitmap::WriteGraphic( const Graphic& rGraphic, OUString& rFileName, if (pOStm) { - pOStm->WriteBytes(aVectorGraphicDataPtr->getVectorGraphicDataArray().getConstArray(), aVectorGraphicDataPtr->getVectorGraphicDataArrayLength()); + pOStm->WriteBytes(rVectorGraphicDataPtr->getVectorGraphicDataArray().getConstArray(), rVectorGraphicDataPtr->getVectorGraphicDataArrayLength()); aMedium.Commit(); if (!aMedium.GetError()) diff --git a/sw/source/core/graphic/ndgrf.cxx b/sw/source/core/graphic/ndgrf.cxx index 6e042765ab7c..bb39141cc49a 100644 --- a/sw/source/core/graphic/ndgrf.cxx +++ b/sw/source/core/graphic/ndgrf.cxx @@ -313,9 +313,9 @@ void SwGrfNode::onGraphicChanged() OUString aName; OUString aTitle; OUString aDesc; - const VectorGraphicDataPtr& rVectorGraphicDataPtr = GetGrf().getVectorGraphicData(); + auto const & rVectorGraphicDataPtr = GetGrf().getVectorGraphicData(); - if(rVectorGraphicDataPtr.get()) + if (rVectorGraphicDataPtr) { const drawinglayer::primitive2d::Primitive2DContainer aSequence(rVectorGraphicDataPtr->getPrimitive2DSequence()); @@ -375,9 +375,9 @@ const GraphicObject* SwGrfNode::GetReplacementGrfObj() const { if(!mpReplacementGraphic) { - const VectorGraphicDataPtr& rVectorGraphicDataPtr = GetGrfObj().GetGraphic().getVectorGraphicData(); + auto const & rVectorGraphicDataPtr = GetGrfObj().GetGraphic().getVectorGraphicData(); - if(rVectorGraphicDataPtr.get()) + if (rVectorGraphicDataPtr) { const_cast< SwGrfNode* >(this)->mpReplacementGraphic.reset( new GraphicObject(rVectorGraphicDataPtr->getReplacement()) ); } diff --git a/vcl/inc/graphic/Manager.hxx b/vcl/inc/graphic/Manager.hxx index d127201266f5..bb52a0cfcf8f 100644 --- a/vcl/inc/graphic/Manager.hxx +++ b/vcl/inc/graphic/Manager.hxx @@ -62,7 +62,8 @@ public: std::shared_ptr<ImpGraphic> newInstance(); std::shared_ptr<ImpGraphic> newInstance(const Bitmap& rBitmap); std::shared_ptr<ImpGraphic> newInstance(const BitmapEx& rBitmapEx); - std::shared_ptr<ImpGraphic> newInstance(const VectorGraphicDataPtr& rVectorGraphicDataPtr); + std::shared_ptr<ImpGraphic> + newInstance(const std::shared_ptr<VectorGraphicData>& rVectorGraphicDataPtr); std::shared_ptr<ImpGraphic> newInstance(const Animation& rAnimation); std::shared_ptr<ImpGraphic> newInstance(const GDIMetaFile& rMtf); std::shared_ptr<ImpGraphic> newInstance(const GraphicExternalLink& rGraphicLink); diff --git a/vcl/inc/impgraph.hxx b/vcl/inc/impgraph.hxx index a5435ee73b39..eaf691c10f1b 100644 --- a/vcl/inc/impgraph.hxx +++ b/vcl/inc/impgraph.hxx @@ -65,7 +65,7 @@ private: mutable sal_uLong mnSizeBytes; bool mbSwapOut; bool mbDummyContext; - VectorGraphicDataPtr maVectorGraphicData; + std::shared_ptr<VectorGraphicData> maVectorGraphicData; // cache checksum computation mutable BitmapChecksum mnChecksum = 0; @@ -82,7 +82,7 @@ public: ImpGraphic( const GraphicExternalLink& rExternalLink); ImpGraphic( const Bitmap& rBmp ); ImpGraphic( const BitmapEx& rBmpEx ); - ImpGraphic(const VectorGraphicDataPtr& rVectorGraphicDataPtr); + ImpGraphic(const std::shared_ptr<VectorGraphicData>& rVectorGraphicDataPtr); ImpGraphic( const Animation& rAnimation ); ImpGraphic( const GDIMetaFile& rMtf ); ~ImpGraphic(); @@ -193,7 +193,7 @@ private: friend void WriteImpGraphic(SvStream& rOStm, const ImpGraphic& rImpGraphic); friend void ReadImpGraphic(SvStream& rIStm, ImpGraphic& rImpGraphic); - const VectorGraphicDataPtr& getVectorGraphicData() const; + const std::shared_ptr<VectorGraphicData>& getVectorGraphicData() const; bool ensureAvailable () const; diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx index 0cc0e3abf80c..9262a91592d9 100644 --- a/vcl/source/filter/graphicfilter.cxx +++ b/vcl/source/filter/graphicfilter.cxx @@ -1576,7 +1576,7 @@ ErrCode GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPath, if(!aMemStream.GetError() ) { - VectorGraphicDataPtr aVectorGraphicDataPtr = std::make_shared<VectorGraphicData>(aNewData, rPath, VectorGraphicDataType::Svg); + auto aVectorGraphicDataPtr = std::make_shared<VectorGraphicData>(aNewData, rPath, VectorGraphicDataType::Svg); rGraphic = Graphic(aVectorGraphicDataPtr); bOkay = true; } @@ -1589,7 +1589,7 @@ ErrCode GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPath, if(!rIStream.GetError()) { - VectorGraphicDataPtr aVectorGraphicDataPtr = std::make_shared<VectorGraphicData>(aNewData, rPath, VectorGraphicDataType::Svg); + auto aVectorGraphicDataPtr = std::make_shared<VectorGraphicData>(aNewData, rPath, VectorGraphicDataType::Svg); rGraphic = Graphic(aVectorGraphicDataPtr); bOkay = true; } @@ -1659,7 +1659,7 @@ ErrCode GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPath, { const bool bIsWmf(aFilterName.equalsIgnoreAsciiCase(IMP_WMF)); const VectorGraphicDataType aDataType(bIsWmf ? VectorGraphicDataType::Wmf : VectorGraphicDataType::Emf); - VectorGraphicDataPtr aVectorGraphicDataPtr = + auto aVectorGraphicDataPtr = std::make_shared<VectorGraphicData>( aNewData, rPath, @@ -1927,13 +1927,13 @@ ErrCode GraphicFilter::ExportGraphic( const Graphic& rGraphic, const OUString& r bool bDone(false); // do we have a native Vector Graphic Data RenderGraphic, whose data can be written directly? - const VectorGraphicDataPtr& aVectorGraphicDataPtr(rGraphic.getVectorGraphicData()); + auto const & rVectorGraphicDataPtr(rGraphic.getVectorGraphicData()); - if (aVectorGraphicDataPtr.get() - && aVectorGraphicDataPtr->getVectorGraphicDataArrayLength() - && VectorGraphicDataType::Wmf == aVectorGraphicDataPtr->getVectorGraphicDataType()) + if (rVectorGraphicDataPtr + && rVectorGraphicDataPtr->getVectorGraphicDataArrayLength() + && VectorGraphicDataType::Wmf == rVectorGraphicDataPtr->getVectorGraphicDataType()) { - rOStm.WriteBytes(aVectorGraphicDataPtr->getVectorGraphicDataArray().getConstArray(), aVectorGraphicDataPtr->getVectorGraphicDataArrayLength()); + rOStm.WriteBytes(rVectorGraphicDataPtr->getVectorGraphicDataArray().getConstArray(), rVectorGraphicDataPtr->getVectorGraphicDataArrayLength()); if (rOStm.GetError()) { @@ -1960,13 +1960,13 @@ ErrCode GraphicFilter::ExportGraphic( const Graphic& rGraphic, const OUString& r bool bDone(false); // do we have a native Vector Graphic Data RenderGraphic, whose data can be written directly? - const VectorGraphicDataPtr& aVectorGraphicDataPtr(rGraphic.getVectorGraphicData()); + auto const & rVectorGraphicDataPtr(rGraphic.getVectorGraphicData()); - if (aVectorGraphicDataPtr.get() - && aVectorGraphicDataPtr->getVectorGraphicDataArrayLength() - && VectorGraphicDataType::Emf == aVectorGraphicDataPtr->getVectorGraphicDataType()) + if (rVectorGraphicDataPtr + && rVectorGraphicDataPtr->getVectorGraphicDataArrayLength() + && VectorGraphicDataType::Emf == rVectorGraphicDataPtr->getVectorGraphicDataType()) { - rOStm.WriteBytes(aVectorGraphicDataPtr->getVectorGraphicDataArray().getConstArray(), aVectorGraphicDataPtr->getVectorGraphicDataArrayLength()); + rOStm.WriteBytes(rVectorGraphicDataPtr->getVectorGraphicDataArray().getConstArray(), rVectorGraphicDataPtr->getVectorGraphicDataArrayLength()); if (rOStm.GetError()) { @@ -2054,13 +2054,13 @@ ErrCode GraphicFilter::ExportGraphic( const Graphic& rGraphic, const OUString& r bool bDone(false); // do we have a native Vector Graphic Data RenderGraphic, whose data can be written directly? - const VectorGraphicDataPtr& aVectorGraphicDataPtr(rGraphic.getVectorGraphicData()); + auto const & rVectorGraphicDataPtr(rGraphic.getVectorGraphicData()); - if (aVectorGraphicDataPtr.get() - && aVectorGraphicDataPtr->getVectorGraphicDataArrayLength() - && VectorGraphicDataType::Svg == aVectorGraphicDataPtr->getVectorGraphicDataType()) + if (rVectorGraphicDataPtr + && rVectorGraphicDataPtr->getVectorGraphicDataArrayLength() + && VectorGraphicDataType::Svg == rVectorGraphicDataPtr->getVectorGraphicDataType()) { - rOStm.WriteBytes(aVectorGraphicDataPtr->getVectorGraphicDataArray().getConstArray(), aVectorGraphicDataPtr->getVectorGraphicDataArrayLength()); + rOStm.WriteBytes(rVectorGraphicDataPtr->getVectorGraphicDataArray().getConstArray(), rVectorGraphicDataPtr->getVectorGraphicDataArrayLength()); if( rOStm.GetError() ) { diff --git a/vcl/source/filter/wmf/wmf.cxx b/vcl/source/filter/wmf/wmf.cxx index 3b9156ac84a1..7818309ed6d1 100644 --- a/vcl/source/filter/wmf/wmf.cxx +++ b/vcl/source/filter/wmf/wmf.cxx @@ -49,7 +49,7 @@ bool ReadWindowMetafile( SvStream& rStream, GDIMetaFile& rMTF ) // Throw into VectorGraphicData to get the import. Do not care // too much for type, this will be checked there. Also no path // needed, it is a temporary object - VectorGraphicDataPtr aVectorGraphicDataPtr = + auto aVectorGraphicDataPtr = std::make_shared<VectorGraphicData>( aNewData, OUString(), diff --git a/vcl/source/gdi/graph.cxx b/vcl/source/gdi/graph.cxx index 96414b43ad3a..ee7a8797cde9 100644 --- a/vcl/source/gdi/graph.cxx +++ b/vcl/source/gdi/graph.cxx @@ -222,7 +222,7 @@ Graphic::Graphic(const Image& rImage) mxImpGraphic->setOriginURL("private:graphicrepository/" + aStock); } -Graphic::Graphic(const VectorGraphicDataPtr& rVectorGraphicDataPtr) +Graphic::Graphic(const std::shared_ptr<VectorGraphicData>& rVectorGraphicDataPtr) : mxImpGraphic(vcl::graphic::Manager::get().newInstance(rVectorGraphicDataPtr)) { } @@ -555,7 +555,7 @@ void WriteGraphic( SvStream& rOStream, const Graphic& rGraphic ) WriteImpGraphic(rOStream, *rGraphic.mxImpGraphic); } -const VectorGraphicDataPtr& Graphic::getVectorGraphicData() const +const std::shared_ptr<VectorGraphicData>& Graphic::getVectorGraphicData() const { return mxImpGraphic->getVectorGraphicData(); } diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx index 5751ecba700c..45d13e71988b 100644 --- a/vcl/source/gdi/impgraph.cxx +++ b/vcl/source/gdi/impgraph.cxx @@ -154,7 +154,7 @@ ImpGraphic::ImpGraphic( const BitmapEx& rBitmapEx ) : { } -ImpGraphic::ImpGraphic(const VectorGraphicDataPtr& rVectorGraphicDataPtr) +ImpGraphic::ImpGraphic(const std::shared_ptr<VectorGraphicData>& rVectorGraphicDataPtr) : meType( rVectorGraphicDataPtr.get() ? GraphicType::Bitmap : GraphicType::NONE ), mnSizeBytes( 0 ), mbSwapOut( false ), @@ -323,7 +323,7 @@ bool ImpGraphic::operator==( const ImpGraphic& rImpGraphic ) const return bRet; } -const VectorGraphicDataPtr& ImpGraphic::getVectorGraphicData() const +const std::shared_ptr<VectorGraphicData>& ImpGraphic::getVectorGraphicData() const { ensureAvailable(); @@ -1758,7 +1758,7 @@ void ReadImpGraphic( SvStream& rIStm, ImpGraphic& rImpGraphic ) aDataType = VectorGraphicDataType::Pdf; } - VectorGraphicDataPtr aVectorGraphicDataPtr = std::make_shared<VectorGraphicData>(aNewData, aPath, aDataType); + auto aVectorGraphicDataPtr = std::make_shared<VectorGraphicData>(aNewData, aPath, aDataType); rImpGraphic = aVectorGraphicDataPtr; } } diff --git a/vcl/source/graphic/GraphicID.cxx b/vcl/source/graphic/GraphicID.cxx index 15de2a0d6f0f..96f256cf45da 100644 --- a/vcl/source/graphic/GraphicID.cxx +++ b/vcl/source/graphic/GraphicID.cxx @@ -30,9 +30,9 @@ GraphicID::GraphicID(ImpGraphic const& rGraphic) if (rGraphic.ImplGetType() == GraphicType::Bitmap) { - if (rGraphic.getVectorGraphicData().get()) + auto const& rVectorGraphicDataPtr = rGraphic.getVectorGraphicData(); + if (rVectorGraphicDataPtr) { - const VectorGraphicDataPtr& rVectorGraphicDataPtr = rGraphic.getVectorGraphicData(); const basegfx::B2DRange& rRange = rVectorGraphicDataPtr->getRange(); mnID1 |= rVectorGraphicDataPtr->getVectorGraphicDataArrayLength(); diff --git a/vcl/source/graphic/Manager.cxx b/vcl/source/graphic/Manager.cxx index 783ff21f64e9..b019d5adceaa 100644 --- a/vcl/source/graphic/Manager.cxx +++ b/vcl/source/graphic/Manager.cxx @@ -199,7 +199,8 @@ std::shared_ptr<ImpGraphic> Manager::newInstance(const Animation& rAnimation) return pReturn; } -std::shared_ptr<ImpGraphic> Manager::newInstance(const VectorGraphicDataPtr& rVectorGraphicDataPtr) +std::shared_ptr<ImpGraphic> +Manager::newInstance(const std::shared_ptr<VectorGraphicData>& rVectorGraphicDataPtr) { auto pReturn = std::make_shared<ImpGraphic>(rVectorGraphicDataPtr); registerGraphic(pReturn, "VectorGraphic"); _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
