diff options
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/attrib.hxx | 1 | ||||
-rw-r--r-- | sc/inc/autoform.hxx | 141 | ||||
-rw-r--r-- | sc/qa/unit/subsequent_filters-test.cxx | 2 | ||||
-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 |
17 files changed, 219 insertions, 528 deletions
diff --git a/sc/inc/attrib.hxx b/sc/inc/attrib.hxx index cecc587c8df3..37340e786fe2 100644 --- a/sc/inc/attrib.hxx +++ b/sc/inc/attrib.hxx @@ -207,7 +207,6 @@ public: virtual sal_uInt16 GetValueCount() const override; virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const override; - virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const override; virtual bool GetPresentation( SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, diff --git a/sc/inc/autoform.hxx b/sc/inc/autoform.hxx index 8982cbd17400..b9279eef5965 100644 --- a/sc/inc/autoform.hxx +++ b/sc/inc/autoform.hxx @@ -46,6 +46,7 @@ #include <editeng/wghtitem.hxx> #include <editeng/justifyitem.hxx> #include <svx/rotmodit.hxx> +#include <svx/autoformathelper.hxx> #include <svl/intitem.hxx> #include <editeng/lineitem.hxx> #include "scdllapi.h" @@ -86,155 +87,37 @@ struct AutoFormatSwBlob }; /// Struct with version numbers of the Items -struct ScAfVersions +struct ScAfVersions : 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; AutoFormatSwBlob swVersions; - sal_uInt16 nHorJustifyVersion; - sal_uInt16 nVerJustifyVersion; - sal_uInt16 nOrientationVersion; - sal_uInt16 nMarginVersion; - sal_uInt16 nBoolVersion; - sal_uInt16 nInt32Version; - sal_uInt16 nRotateModeVersion; - - sal_uInt16 nNumFmtVersion; - ScAfVersions(); + void Load( SvStream& rStream, sal_uInt16 nVer ); void Write(SvStream& rStream, sal_uInt16 fileVersion); }; /// Contains all items for one cell of a table autoformat. -class ScAutoFormatDataField +class ScAutoFormatDataField : public AutoFormatBase { private: - SvxFontItem aFont; - SvxFontHeightItem aHeight; - SvxWeightItem aWeight; - SvxPostureItem aPosture; - - SvxFontItem aCJKFont; - SvxFontHeightItem aCJKHeight; - SvxWeightItem aCJKWeight; - SvxPostureItem aCJKPosture; - - SvxFontItem aCTLFont; - SvxFontHeightItem aCTLHeight; - SvxWeightItem aCTLWeight; - SvxPostureItem aCTLPosture; - - SvxUnderlineItem aUnderline; - SvxOverlineItem aOverline; - SvxCrossedOutItem aCrossedOut; - SvxContourItem aContour; - SvxShadowedItem aShadowed; - SvxColorItem aColor; - SvxBoxItem aBox; - SvxLineItem aTLBR; - SvxLineItem aBLTR; - SvxBrushItem aBackground; - - // Writer specific - SvxAdjustItem aAdjust; - AutoFormatSwBlob m_swFields; - - // Calc specific - SvxHorJustifyItem aHorJustify; - SvxVerJustifyItem aVerJustify; - SfxBoolItem aStacked; - SvxMarginItem aMargin; - SfxBoolItem aLinebreak; - // from SO5, 504k on, rotated text - SfxInt32Item aRotateAngle; - SvxRotateModeItem aRotateMode; + AutoFormatSwBlob m_swFields; // number format - ScNumFormatAbbrev aNumFormat; + ScNumFormatAbbrev aNumFormat; public: - ScAutoFormatDataField(); - ScAutoFormatDataField( const ScAutoFormatDataField& rCopy ); - ~ScAutoFormatDataField(); + ScAutoFormatDataField(); + ScAutoFormatDataField( const ScAutoFormatDataField& rCopy ); + ~ScAutoFormatDataField(); + const AutoFormatSwBlob& GetAutoFormatSwBlob() const { return m_swFields; } + // number format const ScNumFormatAbbrev& GetNumFormat() const { return aNumFormat; } - const SvxFontItem& GetFont() const { return aFont; } - const SvxFontHeightItem& GetHeight() const { return aHeight; } - const SvxWeightItem& GetWeight() const { return aWeight; } - const SvxPostureItem& GetPosture() const { return aPosture; } - const SvxFontItem& GetCJKFont() const { return aCJKFont; } - const SvxFontHeightItem& GetCJKHeight() const { return aCJKHeight; } - const SvxWeightItem& GetCJKWeight() const { return aCJKWeight; } - const SvxPostureItem& GetCJKPosture() const { return aCJKPosture; } - const SvxFontItem& GetCTLFont() const { return aCTLFont; } - const SvxFontHeightItem& GetCTLHeight() const { return aCTLHeight; } - const SvxWeightItem& GetCTLWeight() const { return aCTLWeight; } - const SvxPostureItem& GetCTLPosture() const { return aCTLPosture; } - const SvxUnderlineItem& GetUnderline() const { return aUnderline; } - const SvxOverlineItem& GetOverline() const { return aOverline; } - const SvxCrossedOutItem& GetCrossedOut() const { return aCrossedOut; } - const SvxContourItem& GetContour() const { return aContour; } - const SvxShadowedItem& GetShadowed() const { return aShadowed; } - const SvxColorItem& GetColor() const { return aColor; } - const SvxHorJustifyItem& GetHorJustify() const { return aHorJustify; } - const SvxVerJustifyItem& GetVerJustify() const { return aVerJustify; } - const SfxBoolItem& GetStacked() const { return aStacked; } - const SfxBoolItem& GetLinebreak() const { return aLinebreak; } - const SvxMarginItem& GetMargin() const { return aMargin; } - const SvxBoxItem& GetBox() const { return aBox; } - const SvxLineItem& GetTLBR() const { return aTLBR; } - const SvxLineItem& GetBLTR() const { return aBLTR; } - const SvxBrushItem& GetBackground() const { return aBackground; } - const SfxInt32Item& GetRotateAngle() const { return aRotateAngle; } - const SvxRotateModeItem& GetRotateMode() const { return aRotateMode; } + // number format void SetNumFormat( const ScNumFormatAbbrev& rNumFormat ) { aNumFormat = rNumFormat; } - void SetFont( const SvxFontItem& rFont ) { aFont = rFont; } - void SetHeight( const SvxFontHeightItem& rHeight ) { aHeight = rHeight; } - void SetWeight( const SvxWeightItem& rWeight ) { aWeight = rWeight; } - void SetPosture( const SvxPostureItem& rPosture ) { aPosture = rPosture; } - void SetCJKFont( const SvxFontItem& rCJKFont ) { aCJKFont = rCJKFont; } - void SetCJKHeight( const SvxFontHeightItem& rCJKHeight ) { aCJKHeight = rCJKHeight; } - void SetCJKWeight( const SvxWeightItem& rCJKWeight ) { aCJKWeight = rCJKWeight; } - void SetCJKPosture( const SvxPostureItem& rCJKPosture ) { aCJKPosture = rCJKPosture; } - void SetCTLFont( const SvxFontItem& rCTLFont ) { aCTLFont = rCTLFont; } - void SetCTLHeight( const SvxFontHeightItem& rCTLHeight ) { aCTLHeight = rCTLHeight; } - void SetCTLWeight( const SvxWeightItem& rCTLWeight ) { aCTLWeight = rCTLWeight; } - void SetCTLPosture( const SvxPostureItem& rCTLPosture ) { aCTLPosture = rCTLPosture; } - void SetUnderline( const SvxUnderlineItem& rUnderline ) { aUnderline = rUnderline; } - void SetOverline( const SvxOverlineItem& rOverline ) { aOverline = rOverline; } - void SetCrossedOut( const SvxCrossedOutItem& rCrossedOut ) { aCrossedOut = rCrossedOut; } - void SetContour( const SvxContourItem& rContour ) { aContour = rContour; } - void SetShadowed( const SvxShadowedItem& rShadowed ) { aShadowed = rShadowed; } - void SetColor( const SvxColorItem& rColor ) { aColor = rColor; } - void SetHorJustify( const SvxHorJustifyItem& rHorJustify ) { aHorJustify = rHorJustify; } - void SetVerJustify( const SvxVerJustifyItem& rVerJustify ) { aVerJustify = rVerJustify; } - void SetStacked( const SfxBoolItem& rStacked ) { aStacked.SetValue( rStacked.GetValue() ); } - void SetLinebreak( const SfxBoolItem& rLinebreak ) { aLinebreak.SetValue( rLinebreak.GetValue() ); } - void SetMargin( const SvxMarginItem& rMargin ) { aMargin = rMargin; } - void SetBox( const SvxBoxItem& rBox ) { aBox = rBox; } - void SetTLBR( const SvxLineItem& rTLBR ) { aTLBR = rTLBR; } - void SetBLTR( const SvxLineItem& rBLTR ) { aBLTR = rBLTR; } - void SetBackground( const SvxBrushItem& rBackground ) { aBackground = rBackground; } - void SetAdjust( const SvxAdjustItem& rAdjust ); - void SetRotateAngle( const SfxInt32Item& rRotateAngle ) { aRotateAngle.SetValue( rRotateAngle.GetValue() ); } - void SetRotateMode( const SvxRotateModeItem& rRotateMode ) { aRotateMode.SetValue( rRotateMode.GetValue() ); } bool Load( SvStream& rStream, const ScAfVersions& rVersions, sal_uInt16 nVer ); bool Save( SvStream& rStream, sal_uInt16 fileVersion ); diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index f4d579504a3c..578ff72435d2 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -1629,7 +1629,7 @@ void ScFiltersTest::testPassword_Impl(const OUString& aFileNameBase) ScDocShellRef xDocSh = new ScDocShell; SfxMedium* pMedium = new SfxMedium(aFileName, StreamMode::STD_READWRITE); SfxItemSet* pSet = pMedium->GetItemSet(); - pSet->Put(SfxStringItem(SID_PASSWORD, OUString("test"))); + pSet->Put(SfxStringItem(SID_PASSWORD, "test")); pMedium->SetFilter(pFilter); if (!xDocSh->DoLoad(pMedium)) { 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); } } |