Kaydet (Commit) 792f85dc authored tarafından Noel Grandin's avatar Noel Grandin

introduce SdrObjectUniquePtr typedef

Change-Id: I00106a7be04d473e2ee60ef6165bebc4148f954b
Reviewed-on: https://gerrit.libreoffice.org/61438
Tested-by: Jenkins
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 1f969657
...@@ -1041,6 +1041,7 @@ struct SVX_DLLPUBLIC SdrObjectFreeOp ...@@ -1041,6 +1041,7 @@ struct SVX_DLLPUBLIC SdrObjectFreeOp
SdrObject::Free(obj); SdrObject::Free(obj);
} }
}; };
typedef std::unique_ptr< SdrObject, SdrObjectFreeOp > SdrObjectUniquePtr;
struct SdrObjCreatorParams struct SdrObjCreatorParams
{ {
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include "xiroot.hxx" #include "xiroot.hxx"
#include <oox/ole/olehelper.hxx> #include <oox/ole/olehelper.hxx>
#include <rtl/ustring.hxx> #include <rtl/ustring.hxx>
#include <svx/svdobj.hxx>
#include <map> #include <map>
#include <memory> #include <memory>
#include <vector> #include <vector>
...@@ -49,7 +50,6 @@ struct SdrObjectFreeOp; ...@@ -49,7 +50,6 @@ struct SdrObjectFreeOp;
// Drawing objects ============================================================ // Drawing objects ============================================================
typedef std::unique_ptr< SdrObject, SdrObjectFreeOp > SdrObjectPtr;
class XclImpDrawObjBase; class XclImpDrawObjBase;
typedef std::shared_ptr< XclImpDrawObjBase > XclImpDrawObjRef; typedef std::shared_ptr< XclImpDrawObjBase > XclImpDrawObjRef;
...@@ -124,7 +124,7 @@ public: ...@@ -124,7 +124,7 @@ public:
/** Returns the needed size on the progress bar (calls virtual DoGetProgressSize() function). */ /** Returns the needed size on the progress bar (calls virtual DoGetProgressSize() function). */
std::size_t GetProgressSize() const; std::size_t GetProgressSize() const;
/** Creates and returns an SdrObject from the contained data. Caller takes ownership! */ /** Creates and returns an SdrObject from the contained data. Caller takes ownership! */
SdrObjectPtr CreateSdrObject( XclImpDffConverter& rDffConv, const tools::Rectangle& rAnchorRect, bool bIsDff ) const; SdrObjectUniquePtr CreateSdrObject( XclImpDffConverter& rDffConv, const tools::Rectangle& rAnchorRect, bool bIsDff ) const;
/** Additional processing for the passed SdrObject before insertion into /** Additional processing for the passed SdrObject before insertion into
the drawing page (calls virtual DoPreProcessSdrObj() function). */ the drawing page (calls virtual DoPreProcessSdrObj() function). */
void PreProcessSdrObject( XclImpDffConverter& rDffConv, SdrObject& rSdrObj ) const; void PreProcessSdrObject( XclImpDffConverter& rDffConv, SdrObject& rSdrObj ) const;
...@@ -169,7 +169,7 @@ protected: ...@@ -169,7 +169,7 @@ protected:
/** Derived classes may return a progress bar size different from 1. */ /** Derived classes may return a progress bar size different from 1. */
virtual std::size_t DoGetProgressSize() const; virtual std::size_t DoGetProgressSize() const;
/** Derived classes create and return a new SdrObject from the contained data. Caller takes ownership! */ /** Derived classes create and return a new SdrObject from the contained data. Caller takes ownership! */
virtual SdrObjectPtr DoCreateSdrObj( XclImpDffConverter& rDffConv, const tools::Rectangle& rAnchorRect ) const; virtual SdrObjectUniquePtr DoCreateSdrObj( XclImpDffConverter& rDffConv, const tools::Rectangle& rAnchorRect ) const;
/** Derived classes may perform additional processing for the passed SdrObject before insertion. */ /** Derived classes may perform additional processing for the passed SdrObject before insertion. */
virtual void DoPreProcessSdrObj( XclImpDffConverter& rDffConv, SdrObject& rSdrObj ) const; virtual void DoPreProcessSdrObj( XclImpDffConverter& rDffConv, SdrObject& rSdrObj ) const;
/** Derived classes may perform additional processing for the passed SdrObject after insertion. */ /** Derived classes may perform additional processing for the passed SdrObject after insertion. */
...@@ -251,7 +251,7 @@ private: ...@@ -251,7 +251,7 @@ private:
/** Returns a progress bar size that takes all group children into account. */ /** Returns a progress bar size that takes all group children into account. */
virtual std::size_t DoGetProgressSize() const override; virtual std::size_t DoGetProgressSize() const override;
/** Creates and returns a new SdrObject from the contained data. Caller takes ownership! */ /** Creates and returns a new SdrObject from the contained data. Caller takes ownership! */
virtual SdrObjectPtr DoCreateSdrObj( XclImpDffConverter& rDffConv, const tools::Rectangle& rAnchorRect ) const override; virtual SdrObjectUniquePtr DoCreateSdrObj( XclImpDffConverter& rDffConv, const tools::Rectangle& rAnchorRect ) const override;
XclImpDrawObjVector maChildren; /// Grouped objects. XclImpDrawObjVector maChildren; /// Grouped objects.
sal_uInt16 mnFirstUngrouped; /// Object identifier of first object not grouped into this group. sal_uInt16 mnFirstUngrouped; /// Object identifier of first object not grouped into this group.
...@@ -271,7 +271,7 @@ private: ...@@ -271,7 +271,7 @@ private:
/** Reads the contents of the a BIFF5 OBJ record from the passed stream. */ /** Reads the contents of the a BIFF5 OBJ record from the passed stream. */
virtual void DoReadObj5( XclImpStream& rStrm, sal_uInt16 nNameLen, sal_uInt16 nMacroSize ) override; virtual void DoReadObj5( XclImpStream& rStrm, sal_uInt16 nNameLen, sal_uInt16 nMacroSize ) override;
/** Creates and returns a new SdrObject from the contained data. Caller takes ownership! */ /** Creates and returns a new SdrObject from the contained data. Caller takes ownership! */
virtual SdrObjectPtr DoCreateSdrObj( XclImpDffConverter& rDffConv, const tools::Rectangle& rAnchorRect ) const override; virtual SdrObjectUniquePtr DoCreateSdrObj( XclImpDffConverter& rDffConv, const tools::Rectangle& rAnchorRect ) const override;
XclObjLineData maLineData; /// BIFF5 line formatting. XclObjLineData maLineData; /// BIFF5 line formatting.
sal_uInt16 mnArrows; /// Line arrows. sal_uInt16 mnArrows; /// Line arrows.
...@@ -298,7 +298,7 @@ protected: ...@@ -298,7 +298,7 @@ protected:
/** Reads the contents of the a BIFF5 OBJ record from the passed stream. */ /** Reads the contents of the a BIFF5 OBJ record from the passed stream. */
virtual void DoReadObj5( XclImpStream& rStrm, sal_uInt16 nNameLen, sal_uInt16 nMacroSize ) override; virtual void DoReadObj5( XclImpStream& rStrm, sal_uInt16 nNameLen, sal_uInt16 nMacroSize ) override;
/** Creates and returns a new SdrObject from the contained data. Caller takes ownership! */ /** Creates and returns a new SdrObject from the contained data. Caller takes ownership! */
virtual SdrObjectPtr DoCreateSdrObj( XclImpDffConverter& rDffConv, const tools::Rectangle& rAnchorRect ) const override; virtual SdrObjectUniquePtr DoCreateSdrObj( XclImpDffConverter& rDffConv, const tools::Rectangle& rAnchorRect ) const override;
protected: protected:
XclObjFillData maFillData; /// BIFF5 fill formatting. XclObjFillData maFillData; /// BIFF5 fill formatting.
...@@ -314,7 +314,7 @@ public: ...@@ -314,7 +314,7 @@ public:
protected: protected:
/** Creates and returns a new SdrObject from the contained data. Caller takes ownership! */ /** Creates and returns a new SdrObject from the contained data. Caller takes ownership! */
virtual SdrObjectPtr DoCreateSdrObj( XclImpDffConverter& rDffConv, const tools::Rectangle& rAnchorRect ) const override; virtual SdrObjectUniquePtr DoCreateSdrObj( XclImpDffConverter& rDffConv, const tools::Rectangle& rAnchorRect ) const override;
}; };
/** An arc object. */ /** An arc object. */
...@@ -331,7 +331,7 @@ private: ...@@ -331,7 +331,7 @@ private:
/** Reads the contents of the a BIFF5 OBJ record from the passed stream. */ /** Reads the contents of the a BIFF5 OBJ record from the passed stream. */
virtual void DoReadObj5( XclImpStream& rStrm, sal_uInt16 nNameLen, sal_uInt16 nMacroSize ) override; virtual void DoReadObj5( XclImpStream& rStrm, sal_uInt16 nNameLen, sal_uInt16 nMacroSize ) override;
/** Creates and returns a new SdrObject from the contained data. Caller takes ownership! */ /** Creates and returns a new SdrObject from the contained data. Caller takes ownership! */
virtual SdrObjectPtr DoCreateSdrObj( XclImpDffConverter& rDffConv, const tools::Rectangle& rAnchorRect ) const override; virtual SdrObjectUniquePtr DoCreateSdrObj( XclImpDffConverter& rDffConv, const tools::Rectangle& rAnchorRect ) const override;
XclObjFillData maFillData; /// BIFF5 fill formatting. XclObjFillData maFillData; /// BIFF5 fill formatting.
XclObjLineData maLineData; /// BIFF5 line formatting. XclObjLineData maLineData; /// BIFF5 line formatting.
...@@ -353,7 +353,7 @@ private: ...@@ -353,7 +353,7 @@ private:
/** Reads the contents of the a BIFF5 OBJ record from the passed stream. */ /** Reads the contents of the a BIFF5 OBJ record from the passed stream. */
virtual void DoReadObj5( XclImpStream& rStrm, sal_uInt16 nNameLen, sal_uInt16 nMacroSize ) override; virtual void DoReadObj5( XclImpStream& rStrm, sal_uInt16 nNameLen, sal_uInt16 nMacroSize ) override;
/** Creates and returns a new SdrObject from the contained data. Caller takes ownership! */ /** Creates and returns a new SdrObject from the contained data. Caller takes ownership! */
virtual SdrObjectPtr DoCreateSdrObj( XclImpDffConverter& rDffConv, const tools::Rectangle& rAnchorRect ) const override; virtual SdrObjectUniquePtr DoCreateSdrObj( XclImpDffConverter& rDffConv, const tools::Rectangle& rAnchorRect ) const override;
typedef std::vector< Point > PointVector; typedef std::vector< Point > PointVector;
PointVector maCoords; /// Coordinates relative to bounding rectangle. PointVector maCoords; /// Coordinates relative to bounding rectangle.
...@@ -389,7 +389,7 @@ protected: ...@@ -389,7 +389,7 @@ protected:
/** Reads the contents of the a BIFF5 OBJ record from the passed stream. */ /** Reads the contents of the a BIFF5 OBJ record from the passed stream. */
virtual void DoReadObj5( XclImpStream& rStrm, sal_uInt16 nNameLen, sal_uInt16 nMacroSize ) override; virtual void DoReadObj5( XclImpStream& rStrm, sal_uInt16 nNameLen, sal_uInt16 nMacroSize ) override;
/** Creates and returns a new SdrObject from the contained data. Caller takes ownership! */ /** Creates and returns a new SdrObject from the contained data. Caller takes ownership! */
virtual SdrObjectPtr DoCreateSdrObj( XclImpDffConverter& rDffConv, const tools::Rectangle& rAnchorRect ) const override; virtual SdrObjectUniquePtr DoCreateSdrObj( XclImpDffConverter& rDffConv, const tools::Rectangle& rAnchorRect ) const override;
/** Inserts the contained text data at the passed object. */ /** Inserts the contained text data at the passed object. */
virtual void DoPreProcessSdrObj( XclImpDffConverter& rDffConv, SdrObject& rSdrObj ) const override; virtual void DoPreProcessSdrObj( XclImpDffConverter& rDffConv, SdrObject& rSdrObj ) const override;
...@@ -419,7 +419,7 @@ protected: ...@@ -419,7 +419,7 @@ protected:
/** Returns the needed size on the progress bar. */ /** Returns the needed size on the progress bar. */
virtual std::size_t DoGetProgressSize() const override; virtual std::size_t DoGetProgressSize() const override;
/** Creates and returns a new SdrObject from the contained data. Caller takes ownership! */ /** Creates and returns a new SdrObject from the contained data. Caller takes ownership! */
virtual SdrObjectPtr DoCreateSdrObj( XclImpDffConverter& rDffConv, const tools::Rectangle& rAnchorRect ) const override; virtual SdrObjectUniquePtr DoCreateSdrObj( XclImpDffConverter& rDffConv, const tools::Rectangle& rAnchorRect ) const override;
/** Converts the chart document. */ /** Converts the chart document. */
virtual void DoPostProcessSdrObj( XclImpDffConverter& rDffConv, SdrObject& rSdrObj ) const override; virtual void DoPostProcessSdrObj( XclImpDffConverter& rDffConv, SdrObject& rSdrObj ) const override;
...@@ -463,7 +463,7 @@ public: ...@@ -463,7 +463,7 @@ public:
bool HasCellLink() const { return mxCellLink != nullptr; } bool HasCellLink() const { return mxCellLink != nullptr; }
/** Returns the SdrObject from the passed control shape and sets the bounding rectangle. */ /** Returns the SdrObject from the passed control shape and sets the bounding rectangle. */
SdrObjectPtr CreateSdrObjectFromShape( SdrObjectUniquePtr CreateSdrObjectFromShape(
const css::uno::Reference< css::drawing::XShape >& rxShape, const css::uno::Reference< css::drawing::XShape >& rxShape,
const tools::Rectangle& rAnchorRect ) const; const tools::Rectangle& rAnchorRect ) const;
...@@ -517,7 +517,7 @@ protected: ...@@ -517,7 +517,7 @@ protected:
void ConvertLabel( ScfPropertySet& rPropSet ) const; void ConvertLabel( ScfPropertySet& rPropSet ) const;
/** Creates and returns a new SdrObject from the contained data. Caller takes ownership! */ /** Creates and returns a new SdrObject from the contained data. Caller takes ownership! */
virtual SdrObjectPtr DoCreateSdrObj( XclImpDffConverter& rDffConv, const tools::Rectangle& rAnchorRect ) const override; virtual SdrObjectUniquePtr DoCreateSdrObj( XclImpDffConverter& rDffConv, const tools::Rectangle& rAnchorRect ) const override;
/** Additional processing on the SdrObject, calls new virtual function DoProcessControl(). */ /** Additional processing on the SdrObject, calls new virtual function DoProcessControl(). */
virtual void DoPreProcessSdrObj( XclImpDffConverter& rDffConv, SdrObject& rSdrObj ) const override; virtual void DoPreProcessSdrObj( XclImpDffConverter& rDffConv, SdrObject& rSdrObj ) const override;
...@@ -832,7 +832,7 @@ protected: ...@@ -832,7 +832,7 @@ protected:
/** Reads the contents of the specified subrecord of a BIFF8 OBJ record from stream. */ /** Reads the contents of the specified subrecord of a BIFF8 OBJ record from stream. */
virtual void DoReadObj8SubRec( XclImpStream& rStrm, sal_uInt16 nSubRecId, sal_uInt16 nSubRecSize ) override; virtual void DoReadObj8SubRec( XclImpStream& rStrm, sal_uInt16 nSubRecId, sal_uInt16 nSubRecSize ) override;
/** Creates and returns a new SdrObject from the contained data. Caller takes ownership! */ /** Creates and returns a new SdrObject from the contained data. Caller takes ownership! */
virtual SdrObjectPtr DoCreateSdrObj( XclImpDffConverter& rDffConv, const tools::Rectangle& rAnchorRect ) const override; virtual SdrObjectUniquePtr DoCreateSdrObj( XclImpDffConverter& rDffConv, const tools::Rectangle& rAnchorRect ) const override;
/** Override to do additional processing on the SdrObject. */ /** Override to do additional processing on the SdrObject. */
virtual void DoPreProcessSdrObj( XclImpDffConverter& rDffConv, SdrObject& rSdrObj ) const override; virtual void DoPreProcessSdrObj( XclImpDffConverter& rDffConv, SdrObject& rSdrObj ) const override;
...@@ -939,9 +939,9 @@ public: ...@@ -939,9 +939,9 @@ public:
void FinalizeDrawing(); void FinalizeDrawing();
/** Creates the SdrObject for the passed Excel TBX form control object. */ /** Creates the SdrObject for the passed Excel TBX form control object. */
SdrObjectPtr CreateSdrObject( const XclImpTbxObjBase& rTbxObj, const tools::Rectangle& rAnchorRect ); SdrObjectUniquePtr CreateSdrObject( const XclImpTbxObjBase& rTbxObj, const tools::Rectangle& rAnchorRect );
/** Creates the SdrObject for the passed Excel OLE object or OCX form control object. */ /** Creates the SdrObject for the passed Excel OLE object or OCX form control object. */
SdrObjectPtr CreateSdrObject( const XclImpPictureObj& rPicObj, const tools::Rectangle& rAnchorRect ); SdrObjectUniquePtr CreateSdrObject( const XclImpPictureObj& rPicObj, const tools::Rectangle& rAnchorRect );
/** Returns true, if the conversion of OLE objects is supported. */ /** Returns true, if the conversion of OLE objects is supported. */
bool SupportsOleObjects() const; bool SupportsOleObjects() const;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment