summaryrefslogtreecommitdiff
path: root/sc/source/core
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 /sc/source/core
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 'sc/source/core')
-rw-r--r--sc/source/core/data/attrib.cxx5
-rw-r--r--sc/source/core/data/patattr.cxx55
-rw-r--r--sc/source/core/tool/autoform.cxx343
3 files changed, 102 insertions, 301 deletions
diff --git a/sc/source/core/data/attrib.cxx b/sc/source/core/data/attrib.cxx
index cf6a61663a59..1b523f918a41 100644
--- a/sc/source/core/data/attrib.cxx
+++ b/sc/source/core/data/attrib.cxx
@@ -558,11 +558,6 @@ SfxPoolItem* ScViewObjectModeItem::Clone( SfxItemPool* ) const
return new ScViewObjectModeItem( *this );
}
-sal_uInt16 ScViewObjectModeItem::GetVersion( sal_uInt16 /* nFileVersion */ ) const
-{
- return 1;
-}
-
ScPageScaleToItem::ScPageScaleToItem() :
SfxPoolItem( ATTR_PAGE_SCALETO ),
mnWidth( 0 ),
diff --git a/sc/source/core/data/patattr.cxx b/sc/source/core/data/patattr.cxx
index efaebde867b5..fbf6d33e4a6c 100644
--- a/sc/source/core/data/patattr.cxx
+++ b/sc/source/core/data/patattr.cxx
@@ -582,14 +582,14 @@ void ScPatternAttr::FillToEditItemSet( SfxItemSet& rEditSet, const SfxItemSet& r
{
// Read Items
- SvxColorItem aColorItem(EE_CHAR_COLOR); // use item as-is
- SvxFontItem aFontItem(EE_CHAR_FONTINFO); // use item as-is
- SvxFontItem aCjkFontItem(EE_CHAR_FONTINFO_CJK);
- SvxFontItem aCtlFontItem(EE_CHAR_FONTINFO_CTL);
+ std::shared_ptr<SvxColorItem> aColorItem(std::make_shared<SvxColorItem>(EE_CHAR_COLOR)); // use item as-is
+ std::shared_ptr<SvxFontItem> aFontItem(std::make_shared<SvxFontItem>(EE_CHAR_FONTINFO)); // use item as-is
+ std::shared_ptr<SvxFontItem> aCjkFontItem(std::make_shared<SvxFontItem>(EE_CHAR_FONTINFO_CJK)); // use item as-is
+ std::shared_ptr<SvxFontItem> aCtlFontItem(std::make_shared<SvxFontItem>(EE_CHAR_FONTINFO_CTL)); // use item as-is
long nTHeight, nCjkTHeight, nCtlTHeight; // Twips
FontWeight eWeight, eCjkWeight, eCtlWeight;
- SvxUnderlineItem aUnderlineItem(LINESTYLE_NONE, EE_CHAR_UNDERLINE);
- SvxOverlineItem aOverlineItem(LINESTYLE_NONE, EE_CHAR_OVERLINE);
+ std::shared_ptr<SvxUnderlineItem> aUnderlineItem(std::make_shared<SvxUnderlineItem>(LINESTYLE_NONE, EE_CHAR_UNDERLINE));
+ std::shared_ptr<SvxOverlineItem> aOverlineItem(std::make_shared<SvxOverlineItem>(LINESTYLE_NONE, EE_CHAR_OVERLINE));
bool bWordLine;
FontStrikeout eStrike;
FontItalic eItalic, eCjkItalic, eCtlItalic;
@@ -610,17 +610,19 @@ void ScPatternAttr::FillToEditItemSet( SfxItemSet& rEditSet, const SfxItemSet& r
if ( pCondSet->GetItemState( ATTR_FONT_COLOR, true, &pItem ) != SfxItemState::SET )
pItem = &rSrcSet.Get( ATTR_FONT_COLOR );
- aColorItem = *static_cast<const SvxColorItem*>(pItem);
+ aColorItem.reset(static_cast<SvxColorItem*>(pItem->Clone()));
if ( pCondSet->GetItemState( ATTR_FONT, true, &pItem ) != SfxItemState::SET )
pItem = &rSrcSet.Get( ATTR_FONT );
- aFontItem = *static_cast<const SvxFontItem*>(pItem);
+ aFontItem.reset(static_cast<SvxFontItem*>(pItem->Clone()));
+
if ( pCondSet->GetItemState( ATTR_CJK_FONT, true, &pItem ) != SfxItemState::SET )
pItem = &rSrcSet.Get( ATTR_CJK_FONT );
- aCjkFontItem = *static_cast<const SvxFontItem*>(pItem);
+ aCjkFontItem.reset(static_cast<SvxFontItem*>(pItem->Clone()));
+
if ( pCondSet->GetItemState( ATTR_CTL_FONT, true, &pItem ) != SfxItemState::SET )
pItem = &rSrcSet.Get( ATTR_CTL_FONT );
- aCtlFontItem = *static_cast<const SvxFontItem*>(pItem);
+ aCtlFontItem.reset(static_cast<SvxFontItem*>(pItem->Clone()));
if ( pCondSet->GetItemState( ATTR_FONT_HEIGHT, true, &pItem ) != SfxItemState::SET )
pItem = &rSrcSet.Get( ATTR_FONT_HEIGHT );
@@ -654,11 +656,11 @@ void ScPatternAttr::FillToEditItemSet( SfxItemSet& rEditSet, const SfxItemSet& r
if ( pCondSet->GetItemState( ATTR_FONT_UNDERLINE, true, &pItem ) != SfxItemState::SET )
pItem = &rSrcSet.Get( ATTR_FONT_UNDERLINE );
- aUnderlineItem = *static_cast<const SvxUnderlineItem*>(pItem);
+ aUnderlineItem.reset(static_cast<SvxUnderlineItem*>(pItem->Clone()));
if ( pCondSet->GetItemState( ATTR_FONT_OVERLINE, true, &pItem ) != SfxItemState::SET )
pItem = &rSrcSet.Get( ATTR_FONT_OVERLINE );
- aOverlineItem = *static_cast<const SvxOverlineItem*>(pItem);
+ aOverlineItem.reset(static_cast<SvxOverlineItem*>(pItem->Clone()));
if ( pCondSet->GetItemState( ATTR_FONT_WORDLINE, true, &pItem ) != SfxItemState::SET )
pItem = &rSrcSet.Get( ATTR_FONT_WORDLINE );
@@ -707,10 +709,10 @@ void ScPatternAttr::FillToEditItemSet( SfxItemSet& rEditSet, const SfxItemSet& r
}
else // Everything directly from Pattern
{
- aColorItem = rSrcSet.Get( ATTR_FONT_COLOR );
- aFontItem = rSrcSet.Get( ATTR_FONT );
- aCjkFontItem = rSrcSet.Get( ATTR_CJK_FONT );
- aCtlFontItem = rSrcSet.Get( ATTR_CTL_FONT );
+ aColorItem.reset(static_cast<SvxColorItem*>(rSrcSet.Get(ATTR_FONT_COLOR).Clone()));
+ aFontItem.reset(static_cast<SvxFontItem*>(rSrcSet.Get(ATTR_FONT).Clone()));
+ aCjkFontItem.reset(static_cast<SvxFontItem*>(rSrcSet.Get(ATTR_CJK_FONT).Clone()));
+ aCtlFontItem.reset(static_cast<SvxFontItem*>(rSrcSet.Get(ATTR_CTL_FONT).Clone()));
nTHeight = rSrcSet.Get( ATTR_FONT_HEIGHT ).GetHeight();
nCjkTHeight = rSrcSet.Get( ATTR_CJK_FONT_HEIGHT ).GetHeight();
nCtlTHeight = rSrcSet.Get( ATTR_CTL_FONT_HEIGHT ).GetHeight();
@@ -720,8 +722,8 @@ void ScPatternAttr::FillToEditItemSet( SfxItemSet& rEditSet, const SfxItemSet& r
eItalic = rSrcSet.Get( ATTR_FONT_POSTURE ).GetValue();
eCjkItalic = rSrcSet.Get( ATTR_CJK_FONT_POSTURE ).GetValue();
eCtlItalic = rSrcSet.Get( ATTR_CTL_FONT_POSTURE ).GetValue();
- aUnderlineItem = rSrcSet.Get( ATTR_FONT_UNDERLINE );
- aOverlineItem = rSrcSet.Get( ATTR_FONT_OVERLINE );
+ aUnderlineItem.reset(static_cast<SvxUnderlineItem*>(rSrcSet.Get(ATTR_FONT_UNDERLINE).Clone()));
+ aOverlineItem.reset(static_cast<SvxOverlineItem*>(rSrcSet.Get(ATTR_FONT_OVERLINE).Clone()));
bWordLine = rSrcSet.Get( ATTR_FONT_WORDLINE ).GetValue();
eStrike = rSrcSet.Get( ATTR_FONT_CROSSEDOUT ).GetValue();
bOutline = rSrcSet.Get( ATTR_FONT_CONTOUR ).GetValue();
@@ -744,7 +746,7 @@ void ScPatternAttr::FillToEditItemSet( SfxItemSet& rEditSet, const SfxItemSet& r
// put items into EditEngine ItemSet
- if ( aColorItem.GetValue() == COL_AUTO )
+ if ( aColorItem->GetValue() == COL_AUTO )
{
// When cell attributes are converted to EditEngine paragraph attributes,
// don't create a hard item for automatic color, because that would be converted
@@ -754,18 +756,21 @@ void ScPatternAttr::FillToEditItemSet( SfxItemSet& rEditSet, const SfxItemSet& r
rEditSet.ClearItem( EE_CHAR_COLOR );
}
else
- rEditSet.Put( aColorItem );
- rEditSet.Put( aFontItem );
- rEditSet.Put( aCjkFontItem );
- rEditSet.Put( aCtlFontItem );
+ {
+ rEditSet.Put( *aColorItem );
+ }
+
+ rEditSet.Put( *aFontItem );
+ rEditSet.Put( *aCjkFontItem );
+ rEditSet.Put( *aCtlFontItem );
rEditSet.Put( SvxFontHeightItem( nHeight, 100, EE_CHAR_FONTHEIGHT ) );
rEditSet.Put( SvxFontHeightItem( nCjkHeight, 100, EE_CHAR_FONTHEIGHT_CJK ) );
rEditSet.Put( SvxFontHeightItem( nCtlHeight, 100, EE_CHAR_FONTHEIGHT_CTL ) );
rEditSet.Put( SvxWeightItem ( eWeight, EE_CHAR_WEIGHT ) );
rEditSet.Put( SvxWeightItem ( eCjkWeight, EE_CHAR_WEIGHT_CJK ) );
rEditSet.Put( SvxWeightItem ( eCtlWeight, EE_CHAR_WEIGHT_CTL ) );
- rEditSet.Put( aUnderlineItem );
- rEditSet.Put( aOverlineItem );
+ rEditSet.Put( *aUnderlineItem );
+ rEditSet.Put( *aOverlineItem );
rEditSet.Put( SvxWordLineModeItem( bWordLine, EE_CHAR_WLM ) );
rEditSet.Put( SvxCrossedOutItem( eStrike, EE_CHAR_STRIKEOUT ) );
rEditSet.Put( SvxPostureItem ( eItalic, EE_CHAR_ITALIC ) );
diff --git a/sc/source/core/tool/autoform.cxx b/sc/source/core/tool/autoform.cxx
index fd28eb291ab4..00e0a7430b02 100644
--- a/sc/source/core/tool/autoform.cxx
+++ b/sc/source/core/tool/autoform.cxx
@@ -42,6 +42,10 @@
#include <scresid.hxx>
#include <document.hxx>
+#include <svl/legacyitem.hxx>
+#include <editeng/legacyitem.hxx>
+#include <svx/legacyitem.hxx>
+
/*
* XXX: BIG RED NOTICE! Changes MUST be binary file format compatible and MUST
* be synchronized with Writer's SwTableAutoFmtTbl sw/source/core/doc/tblafmt.cxx
@@ -61,20 +65,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 support
-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;
@@ -119,163 +112,77 @@ namespace
}
}
-ScAfVersions::ScAfVersions() :
- 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),
- nHorJustifyVersion(0),
- nVerJustifyVersion(0),
- nOrientationVersion(0),
- nMarginVersion(0),
- nBoolVersion(0),
- nInt32Version(0),
- nRotateModeVersion(0),
- nNumFmtVersion(0)
+ScAfVersions::ScAfVersions()
+: AutoFormatVersions(),
+ swVersions()
{
}
void ScAfVersions::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)
- rStream >> swVersions;
- rStream.ReadUInt16( nHorJustifyVersion );
- rStream.ReadUInt16( nVerJustifyVersion );
- rStream.ReadUInt16( nOrientationVersion );
- rStream.ReadUInt16( nMarginVersion );
- rStream.ReadUInt16( nBoolVersion );
- if ( nVer >= AUTOFORMAT_ID_504 )
{
- rStream.ReadUInt16( nInt32Version );
- rStream.ReadUInt16( nRotateModeVersion );
+ rStream >> swVersions;
}
- rStream.ReadUInt16( nNumFmtVersion );
+ LoadBlockB(rStream, nVer);
}
void ScAfVersions::Write(SvStream& rStream, sal_uInt16 fileVersion)
{
- rStream.WriteUInt16( SvxFontItem(ATTR_FONT).GetVersion(fileVersion) );
- rStream.WriteUInt16( SvxFontHeightItem(240, 100, ATTR_FONT_HEIGHT).GetVersion(fileVersion) );
- rStream.WriteUInt16( SvxWeightItem(WEIGHT_NORMAL, ATTR_FONT_WEIGHT).GetVersion(fileVersion) );
- rStream.WriteUInt16( SvxPostureItem(ITALIC_NONE, ATTR_FONT_POSTURE).GetVersion(fileVersion) );
- rStream.WriteUInt16( SvxUnderlineItem(LINESTYLE_NONE, ATTR_FONT_UNDERLINE).GetVersion(fileVersion) );
- rStream.WriteUInt16( SvxOverlineItem(LINESTYLE_NONE, ATTR_FONT_OVERLINE).GetVersion(fileVersion) );
- rStream.WriteUInt16( SvxCrossedOutItem(STRIKEOUT_NONE, ATTR_FONT_CROSSEDOUT).GetVersion(fileVersion) );
- rStream.WriteUInt16( SvxContourItem(false, ATTR_FONT_CONTOUR).GetVersion(fileVersion) );
- rStream.WriteUInt16( SvxShadowedItem(false, ATTR_FONT_SHADOWED).GetVersion(fileVersion) );
- rStream.WriteUInt16( SvxColorItem(ATTR_FONT_COLOR).GetVersion(fileVersion) );
- rStream.WriteUInt16( SvxBoxItem(ATTR_BORDER).GetVersion(fileVersion) );
- rStream.WriteUInt16( SvxLineItem(SID_FRAME_LINESTYLE).GetVersion(fileVersion) );
- rStream.WriteUInt16( SvxBrushItem(ATTR_BACKGROUND).GetVersion(fileVersion) );
-
- rStream.WriteUInt16( SvxAdjustItem(SvxAdjust::Left, 0).GetVersion(fileVersion) );
+ AutoFormatVersions::WriteBlockA(rStream, fileVersion);
+
if (fileVersion >= SOFFICE_FILEFORMAT_50)
+ {
WriteAutoFormatSwBlob( rStream, swVersions );
+ }
- rStream.WriteUInt16( SvxHorJustifyItem(SvxCellHorJustify::Standard, ATTR_HOR_JUSTIFY).GetVersion(fileVersion) );
- rStream.WriteUInt16( SvxVerJustifyItem(SvxCellVerJustify::Standard, ATTR_VER_JUSTIFY).GetVersion(fileVersion) );
- rStream.WriteUInt16( SvxOrientationItem(SvxCellOrientation::Standard, 0).GetVersion(fileVersion) );
- rStream.WriteUInt16( SvxMarginItem(ATTR_MARGIN).GetVersion(fileVersion) );
- rStream.WriteUInt16( SfxBoolItem(ATTR_LINEBREAK).GetVersion(fileVersion) );
- rStream.WriteUInt16( SfxInt32Item(ATTR_ROTATE_VALUE).GetVersion(fileVersion) );
- rStream.WriteUInt16( SvxRotateModeItem(SVX_ROTATE_MODE_STANDARD,0).GetVersion(fileVersion) );
-
- rStream.WriteUInt16( 0 ); // Num-Format
-}
-
-ScAutoFormatDataField::ScAutoFormatDataField() :
- aFont( ATTR_FONT ),
- aHeight( 240, 100, ATTR_FONT_HEIGHT ),
- aWeight( WEIGHT_NORMAL, ATTR_FONT_WEIGHT ),
- aPosture( ITALIC_NONE, ATTR_FONT_POSTURE ),
-
- aCJKFont( ATTR_CJK_FONT ),
- aCJKHeight( 240, 100, ATTR_CJK_FONT_HEIGHT ),
- aCJKWeight( WEIGHT_NORMAL, ATTR_CJK_FONT_WEIGHT ),
- aCJKPosture( ITALIC_NONE, ATTR_CJK_FONT_POSTURE ),
-
- aCTLFont( ATTR_CTL_FONT ),
- aCTLHeight( 240, 100, ATTR_CTL_FONT_HEIGHT ),
- aCTLWeight( WEIGHT_NORMAL, ATTR_CTL_FONT_WEIGHT ),
- aCTLPosture( ITALIC_NONE, ATTR_CTL_FONT_POSTURE ),
-
- aUnderline( LINESTYLE_NONE,ATTR_FONT_UNDERLINE ),
- aOverline( LINESTYLE_NONE,ATTR_FONT_OVERLINE ),
- aCrossedOut( STRIKEOUT_NONE, ATTR_FONT_CROSSEDOUT ),
- aContour( false, ATTR_FONT_CONTOUR ),
- aShadowed( false, ATTR_FONT_SHADOWED ),
- aColor( ATTR_FONT_COLOR ),
- aBox( ATTR_BORDER ),
- aTLBR( ATTR_BORDER_TLBR ),
- aBLTR( ATTR_BORDER_BLTR ),
- aBackground( ATTR_BACKGROUND ),
- aAdjust( SvxAdjust::Left, 0 ),
- aHorJustify( SvxCellHorJustify::Standard, ATTR_HOR_JUSTIFY ),
- aVerJustify( SvxCellVerJustify::Standard, ATTR_VER_JUSTIFY ),
- aMargin( ATTR_MARGIN ),
- aLinebreak( ATTR_LINEBREAK ),
- aRotateAngle( ATTR_ROTATE_VALUE ),
- aRotateMode( SVX_ROTATE_MODE_STANDARD, ATTR_ROTATE_MODE )
-{
-}
-
-ScAutoFormatDataField::ScAutoFormatDataField( const ScAutoFormatDataField& rCopy ) :
- aFont( rCopy.aFont ),
- aHeight( rCopy.aHeight ),
- aWeight( rCopy.aWeight ),
- aPosture( rCopy.aPosture ),
- aCJKFont( rCopy.aCJKFont ),
- aCJKHeight( rCopy.aCJKHeight ),
- aCJKWeight( rCopy.aCJKWeight ),
- aCJKPosture( rCopy.aCJKPosture ),
- aCTLFont( rCopy.aCTLFont ),
- aCTLHeight( rCopy.aCTLHeight ),
- aCTLWeight( rCopy.aCTLWeight ),
- aCTLPosture( rCopy.aCTLPosture ),
- aUnderline( rCopy.aUnderline ),
- aOverline( rCopy.aOverline ),
- aCrossedOut( rCopy.aCrossedOut ),
- aContour( rCopy.aContour ),
- aShadowed( rCopy.aShadowed ),
- aColor( rCopy.aColor ),
- aBox( rCopy.aBox ),
- aTLBR( rCopy.aTLBR ),
- aBLTR( rCopy.aBLTR ),
- aBackground( rCopy.aBackground ),
- aAdjust( rCopy.aAdjust ),
- aHorJustify( rCopy.aHorJustify ),
- aVerJustify( rCopy.aVerJustify ),
- aStacked( rCopy.aStacked ),
- aMargin( rCopy.aMargin ),
- aLinebreak( rCopy.aLinebreak ),
- aRotateAngle( rCopy.aRotateAngle ),
- aRotateMode( rCopy.aRotateMode ),
+ AutoFormatVersions::WriteBlockB(rStream, fileVersion);
+}
+
+ScAutoFormatDataField::ScAutoFormatDataField()
+: AutoFormatBase(),
+ m_swFields(),
+ aNumFormat()
+{
+ // need to set default instances for base class AutoFormatBase here
+ // due to ressource defines (e.g. ATTR_FONT) which are not available
+ // in svx and different in the different usages of derivations
+ m_aFont = std::make_shared<SvxFontItem>(ATTR_FONT);
+ m_aHeight = std::make_shared<SvxFontHeightItem>(240, 100, ATTR_FONT_HEIGHT);
+ m_aWeight = std::make_shared<SvxWeightItem>(WEIGHT_NORMAL, ATTR_FONT_WEIGHT);
+ m_aPosture = std::make_shared<SvxPostureItem>(ITALIC_NONE, ATTR_FONT_POSTURE);
+ m_aCJKFont = std::make_shared<SvxFontItem>(ATTR_CJK_FONT);
+ m_aCJKHeight = std::make_shared<SvxFontHeightItem>(240, 100, ATTR_CJK_FONT_HEIGHT);
+ m_aCJKWeight = std::make_shared<SvxWeightItem>(WEIGHT_NORMAL, ATTR_CJK_FONT_WEIGHT);
+ m_aCJKPosture = std::make_shared<SvxPostureItem>(ITALIC_NONE, ATTR_CJK_FONT_POSTURE);
+ m_aCTLFont = std::make_shared<SvxFontItem>(ATTR_CTL_FONT);
+ m_aCTLHeight = std::make_shared<SvxFontHeightItem>(240, 100, ATTR_CTL_FONT_HEIGHT);
+ m_aCTLWeight = std::make_shared<SvxWeightItem>(WEIGHT_NORMAL, ATTR_CTL_FONT_WEIGHT);
+ m_aCTLPosture = std::make_shared<SvxPostureItem>(ITALIC_NONE, ATTR_CTL_FONT_POSTURE);
+ m_aUnderline = std::make_shared<SvxUnderlineItem>(LINESTYLE_NONE,ATTR_FONT_UNDERLINE);
+ m_aOverline = std::make_shared<SvxOverlineItem>(LINESTYLE_NONE,ATTR_FONT_OVERLINE);
+ m_aCrossedOut = std::make_shared<SvxCrossedOutItem>(STRIKEOUT_NONE, ATTR_FONT_CROSSEDOUT);
+ m_aContour = std::make_shared<SvxContourItem>(false, ATTR_FONT_CONTOUR);
+ m_aShadowed = std::make_shared<SvxShadowedItem>(false, ATTR_FONT_SHADOWED);
+ m_aColor = std::make_shared<SvxColorItem>(ATTR_FONT_COLOR);
+ m_aBox = std::make_shared<SvxBoxItem>(ATTR_BORDER);
+ m_aTLBR = std::make_shared<SvxLineItem>(ATTR_BORDER_TLBR);
+ m_aBLTR = std::make_shared<SvxLineItem>(ATTR_BORDER_BLTR);
+ m_aBackground = std::make_shared<SvxBrushItem>(ATTR_BACKGROUND);
+ m_aAdjust = std::make_shared<SvxAdjustItem>(SvxAdjust::Left, 0);
+ m_aHorJustify = std::make_shared<SvxHorJustifyItem>(SvxCellHorJustify::Standard, ATTR_HOR_JUSTIFY);
+ m_aVerJustify = std::make_shared<SvxVerJustifyItem>(SvxCellVerJustify::Standard, ATTR_VER_JUSTIFY);
+ m_aStacked = std::make_shared<SfxBoolItem>();
+ m_aMargin = std::make_shared<SvxMarginItem>(ATTR_MARGIN);
+ m_aLinebreak = std::make_shared<SfxBoolItem>(ATTR_LINEBREAK);
+ m_aRotateAngle = std::make_shared<SfxInt32Item>(ATTR_ROTATE_VALUE);
+ m_aRotateMode = std::make_shared<SvxRotateModeItem>(SVX_ROTATE_MODE_STANDARD, ATTR_ROTATE_MODE);
+}
+
+ScAutoFormatDataField::ScAutoFormatDataField( const ScAutoFormatDataField& rCopy )
+: AutoFormatBase(rCopy),
+ m_swFields(), // was not copied in original, needed?
aNumFormat( rCopy.aNumFormat )
{
}
@@ -284,86 +191,18 @@ ScAutoFormatDataField::~ScAutoFormatDataField()
{
}
-void ScAutoFormatDataField::SetAdjust( const SvxAdjustItem& rAdjust )
-{
- aAdjust.SetAdjust( rAdjust.GetAdjust() );
- aAdjust.SetOneWord( rAdjust.GetOneWord() );
- aAdjust.SetLastBlock( rAdjust.GetLastBlock() );
-}
-
-#define READ( aItem, ItemType, nVers ) \
- pNew = aItem.Create( rStream, nVers ); \
- aItem = *static_cast<ItemType*>(pNew); \
- delete pNew;
-
bool ScAutoFormatDataField::Load( SvStream& rStream, const ScAfVersions& rVersions, sal_uInt16 nVer )
{
- SfxPoolItem* pNew;
- SvxOrientationItem aOrientation( SvxCellOrientation::Standard, 0 );
-
- READ( aFont, SvxFontItem, rVersions.nFontVersion)
- READ( aHeight, SvxFontHeightItem, rVersions.nFontHeightVersion)
- READ( aWeight, SvxWeightItem, rVersions.nWeightVersion)
- READ( aPosture, SvxPostureItem, rVersions.nPostureVersion)
- // --- from 641 on: CJK and CTL font settings
- if( AUTOFORMAT_DATA_ID_641 <= nVer )
- {
- READ( aCJKFont, SvxFontItem, rVersions.nFontVersion)
- READ( aCJKHeight, SvxFontHeightItem, rVersions.nFontHeightVersion)
- READ( aCJKWeight, SvxWeightItem, rVersions.nWeightVersion)
- READ( aCJKPosture, SvxPostureItem, rVersions.nPostureVersion)
- READ( aCTLFont, SvxFontItem, rVersions.nFontVersion)
- READ( aCTLHeight, SvxFontHeightItem, rVersions.nFontHeightVersion)
- READ( aCTLWeight, SvxWeightItem, rVersions.nWeightVersion)
- READ( aCTLPosture, SvxPostureItem, rVersions.nPostureVersion)
- }
- READ( aUnderline, SvxUnderlineItem, rVersions.nUnderlineVersion)
- if ( nVer >= AUTOFORMAT_DATA_ID_300OVRLN )
- {
- READ( aOverline, SvxOverlineItem, rVersions.nOverlineVersion)
- }
- READ( aCrossedOut, SvxCrossedOutItem, rVersions.nCrossedOutVersion)
- READ( aContour, SvxContourItem, rVersions.nContourVersion)
- READ( aShadowed, SvxShadowedItem, rVersions.nShadowedVersion)
- READ( aColor, SvxColorItem, rVersions.nColorVersion)
- READ( aBox, SvxBoxItem, rVersions.nBoxVersion)
-
- // --- from 680/dr14 on: diagonal frame lines
- if( AUTOFORMAT_DATA_ID_680DR14 <= nVer )
- {
- READ( aTLBR, SvxLineItem, rVersions.nLineVersion)
- READ( aBLTR, SvxLineItem, rVersions.nLineVersion)
- }
-
- READ( aBackground, SvxBrushItem, rVersions.nBrushVersion)
-
- pNew = aAdjust.Create( rStream, rVersions.nAdjustVersion );
- SetAdjust( *static_cast<SvxAdjustItem*>(pNew) );
- delete pNew;
+ LoadBlockA( rStream, rVersions, nVer );
if (nVer >= AUTOFORMAT_DATA_ID_31005)
- rStream >> m_swFields;
-
- READ( aHorJustify, SvxHorJustifyItem, rVersions.nHorJustifyVersion)
- READ( aVerJustify, SvxVerJustifyItem, rVersions.nVerJustifyVersion)
- READ( aOrientation, SvxOrientationItem, rVersions.nOrientationVersion)
- READ( aMargin, SvxMarginItem, rVersions.nMarginVersion)
-
- pNew = aLinebreak.Create( rStream, rVersions.nBoolVersion );
- SetLinebreak( *static_cast<SfxBoolItem*>(pNew) );
- delete pNew;
-
- if ( nVer >= AUTOFORMAT_DATA_ID_504 )
{
- pNew = aRotateAngle.Create( rStream, rVersions.nInt32Version );
- SetRotateAngle( *static_cast<SfxInt32Item*>(pNew) );
- delete pNew;
- pNew = aRotateMode.Create( rStream, rVersions.nRotateModeVersion );
- SetRotateMode( *static_cast<SvxRotateModeItem*>(pNew) );
- delete pNew;
+ rStream >> m_swFields;
}
- if( 0 == rVersions.nNumFmtVersion )
+ LoadBlockB( rStream, rVersions, nVer );
+
+ if( 0 == rVersions.nNumFormatVersion )
{
// --- from 680/dr25 on: store strings as UTF-8
rtl_TextEncoding eCharSet = (nVer >= AUTOFORMAT_ID_680DR25) ? RTL_TEXTENCODING_UTF8 : rStream.GetStreamCharSet();
@@ -373,60 +212,22 @@ bool ScAutoFormatDataField::Load( SvStream& rStream, const ScAfVersions& rVersio
// adjust charset in font
rtl_TextEncoding eSysSet = osl_getThreadTextEncoding();
rtl_TextEncoding eSrcSet = rStream.GetStreamCharSet();
- if( eSrcSet != eSysSet && aFont.GetCharSet() == eSrcSet )
- aFont.SetCharSet(eSysSet);
-
- aStacked.SetValue( aOrientation.IsStacked() );
- aRotateAngle.SetValue( aOrientation.GetRotation( aRotateAngle.GetValue() ) );
+ if( eSrcSet != eSysSet && m_aFont->GetCharSet() == eSrcSet )
+ m_aFont->SetCharSet(eSysSet);
return (rStream.GetError() == ERRCODE_NONE);
}
bool ScAutoFormatDataField::Save( SvStream& rStream, sal_uInt16 fileVersion )
{
- SvxOrientationItem aOrientation( aRotateAngle.GetValue(), aStacked.GetValue(), 0 );
-
- aFont.Store ( rStream, aFont.GetVersion( fileVersion ) );
- aHeight.Store ( rStream, aHeight.GetVersion( fileVersion ) );
- aWeight.Store ( rStream, aWeight.GetVersion( fileVersion ) );
- aPosture.Store ( rStream, aPosture.GetVersion( fileVersion ) );
- // --- from 641 on: CJK and CTL font settings
- aCJKFont.Store ( rStream, aCJKFont.GetVersion( fileVersion ) );
- aCJKHeight.Store ( rStream, aCJKHeight.GetVersion( fileVersion ) );
- aCJKWeight.Store ( rStream, aCJKWeight.GetVersion( fileVersion ) );
- aCJKPosture.Store ( rStream, aCJKPosture.GetVersion( fileVersion ) );
- aCTLFont.Store ( rStream, aCTLFont.GetVersion( fileVersion ) );
- aCTLHeight.Store ( rStream, aCTLHeight.GetVersion( fileVersion ) );
- aCTLWeight.Store ( rStream, aCTLWeight.GetVersion( fileVersion ) );
- aCTLPosture.Store ( rStream, aCTLPosture.GetVersion( fileVersion ) );
-
- aUnderline.Store ( rStream, aUnderline.GetVersion( fileVersion ) );
- // --- from DEV300/overline2 on: overline support
- aOverline.Store ( rStream, aOverline.GetVersion( fileVersion ) );
- aCrossedOut.Store ( rStream, aCrossedOut.GetVersion( fileVersion ) );
- aContour.Store ( rStream, aContour.GetVersion( fileVersion ) );
- aShadowed.Store ( rStream, aShadowed.GetVersion( fileVersion ) );
- aColor.Store ( rStream, aColor.GetVersion( fileVersion ) );
- aBox.Store ( rStream, aBox.GetVersion( fileVersion ) );
-
- // --- from 680/dr14 on: diagonal frame lines
- aTLBR.Store ( rStream, aTLBR.GetVersion( fileVersion ) );
- aBLTR.Store ( rStream, aBLTR.GetVersion( fileVersion ) );
-
- aBackground.Store ( rStream, aBackground.GetVersion( fileVersion ) );
-
- aAdjust.Store ( rStream, aAdjust.GetVersion( fileVersion ) );
+ SaveBlockA( rStream, fileVersion );
+
if (fileVersion >= SOFFICE_FILEFORMAT_50)
+ {
WriteAutoFormatSwBlob( rStream, m_swFields );
+ }
- aHorJustify.Store ( rStream, aHorJustify.GetVersion( fileVersion ) );
- aVerJustify.Store ( rStream, aVerJustify.GetVersion( fileVersion ) );
- aOrientation.Store ( rStream, aOrientation.GetVersion( fileVersion ) );
- aMargin.Store ( rStream, aMargin.GetVersion( fileVersion ) );
- aLinebreak.Store ( rStream, aLinebreak.GetVersion( fileVersion ) );
- // rotation from SO5 on
- aRotateAngle.Store ( rStream, aRotateAngle.GetVersion( fileVersion ) );
- aRotateMode.Store ( rStream, aRotateMode.GetVersion( fileVersion ) );
+ SaveBlockB( rStream, fileVersion );
// --- from 680/dr25 on: store strings as UTF-8
aNumFormat.Save( rStream, RTL_TEXTENCODING_UTF8 );