diff options
author | Armin Le Grand <Armin.Le.Grand@me.com> | 2019-04-18 19:25:06 +0200 |
---|---|---|
committer | Armin Le Grand <Armin.Le.Grand@me.com> | 2019-04-25 19:59:04 +0200 |
commit | 1e2682235cded9a7cd90e55f0bfc60a1285e9a46 (patch) | |
tree | 17457bc49d6faf37270c8a481b94765f58a5f434 /sc/source | |
parent | 5e4c1e6ba425ce0b75864e4584a846957b032e61 (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')
-rw-r--r-- | sc/source/core/data/attrib.cxx | 5 | ||||
-rw-r--r-- | sc/source/core/data/patattr.cxx | 55 | ||||
-rw-r--r-- | sc/source/core/tool/autoform.cxx | 343 | ||||
-rw-r--r-- | sc/source/ui/docshell/docsh4.cxx | 4 | ||||
-rw-r--r-- | sc/source/ui/drawfunc/drtxtob.cxx | 15 | ||||
-rw-r--r-- | sc/source/ui/inc/viewfunc.hxx | 5 | ||||
-rw-r--r-- | sc/source/ui/view/cellsh.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/view/editsh.cxx | 17 | ||||
-rw-r--r-- | sc/source/ui/view/formatsh.cxx | 92 | ||||
-rw-r--r-- | sc/source/ui/view/output2.cxx | 12 | ||||
-rw-r--r-- | sc/source/ui/view/tabvwsha.cxx | 29 | ||||
-rw-r--r-- | sc/source/ui/view/viewfun2.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/view/viewfun4.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/view/viewfunc.cxx | 20 |
14 files changed, 206 insertions, 397 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 ); diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx index de8d9e0d118e..549231097045 100644 --- a/sc/source/ui/docshell/docsh4.cxx +++ b/sc/source/ui/docshell/docsh4.cxx @@ -1138,8 +1138,8 @@ void ScDocShell::Execute( SfxRequest& rReq ) #endif case SID_OPEN_CALC: { - SfxStringItem aApp(SID_DOC_SERVICE, OUString("com.sun.star.sheet.SpreadsheetDocument")); - SfxStringItem aTarget(SID_TARGETNAME, OUString("_blank")); + SfxStringItem aApp(SID_DOC_SERVICE, "com.sun.star.sheet.SpreadsheetDocument"); + SfxStringItem aTarget(SID_TARGETNAME, "_blank"); GetViewData()->GetDispatcher().ExecuteList( SID_OPENDOC, SfxCallMode::API|SfxCallMode::SYNCHRON, { &aApp, &aTarget }); diff --git a/sc/source/ui/drawfunc/drtxtob.cxx b/sc/source/ui/drawfunc/drtxtob.cxx index e13883ed3039..f735e56ef082 100644 --- a/sc/source/ui/drawfunc/drtxtob.cxx +++ b/sc/source/ui/drawfunc/drtxtob.cxx @@ -204,7 +204,7 @@ void ScDrawTextObjectBar::Execute( SfxRequest &rReq ) const SvxFontItem& rItem = pOutView->GetAttribs().Get(EE_CHAR_FONTINFO); OUString aString; - SvxFontItem aNewItem( EE_CHAR_FONTINFO ); + std::shared_ptr<SvxFontItem> aNewItem(std::make_shared<SvxFontItem>(EE_CHAR_FONTINFO)); const SfxItemSet *pArgs = rReq.GetArgs(); const SfxPoolItem* pItem = nullptr; @@ -221,12 +221,15 @@ void ScDrawTextObjectBar::Execute( SfxRequest &rReq ) { const OUString& aFontName(pFontItem->GetValue()); vcl::Font aFont(aFontName, Size(1,1)); // Size only because of CTOR - aNewItem = SvxFontItem( aFont.GetFamilyType(), aFont.GetFamilyName(), - aFont.GetStyleName(), aFont.GetPitch(), - aFont.GetCharSet(), ATTR_FONT ); + aNewItem = std::make_shared<SvxFontItem>( + aFont.GetFamilyType(), aFont.GetFamilyName(), + aFont.GetStyleName(), aFont.GetPitch(), + aFont.GetCharSet(), ATTR_FONT); } else - aNewItem = rItem; + { + aNewItem.reset(static_cast<SvxFontItem*>(rItem.Clone())); + } } else ScViewUtil::ExecuteCharMap( rItem, *pViewData->GetViewShell()->GetViewFrame() ); @@ -234,7 +237,7 @@ void ScDrawTextObjectBar::Execute( SfxRequest &rReq ) if ( !aString.isEmpty() ) { SfxItemSet aSet( pOutliner->GetEmptyItemSet() ); - aSet.Put( aNewItem ); + aSet.Put( *aNewItem ); // If nothing is selected, then SetAttribs of the View selects a word pOutView->GetOutliner()->QuickSetAttribs( aSet, pOutView->GetSelection() ); pOutView->InsertText(aString); diff --git a/sc/source/ui/inc/viewfunc.hxx b/sc/source/ui/inc/viewfunc.hxx index 7719cddf6a5c..963b41f863ec 100644 --- a/sc/source/ui/inc/viewfunc.hxx +++ b/sc/source/ui/inc/viewfunc.hxx @@ -71,8 +71,9 @@ public: ~ScViewFunc(); SC_DLLPUBLIC const ScPatternAttr* GetSelectionPattern (); - void GetSelectionFrame ( SvxBoxItem& rLineOuter, - SvxBoxInfoItem& rLineInner ); + void GetSelectionFrame( + std::shared_ptr<SvxBoxItem>& rLineOuter, + std::shared_ptr<SvxBoxInfoItem>& rLineInner ); SvtScriptType GetSelectionScriptType(); diff --git a/sc/source/ui/view/cellsh.cxx b/sc/source/ui/view/cellsh.cxx index b751a8dd893f..26020a86ef4f 100644 --- a/sc/source/ui/view/cellsh.cxx +++ b/sc/source/ui/view/cellsh.cxx @@ -806,7 +806,7 @@ void ScCellShell::GetState(SfxItemSet &rSet) // In interpreter may happen via rescheduled Basic if ( pDoc->IsInInterpreter() ) - rSet.Put( SfxStringItem( nWhich, OUString("...") ) ); + rSet.Put( SfxStringItem( nWhich, "..." ) ); else { FormulaError nErrCode = FormulaError::NONE; diff --git a/sc/source/ui/view/editsh.cxx b/sc/source/ui/view/editsh.cxx index b65bd957ab3b..100592811994 100644 --- a/sc/source/ui/view/editsh.cxx +++ b/sc/source/ui/view/editsh.cxx @@ -391,7 +391,7 @@ void ScEditShell::Execute( SfxRequest& rReq ) pTableView->GetAttribs().Get(nFontWhich)); OUString aString; - SvxFontItem aNewItem( EE_CHAR_FONTINFO ); + std::shared_ptr<SvxFontItem> aNewItem(std::make_shared<SvxFontItem>(EE_CHAR_FONTINFO)); const SfxItemSet *pArgs = rReq.GetArgs(); const SfxPoolItem* pItem = nullptr; @@ -408,12 +408,15 @@ void ScEditShell::Execute( SfxRequest& rReq ) { const OUString& aFontName(pFontItem->GetValue()); vcl::Font aFont(aFontName, Size(1,1)); // Size just because CTOR - aNewItem = SvxFontItem( aFont.GetFamilyType(), aFont.GetFamilyName(), - aFont.GetStyleName(), aFont.GetPitch(), - aFont.GetCharSet(), ATTR_FONT ); + aNewItem = std::make_shared<SvxFontItem>( + aFont.GetFamilyType(), aFont.GetFamilyName(), + aFont.GetStyleName(), aFont.GetPitch(), + aFont.GetCharSet(), ATTR_FONT); } else - aNewItem = rItem; + { + aNewItem.reset(static_cast<SvxFontItem*>(rItem.Clone())); + } } else { @@ -436,7 +439,7 @@ void ScEditShell::Execute( SfxRequest& rReq ) SfxItemSet aSet( pTableView->GetEmptyItemSet() ); SvxScriptSetItem aSetItem( SID_ATTR_CHAR_FONT, GetPool() ); - aSetItem.PutItemForScriptType( nSetScript, aNewItem ); + aSetItem.PutItemForScriptType( nSetScript, *aNewItem ); aSet.Put( aSetItem.GetItemSet(), false ); // SetAttribs on the View selects a word, when nothing is selected @@ -446,7 +449,7 @@ void ScEditShell::Execute( SfxRequest& rReq ) pTopView->InsertText(aString); SfxStringItem aStringItem( SID_CHARMAP, aString ); - SfxStringItem aFontItem( SID_ATTR_SPECIALCHAR, aNewItem.GetFamilyName() ); + SfxStringItem aFontItem( SID_ATTR_SPECIALCHAR, aNewItem->GetFamilyName() ); rReq.AppendItem( aFontItem ); rReq.AppendItem( aStringItem ); rReq.Done(); diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx index f7315debd5de..0f085f50e913 100644 --- a/sc/source/ui/view/formatsh.cxx +++ b/sc/source/ui/view/formatsh.cxx @@ -2053,121 +2053,121 @@ void ScFormatShell::GetAttrState( SfxItemSet& rSet ) editeng::SvxBorderLine aLine(nullptr,0,SvxBorderLineStyle::SOLID); bool bCol = false; bool bColDisable = false, bStyleDisable = false; - SvxBoxItem aBoxItem(ATTR_BORDER); - SvxBoxInfoItem aInfoItem(ATTR_BORDER_INNER); + std::shared_ptr<SvxBoxItem> aBoxItem(std::make_shared<SvxBoxItem>(ATTR_BORDER)); + std::shared_ptr<SvxBoxInfoItem> aInfoItem(std::make_shared<SvxBoxInfoItem>(ATTR_BORDER_INNER)); pTabViewShell->GetSelectionFrame(aBoxItem, aInfoItem); - if( aBoxItem.GetTop() ) + if( aBoxItem->GetTop() ) { bCol = true; - aCol = aBoxItem.GetTop()->GetColor() ; + aCol = aBoxItem->GetTop()->GetColor() ; aLine.SetColor(aCol); - aLine.SetWidth( aBoxItem.GetTop()->GetWidth()); - aLine.SetBorderLineStyle( aBoxItem.GetTop()->GetBorderLineStyle()); + aLine.SetWidth( aBoxItem->GetTop()->GetWidth()); + aLine.SetBorderLineStyle( aBoxItem->GetTop()->GetBorderLineStyle()); } - if( aBoxItem.GetBottom() ) + if( aBoxItem->GetBottom() ) { if(!bCol) { bCol = true; - aCol = aBoxItem.GetBottom()->GetColor() ; + aCol = aBoxItem->GetBottom()->GetColor() ; aLine.SetColor(aCol); - aLine.SetWidth( aBoxItem.GetBottom()->GetWidth()); - aLine.SetBorderLineStyle( aBoxItem.GetBottom()->GetBorderLineStyle()); + aLine.SetWidth( aBoxItem->GetBottom()->GetWidth()); + aLine.SetBorderLineStyle( aBoxItem->GetBottom()->GetBorderLineStyle()); } else { - if(aCol != aBoxItem.GetBottom()->GetColor() ) + if(aCol != aBoxItem->GetBottom()->GetColor() ) bColDisable = true; - if( aLine != *aBoxItem.GetBottom() ) + if( aLine != *aBoxItem->GetBottom() ) bStyleDisable = true; } } - if( aBoxItem.GetLeft() ) + if( aBoxItem->GetLeft() ) { if(!bCol) { bCol = true; - aCol = aBoxItem.GetLeft()->GetColor() ; + aCol = aBoxItem->GetLeft()->GetColor() ; aLine.SetColor(aCol); - aLine.SetWidth( aBoxItem.GetLeft()->GetWidth()); - aLine.SetBorderLineStyle( aBoxItem.GetLeft()->GetBorderLineStyle()); + aLine.SetWidth( aBoxItem->GetLeft()->GetWidth()); + aLine.SetBorderLineStyle( aBoxItem->GetLeft()->GetBorderLineStyle()); } else { - if(aCol != aBoxItem.GetLeft()->GetColor() ) + if(aCol != aBoxItem->GetLeft()->GetColor() ) bColDisable = true; - if( aLine != *aBoxItem.GetLeft() ) + if( aLine != *aBoxItem->GetLeft() ) bStyleDisable = true; } } - if( aBoxItem.GetRight() ) + if( aBoxItem->GetRight() ) { if(!bCol) { bCol = true; - aCol = aBoxItem.GetRight()->GetColor() ; + aCol = aBoxItem->GetRight()->GetColor() ; aLine.SetColor(aCol); - aLine.SetWidth( aBoxItem.GetRight()->GetWidth()); - aLine.SetBorderLineStyle( aBoxItem.GetRight()->GetBorderLineStyle()); + aLine.SetWidth( aBoxItem->GetRight()->GetWidth()); + aLine.SetBorderLineStyle( aBoxItem->GetRight()->GetBorderLineStyle()); } else { - if(aCol != aBoxItem.GetRight()->GetColor() ) + if(aCol != aBoxItem->GetRight()->GetColor() ) bColDisable = true; - if( aLine != *aBoxItem.GetRight() ) + if( aLine != *aBoxItem->GetRight() ) bStyleDisable = true; } } - if( aInfoItem.GetVert()) + if( aInfoItem->GetVert()) { if(!bCol) { bCol = true; - aCol = aInfoItem.GetVert()->GetColor() ; + aCol = aInfoItem->GetVert()->GetColor() ; aLine.SetColor(aCol); - aLine.SetWidth( aInfoItem.GetVert()->GetWidth()); - aLine.SetBorderLineStyle( aInfoItem.GetVert()->GetBorderLineStyle()); + aLine.SetWidth( aInfoItem->GetVert()->GetWidth()); + aLine.SetBorderLineStyle( aInfoItem->GetVert()->GetBorderLineStyle()); } else { - if(aCol != aInfoItem.GetVert()->GetColor() ) + if(aCol != aInfoItem->GetVert()->GetColor() ) bColDisable = true; - if( aLine != *aInfoItem.GetVert() ) + if( aLine != *aInfoItem->GetVert() ) bStyleDisable = true; } } - if( aInfoItem.GetHori()) + if( aInfoItem->GetHori()) { if(!bCol) { bCol = true; - aCol = aInfoItem.GetHori()->GetColor() ; + aCol = aInfoItem->GetHori()->GetColor() ; aLine.SetColor(aCol); - aLine.SetWidth( aInfoItem.GetHori()->GetWidth()); - aLine.SetBorderLineStyle( aInfoItem.GetHori()->GetBorderLineStyle()); + aLine.SetWidth( aInfoItem->GetHori()->GetWidth()); + aLine.SetBorderLineStyle( aInfoItem->GetHori()->GetBorderLineStyle()); } else { - if(aCol != aInfoItem.GetHori()->GetColor() ) + if(aCol != aInfoItem->GetHori()->GetColor() ) bColDisable = true; - if( aLine != *aInfoItem.GetHori() ) + if( aLine != *aInfoItem->GetHori() ) bStyleDisable = true; } } - if( !aInfoItem.IsValid( SvxBoxInfoItemValidFlags::VERT ) - || !aInfoItem.IsValid( SvxBoxInfoItemValidFlags::HORI ) - || !aInfoItem.IsValid( SvxBoxInfoItemValidFlags::LEFT ) - || !aInfoItem.IsValid( SvxBoxInfoItemValidFlags::RIGHT ) - || !aInfoItem.IsValid( SvxBoxInfoItemValidFlags::TOP ) - || !aInfoItem.IsValid( SvxBoxInfoItemValidFlags::BOTTOM ) ) + if( !aInfoItem->IsValid( SvxBoxInfoItemValidFlags::VERT ) + || !aInfoItem->IsValid( SvxBoxInfoItemValidFlags::HORI ) + || !aInfoItem->IsValid( SvxBoxInfoItemValidFlags::LEFT ) + || !aInfoItem->IsValid( SvxBoxInfoItemValidFlags::RIGHT ) + || !aInfoItem->IsValid( SvxBoxInfoItemValidFlags::TOP ) + || !aInfoItem->IsValid( SvxBoxInfoItemValidFlags::BOTTOM ) ) { bColDisable = true; bStyleDisable = true; @@ -2414,15 +2414,15 @@ void ScFormatShell::GetTextAttrState( SfxItemSet& rSet ) void ScFormatShell::GetBorderState( SfxItemSet& rSet ) { ScTabViewShell* pTabViewShell = GetViewData()->GetViewShell(); - SvxBoxItem aBoxItem( ATTR_BORDER ); - SvxBoxInfoItem aInfoItem( ATTR_BORDER_INNER ); + std::shared_ptr<SvxBoxItem> aBoxItem(std::make_shared<SvxBoxItem>(ATTR_BORDER)); + std::shared_ptr<SvxBoxInfoItem> aInfoItem(std::make_shared<SvxBoxInfoItem>(ATTR_BORDER_INNER)); pTabViewShell->GetSelectionFrame( aBoxItem, aInfoItem ); if ( rSet.GetItemState( ATTR_BORDER ) != SfxItemState::UNKNOWN ) - rSet.Put( aBoxItem ); + rSet.Put( *aBoxItem ); if ( rSet.GetItemState( ATTR_BORDER_INNER ) != SfxItemState::UNKNOWN ) - rSet.Put( aInfoItem ); + rSet.Put( *aInfoItem ); } void ScFormatShell::GetAlignState( SfxItemSet& rSet ) diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx index f0b0e9fb7149..3aaaaccd4f15 100644 --- a/sc/source/ui/view/output2.cxx +++ b/sc/source/ui/view/output2.cxx @@ -2413,21 +2413,15 @@ void ScOutputData::DrawEditParam::setPatternToEngine(bool bUseStyleColor) const SfxPoolItem* pItem; if ( mpPreviewFontSet->GetItemState( ATTR_FONT, true, &pItem ) == SfxItemState::SET ) { - SvxFontItem aFontItem(EE_CHAR_FONTINFO); - aFontItem = static_cast<const SvxFontItem&>(*pItem); - pSet->Put( aFontItem ); + pSet->Put(*pItem); } if ( mpPreviewFontSet->GetItemState( ATTR_CJK_FONT, true, &pItem ) == SfxItemState::SET ) { - SvxFontItem aCjkFontItem(EE_CHAR_FONTINFO_CJK); - aCjkFontItem = static_cast<const SvxFontItem&>(*pItem); - pSet->Put( aCjkFontItem ); + pSet->Put(*pItem); } if ( mpPreviewFontSet->GetItemState( ATTR_CTL_FONT, true, &pItem ) == SfxItemState::SET ) { - SvxFontItem aCtlFontItem(EE_CHAR_FONTINFO_CTL); - aCtlFontItem = static_cast<const SvxFontItem&>(*pItem); - pSet->Put( aCtlFontItem ); + pSet->Put(*pItem); } } mpEngine->SetDefaults( pSet ); diff --git a/sc/source/ui/view/tabvwsha.cxx b/sc/source/ui/view/tabvwsha.cxx index 0ab20a898e52..fbd9ca9564fd 100644 --- a/sc/source/ui/view/tabvwsha.cxx +++ b/sc/source/ui/view/tabvwsha.cxx @@ -475,8 +475,8 @@ void ScTabViewShell::ExecuteCellFormatDlg(SfxRequest& rReq, const OString &rName { ScDocument* pDoc = GetViewData().GetDocument(); - SvxBoxItem aLineOuter( ATTR_BORDER ); - SvxBoxInfoItem aLineInner( ATTR_BORDER_INNER ); + std::shared_ptr<SvxBoxItem> aLineOuter(std::make_shared<SvxBoxItem>(ATTR_BORDER)); + std::shared_ptr<SvxBoxInfoItem> aLineInner(std::make_shared<SvxBoxInfoItem>(ATTR_BORDER_INNER)); const ScPatternAttr* pOldAttrs = GetSelectionPattern(); @@ -506,26 +506,29 @@ void ScTabViewShell::ExecuteCellFormatDlg(SfxRequest& rReq, const OString &rName // Get border items and put them in the set: GetSelectionFrame( aLineOuter, aLineInner ); + //Fix border incorrect for RTL fdo#62399 if( pDoc->IsLayoutRTL( GetViewData().GetTabNo() ) ) { - SvxBoxItem aNewFrame( aLineOuter ); - SvxBoxInfoItem aTempInfo( aLineInner ); + std::shared_ptr<SvxBoxItem> aNewFrame(static_cast<SvxBoxItem*>(aLineOuter->Clone())); + std::shared_ptr<SvxBoxInfoItem> aTempInfo(static_cast<SvxBoxInfoItem*>(aLineInner->Clone())); - if ( aLineInner.IsValid(SvxBoxInfoItemValidFlags::LEFT) ) - aNewFrame.SetLine( aLineOuter.GetLeft(), SvxBoxItemLine::RIGHT ); - if ( aLineInner.IsValid(SvxBoxInfoItemValidFlags::RIGHT) ) - aNewFrame.SetLine( aLineOuter.GetRight(), SvxBoxItemLine::LEFT ); + if ( aLineInner->IsValid(SvxBoxInfoItemValidFlags::LEFT) ) + aNewFrame->SetLine( aLineOuter->GetLeft(), SvxBoxItemLine::RIGHT ); + if ( aLineInner->IsValid(SvxBoxInfoItemValidFlags::RIGHT) ) + aNewFrame->SetLine( aLineOuter->GetRight(), SvxBoxItemLine::LEFT ); - aLineInner.SetValid( SvxBoxInfoItemValidFlags::LEFT, aTempInfo.IsValid(SvxBoxInfoItemValidFlags::RIGHT)); - aLineInner.SetValid( SvxBoxInfoItemValidFlags::RIGHT, aTempInfo.IsValid(SvxBoxInfoItemValidFlags::LEFT)); + aLineInner->SetValid( SvxBoxInfoItemValidFlags::LEFT, aTempInfo->IsValid(SvxBoxInfoItemValidFlags::RIGHT)); + aLineInner->SetValid( SvxBoxInfoItemValidFlags::RIGHT, aTempInfo->IsValid(SvxBoxInfoItemValidFlags::LEFT)); - pOldSet->Put( aNewFrame ); + pOldSet->Put( *aNewFrame ); } else - pOldSet->Put( aLineOuter ); + { + pOldSet->Put( *aLineOuter ); + } - pOldSet->Put( aLineInner ); + pOldSet->Put( *aLineInner ); // Generate NumberFormat Value from Value and Language and box it. pOldSet->Put( SfxUInt32Item( ATTR_VALUE_FORMAT, diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx index 96b57048f6b2..bc8a0551417f 100644 --- a/sc/source/ui/view/viewfun2.cxx +++ b/sc/source/ui/view/viewfun2.cxx @@ -2683,7 +2683,7 @@ void ScViewFunc::MoveTable( // execute without SfxCallMode::RECORD, because already contained in move command SfxStringItem aItem( SID_FILE_NAME, "private:factory/" STRING_SCAPP ); - SfxStringItem aTarget( SID_TARGETNAME, OUString("_blank") ); + SfxStringItem aTarget( SID_TARGETNAME, "_blank" ); const SfxPoolItem* pRetItem = GetViewData().GetDispatcher().ExecuteList( SID_OPENDOC, SfxCallMode::API|SfxCallMode::SYNCHRON, diff --git a/sc/source/ui/view/viewfun4.cxx b/sc/source/ui/view/viewfun4.cxx index 938571650805..7c34c1b549af 100644 --- a/sc/source/ui/view/viewfun4.cxx +++ b/sc/source/ui/view/viewfun4.cxx @@ -619,7 +619,7 @@ bool ScViewFunc::PasteFile( const Point& rPos, const OUString& rFile, bool bLink SfxStringItem aFileNameItem( SID_FILE_NAME, aStrURL ); SfxStringItem aFilterItem( SID_FILTER_NAME, pFlt->GetName() ); // #i69524# add target, as in SfxApplication when the Open dialog is used - SfxStringItem aTargetItem( SID_TARGETNAME, OUString("_default") ); + SfxStringItem aTargetItem( SID_TARGETNAME, "_default" ); // Open Asynchronously, because it can also happen from D&D // and that is not so good for the MAC... diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx index 9fa34128fedc..894259de285b 100644 --- a/sc/source/ui/view/viewfunc.cxx +++ b/sc/source/ui/view/viewfunc.cxx @@ -851,14 +851,17 @@ const ScPatternAttr* ScViewFunc::GetSelectionPattern() } } -void ScViewFunc::GetSelectionFrame( SvxBoxItem& rLineOuter, - SvxBoxInfoItem& rLineInner ) +void ScViewFunc::GetSelectionFrame( + std::shared_ptr<SvxBoxItem>& rLineOuter, + std::shared_ptr<SvxBoxInfoItem>& rLineInner ) { ScDocument* pDoc = GetViewData().GetDocument(); const ScMarkData& rMark = GetViewData().GetMarkData(); if ( rMark.IsMarked() || rMark.IsMultiMarked() ) - pDoc->GetSelectionFrame( rMark, rLineOuter, rLineInner ); + { + pDoc->GetSelectionFrame( rMark, *rLineOuter, *rLineInner ); + } else { const ScPatternAttr* pAttrs = @@ -866,11 +869,12 @@ void ScViewFunc::GetSelectionFrame( SvxBoxItem& rLineOuter, GetViewData().GetCurY(), GetViewData().GetTabNo() ); - rLineOuter = pAttrs->GetItem( ATTR_BORDER ); - rLineInner = pAttrs->GetItem( ATTR_BORDER_INNER ); - rLineInner.SetTable(false); - rLineInner.SetDist(true); - rLineInner.SetMinDist(false); + rLineOuter.reset(static_cast<SvxBoxItem*>(pAttrs->GetItem(ATTR_BORDER).Clone())); + rLineInner.reset(static_cast<SvxBoxInfoItem*>(pAttrs->GetItem(ATTR_BORDER_INNER).Clone())); + + rLineInner->SetTable(false); + rLineInner->SetDist(true); + rLineInner->SetMinDist(false); } } |