summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
Diffstat (limited to 'sw')
-rw-r--r--sw/CppunitTest_sw_uiwriter.mk1
-rw-r--r--sw/Library_sw.mk1
-rw-r--r--sw/inc/doc.hxx4
-rw-r--r--sw/inc/fesh.hxx8
-rw-r--r--sw/inc/fmtornt.hxx21
-rw-r--r--sw/inc/format.hxx4
-rwxr-xr-xsw/inc/legacyitem.hxx44
-rw-r--r--sw/inc/ndtxt.hxx2
-rw-r--r--sw/inc/paratr.hxx2
-rw-r--r--sw/inc/tblafmt.hxx132
-rw-r--r--sw/qa/core/filters-test.cxx2
-rw-r--r--sw/qa/core/uwriter.cxx78
-rw-r--r--sw/source/core/attr/format.cxx17
-rw-r--r--sw/source/core/doc/DocumentContentOperationsManager.cxx31
-rw-r--r--sw/source/core/doc/DocumentStylePoolManager.cxx37
-rw-r--r--sw/source/core/doc/doclay.cxx14
-rw-r--r--sw/source/core/doc/tblafmt.cxx478
-rw-r--r--sw/source/core/doc/tblrwcl.cxx35
-rw-r--r--sw/source/core/docnode/ndtbl1.cxx48
-rw-r--r--sw/source/core/frmedt/fefly1.cxx12
-rw-r--r--sw/source/core/frmedt/fetab.cxx18
-rw-r--r--sw/source/core/inc/frmtool.hxx2
-rw-r--r--sw/source/core/layout/atrfrm.cxx58
-rw-r--r--sw/source/core/layout/flylay.cxx4
-rw-r--r--sw/source/core/layout/frmtool.cxx12
-rwxr-xr-xsw/source/core/layout/legacyitem.cxx82
-rw-r--r--sw/source/core/layout/pagedesc.cxx2
-rw-r--r--sw/source/core/layout/paintfrm.cxx7
-rw-r--r--sw/source/core/layout/tabfrm.cxx4
-rw-r--r--sw/source/core/layout/wsfrm.cxx12
-rw-r--r--sw/source/core/text/porfld.cxx2
-rw-r--r--sw/source/core/txtnode/ndtxt.cxx5
-rw-r--r--sw/source/core/unocore/unoframe.cxx26
-rw-r--r--sw/source/core/unocore/unoparagraph.cxx4
-rw-r--r--sw/source/core/unocore/unostyle.cxx44
-rw-r--r--sw/source/core/unocore/unotbl.cxx42
-rw-r--r--sw/source/filter/basflt/fltini.cxx18
-rw-r--r--sw/source/filter/html/css1atr.cxx10
-rw-r--r--sw/source/filter/html/htmlcss1.cxx22
-rw-r--r--sw/source/filter/html/htmlflywriter.cxx9
-rw-r--r--sw/source/filter/html/htmlgrin.cxx22
-rw-r--r--sw/source/filter/html/htmltabw.cxx12
-rw-r--r--sw/source/filter/html/svxcss1.cxx20
-rw-r--r--sw/source/filter/html/swcss1.hxx2
-rw-r--r--sw/source/filter/html/swhtml.cxx12
-rw-r--r--sw/source/filter/html/wrthtml.cxx5
-rw-r--r--sw/source/filter/writer/wrt_fn.cxx4
-rw-r--r--sw/source/filter/ww8/docxexport.cxx4
-rw-r--r--sw/source/filter/ww8/rtfexport.cxx2
-rw-r--r--sw/source/filter/ww8/wrtw8esh.cxx24
-rw-r--r--sw/source/filter/ww8/wrtw8nds.cxx9
-rw-r--r--sw/source/filter/ww8/wrtww8.cxx8
-rw-r--r--sw/source/filter/ww8/wrtww8.hxx4
-rw-r--r--sw/source/filter/ww8/ww8atr.cxx6
-rw-r--r--sw/source/filter/ww8/ww8par.cxx20
-rw-r--r--sw/source/filter/ww8/ww8par.hxx4
-rw-r--r--sw/source/filter/ww8/ww8par3.cxx13
-rw-r--r--sw/source/filter/ww8/ww8par6.cxx49
-rw-r--r--sw/source/ui/dialog/uiregionsw.cxx48
-rw-r--r--sw/source/ui/frmdlg/wrap.cxx13
-rw-r--r--sw/source/uibase/app/apphdl.cxx2
-rw-r--r--sw/source/uibase/app/docsh2.cxx4
-rw-r--r--sw/source/uibase/docvw/romenu.cxx20
-rw-r--r--sw/source/uibase/docvw/romenu.hxx2
-rw-r--r--sw/source/uibase/shells/annotsh.cxx17
-rw-r--r--sw/source/uibase/shells/basesh.cxx30
-rw-r--r--sw/source/uibase/shells/drwtxtsh.cxx12
-rw-r--r--sw/source/uibase/shells/frmsh.cxx110
-rw-r--r--sw/source/uibase/shells/tabsh.cxx86
-rw-r--r--sw/source/uibase/shells/textsh.cxx54
-rw-r--r--sw/source/uibase/uiview/formatclipboard.cxx30
-rw-r--r--sw/source/uibase/uiview/viewtab.cxx25
-rw-r--r--sw/source/uibase/utlui/navipi.cxx2
-rw-r--r--sw/source/uibase/utlui/uitool.cxx48
74 files changed, 937 insertions, 1140 deletions
diff --git a/sw/CppunitTest_sw_uiwriter.mk b/sw/CppunitTest_sw_uiwriter.mk
index eaf0b0d15a17..e6867b790b9d 100644
--- a/sw/CppunitTest_sw_uiwriter.mk
+++ b/sw/CppunitTest_sw_uiwriter.mk
@@ -36,6 +36,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_uiwriter, \
vcl \
tl \
utl \
+ svx \
))
$(eval $(call gb_CppunitTest_use_externals,sw_uiwriter,\
diff --git a/sw/Library_sw.mk b/sw/Library_sw.mk
index 9f92d20e643f..ededa54c689b 100644
--- a/sw/Library_sw.mk
+++ b/sw/Library_sw.mk
@@ -326,6 +326,7 @@ $(eval $(call gb_Library_add_exception_objects,sw,\
sw/source/core/layout/layact \
sw/source/core/layout/laycache \
sw/source/core/layout/layouter \
+ sw/source/core/layout/legacyitem \
sw/source/core/layout/movedfwdfrmsbyobjpos \
sw/source/core/layout/newfrm \
sw/source/core/layout/objectformatter \
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index 9bba13ef17be..fd8ab6c58fdd 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -1474,7 +1474,7 @@ public:
/// Call again without bOptimize to ensure equal height in case some row's content didn't fit.
bool BalanceRowHeight( const SwCursor& rCursor, bool bTstOnly, const bool bOptimize );
void SetRowBackground( const SwCursor& rCursor, const SvxBrushItem &rNew );
- static bool GetRowBackground( const SwCursor& rCursor, SvxBrushItem &rToFill );
+ static bool GetRowBackground( const SwCursor& rCursor, std::shared_ptr<SvxBrushItem>& rToFill );
void SetTabBorders( const SwCursor& rCursor, const SfxItemSet& rSet );
void SetTabLineStyle( const SwCursor& rCursor,
const Color* pColor, bool bSetLine,
@@ -1491,7 +1491,7 @@ public:
the values of the same property over any other boxes in the selection; if any value is different from
that of the first box, the property is unset (and false is returned).
*/
- static bool GetBoxAttr( const SwCursor& rCursor, SfxPoolItem &rToFill );
+ static bool GetBoxAttr( const SwCursor& rCursor, std::shared_ptr<SfxPoolItem>& rToFill );
void SetBoxAlign( const SwCursor& rCursor, sal_uInt16 nAlign );
static sal_uInt16 GetBoxAlign( const SwCursor& rCursor );
/// Adjusts selected cell widths in such a way, that their content does not need to be wrapped (if possible).
diff --git a/sw/inc/fesh.hxx b/sw/inc/fesh.hxx
index 886cb2d7bf39..4d619d4d65f0 100644
--- a/sw/inc/fesh.hxx
+++ b/sw/inc/fesh.hxx
@@ -665,16 +665,16 @@ public:
void SetTabLineStyle(const Color* pColor, bool bSetLine = false, const editeng::SvxBorderLine* pBorderLine = nullptr);
void SetTabBackground( const SvxBrushItem &rNew );
- void GetTabBackground( SvxBrushItem &rToFill ) const;
+ void GetTabBackground( std::shared_ptr<SvxBrushItem>& rToFill ) const;
void SetBoxBackground( const SvxBrushItem &rNew );
- bool GetBoxBackground( SvxBrushItem &rToFill ) const; ///< FALSE ambiguous.
+ bool GetBoxBackground( std::shared_ptr<SvxBrushItem>& rToFill ) const; ///< FALSE ambiguous.
void SetBoxDirection( const SvxFrameDirectionItem& rNew );
- bool GetBoxDirection( SvxFrameDirectionItem& rToFill ) const; ///< FALSE ambiguous.
+ bool GetBoxDirection( std::shared_ptr<SvxFrameDirectionItem>& rToFill ) const; ///< FALSE ambiguous.
void SetRowBackground( const SvxBrushItem &rNew );
- bool GetRowBackground( SvxBrushItem &rToFill ) const; ///< FALSE ambiguous.
+ bool GetRowBackground( std::shared_ptr<SvxBrushItem>& rToFill ) const; ///< FALSE ambiguous.
SwTab WhichMouseTabCol( const Point &rPt ) const;
void GetTabCols( SwTabCols &rToFill ) const; ///< Info about columns and margins.
diff --git a/sw/inc/fmtornt.hxx b/sw/inc/fmtornt.hxx
index 055db32bade3..24ffdc907e26 100644
--- a/sw/inc/fmtornt.hxx
+++ b/sw/inc/fmtornt.hxx
@@ -38,7 +38,6 @@ class SW_DLLPUBLIC SwFormatVertOrient: public SfxPoolItem
public:
SwFormatVertOrient( SwTwips nY = 0, sal_Int16 eVert = css::text::VertOrientation::NONE,
sal_Int16 eRel = css::text::RelOrientation::PRINT_AREA );
- inline SwFormatVertOrient &operator=( const SwFormatVertOrient &rCpy );
SwFormatVertOrient(SwFormatVertOrient const &) = default; // SfxPoolItem copy function dichotomy
/// "Pure virtual methods" of SfxPoolItem.
@@ -52,9 +51,6 @@ public:
virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
- SvStream& Store(SvStream &rStream, sal_uInt16 itemVersion) const override;
- SfxPoolItem* Create(SvStream &rStream, sal_uInt16 itemVersion) const override;
-
sal_Int16 GetVertOrient() const { return m_eOrient; }
sal_Int16 GetRelationOrient() const { return m_eRelation; }
void SetVertOrient( sal_Int16 eNew ) { m_eOrient = eNew; }
@@ -75,7 +71,6 @@ class SW_DLLPUBLIC SwFormatHoriOrient: public SfxPoolItem
public:
SwFormatHoriOrient( SwTwips nX = 0, sal_Int16 eHori = css::text::HoriOrientation::NONE,
sal_Int16 eRel = css::text::RelOrientation::PRINT_AREA, bool bPos = false );
- inline SwFormatHoriOrient &operator=( const SwFormatHoriOrient &rCpy );
SwFormatHoriOrient(SwFormatHoriOrient const &) = default; // SfxPoolItem copy function dichotomy
/// "Pure virtual methods" of SfxPoolItem.
@@ -103,22 +98,6 @@ public:
void dumpAsXml(xmlTextWriterPtr pWriter) const override;
};
-inline SwFormatVertOrient &SwFormatVertOrient::operator=( const SwFormatVertOrient &rCpy )
-{
- m_nYPos = rCpy.GetPos();
- m_eOrient = rCpy.GetVertOrient();
- m_eRelation = rCpy.GetRelationOrient();
- return *this;
-}
-inline SwFormatHoriOrient &SwFormatHoriOrient::operator=( const SwFormatHoriOrient &rCpy )
-{
- m_nXPos = rCpy.GetPos();
- m_eOrient = rCpy.GetHoriOrient();
- m_eRelation = rCpy.GetRelationOrient();
- m_bPosToggle = rCpy.IsPosToggle();
- return *this;
-}
-
inline const SwFormatVertOrient &SwAttrSet::GetVertOrient(bool bInP) const
{ return Get( RES_VERT_ORIENT,bInP); }
inline const SwFormatHoriOrient &SwAttrSet::GetHoriOrient(bool bInP) const
diff --git a/sw/inc/format.hxx b/sw/inc/format.hxx
index cbeda7237f66..849b14d8b688 100644
--- a/sw/inc/format.hxx
+++ b/sw/inc/format.hxx
@@ -96,7 +96,7 @@ public:
}
SfxItemState GetItemState( sal_uInt16 nWhich, bool bSrchInParent = true,
const SfxPoolItem **ppItem = nullptr ) const;
- SfxItemState GetBackgroundState(SvxBrushItem &rItem) const;
+ SfxItemState GetBackgroundState(std::shared_ptr<SvxBrushItem>& rItem) const;
virtual bool SetFormatAttr( const SfxPoolItem& rAttr );
virtual bool SetFormatAttr( const SfxItemSet& rSet );
virtual bool ResetFormatAttr( sal_uInt16 nWhich1, sal_uInt16 nWhich2 = 0 );
@@ -203,7 +203,7 @@ public:
inline const SvxFormatKeepItem &GetKeep( bool = true ) const;
// Create SvxBrushItem for Background fill (partially for backwards compatibility)
- SvxBrushItem makeBackgroundBrushItem( bool = true ) const;
+ std::shared_ptr<SvxBrushItem> makeBackgroundBrushItem( bool = true ) const;
inline const SvxShadowItem &GetShadow( bool = true ) const;
inline const SwFormatPageDesc &GetPageDesc( bool = true ) const;
diff --git a/sw/inc/legacyitem.hxx b/sw/inc/legacyitem.hxx
new file mode 100755
index 000000000000..6df864b9de58
--- /dev/null
+++ b/sw/inc/legacyitem.hxx
@@ -0,0 +1,44 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SW_LEGACYITEM_HXX
+#define INCLUDED_SW_LEGACYITEM_HXX
+
+#include "swdllapi.h"
+
+//////////////////////////////////////////////////////////////////////////////
+// // sw
+// SwFormatVertOrient m_aVerticalAlignment;
+//////////////////////////////////////////////////////////////////////////////
+
+class SvStream;
+class SwFormatVertOrient;
+
+namespace legacy
+{
+ namespace SwFormatVert
+ {
+ sal_uInt16 SW_DLLPUBLIC GetVersion(sal_uInt16 nFileFormatVersion);
+ void SW_DLLPUBLIC Create(SwFormatVertOrient& rItem, SvStream& rStrm, sal_uInt16 nItemVersion);
+ SW_DLLPUBLIC SvStream& Store(const SwFormatVertOrient& rItem, SvStream& rStrm, sal_uInt16 nItemVersion);
+ }
+}
+
+#endif // INCLUDED_SW_LEGACYITEM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/inc/ndtxt.hxx b/sw/inc/ndtxt.hxx
index b8efd5b985af..debe937dd0bf 100644
--- a/sw/inc/ndtxt.hxx
+++ b/sw/inc/ndtxt.hxx
@@ -486,7 +486,7 @@ public:
SwTwips GetAdditionalIndentForStartingNewList() const;
- void ClearLRSpaceItemDueToListLevelIndents( SvxLRSpaceItem& o_rLRSpaceItem ) const;
+ void ClearLRSpaceItemDueToListLevelIndents( std::shared_ptr<SvxLRSpaceItem>& o_rLRSpaceItem ) const;
/** return left margin for tab stop position calculation
diff --git a/sw/inc/paratr.hxx b/sw/inc/paratr.hxx
index 78c03ff0e2df..a66ec00beebd 100644
--- a/sw/inc/paratr.hxx
+++ b/sw/inc/paratr.hxx
@@ -138,8 +138,6 @@ public:
SwNumRuleItem( const OUString& rRuleName )
: SfxStringItem( RES_PARATR_NUMRULE, rRuleName ) {}
- SwNumRuleItem& operator=( const SwNumRuleItem& rCpy )
- { SetValue( rCpy.GetValue() ); return *this; }
SwNumRuleItem(SwNumRuleItem const &) = default; // SfxPoolItem copy function dichotomy
/// "pure virtual methods" of SfxPoolItem
diff --git a/sw/inc/tblafmt.hxx b/sw/inc/tblafmt.hxx
index 2170091abe5d..8b0320f9f929 100644
--- a/sw/inc/tblafmt.hxx
+++ b/sw/inc/tblafmt.hxx
@@ -49,6 +49,7 @@
#include <editeng/frmdiritem.hxx>
#include <editeng/shaditem.hxx>
#include <svx/rotmodit.hxx>
+#include <svx/autoformathelper.hxx>
#include <svl/intitem.hxx>
#include <editeng/lineitem.hxx>
#include "fmtpdsc.hxx"
@@ -60,125 +61,49 @@ struct SwAfVersions;
class SvNumberFormatter;
class SwTable;
-class SwBoxAutoFormat
+class SwBoxAutoFormat : public AutoFormatBase
{
- // common attributes of Calc and Writer
- // --- from 641 on: CJK and CTL font settings
- SvxFontItem m_aFont;
- SvxFontHeightItem m_aHeight;
- SvxWeightItem m_aWeight;
- SvxPostureItem m_aPosture;
-
- SvxFontItem m_aCJKFont;
- SvxFontHeightItem m_aCJKHeight;
- SvxWeightItem m_aCJKWeight;
- SvxPostureItem m_aCJKPosture;
-
- SvxFontItem m_aCTLFont;
- SvxFontHeightItem m_aCTLHeight;
- SvxWeightItem m_aCTLWeight;
- SvxPostureItem m_aCTLPosture;
-
- SvxUnderlineItem m_aUnderline;
- SvxOverlineItem m_aOverline;
- SvxCrossedOutItem m_aCrossedOut;
- SvxContourItem m_aContour;
- SvxShadowedItem m_aShadowed;
- SvxColorItem m_aColor;
- SvxBoxItem m_aBox;
- SvxLineItem m_aTLBR;
- SvxLineItem m_aBLTR;
- SvxBrushItem m_aBackground;
-
// Writer specific
- SvxAdjustItem m_aAdjust;
- SvxFrameDirectionItem m_aTextOrientation;
- SwFormatVertOrient m_aVerticalAlignment;
-
- // Calc specific
- SvxHorJustifyItem m_aHorJustify;
- SvxVerJustifyItem m_aVerJustify;
- SfxBoolItem m_aStacked;
- SvxMarginItem m_aMargin;
- SfxBoolItem m_aLinebreak;
- SfxInt32Item m_aRotateAngle;
- SvxRotateModeItem m_aRotateMode;
+ std::shared_ptr<SvxFrameDirectionItem> m_aTextOrientation;
+ std::shared_ptr<SwFormatVertOrient> m_aVerticalAlignment;
// number format
- OUString m_sNumFormatString;
- LanguageType m_eSysLanguage, m_eNumFormatLanguage;
+ OUString m_sNumFormatString;
+ LanguageType m_eSysLanguage;
+ LanguageType m_eNumFormatLanguage;
css::uno::WeakReference<css::uno::XInterface> m_wXObject;
- friend class SwDocTest;
public:
SwBoxAutoFormat();
SwBoxAutoFormat( const SwBoxAutoFormat& rNew );
~SwBoxAutoFormat();
- SwBoxAutoFormat& operator=( const SwBoxAutoFormat& rNew );
/// Comparing based of boxes backgrounds.
bool operator==(const SwBoxAutoFormat& rRight);
// The get-methods.
- const SvxFontItem &GetFont() const { return m_aFont; }
- const SvxFontHeightItem &GetHeight() const { return m_aHeight; }
- const SvxWeightItem &GetWeight() const { return m_aWeight; }
- const SvxPostureItem &GetPosture() const { return m_aPosture; }
- const SvxFontItem &GetCJKFont() const { return m_aCJKFont; }
- const SvxFontHeightItem &GetCJKHeight() const { return m_aCJKHeight; }
- const SvxWeightItem &GetCJKWeight() const { return m_aCJKWeight; }
- const SvxPostureItem &GetCJKPosture() const { return m_aCJKPosture; }
- const SvxFontItem &GetCTLFont() const { return m_aCTLFont; }
- const SvxFontHeightItem &GetCTLHeight() const { return m_aCTLHeight; }
- const SvxWeightItem &GetCTLWeight() const { return m_aCTLWeight; }
- const SvxPostureItem &GetCTLPosture() const { return m_aCTLPosture; }
- const SvxUnderlineItem &GetUnderline() const { return m_aUnderline; }
- const SvxOverlineItem &GetOverline() const { return m_aOverline; }
- const SvxCrossedOutItem &GetCrossedOut() const { return m_aCrossedOut; }
- const SvxContourItem &GetContour() const { return m_aContour; }
- const SvxShadowedItem &GetShadowed() const { return m_aShadowed; }
- const SvxColorItem &GetColor() const { return m_aColor; }
- const SvxAdjustItem &GetAdjust() const { return m_aAdjust; }
- const SvxFrameDirectionItem& GetTextOrientation() const { return m_aTextOrientation; }
- const SwFormatVertOrient& GetVerticalAlignment() const { return m_aVerticalAlignment; }
- const SvxBoxItem &GetBox() const { return m_aBox; }
- const SvxBrushItem &GetBackground() const { return m_aBackground; }
+ const SvxFrameDirectionItem& GetTextOrientation() const { return *m_aTextOrientation; }
+ const SwFormatVertOrient& GetVerticalAlignment() const { return *m_aVerticalAlignment; }
+
void GetValueFormat( OUString& rFormat, LanguageType& rLng, LanguageType& rSys ) const
{ rFormat = m_sNumFormatString; rLng = m_eNumFormatLanguage; rSys = m_eSysLanguage; }
+ const OUString& GetNumFormatString() const { return m_sNumFormatString; }
+ const LanguageType& GetSysLanguage() const { return m_eSysLanguage; }
+ const LanguageType& GetNumFormatLanguage() const { return m_eNumFormatLanguage; }
+
// The set-methods.
- void SetFont( const SvxFontItem& rNew ) { m_aFont = rNew; }
- void SetHeight( const SvxFontHeightItem& rNew ) { m_aHeight = rNew; }
- void SetWeight( const SvxWeightItem& rNew ) { m_aWeight = rNew; }
- void SetPosture( const SvxPostureItem& rNew ) { m_aPosture = rNew; }
- void SetCJKFont( const SvxFontItem& rNew ) { m_aCJKFont = rNew; }
- void SetCJKHeight( const SvxFontHeightItem& rNew ) { m_aCJKHeight = rNew; }
- void SetCJKWeight( const SvxWeightItem& rNew ) { m_aCJKWeight = rNew; }
- void SetCJKPosture( const SvxPostureItem& rNew ) { m_aCJKPosture = rNew; }
- void SetCTLFont( const SvxFontItem& rNew ) { m_aCTLFont = rNew; }
- void SetCTLHeight( const SvxFontHeightItem& rNew ) { m_aCTLHeight = rNew; }
- void SetCTLWeight( const SvxWeightItem& rNew ) { m_aCTLWeight = rNew; }
- void SetCTLPosture( const SvxPostureItem& rNew ) { m_aCTLPosture = rNew; }
- void SetUnderline( const SvxUnderlineItem& rNew ) { m_aUnderline = rNew; }
- void SetOverline( const SvxOverlineItem& rNew ) { m_aOverline = rNew; }
- void SetCrossedOut( const SvxCrossedOutItem& rNew ) { m_aCrossedOut = rNew; }
- void SetContour( const SvxContourItem& rNew ) { m_aContour = rNew; }
- void SetShadowed( const SvxShadowedItem& rNew ) { m_aShadowed = rNew; }
- void SetColor( const SvxColorItem& rNew ) { m_aColor = rNew; }
- void SetAdjust( const SvxAdjustItem& rNew )
- {
- m_aAdjust.SetAdjust( rNew.GetAdjust() );
- m_aAdjust.SetOneWord( rNew.GetOneWord() );
- m_aAdjust.SetLastBlock( rNew.GetLastBlock() );
- }
- void SetTextOrientation(const SvxFrameDirectionItem& rNew) { m_aTextOrientation = rNew; }
- void SetVerticalAlignment(const SwFormatVertOrient& rNew) { m_aVerticalAlignment = rNew; }
- void SetBox( const SvxBoxItem& rNew ) { m_aBox = rNew; }
- void SetBackground( const SvxBrushItem& rNew ) { m_aBackground = rNew; }
+ void SetTextOrientation( const SvxFrameDirectionItem& rNew ) { m_aTextOrientation.reset(static_cast<SvxFrameDirectionItem*>(rNew.Clone())); }
+ void SetVerticalAlignment( const SwFormatVertOrient& rNew ) { m_aVerticalAlignment.reset(static_cast<SwFormatVertOrient*>(rNew.Clone())); }
+
void SetValueFormat( const OUString& rFormat, LanguageType eLng, LanguageType eSys )
{ m_sNumFormatString = rFormat; m_eNumFormatLanguage = eLng; m_eSysLanguage = eSys; }
+ void SetNumFormatString(const OUString& rNew) { m_sNumFormatString = rNew; }
+ void SetSysLanguage(const LanguageType& rNew) { m_eSysLanguage = rNew; }
+ void SetNumFormatLanguage(const LanguageType& rNew) { m_eNumFormatLanguage = rNew; }
+
css::uno::WeakReference<css::uno::XInterface> const& GetXObject() const
{ return m_wXObject; }
void SetXObject(css::uno::Reference<css::uno::XInterface> const& xObject)
@@ -186,7 +111,6 @@ public:
bool Load( SvStream& rStream, const SwAfVersions& rVersions, sal_uInt16 nVer );
bool Save( SvStream& rStream, sal_uInt16 fileVersion ) const;
- void SaveVersionNo( SvStream& rStream, sal_uInt16 fileVersion ) const;
};
enum class SwTableAutoFormatUpdateFlags { Char = 1, Box = 2 };
@@ -262,14 +186,14 @@ class SW_DLLPUBLIC SwTableAutoFormat
SwBoxAutoFormat* m_aBoxAutoFormat[ 16 ];
// Writer-specific options
- SvxFormatBreakItem m_aBreak;
+ std::shared_ptr<SvxFormatBreakItem> m_aBreak;
SwFormatPageDesc m_aPageDesc;
- SvxFormatKeepItem m_aKeepWithNextPara;
+ std::shared_ptr<SvxFormatKeepItem> m_aKeepWithNextPara;
sal_uInt16 m_aRepeatHeading;
bool m_bLayoutSplit;
bool m_bRowSplit;
bool m_bCollapsingBorders;
- SvxShadowItem m_aShadow;
+ std::shared_ptr<SvxShadowItem> m_aShadow;
bool m_bHidden;
bool m_bUserDefined;
@@ -280,6 +204,14 @@ public:
SwTableAutoFormat& operator=( const SwTableAutoFormat& rNew );
+ const SvxFormatBreakItem& GetBreak() const { return *m_aBreak; }
+ const SvxFormatKeepItem& GetKeepWithNextPara() const { return *m_aKeepWithNextPara; }
+ const SvxShadowItem& GetShadow() const { return *m_aShadow; }
+
+ void SetBreak(const SvxFormatBreakItem& rNew) { m_aBreak.reset(static_cast<SvxFormatBreakItem*>(rNew.Clone())); }
+ void SetKeepWithNextPara(const SvxFormatKeepItem& rNew) { m_aKeepWithNextPara.reset(static_cast<SvxFormatKeepItem*>(rNew.Clone())); }
+ void SetShadow(const SvxShadowItem& rNew) { m_aShadow.reset(static_cast<SvxShadowItem*>(rNew.Clone())); }
+
void SetBoxFormat( const SwBoxAutoFormat& rNew, sal_uInt8 nPos );
const SwBoxAutoFormat& GetBoxFormat( sal_uInt8 nPos ) const;
SwBoxAutoFormat& GetBoxFormat( sal_uInt8 nPos );
diff --git a/sw/qa/core/filters-test.cxx b/sw/qa/core/filters-test.cxx
index bf265b15388f..67db9346e52e 100644
--- a/sw/qa/core/filters-test.cxx
+++ b/sw/qa/core/filters-test.cxx
@@ -99,7 +99,7 @@ bool SwFiltersTest::filter(const OUString &rFilter, const OUString &rURL,
if (rUserData == FILTER_TEXT_DLG)
{
pSrcMed->GetItemSet()->Put(
- SfxStringItem(SID_FILE_FILTEROPTIONS, OUString("UTF8,LF,Liberation Mono,en-US")));
+ SfxStringItem(SID_FILE_FILTEROPTIONS, "UTF8,LF,Liberation Mono,en-US"));
}
bool bLoaded = xDocShRef->DoLoad(pSrcMed);
diff --git a/sw/qa/core/uwriter.cxx b/sw/qa/core/uwriter.cxx
index 0540212e2140..20ac02c6a3b0 100644
--- a/sw/qa/core/uwriter.cxx
+++ b/sw/qa/core/uwriter.cxx
@@ -1279,49 +1279,47 @@ void SwDocTest::testTableAutoFormats()
SvxBrushItem aBackground( Color(0xFF11FF), RES_BACKGROUND );
aBoxAF.SetBackground( aBackground );
//Set m_aTLBR
- aBoxAF.m_aTLBR.ScaleMetrics( 11,12 );
- SvxLineItem aTLBRLine = aBoxAF.m_aTLBR;
+ SvxLineItem aTLBRLine(0); aTLBRLine.ScaleMetrics( 11,12 );
+ aBoxAF.SetTLBR(aTLBRLine);
//Set m_aBLTR
- aBoxAF.m_aBLTR.ScaleMetrics( 13,14 );
- SvxLineItem aBLTRLine = aBoxAF.m_aBLTR;
+ SvxLineItem aBLTRLine(0); aBLTRLine.ScaleMetrics( 13,14 );
+ aBoxAF.SetBLTR(aBLTRLine);
//Set m_aHorJustify
SvxHorJustifyItem aHJustify( SvxCellHorJustify::Center, 0 );
- aBoxAF.m_aHorJustify = aHJustify;
+ aBoxAF.SetHorJustify(aHJustify);
//Set m_aVerJustify
SvxVerJustifyItem aVJustify( SvxCellVerJustify::Center , 0 );
- aBoxAF.m_aVerJustify = aVJustify;
+ aBoxAF.SetVerJustify(aVJustify);
//Set m_aStacked
- aBoxAF.m_aStacked.SetValue( true );
- SfxBoolItem aStacked = aBoxAF.m_aStacked;
+ SfxBoolItem aStacked(0, true);
+ aBoxAF.SetStacked(aStacked);
//Set m_aMargin
- aBoxAF.m_aMargin.SetLeftMargin( sal_Int16(4) );
- aBoxAF.m_aMargin.SetRightMargin( sal_Int16(3) );
- aBoxAF.m_aMargin.SetTopMargin( sal_Int16(2) );
- aBoxAF.m_aMargin.SetBottomMargin( sal_Int16(3) );
- SvxMarginItem aMargin = aBoxAF.m_aMargin;
+ SvxMarginItem aSvxMarginItem(sal_Int16(4), sal_Int16(2), sal_Int16(3), sal_Int16(3), 0);
+ aBoxAF.SetMargin(aSvxMarginItem);
//Set m_aLinebreak
- aBoxAF.m_aLinebreak.SetValue( true );
- SfxBoolItem aLBreak = aBoxAF.m_aLinebreak;
+ SfxBoolItem aLBreak(0, true);
+ aBoxAF.SetLinebreak(aLBreak);
//Set m_aRotateAngle
- aBoxAF.m_aRotateAngle.SetValue( sal_Int32(5) );
- SfxInt32Item aRAngle = aBoxAF.m_aRotateAngle;
+ SfxInt32Item aRAngle(sal_Int32(5));
+ aBoxAF.SetRotateAngle(aRAngle);
//Set m_aRotateMode
- aBoxAF.m_aRotateMode.SetValue( SVX_ROTATE_MODE_CENTER );
+ SvxRotateModeItem aSvxRotateModeItem(SVX_ROTATE_MODE_CENTER, 0);
+ aBoxAF.SetRotateMode(aSvxRotateModeItem);
//Set m_sNumFormatString
OUString aNFString = "UnitTestFormat";
- aBoxAF.m_sNumFormatString = aNFString;
+ aBoxAF.SetNumFormatString(aNFString);
//Set m_eSysLanguage
LanguageType aSLang( LANGUAGE_ENGLISH_INDIA );
- aBoxAF.m_eSysLanguage = aSLang;
+ aBoxAF.SetSysLanguage(aSLang);
//Set m_eNumFormatLanguage
LanguageType aNFLang( LANGUAGE_GERMAN );
- aBoxAF.m_eNumFormatLanguage = aNFLang;
+ aBoxAF.SetNumFormatLanguage(aNFLang);
//Set m_aBreak
SvxFormatBreakItem aBreak( SvxBreak::PageBefore, 0 );
- aTableAF.m_aBreak = aBreak;
+ aTableAF.SetBreak(aBreak);
//Set m_aKeepWithNextPara
SvxFormatKeepItem aKWNPara( true, 0 );
- aTableAF.m_aKeepWithNextPara = aKWNPara;
+ aTableAF.SetKeepWithNextPara(aKWNPara);
//Set m_aPageDesc
SwFormatPageDesc aPDesc;
uno::Any aPDAny( sal_uInt16(3) );
@@ -1341,7 +1339,7 @@ void SwDocTest::testTableAutoFormats()
aTableAF.m_bCollapsingBorders = aCBorders;
//Set m_aShadow
SvxShadowItem aShadow( 0, nullptr, 103, SvxShadowLocation::BottomLeft );
- aTableAF.m_aShadow = aShadow;
+ aTableAF.SetShadow(aShadow);
//Set bInclFont
bool aIFont = false;
aTableAF.m_bInclFont = aIFont;
@@ -1434,21 +1432,21 @@ void SwDocTest::testTableAutoFormats()
//GetBackground
CPPUNIT_ASSERT( bool( pLoadAF->GetBoxFormat(0).GetBackground() == aBackground ) );
//Get m_aTLBR
- CPPUNIT_ASSERT( bool( pLoadAF->GetBoxFormat(0).m_aTLBR == aTLBRLine ) );
+ CPPUNIT_ASSERT( bool( pLoadAF->GetBoxFormat(0).GetTLBR() == aTLBRLine ) );
//Get m_aBLTR
- CPPUNIT_ASSERT( bool( pLoadAF->GetBoxFormat(0).m_aBLTR == aBLTRLine ) );
+ CPPUNIT_ASSERT( bool( pLoadAF->GetBoxFormat(0).GetBLTR() == aBLTRLine ) );
//Get m_aHorJustify
- CPPUNIT_ASSERT( bool( pLoadAF->GetBoxFormat(0).m_aHorJustify == aHJustify ) );
+ CPPUNIT_ASSERT( bool( pLoadAF->GetBoxFormat(0).GetHorJustify() == aHJustify ) );
//Get m_aVerJustify
- CPPUNIT_ASSERT( bool( pLoadAF->GetBoxFormat(0).m_aVerJustify == aVJustify ) );
+ CPPUNIT_ASSERT( bool( pLoadAF->GetBoxFormat(0).GetVerJustify() == aVJustify ) );
//Get m_aStacked
- CPPUNIT_ASSERT( bool( pLoadAF->GetBoxFormat(0).m_aStacked == aStacked ) );
+ CPPUNIT_ASSERT( bool( pLoadAF->GetBoxFormat(0).GetStacked() == aStacked ) );
//Get m_aMargin
- CPPUNIT_ASSERT( bool( pLoadAF->GetBoxFormat(0).m_aMargin == aMargin ) );
+ CPPUNIT_ASSERT( bool( pLoadAF->GetBoxFormat(0).GetMargin() == aSvxMarginItem ) );
//Get m_aLinebreak
- CPPUNIT_ASSERT( bool( pLoadAF->GetBoxFormat(0).m_aLinebreak == aLBreak ) );
+ CPPUNIT_ASSERT( bool( pLoadAF->GetBoxFormat(0).GetLinebreak() == aLBreak ) );
//Get m_aRotateAngle
- CPPUNIT_ASSERT( bool( pLoadAF->GetBoxFormat(0).m_aRotateAngle == aRAngle ) );
+ CPPUNIT_ASSERT( bool( pLoadAF->GetBoxFormat(0).GetRotateAngle() == aRAngle ) );
#if !((defined(__clang__) && __clang_major__ == 4 && __clang_minor__ == 0) \
|| (defined __APPLE__ && defined __clang__ \
&& defined __apple_build_version__ \
@@ -1456,19 +1454,19 @@ void SwDocTest::testTableAutoFormats()
&& __apple_build_version__ <= 9000099))
// Temporary fix for mysterious problem with Clang in F26 and Xcode 9
//Get m_aRotateMode
- SvxRotateModeItem aRMode = aBoxAF.m_aRotateMode;
- CPPUNIT_ASSERT( bool( pLoadAF->GetBoxFormat(0).m_aRotateMode == aRMode ) );
+ //SvxRotateModeItem aRMode = aBoxAF.m_aRotateMode;GetRotateMode
+ CPPUNIT_ASSERT( bool( pLoadAF->GetBoxFormat(0).GetRotateMode() == aSvxRotateModeItem ) );
#endif
//Get m_sNumFormatString
- CPPUNIT_ASSERT( bool( pLoadAF->GetBoxFormat(0).m_sNumFormatString == aNFString ) );
+ CPPUNIT_ASSERT( bool( pLoadAF->GetBoxFormat(0).GetNumFormatString() == aNFString ) );
//Get m_eSysLanguage
- CPPUNIT_ASSERT( bool( pLoadAF->GetBoxFormat(0).m_eSysLanguage == aSLang ) );
+ CPPUNIT_ASSERT( bool( pLoadAF->GetBoxFormat(0).GetSysLanguage() == aSLang ) );
//Get m_eNumFormatLanguage
- CPPUNIT_ASSERT( bool( pLoadAF->GetBoxFormat(0).m_eNumFormatLanguage == aNFLang ) );
+ CPPUNIT_ASSERT( bool( pLoadAF->GetBoxFormat(0).GetNumFormatLanguage() == aNFLang ) );
//Get m_aBreak
- CPPUNIT_ASSERT( bool( pLoadAF->m_aBreak == aBreak ) );
+ CPPUNIT_ASSERT( bool( pLoadAF->GetBreak() == aBreak ) );
//Get m_aKeepWithNextPara
- CPPUNIT_ASSERT( bool( pLoadAF->m_aKeepWithNextPara == aKWNPara ) );
+ CPPUNIT_ASSERT( bool( pLoadAF->GetKeepWithNextPara() == aKWNPara ) );
//Get m_aPageDesc
CPPUNIT_ASSERT( bool( pLoadAF->m_aPageDesc == aPDesc ) );
//Get m_aRepeatHeading
@@ -1480,7 +1478,7 @@ void SwDocTest::testTableAutoFormats()
//Get m_bCollapsingBorders
CPPUNIT_ASSERT( bool( pLoadAF->m_bCollapsingBorders == aCBorders ) );
//Get m_aShadow
- CPPUNIT_ASSERT( bool( pLoadAF->m_aShadow == aShadow ) );
+ CPPUNIT_ASSERT( bool( pLoadAF->GetShadow() == aShadow ) );
//Get bInclFont
CPPUNIT_ASSERT( bool( pLoadAF->m_bInclFont == aIFont ) );
//Get bInclJustify
diff --git a/sw/source/core/attr/format.cxx b/sw/source/core/attr/format.cxx
index af0ebc16bc1c..300118c72abb 100644
--- a/sw/source/core/attr/format.cxx
+++ b/sw/source/core/attr/format.cxx
@@ -382,14 +382,14 @@ const SfxPoolItem& SwFormat::GetFormatAttr( sal_uInt16 nWhich, bool bInParents )
{
// FALLBACKBREAKHERE should not be used; instead use [XATTR_FILL_FIRST .. XATTR_FILL_LAST]
SAL_INFO("sw.core", "Do no longer use SvxBrushItem, instead use [XATTR_FILL_FIRST .. XATTR_FILL_LAST] FillAttributes or makeBackgroundBrushItem (simple fallback is in place and used)");
- static SvxBrushItem aSvxBrushItem(RES_BACKGROUND);
+ static std::shared_ptr<SvxBrushItem> aSvxBrushItem; //(std::make_shared<SvxBrushItem>(RES_BACKGROUND));
// fill the local static SvxBrushItem from the current ItemSet so that
// the fill attributes [XATTR_FILL_FIRST .. XATTR_FILL_LAST] are used
// as good as possible to create a fallback representation and return that
aSvxBrushItem = getSvxBrushItemFromSourceSet(m_aSet, RES_BACKGROUND, bInParents);
- return aSvxBrushItem;
+ return *aSvxBrushItem;
}
return m_aSet.Get( nWhich, bInParents );
@@ -409,12 +409,11 @@ SfxItemState SwFormat::GetItemState( sal_uInt16 nWhich, bool bSrchInParent, cons
// if yes, fill the local SvxBrushItem using the new fill attributes
// as good as possible to have an instance for the pointer to point
// to and return as state that it is set
-
- static SvxBrushItem aSvxBrushItem(RES_BACKGROUND);
+ static std::shared_ptr<SvxBrushItem> aSvxBrushItem; //(RES_BACKGROUND);
aSvxBrushItem = getSvxBrushItemFromSourceSet(m_aSet, RES_BACKGROUND, bSrchInParent);
if( ppItem )
- *ppItem = &aSvxBrushItem;
+ *ppItem = aSvxBrushItem.get();
return SfxItemState::SET;
}
@@ -430,7 +429,7 @@ SfxItemState SwFormat::GetItemState( sal_uInt16 nWhich, bool bSrchInParent, cons
return m_aSet.GetItemState( nWhich, bSrchInParent, ppItem );
}
-SfxItemState SwFormat::GetBackgroundState(SvxBrushItem &rItem) const
+SfxItemState SwFormat::GetBackgroundState(std::shared_ptr<SvxBrushItem>& rItem) const
{
if (supportsFullDrawingLayerFillAttributeSet())
{
@@ -454,7 +453,7 @@ SfxItemState SwFormat::GetBackgroundState(SvxBrushItem &rItem) const
const SfxPoolItem* pItem = nullptr;
SfxItemState eRet = m_aSet.GetItemState(RES_BACKGROUND, true, &pItem);
if (pItem)
- rItem = *static_cast<const SvxBrushItem*>(pItem);
+ rItem.reset(static_cast<SvxBrushItem*>(pItem->Clone()));
return eRet;
}
@@ -782,7 +781,7 @@ void SwFormat::SetGrabBagItem(const uno::Any& rVal)
m_pGrabBagItem->PutValue(rVal, 0);
}
-SvxBrushItem SwFormat::makeBackgroundBrushItem(bool bInP) const
+std::shared_ptr<SvxBrushItem> SwFormat::makeBackgroundBrushItem(bool bInP) const
{
if (supportsFullDrawingLayerFillAttributeSet())
{
@@ -795,7 +794,7 @@ SvxBrushItem SwFormat::makeBackgroundBrushItem(bool bInP) const
return getSvxBrushItemFromSourceSet(m_aSet, RES_BACKGROUND, bInP);
}
- return m_aSet.GetBackground(bInP);
+ return std::shared_ptr<SvxBrushItem>(static_cast<SvxBrushItem*>(m_aSet.GetBackground(bInP).Clone()));
}
drawinglayer::attribute::SdrAllFillAttributesHelperPtr SwFormat::getSdrAllFillAttributesHelper() const
diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index c6ff7c163462..1fe99be1dd2a 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -4306,9 +4306,9 @@ SwFlyFrameFormat* DocumentContentOperationsManager::InsNoTextNode( const SwPosit
#define NUMRULE_STATE \
SfxItemState aNumRuleState = SfxItemState::UNKNOWN; \
- SwNumRuleItem aNumRuleItem; \
+ std::shared_ptr<SwNumRuleItem> aNumRuleItem; \
SfxItemState aListIdState = SfxItemState::UNKNOWN; \
- SfxStringItem aListIdItem( RES_PARATR_LIST_ID, OUString() ); \
+ std::shared_ptr<SfxStringItem> aListIdItem; \
#define PUSH_NUMRULE_STATE \
lcl_PushNumruleState( aNumRuleState, aNumRuleItem, aListIdState, aListIdItem, pDestTextNd );
@@ -4316,9 +4316,10 @@ SwFlyFrameFormat* DocumentContentOperationsManager::InsNoTextNode( const SwPosit
#define POP_NUMRULE_STATE \
lcl_PopNumruleState( aNumRuleState, aNumRuleItem, aListIdState, aListIdItem, pDestTextNd, rPam );
-static void lcl_PushNumruleState( SfxItemState &aNumRuleState, SwNumRuleItem &aNumRuleItem,
- SfxItemState &aListIdState, SfxStringItem &aListIdItem,
- const SwTextNode *pDestTextNd )
+static void lcl_PushNumruleState(
+ SfxItemState &aNumRuleState, std::shared_ptr<SwNumRuleItem>& aNumRuleItem,
+ SfxItemState &aListIdState, std::shared_ptr<SfxStringItem>& aListIdItem,
+ const SwTextNode *pDestTextNd )
{
// Safe numrule item at destination.
// #i86492# - Safe also <ListId> item of destination.
@@ -4328,20 +4329,22 @@ static void lcl_PushNumruleState( SfxItemState &aNumRuleState, SwNumRuleItem &aN
const SfxPoolItem * pItem = nullptr;
aNumRuleState = pAttrSet->GetItemState(RES_PARATR_NUMRULE, false, &pItem);
if (SfxItemState::SET == aNumRuleState)
- aNumRuleItem = *static_cast<const SwNumRuleItem *>( pItem);
+ {
+ aNumRuleItem.reset(static_cast<SwNumRuleItem*>(pItem->Clone()));
+ }
- aListIdState =
- pAttrSet->GetItemState(RES_PARATR_LIST_ID, false, &pItem);
+ aListIdState = pAttrSet->GetItemState(RES_PARATR_LIST_ID, false, &pItem);
if (SfxItemState::SET == aListIdState)
{
- aListIdItem.SetValue( static_cast<const SfxStringItem*>(pItem)->GetValue() );
+ aListIdItem.reset(static_cast<SfxStringItem*>(pItem->Clone()));
}
}
}
-static void lcl_PopNumruleState( SfxItemState aNumRuleState, const SwNumRuleItem &aNumRuleItem,
- SfxItemState aListIdState, const SfxStringItem &aListIdItem,
- SwTextNode *pDestTextNd, const SwPaM& rPam )
+static void lcl_PopNumruleState(
+ SfxItemState aNumRuleState, const std::shared_ptr<SwNumRuleItem>& aNumRuleItem,
+ SfxItemState aListIdState, const std::shared_ptr<SfxStringItem>& aListIdItem,
+ SwTextNode *pDestTextNd, const SwPaM& rPam )
{
/* If only a part of one paragraph is copied
restore the numrule at the destination. */
@@ -4350,7 +4353,7 @@ static void lcl_PopNumruleState( SfxItemState aNumRuleState, const SwNumRuleItem
{
if (SfxItemState::SET == aNumRuleState)
{
- pDestTextNd->SetAttr(aNumRuleItem);
+ pDestTextNd->SetAttr(*aNumRuleItem);
}
else
{
@@ -4358,7 +4361,7 @@ static void lcl_PopNumruleState( SfxItemState aNumRuleState, const SwNumRuleItem
}
if (SfxItemState::SET == aListIdState)
{
- pDestTextNd->SetAttr(aListIdItem);
+ pDestTextNd->SetAttr(*aListIdItem);
}
else
{
diff --git a/sw/source/core/doc/DocumentStylePoolManager.cxx b/sw/source/core/doc/DocumentStylePoolManager.cxx
index 097f8479239e..a7a0a68850f5 100644
--- a/sw/source/core/doc/DocumentStylePoolManager.cxx
+++ b/sw/source/core/doc/DocumentStylePoolManager.cxx
@@ -1317,10 +1317,9 @@ SwTextFormatColl* DocumentStylePoolManager::GetTextCollFromPool( sal_uInt16 nId,
aLR.SetLeft( GetMetricVal( CM_1 ));
aLR.SetRight( GetMetricVal( CM_1 ));
aSet.Put( aLR );
- SvxULSpaceItem aUL( RES_UL_SPACE );
- aUL = pNewColl->GetULSpace();
- aUL.SetLower( HTML_PARSPACE );
- aSet.Put( aUL);
+ std::shared_ptr<SvxULSpaceItem> aUL(static_cast<SvxULSpaceItem*>(pNewColl->GetULSpace().Clone()));
+ aUL->SetLower( HTML_PARSPACE );
+ aSet.Put(*aUL);
}
break;
@@ -1333,10 +1332,9 @@ SwTextFormatColl* DocumentStylePoolManager::GetTextCollFromPool( sal_uInt16 nId,
// The lower paragraph distance is set explicitly (makes
// assigning hard attributes easier)
- SvxULSpaceItem aULSpaceItem( RES_UL_SPACE );
- aULSpaceItem = pNewColl->GetULSpace();
- aULSpaceItem.SetLower( 0 );
- aSet.Put( aULSpaceItem );
+ std::shared_ptr<SvxULSpaceItem> aULSpaceItem(static_cast<SvxULSpaceItem*>(pNewColl->GetULSpace().Clone()));
+ aULSpaceItem->SetLower( 0 );
+ aSet.Put(*aULSpaceItem);
}
break;
@@ -1351,13 +1349,13 @@ SwTextFormatColl* DocumentStylePoolManager::GetTextCollFromPool( sal_uInt16 nId,
aSet.Put( SwParaConnectBorderItem( false ) );
SetAllScriptItem( aSet, SvxFontHeightItem(120, 100, RES_CHRATR_FONTSIZE) );
- SvxULSpaceItem aUL( RES_UL_SPACE );
+ std::shared_ptr<SvxULSpaceItem> aUL;
{
pNewColl->SetNextTextFormatColl( *GetTextCollFromPool( RES_POOLCOLL_TEXT ));
- aUL = pNewColl->GetULSpace();
+ aUL.reset(static_cast<SvxULSpaceItem*>(pNewColl->GetULSpace().Clone()));
}
- aUL.SetLower( HTML_PARSPACE );
- aSet.Put( aUL);
+ aUL->SetLower( HTML_PARSPACE );
+ aSet.Put(*aUL);
SwFormatLineNumber aLN;
aLN.SetCountLines( false );
aSet.Put( aLN );
@@ -1366,23 +1364,22 @@ SwTextFormatColl* DocumentStylePoolManager::GetTextCollFromPool( sal_uInt16 nId,
case RES_POOLCOLL_HTML_DD:
{
- SvxLRSpaceItem aLR( RES_LR_SPACE );
- aLR = pNewColl->GetLRSpace();
+ std::shared_ptr<SvxLRSpaceItem> aLR(static_cast<SvxLRSpaceItem*>(pNewColl->GetLRSpace().Clone()));
// We indent by 1 cm. The IDs are always 2 away from each other!
- aLR.SetLeft( GetMetricVal( CM_1 ));
- aSet.Put( aLR );
+ aLR->SetLeft( GetMetricVal( CM_1 ));
+ aSet.Put(*aLR);
}
break;
case RES_POOLCOLL_HTML_DT:
{
- SvxLRSpaceItem aLR( RES_LR_SPACE );
+ std::shared_ptr<SvxLRSpaceItem> aLR;
{
pNewColl->SetNextTextFormatColl( *GetTextCollFromPool( RES_POOLCOLL_HTML_DD ));
- aLR = pNewColl->GetLRSpace();
+ aLR.reset(static_cast<SvxLRSpaceItem*>(pNewColl->GetLRSpace().Clone()));
}
// We indent by 0 cm. The IDs are always 2 away from each other!
- aLR.SetLeft( 0 );
- aSet.Put( aLR );
+ aLR->SetLeft( 0 );
+ aSet.Put( *aLR );
}
break;
}
diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx
index 286064fddab8..ec866b0c4e83 100644
--- a/sw/source/core/doc/doclay.cxx
+++ b/sw/source/core/doc/doclay.cxx
@@ -785,9 +785,9 @@ lcl_InsertLabel(SwDoc & rDoc, SwTextFormatColls *const pTextFormatCollTable,
pNewSet->Put( pOldFormat->GetAnchor() );
// The new one should be changeable in its height.
- SwFormatFrameSize aFrameSize( pOldFormat->GetFrameSize() );
- aFrameSize.SetHeightSizeType( ATT_MIN_SIZE );
- pNewSet->Put( aFrameSize );
+ std::shared_ptr<SwFormatFrameSize> aFrameSize(static_cast<SwFormatFrameSize*>(pOldFormat->GetFrameSize().Clone()));
+ aFrameSize->SetHeightSizeType( ATT_MIN_SIZE );
+ pNewSet->Put( *aFrameSize );
SwStartNode* pSttNd = rDoc.GetNodes().MakeTextSection(
SwNodeIndex( rDoc.GetNodes().GetEndOfAutotext() ),
@@ -834,7 +834,7 @@ lcl_InsertLabel(SwDoc & rDoc, SwTextFormatColls *const pTextFormatCollTable,
pNewSet->Put( SwFormatVertOrient( 0, eVert ) );
pNewSet->Put( SwFormatHoriOrient( 0, text::HoriOrientation::CENTER ) );
- aFrameSize = pOldFormat->GetFrameSize();
+ aFrameSize.reset(static_cast<SwFormatFrameSize*>(pOldFormat->GetFrameSize().Clone()));
SwOLENode* pOleNode = rDoc.GetNodes()[nNdIdx + 1]->GetOLENode();
bool isMath = false;
@@ -847,9 +847,9 @@ lcl_InsertLabel(SwDoc & rDoc, SwTextFormatColls *const pTextFormatCollTable,
isMath = ( SotExchange::IsMath( aCLSID ) != 0 );
}
}
- aFrameSize.SetWidthPercent(isMath ? 0 : 100);
- aFrameSize.SetHeightPercent(SwFormatFrameSize::SYNCED);
- pNewSet->Put( aFrameSize );
+ aFrameSize->SetWidthPercent(isMath ? 0 : 100);
+ aFrameSize->SetHeightPercent(SwFormatFrameSize::SYNCED);
+ pNewSet->Put( *aFrameSize );
// Hard-set the attributes, because they could come from the Template
// and then size calculations could not be correct anymore.
diff --git a/sw/source/core/doc/tblafmt.cxx b/sw/source/core/doc/tblafmt.cxx
index fbf6270bdd8c..102ac460111d 100644
--- a/sw/source/core/doc/tblafmt.cxx
+++ b/sw/source/core/doc/tblafmt.cxx
@@ -44,6 +44,11 @@
#include <sal/log.hxx>
#include <osl/diagnose.h>
+#include <svl/legacyitem.hxx>
+#include <editeng/legacyitem.hxx>
+#include <svx/legacyitem.hxx>
+#include <legacyitem.hxx>
+
#include <memory>
#include <vector>
@@ -66,20 +71,9 @@ const sal_uInt16 AUTOFORMAT_DATA_ID_504 = 9802;
const sal_uInt16 AUTOFORMAT_DATA_ID_552 = 9902;
-// --- from 641 on: CJK and CTL font settings
-const sal_uInt16 AUTOFORMAT_DATA_ID_641 = 10002;
-
-// --- from 680/dr14 on: diagonal frame lines
-const sal_uInt16 AUTOFORMAT_ID_680DR14 = 10011;
-const sal_uInt16 AUTOFORMAT_DATA_ID_680DR14 = 10012;
-
// --- from 680/dr25 on: store strings as UTF-8
const sal_uInt16 AUTOFORMAT_ID_680DR25 = 10021;
-// --- from DEV300/overline2 on: overline
-const sal_uInt16 AUTOFORMAT_ID_300OVRLN = 10031;
-const sal_uInt16 AUTOFORMAT_DATA_ID_300OVRLN = 10032;
-
// --- Bug fix to fdo#31005: Table Autoformats does not save/apply all properties (Writer and Calc)
const sal_uInt16 AUTOFORMAT_ID_31005 = 10041;
const sal_uInt16 AUTOFORMAT_DATA_ID_31005 = 10042;
@@ -164,187 +158,109 @@ namespace
// Struct with version numbers of the Items
-struct SwAfVersions
+struct SwAfVersions : public AutoFormatVersions
{
public:
- sal_uInt16 nFontVersion;
- sal_uInt16 nFontHeightVersion;
- sal_uInt16 nWeightVersion;
- sal_uInt16 nPostureVersion;
- sal_uInt16 nUnderlineVersion;
- sal_uInt16 nOverlineVersion;
- sal_uInt16 nCrossedOutVersion;
- sal_uInt16 nContourVersion;
- sal_uInt16 nShadowedVersion;
- sal_uInt16 nColorVersion;
- sal_uInt16 nBoxVersion;
- sal_uInt16 nLineVersion;
- sal_uInt16 nBrushVersion;
-
- sal_uInt16 nAdjustVersion;
sal_uInt16 m_nTextOrientationVersion;
sal_uInt16 m_nVerticalAlignmentVersion;
- sal_uInt16 nHorJustifyVersion;
- sal_uInt16 nVerJustifyVersion;
- sal_uInt16 nOrientationVersion;
- sal_uInt16 nMarginVersion;
- sal_uInt16 nBoolVersion;
- sal_uInt16 nInt32Version;
- sal_uInt16 nRotateModeVersion;
-
- sal_uInt16 nNumFormatVersion;
-
SwAfVersions();
void Load( SvStream& rStream, sal_uInt16 nVer );
+ static void Write(SvStream& rStream, sal_uInt16 fileVersion);
};
-SwAfVersions::SwAfVersions() :
- nFontVersion(0),
- nFontHeightVersion(0),
- nWeightVersion(0),
- nPostureVersion(0),
- nUnderlineVersion(0),
- nOverlineVersion(0),
- nCrossedOutVersion(0),
- nContourVersion(0),
- nShadowedVersion(0),
- nColorVersion(0),
- nBoxVersion(0),
- nLineVersion(0),
- nBrushVersion(0),
- nAdjustVersion(0),
+SwAfVersions::SwAfVersions()
+: AutoFormatVersions(),
m_nTextOrientationVersion(0),
- m_nVerticalAlignmentVersion(0),
- nHorJustifyVersion(0),
- nVerJustifyVersion(0),
- nOrientationVersion(0),
- nMarginVersion(0),
- nBoolVersion(0),
- nInt32Version(0),
- nRotateModeVersion(0),
- nNumFormatVersion(0)
+ m_nVerticalAlignmentVersion(0)
{
}
void SwAfVersions::Load( SvStream& rStream, sal_uInt16 nVer )
{
- rStream.ReadUInt16( nFontVersion );
- rStream.ReadUInt16( nFontHeightVersion );
- rStream.ReadUInt16( nWeightVersion );
- rStream.ReadUInt16( nPostureVersion );
- rStream.ReadUInt16( nUnderlineVersion );
- if ( nVer >= AUTOFORMAT_ID_300OVRLN )
- rStream.ReadUInt16( nOverlineVersion );
- rStream.ReadUInt16( nCrossedOutVersion );
- rStream.ReadUInt16( nContourVersion );
- rStream.ReadUInt16( nShadowedVersion );
- rStream.ReadUInt16( nColorVersion );
- rStream.ReadUInt16( nBoxVersion );
- if ( nVer >= AUTOFORMAT_ID_680DR14 )
- rStream.ReadUInt16( nLineVersion );
- rStream.ReadUInt16( nBrushVersion );
- rStream.ReadUInt16( nAdjustVersion );
+ LoadBlockA(rStream, nVer);
if (nVer >= AUTOFORMAT_ID_31005 && WriterSpecificBlockExists(rStream))
{
rStream.ReadUInt16( m_nTextOrientationVersion );
rStream.ReadUInt16( m_nVerticalAlignmentVersion );
}
+ LoadBlockB(rStream, nVer);
+}
- rStream.ReadUInt16( nHorJustifyVersion );
- rStream.ReadUInt16( nVerJustifyVersion );
- rStream.ReadUInt16( nOrientationVersion );
- rStream.ReadUInt16( nMarginVersion );
- rStream.ReadUInt16( nBoolVersion );
- if ( nVer >= AUTOFORMAT_ID_504 )
+void SwAfVersions::Write(SvStream& rStream, sal_uInt16 fileVersion)
+{
+ AutoFormatVersions::WriteBlockA(rStream, fileVersion);
+
+ if (fileVersion >= SOFFICE_FILEFORMAT_50)
{
- rStream.ReadUInt16( nInt32Version );
- rStream.ReadUInt16( nRotateModeVersion );
+ WriterSpecificAutoFormatBlock block(rStream);
+
+ rStream.WriteUInt16(legacy::SvxFrameDirection::GetVersion(fileVersion));
+ rStream.WriteUInt16(legacy::SwFormatVert::GetVersion(fileVersion));
}
- rStream.ReadUInt16( nNumFormatVersion );
+
+ AutoFormatVersions::WriteBlockB(rStream, fileVersion);
}
+
+
SwBoxAutoFormat::SwBoxAutoFormat()
- : m_aFont( *GetDfltAttr( RES_CHRATR_FONT ) ),
- m_aHeight( 240, 100, RES_CHRATR_FONTSIZE ),
- m_aWeight( WEIGHT_NORMAL, RES_CHRATR_WEIGHT ),
- m_aPosture( ITALIC_NONE, RES_CHRATR_POSTURE ),
-
- m_aCJKFont( *GetDfltAttr( RES_CHRATR_CJK_FONT ) ),
- m_aCJKHeight( 240, 100, RES_CHRATR_CJK_FONTSIZE ),
- m_aCJKWeight( WEIGHT_NORMAL, RES_CHRATR_CJK_WEIGHT ),
- m_aCJKPosture( ITALIC_NONE, RES_CHRATR_CJK_POSTURE ),
-
- m_aCTLFont( *GetDfltAttr( RES_CHRATR_CTL_FONT ) ),
- m_aCTLHeight( 240, 100, RES_CHRATR_CTL_FONTSIZE ),
- m_aCTLWeight( WEIGHT_NORMAL, RES_CHRATR_CTL_WEIGHT ),
- m_aCTLPosture( ITALIC_NONE, RES_CHRATR_CTL_POSTURE ),
-
- m_aUnderline( LINESTYLE_NONE, RES_CHRATR_UNDERLINE ),
- m_aOverline( LINESTYLE_NONE, RES_CHRATR_OVERLINE ),
- m_aCrossedOut( STRIKEOUT_NONE, RES_CHRATR_CROSSEDOUT ),
- m_aContour( false, RES_CHRATR_CONTOUR ),
- m_aShadowed( false, RES_CHRATR_SHADOWED ),
- m_aColor( RES_CHRATR_COLOR ),
- m_aBox( RES_BOX ),
- m_aTLBR( 0 ),
- m_aBLTR( 0 ),
- m_aBackground( RES_BACKGROUND ),
- m_aAdjust( SvxAdjust::Left, RES_PARATR_ADJUST ),
- m_aTextOrientation(SvxFrameDirection::Environment, RES_FRAMEDIR),
- m_aVerticalAlignment(0, css::text::VertOrientation::NONE, css::text::RelOrientation::FRAME),
- m_aHorJustify( SvxCellHorJustify::Standard, 0),
- m_aVerJustify( SvxCellVerJustify::Standard, 0),
- m_aStacked( 0 ),
- m_aMargin( 0 ),
- m_aLinebreak( 0 ),
- m_aRotateAngle( 0 ),
+: 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_sNumFormatString(),
+ m_eSysLanguage(::GetAppLanguage()),
+ m_eNumFormatLanguage(::GetAppLanguage()),
+ m_wXObject()
+{
+ // need to set default instances for base class AutoFormatBase here
+ // due to ressource 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 );
// FIXME - add attribute IDs for the diagonal line items
// aTLBR( RES_... ),
// aBLTR( RES_... ),
- m_aRotateMode( SVX_ROTATE_MODE_STANDARD, 0 )
-{
- m_eSysLanguage = m_eNumFormatLanguage = ::GetAppLanguage();
- m_aBox.SetAllDistances(55);
+ m_aBox->SetAllDistances(55);
}
SwBoxAutoFormat::SwBoxAutoFormat( const SwBoxAutoFormat& rNew )
- : 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 ),
- m_aBox( rNew.m_aBox ),
- m_aTLBR( rNew.m_aTLBR ),
- m_aBLTR( rNew.m_aBLTR ),
- m_aBackground( rNew.m_aBackground ),
- m_aAdjust( rNew.m_aAdjust ),
- m_aTextOrientation(rNew.m_aTextOrientation),
- m_aVerticalAlignment(rNew.m_aVerticalAlignment),
- m_aHorJustify( rNew.m_aHorJustify ),
- m_aVerJustify( rNew.m_aVerJustify ),
- m_aStacked( rNew.m_aStacked ),
- m_aMargin( rNew.m_aMargin ),
- m_aLinebreak( rNew.m_aLinebreak ),
- m_aRotateAngle( rNew.m_aRotateAngle ),
- m_aRotateMode( rNew.m_aRotateMode ),
+: AutoFormatBase(rNew),
+ m_aTextOrientation(static_cast<SvxFrameDirectionItem*>(rNew.m_aTextOrientation->Clone())),
+ m_aVerticalAlignment(static_cast<SwFormatVertOrient*>(rNew.m_aVerticalAlignment->Clone())),
m_sNumFormatString( rNew.m_sNumFormatString ),
m_eSysLanguage( rNew.m_eSysLanguage ),
- m_eNumFormatLanguage( rNew.m_eNumFormatLanguage )
+ m_eNumFormatLanguage( rNew.m_eNumFormatLanguage ),
+ m_wXObject()
{
}
@@ -352,139 +268,27 @@ SwBoxAutoFormat::~SwBoxAutoFormat()
{
}
-SwBoxAutoFormat& SwBoxAutoFormat::operator=( const SwBoxAutoFormat& rNew )
-{
- 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;
-
- return *this;
-}
-
bool SwBoxAutoFormat::operator==(const SwBoxAutoFormat& rRight)
{
return GetBackground().GetColor() == rRight.GetBackground().GetColor();
}
-#define READ( aItem, aItemType, nVers )\
- pNew = aItem.Create(rStream, nVers ); \
- aItem = *static_cast<aItemType*>(pNew); \
- delete pNew;
-
bool SwBoxAutoFormat::Load( SvStream& rStream, const SwAfVersions& rVersions, sal_uInt16 nVer )
{
- SfxPoolItem* pNew;
- SvxOrientationItem aOrientation( SvxCellOrientation::Standard, 0);
-
- READ( m_aFont, SvxFontItem , rVersions.nFontVersion)
-
- if( rStream.GetStreamCharSet() == m_aFont.GetCharSet() )
- m_aFont.SetCharSet(::osl_getThreadTextEncoding());
-
- READ( m_aHeight, SvxFontHeightItem , rVersions.nFontHeightVersion)
- READ( m_aWeight, SvxWeightItem , rVersions.nWeightVersion)
- READ( m_aPosture, SvxPostureItem , rVersions.nPostureVersion)
- // --- from 641 on: CJK and CTL font settings
- if( AUTOFORMAT_DATA_ID_641 <= nVer )
- {
- READ( m_aCJKFont, SvxFontItem , rVersions.nFontVersion)
- READ( m_aCJKHeight, SvxFontHeightItem , rVersions.nFontHeightVersion)
- READ( m_aCJKWeight, SvxWeightItem , rVersions.nWeightVersion)
- READ( m_aCJKPosture, SvxPostureItem , rVersions.nPostureVersion)
- READ( m_aCTLFont, SvxFontItem , rVersions.nFontVersion)
- READ( m_aCTLHeight, SvxFontHeightItem , rVersions.nFontHeightVersion)
- READ( m_aCTLWeight, SvxWeightItem , rVersions.nWeightVersion)
- READ( m_aCTLPosture, SvxPostureItem , rVersions.nPostureVersion)
- }
- READ( m_aUnderline, SvxUnderlineItem , rVersions.nUnderlineVersion)
- if( nVer >= AUTOFORMAT_DATA_ID_300OVRLN )
- {
- READ( m_aOverline, SvxOverlineItem , rVersions.nOverlineVersion)
- }
- READ( m_aCrossedOut, SvxCrossedOutItem , rVersions.nCrossedOutVersion)
- READ( m_aContour, SvxContourItem , rVersions.nContourVersion)
- READ( m_aShadowed, SvxShadowedItem , rVersions.nShadowedVersion)
- READ( m_aColor, SvxColorItem , rVersions.nColorVersion)
-
- READ( m_aBox, SvxBoxItem , rVersions.nBoxVersion)
-
- // --- from 680/dr14 on: diagonal frame lines
- if( nVer >= AUTOFORMAT_DATA_ID_680DR14 )
- {
- READ( m_aTLBR, SvxLineItem, rVersions.nLineVersion)
- READ( m_aBLTR, SvxLineItem, rVersions.nLineVersion)
- }
-
- READ( m_aBackground, SvxBrushItem , rVersions.nBrushVersion)
-
- pNew = m_aAdjust.Create(rStream, rVersions.nAdjustVersion );
- SetAdjust( *static_cast<SvxAdjustItem*>(pNew) );
- delete pNew;
+ LoadBlockA( rStream, rVersions, nVer );
if (nVer >= AUTOFORMAT_DATA_ID_31005)
{
sal_Int64 const nSize(WriterSpecificBlockExists(rStream));
if (0 < nSize && nSize < std::numeric_limits<sal_uInt16>::max())
{
- READ(m_aTextOrientation, SvxFrameDirectionItem, rVersions.m_nTextOrientationVersion);
+ legacy::SvxFrameDirection::Create(*m_aTextOrientation, rStream, rVersions.m_nTextOrientationVersion);
// HORRIBLE HACK to read both 32-bit and 64-bit "long": abuse nSize
- READ(m_aVerticalAlignment, SwFormatVertOrient, /*rVersions.m_nVerticalAlignmentVersion*/ nSize);
+ legacy::SwFormatVert::Create(*m_aVerticalAlignment, rStream, /*rVersions.m_nVerticalAlignmentVersion*/ nSize);
}
}
- READ( m_aHorJustify, SvxHorJustifyItem , rVersions.nHorJustifyVersion)
- READ( m_aVerJustify, SvxVerJustifyItem , rVersions.nVerJustifyVersion)
-
- READ( aOrientation, SvxOrientationItem , rVersions.nOrientationVersion)
- READ( m_aMargin, SvxMarginItem , rVersions.nMarginVersion)
-
- pNew = m_aLinebreak.Create(rStream, rVersions.nBoolVersion );
- m_aLinebreak.SetValue( static_cast<SfxBoolItem*>(pNew)->GetValue() );
- delete pNew;
-
- if ( nVer >= AUTOFORMAT_DATA_ID_504 )
- {
- pNew = m_aRotateAngle.Create( rStream, rVersions.nInt32Version );
- m_aRotateAngle.SetValue( static_cast<SfxInt32Item*>(pNew)->GetValue() );
- delete pNew;
- pNew = m_aRotateMode.Create( rStream, rVersions.nRotateModeVersion );
- m_aRotateMode.SetValue( static_cast<SvxRotateModeItem*>(pNew)->GetValue() );
- delete pNew;
- }
+ LoadBlockB( rStream, rVersions, nVer );
if( 0 == rVersions.nNumFormatVersion )
{
@@ -499,56 +303,22 @@ bool SwBoxAutoFormat::Load( SvStream& rStream, const SwAfVersions& rVersions, sa
m_eSysLanguage = ::GetAppLanguage();
}
- m_aStacked.SetValue( aOrientation.IsStacked() );
- m_aRotateAngle.SetValue( aOrientation.GetRotation( m_aRotateAngle.GetValue() ) );
-
return ERRCODE_NONE == rStream.GetError();
}
bool SwBoxAutoFormat::Save( SvStream& rStream, sal_uInt16 fileVersion ) const
{
- SvxOrientationItem aOrientation( m_aRotateAngle.GetValue(), m_aStacked.GetValue(), 0 );
-
- m_aFont.Store( rStream, m_aFont.GetVersion(fileVersion) );
- m_aHeight.Store( rStream, m_aHeight.GetVersion(fileVersion) );
- m_aWeight.Store( rStream, m_aWeight.GetVersion(fileVersion) );
- m_aPosture.Store( rStream, m_aPosture.GetVersion(fileVersion) );
- m_aCJKFont.Store( rStream, m_aCJKFont.GetVersion(fileVersion) );
- m_aCJKHeight.Store( rStream, m_aCJKHeight.GetVersion(fileVersion) );
- m_aCJKWeight.Store( rStream, m_aCJKWeight.GetVersion(fileVersion) );
- m_aCJKPosture.Store( rStream, m_aCJKPosture.GetVersion(fileVersion) );
- m_aCTLFont.Store( rStream, m_aCTLFont.GetVersion(fileVersion) );
- m_aCTLHeight.Store( rStream, m_aCTLHeight.GetVersion(fileVersion) );
- m_aCTLWeight.Store( rStream, m_aCTLWeight.GetVersion(fileVersion) );
- m_aCTLPosture.Store( rStream, m_aCTLPosture.GetVersion(fileVersion) );
- m_aUnderline.Store( rStream, m_aUnderline.GetVersion(fileVersion) );
- m_aOverline.Store( rStream, m_aOverline.GetVersion(fileVersion) );
- m_aCrossedOut.Store( rStream, m_aCrossedOut.GetVersion(fileVersion) );
- m_aContour.Store( rStream, m_aContour.GetVersion(fileVersion) );
- m_aShadowed.Store( rStream, m_aShadowed.GetVersion(fileVersion) );
- m_aColor.Store( rStream, m_aColor.GetVersion(fileVersion) );
- m_aBox.Store( rStream, m_aBox.GetVersion(fileVersion) );
- m_aTLBR.Store( rStream, m_aTLBR.GetVersion(fileVersion) );
- m_aBLTR.Store( rStream, m_aBLTR.GetVersion(fileVersion) );
- m_aBackground.Store( rStream, m_aBackground.GetVersion(fileVersion) );
-
- m_aAdjust.Store( rStream, m_aAdjust.GetVersion(fileVersion) );
+ SaveBlockA( rStream, fileVersion );
+
if (fileVersion >= SOFFICE_FILEFORMAT_50)
{
WriterSpecificAutoFormatBlock block(rStream);
- m_aTextOrientation.Store(rStream, m_aTextOrientation.GetVersion(fileVersion));
- m_aVerticalAlignment.Store(rStream, m_aVerticalAlignment.GetVersion(fileVersion));
+ legacy::SvxFrameDirection::Store(*m_aTextOrientation, rStream, legacy::SvxFrameDirection::GetVersion(fileVersion));
+ legacy::SwFormatVert::Store(*m_aVerticalAlignment, rStream, legacy::SwFormatVert::GetVersion(fileVersion));
}
- m_aHorJustify.Store( rStream, m_aHorJustify.GetVersion(fileVersion) );
- m_aVerJustify.Store( rStream, m_aVerJustify.GetVersion(fileVersion) );
- aOrientation.Store( rStream, aOrientation.GetVersion(fileVersion) );
- m_aMargin.Store( rStream, m_aMargin.GetVersion(fileVersion) );
- m_aLinebreak.Store( rStream, m_aLinebreak.GetVersion(fileVersion) );
- // Calc Rotation from SO5
- m_aRotateAngle.Store( rStream, m_aRotateAngle.GetVersion(fileVersion) );
- m_aRotateMode.Store( rStream, m_aRotateMode.GetVersion(fileVersion) );
+ SaveBlockB( rStream, fileVersion );
// --- from 680/dr25 on: store strings as UTF-8
write_uInt16_lenPrefixed_uInt8s_FromOUString(rStream, m_sNumFormatString,
@@ -558,53 +328,16 @@ bool SwBoxAutoFormat::Save( SvStream& rStream, sal_uInt16 fileVersion ) const
return ERRCODE_NONE == rStream.GetError();
}
-void SwBoxAutoFormat::SaveVersionNo( SvStream& rStream, sal_uInt16 fileVersion ) const
-{
- rStream.WriteUInt16( m_aFont.GetVersion( fileVersion ) );
- rStream.WriteUInt16( m_aHeight.GetVersion( fileVersion ) );
- rStream.WriteUInt16( m_aWeight.GetVersion( fileVersion ) );
- rStream.WriteUInt16( m_aPosture.GetVersion( fileVersion ) );
- rStream.WriteUInt16( m_aUnderline.GetVersion( fileVersion ) );
- rStream.WriteUInt16( m_aOverline.GetVersion( fileVersion ) );
- rStream.WriteUInt16( m_aCrossedOut.GetVersion( fileVersion ) );
- rStream.WriteUInt16( m_aContour.GetVersion( fileVersion ) );
- rStream.WriteUInt16( m_aShadowed.GetVersion( fileVersion ) );
- rStream.WriteUInt16( m_aColor.GetVersion( fileVersion ) );
- rStream.WriteUInt16( m_aBox.GetVersion( fileVersion ) );
- rStream.WriteUInt16( m_aTLBR.GetVersion( fileVersion ) );
- rStream.WriteUInt16( m_aBackground.GetVersion( fileVersion ) );
-
- rStream.WriteUInt16( m_aAdjust.GetVersion( fileVersion ) );
-
- if (fileVersion >= SOFFICE_FILEFORMAT_50)
- {
- WriterSpecificAutoFormatBlock block(rStream);
-
- rStream.WriteUInt16( m_aTextOrientation.GetVersion(fileVersion) );
- rStream.WriteUInt16( m_aVerticalAlignment.GetVersion(fileVersion) );
- }
-
- rStream.WriteUInt16( m_aHorJustify.GetVersion( fileVersion ) );
- rStream.WriteUInt16( m_aVerJustify.GetVersion( fileVersion ) );
- rStream.WriteUInt16( SvxOrientationItem(SvxCellOrientation::Standard, 0).GetVersion( fileVersion ) );
- rStream.WriteUInt16( m_aMargin.GetVersion( fileVersion ) );
- rStream.WriteUInt16( m_aLinebreak.GetVersion( fileVersion ) );
- rStream.WriteUInt16( m_aRotateAngle.GetVersion( fileVersion ) );
- rStream.WriteUInt16( m_aRotateMode.GetVersion( fileVersion ) );
-
- rStream.WriteUInt16( 0 ); // NumberFormat
-}
-
SwTableAutoFormat::SwTableAutoFormat( const OUString& rName )
: m_aName( rName )
, m_nStrResId( USHRT_MAX )
- , m_aBreak( SvxBreak::NONE, RES_BREAK )
- , m_aKeepWithNextPara( false, RES_KEEP )
+ , m_aBreak(std::make_shared<SvxFormatBreakItem>(SvxBreak::NONE, RES_BREAK))
+ , m_aKeepWithNextPara(std::make_shared<SvxFormatKeepItem>(false, RES_KEEP))
, m_aRepeatHeading( 0 )
, m_bLayoutSplit( true )
, m_bRowSplit( true )
, m_bCollapsingBorders(true)
- , m_aShadow( RES_SHADOW )
+ , m_aShadow(std::make_shared<SvxShadowItem>(RES_SHADOW))
, m_bHidden( false )
, m_bUserDefined( true )
{
@@ -619,9 +352,9 @@ SwTableAutoFormat::SwTableAutoFormat( const OUString& rName )
}
SwTableAutoFormat::SwTableAutoFormat( const SwTableAutoFormat& rNew )
- : m_aBreak( rNew.m_aBreak )
- , m_aKeepWithNextPara( false, RES_KEEP )
- , m_aShadow( RES_SHADOW )
+ : m_aBreak()
+ , m_aKeepWithNextPara()
+ , m_aShadow(std::make_shared<SvxShadowItem>(RES_SHADOW))
{
for(SwBoxAutoFormat* & rp : m_aBoxAutoFormat)
rp = nullptr;
@@ -654,14 +387,14 @@ SwTableAutoFormat& SwTableAutoFormat::operator=( const SwTableAutoFormat& rNew )
m_bInclValueFormat = rNew.m_bInclValueFormat;
m_bInclWidthHeight = rNew.m_bInclWidthHeight;
- m_aBreak = rNew.m_aBreak;
+ m_aBreak.reset(static_cast<SvxFormatBreakItem*>(rNew.m_aBreak->Clone()));
m_aPageDesc = rNew.m_aPageDesc;
- m_aKeepWithNextPara = rNew.m_aKeepWithNextPara;
+ m_aKeepWithNextPara.reset(static_cast<SvxFormatKeepItem*>(rNew.m_aKeepWithNextPara->Clone()));
m_aRepeatHeading = rNew.m_aRepeatHeading;
m_bLayoutSplit = rNew.m_bLayoutSplit;
m_bRowSplit = rNew.m_bRowSplit;
m_bCollapsingBorders = rNew.m_bCollapsingBorders;
- m_aShadow = rNew.m_aShadow;
+ m_aShadow.reset(static_cast<SvxShadowItem*>(rNew.m_aShadow->Clone()));
m_bHidden = rNew.m_bHidden;
m_bUserDefined = rNew.m_bUserDefined;
@@ -904,12 +637,12 @@ void SwTableAutoFormat::RestoreTableProperties(SwTable &table) const
SfxItemSet rSet(pDoc->GetAttrPool(), aTableSetRange);
- rSet.Put(m_aBreak);
+ rSet.Put(*m_aBreak);
rSet.Put(m_aPageDesc);
rSet.Put(SwFormatLayoutSplit(m_bLayoutSplit));
rSet.Put(SfxBoolItem(RES_COLLAPSING_BORDERS, m_bCollapsingBorders));
- rSet.Put(m_aKeepWithNextPara);
- rSet.Put(m_aShadow);
+ rSet.Put(*m_aKeepWithNextPara);
+ rSet.Put(*m_aShadow);
pFormat->SetFormatAttr(rSet);
@@ -936,15 +669,15 @@ void SwTableAutoFormat::StoreTableProperties(const SwTable &table)
const SfxItemSet &rSet = pFormat->GetAttrSet();
- m_aBreak = rSet.Get(RES_BREAK);
+ m_aBreak.reset(static_cast<SvxFormatBreakItem*>(rSet.Get(RES_BREAK).Clone()));
m_aPageDesc = rSet.Get(RES_PAGEDESC);
const SwFormatLayoutSplit &layoutSplit = rSet.Get(RES_LAYOUT_SPLIT);
m_bLayoutSplit = layoutSplit.GetValue();
m_bCollapsingBorders = rSet.Get(RES_COLLAPSING_BORDERS).GetValue();
- m_aKeepWithNextPara = rSet.Get(RES_KEEP);
+ m_aKeepWithNextPara.reset(static_cast<SvxFormatKeepItem*>(rSet.Get(RES_KEEP).Clone()));
m_aRepeatHeading = table.GetRowsToRepeat();
- m_aShadow = rSet.Get(RES_SHADOW);
+ m_aShadow.reset(static_cast<SvxShadowItem*>(rSet.Get(RES_SHADOW).Clone()));
}
bool SwTableAutoFormat::FirstRowEndColumnIsRow()
@@ -997,15 +730,13 @@ bool SwTableAutoFormat::Load( SvStream& rStream, const SwAfVersions& rVersions )
if (nVal >= AUTOFORMAT_DATA_ID_31005 && WriterSpecificBlockExists(rStream))
{
- SfxPoolItem* pNew = nullptr;
-
- READ(m_aBreak, SvxFormatBreakItem, AUTOFORMAT_FILE_VERSION);
+ legacy::SvxFormatBreak::Create(*m_aBreak, rStream, AUTOFORMAT_FILE_VERSION);
//unimplemented READ(m_aPageDesc, SwFormatPageDesc, AUTOFORMAT_FILE_VERSION);
- READ(m_aKeepWithNextPara, SvxFormatKeepItem, AUTOFORMAT_FILE_VERSION);
+ legacy::SvxFormatKeep::Create(*m_aKeepWithNextPara, rStream, AUTOFORMAT_FILE_VERSION);
rStream.ReadUInt16( m_aRepeatHeading ).ReadCharAsBool( m_bLayoutSplit ).ReadCharAsBool( m_bRowSplit ).ReadCharAsBool( m_bCollapsingBorders );
- READ(m_aShadow, SvxShadowItem, AUTOFORMAT_FILE_VERSION);
+ legacy::SvxShadow::Create(*m_aShadow, rStream, AUTOFORMAT_FILE_VERSION);
}
bRet = ERRCODE_NONE== rStream.GetError();
@@ -1044,11 +775,11 @@ bool SwTableAutoFormat::Save( SvStream& rStream, sal_uInt16 fileVersion ) const
{
WriterSpecificAutoFormatBlock block(rStream);
- m_aBreak.Store(rStream, m_aBreak.GetVersion(fileVersion));
+ legacy::SvxFormatBreak::Store(*m_aBreak, rStream, legacy::SvxFormatBreak::GetVersion(fileVersion));
//unimplemented m_aPageDesc.Store(rStream, m_aPageDesc.GetVersion(fileVersion));
- m_aKeepWithNextPara.Store(rStream, m_aKeepWithNextPara.GetVersion(fileVersion));
+ legacy::SvxFormatKeep::Store(*m_aKeepWithNextPara, rStream, legacy::SvxFormatKeep::GetVersion(fileVersion));
rStream.WriteUInt16( m_aRepeatHeading ).WriteBool( m_bLayoutSplit ).WriteBool( m_bRowSplit ).WriteBool( m_bCollapsingBorders );
- m_aShadow.Store(rStream, m_aShadow.GetVersion(fileVersion));
+ legacy::SvxShadow::Store(*m_aShadow, rStream, legacy::SvxShadow::GetVersion(fileVersion));
}
bool bRet = ERRCODE_NONE == rStream.GetError();
@@ -1373,8 +1104,7 @@ bool SwTableAutoFormatTable::Save( SvStream& rStream ) const
return false;
// Write this version number for all attributes
- m_pImpl->m_AutoFormats[0]->GetBoxFormat(0).SaveVersionNo(
- rStream, AUTOFORMAT_FILE_VERSION);
+ SwAfVersions::Write(rStream, AUTOFORMAT_FILE_VERSION);
rStream.WriteUInt16( m_pImpl->m_AutoFormats.size() - 1 );
bRet = ERRCODE_NONE == rStream.GetError();
diff --git a/sw/source/core/doc/tblrwcl.cxx b/sw/source/core/doc/tblrwcl.cxx
index f6c0bb60e715..b414d65847f7 100644
--- a/sw/source/core/doc/tblrwcl.cxx
+++ b/sw/source/core/doc/tblrwcl.cxx
@@ -1803,20 +1803,43 @@ static void lcl_CopyBoxToDoc(FndBox_ const& rFndBox, CpyPara *const pCpyPara)
// Find the Frame Format in the list of all Frame Formats
CpyTabFrame aFindFrame(static_cast<SwTableBoxFormat*>(rFndBox.GetBox()->GetFrameFormat()));
- SwFormatFrameSize aFrameSz;
+ std::shared_ptr<SwFormatFrameSize> aFrameSz(std::make_shared<SwFormatFrameSize>());
CpyTabFrames::const_iterator itFind = pCpyPara->rTabFrameArr.lower_bound( aFindFrame );
const CpyTabFrames::size_type nFndPos = itFind - pCpyPara->rTabFrameArr.begin();
- if( itFind == pCpyPara->rTabFrameArr.end() || !(*itFind == aFindFrame) ||
- ( aFrameSz = ( aFindFrame = pCpyPara->rTabFrameArr[ nFndPos ]).pNewFrameFormat->
- GetFrameSize()).GetWidth() != static_cast<SwTwips>(nSize) )
+
+ // It *is* sometimes cool to have multiple tests/if's and assignments
+ // in a single statement, and it is technically possible. But it is definitely
+ // not simply readable - where from my POV reading code is done 1000 times
+ // more often than writing it. Thus I dismantled the expression in smaller
+ // chunks to keep it handy/understandable/changeable (hopefully without error)
+ // The original for reference:
+ // if( itFind == pCpyPara->rTabFrameArr.end() || !(*itFind == aFindFrame) ||
+ // ( aFrameSz = ( aFindFrame = pCpyPara->rTabFrameArr[ nFndPos ]).pNewFrameFormat->
+ // GetFrameSize()).GetWidth() != static_cast<SwTwips>(nSize) )
+
+ bool DoCopyIt(itFind == pCpyPara->rTabFrameArr.end());
+
+ if(!DoCopyIt)
+ {
+ DoCopyIt = !(*itFind == aFindFrame);
+ }
+
+ if(!DoCopyIt)
+ {
+ aFindFrame = pCpyPara->rTabFrameArr[ nFndPos ];
+ aFrameSz.reset(static_cast<SwFormatFrameSize*>(aFindFrame.pNewFrameFormat->GetFrameSize().Clone()));
+ DoCopyIt = aFrameSz->GetWidth() != static_cast<SwTwips>(nSize);
+ }
+
+ if(DoCopyIt)
{
// It doesn't exist yet, so copy it
aFindFrame.pNewFrameFormat = pCpyPara->pDoc->MakeTableBoxFormat();
aFindFrame.pNewFrameFormat->CopyAttrs( *rFndBox.GetBox()->GetFrameFormat() );
if( !pCpyPara->bCpyContent )
aFindFrame.pNewFrameFormat->ResetFormatAttr( RES_BOXATR_FORMULA, RES_BOXATR_VALUE );
- aFrameSz.SetWidth( nSize );
- aFindFrame.pNewFrameFormat->SetFormatAttr( aFrameSz );
+ aFrameSz->SetWidth( nSize );
+ aFindFrame.pNewFrameFormat->SetFormatAttr( *aFrameSz );
pCpyPara->rTabFrameArr.insert( aFindFrame );
}
diff --git a/sw/source/core/docnode/ndtbl1.cxx b/sw/source/core/docnode/ndtbl1.cxx
index daf52e4047a9..9781ccd87911 100644
--- a/sw/source/core/docnode/ndtbl1.cxx
+++ b/sw/source/core/docnode/ndtbl1.cxx
@@ -498,7 +498,7 @@ void SwDoc::SetRowBackground( const SwCursor& rCursor, const SvxBrushItem &rNew
}
}
-bool SwDoc::GetRowBackground( const SwCursor& rCursor, SvxBrushItem &rToFill )
+bool SwDoc::GetRowBackground( const SwCursor& rCursor, std::shared_ptr<SvxBrushItem>& rToFill )
{
bool bRet = false;
SwTableNode* pTableNd = rCursor.GetPoint()->nNode.GetNode().FindTableNode();
@@ -513,11 +513,15 @@ bool SwDoc::GetRowBackground( const SwCursor& rCursor, SvxBrushItem &rToFill )
bRet = true;
for ( std::vector<SwTableLine*>::size_type i = 1; i < aRowArr.size(); ++i )
- if ( rToFill != aRowArr[i]->GetFrameFormat()->makeBackgroundBrushItem() )
+ {
+ std::shared_ptr<SvxBrushItem> aAlternative(aRowArr[i]->GetFrameFormat()->makeBackgroundBrushItem());
+
+ if ( rToFill != aAlternative && rToFill && aAlternative && *rToFill != *aAlternative )
{
bRet = false;
break;
}
+ }
}
}
return bRet;
@@ -875,26 +879,28 @@ void SwDoc::SetTabLineStyle( const SwCursor& rCursor,
const_cast<SwTableBox*>(pCell->GetTabBox())->ClaimFrameFormat();
SwFrameFormat *pFormat = pCell->GetFormat();
- SvxBoxItem aBox( pFormat->GetBox() );
+ std::shared_ptr<SvxBoxItem> aBox(static_cast<SvxBoxItem*>(pFormat->GetBox().Clone()));
if ( !pBorderLine && bSetLine )
- aBox = *::GetDfltAttr( RES_BOX );
+ {
+ aBox.reset(static_cast<SvxBoxItem*>(::GetDfltAttr(RES_BOX)->Clone()));
+ }
else
{
- if ( aBox.GetTop() )
- ::lcl_SetLineStyle( const_cast<SvxBorderLine*>(aBox.GetTop()),
+ if ( aBox->GetTop() )
+ ::lcl_SetLineStyle( const_cast<SvxBorderLine*>(aBox->GetTop()),
pColor, pBorderLine );
- if ( aBox.GetBottom() )
- ::lcl_SetLineStyle( const_cast<SvxBorderLine*>(aBox.GetBottom()),
+ if ( aBox->GetBottom() )
+ ::lcl_SetLineStyle( const_cast<SvxBorderLine*>(aBox->GetBottom()),
pColor, pBorderLine );
- if ( aBox.GetLeft() )
- ::lcl_SetLineStyle( const_cast<SvxBorderLine*>(aBox.GetLeft()),
+ if ( aBox->GetLeft() )
+ ::lcl_SetLineStyle( const_cast<SvxBorderLine*>(aBox->GetLeft()),
pColor, pBorderLine );
- if ( aBox.GetRight() )
- ::lcl_SetLineStyle( const_cast<SvxBorderLine*>(aBox.GetRight()),
+ if ( aBox->GetRight() )
+ ::lcl_SetLineStyle( const_cast<SvxBorderLine*>(aBox->GetRight()),
pColor, pBorderLine );
}
- pFormat->SetFormatAttr( aBox );
+ pFormat->SetFormatAttr( *aBox );
}
}
@@ -1178,7 +1184,7 @@ void SwDoc::SetBoxAttr( const SwCursor& rCursor, const SfxPoolItem &rNew )
}
}
-bool SwDoc::GetBoxAttr( const SwCursor& rCursor, SfxPoolItem& rToFill )
+bool SwDoc::GetBoxAttr( const SwCursor& rCursor, std::shared_ptr<SfxPoolItem>& rToFill )
{
bool bRet = false;
SwTableNode* pTableNd = rCursor.GetPoint()->nNode.GetNode().FindTableNode();
@@ -1187,18 +1193,18 @@ bool SwDoc::GetBoxAttr( const SwCursor& rCursor, SfxPoolItem& rToFill )
{
bRet = true;
bool bOneFound = false;
- const sal_uInt16 nWhich = rToFill.Which();
+ const sal_uInt16 nWhich = rToFill->Which();
for (size_t i = 0; i < aBoxes.size(); ++i)
{
switch ( nWhich )
{
case RES_BACKGROUND:
{
- SvxBrushItem aBack =
+ std::shared_ptr<SvxBrushItem> aBack =
aBoxes[i]->GetFrameFormat()->makeBackgroundBrushItem();
if( !bOneFound )
{
- static_cast<SvxBrushItem&>(rToFill) = aBack;
+ rToFill.reset(aBack->Clone());
bOneFound = true;
}
else if( rToFill != aBack )
@@ -1212,10 +1218,10 @@ bool SwDoc::GetBoxAttr( const SwCursor& rCursor, SfxPoolItem& rToFill )
aBoxes[i]->GetFrameFormat()->GetFrameDir();
if( !bOneFound )
{
- static_cast<SvxFrameDirectionItem&>(rToFill) = rDir;
+ rToFill.reset(rDir.Clone());
bOneFound = true;
}
- else if( rToFill != rDir )
+ else if( rToFill && *rToFill != rDir )
bRet = false;
}
break;
@@ -1225,10 +1231,10 @@ bool SwDoc::GetBoxAttr( const SwCursor& rCursor, SfxPoolItem& rToFill )
aBoxes[i]->GetFrameFormat()->GetVertOrient();
if( !bOneFound )
{
- static_cast<SwFormatVertOrient&>(rToFill) = rOrient;
+ rToFill.reset(rOrient.Clone());
bOneFound = true;
}
- else if( rToFill != rOrient )
+ else if( rToFill && *rToFill != rOrient )
bRet = false;
}
break;
diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx
index 363f1056583a..f81fb14a647c 100644
--- a/sw/source/core/frmedt/fefly1.cxx
+++ b/sw/source/core/frmedt/fefly1.cxx
@@ -701,8 +701,8 @@ const SwFrameFormat *SwFEShell::NewFlyFrame( const SfxItemSet& rSet, bool bAnchV
GetDoc()->GetIDocumentUndoRedo().StartUndo( SwUndoId::INSLAYFMT, nullptr );
std::unique_ptr<SwFormatAnchor> pOldAnchor;
bool bHOriChgd = false, bVOriChgd = false;
- SwFormatVertOrient aOldV;
- SwFormatHoriOrient aOldH;
+ std::shared_ptr<SwFormatVertOrient> aOldV;
+ std::shared_ptr<SwFormatHoriOrient> aOldH;
if ( RndStdIds::FLY_AT_PAGE != eRndId )
{
@@ -718,14 +718,14 @@ const SwFrameFormat *SwFEShell::NewFlyFrame( const SfxItemSet& rSet, bool bAnchV
&& text::HoriOrientation::NONE == static_cast<const SwFormatHoriOrient*>(pItem)->GetHoriOrient() )
{
bHOriChgd = true;
- aOldH = *static_cast<const SwFormatHoriOrient*>(pItem);
+ aOldH.reset(static_cast<SwFormatHoriOrient*>(pItem->Clone()));
const_cast<SfxItemSet&>(rSet).Put( SwFormatHoriOrient( 0, text::HoriOrientation::LEFT ) );
}
if( SfxItemState::SET == rSet.GetItemState( RES_VERT_ORIENT, false, &pItem )
&& text::VertOrientation::NONE == static_cast<const SwFormatVertOrient*>(pItem)->GetVertOrient() )
{
bVOriChgd = true;
- aOldV = *static_cast<const SwFormatVertOrient*>(pItem);
+ aOldV.reset(static_cast<SwFormatVertOrient*>(pItem->Clone()));
const_cast<SfxItemSet&>(rSet).Put( SwFormatVertOrient( 0, text::VertOrientation::TOP ) );
}
}
@@ -773,9 +773,9 @@ const SwFrameFormat *SwFEShell::NewFlyFrame( const SfxItemSet& rSet, bool bAnchV
const_cast<SfxItemSet&>(rSet).Put( *pOldAnchor );
if( bHOriChgd )
- const_cast<SfxItemSet&>(rSet).Put( aOldH );
+ const_cast<SfxItemSet&>(rSet).Put( *aOldH );
if( bVOriChgd )
- const_cast<SfxItemSet&>(rSet).Put( aOldV );
+ const_cast<SfxItemSet&>(rSet).Put( *aOldV );
GetDoc()->SetFlyFrameAttr( *pRet, const_cast<SfxItemSet&>(rSet) );
GetDoc()->GetIDocumentUndoRedo().DoUndo(bDoesUndo);
diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx
index 61a995381a52..a60eff107e9a 100644
--- a/sw/source/core/frmedt/fetab.cxx
+++ b/sw/source/core/frmedt/fetab.cxx
@@ -754,7 +754,7 @@ void SwFEShell::SetRowBackground( const SvxBrushItem &rNew )
EndAllActionAndCall();
}
-bool SwFEShell::GetRowBackground( SvxBrushItem &rToFill ) const
+bool SwFEShell::GetRowBackground( std::shared_ptr<SvxBrushItem>& rToFill ) const
{
return SwDoc::GetRowBackground( *getShellCursor( false ), rToFill );
}
@@ -790,9 +790,12 @@ void SwFEShell::SetBoxBackground( const SvxBrushItem &rNew )
EndAllActionAndCall();
}
-bool SwFEShell::GetBoxBackground( SvxBrushItem &rToFill ) const
+bool SwFEShell::GetBoxBackground( std::shared_ptr<SvxBrushItem>& rToFill ) const
{
- return SwDoc::GetBoxAttr( *getShellCursor( false ), rToFill );
+ std::shared_ptr<SfxPoolItem> aTemp(rToFill);
+ bool bRetval(SwDoc::GetBoxAttr(*getShellCursor( false ), aTemp));
+ rToFill = std::static_pointer_cast<SvxBrushItem>(aTemp);
+ return bRetval;
}
void SwFEShell::SetBoxDirection( const SvxFrameDirectionItem& rNew )
@@ -803,9 +806,12 @@ void SwFEShell::SetBoxDirection( const SvxFrameDirectionItem& rNew )
EndAllActionAndCall();
}
-bool SwFEShell::GetBoxDirection( SvxFrameDirectionItem& rToFill ) const
+bool SwFEShell::GetBoxDirection( std::shared_ptr<SvxFrameDirectionItem>& rToFill ) const
{
- return SwDoc::GetBoxAttr( *getShellCursor( false ), rToFill );
+ std::shared_ptr<SfxPoolItem> aTemp(rToFill);
+ bool bRetval(SwDoc::GetBoxAttr(*getShellCursor( false ), aTemp));
+ rToFill = std::static_pointer_cast<SvxFrameDirectionItem>(aTemp);
+ return bRetval;
}
void SwFEShell::SetBoxAlign( sal_uInt16 nAlign )
@@ -834,7 +840,7 @@ void SwFEShell::SetTabBackground( const SvxBrushItem &rNew )
GetDoc()->getIDocumentState().SetModified();
}
-void SwFEShell::GetTabBackground( SvxBrushItem &rToFill ) const
+void SwFEShell::GetTabBackground( std::shared_ptr<SvxBrushItem>& rToFill ) const
{
SwFrame *pFrame = GetCurrFrame();
if( pFrame && pFrame->IsInTab() )
diff --git a/sw/source/core/inc/frmtool.hxx b/sw/source/core/inc/frmtool.hxx
index 18048e34112b..8765dd034b6f 100644
--- a/sw/source/core/inc/frmtool.hxx
+++ b/sw/source/core/inc/frmtool.hxx
@@ -281,7 +281,7 @@ class SwBorderAttrs : public SwCacheObj
const SwAttrSet &m_rAttrSet;
const SvxULSpaceItem &m_rUL;
// #i96772#
- SvxLRSpaceItem m_rLR;
+ std::shared_ptr<SvxLRSpaceItem> m_rLR;
const SvxBoxItem &m_rBox;
const SvxShadowItem &m_rShadow;
const Size m_aFrameSize;
diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx
index 7c77560c8e33..0cbb44249644 100644
--- a/sw/source/core/layout/atrfrm.cxx
+++ b/sw/source/core/layout/atrfrm.cxx
@@ -1265,48 +1265,6 @@ void SwFormatSurround::dumpAsXml(xmlTextWriterPtr pWriter) const
xmlTextWriterEndElement(pWriter);
}
-SvStream& SwFormatVertOrient::Store(SvStream &rStream, sal_uInt16 /*version*/) const
-{
-#if SAL_TYPES_SIZEOFLONG == 8
- rStream.WriteInt64(m_nYPos);
-#else
- rStream.WriteInt32(m_nYPos);
-#endif
- rStream.WriteInt16( m_eOrient ).WriteInt16( m_eRelation );
- return rStream;
-}
-
-SfxPoolItem* SwFormatVertOrient::Create(SvStream &rStream, sal_uInt16 nVersionAbusedAsSize) const
-{
- SwTwips yPos(0);
- sal_Int16 orient(0);
- sal_Int16 relation(0);
- switch (nVersionAbusedAsSize)
- {
- // compatibility hack for Table Auto Format: SwTwips is "long" :(
- // (this means that the file format is platform dependent)
- case 14:
- {
- sal_Int64 n(0);
- rStream.ReadInt64(n);
- yPos = n;
- }
- break;
- case 10:
- {
- sal_Int32 n(0);
- rStream.ReadInt32(n);
- yPos = n;
- }
- break;
- default:
- SAL_WARN("sw.core", "SwFormatVertOrient::Create: unknown size");
- }
- rStream.ReadInt16( orient ).ReadInt16( relation );
-
- return new SwFormatVertOrient(yPos, orient, relation);
-}
-
// Partially implemented inline in hxx
SwFormatVertOrient::SwFormatVertOrient( SwTwips nY, sal_Int16 eVert,
sal_Int16 eRel )
@@ -3210,16 +3168,17 @@ bool SwFlyFrameFormat::IsBackgroundTransparent() const
// NOTE: If background color is "no fill"/"auto fill" (COL_TRANSPARENT)
// and there is no background graphic, it "inherites" the background
// from its anchor.
- SvxBrushItem aBackground(makeBackgroundBrushItem());
- if ( (aBackground.GetColor().GetTransparency() != 0) &&
- (aBackground.GetColor() != COL_TRANSPARENT)
+ std::shared_ptr<SvxBrushItem> aBackground(makeBackgroundBrushItem());
+ if ( aBackground &&
+ (aBackground->GetColor().GetTransparency() != 0) &&
+ (aBackground->GetColor() != COL_TRANSPARENT)
)
{
return true;
}
else
{
- const GraphicObject *pTmpGrf = aBackground.GetGraphicObject();
+ const GraphicObject *pTmpGrf = aBackground->GetGraphicObject();
if ( pTmpGrf &&
(pTmpGrf->GetAttr().GetTransparency() != 0)
)
@@ -3249,9 +3208,10 @@ bool SwFlyFrameFormat::IsBackgroundBrushInherited() const
}
else
{
- SvxBrushItem aBackground(makeBackgroundBrushItem());
- if ( (aBackground.GetColor() == COL_TRANSPARENT) &&
- !(aBackground.GetGraphicObject()) )
+ std::shared_ptr<SvxBrushItem> aBackground(makeBackgroundBrushItem());
+ if ( aBackground &&
+ (aBackground->GetColor() == COL_TRANSPARENT) &&
+ !(aBackground->GetGraphicObject()) )
{
return true;
}
diff --git a/sw/source/core/layout/flylay.cxx b/sw/source/core/layout/flylay.cxx
index 16a610847978..e7d19227fd88 100644
--- a/sw/source/core/layout/flylay.cxx
+++ b/sw/source/core/layout/flylay.cxx
@@ -358,9 +358,9 @@ bool SwFlyFreeFrame::supportsAutoContour() const
}
else
{
- const SvxBrushItem aBack(GetFormat()->makeBackgroundBrushItem());
+ const std::shared_ptr<SvxBrushItem> aBack(GetFormat()->makeBackgroundBrushItem());
- if(aBack.isUsed())
+ if(aBack && aBack->isUsed())
{
return false;
}
diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx
index 5c33911727bf..8e7c4a3700ff 100644
--- a/sw/source/core/layout/frmtool.cxx
+++ b/sw/source/core/layout/frmtool.cxx
@@ -1977,7 +1977,7 @@ SwBorderAttrs::SwBorderAttrs(const SwModify *pMod, const SwFrame *pConstructor)
, m_rUL(m_rAttrSet.GetULSpace())
// #i96772#
// LRSpaceItem is copied due to the possibility that it is adjusted - see below
- , m_rLR(m_rAttrSet.GetLRSpace())
+ , m_rLR(static_cast<SvxLRSpaceItem*>(m_rAttrSet.GetLRSpace().Clone()))
, m_rBox(m_rAttrSet.GetBox())
, m_rShadow(m_rAttrSet.GetShadow())
, m_aFrameSize(m_rAttrSet.GetFrameSize().GetSize())
@@ -2001,7 +2001,7 @@ SwBorderAttrs::SwBorderAttrs(const SwModify *pMod, const SwFrame *pConstructor)
}
else if ( pConstructor->IsNoTextFrame() )
{
- m_rLR = SvxLRSpaceItem ( RES_LR_SPACE );
+ m_rLR = std::make_shared<SvxLRSpaceItem>(RES_LR_SPACE);
}
// Caution: The USHORTs for the cached values are not initialized by intention!
@@ -2054,9 +2054,9 @@ long SwBorderAttrs::CalcRight( const SwFrame* pCaller ) const
}
// for paragraphs, "left" is "before text" and "right" is "after text"
if ( pCaller->IsTextFrame() && pCaller->IsRightToLeft() )
- nRight += m_rLR.GetLeft();
+ nRight += m_rLR->GetLeft();
else
- nRight += m_rLR.GetRight();
+ nRight += m_rLR->GetRight();
// correction: retrieve left margin for numbering in R2L-layout
if ( pCaller->IsTextFrame() && pCaller->IsRightToLeft() )
@@ -2103,7 +2103,7 @@ long SwBorderAttrs::CalcLeft( const SwFrame *pCaller ) const
// for paragraphs, "left" is "before text" and "right" is "after text"
if ( pCaller->IsTextFrame() && pCaller->IsRightToLeft() )
- nLeft += m_rLR.GetRight();
+ nLeft += m_rLR->GetRight();
else
{
bool bIgnoreMargin = false;
@@ -2121,7 +2121,7 @@ long SwBorderAttrs::CalcLeft( const SwFrame *pCaller ) const
}
}
if (!bIgnoreMargin)
- nLeft += m_rLR.GetLeft();
+ nLeft += m_rLR->GetLeft();
}
// correction: do not retrieve left margin for numbering in R2L-layout
diff --git a/sw/source/core/layout/legacyitem.cxx b/sw/source/core/layout/legacyitem.cxx
new file mode 100755
index 000000000000..9dea0dca8cf6
--- /dev/null
+++ b/sw/source/core/layout/legacyitem.cxx
@@ -0,0 +1,82 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <legacyitem.hxx>
+#include <tools/stream.hxx>
+#include <sal/log.hxx>
+#include <fmtornt.hxx>
+
+namespace legacy
+{
+ namespace SwFormatVert
+ {
+ sal_uInt16 GetVersion(sal_uInt16)
+ {
+ return 0;
+ }
+
+ void Create(SwFormatVertOrient& rItem, SvStream& rStrm, sal_uInt16 nVersionAbusedAsSize)
+ {
+ SwTwips yPos(0);
+ sal_Int16 orient(0);
+ sal_Int16 relation(0);
+
+ switch (nVersionAbusedAsSize)
+ {
+ // compatibility hack for Table Auto Format: SwTwips is "long" :(
+ // (this means that the file format is platform dependent)
+ case 14:
+ {
+ sal_Int64 n(0);
+ rStrm.ReadInt64(n);
+ yPos = n;
+ break;
+ }
+ case 10:
+ {
+ sal_Int32 n(0);
+ rStrm.ReadInt32(n);
+ yPos = n;
+ break;
+ }
+ default:
+ SAL_WARN("sw.core", "SwFormatVertOrient::Create: unknown size");
+ }
+
+ rStrm.ReadInt16( orient ).ReadInt16( relation );
+
+ rItem.SetPos(yPos);
+ rItem.SetVertOrient(orient);
+ rItem.SetRelationOrient(relation);
+ }
+
+ SvStream& Store(const SwFormatVertOrient& rItem, SvStream& rStrm, sal_uInt16)
+ {
+#if SAL_TYPES_SIZEOFLONG == 8
+ rStrm.WriteInt64(rItem.GetPos());
+#else
+ rStrm.WriteInt32(rItem.GetPos());
+#endif
+ rStrm.WriteInt16(rItem.GetVertOrient()).WriteInt16(rItem.GetRelationOrient());
+ return rStrm;
+ }
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/layout/pagedesc.cxx b/sw/source/core/layout/pagedesc.cxx
index 2e3a122655e6..a0c7e08ee45b 100644
--- a/sw/source/core/layout/pagedesc.cxx
+++ b/sw/source/core/layout/pagedesc.cxx
@@ -159,7 +159,7 @@ void SwPageDesc::Mirror()
aSet.Put( m_Master.GetPaperBin() );
aSet.Put( m_Master.GetULSpace() );
aSet.Put( m_Master.GetBox() );
- aSet.Put( m_Master.makeBackgroundBrushItem() );
+ aSet.Put( *m_Master.makeBackgroundBrushItem() );
aSet.Put( m_Master.GetShadow() );
aSet.Put( m_Master.GetCol() );
aSet.Put( m_Master.GetFrameDir() );
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index e8f0613cf942..ad7530657e4e 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -3920,13 +3920,14 @@ void SwFlyFrame::PaintSwFrame(vcl::RenderContext& rRenderContext, SwRect const&
}
else
{
- SvxBrushItem aBack = GetFormat()->makeBackgroundBrushItem();
+ std::shared_ptr<SvxBrushItem> aBack = GetFormat()->makeBackgroundBrushItem();
// OD 07.08.2002 #99657# #GetTransChg#
// to determine, if background has to be painted, by checking, if
// background color is not COL_TRANSPARENT ("no fill"/"auto fill")
// or a background graphic exists.
- bPaintCompleteBack = (aBack.GetColor() != COL_TRANSPARENT) ||
- aBack.GetGraphicPos() != GPOS_NONE;
+ bPaintCompleteBack = aBack &&
+ ((aBack->GetColor() != COL_TRANSPARENT) ||
+ aBack->GetGraphicPos() != GPOS_NONE);
}
}
// paint of margin needed.
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index 5c2158d415cb..060a8dcf6de3 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -3130,8 +3130,8 @@ SwTwips SwTabFrame::GrowFrame( SwTwips nDist, bool bTst, bool bInfo )
InvalidatePage( pPage );
SetComplete();
- SvxBrushItem aBack = GetFormat()->makeBackgroundBrushItem();
- const SvxGraphicPosition ePos = aBack.GetGraphicPos();
+ std::shared_ptr<SvxBrushItem> aBack = GetFormat()->makeBackgroundBrushItem();
+ const SvxGraphicPosition ePos = aBack ? aBack->GetGraphicPos() : GPOS_NONE;
if ( GPOS_NONE != ePos && GPOS_TILED != ePos )
SetCompletePaint();
}
diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx
index 0f486b4f3f4b..187f64e797a5 100644
--- a/sw/source/core/layout/wsfrm.cxx
+++ b/sw/source/core/layout/wsfrm.cxx
@@ -1678,8 +1678,8 @@ SwTwips SwFrame::AdjustNeighbourhood( SwTwips nDiff, bool bTst )
GetNext()->InvalidatePos_();
//Trigger a repaint if necessary.
- SvxBrushItem aBack(pUp->GetFormat()->makeBackgroundBrushItem());
- const SvxGraphicPosition ePos = aBack.GetGraphicPos();
+ std::shared_ptr<SvxBrushItem> aBack(pUp->GetFormat()->makeBackgroundBrushItem());
+ const SvxGraphicPosition ePos = aBack ? aBack->GetGraphicPos() : GPOS_NONE;
if ( ePos != GPOS_NONE && ePos != GPOS_TILED )
pViewShell->InvalidateWindows( pUp->getFrameArea() );
@@ -2717,8 +2717,8 @@ SwTwips SwLayoutFrame::GrowFrame( SwTwips nDist, bool bTst, bool bInfo )
if( IsCellFrame() )
InvaPercentLowers( nReal );
- SvxBrushItem aBack(GetFormat()->makeBackgroundBrushItem());
- const SvxGraphicPosition ePos = aBack.GetGraphicPos();
+ std::shared_ptr<SvxBrushItem> aBack(GetFormat()->makeBackgroundBrushItem());
+ const SvxGraphicPosition ePos = aBack ? aBack->GetGraphicPos() : GPOS_NONE;
if ( GPOS_NONE != ePos && GPOS_TILED != ePos )
SetCompletePaint();
}
@@ -2903,8 +2903,8 @@ SwTwips SwLayoutFrame::ShrinkFrame( SwTwips nDist, bool bTst, bool bInfo )
const SwFrameFormat* pFormat = GetFormat();
if (pFormat)
{
- SvxBrushItem aBack(pFormat->makeBackgroundBrushItem());
- const SvxGraphicPosition ePos = aBack.GetGraphicPos();
+ std::shared_ptr<SvxBrushItem> aBack(pFormat->makeBackgroundBrushItem());
+ const SvxGraphicPosition ePos = aBack ? aBack->GetGraphicPos() : GPOS_NONE;
if ( GPOS_NONE == ePos || GPOS_TILED == ePos )
bCompletePaint = false;
}
diff --git a/sw/source/core/text/porfld.cxx b/sw/source/core/text/porfld.cxx
index bfb547d31487..760a0a8774bf 100644
--- a/sw/source/core/text/porfld.cxx
+++ b/sw/source/core/text/porfld.cxx
@@ -765,7 +765,7 @@ SwGrfNumPortion::SwGrfNumPortion(
m_bReplace = false;
if( pGrfBrush )
{
- *pBrush = *pGrfBrush;
+ pBrush.reset(static_cast<SvxBrushItem*>(pGrfBrush->Clone()));
const Graphic* pGraph = pGrfBrush->GetGraphic();
if( pGraph )
SetAnimated( pGraph->IsAnimated() );
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index c044b4903112..ff94c1848b1b 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -3289,7 +3289,7 @@ SwTwips SwTextNode::GetAdditionalIndentForStartingNewList() const
}
// #i96772#
-void SwTextNode::ClearLRSpaceItemDueToListLevelIndents( SvxLRSpaceItem& o_rLRSpaceItem ) const
+void SwTextNode::ClearLRSpaceItemDueToListLevelIndents( std::shared_ptr<SvxLRSpaceItem>& o_rLRSpaceItem ) const
{
if ( AreListLevelIndentsApplicable() )
{
@@ -3299,8 +3299,7 @@ void SwTextNode::ClearLRSpaceItemDueToListLevelIndents( SvxLRSpaceItem& o_rLRSpa
const SwNumFormat& rFormat = pRule->Get(lcl_BoundListLevel(GetActualListLevel()));
if ( rFormat.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT )
{
- SvxLRSpaceItem aLR( RES_LR_SPACE );
- o_rLRSpaceItem = aLR;
+ o_rLRSpaceItem = std::make_shared<SvxLRSpaceItem>(RES_LR_SPACE);
}
}
}
diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx
index dc6db2ab7438..d5dfc5681fb6 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -355,7 +355,7 @@ bool BaseFrameProperties_Impl::FillBaseProperties(SfxItemSet& rToSet, const SfxI
if(bXFillStyleItemUsed)
{
XFillStyleItem aXFillStyleItem;
- SvxBrushItem aBrush(RES_BACKGROUND);
+ std::shared_ptr<SvxBrushItem> aBrush(std::make_shared<SvxBrushItem>(RES_BACKGROUND));
if(pXFillStyleItem)
{
@@ -379,10 +379,10 @@ bool BaseFrameProperties_Impl::FillBaseProperties(SfxItemSet& rToSet, const SfxI
// Fill style is set to solid, but no fill color is given.
// On the other hand, we have a BackColor, so use that.
if (pCol)
- aBrush.PutValue(*pCol, MID_BACK_COLOR);
+ aBrush->PutValue(*pCol, MID_BACK_COLOR);
else
- aBrush.PutValue(*pRGBCol, MID_BACK_COLOR_R_G_B);
- setSvxBrushItemAsFillAttributesToTargetSet(aBrush, rToSet);
+ aBrush->PutValue(*pRGBCol, MID_BACK_COLOR_R_G_B);
+ setSvxBrushItemAsFillAttributesToTargetSet(*aBrush, rToSet);
}
if(pXFillGradientItem || pXFillGradientNameItem)
@@ -490,8 +490,8 @@ bool BaseFrameProperties_Impl::FillBaseProperties(SfxItemSet& rToSet, const SfxI
}
if (aXFillStyleItem.GetValue() == drawing::FillStyle_SOLID)
{
- aBrush.PutValue(*pColTrans, MID_BACK_COLOR_TRANSPARENCY);
- setSvxBrushItemAsFillAttributesToTargetSet(aBrush, rToSet);
+ aBrush->PutValue(*pColTrans, MID_BACK_COLOR_TRANSPARENCY);
+ setSvxBrushItemAsFillAttributesToTargetSet(*aBrush, rToSet);
}
}
@@ -1767,14 +1767,14 @@ void SwXFrame::setPropertyValue(const OUString& rPropertyName, const ::uno::Any&
if(RES_BACKGROUND == pEntry->nWID)
{
const SwAttrSet& rSet = pFormat->GetAttrSet();
- const SvxBrushItem aOriginalBrushItem(getSvxBrushItemFromSourceSet(rSet, RES_BACKGROUND, true, pDoc->IsInXMLImport()));
- SvxBrushItem aChangedBrushItem(aOriginalBrushItem);
+ const std::shared_ptr<SvxBrushItem> aOriginalBrushItem(getSvxBrushItemFromSourceSet(rSet, RES_BACKGROUND, true, pDoc->IsInXMLImport()));
+ std::shared_ptr<SvxBrushItem> aChangedBrushItem(static_cast<SvxBrushItem*>(aOriginalBrushItem->Clone()));
- aChangedBrushItem.PutValue(aValue, nMemberId);
+ aChangedBrushItem->PutValue(aValue, nMemberId);
- if(aChangedBrushItem != aOriginalBrushItem)
+ if(*aChangedBrushItem != *aOriginalBrushItem)
{
- setSvxBrushItemAsFillAttributesToTargetSet(aChangedBrushItem, aSet);
+ setSvxBrushItemAsFillAttributesToTargetSet(*aChangedBrushItem, aSet);
pFormat->GetDoc()->SetFlyFrameAttr( *pFormat, aSet );
}
@@ -2217,9 +2217,9 @@ uno::Any SwXFrame::getPropertyValue(const OUString& rPropertyName)
if(RES_BACKGROUND == pEntry->nWID)
{
- const SvxBrushItem aOriginalBrushItem(getSvxBrushItemFromSourceSet(rSet, RES_BACKGROUND));
+ const std::shared_ptr<SvxBrushItem> aOriginalBrushItem(getSvxBrushItemFromSourceSet(rSet, RES_BACKGROUND));
- if(!aOriginalBrushItem.QueryValue(aAny, nMemberId))
+ if(!aOriginalBrushItem->QueryValue(aAny, nMemberId))
{
OSL_ENSURE(false, "Error getting attribute from RES_BACKGROUND (!)");
}
diff --git a/sw/source/core/unocore/unoparagraph.cxx b/sw/source/core/unocore/unoparagraph.cxx
index bf9abc3bf68c..2e1201675697 100644
--- a/sw/source/core/unocore/unoparagraph.cxx
+++ b/sw/source/core/unocore/unoparagraph.cxx
@@ -450,9 +450,9 @@ void SwXParagraph::Impl::GetSinglePropertyValue_Impl(
{
case RES_BACKGROUND:
{
- const SvxBrushItem aOriginalBrushItem(getSvxBrushItemFromSourceSet(rSet, RES_BACKGROUND));
+ const std::shared_ptr<SvxBrushItem> aOriginalBrushItem(getSvxBrushItemFromSourceSet(rSet, RES_BACKGROUND));
- if(!aOriginalBrushItem.QueryValue(rAny, rEntry.nMemberId))
+ if(!aOriginalBrushItem->QueryValue(rAny, rEntry.nMemberId))
{
OSL_ENSURE(false, "Error getting attribute from RES_BACKGROUND (!)");
}
diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx
index 2dfc44ef08c3..56f991b53364 100644
--- a/sw/source/core/unocore/unostyle.cxx
+++ b/sw/source/core/unocore/unostyle.cxx
@@ -1647,20 +1647,20 @@ template<>
void SwXStyle::SetPropertyValue<sal_uInt16(RES_BACKGROUND)>(const SfxItemPropertySimpleEntry& rEntry, const SfxItemPropertySet&, const uno::Any& rValue, SwStyleBase_Impl& o_rStyleBase)
{
SfxItemSet& rStyleSet = o_rStyleBase.GetItemSet();
- const SvxBrushItem aOriginalBrushItem(getSvxBrushItemFromSourceSet(rStyleSet, RES_BACKGROUND, true, m_pDoc->IsInXMLImport()));
- SvxBrushItem aChangedBrushItem(aOriginalBrushItem);
+ const std::shared_ptr<SvxBrushItem> aOriginalBrushItem(getSvxBrushItemFromSourceSet(rStyleSet, RES_BACKGROUND, true, m_pDoc->IsInXMLImport()));
+ std::shared_ptr<SvxBrushItem> aChangedBrushItem(static_cast<SvxBrushItem*>(aOriginalBrushItem->Clone()));
uno::Any aValue(rValue);
const auto nMemberId(lcl_TranslateMetric(rEntry, m_pDoc, aValue));
- aChangedBrushItem.PutValue(aValue, nMemberId);
+ aChangedBrushItem->PutValue(aValue, nMemberId);
// 0xff is already the default - but if BackTransparent is set
// to true, it must be applied in the item set on ODF import
// to potentially override parent style, which is unknown yet
- if(aChangedBrushItem == aOriginalBrushItem && (MID_GRAPHIC_TRANSPARENT != nMemberId || !aValue.has<bool>() || !aValue.get<bool>()))
+ if(*aChangedBrushItem == *aOriginalBrushItem && (MID_GRAPHIC_TRANSPARENT != nMemberId || !aValue.has<bool>() || !aValue.get<bool>()))
return;
- setSvxBrushItemAsFillAttributesToTargetSet(aChangedBrushItem, rStyleSet);
+ setSvxBrushItemAsFillAttributesToTargetSet(*aChangedBrushItem, rStyleSet);
}
template<>
void SwXStyle::SetPropertyValue<OWN_ATTR_FILLBMP_MODE>(const SfxItemPropertySimpleEntry&, const SfxItemPropertySet&, const uno::Any& rValue, SwStyleBase_Impl& o_rStyleBase)
@@ -2281,9 +2281,9 @@ uno::Any SwXStyle::GetStyleProperty<sal_uInt16(RES_BACKGROUND)>(const SfxItemPro
{
PrepareStyleBase(rBase);
const SfxItemSet& rSet = rBase.GetItemSet();
- const SvxBrushItem aOriginalBrushItem(getSvxBrushItemFromSourceSet(rSet, RES_BACKGROUND));
+ const std::shared_ptr<SvxBrushItem> aOriginalBrushItem(getSvxBrushItemFromSourceSet(rSet, RES_BACKGROUND));
uno::Any aResult;
- if(!aOriginalBrushItem.QueryValue(aResult, rEntry.nMemberId))
+ if(!aOriginalBrushItem->QueryValue(aResult, rEntry.nMemberId))
SAL_WARN("sw.uno", "error getting attribute from RES_BACKGROUND.");
return aResult;
}
@@ -2682,7 +2682,7 @@ void SAL_CALL SwXStyle::setAllPropertiesToDefault()
pPageFormat->SetFormatAttr(aLR);
pPageFormat->SetFormatAttr(aUL);
SwPageDesc* pStdPgDsc = m_pDoc->getIDocumentStylePoolAccess().GetPageDescFromPool(RES_POOLPAGE_STANDARD);
- SwFormatFrameSize aFrameSz(ATT_FIX_SIZE);
+ std::shared_ptr<SwFormatFrameSize> aFrameSz(std::make_shared<SwFormatFrameSize>(ATT_FIX_SIZE));
if(RES_POOLPAGE_STANDARD == rPageDesc.GetPoolFormatId())
{
@@ -2690,27 +2690,27 @@ void SAL_CALL SwXStyle::setAllPropertiesToDefault()
{
const Size aPhysSize( SvxPaperInfo::GetPaperSize(
static_cast<Printer*>(m_pDoc->getIDocumentDeviceAccess().getPrinter(false))));
- aFrameSz.SetSize(aPhysSize);
+ aFrameSz->SetSize(aPhysSize);
}
else
{
- aFrameSz.SetSize(SvxPaperInfo::GetDefaultPaperSize());
+ aFrameSz->SetSize(SvxPaperInfo::GetDefaultPaperSize());
}
}
else
{
- aFrameSz = pStdPgDsc->GetMaster().GetFrameSize();
+ aFrameSz.reset(static_cast<SwFormatFrameSize*>(pStdPgDsc->GetMaster().GetFrameSize().Clone()));
}
if(pStdPgDsc->GetLandscape())
{
- SwTwips nTmp = aFrameSz.GetHeight();
- aFrameSz.SetHeight(aFrameSz.GetWidth());
- aFrameSz.SetWidth(nTmp);
+ SwTwips nTmp = aFrameSz->GetHeight();
+ aFrameSz->SetHeight(aFrameSz->GetWidth());
+ aFrameSz->SetWidth(nTmp);
}
- pPageFormat->SetFormatAttr(aFrameSz);
+ pPageFormat->SetFormatAttr(*aFrameSz);
m_pDoc->ChgPageDesc(nPgDscPos, m_pDoc->GetPageDesc(nPgDscPos));
return;
}
@@ -3641,14 +3641,14 @@ uno::Reference< style::XAutoStyle > SwXAutoStyleFamily::insertStyle(
}
case RES_BACKGROUND:
{
- const SvxBrushItem aOriginalBrushItem(getSvxBrushItemFromSourceSet(aSet, RES_BACKGROUND, true, m_pDocShell->GetDoc()->IsInXMLImport()));
- SvxBrushItem aChangedBrushItem(aOriginalBrushItem);
+ const std::shared_ptr<SvxBrushItem> aOriginalBrushItem(getSvxBrushItemFromSourceSet(aSet, RES_BACKGROUND, true, m_pDocShell->GetDoc()->IsInXMLImport()));
+ std::shared_ptr<SvxBrushItem> aChangedBrushItem(static_cast<SvxBrushItem*>(aOriginalBrushItem->Clone()));
- aChangedBrushItem.PutValue(aValue, nMemberId);
+ aChangedBrushItem->PutValue(aValue, nMemberId);
- if(aChangedBrushItem != aOriginalBrushItem)
+ if(*aChangedBrushItem != *aOriginalBrushItem)
{
- setSvxBrushItemAsFillAttributesToTargetSet(aChangedBrushItem, aSet);
+ setSvxBrushItemAsFillAttributesToTargetSet(*aChangedBrushItem, aSet);
}
bDone = true;
@@ -3969,9 +3969,9 @@ uno::Sequence< uno::Any > SwXAutoStyle::GetPropertyValues_Impl(
{
case RES_BACKGROUND:
{
- const SvxBrushItem aOriginalBrushItem(getSvxBrushItemFromSourceSet(*mpSet, RES_BACKGROUND));
+ const std::shared_ptr<SvxBrushItem> aOriginalBrushItem(getSvxBrushItemFromSourceSet(*mpSet, RES_BACKGROUND));
- if(!aOriginalBrushItem.QueryValue(aTarget, pEntry->nMemberId))
+ if(!aOriginalBrushItem->QueryValue(aTarget, pEntry->nMemberId))
{
OSL_ENSURE(false, "Error getting attribute from RES_BACKGROUND (!)");
}
diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx
index 26f6dab13353..6843d98d75cd 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -1674,10 +1674,10 @@ void SwXTextTableCursor::setPropertyValue(const OUString& rPropertyName, const u
{
case FN_UNO_TABLE_CELL_BACKGROUND:
{
- SvxBrushItem aBrush(RES_BACKGROUND);
+ std::shared_ptr<SfxPoolItem> aBrush(std::make_shared<SvxBrushItem>(RES_BACKGROUND));
SwDoc::GetBoxAttr(rUnoCursor, aBrush);
- aBrush.PutValue(aValue, pEntry->nMemberId);
- pDoc->SetBoxAttr(rUnoCursor, aBrush);
+ aBrush->PutValue(aValue, pEntry->nMemberId);
+ pDoc->SetBoxAttr(rUnoCursor, *aBrush);
}
break;
@@ -1727,9 +1727,9 @@ uno::Any SwXTextTableCursor::getPropertyValue(const OUString& rPropertyName)
{
case FN_UNO_TABLE_CELL_BACKGROUND:
{
- SvxBrushItem aBrush(RES_BACKGROUND);
+ std::shared_ptr<SfxPoolItem> aBrush(std::make_shared<SvxBrushItem>(RES_BACKGROUND));
if (SwDoc::GetBoxAttr(rUnoCursor, aBrush))
- aBrush.QueryValue(aResult, pEntry->nMemberId);
+ aBrush->QueryValue(aResult, pEntry->nMemberId);
}
break;
case RES_BOXATR_FORMAT:
@@ -1814,8 +1814,8 @@ void SwTableProperties_Impl::AddItemToSet(SfxItemSet& rSet, std::function<Tpooli
{
Tpoolitem aItem = aItemFactory();
for(auto& aMemberAndAny : vMemberAndAny)
- aItem.PutValue(*aMemberAndAny.second, aMemberAndAny.first | (bAddTwips ? CONVERT_TWIPS : 0) );
- rSet.Put(aItem);
+ aItem->PutValue(*aMemberAndAny.second, aMemberAndAny.first | (bAddTwips ? CONVERT_TWIPS : 0) );
+ rSet.Put(*aItem);
}
}
void SwTableProperties_Impl::ApplyTableAttr(const SwTable& rTable, SwDoc& rDoc)
@@ -1837,7 +1837,7 @@ void SwTableProperties_Impl::ApplyTableAttr(const SwTable& rTable, SwDoc& rDoc)
const_cast<SwTable&>(rTable).SetRowsToRepeat( bVal ? 1 : 0 ); // TODO: MULTIHEADER
}
- AddItemToSet<SvxBrushItem>(aSet, [&rFrameFormat]() { return rFrameFormat.makeBackgroundBrushItem(); }, RES_BACKGROUND, {
+ AddItemToSet<std::shared_ptr<SvxBrushItem>>(aSet, [&rFrameFormat]() { return rFrameFormat.makeBackgroundBrushItem(); }, RES_BACKGROUND, {
MID_BACK_COLOR,
MID_GRAPHIC_TRANSPARENT,
MID_GRAPHIC_POSITION,
@@ -1869,10 +1869,10 @@ void SwTableProperties_Impl::ApplyTableAttr(const SwTable& rTable, SwDoc& rDoc)
}
if(bPutBreak)
- AddItemToSet<SvxFormatBreakItem>(aSet, [&rFrameFormat]() { return rFrameFormat.GetBreak(); }, RES_BREAK, {0});
- AddItemToSet<SvxShadowItem>(aSet, [&rFrameFormat]() { return rFrameFormat.GetShadow(); }, RES_SHADOW, {0}, true);
- AddItemToSet<SvxFormatKeepItem>(aSet, [&rFrameFormat]() { return rFrameFormat.GetKeep(); }, RES_KEEP, {0});
- AddItemToSet<SwFormatHoriOrient>(aSet, [&rFrameFormat]() { return rFrameFormat.GetHoriOrient(); }, RES_HORI_ORIENT, {MID_HORIORIENT_ORIENT}, true);
+ AddItemToSet<std::shared_ptr<SvxFormatBreakItem>>(aSet, [&rFrameFormat]() { return std::shared_ptr<SvxFormatBreakItem>(static_cast<SvxFormatBreakItem*>(rFrameFormat.GetBreak().Clone())); }, RES_BREAK, {0});
+ AddItemToSet<std::shared_ptr<SvxShadowItem>>(aSet, [&rFrameFormat]() { return std::shared_ptr<SvxShadowItem>(static_cast<SvxShadowItem*>(rFrameFormat.GetShadow().Clone())); }, RES_SHADOW, {0}, true);
+ AddItemToSet<std::shared_ptr<SvxFormatKeepItem>>(aSet, [&rFrameFormat]() { return std::shared_ptr<SvxFormatKeepItem>(static_cast<SvxFormatKeepItem*>(rFrameFormat.GetKeep().Clone())); }, RES_KEEP, {0});
+ AddItemToSet<std::shared_ptr<SwFormatHoriOrient>>(aSet, [&rFrameFormat]() { return std::shared_ptr<SwFormatHoriOrient>(static_cast<SwFormatHoriOrient*>(rFrameFormat.GetHoriOrient().Clone())); }, RES_HORI_ORIENT, {MID_HORIORIENT_ORIENT}, true);
const uno::Any* pSzRel(nullptr);
GetProperty(FN_TABLE_IS_RELATIVE_WIDTH, 0xff, pSzRel);
@@ -1899,10 +1899,10 @@ void SwTableProperties_Impl::ApplyTableAttr(const SwTable& rTable, SwDoc& rDoc)
aSz.SetWidth(MINLAY);
aSet.Put(aSz);
}
- AddItemToSet<SvxLRSpaceItem>(aSet, [&rFrameFormat]() { return rFrameFormat.GetLRSpace(); }, RES_LR_SPACE, {
+ AddItemToSet<std::shared_ptr<SvxLRSpaceItem>>(aSet, [&rFrameFormat]() { return std::shared_ptr<SvxLRSpaceItem>(static_cast<SvxLRSpaceItem*>(rFrameFormat.GetLRSpace().Clone())); }, RES_LR_SPACE, {
MID_L_MARGIN|CONVERT_TWIPS,
MID_R_MARGIN|CONVERT_TWIPS });
- AddItemToSet<SvxULSpaceItem>(aSet, [&rFrameFormat]() { return rFrameFormat.GetULSpace(); }, RES_UL_SPACE, {
+ AddItemToSet<std::shared_ptr<SvxULSpaceItem>>(aSet, [&rFrameFormat]() { return std::shared_ptr<SvxULSpaceItem>(static_cast<SvxULSpaceItem*>(rFrameFormat.GetULSpace().Clone())); }, RES_UL_SPACE, {
MID_UP_MARGIN|CONVERT_TWIPS,
MID_LO_MARGIN|CONVERT_TWIPS });
const::uno::Any* pSplit(nullptr);
@@ -3397,10 +3397,10 @@ SwXCellRange::setPropertyValue(const OUString& rPropertyName, const uno::Any& aV
{
case FN_UNO_TABLE_CELL_BACKGROUND:
{
- SvxBrushItem aBrush( RES_BACKGROUND );
+ std::shared_ptr<SfxPoolItem> aBrush(std::make_shared<SvxBrushItem>(RES_BACKGROUND));
SwDoc::GetBoxAttr(*m_pImpl->m_pTableCursor, aBrush);
- static_cast<SfxPoolItem&>(aBrush).PutValue(aValue, pEntry->nMemberId);
- pDoc->SetBoxAttr(*m_pImpl->m_pTableCursor, aBrush);
+ aBrush->PutValue(aValue, pEntry->nMemberId);
+ pDoc->SetBoxAttr(*m_pImpl->m_pTableCursor, *aBrush);
}
break;
@@ -3507,9 +3507,9 @@ uno::Any SAL_CALL SwXCellRange::getPropertyValue(const OUString& rPropertyName)
{
case FN_UNO_TABLE_CELL_BACKGROUND:
{
- SvxBrushItem aBrush( RES_BACKGROUND );
+ std::shared_ptr<SfxPoolItem> aBrush(std::make_shared<SvxBrushItem>(RES_BACKGROUND));
if (SwDoc::GetBoxAttr(*m_pImpl->m_pTableCursor, aBrush))
- aBrush.QueryValue(aRet, pEntry->nMemberId);
+ aBrush->QueryValue(aRet, pEntry->nMemberId);
}
break;
@@ -3546,10 +3546,10 @@ uno::Any SAL_CALL SwXCellRange::getPropertyValue(const OUString& rPropertyName)
break;
case RES_VERT_ORIENT:
{
- SwFormatVertOrient aVertOrient;
+ std::shared_ptr<SfxPoolItem> aVertOrient;
if (SwDoc::GetBoxAttr(*m_pImpl->m_pTableCursor, aVertOrient))
{
- aVertOrient.QueryValue( aRet, pEntry->nMemberId );
+ aVertOrient->QueryValue( aRet, pEntry->nMemberId );
}
}
break;
diff --git a/sw/source/filter/basflt/fltini.cxx b/sw/source/filter/basflt/fltini.cxx
index 18de2e807c64..3b6ce6e54469 100644
--- a/sw/source/filter/basflt/fltini.cxx
+++ b/sw/source/filter/basflt/fltini.cxx
@@ -308,9 +308,9 @@ void CalculateFlySize(SfxItemSet& rFlySet, const SwNodeIndex& rAnchor,
if( SfxItemState::SET != rFlySet.GetItemState( RES_FRM_SIZE, true, &pItem ) ||
MINFLY > static_cast<const SwFormatFrameSize*>(pItem)->GetWidth() )
{
- SwFormatFrameSize aSz(rFlySet.Get(RES_FRM_SIZE));
+ std::shared_ptr<SwFormatFrameSize> aSz(static_cast<SwFormatFrameSize*>(rFlySet.Get(RES_FRM_SIZE).Clone()));
if (pItem)
- aSz = static_cast<const SwFormatFrameSize&>(*pItem);
+ aSz.reset(static_cast<SwFormatFrameSize*>(pItem->Clone()));
SwTwips nWidth;
// determine the width; if there is a table use the width of the table;
@@ -397,16 +397,16 @@ void CalculateFlySize(SfxItemSet& rFlySet, const SwNodeIndex& rAnchor,
if( MINFLY > nWidth )
nWidth = MINFLY;
- aSz.SetWidth( nWidth );
- if( MINFLY > aSz.GetHeight() )
- aSz.SetHeight( MINFLY );
- rFlySet.Put( aSz );
+ aSz->SetWidth( nWidth );
+ if( MINFLY > aSz->GetHeight() )
+ aSz->SetHeight( MINFLY );
+ rFlySet.Put( *aSz );
}
else if( MINFLY > static_cast<const SwFormatFrameSize*>(pItem)->GetHeight() )
{
- SwFormatFrameSize aSz( *static_cast<const SwFormatFrameSize*>(pItem) );
- aSz.SetHeight( MINFLY );
- rFlySet.Put( aSz );
+ std::shared_ptr<SwFormatFrameSize> aSz(static_cast<SwFormatFrameSize*>(pItem->Clone()));
+ aSz->SetHeight( MINFLY );
+ rFlySet.Put( *aSz );
}
}
diff --git a/sw/source/filter/html/css1atr.cxx b/sw/source/filter/html/css1atr.cxx
index dd6f6564a4f6..53fe8ef3c76e 100644
--- a/sw/source/filter/html/css1atr.cxx
+++ b/sw/source/filter/html/css1atr.cxx
@@ -2153,7 +2153,7 @@ static bool OutCSS1_FrameFormatBrush( SwHTMLWriter& rWrt,
void SwHTMLWriter::OutCSS1_FrameFormatBackground( const SwFrameFormat& rFrameFormat )
{
// If the frame itself has a background, then export.
- if( OutCSS1_FrameFormatBrush( *this, rFrameFormat.makeBackgroundBrushItem() ) )
+ if( OutCSS1_FrameFormatBrush( *this, *rFrameFormat.makeBackgroundBrushItem() ) )
return;
// If the frame is not linked to a page, we use the background of the anchor.
@@ -2181,7 +2181,7 @@ void SwHTMLWriter::OutCSS1_FrameFormatBackground( const SwFrameFormat& rFrameFor
// If the box has a background, we take it.
if( OutCSS1_FrameFormatBrush( *this,
- pBox->GetFrameFormat()->makeBackgroundBrushItem() ) )
+ *pBox->GetFrameFormat()->makeBackgroundBrushItem() ) )
return;
// Otherwise we use that of the lines
@@ -2189,7 +2189,7 @@ void SwHTMLWriter::OutCSS1_FrameFormatBackground( const SwFrameFormat& rFrameFor
while( pLine )
{
if( OutCSS1_FrameFormatBrush( *this,
- pLine->GetFrameFormat()->makeBackgroundBrushItem() ) )
+ *pLine->GetFrameFormat()->makeBackgroundBrushItem() ) )
return;
pBox = pLine->GetUpper();
pLine = pBox ? pBox->GetUpper() : nullptr;
@@ -2197,7 +2197,7 @@ void SwHTMLWriter::OutCSS1_FrameFormatBackground( const SwFrameFormat& rFrameFor
// If there was none either, we use the background of the table.
if( OutCSS1_FrameFormatBrush( *this,
- pTableNd->GetTable().GetFrameFormat()->makeBackgroundBrushItem() ) )
+ *pTableNd->GetTable().GetFrameFormat()->makeBackgroundBrushItem() ) )
return;
}
@@ -2216,7 +2216,7 @@ void SwHTMLWriter::OutCSS1_FrameFormatBackground( const SwFrameFormat& rFrameFor
// the value of the Config.
OSL_ENSURE( m_pCurrPageDesc, "no page template found" );
if( !OutCSS1_FrameFormatBrush( *this,
- m_pCurrPageDesc->GetMaster().makeBackgroundBrushItem() ) )
+ *m_pCurrPageDesc->GetMaster().makeBackgroundBrushItem() ) )
{
Color aColor( COL_WHITE );
diff --git a/sw/source/filter/html/htmlcss1.cxx b/sw/source/filter/html/htmlcss1.cxx
index c08bd868b084..8ff8ab08d378 100644
--- a/sw/source/filter/html/htmlcss1.cxx
+++ b/sw/source/filter/html/htmlcss1.cxx
@@ -377,12 +377,12 @@ void SwCSS1Parser::SetTableTextColl( bool bHeader )
void SwCSS1Parser::SetPageDescAttrs( const SvxBrushItem *pBrush,
SfxItemSet *pItemSet2 )
{
- SvxBrushItem aBrushItem( RES_BACKGROUND );
- SvxBoxItem aBoxItem( RES_BOX );
- SvxFrameDirectionItem aFrameDirItem(SvxFrameDirection::Environment, RES_FRAMEDIR);
+ std::shared_ptr<SvxBrushItem> aBrushItem(std::make_shared<SvxBrushItem>(RES_BACKGROUND));
+ std::shared_ptr<SvxBoxItem> aBoxItem(std::make_shared<SvxBoxItem>(RES_BOX));
+ std::shared_ptr<SvxFrameDirectionItem> aFrameDirItem(std::make_shared<SvxFrameDirectionItem>(SvxFrameDirection::Environment, RES_FRAMEDIR));
bool bSetBrush = pBrush!=nullptr, bSetBox = false, bSetFrameDir = false;
if( pBrush )
- aBrushItem = *pBrush;
+ aBrushItem.reset(static_cast<SvxBrushItem*>(pBrush->Clone()));
if( pItemSet2 )
{
@@ -391,7 +391,7 @@ void SwCSS1Parser::SetPageDescAttrs( const SvxBrushItem *pBrush,
&pItem ) )
{
// set a background
- aBrushItem = *static_cast<const SvxBrushItem *>(pItem);
+ aBrushItem.reset(static_cast<SvxBrushItem*>(pItem->Clone()));
pItemSet2->ClearItem( RES_BACKGROUND );
bSetBrush = true;
}
@@ -399,7 +399,7 @@ void SwCSS1Parser::SetPageDescAttrs( const SvxBrushItem *pBrush,
if( SfxItemState::SET == pItemSet2->GetItemState( RES_BOX, false, &pItem ) )
{
// set a border
- aBoxItem = *static_cast<const SvxBoxItem *>(pItem);
+ aBoxItem.reset(static_cast<SvxBoxItem*>(pItem->Clone()));
pItemSet2->ClearItem( RES_BOX );
bSetBox = true;
}
@@ -407,7 +407,7 @@ void SwCSS1Parser::SetPageDescAttrs( const SvxBrushItem *pBrush,
if( SfxItemState::SET == pItemSet2->GetItemState( RES_FRAMEDIR, false, &pItem ) )
{
// set a frame
- aFrameDirItem = *static_cast< const SvxFrameDirectionItem *>( pItem );
+ aFrameDirItem.reset(static_cast<SvxFrameDirectionItem*>(pItem->Clone()));
pItemSet2->ClearItem( RES_FRAMEDIR );
bSetFrameDir = true;
}
@@ -425,11 +425,11 @@ void SwCSS1Parser::SetPageDescAttrs( const SvxBrushItem *pBrush,
SwPageDesc aNewPageDesc( *pPageDesc );
SwFrameFormat &rMaster = aNewPageDesc.GetMaster();
if( bSetBrush )
- rMaster.SetFormatAttr( aBrushItem );
+ rMaster.SetFormatAttr( *aBrushItem );
if( bSetBox )
- rMaster.SetFormatAttr( aBoxItem );
+ rMaster.SetFormatAttr( *aBoxItem );
if( bSetFrameDir )
- rMaster.SetFormatAttr( aFrameDirItem );
+ rMaster.SetFormatAttr( *aFrameDirItem );
ChgPageDesc( pPageDesc, aNewPageDesc );
}
@@ -546,7 +546,7 @@ void SwCSS1Parser::SetPageDescAttrs( const SwPageDesc *pPageDesc,
ChgPageDesc( pPageDesc, aNewPageDesc );
}
-SvxBrushItem SwCSS1Parser::makePageDescBackground() const
+std::shared_ptr<SvxBrushItem> SwCSS1Parser::makePageDescBackground() const
{
return m_pDoc->getIDocumentStylePoolAccess().GetPageDescFromPool( RES_POOLPAGE_HTML, false )
->GetMaster().makeBackgroundBrushItem();
diff --git a/sw/source/filter/html/htmlflywriter.cxx b/sw/source/filter/html/htmlflywriter.cxx
index 54051a63b8bf..6eca6c22fb7c 100644
--- a/sw/source/filter/html/htmlflywriter.cxx
+++ b/sw/source/filter/html/htmlflywriter.cxx
@@ -261,12 +261,15 @@ sal_uInt16 SwHTMLWriter::GuessFrameType( const SwFrameFormat& rFrameFormat,
}
if( bEmpty )
{
- SvxBrushItem aBrush = rFrameFormat.makeBackgroundBrushItem();
+ std::shared_ptr<SvxBrushItem> aBrush = rFrameFormat.makeBackgroundBrushItem();
/// background is not empty, if it has a background graphic
/// or its background color is not "no fill"/"auto fill".
- if( GPOS_NONE != aBrush.GetGraphicPos() ||
- aBrush.GetColor() != COL_TRANSPARENT )
+ if( aBrush &&
+ (GPOS_NONE != aBrush->GetGraphicPos() ||
+ aBrush->GetColor() != COL_TRANSPARENT ))
+ {
bEmpty = false;
+ }
}
if( bEmpty )
{
diff --git a/sw/source/filter/html/htmlgrin.cxx b/sw/source/filter/html/htmlgrin.cxx
index 605ba1dfea2b..b0c6fd24e66f 100644
--- a/sw/source/filter/html/htmlgrin.cxx
+++ b/sw/source/filter/html/htmlgrin.cxx
@@ -1003,23 +1003,23 @@ void SwHTMLParser::InsertBodyOptions()
// Prepare the items for the page style (background, frame)
// If BrushItem already set values must remain!
- SvxBrushItem aBrushItem( m_pCSS1Parser->makePageDescBackground() );
+ std::shared_ptr<SvxBrushItem> aBrushItem( m_pCSS1Parser->makePageDescBackground() );
bool bSetBrush = false;
if( bBGColor && !m_pCSS1Parser->IsBodyBGColorSet() )
{
// background colour from "BGCOLOR"
OUString aLink;
- if( !aBrushItem.GetGraphicLink().isEmpty() )
- aLink = aBrushItem.GetGraphicLink();
- SvxGraphicPosition ePos = aBrushItem.GetGraphicPos();
+ if( !aBrushItem->GetGraphicLink().isEmpty() )
+ aLink = aBrushItem->GetGraphicLink();
+ SvxGraphicPosition ePos = aBrushItem->GetGraphicPos();
- aBrushItem.SetColor( aBGColor );
+ aBrushItem->SetColor( aBGColor );
if( !aLink.isEmpty() )
{
- aBrushItem.SetGraphicLink( aLink );
- aBrushItem.SetGraphicPos( ePos );
+ aBrushItem->SetGraphicLink( aLink );
+ aBrushItem->SetGraphicPos( ePos );
}
bSetBrush = true;
m_pCSS1Parser->SetBodyBGColorSet();
@@ -1028,8 +1028,8 @@ void SwHTMLParser::InsertBodyOptions()
if( !aBackGround.isEmpty() && !m_pCSS1Parser->IsBodyBackgroundSet() )
{
// background graphic from "BACKGROUND"
- aBrushItem.SetGraphicLink( INetURLObject::GetAbsURL( m_sBaseURL, aBackGround ) );
- aBrushItem.SetGraphicPos( GPOS_TILED );
+ aBrushItem->SetGraphicLink( INetURLObject::GetAbsURL( m_sBaseURL, aBackGround ) );
+ aBrushItem->SetGraphicPos( GPOS_TILED );
bSetBrush = true;
m_pCSS1Parser->SetBodyBackgroundSet();
}
@@ -1043,7 +1043,7 @@ void SwHTMLParser::InsertBodyOptions()
// Some attributes have to set on the page style, in fact the ones
// which aren't inherited
- m_pCSS1Parser->SetPageDescAttrs( bSetBrush ? &aBrushItem : nullptr,
+ m_pCSS1Parser->SetPageDescAttrs( bSetBrush ? aBrushItem.get() : nullptr,
&aItemSet );
const SfxPoolItem *pItem;
@@ -1070,7 +1070,7 @@ void SwHTMLParser::InsertBodyOptions()
}
else if( bSetBrush )
{
- m_pCSS1Parser->SetPageDescAttrs( &aBrushItem );
+ m_pCSS1Parser->SetPageDescAttrs( aBrushItem.get() );
}
if( bLinkColor && !m_pCSS1Parser->IsBodyLinkSet() )
diff --git a/sw/source/filter/html/htmltabw.cxx b/sw/source/filter/html/htmltabw.cxx
index 66261bbbc1bf..44ea0cfefd61 100644
--- a/sw/source/filter/html/htmltabw.cxx
+++ b/sw/source/filter/html/htmltabw.cxx
@@ -135,13 +135,13 @@ bool SwHTMLWrtTable::HasTabBackground( const SwTableBox& rBox,
bool bRet = false;
if( rBox.GetSttNd() )
{
- SvxBrushItem aBrushItem =
+ std::shared_ptr<SvxBrushItem> aBrushItem =
rBox.GetFrameFormat()->makeBackgroundBrushItem();
/// The table box has a background, if its background color is not "no fill"/
/// "auto fill" or it has a background graphic.
- bRet = aBrushItem.GetColor() != COL_TRANSPARENT ||
- !aBrushItem.GetGraphicLink().isEmpty() || aBrushItem.GetGraphic();
+ bRet = aBrushItem && (aBrushItem->GetColor() != COL_TRANSPARENT ||
+ !aBrushItem->GetGraphicLink().isEmpty() || aBrushItem->GetGraphic());
}
else
{
@@ -166,11 +166,11 @@ bool SwHTMLWrtTable::HasTabBackground( const SwTableLine& rLine,
OSL_ENSURE( bTop || bBottom || bLeft || bRight,
"HasTabBackground: cannot be called" );
- SvxBrushItem aBrushItem = rLine.GetFrameFormat()->makeBackgroundBrushItem();
+ std::shared_ptr<SvxBrushItem> aBrushItem = rLine.GetFrameFormat()->makeBackgroundBrushItem();
/// The table line has a background, if its background color is not "no fill"/
/// "auto fill" or it has a background graphic.
- bool bRet = aBrushItem.GetColor() != COL_TRANSPARENT ||
- !aBrushItem.GetGraphicLink().isEmpty() || aBrushItem.GetGraphic();
+ bool bRet = aBrushItem && (aBrushItem->GetColor() != COL_TRANSPARENT ||
+ !aBrushItem->GetGraphicLink().isEmpty() || aBrushItem->GetGraphic());
if( !bRet )
{
diff --git a/sw/source/filter/html/svxcss1.cxx b/sw/source/filter/html/svxcss1.cxx
index 8f8491b015cd..11aba0a854c8 100644
--- a/sw/source/filter/html/svxcss1.cxx
+++ b/sw/source/filter/html/svxcss1.cxx
@@ -587,25 +587,25 @@ void SvxCSS1PropertyInfo::SetBoxItem( SfxItemSet& rItemSet,
if( !bChg )
return;
- SvxBoxItem aBoxItem( aItemIds.nBox );
+ std::shared_ptr<SvxBoxItem> aBoxItem(std::make_shared<SvxBoxItem>(aItemIds.nBox));
if( pDfltItem )
- aBoxItem = *pDfltItem;
+ aBoxItem.reset(static_cast<SvxBoxItem*>(pDfltItem->Clone()));
SvxCSS1BorderInfo *pInfo = GetBorderInfo( SvxBoxItemLine::TOP, false );
if( pInfo )
- pInfo->SetBorderLine( SvxBoxItemLine::TOP, aBoxItem );
+ pInfo->SetBorderLine( SvxBoxItemLine::TOP, *aBoxItem );
pInfo = GetBorderInfo( SvxBoxItemLine::BOTTOM, false );
if( pInfo )
- pInfo->SetBorderLine( SvxBoxItemLine::BOTTOM, aBoxItem );
+ pInfo->SetBorderLine( SvxBoxItemLine::BOTTOM, *aBoxItem );
pInfo = GetBorderInfo( SvxBoxItemLine::LEFT, false );
if( pInfo )
- pInfo->SetBorderLine( SvxBoxItemLine::LEFT, aBoxItem );
+ pInfo->SetBorderLine( SvxBoxItemLine::LEFT, *aBoxItem );
pInfo = GetBorderInfo( SvxBoxItemLine::RIGHT, false );
if( pInfo )
- pInfo->SetBorderLine( SvxBoxItemLine::RIGHT, aBoxItem );
+ pInfo->SetBorderLine( SvxBoxItemLine::RIGHT, *aBoxItem );
for( size_t i=0; i<m_aBorderInfos.size(); ++i )
{
@@ -631,10 +631,10 @@ void SvxCSS1PropertyInfo::SetBoxItem( SfxItemSet& rItemSet,
break;
}
- if( aBoxItem.GetLine( nLine ) )
+ if( aBoxItem->GetLine( nLine ) )
{
if( UNSET_BORDER_DISTANCE == nDist )
- nDist = aBoxItem.GetDistance( nLine );
+ nDist = aBoxItem->GetDistance( nLine );
if( nDist < nMinBorderDist )
nDist = nMinBorderDist;
@@ -644,10 +644,10 @@ void SvxCSS1PropertyInfo::SetBoxItem( SfxItemSet& rItemSet,
nDist = 0U;
}
- aBoxItem.SetDistance( nDist, nLine );
+ aBoxItem->SetDistance( nDist, nLine );
}
- rItemSet.Put( aBoxItem );
+ rItemSet.Put( *aBoxItem );
DestroyBorderInfos();
}
diff --git a/sw/source/filter/html/swcss1.hxx b/sw/source/filter/html/swcss1.hxx
index d99e9c696f68..b368bd1f068e 100644
--- a/sw/source/filter/html/swcss1.hxx
+++ b/sw/source/filter/html/swcss1.hxx
@@ -145,7 +145,7 @@ public:
void SetBodyLinkSet() { m_bBodyLinkSet = true; }
void SetBodyVLinkSet() { m_bBodyVLinkSet = true; }
- SvxBrushItem makePageDescBackground() const;
+ std::shared_ptr<SvxBrushItem> makePageDescBackground() const;
inline void SetTHTagStyles();
inline void SetTDTagStyles();
diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx
index 9f3a9d335b11..3a165f897102 100644
--- a/sw/source/filter/html/swhtml.cxx
+++ b/sw/source/filter/html/swhtml.cxx
@@ -5150,7 +5150,7 @@ void SwHTMLParser::InsertLineBreak()
}
// parse styles
- SvxFormatBreakItem aBreakItem( SvxBreak::NONE, RES_BREAK );
+ std::shared_ptr<SvxFormatBreakItem> aBreakItem(std::make_shared<SvxFormatBreakItem>(SvxBreak::NONE, RES_BREAK));
bool bBreakItem = false;
if( HasStyleOptions( aStyle, aId, aClass ) )
{
@@ -5161,7 +5161,7 @@ void SwHTMLParser::InsertLineBreak()
{
if( m_pCSS1Parser->SetFormatBreak( aItemSet, aPropInfo ) )
{
- aBreakItem = aItemSet.Get( RES_BREAK );
+ aBreakItem.reset(static_cast<SvxFormatBreakItem*>(aItemSet.Get(RES_BREAK).Clone()));
bBreakItem = true;
}
if( !aPropInfo.m_aId.isEmpty() )
@@ -5169,9 +5169,9 @@ void SwHTMLParser::InsertLineBreak()
}
}
- if( bBreakItem && SvxBreak::PageAfter==aBreakItem.GetBreak() )
+ if( bBreakItem && SvxBreak::PageAfter == aBreakItem->GetBreak() )
{
- NewAttr(m_xAttrTab, &m_xAttrTab->pBreak, aBreakItem);
+ NewAttr(m_xAttrTab, &m_xAttrTab->pBreak, *aBreakItem);
EndAttr( m_xAttrTab->pBreak, false );
}
@@ -5190,9 +5190,9 @@ void SwHTMLParser::InsertLineBreak()
// (>Netscape). That's why we don't do it.
AppendTextNode( AM_NOSPACE );
}
- if( bBreakItem && SvxBreak::PageBefore==aBreakItem.GetBreak() )
+ if( bBreakItem && SvxBreak::PageBefore == aBreakItem->GetBreak() )
{
- NewAttr(m_xAttrTab, &m_xAttrTab->pBreak, aBreakItem);
+ NewAttr(m_xAttrTab, &m_xAttrTab->pBreak, *aBreakItem);
EndAttr( m_xAttrTab->pBreak, false );
}
}
diff --git a/sw/source/filter/html/wrthtml.cxx b/sw/source/filter/html/wrthtml.cxx
index 3f72b20f696b..21acd5f6a2e4 100644
--- a/sw/source/filter/html/wrthtml.cxx
+++ b/sw/source/filter/html/wrthtml.cxx
@@ -1069,9 +1069,8 @@ const SwPageDesc *SwHTMLWriter::MakeHeader( sal_uInt16 &rHeaderAttrs )
const SfxItemSet& rItemSet = pPageDesc->GetMaster().GetAttrSet();
// fdo#86857 page styles now contain the XATTR_*, not RES_BACKGROUND
- SvxBrushItem const aBrushItem(
- getSvxBrushItemFromSourceSet(rItemSet, RES_BACKGROUND));
- OutBackground(&aBrushItem, true);
+ std::shared_ptr<SvxBrushItem> const aBrushItem(getSvxBrushItemFromSourceSet(rItemSet, RES_BACKGROUND));
+ OutBackground(aBrushItem.get(), true);
m_nDirection = GetHTMLDirection( rItemSet );
OutDirection( m_nDirection );
diff --git a/sw/source/filter/writer/wrt_fn.cxx b/sw/source/filter/writer/wrt_fn.cxx
index b0cbff4212f3..1debd24bd0c1 100644
--- a/sw/source/filter/writer/wrt_fn.cxx
+++ b/sw/source/filter/writer/wrt_fn.cxx
@@ -113,11 +113,11 @@ Writer& Out_SfxItemSet( const SwAttrFnTab pTab, Writer& rWrt,
// existing mechanisms.
// This is the right place in the future if the adapted fill attributes
// may be handled more directly in HTML export to handle them.
- const SvxBrushItem aSvxBrushItem = getSvxBrushItemFromSourceSet(*pSet, RES_BACKGROUND, bDeep);
+ const std::shared_ptr<SvxBrushItem> aSvxBrushItem(getSvxBrushItemFromSourceSet(*pSet, RES_BACKGROUND, bDeep));
if( nullptr != ( pOut = pTab[RES_BACKGROUND - RES_CHRATR_BEGIN] ))
{
- (*pOut)( rWrt, aSvxBrushItem );
+ (*pOut)( rWrt, *aSvxBrushItem );
}
}
diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx
index 7d4d4df1fb3d..501f632ff3f2 100644
--- a/sw/source/filter/ww8/docxexport.cxx
+++ b/sw/source/filter/ww8/docxexport.cxx
@@ -944,7 +944,7 @@ void DocxExport::WriteSettings()
}
// Display Background Shape
- if (boost::optional<SvxBrushItem> oBrush = getBackground())
+ if (std::shared_ptr<SvxBrushItem> oBrush = getBackground(); oBrush)
{
// Turn on the 'displayBackgroundShape'
pFS->singleElementNS(XML_w, XML_displayBackgroundShape);
@@ -1456,7 +1456,7 @@ void DocxExport::WriteMainText()
m_aLinkedTextboxesHelper.clear();
// Write background page color
- if (boost::optional<SvxBrushItem> oBrush = getBackground())
+ if (std::shared_ptr<SvxBrushItem> oBrush = getBackground(); oBrush)
{
Color backgroundColor = oBrush->GetColor();
OString aBackgroundColorStr = msfilter::util::ConvertColor(backgroundColor);
diff --git a/sw/source/filter/ww8/rtfexport.cxx b/sw/source/filter/ww8/rtfexport.cxx
index b2b06a77443b..2dbd38230402 100644
--- a/sw/source/filter/ww8/rtfexport.cxx
+++ b/sw/source/filter/ww8/rtfexport.cxx
@@ -419,7 +419,7 @@ void RtfExport::WriteMainText()
{
SAL_INFO("sw.rtf", OSL_THIS_FUNC << " start");
- if (boost::optional<SvxBrushItem> oBrush = getBackground())
+ if (std::shared_ptr<SvxBrushItem> oBrush = getBackground(); oBrush)
{
Strm().WriteCharPtr(LO_STRING_SVTOOLS_RTF_VIEWBKSP).WriteChar('1');
Strm().WriteCharPtr("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_BACKGROUND);
diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx
index f713a9c2de88..feacf1de6f9b 100644
--- a/sw/source/filter/ww8/wrtw8esh.cxx
+++ b/sw/source/filter/ww8/wrtw8esh.cxx
@@ -1608,11 +1608,11 @@ void SwBasicEscherEx::WriteGrfBullet(const Graphic& rGrf)
aPropOpt.AddOpt( ESCHER_Prop_dxTextLeft, 0 );
aPropOpt.AddOpt( ESCHER_Prop_dxTextRight, 0 );
const Color aTmpColor( COL_WHITE );
- SvxBrushItem aBrush( aTmpColor, RES_BACKGROUND );
- const SvxBrushItem *pRet = rWrt.GetCurrentPageBgBrush();
+ std::shared_ptr<SvxBrushItem> aBrush(std::make_shared<SvxBrushItem>(aTmpColor, RES_BACKGROUND));
+ const SvxBrushItem* pRet = rWrt.GetCurrentPageBgBrush();
if (pRet && (pRet->GetGraphic() ||( pRet->GetColor() != COL_TRANSPARENT)))
- aBrush = *pRet;
- WriteBrushAttr(aBrush, aPropOpt);
+ aBrush.reset(static_cast<SvxBrushItem*>(pRet->Clone()));
+ WriteBrushAttr(*aBrush, aPropOpt);
aPropOpt.AddOpt( ESCHER_Prop_pictureActive, 0 );
aPropOpt.Commit( GetStream() );
@@ -2080,13 +2080,21 @@ sal_Int32 SwBasicEscherEx::WriteFlyFrameAttr(const SwFrameFormat& rFormat,
if (bIsInHeader)
{
- SvxBrushItem aBrush(rFormat.makeBackgroundBrushItem());
- WriteBrushAttr(aBrush, rPropOpt);
+ std::shared_ptr<SvxBrushItem> aBrush(rFormat.makeBackgroundBrushItem());
+
+ if(aBrush)
+ {
+ WriteBrushAttr(*aBrush, rPropOpt);
+ }
}
else
{
- SvxBrushItem aBrush(rWrt.TrueFrameBgBrush(rFormat));
- WriteBrushAttr(aBrush, rPropOpt);
+ std::shared_ptr<SvxBrushItem> aBrush(rWrt.TrueFrameBgBrush(rFormat));
+
+ if(aBrush)
+ {
+ WriteBrushAttr(*aBrush, rPropOpt);
+ }
}
const SdrObject* pObj = rFormat.FindRealSdrObject();
diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx
index e89563655fd7..d08796457530 100644
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -1623,7 +1623,7 @@ const SvxBrushItem* WW8Export::GetCurrentPageBgBrush() const
return pRet;
}
-SvxBrushItem WW8Export::TrueFrameBgBrush(const SwFrameFormat &rFlyFormat) const
+std::shared_ptr<SvxBrushItem> WW8Export::TrueFrameBgBrush(const SwFrameFormat &rFlyFormat) const
{
const SwFrameFormat *pFlyFormat = &rFlyFormat;
const SvxBrushItem* pRet = nullptr;
@@ -1657,9 +1657,12 @@ SvxBrushItem WW8Export::TrueFrameBgBrush(const SwFrameFormat &rFlyFormat) const
pRet = GetCurrentPageBgBrush();
const Color aTmpColor( COL_WHITE );
- SvxBrushItem aRet( aTmpColor, RES_BACKGROUND );
+ std::shared_ptr<SvxBrushItem> aRet(std::make_shared<SvxBrushItem>(aTmpColor, RES_BACKGROUND));
+
if (pRet && (pRet->GetGraphic() ||( pRet->GetColor() != COL_TRANSPARENT)))
- aRet = *pRet;
+ {
+ aRet.reset(static_cast<SvxBrushItem*>(pRet->Clone()));
+ }
return aRet;
}
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index 07ba40b373fd..1ccca8f8eb78 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -1522,17 +1522,17 @@ void WW8Export::AppendBookmarkEndWithCorrection( const OUString& rName )
m_pBkmks->Append( nEndCP - 1, rName );
}
-boost::optional<SvxBrushItem> MSWordExportBase::getBackground()
+std::shared_ptr<SvxBrushItem> MSWordExportBase::getBackground()
{
- boost::optional<SvxBrushItem> oRet;
+ std::shared_ptr<SvxBrushItem> oRet;
const SwFrameFormat &rFormat = m_pDoc->GetPageDesc(0).GetMaster();
- SvxBrushItem aBrush(RES_BACKGROUND);
+ std::shared_ptr<SvxBrushItem> aBrush(std::make_shared<SvxBrushItem>(RES_BACKGROUND));
SfxItemState eState = rFormat.GetBackgroundState(aBrush);
if (SfxItemState::SET == eState)
{
// The 'color' is set for the first page style - take it and use it as the background color of the entire DOCX
- if (aBrush.GetColor() != COL_AUTO)
+ if (aBrush->GetColor() != COL_AUTO)
oRet = aBrush;
}
return oRet;
diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx
index c40b36a81bf8..1be70995ca50 100644
--- a/sw/source/filter/ww8/wrtww8.hxx
+++ b/sw/source/filter/ww8/wrtww8.hxx
@@ -878,7 +878,7 @@ protected:
void SetCurPam(sal_uLong nStt, sal_uLong nEnd);
/// Get background color of the document, if there is one.
- boost::optional<SvxBrushItem> getBackground();
+ std::shared_ptr<SvxBrushItem> getBackground();
/// Populates m_vecBulletPic with all the bullet graphics used by numberings.
int CollectGrfsOfBullets();
/// Write the numbering picture bullets.
@@ -1033,7 +1033,7 @@ public:
void WriteFootnoteBegin( const SwFormatFootnote& rFootnote, ww::bytes* pO = nullptr );
void WritePostItBegin( ww::bytes* pO = nullptr );
const SvxBrushItem* GetCurrentPageBgBrush() const;
- SvxBrushItem TrueFrameBgBrush(const SwFrameFormat &rFlyFormat) const;
+ std::shared_ptr<SvxBrushItem> TrueFrameBgBrush(const SwFrameFormat &rFlyFormat) const;
void AppendFlyInFlys(const ww8::Frame& rFrameFormat, const Point& rNdTopLeft);
void WriteOutliner(const OutlinerParaObject& rOutliner, sal_uInt8 nTyp);
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index 886ea9dbc904..710e3bf6e86e 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -310,7 +310,8 @@ void MSWordExportBase::OutputItemSet( const SfxItemSet& rSet, bool bPapFormat, b
if (pXFillStyleItem && pXFillStyleItem->GetValue() == drawing::FillStyle_SOLID && !rSet.HasItem(RES_BACKGROUND))
{
// Construct an SvxBrushItem, as expected by the exporters.
- AttrOutput().OutputItem(getSvxBrushItemFromSourceSet(rSet, RES_BACKGROUND));
+ std::shared_ptr<SvxBrushItem> aBrush(getSvxBrushItemFromSourceSet(rSet, RES_BACKGROUND));
+ AttrOutput().OutputItem(*aBrush);
}
}
m_pISet = nullptr; // for double attributes
@@ -853,7 +854,8 @@ void MSWordExportBase::OutputFormat( const SwFormat& rFormat, bool bPapFormat, b
case drawing::FillStyle_SOLID:
{
// Construct an SvxBrushItem, as expected by the exporters.
- aSet.Put(getSvxBrushItemFromSourceSet(rFrameFormat.GetAttrSet(), RES_BACKGROUND));
+ std::shared_ptr<SvxBrushItem> aBrush(getSvxBrushItemFromSourceSet(rFrameFormat.GetAttrSet(), RES_BACKGROUND));
+ aSet.Put(*aBrush);
break;
}
default:
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 060fcd09c6cb..bef9cc9cd8a3 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -1487,7 +1487,7 @@ const SfxPoolItem* SwWW8FltControlStack::GetFormatAttr(const SwPosition& rPos,
if (const SfxItemSet *pSet = pNd->GetpSwAttrSet())
eState = pSet->GetItemState(RES_LR_SPACE, false);
if (eState != SfxItemState::SET && rReader.m_nCurrentColl < rReader.m_vColl.size())
- pItem = &(rReader.m_vColl[rReader.m_nCurrentColl].maWordLR);
+ pItem = rReader.m_vColl[rReader.m_nCurrentColl].maWordLR.get();
}
/*
@@ -1660,7 +1660,7 @@ void SwWW8ImplReader::Read_Tab(sal_uInt16 , const sal_uInt8* pData, short nLen)
WW8_TBD const * pTyp = reinterpret_cast<WW8_TBD const *>(pData + 2*nDel + 2*nIns + 2); // Type Array
- SvxTabStopItem aAttr(0, 0, SvxTabAdjust::Default, RES_PARATR_TABSTOP);
+ std::shared_ptr<SvxTabStopItem> aAttr(std::make_shared<SvxTabStopItem>(0, 0, SvxTabAdjust::Default, RES_PARATR_TABSTOP));
const SwFormat * pSty = nullptr;
sal_uInt16 nTabBase;
@@ -1686,7 +1686,9 @@ void SwWW8ImplReader::Read_Tab(sal_uInt16 , const sal_uInt8* pData, short nLen)
bFound = pSty->GetAttrSet().GetItemState(RES_PARATR_TABSTOP, false,
&pTabs) == SfxItemState::SET;
if( bFound )
- aAttr = *static_cast<const SvxTabStopItem*>(pTabs);
+ {
+ aAttr.reset(static_cast<SvxTabStopItem*>(pTabs->Clone()));
+ }
else
{
sal_uInt16 nOldTabBase = nTabBase;
@@ -1719,9 +1721,9 @@ void SwWW8ImplReader::Read_Tab(sal_uInt16 , const sal_uInt8* pData, short nLen)
SvxTabStop aTabStop;
for (short i=0; i < nDel; ++i)
{
- sal_uInt16 nPos = aAttr.GetPos(SVBT16ToUInt16(pDel + i*2));
+ sal_uInt16 nPos = aAttr->GetPos(SVBT16ToUInt16(pDel + i*2));
if( nPos != SVX_TAB_NOTFOUND )
- aAttr.Remove( nPos );
+ aAttr->Remove( nPos );
}
for (short i=0; i < nIns; ++i)
@@ -1763,14 +1765,14 @@ void SwWW8ImplReader::Read_Tab(sal_uInt16 , const sal_uInt8* pData, short nLen)
break;
}
- sal_uInt16 nPos2 = aAttr.GetPos( nPos );
+ sal_uInt16 nPos2 = aAttr->GetPos( nPos );
if (nPos2 != SVX_TAB_NOTFOUND)
- aAttr.Remove(nPos2); // Or else Insert() refuses
- aAttr.Insert(aTabStop);
+ aAttr->Remove(nPos2); // Or else Insert() refuses
+ aAttr->Insert(aTabStop);
}
if (nIns || nDel)
- NewAttr(aAttr);
+ NewAttr(*aAttr);
else
{
// Here we have a tab definition which inserts no extra tabs, or deletes
diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx
index 33b0a9349141..f7be682a8d1c 100644
--- a/sw/source/filter/ww8/ww8par.hxx
+++ b/sw/source/filter/ww8/ww8par.hxx
@@ -239,7 +239,7 @@ public:
sal_uInt16 m_n81Flags; // for bold, italic, ...
sal_uInt16 m_n81BiDiFlags; // for bold, italic, ...
- SvxLRSpaceItem maWordLR;
+ std::shared_ptr<SvxLRSpaceItem> maWordLR;
bool m_bValid; // empty of valid
bool m_bImported; // for recursive imports
bool m_bColl; // true-> pFormat is SwTextFormatColl
@@ -271,7 +271,7 @@ public:
mnWW8OutlineLevel( MAXLEVEL ),
m_n81Flags( 0 ),
m_n81BiDiFlags(0),
- maWordLR( RES_LR_SPACE ),
+ maWordLR(std::make_shared<SvxLRSpaceItem>(RES_LR_SPACE)),
m_bValid(false),
m_bImported(false),
m_bColl(false),
diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx
index 829011373542..f28a076da3b1 100644
--- a/sw/source/filter/ww8/ww8par3.cxx
+++ b/sw/source/filter/ww8/ww8par3.cxx
@@ -1757,8 +1757,7 @@ void SwWW8ImplReader::RegisterNumFormatOnStyle(sal_uInt16 nStyle)
if (rStyleInf.m_bValid && rStyleInf.m_pFormat)
{
//Save old pre-list modified indent, which are the word indent values
- rStyleInf.maWordLR =
- ItemGet<SvxLRSpaceItem>(*rStyleInf.m_pFormat, RES_LR_SPACE);
+ rStyleInf.maWordLR.reset(static_cast<SvxLRSpaceItem*>(ItemGet<SvxLRSpaceItem>(*rStyleInf.m_pFormat, RES_LR_SPACE).Clone()));
// Phase 2: refresh StyleDef after reading all Lists
SwNumRule* pNmRule = nullptr;
@@ -1991,19 +1990,19 @@ void SwWW8ImplReader::Read_LFOPosition(sal_uInt16, const sal_uInt8* pData,
pTextNode->SetAttr( aEmptyRule );
// create an empty SvxLRSpaceItem
- SvxLRSpaceItem aLR( RES_LR_SPACE );
+ std::shared_ptr<SvxLRSpaceItem> aLR(std::make_shared<SvxLRSpaceItem>(RES_LR_SPACE));
// replace it with the one of the current node if it exist
const SfxPoolItem* pLR = GetFormatAttr(RES_LR_SPACE);
if( pLR )
- aLR = *static_cast<const SvxLRSpaceItem*>(pLR);
+ aLR.reset(static_cast<SvxLRSpaceItem*>(pLR->Clone()));
// reset/blank the left indent (and only the left)
- aLR.SetTextLeft(0);
- aLR.SetTextFirstLineOfst(0);
+ aLR->SetTextLeft(0);
+ aLR->SetTextFirstLineOfst(0);
// apply the modified SvxLRSpaceItem to the current paragraph
- pTextNode->SetAttr( aLR );
+ pTextNode->SetAttr( *aLR );
}
m_nLFOPosition = USHRT_MAX;
diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx
index f95859e553a5..bcb276246418 100644
--- a/sw/source/filter/ww8/ww8par6.cxx
+++ b/sw/source/filter/ww8/ww8par6.cxx
@@ -4139,10 +4139,10 @@ void SwWW8ImplReader::Read_LR( sal_uInt16 nId, const sal_uInt8* pData, short nLe
short nPara = SVBT16ToUInt16( pData );
- SvxLRSpaceItem aLR( RES_LR_SPACE );
+ std::shared_ptr<SvxLRSpaceItem> aLR(std::make_shared<SvxLRSpaceItem>(RES_LR_SPACE));
const SfxPoolItem* pLR = GetFormatAttr(RES_LR_SPACE);
if( pLR )
- aLR = *static_cast<const SvxLRSpaceItem*>(pLR);
+ aLR.reset(static_cast<SvxLRSpaceItem*>(pLR->Clone()));
// Fix the regression issue: #i99822#: Discussion?
// Since the list level formatting doesn't apply into paragraph style
@@ -4159,10 +4159,10 @@ void SwWW8ImplReader::Read_LR( sal_uInt16 nId, const sal_uInt8* pData, short nLe
const SwNumFormat* pFormat = pNumRule->GetNumFormat( nLvl );
if ( pFormat && pFormat->GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT )
{
- aLR.SetTextLeft( pFormat->GetIndentAt() );
- aLR.SetTextFirstLineOfst( static_cast<short>(pFormat->GetFirstLineIndent()) );
+ aLR->SetTextLeft( pFormat->GetIndentAt() );
+ aLR->SetTextFirstLineOfst( static_cast<short>(pFormat->GetFirstLineIndent()) );
// make paragraph have hard-set indent attributes
- pTextNode->SetAttr( aLR );
+ pTextNode->SetAttr( *aLR );
}
}
}
@@ -4202,7 +4202,7 @@ void SwWW8ImplReader::Read_LR( sal_uInt16 nId, const sal_uInt8* pData, short nLe
case NS_sprm::v6::sprmPDxaLeft:
case NS_sprm::sprmPDxaLeft80:
case NS_sprm::sprmPDxaLeft:
- aLR.SetTextLeft( nPara );
+ aLR->SetTextLeft( nPara );
if (m_pCurrentColl && m_nCurrentColl < m_vColl.size())
{
m_vColl[m_nCurrentColl].m_bListReleventIndentSet = true;
@@ -4236,7 +4236,7 @@ void SwWW8ImplReader::Read_LR( sal_uInt16 nId, const sal_uInt8* pData, short nLe
}
}
- aLR.SetTextFirstLineOfst(nPara);
+ aLR->SetTextFirstLineOfst(nPara);
if (!m_pCurrentColl)
{
@@ -4246,7 +4246,7 @@ void SwWW8ImplReader::Read_LR( sal_uInt16 nId, const sal_uInt8* pData, short nLe
{
if (!lcl_HasExplicitLeft(m_xPlcxMan.get(), m_bVer67))
{
- aLR.SetTextLeft(pNumFormat->GetIndentAt());
+ aLR->SetTextLeft(pNumFormat->GetIndentAt());
// If have not explicit left, set number format list tab position is doc default tab
const SvxTabStopItem *pDefaultStopItem = m_rDoc.GetAttrPool().GetPoolDefaultItem(RES_PARATR_TABSTOP);
@@ -4266,13 +4266,13 @@ void SwWW8ImplReader::Read_LR( sal_uInt16 nId, const sal_uInt8* pData, short nLe
case NS_sprm::v6::sprmPDxaRight:
case NS_sprm::sprmPDxaRight80:
case NS_sprm::sprmPDxaRight:
- aLR.SetRight( nPara );
+ aLR->SetRight( nPara );
break;
default:
return;
}
- NewAttr( aLR, bFirstLinOfstSet, bLeftIndentSet ); // #i103711#, #i105414#
+ NewAttr( *aLR, bFirstLinOfstSet, bLeftIndentSet ); // #i103711#, #i105414#
}
// Sprm 20
@@ -4982,29 +4982,29 @@ void SwWW8ImplReader::Read_Border(sal_uInt16 , const sal_uInt8*, short nLen)
// otherwise it's not possible to turn of the style attribute hard.
const SvxBoxItem* pBox
= static_cast<const SvxBoxItem*>(GetFormatAttr( RES_BOX ));
- SvxBoxItem aBox(RES_BOX);
+ std::shared_ptr<SvxBoxItem> aBox(std::make_shared<SvxBoxItem>(RES_BOX));
if (pBox)
- aBox = *pBox;
+ aBox.reset(static_cast<SvxBoxItem*>(pBox->Clone()));
short aSizeArray[5]={0};
- SetBorder(aBox, aBrcs, &aSizeArray[0], nBorder);
+ SetBorder(*aBox, aBrcs, &aSizeArray[0], nBorder);
tools::Rectangle aInnerDist;
GetBorderDistance( aBrcs, aInnerDist );
if (nBorder & (1 << WW8_LEFT))
- aBox.SetDistance( static_cast<sal_uInt16>(aInnerDist.Left()), SvxBoxItemLine::LEFT );
+ aBox->SetDistance( static_cast<sal_uInt16>(aInnerDist.Left()), SvxBoxItemLine::LEFT );
if (nBorder & (1 << WW8_TOP))
- aBox.SetDistance( static_cast<sal_uInt16>(aInnerDist.Top()), SvxBoxItemLine::TOP );
+ aBox->SetDistance( static_cast<sal_uInt16>(aInnerDist.Top()), SvxBoxItemLine::TOP );
if (nBorder & (1 << WW8_RIGHT))
- aBox.SetDistance( static_cast<sal_uInt16>(aInnerDist.Right()), SvxBoxItemLine::RIGHT );
+ aBox->SetDistance( static_cast<sal_uInt16>(aInnerDist.Right()), SvxBoxItemLine::RIGHT );
if (nBorder & (1 << WW8_BOT))
- aBox.SetDistance( static_cast<sal_uInt16>(aInnerDist.Bottom()), SvxBoxItemLine::BOTTOM );
+ aBox->SetDistance( static_cast<sal_uInt16>(aInnerDist.Bottom()), SvxBoxItemLine::BOTTOM );
- NewAttr( aBox );
+ NewAttr( *aBox );
SvxShadowItem aS(RES_SHADOW);
if( SetShadow( aS, &aSizeArray[0], aBrcs[WW8_RIGHT] ) )
@@ -5031,8 +5031,7 @@ void SwWW8ImplReader::Read_CharBorder(sal_uInt16 nId, const sal_uInt8* pData, sh
= static_cast<const SvxBoxItem*>(GetFormatAttr( RES_CHRATR_BOX ));
if( pBox )
{
- SvxBoxItem aBoxItem(RES_CHRATR_BOX);
- aBoxItem = *pBox;
+ std::shared_ptr<SvxBoxItem> aBoxItem(static_cast<SvxBoxItem*>(pBox->Clone()));
WW8_BRCVer9 aBrc;
int nBrcVer = (nId == NS_sprm::sprmCBrc) ? 9 : (m_bVer67 ? 6 : 8);
@@ -5041,11 +5040,11 @@ void SwWW8ImplReader::Read_CharBorder(sal_uInt16 nId, const sal_uInt8* pData, sh
// Border style is none -> no border, no shadow
if( editeng::ConvertBorderStyleFromWord(aBrc.brcType()) != SvxBorderLineStyle::NONE )
{
- Set1Border(aBoxItem, aBrc, SvxBoxItemLine::TOP, 0, nullptr, true);
- Set1Border(aBoxItem, aBrc, SvxBoxItemLine::BOTTOM, 0, nullptr, true);
- Set1Border(aBoxItem, aBrc, SvxBoxItemLine::LEFT, 0, nullptr, true);
- Set1Border(aBoxItem, aBrc, SvxBoxItemLine::RIGHT, 0, nullptr, true);
- NewAttr( aBoxItem );
+ Set1Border(*aBoxItem, aBrc, SvxBoxItemLine::TOP, 0, nullptr, true);
+ Set1Border(*aBoxItem, aBrc, SvxBoxItemLine::BOTTOM, 0, nullptr, true);
+ Set1Border(*aBoxItem, aBrc, SvxBoxItemLine::LEFT, 0, nullptr, true);
+ Set1Border(*aBoxItem, aBrc, SvxBoxItemLine::RIGHT, 0, nullptr, true);
+ NewAttr( *aBoxItem );
short aSizeArray[WW8_RIGHT+1]={0}; aSizeArray[WW8_RIGHT] = 1;
SvxShadowItem aShadowItem(RES_CHRATR_SHADOW);
diff --git a/sw/source/ui/dialog/uiregionsw.cxx b/sw/source/ui/dialog/uiregionsw.cxx
index 8d5fcc9013c4..1dff89e08cb1 100644
--- a/sw/source/ui/dialog/uiregionsw.cxx
+++ b/sw/source/ui/dialog/uiregionsw.cxx
@@ -146,12 +146,12 @@ class SectRepr
private:
SwSectionData m_SectionData;
SwFormatCol m_Col;
- SvxBrushItem m_Brush;
+ std::shared_ptr<SvxBrushItem> m_Brush;
SwFormatFootnoteAtTextEnd m_FootnoteNtAtEnd;
SwFormatEndAtTextEnd m_EndNtAtEnd;
SwFormatNoBalancedColumns m_Balance;
- SvxFrameDirectionItem m_FrameDirItem;
- SvxLRSpaceItem m_LRSpaceItem;
+ std::shared_ptr<SvxFrameDirectionItem> m_FrameDirItem;
+ std::shared_ptr<SvxLRSpaceItem> m_LRSpaceItem;
const size_t m_nArrPos;
// shows, if maybe textcontent is in the region
bool m_bContent : 1;
@@ -164,12 +164,12 @@ public:
SwSectionData & GetSectionData() { return m_SectionData; }
SwFormatCol& GetCol() { return m_Col; }
- SvxBrushItem& GetBackground() { return m_Brush; }
+ std::shared_ptr<SvxBrushItem>& GetBackground() { return m_Brush; }
SwFormatFootnoteAtTextEnd& GetFootnoteNtAtEnd() { return m_FootnoteNtAtEnd; }
SwFormatEndAtTextEnd& GetEndNtAtEnd() { return m_EndNtAtEnd; }
SwFormatNoBalancedColumns& GetBalance() { return m_Balance; }
- SvxFrameDirectionItem& GetFrameDir() { return m_FrameDirItem; }
- SvxLRSpaceItem& GetLRSpace() { return m_LRSpaceItem; }
+ std::shared_ptr<SvxFrameDirectionItem>& GetFrameDir() { return m_FrameDirItem; }
+ std::shared_ptr<SvxLRSpaceItem>& GetLRSpace() { return m_LRSpaceItem; }
size_t GetArrPos() const { return m_nArrPos; }
OUString GetFile() const;
@@ -191,9 +191,9 @@ public:
SectRepr::SectRepr( size_t nPos, SwSection& rSect )
: m_SectionData( rSect )
- , m_Brush( RES_BACKGROUND )
- , m_FrameDirItem( SvxFrameDirection::Environment, RES_FRAMEDIR )
- , m_LRSpaceItem( RES_LR_SPACE )
+ , m_Brush(std::make_shared<SvxBrushItem>(RES_BACKGROUND))
+ , m_FrameDirItem(std::make_shared<SvxFrameDirectionItem>(SvxFrameDirection::Environment, RES_FRAMEDIR))
+ , m_LRSpaceItem(std::make_shared<SvxLRSpaceItem>(RES_LR_SPACE))
, m_nArrPos(nPos)
, m_bContent(m_SectionData.GetLinkFileName().isEmpty())
, m_bSelected(false)
@@ -206,8 +206,8 @@ SectRepr::SectRepr( size_t nPos, SwSection& rSect )
m_FootnoteNtAtEnd = pFormat->GetFootnoteAtTextEnd();
m_EndNtAtEnd = pFormat->GetEndAtTextEnd();
m_Balance.SetValue(pFormat->GetBalancedColumns().GetValue());
- m_FrameDirItem = pFormat->GetFrameDir();
- m_LRSpaceItem = pFormat->GetLRSpace();
+ m_FrameDirItem.reset(static_cast<SvxFrameDirectionItem*>(pFormat->GetFrameDir().Clone()));
+ m_LRSpaceItem.reset(static_cast<SvxLRSpaceItem*>(pFormat->GetLRSpace().Clone()));
}
}
@@ -779,9 +779,9 @@ IMPL_LINK_NOARG(SwEditRegionDlg, OkHdl, weld::Button&, void)
if( pFormat->GetCol() != pRepr->GetCol() )
pSet->Put( pRepr->GetCol() );
- SvxBrushItem aBrush(pFormat->makeBackgroundBrushItem(false));
- if( aBrush != pRepr->GetBackground() )
- pSet->Put( pRepr->GetBackground() );
+ std::shared_ptr<SvxBrushItem> aBrush(pFormat->makeBackgroundBrushItem(false));
+ if( aBrush != pRepr->GetBackground() || (aBrush && pRepr->GetBackground() && *aBrush != *pRepr->GetBackground()))
+ pSet->Put( *pRepr->GetBackground() );
if( pFormat->GetFootnoteAtTextEnd(false) != pRepr->GetFootnoteNtAtEnd() )
pSet->Put( pRepr->GetFootnoteNtAtEnd() );
@@ -792,11 +792,11 @@ IMPL_LINK_NOARG(SwEditRegionDlg, OkHdl, weld::Button&, void)
if( pFormat->GetBalancedColumns() != pRepr->GetBalance() )
pSet->Put( pRepr->GetBalance() );
- if( pFormat->GetFrameDir() != pRepr->GetFrameDir() )
- pSet->Put( pRepr->GetFrameDir() );
+ if( pFormat->GetFrameDir() != *pRepr->GetFrameDir() )
+ pSet->Put( *pRepr->GetFrameDir() );
- if( pFormat->GetLRSpace() != pRepr->GetLRSpace())
- pSet->Put( pRepr->GetLRSpace());
+ if( pFormat->GetLRSpace() != *pRepr->GetLRSpace())
+ pSet->Put( *pRepr->GetLRSpace());
rSh.UpdateSection( nNewPos, pRepr->GetSectionData(),
pSet->Count() ? pSet.get() : nullptr );
@@ -1029,12 +1029,12 @@ IMPL_LINK_NOARG(SwEditRegionDlg, OptionsHdl, weld::Button&, void)
SID_ATTR_PAGE_SIZE, SID_ATTR_PAGE_SIZE>{});
aSet.Put( pSectRepr->GetCol() );
- aSet.Put( pSectRepr->GetBackground() );
+ aSet.Put( *pSectRepr->GetBackground() );
aSet.Put( pSectRepr->GetFootnoteNtAtEnd() );
aSet.Put( pSectRepr->GetEndNtAtEnd() );
aSet.Put( pSectRepr->GetBalance() );
- aSet.Put( pSectRepr->GetFrameDir() );
- aSet.Put( pSectRepr->GetLRSpace() );
+ aSet.Put( *pSectRepr->GetFrameDir() );
+ aSet.Put( *pSectRepr->GetLRSpace() );
const SwSectionFormats& rDocFormats = rSh.GetDoc()->GetSections();
SwSectionFormats aOrigArray(rDocFormats);
@@ -1085,7 +1085,7 @@ IMPL_LINK_NOARG(SwEditRegionDlg, OptionsHdl, weld::Button&, void)
if( SfxItemState::SET == eColState )
pRepr->GetCol() = *static_cast<const SwFormatCol*>(pColItem);
if( SfxItemState::SET == eBrushState )
- pRepr->GetBackground() = *static_cast<const SvxBrushItem*>(pBrushItem);
+ pRepr->GetBackground().reset(static_cast<SvxBrushItem*>(pBrushItem->Clone()));
if( SfxItemState::SET == eFootnoteState )
pRepr->GetFootnoteNtAtEnd() = *static_cast<const SwFormatFootnoteAtTextEnd*>(pFootnoteItem);
if( SfxItemState::SET == eEndState )
@@ -1093,9 +1093,9 @@ IMPL_LINK_NOARG(SwEditRegionDlg, OptionsHdl, weld::Button&, void)
if( SfxItemState::SET == eBalanceState )
pRepr->GetBalance().SetValue(static_cast<const SwFormatNoBalancedColumns*>(pBalanceItem)->GetValue());
if( SfxItemState::SET == eFrameDirState )
- pRepr->GetFrameDir().SetValue(static_cast<const SvxFrameDirectionItem*>(pFrameDirItem)->GetValue());
+ pRepr->GetFrameDir()->SetValue(static_cast<const SvxFrameDirectionItem*>(pFrameDirItem)->GetValue());
if( SfxItemState::SET == eLRState )
- pRepr->GetLRSpace() = *static_cast<const SvxLRSpaceItem*>(pLRSpaceItem);
+ pRepr->GetLRSpace().reset(static_cast<SvxLRSpaceItem*>(pLRSpaceItem->Clone()));
return false;
});
}
diff --git a/sw/source/ui/frmdlg/wrap.cxx b/sw/source/ui/frmdlg/wrap.cxx
index 1ca392a35e07..c02e9426671b 100644
--- a/sw/source/ui/frmdlg/wrap.cxx
+++ b/sw/source/ui/frmdlg/wrap.cxx
@@ -258,13 +258,12 @@ bool SwWrapTabPage::FillItemSet(SfxItemSet *rSet)
const SwFormatSurround& rOldSur = GetItemSet().Get(RES_SURROUND);
SwFormatSurround aSur( rOldSur );
- SvxOpaqueItem aOp( RES_OPAQUE);
+ std::shared_ptr<SvxOpaqueItem> aOp(std::make_shared<SvxOpaqueItem>(RES_OPAQUE));
if (!m_bDrawMode)
{
- const SvxOpaqueItem& rOpaque = GetItemSet().Get(RES_OPAQUE);
- aOp = rOpaque;
- aOp.SetValue(true);
+ aOp.reset(static_cast<SvxOpaqueItem*>(GetItemSet().Get(RES_OPAQUE).Clone()));
+ aOp->SetValue(true);
}
if (m_xNoWrapRB->get_active())
@@ -279,7 +278,7 @@ bool SwWrapTabPage::FillItemSet(SfxItemSet *rSet)
{
aSur.SetSurround(css::text::WrapTextMode_THROUGH);
if (m_xWrapTransparentCB->get_active() && !m_bDrawMode)
- aOp.SetValue(false);
+ aOp->SetValue(false);
}
else if (m_xIdealWrapRB->get_active())
aSur.SetSurround(css::text::WrapTextMode_DYNAMIC);
@@ -301,9 +300,9 @@ bool SwWrapTabPage::FillItemSet(SfxItemSet *rSet)
if (!m_bDrawMode)
{
if(nullptr == (pOldItem = GetOldItem( *rSet, FN_OPAQUE )) ||
- aOp != *pOldItem )
+ *aOp != *pOldItem )
{
- rSet->Put(aOp);
+ rSet->Put(*aOp);
bModified = true;
}
}
diff --git a/sw/source/uibase/app/apphdl.cxx b/sw/source/uibase/app/apphdl.cxx
index 9e52c5b00b29..2830fa1a726c 100644
--- a/sw/source/uibase/app/apphdl.cxx
+++ b/sw/source/uibase/app/apphdl.cxx
@@ -309,7 +309,7 @@ SwView* lcl_LoadDoc(SwView* pView, const OUString& rURL)
if(!rURL.isEmpty())
{
SfxStringItem aURL(SID_FILE_NAME, rURL);
- SfxStringItem aTargetFrameName( SID_TARGETNAME, OUString("_blank") );
+ SfxStringItem aTargetFrameName( SID_TARGETNAME, "_blank" );
SfxBoolItem aHidden( SID_HIDDEN, true );
SfxStringItem aReferer(SID_REFERER, pView->GetDocShell()->GetTitle());
const SfxObjectItem* pItem = static_cast<const SfxObjectItem*>(
diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx
index 0819b4022553..2139a02a5240 100644
--- a/sw/source/uibase/app/docsh2.cxx
+++ b/sw/source/uibase/app/docsh2.cxx
@@ -1210,8 +1210,8 @@ void SwDocShell::Execute(SfxRequest& rReq)
// Ok. I did my best.
break;
- SfxStringItem aApp(SID_DOC_SERVICE, OUString("com.sun.star.text.TextDocument"));
- SfxStringItem aTarget(SID_TARGETNAME, OUString("_blank"));
+ SfxStringItem aApp(SID_DOC_SERVICE, "com.sun.star.text.TextDocument");
+ SfxStringItem aTarget(SID_TARGETNAME, "_blank");
pViewShell->GetDispatcher()->ExecuteList(SID_OPENDOC,
SfxCallMode::API|SfxCallMode::SYNCHRON,
{ &aApp, &aTarget });
diff --git a/sw/source/uibase/docvw/romenu.cxx b/sw/source/uibase/docvw/romenu.cxx
index 1b8c671ba411..185ff672d42f 100644
--- a/sw/source/uibase/docvw/romenu.cxx
+++ b/sw/source/uibase/docvw/romenu.cxx
@@ -106,7 +106,7 @@ SwReadOnlyPopup::SwReadOnlyPopup(const Point &rDPos, SwView &rV)
, m_nReadonlyFullscreen(m_xMenu->GetItemId("fullscreen"))
, m_nReadonlyCopy(m_xMenu->GetItemId("copy"))
, m_rView(rV)
- , m_aBrushItem(RES_BACKGROUND)
+ , m_aBrushItem(std::make_shared<SvxBrushItem>(RES_BACKGROUND))
{
m_bGrfToGalleryAsLnk = SW_MOD()->GetModuleConfig()->IsGrfToGalleryAsLnk();
SwWrtShell &rSh = m_rView.GetWrtShell();
@@ -159,10 +159,10 @@ SwReadOnlyPopup::SwReadOnlyPopup(const Point &rDPos, SwView &rV)
bool bEnableBackGallery = false,
bEnableBack = false;
- if ( GPOS_NONE != m_aBrushItem.GetGraphicPos() )
+ if ( m_aBrushItem && GPOS_NONE != m_aBrushItem->GetGraphicPos() )
{
bEnableBack = true;
- if ( !m_aBrushItem.GetGraphicLink().isEmpty() )
+ if ( !m_aBrushItem->GetGraphicLink().isEmpty() )
{
if ( m_aThemeList.empty() )
GalleryExplorer::FillThemeList( m_aThemeList );
@@ -240,11 +240,11 @@ void SwReadOnlyPopup::Execute( vcl::Window* pWin, sal_uInt16 nId )
{
OUString sTmp;
sal_uInt16 nSaveId;
- if (nId >= MN_READONLY_BACKGROUNDTOGALLERY)
+ if (m_aBrushItem && nId >= MN_READONLY_BACKGROUNDTOGALLERY)
{
nId -= MN_READONLY_BACKGROUNDTOGALLERY;
nSaveId = m_nReadonlySaveBackground;
- sTmp = m_aBrushItem.GetGraphicLink();
+ sTmp = m_aBrushItem->GetGraphicLink();
}
else
{
@@ -331,14 +331,14 @@ OUString SwReadOnlyPopup::SaveGraphic(sal_uInt16 nId)
// fish out the graphic's name
if (nId == m_nReadonlySaveBackground)
{
- if ( !m_aBrushItem.GetGraphicLink().isEmpty() )
- m_sGrfName = m_aBrushItem.GetGraphicLink();
- const Graphic *pGrf = m_aBrushItem.GetGraphic();
+ if ( m_aBrushItem && !m_aBrushItem->GetGraphicLink().isEmpty() )
+ m_sGrfName = m_aBrushItem->GetGraphicLink();
+ const Graphic *pGrf = m_aBrushItem ? m_aBrushItem->GetGraphic() : nullptr;
if ( pGrf )
{
m_aGraphic = *pGrf;
- if ( !m_aBrushItem.GetGraphicLink().isEmpty() )
- m_sGrfName = m_aBrushItem.GetGraphicLink();
+ if ( !m_aBrushItem->GetGraphicLink().isEmpty() )
+ m_sGrfName = m_aBrushItem->GetGraphicLink();
}
else
return OUString();
diff --git a/sw/source/uibase/docvw/romenu.hxx b/sw/source/uibase/docvw/romenu.hxx
index 18a9bccd0f35..54df7fb8bb57 100644
--- a/sw/source/uibase/docvw/romenu.hxx
+++ b/sw/source/uibase/docvw/romenu.hxx
@@ -58,7 +58,7 @@ class SwReadOnlyPopup
sal_uInt16 const m_nReadonlyCopy;
SwView &m_rView;
- SvxBrushItem m_aBrushItem;
+ std::shared_ptr<SvxBrushItem> m_aBrushItem;
Graphic m_aGraphic;
OUString m_sURL,
m_sTargetFrameName;
diff --git a/sw/source/uibase/shells/annotsh.cxx b/sw/source/uibase/shells/annotsh.cxx
index 79990b849654..b1d0054dec3d 100644
--- a/sw/source/uibase/shells/annotsh.cxx
+++ b/sw/source/uibase/shells/annotsh.cxx
@@ -1724,19 +1724,24 @@ void SwAnnotationShell::InsertSymbol(SfxRequest& rReq)
SfxItemSet aSet(pOLV->GetAttribs());
SvtScriptType nScript = pOLV->GetSelectedScriptType();
- SvxFontItem aSetDlgFont( RES_CHRATR_FONT );
+ std::shared_ptr<SvxFontItem> aSetDlgFont(std::make_shared<SvxFontItem>(RES_CHRATR_FONT));
{
SvxScriptSetItem aSetItem( SID_ATTR_CHAR_FONT, *aSet.GetPool() );
aSetItem.GetItemSet().Put( aSet, false );
const SfxPoolItem* pI = aSetItem.GetItemOfScript( nScript );
if( pI )
- aSetDlgFont = *static_cast<const SvxFontItem*>(pI);
+ {
+ aSetDlgFont.reset(static_cast<SvxFontItem*>(pI->Clone()));
+ }
else
- aSetDlgFont = static_cast<const SvxFontItem&>(aSet.Get( GetWhichOfScript(
+ {
+ aSetDlgFont.reset(static_cast<SvxFontItem*>(aSet.Get( GetWhichOfScript(
SID_ATTR_CHAR_FONT,
- SvtLanguageOptions::GetI18NScriptTypeOfLanguage( GetAppLanguage() ) )));
+ SvtLanguageOptions::GetI18NScriptTypeOfLanguage( GetAppLanguage() ) )).Clone()));
+ }
+
if (sFontName.isEmpty())
- sFontName = aSetDlgFont.GetFamilyName();
+ sFontName = aSetDlgFont->GetFamilyName();
}
vcl::Font aFont(sFontName, Size(1,1));
@@ -1752,7 +1757,7 @@ void SwAnnotationShell::InsertSymbol(SfxRequest& rReq)
if( !sSymbolFont.isEmpty() )
aAllSet.Put( SfxStringItem( SID_FONT_NAME, sSymbolFont ) );
else
- aAllSet.Put( SfxStringItem( SID_FONT_NAME, aSetDlgFont.GetFamilyName() ) );
+ aAllSet.Put( SfxStringItem( SID_FONT_NAME, aSetDlgFont->GetFamilyName() ) );
// If character is selected then it can be shown.
ScopedVclPtr<SfxAbstractDialog> pDlg(pFact->CreateCharMapDialog(rView.GetFrameWeld(), aAllSet, true));
diff --git a/sw/source/uibase/shells/basesh.cxx b/sw/source/uibase/shells/basesh.cxx
index fa22a93d72ff..0a3a735fdd02 100644
--- a/sw/source/uibase/shells/basesh.cxx
+++ b/sw/source/uibase/shells/basesh.cxx
@@ -2202,7 +2202,7 @@ void SwBaseShell::GetBckColState(SfxItemSet &rSet)
SfxWhichIter aIter(rSet);
sal_uInt16 nWhich(aIter.FirstWhich());
SelectionType nSelType(rSh.GetSelectionType());
- SvxBrushItem aBrushItem(RES_BACKGROUND);
+ std::shared_ptr<SvxBrushItem> aBrushItem(std::make_shared<SvxBrushItem>(RES_BACKGROUND));
if( nWhich == SID_TABLE_CELL_BACKGROUND_COLOR )
{
@@ -2234,15 +2234,18 @@ void SwBaseShell::GetBckColState(SfxItemSet &rSet)
case SID_BACKGROUND_COLOR:
case SID_TABLE_CELL_BACKGROUND_COLOR:
{
- SvxColorItem aColorItem(aBrushItem.GetColor(),SID_BACKGROUND_COLOR);
+ SvxColorItem aColorItem(aBrushItem->GetColor(),SID_BACKGROUND_COLOR);
rSet.Put(aColorItem);
break;
}
case SID_ATTR_BRUSH:
case RES_BACKGROUND:
{
- std::unique_ptr<SfxPoolItem> pNewItem(aBrushItem.CloneSetWhich(GetPool().GetWhich(nWhich)));
- rSet.Put(*pNewItem);
+ // if this was intended to have a independent copy of the Item to be set
+ // this is not needed due to the ItemSet/Pool cloning Items which get set anyways.
+ // Keeping code as reference - it may have had other reasons I do notz see (?!?)
+ // std::unique_ptr<SfxPoolItem> pNewItem(aBrushItem.CloneSetWhich(GetPool().GetWhich(nWhich)));
+ rSet.Put(*aBrushItem);
break;
}
}
@@ -2263,7 +2266,7 @@ void SwBaseShell::ExecBckCol(SfxRequest& rReq)
return;
}
- SvxBrushItem aBrushItem(RES_BACKGROUND);
+ std::shared_ptr<SvxBrushItem> aBrushItem(std::make_shared<SvxBrushItem>(RES_BACKGROUND));
if ( nSlot == SID_TABLE_CELL_BACKGROUND_COLOR )
{
@@ -2293,18 +2296,18 @@ void SwBaseShell::ExecBckCol(SfxRequest& rReq)
case SID_BACKGROUND_COLOR:
case SID_TABLE_CELL_BACKGROUND_COLOR:
{
- aBrushItem.SetGraphicPos(GPOS_NONE);
+ aBrushItem->SetGraphicPos(GPOS_NONE);
if(pArgs)
{
const SvxColorItem& rNewColorItem = pArgs->Get(nSlot == SID_BACKGROUND_COLOR ? SID_BACKGROUND_COLOR : SID_TABLE_CELL_BACKGROUND_COLOR );
const Color& rNewColor = rNewColorItem.GetValue();
- aBrushItem.SetColor(rNewColor);
+ aBrushItem->SetColor(rNewColor);
GetView().GetViewFrame()->GetBindings().SetState(rNewColorItem);
}
else
{
- aBrushItem.SetColor(COL_TRANSPARENT);
+ aBrushItem->SetColor(COL_TRANSPARENT);
rReq.AppendItem(SvxColorItem(COL_TRANSPARENT,nSlot));
}
break;
@@ -2314,8 +2317,7 @@ void SwBaseShell::ExecBckCol(SfxRequest& rReq)
case RES_BACKGROUND:
{
assert(pArgs && "only SID_BACKGROUND_COLOR can have !pArgs, checked at entry");
- const SvxBrushItem& rNewBrushItem = static_cast<const SvxBrushItem&>(pArgs->Get(GetPool().GetWhich(nSlot)));
- aBrushItem = rNewBrushItem;
+ aBrushItem.reset(static_cast<SvxBrushItem*>(pArgs->Get(GetPool().GetWhich(nSlot)).Clone()));
break;
}
default:
@@ -2328,7 +2330,7 @@ void SwBaseShell::ExecBckCol(SfxRequest& rReq)
if ( nSlot == SID_TABLE_CELL_BACKGROUND_COLOR )
{
- rSh.SetBoxBackground( aBrushItem );
+ rSh.SetBoxBackground( *aBrushItem );
}
else
{
@@ -2336,7 +2338,7 @@ void SwBaseShell::ExecBckCol(SfxRequest& rReq)
SfxItemSet aCoreSet(GetPool(), svl::Items<XATTR_FILL_FIRST, XATTR_FILL_LAST>{});
aCoreSet.SetParent(&GetView().GetDocShell()->GetDoc()->GetDfltFrameFormat()->GetAttrSet());
- setSvxBrushItemAsFillAttributesToTargetSet(aBrushItem, aCoreSet);
+ setSvxBrushItemAsFillAttributesToTargetSet(*aBrushItem, aCoreSet);
if((SelectionType::Frame & nSelType) || (SelectionType::Graphic & nSelType))
{
@@ -2526,10 +2528,10 @@ void SwBaseShell::ExecDlg(SfxRequest &rReq)
if ( rSh.IsTableMode() )
{
// Get background attributes of the table and put it in the set
- SvxBrushItem aBrush(RES_BACKGROUND);
+ std::shared_ptr<SvxBrushItem> aBrush;
rSh.GetBoxBackground( aBrush );
pDlg.disposeAndReset(pFact->CreateSwBackgroundDialog(pMDI, aSet));
- aSet.Put( aBrush );
+ aSet.Put( *aBrush );
if ( pDlg->Execute() == RET_OK )
{
diff --git a/sw/source/uibase/shells/drwtxtsh.cxx b/sw/source/uibase/shells/drwtxtsh.cxx
index aae01e315673..66aa26277bfa 100644
--- a/sw/source/uibase/shells/drwtxtsh.cxx
+++ b/sw/source/uibase/shells/drwtxtsh.cxx
@@ -697,19 +697,19 @@ void SwDrawTextShell::InsertSymbol(SfxRequest& rReq)
SfxItemSet aSet(pOLV->GetAttribs());
SvtScriptType nScript = pOLV->GetSelectedScriptType();
- SvxFontItem aSetDlgFont( RES_CHRATR_FONT );
+ std::shared_ptr<SvxFontItem> aSetDlgFont(std::make_shared<SvxFontItem>(RES_CHRATR_FONT));
{
SvxScriptSetItem aSetItem( SID_ATTR_CHAR_FONT, *aSet.GetPool() );
aSetItem.GetItemSet().Put( aSet, false );
const SfxPoolItem* pI = aSetItem.GetItemOfScript( nScript );
if( pI )
- aSetDlgFont = *static_cast<const SvxFontItem*>(pI);
+ aSetDlgFont.reset(static_cast<SvxFontItem*>(pI->Clone()));
else
- aSetDlgFont = static_cast<const SvxFontItem&>(aSet.Get( GetWhichOfScript(
+ aSetDlgFont.reset(static_cast<SvxFontItem*>(aSet.Get( GetWhichOfScript(
SID_ATTR_CHAR_FONT,
- SvtLanguageOptions::GetI18NScriptTypeOfLanguage( GetAppLanguage() ) )));
+ SvtLanguageOptions::GetI18NScriptTypeOfLanguage( GetAppLanguage() ) )).Clone()));
if (sFontName.isEmpty())
- sFontName = aSetDlgFont.GetFamilyName();
+ sFontName = aSetDlgFont->GetFamilyName();
}
vcl::Font aFont(sFontName, Size(1,1));
@@ -723,7 +723,7 @@ void SwDrawTextShell::InsertSymbol(SfxRequest& rReq)
if( !sSymbolFont.isEmpty() )
aAllSet.Put( SfxStringItem( SID_FONT_NAME, sSymbolFont ) );
else
- aAllSet.Put( SfxStringItem( SID_FONT_NAME, aSetDlgFont.GetFamilyName() ) );
+ aAllSet.Put( SfxStringItem( SID_FONT_NAME, aSetDlgFont->GetFamilyName() ) );
// If character is selected, it can be shown
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
diff --git a/sw/source/uibase/shells/frmsh.cxx b/sw/source/uibase/shells/frmsh.cxx
index 31a599b4defc..a1e18351d68b 100644
--- a/sw/source/uibase/shells/frmsh.cxx
+++ b/sw/source/uibase/shells/frmsh.cxx
@@ -1017,7 +1017,7 @@ void SwFrameShell::ExecFrameStyle(SfxRequest const & rReq)
if (pPoolBoxItem == &rBoxItem)
bDefault = true;
- SvxBoxItem aBoxItem(rBoxItem);
+ std::shared_ptr<SvxBoxItem> aBoxItem(static_cast<SvxBoxItem*>(rBoxItem.Clone()));
SvxBorderLine aBorderLine;
const SfxPoolItem *pItem = nullptr;
@@ -1030,16 +1030,16 @@ void SwFrameShell::ExecFrameStyle(SfxRequest const & rReq)
{
if (pArgs->GetItemState(RES_BOX, true, &pItem) == SfxItemState::SET)
{
- SvxBoxItem aNewBox(*static_cast<const SvxBoxItem *>(pItem));
+ std::shared_ptr<SvxBoxItem> aNewBox(static_cast<SvxBoxItem*>(pItem->Clone()));
const SvxBorderLine* pBorderLine;
- if ((pBorderLine = aBoxItem.GetTop()) != nullptr)
+ if ((pBorderLine = aBoxItem->GetTop()) != nullptr)
lcl_FrameGetMaxLineWidth(pBorderLine, aBorderLine);
- if ((pBorderLine = aBoxItem.GetBottom()) != nullptr)
+ if ((pBorderLine = aBoxItem->GetBottom()) != nullptr)
lcl_FrameGetMaxLineWidth(pBorderLine, aBorderLine);
- if ((pBorderLine = aBoxItem.GetLeft()) != nullptr)
+ if ((pBorderLine = aBoxItem->GetLeft()) != nullptr)
lcl_FrameGetMaxLineWidth(pBorderLine, aBorderLine);
- if ((pBorderLine = aBoxItem.GetRight()) != nullptr)
+ if ((pBorderLine = aBoxItem->GetRight()) != nullptr)
lcl_FrameGetMaxLineWidth(pBorderLine, aBorderLine);
if(aBorderLine.GetOutWidth() == 0)
@@ -1055,20 +1055,20 @@ void SwFrameShell::ExecFrameStyle(SfxRequest const & rReq)
#endif
{
// TODO: should this copy 4 individual Dist instead?
- aNewBox.SetAllDistances(rBoxItem.GetSmallestDistance());
+ aNewBox->SetAllDistances(rBoxItem.GetSmallestDistance());
}
aBoxItem = aNewBox;
SvxBorderLine aDestBorderLine;
- if( aBoxItem.GetTop() != nullptr )
- aBoxItem.SetLine(&aBorderLine, SvxBoxItemLine::TOP);
- if( aBoxItem.GetBottom() != nullptr )
- aBoxItem.SetLine(&aBorderLine, SvxBoxItemLine::BOTTOM);
- if( aBoxItem.GetLeft() != nullptr )
- aBoxItem.SetLine(&aBorderLine, SvxBoxItemLine::LEFT);
- if( aBoxItem.GetRight() != nullptr )
- aBoxItem.SetLine(&aBorderLine, SvxBoxItemLine::RIGHT);
+ if( aBoxItem->GetTop() != nullptr )
+ aBoxItem->SetLine(&aBorderLine, SvxBoxItemLine::TOP);
+ if( aBoxItem->GetBottom() != nullptr )
+ aBoxItem->SetLine(&aBorderLine, SvxBoxItemLine::BOTTOM);
+ if( aBoxItem->GetLeft() != nullptr )
+ aBoxItem->SetLine(&aBorderLine, SvxBoxItemLine::LEFT);
+ if( aBoxItem->GetRight() != nullptr )
+ aBoxItem->SetLine(&aBorderLine, SvxBoxItemLine::RIGHT);
}
}
break;
@@ -1084,44 +1084,44 @@ void SwFrameShell::ExecFrameStyle(SfxRequest const & rReq)
{
aBorderLine = *(pLineItem->GetLine());
- if (!aBoxItem.GetTop() && !aBoxItem.GetBottom() &&
- !aBoxItem.GetLeft() && !aBoxItem.GetRight())
+ if (!aBoxItem->GetTop() && !aBoxItem->GetBottom() &&
+ !aBoxItem->GetLeft() && !aBoxItem->GetRight())
{
- aBoxItem.SetLine(&aBorderLine, SvxBoxItemLine::TOP);
- aBoxItem.SetLine(&aBorderLine, SvxBoxItemLine::BOTTOM);
- aBoxItem.SetLine(&aBorderLine, SvxBoxItemLine::LEFT);
- aBoxItem.SetLine(&aBorderLine, SvxBoxItemLine::RIGHT);
+ aBoxItem->SetLine(&aBorderLine, SvxBoxItemLine::TOP);
+ aBoxItem->SetLine(&aBorderLine, SvxBoxItemLine::BOTTOM);
+ aBoxItem->SetLine(&aBorderLine, SvxBoxItemLine::LEFT);
+ aBoxItem->SetLine(&aBorderLine, SvxBoxItemLine::RIGHT);
}
else
{
- if( aBoxItem.GetTop() )
+ if( aBoxItem->GetTop() )
{
- aBorderLine.SetColor( aBoxItem.GetTop()->GetColor() );
- aBoxItem.SetLine(&aBorderLine, SvxBoxItemLine::TOP);
+ aBorderLine.SetColor( aBoxItem->GetTop()->GetColor() );
+ aBoxItem->SetLine(&aBorderLine, SvxBoxItemLine::TOP);
}
- if( aBoxItem.GetBottom() )
+ if( aBoxItem->GetBottom() )
{
- aBorderLine.SetColor( aBoxItem.GetBottom()->GetColor());
- aBoxItem.SetLine(&aBorderLine, SvxBoxItemLine::BOTTOM);
+ aBorderLine.SetColor( aBoxItem->GetBottom()->GetColor());
+ aBoxItem->SetLine(&aBorderLine, SvxBoxItemLine::BOTTOM);
}
- if( aBoxItem.GetLeft() )
+ if( aBoxItem->GetLeft() )
{
- aBorderLine.SetColor( aBoxItem.GetLeft()->GetColor());
- aBoxItem.SetLine(&aBorderLine, SvxBoxItemLine::LEFT);
+ aBorderLine.SetColor( aBoxItem->GetLeft()->GetColor());
+ aBoxItem->SetLine(&aBorderLine, SvxBoxItemLine::LEFT);
}
- if( aBoxItem.GetRight() )
+ if( aBoxItem->GetRight() )
{
- aBorderLine.SetColor(aBoxItem.GetRight()->GetColor());
- aBoxItem.SetLine(&aBorderLine, SvxBoxItemLine::RIGHT);
+ aBorderLine.SetColor(aBoxItem->GetRight()->GetColor());
+ aBoxItem->SetLine(&aBorderLine, SvxBoxItemLine::RIGHT);
}
}
}
else
{
- aBoxItem.SetLine(nullptr, SvxBoxItemLine::TOP);
- aBoxItem.SetLine(nullptr, SvxBoxItemLine::BOTTOM);
- aBoxItem.SetLine(nullptr, SvxBoxItemLine::LEFT);
- aBoxItem.SetLine(nullptr, SvxBoxItemLine::RIGHT);
+ aBoxItem->SetLine(nullptr, SvxBoxItemLine::TOP);
+ aBoxItem->SetLine(nullptr, SvxBoxItemLine::BOTTOM);
+ aBoxItem->SetLine(nullptr, SvxBoxItemLine::LEFT);
+ aBoxItem->SetLine(nullptr, SvxBoxItemLine::RIGHT);
}
}
}
@@ -1133,37 +1133,37 @@ void SwFrameShell::ExecFrameStyle(SfxRequest const & rReq)
{
const Color& rNewColor = static_cast<const SvxColorItem*>(pItem)->GetValue();
- if (!aBoxItem.GetTop() && !aBoxItem.GetBottom() &&
- !aBoxItem.GetLeft() && !aBoxItem.GetRight())
+ if (!aBoxItem->GetTop() && !aBoxItem->GetBottom() &&
+ !aBoxItem->GetLeft() && !aBoxItem->GetRight())
{
aBorderLine.SetColor( rNewColor );
- aBoxItem.SetLine(&aBorderLine, SvxBoxItemLine::TOP);
- aBoxItem.SetLine(&aBorderLine, SvxBoxItemLine::BOTTOM);
- aBoxItem.SetLine(&aBorderLine, SvxBoxItemLine::LEFT);
- aBoxItem.SetLine(&aBorderLine, SvxBoxItemLine::RIGHT);
+ aBoxItem->SetLine(&aBorderLine, SvxBoxItemLine::TOP);
+ aBoxItem->SetLine(&aBorderLine, SvxBoxItemLine::BOTTOM);
+ aBoxItem->SetLine(&aBorderLine, SvxBoxItemLine::LEFT);
+ aBoxItem->SetLine(&aBorderLine, SvxBoxItemLine::RIGHT);
}
else
{
- if ( aBoxItem.GetTop() )
- const_cast<SvxBorderLine*>(aBoxItem.GetTop())->SetColor( rNewColor );
- if ( aBoxItem.GetBottom() )
- const_cast<SvxBorderLine*>(aBoxItem.GetBottom())->SetColor( rNewColor );
- if ( aBoxItem.GetLeft() )
- const_cast<SvxBorderLine*>(aBoxItem.GetLeft())->SetColor( rNewColor );
- if ( aBoxItem.GetRight() )
- const_cast<SvxBorderLine*>(aBoxItem.GetRight())->SetColor( rNewColor );
+ if ( aBoxItem->GetTop() )
+ const_cast<SvxBorderLine*>(aBoxItem->GetTop())->SetColor( rNewColor );
+ if ( aBoxItem->GetBottom() )
+ const_cast<SvxBorderLine*>(aBoxItem->GetBottom())->SetColor( rNewColor );
+ if ( aBoxItem->GetLeft() )
+ const_cast<SvxBorderLine*>(aBoxItem->GetLeft())->SetColor( rNewColor );
+ if ( aBoxItem->GetRight() )
+ const_cast<SvxBorderLine*>(aBoxItem->GetRight())->SetColor( rNewColor );
}
}
}
break;
}
}
- if (bDefault && (aBoxItem.GetTop() || aBoxItem.GetBottom() ||
- aBoxItem.GetLeft() || aBoxItem.GetRight()))
+ if (bDefault && (aBoxItem->GetTop() || aBoxItem->GetBottom() ||
+ aBoxItem->GetLeft() || aBoxItem->GetRight()))
{
- aBoxItem.SetAllDistances(MIN_BORDER_DIST);
+ aBoxItem->SetAllDistances(MIN_BORDER_DIST);
}
- aFrameSet.Put( aBoxItem );
+ aFrameSet.Put( *aBoxItem );
// Template AutoUpdate
SwFrameFormat* pFormat = rSh.GetSelectedFrameFormat();
if(pFormat && pFormat->IsAutoUpdateFormat())
diff --git a/sw/source/uibase/shells/tabsh.cxx b/sw/source/uibase/shells/tabsh.cxx
index 4333c01637f3..ef892924fc27 100644
--- a/sw/source/uibase/shells/tabsh.cxx
+++ b/sw/source/uibase/shells/tabsh.cxx
@@ -155,24 +155,24 @@ static SwTableRep* lcl_TableParamToItemSet( SfxItemSet& rSet, SwWrtShell &rSh )
const sal_uInt16 nBackgroundDestination = rSh.GetViewOptions()->GetTableDest();
rSet.Put(SfxUInt16Item(SID_BACKGRND_DESTINATION, nBackgroundDestination ));
- SvxBrushItem aBrush( RES_BACKGROUND );
+ std::shared_ptr<SvxBrushItem> aBrush(std::make_shared<SvxBrushItem>(RES_BACKGROUND));
if(rSh.GetRowBackground(aBrush))
{
- aBrush.SetWhich(SID_ATTR_BRUSH_ROW);
- rSet.Put( aBrush );
+ aBrush->SetWhich(SID_ATTR_BRUSH_ROW);
+ rSet.Put( *aBrush );
}
else
rSet.InvalidateItem(SID_ATTR_BRUSH_ROW);
rSh.GetTabBackground(aBrush);
- aBrush.SetWhich(SID_ATTR_BRUSH_TABLE);
- rSet.Put( aBrush );
+ aBrush->SetWhich(SID_ATTR_BRUSH_TABLE);
+ rSet.Put( *aBrush );
// text direction in boxes
- SvxFrameDirectionItem aBoxDirection( SvxFrameDirection::Environment, RES_FRAMEDIR );
+ std::shared_ptr<SvxFrameDirectionItem> aBoxDirection(std::make_shared<SvxFrameDirectionItem>(SvxFrameDirection::Environment, RES_FRAMEDIR));
if(rSh.GetBoxDirection( aBoxDirection ))
{
- aBoxDirection.SetWhich(FN_TABLE_BOX_TEXTORIENTATION);
- rSet.Put(aBoxDirection);
+ aBoxDirection->SetWhich(FN_TABLE_BOX_TEXTORIENTATION);
+ rSet.Put(*aBoxDirection);
}
bool bSelectAll = rSh.StartsWithTable() && rSh.ExtendedSelectedAll();
@@ -310,15 +310,15 @@ void ItemSetToTableParam( const SfxItemSet& rSet,
rSh.SetBoxBackground( *static_cast<const SvxBrushItem*>(pItem) );
if(pRowItem)
{
- SvxBrushItem aBrush(*static_cast<const SvxBrushItem*>(pRowItem));
- aBrush.SetWhich(RES_BACKGROUND);
- rSh.SetRowBackground(aBrush);
+ std::shared_ptr<SvxBrushItem> aBrush(static_cast<SvxBrushItem*>(pRowItem->Clone()));
+ aBrush->SetWhich(RES_BACKGROUND);
+ rSh.SetRowBackground(*aBrush);
}
if(pTableItem)
{
- SvxBrushItem aBrush(*static_cast<const SvxBrushItem*>(pTableItem));
- aBrush.SetWhich(RES_BACKGROUND);
- rSh.SetTabBackground( aBrush );
+ std::shared_ptr<SvxBrushItem> aBrush(static_cast<SvxBrushItem*>(pTableItem->Clone()));
+ aBrush->SetWhich(RES_BACKGROUND);
+ rSh.SetTabBackground( *aBrush );
}
}
@@ -469,7 +469,7 @@ void SwTableShell::Execute(SfxRequest &rReq)
if(!pArgs)
break;
// Create items, because we have to rework anyway.
- SvxBoxItem aBox( RES_BOX );
+ std::shared_ptr<SvxBoxItem> aBox(std::make_shared<SvxBoxItem>(RES_BOX));
SfxItemSet aCoreSet( GetPool(),
svl::Items<RES_BOX, RES_BOX,
SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER>{});
@@ -480,31 +480,33 @@ void SwTableShell::Execute(SfxRequest &rReq)
const SfxPoolItem *pBoxItem = nullptr;
if ( pArgs->GetItemState(RES_BOX, true, &pBoxItem) == SfxItemState::SET )
{
- aBox = *static_cast<const SvxBoxItem*>(pBoxItem);
+ aBox.reset(static_cast<SvxBoxItem*>(pBoxItem->Clone()));
sal_uInt16 nDefValue = MIN_BORDER_DIST;
if ( !rReq.IsAPI() )
nDefValue = 55;
- if (!rReq.IsAPI() || aBox.GetSmallestDistance() < MIN_BORDER_DIST)
+ if (!rReq.IsAPI() || aBox->GetSmallestDistance() < MIN_BORDER_DIST)
{
for( SvxBoxItemLine k : o3tl::enumrange<SvxBoxItemLine>() )
- aBox.SetDistance( std::max(rCoreBox.GetDistance(k), nDefValue) , k );
+ aBox->SetDistance( std::max(rCoreBox.GetDistance(k), nDefValue) , k );
}
}
else
OSL_ENSURE( false, "where is BoxItem?" );
//since the drawing layer also supports borders the which id might be a different one
- SvxBoxInfoItem aInfo( SID_ATTR_BORDER_INNER );
+ std::shared_ptr<SvxBoxInfoItem> aInfo(std::make_shared<SvxBoxInfoItem>(SID_ATTR_BORDER_INNER));
if (pArgs->GetItemState(SID_ATTR_BORDER_INNER, true, &pBoxItem) == SfxItemState::SET)
- aInfo = *static_cast<const SvxBoxInfoItem*>(pBoxItem);
+ {
+ aInfo.reset(static_cast<SvxBoxInfoItem*>(pBoxItem->Clone()));
+ }
else if( pArgs->GetItemState(SDRATTR_TABLE_BORDER_INNER, true, &pBoxItem) == SfxItemState::SET )
{
- aInfo = *static_cast<const SvxBoxInfoItem*>(pBoxItem);
- aInfo.SetWhich(SID_ATTR_BORDER_INNER);
+ aInfo.reset(static_cast<SvxBoxInfoItem*>(pBoxItem->Clone()));
+ aInfo->SetWhich(SID_ATTR_BORDER_INNER);
}
- aInfo.SetTable( true );
- aInfo.SetValid( SvxBoxInfoItemValidFlags::DISABLE, false );
+ aInfo->SetTable( true );
+ aInfo->SetValid( SvxBoxInfoItemValidFlags::DISABLE, false );
// The attributes of all lines will be read and the strongest wins.
const SvxBorderLine* pBorderLine;
@@ -528,40 +530,40 @@ void SwTableShell::Execute(SfxRequest &rReq)
aBorderLine.SetWidth( DEF_LINE_WIDTH_5 );
}
- if( aBox.GetTop() != nullptr )
+ if( aBox->GetTop() != nullptr )
{
- aBox.SetLine(&aBorderLine, SvxBoxItemLine::TOP);
+ aBox->SetLine(&aBorderLine, SvxBoxItemLine::TOP);
}
- if( aBox.GetBottom() != nullptr )
+ if( aBox->GetBottom() != nullptr )
{
- aBox.SetLine(&aBorderLine, SvxBoxItemLine::BOTTOM);
+ aBox->SetLine(&aBorderLine, SvxBoxItemLine::BOTTOM);
}
- if( aBox.GetLeft() != nullptr )
+ if( aBox->GetLeft() != nullptr )
{
- aBox.SetLine(&aBorderLine, SvxBoxItemLine::LEFT);
+ aBox->SetLine(&aBorderLine, SvxBoxItemLine::LEFT);
}
- if( aBox.GetRight() != nullptr )
+ if( aBox->GetRight() != nullptr )
{
- aBox.SetLine(&aBorderLine, SvxBoxItemLine::RIGHT);
+ aBox->SetLine(&aBorderLine, SvxBoxItemLine::RIGHT);
}
- if( aInfo.GetHori() != nullptr )
+ if( aInfo->GetHori() != nullptr )
{
- aInfo.SetLine(&aBorderLine, SvxBoxInfoItemLine::HORI);
+ aInfo->SetLine(&aBorderLine, SvxBoxInfoItemLine::HORI);
}
- if( aInfo.GetVert() != nullptr )
+ if( aInfo->GetVert() != nullptr )
{
- aInfo.SetLine(&aBorderLine, SvxBoxInfoItemLine::VERT);
+ aInfo->SetLine(&aBorderLine, SvxBoxInfoItemLine::VERT);
}
- aCoreSet.Put( aBox );
- aCoreSet.Put( aInfo );
+ aCoreSet.Put( *aBox );
+ aCoreSet.Put( *aInfo );
rSh.SetTabBorders( aCoreSet );
// we must record the "real" values because otherwise the lines can't be reconstructed on playtime
// the coding style of the controller (setting lines with width 0) is not transportable via Query/PutValue in
// the SvxBoxItem
- rReq.AppendItem( aBox );
- rReq.AppendItem( aInfo );
+ rReq.AppendItem( *aBox );
+ rReq.AppendItem( *aInfo );
bCallDone = true;
break;
}
@@ -582,9 +584,9 @@ void SwTableShell::Execute(SfxRequest &rReq)
aCoreSet.Put(SfxUInt16Item(SID_HTML_MODE, ::GetHtmlMode(GetView().GetDocShell())));
rSh.GetTableAttr(aCoreSet);
// GetTableAttr overwrites the background!
- SvxBrushItem aBrush( RES_BACKGROUND );
+ std::shared_ptr<SvxBrushItem> aBrush(std::make_shared<SvxBrushItem>(RES_BACKGROUND));
if(rSh.GetBoxBackground(aBrush))
- aCoreSet.Put( aBrush );
+ aCoreSet.Put( *aBrush );
else
aCoreSet.InvalidateItem( RES_BACKGROUND );
diff --git a/sw/source/uibase/shells/textsh.cxx b/sw/source/uibase/shells/textsh.cxx
index 3b7b5d41d57e..20fad8442156 100644
--- a/sw/source/uibase/shells/textsh.cxx
+++ b/sw/source/uibase/shells/textsh.cxx
@@ -905,21 +905,26 @@ void SwTextShell::InsertSymbol( SfxRequest& rReq )
rSh.GetCurAttr( aSet );
SvtScriptType nScript = rSh.GetScriptType();
- SvxFontItem aFont( RES_CHRATR_FONT );
+ std::shared_ptr<SvxFontItem> aFont(std::make_shared<SvxFontItem>(RES_CHRATR_FONT));
{
SvxScriptSetItem aSetItem( SID_ATTR_CHAR_FONT, *aSet.GetPool() );
aSetItem.GetItemSet().Put( aSet, false );
const SfxPoolItem* pI = aSetItem.GetItemOfScript( nScript );
if( pI )
- aFont = *static_cast<const SvxFontItem*>(pI);
+ {
+ aFont.reset(static_cast<SvxFontItem*>(pI->Clone()));
+ }
else
- aFont = static_cast<const SvxFontItem&>(
+ {
+ aFont.reset(static_cast<SvxFontItem*>(
aSet.Get(
GetWhichOfScript(
RES_CHRATR_FONT,
- SvtLanguageOptions::GetI18NScriptTypeOfLanguage( GetAppLanguage() ) )));
+ SvtLanguageOptions::GetI18NScriptTypeOfLanguage( GetAppLanguage() ) )).Clone()));
+ }
+
if (aFontName.isEmpty())
- aFontName = aFont.GetFamilyName();
+ aFontName = aFont->GetFamilyName();
}
vcl::Font aNewFont(aFontName, Size(1,1)); // Size only because CTOR.
@@ -934,7 +939,7 @@ void SwTextShell::InsertSymbol( SfxRequest& rReq )
if( aFontName.isEmpty() && !sSymbolFont.isEmpty() )
aAllSet.Put( SfxStringItem( SID_FONT_NAME, sSymbolFont ) );
else
- aAllSet.Put( SfxStringItem( SID_FONT_NAME, aFont.GetFamilyName() ) );
+ aAllSet.Put( SfxStringItem( SID_FONT_NAME, aFont->GetFamilyName() ) );
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
ScopedVclPtr<SfxAbstractDialog> pDlg(pFact->CreateCharMapDialog(GetView().GetFrameWeld(), aAllSet, true));
@@ -961,11 +966,15 @@ void SwTextShell::InsertSymbol( SfxRequest& rReq )
aSetItem.GetItemSet().Put( aSet, false );
const SfxPoolItem* pI = aSetItem.GetItemOfScript( nScript );
if( pI )
- aFont = *static_cast<const SvxFontItem*>(pI);
+ {
+ aFont.reset(static_cast<SvxFontItem*>(pI->Clone()));
+ }
else
- aFont = static_cast<const SvxFontItem&>(aSet.Get( GetWhichOfScript(
+ {
+ aFont.reset(static_cast<SvxFontItem*>(aSet.Get( GetWhichOfScript(
RES_CHRATR_FONT,
- SvtLanguageOptions::GetI18NScriptTypeOfLanguage( GetAppLanguage() ) )));
+ SvtLanguageOptions::GetI18NScriptTypeOfLanguage( GetAppLanguage() ) )).Clone()));
+ }
}
// Insert character.
@@ -974,11 +983,11 @@ void SwTextShell::InsertSymbol( SfxRequest& rReq )
// #108876# a font attribute has to be set always due to a guessed script type
if( !aNewFont.GetFamilyName().isEmpty() )
{
- SvxFontItem aNewFontItem( aFont );
- aNewFontItem.SetFamilyName( aNewFont.GetFamilyName() );
- aNewFontItem.SetFamily( aNewFont.GetFamilyType());
- aNewFontItem.SetPitch( aNewFont.GetPitch());
- aNewFontItem.SetCharSet( aNewFont.GetCharSet() );
+ std::shared_ptr<SvxFontItem> aNewFontItem(static_cast<SvxFontItem*>(aFont->Clone()));
+ aNewFontItem->SetFamilyName( aNewFont.GetFamilyName() );
+ aNewFontItem->SetFamily( aNewFont.GetFamilyType());
+ aNewFontItem->SetPitch( aNewFont.GetPitch());
+ aNewFontItem->SetCharSet( aNewFont.GetCharSet() );
SfxItemSet aRestoreSet( GetPool(), svl::Items<RES_CHRATR_FONT, RES_CHRATR_FONT,
RES_CHRATR_CJK_FONT, RES_CHRATR_CJK_FONT,
@@ -988,20 +997,20 @@ void SwTextShell::InsertSymbol( SfxRequest& rReq )
if( SvtScriptType::LATIN & nScript )
{
aRestoreSet.Put( aSet.Get( RES_CHRATR_FONT ) );
- aNewFontItem.SetWhich(RES_CHRATR_FONT);
- aSet.Put( aNewFontItem );
+ aNewFontItem->SetWhich(RES_CHRATR_FONT);
+ aSet.Put( *aNewFontItem );
}
if( SvtScriptType::ASIAN & nScript )
{
aRestoreSet.Put( aSet.Get( RES_CHRATR_CJK_FONT ) );
- aNewFontItem.SetWhich(RES_CHRATR_CJK_FONT);
- aSet.Put( aNewFontItem );
+ aNewFontItem->SetWhich(RES_CHRATR_CJK_FONT);
+ aSet.Put( *aNewFontItem );
}
if( SvtScriptType::COMPLEX & nScript )
{
aRestoreSet.Put( aSet.Get( RES_CHRATR_CTL_FONT ) );
- aNewFontItem.SetWhich(RES_CHRATR_CTL_FONT);
- aSet.Put( aNewFontItem );
+ aNewFontItem->SetWhich(RES_CHRATR_CTL_FONT);
+ aSet.Put( *aNewFontItem );
}
rSh.SetMark();
@@ -1020,7 +1029,10 @@ void SwTextShell::InsertSymbol( SfxRequest& rReq )
rSh.ClearMark();
rSh.UpdateAttr();
- aFont = aNewFontItem;
+
+ // Why was this done? aFont is not used anymore below, we are not
+ // in a loop and it's a local variable...?
+ // aFont = aNewFontItem;
}
rSh.EndAllAction();
diff --git a/sw/source/uibase/uiview/formatclipboard.cxx b/sw/source/uibase/uiview/formatclipboard.cxx
index 76cadb99a208..f8f95205dbf6 100644
--- a/sw/source/uibase/uiview/formatclipboard.cxx
+++ b/sw/source/uibase/uiview/formatclipboard.cxx
@@ -98,29 +98,29 @@ std::unique_ptr<SfxItemSet> lcl_CreateEmptyItemSet( SelectionType nSelectionType
void lcl_getTableAttributes( SfxItemSet& rSet, SwWrtShell &rSh )
{
- SvxBrushItem aBrush( RES_BACKGROUND );
+ std::shared_ptr<SvxBrushItem> aBrush(std::make_shared<SvxBrushItem>(RES_BACKGROUND));
rSh.GetBoxBackground(aBrush);
- rSet.Put( aBrush );
+ rSet.Put( *aBrush );
if(rSh.GetRowBackground(aBrush))
{
- aBrush.SetWhich(SID_ATTR_BRUSH_ROW);
- rSet.Put( aBrush );
+ aBrush->SetWhich(SID_ATTR_BRUSH_ROW);
+ rSet.Put( *aBrush );
}
else
rSet.InvalidateItem(SID_ATTR_BRUSH_ROW);
rSh.GetTabBackground(aBrush);
- aBrush.SetWhich(SID_ATTR_BRUSH_TABLE);
- rSet.Put( aBrush );
+ aBrush->SetWhich(SID_ATTR_BRUSH_TABLE);
+ rSet.Put( *aBrush );
SvxBoxInfoItem aBoxInfo( SID_ATTR_BORDER_INNER );
rSet.Put(aBoxInfo);
rSh.GetTabBorders( rSet );
- SvxFrameDirectionItem aBoxDirection( SvxFrameDirection::Environment, RES_FRAMEDIR );
+ std::shared_ptr<SvxFrameDirectionItem> aBoxDirection(std::make_shared<SvxFrameDirectionItem>(SvxFrameDirection::Environment, RES_FRAMEDIR));
if(rSh.GetBoxDirection( aBoxDirection ))
{
- aBoxDirection.SetWhich(FN_TABLE_BOX_TEXTORIENTATION);
- rSet.Put(aBoxDirection);
+ aBoxDirection->SetWhich(FN_TABLE_BOX_TEXTORIENTATION);
+ rSet.Put(*aBoxDirection);
}
rSet.Put(SfxUInt16Item(FN_TABLE_SET_VERT_ALIGN, rSh.GetBoxAlign()));
@@ -159,15 +159,15 @@ void lcl_setTableAttributes( const SfxItemSet& rSet, SwWrtShell &rSh )
rSh.SetBoxBackground( *static_cast<const SvxBrushItem*>(pItem) );
if(pRowItem)
{
- SvxBrushItem aBrush(*static_cast<const SvxBrushItem*>(pRowItem));
- aBrush.SetWhich(RES_BACKGROUND);
- rSh.SetRowBackground(aBrush);
+ std::shared_ptr<SvxBrushItem> aBrush(static_cast<SvxBrushItem*>(pRowItem->Clone()));
+ aBrush->SetWhich(RES_BACKGROUND);
+ rSh.SetRowBackground(*aBrush);
}
if(pTableItem)
{
- SvxBrushItem aBrush(*static_cast<const SvxBrushItem*>(pTableItem));
- aBrush.SetWhich(RES_BACKGROUND);
- rSh.SetTabBackground( aBrush );
+ std::shared_ptr<SvxBrushItem> aBrush(static_cast<SvxBrushItem*>(pTableItem->Clone()));
+ aBrush->SetWhich(RES_BACKGROUND);
+ rSh.SetTabBackground(*aBrush);
}
}
if(bBorder)
diff --git a/sw/source/uibase/uiview/viewtab.cxx b/sw/source/uibase/uiview/viewtab.cxx
index f59d3103c75e..39e056cc0b2f 100644
--- a/sw/source/uibase/uiview/viewtab.cxx
+++ b/sw/source/uibase/uiview/viewtab.cxx
@@ -721,25 +721,24 @@ void SwView::ExecTabWin( SfxRequest const & rReq )
if ( i >= rTabStops.Count() )
{
// No DefTab
- SvxTabStopItem aTabStops( RES_PARATR_TABSTOP );
- aTabStops = rTabStops;
+ std::shared_ptr<SvxTabStopItem> aTabStops(static_cast<SvxTabStopItem*>(rTabStops.Clone()));
- ::lcl_EraseDefTabs(aTabStops);
+ ::lcl_EraseDefTabs(*aTabStops);
SvxTabStop aSwTabStop( 0, SvxTabAdjust::Default );
- aTabStops.Insert(aSwTabStop);
+ aTabStops->Insert(aSwTabStop);
const SvxTabStopItem& rDefTabs = rSh.GetDefault(RES_PARATR_TABSTOP);
- ::MakeDefTabs( ::GetTabDist(rDefTabs), aTabStops );
+ ::MakeDefTabs( ::GetTabDist(rDefTabs), *aTabStops );
if( pColl && pColl->IsAutoUpdateFormat())
{
SfxItemSet aSetTmp(GetPool(), svl::Items<RES_PARATR_TABSTOP, RES_PARATR_TABSTOP>{});
- aSetTmp.Put(aTabStops);
+ aSetTmp.Put(*aTabStops);
rSh.AutoUpdatePara( pColl, aSetTmp );
}
else
- rSh.SetAttrItem( aTabStops );
+ rSh.SetAttrItem( *aTabStops );
}
}
}
@@ -1453,15 +1452,15 @@ void SwView::StateTabWin(SfxItemSet& rSet)
}
else
{
- SvxLRSpaceItem aLR( RES_LR_SPACE );
+ std::shared_ptr<SvxLRSpaceItem> aLR(std::make_shared<SvxLRSpaceItem>(RES_LR_SPACE));
if ( !IsTabColFromDoc() )
{
- aLR = aCoreSet.Get(RES_LR_SPACE);
+ aLR.reset(static_cast<SvxLRSpaceItem*>(aCoreSet.Get(RES_LR_SPACE).Clone()));
// #i23726#
if (m_pNumRuleNodeFromDoc)
{
- short nOffset = static_cast< short >(aLR.GetTextLeft() +
+ short nOffset = static_cast< short >(aLR->GetTextLeft() +
// #i42922# Mouse move of numbering label
// has to consider the left indent of the paragraph
m_pNumRuleNodeFromDoc->GetLeftMarginWithNum( true ) );
@@ -1469,11 +1468,11 @@ void SwView::StateTabWin(SfxItemSet& rSet)
short nFLOffset;
m_pNumRuleNodeFromDoc->GetFirstLineOfsWithNum( nFLOffset );
- aLR.SetLeft( nOffset + nFLOffset );
+ aLR->SetLeft( nOffset + nFLOffset );
}
}
- aLR.SetWhich(nWhich);
- rSet.Put(aLR);
+ aLR->SetWhich(nWhich);
+ rSet.Put(*aLR);
}
break;
}
diff --git a/sw/source/uibase/utlui/navipi.cxx b/sw/source/uibase/utlui/navipi.cxx
index af7a34ca2e80..7aac5d6094c4 100644
--- a/sw/source/uibase/utlui/navipi.cxx
+++ b/sw/source/uibase/utlui/navipi.cxx
@@ -1115,7 +1115,7 @@ sal_Int8 SwNavigationPI::ExecuteDrop( const ExecuteDropEvent& rEvt )
m_pxObjectShell.reset();
}
SfxStringItem aFileItem(SID_FILE_NAME, sFileName );
- SfxStringItem aOptionsItem( SID_OPTIONS, OUString("HRC") );
+ SfxStringItem aOptionsItem( SID_OPTIONS, "HRC" );
SfxLinkItem aLink( SID_DONELINK,
LINK( this, SwNavigationPI, DoneLink ) );
GetActiveView()->GetViewFrame()->GetDispatcher()->ExecuteList(
diff --git a/sw/source/uibase/utlui/uitool.cxx b/sw/source/uibase/utlui/uitool.cxx
index 2c84af61fd53..c44434b25961 100644
--- a/sw/source/uibase/utlui/uitool.cxx
+++ b/sw/source/uibase/utlui/uitool.cxx
@@ -101,25 +101,27 @@ void SetMetric(MetricFormatter& rCtrl, FieldUnit eUnit)
void PrepareBoxInfo(SfxItemSet& rSet, const SwWrtShell& rSh)
{
- SvxBoxInfoItem aBoxInfo( SID_ATTR_BORDER_INNER );
+ std::shared_ptr<SvxBoxInfoItem> aBoxInfo(std::make_shared<SvxBoxInfoItem>(SID_ATTR_BORDER_INNER));
const SfxPoolItem *pBoxInfo;
- if ( SfxItemState::SET == rSet.GetItemState( SID_ATTR_BORDER_INNER,
- true, &pBoxInfo))
- aBoxInfo = *static_cast<const SvxBoxInfoItem*>(pBoxInfo);
+
+ if ( SfxItemState::SET == rSet.GetItemState( SID_ATTR_BORDER_INNER, true, &pBoxInfo))
+ {
+ aBoxInfo.reset(static_cast<SvxBoxInfoItem*>(pBoxInfo->Clone()));
+ }
// Table variant: If more than one table cells are selected
rSh.GetCursor(); //So that GetCursorCnt() returns the right thing
- aBoxInfo.SetTable (rSh.IsTableMode() && rSh.GetCursorCnt() > 1);
+ aBoxInfo->SetTable (rSh.IsTableMode() && rSh.GetCursorCnt() > 1);
// Always show the distance field
- aBoxInfo.SetDist (true);
+ aBoxInfo->SetDist (true);
// Set minimal size in tables and paragraphs
- aBoxInfo.SetMinDist (rSh.IsTableMode() || rSh.GetSelectionType() & (SelectionType::Text | SelectionType::Table));
+ aBoxInfo->SetMinDist (rSh.IsTableMode() || rSh.GetSelectionType() & (SelectionType::Text | SelectionType::Table));
// Set always the default distance
- aBoxInfo.SetDefDist (MIN_BORDER_DIST);
+ aBoxInfo->SetDefDist (MIN_BORDER_DIST);
// Single lines can have only in tables DontCare-Status
- aBoxInfo.SetValid(SvxBoxInfoItemValidFlags::DISABLE, !rSh.IsTableMode());
+ aBoxInfo->SetValid(SvxBoxInfoItemValidFlags::DISABLE, !rSh.IsTableMode());
- rSet.Put(aBoxInfo);
+ rSet.Put(*aBoxInfo);
}
void ConvertAttrCharToGen(SfxItemSet& rSet)
@@ -427,22 +429,24 @@ void PageDescToItemSet( const SwPageDesc& rPageDesc, SfxItemSet& rSet)
// Margins, border and the other stuff.
rSet.Put(rMaster.GetAttrSet());
- SvxBoxInfoItem aBoxInfo( SID_ATTR_BORDER_INNER );
+ std::shared_ptr<SvxBoxInfoItem> aBoxInfo(std::make_shared<SvxBoxInfoItem>(SID_ATTR_BORDER_INNER));
const SfxPoolItem *pBoxInfo;
- if ( SfxItemState::SET == rSet.GetItemState( SID_ATTR_BORDER_INNER,
- true, &pBoxInfo) )
- aBoxInfo = *static_cast<const SvxBoxInfoItem*>(pBoxInfo);
- aBoxInfo.SetTable( false );
+ if ( SfxItemState::SET == rSet.GetItemState( SID_ATTR_BORDER_INNER, true, &pBoxInfo) )
+ {
+ aBoxInfo.reset(static_cast<SvxBoxInfoItem*>(pBoxInfo->Clone()));
+ }
+
+ aBoxInfo->SetTable( false );
// Show always the distance field
- aBoxInfo.SetDist( true);
+ aBoxInfo->SetDist( true);
// Set minimal size in tables and paragraphs
- aBoxInfo.SetMinDist( false );
+ aBoxInfo->SetMinDist( false );
// Set always the default distance
- aBoxInfo.SetDefDist( MIN_BORDER_DIST );
+ aBoxInfo->SetDefDist( MIN_BORDER_DIST );
// Single lines can have only in tables DontCare-Status
- aBoxInfo.SetValid( SvxBoxInfoItemValidFlags::DISABLE );
- rSet.Put( aBoxInfo );
+ aBoxInfo->SetValid( SvxBoxInfoItemValidFlags::DISABLE );
+ rSet.Put( *aBoxInfo );
SfxStringItem aFollow(SID_ATTR_PAGE_EXT1, OUString());
if(rPageDesc.GetFollow())
@@ -492,7 +496,7 @@ void PageDescToItemSet( const SwPageDesc& rPageDesc, SfxItemSet& rSet)
// Shifting frame attributes
aHeaderSet.Put(pHeaderFormat->GetAttrSet());
- aHeaderSet.Put( aBoxInfo );
+ aHeaderSet.Put( *aBoxInfo );
// Create SetItem
SvxSetItem aSetItem(SID_ATTR_PAGE_HEADERSET, aHeaderSet);
@@ -542,7 +546,7 @@ void PageDescToItemSet( const SwPageDesc& rPageDesc, SfxItemSet& rSet)
// Shifting Frame attributes
aFooterSet.Put(pFooterFormat->GetAttrSet());
- aFooterSet.Put( aBoxInfo );
+ aFooterSet.Put( *aBoxInfo );
// Create SetItem
SvxSetItem aSetItem(SID_ATTR_PAGE_FOOTERSET, aFooterSet);