diff options
author | Armin Le Grand <Armin.Le.Grand@me.com> | 2019-05-16 11:33:38 +0200 |
---|---|---|
committer | Armin Le Grand <Armin.Le.Grand@me.com> | 2019-05-18 01:29:25 +0200 |
commit | 10d8682e4cf77361e0ebf68a4ea1b565f05e91a9 (patch) | |
tree | 04159e0b5992ceda41c745afb2d8a9b913f172d2 | |
parent | 1cbf0ee54519bf81d934609352e8a1a641d8a534 (diff) |
Adapt AutoFormatHelper to std::unique_ptr
Change-Id: I3087a7e95e73dbcda798ca62705f7941a6466ccb
Reviewed-on: https://gerrit.libreoffice.org/72401
Tested-by: Jenkins
Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
-rw-r--r-- | include/svx/autoformathelper.hxx | 72 | ||||
-rw-r--r-- | sc/inc/autoform.hxx | 3 | ||||
-rw-r--r-- | sc/source/core/tool/autoform.cxx | 60 | ||||
-rw-r--r-- | svx/source/items/autoformathelper.cxx | 43 | ||||
-rw-r--r-- | sw/inc/tblafmt.hxx | 8 | ||||
-rw-r--r-- | sw/source/core/doc/tblafmt.cxx | 122 |
6 files changed, 171 insertions, 137 deletions
diff --git a/include/svx/autoformathelper.hxx b/include/svx/autoformathelper.hxx index a2d72646cbce..c731ff70b5e0 100644 --- a/include/svx/autoformathelper.hxx +++ b/include/svx/autoformathelper.hxx @@ -93,47 +93,50 @@ class SVX_DLLPUBLIC AutoFormatBase protected: // common attributes of Calc and Writer // --- from 641 on: CJK and CTL font settings - std::shared_ptr<SvxFontItem> m_aFont; - std::shared_ptr<SvxFontHeightItem> m_aHeight; - std::shared_ptr<SvxWeightItem> m_aWeight; - std::shared_ptr<SvxPostureItem> m_aPosture; - - std::shared_ptr<SvxFontItem> m_aCJKFont; - std::shared_ptr<SvxFontHeightItem> m_aCJKHeight; - std::shared_ptr<SvxWeightItem> m_aCJKWeight; - std::shared_ptr<SvxPostureItem> m_aCJKPosture; - - std::shared_ptr<SvxFontItem> m_aCTLFont; - std::shared_ptr<SvxFontHeightItem> m_aCTLHeight; - std::shared_ptr<SvxWeightItem> m_aCTLWeight; - std::shared_ptr<SvxPostureItem> m_aCTLPosture; - - std::shared_ptr<SvxUnderlineItem> m_aUnderline; - std::shared_ptr<SvxOverlineItem> m_aOverline; - std::shared_ptr<SvxCrossedOutItem> m_aCrossedOut; - std::shared_ptr<SvxContourItem> m_aContour; - std::shared_ptr<SvxShadowedItem> m_aShadowed; - std::shared_ptr<SvxColorItem> m_aColor; - std::shared_ptr<SvxBoxItem> m_aBox; - std::shared_ptr<SvxLineItem> m_aTLBR; - std::shared_ptr<SvxLineItem> m_aBLTR; - std::shared_ptr<SvxBrushItem> m_aBackground; + std::unique_ptr<SvxFontItem> m_aFont; + std::unique_ptr<SvxFontHeightItem> m_aHeight; + std::unique_ptr<SvxWeightItem> m_aWeight; + std::unique_ptr<SvxPostureItem> m_aPosture; + + std::unique_ptr<SvxFontItem> m_aCJKFont; + std::unique_ptr<SvxFontHeightItem> m_aCJKHeight; + std::unique_ptr<SvxWeightItem> m_aCJKWeight; + std::unique_ptr<SvxPostureItem> m_aCJKPosture; + + std::unique_ptr<SvxFontItem> m_aCTLFont; + std::unique_ptr<SvxFontHeightItem> m_aCTLHeight; + std::unique_ptr<SvxWeightItem> m_aCTLWeight; + std::unique_ptr<SvxPostureItem> m_aCTLPosture; + + std::unique_ptr<SvxUnderlineItem> m_aUnderline; + std::unique_ptr<SvxOverlineItem> m_aOverline; + std::unique_ptr<SvxCrossedOutItem> m_aCrossedOut; + std::unique_ptr<SvxContourItem> m_aContour; + std::unique_ptr<SvxShadowedItem> m_aShadowed; + std::unique_ptr<SvxColorItem> m_aColor; + std::unique_ptr<SvxBoxItem> m_aBox; + std::unique_ptr<SvxLineItem> m_aTLBR; + std::unique_ptr<SvxLineItem> m_aBLTR; + std::unique_ptr<SvxBrushItem> m_aBackground; // Writer specific - std::shared_ptr<SvxAdjustItem> m_aAdjust; + std::unique_ptr<SvxAdjustItem> m_aAdjust; // Calc specific - std::shared_ptr<SvxHorJustifyItem> m_aHorJustify; - std::shared_ptr<SvxVerJustifyItem> m_aVerJustify; - std::shared_ptr<SfxBoolItem> m_aStacked; - std::shared_ptr<SvxMarginItem> m_aMargin; - std::shared_ptr<SfxBoolItem> m_aLinebreak; + std::unique_ptr<SvxHorJustifyItem> m_aHorJustify; + std::unique_ptr<SvxVerJustifyItem> m_aVerJustify; + std::unique_ptr<SfxBoolItem> m_aStacked; + std::unique_ptr<SvxMarginItem> m_aMargin; + std::unique_ptr<SfxBoolItem> m_aLinebreak; // from SO5, 504k on, rotated text - std::shared_ptr<SfxInt32Item> m_aRotateAngle; - std::shared_ptr<SvxRotateModeItem> m_aRotateMode; + std::unique_ptr<SfxInt32Item> m_aRotateAngle; + std::unique_ptr<SvxRotateModeItem> m_aRotateMode; + + // assignment-op is protected due to this being a tooling + // class, so callers need to be aware of what they do + AutoFormatBase& operator=(const AutoFormatBase&); -public: AutoFormatBase(); AutoFormatBase( const AutoFormatBase& rNew ); ~AutoFormatBase(); @@ -141,6 +144,7 @@ public: /// Comparing based of boxes backgrounds. bool operator==(const AutoFormatBase& rRight); +public: // The get-methods. const SvxFontItem &GetFont() const { return *m_aFont; } const SvxFontHeightItem &GetHeight() const { return *m_aHeight; } diff --git a/sc/inc/autoform.hxx b/sc/inc/autoform.hxx index 5a6676f15500..8fad143b8400 100644 --- a/sc/inc/autoform.hxx +++ b/sc/inc/autoform.hxx @@ -112,6 +112,9 @@ public: ScAutoFormatDataField( const ScAutoFormatDataField& rCopy ); ~ScAutoFormatDataField(); + // block assignment operator + ScAutoFormatDataField& operator=(const ScAutoFormatDataField& rRef) = delete; + // number format const ScNumFormatAbbrev& GetNumFormat() const { return aNumFormat; } diff --git a/sc/source/core/tool/autoform.cxx b/sc/source/core/tool/autoform.cxx index 1652af5f5c86..f9840eb0825c 100644 --- a/sc/source/core/tool/autoform.cxx +++ b/sc/source/core/tool/autoform.cxx @@ -149,36 +149,36 @@ ScAutoFormatDataField::ScAutoFormatDataField() // need to set default instances for base class AutoFormatBase here // due to resource defines (e.g. ATTR_FONT) which are not available // in svx and different in the different usages of derivations - m_aFont = std::make_shared<SvxFontItem>(ATTR_FONT); - m_aHeight = std::make_shared<SvxFontHeightItem>(240, 100, ATTR_FONT_HEIGHT); - m_aWeight = std::make_shared<SvxWeightItem>(WEIGHT_NORMAL, ATTR_FONT_WEIGHT); - m_aPosture = std::make_shared<SvxPostureItem>(ITALIC_NONE, ATTR_FONT_POSTURE); - m_aCJKFont = std::make_shared<SvxFontItem>(ATTR_CJK_FONT); - m_aCJKHeight = std::make_shared<SvxFontHeightItem>(240, 100, ATTR_CJK_FONT_HEIGHT); - m_aCJKWeight = std::make_shared<SvxWeightItem>(WEIGHT_NORMAL, ATTR_CJK_FONT_WEIGHT); - m_aCJKPosture = std::make_shared<SvxPostureItem>(ITALIC_NONE, ATTR_CJK_FONT_POSTURE); - m_aCTLFont = std::make_shared<SvxFontItem>(ATTR_CTL_FONT); - m_aCTLHeight = std::make_shared<SvxFontHeightItem>(240, 100, ATTR_CTL_FONT_HEIGHT); - m_aCTLWeight = std::make_shared<SvxWeightItem>(WEIGHT_NORMAL, ATTR_CTL_FONT_WEIGHT); - m_aCTLPosture = std::make_shared<SvxPostureItem>(ITALIC_NONE, ATTR_CTL_FONT_POSTURE); - m_aUnderline = std::make_shared<SvxUnderlineItem>(LINESTYLE_NONE,ATTR_FONT_UNDERLINE); - m_aOverline = std::make_shared<SvxOverlineItem>(LINESTYLE_NONE,ATTR_FONT_OVERLINE); - m_aCrossedOut = std::make_shared<SvxCrossedOutItem>(STRIKEOUT_NONE, ATTR_FONT_CROSSEDOUT); - m_aContour = std::make_shared<SvxContourItem>(false, ATTR_FONT_CONTOUR); - m_aShadowed = std::make_shared<SvxShadowedItem>(false, ATTR_FONT_SHADOWED); - m_aColor = std::make_shared<SvxColorItem>(ATTR_FONT_COLOR); - m_aBox = std::make_shared<SvxBoxItem>(ATTR_BORDER); - m_aTLBR = std::make_shared<SvxLineItem>(ATTR_BORDER_TLBR); - m_aBLTR = std::make_shared<SvxLineItem>(ATTR_BORDER_BLTR); - m_aBackground = std::make_shared<SvxBrushItem>(ATTR_BACKGROUND); - m_aAdjust = std::make_shared<SvxAdjustItem>(SvxAdjust::Left, 0); - m_aHorJustify = std::make_shared<SvxHorJustifyItem>(SvxCellHorJustify::Standard, ATTR_HOR_JUSTIFY); - m_aVerJustify = std::make_shared<SvxVerJustifyItem>(SvxCellVerJustify::Standard, ATTR_VER_JUSTIFY); - m_aStacked = std::make_shared<SfxBoolItem>(); - m_aMargin = std::make_shared<SvxMarginItem>(ATTR_MARGIN); - m_aLinebreak = std::make_shared<SfxBoolItem>(ATTR_LINEBREAK); - m_aRotateAngle = std::make_shared<SfxInt32Item>(ATTR_ROTATE_VALUE); - m_aRotateMode = std::make_shared<SvxRotateModeItem>(SVX_ROTATE_MODE_STANDARD, ATTR_ROTATE_MODE); + m_aFont = std::make_unique<SvxFontItem>(ATTR_FONT); + m_aHeight = std::make_unique<SvxFontHeightItem>(240, 100, ATTR_FONT_HEIGHT); + m_aWeight = std::make_unique<SvxWeightItem>(WEIGHT_NORMAL, ATTR_FONT_WEIGHT); + m_aPosture = std::make_unique<SvxPostureItem>(ITALIC_NONE, ATTR_FONT_POSTURE); + m_aCJKFont = std::make_unique<SvxFontItem>(ATTR_CJK_FONT); + m_aCJKHeight = std::make_unique<SvxFontHeightItem>(240, 100, ATTR_CJK_FONT_HEIGHT); + m_aCJKWeight = std::make_unique<SvxWeightItem>(WEIGHT_NORMAL, ATTR_CJK_FONT_WEIGHT); + m_aCJKPosture = std::make_unique<SvxPostureItem>(ITALIC_NONE, ATTR_CJK_FONT_POSTURE); + m_aCTLFont = std::make_unique<SvxFontItem>(ATTR_CTL_FONT); + m_aCTLHeight = std::make_unique<SvxFontHeightItem>(240, 100, ATTR_CTL_FONT_HEIGHT); + m_aCTLWeight = std::make_unique<SvxWeightItem>(WEIGHT_NORMAL, ATTR_CTL_FONT_WEIGHT); + m_aCTLPosture = std::make_unique<SvxPostureItem>(ITALIC_NONE, ATTR_CTL_FONT_POSTURE); + m_aUnderline = std::make_unique<SvxUnderlineItem>(LINESTYLE_NONE,ATTR_FONT_UNDERLINE); + m_aOverline = std::make_unique<SvxOverlineItem>(LINESTYLE_NONE,ATTR_FONT_OVERLINE); + m_aCrossedOut = std::make_unique<SvxCrossedOutItem>(STRIKEOUT_NONE, ATTR_FONT_CROSSEDOUT); + m_aContour = std::make_unique<SvxContourItem>(false, ATTR_FONT_CONTOUR); + m_aShadowed = std::make_unique<SvxShadowedItem>(false, ATTR_FONT_SHADOWED); + m_aColor = std::make_unique<SvxColorItem>(ATTR_FONT_COLOR); + m_aBox = std::make_unique<SvxBoxItem>(ATTR_BORDER); + m_aTLBR = std::make_unique<SvxLineItem>(ATTR_BORDER_TLBR); + m_aBLTR = std::make_unique<SvxLineItem>(ATTR_BORDER_BLTR); + m_aBackground = std::make_unique<SvxBrushItem>(ATTR_BACKGROUND); + m_aAdjust = std::make_unique<SvxAdjustItem>(SvxAdjust::Left, 0); + m_aHorJustify = std::make_unique<SvxHorJustifyItem>(SvxCellHorJustify::Standard, ATTR_HOR_JUSTIFY); + m_aVerJustify = std::make_unique<SvxVerJustifyItem>(SvxCellVerJustify::Standard, ATTR_VER_JUSTIFY); + m_aStacked = std::make_unique<SfxBoolItem>(); + m_aMargin = std::make_unique<SvxMarginItem>(ATTR_MARGIN); + m_aLinebreak = std::make_unique<SfxBoolItem>(ATTR_LINEBREAK); + m_aRotateAngle = std::make_unique<SfxInt32Item>(ATTR_ROTATE_VALUE); + m_aRotateMode = std::make_unique<SvxRotateModeItem>(SVX_ROTATE_MODE_STANDARD, ATTR_ROTATE_MODE); } ScAutoFormatDataField::ScAutoFormatDataField( const ScAutoFormatDataField& rCopy ) diff --git a/svx/source/items/autoformathelper.cxx b/svx/source/items/autoformathelper.cxx index 1304ab0a25a6..f9ae76b4dd2b 100644 --- a/svx/source/items/autoformathelper.cxx +++ b/svx/source/items/autoformathelper.cxx @@ -244,6 +244,49 @@ AutoFormatBase::~AutoFormatBase() { } +AutoFormatBase& AutoFormatBase::operator=(const AutoFormatBase& rRef) +{ + // check self-assignment + if(this == &rRef) + { + return *this; + } + + // copy local members - this will use ::Clone() on all involved Items + SetFont(rRef.GetFont()); + SetHeight(rRef.GetHeight()); + SetWeight(rRef.GetWeight()); + SetPosture(rRef.GetPosture()); + SetCJKFont(rRef.GetCJKFont()); + SetCJKHeight(rRef.GetCJKHeight()); + SetCJKWeight(rRef.GetCJKWeight()); + SetCJKPosture(rRef.GetCJKPosture()); + SetCTLFont(rRef.GetCTLFont()); + SetCTLHeight(rRef.GetCTLHeight()); + SetCTLWeight(rRef.GetCTLWeight()); + SetCTLPosture(rRef.GetCTLPosture()); + SetUnderline(rRef.GetUnderline()); + SetOverline(rRef.GetOverline()); + SetCrossedOut(rRef.GetCrossedOut()); + SetContour(rRef.GetContour()); + SetShadowed(rRef.GetShadowed()); + SetColor(rRef.GetColor()); + SetBox(rRef.GetBox()); + SetTLBR(rRef.GetTLBR()); + SetBLTR(rRef.GetBLTR()); + SetBackground(rRef.GetBackground()); + SetAdjust(rRef.GetAdjust()); + SetHorJustify(rRef.GetHorJustify()); + SetVerJustify(rRef.GetVerJustify()); + SetStacked(rRef.GetStacked()); + SetMargin(rRef.GetMargin()); + SetLinebreak(rRef.GetLinebreak()); + SetRotateAngle(rRef.GetRotateAngle()); + SetRotateMode(rRef.GetRotateMode()); + + return *this; +} + const sal_uInt16 AUTOFORMAT_DATA_ID_641 = 10002; const sal_uInt16 AUTOFORMAT_DATA_ID_300OVRLN = 10032; const sal_uInt16 AUTOFORMAT_DATA_ID_680DR14 = 10012; diff --git a/sw/inc/tblafmt.hxx b/sw/inc/tblafmt.hxx index 3d2e7e3ff1e3..be1b1f476f79 100644 --- a/sw/inc/tblafmt.hxx +++ b/sw/inc/tblafmt.hxx @@ -63,9 +63,10 @@ class SwTable; class SwBoxAutoFormat : public AutoFormatBase { +private: // Writer specific - std::shared_ptr<SvxFrameDirectionItem> m_aTextOrientation; - std::shared_ptr<SwFormatVertOrient> m_aVerticalAlignment; + std::unique_ptr<SvxFrameDirectionItem> m_aTextOrientation; + std::unique_ptr<SwFormatVertOrient> m_aVerticalAlignment; // number format OUString m_sNumFormatString; @@ -79,7 +80,8 @@ public: SwBoxAutoFormat( const SwBoxAutoFormat& rNew ); ~SwBoxAutoFormat(); - SwBoxAutoFormat& operator=(const SwBoxAutoFormat& rNew); + /// assignemt-op (still used) + SwBoxAutoFormat& operator=(const SwBoxAutoFormat& rRef); /// Comparing based of boxes backgrounds. bool operator==(const SwBoxAutoFormat& rRight); diff --git a/sw/source/core/doc/tblafmt.cxx b/sw/source/core/doc/tblafmt.cxx index 1cbe79762e49..8bd00f8cc5b1 100644 --- a/sw/source/core/doc/tblafmt.cxx +++ b/sw/source/core/doc/tblafmt.cxx @@ -206,8 +206,8 @@ void SwAfVersions::Write(SvStream& rStream, sal_uInt16 fileVersion) SwBoxAutoFormat::SwBoxAutoFormat() : AutoFormatBase(), - m_aTextOrientation(std::make_shared<SvxFrameDirectionItem>(SvxFrameDirection::Environment, RES_FRAMEDIR)), - m_aVerticalAlignment(std::make_shared<SwFormatVertOrient>(0, css::text::VertOrientation::NONE, css::text::RelOrientation::FRAME)), + m_aTextOrientation(std::make_unique<SvxFrameDirectionItem>(SvxFrameDirection::Environment, RES_FRAMEDIR)), + m_aVerticalAlignment(std::make_unique<SwFormatVertOrient>(0, css::text::VertOrientation::NONE, css::text::RelOrientation::FRAME)), m_sNumFormatString(), m_eSysLanguage(::GetAppLanguage()), m_eNumFormatLanguage(::GetAppLanguage()), @@ -216,36 +216,36 @@ SwBoxAutoFormat::SwBoxAutoFormat() // need to set default instances for base class AutoFormatBase here // due to resource defines (e.g. RES_CHRATR_FONT) which are not available // in svx and different in the different usages of derivations - m_aFont = std::make_shared<SvxFontItem>(*GetDfltAttr( RES_CHRATR_FONT ) ); - m_aHeight = std::make_shared<SvxFontHeightItem>(240, 100, RES_CHRATR_FONTSIZE ); - m_aWeight = std::make_shared<SvxWeightItem>(WEIGHT_NORMAL, RES_CHRATR_WEIGHT ); - m_aPosture = std::make_shared<SvxPostureItem>(ITALIC_NONE, RES_CHRATR_POSTURE ); - m_aCJKFont = std::make_shared<SvxFontItem>(*GetDfltAttr( RES_CHRATR_CJK_FONT ) ); - m_aCJKHeight = std::make_shared<SvxFontHeightItem>(240, 100, RES_CHRATR_CJK_FONTSIZE ); - m_aCJKWeight = std::make_shared<SvxWeightItem>(WEIGHT_NORMAL, RES_CHRATR_CJK_WEIGHT ); - m_aCJKPosture = std::make_shared<SvxPostureItem>(ITALIC_NONE, RES_CHRATR_CJK_POSTURE ); - m_aCTLFont = std::make_shared<SvxFontItem>(*GetDfltAttr( RES_CHRATR_CTL_FONT ) ); - m_aCTLHeight = std::make_shared<SvxFontHeightItem>(240, 100, RES_CHRATR_CTL_FONTSIZE ); - m_aCTLWeight = std::make_shared<SvxWeightItem>(WEIGHT_NORMAL, RES_CHRATR_CTL_WEIGHT ); - m_aCTLPosture = std::make_shared<SvxPostureItem>(ITALIC_NONE, RES_CHRATR_CTL_POSTURE ); - m_aUnderline = std::make_shared<SvxUnderlineItem>(LINESTYLE_NONE, RES_CHRATR_UNDERLINE ); - m_aOverline = std::make_shared<SvxOverlineItem>(LINESTYLE_NONE, RES_CHRATR_OVERLINE ); - m_aCrossedOut = std::make_shared<SvxCrossedOutItem>(STRIKEOUT_NONE, RES_CHRATR_CROSSEDOUT ); - m_aContour = std::make_shared<SvxContourItem>(false, RES_CHRATR_CONTOUR ); - m_aShadowed = std::make_shared<SvxShadowedItem>(false, RES_CHRATR_SHADOWED ); - m_aColor = std::make_shared<SvxColorItem>(RES_CHRATR_COLOR ); - m_aBox = std::make_shared<SvxBoxItem>(RES_BOX ); - m_aTLBR = std::make_shared<SvxLineItem>(0 ); - m_aBLTR = std::make_shared<SvxLineItem>(0 ); - m_aBackground = std::make_shared<SvxBrushItem>(RES_BACKGROUND ); - m_aAdjust = std::make_shared<SvxAdjustItem>(SvxAdjust::Left, RES_PARATR_ADJUST ); - m_aHorJustify = std::make_shared<SvxHorJustifyItem>(SvxCellHorJustify::Standard, 0); - m_aVerJustify = std::make_shared<SvxVerJustifyItem>(SvxCellVerJustify::Standard, 0); - m_aStacked = std::make_shared<SfxBoolItem>(0 ); - m_aMargin = std::make_shared<SvxMarginItem>(0 ); - m_aLinebreak = std::make_shared<SfxBoolItem>(0 ); - m_aRotateAngle = std::make_shared<SfxInt32Item>(0 ); - m_aRotateMode = std::make_shared<SvxRotateModeItem>(SVX_ROTATE_MODE_STANDARD, 0 ); + m_aFont = std::make_unique<SvxFontItem>(*GetDfltAttr( RES_CHRATR_FONT ) ); + m_aHeight = std::make_unique<SvxFontHeightItem>(240, 100, RES_CHRATR_FONTSIZE ); + m_aWeight = std::make_unique<SvxWeightItem>(WEIGHT_NORMAL, RES_CHRATR_WEIGHT ); + m_aPosture = std::make_unique<SvxPostureItem>(ITALIC_NONE, RES_CHRATR_POSTURE ); + m_aCJKFont = std::make_unique<SvxFontItem>(*GetDfltAttr( RES_CHRATR_CJK_FONT ) ); + m_aCJKHeight = std::make_unique<SvxFontHeightItem>(240, 100, RES_CHRATR_CJK_FONTSIZE ); + m_aCJKWeight = std::make_unique<SvxWeightItem>(WEIGHT_NORMAL, RES_CHRATR_CJK_WEIGHT ); + m_aCJKPosture = std::make_unique<SvxPostureItem>(ITALIC_NONE, RES_CHRATR_CJK_POSTURE ); + m_aCTLFont = std::make_unique<SvxFontItem>(*GetDfltAttr( RES_CHRATR_CTL_FONT ) ); + m_aCTLHeight = std::make_unique<SvxFontHeightItem>(240, 100, RES_CHRATR_CTL_FONTSIZE ); + m_aCTLWeight = std::make_unique<SvxWeightItem>(WEIGHT_NORMAL, RES_CHRATR_CTL_WEIGHT ); + m_aCTLPosture = std::make_unique<SvxPostureItem>(ITALIC_NONE, RES_CHRATR_CTL_POSTURE ); + m_aUnderline = std::make_unique<SvxUnderlineItem>(LINESTYLE_NONE, RES_CHRATR_UNDERLINE ); + m_aOverline = std::make_unique<SvxOverlineItem>(LINESTYLE_NONE, RES_CHRATR_OVERLINE ); + m_aCrossedOut = std::make_unique<SvxCrossedOutItem>(STRIKEOUT_NONE, RES_CHRATR_CROSSEDOUT ); + m_aContour = std::make_unique<SvxContourItem>(false, RES_CHRATR_CONTOUR ); + m_aShadowed = std::make_unique<SvxShadowedItem>(false, RES_CHRATR_SHADOWED ); + m_aColor = std::make_unique<SvxColorItem>(RES_CHRATR_COLOR ); + m_aBox = std::make_unique<SvxBoxItem>(RES_BOX ); + m_aTLBR = std::make_unique<SvxLineItem>(0 ); + m_aBLTR = std::make_unique<SvxLineItem>(0 ); + m_aBackground = std::make_unique<SvxBrushItem>(RES_BACKGROUND ); + m_aAdjust = std::make_unique<SvxAdjustItem>(SvxAdjust::Left, RES_PARATR_ADJUST ); + m_aHorJustify = std::make_unique<SvxHorJustifyItem>(SvxCellHorJustify::Standard, 0); + m_aVerJustify = std::make_unique<SvxVerJustifyItem>(SvxCellVerJustify::Standard, 0); + m_aStacked = std::make_unique<SfxBoolItem>(0 ); + m_aMargin = std::make_unique<SvxMarginItem>(0 ); + m_aLinebreak = std::make_unique<SfxBoolItem>(0 ); + m_aRotateAngle = std::make_unique<SfxInt32Item>(0 ); + m_aRotateMode = std::make_unique<SvxRotateModeItem>(SVX_ROTATE_MODE_STANDARD, 0 ); // FIXME - add attribute IDs for the diagonal line items // aTLBR( RES_... ), @@ -268,45 +268,27 @@ SwBoxAutoFormat::~SwBoxAutoFormat() { } -SwBoxAutoFormat& SwBoxAutoFormat::operator=( const SwBoxAutoFormat& rNew ) +SwBoxAutoFormat& SwBoxAutoFormat::operator=(const SwBoxAutoFormat& rRef) { - m_aFont = rNew.m_aFont; - m_aHeight = rNew.m_aHeight; - m_aWeight = rNew.m_aWeight; - m_aPosture = rNew.m_aPosture; - m_aCJKFont = rNew.m_aCJKFont; - m_aCJKHeight = rNew.m_aCJKHeight; - m_aCJKWeight = rNew.m_aCJKWeight; - m_aCJKPosture = rNew.m_aCJKPosture; - m_aCTLFont = rNew.m_aCTLFont; - m_aCTLHeight = rNew.m_aCTLHeight; - m_aCTLWeight = rNew.m_aCTLWeight; - m_aCTLPosture = rNew.m_aCTLPosture; - m_aUnderline = rNew.m_aUnderline; - m_aOverline = rNew.m_aOverline; - m_aCrossedOut = rNew.m_aCrossedOut; - m_aContour = rNew.m_aContour; - m_aShadowed = rNew.m_aShadowed; - m_aColor = rNew.m_aColor; - SetAdjust( *rNew.m_aAdjust ); - m_aTextOrientation = rNew.m_aTextOrientation; - m_aVerticalAlignment = rNew.m_aVerticalAlignment; - m_aBox = rNew.m_aBox; - m_aTLBR = rNew.m_aTLBR; - m_aBLTR = rNew.m_aBLTR; - m_aBackground = rNew.m_aBackground; - - m_aHorJustify = rNew.m_aHorJustify; - m_aVerJustify = rNew.m_aVerJustify; - m_aStacked->SetValue( rNew.m_aStacked->GetValue() ); - m_aMargin = rNew.m_aMargin; - m_aLinebreak->SetValue( rNew.m_aLinebreak->GetValue() ); - m_aRotateAngle->SetValue( rNew.m_aRotateAngle->GetValue() ); - m_aRotateMode->SetValue( rNew.m_aRotateMode->GetValue() ); - - m_sNumFormatString = rNew.m_sNumFormatString; - m_eSysLanguage = rNew.m_eSysLanguage; - m_eNumFormatLanguage = rNew.m_eNumFormatLanguage; + // check self-assignment + if(this == &rRef) + { + return *this; + } + + // call baseclass implementation + AutoFormatBase::operator=(rRef); + + // copy local members - this will use ::Clone() on all involved Items + SetTextOrientation(rRef.GetTextOrientation()); + SetVerticalAlignment(rRef.GetVerticalAlignment()); + SetNumFormatString(rRef.GetNumFormatString()); + SetSysLanguage(rRef.GetSysLanguage()); + SetNumFormatLanguage(rRef.GetNumFormatLanguage()); + + // m_wXObject used to not be copied before 1e2682235cded9a7cd90e55f0bfc60a1285e9a46 + // "WIP: Further preparations for deeper Item changes" by this operator, so do not do it now, too + // rRef.SetXObject(GetXObject()); return *this; } |