From ddef60b9c26b1d2990c6c49dbbda73e7831f21fb Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 11 Jul 2018 21:53:47 +0200 Subject: pass SvxFieldData around by std::unique_ptr Change-Id: I9c826547d348000dd6c80e45d833e048caae0ed8 Reviewed-on: https://gerrit.libreoffice.org/57308 Tested-by: Jenkins Reviewed-by: Noel Grandin --- include/editeng/CustomPropertyField.hxx | 2 +- include/editeng/flditem.hxx | 41 +++++++++++++++++---------------- include/editeng/measfld.hxx | 2 +- include/editeng/unofield.hxx | 2 +- include/editeng/unotext.hxx | 2 +- 5 files changed, 25 insertions(+), 24 deletions(-) (limited to 'include/editeng') diff --git a/include/editeng/CustomPropertyField.hxx b/include/editeng/CustomPropertyField.hxx index 5ee612cc74a7..43580ac4b178 100644 --- a/include/editeng/CustomPropertyField.hxx +++ b/include/editeng/CustomPropertyField.hxx @@ -36,7 +36,7 @@ public: SV_DECL_PERSIST1(CustomPropertyField, css::text::textfield::Type::DOCINFO_CUSTOM) - virtual tools::SvRef Clone() const override; + virtual std::unique_ptr Clone() const override; virtual bool operator==(const SvxFieldData&) const override; virtual MetaAction* createBeginComment() const override; diff --git a/include/editeng/flditem.hxx b/include/editeng/flditem.hxx index 413d59148c2b..065dc60969f2 100644 --- a/include/editeng/flditem.hxx +++ b/include/editeng/flditem.hxx @@ -40,19 +40,19 @@ class MetaAction; // class SvxFieldItem --------------------------------------------------- -class EDITENG_DLLPUBLIC SvxFieldData : public SvPersistBase +class EDITENG_DLLPUBLIC SvxFieldData { public: static const sal_Int32 UNKNOWN_FIELD; static SvxFieldData* Create(const css::uno::Reference& xContent); - SV_DECL_PERSIST1( SvxFieldData, css::text::textfield::Type::UNSPECIFIED) + virtual sal_Int32 GetClassId() const { return css::text::textfield::Type::UNSPECIFIED; } SvxFieldData(); - virtual ~SvxFieldData() override; + virtual ~SvxFieldData(); - virtual tools::SvRef Clone() const; + virtual std::unique_ptr Clone() const; virtual bool operator==( const SvxFieldData& ) const; virtual MetaAction* createBeginComment() const; @@ -66,8 +66,9 @@ public: */ class EDITENG_DLLPUBLIC SvxFieldItem : public SfxPoolItem { - tools::SvRef mxField; + std::unique_ptr mpField; public: + SvxFieldItem( std::unique_ptr pField, const sal_uInt16 nId ); SvxFieldItem( const SvxFieldData& rField, const sal_uInt16 nId ); SvxFieldItem( const SvxFieldItem& rItem ); virtual ~SvxFieldItem() override; @@ -75,7 +76,7 @@ public: virtual bool operator==( const SfxPoolItem& ) const override; virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const override; - const SvxFieldData* GetField() const { return mxField.get(); } + const SvxFieldData* GetField() const { return mpField.get(); } }; @@ -124,7 +125,7 @@ public: OUString GetFormatted( SvNumberFormatter& rFormatter, LanguageType eLanguage ) const; static OUString GetFormatted( Date const & rDate, SvxDateFormat eFormat, SvNumberFormatter& rFormatter, LanguageType eLanguage ); - virtual tools::SvRef Clone() const override; + virtual std::unique_ptr Clone() const override; virtual bool operator==( const SvxFieldData& ) const override; virtual MetaAction* createBeginComment() const override; @@ -163,7 +164,7 @@ public: SvxURLFormat GetFormat() const { return eFormat; } void SetFormat( SvxURLFormat eFmt ) { eFormat = eFmt; } - virtual tools::SvRef Clone() const override; + virtual std::unique_ptr Clone() const override; virtual bool operator==( const SvxFieldData& ) const override; virtual MetaAction* createBeginComment() const override; @@ -175,7 +176,7 @@ public: SV_DECL_PERSIST1( SvxPageField, css::text::textfield::Type::PAGE ) SvxPageField(); - virtual tools::SvRef Clone() const override; + virtual std::unique_ptr Clone() const override; virtual bool operator==( const SvxFieldData& ) const override; virtual MetaAction* createBeginComment() const override; @@ -187,7 +188,7 @@ public: SV_DECL_PERSIST1( SvxPageTitleField, css::text::textfield::Type::PAGE_NAME ) SvxPageTitleField(); - virtual tools::SvRef Clone() const override; + virtual std::unique_ptr Clone() const override; virtual bool operator==( const SvxFieldData& ) const override; virtual MetaAction* createBeginComment() const override; @@ -199,7 +200,7 @@ public: SV_DECL_PERSIST1( SvxPagesField, css::text::textfield::Type::PAGES ) SvxPagesField(); - virtual tools::SvRef Clone() const override; + virtual std::unique_ptr Clone() const override; virtual bool operator==( const SvxFieldData& ) const override; }; @@ -209,7 +210,7 @@ public: SV_DECL_PERSIST1( SvxTimeField, css::text::textfield::Type::TIME ) SvxTimeField(); - virtual tools::SvRef Clone() const override; + virtual std::unique_ptr Clone() const override; virtual bool operator==( const SvxFieldData& ) const override; virtual MetaAction* createBeginComment() const override; @@ -221,7 +222,7 @@ public: SV_DECL_PERSIST1( SvxFileField, css::text::textfield::Type::DOCINFO_TITLE ) SvxFileField(); - virtual tools::SvRef Clone() const override; + virtual std::unique_ptr Clone() const override; virtual bool operator==( const SvxFieldData& ) const override; }; @@ -236,7 +237,7 @@ public: void SetTab(int nTab); int GetTab() const { return mnTab;} - virtual tools::SvRef Clone() const override; + virtual std::unique_ptr Clone() const override; virtual bool operator==( const SvxFieldData& ) const override; }; @@ -288,7 +289,7 @@ public: OUString GetFormatted( SvNumberFormatter& rFormatter, LanguageType eLanguage ) const; static OUString GetFormatted( tools::Time const & rTime, SvxTimeFormat eFormat, SvNumberFormatter& rFormatter, LanguageType eLanguage ); - virtual tools::SvRef Clone() const override; + virtual std::unique_ptr Clone() const override; virtual bool operator==( const SvxFieldData& ) const override; virtual MetaAction* createBeginComment() const override; @@ -332,7 +333,7 @@ public: OUString GetFormatted() const; - virtual tools::SvRef Clone() const override; + virtual std::unique_ptr Clone() const override; virtual bool operator==( const SvxFieldData& ) const override; }; @@ -373,7 +374,7 @@ public: OUString GetFormatted() const; - virtual tools::SvRef Clone() const override; + virtual std::unique_ptr Clone() const override; virtual bool operator==( const SvxFieldData& ) const override; }; @@ -385,7 +386,7 @@ public: SV_DECL_PERSIST1( SvxHeaderField, css::text::textfield::Type::PRESENTATION_HEADER ) SvxHeaderField(); - virtual tools::SvRef Clone() const override; + virtual std::unique_ptr Clone() const override; virtual bool operator==( const SvxFieldData& ) const override; }; @@ -396,7 +397,7 @@ class EDITENG_DLLPUBLIC SvxFooterField final: public SvxFieldData public: SV_DECL_PERSIST1( SvxFooterField, css::text::textfield::Type::PRESENTATION_FOOTER ) SvxFooterField(); - virtual tools::SvRef Clone() const override; + virtual std::unique_ptr Clone() const override; virtual bool operator==( const SvxFieldData& ) const override; }; @@ -412,7 +413,7 @@ public: SvxDateFormat eDateFormat, SvxTimeFormat eTimeFormat, SvNumberFormatter& rFormatter, LanguageType eLanguage ); - virtual tools::SvRef Clone() const override; + virtual std::unique_ptr Clone() const override; virtual bool operator==( const SvxFieldData& ) const override; }; diff --git a/include/editeng/measfld.hxx b/include/editeng/measfld.hxx index 40715662566f..50bf3cc3e8df 100644 --- a/include/editeng/measfld.hxx +++ b/include/editeng/measfld.hxx @@ -35,7 +35,7 @@ public: SV_DECL_PERSIST1(SdrMeasureField, css::text::textfield::Type::MEASURE) SdrMeasureField(SdrMeasureFieldKind eNewKind): eMeasureFieldKind(eNewKind) {} virtual ~SdrMeasureField() override; - virtual tools::SvRef Clone() const override; + virtual std::unique_ptr Clone() const override; virtual bool operator==(const SvxFieldData&) const override; SdrMeasureFieldKind GetMeasureFieldKind() const { return eMeasureFieldKind; } }; diff --git a/include/editeng/unofield.hxx b/include/editeng/unofield.hxx index 604024ef8f7c..ea3afb36517e 100644 --- a/include/editeng/unofield.hxx +++ b/include/editeng/unofield.hxx @@ -60,7 +60,7 @@ public: virtual ~SvxUnoTextField() throw() override; // Internal - SvxFieldData* CreateFieldData() const throw(); + std::unique_ptr CreateFieldData() const throw(); static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId() throw(); virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override; diff --git a/include/editeng/unotext.hxx b/include/editeng/unotext.hxx index 07b1171e59f9..0b4a2bf445f9 100644 --- a/include/editeng/unotext.hxx +++ b/include/editeng/unotext.hxx @@ -333,7 +333,7 @@ public: /// @throws css::uno::RuntimeException static bool GetPropertyValueHelper( SfxItemSet const & rSet, const SfxItemPropertySimpleEntry* pMap, css::uno::Any& aAny, const ESelection* pSelection = nullptr, SvxEditSource* pEditSource = nullptr ); - void attachField( const SvxFieldData* pData ) throw(); + void attachField( std::unique_ptr pData ) throw(); UNO3_GETIMPLEMENTATION_DECL( SvxUnoTextRangeBase ) -- cgit v1.2.3