summaryrefslogtreecommitdiff
path: root/sc/source/core/data/patattr.cxx
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/data/patattr.cxx
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/data/patattr.cxx')
-rw-r--r--sc/source/core/data/patattr.cxx55
1 files changed, 30 insertions, 25 deletions
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 ) );