summaryrefslogtreecommitdiff
path: root/sw/source/core/doc
diff options
context:
space:
mode:
authorArmin Le Grand <Armin.Le.Grand@me.com>2019-04-18 19:25:06 +0200
committerArmin Le Grand <Armin.Le.Grand@me.com>2019-04-25 19:59:04 +0200
commit1e2682235cded9a7cd90e55f0bfc60a1285e9a46 (patch)
tree17457bc49d6faf37270c8a481b94765f58a5f434 /sw/source/core/doc
parent5e4c1e6ba425ce0b75864e4584a846957b032e61 (diff)
WIP: Further preparations for deeper Item changes
(1) Migrated all still existing binary load/save stuff in SfxPoolItem to legacy files. Isolated from Item implementations. Adapted all usages. No more methods Create/Store needed, also GetVersion removed (2) Removed operator= for SfxPoolItem. Adapted all usages. Goal ist to handle Items more as Objects ('Object-Oriented') in the sense to move/handle instances, not to copy one instance over another one (which is more and more problematic with hard to copy content as UNO API stuff or similar). This lead to much more usages of std::shared_ptr which correlates well with future plans fr Items (see dev branch). Next logic step will be to also remove copy constructor Linux build and corrections done Fixed Writer test and removed unused defines Fixed another unused m,acro Started to unify the AutoFormat stuff Changes to OUString constructor usages, tests completely No idea why, but SfxStringItem constructor which takes a OUString& now insists of not getting ::OUString's handed in - changed all 'SfxStringItem.*OUString.*".*"' accordingly Change-Id: Ibed7358b18fb019994a7490332b9d797a6694c29 Reviewed-on: https://gerrit.libreoffice.org/71075 Tested-by: Jenkins Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
Diffstat (limited to 'sw/source/core/doc')
-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
5 files changed, 174 insertions, 421 deletions
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 );
}